@microsoft/teams-js 2.1.0-beta.2 → 2.1.0-beta.5

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.
@@ -1063,6 +1063,7 @@ __webpack_require__.d(__webpack_exports__, {
1063
1063
  "appInitialization": () => (/* reexport */ appInitialization),
1064
1064
  "appInstallDialog": () => (/* reexport */ appInstallDialog),
1065
1065
  "authentication": () => (/* reexport */ authentication),
1066
+ "barCode": () => (/* reexport */ barCode),
1066
1067
  "calendar": () => (/* reexport */ calendar),
1067
1068
  "call": () => (/* reexport */ call),
1068
1069
  "chat": () => (/* reexport */ chat),
@@ -1071,6 +1072,7 @@ __webpack_require__.d(__webpack_exports__, {
1071
1072
  "enablePrintCapability": () => (/* reexport */ enablePrintCapability),
1072
1073
  "executeDeepLink": () => (/* reexport */ executeDeepLink),
1073
1074
  "files": () => (/* reexport */ files),
1075
+ "geoLocation": () => (/* reexport */ geoLocation),
1074
1076
  "getContext": () => (/* reexport */ getContext),
1075
1077
  "getMruTabInstances": () => (/* reexport */ getMruTabInstances),
1076
1078
  "getTabInstances": () => (/* reexport */ getTabInstances),
@@ -1118,11 +1120,12 @@ __webpack_require__.d(__webpack_exports__, {
1118
1120
  "teams": () => (/* reexport */ teams),
1119
1121
  "teamsCore": () => (/* reexport */ teamsCore),
1120
1122
  "uploadCustomApp": () => (/* reexport */ uploadCustomApp),
1121
- "video": () => (/* reexport */ video)
1123
+ "video": () => (/* reexport */ video),
1124
+ "webStorage": () => (/* reexport */ webStorage)
1122
1125
  });
1123
1126
 
1124
1127
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1125
- var version = "2.1.0-beta.2";
1128
+ var version = "2.1.0-beta.5";
1126
1129
  /**
1127
1130
  * @hidden
1128
1131
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -1161,6 +1164,13 @@ var getUserJoinedTeamsSupportedAndroidClientVersion = '2.0.1';
1161
1164
  * @internal
1162
1165
  */
1163
1166
  var locationAPIsRequiredVersion = '1.9.0';
1167
+ /**
1168
+ * @hidden
1169
+ * This is the client version when permisisons are supported
1170
+ *
1171
+ * @internal
1172
+ */
1173
+ var permissionsAPIsRequiredVersion = '2.0.1';
1164
1174
  /**
1165
1175
  * @hidden
1166
1176
  * This is the client version when people picker API is supported on mobile.
@@ -1340,6 +1350,12 @@ var ErrorCode;
1340
1350
  */
1341
1351
  ErrorCode[ErrorCode["SIZE_EXCEEDED"] = 10000] = "SIZE_EXCEEDED";
1342
1352
  })(ErrorCode || (ErrorCode = {}));
1353
+ /** @hidden */
1354
+ var DevicePermission;
1355
+ (function (DevicePermission) {
1356
+ DevicePermission["GeoLocation"] = "geolocation";
1357
+ DevicePermission["Media"] = "media";
1358
+ })(DevicePermission || (DevicePermission = {}));
1343
1359
 
1344
1360
  ;// CONCATENATED MODULE: ./src/public/constants.ts
1345
1361
  var HostClientType;
@@ -2355,14 +2371,19 @@ var runtime = {
2355
2371
  apiVersion: 1,
2356
2372
  supports: {
2357
2373
  appInstallDialog: undefined,
2374
+ barCode: undefined,
2358
2375
  calendar: undefined,
2359
2376
  call: undefined,
2360
2377
  chat: undefined,
2378
+ webStorage: undefined,
2361
2379
  conversations: undefined,
2362
2380
  dialog: {
2363
2381
  bot: undefined,
2364
2382
  update: undefined,
2365
2383
  },
2384
+ geoLocation: {
2385
+ map: undefined,
2386
+ },
2366
2387
  location: undefined,
2367
2388
  logs: undefined,
2368
2389
  mail: undefined,
@@ -2378,9 +2399,11 @@ var runtime = {
2378
2399
  fullTrust: undefined,
2379
2400
  },
2380
2401
  people: undefined,
2402
+ permissions: undefined,
2381
2403
  profile: undefined,
2382
2404
  remoteCamera: undefined,
2383
2405
  sharing: undefined,
2406
+ stageView: undefined,
2384
2407
  teams: {
2385
2408
  fullTrust: {
2386
2409
  joinedTeams: undefined,
@@ -2417,6 +2440,7 @@ var teamsRuntimeConfig = {
2417
2440
  },
2418
2441
  remoteCamera: {},
2419
2442
  sharing: {},
2443
+ stageView: {},
2420
2444
  teams: {
2421
2445
  fullTrust: {},
2422
2446
  },
@@ -2460,6 +2484,12 @@ var versionConstants = {
2460
2484
  ],
2461
2485
  },
2462
2486
  ],
2487
+ '2.0.5': [
2488
+ {
2489
+ capability: { webStorage: {} },
2490
+ hostClientTypes: [HostClientType.android, HostClientType.ios],
2491
+ },
2492
+ ],
2463
2493
  };
2464
2494
  /**
2465
2495
  * @internal
@@ -2581,7 +2611,7 @@ var dialog;
2581
2611
  }
2582
2612
  var dialogInfo = getDialogInfoFromUrlDialogInfo(urlDialogInfo);
2583
2613
  sendMessageToParent('tasks.startTask', [dialogInfo], function (err, result) {
2584
- submitHandler({ err: err, result: result });
2614
+ submitHandler === null || submitHandler === void 0 ? void 0 : submitHandler({ err: err, result: result });
2585
2615
  removeHandler('messageForParent');
2586
2616
  });
2587
2617
  }
@@ -2720,7 +2750,7 @@ var dialog;
2720
2750
  }
2721
2751
  var dialogInfo = getDialogInfoFromBotUrlDialogInfo(botUrlDialogInfo);
2722
2752
  sendMessageToParent('tasks.startTask', [dialogInfo], function (err, result) {
2723
- submitHandler({ err: err, result: result });
2753
+ submitHandler === null || submitHandler === void 0 ? void 0 : submitHandler({ err: err, result: result });
2724
2754
  removeHandler('messageForParent');
2725
2755
  });
2726
2756
  }
@@ -4052,6 +4082,10 @@ function removeHandler(name) {
4052
4082
  delete HandlersPrivate.handlers[name];
4053
4083
  }
4054
4084
  /** @internal */
4085
+ function doesHandlerExist(name) {
4086
+ return HandlersPrivate.handlers[name] != null;
4087
+ }
4088
+ /** @internal */
4055
4089
  function handlers_registerOnThemeChangeHandler(handler) {
4056
4090
  HandlersPrivate.themeChangeHandler = handler;
4057
4091
  handler && sendMessageToParent('registerHandler', ['themeChange']);
@@ -4822,204 +4856,484 @@ var appInstallDialog;
4822
4856
  appInstallDialog.isSupported = isSupported;
4823
4857
  })(appInstallDialog || (appInstallDialog = {}));
4824
4858
 
4825
- ;// CONCATENATED MODULE: ./src/public/chat.ts
4826
-
4859
+ ;// CONCATENATED MODULE: ./src/public/media.ts
4860
+ /* eslint-disable @typescript-eslint/explicit-member-accessibility */
4861
+ var __extends = (undefined && undefined.__extends) || (function () {
4862
+ var extendStatics = function (d, b) {
4863
+ extendStatics = Object.setPrototypeOf ||
4864
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4865
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
4866
+ return extendStatics(d, b);
4867
+ };
4868
+ return function (d, b) {
4869
+ if (typeof b !== "function" && b !== null)
4870
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4871
+ extendStatics(d, b);
4872
+ function __() { this.constructor = d; }
4873
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4874
+ };
4875
+ })();
4827
4876
 
4828
4877
 
4829
4878
 
4830
4879
 
4831
- /**
4832
- * Contains functionality to start chat with others
4833
- *
4834
- * @beta
4835
- */
4836
- var chat;
4837
- (function (chat) {
4838
- /**
4839
- * Allows the user to open a chat with a single user and allows
4840
- * for the user to specify the message they wish to send.
4841
- *
4842
- * @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
4843
- *
4844
- * @returns Promise resolved upon completion
4845
- */
4846
- function openChat(openChatRequest) {
4847
- return new Promise(function (resolve) {
4848
- ensureInitialized(FrameContexts.content);
4849
- if (!isSupported()) {
4850
- throw errorNotSupportedOnPlatform;
4851
- }
4852
- if (runtime.isLegacyTeams) {
4853
- resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat([openChatRequest.user], undefined /*topic*/, openChatRequest.message)));
4854
- }
4855
- else {
4856
- var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4857
- members: openChatRequest.user,
4858
- message: openChatRequest.message,
4859
- });
4860
- resolve(sendPromise);
4861
- }
4862
- });
4863
- }
4864
- chat.openChat = openChat;
4865
- /**
4866
- * Allows the user to create a chat with multiple users (2+) and allows
4867
- * for the user to specify a message and name the topic of the conversation. If
4868
- * only 1 user is provided into users array default back to origin openChat.
4869
- *
4870
- * @param openChatRequest: {@link OpenGroupChatRequest} - a request object that contains a list of user emails as well as optional parameters for message and topic (display name for the group chat).
4871
- *
4872
- * @returns Promise resolved upon completion
4873
- */
4874
- function openGroupChat(openChatRequest) {
4875
- return new Promise(function (resolve) {
4876
- if (openChatRequest.users.length < 1) {
4877
- throw Error('OpenGroupChat Failed: No users specified');
4878
- }
4879
- if (openChatRequest.users.length === 1) {
4880
- var chatRequest = {
4881
- user: openChatRequest.users[0],
4882
- message: openChatRequest.message,
4883
- };
4884
- openChat(chatRequest);
4885
- }
4886
- else {
4887
- ensureInitialized(FrameContexts.content);
4888
- if (!isSupported()) {
4889
- throw errorNotSupportedOnPlatform;
4890
- }
4891
- if (runtime.isLegacyTeams) {
4892
- resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat(openChatRequest.users, openChatRequest.topic, openChatRequest.message)));
4893
- }
4894
- else {
4895
- var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4896
- members: openChatRequest.users,
4897
- message: openChatRequest.message,
4898
- topic: openChatRequest.topic,
4899
- });
4900
- resolve(sendPromise);
4901
- }
4902
- }
4903
- });
4904
- }
4905
- chat.openGroupChat = openGroupChat;
4906
- function isSupported() {
4907
- return runtime.supports.chat ? true : false;
4908
- }
4909
- chat.isSupported = isSupported;
4910
- })(chat || (chat = {}));
4911
-
4912
- ;// CONCATENATED MODULE: ./src/public/appWindow.ts
4913
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
4914
- /* eslint-disable @typescript-eslint/no-explicit-any */
4915
- /* eslint-disable @typescript-eslint/ban-types */
4916
4880
 
