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

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.
@@ -1122,7 +1122,7 @@ __webpack_require__.d(__webpack_exports__, {
1122
1122
  });
1123
1123
 
1124
1124
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1125
- var version = "2.0.0-beta.6-dev.6";
1125
+ var version = "2.0.0-beta.6-dev.9";
1126
1126
  /**
1127
1127
  * @hidden
1128
1128
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -2366,8 +2366,6 @@ var runtime = {
2366
2366
  location: undefined,
2367
2367
  logs: undefined,
2368
2368
  mail: undefined,
2369
- media: undefined,
2370
- meeting: undefined,
2371
2369
  meetingRoom: undefined,
2372
2370
  menus: undefined,
2373
2371
  monetization: undefined,
@@ -2405,8 +2403,6 @@ var teamsRuntimeConfig = {
2405
2403
  update: {},
2406
2404
  },
2407
2405
  logs: {},
2408
- media: {},
2409
- meeting: {},
2410
2406
  meetingRoom: {},
2411
2407
  menus: {},
2412
2408
  monetization: {},
@@ -2495,6 +2491,29 @@ function generateBackCompatRuntimeConfig(highestSupportedVersion) {
2495
2491
  function applyRuntimeConfig(runtimeConfig) {
2496
2492
  runtime = deepFreeze(runtimeConfig);
2497
2493
  }
2494
+ /**
2495
+ * @hidden
2496
+ * Hide from docs.
2497
+ * ------
2498
+ * Constant used to set minimum runtime configuration
2499
+ * while un-initializing an app in unit test case.
2500
+ *
2501
+ * @internal
2502
+ */
2503
+ var _minRuntimeConfigToUninitialize = {
2504
+ apiVersion: 1,
2505
+ supports: {
2506
+ pages: {
2507
+ appButton: {},
2508
+ tabs: {},
2509
+ config: {},
2510
+ backStack: {},
2511
+ fullTrust: {},
2512
+ },
2513
+ teamsCore: {},
2514
+ logs: {},
2515
+ },
2516
+ };
2498
2517
 
2499
2518
  ;// CONCATENATED MODULE: ./src/public/dialog.ts
2500
2519
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@@ -5008,9 +5027,9 @@ var __extends = (undefined && undefined.__extends) || (function () {
5008
5027
 
5009
5028
 
5010
5029
 
5011
-
5012
5030
  /**
5013
- * @alpha
5031
+ * @deprecated
5032
+ * As of 2.0.0-beta.6, use media only for backwards compatibility of existing code.
5014
5033
  */
5015
5034
  var media;
5016
5035
  (function (media) {
@@ -5031,20 +5050,35 @@ var media;
5031
5050
  return File;
5032
5051
  }());
5033
5052
  media.File = File;
5053
+ /**
5054
+ * @deprecated
5055
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5056
+ *
5057
+ * Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
5058
+ *
5059
+ * @params callback - Callback will be called with an @see SdkError if there are any.
5060
+ * If error is null or undefined, the callback will be called with a collection of @see File objects
5061
+ * @remarks
5062
+ * Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
5063
+ * Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5064
+ *
5065
+ */
5034
5066
  function captureImage(callback) {
5067
+ if (!callback) {
5068
+ throw new Error('[captureImage] Callback cannot be null');
5069
+ }
5035
5070
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5036
- var wrappedFunction = function () {
5037
- return new Promise(function (resolve) {
5038
- if (!GlobalVars.isFramelessWindow) {
5039
- throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5040
- }
5041
- if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5042
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5043
- }
5044
- resolve(sendAndHandleSdkError('captureImage'));
5045
- });
5046
- };
5047
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5071
+ if (!GlobalVars.isFramelessWindow) {
5072
+ var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5073
+ callback(notSupportedError, undefined);
5074
+ return;
5075
+ }
5076
+ if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5077
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5078
+ callback(oldPlatformError, undefined);
5079
+ return;
5080
+ }
5081
+ sendMessageToParent('captureImage', callback);
5048
5082
  }
5049
5083
  media.captureImage = captureImage;
5050
5084
  /**
@@ -5065,95 +5099,105 @@ var media;
5065
5099
  }
5066
5100
  return _this;
5067
5101
  }
5102
+ /**
5103
+ * Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
5104
+ * @param callback - callback is called with the @see SdkError if there is an error
5105
+ * If error is null or undefined, the callback will be called with @see Blob.
5106
+ */
5068
5107
  Media.prototype.getMedia = function (callback) {
5069
- var _this = this;
5108
+ if (!callback) {
5109
+ throw new Error('[get Media] Callback cannot be null');
5110
+ }
5070
5111
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5071
- var wrappedFunction = function () {
5072
- return new Promise(function (resolve) {
5073
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5074
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5075
- }
5076
- if (!validateGetMediaInputs(_this.mimeType, _this.format, _this.content)) {
5077
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5078
- }
5079
- // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
5080
- if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
5081
- resolve(_this.getMediaViaCallback());
5082
- }
5083
- else {
5084
- resolve(_this.getMediaViaHandler());
5085
- }
5086
- });
5087
- };
5088
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5112
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5113
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5114
+ callback(oldPlatformError, null);
5115
+ return;
5116
+ }
5117
+ if (!validateGetMediaInputs(this.mimeType, this.format, this.content)) {
5118
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5119
+ callback(invalidInput, null);
5120
+ return;
5121
+ }
5122
+ // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
5123
+ if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
5124
+ this.getMediaViaCallback(callback);
5125
+ }
5126
+ else {
5127
+ this.getMediaViaHandler(callback);
5128
+ }
5089
5129
  };
