@microsoft/teams-js 2.35.0-beta.2 → 2.36.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.
Files changed (25) hide show
  1. package/README.md +4 -4
  2. package/dist/esm/packages/teams-js/dts/internal/childCommunication.d.ts +1 -1
  3. package/dist/esm/packages/teams-js/dts/internal/communication.d.ts +1 -1
  4. package/dist/esm/packages/teams-js/dts/internal/globalVars.d.ts +1 -0
  5. package/dist/esm/packages/teams-js/dts/internal/messageObjects.d.ts +1 -0
  6. package/dist/esm/packages/teams-js/dts/internal/nestedAppAuthUtils.d.ts +3 -1
  7. package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +2 -0
  8. package/dist/esm/packages/teams-js/dts/private/index.d.ts +1 -0
  9. package/dist/esm/packages/teams-js/dts/private/nestedAppAuth/nestedAppAuthBridge.d.ts +32 -0
  10. package/dist/esm/packages/teams-js/dts/public/nestedAppAuth.d.ts +56 -5
  11. package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +2 -0
  12. package/dist/esm/packages/teams-js/src/index.js +1 -1
  13. package/dist/esm/packages/teams-js/src/internal/childCommunication.js +1 -1
  14. package/dist/esm/packages/teams-js/src/internal/communication.js +1 -1
  15. package/dist/esm/packages/teams-js/src/internal/globalVars.js +1 -1
  16. package/dist/esm/packages/teams-js/src/internal/nestedAppAuthUtils.js +1 -1
  17. package/dist/esm/packages/teams-js/src/private/nestedAppAuth/nestedAppAuthBridge.js +1 -0
  18. package/dist/esm/packages/teams-js/src/public/nestedAppAuth.js +1 -1
  19. package/dist/esm/packages/teams-js/src/public/runtime.js +1 -1
  20. package/dist/esm/packages/teams-js/src/public/version.js +1 -1
  21. package/dist/umd/MicrosoftTeams.js +457 -23
  22. package/dist/umd/MicrosoftTeams.js.map +1 -1
  23. package/dist/umd/MicrosoftTeams.min.js +1 -1
  24. package/dist/umd/MicrosoftTeams.min.js.map +1 -1
  25. package/package.json +53 -1
package/README.md CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
24
24
 
25
25
  ### Production
26
26
 
27
- You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.34.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.36.0/js/MicrosoftTeams.min.js) or point your package manager at them.
28
28
 
29
29
  ## Usage
