@microsoft/teams-js 2.9.0-beta.0 → 2.9.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.
@@ -7,7 +7,7 @@
7
7
  exports["microsoftTeams"] = factory();
8
8
  else
9
9
  root["microsoftTeams"] = factory();
10
- })(self, function() {
10
+ })(self, () => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
@@ -1477,6 +1477,10 @@ var HostName;
1477
1477
  * Teams
1478
1478
  */
1479
1479
  HostName["teams"] = "Teams";
1480
+ /**
1481
+ * Modern Teams
1482
+ */
1483
+ HostName["teamsModern"] = "TeamsModern";
1480
1484
  })(HostName || (HostName = {}));
1481
1485
  // Ensure these declarations stay in sync with the framework.
1482
1486
  var FrameContexts;
@@ -2151,7 +2155,7 @@ var _minRuntimeConfigToUninitialize = {
2151
2155
  };
2152
2156
 
2153
2157
  ;// CONCATENATED MODULE: ./src/public/version.ts
2154
- var version = "2.9.0-beta.0";
2158
+ var version = "2.9.0-beta.1";
2155
2159
 
2156
2160
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2157
2161
 
@@ -2302,6 +2306,11 @@ var authentication;
2302
2306
  (function (authentication) {
2303
2307
  var authHandlers;
2304
2308
  var authWindowMonitor;
2309
+ /**
2310
+ * @hidden
2311
+ * @internal
2312
+ * Limited to Microsoft-internal use; automatically called when library is initialized
2313
+ */
2305
2314
  function initialize() {
2306
2315
  registerHandler('authentication.authenticate.success', handleSuccess, false);
2307
2316
  registerHandler('authentication.authenticate.failure', handleFailure, false);
@@ -2310,10 +2319,11 @@ var authentication;
2310
2319
  var authParams;
2311
2320
  /**
2312
2321
  * @deprecated
2313
- * As of 2.0.0, this function has been deprecated in favor of a Promise-based pattern.
2314
- * Registers the authentication Communication.handlers
2322
+ * As of 2.0.0, this function has been deprecated in favor of a Promise-based pattern using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
2323
+ *
2324
+ * Registers handlers to be called with the result of an authentication flow triggered using {@link authentication.authenticate authentication.authenticate(authenticateParameters?: AuthenticateParameters): void}
2315
2325
  *
2316
- * @param authenticateParameters - A set of values that configure the authentication pop-up.
2326
+ * @param authenticateParameters - Configuration for authentication flow pop-up result communication
2317
2327
  */
2318
2328
  function registerAuthenticationHandlers(authenticateParameters) {
2319
2329
  authParams = authenticateParameters;
@@ -2563,13 +2573,17 @@ var authentication;
2563
2573
  });
2564
2574
  }
2565
2575
  /**
2566
- * Notifies the frame that initiated this authentication request that the request was successful.
2576
+ * When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
2577
+ * window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
2578
+ * {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
2579
+ * authentication request was successful.
2567
2580
  *
2568
2581
  * @remarks
2569
- * This function is usable only on the authentication window.
2582
+ * This function is usable only from the authentication window.
2570
2583
  * This call causes the authentication window to be closed.
2571
2584
  *
2572
- * @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
2585
+ * @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
2586
+ * this value in its callback or via the `Promise` return value
2573
2587
  * @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
2574
2588
  */
2575
2589
  function notifySuccess(result, callbackUrl) {
@@ -2581,13 +2595,18 @@ var authentication;
2581
2595
  }
2582
2596
  authentication.notifySuccess = notifySuccess;
2583
2597
  /**
2584
- * Notifies the frame that initiated this authentication request that the request failed.
2598
+ * When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
2599
+ * window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
2600
+ * {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
2601
+ * authentication request failed.
2602
+
2585
2603
  *
2586
2604
  * @remarks
2587
2605
  * This function is usable only on the authentication window.
2588
2606
  * This call causes the authentication window to be closed.
2589
2607
  *
2590
- * @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
2608
+ * @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
2609
+ * this value in its callback or via the `Promise` return value
2591
2610
  * @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
2592
2611
  */
2593
2612
  function notifyFailure(reason, callbackUrl) {
@@ -2698,7 +2717,15 @@ var authentication;
2698
2717
 
2699
2718
 
2700
2719
  /**
2701
- * Namespace to interact with the dialog module-specific part of the SDK.
2720
+ * This group of capabilities enables apps to show modal dialogs. There are two primary types of dialogs: URL-based dialogs and [Adaptive Card](https://learn.microsoft.com/adaptive-cards/) dialogs.
2721
+ * Both types of dialogs are shown on top of your app, preventing interaction with your app while they are displayed.
2722
+ * - URL-based dialogs allow you to specify a URL from which the contents will be shown inside the dialog.
2723
+ * - For URL dialogs, use the functions and interfaces in the {@link dialog.url} namespace.
2724
+ * - Adaptive Card-based dialogs allow you to provide JSON describing an Adaptive Card that will be shown inside the dialog.
2725
+ * - For Adaptive Card dialogs, use the functions and interfaces in the {@link dialog.adaptiveCard} namespace.
2726
+ *
2727
+ * @remarks Note that dialogs were previously called "task modules". While they have been renamed for clarity, the functionality has been maintained.
2728
+ * For more details, see [Dialogs](https://learn.microsoft.com/microsoftteams/platform/task-modules-and-cards/what-are-task-modules)
2702
2729
  *
2703
2730
  * @beta
2704
2731
  */
@@ -2947,14 +2974,11 @@ var dialog;
2947
2974
  url.getDialogInfoFromBotUrlDialogInfo = getDialogInfoFromBotUrlDialogInfo;
2948
2975
  })(url = dialog.url || (dialog.url = {}));