5090
- Media.prototype.getMediaViaCallback = function () {
5091
- var _this = this;
5092
- return new Promise(function (resolve, reject) {
5093
- var helper = {
5094
- mediaMimeType: _this.mimeType,
5095
- assembleAttachment: [],
5096
- };
5097
- var localUriId = [_this.content];
5098
- sendMessageToParent('getMedia', localUriId, function (mediaResult) {
5130
+ Media.prototype.getMediaViaCallback = function (callback) {
5131
+ var helper = {
5132
+ mediaMimeType: this.mimeType,
5133
+ assembleAttachment: [],
5134
+ };
5135
+ var localUriId = [this.content];
5136
+ function handleGetMediaCallbackRequest(mediaResult) {
5137
+ if (callback) {
5099
5138
  if (mediaResult && mediaResult.error) {
5100
- reject(mediaResult.error);
5101
- }
5102
- else if (!mediaResult || !mediaResult.mediaChunk) {
5103
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' });
5104
- }
5105
- else if (mediaResult.mediaChunk.chunkSequence <= 0) {
5106
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5107
- resolve(file);
5139
+ callback(mediaResult.error, null);
5108
5140
  }
5109
5141
  else {
5110
- // Keep pushing chunks into assemble attachment
5111
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5112
- helper.assembleAttachment.push(assemble);
5113
- }
5114
- });
5115
- });
5116
- };
5117
- Media.prototype.getMediaViaHandler = function () {
5118
- var _this = this;
5119
- return new Promise(function (resolve, reject) {
5120
- var actionName = generateGUID();
5121
- var helper = {
5122
- mediaMimeType: _this.mimeType,
5123
- assembleAttachment: [],
5124
- };
5125
- var params = [actionName, _this.content];
5126
- _this.content && sendMessageToParent('getMedia', params);
5127
- registerHandler('getMedia' + actionName, function (response) {
5128
- try {
5129
- var mediaResult = JSON.parse(response);
5130
- if (mediaResult.error) {
5131
- reject(mediaResult.error);
5132
- removeHandler('getMedia' + actionName);
5142
+ if (mediaResult && mediaResult.mediaChunk) {
5143
+ // If the chunksequence number is less than equal to 0 implies EOF
5144
+ // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5145
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
5146
+ var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5147
+ callback(mediaResult.error, file);
5148
+ }
5149
+ else {
5150
+ // Keep pushing chunks into assemble attachment
5151
+ var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5152
+ helper.assembleAttachment.push(assemble);
5153
+ }
5133
5154
  }
5134
- else if (!mediaResult || !mediaResult.mediaChunk) {
5135
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' });
5136
- removeHandler('getMedia' + actionName);
5155
+ else {
5156
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5137
5157
  }
5138
- else if (mediaResult.mediaChunk.chunkSequence <= 0) {
5158
+ }
5159
+ }
5160
+ }
5161
+ sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
5162
+ };
5163
+ Media.prototype.getMediaViaHandler = function (callback) {
5164
+ var actionName = generateGUID();
5165
+ var helper = {
5166
+ mediaMimeType: this.mimeType,
5167
+ assembleAttachment: [],
5168
+ };
5169
+ var params = [actionName, this.content];
5170
+ this.content && callback && sendMessageToParent('getMedia', params);
5171
+ function handleGetMediaRequest(response) {
5172
+ if (callback) {
5173
+ var mediaResult = JSON.parse(response);
5174
+ if (mediaResult.error) {
5175
+ callback(mediaResult.error, null);
5176
+ removeHandler('getMedia' + actionName);
5177
+ }
5178
+ else {
5179
+ if (mediaResult.mediaChunk) {
5139
5180
  // If the chunksequence number is less than equal to 0 implies EOF
5140
5181
  // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5141
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5142
- resolve(file);
5143
- removeHandler('getMedia' + actionName);
5182
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
5183
+ var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5184
+ callback(mediaResult.error, file);
5185
+ removeHandler('getMedia' + actionName);
5186
+ }
5187
+ else {
5188
+ // Keep pushing chunks into assemble attachment
5189
+ var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5190
+ helper.assembleAttachment.push(assemble);
5191
+ }
5144
5192
  }
5145
5193
  else {
5146
- // Keep pushing chunks into assemble attachment
5147
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5148
- helper.assembleAttachment.push(assemble);
5194
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5195
+ removeHandler('getMedia' + actionName);
5149
5196
  }
5150
5197
  }
5151
- catch (err) {
5152
- // catch JSON.parse() errors
5153
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'Error parsing the response: ' + response });
5154
- }
5155
- });
5156
- });
5198
+ }
5199
+ }
5200
+ registerHandler('getMedia' + actionName, handleGetMediaRequest);
5157
5201
  };
