@microsoft/teams-js 2.51.0 → 2.53.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.51.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.53.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.51.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-U54aLArLUNmLIfKxJ7P5Ybiq6sXmSH6aNROHNdKLpABDXH+KB/wE17SEz43/zsAe"
48
+ src="https://res.cdn.office.net/teams-js/2.53.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-UFKwOGC8ix6vOFFC4vH8hSpjwkQXZmSjCx8aaxwhbtm+6joQdNvD7b4pPk82cYAD"
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.51.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.53.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -15,14 +15,14 @@ export declare const SharingAPIMessages: {
15
15
  */
16
16
  shareWebContent: string;
17
17
  };
18
- type ContentType = 'URL';
18
+ type ContentType = 'URL' | 'FILE';
19
19
  /** Represents parameters for base shared content. */
20
20
  interface IBaseSharedContent {
21
21
  /** Shared content type */
22
22
  type: ContentType;
23
23
  }
24
24
  /** IShareRequestContentType defines share request type. */
25
- export type IShareRequestContentType = IURLContent;
25
+ export type IShareRequestContentType = IURLContent | IFileContent;
26
26
  /** Represents IShareRequest parameters interface.
27
27
  * @typeparam T - The identity type
28
28
  */
@@ -30,6 +30,23 @@ export interface IShareRequest<T> {
30
30
  /** Content of the share request. */
31
31
  content: T[];
32
32
  }
33
+ /** Represents IFileContent parameters. */
34
+ export interface IFileContent extends IBaseSharedContent {
35
+ /** Type */
36
+ type: 'FILE';
37
+ /**
38
+ * Required URL of the file to share
39
+ */
40
+ url: string;
41
+ /**
42
+ * Default initial message text
43
+ */
44
+ message?: string;
45
+ /**
46
+ * Show file preview, defaults to true
47
+ */
48
+ preview?: boolean;
49
+ }
33
50
  /** Represents IURLContent parameters. */
