@microsoft/teams-js 2.0.0-beta.3-dev.70 → 2.0.0-beta.3-dev.71

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.
@@ -3446,21 +3446,12 @@ export namespace media {
3446
3446
  * @param mediaEvent indicates what the event that needs to be signaled to the host client
3447
3447
  * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
3448
3448
  */
3449
- protected notifyEventToHost(mediaEvent: MediaControllerEvent, callback?: (err?: SdkError) => void): Promise<void>;
3449
+ protected notifyEventToHost(mediaEvent: MediaControllerEvent, callback?: (err?: SdkError) => void): void;
3450
3450
  /**
3451
- * Function to programatically stop the ongoing media event
3452
- *
3453
- * @returns A resolved promise
3454
- * */
3455
- stop(): Promise<void>;
3456
- /**
3457
- * @deprecated
3458
- * As of 2.0.0-beta.3, please use {@link MediaController.stop MediaController.stop(): Promise\<void\>} instead.
3459
-
3460
3451
  * Function to programatically stop the ongoing media event
3461
3452
  * Optional; @param callback is used to send app if host client has successfully stopped the event or not
3462
3453
  */
3463
- stop(callback: (err?: SdkError) => void): void;
3454
+ stop(callback?: (err?: SdkError) => void): void;
3464
3455
  }
3465
3456
  /**
3466
3457
  * Callback which will register your app to listen to lifecycle events during the video capture flow
@@ -1120,7 +1120,7 @@ __webpack_require__.d(__webpack_exports__, {
1120
1120
  });
1121
1121
 
1122
1122
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1123
- var version = "2.0.0-beta.3-dev.70";
1123
+ var version = "2.0.0-beta.3-dev.71";
1124
1124
  /**
1125
1125
  * @hidden
1126
1126
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -1748,7 +1748,7 @@ function ensureInitialized() {
1748
1748
  *
1749
1749
  * @internal
1750
1750
  */