5158
5202
  return Media;
5159
5203
  }(File));
@@ -5168,26 +5212,38 @@ var media;
5168
5212
  function MediaController(controllerCallback) {
5169
5213
  this.controllerCallback = controllerCallback;
5170
5214
  }
5215
+ /**
5216
+ * @hidden
5217
+ * Hide from docs
5218
+ * --------
5219
+ * Function to notify the host client to programatically control the experience
5220
+ * @param mediaEvent indicates what the event that needs to be signaled to the host client
5221
+ * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
5222
+ */
5171
5223
  MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
5172
5224
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5173
5225
  try {
5174
5226
  throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5175
5227
  }
5176
5228
  catch (err) {
5177
- var wrappedRejectedErrorFn = function () { return Promise.reject(err); };
5178
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedRejectedErrorFn, callback);
5229
+ if (callback) {
5230
+ callback(err);
5231
+ }
5232
+ return;
5179
5233
  }
5180
- var params = {
5181
- mediaType: this.getMediaType(),
5182
- mediaControllerEvent: mediaEvent,
5183
- };
5184
- var wrappedFunction = function () {
5185
- return new Promise(function (resolve) { return resolve(sendAndHandleSdkError('media.controller', [params])); });
5186
- };
5187
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedFunction, callback);
5234
+ var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
5235
+ sendMessageToParent('media.controller', [params], function (err) {
5236
+ if (callback) {
5237
+ callback(err);
5238
+ }
5239
+ });
5188
5240
  };
5241
+ /**
5242
+ * Function to programatically stop the ongoing media event
5243
+ * Optional; @param callback is used to send app if host client has successfully stopped the event or not
5244
+ */
5189
5245
  MediaController.prototype.stop = function (callback) {
5190
- return Promise.resolve(this.notifyEventToHost(MediaControllerEvent.StopRecording, callback));
5246
+ this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
5191
5247
  };
5192
5248
  return MediaController;
5193
5249
  }());
@@ -5203,14 +5259,16 @@ var media;
5203
5259
  return MediaType.Video;
5204
5260
  };
5205
5261
  VideoController.prototype.notifyEventToApp = function (mediaEvent) {
5262
+ if (!this.controllerCallback) {
5263
+ // Early return as app has not registered with the callback
5264
+ return;
5265
+ }
5206
5266
  switch (mediaEvent) {
5207
5267
  case MediaControllerEvent.StartRecording:
5208
- this.controllerCallback.onRecordingStarted();
5209
- break;
5210
- // TODO - Should discuss whether this function should be required
5211
- case MediaControllerEvent.StopRecording:
5212
- this.controllerCallback.onRecordingStopped && this.controllerCallback.onRecordingStopped();
5213
- break;
5268
+ if (this.controllerCallback.onRecordingStarted) {
5269
+ this.controllerCallback.onRecordingStarted();
5270
+ break;
5271
+ }
5214
5272
  }
5215
5273
  };
5216
5274
  return VideoController;
@@ -5271,109 +5329,128 @@ var media;
5271
5329
  ImageOutputFormats[ImageOutputFormats["IMAGE"] = 1] = "IMAGE";
5272
5330
  ImageOutputFormats[ImageOutputFormats["PDF"] = 2] = "PDF";
5273
5331
  })(ImageOutputFormats = media.ImageOutputFormats || (media.ImageOutputFormats = {}));
