@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
228 lines (226 loc) • 9.06 kB
TypeScript
import { HostClientType } from './constants';
import { HostVersionsInfo } from './interfaces';
export interface IBaseRuntime {
readonly apiVersion: number;
readonly hostVersionsInfo?: HostVersionsInfo;
readonly isLegacyTeams?: boolean;
readonly supports?: {};
}
/**
* Latest runtime interface version
*/
export type Runtime = IRuntimeV4;
export declare const latestRuntimeApiVersion = 4;
interface IRuntimeV4 extends IBaseRuntime {
readonly apiVersion: 4;
readonly hostVersionsInfo?: HostVersionsInfo;
readonly isNAAChannelRecommended?: boolean;
readonly canParentManageNAATrustedOrigins?: boolean;
readonly isDeeplyNestedAuthSupported?: boolean;
readonly isLegacyTeams?: boolean;
readonly supports: {
readonly app?: {
readonly notifySuccessResponse?: {};
};
readonly appEntity?: {};
readonly appInstallDialog?: {};
readonly appPerformanceMetrics?: {};
readonly barCode?: {};
readonly calendar?: {};
readonly call?: {};
readonly chat?: {};
readonly clipboard?: {};
readonly conversations?: {};
readonly copilot?: {
readonly customTelemetry?: {};
readonly eligibility?: {};
readonly sidePanel?: {};
readonly view?: {};
};
readonly dialog?: {
readonly card?: {
readonly bot?: {};
};
readonly url?: {
readonly bot?: {};
readonly parentCommunication?: {};
};
readonly update?: {};
};
readonly externalAppAuthentication?: {};
readonly externalAppAuthenticationForCEA?: {};
readonly externalAppCardActions?: {};
readonly externalAppCardActionsForCEA?: {};
readonly externalAppCardActionsForDA?: {};
readonly externalAppCommands?: {};
readonly geoLocation?: {
readonly map?: {};
};
readonly hostEntity?: {
readonly tab?: {};
};
readonly interactive?: {};
readonly secondaryBrowser?: {};
readonly location?: {};
readonly logs?: {};
readonly mail?: {
readonly handoff?: {};
};
readonly marketplace?: {};
readonly meetingRoom?: {};
readonly menus?: {};
readonly messageChannels?: {
readonly telemetry?: {};
readonly dataLayer?: {};
};
readonly monetization?: {};
readonly nestedAppAuth?: {};
readonly notifications?: {};
readonly otherAppStateChange?: {};
readonly pages?: {
readonly appButton?: {};
readonly backStack?: {};
readonly config?: {};
readonly currentApp?: {};
readonly fullTrust?: {};
readonly tabs?: {};
};
readonly people?: {};
readonly permissions?: {};
readonly profile?: {};
readonly remoteCamera?: {};
readonly search?: {};
readonly sharing?: {
readonly history?: {};
};
readonly shortcutRelay?: {};
readonly stageView?: {
readonly self?: {};
};
readonly store?: {};
readonly teams?: {
readonly fullTrust?: {
readonly joinedTeams?: {};
};
};
readonly thirdPartyCloudStorage?: {};
readonly teamsCore?: {};
readonly video?: {
readonly mediaStream?: {};
readonly sharedFrame?: {};
};
readonly visualMedia?: {
readonly image?: {};
};
readonly webStorage?: {};
readonly widgetHosting?: {};
};
}
interface UninitializedRuntime extends IBaseRuntime {
readonly apiVersion: -1;
readonly supports: {};
}
/**
* @hidden
* Ensures that the runtime has been initialized
* @returns True if the runtime has been initialized
* @throws Error if the runtime has not been initialized
*
* @internal
* Limited to Microsoft-internal use
*/
export declare function isRuntimeInitialized(runtime: IBaseRuntime): runtime is Runtime;
export declare let runtime: Runtime | UninitializedRuntime;
/**
* This object is used as the default runtime for versions of Teams which don't pass a runtime object during
* initialization. If the host DOES pass a runtime object during init, then this object is not used.
*
* In practice, this is used in Teams V1 and ALL versions of Teams mobile since they are the only hosts
* that don't pass a runtime object during initialization (since they don't use the host SDK).
*
* If there are certain versions of Teams V1 or Teams mobile which support a capability but not ALL
* versions, then you should modify the mapTeamsVersionToSupportedCapabilities structure for that purpose. That
* structure allows you to specify particular versions on particular platforms that support certain capabilities.
* This structure is version agnostic.
*
* In practice, if you are adding a new capability, you are likely only to need to update mapTeamsVersionToSupportedCapabilities
* and NOT this structure, as this structure is effectively only used for capabilities that have existed "forever."
*
* Remember that everything here all still ONLY applies to versions of Teams that don't pass a runtime object during
* initialization -- if they do, then neither this object nor the mapTeamsVersionToSupportedCapabilities structure is
* used -- all runtime capabilities are dynamically discovered at runtime in the case where the runtime object is passed
* during initialization.
*/
export declare const versionAndPlatformAgnosticTeamsRuntimeConfig: Runtime;
export interface ICapabilityReqs {
readonly capability: object;
readonly hostClientTypes: Array<string>;
}
export declare const v1MobileHostClientTypes: HostClientType[];
export declare const v1HostClientTypes: HostClientType[];
/**
* @hidden
* `upgradeToNextVersion` transforms runtime of version `versionToUpgradeFrom` to the next higher version
*
* @internal
* Limited to Microsoft-internal use
*/
interface IRuntimeUpgrade {
versionToUpgradeFrom: number;
upgradeToNextVersion: (previousVersionRuntime: IBaseRuntime) => IBaseRuntime;
}
/**
* @hidden
* Uses upgradeChain to transform an outdated runtime object to the latest format.
* @param outdatedRuntime - The runtime object to be upgraded
* @returns The upgraded runtime object
* @throws Error if the runtime object could not be upgraded to the latest version
*
* @internal
* Limited to Microsoft-internal use
*/
export declare function fastForwardRuntime(outdatedRuntime: IBaseRuntime): Runtime;
/**
* @hidden
* List of transformations required to upgrade a runtime object from a previous version to the next higher version.
* This list must be ordered from lowest version to highest version
*
* @internal
* Limited to Microsoft-internal use
*/
export declare const upgradeChain: IRuntimeUpgrade[];
/**
* This version is for legacy Teams mobile clients that don’t pass a runtime object during initialization.
* It’s the minimum version required to support deeply nested app auth.
*/
export declare const legacyTeamsMobileVersionForDeeplyNestedAuth = "2.1.2";
/**
* This structure is used for versions of Teams that don't pass a runtime object during initialization.
* Please see the extensive comments in versionAndPlatformAgnosticTeamsRuntimeConfig for more information
* on when and how to use this structure.
*/
export declare const mapTeamsVersionToSupportedCapabilities: Record<string, Array<ICapabilityReqs>>;
/**
* @internal
* Limited to Microsoft-internal use
*
* Generates and returns a runtime configuration for host clients which are not on the latest host SDK version
* and do not provide their own runtime config (this is just older versions of Teams on some platforms).
* Their supported capabilities are based on the highest client SDK version that they can support.
*
* @param highestSupportedVersion - The highest client SDK version that the host client can support.
* @returns runtime which describes the APIs supported by the legacy host client.
*/
export declare function generateVersionBasedTeamsRuntimeConfig(highestSupportedVersion: string, versionAgnosticRuntimeConfig: Runtime, mapVersionToSupportedCapabilities: Record<string, Array<ICapabilityReqs>>): Runtime;
export declare function applyRuntimeConfig(runtimeConfig: IBaseRuntime): void;
export declare function setUnitializedRuntime(): void;
/**
* @hidden
* Constant used to set minimum runtime configuration
* while un-initializing an app in unit test case.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare const _minRuntimeConfigToUninitialize: Runtime;
export {};