@microsoft/teams-js 2.1.0-beta.4 → 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),
@@ -1123,7 +1125,7 @@ __webpack_require__.d(__webpack_exports__, {
1123
1125
  });
1124
1126
 
1125
1127
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1126
- var version = "2.1.0-beta.4";
1128
+ var version = "2.1.0-beta.5";
1127
1129
  /**
1128
1130
  * @hidden
1129
1131
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -1162,6 +1164,13 @@ var getUserJoinedTeamsSupportedAndroidClientVersion = '2.0.1';
1162
1164
  * @internal
1163
1165
  */
1164
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';
1165
1174
  /**
1166
1175
  * @hidden
1167
1176
  * This is the client version when people picker API is supported on mobile.
@@ -1341,6 +1350,12 @@ var ErrorCode;
1341
1350
  */
1342
1351
  ErrorCode[ErrorCode["SIZE_EXCEEDED"] = 10000] = "SIZE_EXCEEDED";
1343
1352
  })(ErrorCode || (ErrorCode = {}));
1353
+ /** @hidden */
1354
+ var DevicePermission;
1355
+ (function (DevicePermission) {
1356
+ DevicePermission["GeoLocation"] = "geolocation";
1357
+ DevicePermission["Media"] = "media";
1358
+ })(DevicePermission || (DevicePermission = {}));
1344
1359
 
1345
1360
  ;// CONCATENATED MODULE: ./src/public/constants.ts
1346
1361
  var HostClientType;
@@ -2356,6 +2371,7 @@ var runtime = {
2356
2371
  apiVersion: 1,
2357
2372
  supports: {
2358
2373
  appInstallDialog: undefined,
2374
+ barCode: undefined,
2359
2375
  calendar: undefined,
2360
2376
  call: undefined,
2361
2377
  chat: undefined,
@@ -2365,6 +2381,9 @@ var runtime = {
2365
2381
  bot: undefined,
2366
2382
  update: undefined,
2367
2383
  },
2384
+ geoLocation: {
2385
+ map: undefined,
2386
+ },
2368
2387
  location: undefined,
2369
2388
  logs: undefined,
2370
2389
  mail: undefined,
@@ -2380,9 +2399,11 @@ var runtime = {
2380
2399
  fullTrust: undefined,
2381
2400
  },
2382
2401
  people: undefined,
2402
+ permissions: undefined,
2383
2403
  profile: undefined,
2384
2404
  remoteCamera: undefined,
2385
2405
  sharing: undefined,
2406
+ stageView: undefined,
2386
2407
  teams: {
2387
2408
  fullTrust: {
2388
2409
  joinedTeams: undefined,
@@ -2419,6 +2440,7 @@ var teamsRuntimeConfig = {
2419
2440
  },
2420
2441
  remoteCamera: {},
2421
2442
  sharing: {},
2443
+ stageView: {},
2422
2444
  teams: {
2423
2445
  fullTrust: {},
2424
2446
  },
@@ -4834,463 +4856,96 @@ var appInstallDialog;
4834
4856
  appInstallDialog.isSupported = isSupported;
4835
4857
  })(appInstallDialog || (appInstallDialog = {}));
4836
4858
 
4837
- ;// CONCATENATED MODULE: ./src/public/chat.ts
4838
-
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
+ })();
4839
4876
 
4840
4877
 
4841
4878
 
4842
4879
 
