@microsoft/teams-js 2.51.0 → 2.52.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.52.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.52.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-j4GNIru3mNYN+q8XdBRVyvbUx+0U867Cy90v6H61tpIZoR2pUq+bZDZmmpT8N7VG"
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.52.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 +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
- const o="2.51.0";export{o as version};
1
+ const o="2.52.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.52.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