@microsoft/teams-js 2.0.0-beta.6-dev.5 → 2.0.0-beta.6-dev.8

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.
@@ -1089,6 +1089,7 @@ __webpack_require__.d(__webpack_exports__, {
1089
1089
  "navigateCrossDomain": () => (/* reexport */ navigateCrossDomain),
1090
1090
  "navigateToTab": () => (/* reexport */ navigateToTab),
1091
1091
  "notifications": () => (/* reexport */ notifications),
1092
+ "openFilePreview": () => (/* reexport */ openFilePreview),
1092
1093
  "pages": () => (/* reexport */ pages),
1093
1094
  "people": () => (/* reexport */ people),
1094
1095
  "print": () => (/* reexport */ print),
@@ -1121,7 +1122,7 @@ __webpack_require__.d(__webpack_exports__, {
1121
1122
  });
1122
1123
 
1123
1124
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1124
- var version = "2.0.0-beta.6-dev.5";
1125
+ var version = "2.0.0-beta.6-dev.8";
1125
1126
  /**
1126
1127
  * @hidden
1127
1128
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -1831,6 +1832,7 @@ function processAdditionalValidOrigins(validMessageOrigins) {
1831
1832
 
1832
1833
 
1833
1834
 
1835
+
1834
1836
  /**
1835
1837
  * @internal
1836
1838
  */
@@ -1926,6 +1928,34 @@ function registerUserSettingsChangeHandler(settingTypes, handler) {
1926
1928
  ensureInitialized();
1927
1929
  registerHandler('userSettingsChange', handler, true, [settingTypes]);
1928
1930
  }
1931
+ /**
1932
+ * @hidden
1933
+ * Hide from docs.
1934
+ * ------
1935
+ * Opens a client-friendly preview of the specified file.
1936
+ *
1937
+ * @param file - The file to preview.
1938
+ */
1939
+ function openFilePreview(filePreviewParameters) {
1940
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
1941
+ var params = [
1942
+ filePreviewParameters.entityId,
1943
+ filePreviewParameters.title,
1944
+ filePreviewParameters.description,
1945
+ filePreviewParameters.type,
1946
+ filePreviewParameters.objectUrl,
1947
+ filePreviewParameters.downloadUrl,
1948
+ filePreviewParameters.webPreviewUrl,
1949
+ filePreviewParameters.webEditUrl,
1950
+ filePreviewParameters.baseUrl,
1951
+ filePreviewParameters.editFile,
1952
+ filePreviewParameters.subEntityId,
1953
+ filePreviewParameters.viewerAction,
1954
+ filePreviewParameters.fileOpenPreference,
1955
+ filePreviewParameters.conversationId,
1956
+ ];
1957
+ sendMessageToParent('openFilePreview', params);
1958
+ }
1929
1959
 
1930
1960
  ;// CONCATENATED MODULE: ./src/public/authentication.ts
1931
1961
 
@@ -2336,8 +2366,6 @@ var runtime = {
2336
2366
  location: undefined,
2337
2367
  logs: undefined,
2338
2368
  mail: undefined,
2339
- media: undefined,
2340
- meeting: undefined,
2341
2369
  meetingRoom: undefined,
2342
2370
  menus: undefined,
2343
2371
  monetization: undefined,
@@ -2374,10 +2402,7 @@ var teamsRuntimeConfig = {
2374
2402
  bot: {},
2375
2403
  update: {},
2376
2404
  },
2377
- files: {},
2378
2405
  logs: {},
2379
- media: {},
2380
- meeting: {},
2381
2406
  meetingRoom: {},
2382
2407
  menus: {},
2383
2408
  monetization: {},
@@ -4979,9 +5004,9 @@ var __extends = (undefined && undefined.__extends) || (function () {
4979
5004
 
4980
5005
 
4981
5006
 
4982
-
4983
5007
  /**
4984
- * @alpha
5008
+ * @deprecated
5009
+ * As of 2.0.0-beta.6, use media only for backwards compatibility of existing code.
4985
5010
  */
4986
5011
  var media;
4987
5012
  (function (media) {
@@ -5002,20 +5027,35 @@ var media;
5002
5027
  return File;
5003
5028
  }());
5004
5029
  media.File = File;
5030
+ /**
5031
+ * @deprecated
5032
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5033
+ *
5034
+ * Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
5035
+ *
5036
+ * @params callback - Callback will be called with an @see SdkError if there are any.
5037
+ * If error is null or undefined, the callback will be called with a collection of @see File objects
5038
+ * @remarks
5039
+ * Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
5040
+ * Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5041
+ *
5042
+ */
5005
5043
  function captureImage(callback) {
5044
+ if (!callback) {
5045
+ throw new Error('[captureImage] Callback cannot be null');
5046
+ }
5006
5047
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5007
- var wrappedFunction = function () {
5008
- return new Promise(function (resolve) {
5009
- if (!GlobalVars.isFramelessWindow) {
5010
- throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5011
- }
5012
- if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5013
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5014
- }
5015
- resolve(sendAndHandleSdkError('captureImage'));
5016
- });
5017
- };
5018
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5048
+ if (!GlobalVars.isFramelessWindow) {
5049
+ var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5050
+ callback(notSupportedError, undefined);
5051
+ return;
5052
+ }
5053
+ if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5054
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5055
+ callback(oldPlatformError, undefined);
5056
+ return;
5057
+ }
5058
+ sendMessageToParent('captureImage', callback);
5019
5059
  }
5020
5060
  media.captureImage = captureImage;
5021
5061
  /**
@@ -5036,95 +5076,105 @@ var media;
5036
5076
  }
5037
5077
  return _this;
5038
5078
  }
5079
+ /**
5080
+ * Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
5081
+ * @param callback - callback is called with the @see SdkError if there is an error
5082
+ * If error is null or undefined, the callback will be called with @see Blob.
5083
+ */
5039
5084
  Media.prototype.getMedia = function (callback) {
5040
- var _this = this;
5085
+ if (!callback) {
5086
+ throw new Error('[get Media] Callback cannot be null');
5087
+ }
5041
5088
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5042
- var wrappedFunction = function () {
5043
- return new Promise(function (resolve) {
5044
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5045
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5046
- }
5047
- if (!validateGetMediaInputs(_this.mimeType, _this.format, _this.content)) {
5048
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5049
- }
5050
- // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
5051
- if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
5052
- resolve(_this.getMediaViaCallback());
5053
- }
5054
- else {
5055
- resolve(_this.getMediaViaHandler());
5056
- }
5057
- });
5058
- };
5059
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5089
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5090
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5091
+ callback(oldPlatformError, null);
5092
+ return;
5093
+ }
5094
+ if (!validateGetMediaInputs(this.mimeType, this.format, this.content)) {
5095
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5096
+ callback(invalidInput, null);
5097
+ return;
5098
+ }
5099
+ // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
5100
+ if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
5101
+ this.getMediaViaCallback(callback);
5102
+ }
5103
+ else {
5104
+ this.getMediaViaHandler(callback);
5105
+ }
5060
5106
  };