4843
- /**
4844
- * Contains functionality to start chat with others
4845
- *
4846
- * @beta
4847
- */
4848
- var chat;
4849
- (function (chat) {
4850
- /**
4851
- * Allows the user to open a chat with a single user and allows
4852
- * for the user to specify the message they wish to send.
4853
- *
4854
- * @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
4855
- *
4856
- * @returns Promise resolved upon completion
4857
- */
4858
- function openChat(openChatRequest) {
4859
- return new Promise(function (resolve) {
4860
- ensureInitialized(FrameContexts.content);
4861
- if (!isSupported()) {
4862
- throw errorNotSupportedOnPlatform;
4863
- }
4864
- if (runtime.isLegacyTeams) {
4865
- resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat([openChatRequest.user], undefined /*topic*/, openChatRequest.message)));
4866
- }
4867
- else {
4868
- var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4869
- members: openChatRequest.user,
4870
- message: openChatRequest.message,
4871
- });
4872
- resolve(sendPromise);
4873
- }
4874
- });
4875
- }
4876
- chat.openChat = openChat;
4877
- /**
4878
- * Allows the user to create a chat with multiple users (2+) and allows
4879
- * for the user to specify a message and name the topic of the conversation. If
4880
- * only 1 user is provided into users array default back to origin openChat.
4881
- *
4882
- * @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).
4883
- *
4884
- * @returns Promise resolved upon completion
4885
- */
4886
- function openGroupChat(openChatRequest) {
4887
- return new Promise(function (resolve) {
4888
- if (openChatRequest.users.length < 1) {
4889
- throw Error('OpenGroupChat Failed: No users specified');
4890
- }
4891
- if (openChatRequest.users.length === 1) {
4892
- var chatRequest = {
4893
- user: openChatRequest.users[0],
4894
- message: openChatRequest.message,
4895
- };
4896
- openChat(chatRequest);
4897
- }
4898
- else {
4899
- ensureInitialized(FrameContexts.content);
4900
- if (!isSupported()) {
4901
- throw errorNotSupportedOnPlatform;
4902
- }
4903
- if (runtime.isLegacyTeams) {
4904
- resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat(openChatRequest.users, openChatRequest.topic, openChatRequest.message)));
4905
- }
4906
- else {
4907
- var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4908
- members: openChatRequest.users,
4909
- message: openChatRequest.message,
4910
- topic: openChatRequest.topic,
4911
- });
4912
- resolve(sendPromise);
4913
- }
4914
- }
4915
- });
4916
- }
4917
- chat.openGroupChat = openGroupChat;
4918
- function isSupported() {
4919
- return runtime.supports.chat ? true : false;
4920
- }
4921
- chat.isSupported = isSupported;
4922
- })(chat || (chat = {}));
4923
-
4924
- ;// CONCATENATED MODULE: ./src/public/appWindow.ts
4925
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
4926
- /* eslint-disable @typescript-eslint/no-explicit-any */
4927
- /* eslint-disable @typescript-eslint/ban-types */
4928
4880
 
4929
4881
 
4930
4882
 
4931
4883
 
4932
4884
 