2949
2976
  /**
2950
- * Checks if dialog capability is supported by the host
2951
- * @returns boolean to represent whether dialog capabilty is supported
2952
- *
2953
- * @throws Error if {@linkcode app.initialize} has not successfully completed
2954
- *
2955
- * @throws Error if {@linkcode app.initialize} has not successfully completed
2977
+ * This function currently serves no purpose and should not be used. All functionality that used
2978
+ * to be covered by this method is now in subcapabilities and those isSupported methods should be
2979
+ * used directly.
2956
2980
  *
2957
- * @beta
2981
+ * @hidden
2958
2982
  */
2959
2983
  function isSupported() {
2960
2984
  return ensureInitialized(runtime) && runtime.supports.dialog ? true : false;
@@ -7766,6 +7790,53 @@ var profile;
7766
7790
  })(profile || (profile = {}));
7767
7791
 
7768
7792
  ;// CONCATENATED MODULE: ./src/public/video.ts
7793
+ var video_assign = (undefined && undefined.__assign) || function () {
7794
+ video_assign = Object.assign || function(t) {
7795
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7796
+ s = arguments[i];
7797
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7798
+ t[p] = s[p];
7799
+ }
7800
+ return t;
7801
+ };
7802
+ return video_assign.apply(this, arguments);
7803
+ };
7804
+ var video_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
7805
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7806
+ return new (P || (P = Promise))(function (resolve, reject) {
7807
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7808
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7809
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7810
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7811
+ });
7812
+ };
7813
+ var video_generator = (undefined && undefined.__generator) || function (thisArg, body) {
7814
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7815
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7816
+ function verb(n) { return function (v) { return step([n, v]); }; }
7817
+ function step(op) {
7818
+ if (f) throw new TypeError("Generator is already executing.");
7819
+ while (_) try {
7820
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
7821
+ if (y = 0, t) op = [op[0] & 2, t.value];
7822
+ switch (op[0]) {
7823
+ case 0: case 1: t = op; break;
7824
+ case 4: _.label++; return { value: op[1], done: false };
7825
+ case 5: _.label++; y = op[1]; op = [0]; continue;
7826
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
7827
+ default:
7828
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7829
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7830
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7831
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7832
+ if (t[2]) _.ops.pop();
7833
+ _.trys.pop(); continue;
7834
+ }
7835
+ op = body.call(thisArg, _);
7836
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7837
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7838
+ }
7839
+ };
7769
7840
 
7770
7841
 
7771
7842
 
@@ -7783,7 +7854,7 @@ var video;
7783
7854
  */
7784
7855
  var VideoFrameFormat;
7785
7856
  (function (VideoFrameFormat) {
7786
- VideoFrameFormat[VideoFrameFormat["NV12"] = 0] = "NV12";
7857
+ VideoFrameFormat["NV12"] = "NV12";
7787
7858
  })(VideoFrameFormat = video.VideoFrameFormat || (video.VideoFrameFormat = {}));
7788
7859
  /**
7789
7860
  * Video effect change type enum
@@ -7827,10 +7898,14 @@ var video;
7827
7898
  if (!isSupported()) {
7828
7899
  throw errorNotSupportedOnPlatform;
7829
7900
  }
7830
- registerHandler('video.newVideoFrame', function (videoFrame) {
7901
+ registerHandler('video.newVideoFrame',
7902
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7903
+ function (videoFrame) {
7831
7904
  if (videoFrame) {
7832
- var timestamp_1 = videoFrame.timestamp;
7833
- frameCallback(videoFrame, function () {
7905
+ // The host may pass the VideoFrame with the old definition which has `data` instead of `videoFrameBuffer`
7906
+ var videoFrameData = video_assign(video_assign({}, videoFrame), { videoFrameBuffer: videoFrame.videoFrameBuffer || videoFrame.data });
7907
+ var timestamp_1 = videoFrameData.timestamp;
7908
+ frameCallback(videoFrameData, function () {
7834
7909
  notifyVideoFrameProcessed(timestamp_1);
7835
7910
  }, notifyError);
7836
7911
  }
@@ -7906,6 +7981,165 @@ var video;
7906
7981
  return ensureInitialized(runtime) && runtime.supports.video ? true : false;
7907
7982
  }
7908
7983
  video.isSupported = isSupported;
7984
+ /**
7985
+ * @beta
7986
+ * Namespace to get video frames from a media stream.
7987
+ * When the host supports this capability, developer should call {@link mediaStream.registerForVideoFrame} to get the video frames instead of {@link registerForVideoFrame} to get the video frames, callback of {@link registerForVideoFrame} will be ignored when the host supports this capability.
7988
+ */
7989
+ var mediaStream;
7990
+ (function (mediaStream_1) {
7991
+ /**
7992
+ * @beta
7993
+ * Checks if video.mediaStream capability is supported by the host
7994
+ * @returns boolean to represent whether the video.medisStream capability is supported
7995
+ *
7996
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
7997
+ *
7998
+ */
7999
+ function isSupported() {
8000
+ var _a;
8001
+ return ensureInitialized(runtime) && isTextureStreamAvailable() && !!((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.mediaStream);
8002
+ }
8003
+ mediaStream_1.isSupported = isSupported;
8004
+ function isTextureStreamAvailable() {
8005
+ var _a, _b, _c, _d;
8006
+ return (typeof window !== 'undefined' &&
8007
+ !!(((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.getTextureStream) && ((_d = (_c = window['chrome']) === null || _c === void 0 ? void 0 : _c.webview) === null || _d === void 0 ? void 0 : _d.registerTextureStream)));
8008
+ }
8009
+ /**
8010
+ * @beta
8011
+ * Register to read the video frames from the media stream provided by the host.
8012
+ * @param frameCallback - The callback to invoke when recieve a video frame from the media stream.
8013
+ * @example
8014
+ * ```typescript
8015
+ * video.mediaStream.registerForVideoFrame(async (receivedVideoFrame) => {
8016
+ * const { videoFrame } = receivedVideoFrame;
8017
+ * try {
8018
+ * return await processVideoFrame(videoFrame);
8019
+ * } catch (error) {
8020
+ * throw error;
8021
+ * }
8022
+ * });
8023
+ * ```
8024
+ */
8025
+ function registerForVideoFrame(frameCallback) {
8026
+ var _this = this;
8027
+ ensureInitialized(runtime, FrameContexts.sidePanel);
8028
+ if (!isSupported()) {
8029
+ throw errorNotSupportedOnPlatform;
8030
+ }
8031
+ registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return video_awaiter(_this, void 0, void 0, function () {
8032
+ var streamId, videoTrack, generator;
8033
+ var _a, _b;
8034
+ return video_generator(this, function (_c) {
8035
+ switch (_c.label) {
8036
+ case 0:
8037
+ streamId = mediaStreamInfo.streamId;
8038
+ return [4 /*yield*/, getInputVideoTrack(streamId)];
8039
+ case 1:
8040
+ videoTrack = _c.sent();
8041
+ generator = createProcessedStreamGenerator(videoTrack, frameCallback);
8042
+ // register the video track with processed frames back to the stream:
8043
+ typeof window !== 'undefined' && ((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.registerTextureStream(streamId, generator));
8044
+ return [2 /*return*/];
8045
+ }
8046
+ });
8047
+ }); });
8048
+ sendMessageToParent('video.registerForVideoFrame', [
8049
+ {
8050
+ format: VideoFrameFormat.NV12,
8051
+ },
8052
+ ]);
8053
+ }
8054
+ mediaStream_1.registerForVideoFrame = registerForVideoFrame;
8055
+ /**
8056
+ * Get the video track from the media stream gotten from chrome.webview.getTextureStream(streamId).
8057
+ */
8058
+ function getInputVideoTrack(streamId) {
8059
+ return video_awaiter(this, void 0, void 0, function () {
8060
+ var chrome, mediaStream_2, tracks, error_1, errorMsg;
8061
+ return video_generator(this, function (_a) {
8062
+ switch (_a.label) {
8063
+ case 0:
8064
+ if (typeof window === 'undefined') {
8065
+ throw errorNotSupportedOnPlatform;
8066
+ }
8067
+ chrome = window['chrome'];
8068
+ _a.label = 1;
8069
+ case 1:
8070
+ _a.trys.push([1, 3, , 4]);
8071
+ return [4 /*yield*/, chrome.webview.getTextureStream(streamId)];
8072
+ case 2:
8073
+ mediaStream_2 = _a.sent();
8074
+ tracks = mediaStream_2.getVideoTracks();
8075
+ if (tracks.length === 0) {
8076
+ throw new Error("No video track in stream ".concat(streamId));
8077
+ }
8078
+ return [2 /*return*/, tracks[0]];
8079
+ case 3:
8080
+ error_1 = _a.sent();
8081
+ errorMsg = "Failed to get video track from stream ".concat(streamId, ", error: ").concat(error_1);
8082
+ notifyError(errorMsg);
8083
+ throw new Error(errorMsg);
8084
+ case 4: return [2 /*return*/];
8085
+ }
8086
+ });
8087
+ });
8088
+ }
8089
+ /**
8090
+ * The function to create a processed video track from the original video track.
8091
+ * It reads frames from the video track and pipes them to the video frame callback to process the frames.
8092
+ * The processed frames are then enqueued to the generator.
8093
+ * The generator can be registered back to the media stream so that the host can get the processed frames.
8094
+ */
8095
+ function createProcessedStreamGenerator(videoTrack, videoFrameCallback) {
8096
+ var processor = new MediaStreamTrackProcessor({ track: videoTrack });
8097
+ var source = processor.readable;
8098
+ var generator = new MediaStreamTrackGenerator({ kind: 'video' });
8099
+ var sink = generator.writable;
8100
+ source
8101
+ .pipeThrough(new TransformStream({
8102
+ transform: function (originalFrame, controller) {
8103
+ return video_awaiter(this, void 0, void 0, function () {
8104
+ var timestamp, frameProcessedByApp, processedFrame, error_2;
8105
+ return video_generator(this, function (_a) {
8106
+ switch (_a.label) {
8107
+ case 0:
8108
+ timestamp = originalFrame.timestamp;
8109
+ if (!(timestamp !== null)) return [3 /*break*/, 5];
8110
+ _a.label = 1;
8111
+ case 1:
8112
+ _a.trys.push([1, 3, , 4]);
8113
+ return [4 /*yield*/, videoFrameCallback({ videoFrame: originalFrame })];
8114
+ case 2:
8115
+ frameProcessedByApp = _a.sent();
8116
+ processedFrame = new VideoFrame(frameProcessedByApp, {
8117
+ // we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
8118
+ timestamp: timestamp,
8119
+ });
8120
+ controller.enqueue(processedFrame);
8121
+ originalFrame.close();
8122
+ frameProcessedByApp.close();
8123
+ return [3 /*break*/, 4];
8124
+ case 3:
8125
+ error_2 = _a.sent();
8126
+ originalFrame.close();
8127
+ notifyError(error_2);
8128
+ return [3 /*break*/, 4];
8129
+ case 4: return [3 /*break*/, 6];
8130
+ case 5:
8131
+ notifyError('timestamp of the original video frame is null');
8132
+ _a.label = 6;
8133
+ case 6: return [2 /*return*/];
8134
+ }
8135
+ });
8136
+ });
8137
+ },
8138
+ }))
8139
+ .pipeTo(sink);
8140
+ return generator;
8141
+ }
8142
+ })(mediaStream = video.mediaStream || (video.mediaStream = {}));
7909
8143
  })(video || (video = {})); //end of video namespace
