@microsoft/teams-js 2.54.0-beta.0 → 2.55.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/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.54.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.55.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.54.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-PIuQ2V7hlz4b1x3G1mPCYYZiWTjxzRTL6bf547xR9ARsAeNv2DAzti86LQnFCwlo"
48
+ src="https://res.cdn.office.net/teams-js/2.55.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-qOOENVJGWr7UF7wvgyycjvq3sZen4SEYQwZMKqpquvV/PNMtSJb3VGZ/sAIKsZDw"
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.54.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.55.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -8,6 +8,12 @@
8
8
  * @module
9
9
  */
10
10
  import { ChatMembersInformation } from './interfaces';
11
+ /**
12
+ * @hidden
13
+ *
14
+ * @internal
15
+ * Limited to Microsoft-internal use
16
+ */
11
17
  export interface OpenConversationRequest {
12
18
  /**
13
19
  * @hidden
@@ -141,6 +147,7 @@ export declare function closeConversation(): void;
141
147
  */
142
148
  export declare function getChatMembers(): Promise<ChatMembersInformation>;
143
149
  /**
150
+ * @hidden
144
151
  * Checks if the conversations capability is supported by the host
145
152
  * @returns boolean to represent whether conversations capability is supported
146
153
  *
@@ -51,7 +51,12 @@ export declare function getContent(request?: ContentRequest): Promise<Content>;
51
51
  * Limited to Microsoft-internal use
52
52
  */
53
53
  export declare function preCheckUserConsent(request?: UserConsentRequest): Promise<PreCheckContextResponse>;
54
- /** Register user action content select handler function type */
54
+ /**
55
+ * @hidden
56
+ * Register user action content select handler function type
57
+ * @internal
58
+ * Limited to Microsoft-internal use
59
+ */
55
60
  export type userActionHandlerType = (selectedContent: Content) => void;
56
61
  /**
57
62
  * @hidden
@@ -60,6 +60,12 @@ export interface DraftEmailContent extends BaseEmailContent {
60
60
  savedTime?: Date;
61
61
  composeType?: 'new' | 'reply' | 'replyAll' | 'forward';
62
62
  }
63
+ /**
64
+ * @hidden
65
+ * Union type for usage elsewhere
66
+ * @internal
67
+ * Limited to Microsoft-internal use
68
+ */
63
69
  export type EmailContent = ServerEmailContent | DraftEmailContent;
64
70
  /**
65
71
  * @hidden
@@ -275,6 +275,12 @@ export type AttachmentLayout = 'grid' | 'list';
275
275
  export type ComposeResultTypes = 'auth' | 'config' | 'message' | 'result' | 'silentAuth';
276
276
  /*********** END RESPONSE TYPE ************/
277
277
  /*********** BEGIN ERROR TYPE ***********/
278
+ /**
279
+ * @hidden
280
+ *
281
+ * @internal
282
+ * Limited to Microsoft-internal use
283
+ */
278
284
  export interface InvokeError {
279
285
  errorCode: InvokeErrorCode;
280
286
  message?: string;
@@ -394,6 +400,12 @@ export interface ConnectorParameters {
394
400
  /** Optional parameters for the OAuth sign-in window. */
395
401
  windowParameters?: OauthWindowProperties;
396
402
  }
403
+ /**
404
+ * @hidden
405
+ *
406
+ * @internal
407
+ * Limited to Microsoft-internal use
408
+ */
397
409
  export declare class SerializableConnectorParameters implements ISerializable {
398
410
  private param;
399
411
  constructor(param: ConnectorParameters);
@@ -8,6 +8,11 @@
8
8
  * This capability allows an app to associate apps with a host entity, such as a Teams channel or chat, and configure them as needed.
9
9
  */
10
10
  import * as tab from './tab';
11
+ /**
12
+ * @hidden
13
+ * @internal
14
+ * Limited to Microsoft-internal use
15
+ */
11
16
  export declare enum AppTypes {
12
17
  edu = "EDU",
13
18
  /**
@@ -26,13 +31,19 @@ interface TeamsEntityId {
26
31
  threadId: string;
27
32
  }
28
33
  /**
34
+ * @hidden
29
35
  * Id of message in which channel meeting is created
36
+ * @internal
37
+ * Limited to Microsoft-internal use
30
38
  */
31
39
  export interface TeamsChannelMeetingEntityIds extends TeamsEntityId {
32
40
  parentMessageId: string;
33
41
  }
34
42
  /**
43
+ * @hidden
35
44
  * Id of the host entity
45
+ * @internal
46
+ * Limited to Microsoft-internal use
36
47
  */
37
48
  export type HostEntityIds = TeamsEntityId | TeamsChannelMeetingEntityIds;
38
49
  /**
@@ -10,23 +10,35 @@
10
10
  import { TabInstance } from '../../public/interfaces';
11
11
  import { AppTypes, HostEntityIds } from './hostEntity';
12
12
  /**
13
+ * @hidden
13
14
  * Represents information about a static tab instance
15
+ * @internal
16
+ * Limited to Microsoft-internal use
14
17
  */
15
18
  export interface StaticTabInstance extends TabInstance {
16
19
  tabType: 'StaticTab';
17
20
  }
18
21
  /**
22
+ * @hidden
19
23
  * Represents information about a configurable tab instance
24
+ * @internal
25
+ * Limited to Microsoft-internal use
20
26
  */
21
27
  export interface ConfigurableTabInstance extends TabInstance {
22
28
  tabType: 'ConfigurableTab';
23
29
  }
24
30
  /**
25
- * Represents information about a tab instance associated with a host entity like chat, channel or meeting. Cab be a configurable tab or static tab.
31
+ * @hidden
32
+ * Represents information about a tab instance associated with a host entity like chat, channel or meeting. Can be a configurable tab or static tab.
33
+ * @internal
34
+ * Limited to Microsoft-internal use
26
35
  */
27
36
  export type HostEntityTabInstance = StaticTabInstance | ConfigurableTabInstance;
28
37
  /**
38
+ * @hidden
29
39
  * Represents all tabs associated with a host entity like chat, channel or meeting
40
+ * @internal
41
+ * Limited to Microsoft-internal use
30
42
  */
31
43
  export interface HostEntityTabInstances {
32
44
  allTabs: HostEntityTabInstance[];
@@ -84,6 +84,7 @@ export declare function unregisterAppInstallationHandler(): void;
84
84
  */
85
85
  export declare function notifyInstallCompleted(appId: AppId): Promise<void>;
86
86
  /**
87
+ * @hidden
87
88
  * Checks if the otherAppStateChange capability is supported by the host
88
89
  * @returns boolean to represent whether the otherAppStateChange capability is supported
89
90
  *
@@ -1,4 +1,12 @@
1
1
  import { FilePreviewParameters, UserSettingTypes } from './interfaces';
2
+ /**
3
+ * @hidden
4
+ * Upload a custom App manifest directly to both team and personal scopes.
5
+ * This method works just for the first party Apps.
6
+ *
7
+ * @internal
8
+ * Limited to Microsoft-internal use
9
+ */
2
10
  export declare function uploadCustomApp(manifestBlob: Blob, onComplete?: (status: boolean, reason?: string) => void): void;
3
11
  /**
4
12
  * @deprecated Use {@link plugins.sendPluginMessage} with {@link plugins.registerPluginMessage} and a correlationId-based response pattern.
@@ -120,6 +120,7 @@ export declare function openInContextStore(params: OpenInContextStoreParams | un
120
120
  */
121
121
  export declare function openSpecificStore(params: OpenSpecificStoreParams): Promise<void>;
122
122
  /**
123
+ * @hidden
123
124
  * Checks if the store capability is supported by the host
124
125
  * @returns boolean to represent whether the store capability is supported
125
126
  *
@@ -8,6 +8,11 @@
8
8
  */
9
9
  import { SdkError } from '../../public/interfaces';
10
10
  import * as fullTrust from './fullTrust/fullTrust';
11
+ /**
12
+ * @hidden
13
+ * @internal
14
+ * Limited to Microsoft-internal use
15
+ */
11
16
  export declare enum ChannelType {
12
17
  Regular = 0,
13
18
  Private = 1,
@@ -8,6 +8,11 @@
8
8
  */
9
9
  import { DefaultVideoEffectCallBack as VideoEffectCallBack } from '../internal/videoEffectsUtils';
10
10
  import * as videoEffects from '../public/videoEffects';
11
+ /**
12
+ * @hidden
13
+ * @internal
14
+ * Limited to Microsoft-internal use
15
+ */
11
16
  export declare const frameProcessingTimeoutInMs = 2000;
12
17
  /**
13
18
  * @hidden
@@ -1,20 +1,56 @@
1
+ /**
2
+ * @hidden
3
+ * @internal
4
+ * Limited to Microsoft-internal use
5
+ * @module
6
+ */
1
7
  import { RenderingSurfaces } from '../../public';
8
+ /**
9
+ * @hidden
10
+ * @internal
11
+ * Limited to Microsoft-internal use
12
+ */
2
13
  export interface ISecurityPolicy {
3
14
  connectDomains?: string[];
4
15
  resourceDomains?: string[];
5
16
  isTrusted?: boolean;
6
17
  }
18
+ /**
19
+ * @hidden
20
+ * @internal
21
+ * Limited to Microsoft-internal use
22
+ */
7
23
  export type Theme = 'light' | 'dark';
24
+ /**
25
+ * @hidden
26
+ * @internal
27
+ * Limited to Microsoft-internal use
28
+ */
8
29
  export type SafeAreaInsets = {
9
30
  top: number;
10
31
  bottom: number;
11
32
  left: number;
12
33
  right: number;
13
34
  };
35
+ /**
36
+ * @hidden
37
+ * @internal
38
+ * Limited to Microsoft-internal use
39
+ */
14
40
  export type SafeArea = {
15
41
  insets: SafeAreaInsets;
16
42
  };
43
+ /**
44
+ * @hidden
45
+ * @internal
46
+ * Limited to Microsoft-internal use
47
+ */
17
48
  export type DeviceType = 'mobile' | 'tablet' | 'desktop' | 'unknown';
49
+ /**
50
+ * @hidden
51
+ * @internal
52
+ * Limited to Microsoft-internal use
53
+ */
18
54
  export type UserAgent = {
19
55
  device: {
20
56
  type: DeviceType;
@@ -25,7 +61,10 @@ export type UserAgent = {
25
61
  };
26
62
  };
27
63
  /**
64
+ * @hidden
28
65
  * Options for requesting a modal dialog
66
+ * @internal
67
+ * Limited to Microsoft-internal use
29
68
  */
30
69
  export interface IModalOptions {
31
70
  /** Unique identifier for the modal */
@@ -40,23 +79,49 @@ export interface IModalOptions {
40
79
  height?: number;
41
80
  }
42
81
  /**
82
+ * @hidden
43
83
  * Response from requesting a modal dialog
84
+ * @internal
85
+ * Limited to Microsoft-internal use
44
86
  */
45
87
  export interface IModalResponse {
46
88
  /** A DOM element representing the modal's root */
47
89
  modalElement: HTMLElement;
48
90
  }
49
- /** Declare generic JSON - serializable structure */
91
+ /**
92
+ * @hidden
93
+ * Declare generic JSON - serializable structure
94
+ * @internal
95
+ * Limited to Microsoft-internal use
96
+ */
50
97
  export interface JSONObject {
51
98
  [key: string]: JSONValue;
52
99
  }
100
+ /**
101
+ * @hidden
102
+ * @internal
103
+ * Limited to Microsoft-internal use
104
+ */
53
105
  export interface JSONArray extends Array<JSONValue> {
54
106
  }
107
+ /**
108
+ * @hidden
109
+ * @internal
110
+ * Limited to Microsoft-internal use
111
+ */
55
112
  export type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
56
- /** Display mode */
113
+ /**
114
+ * @hidden
115
+ * Display mode
116
+ * @internal
117
+ * Limited to Microsoft-internal use
118
+ */
57
119
  export type DisplayMode = 'pip' | 'inline' | 'fullscreen';
58
120
  /**
121
+ * @hidden
59
122
  * MCP-compatible tool input structure following OpenAI MCP server specification
123
+ * @internal
124
+ * Limited to Microsoft-internal use
60
125
  */
61
126
  export interface IToolInput {
62
127
  /** The name of the tool to call */
@@ -65,7 +130,10 @@ export interface IToolInput {
65
130
  arguments?: Record<string, unknown>;
66
131
  }
67
132
  /**
133
+ * @hidden
68
134
  * MCP-compatible tool output structure matching exact MCP schema
135
+ * @internal
136
+ * Limited to Microsoft-internal use
69
137
  */
70
138
  export interface IToolOutput {
71
139
  /** Whether the tool call resulted in an error */
@@ -96,7 +164,10 @@ export interface IToolOutput {
96
164
  _meta?: Record<string, unknown>;
97
165
  }
98
166
  /**
167
+ * @hidden
99
168
  * Widget context similar to IWidgetHost structure - simplified for widget rendering
169
+ * @internal
170
+ * Limited to Microsoft-internal use
100
171
  */
101
172
  export interface IWidgetContext {
102
173
  /** Unique identifier for the widget instance */
@@ -17,6 +17,12 @@ import { DisplayMode, IModalOptions, IModalResponse, IToolInput, IToolOutput, JS
17
17
  * @throws Error if {@linkcode app.initialize} has not successfully completed
18
18
  */
19
19
  export declare function isSupported(): boolean;
20
+ /**
21
+ * @hidden
22
+ * @internal
23
+ * Limited to Microsoft-internal use
24
+ * @beta
25
+ */
20
26
  export declare function callTool(widgetId: string, input: IToolInput): Promise<IToolOutput>;
21
27
  /**
22
28
  * @beta
@@ -86,7 +92,12 @@ export declare function setWidgetState(widgetId: string, state: JSONValue): Prom
86
92
  export declare function openExternal(widgetId: string, payload: {
87
93
  href: string;
88
94
  }): void;
89
- /** Modal close handler function type */
95
+ /**
96
+ * @hidden
97
+ * Modal close handler function type
98
+ * @internal
99
+ * Limited to Microsoft-internal use
100
+ */
90
101
  export type ModalCloseHandlerType = (modalId: string) => void;
91
102
  /**
92
103
  * @hidden
@@ -538,6 +538,26 @@ export declare function getFrameContext(): FrameContexts | undefined;
538
538
  * @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
539
539
  */
540
540
  export declare function initialize(validMessageOrigins?: string[]): Promise<void>;
541
+ /**
542
+ * Returns the immediate parent origin when this app is running inside an iframe.
543
+ *
544
+ * @remarks
545
+ * This helper is useful for scenarios where the app must explicitly trust the hosting parent origin during
546
+ * {@link initialize} by passing `[origin]` as `validMessageOrigins`.
547
+ *
548
+ * If no parent origin can be determined, this function returns `null`.
549
+ *
550
+ * @example
551
+ * ```typescript
552
+ * import { app } from '@microsoft/teams-js';
553
+ *
554
+ * const parentOrigin = app.getImmediateParentOrigin();
555
+ * await app.initialize(parentOrigin ? [parentOrigin] : undefined);
556
+ * ```
557
+ *
558
+ * @returns The immediate parent origin, or `null` when unavailable.
559
+ */
560
+ export declare function getImmediateParentOrigin(): string | null;
541
561
  /**
542
562
  * @hidden
543
563
  * Undocumented function used to set a mock window for unit tests
@@ -1 +1 @@
1
- import{appInitializeHelper as e,notifyAppLoadedHelper as i,notifySuccessHelper as t,notifyFailureHelper as n,notifyExpectedFailureHelper as a,registerOnThemeChangeHandlerHelper as o,registerOnContextChangeHandlerHelper as s,openLinkHelper as r}from"../../internal/appHelpers.js";import{uninitializeCommunication as l,sendAndUnwrap as m,Communication as d}from"../../internal/communication.js";import{GlobalVars as p}from"../../internal/globalVars.js";import{uninitializeHandlers as c,registerHostToAppPerformanceMetricsHandler as u}from"../../internal/handlers.js";import{ensureInitializeCalled as f}from"../../internal/internalAPIs.js";import{getLogger as h,getApiVersionTag as g}from"../../internal/telemetry.js";import{inServerSideRenderingEnvironment as I}from"../../internal/utils.js";import{AppId as y}from"../appId.js";import{HostClientType as S,HostName as T}from"../constants.js";import{version as C}from"../version.js";import*as v from"./lifecycle.js";export{v as lifecycle};import{_clearTelemetryPort as P}from"../../private/messageChannels/telemetry.js";import{_clearDataLayerPort as j}from"../../private/messageChannels/dataLayer.js";const w="v2",O=h("app"),N={AppLoaded:"appInitialization.appLoaded",Success:"appInitialization.success",Failure:"appInitialization.failure",ExpectedFailure:"appInitialization.expectedFailure"};var F,b;function x(){return p.initializeCompleted}function A(){return p.frameContext}function L(i){return e(g(w,"app.initialize"),i)}function z(e){d.currentWindow=e}function D(){p.initializeCalled&&(c(),p.initializeCalled=!1,p.initializeCompleted=!1,p.initializePromise=void 0,p.additionalValidOrigins=[],p.frameContext=void 0,p.hostClientType=void 0,p.isFramelessWindow=!1,P(),j(),l())}function k(){return new Promise(e=>{f(),e(m(g(w,"app.getContext"),"getContext"))}).then(e=>function(e){var i;const t={actionInfo:e.actionInfo,app:{locale:e.locale,sessionId:e.appSessionId?e.appSessionId:"",theme:e.theme?e.theme:"default",iconPositionVertical:e.appIconPosition,osLocaleInfo:e.osLocaleInfo,messageId:e.messageId,parentMessageId:e.parentMessageId,userClickTime:e.userClickTime,userClickTimeV2:e.userClickTimeV2,userFileOpenPreference:e.userFileOpenPreference,host:{name:e.hostName?e.hostName:T.teams,clientType:e.hostClientType?e.hostClientType:S.web,features:e.hostFeatures,sessionId:e.sessionId?e.sessionId:"",ringId:e.ringId,ancestors:e.hostAncestors},appLaunchId:e.appLaunchId,appId:e.appId?new y(e.appId):void 0,manifestVersion:e.manifestVersion},page:{id:e.entityId,frameContext:e.frameContext?e.frameContext:p.frameContext,renderingSurface:e.renderingSurface?e.renderingSurface:void 0,subPageId:e.subEntityId,isFullScreen:e.isFullScreen,isMultiWindow:e.isMultiWindow,isBackgroundLoad:e.isBackgroundLoad,sourceOrigin:e.sourceOrigin},user:{id:null!==(i=e.userObjectId)&&void 0!==i?i:"",displayName:e.userDisplayName,isCallingAllowed:e.isCallingAllowed,isPSTNCallingAllowed:e.isPSTNCallingAllowed,licenseType:e.userLicenseType,loginHint:e.loginHint,userPrincipalName:e.userPrincipalName,tenant:e.tid?{id:e.tid,teamsSku:e.tenantSKU}:void 0},channel:e.channelId?{id:e.channelId,displayName:e.channelName,relativeUrl:e.channelRelativeUrl,membershipType:e.channelType,defaultOneNoteSectionId:e.defaultOneNoteSectionId,ownerGroupId:e.hostTeamGroupId,ownerTenantId:e.hostTeamTenantId}:void 0,chat:e.chatId?{id:e.chatId}:void 0,meeting:e.meetingId?{id:e.meetingId}:void 0,sharepoint:e.sharepoint,team:e.teamId?{internalId:e.teamId,displayName:e.teamName,type:e.teamType,groupId:e.groupId,templateId:e.teamTemplateId,isArchived:e.isTeamArchived,userRole:e.userTeamRole}:void 0,sharePointSite:e.teamSiteUrl||e.teamSiteDomain||e.teamSitePath||e.mySitePath||e.mySiteDomain?{teamSiteUrl:e.teamSiteUrl,teamSiteDomain:e.teamSiteDomain,teamSitePath:e.teamSitePath,teamSiteId:e.teamSiteId,mySitePath:e.mySitePath,mySiteDomain:e.mySiteDomain}:void 0,dialogParameters:e.dialogParameters||{}};return t}(e))}function H(){f(),i(g(w,"app.notifyAppLoaded"))}function U(){return t(g(w,"app.notifySuccess"))}function V(e){f(),n(g(w,"app.notifyFailure"),e)}function E(e){f(),a(g(w,"app.notifyExpectedFailure"),e)}function M(e){o(g(w,"app.registerOnThemeChangeHandler"),e)}function W(e){s(g(w,"app.registerOnContextChangeHandler"),e)}function B(e){u(e)}function R(e){return r(g(w,"app.openLink"),e)}!function(e){e.AuthFailed="AuthFailed",e.Timeout="Timeout",e.Other="Other"}(F||(F={})),function(e){e.PermissionError="PermissionError",e.NotFound="NotFound",e.Throttling="Throttling",e.Offline="Offline",e.Other="Other"}(b||(b={})),O("teamsjs instance is version %s, starting at %s UTC (%s local)",C,(new Date).toISOString(),(new Date).toLocaleString()),function(){if(I())return;const e=document.getElementsByTagName("script"),i=e&&e[e.length-1]&&e[e.length-1].src,t="Today, teamsjs can only be used from a single script or you may see undefined behavior. This log line is used to help detect cases where teamsjs is loaded multiple times -- it is always written. The presence of the log itself does not indicate a multi-load situation, but multiples of these log lines will. If you would like to use teamjs from more than one script at the same time, please open an issue at https://github.com/OfficeDev/microsoft-teams-library-js/issues";i&&0!==i.length?O("teamsjs is being used from %s. %s",i,t):O("teamsjs is being used from a script tag embedded directly in your html. %s",t)}();export{b as ExpectedFailureReason,F as FailedReason,N as Messages,z as _initialize,D as _uninitialize,k as getContext,A as getFrameContext,L as initialize,x as isInitialized,H as notifyAppLoaded,E as notifyExpectedFailure,V as notifyFailure,U as notifySuccess,R as openLink,B as registerHostToAppPerformanceMetricsHandler,W as registerOnContextChangeHandler,M as registerOnThemeChangeHandler};
1
+ import{appInitializeHelper as e,notifyAppLoadedHelper as i,notifySuccessHelper as t,notifyFailureHelper as n,notifyExpectedFailureHelper as a,registerOnThemeChangeHandlerHelper as o,registerOnContextChangeHandlerHelper as r,openLinkHelper as s}from"../../internal/appHelpers.js";import{uninitializeCommunication as l,sendAndUnwrap as m,Communication as d}from"../../internal/communication.js";import{GlobalVars as p}from"../../internal/globalVars.js";import{uninitializeHandlers as u,registerHostToAppPerformanceMetricsHandler as c}from"../../internal/handlers.js";import{ensureInitializeCalled as f}from"../../internal/internalAPIs.js";import{getLogger as h,getApiVersionTag as g}from"../../internal/telemetry.js";import{inServerSideRenderingEnvironment as I}from"../../internal/utils.js";import{AppId as y}from"../appId.js";import{HostClientType as S,HostName as T}from"../constants.js";import{version as v}from"../version.js";import*as C from"./lifecycle.js";export{C as lifecycle};import{_clearTelemetryPort as w}from"../../private/messageChannels/telemetry.js";import{_clearDataLayerPort as P}from"../../private/messageChannels/dataLayer.js";const j="v2",O=h("app"),N={AppLoaded:"appInitialization.appLoaded",Success:"appInitialization.success",Failure:"appInitialization.failure",ExpectedFailure:"appInitialization.expectedFailure"};var F,b;function x(){return p.initializeCompleted}function L(){return p.frameContext}function A(i){return e(g(j,"app.initialize"),i)}function z(){var e,i;if(I())return null;const t=null!==(e=d.currentWindow)&&void 0!==e?e:window;if(t.parent===t)return null;const n=t.location.ancestorOrigins,a=null==n?void 0:n.item(0);if(a)return a;const o=null===(i=t.document)||void 0===i?void 0:i.referrer;if(!o)return null;try{const e=new URL(o).origin;return e===t.location.origin?null:e}catch(e){return null}}function D(e){d.currentWindow=e}function k(){p.initializeCalled&&(u(),p.initializeCalled=!1,p.initializeCompleted=!1,p.initializePromise=void 0,p.additionalValidOrigins=[],p.frameContext=void 0,p.hostClientType=void 0,p.isFramelessWindow=!1,w(),P(),l())}function U(){return new Promise(e=>{f(),e(m(g(j,"app.getContext"),"getContext"))}).then(e=>function(e){var i;const t={actionInfo:e.actionInfo,app:{locale:e.locale,sessionId:e.appSessionId?e.appSessionId:"",theme:e.theme?e.theme:"default",iconPositionVertical:e.appIconPosition,osLocaleInfo:e.osLocaleInfo,messageId:e.messageId,parentMessageId:e.parentMessageId,userClickTime:e.userClickTime,userClickTimeV2:e.userClickTimeV2,userFileOpenPreference:e.userFileOpenPreference,host:{name:e.hostName?e.hostName:T.teams,clientType:e.hostClientType?e.hostClientType:S.web,features:e.hostFeatures,sessionId:e.sessionId?e.sessionId:"",ringId:e.ringId,ancestors:e.hostAncestors},appLaunchId:e.appLaunchId,appId:e.appId?new y(e.appId):void 0,manifestVersion:e.manifestVersion},page:{id:e.entityId,frameContext:e.frameContext?e.frameContext:p.frameContext,renderingSurface:e.renderingSurface?e.renderingSurface:void 0,subPageId:e.subEntityId,isFullScreen:e.isFullScreen,isMultiWindow:e.isMultiWindow,isBackgroundLoad:e.isBackgroundLoad,sourceOrigin:e.sourceOrigin},user:{id:null!==(i=e.userObjectId)&&void 0!==i?i:"",displayName:e.userDisplayName,isCallingAllowed:e.isCallingAllowed,isPSTNCallingAllowed:e.isPSTNCallingAllowed,licenseType:e.userLicenseType,loginHint:e.loginHint,userPrincipalName:e.userPrincipalName,tenant:e.tid?{id:e.tid,teamsSku:e.tenantSKU}:void 0},channel:e.channelId?{id:e.channelId,displayName:e.channelName,relativeUrl:e.channelRelativeUrl,membershipType:e.channelType,defaultOneNoteSectionId:e.defaultOneNoteSectionId,ownerGroupId:e.hostTeamGroupId,ownerTenantId:e.hostTeamTenantId}:void 0,chat:e.chatId?{id:e.chatId}:void 0,meeting:e.meetingId?{id:e.meetingId}:void 0,sharepoint:e.sharepoint,team:e.teamId?{internalId:e.teamId,displayName:e.teamName,type:e.teamType,groupId:e.groupId,templateId:e.teamTemplateId,isArchived:e.isTeamArchived,userRole:e.userTeamRole}:void 0,sharePointSite:e.teamSiteUrl||e.teamSiteDomain||e.teamSitePath||e.mySitePath||e.mySiteDomain?{teamSiteUrl:e.teamSiteUrl,teamSiteDomain:e.teamSiteDomain,teamSitePath:e.teamSitePath,teamSiteId:e.teamSiteId,mySitePath:e.mySitePath,mySiteDomain:e.mySiteDomain}:void 0,dialogParameters:e.dialogParameters||{}};return t}(e))}function H(){f(),i(g(j,"app.notifyAppLoaded"))}function V(){return t(g(j,"app.notifySuccess"))}function E(e){f(),n(g(j,"app.notifyFailure"),e)}function M(e){f(),a(g(j,"app.notifyExpectedFailure"),e)}function W(e){o(g(j,"app.registerOnThemeChangeHandler"),e)}function R(e){r(g(j,"app.registerOnContextChangeHandler"),e)}function B(e){c(e)}function G(e){return s(g(j,"app.openLink"),e)}!function(e){e.AuthFailed="AuthFailed",e.Timeout="Timeout",e.Other="Other"}(F||(F={})),function(e){e.PermissionError="PermissionError",e.NotFound="NotFound",e.Throttling="Throttling",e.Offline="Offline",e.Other="Other"}(b||(b={})),O("teamsjs instance is version %s, starting at %s UTC (%s local)",v,(new Date).toISOString(),(new Date).toLocaleString()),function(){if(I())return;const e=document.getElementsByTagName("script"),i=e&&e[e.length-1]&&e[e.length-1].src,t="Today, teamsjs can only be used from a single script or you may see undefined behavior. This log line is used to help detect cases where teamsjs is loaded multiple times -- it is always written. The presence of the log itself does not indicate a multi-load situation, but multiples of these log lines will. If you would like to use teamjs from more than one script at the same time, please open an issue at https://github.com/OfficeDev/microsoft-teams-library-js/issues";i&&0!==i.length?O("teamsjs is being used from %s. %s",i,t):O("teamsjs is being used from a script tag embedded directly in your html. %s",t)}();export{b as ExpectedFailureReason,F as FailedReason,N as Messages,D as _initialize,k as _uninitialize,U as getContext,L as getFrameContext,z as getImmediateParentOrigin,A as initialize,x as isInitialized,H as notifyAppLoaded,M as notifyExpectedFailure,E as notifyFailure,V as notifySuccess,G as openLink,B as registerHostToAppPerformanceMetricsHandler,R as registerOnContextChangeHandler,W as registerOnThemeChangeHandler};
@@ -1 +1 @@
1
- const t="2.54.0-beta.0";export{t as version};
1
+ const o="2.55.0";export{o as version};
@@ -1151,6 +1151,7 @@ __webpack_require__.d(app_namespaceObject, {
1151
1151
  _uninitialize: () => (_uninitialize),
1152
1152
  getContext: () => (getContext),
1153
1153
  getFrameContext: () => (getFrameContext),
1154
+ getImmediateParentOrigin: () => (getImmediateParentOrigin),
1154
1155
  initialize: () => (initialize),
1155
1156
  isInitialized: () => (isInitialized),
1156
1157
  lifecycle: () => (lifecycle_namespaceObject),
@@ -4694,7 +4695,7 @@ function isSerializable(arg) {
4694
4695
  * @hidden
4695
4696
  * Package version.
4696
4697
  */
4697
- const version = "2.54.0-beta.0";
4698
+ const version = "2.55.0";
4698
4699
 
4699
4700
  ;// ./src/public/featureFlags.ts
4700
4701
  // 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.
@@ -5533,6 +5534,56 @@ logWhereTeamsJsIsBeingUsed();
5533
5534
  function initialize(validMessageOrigins) {
5534
5535
  return appInitializeHelper(getApiVersionTag(appTelemetryVersionNumber, "app.initialize" /* ApiName.App_Initialize */), validMessageOrigins);
5535
5536
  }
5537
+ /**
5538
+ * Returns the immediate parent origin when this app is running inside an iframe.
5539
+ *
5540
+ * @remarks
5541
+ * This helper is useful for scenarios where the app must explicitly trust the hosting parent origin during
5542
+ * {@link initialize} by passing `[origin]` as `validMessageOrigins`.
5543
+ *
5544
+ * If no parent origin can be determined, this function returns `null`.
5545
+ *
5546
+ * @example
5547
+ * ```typescript
5548
+ * import { app } from '@microsoft/teams-js';
5549
+ *
5550
+ * const parentOrigin = app.getImmediateParentOrigin();
5551
+ * await app.initialize(parentOrigin ? [parentOrigin] : undefined);
5552
+ * ```
5553
+ *
5554
+ * @returns The immediate parent origin, or `null` when unavailable.
5555
+ */
5556
+ function getImmediateParentOrigin() {
5557
+ var _a, _b;
5558
+ if (inServerSideRenderingEnvironment()) {
5559
+ return null;
5560
+ }
5561
+ const currentWindow = (_a = Communication.currentWindow) !== null && _a !== void 0 ? _a : window;
5562
+ if (currentWindow.parent === currentWindow) {
5563
+ return null;
5564
+ }
5565
+ const ancestorOrigins = currentWindow.location.ancestorOrigins;
5566
+ const immediateAncestorOrigin = ancestorOrigins === null || ancestorOrigins === void 0 ? void 0 : ancestorOrigins.item(0);
5567
+ if (immediateAncestorOrigin) {
5568
+ return immediateAncestorOrigin;
5569
+ }
5570
+ const referrer = (_b = currentWindow.document) === null || _b === void 0 ? void 0 : _b.referrer;
5571
+ if (!referrer) {
5572
+ return null;
5573
+ }
5574
+ try {
5575
+ const referrerOrigin = new URL(referrer).origin;
5576
+ // `document.referrer` can point to this iframe's prior URL after in-frame redirects.
5577
+ // Returning self-origin as the parent would be incorrect; treat this as unavailable.
5578
+ if (referrerOrigin === currentWindow.location.origin) {
5579
+ return null;
5580
+ }
5581
+ return referrerOrigin;
5582
+ }
5583
+ catch (_c) {
5584
+ return null;
5585
+ }
5586
+ }
5536
5587
  /**
5537
5588
  * @hidden
5538
5589
  * Undocumented function used to set a mock window for unit tests
@@ -9326,6 +9377,7 @@ var UserSettingTypes;
9326
9377
 
9327
9378
 
9328
9379
 
9380
+ const privateAPIsTelemetryVersionNumber = "v1" /* ApiVersionNumber.V_1 */;
9329
9381
  /**
9330
9382
  * @hidden
9331
9383
  * Upload a custom App manifest directly to both team and personal scopes.
@@ -9333,10 +9385,7 @@ var UserSettingTypes;
9333
9385
  *
9334
9386
  * @internal
9335
9387
  * Limited to Microsoft-internal use
9336
- *
9337
- * v1 APIs telemetry file: All of APIs in this capability file should send out API version v1 ONLY
9338
9388
  */
9339
- const privateAPIsTelemetryVersionNumber = "v1" /* ApiVersionNumber.V_1 */;
9340
9389
  function uploadCustomApp(manifestBlob, onComplete) {
9341
9390
  ensureInitialized(runtime);
9342
9391
  sendMessageToParent(getApiVersionTag(privateAPIsTelemetryVersionNumber, "uploadCustomApp" /* ApiName.PrivateAPIs_UploadCustomApp */), 'uploadCustomApp', [manifestBlob], onComplete ? onComplete : getGenericOnCompleteHandler());
@@ -9591,6 +9640,7 @@ function getChatMembers() {
9591
9640
  });
9592
9641
  }
9593
9642
  /**
9643
+ * @hidden
9594
9644
  * Checks if the conversations capability is supported by the host
9595
9645
  * @returns boolean to represent whether conversations capability is supported
9596
9646
  *
@@ -10461,6 +10511,12 @@ function authenticateWithPowerPlatformConnectorPlugins(titleId, signInUrl, oauth
10461
10511
  }
10462
10512
  });
10463
10513
  }
10514
+ /**
10515
+ * @hidden
10516
+ *
10517
+ * @internal
10518
+ * Limited to Microsoft-internal use
10519
+ */
10464
10520
  class SerializableConnectorParameters {
10465
10521
  constructor(param) {
10466
10522
  this.param = param;
@@ -12252,6 +12308,7 @@ function notifyInstallCompleted(appId) {
12252
12308
  return callFunctionInHost("otherApp.notifyInstallCompleted" /* ApiName.OtherAppStateChange_NotifyInstallCompleted */, [appId.toString()], getApiVersionTag(otherAppStateChangeTelemetryVersionNumber, "otherApp.notifyInstallCompleted" /* ApiName.OtherAppStateChange_NotifyInstallCompleted */));
12253
12309
  }
12254
12310
  /**
12311
+ * @hidden
12255
12312
  * Checks if the otherAppStateChange capability is supported by the host
12256
12313
  * @returns boolean to represent whether the otherAppStateChange capability is supported
12257
12314
  *
@@ -12856,6 +12913,11 @@ function fullTrust_fullTrust_isSupported() {
12856
12913
  * v1 APIs telemetry file: All of APIs in this capability file should send out API version v1 ONLY
12857
12914
  */
12858
12915
  const teams_teamsTelemetryVersionNumber = "v1" /* ApiVersionNumber.V_1 */;
12916
+ /**
12917
+ * @hidden
12918
+ * @internal
12919
+ * Limited to Microsoft-internal use
12920
+ */
12859
12921
  var teams_ChannelType;
12860
12922
  (function (ChannelType) {
12861
12923
  ChannelType[ChannelType["Regular"] = 0] = "Regular";
@@ -13869,6 +13931,11 @@ var videoEffectsEx_awaiter = (undefined && undefined.__awaiter) || function (thi
13869
13931
  * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
13870
13932
  */
13871
13933
  const videoEffectsExTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
13934
+ /**
13935
+ * @hidden
13936
+ * @internal
13937
+ * Limited to Microsoft-internal use
13938
+ */
13872
13939
  const frameProcessingTimeoutInMs = 2000;
13873
13940
  const videoEffectsEx_videoPerformanceMonitor = inServerSideRenderingEnvironment()
13874
13941
  ? undefined
@@ -14342,6 +14409,11 @@ function validateTab(tab) {
14342
14409
 
14343
14410
 
14344
14411
 
14412
+ /**
14413
+ * @hidden
14414
+ * @internal
14415
+ * Limited to Microsoft-internal use
14416
+ */
14345
14417
  var AppTypes;
14346
14418
  (function (AppTypes) {
14347
14419
  AppTypes["edu"] = "EDU";
@@ -14459,6 +14531,7 @@ function openSpecificStore(params) {
14459
14531
  });
14460
14532
  }
14461
14533
  /**
14534
+ * @hidden
14462
14535
  * Checks if the store capability is supported by the host
14463
14536
  * @returns boolean to represent whether the store capability is supported
14464
14537
  *
@@ -14526,6 +14599,12 @@ const widgetHostingLogger = getLogger('widgetHosting');
14526
14599
  function widgetHosting_isSupported() {
14527
14600
  return ensureInitialized(runtime) && !!runtime.supports.widgetHosting;
14528
14601
  }
14602
+ /**
14603
+ * @hidden
14604
+ * @internal
14605
+ * Limited to Microsoft-internal use
14606
+ * @beta
14607
+ */
14529
14608
  function callTool(widgetId, input) {
14530
14609
  return widgetHosting_awaiter(this, void 0, void 0, function* () {
14531
14610
  ensureInitializeCalled();