5061
- Media.prototype.getMediaViaCallback = function () {
5062
- var _this = this;
5063
- return new Promise(function (resolve, reject) {
5064
- var helper = {
5065
- mediaMimeType: _this.mimeType,
5066
- assembleAttachment: [],
5067
- };
5068
- var localUriId = [_this.content];
5069
- sendMessageToParent('getMedia', localUriId, function (mediaResult) {
5107
+ Media.prototype.getMediaViaCallback = function (callback) {
5108
+ var helper = {
5109
+ mediaMimeType: this.mimeType,
5110
+ assembleAttachment: [],
5111
+ };
5112
+ var localUriId = [this.content];
5113
+ function handleGetMediaCallbackRequest(mediaResult) {
5114
+ if (callback) {
5070
5115
  if (mediaResult && mediaResult.error) {
5071
- reject(mediaResult.error);
5072
- }
5073
- else if (!mediaResult || !mediaResult.mediaChunk) {
5074
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' });
5075
- }
5076
- else if (mediaResult.mediaChunk.chunkSequence <= 0) {
5077
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5078
- resolve(file);
5116
+ callback(mediaResult.error, null);
5079
5117
  }
5080
5118
  else {
5081
- // Keep pushing chunks into assemble attachment
5082
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5083
- helper.assembleAttachment.push(assemble);
5084
- }
5085
- });
5086
- });
5087
- };
5088
- Media.prototype.getMediaViaHandler = function () {
5089
- var _this = this;
5090
- return new Promise(function (resolve, reject) {
5091
- var actionName = generateGUID();
5092
- var helper = {
5093
- mediaMimeType: _this.mimeType,
5094
- assembleAttachment: [],
5095
- };
5096
- var params = [actionName, _this.content];
5097
- _this.content && sendMessageToParent('getMedia', params);
5098
- registerHandler('getMedia' + actionName, function (response) {
5099
- try {
5100
- var mediaResult = JSON.parse(response);
5101
- if (mediaResult.error) {
5102
- reject(mediaResult.error);
5103
- removeHandler('getMedia' + actionName);
5119
+ if (mediaResult && mediaResult.mediaChunk) {
5120
+ // If the chunksequence number is less than equal to 0 implies EOF
5121
+ // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5122
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
5123
+ var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5124
+ callback(mediaResult.error, file);
5125
+ }
5126
+ else {
5127
+ // Keep pushing chunks into assemble attachment
5128
+ var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5129
+ helper.assembleAttachment.push(assemble);
5130
+ }
5104
5131
  }
5105
- else if (!mediaResult || !mediaResult.mediaChunk) {
5106
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' });
5107
- removeHandler('getMedia' + actionName);
5132
+ else {
5133
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5108
5134
  }
5109
- else if (mediaResult.mediaChunk.chunkSequence <= 0) {
5135
+ }
5136
+ }
5137
+ }
5138
+ sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
5139
+ };
5140
+ Media.prototype.getMediaViaHandler = function (callback) {
5141
+ var actionName = generateGUID();
5142
+ var helper = {
5143
+ mediaMimeType: this.mimeType,
5144
+ assembleAttachment: [],
5145
+ };
5146
+ var params = [actionName, this.content];
5147
+ this.content && callback && sendMessageToParent('getMedia', params);
5148
+ function handleGetMediaRequest(response) {
5149
+ if (callback) {
5150
+ var mediaResult = JSON.parse(response);
5151
+ if (mediaResult.error) {
5152
+ callback(mediaResult.error, null);
5153
+ removeHandler('getMedia' + actionName);
5154
+ }
5155
+ else {
5156
+ if (mediaResult.mediaChunk) {
5110
5157
  // If the chunksequence number is less than equal to 0 implies EOF
5111
5158
  // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5112
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5113
- resolve(file);
5114
- removeHandler('getMedia' + actionName);
5159
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
5160
+ var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5161
+ callback(mediaResult.error, file);
5162
+ removeHandler('getMedia' + actionName);
5163
+ }
5164
+ else {
5165
+ // Keep pushing chunks into assemble attachment
5166
+ var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5167
+ helper.assembleAttachment.push(assemble);
5168
+ }
5115
5169
  }
5116
5170
  else {
5117
- // Keep pushing chunks into assemble attachment
5118
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5119
- helper.assembleAttachment.push(assemble);
5171
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5172
+ removeHandler('getMedia' + actionName);
5120
5173
  }
5121
5174
  }
5122
- catch (err) {
5123
- // catch JSON.parse() errors
5124
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'Error parsing the response: ' + response });
5125
- }
5126
- });
5127
- });
5175
+ }
5176
+ }
5177
+ registerHandler('getMedia' + actionName, handleGetMediaRequest);
5128
5178
  };
5129
5179
  return Media;
5130
5180
  }(File));
@@ -5139,26 +5189,38 @@ var media;
5139
5189
  function MediaController(controllerCallback) {
5140
5190
  this.controllerCallback = controllerCallback;
5141
5191
  }
5192
+ /**
5193
+ * @hidden
5194
+ * Hide from docs
5195
+ * --------
5196
+ * Function to notify the host client to programatically control the experience
5197
+ * @param mediaEvent indicates what the event that needs to be signaled to the host client
5198
+ * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
5199
+ */
5142
5200
  MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
5143
5201
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5144
5202
  try {
5145
5203
  throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5146
5204
  }
5147
5205
  catch (err) {
5148
- var wrappedRejectedErrorFn = function () { return Promise.reject(err); };
5149
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedRejectedErrorFn, callback);
5206
+ if (callback) {
5207
+ callback(err);
5208
+ }
5209
+ return;
5150
5210
  }
5151
- var params = {
5152
- mediaType: this.getMediaType(),
5153
- mediaControllerEvent: mediaEvent,
5154
- };
5155
- var wrappedFunction = function () {
5156
- return new Promise(function (resolve) { return resolve(sendAndHandleSdkError('media.controller', [params])); });
5157
- };
5158
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedFunction, callback);
5211
+ var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
5212
+ sendMessageToParent('media.controller', [params], function (err) {
5213
+ if (callback) {
5214
+ callback(err);
5215
+ }
5216
+ });
5159
5217
  };
5218
+ /**
5219
+ * Function to programatically stop the ongoing media event
5220
+ * Optional; @param callback is used to send app if host client has successfully stopped the event or not
5221
+ */
5160
5222
  MediaController.prototype.stop = function (callback) {
5161
- return Promise.resolve(this.notifyEventToHost(MediaControllerEvent.StopRecording, callback));
5223
+ this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
5162
5224
  };
5163
5225
  return MediaController;
5164
5226
  }());
@@ -5174,14 +5236,16 @@ var media;
5174
5236
  return MediaType.Video;
5175
5237
  };
5176
5238
  VideoController.prototype.notifyEventToApp = function (mediaEvent) {
5239
+ if (!this.controllerCallback) {
5240
+ // Early return as app has not registered with the callback
5241
+ return;
5242
+ }
5177
5243
  switch (mediaEvent) {
5178
5244
  case MediaControllerEvent.StartRecording:
5179
- this.controllerCallback.onRecordingStarted();
5180
- break;
5181
- // TODO - Should discuss whether this function should be required
5182
- case MediaControllerEvent.StopRecording:
5183
- this.controllerCallback.onRecordingStopped && this.controllerCallback.onRecordingStopped();
5184
- break;
5245
+ if (this.controllerCallback.onRecordingStarted) {
5246
+ this.controllerCallback.onRecordingStarted();
5247
+ break;
5248
+ }
5185
5249
  }
5186
5250
  };
