@microsoft/teams-js 2.0.0-beta.6-dev.7 → 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.
@@ -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.7";
1125
+ var version = "2.0.0-beta.6-dev.8";
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,7 +2366,6 @@ var runtime = {
2366
2366
  location: undefined,
2367
2367
  logs: undefined,
2368
2368
  mail: undefined,
2369
- media: undefined,
2370
2369
  meetingRoom: undefined,
2371
2370
  menus: undefined,
2372
2371
  monetization: undefined,
@@ -2404,7 +2403,6 @@ var teamsRuntimeConfig = {
2404
2403
  update: {},
2405
2404
  },
2406
2405
  logs: {},
2407
- media: {},
2408
2406
  meetingRoom: {},
2409
2407
  menus: {},
2410
2408
  monetization: {},
@@ -5006,9 +5004,9 @@ var __extends = (undefined && undefined.__extends) || (function () {
5006
5004
 
5007
5005
 
5008
5006
 
5009
-
5010
5007
  /**
5011
- * @alpha
5008
+ * @deprecated
5009
+ * As of 2.0.0-beta.6, use media only for backwards compatibility of existing code.
5012
5010
  */
5013
5011
  var media;
5014
5012
  (function (media) {
@@ -5029,20 +5027,35 @@ var media;
5029
5027
  return File;
5030
5028
  }());
5031
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
+ */
5032
5043
  function captureImage(callback) {
5044
+ if (!callback) {
5045
+ throw new Error('[captureImage] Callback cannot be null');
5046
+ }
5033
5047
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5034
- var wrappedFunction = function () {
5035
- return new Promise(function (resolve) {
5036
- if (!GlobalVars.isFramelessWindow) {
5037
- throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5038
- }
5039
- if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5040
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5041
- }
5042
- resolve(sendAndHandleSdkError('captureImage'));
5043
- });
5044
- };
5045
- 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);
5046
5059
  }
5047
5060
  media.captureImage = captureImage;
5048
5061
  /**
@@ -5063,95 +5076,105 @@ var media;
5063
5076
  }
5064
5077
  return _this;
5065
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
+ */
5066
5084
  Media.prototype.getMedia = function (callback) {
5067
- var _this = this;
5085
+ if (!callback) {
5086
+ throw new Error('[get Media] Callback cannot be null');
5087
+ }
5068
5088
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5069
- var wrappedFunction = function () {
5070
- return new Promise(function (resolve) {
5071
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5072
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5073
- }
5074
- if (!validateGetMediaInputs(_this.mimeType, _this.format, _this.content)) {
5075
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5076
- }
5077
- // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
5078
- if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
5079
- resolve(_this.getMediaViaCallback());
5080
- }
5081
- else {
5082
- resolve(_this.getMediaViaHandler());
5083
- }
5084
- });
5085
- };
5086
- 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
+ }
5087
5106
  };