30
30
 
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
45
45
  ```html
46
46
  <!-- Microsoft Teams JavaScript API (via CDN) -->
47
47
  <script
48
- src="https://res.cdn.office.net/teams-js/2.34.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-brW9AazbKR2dYw2DucGgWCCcmrm2oBFV4HQidyuyZRI/TnAkmOOnTARSTdps3Hwt"
48
+ src="https://res.cdn.office.net/teams-js/2.36.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-Vg2zZJuta2CG1wHGm8f5belcapTREs0cxiGzaMgVWI/apjFxwHqOgYOon/OqPXP7"
50
50
  crossorigin="anonymous"
51
51
  ></script>
52
52
 
53
53
  <!-- Microsoft Teams JavaScript API (via npm) -->
54
- <script src="node_modules/@microsoft/teams-js@2.34.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.36.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -12,7 +12,7 @@ export declare function uninitializeChildCommunication(): void;
12
12
  * Limited to Microsoft-internal use
13
13
  */
14
14
  export declare function shouldEventBeRelayedToChild(): boolean;
15
- type SendMessageToParentHelper = (apiVersionTag: string, func: string, args?: any[], isProxiedFromChild?: boolean) => MessageRequestWithRequiredProperties;
15
+ type SendMessageToParentHelper = (apiVersionTag: string, func: string, args?: any[], isProxiedFromChild?: boolean, teamsJsInstanceId?: string) => MessageRequestWithRequiredProperties;
16
16
  type SetCallbackForRequest = (uuid: MessageUUID, callback: Function) => void;
17
17
  /**
18
18
  * @hidden
@@ -142,7 +142,7 @@ export declare function sendMessageToParent(apiVersionTag: string, actionName: s
142
142
  * @internal
143
143
  * Limited to Microsoft-internal use
144
144
  */
145
- export declare function sendNestedAuthRequestToTopWindow(message: string): NestedAppAuthRequest;
145
+ export declare function sendNestedAuthRequestToTopWindow(message: string, apiVersionTag: string): NestedAppAuthRequest;
146
146
  /**
147
147
  * @internal
148
148
  * Limited to Microsoft-internal use
@@ -9,4 +9,5 @@ export declare class GlobalVars {
9
9
  static hostClientType: string | undefined;
10
10
  static clientSupportedSDKVersion: string;
11
11
  static printCapabilityEnabled: boolean;
12
+ static readonly teamsJsInstanceId: string;
12
13
  }
@@ -20,6 +20,7 @@ export interface MessageRequest {
20
20
  apiVersionTag?: string;
21
21
  isPartialResponse?: boolean;
22
22
  isProxiedFromChild?: boolean;
23
+ teamsJsInstanceId?: string;
23
24
  }
24
25
  /**
25
26
  * @internal
@@ -1,4 +1,6 @@
1
1
  import { MessageRequestWithRequiredProperties } from './messageObjects';
2
+ import { ApiVersionNumber } from './telemetry';
3
+ export declare const nestedAppAuthTelemetryVersionNumber: ApiVersionNumber;
2
4
  /**
3
5
  * @hidden
4
6
  * Enumeration for nested app authentication message event names.
@@ -92,7 +94,7 @@ export interface NestedAuthExtendedWindow extends Window {
92
94
  */
93
95
  type NestedAppAuthBridgeHandlers = {
94
96
  onMessage: (evt: MessageEvent, onMessageReceived: (response: string) => void) => void;
95
- sendPostMessage: (message: string) => void;
97
+ sendPostMessage: (message: string, apiVersionTag: string) => void;
96
98
  };
97
99
  /**
98
100
  * @hidden
@@ -209,6 +209,8 @@ export declare const enum ApiName {
209
209
  Navigation_NavigateCrossDomain = "navigation.navigateCrossDomain",
210
210
  Navigation_NavigateToTab = "navigation.navigateToTab",
211
211
  Navigation_ReturnFocus = "navigation.returnFocus",
212
+ NestedAppAuth_Execute = "nestedAppAuth.execute",
213
+ NestedAppAuth_ManageNAATrustedOrigins = "nestedAppAuth.manageNAATrustedOrigins",
212
214
  Notifications_ShowNotification = "notifications.showNotification",
213
215
  OtherAppStateChange_Install = "otherApp.install",
214
216
  OtherAppStateChange_UnregisterInstall = "otherApp.unregisterInstall",
@@ -13,6 +13,7 @@ export * as externalAppCommands from './externalAppCommands';
13
13
  export * as files from './files';
14
14
  export * as meetingRoom from './meetingRoom';
15
15
  export * as messageChannels from './messageChannels/messageChannels';
16
+ export * as nestedAppAuthBridge from './nestedAppAuth/nestedAppAuthBridge';
16
17
  export * as notifications from './notifications';
17
18
  export * as otherAppStateChange from './otherAppStateChange';
18
19
  export * as remoteCamera from './remoteCamera';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @beta
3
+ * @hidden
4
+ * Local version of the Nested App Auth Bridge module.
5
+ *
6
+ * This version is specific to this standalone module and is not tied to the overall TeamsJS SDK version.
7
+ * It allows developers to track changes within this module and handle version-based compatibility if needed.
8
+ *
9
+ * While not strictly required today, having a version provides flexibility for future updates,
10
+ * especially if breaking changes are introduced later.
11
+ *
12
+ * Example:
13
+ * if (nestedAppAuthBridge.version.startsWith('1.')) {
14
+ * // Safe to use with current logic
15
+ * }
16
+ *
17
+ * @internal
18
+ * Limited to Microsoft-internal use
19
+ */
20
+ export declare const version = "1.0.0";
21
+ /**
22
+ * @beta
23
+ * @hidden
24
+ * Initializes the Nested App Auth Bridge.
25
+ * @param window The window object where the bridge will be attached.
26
+ * @param topOrigin The origin of the top-level frame.
27
+ * @param enableLogging - Optional flag to enable internal debug and error logging. Defaults to false.
28
+ *
29
+ * @internal
30
+ * Limited to Microsoft-internal use
31
+ */
32
+ export declare function initialize(window: Window | null, topOrigin: string, enableLogging?: boolean): void;
@@ -1,8 +1,3 @@
1
- /**
2
- * @beta
3
- * Nested app auth capabilities
4
- * @module
5
- */
6
1
  /**
7
2
  * Checks if MSAL-NAA channel recommended by the host
8
3
  * @returns true if host is recommending NAA channel and false otherwise
@@ -12,3 +7,59 @@
12
7
  * @beta
13
8
  */
14
9
  export declare function isNAAChannelRecommended(): boolean;
10
+ /**
11
+ * Gets the origin of the parent window if available.
12
+ * This will be the top-level origin in the case of a parent app.
13
+ * It is used to pass to the embedded child app to initialize the Nested App Auth bridge.
14
+
15
+ * @returns The origin string if available, otherwise null
16
+ *
17
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
18
+ *
19
+ * @beta
20
+ */
21
+ export declare function getParentOrigin(): string | null;
22
+ /**
23
+ * Checks if the parent has the capability to manage its list of trusted child origins
24
+ * for Nested App Auth (NAA).
25
+ *
26
+ * @returns true if parent can manage NAA TrustedOrigins, false otherwise
27
+ *
28
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
29
+ *
30
+ * @beta
31
+ */
32
+ export declare function canParentManageNAATrustedOrigins(): boolean;
33
+ /**
34
+ * Checks if NAA deeply nested scenario supported by the host
35
+ * @returns true if host supports
36
+ *
37
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
38
+ *
39
+ * @beta
40
+ */
41
+ export declare function isDeeplyNestedAuthSupported(): boolean;
42
+ /**
43
+ * Registers the origins of child apps as trusted for Nested App Auth (NAA).
44
+ *
45
+ * This allows a top-level parent app to specify which child app origins are considered trusted
46
+ *
47
+ * @param appOrigins - An array of child app origins to trust (must be a non-empty array).
48
+ * @returns A Promise resolving with the result of the action.
49
+ * @throws Error if called from a non-top-level parent or if parameters are invalid.
50
+ *
51
+ * @beta
52
+ */
53
+ export declare function addNAATrustedOrigins(appOrigins: string[]): Promise<string>;
54
+ /**
55
+ * Removes previously trusted child app origins from Nested App Auth (NAA).
56
+ *
57
+ * The specified origins will no longer be considered trusted.
58
+ *
59
+ * @param appOrigins - An array of child app origins to remove from the trusted list (must be a non-empty array).
60
+ * @returns A Promise resolving with the result of the action.
61
+ * @throws Error if called from a non-top-level parent or if parameters are invalid.
62
+ *
63
+ * @beta
64
+ */
65
+ export declare function deleteNAATrustedOrigins(appOrigins: string[]): Promise<string>;
@@ -15,6 +15,8 @@ interface IRuntimeV4 extends IBaseRuntime {
15
15
  readonly apiVersion: 4;
16
16
  readonly hostVersionsInfo?: HostVersionsInfo;
17
17
  readonly isNAAChannelRecommended?: boolean;
18
+ readonly canParentManageNAATrustedOrigins?: boolean;
19
+ readonly isDeeplyNestedAuthSupported?: boolean;
18
20
  readonly isLegacyTeams?: boolean;
19
21
  readonly supports: {
20
22
  readonly app?: {
@@ -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/logs.js";export{e as logs};import*as r from"./private/conversations.js";export{r as conversations};import*as t from"./private/copilot/copilot.js";export{t as copilot};import*as o from"./private/externalAppAuthentication.js";export{o as externalAppAuthentication};import*as p from"./private/externalAppAuthenticationForCEA.js";export{p as externalAppAuthenticationForCEA};import*as i from"./private/externalAppCardActions.js";export{i as externalAppCardActions};import*as a from"./private/externalAppCardActionsForCEA.js";export{a as externalAppCardActionsForCEA};import*as s from"./private/externalAppCardActionsForDA.js";export{s as externalAppCardActionsForDA};import*as m from"./private/externalAppCommands.js";export{m as externalAppCommands};import*as n from"./private/files.js";export{n as files};import*as l from"./private/meetingRoom.js";export{l as meetingRoom};import*as c from"./private/messageChannels/messageChannels.js";export{c as messageChannels};import*as f from"./private/notifications.js";export{f as notifications};import*as x from"./private/otherAppStateChange.js";export{x as otherAppStateChange};import*as u from"./private/remoteCamera.js";export{u as remoteCamera};import*as j from"./private/appEntity.js";export{j as appEntity};import*as d from"./private/teams/teams.js";export{d as teams};import*as b from"./private/videoEffectsEx.js";export{b as videoEffectsEx};import*as g from"./private/hostEntity/hostEntity.js";export{g as hostEntity};import*as v from"./private/store.js";export{v as store};export{ChannelType,DialogDimension,FrameContexts,HostClientType,HostName,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 C from"./public/liveShareHost.js";export{C as liveShare};export{LiveShareHost}from"./public/liveShareHost.js";import*as A from"./public/authentication.js";export{A as authentication};import*as h from"./public/app/app.js";export{h as app};import*as S from"./public/appInstallDialog.js";export{S as appInstallDialog};import*as H from"./public/barCode.js";export{H as barCode};import*as F from"./public/chat.js";export{F as chat};import*as y from"./public/clipboard.js";export{y as clipboard};import*as T from"./public/dialog/dialog.js";export{T as dialog};import*as E from"./public/nestedAppAuth.js";export{E as nestedAppAuth};import*as D from"./public/geoLocation/geoLocation.js";export{D as geoLocation};import*as I from"./public/pages/pages.js";export{I as pages};import*as w from"./public/menus.js";export{w as menus};import*as P from"./public/media.js";export{P as media};import*as k from"./public/secondaryBrowser.js";export{k as secondaryBrowser};import*as B from"./public/location.js";export{B as location};import*as L from"./public/meeting/meeting.js";export{L as meeting};import*as M from"./public/monetization.js";export{M as monetization};import*as U from"./public/calendar.js";export{U as calendar};import*as O from"./public/mail/mail.js";export{O as mail};import*as V from"./public/teamsAPIs.js";export{V as teamsCore};import*as z from"./public/people.js";export{z as people};import*as W from"./public/profile.js";export{W as profile};import*as N from"./public/videoEffects.js";export{N as videoEffects};import*as R from"./public/search.js";export{R as search};import*as q from"./public/sharing/sharing.js";export{q as sharing};import*as G from"./public/stageView/stageView.js";export{G as stageView};import*as J from"./public/visualMedia/visualMedia.js";export{J as visualMedia};import*as K from"./public/webStorage.js";export{K as webStorage};import*as Q from"./public/call.js";export{Q as call};import*as X from"./public/appInitialization.js";export{X as appInitialization};import*as Y from"./public/thirdPartyCloudStorage.js";export{Y as thirdPartyCloudStorage};import*as Z from"./public/settings.js";export{Z as settings};import*as $ from"./public/tasks.js";export{$ as tasks};import*as _ from"./public/marketplace.js";export{_ as marketplace};
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/logs.js";export{e as logs};import*as r from"./private/conversations.js";export{r as conversations};import*as t from"./private/copilot/copilot.js";export{t as copilot};import*as o from"./private/externalAppAuthentication.js";export{o as externalAppAuthentication};import*as p from"./private/externalAppAuthenticationForCEA.js";export{p as externalAppAuthenticationForCEA};import*as i from"./private/externalAppCardActions.js";export{i as externalAppCardActions};import*as a from"./private/externalAppCardActionsForCEA.js";export{a as externalAppCardActionsForCEA};import*as s from"./private/externalAppCardActionsForDA.js";export{s as externalAppCardActionsForDA};import*as m from"./private/externalAppCommands.js";export{m as externalAppCommands};import*as n from"./private/files.js";export{n as files};import*as l from"./private/meetingRoom.js";export{l as meetingRoom};import*as c from"./private/messageChannels/messageChannels.js";export{c as messageChannels};import*as f from"./private/nestedAppAuth/nestedAppAuthBridge.js";export{f as nestedAppAuthBridge};import*as u from"./private/notifications.js";export{u as notifications};import*as x from"./private/otherAppStateChange.js";export{x as otherAppStateChange};import*as j from"./private/remoteCamera.js";export{j as remoteCamera};import*as d from"./private/appEntity.js";export{d as appEntity};import*as g from"./private/teams/teams.js";export{g as teams};import*as b from"./private/videoEffectsEx.js";export{b as videoEffectsEx};import*as v from"./private/hostEntity/hostEntity.js";export{v as hostEntity};import*as C from"./private/store.js";export{C as store};export{ChannelType,DialogDimension,FrameContexts,HostClientType,HostName,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 A from"./public/liveShareHost.js";export{A as liveShare};export{LiveShareHost}from"./public/liveShareHost.js";import*as h from"./public/authentication.js";export{h as authentication};import*as S from"./public/app/app.js";export{S as app};import*as H from"./public/appInstallDialog.js";export{H as appInstallDialog};import*as F from"./public/barCode.js";export{F as barCode};import*as y from"./public/chat.js";export{y as chat};import*as T from"./public/clipboard.js";export{T as clipboard};import*as E from"./public/dialog/dialog.js";export{E as dialog};import*as D from"./public/nestedAppAuth.js";export{D as nestedAppAuth};import*as I from"./public/geoLocation/geoLocation.js";export{I as geoLocation};import*as w from"./public/pages/pages.js";export{w as pages};import*as B from"./public/menus.js";export{B as menus};import*as P from"./public/media.js";export{P as media};import*as k from"./public/secondaryBrowser.js";export{k as secondaryBrowser};import*as L from"./public/location.js";export{L as location};import*as M from"./public/meeting/meeting.js";export{M as meeting};import*as U from"./public/monetization.js";export{U as monetization};import*as O from"./public/calendar.js";export{O as calendar};import*as V from"./public/mail/mail.js";export{V as mail};import*as z from"./public/teamsAPIs.js";export{z as teamsCore};import*as W from"./public/people.js";export{W as people};import*as N from"./public/profile.js";export{N as profile};import*as R from"./public/videoEffects.js";export{R as videoEffects};import*as q from"./public/search.js";export{q as search};import*as G from"./public/sharing/sharing.js";export{G as sharing};import*as J from"./public/stageView/stageView.js";export{J as stageView};import*as K from"./public/visualMedia/visualMedia.js";export{K as visualMedia};import*as Q from"./public/webStorage.js";export{Q as webStorage};import*as X from"./public/call.js";export{X as call};import*as Y from"./public/appInitialization.js";export{Y as appInitialization};import*as Z from"./public/thirdPartyCloudStorage.js";export{Z as thirdPartyCloudStorage};import*as $ from"./public/settings.js";export{$ as settings};import*as _ from"./public/tasks.js";export{_ as tasks};import*as ee from"./public/marketplace.js";export{ee as marketplace};
@@ -1 +1 @@
1
- import{__awaiter as n}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{isChildProxyingEnabled as i,getCurrentFeatureFlagsState as o}from"../public/featureFlags.js";import{flushMessageQueue as e,getMessageIdsAsLogString as s}from"./communicationUtils.js";import{callHandler as r}from"./handlers.js";import{deserializeMessageRequest as t,serializeMessageResponse as d}from"./messageObjects.js";import{getLogger as a,getApiVersionTag as u}from"./telemetry.js";const c=a("childProxyingCommunication");class l{}function g(){l.window=null,l.origin=null,l.messageQueue=[]}function f(){return!!i()&&!!l.window}function m(n,o){return!!i()&&(l.window&&!l.window.closed&&n!==l.window||(l.window=n,l.origin=o),l.window&&l.window.closed?(l.window=null,l.origin=null,!1):l.window===n)}function w(i,d,a,c){return n(this,void 0,void 0,(function*(){l.window===d&&(e(l.window,l.origin,l.messageQueue,"child"),function(n,i,e){if(void 0===n.data.id||void 0===n.data.func)return;const d=t(n.data),[a,c]=r(d.func,d.args);if(a&&void 0!==c)return p("Handler called in response to message %s from child. Returning response from handler to child, action: %s.",s(d),d.func),void h(d.id,d.uuid,Array.isArray(c)?c:[c]);p("No handler for message %s from child found; relaying message on to parent, action: %s. Relayed message will have a new id.",s(d),d.func),function(n,i,e){const r=i(u("v2","tasks.startTask"),n.func,n.args,!0),t=l.origin;e(r.uuid,((...i)=>{if(!l.window)return;if(!o().disableEnforceOriginMatchForChildResponses&&t!==l.origin)return void p("Origin of child window has changed, not sending response back to child window");const e=i.pop();p("Message from parent being relayed to child, id: %s",s(n)),h(n.id,n.uuid,i,e)}))}(d,i,e)}(i,a,c))}))}l.messageQueue=[];const p=c.extend("handleIncomingMessageFromChild");function h(n,i,o,e){const r=l.window,t=function(n,i,o,e){return{id:n,uuid:i,args:o||[],isPartialResponse:e}}(n,i,o,e),a=d(t),u=l.origin;r&&u&&(p("Sending message %s to %s via postMessage, args = %o",s(a),"child",a.args),r.postMessage(a,u))}function v(n,i){const o=l.window,e=function(n,i){return{func:n,args:i||[]}}(n,i),s=l.origin;o&&s?o.postMessage(e,s):l.messageQueue.push(e)}export{w as handleIncomingMessageFromChild,v as sendMessageEventToChild,f as shouldEventBeRelayedToChild,m as shouldProcessChildMessage,g as uninitializeChildCommunication};
1
+ import{__awaiter as n}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{isChildProxyingEnabled as i,getCurrentFeatureFlagsState as o}from"../public/featureFlags.js";import{flushMessageQueue as s,getMessageIdsAsLogString as e}from"./communicationUtils.js";import{callHandler as r}from"./handlers.js";import{deserializeMessageRequest as t,serializeMessageResponse as d}from"./messageObjects.js";import{getLogger as a,getApiVersionTag as u}from"./telemetry.js";const c=a("childProxyingCommunication");class l{}function g(){l.window=null,l.origin=null,l.messageQueue=[]}function m(){return!!i()&&!!l.window}function f(n,o){return!!i()&&(l.window&&!l.window.closed&&n!==l.window||(l.window=n,l.origin=o),l.window&&l.window.closed?(l.window=null,l.origin=null,!1):l.window===n)}function w(i,d,a,c){return n(this,void 0,void 0,(function*(){l.window===d&&(s(l.window,l.origin,l.messageQueue,"child"),function(n,i,s){if(void 0===n.data.id||void 0===n.data.func)return;const d=t(n.data),[a,c]=r(d.func,d.args);if(a&&void 0!==c)return p("Handler called in response to message %s from child. Returning response from handler to child, action: %s.",e(d),d.func),void h(d.id,d.uuid,Array.isArray(c)?c:[c]);p("No handler for message %s from child found; relaying message on to parent, action: %s. Relayed message will have a new id.",e(d),d.func),function(n,i,s){const r=i(u("v2","tasks.startTask"),n.func,n.args,!0,n.teamsJsInstanceId),t=l.origin;s(r.uuid,((...i)=>{if(!l.window)return;if(!o().disableEnforceOriginMatchForChildResponses&&t!==l.origin)return void p("Origin of child window has changed, not sending response back to child window");const s=i.pop();p("Message from parent being relayed to child, id: %s",e(n)),h(n.id,n.uuid,i,s)}))}(d,i,s)}(i,a,c))}))}l.messageQueue=[];const p=c.extend("handleIncomingMessageFromChild");function h(n,i,o,s){const r=l.window,t=function(n,i,o,s){return{id:n,uuid:i,args:o||[],isPartialResponse:s}}(n,i,o,s),a=d(t),u=l.origin;r&&u&&(p("Sending message %s to %s via postMessage, args = %o",e(a),"child",a.args),r.postMessage(a,u))}function v(n,i){const o=l.window,s=function(n,i){return{func:n,args:i||[]}}(n,i),e=l.origin;o&&e?o.postMessage(s,e):l.messageQueue.push(s)}export{w as handleIncomingMessageFromChild,v as sendMessageEventToChild,m as shouldEventBeRelayedToChild,f as shouldProcessChildMessage,g as uninitializeChildCommunication};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{isSdkError as n,ErrorCode as t}from"../public/interfaces.js";import{latestRuntimeApiVersion as o}from"../public/runtime.js";import{isSerializable as r}from"../public/serializable.interface.js";import{UUID as i}from"../public/uuidObject.js";import{version as s}from"../public/version.js";import{uninitializeChildCommunication as a,shouldProcessChildMessage as c,handleIncomingMessageFromChild as d}from"./childCommunication.js";import{getMessageIdsAsLogString as u,flushMessageQueue as l}from"./communicationUtils.js";import{GlobalVars as g}from"./globalVars.js";import{callHandler as p}from"./handlers.js";import f from"./hostToAppTelemetry.js";import{serializeMessageRequest as m,deserializeMessageResponse as w}from"./messageObjects.js";import{tryPolyfillWithNestedAppAuthBridge as h}from"./nestedAppAuthUtils.js";import{getLogger as v,isFollowingApiVersionTagFormat as b}from"./telemetry.js";import{getCurrentTimestamp as W,ssrSafeWindow as M}from"./utils.js";import{validateOrigin as y}from"./validOrigins.js";const k=v("communication");class I{}class T{}function E(n,t){if(T.messageListener=n=>function(n){return e(this,void 0,void 0,(function*(){if(!n||!n.data||"object"!=typeof n.data)return void q("Unrecognized message format received by app, message being ignored. Message: %o",n);const e=n.source||n.originalEvent&&n.originalEvent.source,t=n.origin||n.originalEvent&&n.originalEvent.origin;return B(e,t).then((o=>{o?(!function(e,n){g.isFramelessWindow||I.parentWindow&&!I.parentWindow.closed&&e!==I.parentWindow||(I.parentWindow=e,I.parentOrigin=n);I.parentWindow&&I.parentWindow.closed&&(I.parentWindow=null,I.parentOrigin=null);l(I.parentWindow,I.parentOrigin,T.parentMessageQueue,"parent")}(e,t),e!==I.parentWindow?c(e,t)&&d(n,e,V,((e,n)=>T.callbacks.set(e,n))):Y(n)):q("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o",n,e,t)}))}))}(n),I.currentWindow=I.currentWindow||M(),I.parentWindow=I.currentWindow.parent!==I.currentWindow.self?I.currentWindow.parent:I.currentWindow.opener,I.topWindow=I.currentWindow.top,(I.parentWindow||n)&&I.currentWindow.addEventListener("message",T.messageListener,!1),!I.parentWindow){const e=I.currentWindow;if(!e.nativeInterface)return Promise.reject(new Error("Initialization Failed. No Parent window found."));g.isFramelessWindow=!0,e.onNativeMessage=Y}try{return I.parentOrigin="*",S(t,"initialize",[s,o,n]).then((([e,n,t,o])=>(h(o,I.currentWindow,{onMessage:H,sendPostMessage:L}),{context:e,clientType:n,runtimeConfig:t,clientSupportedSDKVersion:o})))}finally{I.parentOrigin=null}}function j(){I.currentWindow&&I.currentWindow.removeEventListener("message",T.messageListener,!1),I.currentWindow=null,I.parentWindow=null,I.parentOrigin=null,T.parentMessageQueue=[],T.nextMessageId=0,T.callbacks.clear(),T.promiseCallbacks.clear(),T.portCallbacks.clear(),T.legacyMessageIdsToUuidMap={},f.clearMessages(),a()}function O(e,n,...t){return S(e,n,t).then((([e])=>e))}function R(e,n,...t){return S(e,n,t).then((([e,n])=>{if(!e)throw new Error(n)}))}function C(e,n,t,...o){return S(e,n,o).then((([e,n])=>{if(!e)throw new Error(n||t)}))}function P(e,n,...t){return S(e,n,t).then((([e,n])=>{if(e)throw e;return n}))}function S(e,n,t=void 0){if(!b(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);return new Promise((o=>{const r=V(e,n,t);var i;o((i=r.uuid,new Promise((e=>{T.promiseCallbacks.set(i,e)}))))}))}function x(e){return e.map((e=>r(e)?e.serialize():e))}function N(o,r,i,s,a){var c;return e(this,void 0,void 0,(function*(){const e=x(r),[d]=yield S(s,o,e);if(a&&a(d)||!a&&n(d))throw new Error(`${d.errorCode}, message: ${null!==(c=d.message)&&void 0!==c?c:"None"}`);if(i.validate(d))return i.deserialize(d);throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host - ${JSON.stringify(d)}`)}))}function A(o,r,i,s){var a;return e(this,void 0,void 0,(function*(){const e=x(r),[c]=yield S(i,o,e);if(s&&s(c)||!s&&n(c))throw new Error(`${c.errorCode}, message: ${null!==(a=c.message)&&void 0!==a?a:"None"}`);if(void 0!==c)throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host`)}))}function U(e,n,t=void 0){if(!b(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const o=V(e,n,t);return r=o.uuid,new Promise(((e,n)=>{T.portCallbacks.set(r,((t,o)=>{t instanceof MessagePort?e(t):n(o&&o.length>0?o[0]:new Error("Host responded without port or error details."))}))}));var r}function $(e,n,t,o){let r;if(t instanceof Function?o=t:t instanceof Array&&(r=t),!b(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const i=V(e,n,r);o&&T.callbacks.set(i.uuid,o)}T.parentMessageQueue=[],T.topMessageQueue=[],T.nextMessageId=0,T.callbacks=new Map,T.promiseCallbacks=new Map,T.portCallbacks=new Map,T.legacyMessageIdsToUuidMap={};const z=k.extend("sendNestedAuthRequestToTopWindow");function L(e){const n=z,t=I.topWindow,o=function(e){const n=T.nextMessageId++,t=new i;return T.legacyMessageIdsToUuidMap[n]=t,{id:n,uuid:t,func:"nestedAppAuth.execute",timestamp:Date.now(),monotonicTimestamp:W(),args:[],data:e}}(e);return n("Message %s information: %o",u(o),{actionName:o.func}),F(t,o)}const _=k.extend("sendRequestToTargetWindowHelper");function F(e,n){const t=_,o=function(e){return e===I.topWindow&&Z()?"top":e===I.parentWindow?"parent":null}(e),r=m(n);if(g.isFramelessWindow)I.currentWindow&&I.currentWindow.nativeInterface&&(t("Sending message %s to %s via framelessPostMessage interface",u(r),o),I.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(r)));else{const i=function(e){return e===I.topWindow&&Z()?I.topOrigin:e===I.parentWindow?I.parentOrigin:null}(e);e&&i?(t("Sending message %s to %s via postMessage",u(r),o),e.postMessage(r,i)):(t("Adding message %s to %s message queue",u(r),o),ee(e).push(n))}return n}const Q=k.extend("sendMessageToParentHelper");function V(e,n,t,o){const r=Q,s=I.parentWindow,a=function(e,n,t,o){const r=T.nextMessageId++,s=new i;return T.legacyMessageIdsToUuidMap[r]=s,{id:r,uuid:s,func:n,timestamp:Date.now(),monotonicTimestamp:W(),args:t||[],apiVersionTag:e,isProxiedFromChild:null!=o&&o}}(e,n,t,o);return f.storeCallbackInformation(a.uuid,{name:n,calledAt:a.timestamp}),r("Message %s information: %o",u(a),{actionName:n,args:t}),F(s,a)}const q=k.extend("processIncomingMessage");const D=k.extend("processAuthBridgeMessage");function H(e,n){var t,o;const r=D;if(!e||!e.data||"object"!=typeof e.data)return void r("Unrecognized message format received by app, message being ignored. Message: %o",e);const{args:i}=e.data,[,s]=null!=i?i:[],a=(()=>{try{return JSON.parse(s)}catch(e){return null}})();if(!a||"object"!=typeof a||"NestedAppAuthResponse"!==a.messageType)return void r("Unrecognized data format received by app, message being ignored. Message: %o",e);const c=e.source||(null===(t=null==e?void 0:e.originalEvent)||void 0===t?void 0:t.source),d=e.origin||(null===(o=null==e?void 0:e.originalEvent)||void 0===o?void 0:o.origin);c?B(c,d)?(I.topWindow&&!I.topWindow.closed&&c!==I.topWindow||(I.topWindow=c,I.topOrigin=d),I.topWindow&&I.topWindow.closed&&(I.topWindow=null,I.topOrigin=null),l(I.topWindow,I.topOrigin,T.topMessageQueue,"top"),n(s)):r("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin"):r("Message being ignored by app because it is coming for a target that is null")}const J=k.extend("shouldProcessIncomingMessage");function B(n,t){return e(this,void 0,void 0,(function*(){if(I.currentWindow&&n===I.currentWindow)return J("Should not process message because it is coming from the current window"),!1;if(I.currentWindow&&I.currentWindow.location&&t&&t===I.currentWindow.location.origin)return!0;{let e;try{e=new URL(t)}catch(e){return J("Message has an invalid origin of %s",t),!1}const n=yield y(e);return n||J("Message has an invalid origin of %s",t),n}}))}const K=k.extend("handleIncomingMessageFromParent");function G(e,n){if(n){const t=[...e].find((([e,t])=>e.toString()===n.toString()));if(t)return t[0]}}function X(e,n){const t=G(n,e.uuid);t&&n.delete(t),e.uuid?T.legacyMessageIdsToUuidMap={}:delete T.legacyMessageIdsToUuidMap[e.id]}function Y(e){const n=K,t=W();if("id"in e.data&&"number"==typeof e.data.id){const o=e.data,r=w(o),i=function(e){const n=K;if(!e.uuid)return T.legacyMessageIdsToUuidMap[e.id];{const n=e.uuid,t=G(T.callbacks,n);if(t)return t;const o=G(T.promiseCallbacks,n);if(o)return o;const r=G(T.portCallbacks,n);if(r)return r}n("Received message %s that failed to produce a callbackId",u(e))}(r);if(i){const o=T.callbacks.get(i);n("Received a response from parent for message %s",i.toString()),f.handlePerformanceMetrics(i,r,n,t),o&&(n("Invoking the registered callback for message %s with arguments %o",i.toString(),r.args),o.apply(null,[...r.args,r.isPartialResponse]),function(e){return!0===e.data.isPartialResponse}(e)||(n("Removing registered callback for message %s",i.toString()),X(r,T.callbacks)));const s=T.promiseCallbacks.get(i);s&&(n("Invoking the registered promise callback for message %s with arguments %o",i.toString(),r.args),s(r.args),n("Removing registered promise callback for message %s",i.toString()),X(r,T.promiseCallbacks));const a=T.portCallbacks.get(i);if(a){let t;n("Invoking the registered port callback for message %s with arguments %o",i.toString(),r.args),e.ports&&e.ports[0]instanceof MessagePort&&(t=e.ports[0]),a(t,r.args),n("Removing registered port callback for message %s",i.toString()),X(r,T.portCallbacks)}r.uuid&&(T.legacyMessageIdsToUuidMap={})}}else if("func"in e.data&&"string"==typeof e.data.func){const o=e.data;f.handleOneWayPerformanceMetrics(o,n,t),n('Received a message from parent %s, action: "%s"',u(o),o.func),p(o.func,o.args)}else n("Received an unknown message: %O",e)}function Z(){return I.topWindow!==I.parentWindow}function ee(e){return e===I.topWindow&&Z()?T.topMessageQueue:e===I.parentWindow?T.parentMessageQueue:[]}function ne(e,n){let t;t=I.currentWindow.setInterval((()=>{0===ee(e).length&&(clearInterval(t),n())}),100)}export{I as Communication,A as callFunctionInHost,N as callFunctionInHostAndHandleResponse,E as initializeCommunication,U as requestPortFromParentWithVersion,P as sendAndHandleSdkError,R as sendAndHandleStatusAndReason,C as sendAndHandleStatusAndReasonWithDefaultError,O as sendAndUnwrap,$ as sendMessageToParent,S as sendMessageToParentAsync,L as sendNestedAuthRequestToTopWindow,j as uninitializeCommunication,ne as waitForMessageQueue};
1
+ import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{isSdkError as n,ErrorCode as t}from"../public/interfaces.js";import{latestRuntimeApiVersion as o}from"../public/runtime.js";import{isSerializable as r}from"../public/serializable.interface.js";import{UUID as i}from"../public/uuidObject.js";import{version as s}from"../public/version.js";import{uninitializeChildCommunication as a,shouldProcessChildMessage as c,handleIncomingMessageFromChild as d}from"./childCommunication.js";import{getMessageIdsAsLogString as u,flushMessageQueue as l}from"./communicationUtils.js";import{GlobalVars as g}from"./globalVars.js";import{callHandler as p}from"./handlers.js";import f from"./hostToAppTelemetry.js";import{serializeMessageRequest as m,deserializeMessageResponse as w}from"./messageObjects.js";import{tryPolyfillWithNestedAppAuthBridge as h}from"./nestedAppAuthUtils.js";import{getLogger as v,isFollowingApiVersionTagFormat as b}from"./telemetry.js";import{getCurrentTimestamp as W,ssrSafeWindow as M}from"./utils.js";import{validateOrigin as y}from"./validOrigins.js";const k=v("communication");class I{}class T{}function E(n,t){if(T.messageListener=n=>function(n){return e(this,void 0,void 0,(function*(){if(!n||!n.data||"object"!=typeof n.data)return void J("Unrecognized message format received by app, message being ignored. Message: %o",n);const e=n.source||n.originalEvent&&n.originalEvent.source,t=n.origin||n.originalEvent&&n.originalEvent.origin;return B(e,t).then((o=>{o?(!function(e,n){g.isFramelessWindow||I.parentWindow&&!I.parentWindow.closed&&e!==I.parentWindow||(I.parentWindow=e,I.parentOrigin=n);I.parentWindow&&I.parentWindow.closed&&(I.parentWindow=null,I.parentOrigin=null);l(I.parentWindow,I.parentOrigin,T.parentMessageQueue,"parent")}(e,t),e!==I.parentWindow?c(e,t)&&d(n,e,V,((e,n)=>T.callbacks.set(e,n))):Y(n)):J("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o",n,e,t)}))}))}(n),I.currentWindow=I.currentWindow||M(),I.parentWindow=I.currentWindow.parent!==I.currentWindow.self?I.currentWindow.parent:I.currentWindow.opener,I.topWindow=I.currentWindow.top,(I.parentWindow||n)&&I.currentWindow.addEventListener("message",T.messageListener,!1),!I.parentWindow){const e=I.currentWindow;if(!e.nativeInterface)return Promise.reject(new Error("Initialization Failed. No Parent window found."));g.isFramelessWindow=!0,e.onNativeMessage=Y}try{return I.parentOrigin="*",S(t,"initialize",[s,o,n]).then((([e,n,t,o])=>(h(o,I.currentWindow,{onMessage:D,sendPostMessage:L}),{context:e,clientType:n,runtimeConfig:t,clientSupportedSDKVersion:o})))}finally{I.parentOrigin=null}}function j(){I.currentWindow&&I.currentWindow.removeEventListener("message",T.messageListener,!1),I.currentWindow=null,I.parentWindow=null,I.parentOrigin=null,T.parentMessageQueue=[],T.nextMessageId=0,T.callbacks.clear(),T.promiseCallbacks.clear(),T.portCallbacks.clear(),T.legacyMessageIdsToUuidMap={},f.clearMessages(),a()}function O(e,n,...t){return S(e,n,t).then((([e])=>e))}function R(e,n,...t){return S(e,n,t).then((([e,n])=>{if(!e)throw new Error(n)}))}function C(e,n,t,...o){return S(e,n,o).then((([e,n])=>{if(!e)throw new Error(n||t)}))}function P(e,n,...t){return S(e,n,t).then((([e,n])=>{if(e)throw e;return n}))}function S(e,n,t=void 0){if(!b(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);return new Promise((o=>{const r=V(e,n,t);var i;o((i=r.uuid,new Promise((e=>{T.promiseCallbacks.set(i,e)}))))}))}function x(e){return e.map((e=>r(e)?e.serialize():e))}function N(o,r,i,s,a){var c;return e(this,void 0,void 0,(function*(){const e=x(r),[d]=yield S(s,o,e);if(a&&a(d)||!a&&n(d))throw new Error(`${d.errorCode}, message: ${null!==(c=d.message)&&void 0!==c?c:"None"}`);if(i.validate(d))return i.deserialize(d);throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host - ${JSON.stringify(d)}`)}))}function A(o,r,i,s){var a;return e(this,void 0,void 0,(function*(){const e=x(r),[c]=yield S(i,o,e);if(s&&s(c)||!s&&n(c))throw new Error(`${c.errorCode}, message: ${null!==(a=c.message)&&void 0!==a?a:"None"}`);if(void 0!==c)throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host`)}))}function U(e,n,t=void 0){if(!b(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const o=V(e,n,t);return r=o.uuid,new Promise(((e,n)=>{T.portCallbacks.set(r,((t,o)=>{t instanceof MessagePort?e(t):n(o&&o.length>0?o[0]:new Error("Host responded without port or error details."))}))}));var r}function $(e,n,t,o){let r;if(t instanceof Function?o=t:t instanceof Array&&(r=t),!b(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const i=V(e,n,r);o&&T.callbacks.set(i.uuid,o)}T.parentMessageQueue=[],T.topMessageQueue=[],T.nextMessageId=0,T.callbacks=new Map,T.promiseCallbacks=new Map,T.portCallbacks=new Map,T.legacyMessageIdsToUuidMap={};const z=k.extend("sendNestedAuthRequestToTopWindow");function L(e,n){const t=z,o=I.topWindow,r=function(e,n){const t=T.nextMessageId++,o=new i;return T.legacyMessageIdsToUuidMap[t]=o,{id:t,uuid:o,func:"nestedAppAuth.execute",timestamp:Date.now(),monotonicTimestamp:W(),apiVersionTag:n,args:[],data:e}}(e,n);return t("Message %s information: %o",u(r),{actionName:r.func}),F(o,r)}const _=k.extend("sendRequestToTargetWindowHelper");function F(e,n){const t=_,o=function(e){return e===I.topWindow&&Z()?"top":e===I.parentWindow?"parent":null}(e),r=m(n);if(g.isFramelessWindow)I.currentWindow&&I.currentWindow.nativeInterface&&(t("Sending message %s to %s via framelessPostMessage interface",u(r),o),I.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(r)));else{const i=function(e){return e===I.topWindow&&Z()?I.topOrigin:e===I.parentWindow?I.parentOrigin:null}(e);e&&i?(t("Sending message %s to %s via postMessage",u(r),o),e.postMessage(r,i)):(t("Adding message %s to %s message queue",u(r),o),ee(e).push(n))}return n}const Q=k.extend("sendMessageToParentHelper");function V(e,n,t,o,r){const s=Q,a=I.parentWindow,c=function(e,n,t,o,r){const s=T.nextMessageId++,a=new i;T.legacyMessageIdsToUuidMap[s]=a;const c=!0===o?r:g.teamsJsInstanceId;return{id:s,uuid:a,func:n,timestamp:Date.now(),monotonicTimestamp:W(),args:t||[],apiVersionTag:e,isProxiedFromChild:null!=o&&o,teamsJsInstanceId:c}}(e,n,t,o,r);return f.storeCallbackInformation(c.uuid,{name:n,calledAt:c.timestamp}),s("Message %s information: %o",u(c),{actionName:n,args:t}),F(a,c)}const J=k.extend("processIncomingMessage");const q=k.extend("processAuthBridgeMessage");function D(e,n){var t,o;const r=q;if(!e||!e.data||"object"!=typeof e.data)return void r("Unrecognized message format received by app, message being ignored. Message: %o",e);const{args:i}=e.data,[,s]=null!=i?i:[],a=(()=>{try{return JSON.parse(s)}catch(e){return null}})();if(!a||"object"!=typeof a||"NestedAppAuthResponse"!==a.messageType)return void r("Unrecognized data format received by app, message being ignored. Message: %o",e);const c=e.source||(null===(t=null==e?void 0:e.originalEvent)||void 0===t?void 0:t.source),d=e.origin||(null===(o=null==e?void 0:e.originalEvent)||void 0===o?void 0:o.origin);c?B(c,d)?(I.topWindow&&!I.topWindow.closed&&c!==I.topWindow||(I.topWindow=c,I.topOrigin=d),I.topWindow&&I.topWindow.closed&&(I.topWindow=null,I.topOrigin=null),l(I.topWindow,I.topOrigin,T.topMessageQueue,"top"),n(s)):r("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin"):r("Message being ignored by app because it is coming for a target that is null")}const H=k.extend("shouldProcessIncomingMessage");function B(n,t){return e(this,void 0,void 0,(function*(){if(I.currentWindow&&n===I.currentWindow)return H("Should not process message because it is coming from the current window"),!1;if(I.currentWindow&&I.currentWindow.location&&t&&t===I.currentWindow.location.origin)return!0;{let e;try{e=new URL(t)}catch(e){return H("Message has an invalid origin of %s",t),!1}const n=yield y(e);return n||H("Message has an invalid origin of %s",t),n}}))}const K=k.extend("handleIncomingMessageFromParent");function G(e,n){if(n){const t=[...e].find((([e,t])=>e.toString()===n.toString()));if(t)return t[0]}}function X(e,n){const t=G(n,e.uuid);t&&n.delete(t),e.uuid?T.legacyMessageIdsToUuidMap={}:delete T.legacyMessageIdsToUuidMap[e.id]}function Y(e){const n=K,t=W();if("id"in e.data&&"number"==typeof e.data.id){const o=e.data,r=w(o),i=function(e){const n=K;if(!e.uuid)return T.legacyMessageIdsToUuidMap[e.id];{const n=e.uuid,t=G(T.callbacks,n);if(t)return t;const o=G(T.promiseCallbacks,n);if(o)return o;const r=G(T.portCallbacks,n);if(r)return r}n("Received message %s that failed to produce a callbackId",u(e))}(r);if(i){const o=T.callbacks.get(i);n("Received a response from parent for message %s",i.toString()),f.handlePerformanceMetrics(i,r,n,t),o&&(n("Invoking the registered callback for message %s with arguments %o",i.toString(),r.args),o.apply(null,[...r.args,r.isPartialResponse]),function(e){return!0===e.data.isPartialResponse}(e)||(n("Removing registered callback for message %s",i.toString()),X(r,T.callbacks)));const s=T.promiseCallbacks.get(i);s&&(n("Invoking the registered promise callback for message %s with arguments %o",i.toString(),r.args),s(r.args),n("Removing registered promise callback for message %s",i.toString()),X(r,T.promiseCallbacks));const a=T.portCallbacks.get(i);if(a){let t;n("Invoking the registered port callback for message %s with arguments %o",i.toString(),r.args),e.ports&&e.ports[0]instanceof MessagePort&&(t=e.ports[0]),a(t,r.args),n("Removing registered port callback for message %s",i.toString()),X(r,T.portCallbacks)}r.uuid&&(T.legacyMessageIdsToUuidMap={})}}else if("func"in e.data&&"string"==typeof e.data.func){const o=e.data;f.handleOneWayPerformanceMetrics(o,n,t),n('Received a message from parent %s, action: "%s"',u(o),o.func),p(o.func,o.args)}else n("Received an unknown message: %O",e)}function Z(){return I.topWindow!==I.parentWindow}function ee(e){return e===I.topWindow&&Z()?T.topMessageQueue:e===I.parentWindow?T.parentMessageQueue:[]}function ne(e,n){let t;t=I.currentWindow.setInterval((()=>{0===ee(e).length&&(clearInterval(t),n())}),100)}export{I as Communication,A as callFunctionInHost,N as callFunctionInHostAndHandleResponse,E as initializeCommunication,U as requestPortFromParentWithVersion,P as sendAndHandleSdkError,R as sendAndHandleStatusAndReason,C as sendAndHandleStatusAndReasonWithDefaultError,O as sendAndUnwrap,$ as sendMessageToParent,S as sendMessageToParentAsync,L as sendNestedAuthRequestToTopWindow,j as uninitializeCommunication,ne as waitForMessageQueue};
@@ -1 +1 @@
1
- class i{}i.initializeCalled=!1,i.initializeCompleted=!1,i.additionalValidOrigins=[],i.initializePromise=void 0,i.isFramelessWindow=!1,i.frameContext=void 0,i.hostClientType=void 0,i.printCapabilityEnabled=!1;export{i as GlobalVars};
1
+ import{UUID as i}from"../public/uuidObject.js";class e{}e.initializeCalled=!1,e.initializeCompleted=!1,e.additionalValidOrigins=[],e.initializePromise=void 0,e.isFramelessWindow=!1,e.frameContext=void 0,e.hostClientType=void 0,e.printCapabilityEnabled=!1,e.teamsJsInstanceId=(new i).toString();export{e as GlobalVars};
@@ -1 +1 @@
1
- import{GlobalVars as e}from"./globalVars.js";import{getLogger as t}from"./telemetry.js";const n=t("nestedAppAuthUtils"),s=n.extend("tryPolyfillWithNestedAppAuthBridge");function r(t,n,r){var i;const d=s;if(e.isFramelessWindow)return void d("Cannot polyfill nestedAppAuthBridge as current window is frameless");if(!n)return void d("Cannot polyfill nestedAppAuthBridge as current window does not exist");const p=(()=>{try{return JSON.parse(t)}catch(e){return null}})();if(!p||!(null===(i=p.supports)||void 0===i?void 0:i.nestedAppAuth))return void d("Cannot polyfill nestedAppAuthBridge as current hub does not support nested app auth");const u=n;if(u.nestedAppAuthBridge)return void d("nestedAppAuthBridge already exists on current window, skipping polyfill");const a=function(e,t){const n=o;if(!e)return n("nestedAppAuthBridge cannot be created as current window does not exist"),null;const{onMessage:s,sendPostMessage:r}=t,i=e=>t=>s(t,e);return{addEventListener:(t,s)=>{"message"===t?e.addEventListener(t,i(s)):n(`Event ${t} is not supported by nestedAppAuthBridge`)},postMessage:e=>{const t=(()=>{try{return JSON.parse(e)}catch(e){return null}})();t&&"object"==typeof t&&"NestedAppAuthRequest"===t.messageType?r(e):n("Unrecognized data format received by app, message being ignored. Message: %o",e)},removeEventListener:(t,n)=>{e.removeEventListener(t,i(n))}}}(u,r);a&&(u.nestedAppAuthBridge=a)}const o=n.extend("createNestedAppAuthBridge");export{r as tryPolyfillWithNestedAppAuthBridge};
1
+ import{GlobalVars as e}from"./globalVars.js";import{getLogger as t,getApiVersionTag as n}from"./telemetry.js";const s=t("nestedAppAuthUtils"),r=s.extend("tryPolyfillWithNestedAppAuthBridge"),o="v2";function i(t,s,i){var p;const u=r;if(e.isFramelessWindow)return void u("Cannot polyfill nestedAppAuthBridge as current window is frameless");if(!s)return void u("Cannot polyfill nestedAppAuthBridge as current window does not exist");if(s.parent!==s.top)return void u("Default NAA bridge injection not supported in nested iframe. Use standalone NAA bridge instead.");const a=(()=>{try{return JSON.parse(t)}catch(e){return null}})();if(!a||!(null===(p=a.supports)||void 0===p?void 0:p.nestedAppAuth))return void u("Cannot polyfill nestedAppAuthBridge as current hub does not support nested app auth");const l=s;if(l.nestedAppAuthBridge)return void u("nestedAppAuthBridge already exists on current window, skipping polyfill");const A=function(e,t){const s=d;if(!e)return s("nestedAppAuthBridge cannot be created as current window does not exist"),null;const{onMessage:r,sendPostMessage:i}=t,p=e=>t=>r(t,e);return{addEventListener:(t,n)=>{"message"===t?e.addEventListener(t,p(n)):s(`Event ${t} is not supported by nestedAppAuthBridge`)},postMessage:e=>{const t=(()=>{try{return JSON.parse(e)}catch(e){return null}})();if(!t||"object"!=typeof t||"NestedAppAuthRequest"!==t.messageType)return void s("Unrecognized data format received by app, message being ignored. Message: %o",e);const r=n(o,"nestedAppAuth.execute");i(e,r)},removeEventListener:(t,n)=>{e.removeEventListener(t,p(n))}}}(l,i);A&&(l.nestedAppAuthBridge=A)}const d=s.extend("createNestedAppAuthBridge");export{o as nestedAppAuthTelemetryVersionNumber,i as tryPolyfillWithNestedAppAuthBridge};
@@ -0,0 +1 @@
1
+ import e from"../../../../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js";const t="1.0.0",o={onMessage:function(e,t){if(!e||!e.data||"object"!=typeof e.data||null===e.data)return void a("Invalid message format, ignoring. Message: %o",e);if(!function(e,t){if(e&&e!==window.top)return a("Should not process message because it is not coming from the top window"),!1;if(t===n)try{return"https:"===new URL(t).protocol}catch(e){return d("Invalid message origin URL:",e),!1}return!1}(e.source,e.origin))return void a("Message source/origin not allowed, ignoring.");const{args:o}=e.data,[,r]=null!=o?o:[],i=(()=>{try{return JSON.parse(r)}catch(e){return d("Failed to parse response message:",e),null}})();if(!i||"NestedAppAuthResponse"!==i.messageType)return void a("Invalid response format, ignoring. Message: %o",e);t(r)}};let n=null,r=!1;function i(t,i,p=!1){if(r=p,!t)throw new Error("Cannot polyfill nestedAppAuthBridge as the current window does not exist");if(!i)throw new Error("Top origin is required to initialize the Nested App Auth Bridge");try{const e=new URL(i);if("https:"!==e.protocol)throw new Error(`Invalid top origin: ${i}. Only HTTPS origins are allowed.`);n=e.origin}catch(e){throw new Error(`Failed to initialize bridge: invalid top origin: ${i}`)}const u=t;if(u.nestedAppAuthBridge)return void a("Nested App Auth Bridge is already present");const g=function(t){const r=new WeakMap,{onMessage:i}=o,p=e=>t=>i(t,e);return{addEventListener:(e,o)=>{if("message"===e){const n=p(o);r.set(o,n),t.addEventListener(e,n)}else a(`Event ${e} is not supported by nestedAppAuthBridge`)},postMessage:o=>{if(!t.top)throw new Error("window.top is not available for posting messages");try{const r=JSON.parse(o);if("object"==typeof r&&"NestedAppAuthRequest"===r.messageType){const r=function(t){const o=Date.now();return{id:s(),uuid:e(),func:"nestedAppAuth.execute",timestamp:o,apiVersionTag:"v2_nestedAppAuth.execute",monotonicTimestamp:o,args:[],data:t}}(o);if(t===t.top||!n)return void d("Not in an embedded iframe; skipping postMessage.");t.top.postMessage(r,n)}}catch(e){return void d("Failed to parse message:",e,"Original message:",o)}},removeEventListener:(e,o)=>{const n=r.get(o);n&&(t.removeEventListener(e,n),r.delete(o))}}}(u);g&&(u.nestedAppAuthBridge=g)}function s(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2,11)}function a(...e){r&&console.log(...e)}function d(...e){r&&console.error(...e)}export{i as initialize,t as version};
@@ -1 +1 @@
1
- import{GlobalVars as t}from"../internal/globalVars.js";import{ensureInitialized as n}from"../internal/internalAPIs.js";import{HostClientType as o}from"./constants.js";import{runtime as e}from"./runtime.js";function i(){var i;return null!==(i=n(e)&&(e.isNAAChannelRecommended||!(!n(e)||t.hostClientType!==o.android&&t.hostClientType!==o.ios&&t.hostClientType!==o.ipados&&t.hostClientType!==o.visionOS||!e.isLegacyTeams||!e.supports.nestedAppAuth)))&&void 0!==i&&i}export{i as isNAAChannelRecommended};
1
+ import{__awaiter as n}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{Communication as r,callFunctionInHostAndHandleResponse as t}from"../internal/communication.js";import{GlobalVars as i}from"../internal/globalVars.js";import{ensureInitialized as e}from"../internal/internalAPIs.js";import{getApiVersionTag as o}from"../internal/telemetry.js";import{HostClientType as s,errorNotSupportedOnPlatform as a}from"./constants.js";import{runtime as p}from"./runtime.js";const u="v2",l={validate:n=>Array.isArray(n)||"object"==typeof n,deserialize:n=>n};var d;function c(){var n;return null!==(n=e(p)&&(p.isNAAChannelRecommended||!(!e(p)||i.hostClientType!==s.android&&i.hostClientType!==s.ios&&i.hostClientType!==s.ipados&&i.hostClientType!==s.visionOS||!p.isLegacyTeams||!p.supports.nestedAppAuth)))&&void 0!==n&&n}function m(){return e(p),r.parentOrigin}function h(){var n;return null!==(n=e(p)&&p.canParentManageNAATrustedOrigins)&&void 0!==n&&n}function f(){var n;return null!==(n=e(p)&&p.isDeeplyNestedAuthSupported)&&void 0!==n&&n}function A(r){return n(this,void 0,void 0,(function*(){if(!h())throw a;const n=r.map(g);return y(d.ADD,n)}))}function v(r){return n(this,void 0,void 0,(function*(){if(!h())throw a;const n=r.map(g);return y(d.DELETE,n)}))}function y(r,i){return n(this,void 0,void 0,(function*(){if(window.parent!==window.top)throw new Error("This API is only available in the top-level parent.");if(!Array.isArray(i)||0===i.length)throw new Error(`The '${i}' parameter is required and must be a non-empty array.`);const n=[new w(r,i)];return t("nestedAppAuth.manageNAATrustedOrigins",n,l,o(u,"nestedAppAuth.manageNAATrustedOrigins"))}))}function g(n){try{return new URL(n).origin.toLowerCase()}catch(r){throw new Error(`Invalid origin provided: ${n}`)}}!function(n){n.ADD="ADD",n.DELETE="DELETE"}(d||(d={}));class w{constructor(n,r){this.action=n,this.appOrigins=r}serialize(){return{action:this.action,appOrigins:this.appOrigins}}}export{A as addNAATrustedOrigins,h as canParentManageNAATrustedOrigins,v as deleteNAATrustedOrigins,m as getParentOrigin,f as isDeeplyNestedAuthSupported,c as isNAAChannelRecommended};
@@ -1 +1 @@
1
- import{__rest as o}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{errorRuntimeNotInitialized as e,errorRuntimeNotSupported as s}from"../internal/constants.js";import{GlobalVars as i}from"../internal/globalVars.js";import{getLogger as t}from"../internal/telemetry.js";import{compareSDKVersions as n,deepFreeze as a}from"../internal/utils.js";import{HostClientType as r,teamsMinAdaptiveCardVersion as p}from"./constants.js";const l=t("runtime"),d=4;function u(o){return o.apiVersion===d}function c(o){if(u(o))return!0;throw-1===o.apiVersion?new Error(e):new Error(s)}let g={apiVersion:-1,supports:{}};const m={apiVersion:4,isNAAChannelRecommended:!1,hostVersionsInfo:p,isLegacyTeams:!0,supports:{appInstallDialog:{},appEntity:{},call:{},chat:{},conversations:{},dialog:{card:{bot:{}},url:{bot:{},parentCommunication:{}},update:{}},interactive:{},logs:{},meetingRoom:{},menus:{},monetization:{},notifications:{},pages:{config:{},backStack:{},fullTrust:{}},remoteCamera:{},teams:{fullTrust:{}},teamsCore:{},video:{sharedFrame:{}}}},b=[r.desktop,r.web,r.rigel,r.surfaceHub,r.teamsRoomsWindows,r.teamsRoomsAndroid,r.teamsPhones,r.teamsDisplays],y=[r.android,r.ios,r.ipados,r.visionOS],f=[...b,...y];function h(o){let e=o;if(e.apiVersion<d&&v.forEach((o=>{e.apiVersion===o.versionToUpgradeFrom&&(e=o.upgradeToNextVersion(e))})),u(e))return e;throw new Error("Received a runtime that could not be upgraded to the latest version")}const v=[{versionToUpgradeFrom:1,upgradeToNextVersion:o=>{var e;return{apiVersion:2,hostVersionsInfo:void 0,isLegacyTeams:o.isLegacyTeams,supports:Object.assign(Object.assign({},o.supports),{dialog:o.supports.dialog?{card:void 0,url:o.supports.dialog,update:null===(e=o.supports.dialog)||void 0===e?void 0:e.update}:void 0})}}},{versionToUpgradeFrom:2,upgradeToNextVersion:e=>{const s=e.supports,i=o(s,["appNotification"]);return Object.assign(Object.assign({},e),{apiVersion:3,supports:i})}},{versionToUpgradeFrom:3,upgradeToNextVersion:o=>{var e,s,i,t,n;return{apiVersion:4,hostVersionsInfo:o.hostVersionsInfo,isNAAChannelRecommended:o.isNAAChannelRecommended,isLegacyTeams:o.isLegacyTeams,supports:Object.assign(Object.assign({},o.supports),{dialog:o.supports.dialog?{card:null===(e=o.supports.dialog)||void 0===e?void 0:e.card,url:{bot:null===(i=null===(s=o.supports.dialog)||void 0===s?void 0:s.url)||void 0===i?void 0:i.bot,parentCommunication:(null===(t=o.supports.dialog)||void 0===t?void 0:t.url)?{}:void 0},update:null===(n=o.supports.dialog)||void 0===n?void 0:n.update}:void 0})}}}],T={"1.0.0":[{capability:{pages:{appButton:{},tabs:{}},stageView:{}},hostClientTypes:b}],"1.9.0":[{capability:{location:{}},hostClientTypes:f}],"2.0.0":[{capability:{people:{}},hostClientTypes:f},{capability:{sharing:{}},hostClientTypes:[r.desktop,r.web]}],"2.0.1":[{capability:{teams:{fullTrust:{joinedTeams:{}}}},hostClientTypes:[r.android,r.desktop,r.ios,r.teamsRoomsAndroid,r.teamsPhones,r.teamsDisplays,r.web]},{capability:{webStorage:{}},hostClientTypes:[r.desktop]}],"2.0.5":[{capability:{webStorage:{}},hostClientTypes:[r.android,r.ios]}],"2.0.8":[{capability:{sharing:{}},hostClientTypes:[r.android,r.ios]}],"2.1.1":[{capability:{nestedAppAuth:{}},hostClientTypes:[r.android,r.ios,r.ipados,r.visionOS]}]},V=l.extend("generateBackCompatRuntimeConfig");function C(o,e){const s=Object.assign({},o);for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&("object"!=typeof e[i]||Array.isArray(e[i])?i in o||(s[i]=e[i]):s[i]=C(o[i]||{},e[i]));return s}function j(o,e,s){V("generating back compat runtime config for %s",o);let t=Object.assign({},e.supports);V("Supported capabilities in config before updating based on highestSupportedVersion: %o",t),Object.keys(s).forEach((e=>{n(o,e)>=0&&s[e].forEach((o=>{void 0!==i.hostClientType&&o.hostClientTypes.includes(i.hostClientType)&&(t=C(t,o.capability))}))}));const a={apiVersion:d,hostVersionsInfo:p,isLegacyTeams:!0,supports:t};return V("Runtime config after updating based on highestSupportedVersion: %o",a),a}const w=l.extend("applyRuntimeConfig");function O(o){"string"==typeof o.apiVersion&&(w("Trying to apply runtime with string apiVersion, processing as v1: %o",o),o=Object.assign(Object.assign({},o),{apiVersion:1})),w("Fast-forwarding runtime %o",o);const e=h(o);w("Applying runtime %o",e),g=a(e)}export{O as applyRuntimeConfig,h as fastForwardRuntime,j as generateVersionBasedTeamsRuntimeConfig,c as isRuntimeInitialized,d as latestRuntimeApiVersion,T as mapTeamsVersionToSupportedCapabilities,g as runtime,v as upgradeChain,f as v1HostClientTypes,y as v1MobileHostClientTypes,m as versionAndPlatformAgnosticTeamsRuntimeConfig};
1
+ import{__rest as o}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{errorRuntimeNotInitialized as e,errorRuntimeNotSupported as s}from"../internal/constants.js";import{GlobalVars as i}from"../internal/globalVars.js";import{getLogger as t}from"../internal/telemetry.js";import{compareSDKVersions as n,deepFreeze as a}from"../internal/utils.js";import{HostClientType as r,teamsMinAdaptiveCardVersion as p}from"./constants.js";const l=t("runtime"),d=4;function u(o){return o.apiVersion===d}function c(o){if(u(o))return!0;throw-1===o.apiVersion?new Error(e):new Error(s)}let g={apiVersion:-1,supports:{}};const m={apiVersion:4,isNAAChannelRecommended:!1,isDeeplyNestedAuthSupported:!1,hostVersionsInfo:p,isLegacyTeams:!0,supports:{appInstallDialog:{},appEntity:{},call:{},chat:{},conversations:{},dialog:{card:{bot:{}},url:{bot:{},parentCommunication:{}},update:{}},interactive:{},logs:{},meetingRoom:{},menus:{},monetization:{},notifications:{},pages:{config:{},backStack:{},fullTrust:{}},remoteCamera:{},teams:{fullTrust:{}},teamsCore:{},video:{sharedFrame:{}}}},y=[r.desktop,r.web,r.rigel,r.surfaceHub,r.teamsRoomsWindows,r.teamsRoomsAndroid,r.teamsPhones,r.teamsDisplays],b=[r.android,r.ios,r.ipados,r.visionOS],f=[...y,...b];function h(o){let e=o;if(e.apiVersion<d&&v.forEach((o=>{e.apiVersion===o.versionToUpgradeFrom&&(e=o.upgradeToNextVersion(e))})),u(e))return e;throw new Error("Received a runtime that could not be upgraded to the latest version")}const v=[{versionToUpgradeFrom:1,upgradeToNextVersion:o=>{var e;return{apiVersion:2,hostVersionsInfo:void 0,isLegacyTeams:o.isLegacyTeams,supports:Object.assign(Object.assign({},o.supports),{dialog:o.supports.dialog?{card:void 0,url:o.supports.dialog,update:null===(e=o.supports.dialog)||void 0===e?void 0:e.update}:void 0})}}},{versionToUpgradeFrom:2,upgradeToNextVersion:e=>{const s=e.supports,i=o(s,["appNotification"]);return Object.assign(Object.assign({},e),{apiVersion:3,supports:i})}},{versionToUpgradeFrom:3,upgradeToNextVersion:o=>{var e,s,i,t,n;return{apiVersion:4,hostVersionsInfo:o.hostVersionsInfo,isNAAChannelRecommended:o.isNAAChannelRecommended,isLegacyTeams:o.isLegacyTeams,supports:Object.assign(Object.assign({},o.supports),{dialog:o.supports.dialog?{card:null===(e=o.supports.dialog)||void 0===e?void 0:e.card,url:{bot:null===(i=null===(s=o.supports.dialog)||void 0===s?void 0:s.url)||void 0===i?void 0:i.bot,parentCommunication:(null===(t=o.supports.dialog)||void 0===t?void 0:t.url)?{}:void 0},update:null===(n=o.supports.dialog)||void 0===n?void 0:n.update}:void 0})}}}],T={"1.0.0":[{capability:{pages:{appButton:{},tabs:{}},stageView:{}},hostClientTypes:y}],"1.9.0":[{capability:{location:{}},hostClientTypes:f}],"2.0.0":[{capability:{people:{}},hostClientTypes:f},{capability:{sharing:{}},hostClientTypes:[r.desktop,r.web]}],"2.0.1":[{capability:{teams:{fullTrust:{joinedTeams:{}}}},hostClientTypes:[r.android,r.desktop,r.ios,r.teamsRoomsAndroid,r.teamsPhones,r.teamsDisplays,r.web]},{capability:{webStorage:{}},hostClientTypes:[r.desktop]}],"2.0.5":[{capability:{webStorage:{}},hostClientTypes:[r.android,r.ios]}],"2.0.8":[{capability:{sharing:{}},hostClientTypes:[r.android,r.ios]}],"2.1.1":[{capability:{nestedAppAuth:{}},hostClientTypes:[r.android,r.ios,r.ipados,r.visionOS]}]},V=l.extend("generateBackCompatRuntimeConfig");function C(o,e){const s=Object.assign({},o);for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&("object"!=typeof e[i]||Array.isArray(e[i])?i in o||(s[i]=e[i]):s[i]=C(o[i]||{},e[i]));return s}function j(o,e,s){V("generating back compat runtime config for %s",o);let t=Object.assign({},e.supports);V("Supported capabilities in config before updating based on highestSupportedVersion: %o",t),Object.keys(s).forEach((e=>{n(o,e)>=0&&s[e].forEach((o=>{void 0!==i.hostClientType&&o.hostClientTypes.includes(i.hostClientType)&&(t=C(t,o.capability))}))}));const a={apiVersion:d,hostVersionsInfo:p,isLegacyTeams:!0,supports:t};return V("Runtime config after updating based on highestSupportedVersion: %o",a),a}const w=l.extend("applyRuntimeConfig");function O(o){"string"==typeof o.apiVersion&&(w("Trying to apply runtime with string apiVersion, processing as v1: %o",o),o=Object.assign(Object.assign({},o),{apiVersion:1})),w("Fast-forwarding runtime %o",o);const e=h(o);w("Applying runtime %o",e),g=a(e)}export{O as applyRuntimeConfig,h as fastForwardRuntime,j as generateVersionBasedTeamsRuntimeConfig,c as isRuntimeInitialized,d as latestRuntimeApiVersion,T as mapTeamsVersionToSupportedCapabilities,g as runtime,v as upgradeChain,f as v1HostClientTypes,b as v1MobileHostClientTypes,m as versionAndPlatformAgnosticTeamsRuntimeConfig};
@@ -1 +1 @@
1
- const t="2.35.0-beta.2";export{t as version};
1
+ const o="2.36.0";export{o as version};