1751
- function isCurrentSDKVersionAtLeast(requiredVersion) {
1751
+ function isAPISupportedByPlatform(requiredVersion) {
1752
1752
  if (requiredVersion === void 0) { requiredVersion = defaultSDKVersionForCompatCheck; }
1753
1753
  var value = compareSDKVersions(GlobalVars.clientSupportedSDKVersion, requiredVersion);
1754
1754
  if (isNaN(value)) {
@@ -1768,21 +1768,22 @@ function isHostClientMobile() {
1768
1768
  /**
1769
1769
  * @hidden
1770
1770
  * Helper function which indicates if current API is supported on mobile or not.
1771
- * @throws SdkError if host client is not android/ios or if the requiredVersion is not
1771
+ * @returns SdkError if host client is not android/ios or if the requiredVersion is not
1772
1772
  * supported by platform or not. Null is returned in case of success.
1773
1773
  *
1774
1774
  * @internal
1775
1775
  */
1776
- function throwExceptionIfMobileApiIsNotSupported(requiredVersion) {
1776
+ function isApiSupportedOnMobile(requiredVersion) {
1777
1777
  if (requiredVersion === void 0) { requiredVersion = defaultSDKVersionForCompatCheck; }
1778
1778
  if (!isHostClientMobile()) {
1779
1779
  var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
1780
- throw notSupportedError;
1780
+ return notSupportedError;
1781
1781
  }
1782
- else if (!isCurrentSDKVersionAtLeast(requiredVersion)) {
1782
+ else if (!isAPISupportedByPlatform(requiredVersion)) {
1783
1783
  var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
1784
- throw oldPlatformError;
1784
+ return oldPlatformError;
1785
1785
  }
1786
+ return null;
1786
1787
  }
1787
1788
  /**
1788
1789
  * @hidden
@@ -4459,20 +4460,21 @@ function decodeAttachment(attachment, mimeType) {
4459
4460
  }
4460
4461
  /**
4461
4462
  * @hidden
4462
- * Function throws an SdkError if the media call is not supported on current mobile version, else undefined.
4463
- * @throws an SdkError if the media call is not supported
4463
+ * Function returns null if the media call is supported on current mobile version, else SdkError.
4464
+ *
4464
4465
  * @internal
4465
4466
  */
4466
- function throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs) {
4467
+ function isMediaCallSupportedOnMobile(mediaInputs) {
4467
4468
  if (isMediaCallForVideoAndImageInputs(mediaInputs)) {
4468
- return throwExceptionIfMobileApiIsNotSupported(videoAndImageMediaAPISupportVersion);
4469
+ return isApiSupportedOnMobile(videoAndImageMediaAPISupportVersion);
4469
4470
  }
4470
4471
  else if (isMediaCallForNonFullScreenVideoMode(mediaInputs)) {
4471
- return throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
4472
+ return isApiSupportedOnMobile(nonFullScreenVideoModeAPISupportVersion);
4472
4473
  }
4473
4474
  else if (isMediaCallForImageOutputFormats(mediaInputs)) {
4474
- return throwExceptionIfMobileApiIsNotSupported(imageOutputFormatsAPISupportVersion);
4475
+ return isApiSupportedOnMobile(imageOutputFormatsAPISupportVersion);
4475
4476
  }
4477
+ return null;
4476
4478
  }
4477
4479
  /**
4478
4480
  * @hidden
@@ -4610,6 +4612,7 @@ function validatePeoplePickerInput(peoplePickerInputs) {
4610
4612
  }
4611
4613
 
4612
4614
  ;// CONCATENATED MODULE: ./src/public/media.ts
4615
+ /* eslint-disable @typescript-eslint/explicit-member-accessibility */
4613
4616
  var __extends = (undefined && undefined.__extends) || (function () {
4614
4617
  var extendStatics = function (d, b) {
4615
4618
  extendStatics = Object.setPrototypeOf ||
@@ -4664,7 +4667,7 @@ var media;
4664
4667
  if (!GlobalVars.isFramelessWindow) {
4665
4668
  throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
4666
4669
  }
4667
- if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
4670
+ if (!isAPISupportedByPlatform(captureImageMobileSupportVersion)) {
4668
4671
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4669
4672
  }
4670
4673
  resolve(sendAndHandleSdkError('captureImage'));
@@ -4696,14 +4699,14 @@ var media;
4696
4699
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4697
4700
  var wrappedFunction = function () {
4698
4701
  return new Promise(function (resolve) {
4699
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4702
+ if (!isAPISupportedByPlatform(mediaAPISupportVersion)) {
4700
4703
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4701
4704
  }
4702
4705
  if (!validateGetMediaInputs(_this.mimeType, _this.format, _this.content)) {
4703
4706
  throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
4704
4707
  }
4705
4708
  // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
4706
- if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
4709
+ if (isAPISupportedByPlatform(getMediaCallbackSupportVersion)) {
4707
4710
  resolve(_this.getMediaViaCallback());
4708
4711
  }
4709
4712
  else {
@@ -4804,33 +4807,26 @@ var media;
4804
4807
  */
4805
4808
  MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
4806
4809
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4807
- var mediaError;
4808
- var promise = Promise.resolve().then(function () {
4809
- return throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
4810
- });
4810
+ var err = isApiSupportedOnMobile(nonFullScreenVideoModeAPISupportVersion);
4811
+ if (err) {
4812
+ if (callback) {
4813
+ callback(err);
4814
+ }
4815
+ return;
4816
+ }
4811
4817
  var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
4812
4818
  sendMessageToParent('media.controller', [params], function (err) {
4813
4819
  if (callback) {
4814
- return callback(err);
4815
- }
4816
- else if (err) {
4817
- mediaError = err;
4818
- }
4819
- });
4820
- return promise
4821
- .then(function () {
4822
- if (mediaError) {
4823
- throw mediaError;
4820
+ callback(err);
4824
4821
  }
4825
- })
4826
- .catch(function (err) {
4827
- throw err;
4828
4822
  });
4829
4823
  };
4824
+ /**
4825
+ * Function to programatically stop the ongoing media event
4826
+ * Optional; @param callback is used to send app if host client has successfully stopped the event or not
4827
+ */
4830
4828
  MediaController.prototype.stop = function (callback) {
4831
- var _this = this;
4832
- var wrappedFunction = function () { return _this.notifyEventToHost(MediaControllerEvent.StopRecording, callback); };
4833
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
4829
+ this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
4834
4830
  };
4835
4831
  return MediaController;
4836
4832
  }());
@@ -4920,10 +4916,13 @@ var media;
4920
4916
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4921
4917
  var wrappedFunction = function () {
4922
4918
  return new Promise(function (resolve) {
4923
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4919
+ if (!isAPISupportedByPlatform(mediaAPISupportVersion)) {
4924
4920
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4925
4921
  }
4926
- throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
4922
+ var err = isMediaCallSupportedOnMobile(mediaInputs);
4923
+ if (err) {
4924
+ throw err;
4925
+ }
4927
4926
  if (!validateSelectMediaInputs(mediaInputs)) {
4928
4927
  throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
4929
4928
  }
@@ -4958,7 +4957,7 @@ var media;
4958
4957
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4959
4958
  var wrappedFunction = function () {
4960
4959
  return new Promise(function (resolve) {
4961
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4960
+ if (!isAPISupportedByPlatform(mediaAPISupportVersion)) {
4962
4961
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4963
4962
  }
4964
4963
  if (!validateViewImagesInput(uriList)) {
@@ -5003,7 +5002,7 @@ var media;
5003
5002
  GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5004
5003
  throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5005
5004
  }
5006
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5005
+ if (!isAPISupportedByPlatform(scanBarCodeAPIMobileSupportVersion)) {
5007
5006
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5008
5007
  }
5009
5008
  if (!validateScanBarCodeInput(config)) {
@@ -5041,7 +5040,7 @@ var location_location;
5041
5040
  location_1.getLocation = getLocation;
5042
5041
  function getLocationHelper(props) {
5043
5042
  return new Promise(function (resolve) {
5044
- if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5043
+ if (!isAPISupportedByPlatform(locationAPIsRequiredVersion)) {
5045
5044
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5046
5045
  }
5047
5046
  if (!props) {
@@ -5057,7 +5056,7 @@ var location_location;
5057
5056
  location_1.showLocation = showLocation;
5058
5057
  function showLocationHelper(location) {
5059
5058
  return new Promise(function (resolve) {
5060
- if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5059
+ if (!isAPISupportedByPlatform(locationAPIsRequiredVersion)) {
5061
5060
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5062
5061
  }
5063
5062
  if (!location) {
@@ -5449,7 +5448,7 @@ var people;
5449
5448
  people_1.selectPeople = selectPeople;
5450
5449
  function selectPeopleHelper(peoplePickerInputs) {
5451
5450
  return new Promise(function (resolve) {
5452
- if (!isCurrentSDKVersionAtLeast(peoplePickerRequiredVersion)) {
5451
+ if (!isAPISupportedByPlatform(peoplePickerRequiredVersion)) {
5453
5452
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5454
5453
  }
5455
5454
  if (!validatePeoplePickerInput(peoplePickerInputs)) {
@@ -6688,7 +6687,7 @@ var legacy;
6688
6687
  GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
6689
6688
  GlobalVars.hostClientType === HostClientType.teamsPhones ||
6690
6689
  GlobalVars.hostClientType === HostClientType.teamsDisplays) &&
6691
- !isCurrentSDKVersionAtLeast(getUserJoinedTeamsSupportedAndroidClientVersion)) {
6690
+ !isAPISupportedByPlatform(getUserJoinedTeamsSupportedAndroidClientVersion)) {
6692
6691
  var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
6693
6692
  throw new Error(JSON.stringify(oldPlatformError));
6694
6693
  }