@microsoft/teams-js 2.0.0-beta.3-dev.74 → 2.0.0-beta.3-dev.78

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.
@@ -3442,6 +3442,20 @@ export namespace media {
3442
3442
  * @hidden
3443
3443
  * Hide from docs
3444
3444
  * --------
3445
+ *
3446
+ * Function to notify the host client to programatically control the experience
3447
+ * @param mediaEvent indicates what the event that needs to be signaled to the host client
3448
+ * @returns A promise resolved promise
3449
+ */
3450
+ protected notifyEventToHost(mediaEvent: MediaControllerEvent): Promise<void>;
3451
+ /**
3452
+ * @hidden
3453
+ * Hide from docs
3454
+ * --------
3455
+ *
3456
+ * @deprecated
3457
+ * As of 2.0.0-beta.3, please use {@link media.MediaController.notifyEventToHost media.MediaController.notifyEventToHost(mediaEvent: MediaControllerEvent): Promise\<void\>} instead.
3458
+ *
3445
3459
  * Function to notify the host client to programatically control the experience
3446
3460
  * @param mediaEvent indicates what the event that needs to be signaled to the host client
3447
3461
  * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
@@ -3449,6 +3463,17 @@ export namespace media {
3449
3463
  protected notifyEventToHost(mediaEvent: MediaControllerEvent, callback?: (err?: SdkError) => void): void;
3450
3464
  /**
3451
3465
  * Function to programatically stop the ongoing media event
3466
+ *
3467
+ * @returns A resolved promise
3468
+ * */
3469
+ stop(): Promise<void>;
3470
+ /**
3471
+ *
3472
+ * Function to programatically stop the ongoing media event
3473
+ *
3474
+ * @deprecated
3475
+ * As of 2.0.0-beta.3, please use {@link media.MediaController.stop media.MediaController.stop(): Promise\<void\>} instead.
3476
+ *
3452
3477
  * Optional; @param callback is used to send app if host client has successfully stopped the event or not
3453
3478
  */
3454
3479
  stop(callback?: (err?: SdkError) => void): void;
@@ -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.74";
1123
+ var version = "2.0.0-beta.3-dev.78";
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 isAPISupportedByPlatform(requiredVersion) {
1751
+ function isCurrentSDKVersionAtLeast(requiredVersion) {
1752
1752
  if (requiredVersion === void 0) { requiredVersion = defaultSDKVersionForCompatCheck; }
1753
1753
  var value = compareSDKVersions(GlobalVars.clientSupportedSDKVersion, requiredVersion);
1754
1754
  if (isNaN(value)) {
@@ -1768,22 +1768,21 @@ function isHostClientMobile() {
1768
1768
  /**
1769
1769
  * @hidden
1770
1770
  * Helper function which indicates if current API is supported on mobile or not.
1771
- * @returns SdkError if host client is not android/ios or if the requiredVersion is not
1771
+ * @throws 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 isApiSupportedOnMobile(requiredVersion) {
1776
+ function throwExceptionIfMobileApiIsNotSupported(requiredVersion) {
1777
1777
  if (requiredVersion === void 0) { requiredVersion = defaultSDKVersionForCompatCheck; }
1778
1778
  if (!isHostClientMobile()) {
1779
1779
  var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
1780
- return notSupportedError;
1780
+ throw notSupportedError;
1781
1781
  }
1782
- else if (!isAPISupportedByPlatform(requiredVersion)) {
1782
+ else if (!isCurrentSDKVersionAtLeast(requiredVersion)) {
1783
1783
  var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
1784
- return oldPlatformError;
1784
+ throw oldPlatformError;
1785
1785
  }
1786
- return null;
1787
1786
  }
1788
1787
  /**
1789
1788
  * @hidden
@@ -4460,21 +4459,20 @@ function decodeAttachment(attachment, mimeType) {
4460
4459
  }
4461
4460
  /**
4462
4461
  * @hidden
4463
- * Function returns null if the media call is supported on current mobile version, else SdkError.
4464
- *
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
4465
4464
  * @internal
4466
4465
  */
4467
- function isMediaCallSupportedOnMobile(mediaInputs) {
4466
+ function throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs) {
4468
4467
  if (isMediaCallForVideoAndImageInputs(mediaInputs)) {
4469
- return isApiSupportedOnMobile(videoAndImageMediaAPISupportVersion);
4468
+ throwExceptionIfMobileApiIsNotSupported(videoAndImageMediaAPISupportVersion);
4470
4469
  }
4471
4470
  else if (isMediaCallForNonFullScreenVideoMode(mediaInputs)) {
4472
- return isApiSupportedOnMobile(nonFullScreenVideoModeAPISupportVersion);
4471
+ throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
4473
4472
  }
4474
4473
  else if (isMediaCallForImageOutputFormats(mediaInputs)) {
4475
- return isApiSupportedOnMobile(imageOutputFormatsAPISupportVersion);
4474
+ throwExceptionIfMobileApiIsNotSupported(imageOutputFormatsAPISupportVersion);
4476
4475
  }
4477
- return null;
4478
4476
  }
4479
4477
  /**
4480
4478
  * @hidden
@@ -4667,7 +4665,7 @@ var media;
4667
4665
  if (!GlobalVars.isFramelessWindow) {
4668
4666
  throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
4669
4667
  }
4670
- if (!isAPISupportedByPlatform(captureImageMobileSupportVersion)) {
4668
+ if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
4671
4669
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4672
4670
  }
4673
4671
  resolve(sendAndHandleSdkError('captureImage'));
@@ -4699,14 +4697,14 @@ var media;
4699
4697
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4700
4698
  var wrappedFunction = function () {
4701
4699
  return new Promise(function (resolve) {
4702
- if (!isAPISupportedByPlatform(mediaAPISupportVersion)) {
4700
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4703
4701
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4704
4702
  }
4705
4703
  if (!validateGetMediaInputs(_this.mimeType, _this.format, _this.content)) {
4706
4704
  throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
4707
4705
  }
4708
4706
  // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
4709
- if (isAPISupportedByPlatform(getMediaCallbackSupportVersion)) {
4707
+ if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
4710
4708
  resolve(_this.getMediaViaCallback());
4711
4709
  }
4712
4710
  else {
@@ -4797,36 +4795,33 @@ var media;
4797
4795
  function MediaController(controllerCallback) {
4798
4796
  this.controllerCallback = controllerCallback;
4799
4797
  }
4800
- /**
4801
- * @hidden
4802
- * Hide from docs
4803
- * --------
4804
- * Function to notify the host client to programatically control the experience
4805
- * @param mediaEvent indicates what the event that needs to be signaled to the host client
4806
- * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
4807
- */
4808
4798
  MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
4799
+ var _this = this;
4809
4800
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4810
- var err = isApiSupportedOnMobile(nonFullScreenVideoModeAPISupportVersion);
4811
- if (err) {
4812
- if (callback) {
4813
- callback(err);
4814
- }
4815
- return;
4816
- }
4817
- var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
4818
- sendMessageToParent('media.controller', [params], function (err) {
4801
+ return Promise.resolve()
4802
+ .then(function () {
4803
+ throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
4804
+ })
4805
+ .then(function () {
4806
+ var params = { mediaType: _this.getMediaType(), mediaControllerEvent: mediaEvent };
4807
+ sendMessageToParent('media.controller', [params], function (err) {
4808
+ if (callback) {
4809
+ callback(err);
4810
+ }
4811
+ else if (err) {
4812
+ throw err;
4813
+ }
4814
+ });
4815
+ })
4816
+ .catch(function (err) {
4819
4817
  if (callback) {
4820
4818
  callback(err);
4821
4819
  }
4820
+ throw err;
4822
4821
  });
4823
4822
  };
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
- */
4828
4823
  MediaController.prototype.stop = function (callback) {
4829
- this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
4824
+ return Promise.resolve(this.notifyEventToHost(MediaControllerEvent.StopRecording, callback));
4830
4825
  };
4831
4826
  return MediaController;
4832
4827
  }());
@@ -4916,13 +4911,10 @@ var media;
4916
4911
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4917
4912
  var wrappedFunction = function () {
4918
4913
  return new Promise(function (resolve) {
4919
- if (!isAPISupportedByPlatform(mediaAPISupportVersion)) {
4914
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4920
4915
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4921
4916
  }
4922
- var err = isMediaCallSupportedOnMobile(mediaInputs);
4923
- if (err) {
4924
- throw err;
4925
- }
4917
+ throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
4926
4918
  if (!validateSelectMediaInputs(mediaInputs)) {
4927
4919
  throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
4928
4920
  }
@@ -4957,7 +4949,7 @@ var media;
4957
4949
  ensureInitialized(FrameContexts.content, FrameContexts.task);
4958
4950
  var wrappedFunction = function () {
4959
4951
  return new Promise(function (resolve) {
4960
- if (!isAPISupportedByPlatform(mediaAPISupportVersion)) {
4952
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4961
4953
  throw { errorCode: ErrorCode.OLD_PLATFORM };
4962
4954
  }
4963
4955
  if (!validateViewImagesInput(uriList)) {
@@ -5002,7 +4994,7 @@ var media;
5002
4994
  GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5003
4995
  throw { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5004
4996
  }
5005
- if (!isAPISupportedByPlatform(scanBarCodeAPIMobileSupportVersion)) {
4997
+ if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5006
4998
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5007
4999
  }
5008
5000
  if (!validateScanBarCodeInput(config)) {
@@ -5040,7 +5032,7 @@ var location_location;
5040
5032
  location_1.getLocation = getLocation;
5041
5033
  function getLocationHelper(props) {
5042
5034
  return new Promise(function (resolve) {
5043
- if (!isAPISupportedByPlatform(locationAPIsRequiredVersion)) {
5035
+ if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5044
5036
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5045
5037
  }
5046
5038
  if (!props) {
@@ -5056,7 +5048,7 @@ var location_location;
5056
5048
  location_1.showLocation = showLocation;
5057
5049
  function showLocationHelper(location) {
5058
5050
  return new Promise(function (resolve) {
5059
- if (!isAPISupportedByPlatform(locationAPIsRequiredVersion)) {
5051
+ if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5060
5052
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5061
5053
  }
5062
5054
  if (!location) {
@@ -5448,7 +5440,7 @@ var people;
5448
5440
  people_1.selectPeople = selectPeople;
5449
5441
  function selectPeopleHelper(peoplePickerInputs) {
5450
5442
  return new Promise(function (resolve) {
5451
- if (!isAPISupportedByPlatform(peoplePickerRequiredVersion)) {
5443
+ if (!isCurrentSDKVersionAtLeast(peoplePickerRequiredVersion)) {
5452
5444
  throw { errorCode: ErrorCode.OLD_PLATFORM };
5453
5445
  }
5454
5446
  if (!validatePeoplePickerInput(peoplePickerInputs)) {
@@ -6687,7 +6679,7 @@ var legacy;
6687
6679
  GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
6688
6680
  GlobalVars.hostClientType === HostClientType.teamsPhones ||
6689
6681
  GlobalVars.hostClientType === HostClientType.teamsDisplays) &&
6690
- !isAPISupportedByPlatform(getUserJoinedTeamsSupportedAndroidClientVersion)) {
6682
+ !isCurrentSDKVersionAtLeast(getUserJoinedTeamsSupportedAndroidClientVersion)) {
6691
6683
  var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
6692
6684
  throw new Error(JSON.stringify(oldPlatformError));
6693
6685
  }