@microsoft/teams-js 2.24.1-beta.1 → 2.26.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
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.24.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.25.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.24.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-79NK4sbfVpgLoDFqyfj18/S1Uj8jhLBeRGvKO1Cqw5634RznExQ90myY/qV/0gsN"
48
+ src="https://res.cdn.office.net/teams-js/2.25.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-6royw0i5cEmf/8pzbTX9dVy1pjjJA8PQOaQbGvoL/m39OdjrlcWluhQZxqy5KbJA"
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.24.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.25.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -3027,6 +3027,9 @@ export namespace authentication {
3027
3027
  *
3028
3028
  * @returns Promise that resolves with the {@link UserProfile}.
3029
3029
  *
3030
+ * @throws `Error` object in case of any problems, the most likely of which is that the calling app does not have appropriate permissions
3031
+ * to call this method.
3032
+ *
3030
3033
  * @internal
3031
3034
  * Limited to Microsoft-internal use
3032
3035
  */
@@ -3039,6 +3042,10 @@ export namespace authentication {
3039
3042
  * Requests the decoded Microsoft Entra user identity on behalf of the app.
3040
3043
  *
3041
3044
  * @param userRequest - It passes success/failure callbacks in the userRequest object(deprecated)
3045
+ *
3046
+ * @throws `Error` object in case of any problems, the most likely of which is that the calling app does not have appropriate permissions
3047
+ * to call this method.
3048
+ *
3042
3049
  * @internal
3043
3050
  * Limited to Microsoft-internal use
3044
3051
  */
@@ -3688,7 +3695,7 @@ export enum FileOpenPreference {
3688
3695
  Web = "web"
3689
3696
  }
3690
3697
  /**
3691
- * Possible Action Types
3698
+ * Types of Action Objects
3692
3699
  *
3693
3700
  * @beta
3694
3701
  */
@@ -3708,8 +3715,7 @@ export interface BaseActionObject<T extends ActionObjectType> {
3708
3715
  type: T;
3709
3716
  }
3710
3717
  /**
3711
- * Stores information needed to represent M365 Content stored
3712
- * in OneDrive or Sharepoint
3718
+ * Stores information needed to represent content stored in OneDrive or Sharepoint
3713
3719
  *
3714
3720
  * @beta
3715
3721
  */
@@ -3723,7 +3729,7 @@ export interface M365ContentAction extends BaseActionObject<ActionObjectType.M36
3723
3729
  secondaryId?: SecondaryId;
3724
3730
  }
3725
3731
  /**
3726
- * Contains information on what Graph item is being queried
3732
+ * Contains additional IDs of the content that the action is triggered from. Maps to ids used in the Graph.
3727
3733
  *
3728
3734
  * @beta
3729
3735
  */
@@ -3749,13 +3755,15 @@ export enum SecondaryM365ContentIdName {
3749
3755
  UserId = "userId"
3750
3756
  }
3751
3757
  /**
3752
- * Information common to all actions
3758
+ * Information about an Action.
3753
3759
  *
3760
+ * @remarks
3761
+ * This contains Id of the action, and the information about the object that triggered the action.
3754
3762
  * @beta
3755
3763
  */
3756
3764
  export interface ActionInfo {
3757
3765
  /**
3758
- * Maps to the action id supplied inside the manifest
3766
+ * Id of the action. Maps to the action id supplied inside the manifest
3759
3767
  */
3760
3768
  actionId: string;
3761
3769
  /**
@@ -5790,11 +5798,11 @@ export namespace pages {
5790
5798
  */
5791
5799
  function getConfig(): Promise<InstanceConfig>;
5792
5800
  /**
5793
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
5794
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
5795
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
5796
- * than the current one in a way that keeps the application informed of the change and allows the SDK to
5797
- * continue working.
5801
+ * @deprecated
5802
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
5803
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
5804
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
5805
+ * remove any calls to this API.
5798
5806
  * @param url - The URL to navigate the frame to.
5799
5807
  * @returns Promise that resolves when the navigation has completed.
5800
5808
  */
@@ -5855,6 +5863,11 @@ export namespace pages {
5855
5863
  * For apps installed as a channel tab, this ID can be supplied to indicate in which Teams channel the app should be opened
5856
5864
  */
5857
5865
  channelId?: string;
5866
+ /**
5867
+ * Optional ID of the chat or meeting where the app should be opened
5868
+
5869
+ */
5870
+ chatId?: string;
5858
5871
  }
5859
5872
  /**
5860
5873
  * Provides APIs for querying and navigating between contextual tabs of an application. Unlike personal tabs,
@@ -9525,14 +9538,10 @@ export function returnFocus(navigateForward?: boolean): void;
9525
9538
  export function navigateToTab(tabInstance: TabInstance, onComplete?: onCompleteHandlerFunctionType): void;
9526
9539
  /**
9527
9540
  * @deprecated
9528
- * As of TeamsJS v2.0.0, please use {@link pages.navigateCrossDomain pages.navigateCrossDomain(url: string): Promise\<void\>} instead.
9529
- *
9530
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
9531
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
9532
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
9533
- * than the current one in a way that keeps the app informed of the change and allows the SDK to
9534
- * continue working.
9535
- *
9541
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
9542
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
9543
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
9544
+ * remove any calls to this API.
9536
9545
  * @param url - The URL to navigate the frame to.
9537
9546
  * @param onComplete - The callback to invoke when the action is complete.
9538
9547
  */
@@ -169,7 +169,7 @@ function fromByteArray (uint8) {
169
169
 
170
170
  /***/ }),
171
171
 
172
- /***/ 46:
172
+ /***/ 815:
173
173
  /***/ ((module, exports, __webpack_require__) => {
174
174
 
175
175
  /* eslint-env browser */
@@ -426,7 +426,7 @@ function localstorage() {
426
426
  }
427
427
  }
428
428
 
429
- module.exports = __webpack_require__(601)(exports);
429
+ module.exports = __webpack_require__(530)(exports);
430
430
 
431
431
  const {formatters} = module.exports;
432
432
 
@@ -445,7 +445,7 @@ formatters.j = function (v) {
445
445
 
446
446
  /***/ }),
447
447
 
448
- /***/ 601:
448
+ /***/ 530:
449
449
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
450
450
 
451
451
 
@@ -1090,8 +1090,8 @@ __webpack_require__.d(__webpack_exports__, {
1090
1090
  webStorage: () => (/* reexport */ webStorage)
1091
1091
  });
1092
1092
 
1093
- // EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js
1094
- var browser = __webpack_require__(46);
1093
+ // EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js
1094
+ var browser = __webpack_require__(815);
1095
1095
  ;// CONCATENATED MODULE: ./src/internal/telemetry.ts
1096
1096
 
1097
1097
  const topLevelLogger = (0,browser.debug)('teamsJs');
@@ -2278,7 +2278,7 @@ var FileOpenPreference;
2278
2278
  FileOpenPreference["Web"] = "web";
2279
2279
  })(FileOpenPreference || (FileOpenPreference = {}));