5187
5251
  return VideoController;
@@ -5242,109 +5306,128 @@ var media;
5242
5306
  ImageOutputFormats[ImageOutputFormats["IMAGE"] = 1] = "IMAGE";
5243
5307
  ImageOutputFormats[ImageOutputFormats["PDF"] = 2] = "PDF";
5244
5308
  })(ImageOutputFormats = media.ImageOutputFormats || (media.ImageOutputFormats = {}));
5309
+ /**
5310
+ * @deprecated
5311
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5312
+ *
5313
+ * Select an attachment using camera/gallery
5314
+ *
5315
+ * @param mediaInputs - The input params to customize the media to be selected
5316
+ * @param callback - The callback to invoke after fetching the media
5317
+ */
5245
5318
  function selectMedia(mediaInputs, callback) {
5319
+ if (!callback) {
5320
+ throw new Error('[select Media] Callback cannot be null');
5321
+ }
5246
5322
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5247
- var wrappedFunction = function () {
5248
- return new Promise(function (resolve) {
5249
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5250
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5251
- }
5252
- throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5253
- if (!validateSelectMediaInputs(mediaInputs)) {
5254
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5255
- }
5256
- var params = [mediaInputs];
5257
- // What comes back from native at attachments would just be objects and will be missing getMedia method on them.
5258
- resolve(sendMessageToParentAsync('selectMedia', params));
5259
- }).then(function (_a) {
5260
- var err = _a[0], localAttachments = _a[1], mediaEvent = _a[2];
5261
- // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5262
- if (mediaEvent) {
5263
- if (isVideoControllerRegistered(mediaInputs)) {
5264
- mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5265
- }
5266
- return [];
5267
- }
5268
- // Media Attachments are final response to selectMedia
5269
- if (!localAttachments) {
5270
- throw err;
5271
- }
5272
- var mediaArray = [];
5273
- for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5274
- var attachment = localAttachments_1[_i];
5275
- mediaArray.push(new Media(attachment));
5323
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5324
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5325
+ callback(oldPlatformError, null);
5326
+ return;
5327
+ }
5328
+ try {
5329
+ throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5330
+ }
5331
+ catch (err) {
5332
+ callback(err, null);
5333
+ return;
5334
+ }
5335
+ if (!validateSelectMediaInputs(mediaInputs)) {
5336
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5337
+ callback(invalidInput, null);
5338
+ return;
5339
+ }
5340
+ var params = [mediaInputs];
5341
+ // What comes back from native as attachments would just be objects and will be missing getMedia method on them
5342
+ sendMessageToParent('selectMedia', params, function (err, localAttachments, mediaEvent) {
5343
+ // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5344
+ if (mediaEvent) {
5345
+ if (isVideoControllerRegistered(mediaInputs)) {
5346
+ mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5276
5347
  }
5277
- return mediaArray;
5278
- });
5279
- };
5280
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5348
+ return;
5349
+ }
5350
+ // Media Attachments are final response to selectMedia
5351
+ if (!localAttachments) {
5352
+ callback(err, null);
5353
+ return;
5354
+ }
5355
+ var mediaArray = [];
5356
+ for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5357
+ var attachment = localAttachments_1[_i];
5358
+ mediaArray.push(new Media(attachment));
5359
+ }
5360
+ callback(err, mediaArray);
5361
+ });
5281
5362
  }
5282
5363
  media.selectMedia = selectMedia;
5364
+ /**
5365
+ * @deprecated
5366
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5367
+ *
5368
+ * View images using native image viewer
5369
+ * @param uriList - list of URIs for images to be viewed - can be content URI or server URL. Supports up to 10 Images in a single call
5370
+ * @param callback - returns back error if encountered, returns null in case of success
5371
+ */
5283
5372
  function viewImages(uriList, callback) {
5373
+ if (!callback) {
5374
+ throw new Error('[view images] Callback cannot be null');
5375
+ }
5284
5376
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5285
- var wrappedFunction = function () {
5286
- return new Promise(function (resolve) {
5287
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5288
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5289
- }
5290
- if (!validateViewImagesInput(uriList)) {
5291
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5292
- }
5293
- resolve(sendAndHandleSdkError('viewImages', uriList));
5294
- });
5295
- };
5296
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedFunction, callback);
5377
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5378
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5379
+ callback(oldPlatformError);
5380
+ return;
5381
+ }
5382
+ if (!validateViewImagesInput(uriList)) {
5383
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5384
+ callback(invalidInput);
5385
+ return;
5386
+ }
5387
+ var params = [uriList];
5388
+ sendMessageToParent('viewImages', params, callback);
5297
5389
  }
5298
5390
  media.viewImages = viewImages;
5299
- function scanBarCode(callbackOrConfig, configMaybe) {
5300
- var callback;
5301
- var config;
5302
- // Because the callback isn't the second parameter in the original v1 method we need to
5303
- // do a bit of trickery to see which of the two ways were used to call into
5304
- // the flow and if the first parameter is a callback (v1) or a config object (v2)
5305
- if (callbackOrConfig === undefined) {
5306
- // no first parameter - the second one might be a config, definitely no callback
5307
- config = configMaybe;
5308
- }
5309
- else {
5310
- if (typeof callbackOrConfig === 'object') {
5311
- // the first parameter is an object - it's the config! No callback.
5312
- config = callbackOrConfig;
5313
- }
5314
- else {
5315
- // otherwise, it's a function, so a callback. The second parameter might be a callback
5316
- callback = callbackOrConfig;
5317
- config = configMaybe;
5318
- }
5391
+ /**
5392
+ * @deprecated
5393
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5394
+ *
5395
+ * Scan Barcode/QRcode using camera
5396
+ * @remarks
5397
+ * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5398
+ *
5399
+ * @param callback - callback to invoke after scanning the barcode
5400
+ * @param config - optional input configuration to customize the barcode scanning experience
5401
+ */
5402
+ function scanBarCode(callback, config) {
5403
+ if (!callback) {
5404
+ throw new Error('[media.scanBarCode] Callback cannot be null');
5319
5405
  }
5320
5406
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5321
- var wrappedFunction = function () {
5322
- return new Promise(function (resolve) {
5323
- if (GlobalVars.hostClientType === HostClientType.desktop ||
5324
- GlobalVars.hostClientType === HostClientType.web ||
5325
- GlobalVars.hostClientType === HostClientType.rigel ||
5326
- GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5327
- GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5328
- GlobalVars.hostClientType === HostClientType.teamsPhones ||
5329
- GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5330
- throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5331
- }
5332
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5333
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5334
- }
5335
- if (!validateScanBarCodeInput(config)) {
5336
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5337
- }
5338
- resolve(sendAndHandleSdkError('media.scanBarCode', config));
5339
- });
5340
- };
5341
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5407
+ if (GlobalVars.hostClientType === HostClientType.desktop ||
5408
+ GlobalVars.hostClientType === HostClientType.web ||
5409
+ GlobalVars.hostClientType === HostClientType.rigel ||
5410
+ GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5411
+ GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5412
+ GlobalVars.hostClientType === HostClientType.teamsPhones ||
5413
+ GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5414
+ var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5415
+ callback(notSupportedError, null);
5416
+ return;
5417
+ }
5418
+ if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5419
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5420
+ callback(oldPlatformError, null);
5421
+ return;
5422
+ }
5423
+ if (!validateScanBarCodeInput(config)) {
5424
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5425
+ callback(invalidInput, null);
5426
+ return;
5427
+ }
5428
+ sendMessageToParent('media.scanBarCode', [config], callback);
5342
5429
  }
