@microsoft/teams-js 2.51.0-beta.0 → 2.51.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.50.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.51.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.50.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-tAUmOW9DgkVVCWNQlKJzT9A3ykFmjwWrk8ClFaO1ozKKq44WzKpLyULQIrsovhwM"
48
+ src="https://res.cdn.office.net/teams-js/2.51.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-U54aLArLUNmLIfKxJ7P5Ybiq6sXmSH6aNROHNdKLpABDXH+KB/wE17SEz43/zsAe"
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.50.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.51.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -235,6 +235,22 @@ export interface FilePreviewParameters {
235
235
  * Limited to Microsoft-internal use
236
236
  */
237
237
  atpData?: string;
238
+ /**
239
+ * @hidden
240
+ * Optional; sharelink of a ODSP file
241
+ *
242
+ * @internal
243
+ * Limited to Microsoft-internal use
244
+ */
245
+ shareUrl?: string;
246
+ /**
247
+ * @hidden
248
+ * Optional; the reply chain id of message where file is shared. Usually found in channels
249
+ *
250
+ * @internal
251
+ * Limited to Microsoft-internal use
252
+ */
253
+ replyChainId?: string;
238
254
  }
239
255
  /**
240
256
  * @hidden
@@ -162,6 +162,19 @@ export interface AppInfo {
162
162
  */
163
163
  manifestVersion?: string;
164
164
  }
165
+ /**
166
+ * Features supported by the host that the app can query for via getContext.
167
+ */
168
+ export type HostFeatures = {
169
+ /**
170
+ * Indicates whether the host supports nested wildcards in valid domains. If true, the host will allow valid domains with nested wildcards (e.g. apps.*.com). If false or undefined, the host will only allow valid domains with a single wildcard level (e.g. *.test.com).
171
+ */
172
+ nestedWildcardsInValidDomains?: boolean;
173
+ /**
174
+ * Indicates whether server side rendering is enabled for the host.
175
+ */
176
+ serverSideRendering?: boolean;
177
+ };
165
178
  /**
166
179
  * Represents information about the application's host.
167
180
  */
@@ -174,6 +187,10 @@ export interface AppHostInfo {
174
187
  * The client type on which the host is running
175
188
  */
176
189
  clientType: HostClientType;
190
+ /**
191
+ * The features supported by the host. This is an optional field that may not be populated by all hosts, and may be added to over time as new features are added to hosts. Because of this, apps should always check for the presence of a feature and its value before using it, and should gracefully handle the case where the feature is not present.
192
+ */
193
+ features?: HostFeatures;
177
194
  /**
178
195
  * Unique ID for the current Host session for use in correlating telemetry data.
179
196
  */
@@ -1,3 +1,4 @@
1
+ import { HostFeatures } from './app/app';
1
2
  import { ChannelType, DialogDimension, HostClientType, HostName, RenderingSurfaces, TeamType, UserTeamRole } from './constants';
2
3
  import { FrameContexts } from './constants';
3
4
  /**
@@ -729,6 +730,12 @@ export interface Context {
729
730
  * For example, if Bizchat is running in Calendar in Teams, this would be ["Calendar", "Teams"].
730
731
  */
731
732
  hostAncestors?: string[];
733
+ /**
734
+ * @deprecated
735
+ * As of TeamsJS v2.0.0, please use {@link app.AppHostInfo.features | app.Context.app.host.features} instead
736
+ * The features supported by the host. This is an optional field that may not be populated by all hosts, and may be added to over time as new features are added to hosts. Because of this, apps should always check for the presence of a feature and its value before using it, and should gracefully handle the case where the feature is not present.
737
+ */
738
+ hostFeatures?: HostFeatures;
732
739
  }
733
740
  /** Represents the parameters used to share a deep link. */