2280
2280
  /**
2281
- * Possible Action Types
2281
+ * Types of Action Objects
2282
2282
  *
2283
2283
  * @beta
2284
2284
  */
@@ -2810,8 +2810,8 @@ function createTeamsAppLink(params) {
2810
2810
  if (params.webUrl) {
2811
2811
  url.searchParams.append('webUrl', params.webUrl);
2812
2812
  }
2813
- if (params.channelId || params.subPageId) {
2814
- url.searchParams.append('context', JSON.stringify({ channelId: params.channelId, subEntityId: params.subPageId }));
2813
+ if (params.chatId || params.channelId || params.subPageId) {
2814
+ url.searchParams.append('context', JSON.stringify({ chatId: params.chatId, channelId: params.channelId, subEntityId: params.subPageId }));
2815
2815
  }
2816
2816
  return url.toString();
2817
2817
  }
@@ -3395,7 +3395,7 @@ const _minRuntimeConfigToUninitialize = {
3395
3395
  * @hidden
3396
3396
  * Package version.
3397
3397
  */
3398
- const version = "2.24.1-beta.1";
3398
+ const version = "2.26.0-beta.0";
3399
3399
 
3400
3400
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
3401
3401
 
@@ -4014,11 +4014,12 @@ var authentication;
4014
4014
  return value;
4015
4015
  })