34
51
  export interface IURLContent extends IBaseSharedContent {
35
52
  /** Type */
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Allows host shortcuts to function in your application by forwarding keyboard shortcuts to the host.
3
3
  *
4
- * This functionality is in Beta.
5
- * @beta
6
4
  * @module
7
5
  */
8
6
  /**
@@ -26,20 +24,17 @@ export type OverridableShortcutHandler = (event: KeyboardEvent, data: Overridabl
26
24
  * • Pass `undefined` to remove an existing handler.
27
25
  * • Returns the previous handler so callers can restore it if needed.
28
26
  *
29
- * @beta
30
27
  */
31
28
  export declare function setOverridableShortcutHandler(handler: OverridableShortcutHandler | undefined): OverridableShortcutHandler | undefined;
32
29
  /**
33
30
  * Reset the state of the shortcut relay capability.
34
31
  * This is useful for tests to ensure a clean state.
35
32
  *
36
- * @beta
37
33
  */
38
34
  export declare function resetIsShortcutRelayCapabilityEnabled(): void;
39
35
  /**
40
36
  * Enable capability to support host shortcuts.
41
37
  *
42
- * @beta
43
38
  */
44
39
  export declare function enableShortcutRelayCapability(): Promise<void>;
45
40
  /**
@@ -48,13 +43,11 @@ export declare function enableShortcutRelayCapability(): Promise<void>;
48
43
  *
49
44
  * @throws Error if {@link app.initialize} has not successfully completed
50
45
  *
51
- * @beta
52
46
  */
53
47
  export declare function isSupported(): boolean;
54
48
  /**
55
49
  * Allow apps to define zones where shortcuts should not be forwarded to the host.
56
50
  * This is useful for input fields for password where shortcuts should not trigger host actions.
57
51
  *
58
- * @beta
59
52
  */
60
53
  export declare const DISABLE_SHORTCUT_FORWARDING_ATTRIBUTE = "data-disable-shortcuts-forwarding";
@@ -1 +1 @@
1
- import{sendAndHandleSdkError as e}from"../../internal/communication.js";import{ensureInitialized as t}from"../../internal/internalAPIs.js";import{getApiVersionTag as n}from"../../internal/telemetry.js";import{callCallbackWithSdkErrorFromPromiseAndReturnPromise as r}from"../../internal/utils.js";import{FrameContexts as o,errorNotSupportedOnPlatform as s}from"../constants.js";import{ErrorCode as i}from"../interfaces.js";import{runtime as m}from"../runtime.js";import*as a from"./history.js";export{a as history};const c={shareWebContent:"sharing.shareWebContent"};function f(e,s){try{!function(e){if(!(e&&e.content&&e.content.length)){throw{errorCode:i.INVALID_ARGUMENTS,message:"Shared content is missing"}}}(e),function(e){let t;if(e.content.some(e=>!e.type))throw t={errorCode:i.INVALID_ARGUMENTS,message:"Shared content type cannot be undefined"},t;if(e.content.some(t=>t.type!==e.content[0].type))throw t={errorCode:i.INVALID_ARGUMENTS,message:"Shared content must be of the same type"},t}(e),function(e){let t;if("URL"!==e.content[0].type)throw t={errorCode:i.INVALID_ARGUMENTS,message:"Content type is unsupported"},t;if(e.content.some(e=>!e.url))throw t={errorCode:i.INVALID_ARGUMENTS,message:"URLs are required for URL content types"},t}(e)}catch(e){return r(()=>Promise.reject(e),s)}t(m,o.content,o.sidePanel,o.task,o.stage,o.meetingStage);const a=n(s?"v1":"v2","sharing.shareWebContent");return r(p,s,a,e)}function p(t,n){return new Promise(r=>{if(!h())throw s;r(e(t,c.shareWebContent,n))})}function h(){return!(!t(m)||!m.supports.sharing)}export{c as SharingAPIMessages,h as isSupported,f as shareWebContent};
1
+ import{sendAndHandleSdkError as e}from"../../internal/communication.js";import{ensureInitialized as t}from"../../internal/internalAPIs.js";import{getApiVersionTag as r}from"../../internal/telemetry.js";import{callCallbackWithSdkErrorFromPromiseAndReturnPromise as n}from"../../internal/utils.js";import{FrameContexts as o,errorNotSupportedOnPlatform as s}from"../constants.js";import{ErrorCode as i}from"../interfaces.js";import{runtime as a}from"../runtime.js";import*as m from"./history.js";export{m as history};const c={shareWebContent:"sharing.shareWebContent"};function f(e,s){try{!function(e){if(!(e&&e.content&&e.content.length)){throw{errorCode:i.INVALID_ARGUMENTS,message:"Shared content is missing"}}}(e),function(e){let t;if(e.content.some(e=>!e.type))throw t={errorCode:i.INVALID_ARGUMENTS,message:"Shared content type cannot be undefined"},t;if(e.content.some(t=>t.type!==e.content[0].type))throw t={errorCode:i.INVALID_ARGUMENTS,message:"Shared content must be of the same type"},t}(e),e.content.forEach(h)}catch(e){return n(()=>Promise.reject(e),s)}t(a,o.content,o.sidePanel,o.task,o.stage,o.meetingStage);const m=r(s?"v1":"v2","sharing.shareWebContent");return n(p,s,m,e)}function p(t,r){return new Promise(n=>{if(!u())throw s;n(e(t,c.shareWebContent,r))})}function h(e){if("URL"===e.type){if(!e.url)throw{errorCode:i.INVALID_ARGUMENTS,message:"URLs are required for URL content types"}}else{if("FILE"!==e.type)throw{errorCode:i.INVALID_ARGUMENTS,message:"Content type is unsupported"};if(!e.url)throw{errorCode:i.INVALID_ARGUMENTS,message:"File URLs are required for File content types"}}}function u(){return!(!t(a)||!a.supports.sharing)}export{c as SharingAPIMessages,u as isSupported,f as shareWebContent};
@@ -1 +1 @@
1
- import{__awaiter as t}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{callFunctionInHost as e,callFunctionInHostAndHandleResponse as r}from"../internal/communication.js";import{registerHandler as o}from"../internal/handlers.js";import{ensureInitialized as n}from"../internal/internalAPIs.js";import{ResponseHandler as s}from"../internal/responseHandler.js";import{getApiVersionTag as i}from"../internal/telemetry.js";import{errorNotSupportedOnPlatform as a}from"./constants.js";import{runtime as c}from"./runtime.js";class h{constructor(t){this.event=t}serialize(){return{altKey:this.event.altKey,bubbles:this.event.bubbles,cancelBubble:this.event.cancelBubble,charCode:this.event.charCode,code:this.event.code,composed:this.event.composed,ctrlKey:this.event.ctrlKey,defaultPrevented:this.event.defaultPrevented,detail:this.event.detail,eventPhase:this.event.eventPhase,isComposing:this.event.isComposing,isTrusted:this.event.isTrusted,key:this.event.key,keyCode:this.event.keyCode,location:this.event.location,metaKey:this.event.metaKey,repeat:this.event.repeat,returnValue:this.event.returnValue,shiftKey:this.event.shiftKey,timeStamp:this.event.timeStamp,type:this.event.type,which:this.event.which}}}function u(t){return t.toLowerCase().split("+").sort().join("+")}function l(t,e){if(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey||!!t.key&&"escape"===t.key.toLowerCase()}(e)){const r=function(t){return[t.ctrlKey&&"ctrl",t.shiftKey&&"shift",t.altKey&&"alt",t.metaKey&&"meta",t.key.toLowerCase()].filter(Boolean).sort().join("+")}(e);if(t.has(r))return{matchedShortcut:r,isOverridable:f.has(r)}}return{matchedShortcut:void 0,isOverridable:!1}}function d(t){y.clear(),t.shortcuts.forEach(t=>{y.add(u(t))}),f.clear(),t.overridableShortcuts.forEach(t=>{f.add(u(t))})}class v extends s{validate(t){return t&&Array.isArray(t.shortcuts)&&Array.isArray(t.overridableShortcuts)}deserialize(t){return t}}function m(t){if(t.target.closest(`[${g}]`))return;const{matchedShortcut:r,isOverridable:o}=l(y,t);if(!r)return;if(o&&p){if(p(t,{matchedShortcut:r}))return}const n=new h(t);e("shortcutRelay.forwardShortcutEvent",[n],i("v2","shortcutRelay.forwardShortcutEvent")),t.preventDefault(),t.stopImmediatePropagation()}const f=new Set,y=new Set;let p,b=!1;function w(t){if(!C())throw a;const e=p;return p=t,e}function K(){if(!C())throw a;b=!1,y.clear(),f.clear(),p=void 0,document.removeEventListener("keydown",m,{capture:!0})}function S(){return t(this,void 0,void 0,function*(){if(!C())throw a;var t;d(yield r("shortcutRelay.getHostShortcuts",[],new v,i("v2","shortcutRelay.getHostShortcuts"))),b||document.addEventListener("keydown",m,{capture:!0}),b=!0,t=t=>{d(t)},o(i("v2","shortcutRelay.hostShortcutChanged"),"shortcutRelay.hostShortcutChanged",t)})}function C(){return!(!n(c)||!c.supports.shortcutRelay)}const g="data-disable-shortcuts-forwarding";export{g as DISABLE_SHORTCUT_FORWARDING_ATTRIBUTE,S as enableShortcutRelayCapability,C as isSupported,K as resetIsShortcutRelayCapabilityEnabled,w as setOverridableShortcutHandler};
1
+ import{__awaiter as t}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{callFunctionInHost as e,callFunctionInHostAndHandleResponse as r}from"../internal/communication.js";import{registerHandler as o}from"../internal/handlers.js";import{ensureInitialized as n}from"../internal/internalAPIs.js";import{ResponseHandler as s}from"../internal/responseHandler.js";import{getApiVersionTag as i}from"../internal/telemetry.js";import{errorNotSupportedOnPlatform as a}from"./constants.js";import{runtime as c}from"./runtime.js";class h{constructor(t){this.event=t}serialize(){return{altKey:this.event.altKey,bubbles:this.event.bubbles,cancelBubble:this.event.cancelBubble,charCode:this.event.charCode,code:this.event.code,composed:this.event.composed,ctrlKey:this.event.ctrlKey,defaultPrevented:this.event.defaultPrevented,detail:this.event.detail,eventPhase:this.event.eventPhase,isComposing:this.event.isComposing,isTrusted:this.event.isTrusted,key:this.event.key,keyCode:this.event.keyCode,location:this.event.location,metaKey:this.event.metaKey,repeat:this.event.repeat,returnValue:this.event.returnValue,shiftKey:this.event.shiftKey,timeStamp:this.event.timeStamp,type:this.event.type,which:this.event.which}}}function u(t){return t.toLowerCase().split("+").sort().join("+")}function l(t,e){if(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey||!!t.key&&"escape"===t.key.toLowerCase()||!!t.key&&/^F\d+$/i.test(t.key)}(e)){const r=function(t){return[t.ctrlKey&&"ctrl",t.shiftKey&&"shift",t.altKey&&"alt",t.metaKey&&"meta",t.key.toLowerCase()].filter(Boolean).sort().join("+")}(e);if(t.has(r))return{matchedShortcut:r,isOverridable:y.has(r)}}return{matchedShortcut:void 0,isOverridable:!1}}function d(t){f.clear(),t.shortcuts.forEach(t=>{f.add(u(t))}),y.clear(),t.overridableShortcuts.forEach(t=>{y.add(u(t))})}class v extends s{validate(t){return t&&Array.isArray(t.shortcuts)&&Array.isArray(t.overridableShortcuts)}deserialize(t){return t}}function m(t){if(t.target.closest(`[${C}]`))return;const{matchedShortcut:r,isOverridable:o}=l(f,t);if(!r)return;if(o&&p){if(p(t,{matchedShortcut:r}))return}const n=new h(t);e("shortcutRelay.forwardShortcutEvent",[n],i("v2","shortcutRelay.forwardShortcutEvent")),t.preventDefault(),t.stopImmediatePropagation()}const y=new Set,f=new Set;let p,b=!1;function w(t){if(!k())throw a;const e=p;return p=t,e}function K(){if(!k())throw a;b=!1,f.clear(),y.clear(),p=void 0,document.removeEventListener("keydown",m,{capture:!0})}function S(){return t(this,void 0,void 0,function*(){if(!k())throw a;var t;d(yield r("shortcutRelay.getHostShortcuts",[],new v,i("v2","shortcutRelay.getHostShortcuts"))),b||document.addEventListener("keydown",m,{capture:!0}),b=!0,t=t=>{d(t)},o(i("v2","shortcutRelay.hostShortcutChanged"),"shortcutRelay.hostShortcutChanged",t)})}function k(){return!(!n(c)||!c.supports.shortcutRelay)}const C="data-disable-shortcuts-forwarding";export{C as DISABLE_SHORTCUT_FORWARDING_ATTRIBUTE,S as enableShortcutRelayCapability,k as isSupported,K as resetIsShortcutRelayCapabilityEnabled,w as setOverridableShortcutHandler};
@@ -1 +1 @@
1
- const o="2.51.0";export{o as version};
1
+ const o="2.53.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";
4682
+ const version = "2.53.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.
@@ -18386,25 +18386,24 @@ function validateTypeConsistency(shareRequest) {
18386
18386
  throw err;
18387
18387
  }