5332
+ /**
5333
+ * @deprecated
5334
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5335
+ *
5336
+ * Select an attachment using camera/gallery
5337
+ *
5338
+ * @param mediaInputs - The input params to customize the media to be selected
5339
+ * @param callback - The callback to invoke after fetching the media
5340
+ */
5274
5341
  function selectMedia(mediaInputs, callback) {
5342
+ if (!callback) {
5343
+ throw new Error('[select Media] Callback cannot be null');
5344
+ }
5275
5345
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5276
- var wrappedFunction = function () {
5277
- return new Promise(function (resolve) {
5278
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5279
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5280
- }
5281
- throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5282
- if (!validateSelectMediaInputs(mediaInputs)) {
5283
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5284
- }
5285
- var params = [mediaInputs];
5286
- // What comes back from native at attachments would just be objects and will be missing getMedia method on them.
5287
- resolve(sendMessageToParentAsync('selectMedia', params));
5288
- }).then(function (_a) {
5289
- var err = _a[0], localAttachments = _a[1], mediaEvent = _a[2];
5290
- // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5291
- if (mediaEvent) {
5292
- if (isVideoControllerRegistered(mediaInputs)) {
5293
- mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5294
- }
5295
- return [];
5296
- }
5297
- // Media Attachments are final response to selectMedia
5298
- if (!localAttachments) {
5299
- throw err;
5300
- }
5301
- var mediaArray = [];
5302
- for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5303
- var attachment = localAttachments_1[_i];
5304
- mediaArray.push(new Media(attachment));
5346
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5347
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5348
+ callback(oldPlatformError, null);
5349
+ return;
5350
+ }
5351
+ try {
5352
+ throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5353
+ }
5354
+ catch (err) {
5355
+ callback(err, null);
5356
+ return;
5357
+ }
5358
+ if (!validateSelectMediaInputs(mediaInputs)) {
5359
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5360
+ callback(invalidInput, null);
5361
+ return;
5362
+ }
5363
+ var params = [mediaInputs];
5364
+ // What comes back from native as attachments would just be objects and will be missing getMedia method on them
5365
+ sendMessageToParent('selectMedia', params, function (err, localAttachments, mediaEvent) {
5366
+ // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5367
+ if (mediaEvent) {
5368
+ if (isVideoControllerRegistered(mediaInputs)) {
5369
+ mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5305
5370
  }
5306
- return mediaArray;
5307
- });
5308
- };
5309
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5371
+ return;
5372
+ }
5373
+ // Media Attachments are final response to selectMedia
5374
+ if (!localAttachments) {
5375
+ callback(err, null);
5376
+ return;
5377
+ }
5378
+ var mediaArray = [];
5379
+ for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5380
+ var attachment = localAttachments_1[_i];
5381
+ mediaArray.push(new Media(attachment));
5382
+ }
5383
+ callback(err, mediaArray);
5384
+ });
5310
5385
  }
5311
5386
  media.selectMedia = selectMedia;
5387
+ /**
5388
+ * @deprecated
5389
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5390
+ *
5391
+ * View images using native image viewer
5392
+ * @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
5393
+ * @param callback - returns back error if encountered, returns null in case of success
5394
+ */
5312
5395
  function viewImages(uriList, callback) {
5396
+ if (!callback) {
5397
+ throw new Error('[view images] Callback cannot be null');
5398
+ }
5313
5399
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5314
- var wrappedFunction = function () {
5315
- return new Promise(function (resolve) {
5316
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5317
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5318
- }
5319
- if (!validateViewImagesInput(uriList)) {
5320
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5321
- }
5322
- resolve(sendAndHandleSdkError('viewImages', uriList));
5323
- });
5324
- };
5325
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedFunction, callback);
5400
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5401
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5402
+ callback(oldPlatformError);
5403
+ return;
5404
+ }
5405
+ if (!validateViewImagesInput(uriList)) {
5406
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5407
+ callback(invalidInput);
5408
+ return;
5409
+ }
5410
+ var params = [uriList];
5411
+ sendMessageToParent('viewImages', params, callback);
5326
5412
  }
5327
5413
  media.viewImages = viewImages;
5328
- function scanBarCode(callbackOrConfig, configMaybe) {
5329
- var callback;
5330
- var config;
5331
- // Because the callback isn't the second parameter in the original v1 method we need to
5332
- // do a bit of trickery to see which of the two ways were used to call into
5333
- // the flow and if the first parameter is a callback (v1) or a config object (v2)
5334
- if (callbackOrConfig === undefined) {
5335
- // no first parameter - the second one might be a config, definitely no callback
5336
- config = configMaybe;
5337
- }
5338
- else {
5339
- if (typeof callbackOrConfig === 'object') {
5340
- // the first parameter is an object - it's the config! No callback.
5341
- config = callbackOrConfig;
5342
- }
5343
- else {
5344
- // otherwise, it's a function, so a callback. The second parameter might be a callback
5345
- callback = callbackOrConfig;
5346
- config = configMaybe;
5347
- }
5414
+ /**
5415
+ * @deprecated
5416
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5417
+ *
5418
+ * Scan Barcode/QRcode using camera
5419
+ * @remarks
5420
+ * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5421
+ *
5422
+ * @param callback - callback to invoke after scanning the barcode
5423
+ * @param config - optional input configuration to customize the barcode scanning experience
5424
+ */
5425
+ function scanBarCode(callback, config) {
5426
+ if (!callback) {
5427
+ throw new Error('[media.scanBarCode] Callback cannot be null');
5348
5428
  }
5349
5429
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5350
- var wrappedFunction = function () {
5351
- return new Promise(function (resolve) {
5352
- if (GlobalVars.hostClientType === HostClientType.desktop ||
5353
- GlobalVars.hostClientType === HostClientType.web ||
5354
- GlobalVars.hostClientType === HostClientType.rigel ||
5355
- GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5356
- GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5357
- GlobalVars.hostClientType === HostClientType.teamsPhones ||
5358
- GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5359
- throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5360
- }
5361
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5362
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5363
- }
5364
- if (!validateScanBarCodeInput(config)) {
5365
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5366
- }
5367
- resolve(sendAndHandleSdkError('media.scanBarCode', config));
5368
- });
5369
- };
5370
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5430
+ if (GlobalVars.hostClientType === HostClientType.desktop ||
5431
+ GlobalVars.hostClientType === HostClientType.web ||
5432
+ GlobalVars.hostClientType === HostClientType.rigel ||
5433
+ GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5434
+ GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5435
+ GlobalVars.hostClientType === HostClientType.teamsPhones ||
5436
+ GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5437
+ var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5438
+ callback(notSupportedError, null);
5439
+ return;
5440
+ }
5441
+ if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5442
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5443
+ callback(oldPlatformError, null);
5444
+ return;
5445
+ }
5446
+ if (!validateScanBarCodeInput(config)) {
5447
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5448
+ callback(invalidInput, null);
5449
+ return;
5450
+ }
5451
+ sendMessageToParent('media.scanBarCode', [config], callback);
5371
5452
  }