4016
4016
  .catch((err) => {
4017
+ const errorMessage = `Error returned, code = ${err.errorCode}, message = ${err.message}`;
4017
4018
  if (userRequest && userRequest.failureCallback) {
4018
- userRequest.failureCallback(err.message);
4019
+ userRequest.failureCallback(errorMessage);
4019
4020
  return null;
4020
4021
  }
4021
- throw err;
4022
+ throw new Error(errorMessage);
4022
4023
  });
4023
4024
  }
4024
4025
  authentication.getUser = getUser;
@@ -4030,7 +4031,7 @@ var authentication;
4030
4031
  return result;
4031
4032
  }
4032
4033
  else {
4033
- throw new Error(result);
4034
+ throw result;
4034
4035
  }
4035
4036
  });
4036
4037
  }
@@ -4266,10 +4267,7 @@ function botUrlOpenHelper(apiVersionTag, urlDialogInfo, submitHandler, messageFr
4266
4267
  });
4267
4268
  }
4268
4269
  function urlSubmitHelper(apiVersionTag, result, appIds) {
4269
- // FrameContext content should not be here because dialog.submit can be called only from inside of a dialog (FrameContext task)
4270
- // but it's here because Teams mobile incorrectly returns FrameContext.content when calling app.getFrameContext().
4271
- // FrameContexts.content will be removed once the bug is fixed.
4272
- ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
4270
+ ensureInitialized(runtime, FrameContexts.task);
4273
4271
  if (!dialog.url.isSupported()) {
4274
4272
  throw errorNotSupportedOnPlatform;
4275
4273
  }
@@ -5599,11 +5597,11 @@ var pages;
5599
5597
  }
5600
5598
  pages.getConfig = getConfig;
5601
5599
  /**
5602
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
5603
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
5604
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
5605
- * than the current one in a way that keeps the application informed of the change and allows the SDK to
5606
- * continue working.
5600
+ * @deprecated
5601
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
5602
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
5603
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
5604
+ * remove any calls to this API.
5607
5605
  * @param url - The URL to navigate the frame to.
5608
5606
  * @returns Promise that resolves when the navigation has completed.
5609
5607
  */
@@ -7042,7 +7040,15 @@ function shouldProcessMessage(messageSource, messageOrigin) {
7042
7040
  return true;
7043
7041
  }
7044
7042
  else {
7045
- const isOriginValid = yield validateOrigin(new URL(messageOrigin));
7043
+ let messageOriginURL;
7044
+ try {
7045
+ messageOriginURL = new URL(messageOrigin);
7046
+ }
7047
+ catch (_) {
7048
+ shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
7049
+ return false;
7050
+ }
7051
+ const isOriginValid = yield validateOrigin(messageOriginURL);
7046
7052
  if (!isOriginValid) {
7047
7053
  shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
7048
7054
  }
@@ -14839,14 +14845,10 @@ function navigateToTab(tabInstance, onComplete) {
14839
14845
  }
14840
14846
  /**
14841
14847
  * @deprecated
14842
- * As of TeamsJS v2.0.0, please use {@link pages.navigateCrossDomain pages.navigateCrossDomain(url: string): Promise\<void\>} instead.
14843
- *
14844
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
14845
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
14846
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
14847
- * than the current one in a way that keeps the app informed of the change and allows the SDK to
14848
- * continue working.
14849
- *
14848
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
14849
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
14850
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
14851
+ * remove any calls to this API.
14850
14852
  * @param url - The URL to navigate the frame to.
14851
14853
  * @param onComplete - The callback to invoke when the action is complete.
14852
14854
  */