@microsoft/teams-js 2.25.0 → 2.26.0-beta.1

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.
@@ -2756,6 +2756,15 @@ export namespace videoEffectsEx {
2756
2756
  * Limited to Microsoft-internal use
2757
2757
  */
2758
2758
  audioInferenceModel?: ArrayBuffer;
2759
+ /**
2760
+ * @hidden
2761
+ * Specifies additional capabilities that should be applied to the video frame
2762
+ * @beta
2763
+ *
2764
+ * @internal
2765
+ * Limited to Microsoft-internal use
2766
+ */
2767
+ requiredCapabilities?: string[];
2759
2768
  }
2760
2769
  /**
2761
2770
  * @hidden
@@ -2806,6 +2815,15 @@ export namespace videoEffectsEx {
2806
2815
  * Limited to Microsoft-internal use
2807
2816
  */
2808
2817
  audioInferenceResult?: Uint8Array;
2818
+ /**
2819
+ * @hidden
2820
+ * Additional metadata determined by capabilities specified in {@linkcode VideoFrameConfig.requiredCapabilities}
2821
+ * @beta
2822
+ *
2823
+ * @internal
2824
+ * Limited to Microsoft-internal use
2825
+ */
2826
+ attributes?: ReadonlyMap<string, Uint8Array>;
2809
2827
  };
2810
2828
  /**
2811
2829
  * @hidden
@@ -3027,6 +3045,9 @@ export namespace authentication {
3027
3045
  *
3028
3046
  * @returns Promise that resolves with the {@link UserProfile}.
3029
3047
  *
3048
+ * @throws `Error` object in case of any problems, the most likely of which is that the calling app does not have appropriate permissions
3049
+ * to call this method.
3050
+ *
3030
3051
  * @internal
3031
3052
  * Limited to Microsoft-internal use
3032
3053
  */
@@ -3039,6 +3060,10 @@ export namespace authentication {
3039
3060
  * Requests the decoded Microsoft Entra user identity on behalf of the app.
3040
3061
  *
3041
3062
  * @param userRequest - It passes success/failure callbacks in the userRequest object(deprecated)
3063
+ *
3064
+ * @throws `Error` object in case of any problems, the most likely of which is that the calling app does not have appropriate permissions
3065
+ * to call this method.
3066
+ *
3042
3067
  * @internal
3043
3068
  * Limited to Microsoft-internal use
3044
3069
  */
@@ -5791,11 +5816,11 @@ export namespace pages {
5791
5816
  */
5792
5817
  function getConfig(): Promise<InstanceConfig>;
5793
5818
  /**
5794
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
5795
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
5796
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
5797
- * than the current one in a way that keeps the application informed of the change and allows the SDK to
5798
- * continue working.
5819
+ * @deprecated
5820
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
5821
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
5822
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
5823
+ * remove any calls to this API.
5799
5824
  * @param url - The URL to navigate the frame to.
5800
5825
  * @returns Promise that resolves when the navigation has completed.
5801
5826
  */
@@ -5856,6 +5881,11 @@ export namespace pages {
5856
5881
  * For apps installed as a channel tab, this ID can be supplied to indicate in which Teams channel the app should be opened
5857
5882
  */
5858
5883
  channelId?: string;
5884
+ /**
5885
+ * Optional ID of the chat or meeting where the app should be opened
5886
+
5887
+ */
5888
+ chatId?: string;
5859
5889
  }
5860
5890
  /**
5861
5891
  * Provides APIs for querying and navigating between contextual tabs of an application. Unlike personal tabs,
@@ -9526,14 +9556,10 @@ export function returnFocus(navigateForward?: boolean): void;
9526
9556
  export function navigateToTab(tabInstance: TabInstance, onComplete?: onCompleteHandlerFunctionType): void;
9527
9557
  /**
9528
9558
  * @deprecated
9529
- * As of TeamsJS v2.0.0, please use {@link pages.navigateCrossDomain pages.navigateCrossDomain(url: string): Promise\<void\>} instead.
9530
- *
9531
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
9532
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
9533
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
9534
- * than the current one in a way that keeps the app informed of the change and allows the SDK to
9535
- * continue working.
9536
- *
9559
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
9560
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
9561
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
9562
+ * remove any calls to this API.
9537
9563
  * @param url - The URL to navigate the frame to.
9538
9564
  * @param onComplete - The callback to invoke when the action is complete.
9539
9565
  */
@@ -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');
@@ -1130,7 +1130,7 @@ function isFollowingApiVersionTagFormat(apiVersionTag) {
1130
1130
  }
1131
1131
 
1132
1132
  ;// CONCATENATED MODULE: ./src/artifactsForCDN/validDomains.json
1133
- const validDomains_namespaceObject = /*#__PURE__*/JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.live.com","outlook-sdf.live.com","teams.live.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","devspaces.skype.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","www.bing.com","www.staging-bing-int.com","teams.cloud.microsoft","outlook.cloud.microsoft","m365.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net"]}');
1133
+ const validDomains_namespaceObject = /*#__PURE__*/JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.live.com","outlook-sdf.live.com","teams.live.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","devspaces.skype.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","www.bing.com","www.staging-bing-int.com","*.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net","fa000000136.resources.office.net"]}');
1134
1134
  var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
1135
1135
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1136
1136
 
@@ -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.25.0";
3398
+ const version = "2.26.0-beta.1";
3399
3399
 
3400
3400
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
3401
3401
 
@@ -3553,11 +3553,11 @@ function prefetchOriginsFromCDN() {
3553
3553
  });
3554
3554
  }