5088
- Media.prototype.getMediaViaCallback = function () {
5089
- var _this = this;
5090
- return new Promise(function (resolve, reject) {
5091
- var helper = {
5092
- mediaMimeType: _this.mimeType,
5093
- assembleAttachment: [],
5094
- };
5095
- var localUriId = [_this.content];
5096
- 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) {
5097
5115
  if (mediaResult && mediaResult.error) {
5098
- reject(mediaResult.error);
5099
- }
5100
- else if (!mediaResult || !mediaResult.mediaChunk) {
5101
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' });
5102
- }
5103
- else if (mediaResult.mediaChunk.chunkSequence <= 0) {
5104
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5105
- resolve(file);
5116
+ callback(mediaResult.error, null);
5106
5117
  }
5107
5118
  else {
5108
- // Keep pushing chunks into assemble attachment
5109
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5110
- helper.assembleAttachment.push(assemble);
5111
- }
5112
- });
5113
- });
5114
- };
5115
- Media.prototype.getMediaViaHandler = function () {
5116
- var _this = this;
5117
- return new Promise(function (resolve, reject) {
5118
- var actionName = generateGUID();
5119
- var helper = {
5120
- mediaMimeType: _this.mimeType,
5121
- assembleAttachment: [],
5122
- };
5123
- var params = [actionName, _this.content];
5124
- _this.content && sendMessageToParent('getMedia', params);
5125
- registerHandler('getMedia' + actionName, function (response) {
5126
- try {
5127
- var mediaResult = JSON.parse(response);
5128
- if (mediaResult.error) {
5129
- reject(mediaResult.error);
5130
- 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
+ }
5131
5131
  }
5132
- else if (!mediaResult || !mediaResult.mediaChunk) {
5133
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' });
5134
- removeHandler('getMedia' + actionName);
5132
+ else {
5133
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5135
5134
  }
5136
- 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) {
5137
5157
  // If the chunksequence number is less than equal to 0 implies EOF
5138
5158
  // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5139
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5140
- resolve(file);
5141
- 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
+ }
5142
5169
  }
5143
5170
  else {
5144
- // Keep pushing chunks into assemble attachment
5145
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5146
- helper.assembleAttachment.push(assemble);
5171
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5172
+ removeHandler('getMedia' + actionName);
5147
5173
  }
5148
5174
  }
5149
- catch (err) {
5150
- // catch JSON.parse() errors
5151
- reject({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'Error parsing the response: ' + response });
5152
- }
5153
- });
5154
- });
5175
+ }
5176
+ }
5177
+ registerHandler('getMedia' + actionName, handleGetMediaRequest);
5155
5178
  };
5156
5179
  return Media;
5157
5180
  }(File));
@@ -5166,26 +5189,38 @@ var media;
5166
5189
  function MediaController(controllerCallback) {
5167
5190
  this.controllerCallback = controllerCallback;
5168
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
+ */
5169
5200
  MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
5170
5201
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5171
5202
  try {
5172
5203
  throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5173
5204
  }
5174
5205
  catch (err) {
5175
- var wrappedRejectedErrorFn = function () { return Promise.reject(err); };
5176
- return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedRejectedErrorFn, callback);
5206
+ if (callback) {
5207
+ callback(err);
5208
+ }
5209
+ return;
5177
5210
  }
5178
- var params = {
5179
- mediaType: this.getMediaType(),
5180
- mediaControllerEvent: mediaEvent,
5181
- };
5182
- var wrappedFunction = function () {
5183
- return new Promise(function (resolve) { return resolve(sendAndHandleSdkError('media.controller', [params])); });
5184
- };
5185
- 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
+ });
5186
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
+ */
5187
5222
  MediaController.prototype.stop = function (callback) {
5188
- return Promise.resolve(this.notifyEventToHost(MediaControllerEvent.StopRecording, callback));
5223
+ this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
5189
5224
  };
5190
5225
  return MediaController;
5191
5226
  }());
@@ -5201,14 +5236,16 @@ var media;
5201
5236
  return MediaType.Video;
5202
5237
  };
5203
5238
  VideoController.prototype.notifyEventToApp = function (mediaEvent) {
5239
+ if (!this.controllerCallback) {
5240
+ // Early return as app has not registered with the callback
5241
+ return;
5242
+ }
5204
5243
  switch (mediaEvent) {
5205
5244
  case MediaControllerEvent.StartRecording:
5206
- this.controllerCallback.onRecordingStarted();
5207
- break;
5208
- // TODO - Should discuss whether this function should be required
5209
- case MediaControllerEvent.StopRecording:
5210
- this.controllerCallback.onRecordingStopped && this.controllerCallback.onRecordingStopped();
5211
- break;
5245
+ if (this.controllerCallback.onRecordingStarted) {
5246
+ this.controllerCallback.onRecordingStarted();
5247
+ break;
5248
+ }
5212
5249
  }
5213
5250
  };
5214
5251
  return VideoController;
@@ -5269,109 +5306,128 @@ var media;
5269
5306
  ImageOutputFormats[ImageOutputFormats["IMAGE"] = 1] = "IMAGE";
5270
5307
  ImageOutputFormats[ImageOutputFormats["PDF"] = 2] = "PDF";