18388
18388
  }
18389
- function validateContentForSupportedTypes(shareRequest) {
18390
- let err;
18391
- if (shareRequest.content[0].type === 'URL') {
18392
- if (shareRequest.content.some((item) => !item.url)) {
18393
- err = {
18394
- errorCode: ErrorCode.INVALID_ARGUMENTS,
18395
- message: 'URLs are required for URL content types',
18396
- };
18397
- throw err;
18389
+ function validateContentItem(item) {
18390
+ if (item.type === 'URL') {
18391
+ if (!item.url) {
18392
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS, message: 'URLs are required for URL content types' };
18393
+ }
18394
+ }
18395
+ else if (item.type === 'FILE') {
18396
+ if (!item.url) {
18397
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS, message: 'File URLs are required for File content types' };
18398
18398
  }
18399
18399
  }
18400
18400
  else {
18401
- err = {
18402
- errorCode: ErrorCode.INVALID_ARGUMENTS,
18403
- message: 'Content type is unsupported',
18404
- };
18405
- throw err;
18401
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS, message: 'Content type is unsupported' };
18406
18402
  }
18407
18403
  }
18404
+ function validateContentForSupportedTypes(shareRequest) {
18405
+ shareRequest.content.forEach(validateContentItem);
18406
+ }
18408
18407
  /**
18409
18408
  * Checks if the sharing capability is supported by the host
18410
18409
  * @returns boolean to represent whether the sharing capability is supported
@@ -20350,8 +20349,6 @@ function marketplace_isSupported() {
20350
20349
  /**
20351
20350
  * Allows host shortcuts to function in your application by forwarding keyboard shortcuts to the host.
20352
20351
  *
20353
- * This functionality is in Beta.
20354
- * @beta
20355
20352
  * @module
20356
20353
  */