5372
5453
  media.scanBarCode = scanBarCode;
5373
- function isSupported() {
5374
- return runtime.supports.media ? true : false;
5375
- }
5376
- media.isSupported = isSupported;
5377
5454
  })(media || (media = {}));
5378
5455
 
5379
5456
  ;// CONCATENATED MODULE: ./src/public/location.ts
@@ -5439,10 +5516,9 @@ var location_location;
5439
5516
 
5440
5517
 
5441
5518
 
5442
-
5443
-
5444
5519
  /**
5445
- * @alpha
5520
+ * @deprecated
5521
+ * As of 2.0.0-beta.6, use meeting only for backwards compatibility of existing code.
5446
5522
  */
5447
5523
  var meeting;
5448
5524
  (function (meeting) {
@@ -5455,102 +5531,156 @@ var meeting;
5455
5531
  MeetingType["Broadcast"] = "Broadcast";
5456
5532
  MeetingType["MeetNow"] = "MeetNow";
5457
5533
  })(MeetingType = meeting.MeetingType || (meeting.MeetingType = {}));
5534
+ var CallType;
5535
+ (function (CallType) {
5536
+ CallType["OneOnOneCall"] = "oneOnOneCall";
5537
+ CallType["GroupCall"] = "groupCall";
5538
+ })(CallType = meeting.CallType || (meeting.CallType = {}));
5539
+ /**
5540
+ * @deprecated
5541
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5542
+ *
5543
+ * Allows an app to get the incoming audio speaker setting for the meeting user
5544
+ *
5545
+ * @param callback - Callback contains 2 parameters, error and result.
5546
+ *
5547
+ * error can either contain an error of type SdkError, incase of an error, or null when fetch is successful
5548
+ * result can either contain the true/false value, incase of a successful fetch or null when the fetching fails
5549
+ * result: True means incoming audio is muted and false means incoming audio is unmuted
5550
+ */
5458
5551
  function getIncomingClientAudioState(callback) {
5552
+ if (!callback) {
5553
+ throw new Error('[get incoming client audio state] Callback cannot be null');
5554
+ }
5459
5555
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5460
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getIncomingClientAudioStateHelper, callback);
5556
+ sendMessageToParent('getIncomingClientAudioState', callback);
5461
5557
  }
5462
5558
  meeting.getIncomingClientAudioState = getIncomingClientAudioState;
5463
- function getIncomingClientAudioStateHelper() {
5464
- return new Promise(function (resolve) {
5465
- resolve(sendAndHandleSdkError('getIncomingClientAudioState'));
5466
- });
5467
- }
5559
+ /**
5560
+ * @deprecated
5561
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5562
+ *
5563
+ * Allows an app to toggle the incoming audio speaker setting for the meeting user from mute to unmute or vice-versa
5564
+ *
5565
+ * @param callback - Callback contains 2 parameters, error and result.
5566
+ * error can either contain an error of type SdkError, incase of an error, or null when toggle is successful
5567
+ * result can either contain the true/false value, incase of a successful toggle or null when the toggling fails
5568
+ * result: True means incoming audio is muted and false means incoming audio is unmuted
5569
+ */
5468
5570
  function toggleIncomingClientAudio(callback) {
5571
+ if (!callback) {
5572
+ throw new Error('[toggle incoming client audio] Callback cannot be null');
5573
+ }
5469
5574
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5470
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(toggleIncomingClientAudioHelper, callback);
5575
+ sendMessageToParent('toggleIncomingClientAudio', callback);
5471
5576
  }
5472
5577
  meeting.toggleIncomingClientAudio = toggleIncomingClientAudio;
