@microsoft/teams-js 2.50.0 → 2.51.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/packages/teams-js/dts/internal/responseHandler.d.ts +3 -1
- package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +3 -0
- package/dist/esm/packages/teams-js/dts/private/index.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/private/plugins.d.ts +94 -0
- package/dist/esm/packages/teams-js/dts/private/privateAPIs.d.ts +35 -0
- package/dist/esm/packages/teams-js/dts/public/index.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/public/interfaces.d.ts +12 -0
- package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +1 -0
- package/dist/esm/packages/teams-js/src/index.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/internalAPIs.js +1 -1
- package/dist/esm/packages/teams-js/src/private/plugins.js +1 -0
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +168 -3
- package/dist/umd/MicrosoftTeams.js.map +1 -1
- package/dist/umd/MicrosoftTeams.min.js +1 -1
- package/dist/umd/MicrosoftTeams.min.js.map +1 -1
- package/package.json +1 -53
|
@@ -20,7 +20,9 @@ export declare abstract class ResponseHandler<SerializedReturnValueFromHost, Des
|
|
|
20
20
|
*/
|
|
21
21
|
abstract deserialize(response: SerializedReturnValueFromHost): DeserializedReturnValueFromHost;
|
|
22
22
|
}
|
|
23
|
-
export type SimpleType = string | number | boolean | null | undefined | SimpleType[]
|
|
23
|
+
export type SimpleType = string | number | boolean | null | undefined | SimpleType[] | {
|
|
24
|
+
[key: string]: SimpleType;
|
|
25
|
+
};
|
|
24
26
|
/**
|
|
25
27
|
* This class is used for validating and deserializing boolean responses from the host.
|
|
26
28
|
*/
|
|
@@ -47,6 +47,7 @@ export declare const enum ApiName {
|
|
|
47
47
|
App_NotifySuccess = "app.notifySuccess",
|
|
48
48
|
App_OpenLink = "app.openLink",
|
|
49
49
|
App_RegisterOnThemeChangeHandler = "app.registerOnThemeChangeHandler",
|
|
50
|
+
App_RegisterOnPromptHandler = "app.registerOnPromptHandler",
|
|
50
51
|
App_RegisterOnContextChangeHandler = "app.registerOnContextChangeHandler",
|
|
51
52
|
AppInitialization_NotifyAppLoaded = "appInitialization.notifyAppLoaded",
|
|
52
53
|
AppInitialization_NotifyExpectedFailure = "appInitialization.notifyExpectedFailure",
|
|
@@ -264,6 +265,8 @@ export declare const enum ApiName {
|
|
|
264
265
|
PrivateAPIs_RegisterUserSettingsChangeHandler = "registerUserSettingsChangeHandler",
|
|
265
266
|
PrivateAPIs_SendCustomMessage = "sendCustomMessage",
|
|
266
267
|
PrivateAPIs_UploadCustomApp = "uploadCustomApp",
|
|
268
|
+
Plugins_ReceiveMessage = "plugins.receiveMessage",
|
|
269
|
+
Plugins_SendMessage = "plugins.sendMessage",
|
|
267
270
|
Profile_ShowProfile = "profile.showProfile",
|
|
268
271
|
PublicAPIs_ExecuteDeepLink = "executeDeepLink",
|
|
269
272
|
PublicAPIs_GetContext = "getContext",
|
|
@@ -18,6 +18,7 @@ export * as messageChannels from './messageChannels/messageChannels';
|
|
|
18
18
|
export * as nestedAppAuthBridge from './nestedAppAuth/nestedAppAuthBridge';
|
|
19
19
|
export * as notifications from './notifications';
|
|
20
20
|
export * as otherAppStateChange from './otherAppStateChange';
|
|
21
|
+
export * as plugins from './plugins';
|
|
21
22
|
export * as remoteCamera from './remoteCamera';
|
|
22
23
|
export * as appEntity from './appEntity';
|
|
23
24
|
export * as teams from './teams/teams';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { SimpleType } from '../internal/responseHandler';
|
|
2
|
+
/**
|
|
3
|
+
* The type of arguments that can be passed in a {@link PluginMessage}.
|
|
4
|
+
*
|
|
5
|
+
* @hidden
|
|
6
|
+
* @internal
|
|
7
|
+
* Limited to Microsoft-internal use
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export type PluginMessageArg = SimpleType;
|
|
11
|
+
/**
|
|
12
|
+
* Indicates whether the plugin capability is available in the current host.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This API validates SDK initialization and then checks runtime capability flags
|
|
16
|
+
* for `supports.plugins`.
|
|
17
|
+
*
|
|
18
|
+
* @returns `true` if the host reports plugin support; otherwise `false`.
|
|
19
|
+
*
|
|
20
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
* @internal
|
|
24
|
+
* Limited to Microsoft-internal use
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export declare function isSupported(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Canonical message envelope used for plugin send/receive operations.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Messages are used to communicate between plugin and host.
|
|
33
|
+
*
|
|
34
|
+
* @property func - Function/event name for the message.
|
|
35
|
+
* @property args - Optional JSON payload.
|
|
36
|
+
* @property correlationId - Optional ID for request/response correlation.
|
|
37
|
+
*
|
|
38
|
+
* @hidden
|
|
39
|
+
* @internal
|
|
40
|
+
* Limited to Microsoft-internal use
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export type PluginMessage = {
|
|
44
|
+
func: string;
|
|
45
|
+
args?: PluginMessageArg;
|
|
46
|
+
correlationId?: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Sends a plugin message to the host.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The message payload is serialized before transmission to the host.
|
|
53
|
+
* All payload data must be JSON-safe (see {@link JsonValue}).
|
|
54
|
+
*
|
|
55
|
+
* @returns A promise that resolves when the host acknowledges the message.
|
|
56
|
+
*
|
|
57
|
+
* @throws Error if SDK initialization has not completed, if the host returns
|
|
58
|
+
* an error response, or if `func` is missing.
|
|
59
|
+
*
|
|
60
|
+
* @hidden
|
|
61
|
+
* @internal
|
|
62
|
+
* Limited to Microsoft-internal use
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
65
|
+
export declare function sendPluginMessage(message: PluginMessage): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Handler signature for incoming plugin messages.
|
|
68
|
+
*
|
|
69
|
+
* @param message - Normalized plugin message envelope.
|
|
70
|
+
*
|
|
71
|
+
* @hidden
|
|
72
|
+
* @internal
|
|
73
|
+
* Limited to Microsoft-internal use
|
|
74
|
+
* @beta
|
|
75
|
+
*/
|
|
76
|
+
export type ReceiveMessageHandler = (message: PluginMessage) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Registers a handler to receive plugin messages from the host.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* This API registers the callback under the `plugin.receiveMessage` handler name.
|
|
82
|
+
* When the host dispatches a plugin message, the supplied handler is invoked with
|
|
83
|
+
* the received JSON payload.
|
|
84
|
+
*
|
|
85
|
+
* @param handler - Callback invoked for each incoming plugin message payload.
|
|
86
|
+
*
|
|
87
|
+
* @throws Error if plugin messaging is not supported by the current host.
|
|
88
|
+
*
|
|
89
|
+
* @hidden
|
|
90
|
+
* @internal
|
|
91
|
+
* Limited to Microsoft-internal use
|
|
92
|
+
* @beta
|
|
93
|
+
*/
|
|
94
|
+
export declare function registerPluginMessage(handler: ReceiveMessageHandler): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FilePreviewParameters, UserSettingTypes } from './interfaces';
|
|
2
2
|
export declare function uploadCustomApp(manifestBlob: Blob, onComplete?: (status: boolean, reason?: string) => void): void;
|
|
3
3
|
/**
|
|
4
|
+
* @deprecated Use {@link plugins.sendPluginMessage} with {@link plugins.registerPluginMessage} and a correlationId-based response pattern.
|
|
5
|
+
*
|
|
4
6
|
* @hidden
|
|
5
7
|
* Sends a custom action MessageRequest to host or parent window
|
|
6
8
|
*
|
|
@@ -9,6 +11,39 @@ export declare function uploadCustomApp(manifestBlob: Blob, onComplete?: (status
|
|
|
9
11
|
* @param callback - Optionally specify a callback to receive response parameters from the parent
|
|
10
12
|
* @returns id of sent message
|
|
11
13
|
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Prefer the plugin event model for new development. In that model, send a request message
|
|
16
|
+
* with a unique `correlationId` and listen for a response event with the same `correlationId`.
|
|
17
|
+
*
|
|
18
|
+
* Example:
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Request side
|
|
21
|
+
* const correlationId = crypto.randomUUID();
|
|
22
|
+
*
|
|
23
|
+
* plugins.registerPluginMessage((message) => {
|
|
24
|
+
* if (message.func !== 'example.customAction.response') {
|
|
25
|
+
* return;
|
|
26
|
+
* }
|
|
27
|
+
* if (message.correlationId !== correlationId) {
|
|
28
|
+
* return;
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* // This is the response for the request above.
|
|
32
|
+
* const response = message.args;
|
|
33
|
+
* console.log('Received response', response);
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* await plugins.sendPluginMessage({
|
|
37
|
+
* func: 'example.customAction.request',
|
|
38
|
+
* args: { itemId: '12345' },
|
|
39
|
+
* correlationId,
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Host side contract example (conceptual):
|
|
43
|
+
* // On receiving example.customAction.request, send back
|
|
44
|
+
* // example.customAction.response with the same correlationId.
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
12
47
|
* @internal
|
|
13
48
|
* Limited to Microsoft-internal use
|
|
14
49
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as authentication from './authentication';
|
|
2
2
|
export { ChannelType, DialogDimension, FrameContexts, HostClientType, HostName, RenderingSurfaces, TaskModuleDimension, TeamType, UserTeamRole, } from './constants';
|
|
3
|
-
export { ActionInfo, ActionObjectType, AdaptiveCardVersion, AdaptiveCardDialogInfo, BaseActionObject, BotAdaptiveCardDialogInfo, BotUrlDialogInfo, Context, DeepLinkParameters, DialogInfo, DialogSize, EduType, ErrorCode, FileOpenPreference, FrameContext, FrameInfo, HostMemoryMetrics, HostToAppFrameMemoryMetrics, HostToAppPerformanceMetrics, LoadContext, LocaleInfo, M365ContentAction, ResumeContext, SdkError, SecondaryId, SecondaryM365ContentIdName, ShareDeepLinkParameters, TabInformation, TabInstance, TabInstanceParameters, TaskInfo, TeamInformation, UrlDialogInfo, } from './interfaces';
|
|
3
|
+
export { ActionInfo, ActionObjectType, AdaptiveCardVersion, AdaptiveCardDialogInfo, AppState, BaseActionObject, BotAdaptiveCardDialogInfo, BotUrlDialogInfo, Context, DeepLinkParameters, DialogInfo, DialogSize, EduType, ErrorCode, FileOpenPreference, FrameContext, FrameInfo, HostMemoryMetrics, HostToAppFrameMemoryMetrics, HostToAppPerformanceMetrics, LoadContext, LocaleInfo, M365ContentAction, ResumeContext, SdkError, SecondaryId, SecondaryM365ContentIdName, ShareDeepLinkParameters, TabInformation, TabInstance, TabInstanceParameters, TaskInfo, TeamInformation, UrlDialogInfo, } from './interfaces';
|
|
4
4
|
export * as app from './app/app';
|
|
5
5
|
export { AppId } from './appId';
|
|
6
6
|
export * as appPerformanceMetrics from './appPerformanceMetrics';
|
|
@@ -1271,15 +1271,27 @@ export type HostToAppFrameMemoryMetrics = {
|
|
|
1271
1271
|
*/
|
|
1272
1272
|
treeLevel: number;
|
|
1273
1273
|
};
|
|
1274
|
+
/**
|
|
1275
|
+
* The state of the app in terms of its lifecycle and caching status, which can impact its performance characteristics and memory usage.
|
|
1276
|
+
*/
|
|
1277
|
+
export type AppState = 'cached' | 'precached' | 'active';
|
|
1274
1278
|
/**
|
|
1275
1279
|
* Memory metrics provided by the host for the app.
|
|
1276
1280
|
*/
|
|
1277
1281
|
export type HostMemoryMetrics = {
|
|
1278
1282
|
/**
|
|
1283
|
+
* The current state of the app, which can be 'cached', 'precached', or 'active'. This provides insight into the app's lifecycle stage and can help developers understand the performance characteristics and memory usage of their app in different states.
|
|
1284
|
+
*/
|
|
1285
|
+
appState: AppState;
|
|
1286
|
+
/**
|
|
1287
|
+
* @deprecated - Use `appState` instead.
|
|
1288
|
+
*
|
|
1279
1289
|
* Indicates if the app is in a hidden state to accelerate future launches.
|
|
1280
1290
|
*/
|
|
1281
1291
|
isCached: boolean;
|
|
1282
1292
|
/**
|
|
1293
|
+
* @deprecated - Use `appState` instead.
|
|
1294
|
+
*
|
|
1283
1295
|
* Indicates if the app is in a preloaded state to accelerate its first launch in the session.
|
|
1284
1296
|
*/
|
|
1285
1297
|
isPrecached: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{NotificationTypes,UserSettingTypes,ViewerActionTypes}from"./private/interfaces.js";export{openFilePreview,registerCustomHandler,registerUserSettingsChangeHandler,sendCustomEvent,sendCustomMessage,uploadCustomApp}from"./private/privateAPIs.js";import*as e from"./private/externalAppAuthentication.js";export{e as externalAppAuthentication};export{UserAuthenticationState}from"./private/externalAppAuthentication.js";import*as r from"./private/logs.js";export{r as logs};import*as t from"./private/conversations.js";export{t as conversations};import*as o from"./private/copilot/copilot.js";export{o as copilot};import*as p from"./private/copilot/sidePanelInterfaces.js";export{p as sidePanelInterfaces};import*as i from"./private/externalAppAuthenticationForCEA.js";export{i as externalAppAuthenticationForCEA};import*as a from"./private/externalAppCardActions.js";export{a as externalAppCardActions};import*as s from"./private/externalAppCardActionsForCEA.js";export{s as externalAppCardActionsForCEA};import*as m from"./private/externalAppCardActionsForDA.js";export{m as externalAppCardActionsForDA};import*as n from"./private/externalAppCommands.js";export{n as externalAppCommands};import*as l from"./private/files.js";export{l as files};import*as c from"./private/meetingRoom.js";export{c as meetingRoom};import*as f from"./private/messageChannels/messageChannels.js";export{f as messageChannels};import*as u from"./private/nestedAppAuth/nestedAppAuthBridge.js";export{u as nestedAppAuthBridge};import*as x from"./private/notifications.js";export{x as notifications};import*as j from"./private/otherAppStateChange.js";export{j as otherAppStateChange};import*as d from"./private/
|
|
1
|
+
export{NotificationTypes,UserSettingTypes,ViewerActionTypes}from"./private/interfaces.js";export{openFilePreview,registerCustomHandler,registerUserSettingsChangeHandler,sendCustomEvent,sendCustomMessage,uploadCustomApp}from"./private/privateAPIs.js";import*as e from"./private/externalAppAuthentication.js";export{e as externalAppAuthentication};export{UserAuthenticationState}from"./private/externalAppAuthentication.js";import*as r from"./private/logs.js";export{r as logs};import*as t from"./private/conversations.js";export{t as conversations};import*as o from"./private/copilot/copilot.js";export{o as copilot};import*as p from"./private/copilot/sidePanelInterfaces.js";export{p as sidePanelInterfaces};import*as i from"./private/externalAppAuthenticationForCEA.js";export{i as externalAppAuthenticationForCEA};import*as a from"./private/externalAppCardActions.js";export{a as externalAppCardActions};import*as s from"./private/externalAppCardActionsForCEA.js";export{s as externalAppCardActionsForCEA};import*as m from"./private/externalAppCardActionsForDA.js";export{m as externalAppCardActionsForDA};import*as n from"./private/externalAppCommands.js";export{n as externalAppCommands};import*as l from"./private/files.js";export{l as files};import*as c from"./private/meetingRoom.js";export{c as meetingRoom};import*as f from"./private/messageChannels/messageChannels.js";export{f as messageChannels};import*as u from"./private/nestedAppAuth/nestedAppAuthBridge.js";export{u as nestedAppAuthBridge};import*as x from"./private/notifications.js";export{x as notifications};import*as j from"./private/otherAppStateChange.js";export{j as otherAppStateChange};import*as d from"./private/plugins.js";export{d as plugins};import*as g from"./private/remoteCamera.js";export{g as remoteCamera};import*as b from"./private/appEntity.js";export{b as appEntity};import*as v from"./private/teams/teams.js";export{v as teams};import*as A from"./private/videoEffectsEx.js";export{A as videoEffectsEx};import*as C from"./private/hostEntity/hostEntity.js";export{C as hostEntity};import*as h from"./private/store.js";export{h as store};import*as S from"./private/widgetHosting/widgetHosting.js";export{S as widgetHosting};export{ChannelType,DialogDimension,FrameContexts,HostClientType,HostName,RenderingSurfaces,DialogDimension as TaskModuleDimension,TeamType,UserTeamRole}from"./public/constants.js";export{ActionObjectType,EduType,ErrorCode,FileOpenPreference,SecondaryM365ContentIdName}from"./public/interfaces.js";export{AppId}from"./public/appId.js";export{EmailAddress}from"./public/emailAddress.js";export{activateChildProxyingCommunication,getCurrentFeatureFlagsState,overwriteFeatureFlagsState,setFeatureFlagsState}from"./public/featureFlags.js";export{getAdaptiveCardSchemaVersion}from"./public/adaptiveCards.js";export{ChildAppWindow,ParentAppWindow}from"./public/appWindow.js";export{ValidatedSafeString}from"./public/validatedSafeString.js";export{version}from"./public/version.js";export{enablePrintCapability,executeDeepLink,getContext,getMruTabInstances,getTabInstances,initialize,initializeWithFrameContext,print,registerAppButtonClickHandler,registerAppButtonHoverEnterHandler,registerAppButtonHoverLeaveHandler,registerBackButtonHandler,registerBeforeUnloadHandler,registerChangeSettingsHandler,registerFocusEnterHandler,registerFullScreenHandler,registerOnLoadHandler,registerOnThemeChangeHandler,setFrameContext,shareDeepLink}from"./public/publicAPIs.js";export{navigateBack,navigateCrossDomain,navigateToTab,returnFocus}from"./public/navigation.js";export{UUID}from"./public/uuidObject.js";import*as H from"./public/liveShareHost.js";export{H as liveShare};export{LiveShareHost}from"./public/liveShareHost.js";import*as F from"./public/authentication.js";export{F as authentication};import*as y from"./public/app/app.js";export{y as app};import*as T from"./public/appPerformanceMetrics.js";export{T as appPerformanceMetrics};import*as E from"./public/appInstallDialog.js";export{E as appInstallDialog};import*as w from"./public/barCode.js";export{w as barCode};import*as I from"./public/chat.js";export{I as chat};import*as D from"./public/clipboard.js";export{D as clipboard};import*as P from"./public/dialog/dialog.js";export{P as dialog};import*as B from"./public/nestedAppAuth.js";export{B as nestedAppAuth};import*as k from"./public/geoLocation/geoLocation.js";export{k as geoLocation};import*as L from"./public/pages/pages.js";export{L as pages};import*as M from"./public/menus.js";export{M as menus};import*as U from"./public/media.js";export{U as media};import*as O from"./public/secondaryBrowser.js";export{O as secondaryBrowser};import*as V from"./public/location.js";export{V as location};import*as z from"./public/meeting/meeting.js";export{z as meeting};import*as R from"./public/monetization.js";export{R as monetization};import*as W from"./public/calendar.js";export{W as calendar};import*as N from"./public/mail/mail.js";export{N as mail};import*as q from"./public/teamsAPIs.js";export{q as teamsCore};import*as G from"./public/people.js";export{G as people};import*as J from"./public/profile.js";export{J as profile};import*as K from"./public/videoEffects.js";export{K as videoEffects};import*as Q from"./public/search.js";export{Q as search};import*as X from"./public/sharing/sharing.js";export{X as sharing};import*as Y from"./public/stageView/stageView.js";export{Y as stageView};import*as Z from"./public/visualMedia/visualMedia.js";export{Z as visualMedia};import*as $ from"./public/webStorage.js";export{$ as webStorage};import*as _ from"./public/call.js";export{_ as call};import*as ee from"./public/appInitialization.js";export{ee as appInitialization};import*as re from"./public/thirdPartyCloudStorage.js";export{re as thirdPartyCloudStorage};import*as te from"./public/settings.js";export{te as settings};import*as oe from"./public/tasks.js";export{oe as tasks};import*as pe from"./public/marketplace.js";export{pe as marketplace};import*as ie from"./public/shortcutRelay.js";export{ie as shortcutRelay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HostClientType as i}from"../public/constants.js";import{ErrorCode as t}from"../public/interfaces.js";import{isRuntimeInitialized as r}from"../public/runtime.js";import{defaultSDKVersionForCompatCheck as e,errorLibraryNotInitialized as n}from"./constants.js";import{GlobalVars as o}from"./globalVars.js";import{getLogger as l}from"./telemetry.js";import{isValidPatternUrl as s}from"./urlPattern.js";import{compareSDKVersions as a}from"./utils.js";const f=l("internal"),c=f.extend("ensureInitializeCalled"),d=f.extend("ensureInitialized");function m(){if(!o.initializeCalled)throw c(n),new Error(n)}function p(i,...t){if(!o.initializeCompleted)throw d("%s. initializeCalled: %s",n,o.initializeCalled.toString()),new Error(n);if(t&&t.length>0){let i=!1;for(let r=0;r<t.length;r++)if(t[r]===o.frameContext){i=!0;break}if(!i)
|
|
1
|
+
import{HostClientType as i}from"../public/constants.js";import{ErrorCode as t}from"../public/interfaces.js";import{isRuntimeInitialized as r}from"../public/runtime.js";import{defaultSDKVersionForCompatCheck as e,errorLibraryNotInitialized as n}from"./constants.js";import{GlobalVars as o}from"./globalVars.js";import{getLogger as l}from"./telemetry.js";import{isValidPatternUrl as s}from"./urlPattern.js";import{compareSDKVersions as a}from"./utils.js";const f=l("internal"),c=f.extend("ensureInitializeCalled"),d=f.extend("ensureInitialized");function m(){if(!o.initializeCalled)throw c(n),new Error(n)}function p(i,...t){if(!o.initializeCompleted)throw d("%s. initializeCalled: %s",n,o.initializeCalled.toString()),new Error(n);if(t&&t.length>0){let i=!1;for(let r=0;r<t.length;r++)if(t[r]===o.frameContext){i=!0;break}if(!i){const i=`This call is only allowed in following contexts: ${JSON.stringify(t)}. Current context: "${o.frameContext}".`;throw d(i),new Error(i)}}return r(i)}function u(i=e){const t=a(o.clientSupportedSDKVersion,i);return!isNaN(t)&&t>=0}function C(){return o.hostClientType==i.android||o.hostClientType==i.ios||o.hostClientType==i.ipados||o.hostClientType==i.visionOS}function h(i=e){if(!C()){throw{errorCode:t.NOT_SUPPORTED_ON_PLATFORM}}if(!u(i)){throw{errorCode:t.OLD_PLATFORM}}}function w(i){let t=o.additionalValidOrigins.concat(i.filter(i=>"string"==typeof i&&s(i)));const r={};t=t.filter(i=>!r[i]&&(r[i]=!0,!0)),o.additionalValidOrigins=t}export{m as ensureInitializeCalled,p as ensureInitialized,u as isCurrentSDKVersionAtLeast,C as isHostClientMobile,w as processAdditionalValidOrigins,h as throwExceptionIfMobileApiIsNotSupported};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{callFunctionInHost as n}from"../internal/communication.js";import{registerHandlerHelper as r}from"../internal/handlers.js";import{ensureInitialized as t}from"../internal/internalAPIs.js";import{getApiVersionTag as i}from"../internal/telemetry.js";import{FrameContexts as s}from"../public/constants.js";import{runtime as o}from"../public/runtime.js";function u(){return t(o)&&!!o.supports.plugins}function l(r){return e(this,void 0,void 0,function*(){if(t(o),!r.func)throw new Error("func is required in PluginMessage.");return n("plugins.sendMessage",[new c(r)],i("v2","plugins.sendMessage"))})}function p(e){r(i("v2","plugins.receiveMessage"),"plugins.receiveMessage",(...n)=>{e(function(e){if(1===e.length&&function(e){if(!e||"object"!=typeof e)return!1;return"string"==typeof e.func}(e[0]))return e[0];const[n,r,t]=e;return{func:"string"==typeof n?n:String(null!=n?n:""),args:r,correlationId:"string"==typeof t?t:void 0}}(n))},Object.values(s),()=>{if(!u())throw new Error("Receiving plugin messages is not supported in the current host.")})}class c{constructor(e){this.message=e}serialize(){return this.message}}export{u as isSupported,p as registerPluginMessage,l as sendPluginMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t="2.51.0-beta.0";export{t as version};
|
|
@@ -1070,6 +1070,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1070
1070
|
overwriteFeatureFlagsState: () => (/* reexport */ overwriteFeatureFlagsState),
|
|
1071
1071
|
pages: () => (/* reexport */ pages_namespaceObject),
|
|
1072
1072
|
people: () => (/* reexport */ people_namespaceObject),
|
|
1073
|
+
plugins: () => (/* reexport */ plugins_namespaceObject),
|
|
1073
1074
|
print: () => (/* reexport */ publicAPIs_print),
|
|
1074
1075
|
profile: () => (/* reexport */ profile_namespaceObject),
|
|
1075
1076
|
registerAppButtonClickHandler: () => (/* reexport */ registerAppButtonClickHandler),
|
|
@@ -1562,6 +1563,15 @@ __webpack_require__.d(otherAppStateChange_namespaceObject, {
|
|
|
1562
1563
|
unregisterAppInstallationHandler: () => (unregisterAppInstallationHandler)
|
|
1563
1564
|
});
|
|
1564
1565
|
|
|
1566
|
+
// NAMESPACE OBJECT: ./src/private/plugins.ts
|
|
1567
|
+
var plugins_namespaceObject = {};
|
|
1568
|
+
__webpack_require__.r(plugins_namespaceObject);
|
|
1569
|
+
__webpack_require__.d(plugins_namespaceObject, {
|
|
1570
|
+
isSupported: () => (plugins_isSupported),
|
|
1571
|
+
registerPluginMessage: () => (registerPluginMessage),
|
|
1572
|
+
sendPluginMessage: () => (sendPluginMessage)
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1565
1575
|
// NAMESPACE OBJECT: ./src/private/remoteCamera.ts
|
|
1566
1576
|
var remoteCamera_namespaceObject = {};
|
|
1567
1577
|
__webpack_require__.r(remoteCamera_namespaceObject);
|
|
@@ -4669,7 +4679,7 @@ function isSerializable(arg) {
|
|
|
4669
4679
|
* @hidden
|
|
4670
4680
|
* Package version.
|
|
4671
4681
|
*/
|
|
4672
|
-
const version = "2.
|
|
4682
|
+
const version = "2.51.0-beta.0";
|
|
4673
4683
|
|
|
4674
4684
|
;// ./src/public/featureFlags.ts
|
|
4675
4685
|
// All build feature flags are defined inside this object. Any build feature flag must have its own unique getter and setter function. This pattern allows for client apps to treeshake unused code and avoid including code guarded by this feature flags in the final bundle. If this property isn't desired, use the below runtime feature flags object.
|
|
@@ -4959,8 +4969,10 @@ function ensureInitialized(runtime, ...expectedFrameContexts) {
|
|
|
4959
4969
|
}
|
|
4960
4970
|
}
|
|
4961
4971
|
if (!found) {
|
|
4962
|
-
|
|
4963
|
-
`Current context: "${GlobalVars.frameContext}"
|
|
4972
|
+
const errorMessage = `This call is only allowed in following contexts: ${JSON.stringify(expectedFrameContexts)}. ` +
|
|
4973
|
+
`Current context: "${GlobalVars.frameContext}".`;
|
|
4974
|
+
ensureInitializedLogger(errorMessage);
|
|
4975
|
+
throw new Error(errorMessage);
|
|
4964
4976
|
}
|
|
4965
4977
|
}
|
|
4966
4978
|
return isRuntimeInitialized(runtime);
|
|
@@ -9301,6 +9313,8 @@ function uploadCustomApp(manifestBlob, onComplete) {
|
|
|
9301
9313
|
sendMessageToParent(getApiVersionTag(privateAPIsTelemetryVersionNumber, "uploadCustomApp" /* ApiName.PrivateAPIs_UploadCustomApp */), 'uploadCustomApp', [manifestBlob], onComplete ? onComplete : getGenericOnCompleteHandler());
|
|
9302
9314
|
}
|
|
9303
9315
|
/**
|
|
9316
|
+
* @deprecated Use {@link plugins.sendPluginMessage} with {@link plugins.registerPluginMessage} and a correlationId-based response pattern.
|
|
9317
|
+
*
|
|
9304
9318
|
* @hidden
|
|
9305
9319
|
* Sends a custom action MessageRequest to host or parent window
|
|
9306
9320
|
*
|
|
@@ -9309,6 +9323,39 @@ function uploadCustomApp(manifestBlob, onComplete) {
|
|
|
9309
9323
|
* @param callback - Optionally specify a callback to receive response parameters from the parent
|
|
9310
9324
|
* @returns id of sent message
|
|
9311
9325
|
*
|
|
9326
|
+
* @remarks
|
|
9327
|
+
* Prefer the plugin event model for new development. In that model, send a request message
|
|
9328
|
+
* with a unique `correlationId` and listen for a response event with the same `correlationId`.
|
|
9329
|
+
*
|
|
9330
|
+
* Example:
|
|
9331
|
+
* ```ts
|
|
9332
|
+
* // Request side
|
|
9333
|
+
* const correlationId = crypto.randomUUID();
|
|
9334
|
+
*
|
|
9335
|
+
* plugins.registerPluginMessage((message) => {
|
|
9336
|
+
* if (message.func !== 'example.customAction.response') {
|
|
9337
|
+
* return;
|
|
9338
|
+
* }
|
|
9339
|
+
* if (message.correlationId !== correlationId) {
|
|
9340
|
+
* return;
|
|
9341
|
+
* }
|
|
9342
|
+
*
|
|
9343
|
+
* // This is the response for the request above.
|
|
9344
|
+
* const response = message.args;
|
|
9345
|
+
* console.log('Received response', response);
|
|
9346
|
+
* });
|
|
9347
|
+
*
|
|
9348
|
+
* await plugins.sendPluginMessage({
|
|
9349
|
+
* func: 'example.customAction.request',
|
|
9350
|
+
* args: { itemId: '12345' },
|
|
9351
|
+
* correlationId,
|
|
9352
|
+
* });
|
|
9353
|
+
*
|
|
9354
|
+
* // Host side contract example (conceptual):
|
|
9355
|
+
* // On receiving example.customAction.request, send back
|
|
9356
|
+
* // example.customAction.response with the same correlationId.
|
|
9357
|
+
* ```
|
|
9358
|
+
*
|
|
9312
9359
|
* @internal
|
|
9313
9360
|
* Limited to Microsoft-internal use
|
|
9314
9361
|
*/
|
|
@@ -12185,6 +12232,122 @@ function otherAppStateChange_isSupported() {
|
|
|
12185
12232
|
return ensureInitialized(runtime) && runtime.supports.otherAppStateChange ? true : false;
|
|
12186
12233
|
}
|
|
12187
12234
|
|
|
12235
|
+
;// ./src/private/plugins.ts
|
|
12236
|
+
var plugins_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12237
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12238
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12239
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12240
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12241
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12242
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12243
|
+
});
|
|
12244
|
+
};
|
|
12245
|
+
|
|
12246
|
+
|
|
12247
|
+
|
|
12248
|
+
|
|
12249
|
+
|
|
12250
|
+
|
|
12251
|
+
const pluginTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
|
|
12252
|
+
/**
|
|
12253
|
+
* Indicates whether the plugin capability is available in the current host.
|
|
12254
|
+
*
|
|
12255
|
+
* @remarks
|
|
12256
|
+
* This API validates SDK initialization and then checks runtime capability flags
|
|
12257
|
+
* for `supports.plugins`.
|
|
12258
|
+
*
|
|
12259
|
+
* @returns `true` if the host reports plugin support; otherwise `false`.
|
|
12260
|
+
*
|
|
12261
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed.
|
|
12262
|
+
*
|
|
12263
|
+
* @hidden
|
|
12264
|
+
* @internal
|
|
12265
|
+
* Limited to Microsoft-internal use
|
|
12266
|
+
* @beta
|
|
12267
|
+
*/
|
|
12268
|
+
function plugins_isSupported() {
|
|
12269
|
+
return ensureInitialized(runtime) && !!runtime.supports.plugins;
|
|
12270
|
+
}
|
|
12271
|
+
/**
|
|
12272
|
+
* Sends a plugin message to the host.
|
|
12273
|
+
*
|
|
12274
|
+
* @remarks
|
|
12275
|
+
* The message payload is serialized before transmission to the host.
|
|
12276
|
+
* All payload data must be JSON-safe (see {@link JsonValue}).
|
|
12277
|
+
*
|
|
12278
|
+
* @returns A promise that resolves when the host acknowledges the message.
|
|
12279
|
+
*
|
|
12280
|
+
* @throws Error if SDK initialization has not completed, if the host returns
|
|
12281
|
+
* an error response, or if `func` is missing.
|
|
12282
|
+
*
|
|
12283
|
+
* @hidden
|
|
12284
|
+
* @internal
|
|
12285
|
+
* Limited to Microsoft-internal use
|
|
12286
|
+
* @beta
|
|
12287
|
+
*/
|
|
12288
|
+
function sendPluginMessage(message) {
|
|
12289
|
+
return plugins_awaiter(this, void 0, void 0, function* () {
|
|
12290
|
+
ensureInitialized(runtime);
|
|
12291
|
+
if (!message.func) {
|
|
12292
|
+
throw new Error('func is required in PluginMessage.');
|
|
12293
|
+
}
|
|
12294
|
+
return callFunctionInHost("plugins.sendMessage" /* ApiName.Plugins_SendMessage */, [new SerializablePluginMessage(message)], getApiVersionTag(pluginTelemetryVersionNumber, "plugins.sendMessage" /* ApiName.Plugins_SendMessage */));
|
|
12295
|
+
});
|
|
12296
|
+
}
|
|
12297
|
+
/**
|
|
12298
|
+
* Registers a handler to receive plugin messages from the host.
|
|
12299
|
+
*
|
|
12300
|
+
* @remarks
|
|
12301
|
+
* This API registers the callback under the `plugin.receiveMessage` handler name.
|
|
12302
|
+
* When the host dispatches a plugin message, the supplied handler is invoked with
|
|
12303
|
+
* the received JSON payload.
|
|
12304
|
+
*
|
|
12305
|
+
* @param handler - Callback invoked for each incoming plugin message payload.
|
|
12306
|
+
*
|
|
12307
|
+
* @throws Error if plugin messaging is not supported by the current host.
|
|
12308
|
+
*
|
|
12309
|
+
* @hidden
|
|
12310
|
+
* @internal
|
|
12311
|
+
* Limited to Microsoft-internal use
|
|
12312
|
+
* @beta
|
|
12313
|
+
*/
|
|
12314
|
+
function registerPluginMessage(handler) {
|
|
12315
|
+
registerHandlerHelper(getApiVersionTag(pluginTelemetryVersionNumber, "plugins.receiveMessage" /* ApiName.Plugins_ReceiveMessage */), "plugins.receiveMessage" /* ApiName.Plugins_ReceiveMessage */, (...incoming) => {
|
|
12316
|
+
handler(normalizePluginInboundMessage(incoming));
|
|
12317
|
+
}, Object.values(FrameContexts), () => {
|
|
12318
|
+
if (!plugins_isSupported()) {
|
|
12319
|
+
throw new Error('Receiving plugin messages is not supported in the current host.');
|
|
12320
|
+
}
|
|
12321
|
+
});
|
|
12322
|
+
}
|
|
12323
|
+
class SerializablePluginMessage {
|
|
12324
|
+
constructor(message) {
|
|
12325
|
+
this.message = message;
|
|
12326
|
+
}
|
|
12327
|
+
serialize() {
|
|
12328
|
+
return this.message;
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
function normalizePluginInboundMessage(incoming) {
|
|
12332
|
+
// New envelope format: { func, args, correlationId?, schemaVersion? }
|
|
12333
|
+
if (incoming.length === 1 && isPluginInboundMessage(incoming[0])) {
|
|
12334
|
+
return incoming[0];
|
|
12335
|
+
}
|
|
12336
|
+
const [func, args, correlationId] = incoming;
|
|
12337
|
+
return {
|
|
12338
|
+
func: typeof func === 'string' ? func : String(func !== null && func !== void 0 ? func : ''),
|
|
12339
|
+
args: args,
|
|
12340
|
+
correlationId: typeof correlationId === 'string' ? correlationId : undefined,
|
|
12341
|
+
};
|
|
12342
|
+
}
|
|
12343
|
+
function isPluginInboundMessage(value) {
|
|
12344
|
+
if (!value || typeof value !== 'object') {
|
|
12345
|
+
return false;
|
|
12346
|
+
}
|
|
12347
|
+
const message = value;
|
|
12348
|
+
return typeof message.func === 'string';
|
|
12349
|
+
}
|
|
12350
|
+
|
|
12188
12351
|
;// ./src/private/remoteCamera.ts
|
|
12189
12352
|
/**
|
|
12190
12353
|
* @hidden
|
|
@@ -14649,6 +14812,8 @@ class SerializableContentSizeArgs {
|
|
|
14649
14812
|
|
|
14650
14813
|
|
|
14651
14814
|
|
|
14815
|
+
|
|
14816
|
+
|
|
14652
14817
|
|
|
14653
14818
|
|
|
14654
14819
|
|