3555
3555
  function isValidOriginsCacheEmpty() {
3556
- return validOriginsCache.length !== 0;
3556
+ return validOriginsCache.length === 0;
3557
3557
  }
3558
3558
  function getValidOriginsListFromCDN() {
3559
3559
  return __awaiter(this, void 0, void 0, function* () {
3560
- if (isValidOriginsCacheEmpty()) {
3560
+ if (!isValidOriginsCacheEmpty()) {
3561
3561
  return validOriginsCache;
3562
3562
  }
3563
3563
  if (!inServerSideRenderingEnvironment()) {
@@ -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
  }
@@ -5596,11 +5597,11 @@ var pages;
5596
5597
  }
5597
5598
  pages.getConfig = getConfig;
5598
5599
  /**
5599
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
5600
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
5601
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
5602
- * than the current one in a way that keeps the application informed of the change and allows the SDK to
5603
- * 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.
5604
5605
  * @param url - The URL to navigate the frame to.
5605
5606
  * @returns Promise that resolves when the navigation has completed.
5606
5607
  */
@@ -7039,7 +7040,15 @@ function shouldProcessMessage(messageSource, messageOrigin) {
7039
7040
  return true;
7040
7041
  }
7041
7042
  else {
7042
- 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);
7043
7052
  if (!isOriginValid) {
7044
7053
  shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
7045
7054
  }
@@ -10347,6 +10356,7 @@ class OneTextureMetadata {
10347
10356
  // Stream id for audio inference metadata, which is the 4-byte ASCII string "1dia" hardcoded by the host
10348
10357
  // (1dia stands for "audio inference data version 1")
10349
10358
  this.AUDIO_INFERENCE_RESULT_STREAM_ID = 0x31646961;
10359
+ this.ATTRIBUTE_ID_MAP_STREAM_ID = 0x4d444941;
10350
10360
  const metadataDataView = new Uint32Array(metadataBuffer);
10351
10361
  for (let i = 0, index = 0; i < streamCount; i++) {
10352
10362
  const streamId = metadataDataView[index++];
@@ -10359,6 +10369,48 @@ class OneTextureMetadata {
10359
10369
  get audioInferenceResult() {
10360
10370
  return this.metadataMap.get(this.AUDIO_INFERENCE_RESULT_STREAM_ID);
10361
10371
  }
10372
+ /**
10373
+ * @hidden
10374
+ * Additional attributes on the video frame are string-indexed, with their stream Id dynamically generated.
10375
+ * The mapping of attribute Ids to their stream Ids is itself stored as frame metadata with layout:
10376
+ *
10377
+ * | attribute count | attribute stream Id | attribute id | ... |
10378
+ * | :---: | :---: | :---: | :---: |
10379
+ * | 4 bytes | 4 bytes | variable length string (null terminated, 4 byte aligned) | ... |
10380
+ *
10381
+ *
10382
+ * @internal
10383
+ * Limited to Microsoft-internal use
10384
+ */
10385
+ get attributes() {
10386
+ const data = this.metadataMap.get(this.ATTRIBUTE_ID_MAP_STREAM_ID);
10387
+ if (data === undefined) {
10388
+ return undefined;
10389
+ }
10390
+ const map = new Map();
10391
+ const textDecoder = new TextDecoder('utf-8');
10392
+ let offset = 0;
10393
+ const count = data[offset] + (data[++offset] << 8) + (data[++offset] << 16) + (data[++offset] << 24);
10394
+ for (let i = 0; i < count && offset < data.length - 1; i++) {
10395
+ const streamId = data[++offset] + (data[++offset] << 8) + (data[++offset] << 16) + (data[++offset] << 24);
10396
+ // Find start of null-terminator for the subsequent variable-length string entry
10397
+ const nullTerminatorStartIndex = data.findIndex((value, index, _) => {
10398
+ return value == 0 && index > offset;
10399
+ });
10400
+ const attributeId = textDecoder.decode(data.slice(++offset, nullTerminatorStartIndex));
10401
+ // Read attribute value from metadata map
10402
+ const metadata = this.metadataMap.get(streamId);
10403
+ if (metadata !== undefined) {
10404
+ map.set(attributeId, metadata);
10405
+ }
10406
+ // Variable length attribute Id strings are null-terminated to a 4-byte alignment
10407
+ const stringByteLength = nullTerminatorStartIndex - offset;
10408
+ const paddingSize = 4 - (stringByteLength % 4);
10409
+ // Set offset to index of last trailing zero
10410
+ offset = nullTerminatorStartIndex + (paddingSize - 1);
10411
+ }
10412
+ return map;
10413
+ }
10362
10414
  }
10363
10415
  class TransformerWithMetadata {
10364
10416
  constructor(notifyError, videoFrameHandler) {
@@ -10369,8 +10421,8 @@ class TransformerWithMetadata {
10369
10421
  const timestamp = originalFrame.timestamp;
10370
10422
  if (timestamp !== null) {
10371
10423
  try {
10372
- const { videoFrame, metadata: { audioInferenceResult } = {} } = yield this.extractVideoFrameAndMetadata(originalFrame);
10373
- const frameProcessedByApp = yield this.videoFrameHandler({ videoFrame, audioInferenceResult });
10424
+ const { videoFrame, metadata: { audioInferenceResult, attributes } = {} } = yield this.extractVideoFrameAndMetadata(originalFrame);
10425
+ const frameProcessedByApp = yield this.videoFrameHandler({ videoFrame, audioInferenceResult, attributes });
10374
10426
  // the current typescript version(4.6.4) dosn't support webcodecs API fully, we have to do type conversion here.
10375
10427
  const processedFrame = new VideoFrame(frameProcessedByApp, {
10376
10428
  // we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
@@ -10467,6 +10519,7 @@ class TransformerWithMetadata {
10467
10519
  }),
10468
10520
  metadata: {
10469
10521
  audioInferenceResult: this.shouldDiscardAudioInferenceResult ? undefined : metadata.audioInferenceResult,
10522
+ attributes: metadata.attributes,
10470
10523
  },
10471
10524
  };
10472
10525
  });
@@ -14836,14 +14889,10 @@ function navigateToTab(tabInstance, onComplete) {
14836
14889
  }
14837
14890
  /**
14838
14891
  * @deprecated
14839
- * As of TeamsJS v2.0.0, please use {@link pages.navigateCrossDomain pages.navigateCrossDomain(url: string): Promise\<void\>} instead.
14840
- *
14841
- * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
14842
- * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
14843
- * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
14844
- * than the current one in a way that keeps the app informed of the change and allows the SDK to
14845
- * continue working.
14846
- *
14892
+ * As of 2.0.0, this API is deprecated and can be replaced by the standard JavaScript
14893
+ * API, window.location.href, when navigating the app to a new cross-domain URL. Any URL
14894
+ * that is redirected to must be listed in the validDomains block of the manifest. Please
14895
+ * remove any calls to this API.
14847
14896
  * @param url - The URL to navigate the frame to.
14848
14897
  * @param onComplete - The callback to invoke when the action is complete.
14849
14898
  */