5473
- function toggleIncomingClientAudioHelper() {
5474
- return new Promise(function (resolve) {
5475
- resolve(sendAndHandleSdkError('toggleIncomingClientAudio'));
5476
- });
5477
- }
5578
+ /**
5579
+ * @deprecated
5580
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5581
+ *
5582
+ * @hidden
5583
+ * Hide from docs
5584
+ *
5585
+ * Allows an app to get the meeting details for the meeting
5586
+ *
5587
+ * @param callback - Callback contains 2 parameters, error and meetingDetailsResponse.
5588
+ * error can either contain an error of type SdkError, incase of an error, or null when get is successful
5589
+ * result can either contain a IMeetingDetailsResponse value, incase of a successful get or null when the get fails
5590
+ *
5591
+ * @internal
5592
+ */
5478
5593
  function getMeetingDetails(callback) {
5594
+ if (!callback) {
5595
+ throw new Error('[get meeting details] Callback cannot be null');
5596
+ }
5479
5597
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage, FrameContexts.settings, FrameContexts.content);
5480
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getMeetingDetailsHelper, callback);
5598
+ sendMessageToParent('meeting.getMeetingDetails', callback);
5481
5599
  }
5482
5600
  meeting.getMeetingDetails = getMeetingDetails;
5483
- function getMeetingDetailsHelper() {
5484
- return new Promise(function (resolve) {
5485
- resolve(sendAndHandleSdkError('meeting.getMeetingDetails'));
5486
- });
5487
- }
5601
+ /**
5602
+ * @deprecated
5603
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5604
+ *
5605
+ * @hidden
5606
+ * Allows an app to get the authentication token for the anonymous or guest user in the meeting
5607
+ *
5608
+ * @param callback - Callback contains 2 parameters, error and authenticationTokenOfAnonymousUser.
5609
+ * error can either contain an error of type SdkError, incase of an error, or null when get is successful
5610
+ * authenticationTokenOfAnonymousUser can either contain a string value, incase of a successful get or null when the get fails
5611
+ *
5612
+ * @internal
5613
+ */
5488
5614
  function getAuthenticationTokenForAnonymousUser(callback) {
5615
+ if (!callback) {
5616
+ throw new Error('[get Authentication Token For AnonymousUser] Callback cannot be null');
5617
+ }
5489
5618
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5490
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getAuthenticationTokenForAnonymousUserHelper, callback);
5619
+ sendMessageToParent('meeting.getAuthenticationTokenForAnonymousUser', callback);
5491
5620
  }
5492
5621
  meeting.getAuthenticationTokenForAnonymousUser = getAuthenticationTokenForAnonymousUser;
5493
- function getAuthenticationTokenForAnonymousUserHelper() {
5494
- return new Promise(function (resolve) {
5495
- resolve(sendAndHandleSdkError('meeting.getAuthenticationTokenForAnonymousUser'));
5496
- });
5497
- }
5498
- function isSupported() {
5499
- return runtime.supports.meeting ? true : false;
5500
- }
5501
- meeting.isSupported = isSupported;
5622
+ /**
5623
+ * @deprecated
5624
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5625
+ *
5626
+ * Allows an app to get the state of the live stream in the current meeting
5627
+ *
5628
+ * @param callback - Callback contains 2 parameters: error and liveStreamState.
5629
+ * error can either contain an error of type SdkError, in case of an error, or null when get is successful
5630
+ * liveStreamState can either contain a LiveStreamState value, or null when operation fails
5631
+ */
5502
5632
  function getLiveStreamState(callback) {
5503
- ensureInitialized();
5504
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getLiveStreamStateHelper, callback);
5633
+ if (!callback) {
5634
+ throw new Error('[get live stream state] Callback cannot be null');
5635
+ }
5636
+ ensureInitialized(FrameContexts.sidePanel);
5637
+ sendMessageToParent('meeting.getLiveStreamState', callback);
5505
5638
  }
5506
5639
  meeting.getLiveStreamState = getLiveStreamState;
5507
- function getLiveStreamStateHelper() {
5508
- return new Promise(function (resolve) {
5509
- resolve(sendAndHandleSdkError('meeting.getLiveStreamState'));
5510
- });
5511
- }
5512
5640
  /**
5513
- * @hidden
5514
- * This function is the overloaded implementation of requestStartLiveStreaming.
5515
- * Since the method signatures of the v1 callback and v2 promise differ in the type of the first parameter,
5516
- * we need to do an extra check to know the typeof the @param1 to set the proper arguments of the utility function.
5517
- * @param param1
5518
- * @param param2
5519
- * @param param3
5520
- * @returns Promise that will be resolved when the operation has completed or rejected with SdkError value
5641
+ * @deprecated
5642
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5643
+ *
5644
+ * Allows an app to request the live streaming be started at the given streaming url
5645
+ *
5646
+ * @remarks
5647
+ * Use getLiveStreamState or registerLiveStreamChangedHandler to get updates on the live stream state
5648
+ *
5649
+ * @param streamUrl - the url to the stream resource
5650
+ * @param streamKey - the key to the stream resource
5651
+ * @param callback - Callback contains error parameter which can be of type SdkError in case of an error, or null when operation is successful
5521
5652
  */