5271
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
+ */
5272
5318
  function selectMedia(mediaInputs, callback) {
5319
+ if (!callback) {
5320
+ throw new Error('[select Media] Callback cannot be null');
5321
+ }
5273
5322
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5274
- var wrappedFunction = function () {
5275
- return new Promise(function (resolve) {
5276
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5277
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5278
- }
5279
- throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5280
- if (!validateSelectMediaInputs(mediaInputs)) {
5281
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5282
- }
5283
- var params = [mediaInputs];
5284
- // What comes back from native at attachments would just be objects and will be missing getMedia method on them.
5285
- resolve(sendMessageToParentAsync('selectMedia', params));
5286
- }).then(function (_a) {
5287
- var err = _a[0], localAttachments = _a[1], mediaEvent = _a[2];
5288
- // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5289
- if (mediaEvent) {
5290
- if (isVideoControllerRegistered(mediaInputs)) {
5291
- mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5292
- }
5293
- return [];
5294
- }
5295
- // Media Attachments are final response to selectMedia
5296
- if (!localAttachments) {
5297
- throw err;
5298
- }
5299
- var mediaArray = [];
5300
- for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5301
- var attachment = localAttachments_1[_i];
5302
- 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);
5303
5347
  }
5304
- return mediaArray;
5305
- });
5306
- };
5307
- 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
+ });
5308
5362
  }
5309
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
+ */
5310
5372
  function viewImages(uriList, callback) {
5373
+ if (!callback) {
5374
+ throw new Error('[view images] Callback cannot be null');
5375
+ }
5311
5376
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5312
- var wrappedFunction = function () {
5313
- return new Promise(function (resolve) {
5314
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5315
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5316
- }
5317
- if (!validateViewImagesInput(uriList)) {
5318
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5319
- }
5320
- resolve(sendAndHandleSdkError('viewImages', uriList));
5321
- });
5322
- };
5323
- 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);
5324
5389
  }
5325
5390
  media.viewImages = viewImages;
5326
- function scanBarCode(callbackOrConfig, configMaybe) {
5327
- var callback;
5328
- var config;
5329
- // Because the callback isn't the second parameter in the original v1 method we need to
5330
- // do a bit of trickery to see which of the two ways were used to call into
5331
- // the flow and if the first parameter is a callback (v1) or a config object (v2)
5332
- if (callbackOrConfig === undefined) {
5333
- // no first parameter - the second one might be a config, definitely no callback
5334
- config = configMaybe;
5335
- }
5336
- else {
5337
- if (typeof callbackOrConfig === 'object') {
5338
- // the first parameter is an object - it's the config! No callback.
5339
- config = callbackOrConfig;
5340
- }
5341
- else {
5342
- // otherwise, it's a function, so a callback. The second parameter might be a callback
5343
- callback = callbackOrConfig;
5344
- config = configMaybe;
5345
- }
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');
5346
5405
  }
5347
5406
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5348
- var wrappedFunction = function () {
5349
- return new Promise(function (resolve) {
5350
- if (GlobalVars.hostClientType === HostClientType.desktop ||
5351
- GlobalVars.hostClientType === HostClientType.web ||
5352
- GlobalVars.hostClientType === HostClientType.rigel ||
5353
- GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5354
- GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5355
- GlobalVars.hostClientType === HostClientType.teamsPhones ||
5356
- GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5357
- throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5358
- }
5359
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5360
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5361
- }
5362
- if (!validateScanBarCodeInput(config)) {
5363
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5364
- }
5365
- resolve(sendAndHandleSdkError('media.scanBarCode', config));
5366
- });
5367
- };
5368
- 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);
5369
5429
  }
5370
5430
  media.scanBarCode = scanBarCode;
5371
- function isSupported() {
5372
- return runtime.supports.media ? true : false;
5373
- }
5374
- media.isSupported = isSupported;
5375
5431
  })(media || (media = {}));
5376
5432
 
5377
5433
  ;// CONCATENATED MODULE: ./src/public/location.ts