4917
4881
 
4918
4882
 
4919
4883
 
4920
4884
 
4921
- var ChildAppWindow = /** @class */ (function () {
4922
- function ChildAppWindow() {
4923
- }
4885
+ var media;
4886
+ (function (media) {
4924
4887
  /**
4925
- * Send a message to the ChildAppWindow.
4926
- *
4927
- * @param message - The message to send
4928
- * @param onComplete - The callback to know if the postMessage has been success/failed.
4888
+ * Enum for file formats supported
4929
4889
  */
4930
- ChildAppWindow.prototype.postMessage = function (message, onComplete) {
4931
- ensureInitialized();
4932
- sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4933
- };
4890
+ var FileFormat;
4891
+ (function (FileFormat) {
4892
+ FileFormat["Base64"] = "base64";
4893
+ FileFormat["ID"] = "id";
4894
+ })(FileFormat = media.FileFormat || (media.FileFormat = {}));
4934
4895
  /**
4935
- * Add a listener that will be called when an event is received from the ChildAppWindow.
4936
- *
4937
- * @param type - The event to listen to. Currently the only supported type is 'message'.
4938
- * @param listener - The listener that will be called
4896
+ * File object that can be used to represent image or video or audio
4939
4897
  */
4940
- ChildAppWindow.prototype.addEventListener = function (type, listener) {
4941
- ensureInitialized();
4942
- if (type === 'message') {
4943
- registerHandler('messageForParent', listener);
4898
+ var File = /** @class */ (function () {
4899
+ function File() {
4944
4900
  }
4945
- };
4946
- return ChildAppWindow;
4947
- }());
4948
-
4949
- var ParentAppWindow = /** @class */ (function () {
4950
- function ParentAppWindow() {
4951
- }
4952
- Object.defineProperty(ParentAppWindow, "Instance", {
4953
- get: function () {
4954
- // Do you need arguments? Make it a regular method instead.
4955
- return this._instance || (this._instance = new this());
4956
- },
4957
- enumerable: false,
4958
- configurable: true
4959
- });
4901
+ return File;
4902
+ }());
4903
+ media.File = File;
4960
4904
  /**
4961
- * Send a message to the ParentAppWindow.
4905
+ * Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
4962
4906
  *
4963
- * @param message - The message to send
4964
- * @param onComplete - The callback to know if the postMessage has been success/failed.
4965
- */
4966
- ParentAppWindow.prototype.postMessage = function (message, onComplete) {
4967
- ensureInitialized(FrameContexts.task);
4968
- sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4969
- };
4970
- /**
4971
- * Add a listener that will be called when an event is received from the ParentAppWindow.
4907
+ * @params callback - Callback will be called with an @see SdkError if there are any.
4908
+ * If error is null or undefined, the callback will be called with a collection of @see File objects
4909
+ * @remarks
4910
+ * Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
4911
+ * Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
4972
4912
  *
4973
- * @param type - The event to listen to. Currently the only supported type is 'message'.
4974
- * @param listener - The listener that will be called
4975
4913
  */
4976
- ParentAppWindow.prototype.addEventListener = function (type, listener) {
4977
- ensureInitialized(FrameContexts.task);
4978
- if (type === 'message') {
4979
- registerHandler('messageForChild', listener);
4914
+ function captureImage(callback) {
4915
+ if (!callback) {
4916
+ throw new Error('[captureImage] Callback cannot be null');
4980
4917
  }
4981
- };
4982
- return ParentAppWindow;
4983
- }());
4984
-
4985
-
4986
- ;// CONCATENATED MODULE: ./src/internal/mediaUtil.ts
4987
-
4988
-
4989
-
4990
- /**
4991
- * @hidden
4992
- * Helper function to create a blob from media chunks based on their sequence
4993
- *
4994
- * @internal
4995
- */
4996
- function createFile(assembleAttachment, mimeType) {
4997
- if (assembleAttachment == null || mimeType == null || assembleAttachment.length <= 0) {
4998
- return null;
4918
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
4919
+ if (!GlobalVars.isFramelessWindow) {
4920
+ var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
4921
+ callback(notSupportedError, undefined);
4922
+ return;
4923
+ }
4924
+ if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
4925
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
4926
+ callback(oldPlatformError, undefined);
4927
+ return;
4928
+ }
4929
+ sendMessageToParent('captureImage', callback);
4999
4930
  }
5000
- var file;
5001
- var sequence = 1;
5002
- assembleAttachment.sort(function (a, b) { return (a.sequence > b.sequence ? 1 : -1); });
5003
- assembleAttachment.forEach(function (item) {
5004
- if (item.sequence == sequence) {
5005
- if (file) {
5006
- file = new Blob([file, item.file], { type: mimeType });
5007
- }
5008
- else {
5009
- file = new Blob([item.file], { type: mimeType });
4931
+ media.captureImage = captureImage;
4932
+ /**
4933
+ * Media object returned by the select Media API
4934
+ */
4935
+ var Media = /** @class */ (function (_super) {
4936
+ __extends(Media, _super);
4937
+ function Media(that) {
4938
+ if (that === void 0) { that = null; }
4939
+ var _this = _super.call(this) || this;
4940
+ if (that) {
4941
+ _this.content = that.content;
4942
+ _this.format = that.format;
4943
+ _this.mimeType = that.mimeType;
4944
+ _this.name = that.name;
4945
+ _this.preview = that.preview;
4946
+ _this.size = that.size;
5010
4947
  }
5011
- sequence++;
4948
+ return _this;
5012
4949
  }
5013
- });
5014
- return file;
5015
- }
5016
- /**
5017
- * @hidden
5018
- * Helper function to convert Media chunks into another object type which can be later assemebled
5019
- * Converts base 64 encoded string to byte array and then into an array of blobs
5020
- *
5021
- * @internal
5022
- */
4950
+ /**
4951
+ * Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
4952
+ * @param callback - callback is called with the @see SdkError if there is an error
4953
+ * If error is null or undefined, the callback will be called with @see Blob.
4954
+ */
4955
+ Media.prototype.getMedia = function (callback) {
4956
+ if (!callback) {
4957
+ throw new Error('[get Media] Callback cannot be null');
4958
+ }
4959
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
4960
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
4961
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
4962
+ callback(oldPlatformError, null);
4963
+ return;
4964
+ }
4965
+ if (!validateGetMediaInputs(this.mimeType, this.format, this.content)) {
4966
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
4967
+ callback(invalidInput, null);
4968
+ return;
4969
+ }
4970
+ // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
4971
+ if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
4972
+ this.getMediaViaCallback(callback);
4973
+ }
4974
+ else {
4975
+ this.getMediaViaHandler(callback);
4976
+ }
4977
+ };
4978
+ Media.prototype.getMediaViaCallback = function (callback) {
4979
+ var helper = {
4980
+ mediaMimeType: this.mimeType,
4981
+ assembleAttachment: [],
4982
+ };
4983
+ var localUriId = [this.content];
4984
+ function handleGetMediaCallbackRequest(mediaResult) {
4985
+ if (callback) {
4986
+ if (mediaResult && mediaResult.error) {
4987
+ callback(mediaResult.error, null);
4988
+ }
4989
+ else {
4990
+ if (mediaResult && mediaResult.mediaChunk) {
4991
+ // If the chunksequence number is less than equal to 0 implies EOF
4992
+ // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
4993
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
4994
+ var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
4995
+ callback(mediaResult.error, file);
4996
+ }
4997
+ else {
4998
+ // Keep pushing chunks into assemble attachment
4999
+ var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5000
+ helper.assembleAttachment.push(assemble);
5001
+ }
5002
+ }
5003
+ else {
5004
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5005
+ }
5006
+ }
5007
+ }
5008
+ }
5009
+ sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
5010
+ };
5011
+ Media.prototype.getMediaViaHandler = function (callback) {
5012
+ var actionName = generateGUID();
5013
+ var helper = {
5014
+ mediaMimeType: this.mimeType,
5015
+ assembleAttachment: [],
5016
+ };
5017
+ var params = [actionName, this.content];
5018
+ this.content && callback && sendMessageToParent('getMedia', params);
5019
+ function handleGetMediaRequest(response) {
5020
+ if (callback) {
5021
+ var mediaResult = JSON.parse(response);
5022
+ if (mediaResult.error) {
5023
+ callback(mediaResult.error, null);
5024
+ removeHandler('getMedia' + actionName);
5025
+ }
5026
+ else {
5027
+ if (mediaResult.mediaChunk) {
5028
+ // If the chunksequence number is less than equal to 0 implies EOF
5029
+ // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5030
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
5031
+ var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5032
+ callback(mediaResult.error, file);
5033
+ removeHandler('getMedia' + actionName);
5034
+ }
5035
+ else {
5036
+ // Keep pushing chunks into assemble attachment
5037
+ var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5038
+ helper.assembleAttachment.push(assemble);
5039
+ }
5040
+ }
5041
+ else {
5042
+ callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5043
+ removeHandler('getMedia' + actionName);
5044
+ }
5045
+ }
5046
+ }
5047
+ }
5048
+ registerHandler('getMedia' + actionName, handleGetMediaRequest);
5049
+ };
5050
+ return Media;
5051
+ }(File));
5052
+ media.Media = Media;
5053
+ /**
5054
+ * @hidden
5055
+ * Hide from docs
5056
+ * --------
5057
+ * Base class which holds the callback and notifies events to the host client
5058
+ */
5059
+ var MediaController = /** @class */ (function () {
5060
+ function MediaController(controllerCallback) {
5061
+ this.controllerCallback = controllerCallback;
5062
+ }
5063
+ /**
5064
+ * @hidden
5065
+ * Hide from docs
5066
+ * --------
5067
+ * Function to notify the host client to programatically control the experience
5068
+ * @param mediaEvent indicates what the event that needs to be signaled to the host client
5069
+ * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
5070
+ */
5071
+ MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
5072
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5073
+ try {
5074
+ throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5075
+ }
5076
+ catch (err) {
5077
+ if (callback) {
5078
+ callback(err);
5079
+ }
5080
+ return;
5081
+ }
5082
+ var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
5083
+ sendMessageToParent('media.controller', [params], function (err) {
5084
+ if (callback) {
5085
+ callback(err);
5086
+ }
5087
+ });
5088
+ };
5089
+ /**
5090
+ * Function to programatically stop the ongoing media event
5091
+ * Optional; @param callback is used to send app if host client has successfully stopped the event or not
5092
+ */
5093
+ MediaController.prototype.stop = function (callback) {
5094
+ this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
5095
+ };
5096
+ return MediaController;
5097
+ }());
5098
+ /**
5099
+ * VideoController class is used to communicate between the app and the host client during the video capture flow
5100
+ */
5101
+ var VideoController = /** @class */ (function (_super) {
5102
+ __extends(VideoController, _super);
5103
+ function VideoController() {
5104
+ return _super !== null && _super.apply(this, arguments) || this;
5105
+ }
5106
+ VideoController.prototype.getMediaType = function () {
5107
+ return MediaType.Video;
5108
+ };
5109
+ VideoController.prototype.notifyEventToApp = function (mediaEvent) {
5110
+ if (!this.controllerCallback) {
5111
+ // Early return as app has not registered with the callback
5112
+ return;
5113
+ }
5114
+ switch (mediaEvent) {
5115
+ case MediaControllerEvent.StartRecording:
5116
+ if (this.controllerCallback.onRecordingStarted) {
5117
+ this.controllerCallback.onRecordingStarted();
5118
+ break;
5119
+ }
5120
+ }
5121
+ };
5122
+ return VideoController;
5123
+ }(MediaController));
5124
+ media.VideoController = VideoController;
5125
+ /**
5126
+ * @hidden
5127
+ * Hide from docs
5128
+ * --------
5129
+ * Events which are used to communicate between the app and the host client during the media recording flow
5130
+ */
5131
+ var MediaControllerEvent;
5132
+ (function (MediaControllerEvent) {
5133
+ MediaControllerEvent[MediaControllerEvent["StartRecording"] = 1] = "StartRecording";
5134
+ MediaControllerEvent[MediaControllerEvent["StopRecording"] = 2] = "StopRecording";
5135
+ })(MediaControllerEvent = media.MediaControllerEvent || (media.MediaControllerEvent = {}));
5136
+ /**
5137
+ * The modes in which camera can be launched in select Media API
5138
+ */
5139
+ var CameraStartMode;
5140
+ (function (CameraStartMode) {
5141
+ CameraStartMode[CameraStartMode["Photo"] = 1] = "Photo";
5142
+ CameraStartMode[CameraStartMode["Document"] = 2] = "Document";
5143
+ CameraStartMode[CameraStartMode["Whiteboard"] = 3] = "Whiteboard";
5144
+ CameraStartMode[CameraStartMode["BusinessCard"] = 4] = "BusinessCard";
5145
+ })(CameraStartMode = media.CameraStartMode || (media.CameraStartMode = {}));
5146
+ /**
5147
+ * Specifies the image source
5148
+ */
5149
+ var Source;
5150
+ (function (Source) {
5151
+ Source[Source["Camera"] = 1] = "Camera";
5152
+ Source[Source["Gallery"] = 2] = "Gallery";
5153
+ })(Source = media.Source || (media.Source = {}));
5154
+ /**
5155
+ * Specifies the type of Media
5156
+ */
5157
+ var MediaType;
5158
+ (function (MediaType) {
5159
+ MediaType[MediaType["Image"] = 1] = "Image";
5160
+ MediaType[MediaType["Video"] = 2] = "Video";
5161
+ MediaType[MediaType["VideoAndImage"] = 3] = "VideoAndImage";
5162
+ MediaType[MediaType["Audio"] = 4] = "Audio";
5163
+ })(MediaType = media.MediaType || (media.MediaType = {}));
5164
+ /**
5165
+ * ID contains a mapping for content uri on platform's side, URL is generic
5166
+ */
5167
+ var ImageUriType;
5168
+ (function (ImageUriType) {
5169
+ ImageUriType[ImageUriType["ID"] = 1] = "ID";
5170
+ ImageUriType[ImageUriType["URL"] = 2] = "URL";
5171
+ })(ImageUriType = media.ImageUriType || (media.ImageUriType = {}));
5172
+ /**
5173
+ * Specifies the image output formats.
5174
+ */
5175
+ var ImageOutputFormats;
5176
+ (function (ImageOutputFormats) {
5177
+ ImageOutputFormats[ImageOutputFormats["IMAGE"] = 1] = "IMAGE";
5178
+ ImageOutputFormats[ImageOutputFormats["PDF"] = 2] = "PDF";
5179
+ })(ImageOutputFormats = media.ImageOutputFormats || (media.ImageOutputFormats = {}));
5180
+ /**
5181
+ * Select an attachment using camera/gallery
5182
+ *
5183
+ * @param mediaInputs - The input params to customize the media to be selected
5184
+ * @param callback - The callback to invoke after fetching the media
5185
+ */
5186
+ function selectMedia(mediaInputs, callback) {
5187
+ if (!callback) {
5188
+ throw new Error('[select Media] Callback cannot be null');
5189
+ }
5190
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5191
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5192
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5193
+ callback(oldPlatformError, null);
5194
+ return;
5195
+ }
5196
+ try {
5197
+ throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5198
+ }
5199
+ catch (err) {
5200
+ callback(err, null);
5201
+ return;
5202
+ }
5203
+ if (!validateSelectMediaInputs(mediaInputs)) {
5204
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5205
+ callback(invalidInput, null);
5206
+ return;
5207
+ }
5208
+ var params = [mediaInputs];
5209
+ // What comes back from native as attachments would just be objects and will be missing getMedia method on them
5210
+ sendMessageToParent('selectMedia', params, function (err, localAttachments, mediaEvent) {
5211
+ // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5212
+ if (mediaEvent) {
5213
+ if (isVideoControllerRegistered(mediaInputs)) {
5214
+ mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5215
+ }
5216
+ return;
5217
+ }
5218
+ // Media Attachments are final response to selectMedia
5219
+ if (!localAttachments) {
5220
+ callback(err, null);
5221
+ return;
5222
+ }
5223
+ var mediaArray = [];
5224
+ for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5225
+ var attachment = localAttachments_1[_i];
5226
+ mediaArray.push(new Media(attachment));
5227
+ }
5228
+ callback(err, mediaArray);
5229
+ });
5230
+ }
5231
+ media.selectMedia = selectMedia;
5232
+ /**
5233
+ * View images using native image viewer
5234
+ *
5235
+ * @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
5236
+ * @param callback - returns back error if encountered, returns null in case of success
5237
+ */
5238
+ function viewImages(uriList, callback) {
5239
+ if (!callback) {
5240
+ throw new Error('[view images] Callback cannot be null');
5241
+ }
5242
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5243
+ if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5244
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5245
+ callback(oldPlatformError);
5246
+ return;
5247
+ }
5248
+ if (!validateViewImagesInput(uriList)) {
5249
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5250
+ callback(invalidInput);
5251
+ return;
5252
+ }
5253
+ var params = [uriList];
5254
+ sendMessageToParent('viewImages', params, callback);
5255
+ }
5256
+ media.viewImages = viewImages;
5257
+ /**
5258
+ * @deprecated
5259
+ * As of 2.1.0, please use {@link barCode.scanBarCode barCode.scanBarCode(config?: BarCodeConfig): Promise\<string\>} instead.
5260
+
5261
+ * Scan Barcode/QRcode using camera
5262
+ *
5263
+ * @remarks
5264
+ * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5265
+ *
5266
+ * @param callback - callback to invoke after scanning the barcode
5267
+ * @param config - optional input configuration to customize the barcode scanning experience
5268
+ */
5269
+ function scanBarCode(callback, config) {
5270
+ if (!callback) {
5271
+ throw new Error('[media.scanBarCode] Callback cannot be null');
5272
+ }
5273
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5274
+ if (GlobalVars.hostClientType === HostClientType.desktop ||
5275
+ GlobalVars.hostClientType === HostClientType.web ||
5276
+ GlobalVars.hostClientType === HostClientType.rigel ||
5277
+ GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5278
+ GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5279
+ GlobalVars.hostClientType === HostClientType.teamsPhones ||
5280
+ GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5281
+ var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5282
+ callback(notSupportedError, null);
5283
+ return;
5284
+ }
5285
+ if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5286
+ var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5287
+ callback(oldPlatformError, null);
5288
+ return;
5289
+ }
5290
+ if (!validateScanBarCodeInput(config)) {
5291
+ var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5292
+ callback(invalidInput, null);
5293
+ return;
5294
+ }
5295
+ sendMessageToParent('media.scanBarCode', [config], callback);
5296
+ }
5297
+ media.scanBarCode = scanBarCode;
5298
+ })(media || (media = {}));
5299
+
5300
+ ;// CONCATENATED MODULE: ./src/internal/mediaUtil.ts
5301
+
5302
+
5303
+
5304
+ /**
5305
+ * @hidden
5306
+ * Helper function to create a blob from media chunks based on their sequence
5307
+ *
5308
+ * @internal
5309
+ */
5310
+ function createFile(assembleAttachment, mimeType) {
5311
+ if (assembleAttachment == null || mimeType == null || assembleAttachment.length <= 0) {
5312
+ return null;
5313
+ }
5314
+ var file;
5315
+ var sequence = 1;
5316
+ assembleAttachment.sort(function (a, b) { return (a.sequence > b.sequence ? 1 : -1); });
5317
+ assembleAttachment.forEach(function (item) {
5318
+ if (item.sequence == sequence) {
5319
+ if (file) {
5320
+ file = new Blob([file, item.file], { type: mimeType });
5321
+ }
5322
+ else {
5323
+ file = new Blob([item.file], { type: mimeType });
5324
+ }
5325
+ sequence++;
5326
+ }
5327
+ });
5328
+ return file;
5329
+ }
5330
+ /**
5331
+ * @hidden
5332
+ * Helper function to convert Media chunks into another object type which can be later assemebled
5333
+ * Converts base 64 encoded string to byte array and then into an array of blobs
5334
+ *
5335
+ * @internal
5336
+ */
5023
5337
  function decodeAttachment(attachment, mimeType) {
5024
5338
  if (attachment == null || mimeType == null) {
5025
5339
  return null;
@@ -5189,443 +5503,375 @@ function validatePeoplePickerInput(peoplePickerInputs) {
5189
5503
  return true;
5190
5504
  }
5191
5505
 
5192
- ;// CONCATENATED MODULE: ./src/public/media.ts
5193
- /* eslint-disable @typescript-eslint/explicit-member-accessibility */
5194
- var __extends = (undefined && undefined.__extends) || (function () {
5195
- var extendStatics = function (d, b) {
5196
- extendStatics = Object.setPrototypeOf ||
5197
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5198
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
5199
- return extendStatics(d, b);
5200
- };
5201
- return function (d, b) {
5202
- if (typeof b !== "function" && b !== null)
5203
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
5204
- extendStatics(d, b);
5205
- function __() { this.constructor = d; }
5206
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5207
- };
5208
- })();
5209
-
5506
+ ;// CONCATENATED MODULE: ./src/public/barCode.ts
5210
5507
 
5211
5508
 
5212
5509
 
5213
5510
 
5214
5511
 
5215
5512
 
5216
-
5217
-
5218
- var media;
5219
- (function (media) {
5220
- /**
5221
- * Enum for file formats supported
5222
- */
5223
- var FileFormat;
5224
- (function (FileFormat) {
5225
- FileFormat["Base64"] = "base64";
5226
- FileFormat["ID"] = "id";
5227
- })(FileFormat = media.FileFormat || (media.FileFormat = {}));
5228
- /**
5229
- * File object that can be used to represent image or video or audio
5230
- */
5231
- var File = /** @class */ (function () {
5232
- function File() {
5233
- }
5234
- return File;
5235
- }());
5236
- media.File = File;
5513
+ /**
5514
+ * Namespace to interact with the barcode scanning-specific part of the SDK.
5515
+ */
5516
+ var barCode;
5517
+ (function (barCode) {
5237
5518
  /**
5238
- * Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
5519
+ * Scan Barcode or QRcode using camera
5239
5520
  *
5240
- * @params callback - Callback will be called with an @see SdkError if there are any.
5241
- * If error is null or undefined, the callback will be called with a collection of @see File objects
5242
- * @remarks
5243
- * Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
5244
- * Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5521
+ * @param barCodeConfig - input configuration to customize the barcode scanning experience
5245
5522
  *
5523
+ * @returns a scanned code
5246
5524
  */
5247
- function captureImage(callback) {
5248
- if (!callback) {
5249
- throw new Error('[captureImage] Callback cannot be null');
5250
- }
5251
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5252
- if (!GlobalVars.isFramelessWindow) {
5253
- var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5254
- callback(notSupportedError, undefined);
5255
- return;
5256
- }
5257
- if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5258
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5259
- callback(oldPlatformError, undefined);
5260
- return;
5261
- }
5262
- sendMessageToParent('captureImage', callback);
5263
- }
5264
- media.captureImage = captureImage;
5265
- /**
5266
- * Media object returned by the select Media API
5267
- */
5268
- var Media = /** @class */ (function (_super) {
5269
- __extends(Media, _super);
5270
- function Media(that) {
5271
- if (that === void 0) { that = null; }
5272
- var _this = _super.call(this) || this;
5273
- if (that) {
5274
- _this.content = that.content;
5275
- _this.format = that.format;
5276
- _this.mimeType = that.mimeType;
5277
- _this.name = that.name;
5278
- _this.preview = that.preview;
5279
- _this.size = that.size;
5280
- }
5281
- return _this;
5282
- }
5283
- /**
5284
- * Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
5285
- * @param callback - callback is called with the @see SdkError if there is an error
5286
- * If error is null or undefined, the callback will be called with @see Blob.
5287
- */
5288
- Media.prototype.getMedia = function (callback) {
5289
- if (!callback) {
5290
- throw new Error('[get Media] Callback cannot be null');
5291
- }
5292
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5293
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5294
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5295
- callback(oldPlatformError, null);
5296
- return;
5297
- }
5298
- if (!validateGetMediaInputs(this.mimeType, this.format, this.content)) {
5299
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5300
- callback(invalidInput, null);
5301
- return;
5302
- }
5303
- // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
5304
- if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
5305
- this.getMediaViaCallback(callback);
5306
- }
5307
- else {
5308
- this.getMediaViaHandler(callback);
5309
- }
5310
- };
5311
- Media.prototype.getMediaViaCallback = function (callback) {
5312
- var helper = {
5313
- mediaMimeType: this.mimeType,
5314
- assembleAttachment: [],
5315
- };
5316
- var localUriId = [this.content];
5317
- function handleGetMediaCallbackRequest(mediaResult) {
5318
- if (callback) {
5319
- if (mediaResult && mediaResult.error) {
5320
- callback(mediaResult.error, null);
5321
- }
5322
- else {
5323
- if (mediaResult && mediaResult.mediaChunk) {
5324
- // If the chunksequence number is less than equal to 0 implies EOF
5325
- // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5326
- if (mediaResult.mediaChunk.chunkSequence <= 0) {
5327
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5328
- callback(mediaResult.error, file);
5329
- }
5330
- else {
5331
- // Keep pushing chunks into assemble attachment
5332
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5333
- helper.assembleAttachment.push(assemble);
5334
- }
5335
- }
5336
- else {
5337
- callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5338
- }
5339
- }
5340
- }
5341
- }
5342
- sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
5343
- };
5344
- Media.prototype.getMediaViaHandler = function (callback) {
5345
- var actionName = generateGUID();
5346
- var helper = {
5347
- mediaMimeType: this.mimeType,
5348
- assembleAttachment: [],
5349
- };
5350
- var params = [actionName, this.content];
5351
- this.content && callback && sendMessageToParent('getMedia', params);
5352
- function handleGetMediaRequest(response) {
5353
- if (callback) {
5354
- var mediaResult = JSON.parse(response);
5355
- if (mediaResult.error) {
5356
- callback(mediaResult.error, null);
5357
- removeHandler('getMedia' + actionName);
5358
- }
5359
- else {
5360
- if (mediaResult.mediaChunk) {
5361
- // If the chunksequence number is less than equal to 0 implies EOF
5362
- // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
5363
- if (mediaResult.mediaChunk.chunkSequence <= 0) {
5364
- var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
5365
- callback(mediaResult.error, file);
5366
- removeHandler('getMedia' + actionName);
5367
- }
5368
- else {
5369
- // Keep pushing chunks into assemble attachment
5370
- var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
5371
- helper.assembleAttachment.push(assemble);
5372
- }
5373
- }
5374
- else {
5375
- callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
5376
- removeHandler('getMedia' + actionName);
5377
- }
5378
- }
5379
- }
5380
- }
5381
- registerHandler('getMedia' + actionName, handleGetMediaRequest);
5382
- };
5383
- return Media;
5384
- }(File));
5385
- media.Media = Media;
5386
- /**
5387
- * @hidden
5388
- * Hide from docs
5389
- * --------
5390
- * Base class which holds the callback and notifies events to the host client
5391
- */
5392
- var MediaController = /** @class */ (function () {
5393
- function MediaController(controllerCallback) {
5394
- this.controllerCallback = controllerCallback;
5395
- }
5396
- /**
5397
- * @hidden
5398
- * Hide from docs
5399
- * --------
5400
- * Function to notify the host client to programatically control the experience
5401
- * @param mediaEvent indicates what the event that needs to be signaled to the host client
5402
- * Optional; @param callback is used to send app if host client has successfully handled the notification event or not
5403
- */
5404
- MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
5405
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5406
- try {
5407
- throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5408
- }
5409
- catch (err) {
5410
- if (callback) {
5411
- callback(err);
5412
- }
5413
- return;
5414
- }
5415
- var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
5416
- sendMessageToParent('media.controller', [params], function (err) {
5417
- if (callback) {
5418
- callback(err);
5419
- }
5420
- });
5421
- };
5422
- /**
5423
- * Function to programatically stop the ongoing media event
5424
- * Optional; @param callback is used to send app if host client has successfully stopped the event or not
5425
- */
5426
- MediaController.prototype.stop = function (callback) {
5427
- this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
5428
- };
5429
- return MediaController;
5430
- }());
5431
- /**
5432
- * VideoController class is used to communicate between the app and the host client during the video capture flow
5433
- */
5434
- var VideoController = /** @class */ (function (_super) {
5435
- __extends(VideoController, _super);
5436
- function VideoController() {
5437
- return _super !== null && _super.apply(this, arguments) || this;
5438
- }
5439
- VideoController.prototype.getMediaType = function () {
5440
- return MediaType.Video;
5441
- };
5442
- VideoController.prototype.notifyEventToApp = function (mediaEvent) {
5443
- if (!this.controllerCallback) {
5444
- // Early return as app has not registered with the callback
5445
- return;
5525
+ function scanBarCode(barCodeConfig) {
5526
+ return new Promise(function (resolve) {
5527
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5528
+ if (!isSupported()) {
5529
+ throw errorNotSupportedOnPlatform;
5446
5530
  }
5447
- switch (mediaEvent) {
5448
- case MediaControllerEvent.StartRecording:
5449
- if (this.controllerCallback.onRecordingStarted) {
5450
- this.controllerCallback.onRecordingStarted();
5451
- break;
5452
- }
5531
+ if (!validateScanBarCodeInput(barCodeConfig)) {
5532
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5453
5533
  }
5454
- };
5455
- return VideoController;
5456
- }(MediaController));
5457
- media.VideoController = VideoController;
5534
+ resolve(sendAndHandleSdkError('media.scanBarCode', barCodeConfig));
5535
+ });
5536
+ }
5537
+ barCode.scanBarCode = scanBarCode;
5458
5538
  /**
5459
- * @hidden
5460
- * Hide from docs
5461
- * --------
5462
- * Events which are used to communicate between the app and the host client during the media recording flow
5539
+ * Checks whether or not media has user permission
5540
+ *
5541
+ * @returns true if the user has granted the app permission to media information, false otherwise
5463
5542
  */
5464
- var MediaControllerEvent;
5465
- (function (MediaControllerEvent) {
5466
- MediaControllerEvent[MediaControllerEvent["StartRecording"] = 1] = "StartRecording";
5467
- MediaControllerEvent[MediaControllerEvent["StopRecording"] = 2] = "StopRecording";
5468
- })(MediaControllerEvent = media.MediaControllerEvent || (media.MediaControllerEvent = {}));
5543
+ function hasPermission() {
5544
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5545
+ if (!isSupported()) {
5546
+ throw errorNotSupportedOnPlatform;
5547
+ }
5548
+ var permissions = DevicePermission.Media;
5549
+ return new Promise(function (resolve) {
5550
+ resolve(sendAndHandleSdkError('permissions.has', permissions));
5551
+ });
5552
+ }
5553
+ barCode.hasPermission = hasPermission;
5469
5554
  /**
5470
- * The modes in which camera can be launched in select Media API
5555
+ * Requests user permission for media
5556
+ *
5557
+ * @returns true if the user has granted the app permission to the media, false otherwise
5471
5558
  */
5472
- var CameraStartMode;
5473
- (function (CameraStartMode) {
5474
- CameraStartMode[CameraStartMode["Photo"] = 1] = "Photo";
5475
- CameraStartMode[CameraStartMode["Document"] = 2] = "Document";
5476
- CameraStartMode[CameraStartMode["Whiteboard"] = 3] = "Whiteboard";
5477
- CameraStartMode[CameraStartMode["BusinessCard"] = 4] = "BusinessCard";
5478
- })(CameraStartMode = media.CameraStartMode || (media.CameraStartMode = {}));
5559
+ function requestPermission() {
5560
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5561
+ if (!isSupported()) {
5562
+ throw errorNotSupportedOnPlatform;
5563
+ }
5564
+ var permissions = DevicePermission.Media;
5565
+ return new Promise(function (resolve) {
5566
+ resolve(sendAndHandleSdkError('permissions.request', permissions));
5567
+ });
5568
+ }
5569
+ barCode.requestPermission = requestPermission;
5479
5570
  /**
5480
- * Specifies the image source
5571
+ * Checks if barCode capability is supported by the host
5572
+ *
5573
+ * @returns boolean to represent whether barCode is supported
5481
5574
  */
5482
- var Source;
5483
- (function (Source) {
5484
- Source[Source["Camera"] = 1] = "Camera";
5485
- Source[Source["Gallery"] = 2] = "Gallery";
5486
- })(Source = media.Source || (media.Source = {}));
5575
+ function isSupported() {
5576
+ return runtime.supports.barCode && runtime.supports.permissions ? true : false;
5577
+ }
5578
+ barCode.isSupported = isSupported;
5579
+ })(barCode || (barCode = {}));
5580
+
5581
+ ;// CONCATENATED MODULE: ./src/public/chat.ts
5582
+
5583
+
5584
+
5585
+
5586
+
5587
+ /**
5588
+ * Contains functionality to start chat with others
5589
+ *
5590
+ * @beta
5591
+ */
5592
+ var chat;
5593
+ (function (chat) {
5487
5594
  /**
5488
- * Specifies the type of Media
5595
+ * Allows the user to open a chat with a single user and allows
5596
+ * for the user to specify the message they wish to send.
5597
+ *
5598
+ * @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
5599
+ *
5600
+ * @returns Promise resolved upon completion
5489
5601
  */
5490
- var MediaType;
5491
- (function (MediaType) {
5492
- MediaType[MediaType["Image"] = 1] = "Image";
5493
- MediaType[MediaType["Video"] = 2] = "Video";
5494
- MediaType[MediaType["VideoAndImage"] = 3] = "VideoAndImage";
5495
- MediaType[MediaType["Audio"] = 4] = "Audio";
5496
- })(MediaType = media.MediaType || (media.MediaType = {}));
5602
+ function openChat(openChatRequest) {
5603
+ return new Promise(function (resolve) {
5604
+ ensureInitialized(FrameContexts.content);
5605
+ if (!isSupported()) {
5606
+ throw errorNotSupportedOnPlatform;
5607
+ }
5608
+ if (runtime.isLegacyTeams) {
5609
+ resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat([openChatRequest.user], undefined /*topic*/, openChatRequest.message)));
5610
+ }
5611
+ else {
5612
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
5613
+ members: openChatRequest.user,
5614
+ message: openChatRequest.message,
5615
+ });
5616
+ resolve(sendPromise);
5617
+ }
5618
+ });
5619
+ }
5620
+ chat.openChat = openChat;
5497
5621
  /**
5498
- * ID contains a mapping for content uri on platform's side, URL is generic
5622
+ * Allows the user to create a chat with multiple users (2+) and allows
5623
+ * for the user to specify a message and name the topic of the conversation. If
5624
+ * only 1 user is provided into users array default back to origin openChat.
5625
+ *
5626
+ * @param openChatRequest: {@link OpenGroupChatRequest} - a request object that contains a list of user emails as well as optional parameters for message and topic (display name for the group chat).
5627
+ *
5628
+ * @returns Promise resolved upon completion
5499
5629
  */