5522
- function requestStartLiveStreaming(param1, param2, param3) {
5523
- var _a, _b;
5524
- ensureInitialized(FrameContexts.sidePanel);
5525
- var streamUrl;
5526
- var streamKey;
5527
- var callback;
5528
- if (typeof param1 === 'function') {
5529
- // Legacy code, with callbacks.
5530
- _a = [param1, param2, param3], callback = _a[0], streamUrl = _a[1], streamKey = _a[2];
5531
- }
5532
- else if (typeof param1 === 'string') {
5533
- _b = [param1, param2], streamUrl = _b[0], streamKey = _b[1];
5653
+ function requestStartLiveStreaming(callback, streamUrl, streamKey) {
5654
+ if (!callback) {
5655
+ throw new Error('[request start live streaming] Callback cannot be null');
5534
5656
  }
5535
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(requestStartLiveStreamingHelper, callback, streamUrl, streamKey);
5657
+ ensureInitialized(FrameContexts.sidePanel);
5658
+ sendMessageToParent('meeting.requestStartLiveStreaming', [streamUrl, streamKey], callback);
5536
5659
  }
5537
5660
  meeting.requestStartLiveStreaming = requestStartLiveStreaming;
5538
- function requestStartLiveStreamingHelper(streamUrl, streamKey) {
5539
- return new Promise(function (resolve) {
5540
- resolve(sendAndHandleSdkError('meeting.requestStartLiveStreaming', streamUrl, streamKey));
5541
- });
5542
- }
5661
+ /**
5662
+ * @deprecated
5663
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5664
+ *
5665
+ * Allows an app to request the live streaming be stopped at the given streaming url
5666
+ *
5667
+ * @remarks
5668
+ * Use getLiveStreamState or registerLiveStreamChangedHandler to get updates on the live stream state
5669
+ *
5670
+ * @param callback - Callback contains error parameter which can be of type SdkError in case of an error, or null when operation is successful
5671
+ */
5543
5672
  function requestStopLiveStreaming(callback) {
5673
+ if (!callback) {
5674
+ throw new Error('[request stop live streaming] Callback cannot be null');
5675
+ }
5544
5676
  ensureInitialized(FrameContexts.sidePanel);
5545
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(requestStopLiveStreamingHelper, callback);
5677
+ sendMessageToParent('meeting.requestStopLiveStreaming', callback);
5546
5678
  }
5547
5679
  meeting.requestStopLiveStreaming = requestStopLiveStreaming;
5548
- function requestStopLiveStreamingHelper() {
5549
- return new Promise(function (resolve) {
5550
- resolve(sendAndHandleSdkError('meeting.requestStopLiveStreaming'));
5551
- });
5552
- }
5553
5680
  /**
5681
+ * @deprecated
5682
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5683
+ *
5554
5684
  * Registers a handler for changes to the live stream.
5555
5685
  *
5556
5686
  * @remarks
@@ -5567,81 +5697,90 @@ var meeting;
5567
5697
  }
5568
5698
  meeting.registerLiveStreamChangedHandler = registerLiveStreamChangedHandler;
5569
5699
  /**
5570
- * This function is the overloaded implementation of shareAppContentToStage.
5571
- * Since the method signatures of the v1 callback and v2 promise differ in the type of the first parameter,
5572
- * we need to do an extra check to know the typeof the @param1 to set the proper arguments of the utility function.
5573
- * @param param1
5574
- * @param param2
5575
- * @returns Promise resolved indicating whether or not the share was successful or rejected with SdkError value
5700
+ * @deprecated
5701
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5702
+ *
5703
+ * Allows an app to share contents in the meeting
5704
+ *
5705
+ * @param callback - Callback contains 2 parameters, error and result.
5706
+ * error can either contain an error of type SdkError, incase of an error, or null when share is successful
5707
+ * result can either contain a true value, incase of a successful share or null when the share fails
5708
+ * @param appContentUrl - is the input URL which needs to be shared on to the stage
5576
5709
  */
5577
- function shareAppContentToStage(param1, param2) {
5578
- var _a;
5579
- ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5580
- var appContentUrl;
5581
- var callback;
5582
- if (typeof param1 === 'function') {
5583
- // Legacy callback
5584
- _a = [param1, param2], callback = _a[0], appContentUrl = _a[1];
5585
- }
5586
- else {
5587
- appContentUrl = param1;
5710
+ function shareAppContentToStage(callback, appContentUrl) {
5711
+ if (!callback) {
5712
+ throw new Error('[share app content to stage] Callback cannot be null');
5588
5713
  }
5589
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(shareAppContentToStageHelper, callback, appContentUrl);
5714
+ ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5715
+ sendMessageToParent('meeting.shareAppContentToStage', [appContentUrl], callback);
5590
5716
  }
5591
5717
  meeting.shareAppContentToStage = shareAppContentToStage;
5592
5718
  /**
5593
- * @hidden
5594
- * Helper method to generate and return a promise for shareAppContentToStage
5595
- * @param appContentUrl
5596
- * @returns
5719
+ * @deprecated
5720
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5721
+ *
5722
+ * Provides information related app's in-meeting sharing capabilities
5723
+ *
5724
+ * @param callback - Callback contains 2 parameters, error and result.
5725
+ * error can either contain an error of type SdkError (error indication), or null (non-error indication)
5726
+ * appContentStageSharingCapabilities can either contain an IAppContentStageSharingCapabilities object
5727
+ * (indication of successful retrieval), or null (indication of failed retrieval)
5597
5728
  */
5598
- function shareAppContentToStageHelper(appContentUrl) {
5599
- return new Promise(function (resolve) {
5600
- resolve(sendAndHandleSdkError('meeting.shareAppContentToStage', appContentUrl));
5601
- });
5602
- }
5603
5729
  function getAppContentStageSharingCapabilities(callback) {
5730
+ if (!callback) {
5731
+ throw new Error('[get app content stage sharing capabilities] Callback cannot be null');
5732
+ }
5604
5733
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5605
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getAppContentStageSharingCapabilitiesHelper, callback);
5734
+ sendMessageToParent('meeting.getAppContentStageSharingCapabilities', callback);
5606
5735
  }
5607
5736
  meeting.getAppContentStageSharingCapabilities = getAppContentStageSharingCapabilities;
5608
5737
  /**
5738
+ * @deprecated
5739
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5740
+ *
5609
5741
  * @hidden
5610
- * @returns
5742
+ * Hide from docs.
5743
+ * Terminates current stage sharing session in meeting
5744
+ *
5745
+ * @param callback - Callback contains 2 parameters, error and result.
5746
+ * error can either contain an error of type SdkError (error indication), or null (non-error indication)
5747
+ * result can either contain a true boolean value (successful termination), or null (unsuccessful fetch)
5611
5748
  */
5612
- function getAppContentStageSharingCapabilitiesHelper() {
5613
- return new Promise(function (resolve) {
5614
- resolve(sendAndHandleSdkError('meeting.getAppContentStageSharingCapabilities'));
5615
- });
5616
- }
5617
5749
  function stopSharingAppContentToStage(callback) {
5750
+ if (!callback) {
5751
+ throw new Error('[stop sharing app content to stage] Callback cannot be null');
5752
+ }
5618
5753
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5619
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(stopSharingAppContentToStageHelper, callback);
5754
+ sendMessageToParent('meeting.stopSharingAppContentToStage', callback);
5620
5755
  }
5621
5756
  meeting.stopSharingAppContentToStage = stopSharingAppContentToStage;
5622
5757
  /**
5623
- * @hidden
5624
- * @returns
5758
+ * @deprecated
5759
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5760
+ *
5761
+ * Provides information related to current stage sharing state for app
5762
+ *
5763
+ * @param callback - Callback contains 2 parameters, error and result.
5764
+ * error can either contain an error of type SdkError (error indication), or null (non-error indication)
5765
+ * appContentStageSharingState can either contain an IAppContentStageSharingState object
5766
+ * (indication of successful retrieval), or null (indication of failed retrieval)
5625
5767
  */
5626
- function stopSharingAppContentToStageHelper() {
5627
- return new Promise(function (resolve) {
5628
- resolve(sendAndHandleSdkError('meeting.stopSharingAppContentToStage'));
5629
- });
5630
- }
5631
5768
  function getAppContentStageSharingState(callback) {
5769
+ if (!callback) {
5770
+ throw new Error('[get app content stage sharing state] Callback cannot be null');
5771
+ }
5632
5772
  ensureInitialized(FrameContexts.sidePanel, FrameContexts.meetingStage);
5633
- return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(getAppContentStageSharingStateHelper, callback);
5773
+ sendMessageToParent('meeting.getAppContentStageSharingState', callback);
5634
5774
  }
5635
5775
  meeting.getAppContentStageSharingState = getAppContentStageSharingState;
5636
- function getAppContentStageSharingStateHelper() {
5637
- return new Promise(function (resolve) {
5638
- resolve(sendAndHandleSdkError('meeting.getAppContentStageSharingState'));
5639
- });
5640
- }
5641
5776
  /**
5777
+ * @deprecated
5778
+ * As of 2.0.0-beta.6, use only for backwards compatibility of existing code.
5779
+ *
5642
5780
  * Registers a handler for changes to paticipant speaking states. If any participant is speaking, isSpeakingDetected
5643
5781
  * will be true. If no participants are speaking, isSpeakingDetected will be false. Only one handler can be registered
5644
5782
  * at a time. A subsequent registration replaces an existing registration.
5783
+ *
5645
5784
  * @param handler The handler to invoke when the speaking state of any participant changes (start/stop speaking).
5646
5785
  */
5647
5786
  function registerSpeakingStateChangeHandler(handler) {