@microsoft/teams-js 2.1.0-beta.3 → 2.1.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.
- package/README.md +4 -4
- package/dist/MicrosoftTeams.d.ts +395 -76
- package/dist/MicrosoftTeams.js +961 -613
- package/dist/MicrosoftTeams.js.map +1 -1
- package/dist/MicrosoftTeams.min.js +1 -1
- package/dist/MicrosoftTeams.min.js.map +1 -1
- package/package.json +34 -1
package/dist/MicrosoftTeams.js
CHANGED
@@ -1063,6 +1063,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
1063
1063
|
"appInitialization": () => (/* reexport */ appInitialization),
|
1064
1064
|
"appInstallDialog": () => (/* reexport */ appInstallDialog),
|
1065
1065
|
"authentication": () => (/* reexport */ authentication),
|
1066
|
+
"barCode": () => (/* reexport */ barCode),
|
1066
1067
|
"calendar": () => (/* reexport */ calendar),
|
1067
1068
|
"call": () => (/* reexport */ call),
|
1068
1069
|
"chat": () => (/* reexport */ chat),
|
@@ -1071,6 +1072,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
1071
1072
|
"enablePrintCapability": () => (/* reexport */ enablePrintCapability),
|
1072
1073
|
"executeDeepLink": () => (/* reexport */ executeDeepLink),
|
1073
1074
|
"files": () => (/* reexport */ files),
|
1075
|
+
"geoLocation": () => (/* reexport */ geoLocation),
|
1074
1076
|
"getContext": () => (/* reexport */ getContext),
|
1075
1077
|
"getMruTabInstances": () => (/* reexport */ getMruTabInstances),
|
1076
1078
|
"getTabInstances": () => (/* reexport */ getTabInstances),
|
@@ -1118,11 +1120,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
1118
1120
|
"teams": () => (/* reexport */ teams),
|
1119
1121
|
"teamsCore": () => (/* reexport */ teamsCore),
|
1120
1122
|
"uploadCustomApp": () => (/* reexport */ uploadCustomApp),
|
1121
|
-
"video": () => (/* reexport */ video)
|
1123
|
+
"video": () => (/* reexport */ video),
|
1124
|
+
"webStorage": () => (/* reexport */ webStorage)
|
1122
1125
|
});
|
1123
1126
|
|
1124
1127
|
;// CONCATENATED MODULE: ./src/internal/constants.ts
|
1125
|
-
var version = "2.1.0
|
1128
|
+
var version = "2.1.0";
|
1126
1129
|
/**
|
1127
1130
|
* @hidden
|
1128
1131
|
* The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
|
@@ -1161,6 +1164,13 @@ var getUserJoinedTeamsSupportedAndroidClientVersion = '2.0.1';
|
|
1161
1164
|
* @internal
|
1162
1165
|
*/
|
1163
1166
|
var locationAPIsRequiredVersion = '1.9.0';
|
1167
|
+
/**
|
1168
|
+
* @hidden
|
1169
|
+
* This is the client version when permisisons are supported
|
1170
|
+
*
|
1171
|
+
* @internal
|
1172
|
+
*/
|
1173
|
+
var permissionsAPIsRequiredVersion = '2.0.1';
|
1164
1174
|
/**
|
1165
1175
|
* @hidden
|
1166
1176
|
* This is the client version when people picker API is supported on mobile.
|
@@ -1340,6 +1350,12 @@ var ErrorCode;
|
|
1340
1350
|
*/
|
1341
1351
|
ErrorCode[ErrorCode["SIZE_EXCEEDED"] = 10000] = "SIZE_EXCEEDED";
|
1342
1352
|
})(ErrorCode || (ErrorCode = {}));
|
1353
|
+
/** @hidden */
|
1354
|
+
var DevicePermission;
|
1355
|
+
(function (DevicePermission) {
|
1356
|
+
DevicePermission["GeoLocation"] = "geolocation";
|
1357
|
+
DevicePermission["Media"] = "media";
|
1358
|
+
})(DevicePermission || (DevicePermission = {}));
|
1343
1359
|
|
1344
1360
|
;// CONCATENATED MODULE: ./src/public/constants.ts
|
1345
1361
|
var HostClientType;
|
@@ -2355,14 +2371,19 @@ var runtime = {
|
|
2355
2371
|
apiVersion: 1,
|
2356
2372
|
supports: {
|
2357
2373
|
appInstallDialog: undefined,
|
2374
|
+
barCode: undefined,
|
2358
2375
|
calendar: undefined,
|
2359
2376
|
call: undefined,
|
2360
2377
|
chat: undefined,
|
2378
|
+
webStorage: undefined,
|
2361
2379
|
conversations: undefined,
|
2362
2380
|
dialog: {
|
2363
2381
|
bot: undefined,
|
2364
2382
|
update: undefined,
|
2365
2383
|
},
|
2384
|
+
geoLocation: {
|
2385
|
+
map: undefined,
|
2386
|
+
},
|
2366
2387
|
location: undefined,
|
2367
2388
|
logs: undefined,
|
2368
2389
|
mail: undefined,
|
@@ -2378,9 +2399,11 @@ var runtime = {
|
|
2378
2399
|
fullTrust: undefined,
|
2379
2400
|
},
|
2380
2401
|
people: undefined,
|
2402
|
+
permissions: undefined,
|
2381
2403
|
profile: undefined,
|
2382
2404
|
remoteCamera: undefined,
|
2383
2405
|
sharing: undefined,
|
2406
|
+
stageView: undefined,
|
2384
2407
|
teams: {
|
2385
2408
|
fullTrust: {
|
2386
2409
|
joinedTeams: undefined,
|
@@ -2417,6 +2440,7 @@ var teamsRuntimeConfig = {
|
|
2417
2440
|
},
|
2418
2441
|
remoteCamera: {},
|
2419
2442
|
sharing: {},
|
2443
|
+
stageView: {},
|
2420
2444
|
teams: {
|
2421
2445
|
fullTrust: {},
|
2422
2446
|
},
|
@@ -2460,6 +2484,12 @@ var versionConstants = {
|
|
2460
2484
|
],
|
2461
2485
|
},
|
2462
2486
|
],
|
2487
|
+
'2.0.5': [
|
2488
|
+
{
|
2489
|
+
capability: { webStorage: {} },
|
2490
|
+
hostClientTypes: [HostClientType.android, HostClientType.ios],
|
2491
|
+
},
|
2492
|
+
],
|
2463
2493
|
};
|
2464
2494
|
/**
|
2465
2495
|
* @internal
|
@@ -4826,206 +4856,486 @@ var appInstallDialog;
|
|
4826
4856
|
appInstallDialog.isSupported = isSupported;
|
4827
4857
|
})(appInstallDialog || (appInstallDialog = {}));
|
4828
4858
|
|
4829
|
-
;// CONCATENATED MODULE: ./src/public/
|
4830
|
-
|
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
|
+
})();
|
4831
4876
|
|
4832
4877
|
|
4833
4878
|
|
4834
4879
|
|
4835
|
-
/**
|
4836
|
-
* Contains functionality to start chat with others
|
4837
|
-
*
|
4838
|
-
* @beta
|
4839
|
-
*/
|
4840
|
-
var chat;
|
4841
|
-
(function (chat) {
|
4842
|
-
/**
|
4843
|
-
* Allows the user to open a chat with a single user and allows
|
4844
|
-
* for the user to specify the message they wish to send.
|
4845
|
-
*
|
4846
|
-
* @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
|
4847
|
-
*
|
4848
|
-
* @returns Promise resolved upon completion
|
4849
|
-
*/
|
4850
|
-
function openChat(openChatRequest) {
|
4851
|
-
return new Promise(function (resolve) {
|
4852
|
-
ensureInitialized(FrameContexts.content);
|
4853
|
-
if (!isSupported()) {
|
4854
|
-
throw errorNotSupportedOnPlatform;
|
4855
|
-
}
|
4856
|
-
if (runtime.isLegacyTeams) {
|
4857
|
-
resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat([openChatRequest.user], undefined /*topic*/, openChatRequest.message)));
|
4858
|
-
}
|
4859
|
-
else {
|
4860
|
-
var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
|
4861
|
-
members: openChatRequest.user,
|
4862
|
-
message: openChatRequest.message,
|
4863
|
-
});
|
4864
|
-
resolve(sendPromise);
|
4865
|
-
}
|
4866
|
-
});
|
4867
|
-
}
|
4868
|
-
chat.openChat = openChat;
|
4869
|
-
/**
|
4870
|
-
* Allows the user to create a chat with multiple users (2+) and allows
|
4871
|
-
* for the user to specify a message and name the topic of the conversation. If
|
4872
|
-
* only 1 user is provided into users array default back to origin openChat.
|
4873
|
-
*
|
4874
|
-
* @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).
|
4875
|
-
*
|
4876
|
-
* @returns Promise resolved upon completion
|
4877
|
-
*/
|
4878
|
-
function openGroupChat(openChatRequest) {
|
4879
|
-
return new Promise(function (resolve) {
|
4880
|
-
if (openChatRequest.users.length < 1) {
|
4881
|
-
throw Error('OpenGroupChat Failed: No users specified');
|
4882
|
-
}
|
4883
|
-
if (openChatRequest.users.length === 1) {
|
4884
|
-
var chatRequest = {
|
4885
|
-
user: openChatRequest.users[0],
|
4886
|
-
message: openChatRequest.message,
|
4887
|
-
};
|
4888
|
-
openChat(chatRequest);
|
4889
|
-
}
|
4890
|
-
else {
|
4891
|
-
ensureInitialized(FrameContexts.content);
|
4892
|
-
if (!isSupported()) {
|
4893
|
-
throw errorNotSupportedOnPlatform;
|
4894
|
-
}
|
4895
|
-
if (runtime.isLegacyTeams) {
|
4896
|
-
resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat(openChatRequest.users, openChatRequest.topic, openChatRequest.message)));
|
4897
|
-
}
|
4898
|
-
else {
|
4899
|
-
var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
|
4900
|
-
members: openChatRequest.users,
|
4901
|
-
message: openChatRequest.message,
|
4902
|
-
topic: openChatRequest.topic,
|
4903
|
-
});
|
4904
|
-
resolve(sendPromise);
|
4905
|
-
}
|
4906
|
-
}
|
4907
|
-
});
|
4908
|
-
}
|
4909
|
-
chat.openGroupChat = openGroupChat;
|
4910
|
-
function isSupported() {
|
4911
|
-
return runtime.supports.chat ? true : false;
|
4912
|
-
}
|
4913
|
-
chat.isSupported = isSupported;
|
4914
|
-
})(chat || (chat = {}));
|
4915
|
-
|
4916
|
-
;// CONCATENATED MODULE: ./src/public/appWindow.ts
|
4917
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
4918
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
4919
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
4920
4880
|
|
4921
4881
|
|
4922
4882
|
|
4923
4883
|
|
4924
4884
|
|
4925
|
-
var
|
4926
|
-
|
4927
|
-
}
|
4885
|
+
var media;
|
4886
|
+
(function (media) {
|
4928
4887
|
/**
|
4929
|
-
*
|
4930
|
-
*
|
4931
|
-
* @param message - The message to send
|
4932
|
-
* @param onComplete - The callback to know if the postMessage has been success/failed.
|
4888
|
+
* Enum for file formats supported
|
4933
4889
|
*/
|
4934
|
-
|
4935
|
-
|
4936
|
-
|
4937
|
-
|
4890
|
+
var FileFormat;
|
4891
|
+
(function (FileFormat) {
|
4892
|
+
FileFormat["Base64"] = "base64";
|
4893
|
+
FileFormat["ID"] = "id";
|
4894
|
+
})(FileFormat = media.FileFormat || (media.FileFormat = {}));
|
4938
4895
|
/**
|
4939
|
-
*
|
4940
|
-
*
|
4941
|
-
* @param type - The event to listen to. Currently the only supported type is 'message'.
|
4942
|
-
* @param listener - The listener that will be called
|
4896
|
+
* File object that can be used to represent image or video or audio
|
4943
4897
|
*/
|
4944
|
-
|
4945
|
-
|
4946
|
-
if (type === 'message') {
|
4947
|
-
registerHandler('messageForParent', listener);
|
4898
|
+
var File = /** @class */ (function () {
|
4899
|
+
function File() {
|
4948
4900
|
}
|
4949
|
-
|
4950
|
-
|
4951
|
-
|
4952
|
-
|
4953
|
-
var ParentAppWindow = /** @class */ (function () {
|
4954
|
-
function ParentAppWindow() {
|
4955
|
-
}
|
4956
|
-
Object.defineProperty(ParentAppWindow, "Instance", {
|
4957
|
-
get: function () {
|
4958
|
-
// Do you need arguments? Make it a regular method instead.
|
4959
|
-
return this._instance || (this._instance = new this());
|
4960
|
-
},
|
4961
|
-
enumerable: false,
|
4962
|
-
configurable: true
|
4963
|
-
});
|
4901
|
+
return File;
|
4902
|
+
}());
|
4903
|
+
media.File = File;
|
4964
4904
|
/**
|
4965
|
-
*
|
4905
|
+
* Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
|
4966
4906
|
*
|
4967
|
-
* @
|
4968
|
-
*
|
4969
|
-
|
4970
|
-
|
4971
|
-
|
4972
|
-
sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
|
4973
|
-
};
|
4974
|
-
/**
|
4975
|
-
* 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.
|
4976
4912
|
*
|
4977
|
-
* @param type - The event to listen to. Currently the only supported type is 'message'.
|
4978
|
-
* @param listener - The listener that will be called
|
4979
4913
|
*/
|
4980
|
-
|
4981
|
-
|
4982
|
-
|
4983
|
-
registerHandler('messageForChild', listener);
|
4914
|
+
function captureImage(callback) {
|
4915
|
+
if (!callback) {
|
4916
|
+
throw new Error('[captureImage] Callback cannot be null');
|
4984
4917
|
}
|
4985
|
-
|
4986
|
-
|
4987
|
-
}
|
4988
|
-
|
4989
|
-
|
4990
|
-
|
4991
|
-
|
4992
|
-
|
4993
|
-
|
4994
|
-
|
4995
|
-
|
4996
|
-
|
4997
|
-
*
|
4998
|
-
* @internal
|
4999
|
-
*/
|
5000
|
-
function createFile(assembleAttachment, mimeType) {
|
5001
|
-
if (assembleAttachment == null || mimeType == null || assembleAttachment.length <= 0) {
|
5002
|
-
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);
|
5003
4930
|
}
|
5004
|
-
|
5005
|
-
|
5006
|
-
|
5007
|
-
|
5008
|
-
|
5009
|
-
|
5010
|
-
|
5011
|
-
}
|
5012
|
-
|
5013
|
-
|
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;
|
5014
4947
|
}
|
5015
|
-
|
4948
|
+
return _this;
|
5016
4949
|
}
|
5017
|
-
|
5018
|
-
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
|
5023
|
-
|
5024
|
-
|
5025
|
-
|
5026
|
-
|
5027
|
-
|
5028
|
-
|
4950
|
+
/**
|
4951
|
+
* Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
|
4952
|
+
* @param callback - callback is called with the @see SdkError if there is an error
|
4953
|
+
* If error is null or undefined, the callback will be called with @see Blob.
|
4954
|
+
*/
|
4955
|
+
Media.prototype.getMedia = function (callback) {
|
4956
|
+
if (!callback) {
|
4957
|
+
throw new Error('[get Media] Callback cannot be null');
|
4958
|
+
}
|
4959
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
4960
|
+
if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
|
4961
|
+
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
4962
|
+
callback(oldPlatformError, null);
|
4963
|
+
return;
|
4964
|
+
}
|
4965
|
+
if (!validateGetMediaInputs(this.mimeType, this.format, this.content)) {
|
4966
|
+
var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
4967
|
+
callback(invalidInput, null);
|
4968
|
+
return;
|
4969
|
+
}
|
4970
|
+
// Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
|
4971
|
+
if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
|
4972
|
+
this.getMediaViaCallback(callback);
|
4973
|
+
}
|
4974
|
+
else {
|
4975
|
+
this.getMediaViaHandler(callback);
|
4976
|
+
}
|
4977
|
+
};
|
4978
|
+
Media.prototype.getMediaViaCallback = function (callback) {
|
4979
|
+
var helper = {
|
4980
|
+
mediaMimeType: this.mimeType,
|
4981
|
+
assembleAttachment: [],
|
4982
|
+
};
|
4983
|
+
var localUriId = [this.content];
|
4984
|
+
function handleGetMediaCallbackRequest(mediaResult) {
|
4985
|
+
if (callback) {
|
4986
|
+
if (mediaResult && mediaResult.error) {
|
4987
|
+
callback(mediaResult.error, null);
|
4988
|
+
}
|
4989
|
+
else {
|
4990
|
+
if (mediaResult && mediaResult.mediaChunk) {
|
4991
|
+
// If the chunksequence number is less than equal to 0 implies EOF
|
4992
|
+
// create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
|
4993
|
+
if (mediaResult.mediaChunk.chunkSequence <= 0) {
|
4994
|
+
var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
|
4995
|
+
callback(mediaResult.error, file);
|
4996
|
+
}
|
4997
|
+
else {
|
4998
|
+
// Keep pushing chunks into assemble attachment
|
4999
|
+
var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
|
5000
|
+
helper.assembleAttachment.push(assemble);
|
5001
|
+
}
|
5002
|
+
}
|
5003
|
+
else {
|
5004
|
+
callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
|
5005
|
+
}
|
5006
|
+
}
|
5007
|
+
}
|
5008
|
+
}
|
5009
|
+
sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
|
5010
|
+
};
|
5011
|
+
Media.prototype.getMediaViaHandler = function (callback) {
|
5012
|
+
var actionName = generateGUID();
|
5013
|
+
var helper = {
|
5014
|
+
mediaMimeType: this.mimeType,
|
5015
|
+
assembleAttachment: [],
|
5016
|
+
};
|
5017
|
+
var params = [actionName, this.content];
|
5018
|
+
this.content && callback && sendMessageToParent('getMedia', params);
|
5019
|
+
function handleGetMediaRequest(response) {
|
5020
|
+
if (callback) {
|
5021
|
+
var mediaResult = JSON.parse(response);
|
5022
|
+
if (mediaResult.error) {
|
5023
|
+
callback(mediaResult.error, null);
|
5024
|
+
removeHandler('getMedia' + actionName);
|
5025
|
+
}
|
5026
|
+
else {
|
5027
|
+
if (mediaResult.mediaChunk) {
|
5028
|
+
// If the chunksequence number is less than equal to 0 implies EOF
|
5029
|
+
// create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
|
5030
|
+
if (mediaResult.mediaChunk.chunkSequence <= 0) {
|
5031
|
+
var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
|
5032
|
+
callback(mediaResult.error, file);
|
5033
|
+
removeHandler('getMedia' + actionName);
|
5034
|
+
}
|
5035
|
+
else {
|
5036
|
+
// Keep pushing chunks into assemble attachment
|
5037
|
+
var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
|
5038
|
+
helper.assembleAttachment.push(assemble);
|
5039
|
+
}
|
5040
|
+
}
|
5041
|
+
else {
|
5042
|
+
callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
|
5043
|
+
removeHandler('getMedia' + actionName);
|
5044
|
+
}
|
5045
|
+
}
|
5046
|
+
}
|
5047
|
+
}
|
5048
|
+
registerHandler('getMedia' + actionName, handleGetMediaRequest);
|
5049
|
+
};
|
5050
|
+
return Media;
|
5051
|
+
}(File));
|
5052
|
+
media.Media = Media;
|
5053
|
+
/**
|
5054
|
+
* @hidden
|
5055
|
+
* Hide from docs
|
5056
|
+
* --------
|
5057
|
+
* Base class which holds the callback and notifies events to the host client
|
5058
|
+
*/
|
5059
|
+
var MediaController = /** @class */ (function () {
|
5060
|
+
function MediaController(controllerCallback) {
|
5061
|
+
this.controllerCallback = controllerCallback;
|
5062
|
+
}
|
5063
|
+
/**
|
5064
|
+
* @hidden
|
5065
|
+
* Hide from docs
|
5066
|
+
* --------
|
5067
|
+
* Function to notify the host client to programatically control the experience
|
5068
|
+
* @param mediaEvent indicates what the event that needs to be signaled to the host client
|
5069
|
+
* Optional; @param callback is used to send app if host client has successfully handled the notification event or not
|
5070
|
+
*/
|
5071
|
+
MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
|
5072
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5073
|
+
try {
|
5074
|
+
throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
|
5075
|
+
}
|
5076
|
+
catch (err) {
|
5077
|
+
if (callback) {
|
5078
|
+
callback(err);
|
5079
|
+
}
|
5080
|
+
return;
|
5081
|
+
}
|
5082
|
+
var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
|
5083
|
+
sendMessageToParent('media.controller', [params], function (err) {
|
5084
|
+
if (callback) {
|
5085
|
+
callback(err);
|
5086
|
+
}
|
5087
|
+
});
|
5088
|
+
};
|
5089
|
+
/**
|
5090
|
+
* Function to programatically stop the ongoing media event
|
5091
|
+
* Optional; @param callback is used to send app if host client has successfully stopped the event or not
|
5092
|
+
*/
|
5093
|
+
MediaController.prototype.stop = function (callback) {
|
5094
|
+
this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
|
5095
|
+
};
|
5096
|
+
return MediaController;
|
5097
|
+
}());
|
5098
|
+
/**
|
5099
|
+
* VideoController class is used to communicate between the app and the host client during the video capture flow
|
5100
|
+
*/
|
5101
|
+
var VideoController = /** @class */ (function (_super) {
|
5102
|
+
__extends(VideoController, _super);
|
5103
|
+
function VideoController() {
|
5104
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
5105
|
+
}
|
5106
|
+
VideoController.prototype.getMediaType = function () {
|
5107
|
+
return MediaType.Video;
|
5108
|
+
};
|
5109
|
+
VideoController.prototype.notifyEventToApp = function (mediaEvent) {
|
5110
|
+
if (!this.controllerCallback) {
|
5111
|
+
// Early return as app has not registered with the callback
|
5112
|
+
return;
|
5113
|
+
}
|
5114
|
+
switch (mediaEvent) {
|
5115
|
+
case MediaControllerEvent.StartRecording:
|
5116
|
+
if (this.controllerCallback.onRecordingStarted) {
|
5117
|
+
this.controllerCallback.onRecordingStarted();
|
5118
|
+
break;
|
5119
|
+
}
|
5120
|
+
}
|
5121
|
+
};
|
5122
|
+
return VideoController;
|
5123
|
+
}(MediaController));
|
5124
|
+
media.VideoController = VideoController;
|
5125
|
+
/**
|
5126
|
+
* @hidden
|
5127
|
+
* Hide from docs
|
5128
|
+
* --------
|
5129
|
+
* Events which are used to communicate between the app and the host client during the media recording flow
|
5130
|
+
*/
|
5131
|
+
var MediaControllerEvent;
|
5132
|
+
(function (MediaControllerEvent) {
|
5133
|
+
MediaControllerEvent[MediaControllerEvent["StartRecording"] = 1] = "StartRecording";
|
5134
|
+
MediaControllerEvent[MediaControllerEvent["StopRecording"] = 2] = "StopRecording";
|
5135
|
+
})(MediaControllerEvent = media.MediaControllerEvent || (media.MediaControllerEvent = {}));
|
5136
|
+
/**
|
5137
|
+
* The modes in which camera can be launched in select Media API
|
5138
|
+
*/
|
5139
|
+
var CameraStartMode;
|
5140
|
+
(function (CameraStartMode) {
|
5141
|
+
CameraStartMode[CameraStartMode["Photo"] = 1] = "Photo";
|
5142
|
+
CameraStartMode[CameraStartMode["Document"] = 2] = "Document";
|
5143
|
+
CameraStartMode[CameraStartMode["Whiteboard"] = 3] = "Whiteboard";
|
5144
|
+
CameraStartMode[CameraStartMode["BusinessCard"] = 4] = "BusinessCard";
|
5145
|
+
})(CameraStartMode = media.CameraStartMode || (media.CameraStartMode = {}));
|
5146
|
+
/**
|
5147
|
+
* Specifies the image source
|
5148
|
+
*/
|
5149
|
+
var Source;
|
5150
|
+
(function (Source) {
|
5151
|
+
Source[Source["Camera"] = 1] = "Camera";
|
5152
|
+
Source[Source["Gallery"] = 2] = "Gallery";
|
5153
|
+
})(Source = media.Source || (media.Source = {}));
|
5154
|
+
/**
|
5155
|
+
* Specifies the type of Media
|
5156
|
+
*/
|
5157
|
+
var MediaType;
|
5158
|
+
(function (MediaType) {
|
5159
|
+
MediaType[MediaType["Image"] = 1] = "Image";
|
5160
|
+
MediaType[MediaType["Video"] = 2] = "Video";
|
5161
|
+
MediaType[MediaType["VideoAndImage"] = 3] = "VideoAndImage";
|
5162
|
+
MediaType[MediaType["Audio"] = 4] = "Audio";
|
5163
|
+
})(MediaType = media.MediaType || (media.MediaType = {}));
|
5164
|
+
/**
|
5165
|
+
* ID contains a mapping for content uri on platform's side, URL is generic
|
5166
|
+
*/
|
5167
|
+
var ImageUriType;
|
5168
|
+
(function (ImageUriType) {
|
5169
|
+
ImageUriType[ImageUriType["ID"] = 1] = "ID";
|
5170
|
+
ImageUriType[ImageUriType["URL"] = 2] = "URL";
|
5171
|
+
})(ImageUriType = media.ImageUriType || (media.ImageUriType = {}));
|
5172
|
+
/**
|
5173
|
+
* Specifies the image output formats.
|
5174
|
+
*/
|
5175
|
+
var ImageOutputFormats;
|
5176
|
+
(function (ImageOutputFormats) {
|
5177
|
+
ImageOutputFormats[ImageOutputFormats["IMAGE"] = 1] = "IMAGE";
|
5178
|
+
ImageOutputFormats[ImageOutputFormats["PDF"] = 2] = "PDF";
|
5179
|
+
})(ImageOutputFormats = media.ImageOutputFormats || (media.ImageOutputFormats = {}));
|
5180
|
+
/**
|
5181
|
+
* Select an attachment using camera/gallery
|
5182
|
+
*
|
5183
|
+
* @param mediaInputs - The input params to customize the media to be selected
|
5184
|
+
* @param callback - The callback to invoke after fetching the media
|
5185
|
+
*/
|
5186
|
+
function selectMedia(mediaInputs, callback) {
|
5187
|
+
if (!callback) {
|
5188
|
+
throw new Error('[select Media] Callback cannot be null');
|
5189
|
+
}
|
5190
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5191
|
+
if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
|
5192
|
+
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
5193
|
+
callback(oldPlatformError, null);
|
5194
|
+
return;
|
5195
|
+
}
|
5196
|
+
try {
|
5197
|
+
throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
|
5198
|
+
}
|
5199
|
+
catch (err) {
|
5200
|
+
callback(err, null);
|
5201
|
+
return;
|
5202
|
+
}
|
5203
|
+
if (!validateSelectMediaInputs(mediaInputs)) {
|
5204
|
+
var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
5205
|
+
callback(invalidInput, null);
|
5206
|
+
return;
|
5207
|
+
}
|
5208
|
+
var params = [mediaInputs];
|
5209
|
+
// What comes back from native as attachments would just be objects and will be missing getMedia method on them
|
5210
|
+
sendMessageToParent('selectMedia', params, function (err, localAttachments, mediaEvent) {
|
5211
|
+
// MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
|
5212
|
+
if (mediaEvent) {
|
5213
|
+
if (isVideoControllerRegistered(mediaInputs)) {
|
5214
|
+
mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
|
5215
|
+
}
|
5216
|
+
return;
|
5217
|
+
}
|
5218
|
+
// Media Attachments are final response to selectMedia
|
5219
|
+
if (!localAttachments) {
|
5220
|
+
callback(err, null);
|
5221
|
+
return;
|
5222
|
+
}
|
5223
|
+
var mediaArray = [];
|
5224
|
+
for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
|
5225
|
+
var attachment = localAttachments_1[_i];
|
5226
|
+
mediaArray.push(new Media(attachment));
|
5227
|
+
}
|
5228
|
+
callback(err, mediaArray);
|
5229
|
+
});
|
5230
|
+
}
|
5231
|
+
media.selectMedia = selectMedia;
|
5232
|
+
/**
|
5233
|
+
* View images using native image viewer
|
5234
|
+
*
|
5235
|
+
* @param uriList - list of URIs for images to be viewed - can be content URI or server URL. Supports up to 10 Images in a single call
|
5236
|
+
* @param callback - returns back error if encountered, returns null in case of success
|
5237
|
+
*/
|
5238
|
+
function viewImages(uriList, callback) {
|
5239
|
+
if (!callback) {
|
5240
|
+
throw new Error('[view images] Callback cannot be null');
|
5241
|
+
}
|
5242
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5243
|
+
if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
|
5244
|
+
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
5245
|
+
callback(oldPlatformError);
|
5246
|
+
return;
|
5247
|
+
}
|
5248
|
+
if (!validateViewImagesInput(uriList)) {
|
5249
|
+
var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
5250
|
+
callback(invalidInput);
|
5251
|
+
return;
|
5252
|
+
}
|
5253
|
+
var params = [uriList];
|
5254
|
+
sendMessageToParent('viewImages', params, callback);
|
5255
|
+
}
|
5256
|
+
media.viewImages = viewImages;
|
5257
|
+
/**
|
5258
|
+
* @deprecated
|
5259
|
+
* As of 2.1.0, please use {@link barCode.scanBarCode barCode.scanBarCode(config?: BarCodeConfig): Promise\<string\>} instead.
|
5260
|
+
|
5261
|
+
* Scan Barcode/QRcode using camera
|
5262
|
+
*
|
5263
|
+
* @remarks
|
5264
|
+
* Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
|
5265
|
+
*
|
5266
|
+
* @param callback - callback to invoke after scanning the barcode
|
5267
|
+
* @param config - optional input configuration to customize the barcode scanning experience
|
5268
|
+
*/
|
5269
|
+
function scanBarCode(callback, config) {
|
5270
|
+
if (!callback) {
|
5271
|
+
throw new Error('[media.scanBarCode] Callback cannot be null');
|
5272
|
+
}
|
5273
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5274
|
+
if (GlobalVars.hostClientType === HostClientType.desktop ||
|
5275
|
+
GlobalVars.hostClientType === HostClientType.web ||
|
5276
|
+
GlobalVars.hostClientType === HostClientType.rigel ||
|
5277
|
+
GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
|
5278
|
+
GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
|
5279
|
+
GlobalVars.hostClientType === HostClientType.teamsPhones ||
|
5280
|
+
GlobalVars.hostClientType === HostClientType.teamsDisplays) {
|
5281
|
+
var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
|
5282
|
+
callback(notSupportedError, null);
|
5283
|
+
return;
|
5284
|
+
}
|
5285
|
+
if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
|
5286
|
+
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
5287
|
+
callback(oldPlatformError, null);
|
5288
|
+
return;
|
5289
|
+
}
|
5290
|
+
if (!validateScanBarCodeInput(config)) {
|
5291
|
+
var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
5292
|
+
callback(invalidInput, null);
|
5293
|
+
return;
|
5294
|
+
}
|
5295
|
+
sendMessageToParent('media.scanBarCode', [config], callback);
|
5296
|
+
}
|
5297
|
+
media.scanBarCode = scanBarCode;
|
5298
|
+
})(media || (media = {}));
|
5299
|
+
|
5300
|
+
;// CONCATENATED MODULE: ./src/internal/mediaUtil.ts
|
5301
|
+
|
5302
|
+
|
5303
|
+
|
5304
|
+
/**
|
5305
|
+
* @hidden
|
5306
|
+
* Helper function to create a blob from media chunks based on their sequence
|
5307
|
+
*
|
5308
|
+
* @internal
|
5309
|
+
*/
|
5310
|
+
function createFile(assembleAttachment, mimeType) {
|
5311
|
+
if (assembleAttachment == null || mimeType == null || assembleAttachment.length <= 0) {
|
5312
|
+
return null;
|
5313
|
+
}
|
5314
|
+
var file;
|
5315
|
+
var sequence = 1;
|
5316
|
+
assembleAttachment.sort(function (a, b) { return (a.sequence > b.sequence ? 1 : -1); });
|
5317
|
+
assembleAttachment.forEach(function (item) {
|
5318
|
+
if (item.sequence == sequence) {
|
5319
|
+
if (file) {
|
5320
|
+
file = new Blob([file, item.file], { type: mimeType });
|
5321
|
+
}
|
5322
|
+
else {
|
5323
|
+
file = new Blob([item.file], { type: mimeType });
|
5324
|
+
}
|
5325
|
+
sequence++;
|
5326
|
+
}
|
5327
|
+
});
|
5328
|
+
return file;
|
5329
|
+
}
|
5330
|
+
/**
|
5331
|
+
* @hidden
|
5332
|
+
* Helper function to convert Media chunks into another object type which can be later assemebled
|
5333
|
+
* Converts base 64 encoded string to byte array and then into an array of blobs
|
5334
|
+
*
|
5335
|
+
* @internal
|
5336
|
+
*/
|
5337
|
+
function decodeAttachment(attachment, mimeType) {
|
5338
|
+
if (attachment == null || mimeType == null) {
|
5029
5339
|
return null;
|
5030
5340
|
}
|
5031
5341
|
var decoded = atob(attachment.chunk);
|
@@ -5193,443 +5503,385 @@ function validatePeoplePickerInput(peoplePickerInputs) {
|
|
5193
5503
|
return true;
|
5194
5504
|
}
|
5195
5505
|
|
5196
|
-
;// CONCATENATED MODULE: ./src/public/
|
5197
|
-
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
5198
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
5199
|
-
var extendStatics = function (d, b) {
|
5200
|
-
extendStatics = Object.setPrototypeOf ||
|
5201
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5202
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
5203
|
-
return extendStatics(d, b);
|
5204
|
-
};
|
5205
|
-
return function (d, b) {
|
5206
|
-
if (typeof b !== "function" && b !== null)
|
5207
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
5208
|
-
extendStatics(d, b);
|
5209
|
-
function __() { this.constructor = d; }
|
5210
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
5211
|
-
};
|
5212
|
-
})();
|
5506
|
+
;// CONCATENATED MODULE: ./src/public/barCode.ts
|
5213
5507
|
|
5214
5508
|
|
5215
5509
|
|
5216
5510
|
|
5217
5511
|
|
5218
5512
|
|
5219
|
-
|
5220
|
-
|
5221
|
-
|
5222
|
-
|
5223
|
-
|
5224
|
-
|
5225
|
-
|
5226
|
-
|
5227
|
-
|
5228
|
-
|
5229
|
-
|
5230
|
-
|
5231
|
-
|
5232
|
-
|
5233
|
-
*
|
5234
|
-
*/
|
5235
|
-
|
5236
|
-
function
|
5237
|
-
|
5238
|
-
|
5239
|
-
|
5240
|
-
media.File = File;
|
5241
|
-
/**
|
5242
|
-
* Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
|
5243
|
-
*
|
5244
|
-
* @params callback - Callback will be called with an @see SdkError if there are any.
|
5245
|
-
* If error is null or undefined, the callback will be called with a collection of @see File objects
|
5246
|
-
* @remarks
|
5247
|
-
* Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
|
5248
|
-
* Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
|
5249
|
-
*
|
5250
|
-
*/
|
5251
|
-
function captureImage(callback) {
|
5252
|
-
if (!callback) {
|
5253
|
-
throw new Error('[captureImage] Callback cannot be null');
|
5254
|
-
}
|
5255
|
-
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5256
|
-
if (!GlobalVars.isFramelessWindow) {
|
5257
|
-
var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
|
5258
|
-
callback(notSupportedError, undefined);
|
5259
|
-
return;
|
5260
|
-
}
|
5261
|
-
if (!isCurrentSDKVersionAtLeast(captureImageMobileSupportVersion)) {
|
5262
|
-
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
5263
|
-
callback(oldPlatformError, undefined);
|
5264
|
-
return;
|
5265
|
-
}
|
5266
|
-
sendMessageToParent('captureImage', callback);
|
5267
|
-
}
|
5268
|
-
media.captureImage = captureImage;
|
5269
|
-
/**
|
5270
|
-
* Media object returned by the select Media API
|
5271
|
-
*/
|
5272
|
-
var Media = /** @class */ (function (_super) {
|
5273
|
-
__extends(Media, _super);
|
5274
|
-
function Media(that) {
|
5275
|
-
if (that === void 0) { that = null; }
|
5276
|
-
var _this = _super.call(this) || this;
|
5277
|
-
if (that) {
|
5278
|
-
_this.content = that.content;
|
5279
|
-
_this.format = that.format;
|
5280
|
-
_this.mimeType = that.mimeType;
|
5281
|
-
_this.name = that.name;
|
5282
|
-
_this.preview = that.preview;
|
5283
|
-
_this.size = that.size;
|
5284
|
-
}
|
5285
|
-
return _this;
|
5286
|
-
}
|
5287
|
-
/**
|
5288
|
-
* Gets the media in chunks irrespective of size, these chunks are assembled and sent back to the webapp as file/blob
|
5289
|
-
* @param callback - callback is called with the @see SdkError if there is an error
|
5290
|
-
* If error is null or undefined, the callback will be called with @see Blob.
|
5291
|
-
*/
|
5292
|
-
Media.prototype.getMedia = function (callback) {
|
5293
|
-
if (!callback) {
|
5294
|
-
throw new Error('[get Media] Callback cannot be null');
|
5295
|
-
}
|
5296
|
-
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5297
|
-
if (!isCurrentSDKVersionAtLeast(mediaAPISupportVersion)) {
|
5298
|
-
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
5299
|
-
callback(oldPlatformError, null);
|
5300
|
-
return;
|
5301
|
-
}
|
5302
|
-
if (!validateGetMediaInputs(this.mimeType, this.format, this.content)) {
|
5303
|
-
var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
5304
|
-
callback(invalidInput, null);
|
5305
|
-
return;
|
5306
|
-
}
|
5307
|
-
// Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
|
5308
|
-
if (isCurrentSDKVersionAtLeast(getMediaCallbackSupportVersion)) {
|
5309
|
-
this.getMediaViaCallback(callback);
|
5310
|
-
}
|
5311
|
-
else {
|
5312
|
-
this.getMediaViaHandler(callback);
|
5313
|
-
}
|
5314
|
-
};
|
5315
|
-
Media.prototype.getMediaViaCallback = function (callback) {
|
5316
|
-
var helper = {
|
5317
|
-
mediaMimeType: this.mimeType,
|
5318
|
-
assembleAttachment: [],
|
5319
|
-
};
|
5320
|
-
var localUriId = [this.content];
|
5321
|
-
function handleGetMediaCallbackRequest(mediaResult) {
|
5322
|
-
if (callback) {
|
5323
|
-
if (mediaResult && mediaResult.error) {
|
5324
|
-
callback(mediaResult.error, null);
|
5325
|
-
}
|
5326
|
-
else {
|
5327
|
-
if (mediaResult && mediaResult.mediaChunk) {
|
5328
|
-
// If the chunksequence number is less than equal to 0 implies EOF
|
5329
|
-
// create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
|
5330
|
-
if (mediaResult.mediaChunk.chunkSequence <= 0) {
|
5331
|
-
var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
|
5332
|
-
callback(mediaResult.error, file);
|
5333
|
-
}
|
5334
|
-
else {
|
5335
|
-
// Keep pushing chunks into assemble attachment
|
5336
|
-
var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
|
5337
|
-
helper.assembleAttachment.push(assemble);
|
5338
|
-
}
|
5339
|
-
}
|
5340
|
-
else {
|
5341
|
-
callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
|
5342
|
-
}
|
5343
|
-
}
|
5344
|
-
}
|
5345
|
-
}
|
5346
|
-
sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
|
5347
|
-
};
|
5348
|
-
Media.prototype.getMediaViaHandler = function (callback) {
|
5349
|
-
var actionName = generateGUID();
|
5350
|
-
var helper = {
|
5351
|
-
mediaMimeType: this.mimeType,
|
5352
|
-
assembleAttachment: [],
|
5353
|
-
};
|
5354
|
-
var params = [actionName, this.content];
|
5355
|
-
this.content && callback && sendMessageToParent('getMedia', params);
|
5356
|
-
function handleGetMediaRequest(response) {
|
5357
|
-
if (callback) {
|
5358
|
-
var mediaResult = JSON.parse(response);
|
5359
|
-
if (mediaResult.error) {
|
5360
|
-
callback(mediaResult.error, null);
|
5361
|
-
removeHandler('getMedia' + actionName);
|
5362
|
-
}
|
5363
|
-
else {
|
5364
|
-
if (mediaResult.mediaChunk) {
|
5365
|
-
// If the chunksequence number is less than equal to 0 implies EOF
|
5366
|
-
// create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
|
5367
|
-
if (mediaResult.mediaChunk.chunkSequence <= 0) {
|
5368
|
-
var file = createFile(helper.assembleAttachment, helper.mediaMimeType);
|
5369
|
-
callback(mediaResult.error, file);
|
5370
|
-
removeHandler('getMedia' + actionName);
|
5371
|
-
}
|
5372
|
-
else {
|
5373
|
-
// Keep pushing chunks into assemble attachment
|
5374
|
-
var assemble = decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
|
5375
|
-
helper.assembleAttachment.push(assemble);
|
5376
|
-
}
|
5377
|
-
}
|
5378
|
-
else {
|
5379
|
-
callback({ errorCode: ErrorCode.INTERNAL_ERROR, message: 'data received is null' }, null);
|
5380
|
-
removeHandler('getMedia' + actionName);
|
5381
|
-
}
|
5382
|
-
}
|
5383
|
-
}
|
5384
|
-
}
|
5385
|
-
registerHandler('getMedia' + actionName, handleGetMediaRequest);
|
5386
|
-
};
|
5387
|
-
return Media;
|
5388
|
-
}(File));
|
5389
|
-
media.Media = Media;
|
5390
|
-
/**
|
5391
|
-
* @hidden
|
5392
|
-
* Hide from docs
|
5393
|
-
* --------
|
5394
|
-
* Base class which holds the callback and notifies events to the host client
|
5395
|
-
*/
|
5396
|
-
var MediaController = /** @class */ (function () {
|
5397
|
-
function MediaController(controllerCallback) {
|
5398
|
-
this.controllerCallback = controllerCallback;
|
5399
|
-
}
|
5400
|
-
/**
|
5401
|
-
* @hidden
|
5402
|
-
* Hide from docs
|
5403
|
-
* --------
|
5404
|
-
* Function to notify the host client to programatically control the experience
|
5405
|
-
* @param mediaEvent indicates what the event that needs to be signaled to the host client
|
5406
|
-
* Optional; @param callback is used to send app if host client has successfully handled the notification event or not
|
5407
|
-
*/
|
5408
|
-
MediaController.prototype.notifyEventToHost = function (mediaEvent, callback) {
|
5409
|
-
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5410
|
-
try {
|
5411
|
-
throwExceptionIfMobileApiIsNotSupported(nonFullScreenVideoModeAPISupportVersion);
|
5412
|
-
}
|
5413
|
-
catch (err) {
|
5414
|
-
if (callback) {
|
5415
|
-
callback(err);
|
5416
|
-
}
|
5417
|
-
return;
|
5418
|
-
}
|
5419
|
-
var params = { mediaType: this.getMediaType(), mediaControllerEvent: mediaEvent };
|
5420
|
-
sendMessageToParent('media.controller', [params], function (err) {
|
5421
|
-
if (callback) {
|
5422
|
-
callback(err);
|
5423
|
-
}
|
5424
|
-
});
|
5425
|
-
};
|
5426
|
-
/**
|
5427
|
-
* Function to programatically stop the ongoing media event
|
5428
|
-
* Optional; @param callback is used to send app if host client has successfully stopped the event or not
|
5429
|
-
*/
|
5430
|
-
MediaController.prototype.stop = function (callback) {
|
5431
|
-
this.notifyEventToHost(MediaControllerEvent.StopRecording, callback);
|
5432
|
-
};
|
5433
|
-
return MediaController;
|
5434
|
-
}());
|
5435
|
-
/**
|
5436
|
-
* VideoController class is used to communicate between the app and the host client during the video capture flow
|
5437
|
-
*/
|
5438
|
-
var VideoController = /** @class */ (function (_super) {
|
5439
|
-
__extends(VideoController, _super);
|
5440
|
-
function VideoController() {
|
5441
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
5442
|
-
}
|
5443
|
-
VideoController.prototype.getMediaType = function () {
|
5444
|
-
return MediaType.Video;
|
5445
|
-
};
|
5446
|
-
VideoController.prototype.notifyEventToApp = function (mediaEvent) {
|
5447
|
-
if (!this.controllerCallback) {
|
5448
|
-
// Early return as app has not registered with the callback
|
5449
|
-
return;
|
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;
|
5450
5534
|
}
|
5451
|
-
|
5452
|
-
|
5453
|
-
if (this.controllerCallback.onRecordingStarted) {
|
5454
|
-
this.controllerCallback.onRecordingStarted();
|
5455
|
-
break;
|
5456
|
-
}
|
5535
|
+
if (!validateScanBarCodeInput(barCodeConfig)) {
|
5536
|
+
throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
5457
5537
|
}
|
5458
|
-
|
5459
|
-
|
5460
|
-
}
|
5461
|
-
|
5538
|
+
resolve(sendAndHandleSdkError('media.scanBarCode', barCodeConfig));
|
5539
|
+
});
|
5540
|
+
}
|
5541
|
+
barCode.scanBarCode = scanBarCode;
|
5462
5542
|
/**
|
5463
|
-
*
|
5464
|
-
*
|
5465
|
-
*
|
5466
|
-
*
|
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
|
5467
5548
|
*/
|
5468
|
-
|
5469
|
-
|
5470
|
-
|
5471
|
-
|
5472
|
-
|
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;
|
5473
5560
|
/**
|
5474
|
-
*
|
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
|
5475
5566
|
*/
|
5476
|
-
|
5477
|
-
|
5478
|
-
|
5479
|
-
|
5480
|
-
|
5481
|
-
|
5482
|
-
|
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;
|
5483
5578
|
/**
|
5484
|
-
*
|
5579
|
+
* Checks if barCode capability is supported by the host
|
5580
|
+
*
|
5581
|
+
* @returns boolean to represent whether barCode is supported
|
5582
|
+
*
|
5583
|
+
* @beta
|
5485
5584
|
*/
|
5486
|
-
|
5487
|
-
|
5488
|
-
|
5489
|
-
|
5490
|
-
|
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) {
|
5491
5604
|
/**
|
5492
|
-
*
|
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
|
5493
5611
|
*/
|
5494
|
-
|
5495
|
-
|
5496
|
-
|
5497
|
-
|
5498
|
-
|
5499
|
-
|
5500
|
-
|
5612
|
+
function openChat(openChatRequest) {
|
5613
|
+
return new Promise(function (resolve) {
|
5614
|
+
ensureInitialized(FrameContexts.content);
|
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;
|
5501
5631
|
/**
|
5502
|
-
*
|
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
|
5503
5639
|
*/
|
5504
|
-
|
5505
|
-
|
5506
|
-
|
5507
|
-
|
5508
|
-
|
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);
|
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) {
|
5509
5691
|
/**
|
5510
|
-
*
|
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
|
5511
5696
|
*/
|
5512
|
-
|
5513
|
-
|
5514
|
-
|
5515
|
-
|
5516
|
-
|
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;
|
5517
5705
|
/**
|
5518
|
-
*
|
5706
|
+
* Checks whether or not location has user permission
|
5519
5707
|
*
|
5520
|
-
* @
|
5521
|
-
*
|
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
|
5522
5712
|
*/
|
5523
|
-
function
|
5524
|
-
if (!callback) {
|
5525
|
-
throw new Error('[select Media] Callback cannot be null');
|
5526
|
-
}
|
5713
|
+
function hasPermission() {
|
5527
5714
|
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5528
|
-
if (!
|
5529
|
-
|
5530
|
-
callback(oldPlatformError, null);
|
5531
|
-
return;
|
5532
|
-
}
|
5533
|
-
try {
|
5534
|
-
throwExceptionIfMediaCallIsNotSupportedOnMobile(mediaInputs);
|
5535
|
-
}
|
5536
|
-
catch (err) {
|
5537
|
-
callback(err, null);
|
5538
|
-
return;
|
5715
|
+
if (!isSupported()) {
|
5716
|
+
throw errorNotSupportedOnPlatform;
|
5539
5717
|
}
|
5540
|
-
|
5541
|
-
|
5542
|
-
|
5543
|
-
|
5718
|
+
var permissions = DevicePermission.GeoLocation;
|
5719
|
+
return new Promise(function (resolve) {
|
5720
|
+
resolve(sendAndHandleSdkError('permissions.has', permissions));
|
5721
|
+
});
|
5722
|
+
}
|
5723
|
+
geoLocation.hasPermission = hasPermission;
|
5724
|
+
/**
|
5725
|
+
* Requests user permission for location
|
5726
|
+
*
|
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
|
5732
|
+
*/
|
5733
|
+
function requestPermission() {
|
5734
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5735
|
+
if (!isSupported()) {
|
5736
|
+
throw errorNotSupportedOnPlatform;
|
5544
5737
|
}
|
5545
|
-
var
|
5546
|
-
|
5547
|
-
|
5548
|
-
// MediaControllerEvent response is used to notify the app about events and is a partial response to selectMedia
|
5549
|
-
if (mediaEvent) {
|
5550
|
-
if (isVideoControllerRegistered(mediaInputs)) {
|
5551
|
-
mediaInputs.videoProps.videoController.notifyEventToApp(mediaEvent);
|
5552
|
-
}
|
5553
|
-
return;
|
5554
|
-
}
|
5555
|
-
// Media Attachments are final response to selectMedia
|
5556
|
-
if (!localAttachments) {
|
5557
|
-
callback(err, null);
|
5558
|
-
return;
|
5559
|
-
}
|
5560
|
-
var mediaArray = [];
|
5561
|
-
for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
|
5562
|
-
var attachment = localAttachments_1[_i];
|
5563
|
-
mediaArray.push(new Media(attachment));
|
5564
|
-
}
|
5565
|
-
callback(err, mediaArray);
|
5738
|
+
var permissions = DevicePermission.GeoLocation;
|
5739
|
+
return new Promise(function (resolve) {
|
5740
|
+
resolve(sendAndHandleSdkError('permissions.request', permissions));
|
5566
5741
|
});
|
5567
5742
|
}
|
5568
|
-
|
5743
|
+
geoLocation.requestPermission = requestPermission;
|
5744
|
+
/**
|
5745
|
+
* Checks if geoLocation capability is supported by the host
|
5746
|
+
*
|
5747
|
+
* @returns boolean to represent whether geoLocation is supported
|
5748
|
+
*
|
5749
|
+
* @beta
|
5750
|
+
*/
|
5751
|
+
function isSupported() {
|
5752
|
+
return runtime.supports.geoLocation && runtime.supports.permissions ? true : false;
|
5753
|
+
}
|
5754
|
+
geoLocation.isSupported = isSupported;
|
5569
5755
|
/**
|
5570
|
-
*
|
5756
|
+
* Namespace to interact with the location on map module-specific part of the SDK.
|
5571
5757
|
*
|
5572
|
-
* @
|
5573
|
-
* @param callback - returns back error if encountered, returns null in case of success
|
5758
|
+
* @beta
|
5574
5759
|
*/
|
5575
|
-
|
5576
|
-
|
5577
|
-
|
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 });
|
5578
5775
|
}
|
5579
|
-
|
5580
|
-
|
5581
|
-
|
5582
|
-
|
5583
|
-
|
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);
|
5584
5794
|
}
|
5585
|
-
|
5586
|
-
|
5587
|
-
|
5588
|
-
|
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;
|
5589
5807
|
}
|
5590
|
-
|
5591
|
-
|
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() {
|
5592
5823
|
}
|
5593
|
-
media.viewImages = viewImages;
|
5594
5824
|
/**
|
5595
|
-
*
|
5825
|
+
* Send a message to the ChildAppWindow.
|
5596
5826
|
*
|
5597
|
-
* @
|
5598
|
-
*
|
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.
|
5599
5836
|
*
|
5600
|
-
* @param
|
5601
|
-
* @param
|
5837
|
+
* @param type - The event to listen to. Currently the only supported type is 'message'.
|
5838
|
+
* @param listener - The listener that will be called
|
5602
5839
|
*/
|
5603
|
-
function
|
5604
|
-
|
5605
|
-
|
5606
|
-
|
5607
|
-
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5608
|
-
if (GlobalVars.hostClientType === HostClientType.desktop ||
|
5609
|
-
GlobalVars.hostClientType === HostClientType.web ||
|
5610
|
-
GlobalVars.hostClientType === HostClientType.rigel ||
|
5611
|
-
GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
|
5612
|
-
GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
|
5613
|
-
GlobalVars.hostClientType === HostClientType.teamsPhones ||
|
5614
|
-
GlobalVars.hostClientType === HostClientType.teamsDisplays) {
|
5615
|
-
var notSupportedError = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
|
5616
|
-
callback(notSupportedError, null);
|
5617
|
-
return;
|
5618
|
-
}
|
5619
|
-
if (!isCurrentSDKVersionAtLeast(scanBarCodeAPIMobileSupportVersion)) {
|
5620
|
-
var oldPlatformError = { errorCode: ErrorCode.OLD_PLATFORM };
|
5621
|
-
callback(oldPlatformError, null);
|
5622
|
-
return;
|
5623
|
-
}
|
5624
|
-
if (!validateScanBarCodeInput(config)) {
|
5625
|
-
var invalidInput = { errorCode: ErrorCode.INVALID_ARGUMENTS };
|
5626
|
-
callback(invalidInput, null);
|
5627
|
-
return;
|
5840
|
+
ChildAppWindow.prototype.addEventListener = function (type, listener) {
|
5841
|
+
ensureInitialized();
|
5842
|
+
if (type === 'message') {
|
5843
|
+
registerHandler('messageForParent', listener);
|
5628
5844
|
}
|
5629
|
-
|
5845
|
+
};
|
5846
|
+
return ChildAppWindow;
|
5847
|
+
}());
|
5848
|
+
|
5849
|
+
var ParentAppWindow = /** @class */ (function () {
|
5850
|
+
function ParentAppWindow() {
|
5630
5851
|
}
|
5631
|
-
|
5632
|
-
|
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
|
+
|
5633
5885
|
|
5634
5886
|
;// CONCATENATED MODULE: ./src/public/location.ts
|
5635
5887
|
|
@@ -5638,48 +5890,75 @@ var media;
|
|
5638
5890
|
|
5639
5891
|
|
5640
5892
|
|
5641
|
-
|
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
|
+
*/
|
5642
5899
|
var location_location;
|
5643
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
|
+
*/
|
5644
5911
|
function getLocation(props, callback) {
|
5912
|
+
if (!callback) {
|
5913
|
+
throw new Error('[location.getLocation] Callback cannot be null');
|
5914
|
+
}
|
5645
5915
|
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5646
|
-
|
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);
|
5647
5926
|
}
|
5648
5927
|
location_1.getLocation = getLocation;
|
5649
|
-
|
5650
|
-
|
5651
|
-
|
5652
|
-
|
5653
|
-
|
5654
|
-
|
5655
|
-
|
5656
|
-
|
5657
|
-
|
5658
|
-
throw errorNotSupportedOnPlatform;
|
5659
|
-
}
|
5660
|
-
resolve(sendAndHandleSdkError('location.getLocation', props));
|
5661
|
-
});
|
5662
|
-
}
|
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
|
+
*/
|
5663
5937
|
function showLocation(location, callback) {
|
5938
|
+
if (!callback) {
|
5939
|
+
throw new Error('[location.showLocation] Callback cannot be null');
|
5940
|
+
}
|
5664
5941
|
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
5665
|
-
|
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);
|
5666
5952
|
}
|
5667
5953
|
location_1.showLocation = showLocation;
|
5668
|
-
|
5669
|
-
|
5670
|
-
|
5671
|
-
|
5672
|
-
|
5673
|
-
|
5674
|
-
|
5675
|
-
|
5676
|
-
if (!isSupported()) {
|
5677
|
-
throw errorNotSupportedOnPlatform;
|
5678
|
-
}
|
5679
|
-
resolve(sendAndHandleSdkError('location.showLocation', location));
|
5680
|
-
});
|
5681
|
-
}
|
5682
|
-
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
|
+
*/
|
5683
5962
|
function isSupported() {
|
5684
5963
|
return runtime.supports.location ? true : false;
|
5685
5964
|
}
|
@@ -6273,18 +6552,21 @@ var profile;
|
|
6273
6552
|
|
6274
6553
|
/**
|
6275
6554
|
* Namespace to video extensibility of the SDK
|
6555
|
+
* @beta
|
6276
6556
|
*/
|
6277
6557
|
var video;
|
6278
6558
|
(function (video) {
|
6279
6559
|
/**
|
6280
6560
|
* Video frame format enum, currently only support NV12
|
6561
|
+
* @beta
|
6281
6562
|
*/
|
6282
6563
|
var VideoFrameFormat;
|
6283
6564
|
(function (VideoFrameFormat) {
|
6284
6565
|
VideoFrameFormat[VideoFrameFormat["NV12"] = 0] = "NV12";
|
6285
6566
|
})(VideoFrameFormat = video.VideoFrameFormat || (video.VideoFrameFormat = {}));
|
6286
6567
|
/**
|
6287
|
-
*
|
6568
|
+
* Video effect change type enum
|
6569
|
+
* @beta
|
6288
6570
|
*/
|
6289
6571
|
var EffectChangeType;
|
6290
6572
|
(function (EffectChangeType) {
|
@@ -6299,6 +6581,7 @@ var video;
|
|
6299
6581
|
})(EffectChangeType = video.EffectChangeType || (video.EffectChangeType = {}));
|
6300
6582
|
/**
|
6301
6583
|
* Register to read the video frames in Permissions section
|
6584
|
+
* @beta
|
6302
6585
|
* @param frameCallback - The callback to invoke when registerForVideoFrame has completed
|
6303
6586
|
* @param config - VideoFrameConfig to customize generated video frame parameters
|
6304
6587
|
*/
|
@@ -6316,10 +6599,10 @@ var video;
|
|
6316
6599
|
}
|
6317
6600
|
video.registerForVideoFrame = registerForVideoFrame;
|
6318
6601
|
/**
|
6319
|
-
*
|
6602
|
+
* Video extension should call this to notify host client that the current selected effect parameter changed.
|
6320
6603
|
* If it's pre-meeting, host client will call videoEffectCallback immediately then use the videoEffect.
|
6321
6604
|
* If it's the in-meeting scenario, we will call videoEffectCallback when apply button clicked.
|
6322
|
-
*
|
6605
|
+
* @beta
|
6323
6606
|
* @param effectChangeType - the effect change type.
|
6324
6607
|
* @param effectId - Newly selected effect id.
|
6325
6608
|
*/
|
@@ -6333,6 +6616,7 @@ var video;
|
|
6333
6616
|
video.notifySelectedVideoEffectChanged = notifySelectedVideoEffectChanged;
|
6334
6617
|
/**
|
6335
6618
|
* Register the video effect callback, host client uses this to notify the video extension the new video effect will by applied
|
6619
|
+
* @beta
|
6336
6620
|
* @param callback - The VideoEffectCallback to invoke when registerForVideoEffect has completed
|
6337
6621
|
*/
|
6338
6622
|
function registerForVideoEffect(callback) {
|
@@ -6346,12 +6630,14 @@ var video;
|
|
6346
6630
|
/**
|
6347
6631
|
* Sending notification to host client finished the video frame processing, now host client can render this video frame
|
6348
6632
|
* or pass the video frame to next one in video pipeline
|
6633
|
+
* @beta
|
6349
6634
|
*/
|
6350
6635
|
function notifyVideoFrameProcessed() {
|
6351
6636
|
sendMessageToParent('video.videoFrameProcessed');
|
6352
6637
|
}
|
6353
6638
|
/**
|
6354
6639
|
* Sending error notification to host client
|
6640
|
+
* @beta
|
6355
6641
|
* @param errorMessage - The error message that will be sent to the host
|
6356
6642
|
*/
|
6357
6643
|
function notifyError(errorMessage) {
|
@@ -6359,6 +6645,7 @@ var video;
|
|
6359
6645
|
}
|
6360
6646
|
/**
|
6361
6647
|
* Checks if video capability is supported by the host
|
6648
|
+
* @beta
|
6362
6649
|
* @returns true if the video capability is enabled in runtime.supports.video and
|
6363
6650
|
* false if it is disabled
|
6364
6651
|
*/
|
@@ -6462,8 +6749,11 @@ var sharing;
|
|
6462
6749
|
|
6463
6750
|
|
6464
6751
|
|
6752
|
+
|
6465
6753
|
/**
|
6466
6754
|
* Namespace to interact with the stage view specific part of the SDK.
|
6755
|
+
*
|
6756
|
+
* @beta
|
6467
6757
|
*/
|
6468
6758
|
var stageView;
|
6469
6759
|
(function (stageView) {
|
@@ -6472,12 +6762,16 @@ var stageView;
|
|
6472
6762
|
* Feature is under development
|
6473
6763
|
*
|
6474
6764
|
* Opens a stage view to display a Teams application
|
6765
|
+
* @beta
|
6475
6766
|
* @param stageViewParams - The parameters to pass into the stage view.
|
6476
6767
|
* @returns Promise that resolves or rejects with an error once the stage view is closed.
|
6477
6768
|
*/
|
6478
6769
|
function open(stageViewParams) {
|
6479
6770
|
return new Promise(function (resolve) {
|
6480
6771
|
ensureInitialized(FrameContexts.content);
|
6772
|
+
if (!isSupported()) {
|
6773
|
+
throw errorNotSupportedOnPlatform;
|
6774
|
+
}
|
6481
6775
|
if (!stageViewParams) {
|
6482
6776
|
throw new Error('[stageView.open] Stage view params cannot be null');
|
6483
6777
|
}
|
@@ -6485,8 +6779,59 @@ var stageView;
|
|
6485
6779
|
});
|
6486
6780
|
}
|
6487
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;
|
6488
6792
|
})(stageView || (stageView = {}));
|
6489
6793
|
|
6794
|
+
;// CONCATENATED MODULE: ./src/public/webStorage.ts
|
6795
|
+
|
6796
|
+
|
6797
|
+
|
6798
|
+
|
6799
|
+
/**
|
6800
|
+
* Contains functionality to allow web apps to store data in webview cache
|
6801
|
+
*
|
6802
|
+
* @beta
|
6803
|
+
*/
|
6804
|
+
var webStorage;
|
6805
|
+
(function (webStorage) {
|
6806
|
+
/**
|
6807
|
+
* Checks if web storage gets cleared when a user logs out from host client
|
6808
|
+
*
|
6809
|
+
* @returns true is web storage gets cleared on logout and false if it does not
|
6810
|
+
*
|
6811
|
+
* @beta
|
6812
|
+
*/
|
6813
|
+
function isWebStorageClearedOnUserLogOut() {
|
6814
|
+
ensureInitialized();
|
6815
|
+
// return true as web storage is always cleared on desktop.
|
6816
|
+
if (GlobalVars.hostClientType === HostClientType.desktop) {
|
6817
|
+
return true;
|
6818
|
+
}
|
6819
|
+
return isSupported();
|
6820
|
+
}
|
6821
|
+
webStorage.isWebStorageClearedOnUserLogOut = isWebStorageClearedOnUserLogOut;
|
6822
|
+
/**
|
6823
|
+
* Checks if webStorage capability is supported by the host
|
6824
|
+
* @returns true if the webStorage capability is enabled in runtime.supports.webStorage and
|
6825
|
+
* false if it is disabled
|
6826
|
+
*
|
6827
|
+
* @beta
|
6828
|
+
*/
|
6829
|
+
function isSupported() {
|
6830
|
+
return runtime.supports.webStorage ? true : false;
|
6831
|
+
}
|
6832
|
+
webStorage.isSupported = isSupported;
|
6833
|
+
})(webStorage || (webStorage = {}));
|
6834
|
+
|
6490
6835
|
;// CONCATENATED MODULE: ./src/public/call.ts
|
6491
6836
|
|
6492
6837
|
|
@@ -6513,9 +6858,9 @@ var call;
|
|
6513
6858
|
function startCall(startCallParams) {
|
6514
6859
|
return new Promise(function (resolve) {
|
6515
6860
|
var _a;
|
6516
|
-
ensureInitialized(FrameContexts.content);
|
6861
|
+
ensureInitialized(FrameContexts.content, FrameContexts.task);
|
6517
6862
|
if (!isSupported()) {
|
6518
|
-
throw
|
6863
|
+
throw errorNotSupportedOnPlatform;
|
6519
6864
|
}
|
6520
6865
|
if (runtime.isLegacyTeams) {
|
6521
6866
|
resolve(sendAndHandleSdkError('executeDeepLink', createTeamsDeepLinkForCall(startCallParams.targets, (_a = startCallParams.requestedModalities) === null || _a === void 0 ? void 0 : _a.includes(CallModalities.Video), startCallParams.source)));
|
@@ -7323,6 +7668,9 @@ var tasks;
|
|
7323
7668
|
|
7324
7669
|
|
7325
7670
|
|
7671
|
+
|
7672
|
+
|
7673
|
+
|
7326
7674
|
|
7327
7675
|
|
7328
7676
|
|