5500
- var ImageUriType;
5501
- (function (ImageUriType) {
5502
- ImageUriType[ImageUriType["ID"] = 1] = "ID";
5503
- ImageUriType[ImageUriType["URL"] = 2] = "URL";
5504
- })(ImageUriType = media.ImageUriType || (media.ImageUriType = {}));
5630
+ function openGroupChat(openChatRequest) {
5631
+ return new Promise(function (resolve) {
5632
+ if (openChatRequest.users.length < 1) {
5633
+ throw Error('OpenGroupChat Failed: No users specified');
5634
+ }
5635
+ if (openChatRequest.users.length === 1) {
5636
+ var chatRequest = {
5637
+ user: openChatRequest.users[0],
5638
+ message: openChatRequest.message,
5639
+ };
5640
+ openChat(chatRequest);
5641
+ }
5642
+ else {
5643
+ ensureInitialized(FrameContexts.content);
5644
+ if (!isSupported()) {
5645
+ throw errorNotSupportedOnPlatform;
5646
+ }
5647
+ if (runtime.isLegacyTeams) {
5648
+ resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat(openChatRequest.users, openChatRequest.topic, openChatRequest.message)));
5649
+ }
5650
+ else {
5651
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
5652
+ members: openChatRequest.users,
5653
+ message: openChatRequest.message,
5654
+ topic: openChatRequest.topic,
5655
+ });
5656
+ resolve(sendPromise);
5657
+ }
5658
+ }
5659
+ });
5660
+ }
5661
+ chat.openGroupChat = openGroupChat;
5662
+ function isSupported() {
5663
+ return runtime.supports.chat ? true : false;
5664
+ }
5665
+ chat.isSupported = isSupported;
5666
+ })(chat || (chat = {}));
5667
+
5668
+ ;// CONCATENATED MODULE: ./src/public/geoLocation.ts
5669
+
5670
+
5671
+
5672
+
5673
+
5674
+ /**
5675
+ * Namespace to interact with the geoLocation module-specific part of the SDK. This is the newer version of location module.
5676
+ *
5677
+ * @beta
5678
+ */
5679
+ var geoLocation;
5680
+ (function (geoLocation) {
5505
5681
  /**
5506
- * Specifies the image output formats.
5682
+ * Fetches current user coordinates
5683
+ * @returns Promise that will resolve with {@link geoLocation.Location} object or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5684
+ *
5685
+ * @beta
5507
5686
  */
5508
- var ImageOutputFormats;
5509
- (function (ImageOutputFormats) {
5510
- ImageOutputFormats[ImageOutputFormats["IMAGE"] = 1] = "IMAGE";
5511
- ImageOutputFormats[ImageOutputFormats["PDF"] = 2] = "PDF";
5512
- })(ImageOutputFormats = media.ImageOutputFormats || (media.ImageOutputFormats = {}));
5687
+ function getCurrentLocation() {
5688
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5689
+ if (!isSupported()) {
5690
+ throw errorNotSupportedOnPlatform;
5691
+ }
5692
+ return sendAndHandleSdkError('location.getLocation', { allowChooseLocation: false, showMap: false });
5693
+ }
5694
+ geoLocation.getCurrentLocation = getCurrentLocation;
5513
5695
  /**
5514
- * Select an attachment using camera/gallery
5696
+ * Checks whether or not location has user permission
5515
5697
  *
5516
- * @param mediaInputs - The input params to customize the media to be selected
5517
- * @param callback - The callback to invoke after fetching the media
5698
+ * @returns Promise that will resolve with true if the user had granted the app permission to location information, or with false otherwise,
5699
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5700
+ *
5701
+ * @beta
5518
5702
  */
5519
- function selectMedia(mediaInputs, callback) {
5520
- if (!callback) {
5521
- throw new Error('[select Media] Callback cannot be null');
5522
- }
5703
+ function hasPermission() {
5523
5704
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5524
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5525
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5526
- callback(oldPlatformError, null);
5527
- return;
5528
- }
5529
- try {
5530
- throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
5531
- }
5532
- catch (err) {
5533
- callback(err, null);
5534
- return;
5705
+ if (!isSupported()) {
5706
+ throw errorNotSupportedOnPlatform;
5535
5707
  }
5536
- if (!validateSelectMediaInputs(mediaInputs)) {
5537
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5538
- callback(invalidInput, null);
5539
- return;
5708
+ var permissions = DevicePermission.GeoLocation;
5709
+ return new Promise(function (resolve) {
5710
+ resolve(sendAndHandleSdkError('permissions.has', permissions));
5711
+ });
5712
+ }
5713
+ geoLocation.hasPermission = hasPermission;
5714
+ /**
5715
+ * Requests user permission for location
5716
+ *
5717
+ * @returns true if the user consented permission for location, false otherwise
5718
+ * @returns Promise that will resolve with true if the user consented permission for location, or with false otherwise,
5719
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5720
+ *
5721
+ * @beta
5722
+ */
5723
+ function requestPermission() {
5724
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5725
+ if (!isSupported()) {
5726
+ throw errorNotSupportedOnPlatform;
5540
5727
  }
5541
- var params = [mediaInputs];
5542
- // What comes back from native as attachments would just be objects and will be missing getMedia method on them
5543
- sendMessageToParent('selectMedia', params, function (err, localAttachments, mediaEvent) {
5544
- // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5545
- if (mediaEvent) {
5546
- if (isVideoControllerRegistered(mediaInputs)) {
5547
- mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5548
- }
5549
- return;
5550
- }
5551
- // Media Attachments are final response to selectMedia
5552
- if (!localAttachments) {
5553
- callback(err, null);
5554
- return;
5555
- }
5556
- var mediaArray = [];
5557
- for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5558
- var attachment = localAttachments_1[_i];
5559
- mediaArray.push(new Media(attachment));
5560
- }
5561
- callback(err, mediaArray);
5728
+ var permissions = DevicePermission.GeoLocation;
5729
+ return new Promise(function (resolve) {
5730
+ resolve(sendAndHandleSdkError('permissions.request', permissions));
5562
5731
  });
5563
5732
  }
5564
- media.selectMedia = selectMedia;
5733
+ geoLocation.requestPermission = requestPermission;
5734
+ /**
5735
+ * Checks if geoLocation capability is supported by the host
5736
+ *
5737
+ * @returns boolean to represent whether geoLocation is supported
5738
+ *
5739
+ * @beta
5740
+ */
5741
+ function isSupported() {
5742
+ return runtime.supports.geoLocation && runtime.supports.permissions ? true : false;
5743
+ }
5744
+ geoLocation.isSupported = isSupported;
5565
5745
  /**
5566
- * View images using native image viewer
5746
+ * Namespace to interact with the location on map module-specific part of the SDK.
5567
5747
  *
5568
- * @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
5569
- * @param callback - returns back error if encountered, returns null in case of success
5748
+ * @beta
5570
5749
  */
5571
- function viewImages(uriList, callback) {
5572
- if (!callback) {
5573
- throw new Error('[view images] Callback cannot be null');
5750
+ var map;
5751
+ (function (map) {
5752
+ /**
5753
+ * Allows user to choose location on map
5754
+ *
5755
+ * @returns Promise that will resolve with {@link geoLocation.Location} object chosen by the user or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5756
+ *
5757
+ * @beta
5758
+ */
5759
+ function chooseLocation() {
5760
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5761
+ if (!isSupported()) {
5762
+ throw errorNotSupportedOnPlatform;
5763
+ }
5764
+ return sendAndHandleSdkError('location.getLocation', { allowChooseLocation: true, showMap: true });
5574
5765
  }
5575
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5576
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5577
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5578
- callback(oldPlatformError);
5579
- return;
5766
+ map.chooseLocation = chooseLocation;
5767
+ /**
5768
+ * Shows the location on map corresponding to the given coordinates
5769
+ *
5770
+ * @param location - Location to be shown on the map
5771
+ * @returns Promise that resolves when the location dialog has been closed or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5772
+ *
5773
+ * @beta
5774
+ */
5775
+ function showLocation(location) {
5776
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5777
+ if (!isSupported()) {
5778
+ throw errorNotSupportedOnPlatform;
5779
+ }
5780
+ if (!location) {
5781
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5782
+ }
5783
+ return sendAndHandleSdkError('location.showLocation', location);
5580
5784
  }
5581
- if (!validateViewImagesInput(uriList)) {
5582
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5583
- callback(invalidInput);
5584
- return;
5785
+ map.showLocation = showLocation;
5786
+ /**
5787
+ * Checks if geoLocation.map capability is supported by the host
5788
+ *
5789
+ * @returns boolean to represent whether geoLocation.map is supported
5790
+ *
5791
+ * @beta
5792
+ */
5793
+ function isSupported() {
5794
+ return runtime.supports.geoLocation && runtime.supports.geoLocation.map && runtime.supports.permissions
5795
+ ? true
5796
+ : false;
5585
5797
  }
5586
- var params = [uriList];
5587
- sendMessageToParent('viewImages', params, callback);
5798
+ map.isSupported = isSupported;
5799
+ })(map = geoLocation.map || (geoLocation.map = {}));
5800
+ })(geoLocation || (geoLocation = {}));
5801
+
5802
+ ;// CONCATENATED MODULE: ./src/public/appWindow.ts
5803
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
5804
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5805
+ /* eslint-disable @typescript-eslint/ban-types */
5806
+
5807
+
5808
+
5809
+
5810
+
5811
+ var ChildAppWindow = /** @class */ (function () {
5812
+ function ChildAppWindow() {
5588
5813
  }
5589
- media.viewImages = viewImages;
5590
5814
  /**
5591
- * Scan Barcode/QRcode using camera
5815
+ * Send a message to the ChildAppWindow.
5592
5816
  *
5593
- * @remarks
5594
- * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5817
+ * @param message - The message to send
5818
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
5819
+ */
5820
+ ChildAppWindow.prototype.postMessage = function (message, onComplete) {
5821
+ ensureInitialized();
5822
+ sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
5823
+ };
5824
+ /**
5825
+ * Add a listener that will be called when an event is received from the ChildAppWindow.
5595
5826
  *
5596
- * @param callback - callback to invoke after scanning the barcode
5597
- * @param config - optional input configuration to customize the barcode scanning experience
5827
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
5828
+ * @param listener - The listener that will be called
5598
5829
  */
5599
- function scanBarCode(callback, config) {
5600
- if (!callback) {
5601
- throw new Error('[media.scanBarCode] Callback cannot be null');
5602
- }
5603
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5604
- if (GlobalVars.hostClientType === HostClientType.desktop ||
5605
- GlobalVars.hostClientType === HostClientType.web ||
5606
- GlobalVars.hostClientType === HostClientType.rigel ||
5607
- GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5608
- GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5609
- GlobalVars.hostClientType === HostClientType.teamsPhones ||
5610
- GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5611
- var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5612
- callback(notSupportedError, null);
5613
- return;
5614
- }
5615
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5616
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5617
- callback(oldPlatformError, null);
5618
- return;
5619
- }
5620
- if (!validateScanBarCodeInput(config)) {
5621
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5622
- callback(invalidInput, null);
5623
- return;
5830
+ ChildAppWindow.prototype.addEventListener = function (type, listener) {
5831
+ ensureInitialized();
5832
+ if (type === 'message') {
5833
+ registerHandler('messageForParent', listener);
5624
5834
  }
5625
- sendMessageToParent('media.scanBarCode', [config], callback);
5835
+ };
5836
+ return ChildAppWindow;
5837
+ }());
5838
+
5839
+ var ParentAppWindow = /** @class */ (function () {
5840
+ function ParentAppWindow() {
5626
5841
  }
5627
- media.scanBarCode = scanBarCode;
5628
- })(media || (media = {}));
5842
+ Object.defineProperty(ParentAppWindow, "Instance", {
5843
+ get: function () {
5844
+ // Do you need arguments? Make it a regular method instead.
5845
+ return this._instance || (this._instance = new this());
5846
+ },
5847
+ enumerable: false,
5848
+ configurable: true
5849
+ });
5850
+ /**
5851
+ * Send a message to the ParentAppWindow.
5852
+ *
5853
+ * @param message - The message to send
5854
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
5855
+ */
5856
+ ParentAppWindow.prototype.postMessage = function (message, onComplete) {
5857
+ ensureInitialized(FrameContexts.task);
5858
+ sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
5859
+ };
5860
+ /**
5861
+ * Add a listener that will be called when an event is received from the ParentAppWindow.
5862
+ *
5863
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
5864
+ * @param listener - The listener that will be called
5865
+ */
5866
+ ParentAppWindow.prototype.addEventListener = function (type, listener) {
5867
+ ensureInitialized(FrameContexts.task);
5868
+ if (type === 'message') {
5869
+ registerHandler('messageForChild', listener);
5870
+ }
5871
+ };
5872
+ return ParentAppWindow;
5873
+ }());
5874
+
5629
5875
 
5630
5876
  ;// CONCATENATED MODULE: ./src/public/location.ts
5631
5877
 
@@ -5634,48 +5880,75 @@ var media;
5634
5880
 
5635
5881
 
5636
5882
 
5637
-
5883
+ /**
5884
+ * @deprecated
5885
+ * As of 2.1.0, please use geoLocation namespace.
5886
+ *
5887
+ * Namespace to interact with the location module-specific part of the SDK.
5888
+ */
5638
5889
  var location_location;
5639
5890
  (function (location_1) {
5891
+ /**
5892
+ * @deprecated
5893
+ * As of 2.1.0, please use one of the following functions:
5894
+ * - {@link geoLocation.getCurrentLocation geoLocation.getCurrentLocation(): Promise\<Location\>} to get the current location.
5895
+ * - {@link geoLocation.map.chooseLocation geoLocation.map.chooseLocation(): Promise\<Location\>} to choose location on map.
5896
+ *
5897
+ * Fetches user location
5898
+ * @param props {@link LocationProps} - Specifying how the location request is handled
5899
+ * @param callback - Callback to invoke when current user location is fetched
5900
+ */
5640
5901
  function getLocation(props, callback) {
5902
+ if (!callback) {
5903
+ throw new Error('[location.getLocation] Callback cannot be null');
5904
+ }
5641
5905
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5642
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(getLocationHelper, callback, props);
5906
+ if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5907
+ throw { errorCode: ErrorCode.OLD_PLATFORM };
5908
+ }
5909
+ if (!props) {
5910
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5911
+ }
5912
+ if (!isSupported()) {
5913
+ throw errorNotSupportedOnPlatform;
5914
+ }
5915
+ sendMessageToParent('location.getLocation', [props], callback);
5643
5916
  }
5644
5917
  location_1.getLocation = getLocation;
5645
- function getLocationHelper(props) {
5646
- return new Promise(function (resolve) {
5647
- if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5648
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5649
- }
5650
- if (!props) {
5651
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5652
- }
5653
- if (!isSupported()) {
5654
- throw errorNotSupportedOnPlatform;
5655
- }
5656
- resolve(sendAndHandleSdkError('location.getLocation', props));
5657
- });
5658
- }
5918
+ /**
5919
+ * @deprecated
5920
+ * As of 2.1.0, please use {@link geoLocation.map.showLocation geoLocation.map.showLocation(location: Location): Promise\<void\>} instead.
5921
+ *
5922
+ * Shows the location on map corresponding to the given coordinates
5923
+ *
5924
+ * @param location - Location to be shown on the map
5925
+ * @param callback - Callback to invoke when the location is opened on map
5926
+ */
5659
5927
  function showLocation(location, callback) {
5928
+ if (!callback) {
5929
+ throw new Error('[location.showLocation] Callback cannot be null');
5930
+ }
5660
5931
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5661
- return callCallbackWithErrorOrBooleanFromPromiseAndReturnPromise(showLocationHelper, callback, location);
5932
+ if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5933
+ throw { errorCode: ErrorCode.OLD_PLATFORM };
5934
+ }
5935
+ if (!location) {
5936
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5937
+ }
5938
+ if (!isSupported()) {
5939
+ throw errorNotSupportedOnPlatform;
5940
+ }
5941
+ sendMessageToParent('location.showLocation', [location], callback);
5662
5942
  }
5663
5943
  location_1.showLocation = showLocation;
5664
- function showLocationHelper(location) {
5665
- return new Promise(function (resolve) {
5666
- if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5667
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5668
- }
5669
- if (!location) {
5670
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5671
- }
5672
- if (!isSupported()) {
5673
- throw errorNotSupportedOnPlatform;
5674
- }
5675
- resolve(sendAndHandleSdkError('location.showLocation', location));
5676
- });
5677
- }
5678
- location_1.showLocationHelper = showLocationHelper;
5944
+ /**
5945
+ * @deprecated
5946
+ * As of 2.1.0, please use geoLocation namespace, and use {@link geoLocation.isSupported geoLocation.isSupported: boolean} to check if geoLocation is supported.
5947
+ *
5948
+ * Checks if Location capability is supported by the host
5949
+ *
5950
+ * @returns boolean to represent whether Location is supported
5951
+ */
5679
5952
  function isSupported() {
5680
5953
  return runtime.supports.location ? true : false;
5681
5954
  }
@@ -6269,18 +6542,21 @@ var profile;
6269
6542
 
6270
6543
  /**
6271
6544
  * Namespace to video extensibility of the SDK
6545
+ * @beta
6272
6546
  */
6273
6547
  var video;
6274
6548
  (function (video) {
6275
6549
  /**
6276
6550
  * Video frame format enum, currently only support NV12
6551
+ * @beta
6277
6552
  */
6278
6553
  var VideoFrameFormat;
6279
6554
  (function (VideoFrameFormat) {
6280
6555
  VideoFrameFormat[VideoFrameFormat["NV12"] = 0] = "NV12";
6281
6556
  })(VideoFrameFormat = video.VideoFrameFormat || (video.VideoFrameFormat = {}));
6282
6557
  /**
6283
- * Video effect change type enum
6558
+ * Video effect change type enum
6559
+ * @beta
6284
6560
  */
6285
6561
  var EffectChangeType;
6286
6562
  (function (EffectChangeType) {
@@ -6295,6 +6571,7 @@ var video;
6295
6571
  })(EffectChangeType = video.EffectChangeType || (video.EffectChangeType = {}));
6296
6572
  /**
6297
6573
  * Register to read the video frames in Permissions section
6574
+ * @beta
6298
6575
  * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
6299
6576
  * @param config - VideoFrameConfig to customize generated video frame parameters
6300
6577
  */
@@ -6312,10 +6589,10 @@ var video;
6312
6589
  }
6313
6590
  video.registerForVideoFrame = registerForVideoFrame;
6314
6591
  /**
6315
- * video extension should call this to notify host client that the current selected effect parameter changed.
6592
+ * Video extension should call this to notify host client that the current selected effect parameter changed.
6316
6593
  * If it's pre-meeting, host client will call videoEffectCallback immediately then use the videoEffect.
6317
6594
  * If it's the in-meeting scenario, we will call videoEffectCallback when apply button clicked.
6318
- *
6595
+ * @beta
6319
6596
  * @param effectChangeType - the effect change type.
6320
6597
  * @param effectId - Newly selected effect id.
6321
6598
  */
@@ -6329,6 +6606,7 @@ var video;
6329
6606
  video.notifySelectedVideoEffectChanged = notifySelectedVideoEffectChanged;
6330
6607
  /**
6331
6608
  * Register the video effect callback, host client uses this to notify the video extension the new video effect will by applied
6609
+ * @beta
6332
6610
  * @param callback - The VideoEffectCallback to invoke when registerForVideoEffect has completed
6333
6611
  */
6334
6612
  function registerForVideoEffect(callback) {
@@ -6342,12 +6620,14 @@ var video;
6342
6620
  /**
6343
6621
  * Sending notification to host client finished the video frame processing, now host client can render this video frame
6344
6622
  * or pass the video frame to next one in video pipeline
6623
+ * @beta
6345
6624
  */
6346
6625
  function notifyVideoFrameProcessed() {
6347
6626
  sendMessageToParent('video.videoFrameProcessed');
6348
6627
  }
6349
6628
  /**
6350
6629
  * Sending error notification to host client
6630
+ * @beta
6351
6631
  * @param errorMessage - The error message that will be sent to the host
6352
6632
  */
6353
6633
  function notifyError(errorMessage) {
@@ -6355,6 +6635,7 @@ var video;
6355
6635
  }
6356
6636
  /**
6357
6637
  * Checks if video capability is supported by the host
6638
+ * @beta
6358
6639
  * @returns true if the video capability is enabled in runtime.supports.video and
6359
6640
  * false if it is disabled
6360
6641
  */
@@ -6458,8 +6739,11 @@ var sharing;
6458
6739
 
6459
6740
 
6460
6741
 
6742
+
6461
6743
  /**
6462
6744
  * Namespace to interact with the stage view specific part of the SDK.
6745
+ *
6746
+ * @beta
6463
6747
  */
6464
6748
  var stageView;
6465
6749
  (function (stageView) {
@@ -6468,12 +6752,16 @@ var stageView;
6468
6752
  * Feature is under development
6469
6753
  *
6470
6754
  * Opens a stage view to display a Teams application
6755
+ * @beta
6471
6756
  * @param stageViewParams - The parameters to pass into the stage view.
6472
6757
  * @returns Promise that resolves or rejects with an error once the stage view is closed.
6473
6758
  */
6474
6759
  function open(stageViewParams) {
6475
6760
  return new Promise(function (resolve) {
6476
6761
  ensureInitialized(FrameContexts.content);
6762
+ if (!isSupported()) {
6763
+ throw errorNotSupportedOnPlatform;
6764
+ }
6477
6765
  if (!stageViewParams) {
6478
6766
  throw new Error('[stageView.open] Stage view params cannot be null');
6479
6767
  }
@@ -6481,8 +6769,59 @@ var stageView;
6481
6769
  });
6482
6770
  }
6483
6771
  stageView.open = open;
6772
+ /**
6773
+ * Checks if stageView capability is supported by the host
6774
+ * @beta
6775
+ * @returns true if the stageView capability is enabled in runtime.supports.stageView and
6776
+ * false if it is disabled
6777
+ */
6778
+ function isSupported() {
6779
+ return runtime.supports.stageView ? true : false;
6780
+ }
6781
+ stageView.isSupported = isSupported;
6484
6782
  })(stageView || (stageView = {}));
6485
6783
 
6784
+ ;// CONCATENATED MODULE: ./src/public/webStorage.ts
6785
+
6786
+
6787
+
6788
+
6789
+ /**
6790
+ * Contains functionality to allow web apps to store data in webview cache
6791
+ *
6792
+ * @beta
6793
+ */
6794
+ var webStorage;
6795
+ (function (webStorage) {
6796
+ /**
6797
+ * Checks if web storage gets cleared when a user logs out from host client
6798
+ *
6799
+ * @returns true is web storage gets cleared on logout and false if it does not
6800
+ *
6801
+ * @beta
6802
+ */
6803
+ function isWebStorageClearedOnUserLogOut() {
6804
+ ensureInitialized();
6805
+ // return true as web storage is always cleared on desktop.
6806
+ if (GlobalVars.hostClientType === HostClientType.desktop) {
6807
+ return true;
6808
+ }
6809
+ return isSupported();
6810
+ }
6811
+ webStorage.isWebStorageClearedOnUserLogOut = isWebStorageClearedOnUserLogOut;
6812
+ /**
6813
+ * Checks if webStorage capability is supported by the host
6814
+ * @returns true if the webStorage capability is enabled in runtime.supports.webStorage and
6815
+ * false if it is disabled
6816
+ *
6817
+ * @beta
6818
+ */
6819
+ function isSupported() {
6820
+ return runtime.supports.webStorage ? true : false;
6821
+ }
6822
+ webStorage.isSupported = isSupported;
6823
+ })(webStorage || (webStorage = {}));
6824
+
6486
6825
  ;// CONCATENATED MODULE: ./src/public/call.ts
6487
6826
 
6488
6827
 
@@ -6509,9 +6848,9 @@ var call;
6509
6848
  function startCall(startCallParams) {
6510
6849
  return new Promise(function (resolve) {
6511
6850
  var _a;
6512
- ensureInitialized(FrameContexts.content);
6851
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
6513
6852
  if (!isSupported()) {
6514
- throw new Error('Not supported');
6853
+ throw errorNotSupportedOnPlatform;
6515
6854
  }
6516
6855
  if (runtime.isLegacyTeams) {
6517
6856
  resolve(sendAndHandleSdkError('executeDeepLink', createTeamsDeepLinkForCall(startCallParams.targets, (_a = startCallParams.requestedModalities) === null || _a === void 0 ? void 0 : _a.includes(CallModalities.Video), startCallParams.source)));
@@ -7187,26 +7526,27 @@ var tasks;
7187
7526
  /**
7188
7527
  * @deprecated
7189
7528
  * As of 2.0.0, please use {@link dialog.open dialog.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for url based dialogs
7190
- * and {@link dialog.bot.open dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot based dialogs.
7529
+ * and {@link dialog.bot.open dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot based dialogs. In Teams,
7530
+ * this function can be used for adaptive card based dialogs. Support for adaptive card based dialogs is coming to other hosts in the future.
7531
+ *
7191
7532
  * Allows an app to open the task module.
7192
7533
  *
7193
7534
  * @param taskInfo - An object containing the parameters of the task module
7194
7535
  * @param submitHandler - Handler to call when the task module is completed
7195
7536
  */
7196
7537
  function startTask(taskInfo, submitHandler) {
7538
+ var dialogSubmitHandler = submitHandler
7539
+ ? function (sdkResponse) { return submitHandler(sdkResponse.err, sdkResponse.result); }
7540
+ : undefined;
7197
7541
  if (taskInfo.card !== undefined || taskInfo.url === undefined) {
7198
7542
  ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
7199
7543
  sendMessageToParent('tasks.startTask', [taskInfo], submitHandler);
7200
7544
  }
7201
7545
  else if (taskInfo.completionBotId !== undefined) {
7202
- dialog.bot.open(getBotUrlDialogInfoFromTaskInfo(taskInfo), function (sdkResponse) {
7203
- return submitHandler(sdkResponse.err, sdkResponse.result);
7204
- });
7546
+ dialog.bot.open(getBotUrlDialogInfoFromTaskInfo(taskInfo), dialogSubmitHandler);
7205
7547
  }
7206
7548
  else {
7207
- dialog.open(getUrlDialogInfoFromTaskInfo(taskInfo), function (sdkResponse) {
7208
- return submitHandler(sdkResponse.err, sdkResponse.result);
7209
- });
7549
+ dialog.open(getUrlDialogInfoFromTaskInfo(taskInfo), dialogSubmitHandler);
7210
7550
  }
7211
7551
  return new ChildAppWindow();
7212
7552
  }
@@ -7318,6 +7658,9 @@ var tasks;
7318
7658
 
7319
7659
 
7320
7660
 
7661
+
7662
+
7663
+
7321
7664
 
7322
7665
 
7323
7666