4933
- var ChildAppWindow = /** @class */ (function () {
4934
- function ChildAppWindow() {
4935
- }
4885
+ var media;
4886
+ (function (media) {
4936
4887
  /**
4937
- * Send a message to the ChildAppWindow.
4938
- *
4939
- * @param message - The message to send
4940
- * @param onComplete - The callback to know if the postMessage has been success/failed.
4888
+ * Enum for file formats supported
4941
4889
  */
4942
- ChildAppWindow.prototype.postMessage = function (message, onComplete) {
4943
- ensureInitialized();
4944
- sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4945
- };
4890
+ var FileFormat;
4891
+ (function (FileFormat) {
4892
+ FileFormat["Base64"] = "base64";
4893
+ FileFormat["ID"] = "id";
4894
+ })(FileFormat = media.FileFormat || (media.FileFormat = {}));
4946
4895
  /**
4947
- * Add a listener that will be called when an event is received from the ChildAppWindow.
4948
- *
4949
- * @param type - The event to listen to. Currently the only supported type is 'message'.
4950
- * @param listener - The listener that will be called
4896
+ * File object that can be used to represent image or video or audio
4951
4897
  */
4952
- ChildAppWindow.prototype.addEventListener = function (type, listener) {
4953
- ensureInitialized();
4954
- if (type === 'message') {
4955
- registerHandler('messageForParent', listener);
4898
+ var File = /** @class */ (function () {
4899
+ function File() {
4956
4900
  }
4957
- };
4958
- return ChildAppWindow;
4959
- }());
4960
-
4961
- var ParentAppWindow = /** @class */ (function () {
4962
- function ParentAppWindow() {
4963
- }
4964
- Object.defineProperty(ParentAppWindow, "Instance", {
4965
- get: function () {
4966
- // Do you need arguments? Make it a regular method instead.
4967
- return this._instance || (this._instance = new this());
4968
- },
4969
- enumerable: false,
4970
- configurable: true
4971
- });
4901
+ return File;
4902
+ }());
4903
+ media.File = File;
4972
4904
  /**
4973
- * 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.
4974
4906
  *
4975
- * @param message - The message to send
4976
- * @param onComplete - The callback to know if the postMessage has been success/failed.
4977
- */
4978
- ParentAppWindow.prototype.postMessage = function (message, onComplete) {
4979
- ensureInitialized(FrameContexts.task);
4980
- sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4981
- };
4982
- /**
4983
- * 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.
4984
4912
  *
4985
- * @param type - The event to listen to. Currently the only supported type is 'message'.
4986
- * @param listener - The listener that will be called
4987
4913
  */
4988
- ParentAppWindow.prototype.addEventListener = function (type, listener) {
4989
- ensureInitialized(FrameContexts.task);
4990
- if (type === 'message') {
4991
- registerHandler('messageForChild', listener);
4914
+ function captureImage(callback) {
4915
+ if (!callback) {
4916
+ throw new Error('[captureImage] Callback cannot be null');
4992
4917
  }
4993
- };
4994
- return ParentAppWindow;
4995
- }());
4996
-
4997
-
4998
- ;// CONCATENATED MODULE: ./src/internal/mediaUtil.ts
4999
-
5000
-
5001
-
5002
- /**
5003
- * @hidden
5004
- * Helper function to create a blob from media chunks based on their sequence
5005
- *
5006
- * @internal
5007
- */
5008
- function createFile(assembleAttachment, mimeType) {
5009
- if (assembleAttachment == null || mimeType == null || assembleAttachment.length <= 0) {
5010
- 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);
5011
4930
  }
5012
- var file;
5013
- var sequence = 1;
5014
- assembleAttachment.sort(function (a, b) { return (a.sequence > b.sequence ? 1 : -1); });
5015
- assembleAttachment.forEach(function (item) {
5016
- if (item.sequence == sequence) {
5017
- if (file) {
5018
- file = new Blob([file, item.file], { type: mimeType });
5019
- }
5020
- else {
5021
- 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;
5022
4947
  }
5023
- sequence++;
5024
- }
5025
- });
5026
- return file;
5027
- }
5028
- /**
5029
- * @hidden
5030
- * Helper function to convert Media chunks into another object type which can be later assemebled
5031
- * Converts base 64 encoded string to byte array and then into an array of blobs
5032
- *
5033
- * @internal
5034
- */
5035
- function decodeAttachment(attachment, mimeType) {
5036
- if (attachment == null || mimeType == null) {
5037
- return null;
5038
- }
5039
- var decoded = atob(attachment.chunk);
5040
- var byteNumbers = new Array(decoded.length);
5041
- for (var i = 0; i < decoded.length; i++) {
5042
- byteNumbers[i] = decoded.charCodeAt(i);
5043
- }
5044
- var byteArray = new Uint8Array(byteNumbers);
5045
- var blob = new Blob([byteArray], { type: mimeType });
5046
- var assemble = {
5047
- sequence: attachment.chunkSequence,
5048
- file: blob,
5049
- };
5050
- return assemble;
5051
- }
5052
- /**
5053
- * @hidden
5054
- * Function throws an SdkError if the media call is not supported on current mobile version, else undefined.
5055
- * @throws an SdkError if the media call is not supported
5056
- * @internal
5057
- */
5058
- function throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs) {
5059
- if (isMediaCallForVideoAndImageInputs(mediaInputs)) {
5060
- throwExceptionIfMobileApiIsNotSupported(videoAndImageMediaAPISupportVersion);
5061
- }
5062
- else if (isMediaCallForNonFullScreenVideoMode(mediaInputs)) {
5063
- throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5064
- }
5065
- else if (isMediaCallForImageOutputFormats(mediaInputs)) {
5066
- throwExceptionIfMobileApiIsNotSupported(imageOutputFormatsAPISupportVersion);
5067
- }
5068
- }
5069
- /**
5070
- * @hidden
5071
- * Function returns true if the app has registered to listen to video controller events, else false.
5072
- *
5073
- * @internal
5074
- */
5075
- function isVideoControllerRegistered(mediaInputs) {
5076
- if (mediaInputs.mediaType == media.MediaType.Video &&
5077
- mediaInputs.videoProps &&
5078
- mediaInputs.videoProps.videoController) {
5079
- return true;
5080
- }
5081
- return false;
5082
- }
5083
- /**
5084
- * @hidden
5085
- * Returns true if the mediaInput params are valid and false otherwise
5086
- *
5087
- * @internal
5088
- */
5089
- function validateSelectMediaInputs(mediaInputs) {
5090
- if (mediaInputs == null || mediaInputs.maxMediaCount > 10) {
5091
- return false;
5092
- }
5093
- return true;
5094
- }
5095
- /**
5096
- * Returns true if the mediaInput params are called for mediatype Image and contains Image outputs formats, false otherwise
5097
- */
5098
- function isMediaCallForImageOutputFormats(mediaInputs) {
5099
- var _a;
5100
- if ((mediaInputs === null || mediaInputs === void 0 ? void 0 : mediaInputs.mediaType) == media.MediaType.Image && ((_a = mediaInputs === null || mediaInputs === void 0 ? void 0 : mediaInputs.imageProps) === null || _a === void 0 ? void 0 : _a.imageOutputFormats)) {
5101
- return true;
5102
- }
5103
- return false;
5104
- }
5105
- /**
5106
- * @hidden
5107
- * Returns true if the mediaInput params are called for mediatype VideoAndImage and false otherwise
5108
- *
5109
- * @internal
5110
- */
5111
- function isMediaCallForVideoAndImageInputs(mediaInputs) {
5112
- if (mediaInputs && (mediaInputs.mediaType == media.MediaType.VideoAndImage || mediaInputs.videoAndImageProps)) {
5113
- return true;
5114
- }
5115
- return false;
5116
- }
5117
- /**
5118
- * @hidden
5119
- * Returns true if the mediaInput params are called for non-full screen video mode and false otherwise
5120
- *
5121
- * @internal
5122
- */
5123
- function isMediaCallForNonFullScreenVideoMode(mediaInputs) {
5124
- if (mediaInputs &&
5125
- mediaInputs.mediaType == media.MediaType.Video &&
5126
- mediaInputs.videoProps &&
5127
- !mediaInputs.videoProps.isFullScreenMode) {
5128
- return true;
5129
- }
5130
- return false;
5131
- }
5132
- /**
5133
- * @hidden
5134
- * Returns true if the get Media params are valid and false otherwise
5135
- *
5136
- * @internal
5137
- */
5138
- function validateGetMediaInputs(mimeType, format, content) {
5139
- if (mimeType == null || format == null || format != media.FileFormat.ID || content == null) {
5140
- return false;
5141
- }
5142
- return true;
5143
- }
5144
- /**
5145
- * @hidden
5146
- * Returns true if the view images param is valid and false otherwise
5147
- *
5148
- * @internal
5149
- */
5150
- function validateViewImagesInput(uriList) {
5151
- if (uriList == null || uriList.length <= 0 || uriList.length > 10) {
5152
- return false;
5153
- }
5154
- return true;
5155
- }
5156
- /**
5157
- * @hidden
5158
- * Returns true if the scan barcode param is valid and false otherwise
5159
- *
5160
- * @internal
5161
- */
5162
- function validateScanBarCodeInput(barCodeConfig) {
5163
- if (barCodeConfig) {
5164
- if (barCodeConfig.timeOutIntervalInSec === null ||
5165
- barCodeConfig.timeOutIntervalInSec <= 0 ||
5166
- barCodeConfig.timeOutIntervalInSec > 60) {
5167
- return false;
5168
- }
5169
- }
5170
- return true;
5171
- }
5172
- /**
5173
- * @hidden
5174
- * Returns true if the people picker params are valid and false otherwise
5175
- *
5176
- * @internal
5177
- */
5178
- function validatePeoplePickerInput(peoplePickerInputs) {
5179
- if (peoplePickerInputs) {
5180
- if (peoplePickerInputs.title) {
5181
- if (typeof peoplePickerInputs.title !== 'string') {
5182
- return false;
5183
- }
5184
- }
5185
- if (peoplePickerInputs.setSelected) {
5186
- if (typeof peoplePickerInputs.setSelected !== 'object') {
5187
- return false;
5188
- }
5189
- }
5190
- if (peoplePickerInputs.openOrgWideSearchInChatOrChannel) {
5191
- if (typeof peoplePickerInputs.openOrgWideSearchInChatOrChannel !== 'boolean') {
5192
- return false;
5193
- }
5194
- }
5195
- if (peoplePickerInputs.singleSelect) {
5196
- if (typeof peoplePickerInputs.singleSelect !== 'boolean') {
5197
- return false;
5198
- }
5199
- }
5200
- }
5201
- return true;
5202
- }
5203
-
5204
- ;// CONCATENATED MODULE: ./src/public/media.ts
5205
- /* eslint-disable @typescript-eslint/explicit-member-accessibility */
5206
- var __extends = (undefined && undefined.__extends) || (function () {
5207
- var extendStatics = function (d, b) {
5208
- extendStatics = Object.setPrototypeOf ||
5209
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5210
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
5211
- return extendStatics(d, b);
5212
- };
5213
- return function (d, b) {
5214
- if (typeof b !== "function" && b !== null)
5215
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
5216
- extendStatics(d, b);
5217
- function __() { this.constructor = d; }
5218
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5219
- };
5220
- })();
5221
-
5222
-
5223
-
5224
-
5225
-
5226
-
5227
-
5228
-
5229
-
5230
- var media;
5231
- (function (media) {
5232
- /**
5233
- * Enum for file formats supported
5234
- */
5235
- var FileFormat;
5236
- (function (FileFormat) {
5237
- FileFormat["Base64"] = "base64";
5238
- FileFormat["ID"] = "id";
5239
- })(FileFormat = media.FileFormat || (media.FileFormat = {}));
5240
- /**
5241
- * File object that can be used to represent image or video or audio
5242
- */
5243
- var File = /** @class */ (function () {
5244
- function File() {
5245
- }
5246
- return File;
5247
- }());
5248
- media.File = File;
5249
- /**
5250
- * Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
5251
- *
5252
- * @params callback - Callback will be called with an @see SdkError if there are any.
5253
- * If error is null or undefined, the callback will be called with a collection of @see File objects
5254
- * @remarks
5255
- * Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
5256
- * Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5257
- *
5258
- */
5259
- function captureImage(callback) {
5260
- if (!callback) {
5261
- throw new Error('[captureImage] Callback cannot be null');
5262
- }
5263
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5264
- if (!GlobalVars.isFramelessWindow) {
5265
- var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5266
- callback(notSupportedError, undefined);
5267
- return;
5268
- }
5269
- if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
5270
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5271
- callback(oldPlatformError, undefined);
5272
- return;
5273
- }
5274
- sendMessageToParent('captureImage', callback);
5275
- }
5276
- media.captureImage = captureImage;
5277
- /**
5278
- * Media object returned by the select Media API
5279
- */
5280
- var Media = /** @class */ (function (_super) {
5281
- __extends(Media, _super);
5282
- function Media(that) {
5283
- if (that === void 0) { that = null; }
5284
- var _this = _super.call(this) || this;
5285
- if (that) {
5286
- _this.content = that.content;
5287
- _this.format = that.format;
5288
- _this.mimeType = that.mimeType;
5289
- _this.name = that.name;
5290
- _this.preview = that.preview;
5291
- _this.size = that.size;
5292
- }
5293
- return _this;
4948
+ return _this;
5294
4949
  }
5295
4950
  /**
5296
4951
  * Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
@@ -5550,94 +5205,673 @@ var media;
5550
5205
  callback(invalidInput, null);
5551
5206
  return;
5552
5207
  }
5553
- var params = [mediaInputs];
5554
- // What comes back from native as attachments would just be objects and will be missing getMedia method on them
5555
- sendMessageToParent('selectMedia', params, function (err, localAttachments, mediaEvent) {
5556
- // MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
5557
- if (mediaEvent) {
5558
- if (isVideoControllerRegistered(mediaInputs)) {
5559
- mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
5560
- }
5561
- return;
5562
- }
5563
- // Media Attachments are final response to selectMedia
5564
- if (!localAttachments) {
5565
- callback(err, null);
5566
- return;
5567
- }
5568
- var mediaArray = [];
5569
- for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
5570
- var attachment = localAttachments_1[_i];
5571
- mediaArray.push(new Media(attachment));
5572
- }
5573
- callback(err, mediaArray);
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
+ */
5337
+ function decodeAttachment(attachment, mimeType) {
5338
+ if (attachment == null || mimeType == null) {
5339
+ return null;
5340
+ }
5341
+ var decoded = atob(attachment.chunk);
5342
+ var byteNumbers = new Array(decoded.length);
5343
+ for (var i = 0; i < decoded.length; i++) {
5344
+ byteNumbers[i] = decoded.charCodeAt(i);
5345
+ }
5346
+ var byteArray = new Uint8Array(byteNumbers);
5347
+ var blob = new Blob([byteArray], { type: mimeType });
5348
+ var assemble = {
5349
+ sequence: attachment.chunkSequence,
5350
+ file: blob,
5351
+ };
5352
+ return assemble;
5353
+ }
5354
+ /**
5355
+ * @hidden
5356
+ * Function throws an SdkError if the media call is not supported on current mobile version, else undefined.
5357
+ * @throws an SdkError if the media call is not supported
5358
+ * @internal
5359
+ */
5360
+ function throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs) {
5361
+ if (isMediaCallForVideoAndImageInputs(mediaInputs)) {
5362
+ throwExceptionIfMobileApiIsNotSupported(videoAndImageMediaAPISupportVersion);
5363
+ }
5364
+ else if (isMediaCallForNonFullScreenVideoMode(mediaInputs)) {
5365
+ throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
5366
+ }
5367
+ else if (isMediaCallForImageOutputFormats(mediaInputs)) {
5368
+ throwExceptionIfMobileApiIsNotSupported(imageOutputFormatsAPISupportVersion);
5369
+ }
5370
+ }
5371
+ /**
5372
+ * @hidden
5373
+ * Function returns true if the app has registered to listen to video controller events, else false.
5374
+ *
5375
+ * @internal
5376
+ */
5377
+ function isVideoControllerRegistered(mediaInputs) {
5378
+ if (mediaInputs.mediaType == media.MediaType.Video &&
5379
+ mediaInputs.videoProps &&
5380
+ mediaInputs.videoProps.videoController) {
5381
+ return true;
5382
+ }
5383
+ return false;
5384
+ }
5385
+ /**
5386
+ * @hidden
5387
+ * Returns true if the mediaInput params are valid and false otherwise
5388
+ *
5389
+ * @internal
5390
+ */
5391
+ function validateSelectMediaInputs(mediaInputs) {
5392
+ if (mediaInputs == null || mediaInputs.maxMediaCount > 10) {
5393
+ return false;
5394
+ }
5395
+ return true;
5396
+ }
5397
+ /**
5398
+ * Returns true if the mediaInput params are called for mediatype Image and contains Image outputs formats, false otherwise
5399
+ */
5400
+ function isMediaCallForImageOutputFormats(mediaInputs) {
5401
+ var _a;
5402
+ if ((mediaInputs === null || mediaInputs === void 0 ? void 0 : mediaInputs.mediaType) == media.MediaType.Image && ((_a = mediaInputs === null || mediaInputs === void 0 ? void 0 : mediaInputs.imageProps) === null || _a === void 0 ? void 0 : _a.imageOutputFormats)) {
5403
+ return true;
5404
+ }
5405
+ return false;
5406
+ }
5407
+ /**
5408
+ * @hidden
5409
+ * Returns true if the mediaInput params are called for mediatype VideoAndImage and false otherwise
5410
+ *
5411
+ * @internal
5412
+ */
5413
+ function isMediaCallForVideoAndImageInputs(mediaInputs) {
5414
+ if (mediaInputs && (mediaInputs.mediaType == media.MediaType.VideoAndImage || mediaInputs.videoAndImageProps)) {
5415
+ return true;
5416
+ }
5417
+ return false;
5418
+ }
5419
+ /**
5420
+ * @hidden
5421
+ * Returns true if the mediaInput params are called for non-full screen video mode and false otherwise
5422
+ *
5423
+ * @internal
5424
+ */
5425
+ function isMediaCallForNonFullScreenVideoMode(mediaInputs) {
5426
+ if (mediaInputs &&
5427
+ mediaInputs.mediaType == media.MediaType.Video &&
5428
+ mediaInputs.videoProps &&
5429
+ !mediaInputs.videoProps.isFullScreenMode) {
5430
+ return true;
5431
+ }
5432
+ return false;
5433
+ }
5434
+ /**
5435
+ * @hidden
5436
+ * Returns true if the get Media params are valid and false otherwise
5437
+ *
5438
+ * @internal
5439
+ */
5440
+ function validateGetMediaInputs(mimeType, format, content) {
5441
+ if (mimeType == null || format == null || format != media.FileFormat.ID || content == null) {
5442
+ return false;
5443
+ }
5444
+ return true;
5445
+ }
5446
+ /**
5447
+ * @hidden
5448
+ * Returns true if the view images param is valid and false otherwise
5449
+ *
5450
+ * @internal
5451
+ */
5452
+ function validateViewImagesInput(uriList) {
5453
+ if (uriList == null || uriList.length <= 0 || uriList.length > 10) {
5454
+ return false;
5455
+ }
5456
+ return true;
5457
+ }
5458
+ /**
5459
+ * @hidden
5460
+ * Returns true if the scan barcode param is valid and false otherwise
5461
+ *
5462
+ * @internal
5463
+ */
5464
+ function validateScanBarCodeInput(barCodeConfig) {
5465
+ if (barCodeConfig) {
5466
+ if (barCodeConfig.timeOutIntervalInSec === null ||
5467
+ barCodeConfig.timeOutIntervalInSec <= 0 ||
5468
+ barCodeConfig.timeOutIntervalInSec > 60) {
5469
+ return false;
5470
+ }
5471
+ }
5472
+ return true;
5473
+ }
5474
+ /**
5475
+ * @hidden
5476
+ * Returns true if the people picker params are valid and false otherwise
5477
+ *
5478
+ * @internal
5479
+ */
5480
+ function validatePeoplePickerInput(peoplePickerInputs) {
5481
+ if (peoplePickerInputs) {
5482
+ if (peoplePickerInputs.title) {
5483
+ if (typeof peoplePickerInputs.title !== 'string') {
5484
+ return false;
5485
+ }
5486
+ }
5487
+ if (peoplePickerInputs.setSelected) {
5488
+ if (typeof peoplePickerInputs.setSelected !== 'object') {
5489
+ return false;
5490
+ }
5491
+ }
5492
+ if (peoplePickerInputs.openOrgWideSearchInChatOrChannel) {
5493
+ if (typeof peoplePickerInputs.openOrgWideSearchInChatOrChannel !== 'boolean') {
5494
+ return false;
5495
+ }
5496
+ }
5497
+ if (peoplePickerInputs.singleSelect) {
5498
+ if (typeof peoplePickerInputs.singleSelect !== 'boolean') {
5499
+ return false;
5500
+ }
5501
+ }
5502
+ }
5503
+ return true;
5504
+ }
5505
+
5506
+ ;// CONCATENATED MODULE: ./src/public/barCode.ts
5507
+
5508
+
5509
+
5510
+
5511
+
5512
+
5513
+ /**
5514
+ * Namespace to interact with the barcode scanning-specific part of the SDK.
5515
+ */
5516
+ var barCode;
5517
+ (function (barCode) {
5518
+ /**
5519
+ * Scan Barcode or QRcode using camera
5520
+ *
5521
+ * @param barCodeConfig - input configuration to customize the barcode scanning experience
5522
+ *
5523
+ * @returns a scanned code
5524
+ */
5525
+ function scanBarCode(barCodeConfig) {
5526
+ return new Promise(function (resolve) {
5527
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5528
+ if (!isSupported()) {
5529
+ throw errorNotSupportedOnPlatform;
5530
+ }
5531
+ if (!validateScanBarCodeInput(barCodeConfig)) {
5532
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5533
+ }
5534
+ resolve(sendAndHandleSdkError('media.scanBarCode', barCodeConfig));
5535
+ });
5536
+ }
5537
+ barCode.scanBarCode = scanBarCode;
5538
+ /**
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
5542
+ */
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;
5554
+ /**
5555
+ * Requests user permission for media
5556
+ *
5557
+ * @returns true if the user has granted the app permission to the media, false otherwise
5558
+ */
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;
5570
+ /**
5571
+ * Checks if barCode capability is supported by the host
5572
+ *
5573
+ * @returns boolean to represent whether barCode is supported
5574
+ */
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) {
5594
+ /**
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
5601
+ */
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;
5621
+ /**
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
5629
+ */
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) {
5681
+ /**
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
5686
+ */
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;
5695
+ /**
5696
+ * Checks whether or not location has user permission
5697
+ *
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
5702
+ */
5703
+ function hasPermission() {
5704
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5705
+ if (!isSupported()) {
5706
+ throw errorNotSupportedOnPlatform;
5707
+ }
5708
+ var permissions = DevicePermission.GeoLocation;
5709
+ return new Promise(function (resolve) {
5710
+ resolve(sendAndHandleSdkError('permissions.has', permissions));
5574
5711
  });
5575
5712
  }
5576
- media.selectMedia = selectMedia;
5713
+ geoLocation.hasPermission = hasPermission;
5577
5714
  /**
5578
- * View images using native image viewer
5715
+ * Requests user permission for location
5579
5716
  *
5580
- * @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
5581
- * @param callback - returns back error if encountered, returns null in case of success
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
5582
5722
  */
5583
- function viewImages(uriList, callback) {
5584
- if (!callback) {
5585
- throw new Error('[view images] Callback cannot be null');
5586
- }
5723
+ function requestPermission() {
5587
5724
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5588
- if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
5589
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5590
- callback(oldPlatformError);
5591
- return;
5592
- }
5593
- if (!validateViewImagesInput(uriList)) {
5594
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5595
- callback(invalidInput);
5596
- return;
5725
+ if (!isSupported()) {
5726
+ throw errorNotSupportedOnPlatform;
5597
5727
  }
5598
- var params = [uriList];
5599
- sendMessageToParent('viewImages', params, callback);
5728
+ var permissions = DevicePermission.GeoLocation;
5729
+ return new Promise(function (resolve) {
5730
+ resolve(sendAndHandleSdkError('permissions.request', permissions));
5731
+ });
5600
5732
  }
5601
- media.viewImages = viewImages;
5733
+ geoLocation.requestPermission = requestPermission;
5602
5734
  /**
5603
- * Scan Barcode/QRcode using camera
5735
+ * Checks if geoLocation capability is supported by the host
5604
5736
  *
5605
- * @remarks
5606
- * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5737
+ * @returns boolean to represent whether geoLocation is supported
5607
5738
  *
5608
- * @param callback - callback to invoke after scanning the barcode
5609
- * @param config - optional input configuration to customize the barcode scanning experience
5739
+ * @beta
5610
5740
  */
5611
- function scanBarCode(callback, config) {
5612
- if (!callback) {
5613
- throw new Error('[media.scanBarCode] Callback cannot be null');
5741
+ function isSupported() {
5742
+ return runtime.supports.geoLocation && runtime.supports.permissions ? true : false;
5743
+ }
5744
+ geoLocation.isSupported = isSupported;
5745
+ /**
5746
+ * Namespace to interact with the location on map module-specific part of the SDK.
5747
+ *
5748
+ * @beta
5749
+ */
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 });
5614
5765
  }
5615
- ensureInitialized(FrameContexts.content, FrameContexts.task);
5616
- if (GlobalVars.hostClientType === HostClientType.desktop ||
5617
- GlobalVars.hostClientType === HostClientType.web ||
5618
- GlobalVars.hostClientType === HostClientType.rigel ||
5619
- GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
5620
- GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
5621
- GlobalVars.hostClientType === HostClientType.teamsPhones ||
5622
- GlobalVars.hostClientType === HostClientType.teamsDisplays) {
5623
- var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
5624
- callback(notSupportedError, null);
5625
- 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);
5626
5784
  }
5627
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5628
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5629
- callback(oldPlatformError, null);
5630
- 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;
5631
5797
  }
5632
- if (!validateScanBarCodeInput(config)) {
5633
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5634
- callback(invalidInput, null);
5635
- return;
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() {
5813
+ }
5814
+ /**
5815
+ * Send a message to the ChildAppWindow.
5816
+ *
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.
5826
+ *
5827
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
5828
+ * @param listener - The listener that will be called
5829
+ */
5830
+ ChildAppWindow.prototype.addEventListener = function (type, listener) {
5831
+ ensureInitialized();
5832
+ if (type === 'message') {
5833
+ registerHandler('messageForParent', listener);
5636
5834
  }
5637
- sendMessageToParent('media.scanBarCode', [config], callback);
5835
+ };
5836
+ return ChildAppWindow;
5837
+ }());
5838
+
5839
+ var ParentAppWindow = /** @class */ (function () {
5840
+ function ParentAppWindow() {
5638
5841
  }
5639
- media.scanBarCode = scanBarCode;
5640
- })(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
+
5641
5875
 
5642
5876
  ;// CONCATENATED MODULE: ./src/public/location.ts
5643
5877
 
@@ -5646,48 +5880,75 @@ var media;
5646
5880
 
5647
5881
 
5648
5882
 
5649
-
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
+ */
5650
5889
  var location_location;
5651
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
+ */
5652
5901
  function getLocation(props, callback) {
5902
+ if (!callback) {
5903
+ throw new Error('[location.getLocation] Callback cannot be null');
5904
+ }
5653
5905
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5654
- 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);
5655
5916
  }
5656
5917
  location_1.getLocation = getLocation;
5657
- function getLocationHelper(props) {
5658
- return new Promise(function (resolve) {
5659
- if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5660
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5661
- }
5662
- if (!props) {
5663
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5664
- }
5665
- if (!isSupported()) {
5666
- throw errorNotSupportedOnPlatform;
5667
- }
5668
- resolve(sendAndHandleSdkError('location.getLocation', props));
5669
- });
5670
- }
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
+ */
5671
5927
  function showLocation(location, callback) {
5928
+ if (!callback) {
5929
+ throw new Error('[location.showLocation] Callback cannot be null');
5930
+ }
5672
5931
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5673
- 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);
5674
5942
  }
5675
5943
  location_1.showLocation = showLocation;
5676
- function showLocationHelper(location) {
5677
- return new Promise(function (resolve) {
5678
- if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5679
- throw { errorCode: ErrorCode.OLD_PLATFORM };
5680
- }
5681
- if (!location) {
5682
- throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5683
- }
5684
- if (!isSupported()) {
5685
- throw errorNotSupportedOnPlatform;
5686
- }
5687
- resolve(sendAndHandleSdkError('location.showLocation', location));
5688
- });
5689
- }
5690
- 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
+ */
5691
5952
  function isSupported() {
5692
5953
  return runtime.supports.location ? true : false;
5693
5954
  }
@@ -6478,8 +6739,11 @@ var sharing;
6478
6739
 
6479
6740
 
6480
6741
 
6742
+
6481
6743
  /**
6482
6744
  * Namespace to interact with the stage view specific part of the SDK.
6745
+ *
6746
+ * @beta
6483
6747
  */
6484
6748
  var stageView;
6485
6749
  (function (stageView) {
@@ -6488,12 +6752,16 @@ var stageView;
6488
6752
  * Feature is under development
6489
6753
  *
6490
6754
  * Opens a stage view to display a Teams application
6755
+ * @beta
6491
6756
  * @param stageViewParams - The parameters to pass into the stage view.
6492
6757
  * @returns Promise that resolves or rejects with an error once the stage view is closed.
6493
6758
  */
6494
6759
  function open(stageViewParams) {
6495
6760
  return new Promise(function (resolve) {
6496
6761
  ensureInitialized(FrameContexts.content);
6762
+ if (!isSupported()) {
6763
+ throw errorNotSupportedOnPlatform;
6764
+ }
6497
6765
  if (!stageViewParams) {
6498
6766
  throw new Error('[stageView.open] Stage view params cannot be null');
6499
6767
  }
@@ -6501,6 +6769,16 @@ var stageView;
6501
6769
  });
6502
6770
  }
6503
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;
6504
6782
  })(stageView || (stageView = {}));
6505
6783
 
6506
6784
  ;// CONCATENATED MODULE: ./src/public/webStorage.ts
@@ -6570,9 +6848,9 @@ var call;
6570
6848
  function startCall(startCallParams) {
6571
6849
  return new Promise(function (resolve) {
6572
6850
  var _a;
6573
- ensureInitialized(FrameContexts.content);
6851
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
6574
6852
  if (!isSupported()) {
6575
- throw new Error('Not supported');
6853
+ throw errorNotSupportedOnPlatform;
6576
6854
  }
6577
6855
  if (runtime.isLegacyTeams) {
6578
6856
  resolve(sendAndHandleSdkError('executeDeepLink', createTeamsDeepLinkForCall(startCallParams.targets, (_a = startCallParams.requestedModalities) === null || _a === void 0 ? void 0 : _a.includes(CallModalities.Video), startCallParams.source)));
@@ -7382,6 +7660,8 @@ var tasks;
7382
7660
 
7383
7661
 
7384
7662
 
7663
+
7664
+
7385
7665
 
7386
7666
 
7387
7667