@microsoft/teams-js 2.1.0-beta.4 → 2.1.1-beta.0

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.1-beta.0";
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,683 @@ 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
+ * @beta
5517
+ */
5518
+ var barCode;
5519
+ (function (barCode) {
5520
+ /**
5521
+ * Scan Barcode or QRcode using camera
5522
+ *
5523
+ * @param barCodeConfig - input configuration to customize the barcode scanning experience
5524
+ *
5525
+ * @returns a scanned code
5526
+ *
5527
+ * @beta
5528
+ */
5529
+ function scanBarCode(barCodeConfig) {
5530
+ return new Promise(function (resolve) {
5531
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5532
+ if (!isSupported()) {
5533
+ throw errorNotSupportedOnPlatform;
5534
+ }
5535
+ if (!validateScanBarCodeInput(barCodeConfig)) {
5536
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5537
+ }
5538
+ resolve(sendAndHandleSdkError('media.scanBarCode', barCodeConfig));
5539
+ });
5540
+ }
5541
+ barCode.scanBarCode = scanBarCode;
5542
+ /**
5543
+ * Checks whether or not media has user permission
5544
+ *
5545
+ * @returns true if the user has granted the app permission to media information, false otherwise
5546
+ *
5547
+ * @beta
5548
+ */
5549
+ function hasPermission() {
5550
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5551
+ if (!isSupported()) {
5552
+ throw errorNotSupportedOnPlatform;
5553
+ }
5554
+ var permissions = DevicePermission.Media;
5555
+ return new Promise(function (resolve) {
5556
+ resolve(sendAndHandleSdkError('permissions.has', permissions));
5557
+ });
5558
+ }
5559
+ barCode.hasPermission = hasPermission;
5560
+ /**
5561
+ * Requests user permission for media
5562
+ *
5563
+ * @returns true if the user has granted the app permission to the media, false otherwise
5564
+ *
5565
+ * @beta
5566
+ */
5567
+ function requestPermission() {
5568
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5569
+ if (!isSupported()) {
5570
+ throw errorNotSupportedOnPlatform;
5571
+ }
5572
+ var permissions = DevicePermission.Media;
5573
+ return new Promise(function (resolve) {
5574
+ resolve(sendAndHandleSdkError('permissions.request', permissions));
5575
+ });
5576
+ }
5577
+ barCode.requestPermission = requestPermission;
5578
+ /**
5579
+ * Checks if barCode capability is supported by the host
5580
+ *
5581
+ * @returns boolean to represent whether barCode is supported
5582
+ *
5583
+ * @beta
5584
+ */
5585
+ function isSupported() {
5586
+ return runtime.supports.barCode && runtime.supports.permissions ? true : false;
5587
+ }
5588
+ barCode.isSupported = isSupported;
5589
+ })(barCode || (barCode = {}));
5590
+
5591
+ ;// CONCATENATED MODULE: ./src/public/chat.ts
5592
+
5593
+
5594
+
5595
+
5596
+
5597
+ /**
5598
+ * Contains functionality to start chat with others
5599
+ *
5600
+ * @beta
5601
+ */
5602
+ var chat;
5603
+ (function (chat) {
5604
+ /**
5605
+ * Allows the user to open a chat with a single user and allows
5606
+ * for the user to specify the message they wish to send.
5607
+ *
5608
+ * @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
5609
+ *
5610
+ * @returns Promise resolved upon completion
5611
+ */
5612
+ function openChat(openChatRequest) {
5613
+ return new Promise(function (resolve) {
5614
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5615
+ if (!isSupported()) {
5616
+ throw errorNotSupportedOnPlatform;
5617
+ }
5618
+ if (runtime.isLegacyTeams) {
5619
+ resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat([openChatRequest.user], undefined /*topic*/, openChatRequest.message)));
5620
+ }
5621
+ else {
5622
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
5623
+ members: openChatRequest.user,
5624
+ message: openChatRequest.message,
5625
+ });
5626
+ resolve(sendPromise);
5627
+ }
5628
+ });
5629
+ }
5630
+ chat.openChat = openChat;
5631
+ /**
5632
+ * Allows the user to create a chat with multiple users (2+) and allows
5633
+ * for the user to specify a message and name the topic of the conversation. If
5634
+ * only 1 user is provided into users array default back to origin openChat.
5635
+ *
5636
+ * @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).
5637
+ *
5638
+ * @returns Promise resolved upon completion
5639
+ */
5640
+ function openGroupChat(openChatRequest) {
5641
+ return new Promise(function (resolve) {
5642
+ if (openChatRequest.users.length < 1) {
5643
+ throw Error('OpenGroupChat Failed: No users specified');
5644
+ }
5645
+ if (openChatRequest.users.length === 1) {
5646
+ var chatRequest = {
5647
+ user: openChatRequest.users[0],
5648
+ message: openChatRequest.message,
5649
+ };
5650
+ openChat(chatRequest);
5651
+ }
5652
+ else {
5653
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5654
+ if (!isSupported()) {
5655
+ throw errorNotSupportedOnPlatform;
5656
+ }
5657
+ if (runtime.isLegacyTeams) {
5658
+ resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat(openChatRequest.users, openChatRequest.topic, openChatRequest.message)));
5659
+ }
5660
+ else {
5661
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
5662
+ members: openChatRequest.users,
5663
+ message: openChatRequest.message,
5664
+ topic: openChatRequest.topic,
5665
+ });
5666
+ resolve(sendPromise);
5667
+ }
5668
+ }
5669
+ });
5670
+ }
5671
+ chat.openGroupChat = openGroupChat;
5672
+ function isSupported() {
5673
+ return runtime.supports.chat ? true : false;
5674
+ }
5675
+ chat.isSupported = isSupported;
5676
+ })(chat || (chat = {}));
5677
+
5678
+ ;// CONCATENATED MODULE: ./src/public/geoLocation.ts
5679
+
5680
+
5681
+
5682
+
5683
+
5684
+ /**
5685
+ * Namespace to interact with the geoLocation module-specific part of the SDK. This is the newer version of location module.
5686
+ *
5687
+ * @beta
5688
+ */
5689
+ var geoLocation;
5690
+ (function (geoLocation) {
5691
+ /**
5692
+ * Fetches current user coordinates
5693
+ * @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
5694
+ *
5695
+ * @beta
5696
+ */
5697
+ function getCurrentLocation() {
5698
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5699
+ if (!isSupported()) {
5700
+ throw errorNotSupportedOnPlatform;
5701
+ }
5702
+ return sendAndHandleSdkError('location.getLocation', { allowChooseLocation: false, showMap: false });
5703
+ }
5704
+ geoLocation.getCurrentLocation = getCurrentLocation;
5705
+ /**
5706
+ * Checks whether or not location has user permission
5707
+ *
5708
+ * @returns Promise that will resolve with true if the user had granted the app permission to location information, or with false otherwise,
5709
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5710
+ *
5711
+ * @beta
5712
+ */
5713
+ function hasPermission() {
5714
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5715
+ if (!isSupported()) {
5716
+ throw errorNotSupportedOnPlatform;
5717
+ }
5718
+ var permissions = DevicePermission.GeoLocation;
5719
+ return new Promise(function (resolve) {
5720
+ resolve(sendAndHandleSdkError('permissions.has', permissions));
5574
5721
  });
5575
5722
  }
5576
- media.selectMedia = selectMedia;
5723
+ geoLocation.hasPermission = hasPermission;
5577
5724
  /**
5578
- * View images using native image viewer
5725
+ * Requests user permission for location
5579
5726
  *
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
5727
+ * @returns true if the user consented permission for location, false otherwise
5728
+ * @returns Promise that will resolve with true if the user consented permission for location, or with false otherwise,
5729
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5730
+ *
5731
+ * @beta
5582
5732
  */
5583
- function viewImages(uriList, callback) {
5584
- if (!callback) {
5585
- throw new Error('[view images] Callback cannot be null');
5586
- }
5733
+ function requestPermission() {
5587
5734
  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;
5735
+ if (!isSupported()) {
5736
+ throw errorNotSupportedOnPlatform;
5597
5737
  }
5598
- var params = [uriList];
5599
- sendMessageToParent('viewImages', params, callback);
5738
+ var permissions = DevicePermission.GeoLocation;
5739
+ return new Promise(function (resolve) {
5740
+ resolve(sendAndHandleSdkError('permissions.request', permissions));
5741
+ });
5600
5742
  }
5601
- media.viewImages = viewImages;
5743
+ geoLocation.requestPermission = requestPermission;
5602
5744
  /**
5603
- * Scan Barcode/QRcode using camera
5745
+ * Checks if geoLocation capability is supported by the host
5604
5746
  *
5605
- * @remarks
5606
- * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
5747
+ * @returns boolean to represent whether geoLocation is supported
5607
5748
  *
5608
- * @param callback - callback to invoke after scanning the barcode
5609
- * @param config - optional input configuration to customize the barcode scanning experience
5749
+ * @beta
5610
5750
  */
5611
- function scanBarCode(callback, config) {
5612
- if (!callback) {
5613
- throw new Error('[media.scanBarCode] Callback cannot be null');
5751
+ function isSupported() {
5752
+ return runtime.supports.geoLocation && runtime.supports.permissions ? true : false;
5753
+ }
5754
+ geoLocation.isSupported = isSupported;
5755
+ /**
5756
+ * Namespace to interact with the location on map module-specific part of the SDK.
5757
+ *
5758
+ * @beta
5759
+ */
5760
+ var map;
5761
+ (function (map) {
5762
+ /**
5763
+ * Allows user to choose location on map
5764
+ *
5765
+ * @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
5766
+ *
5767
+ * @beta
5768
+ */
5769
+ function chooseLocation() {
5770
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5771
+ if (!isSupported()) {
5772
+ throw errorNotSupportedOnPlatform;
5773
+ }
5774
+ return sendAndHandleSdkError('location.getLocation', { allowChooseLocation: true, showMap: true });
5614
5775
  }
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;
5776
+ map.chooseLocation = chooseLocation;
5777
+ /**
5778
+ * Shows the location on map corresponding to the given coordinates
5779
+ *
5780
+ * @param location - Location to be shown on the map
5781
+ * @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
5782
+ *
5783
+ * @beta
5784
+ */
5785
+ function showLocation(location) {
5786
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
5787
+ if (!isSupported()) {
5788
+ throw errorNotSupportedOnPlatform;
5789
+ }
5790
+ if (!location) {
5791
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5792
+ }
5793
+ return sendAndHandleSdkError('location.showLocation', location);
5626
5794
  }
5627
- if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
5628
- var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
5629
- callback(oldPlatformError, null);
5630
- return;
5795
+ map.showLocation = showLocation;
5796
+ /**
5797
+ * Checks if geoLocation.map capability is supported by the host
5798
+ *
5799
+ * @returns boolean to represent whether geoLocation.map is supported
5800
+ *
5801
+ * @beta
5802
+ */
5803
+ function isSupported() {
5804
+ return runtime.supports.geoLocation && runtime.supports.geoLocation.map && runtime.supports.permissions
5805
+ ? true
5806
+ : false;
5631
5807
  }
5632
- if (!validateScanBarCodeInput(config)) {
5633
- var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
5634
- callback(invalidInput, null);
5635
- return;
5808
+ map.isSupported = isSupported;
5809
+ })(map = geoLocation.map || (geoLocation.map = {}));
5810
+ })(geoLocation || (geoLocation = {}));
5811
+
5812
+ ;// CONCATENATED MODULE: ./src/public/appWindow.ts
5813
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
5814
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5815
+ /* eslint-disable @typescript-eslint/ban-types */
5816
+
5817
+
5818
+
5819
+
5820
+
5821
+ var ChildAppWindow = /** @class */ (function () {
5822
+ function ChildAppWindow() {
5823
+ }
5824
+ /**
5825
+ * Send a message to the ChildAppWindow.
5826
+ *
5827
+ * @param message - The message to send
5828
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
5829
+ */
5830
+ ChildAppWindow.prototype.postMessage = function (message, onComplete) {
5831
+ ensureInitialized();
5832
+ sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
5833
+ };
5834
+ /**
5835
+ * Add a listener that will be called when an event is received from the ChildAppWindow.
5836
+ *
5837
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
5838
+ * @param listener - The listener that will be called
5839
+ */
5840
+ ChildAppWindow.prototype.addEventListener = function (type, listener) {
5841
+ ensureInitialized();
5842
+ if (type === 'message') {
5843
+ registerHandler('messageForParent', listener);
5636
5844
  }
5637
- sendMessageToParent('media.scanBarCode', [config], callback);
5845
+ };
5846
+ return ChildAppWindow;
5847
+ }());
5848
+
5849
+ var ParentAppWindow = /** @class */ (function () {
5850
+ function ParentAppWindow() {
5638
5851
  }
5639
- media.scanBarCode = scanBarCode;
5640
- })(media || (media = {}));
5852
+ Object.defineProperty(ParentAppWindow, "Instance", {
5853
+ get: function () {
5854
+ // Do you need arguments? Make it a regular method instead.
5855
+ return this._instance || (this._instance = new this());
5856
+ },
5857
+ enumerable: false,
5858
+ configurable: true
5859
+ });
5860
+ /**
5861
+ * Send a message to the ParentAppWindow.
5862
+ *
5863
+ * @param message - The message to send
5864
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
5865
+ */
5866
+ ParentAppWindow.prototype.postMessage = function (message, onComplete) {
5867
+ ensureInitialized(FrameContexts.task);
5868
+ sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
5869
+ };
5870
+ /**
5871
+ * Add a listener that will be called when an event is received from the ParentAppWindow.
5872
+ *
5873
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
5874
+ * @param listener - The listener that will be called
5875
+ */
5876
+ ParentAppWindow.prototype.addEventListener = function (type, listener) {
5877
+ ensureInitialized(FrameContexts.task);
5878
+ if (type === 'message') {
5879
+ registerHandler('messageForChild', listener);
5880
+ }
5881
+ };
5882
+ return ParentAppWindow;
5883
+ }());
5884
+
5641
5885
 
5642
5886
  ;// CONCATENATED MODULE: ./src/public/location.ts
5643
5887
 
@@ -5646,48 +5890,75 @@ var media;
5646
5890
 
5647
5891
 
5648
5892
 
5649
-
5893
+ /**
5894
+ * @deprecated
5895
+ * As of 2.1.0, please use geoLocation namespace.
5896
+ *
5897
+ * Namespace to interact with the location module-specific part of the SDK.
5898
+ */
5650
5899
  var location_location;
5651
5900
  (function (location_1) {
5901
+ /**
5902
+ * @deprecated
5903
+ * As of 2.1.0, please use one of the following functions:
5904
+ * - {@link geoLocation.getCurrentLocation geoLocation.getCurrentLocation(): Promise\<Location\>} to get the current location.
5905
+ * - {@link geoLocation.map.chooseLocation geoLocation.map.chooseLocation(): Promise\<Location\>} to choose location on map.
5906
+ *
5907
+ * Fetches user location
5908
+ * @param props {@link LocationProps} - Specifying how the location request is handled
5909
+ * @param callback - Callback to invoke when current user location is fetched
5910
+ */
5652
5911
  function getLocation(props, callback) {
5912
+ if (!callback) {
5913
+ throw new Error('[location.getLocation] Callback cannot be null');
5914
+ }
5653
5915
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5654
- return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(getLocationHelper, callback, props);
5916
+ if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5917
+ throw { errorCode: ErrorCode.OLD_PLATFORM };
5918
+ }
5919
+ if (!props) {
5920
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5921
+ }
5922
+ if (!isSupported()) {
5923
+ throw errorNotSupportedOnPlatform;
5924
+ }
5925
+ sendMessageToParent('location.getLocation', [props], callback);
5655
5926
  }
5656
5927
  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
- }
5928
+ /**
5929
+ * @deprecated
5930
+ * As of 2.1.0, please use {@link geoLocation.map.showLocation geoLocation.map.showLocation(location: Location): Promise\<void\>} instead.
5931
+ *
5932
+ * Shows the location on map corresponding to the given coordinates
5933
+ *
5934
+ * @param location - Location to be shown on the map
5935
+ * @param callback - Callback to invoke when the location is opened on map
5936
+ */
5671
5937
  function showLocation(location, callback) {
5938
+ if (!callback) {
5939
+ throw new Error('[location.showLocation] Callback cannot be null');
5940
+ }
5672
5941
  ensureInitialized(FrameContexts.content, FrameContexts.task);
5673
- return callCallbackWithErrorOrBooleanFromPromiseAndReturnPromise(showLocationHelper, callback, location);
5942
+ if (!isCurrentSDKVersionAtLeast(locationAPIsRequiredVersion)) {
5943
+ throw { errorCode: ErrorCode.OLD_PLATFORM };
5944
+ }
5945
+ if (!location) {
5946
+ throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
5947
+ }
5948
+ if (!isSupported()) {
5949
+ throw errorNotSupportedOnPlatform;
5950
+ }
5951
+ sendMessageToParent('location.showLocation', [location], callback);
5674
5952
  }
5675
5953
  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;
5954
+ /**
5955
+ * @deprecated
5956
+ * As of 2.1.0, please use geoLocation namespace, and use {@link geoLocation.isSupported geoLocation.isSupported: boolean} to check if geoLocation is supported.
5957
+ *
5958
+ * Checks if Location capability is supported by the host
5959
+ *
5960
+ * @returns boolean to represent whether Location is supported
5961
+ */
5691
5962
  function isSupported() {
5692
5963
  return runtime.supports.location ? true : false;
5693
5964
  }
@@ -6478,8 +6749,11 @@ var sharing;
6478
6749
 
6479
6750
 
6480
6751
 
6752
+
6481
6753
  /**
6482
6754
  * Namespace to interact with the stage view specific part of the SDK.
6755
+ *
6756
+ * @beta
6483
6757
  */
6484
6758
  var stageView;
6485
6759
  (function (stageView) {
@@ -6488,12 +6762,16 @@ var stageView;
6488
6762
  * Feature is under development
6489
6763
  *
6490
6764
  * Opens a stage view to display a Teams application
6765
+ * @beta
6491
6766
  * @param stageViewParams - The parameters to pass into the stage view.
6492
6767
  * @returns Promise that resolves or rejects with an error once the stage view is closed.
6493
6768
  */
6494
6769
  function open(stageViewParams) {
6495
6770
  return new Promise(function (resolve) {
6496
6771
  ensureInitialized(FrameContexts.content);
6772
+ if (!isSupported()) {
6773
+ throw errorNotSupportedOnPlatform;
6774
+ }
6497
6775
  if (!stageViewParams) {
6498
6776
  throw new Error('[stageView.open] Stage view params cannot be null');
6499
6777
  }
@@ -6501,6 +6779,16 @@ var stageView;
6501
6779
  });
6502
6780
  }
6503
6781
  stageView.open = open;
6782
+ /**
6783
+ * Checks if stageView capability is supported by the host
6784
+ * @beta
6785
+ * @returns true if the stageView capability is enabled in runtime.supports.stageView and
6786
+ * false if it is disabled
6787
+ */
6788
+ function isSupported() {
6789
+ return runtime.supports.stageView ? true : false;
6790
+ }
6791
+ stageView.isSupported = isSupported;
6504
6792
  })(stageView || (stageView = {}));
6505
6793
 
6506
6794
  ;// CONCATENATED MODULE: ./src/public/webStorage.ts
@@ -6570,9 +6858,9 @@ var call;
6570
6858
  function startCall(startCallParams) {
6571
6859
  return new Promise(function (resolve) {
6572
6860
  var _a;
6573
- ensureInitialized(FrameContexts.content);
6861
+ ensureInitialized(FrameContexts.content, FrameContexts.task);
6574
6862
  if (!isSupported()) {
6575
- throw new Error('Not supported');
6863
+ throw errorNotSupportedOnPlatform;
6576
6864
  }
6577
6865
  if (runtime.isLegacyTeams) {
6578
6866
  resolve(sendAndHandleSdkError('executeDeepLink', createTeamsDeepLinkForCall(startCallParams.targets, (_a = startCallParams.requestedModalities) === null || _a === void 0 ? void 0 : _a.includes(CallModalities.Video), startCallParams.source)));
@@ -6917,7 +7205,7 @@ function shareDeepLink(deepLinkParameters) {
6917
7205
  }
6918
7206
  /**
6919
7207
  * @deprecated
6920
- * As of 2.0.0, please use {@link app.openLink core.openLink(deepLink: string): Promise\<void\>} instead.
7208
+ * As of 2.0.0, please use {@link app.openLink app.openLink(deepLink: string): Promise\<void\>} instead.
6921
7209
  *
6922
7210
  * Execute deep link API.
6923
7211
  *
@@ -7382,6 +7670,8 @@ var tasks;
7382
7670
 
7383
7671
 
7384
7672
 
7673
+
7674
+
7385
7675
 
7386
7676
 
7387
7677