734
741
  export interface ShareDeepLinkParameters {
@@ -1 +1 @@
1
- import{shouldEventBeRelayedToChild as e,sendMessageEventToChild as t}from"../internal/childCommunication.js";import{sendMessageToParent as n}from"../internal/communication.js";import{registerHandler as i}from"../internal/handlers.js";import{ensureInitialized as r}from"../internal/internalAPIs.js";import{getApiVersionTag as o}from"../internal/telemetry.js";import{getGenericOnCompleteHandler as s}from"../internal/utils.js";import{FrameContexts as l}from"../public/constants.js";import{runtime as a}from"../public/runtime.js";const m="v1";function p(e,t){r(a),n(o(m,"uploadCustomApp"),"uploadCustomApp",[e],t||s())}function c(e,t,i){r(a),n(o(m,"sendCustomMessage"),e,t,i)}function d(n,i){if(r(a),!e())throw new Error("The child window has not yet been initialized or is not present");t(n,i)}function u(e,t){r(a),i(o(m,"registerCustomHandler"),e,(...e)=>t.apply(this,e))}function f(e,t){r(a),i(o(m,"registerUserSettingsChangeHandler"),"userSettingsChange",t,!0,[e])}function w(e){r(a,l.content,l.sidePanel,l.task);const t=[e.entityId,e.title,e.description,e.type,e.objectUrl,e.downloadUrl,e.webPreviewUrl,e.webEditUrl,e.baseUrl,e.editFile,e.subEntityId,e.viewerAction,e.fileOpenPreference,e.conversationId,e.sizeInBytes,e.messageId,e.callerInfo,e.atpData];n(o(m,"openFilePreview"),"openFilePreview",t)}export{w as openFilePreview,u as registerCustomHandler,f as registerUserSettingsChangeHandler,d as sendCustomEvent,c as sendCustomMessage,p as uploadCustomApp};
1
+ import{shouldEventBeRelayedToChild as e,sendMessageEventToChild as t}from"../internal/childCommunication.js";import{sendMessageToParent as n}from"../internal/communication.js";import{registerHandler as i}from"../internal/handlers.js";import{ensureInitialized as r}from"../internal/internalAPIs.js";import{getApiVersionTag as o}from"../internal/telemetry.js";import{getGenericOnCompleteHandler as s}from"../internal/utils.js";import{FrameContexts as l}from"../public/constants.js";import{runtime as a}from"../public/runtime.js";const m="v1";function p(e,t){r(a),n(o(m,"uploadCustomApp"),"uploadCustomApp",[e],t||s())}function c(e,t,i){r(a),n(o(m,"sendCustomMessage"),e,t,i)}function d(n,i){if(r(a),!e())throw new Error("The child window has not yet been initialized or is not present");t(n,i)}function u(e,t){r(a),i(o(m,"registerCustomHandler"),e,(...e)=>t.apply(this,e))}function f(e,t){r(a),i(o(m,"registerUserSettingsChangeHandler"),"userSettingsChange",t,!0,[e])}function h(e){r(a,l.content,l.sidePanel,l.task);const t=[e.entityId,e.title,e.description,e.type,e.objectUrl,e.downloadUrl,e.webPreviewUrl,e.webEditUrl,e.baseUrl,e.editFile,e.subEntityId,e.viewerAction,e.fileOpenPreference,e.conversationId,e.sizeInBytes,e.messageId,e.callerInfo,e.atpData,e.shareUrl,e.replyChainId];n(o(m,"openFilePreview"),"openFilePreview",t)}export{h as openFilePreview,u as registerCustomHandler,f as registerUserSettingsChangeHandler,d as sendCustomEvent,c as sendCustomMessage,p as uploadCustomApp};
@@ -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 b,x;function F(){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,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"}(b||(b={})),function(e){e.PermissionError="PermissionError",e.NotFound="NotFound",e.Throttling="Throttling",e.Offline="Offline",e.Other="Other"}(x||(x={})),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{x as ExpectedFailureReason,b as FailedReason,N as Messages,z as _initialize,D as _uninitialize,k as getContext,A as getFrameContext,L as initialize,F 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 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 +1 @@
1
- const t="2.51.0-beta.0";export{t as version};
1
+ const o="2.51.0";export{o as version};
@@ -4679,7 +4679,7 @@ function isSerializable(arg) {
4679
4679
  * @hidden
4680
4680
  * Package version.
4681
4681
  */
4682
- const version = "2.51.0-beta.0";
4682
+ const version = "2.51.0";
4683
4683
 
4684
4684
  ;// ./src/public/featureFlags.ts
4685
4685
  // All build feature flags are defined inside this object. Any build feature flag must have its own unique getter and setter function. This pattern allows for client apps to treeshake unused code and avoid including code guarded by this feature flags in the final bundle. If this property isn't desired, use the below runtime feature flags object.
@@ -5691,6 +5691,7 @@ function transformLegacyContextToAppContext(legacyContext) {
5691
5691
  host: {
5692
5692
  name: legacyContext.hostName ? legacyContext.hostName : HostName.teams,
5693
5693
  clientType: legacyContext.hostClientType ? legacyContext.hostClientType : HostClientType.web,
5694
+ features: legacyContext.hostFeatures,
5694
5695
  sessionId: legacyContext.sessionId ? legacyContext.sessionId : '',
5695
5696
  ringId: legacyContext.ringId,
5696
5697
  ancestors: legacyContext.hostAncestors,
@@ -9442,6 +9443,8 @@ function openFilePreview(filePreviewParameters) {
9442
9443
  filePreviewParameters.messageId,
9443
9444
  filePreviewParameters.callerInfo,
9444
9445
  filePreviewParameters.atpData,
9446
+ filePreviewParameters.shareUrl,
9447
+ filePreviewParameters.replyChainId,
9445
9448
  ];
9446
9449
  sendMessageToParent(getApiVersionTag(privateAPIsTelemetryVersionNumber, "openFilePreview" /* ApiName.PrivateAPIs_OpenFilePreview */), 'openFilePreview', params);
9447
9450
  }