20357
20354
  var shortcutRelay_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -20430,10 +20427,15 @@ function eventToCanonicalShortcut(e) {
20430
20427
  /**
20431
20428
  * Checks if the event is a valid shortcut event.
20432
20429
  * A valid shortcut event is one that has at least one modifier key pressed
20433
- * (ctrl, shift, alt, meta) or the Escape key.
20430
+ * (ctrl, shift, alt, meta), the Escape key, or a function key (F1–F24).
20434
20431
  */
20435
20432
  function isValidShortcutEvent(e) {
20436
- return e.ctrlKey || e.shiftKey || e.altKey || e.metaKey || (!!e.key && e.key.toLowerCase() === 'escape');
20433
+ return (e.ctrlKey ||
20434
+ e.shiftKey ||
20435
+ e.altKey ||
20436
+ e.metaKey ||
20437
+ (!!e.key && e.key.toLowerCase() === 'escape') ||
20438
+ (!!e.key && /^F\d+$/i.test(e.key)));
20437
20439
  }
20438
20440
  function isMatchingShortcut(shortcuts, e) {
20439
20441
  if (isValidShortcutEvent(e)) {
@@ -20533,7 +20535,6 @@ let isShortcutRelayCapabilityEnabled = false;
20533
20535
  * • Pass `undefined` to remove an existing handler.
20534
20536
  * • Returns the previous handler so callers can restore it if needed.
20535
20537
  *
20536
- * @beta
20537
20538
  */
20538
20539
  function setOverridableShortcutHandler(handler) {
20539
20540
  if (!shortcutRelay_isSupported()) {
@@ -20547,7 +20548,6 @@ function setOverridableShortcutHandler(handler) {
20547
20548
  * Reset the state of the shortcut relay capability.
20548
20549
  * This is useful for tests to ensure a clean state.
20549
20550
  *
20550
- * @beta
20551
20551
  */
20552
20552
  function resetIsShortcutRelayCapabilityEnabled() {
20553
20553
  if (!shortcutRelay_isSupported()) {
@@ -20562,7 +20562,6 @@ function resetIsShortcutRelayCapabilityEnabled() {
20562
20562
  /**
20563
20563
  * Enable capability to support host shortcuts.
20564
20564
  *
20565
- * @beta
20566
20565
  */
20567
20566
  function enableShortcutRelayCapability() {
20568
20567
  return shortcutRelay_awaiter(this, void 0, void 0, function* () {
@@ -20589,7 +20588,6 @@ function enableShortcutRelayCapability() {
20589
20588
  *
20590
20589
  * @throws Error if {@link app.initialize} has not successfully completed
20591
20590
  *
20592
- * @beta
20593
20591
  */
20594
20592
  function shortcutRelay_isSupported() {
20595
20593
  return ensureInitialized(runtime) && runtime.supports.shortcutRelay ? true : false;
@@ -20598,7 +20596,6 @@ function shortcutRelay_isSupported() {
20598
20596
  * Allow apps to define zones where shortcuts should not be forwarded to the host.
20599
20597
  * This is useful for input fields for password where shortcuts should not trigger host actions.
20600
20598
  *
20601
- * @beta
20602
20599
  */
20603
20600
  const DISABLE_SHORTCUT_FORWARDING_ATTRIBUTE = 'data-disable-shortcuts-forwarding';
20604
20601