7910
8144
 
7911
8145
  ;// CONCATENATED MODULE: ./src/public/search.ts
@@ -8808,9 +9042,13 @@ var tasks;
8808
9042
  (function (tasks) {
8809
9043
  /**
8810
9044
  * @deprecated
8811
- * As of 2.8.0, please use {@link dialog.url.open dialog.url.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for url based dialogs
8812
- * and {@link dialog.url.bot.open dialog.url.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot-based dialogs. In Teams,
8813
- * this function can be used for Adaptive Card-based dialogs. Support for Adaptive Card-based dialogs is coming to other hosts in the future.
9045
+ * As of 2.8.0:
9046
+ * - For url-based dialogs, please use {@link dialog.url.open dialog.url.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} .
9047
+ * - For url-based dialogs with bot interaction, please use {@link dialog.url.bot.open dialog.url.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void}
9048
+ * - For Adaptive Card-based dialogs:
9049
+ * - In Teams, please continue to use this function until the new functions in {@link dialog.adaptiveCard} have been fully implemented. You can tell at runtime when they are implemented in Teams by checking
9050
+ * the return value of the {@link dialog.adaptiveCard.isSupported} function. This documentation line will also be removed once they have been fully implemented in Teams.
9051
+ * - In all other hosts, please use {@link dialog.adaptiveCard.open dialog.adaptiveCard.open(cardDialogInfo: CardDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void}
8814
9052
  *
8815
9053
  * Allows an app to open the task module.
8816
9054
  *