5343
5430
  media.scanBarCode = scanBarCode;
5344
- function isSupported() {
5345
- return runtime.supports.media ? true : false;
5346
- }
5347
- media.isSupported = isSupported;
5348
5431
  })(media || (media = {}));
5349
5432
 
5350
5433
  ;// CONCATENATED MODULE: ./src/public/location.ts
@@ -5410,10 +5493,9 @@ var location_location;
5410
5493
 
5411
5494
 
5412
5495
 
5413
-
5414
-
5415
5496
  /**
5416
- * @alpha
5497
+ * @deprecated
5498
+ * As of 2.0.0-beta.6, use meeting only for backwards compatibility of existing code.
5417
5499
  */
5418
5500
  var meeting;
5419
5501
  (function (meeting) {
@@ -5426,102 +5508,156 @@ var meeting;
5426
5508
  MeetingType["Broadcast"] = "Broadcast";
5427
5509
  MeetingType["MeetNow"] = "MeetNow";
5428
5510
  })(MeetingType = meeting.MeetingType || (meeting.MeetingType = {}));
5511
+ var CallType;
5512
+ (function (CallType) {
5513
+ CallType["OneOnOneCall"] = "oneOnOneCall";
5514
+ CallType["GroupCall"] = "groupCall";
5515
+ })(CallType = meeting.CallType || (meeting.CallType = {}));
5516
+ /**
5517
+ * @deprecated
5518
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5519
+ *
5520
+ * Allows an app to get the incoming audio speaker setting for the meeting user
5521
+ *
5522
+ * @param callback - Callback contains 2 parameters, error and result.
5523
+ *
5524
+ * error can either contain an error of type SdkError, incase of an error, or null when fetch is successful
5525
+ * result can either contain the true/false value, incase of a successful fetch or null when the fetching fails
5526
+ * result: True means incoming audio is muted and false means incoming audio is unmuted
5527
+ */
5429
5528
  function getIncomingClientAudioState(callback) {
5529
+ if (!callback) {
5530
+ throw new Error('[get incoming client audio state] Callback cannot be null');
5531
+ }
5430
5532
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5431
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getIncomingClientAudioStateHelper, callback);
5533
+ sendMessageToParent('getIncomingClientAudioState', callback);
5432
5534
  }
5433
5535
  meeting.getIncomingClientAudioState = getIncomingClientAudioState;
5434
- function getIncomingClientAudioStateHelper() {
5435
- return new Promise(function (resolve) {
5436
- resolve(sendAndHandleSdkError('getIncomingClientAudioState'));
5437
- });
5438
- }
5536
+ /**
5537
+ * @deprecated
5538
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5539
+ *
5540
+ * Allows an app to toggle the incoming audio speaker setting for the meeting user from mute to unmute or vice-versa
5541
+ *
5542
+ * @param callback - Callback contains 2 parameters, error and result.
5543
+ * error can either contain an error of type SdkError, incase of an error, or null when toggle is successful
5544
+ * result can either contain the true/false value, incase of a successful toggle or null when the toggling fails
5545
+ * result: True means incoming audio is muted and false means incoming audio is unmuted
5546
+ */
5439
5547
  function toggleIncomingClientAudio(callback) {
5548
+ if (!callback) {
5549
+ throw new Error('[toggle incoming client audio] Callback cannot be null');
5550
+ }
5440
5551
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5441
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(toggleIncomingClientAudioHelper, callback);
5552
+ sendMessageToParent('toggleIncomingClientAudio', callback);
5442
5553
  }
5443
5554
  meeting.toggleIncomingClientAudio = toggleIncomingClientAudio;
5444
- function toggleIncomingClientAudioHelper() {
5445
- return new Promise(function (resolve) {
5446
- resolve(sendAndHandleSdkError('toggleIncomingClientAudio'));
5447
- });
5448
- }
5555
+ /**
5556
+ * @deprecated
5557
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5558
+ *
5559
+ * @hidden
5560
+ * Hide from docs
5561
+ *
5562
+ * Allows an app to get the meeting details for the meeting
5563
+ *
5564
+ * @param callback - Callback contains 2 parameters, error and meetingDetailsResponse.
5565
+ * error can either contain an error of type SdkError, incase of an error, or null when get is successful
5566
+ * result can either contain a IMeetingDetailsResponse value, incase of a successful get or null when the get fails
5567
+ *
5568
+ * @internal
5569
+ */
5449
5570
  function getMeetingDetails(callback) {
5571
+ if (!callback) {
5572
+ throw new Error('[get meeting details] Callback cannot be null');
5573
+ }
5450
5574
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage, FrameContexts.settings, FrameContexts.content);
5451
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getMeetingDetailsHelper, callback);
5575
+ sendMessageToParent('meeting.getMeetingDetails', callback);
5452
5576
  }
5453
5577
  meeting.getMeetingDetails = getMeetingDetails;
5454
- function getMeetingDetailsHelper() {
5455
- return new Promise(function (resolve) {
5456
- resolve(sendAndHandleSdkError('meeting.getMeetingDetails'));
5457
- });
5458
- }
5578
+ /**
5579
+ * @deprecated
5580
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5581
+ *
5582
+ * @hidden
5583
+ * Allows an app to get the authentication token for the anonymous or guest user in the meeting
5584
+ *
5585
+ * @param callback - Callback contains 2 parameters, error and authenticationTokenOfAnonymousUser.
5586
+ * error can either contain an error of type SdkError, incase of an error, or null when get is successful
5587
+ * authenticationTokenOfAnonymousUser can either contain a string value, incase of a successful get or null when the get fails
5588
+ *
5589
+ * @internal
5590
+ */
5459
5591
  function getAuthenticationTokenForAnonymousUser(callback) {
5592
+ if (!callback) {
5593
+ throw new Error('[get Authentication Token For AnonymousUser] Callback cannot be null');
5594
+ }
5460
5595
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5461
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getAuthenticationTokenForAnonymousUserHelper, callback);
5596
+ sendMessageToParent('meeting.getAuthenticationTokenForAnonymousUser', callback);
5462
5597
  }
5463
5598
  meeting.getAuthenticationTokenForAnonymousUser = getAuthenticationTokenForAnonymousUser;
5464
- function getAuthenticationTokenForAnonymousUserHelper() {
5465
- return new Promise(function (resolve) {
5466
- resolve(sendAndHandleSdkError('meeting.getAuthenticationTokenForAnonymousUser'));
5467
- });
5468
- }
5469
- function isSupported() {
5470
- return runtime.supports.meeting ? true : false;
5471
- }
5472
- meeting.isSupported = isSupported;
5599
+ /**
5600
+ * @deprecated
5601
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5602
+ *
5603
+ * Allows an app to get the state of the live stream in the current meeting
5604
+ *
5605
+ * @param callback - Callback contains 2 parameters: error and liveStreamState.
5606
+ * error can either contain an error of type SdkError, in case of an error, or null when get is successful
5607
+ * liveStreamState can either contain a LiveStreamState value, or null when operation fails
5608
+ */
5473
5609
  function getLiveStreamState(callback) {
5474
- ensureInitialized();
5475
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getLiveStreamStateHelper, callback);
5610
+ if (!callback) {
5611
+ throw new Error('[get live stream state] Callback cannot be null');
5612
+ }
5613
+ ensureInitialized(FrameContexts.sidePanel);
5614
+ sendMessageToParent('meeting.getLiveStreamState', callback);
5476
5615
  }
5477
5616
  meeting.getLiveStreamState = getLiveStreamState;
5478
- function getLiveStreamStateHelper() {
5479
- return new Promise(function (resolve) {
5480
- resolve(sendAndHandleSdkError('meeting.getLiveStreamState'));
5481
- });
5482
- }
5483
5617
  /**
5484
- * @hidden
5485
- * This function is the overloaded implementation of requestStartLiveStreaming.
5486
- * Since the method signatures of the v1 callback and v2 promise differ in the type of the first parameter,
5487
- * we need to do an extra check to know the typeof the @param1 to set the proper arguments of the utility function.
5488
- * @param param1
5489
- * @param param2
5490
- * @param param3
5491
- * @returns Promise that will be resolved when the operation has completed or rejected with SdkError value
5618
+ * @deprecated
5619
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5620
+ *
5621
+ * Allows an app to request the live streaming be started at the given streaming url
5622
+ *
5623
+ * @remarks
5624
+ * Use getLiveStreamState or registerLiveStreamChangedHandler to get updates on the live stream state
5625
+ *
5626
+ * @param streamUrl - the url to the stream resource
5627
+ * @param streamKey - the key to the stream resource
5628
+ * @param callback - Callback contains error parameter which can be of type SdkError in case of an error, or null when operation is successful
5492
5629
  */
5493
- function requestStartLiveStreaming(param1, param2, param3) {
5494
- var _a, _b;
5495
- ensureInitialized(FrameContexts.sidePanel);
5496
- var streamUrl;
5497
- var streamKey;
5498
- var callback;
5499
- if (typeof param1 === 'function') {
5500
- // Legacy code, with callbacks.
5501
- _a = [param1, param2, param3], callback = _a[0], streamUrl = _a[1], streamKey = _a[2];
5502
- }
5503
- else if (typeof param1 === 'string') {
5504
- _b = [param1, param2], streamUrl = _b[0], streamKey = _b[1];
5630
+ function requestStartLiveStreaming(callback, streamUrl, streamKey) {
5631
+ if (!callback) {
5632
+ throw new Error('[request start live streaming] Callback cannot be null');
5505
5633
  }
5506
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(requestStartLiveStreamingHelper, callback, streamUrl, streamKey);
5634
+ ensureInitialized(FrameContexts.sidePanel);
5635
+ sendMessageToParent('meeting.requestStartLiveStreaming', [streamUrl, streamKey], callback);
5507
5636
  }
5508
5637
  meeting.requestStartLiveStreaming = requestStartLiveStreaming;
5509
- function requestStartLiveStreamingHelper(streamUrl, streamKey) {
5510
- return new Promise(function (resolve) {
5511
- resolve(sendAndHandleSdkError('meeting.requestStartLiveStreaming', streamUrl, streamKey));
5512
- });
5513
- }
5638
+ /**
5639
+ * @deprecated
5640
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5641
+ *
5642
+ * Allows an app to request the live streaming be stopped at the given streaming url
5643
+ *
5644
+ * @remarks
5645
+ * Use getLiveStreamState or registerLiveStreamChangedHandler to get updates on the live stream state
5646
+ *
5647
+ * @param callback - Callback contains error parameter which can be of type SdkError in case of an error, or null when operation is successful
5648
+ */
5514
5649
  function requestStopLiveStreaming(callback) {
5650
+ if (!callback) {
5651
+ throw new Error('[request stop live streaming] Callback cannot be null');
5652
+ }
5515
5653
  ensureInitialized(FrameContexts.sidePanel);
5516
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(requestStopLiveStreamingHelper, callback);
5654
+ sendMessageToParent('meeting.requestStopLiveStreaming', callback);
5517
5655
  }
5518
5656
  meeting.requestStopLiveStreaming = requestStopLiveStreaming;
5519
- function requestStopLiveStreamingHelper() {
5520
- return new Promise(function (resolve) {
5521
- resolve(sendAndHandleSdkError('meeting.requestStopLiveStreaming'));
5522
- });
5523
- }
5524
5657
  /**
5658
+ * @deprecated
5659
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5660
+ *
5525
5661
  * Registers a handler for changes to the live stream.
5526
5662
  *
5527
5663
  * @remarks
@@ -5538,81 +5674,90 @@ var meeting;
5538
5674
  }
5539
5675
  meeting.registerLiveStreamChangedHandler = registerLiveStreamChangedHandler;
5540
5676
  /**
5541
- * This function is the overloaded implementation of shareAppContentToStage.
5542
- * Since the method signatures of the v1 callback and v2 promise differ in the type of the first parameter,
5543
- * we need to do an extra check to know the typeof the @param1 to set the proper arguments of the utility function.
5544
- * @param param1
5545
- * @param param2
5546
- * @returns Promise resolved indicating whether or not the share was successful or rejected with SdkError value
5677
+ * @deprecated
5678
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5679
+ *
5680
+ * Allows an app to share contents in the meeting
5681
+ *
5682
+ * @param callback - Callback contains 2 parameters, error and result.
5683
+ * error can either contain an error of type SdkError, incase of an error, or null when share is successful
5684
+ * result can either contain a true value, incase of a successful share or null when the share fails
5685
+ * @param appContentUrl - is the input URL which needs to be shared on to the stage
5547
5686
  */
5548
- function shareAppContentToStage(param1, param2) {
5549
- var _a;
5550
- ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5551
- var appContentUrl;
5552
- var callback;
5553
- if (typeof param1 === 'function') {
5554
- // Legacy callback
5555
- _a = [param1, param2], callback = _a[0], appContentUrl = _a[1];
5556
- }
5557
- else {
5558
- appContentUrl = param1;
5687
+ function shareAppContentToStage(callback, appContentUrl) {
5688
+ if (!callback) {
5689
+ throw new Error('[share app content to stage] Callback cannot be null');
5559
5690
  }
5560
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(shareAppContentToStageHelper, callback, appContentUrl);
5691
+ ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5692
+ sendMessageToParent('meeting.shareAppContentToStage', [appContentUrl], callback);
5561
5693
  }
5562
5694
  meeting.shareAppContentToStage = shareAppContentToStage;
5563
5695
  /**
5564
- * @hidden
5565
- * Helper method to generate and return a promise for shareAppContentToStage
5566
- * @param appContentUrl
5567
- * @returns
5696
+ * @deprecated
5697
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5698
+ *
5699
+ * Provides information related app's in-meeting sharing capabilities
5700
+ *
5701
+ * @param callback - Callback contains 2 parameters, error and result.
5702
+ * error can either contain an error of type SdkError (error indication), or null (non-error indication)
5703
+ * appContentStageSharingCapabilities can either contain an IAppContentStageSharingCapabilities object
5704
+ * (indication of successful retrieval), or null (indication of failed retrieval)
5568
5705
  */
5569
- function shareAppContentToStageHelper(appContentUrl) {
5570
- return new Promise(function (resolve) {
5571
- resolve(sendAndHandleSdkError('meeting.shareAppContentToStage', appContentUrl));
5572
- });
5573
- }
5574
5706
  function getAppContentStageSharingCapabilities(callback) {
5707
+ if (!callback) {
5708
+ throw new Error('[get app content stage sharing capabilities] Callback cannot be null');
5709
+ }
5575
5710
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5576
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getAppContentStageSharingCapabilitiesHelper, callback);
5711
+ sendMessageToParent('meeting.getAppContentStageSharingCapabilities', callback);
5577
5712
  }
5578
5713
  meeting.getAppContentStageSharingCapabilities = getAppContentStageSharingCapabilities;
5579
5714
  /**
5715
+ * @deprecated
5716
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5717
+ *
5580
5718
  * @hidden
5581
- * @returns
5719
+ * Hide from docs.
5720
+ * Terminates current stage sharing session in meeting
5721
+ *
5722
+ * @param callback - Callback contains 2 parameters, error and result.
5723
+ * error can either contain an error of type SdkError (error indication), or null (non-error indication)
5724
+ * result can either contain a true boolean value (successful termination), or null (unsuccessful fetch)
5582
5725
  */
5583
- function getAppContentStageSharingCapabilitiesHelper() {
5584
- return new Promise(function (resolve) {
5585
- resolve(sendAndHandleSdkError('meeting.getAppContentStageSharingCapabilities'));
5586
- });
5587
- }
5588
5726
  function stopSharingAppContentToStage(callback) {
5727
+ if (!callback) {
5728
+ throw new Error('[stop sharing app content to stage] Callback cannot be null');
5729
+ }
5589
5730
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5590
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(stopSharingAppContentToStageHelper, callback);
5731
+ sendMessageToParent('meeting.stopSharingAppContentToStage', callback);
5591
5732
  }
5592
5733
  meeting.stopSharingAppContentToStage = stopSharingAppContentToStage;
5593
5734
  /**
5594
- * @hidden
5595
- * @returns
5735
+ * @deprecated
5736
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5737
+ *
5738
+ * Provides information related to current stage sharing state for app
5739
+ *
5740
+ * @param callback - Callback contains 2 parameters, error and result.
5741
+ * error can either contain an error of type SdkError (error indication), or null (non-error indication)
5742
+ * appContentStageSharingState can either contain an IAppContentStageSharingState object
5743
+ * (indication of successful retrieval), or null (indication of failed retrieval)
5596
5744
  */
5597
- function stopSharingAppContentToStageHelper() {
5598
- return new Promise(function (resolve) {
5599
- resolve(sendAndHandleSdkError('meeting.stopSharingAppContentToStage'));
5600
- });
5601
- }
5602
5745
  function getAppContentStageSharingState(callback) {
5746
+ if (!callback) {
5747
+ throw new Error('[get app content stage sharing state] Callback cannot be null');
5748
+ }
5603
5749
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5604
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getAppContentStageSharingStateHelper, callback);
5750
+ sendMessageToParent('meeting.getAppContentStageSharingState', callback);
5605
5751
  }
5606
5752
  meeting.getAppContentStageSharingState = getAppContentStageSharingState;
5607
- function getAppContentStageSharingStateHelper() {
5608
- return new Promise(function (resolve) {
5609
- resolve(sendAndHandleSdkError('meeting.getAppContentStageSharingState'));
5610
- });
5611
- }
5612
5753
  /**
5754
+ * @deprecated
5755
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5756
+ *
5613
5757
  * Registers a handler for changes to paticipant speaking states. If any participant is speaking, isSpeakingDetected
5614
5758
  * will be true. If no participants are speaking, isSpeakingDetected will be false. Only one handler can be registered
5615
5759
  * at a time. A subsequent registration replaces an existing registration.
5760
+ *
5616
5761
  * @param handler The handler to invoke when the speaking state of any participant changes (start/stop speaking).
5617
5762
  */
5618
5763
  function registerSpeakingStateChangeHandler(handler) {
@@ -6842,16 +6987,11 @@ var tasks;
6842
6987
 
6843
6988
 
6844
6989
 
6845
-
6846
-
6847
-
6848
6990
  /**
6849
6991
  * @hidden
6850
6992
  * Hide from docs
6851
6993
  * ------
6852
6994
  * Namespace to interact with the files specific part of the SDK.
6853
- *
6854
- * @alpha
6855
6995
  */
6856
6996
  var files;
6857
6997
  (function (files_1) {
@@ -6924,22 +7064,20 @@ var files;
6924
7064
  /**
6925
7065
  * @hidden
6926
7066
  * Hide from docs
6927
- * ------
6928
- * Gets a list of cloud storage folders added to the channel
6929
7067
  *
7068
+ * Gets a list of cloud storage folders added to the channel
6930
7069
  * @param channelId - ID of the channel whose cloud storage folders should be retrieved
7070
+ * @param callback - Callback that will be triggered post folders load
6931
7071
  */
6932
- function getCloudStorageFolders(channelId) {
6933
- return new Promise(function (resolve) {
6934
- ensureInitialized(FrameContexts.content);
6935
- if (!isSupported()) {
6936
- throw errorNotSupportedOnPlatform;
6937
- }
6938
- if (!channelId || channelId.length === 0) {
6939
- throw new Error('[files.getCloudStorageFolders] channelId name cannot be null or empty');
6940
- }
6941
- resolve(sendAndHandleSdkError('files.getCloudStorageFolders', channelId));
6942
- });
7072
+ function getCloudStorageFolders(channelId, callback) {
7073
+ ensureInitialized(FrameContexts.content);
7074
+ if (!channelId || channelId.length === 0) {
7075
+ throw new Error('[files.getCloudStorageFolders] channelId name cannot be null or empty');
7076
+ }
7077
+ if (!callback) {
7078
+ throw new Error('[files.getCloudStorageFolders] Callback cannot be null');
7079
+ }
7080
+ sendMessageToParent('files.getCloudStorageFolders', [channelId], callback);
6943
7081
  }
6944
7082
  files_1.getCloudStorageFolders = getCloudStorageFolders;
6945
7083
  /**
@@ -6947,82 +7085,76 @@ var files;
6947
7085
  * Hide from docs
6948
7086
  * ------
6949
7087
  * Initiates the add cloud storage folder flow
7088
+ *
6950
7089
  * @param channelId - ID of the channel to add cloud storage folder
7090
+ * @param callback - Callback that will be triggered post add folder flow is compelete
6951
7091
  */
6952
- function addCloudStorageFolder(channelId) {
6953
- return new Promise(function (resolve) {
6954
- ensureInitialized(FrameContexts.content);
6955
- if (!isSupported()) {
6956
- throw errorNotSupportedOnPlatform;
6957
- }
6958
- if (!channelId || channelId.length === 0) {
6959
- throw new Error('[files.addCloudStorageFolder] channelId name cannot be null or empty');
6960
- }
6961
- resolve(sendMessageToParentAsync('files.addCloudStorageFolder', [channelId]));
6962
- }).then(function (_a) {
6963
- var error = _a[0], isFolderAdded = _a[1], folders = _a[2];
6964
- if (error) {
6965
- throw error;
6966
- }
6967
- var result = [isFolderAdded, folders];
6968
- return result;
6969
- });
7092
+ function addCloudStorageFolder(channelId, callback) {
7093
+ ensureInitialized(FrameContexts.content);
7094
+ if (!channelId || channelId.length === 0) {
7095
+ throw new Error('[files.addCloudStorageFolder] channelId name cannot be null or empty');
7096
+ }
7097
+ if (!callback) {
7098
+ throw new Error('[files.addCloudStorageFolder] Callback cannot be null');
7099
+ }
7100
+ sendMessageToParent('files.addCloudStorageFolder', [channelId], callback);
6970
7101
  }
6971
7102
  files_1.addCloudStorageFolder = addCloudStorageFolder;
6972
7103
  /**
6973
7104
  * @hidden
6974
7105
  * Hide from docs
6975
7106
  * ------
7107
+ *
6976
7108
  * Deletes a cloud storage folder from channel
6977
7109
  *
6978
7110
  * @param channelId - ID of the channel where folder is to be deleted
6979
7111
  * @param folderToDelete - cloud storage folder to be deleted
7112
+ * @param callback - Callback that will be triggered post delete
6980
7113
  */
6981
- function deleteCloudStorageFolder(channelId, folderToDelete) {
6982
- return new Promise(function (resolve) {
6983
- ensureInitialized(FrameContexts.content);
6984
- if (!isSupported()) {
6985
- throw errorNotSupportedOnPlatform;
6986
- }
6987
- if (!channelId) {
6988
- throw new Error('[files.deleteCloudStorageFolder] channelId name cannot be null or empty');
6989
- }
6990
- if (!folderToDelete) {
6991
- throw new Error('[files.deleteCloudStorageFolder] folderToDelete cannot be null or empty');
6992
- }
6993
- resolve(sendAndHandleSdkError('files.deleteCloudStorageFolder', channelId, folderToDelete));
6994
- });
7114
+ function deleteCloudStorageFolder(channelId, folderToDelete, callback) {
7115
+ ensureInitialized(FrameContexts.content);
7116
+ if (!channelId) {
7117
+ throw new Error('[files.deleteCloudStorageFolder] channelId name cannot be null or empty');
7118
+ }
7119
+ if (!folderToDelete) {
7120
+ throw new Error('[files.deleteCloudStorageFolder] folderToDelete cannot be null or empty');
7121
+ }
7122
+ if (!callback) {
7123
+ throw new Error('[files.deleteCloudStorageFolder] Callback cannot be null');
7124
+ }
7125
+ sendMessageToParent('files.deleteCloudStorageFolder', [channelId, folderToDelete], callback);
6995
7126
  }
6996
7127
  files_1.deleteCloudStorageFolder = deleteCloudStorageFolder;
6997
7128
  /**
6998
7129
  * @hidden
6999
7130
  * Hide from docs
7000
7131
  * ------
7132
+ *
7001
7133
  * Fetches the contents of a Cloud storage folder (CloudStorageFolder) / sub directory
7002
7134
  *
7003
7135
  * @param folder - Cloud storage folder (CloudStorageFolder) / sub directory (CloudStorageFolderItem)
7004
7136
  * @param providerCode - Code of the cloud storage folder provider
7137
+ * @param callback - Callback that will be triggered post contents are loaded
7005
7138
  */
7006
- function getCloudStorageFolderContents(folder, providerCode) {
7007
- return new Promise(function (resolve) {
7008
- ensureInitialized(FrameContexts.content);
7009
- if (!isSupported()) {
7010
- throw errorNotSupportedOnPlatform;
7011
- }
7012
- if (!folder || !providerCode) {
7013
- throw new Error('[files.getCloudStorageFolderContents] folder/providerCode name cannot be null or empty');
7014
- }
7015
- if ('isSubdirectory' in folder && !folder.isSubdirectory) {
7016
- throw new Error('[files.getCloudStorageFolderContents] provided folder is not a subDirectory');
7017
- }
7018
- resolve(sendAndHandleSdkError('files.getCloudStorageFolderContents', folder, providerCode));
7019
- });
7139
+ function getCloudStorageFolderContents(folder, providerCode, callback) {
7140
+ ensureInitialized(FrameContexts.content);
7141
+ if (!folder || !providerCode) {
7142
+ throw new Error('[files.getCloudStorageFolderContents] folder/providerCode name cannot be null or empty');
7143
+ }
7144
+ if (!callback) {
7145
+ throw new Error('[files.getCloudStorageFolderContents] Callback cannot be null');
7146
+ }
7147
+ if ('isSubdirectory' in folder && !folder.isSubdirectory) {
7148
+ throw new Error('[files.getCloudStorageFolderContents] provided folder is not a subDirectory');
7149
+ }
7150
+ sendMessageToParent('files.getCloudStorageFolderContents', [folder, providerCode], callback);
7020
7151
  }
7021
7152
  files_1.getCloudStorageFolderContents = getCloudStorageFolderContents;
7022
7153
  /**
7023
7154
  * @hidden
7024
7155
  * Hide from docs
7025
7156
  * ------
7157
+ *
7026
7158
  * Open a cloud storage file in teams
7027
7159
  *
7028
7160
  * @param file - cloud storage file that should be opened
@@ -7031,9 +7163,6 @@ var files;
7031
7163
  */
7032
7164
  function openCloudStorageFile(file, providerCode, fileOpenPreference) {
7033
7165
  ensureInitialized(FrameContexts.content);
7034
- if (!isSupported()) {
7035
- throw errorNotSupportedOnPlatform;
7036
- }
7037
7166
  if (!file || !providerCode) {
7038
7167
  throw new Error('[files.openCloudStorageFile] file/providerCode cannot be null or empty');
7039
7168
  }
@@ -7043,38 +7172,6 @@ var files;
7043
7172
  sendMessageToParent('files.openCloudStorageFile', [file, providerCode, fileOpenPreference]);
7044
7173
  }
7045
7174
  files_1.openCloudStorageFile = openCloudStorageFile;
7046
- /**
7047
- * @hidden
7048
- * Hide from docs.
7049
- * ------
7050
- * Opens a client-friendly preview of the specified file.
7051
- *
7052
- * @param file - The file to preview.
7053
- */
7054
- function openFilePreview(filePreviewParameters) {
7055
- ensureInitialized(FrameContexts.content);
7056
- if (!isSupported()) {
7057
- throw errorNotSupportedOnPlatform;
7058
- }
7059
- var params = [
7060
- filePreviewParameters.entityId,
7061
- filePreviewParameters.title,
7062
- filePreviewParameters.description,
7063
- filePreviewParameters.type,
7064
- filePreviewParameters.objectUrl,
7065
- filePreviewParameters.downloadUrl,
7066
- filePreviewParameters.webPreviewUrl,
7067
- filePreviewParameters.webEditUrl,
7068
- filePreviewParameters.baseUrl,
7069
- filePreviewParameters.editFile,
7070
- filePreviewParameters.subEntityId,
7071
- filePreviewParameters.viewerAction,
7072
- filePreviewParameters.fileOpenPreference,
7073
- filePreviewParameters.conversationId,
7074
- ];
7075
- sendMessageToParent('openFilePreview', params);
7076
- }
7077
- files_1.openFilePreview = openFilePreview;
7078
7175
  /**
7079
7176
  * @hidden
7080
7177
  * Allow 1st party apps to call this function to get the external
@@ -7082,15 +7179,13 @@ var files;
7082
7179
  * @param excludeAddedProviders: return a list of support third party
7083
7180
  * cloud storages that hasn't been added yet.
7084
7181
  */
7085
- function getExternalProviders(excludeAddedProviders) {
7182
+ function getExternalProviders(excludeAddedProviders, callback) {
7086
7183
  if (excludeAddedProviders === void 0) { excludeAddedProviders = false; }
7087
- return new Promise(function (resolve) {
7088
- ensureInitialized(FrameContexts.content);
7089
- if (!isSupported()) {
7090
- throw errorNotSupportedOnPlatform;
7091
- }
7092
- resolve(sendAndHandleSdkError('files.getExternalProviders', excludeAddedProviders));
7093
- });
7184
+ ensureInitialized(FrameContexts.content);
7185
+ if (!callback) {
7186
+ throw new Error('[files.getExternalProviders] Callback cannot be null');
7187
+ }
7188
+ sendMessageToParent('files.getExternalProviders', [excludeAddedProviders], callback);
7094
7189
  }
7095
7190
  files_1.getExternalProviders = getExternalProviders;
7096
7191
  /**
@@ -7098,42 +7193,41 @@ var files;
7098
7193
  * Allow 1st party apps to call this function to move files
7099
7194
  * among SharePoint and third party cloud storages.
7100
7195
  */
7101
- function copyMoveFiles(selectedFiles, providerCode, destinationFolder, destinationProviderCode, isMove) {
7196
+ function copyMoveFiles(selectedFiles, providerCode, destinationFolder, destinationProviderCode, isMove, callback) {
7102
7197
  if (isMove === void 0) { isMove = false; }
7103
- return new Promise(function (resolve) {
7104
- ensureInitialized(FrameContexts.content);
7105
- if (!isSupported()) {
7106
- throw errorNotSupportedOnPlatform;
7107
- }
7108
- if (!selectedFiles || selectedFiles.length === 0) {
7109
- throw new Error('[files.copyMoveFiles] selectedFiles cannot be null or empty');
7110
- }
7111
- if (!providerCode) {
7112
- throw new Error('[files.copyMoveFiles] providerCode cannot be null or empty');
7113
- }
7114
- if (!destinationFolder) {
7115
- throw new Error('[files.copyMoveFiles] destinationFolder cannot be null or empty');
7116
- }
7117
- if (!destinationProviderCode) {
7118
- throw new Error('[files.copyMoveFiles] destinationProviderCode cannot be null or empty');
7119
- }
7120
- resolve(sendAndHandleSdkError('files.copyMoveFiles', selectedFiles, providerCode, destinationFolder, destinationProviderCode, isMove));
7121
- });
7198
+ ensureInitialized(FrameContexts.content);
7199
+ if (!selectedFiles || selectedFiles.length === 0) {
7200
+ throw new Error('[files.copyMoveFiles] selectedFiles cannot be null or empty');
7201
+ }
7202
+ if (!providerCode) {
7203
+ throw new Error('[files.copyMoveFiles] providerCode cannot be null or empty');
7204
+ }
7205
+ if (!destinationFolder) {
7206
+ throw new Error('[files.copyMoveFiles] destinationFolder cannot be null or empty');
7207
+ }
7208
+ if (!destinationProviderCode) {
7209
+ throw new Error('[files.copyMoveFiles] destinationProviderCode cannot be null or empty');
7210
+ }
7211
+ if (!callback) {
7212
+ throw new Error('[files.copyMoveFiles] callback cannot be null');
7213
+ }
7214
+ sendMessageToParent('files.copyMoveFiles', [selectedFiles, providerCode, destinationFolder, destinationProviderCode, isMove], callback);
7122
7215
  }
7123
7216
  files_1.copyMoveFiles = copyMoveFiles;
7124
- function isSupported() {
7125
- return runtime.supports.files ? true : false;
7126
- }
7127
- files_1.isSupported = isSupported;
7217
+ /**
7218
+ * @hidden
7219
+ * Hide from docs
7220
+ * ------
7221
+ *
7222
+ * Gets list of downloads for current user
7223
+ * @param callback Callback that will be triggered post downloads load
7224
+ */
7128
7225
  function getFileDownloads(callback) {
7129
7226
  ensureInitialized(FrameContexts.content);
7130
- if (!isSupported()) {
7131
- throw errorNotSupportedOnPlatform;
7227
+ if (!callback) {
7228
+ throw new Error('[files.getFileDownloads] Callback cannot be null');
7132
7229
  }
7133
- var wrappedFunction = function () {
7134
- return new Promise(function (resolve) { return resolve(sendAndHandleSdkError('files.getFileDownloads', [])); });
7135
- };
7136
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
7230
+ sendMessageToParent('files.getFileDownloads', [], callback);
7137
7231
  }
7138
7232
  files_1.getFileDownloads = getFileDownloads;
7139
7233
  /**
@@ -7141,15 +7235,12 @@ var files;
7141
7235
  * Hide from docs
7142
7236
  *
7143
7237
  * Open download preference folder if fileObjectId value is undefined else open folder containing the file with id fileObjectId
7144
- * @param fileObjectId Id of the file whose containing folder should be opened
7238
+ * @param fileObjectId - Id of the file whose containing folder should be opened
7145
7239
  * @param callback Callback that will be triggered post open download folder/path
7146
7240
  */
7147
7241
  function openDownloadFolder(fileObjectId, callback) {
7148
7242
  if (fileObjectId === void 0) { fileObjectId = undefined; }
7149
7243
  ensureInitialized(FrameContexts.content);
7150
- if (!isSupported()) {
7151
- throw errorNotSupportedOnPlatform;
7152
- }
7153
7244
  if (!callback) {
7154
7245
  throw new Error('[files.openDownloadFolder] Callback cannot be null');
7155
7246
  }