@microsoft/teams-js 2.34.0-beta.1 → 2.34.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.
- package/README.md +4 -4
- package/dist/esm/_virtual/_polyfill-node.buffer.js +1 -0
- package/dist/esm/_virtual/_polyfill-node.global.js +1 -0
- package/dist/esm/packages/teams-js/dts/internal/constants.d.ts +8 -0
- package/dist/esm/packages/teams-js/dts/internal/internalAPIs.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/internal/messageObjects.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/internal/validOrigins.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/public/app/app.d.ts +9 -0
- package/dist/esm/packages/teams-js/dts/public/authentication.d.ts +0 -6
- package/dist/esm/packages/teams-js/dts/public/constants.d.ts +2 -0
- package/dist/esm/packages/teams-js/dts/public/interfaces.d.ts +14 -0
- package/dist/esm/packages/teams-js/src/internal/appHelpers.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/communication.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/constants.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/internalAPIs.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/utils.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/validOrigins.js +1 -1
- package/dist/esm/packages/teams-js/src/public/app/app.js +1 -1
- package/dist/esm/packages/teams-js/src/public/authentication.js +1 -1
- package/dist/esm/packages/teams-js/src/public/constants.js +1 -1
- package/dist/esm/packages/teams-js/src/public/nestedAppAuth.js +1 -1
- package/dist/esm/packages/teams-js/src/public/runtime.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/esm/packages/teams-js/src/public/webStorage.js +1 -1
- package/dist/umd/MicrosoftTeams.js +529 -628
- package/dist/umd/MicrosoftTeams.js.map +1 -1
- package/dist/umd/MicrosoftTeams.min.js +1 -1
- package/dist/umd/MicrosoftTeams.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/node_modules/.pnpm/rollup-plugin-node-polyfills@0.2.1/node_modules/rollup-plugin-node-polyfills/polyfills/buffer-es6.js +0 -1
- package/dist/esm/packages/teams-js/dts/internal/uint8array-extras/uint8array-extras.d.ts +0 -6
@@ -1148,20 +1148,6 @@ __webpack_require__.d(app_namespaceObject, {
|
|
1148
1148
|
registerOnThemeChangeHandler: () => (registerOnThemeChangeHandler)
|
1149
1149
|
});
|
1150
1150
|
|
1151
|
-
// NAMESPACE OBJECT: ./src/public/authentication.ts
|
1152
|
-
var authentication_namespaceObject = {};
|
1153
|
-
__webpack_require__.r(authentication_namespaceObject);
|
1154
|
-
__webpack_require__.d(authentication_namespaceObject, {
|
1155
|
-
DataResidency: () => (DataResidency),
|
1156
|
-
authenticate: () => (authenticate),
|
1157
|
-
getAuthToken: () => (getAuthToken),
|
1158
|
-
getUser: () => (getUser),
|
1159
|
-
initialize: () => (authentication_initialize),
|
1160
|
-
notifyFailure: () => (authentication_notifyFailure),
|
1161
|
-
notifySuccess: () => (authentication_notifySuccess),
|
1162
|
-
registerAuthenticationHandlers: () => (registerAuthenticationHandlers)
|
1163
|
-
});
|
1164
|
-
|
1165
1151
|
// NAMESPACE OBJECT: ./src/public/dialog/update.ts
|
1166
1152
|
var update_namespaceObject = {};
|
1167
1153
|
__webpack_require__.r(update_namespaceObject);
|
@@ -1615,6 +1601,19 @@ __webpack_require__.d(store_namespaceObject, {
|
|
1615
1601
|
openSpecificStore: () => (openSpecificStore)
|
1616
1602
|
});
|
1617
1603
|
|
1604
|
+
// NAMESPACE OBJECT: ./src/public/authentication.ts
|
1605
|
+
var authentication_namespaceObject = {};
|
1606
|
+
__webpack_require__.r(authentication_namespaceObject);
|
1607
|
+
__webpack_require__.d(authentication_namespaceObject, {
|
1608
|
+
DataResidency: () => (DataResidency),
|
1609
|
+
authenticate: () => (authenticate),
|
1610
|
+
getAuthToken: () => (getAuthToken),
|
1611
|
+
getUser: () => (getUser),
|
1612
|
+
notifyFailure: () => (authentication_notifyFailure),
|
1613
|
+
notifySuccess: () => (authentication_notifySuccess),
|
1614
|
+
registerAuthenticationHandlers: () => (registerAuthenticationHandlers)
|
1615
|
+
});
|
1616
|
+
|
1618
1617
|
// NAMESPACE OBJECT: ./src/public/appInstallDialog.ts
|
1619
1618
|
var appInstallDialog_namespaceObject = {};
|
1620
1619
|
__webpack_require__.r(appInstallDialog_namespaceObject);
|
@@ -3156,6 +3155,8 @@ var HostClientType;
|
|
3156
3155
|
HostClientType["ipados"] = "ipados";
|
3157
3156
|
/** The host is running on a macOS client, which runs on devices such as MacBooks. */
|
3158
3157
|
HostClientType["macos"] = "macos";
|
3158
|
+
/** The host is running on a visionOS client, which runs on devices such as Apple Vision. */
|
3159
|
+
HostClientType["visionOS"] = "visionOS";
|
3159
3160
|
/**
|
3160
3161
|
* @deprecated
|
3161
3162
|
* As of TeamsJS v2.0.0, please use {@link teamsRoomsWindows} instead.
|
@@ -4013,6 +4014,14 @@ const validOriginsLocal = artifactsForCDN_validDomains_namespaceObject;
|
|
4013
4014
|
* Limited to Microsoft-internal use
|
4014
4015
|
*/
|
4015
4016
|
const validOriginsFallback = validOriginsLocal.validOrigins;
|
4017
|
+
/**
|
4018
|
+
* @hidden
|
4019
|
+
* Timeout length for Fetch Call for Valid Origins
|
4020
|
+
*
|
4021
|
+
* @internal
|
4022
|
+
* Limited to Microsoft-internal use
|
4023
|
+
*/
|
4024
|
+
const ORIGIN_LIST_FETCH_TIMEOUT_IN_MS = 1500;
|
4016
4025
|
/**
|
4017
4026
|
* @hidden
|
4018
4027
|
* CDN endpoint of the list of valid origins
|
@@ -4188,7 +4197,12 @@ const v1NonMobileHostClientTypes = [
|
|
4188
4197
|
HostClientType.teamsPhones,
|
4189
4198
|
HostClientType.teamsDisplays,
|
4190
4199
|
];
|
4191
|
-
const v1MobileHostClientTypes = [
|
4200
|
+
const v1MobileHostClientTypes = [
|
4201
|
+
HostClientType.android,
|
4202
|
+
HostClientType.ios,
|
4203
|
+
HostClientType.ipados,
|
4204
|
+
HostClientType.visionOS,
|
4205
|
+
];
|
4192
4206
|
const v1HostClientTypes = [...v1NonMobileHostClientTypes, ...v1MobileHostClientTypes];
|
4193
4207
|
/**
|
4194
4208
|
* @hidden
|
@@ -4338,7 +4352,7 @@ const mapTeamsVersionToSupportedCapabilities = {
|
|
4338
4352
|
'2.1.1': [
|
4339
4353
|
{
|
4340
4354
|
capability: { nestedAppAuth: {} },
|
4341
|
-
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados],
|
4355
|
+
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados, HostClientType.visionOS],
|
4342
4356
|
},
|
4343
4357
|
],
|
4344
4358
|
};
|
@@ -4470,7 +4484,7 @@ function isSerializable(arg) {
|
|
4470
4484
|
* @hidden
|
4471
4485
|
* Package version.
|
4472
4486
|
*/
|
4473
|
-
const version = "2.34.
|
4487
|
+
const version = "2.34.1-beta.0";
|
4474
4488
|
|
4475
4489
|
;// ./src/internal/internalAPIs.ts
|
4476
4490
|
|
@@ -4549,7 +4563,7 @@ function isCurrentSDKVersionAtLeast(requiredVersion = defaultSDKVersionForCompat
|
|
4549
4563
|
}
|
4550
4564
|
/**
|
4551
4565
|
* @hidden
|
4552
|
-
* Helper function to identify if host client is either android, ios, or
|
4566
|
+
* Helper function to identify if host client is either android, ios, ipados, or visionOS
|
4553
4567
|
*
|
4554
4568
|
* @internal
|
4555
4569
|
* Limited to Microsoft-internal use
|
@@ -4557,7 +4571,8 @@ function isCurrentSDKVersionAtLeast(requiredVersion = defaultSDKVersionForCompat
|
|
4557
4571
|
function isHostClientMobile() {
|
4558
4572
|
return (GlobalVars.hostClientType == HostClientType.android ||
|
4559
4573
|
GlobalVars.hostClientType == HostClientType.ios ||
|
4560
|
-
GlobalVars.hostClientType == HostClientType.ipados
|
4574
|
+
GlobalVars.hostClientType == HostClientType.ipados ||
|
4575
|
+
GlobalVars.hostClientType == HostClientType.visionOS);
|
4561
4576
|
}
|
4562
4577
|
/**
|
4563
4578
|
* @hidden
|
@@ -4697,139 +4712,8 @@ function isNullOrUndefined(value) {
|
|
4697
4712
|
return value === null || value === undefined;
|
4698
4713
|
}
|
4699
4714
|
|
4700
|
-
;// ./src/internal/validOrigins.ts
|
4701
|
-
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
4702
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4703
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4704
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
4705
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
4706
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
4707
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
4708
|
-
});
|
4709
|
-
};
|
4710
|
-
|
4711
|
-
|
4712
|
-
|
4713
|
-
|
4714
|
-
let validOriginsCache = [];
|
4715
|
-
const validateOriginLogger = getLogger('validateOrigin');
|
4716
|
-
function prefetchOriginsFromCDN() {
|
4717
|
-
return __awaiter(this, void 0, void 0, function* () {
|
4718
|
-
yield getValidOriginsListFromCDN();
|
4719
|
-
});
|
4720
|
-
}
|
4721
|
-
function isValidOriginsCacheEmpty() {
|
4722
|
-
return validOriginsCache.length === 0;
|
4723
|
-
}
|
4724
|
-
function getValidOriginsListFromCDN() {
|
4725
|
-
return __awaiter(this, void 0, void 0, function* () {
|
4726
|
-
if (!isValidOriginsCacheEmpty()) {
|
4727
|
-
return validOriginsCache;
|
4728
|
-
}
|
4729
|
-
if (!inServerSideRenderingEnvironment()) {
|
4730
|
-
return fetch(validOriginsCdnEndpoint)
|
4731
|
-
.then((response) => {
|
4732
|
-
if (!response.ok) {
|
4733
|
-
throw new Error('Invalid Response from Fetch Call');
|
4734
|
-
}
|
4735
|
-
return response.json().then((validOriginsCDN) => {
|
4736
|
-
if (isValidOriginsJSONValid(JSON.stringify(validOriginsCDN))) {
|
4737
|
-
validOriginsCache = validOriginsCDN.validOrigins;
|
4738
|
-
return validOriginsCache;
|
4739
|
-
}
|
4740
|
-
else {
|
4741
|
-
throw new Error('Valid Origins List Is Invalid');
|
4742
|
-
}
|
4743
|
-
});
|
4744
|
-
})
|
4745
|
-
.catch((e) => {
|
4746
|
-
validateOriginLogger('validOrigins fetch call to CDN failed with error: %s. Defaulting to fallback list', e);
|
4747
|
-
validOriginsCache = validOriginsFallback;
|
4748
|
-
return validOriginsCache;
|
4749
|
-
});
|
4750
|
-
}
|
4751
|
-
else {
|
4752
|
-
validOriginsCache = validOriginsFallback;
|
4753
|
-
return validOriginsFallback;
|
4754
|
-
}
|
4755
|
-
});
|
4756
|
-
}
|
4757
|
-
function isValidOriginsJSONValid(validOriginsJSON) {
|
4758
|
-
let validOriginsCDN = JSON.parse(validOriginsJSON);
|
4759
|
-
try {
|
4760
|
-
validOriginsCDN = JSON.parse(validOriginsJSON);
|
4761
|
-
}
|
4762
|
-
catch (_) {
|
4763
|
-
return false;
|
4764
|
-
}
|
4765
|
-
if (!validOriginsCDN.validOrigins) {
|
4766
|
-
return false;
|
4767
|
-
}
|
4768
|
-
for (const validOrigin of validOriginsCDN.validOrigins) {
|
4769
|
-
try {
|
4770
|
-
new URL('https://' + validOrigin);
|
4771
|
-
}
|
4772
|
-
catch (_) {
|
4773
|
-
validateOriginLogger('isValidOriginsFromCDN call failed to validate origin: %s', validOrigin);
|
4774
|
-
return false;
|
4775
|
-
}
|
4776
|
-
}
|
4777
|
-
return true;
|
4778
|
-
}
|
4779
|
-
/**
|
4780
|
-
* @param pattern - reference pattern
|
4781
|
-
* @param host - candidate string
|
4782
|
-
* @returns returns true if host matches pre-know valid pattern
|
4783
|
-
*
|
4784
|
-
* @example
|
4785
|
-
* validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
|
4786
|
-
* validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
|
4787
|
-
*
|
4788
|
-
* @internal
|
4789
|
-
* Limited to Microsoft-internal use
|
4790
|
-
*/
|
4791
|
-
function validateHostAgainstPattern(pattern, host) {
|
4792
|
-
if (pattern.substring(0, 2) === '*.') {
|
4793
|
-
const suffix = pattern.substring(1);
|
4794
|
-
if (host.length > suffix.length &&
|
4795
|
-
host.split('.').length === suffix.split('.').length &&
|
4796
|
-
host.substring(host.length - suffix.length) === suffix) {
|
4797
|
-
return true;
|
4798
|
-
}
|
4799
|
-
}
|
4800
|
-
else if (pattern === host) {
|
4801
|
-
return true;
|
4802
|
-
}
|
4803
|
-
return false;
|
4804
|
-
}
|
4805
|
-
/**
|
4806
|
-
* @internal
|
4807
|
-
* Limited to Microsoft-internal use
|
4808
|
-
*/
|
4809
|
-
function validateOrigin(messageOrigin) {
|
4810
|
-
return getValidOriginsListFromCDN().then((validOriginsList) => {
|
4811
|
-
// Check whether the url is in the pre-known allowlist or supplied by user
|
4812
|
-
if (!isValidHttpsURL(messageOrigin)) {
|
4813
|
-
validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
|
4814
|
-
return false;
|
4815
|
-
}
|
4816
|
-
const messageOriginHost = messageOrigin.host;
|
4817
|
-
if (validOriginsList.some((pattern) => validateHostAgainstPattern(pattern, messageOriginHost))) {
|
4818
|
-
return true;
|
4819
|
-
}
|
4820
|
-
for (const domainOrPattern of GlobalVars.additionalValidOrigins) {
|
4821
|
-
const pattern = domainOrPattern.substring(0, 8) === 'https://' ? domainOrPattern.substring(8) : domainOrPattern;
|
4822
|
-
if (validateHostAgainstPattern(pattern, messageOriginHost)) {
|
4823
|
-
return true;
|
4824
|
-
}
|
4825
|
-
}
|
4826
|
-
validateOriginLogger('Origin %s is invalid because it is not an origin approved by this library or included in the call to app.initialize.\nOrigins approved by this library: %o\nOrigins included in app.initialize: %o', messageOrigin, validOriginsList, GlobalVars.additionalValidOrigins);
|
4827
|
-
return false;
|
4828
|
-
});
|
4829
|
-
}
|
4830
|
-
|
4831
4715
|
;// ./src/private/messageChannels/telemetry.ts
|
4832
|
-
var
|
4716
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
4833
4717
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4834
4718
|
return new (P || (P = Promise))(function (resolve, reject) {
|
4835
4719
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
@@ -4861,7 +4745,7 @@ const logger = getLogger('messageChannels.telemetry');
|
|
4861
4745
|
* Limited to Microsoft-internal use
|
4862
4746
|
*/
|
4863
4747
|
function getTelemetryPort() {
|
4864
|
-
return
|
4748
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4865
4749
|
// If the port has already been initialized, return it.
|
4866
4750
|
if (telemetryPort) {
|
4867
4751
|
logger('Returning telemetry port from cache');
|
@@ -5155,7 +5039,6 @@ logWhereTeamsJsIsBeingUsed();
|
|
5155
5039
|
* @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
|
5156
5040
|
*/
|
5157
5041
|
function initialize(validMessageOrigins) {
|
5158
|
-
prefetchOriginsFromCDN();
|
5159
5042
|
return appInitializeHelper(getApiVersionTag(appTelemetryVersionNumber, "app.initialize" /* ApiName.App_Initialize */), validMessageOrigins);
|
5160
5043
|
}
|
5161
5044
|
/**
|
@@ -5319,6 +5202,8 @@ function transformLegacyContextToAppContext(legacyContext) {
|
|
5319
5202
|
ringId: legacyContext.ringId,
|
5320
5203
|
},
|
5321
5204
|
appLaunchId: legacyContext.appLaunchId,
|
5205
|
+
appId: legacyContext.appId ? new AppId(legacyContext.appId) : undefined,
|
5206
|
+
manifestVersion: legacyContext.manifestVersion,
|
5322
5207
|
},
|
5323
5208
|
page: {
|
5324
5209
|
id: legacyContext.entityId,
|
@@ -5398,469 +5283,104 @@ function transformLegacyContextToAppContext(legacyContext) {
|
|
5398
5283
|
return context;
|
5399
5284
|
}
|
5400
5285
|
|
5401
|
-
;// ./src/public/
|
5286
|
+
;// ./src/public/dialog/update.ts
|
5402
5287
|
/**
|
5403
|
-
* Module to
|
5288
|
+
* Module to update the dialog
|
5404
5289
|
*
|
5405
|
-
* This object is used for starting or completing authentication flows.
|
5406
5290
|
* @module
|
5407
5291
|
*/
|
5408
5292
|
|
5409
5293
|
|
5410
5294
|
|
5411
5295
|
|
5296
|
+
/**
|
5297
|
+
* Update dimensions - height/width of a dialog.
|
5298
|
+
*
|
5299
|
+
* @param dimensions - An object containing width and height properties.
|
5300
|
+
*/
|
5301
|
+
function resize(dimensions) {
|
5302
|
+
updateResizeHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.update.resize" /* ApiName.Dialog_Update_Resize */), dimensions);
|
5303
|
+
}
|
5304
|
+
/**
|
5305
|
+
* Checks if dialog.update capability is supported by the host
|
5306
|
+
* @returns boolean to represent whether dialog.update capabilty is supported
|
5307
|
+
*
|
5308
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
5309
|
+
*/
|
5310
|
+
function update_isSupported() {
|
5311
|
+
return ensureInitialized(runtime) && runtime.supports.dialog
|
5312
|
+
? runtime.supports.dialog.update
|
5313
|
+
? true
|
5314
|
+
: false
|
5315
|
+
: false;
|
5316
|
+
}
|
5317
|
+
|
5318
|
+
;// ./src/public/dialog/url/bot.ts
|
5319
|
+
/**
|
5320
|
+
* Module to open a dialog that sends results to the bot framework
|
5321
|
+
*
|
5322
|
+
* @module
|
5323
|
+
*/
|
5412
5324
|
|
5413
5325
|
|
5414
5326
|
|
5415
5327
|
|
5416
5328
|
/**
|
5417
|
-
*
|
5329
|
+
* Allows an app to open a dialog that sends submitted data to a bot.
|
5330
|
+
*
|
5331
|
+
* @param botUrlDialogInfo - An object containing the parameters of the dialog module including completionBotId.
|
5332
|
+
* @param submitHandler - Handler that triggers when the dialog has been submitted or closed.
|
5333
|
+
* @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
|
5334
|
+
*
|
5335
|
+
* @returns a function that can be used to send messages to the dialog.
|
5418
5336
|
*/
|
5419
|
-
|
5420
|
-
|
5421
|
-
|
5422
|
-
let authWindowMonitor;
|
5337
|
+
function bot_open(botUrlDialogInfo, submitHandler, messageFromChildHandler) {
|
5338
|
+
botUrlOpenHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.bot.open" /* ApiName.Dialog_Url_Bot_Open */), botUrlDialogInfo, submitHandler, messageFromChildHandler);
|
5339
|
+
}
|
5423
5340
|
/**
|
5424
|
-
*
|
5425
|
-
*
|
5426
|
-
*
|
5341
|
+
* Checks if dialog.url.bot capability is supported by the host
|
5342
|
+
*
|
5343
|
+
* @returns boolean to represent whether dialog.url.bot is supported
|
5344
|
+
*
|
5345
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
5427
5346
|
*/
|
5428
|
-
function
|
5429
|
-
|
5430
|
-
|
5347
|
+
function bot_isSupported() {
|
5348
|
+
return (ensureInitialized(runtime) &&
|
5349
|
+
(runtime.supports.dialog && runtime.supports.dialog.url && runtime.supports.dialog.url.bot) !== undefined);
|
5431
5350
|
}
|
5432
|
-
|
5351
|
+
|
5352
|
+
;// ./src/public/dialog/url/parentCommunication.ts
|
5433
5353
|
/**
|
5434
|
-
*
|
5435
|
-
* As of TeamsJS v2.0.0, this function has been deprecated in favor of a Promise-based pattern using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
|
5354
|
+
* Subcapability that allows communication between the dialog and the parent app.
|
5436
5355
|
*
|
5437
|
-
*
|
5356
|
+
* @remarks
|
5357
|
+
* Note that dialog can be invoked from parentless scenarios e.g. Search Message Extensions. The subcapability `parentCommunication` is not supported in such scenarios.
|
5438
5358
|
*
|
5439
|
-
* @
|
5359
|
+
* @module
|
5440
5360
|
*/
|
5441
|
-
|
5442
|
-
|
5443
|
-
|
5444
|
-
|
5445
|
-
|
5446
|
-
|
5447
|
-
|
5448
|
-
|
5449
|
-
|
5450
|
-
|
5451
|
-
|
5452
|
-
|
5453
|
-
|
5454
|
-
|
5455
|
-
|
5456
|
-
|
5457
|
-
|
5458
|
-
|
5459
|
-
|
5460
|
-
|
5461
|
-
|
5462
|
-
|
5463
|
-
|
5464
|
-
}
|
5465
|
-
finally {
|
5466
|
-
if (!isDifferentParamsInCall) {
|
5467
|
-
authParams = undefined;
|
5468
|
-
}
|
5469
|
-
}
|
5470
|
-
})
|
5471
|
-
.catch((err) => {
|
5472
|
-
try {
|
5473
|
-
if (authenticateParams && authenticateParams.failureCallback) {
|
5474
|
-
authenticateParams.failureCallback(err.message);
|
5475
|
-
return '';
|
5476
|
-
}
|
5477
|
-
throw err;
|
5478
|
-
}
|
5479
|
-
finally {
|
5480
|
-
if (!isDifferentParamsInCall) {
|
5481
|
-
authParams = undefined;
|
5482
|
-
}
|
5483
|
-
}
|
5484
|
-
});
|
5485
|
-
}
|
5486
|
-
function authenticateHelper(apiVersionTag, authenticateParameters) {
|
5487
|
-
return new Promise((resolve, reject) => {
|
5488
|
-
if (GlobalVars.hostClientType !== HostClientType.web) {
|
5489
|
-
// Convert any relative URLs into absolute URLs before sending them over to the parent window.
|
5490
|
-
const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url);
|
5491
|
-
validateUrl(fullyQualifiedURL);
|
5492
|
-
// Ask the parent window to open an authentication window with the parameters provided by the caller.
|
5493
|
-
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.authenticate', [
|
5494
|
-
fullyQualifiedURL.href,
|
5495
|
-
authenticateParameters.width,
|
5496
|
-
authenticateParameters.height,
|
5497
|
-
authenticateParameters.isExternal,
|
5498
|
-
]).then(([success, response]) => {
|
5499
|
-
if (success) {
|
5500
|
-
return response;
|
5501
|
-
}
|
5502
|
-
else {
|
5503
|
-
throw new Error(response);
|
5504
|
-
}
|
5505
|
-
}));
|
5506
|
-
}
|
5507
|
-
else {
|
5508
|
-
// Open an authentication window with the parameters provided by the caller.
|
5509
|
-
authHandlers = {
|
5510
|
-
success: resolve,
|
5511
|
-
fail: reject,
|
5512
|
-
};
|
5513
|
-
openAuthenticationWindow(authenticateParameters);
|
5514
|
-
}
|
5515
|
-
});
|
5516
|
-
}
|
5517
|
-
function getAuthToken(authTokenRequest) {
|
5518
|
-
ensureInitializeCalled();
|
5519
|
-
const apiVersionTag = authTokenRequest && (authTokenRequest.successCallback || authTokenRequest.failureCallback)
|
5520
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */)
|
5521
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */);
|
5522
|
-
return getAuthTokenHelper(apiVersionTag, authTokenRequest)
|
5523
|
-
.then((value) => {
|
5524
|
-
if (authTokenRequest && authTokenRequest.successCallback) {
|
5525
|
-
authTokenRequest.successCallback(value);
|
5526
|
-
return '';
|
5527
|
-
}
|
5528
|
-
return value;
|
5529
|
-
})
|
5530
|
-
.catch((err) => {
|
5531
|
-
if (authTokenRequest && authTokenRequest.failureCallback) {
|
5532
|
-
authTokenRequest.failureCallback(err.message);
|
5533
|
-
return '';
|
5534
|
-
}
|
5535
|
-
throw err;
|
5536
|
-
});
|
5537
|
-
}
|
5538
|
-
function getAuthTokenHelper(apiVersionTag, authTokenRequest) {
|
5539
|
-
return new Promise((resolve) => {
|
5540
|
-
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getAuthToken', [
|
5541
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.resources,
|
5542
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.claims,
|
5543
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.silent,
|
5544
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.tenantId,
|
5545
|
-
]));
|
5546
|
-
}).then(([success, result]) => {
|
5547
|
-
if (success) {
|
5548
|
-
return result;
|
5549
|
-
}
|
5550
|
-
else {
|
5551
|
-
throw new Error(result);
|
5552
|
-
}
|
5553
|
-
});
|
5554
|
-
}
|
5555
|
-
function getUser(userRequest) {
|
5556
|
-
ensureInitializeCalled();
|
5557
|
-
const apiVersionTag = userRequest && (userRequest.successCallback || userRequest.failureCallback)
|
5558
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getUser" /* ApiName.Authentication_GetUser */)
|
5559
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getUser" /* ApiName.Authentication_GetUser */);
|
5560
|
-
return getUserHelper(apiVersionTag)
|
5561
|
-
.then((value) => {
|
5562
|
-
if (userRequest && userRequest.successCallback) {
|
5563
|
-
userRequest.successCallback(value);
|
5564
|
-
return null;
|
5565
|
-
}
|
5566
|
-
return value;
|
5567
|
-
})
|
5568
|
-
.catch((err) => {
|
5569
|
-
const errorMessage = `Error returned, code = ${err.errorCode}, message = ${err.message}`;
|
5570
|
-
if (userRequest && userRequest.failureCallback) {
|
5571
|
-
userRequest.failureCallback(errorMessage);
|
5572
|
-
return null;
|
5573
|
-
}
|
5574
|
-
throw new Error(errorMessage);
|
5575
|
-
});
|
5576
|
-
}
|
5577
|
-
function getUserHelper(apiVersionTag) {
|
5578
|
-
return new Promise((resolve) => {
|
5579
|
-
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getUser'));
|
5580
|
-
}).then(([success, result]) => {
|
5581
|
-
if (success) {
|
5582
|
-
return result;
|
5583
|
-
}
|
5584
|
-
else {
|
5585
|
-
throw result;
|
5586
|
-
}
|
5587
|
-
});
|
5588
|
-
}
|
5589
|
-
function closeAuthenticationWindow() {
|
5590
|
-
// Stop monitoring the authentication window
|
5591
|
-
stopAuthenticationWindowMonitor();
|
5592
|
-
// Try to close the authentication window and clear all properties associated with it
|
5593
|
-
try {
|
5594
|
-
if (Communication.childWindow) {
|
5595
|
-
Communication.childWindow.close();
|
5596
|
-
}
|
5597
|
-
}
|
5598
|
-
finally {
|
5599
|
-
Communication.childWindow = null;
|
5600
|
-
Communication.childOrigin = null;
|
5601
|
-
}
|
5602
|
-
}
|
5603
|
-
/**
|
5604
|
-
* Different browsers handle authentication flows in pop-up windows differently.
|
5605
|
-
* Firefox and Safari, which use Quantum and WebKit browser engines respectively, block the use of 'window.open' for pop-up windows.
|
5606
|
-
* Any chrome-based browser (Chrome, Edge, Brave, etc.) opens a new browser window without any user-prompts.
|
5607
|
-
* To ensure consistent behavior across all browsers, consider using the following function to create a new authentication window.
|
5608
|
-
*
|
5609
|
-
* @param authenticateParameters - Parameters describing the authentication window used for executing the authentication flow.
|
5610
|
-
*/
|
5611
|
-
function openAuthenticationWindow(authenticateParameters) {
|
5612
|
-
// Close the previously opened window if we have one
|
5613
|
-
closeAuthenticationWindow();
|
5614
|
-
// Start with a sensible default size
|
5615
|
-
let width = authenticateParameters.width || 600;
|
5616
|
-
let height = authenticateParameters.height || 400;
|
5617
|
-
// Ensure that the new window is always smaller than our app's window so that it never fully covers up our app
|
5618
|
-
width = Math.min(width, Communication.currentWindow.outerWidth - 400);
|
5619
|
-
height = Math.min(height, Communication.currentWindow.outerHeight - 200);
|
5620
|
-
// Convert any relative URLs into absolute URLs before sending them over to the parent window
|
5621
|
-
const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url.replace('{oauthRedirectMethod}', 'web'));
|
5622
|
-
validateUrl(fullyQualifiedURL);
|
5623
|
-
// We are running in the browser, so we need to center the new window ourselves
|
5624
|
-
let left = typeof Communication.currentWindow.screenLeft !== 'undefined'
|
5625
|
-
? Communication.currentWindow.screenLeft
|
5626
|
-
: Communication.currentWindow.screenX;
|
5627
|
-
let top = typeof Communication.currentWindow.screenTop !== 'undefined'
|
5628
|
-
? Communication.currentWindow.screenTop
|
5629
|
-
: Communication.currentWindow.screenY;
|
5630
|
-
left += Communication.currentWindow.outerWidth / 2 - width / 2;
|
5631
|
-
top += Communication.currentWindow.outerHeight / 2 - height / 2;
|
5632
|
-
// Open a child window with a desired set of standard browser features
|
5633
|
-
Communication.childWindow = Communication.currentWindow.open(fullyQualifiedURL.href, '_blank', 'toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=' +
|
5634
|
-
top +
|
5635
|
-
', left=' +
|
5636
|
-
left +
|
5637
|
-
', width=' +
|
5638
|
-
width +
|
5639
|
-
', height=' +
|
5640
|
-
height);
|
5641
|
-
if (Communication.childWindow) {
|
5642
|
-
// Start monitoring the authentication window so that we can detect if it gets closed before the flow completes
|
5643
|
-
startAuthenticationWindowMonitor();
|
5644
|
-
}
|
5645
|
-
else {
|
5646
|
-
// If we failed to open the window, fail the authentication flow
|
5647
|
-
handleFailure('FailedToOpenWindow');
|
5648
|
-
}
|
5649
|
-
}
|
5650
|
-
function stopAuthenticationWindowMonitor() {
|
5651
|
-
if (authWindowMonitor) {
|
5652
|
-
clearInterval(authWindowMonitor);
|
5653
|
-
authWindowMonitor = 0;
|
5654
|
-
}
|
5655
|
-
handlers_removeHandler('initialize');
|
5656
|
-
handlers_removeHandler('navigateCrossDomain');
|
5657
|
-
}
|
5658
|
-
function startAuthenticationWindowMonitor() {
|
5659
|
-
// Stop the previous window monitor if one is running
|
5660
|
-
stopAuthenticationWindowMonitor();
|
5661
|
-
// Create an interval loop that
|
5662
|
-
// - Notifies the caller of failure if it detects that the authentication window is closed
|
5663
|
-
// - Keeps pinging the authentication window while it is open to re-establish
|
5664
|
-
// contact with any pages along the authentication flow that need to communicate
|
5665
|
-
// with us
|
5666
|
-
authWindowMonitor = Communication.currentWindow.setInterval(() => {
|
5667
|
-
if (!Communication.childWindow || Communication.childWindow.closed) {
|
5668
|
-
handleFailure('CancelledByUser');
|
5669
|
-
}
|
5670
|
-
else {
|
5671
|
-
const savedChildOrigin = Communication.childOrigin;
|
5672
|
-
try {
|
5673
|
-
Communication.childOrigin = '*';
|
5674
|
-
sendMessageEventToChild('ping');
|
5675
|
-
}
|
5676
|
-
finally {
|
5677
|
-
Communication.childOrigin = savedChildOrigin;
|
5678
|
-
}
|
5679
|
-
}
|
5680
|
-
}, 100);
|
5681
|
-
// Set up an initialize-message handler that gives the authentication window its frame context
|
5682
|
-
registerHandler(getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticationWindow.registerInitializeHandler" /* ApiName.Authentication_AuthenticationWindow_RegisterInitializeHandler */), 'initialize', () => {
|
5683
|
-
return [FrameContexts.authentication, GlobalVars.hostClientType];
|
5684
|
-
});
|
5685
|
-
// Set up a navigateCrossDomain message handler that blocks cross-domain re-navigation attempts
|
5686
|
-
// in the authentication window. We could at some point choose to implement this method via a call to
|
5687
|
-
// authenticationWindow.location.href = url; however, we would first need to figure out how to
|
5688
|
-
// validate the URL against the tab's list of valid domains.
|
5689
|
-
registerHandler(getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticationWindow.registerNavigateCrossDomainHandler" /* ApiName.Authentication_AuthenticationWindow_RegisterNavigateCrossDomainHandler */), 'navigateCrossDomain', () => {
|
5690
|
-
return false;
|
5691
|
-
});
|
5692
|
-
}
|
5693
|
-
/**
|
5694
|
-
* @deprecated
|
5695
|
-
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
5696
|
-
* Please use the {@link authentication.notifySuccess authentication.notifySuccess(result?: string): void} instead.
|
5697
|
-
*/
|
5698
|
-
function authentication_notifySuccess(result, _callbackUrl) {
|
5699
|
-
ensureInitialized(runtime, FrameContexts.authentication);
|
5700
|
-
const apiVersionTag = _callbackUrl
|
5701
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */)
|
5702
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */);
|
5703
|
-
sendMessageToParent(apiVersionTag, 'authentication.authenticate.success', [result]);
|
5704
|
-
// Wait for the message to be sent before closing the window
|
5705
|
-
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
5706
|
-
}
|
5707
|
-
/**
|
5708
|
-
* @deprecated
|
5709
|
-
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
5710
|
-
* Please use the {@link authentication.notifyFailure authentication.notifyFailure(result?: string): void} instead.
|
5711
|
-
*/
|
5712
|
-
function authentication_notifyFailure(reason, _callbackUrl) {
|
5713
|
-
ensureInitialized(runtime, FrameContexts.authentication);
|
5714
|
-
const apiVersionTag = _callbackUrl
|
5715
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */)
|
5716
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */);
|
5717
|
-
sendMessageToParent(apiVersionTag, 'authentication.authenticate.failure', [reason]);
|
5718
|
-
// Wait for the message to be sent before closing the window
|
5719
|
-
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
5720
|
-
}
|
5721
|
-
function handleSuccess(result) {
|
5722
|
-
try {
|
5723
|
-
if (authHandlers) {
|
5724
|
-
authHandlers.success(result);
|
5725
|
-
}
|
5726
|
-
}
|
5727
|
-
finally {
|
5728
|
-
authHandlers = undefined;
|
5729
|
-
closeAuthenticationWindow();
|
5730
|
-
}
|
5731
|
-
}
|
5732
|
-
function handleFailure(reason) {
|
5733
|
-
try {
|
5734
|
-
if (authHandlers) {
|
5735
|
-
authHandlers.fail(new Error(reason));
|
5736
|
-
}
|
5737
|
-
}
|
5738
|
-
finally {
|
5739
|
-
authHandlers = undefined;
|
5740
|
-
closeAuthenticationWindow();
|
5741
|
-
}
|
5742
|
-
}
|
5743
|
-
/**
|
5744
|
-
* @hidden
|
5745
|
-
* Limited set of data residencies information exposed to 1P application developers
|
5746
|
-
*
|
5747
|
-
* @internal
|
5748
|
-
* Limited to Microsoft-internal use
|
5749
|
-
*/
|
5750
|
-
var DataResidency;
|
5751
|
-
(function (DataResidency) {
|
5752
|
-
/**
|
5753
|
-
* Public
|
5754
|
-
*/
|
5755
|
-
DataResidency["Public"] = "public";
|
5756
|
-
/**
|
5757
|
-
* European Union Data Boundary
|
5758
|
-
*/
|
5759
|
-
DataResidency["EUDB"] = "eudb";
|
5760
|
-
/**
|
5761
|
-
* Other, stored to cover fields that will not be exposed
|
5762
|
-
*/
|
5763
|
-
DataResidency["Other"] = "other";
|
5764
|
-
})(DataResidency || (DataResidency = {}));
|
5765
|
-
|
5766
|
-
;// ./src/public/dialog/update.ts
|
5767
|
-
/**
|
5768
|
-
* Module to update the dialog
|
5769
|
-
*
|
5770
|
-
* @module
|
5771
|
-
*/
|
5772
|
-
|
5773
|
-
|
5774
|
-
|
5775
|
-
|
5776
|
-
/**
|
5777
|
-
* Update dimensions - height/width of a dialog.
|
5778
|
-
*
|
5779
|
-
* @param dimensions - An object containing width and height properties.
|
5780
|
-
*/
|
5781
|
-
function resize(dimensions) {
|
5782
|
-
updateResizeHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.update.resize" /* ApiName.Dialog_Update_Resize */), dimensions);
|
5783
|
-
}
|
5784
|
-
/**
|
5785
|
-
* Checks if dialog.update capability is supported by the host
|
5786
|
-
* @returns boolean to represent whether dialog.update capabilty is supported
|
5787
|
-
*
|
5788
|
-
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
5789
|
-
*/
|
5790
|
-
function update_isSupported() {
|
5791
|
-
return ensureInitialized(runtime) && runtime.supports.dialog
|
5792
|
-
? runtime.supports.dialog.update
|
5793
|
-
? true
|
5794
|
-
: false
|
5795
|
-
: false;
|
5796
|
-
}
|
5797
|
-
|
5798
|
-
;// ./src/public/dialog/url/bot.ts
|
5799
|
-
/**
|
5800
|
-
* Module to open a dialog that sends results to the bot framework
|
5801
|
-
*
|
5802
|
-
* @module
|
5803
|
-
*/
|
5804
|
-
|
5805
|
-
|
5806
|
-
|
5807
|
-
|
5808
|
-
/**
|
5809
|
-
* Allows an app to open a dialog that sends submitted data to a bot.
|
5810
|
-
*
|
5811
|
-
* @param botUrlDialogInfo - An object containing the parameters of the dialog module including completionBotId.
|
5812
|
-
* @param submitHandler - Handler that triggers when the dialog has been submitted or closed.
|
5813
|
-
* @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
|
5814
|
-
*
|
5815
|
-
* @returns a function that can be used to send messages to the dialog.
|
5816
|
-
*/
|
5817
|
-
function bot_open(botUrlDialogInfo, submitHandler, messageFromChildHandler) {
|
5818
|
-
botUrlOpenHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.bot.open" /* ApiName.Dialog_Url_Bot_Open */), botUrlDialogInfo, submitHandler, messageFromChildHandler);
|
5819
|
-
}
|
5820
|
-
/**
|
5821
|
-
* Checks if dialog.url.bot capability is supported by the host
|
5822
|
-
*
|
5823
|
-
* @returns boolean to represent whether dialog.url.bot is supported
|
5824
|
-
*
|
5825
|
-
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
5826
|
-
*/
|
5827
|
-
function bot_isSupported() {
|
5828
|
-
return (ensureInitialized(runtime) &&
|
5829
|
-
(runtime.supports.dialog && runtime.supports.dialog.url && runtime.supports.dialog.url.bot) !== undefined);
|
5830
|
-
}
|
5831
|
-
|
5832
|
-
;// ./src/public/dialog/url/parentCommunication.ts
|
5833
|
-
/**
|
5834
|
-
* Subcapability that allows communication between the dialog and the parent app.
|
5835
|
-
*
|
5836
|
-
* @remarks
|
5837
|
-
* Note that dialog can be invoked from parentless scenarios e.g. Search Message Extensions. The subcapability `parentCommunication` is not supported in such scenarios.
|
5838
|
-
*
|
5839
|
-
* @module
|
5840
|
-
*/
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5848
|
-
/**
|
5849
|
-
* Send message to the parent from dialog
|
5850
|
-
*
|
5851
|
-
* @remarks
|
5852
|
-
* This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
|
5853
|
-
*
|
5854
|
-
* @param message - The message to send to the parent
|
5855
|
-
*/
|
5856
|
-
function sendMessageToParentFromDialog(
|
5857
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5858
|
-
message) {
|
5859
|
-
ensureInitialized(runtime, FrameContexts.task);
|
5860
|
-
if (!parentCommunication_isSupported()) {
|
5861
|
-
throw errorNotSupportedOnPlatform;
|
5862
|
-
}
|
5863
|
-
sendMessageToParent(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.parentCommunication.sendMessageToParentFromDialog" /* ApiName.Dialog_Url_ParentCommunication_SendMessageToParentFromDialog */), 'messageForParent', [message]);
|
5361
|
+
|
5362
|
+
|
5363
|
+
|
5364
|
+
|
5365
|
+
|
5366
|
+
|
5367
|
+
|
5368
|
+
/**
|
5369
|
+
* Send message to the parent from dialog
|
5370
|
+
*
|
5371
|
+
* @remarks
|
5372
|
+
* This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
|
5373
|
+
*
|
5374
|
+
* @param message - The message to send to the parent
|
5375
|
+
*/
|
5376
|
+
function sendMessageToParentFromDialog(
|
5377
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5378
|
+
message) {
|
5379
|
+
ensureInitialized(runtime, FrameContexts.task);
|
5380
|
+
if (!parentCommunication_isSupported()) {
|
5381
|
+
throw errorNotSupportedOnPlatform;
|
5382
|
+
}
|
5383
|
+
sendMessageToParent(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.parentCommunication.sendMessageToParentFromDialog" /* ApiName.Dialog_Url_ParentCommunication_SendMessageToParentFromDialog */), 'messageForParent', [message]);
|
5864
5384
|
}
|
5865
5385
|
/**
|
5866
5386
|
* Send message to the dialog from the parent
|
@@ -6656,7 +6176,6 @@ var appHelpers_awaiter = (undefined && undefined.__awaiter) || function (thisArg
|
|
6656
6176
|
|
6657
6177
|
|
6658
6178
|
|
6659
|
-
|
6660
6179
|
/**
|
6661
6180
|
* Number of milliseconds we'll give the initialization call to return before timing it out
|
6662
6181
|
*/
|
@@ -6789,7 +6308,6 @@ function initializeHelper(apiVersionTag, validMessageOrigins) {
|
|
6789
6308
|
}
|
6790
6309
|
GlobalVars.initializeCompleted = true;
|
6791
6310
|
});
|
6792
|
-
authentication_initialize();
|
6793
6311
|
menus_initialize();
|
6794
6312
|
config_initialize();
|
6795
6313
|
dialog_initialize();
|
@@ -6798,25 +6316,167 @@ function initializeHelper(apiVersionTag, validMessageOrigins) {
|
|
6798
6316
|
if (Array.isArray(validMessageOrigins)) {
|
6799
6317
|
processAdditionalValidOrigins(validMessageOrigins);
|
6800
6318
|
}
|
6801
|
-
if (GlobalVars.initializePromise !== undefined) {
|
6802
|
-
resolve(GlobalVars.initializePromise);
|
6319
|
+
if (GlobalVars.initializePromise !== undefined) {
|
6320
|
+
resolve(GlobalVars.initializePromise);
|
6321
|
+
}
|
6322
|
+
else {
|
6323
|
+
initializeHelperLogger('GlobalVars.initializePromise is unexpectedly undefined');
|
6324
|
+
}
|
6325
|
+
});
|
6326
|
+
}
|
6327
|
+
function registerOnThemeChangeHandlerHelper(apiVersionTag, handler) {
|
6328
|
+
// allow for registration cleanup even when not called initialize
|
6329
|
+
!isNullOrUndefined(handler) && ensureInitializeCalled();
|
6330
|
+
handlers_registerOnThemeChangeHandler(apiVersionTag, handler);
|
6331
|
+
}
|
6332
|
+
function openLinkHelper(apiVersionTag, deepLink) {
|
6333
|
+
return new Promise((resolve) => {
|
6334
|
+
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
6335
|
+
resolve(sendAndHandleStatusAndReason(apiVersionTag, 'executeDeepLink', deepLink));
|
6336
|
+
});
|
6337
|
+
}
|
6338
|
+
|
6339
|
+
;// ./src/internal/validOrigins.ts
|
6340
|
+
var validOrigins_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
6341
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
6342
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
6343
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6344
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6345
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
6346
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
6347
|
+
});
|
6348
|
+
};
|
6349
|
+
|
6350
|
+
|
6351
|
+
|
6352
|
+
|
6353
|
+
let validOriginsCache = [];
|
6354
|
+
const validateOriginLogger = getLogger('validateOrigin');
|
6355
|
+
function prefetchOriginsFromCDN() {
|
6356
|
+
return validOrigins_awaiter(this, void 0, void 0, function* () {
|
6357
|
+
yield getValidOriginsListFromCDN();
|
6358
|
+
});
|
6359
|
+
}
|
6360
|
+
function isValidOriginsCacheEmpty() {
|
6361
|
+
return validOriginsCache.length === 0;
|
6362
|
+
}
|
6363
|
+
function getValidOriginsListFromCDN(shouldDisableCache = false) {
|
6364
|
+
return validOrigins_awaiter(this, void 0, void 0, function* () {
|
6365
|
+
if (!isValidOriginsCacheEmpty() && !shouldDisableCache) {
|
6366
|
+
return validOriginsCache;
|
6367
|
+
}
|
6368
|
+
if (!inServerSideRenderingEnvironment()) {
|
6369
|
+
validateOriginLogger('Initiating fetch call to acquire valid origins list from CDN');
|
6370
|
+
const controller = new AbortController();
|
6371
|
+
const timeoutId = setTimeout(() => controller.abort(), ORIGIN_LIST_FETCH_TIMEOUT_IN_MS);
|
6372
|
+
return fetch(validOriginsCdnEndpoint, { signal: controller.signal })
|
6373
|
+
.then((response) => {
|
6374
|
+
clearTimeout(timeoutId);
|
6375
|
+
if (!response.ok) {
|
6376
|
+
throw new Error('Invalid Response from Fetch Call');
|
6377
|
+
}
|
6378
|
+
validateOriginLogger('Fetch call completed and retrieved valid origins list from CDN');
|
6379
|
+
return response.json().then((validOriginsCDN) => {
|
6380
|
+
if (isValidOriginsJSONValid(JSON.stringify(validOriginsCDN))) {
|
6381
|
+
validOriginsCache = validOriginsCDN.validOrigins;
|
6382
|
+
return validOriginsCache;
|
6383
|
+
}
|
6384
|
+
else {
|
6385
|
+
throw new Error('Valid origins list retrieved from CDN is invalid');
|
6386
|
+
}
|
6387
|
+
});
|
6388
|
+
})
|
6389
|
+
.catch((e) => {
|
6390
|
+
if (e.name === 'AbortError') {
|
6391
|
+
validateOriginLogger(`validOrigins fetch call to CDN failed due to Timeout of ${ORIGIN_LIST_FETCH_TIMEOUT_IN_MS} ms. Defaulting to fallback list`);
|
6392
|
+
}
|
6393
|
+
else {
|
6394
|
+
validateOriginLogger('validOrigins fetch call to CDN failed with error: %s. Defaulting to fallback list', e);
|
6395
|
+
}
|
6396
|
+
validOriginsCache = validOriginsFallback;
|
6397
|
+
return validOriginsCache;
|
6398
|
+
});
|
6399
|
+
}
|
6400
|
+
else {
|
6401
|
+
validOriginsCache = validOriginsFallback;
|
6402
|
+
return validOriginsFallback;
|
6403
|
+
}
|
6404
|
+
});
|
6405
|
+
}
|
6406
|
+
function isValidOriginsJSONValid(validOriginsJSON) {
|
6407
|
+
let validOriginsCDN = JSON.parse(validOriginsJSON);
|
6408
|
+
try {
|
6409
|
+
validOriginsCDN = JSON.parse(validOriginsJSON);
|
6410
|
+
}
|
6411
|
+
catch (_) {
|
6412
|
+
return false;
|
6413
|
+
}
|
6414
|
+
if (!validOriginsCDN.validOrigins) {
|
6415
|
+
return false;
|
6416
|
+
}
|
6417
|
+
for (const validOrigin of validOriginsCDN.validOrigins) {
|
6418
|
+
try {
|
6419
|
+
new URL('https://' + validOrigin);
|
6420
|
+
}
|
6421
|
+
catch (_) {
|
6422
|
+
validateOriginLogger('isValidOriginsFromCDN call failed to validate origin: %s', validOrigin);
|
6423
|
+
return false;
|
6424
|
+
}
|
6425
|
+
}
|
6426
|
+
return true;
|
6427
|
+
}
|
6428
|
+
/**
|
6429
|
+
* @param pattern - reference pattern
|
6430
|
+
* @param host - candidate string
|
6431
|
+
* @returns returns true if host matches pre-know valid pattern
|
6432
|
+
*
|
6433
|
+
* @example
|
6434
|
+
* validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
|
6435
|
+
* validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
|
6436
|
+
*
|
6437
|
+
* @internal
|
6438
|
+
* Limited to Microsoft-internal use
|
6439
|
+
*/
|
6440
|
+
function validateHostAgainstPattern(pattern, host) {
|
6441
|
+
if (pattern.substring(0, 2) === '*.') {
|
6442
|
+
const suffix = pattern.substring(1);
|
6443
|
+
if (host.length > suffix.length &&
|
6444
|
+
host.split('.').length === suffix.split('.').length &&
|
6445
|
+
host.substring(host.length - suffix.length) === suffix) {
|
6446
|
+
return true;
|
6447
|
+
}
|
6448
|
+
}
|
6449
|
+
else if (pattern === host) {
|
6450
|
+
return true;
|
6451
|
+
}
|
6452
|
+
return false;
|
6453
|
+
}
|
6454
|
+
/**
|
6455
|
+
* @internal
|
6456
|
+
* Limited to Microsoft-internal use
|
6457
|
+
*/
|
6458
|
+
function validateOrigin(messageOrigin, disableCache) {
|
6459
|
+
return getValidOriginsListFromCDN(disableCache).then((validOriginsList) => {
|
6460
|
+
// Check whether the url is in the pre-known allowlist or supplied by user
|
6461
|
+
if (!isValidHttpsURL(messageOrigin)) {
|
6462
|
+
validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
|
6463
|
+
return false;
|
6464
|
+
}
|
6465
|
+
const messageOriginHost = messageOrigin.host;
|
6466
|
+
if (validOriginsList.some((pattern) => validateHostAgainstPattern(pattern, messageOriginHost))) {
|
6467
|
+
return true;
|
6803
6468
|
}
|
6804
|
-
|
6805
|
-
|
6469
|
+
for (const domainOrPattern of GlobalVars.additionalValidOrigins) {
|
6470
|
+
const pattern = domainOrPattern.substring(0, 8) === 'https://' ? domainOrPattern.substring(8) : domainOrPattern;
|
6471
|
+
if (validateHostAgainstPattern(pattern, messageOriginHost)) {
|
6472
|
+
return true;
|
6473
|
+
}
|
6806
6474
|
}
|
6475
|
+
validateOriginLogger('Origin %s is invalid because it is not an origin approved by this library or included in the call to app.initialize.\nOrigins approved by this library: %o\nOrigins included in app.initialize: %o', messageOrigin, validOriginsList, GlobalVars.additionalValidOrigins);
|
6476
|
+
return false;
|
6807
6477
|
});
|
6808
6478
|
}
|
6809
|
-
|
6810
|
-
// allow for registration cleanup even when not called initialize
|
6811
|
-
!isNullOrUndefined(handler) && ensureInitializeCalled();
|
6812
|
-
handlers_registerOnThemeChangeHandler(apiVersionTag, handler);
|
6813
|
-
}
|
6814
|
-
function openLinkHelper(apiVersionTag, deepLink) {
|
6815
|
-
return new Promise((resolve) => {
|
6816
|
-
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
6817
|
-
resolve(sendAndHandleStatusAndReason(apiVersionTag, 'executeDeepLink', deepLink));
|
6818
|
-
});
|
6819
|
-
}
|
6479
|
+
prefetchOriginsFromCDN();
|
6820
6480
|
|
6821
6481
|
;// ./src/public/pages/appButton.ts
|
6822
6482
|
/**
|
@@ -8354,10 +8014,10 @@ const sendMessageToParentHelperLogger = communicationLogger.extend('sendMessageT
|
|
8354
8014
|
* @internal
|
8355
8015
|
* Limited to Microsoft-internal use
|
8356
8016
|
*/
|
8357
|
-
function sendMessageToParentHelper(apiVersionTag, actionName, args) {
|
8017
|
+
function sendMessageToParentHelper(apiVersionTag, actionName, args, isProxiedFromChild) {
|
8358
8018
|
const logger = sendMessageToParentHelperLogger;
|
8359
8019
|
const targetWindow = Communication.parentWindow;
|
8360
|
-
const request = createMessageRequest(apiVersionTag, actionName, args);
|
8020
|
+
const request = createMessageRequest(apiVersionTag, actionName, args, isProxiedFromChild);
|
8361
8021
|
HostToAppMessageDelayTelemetry.storeCallbackInformation(request.uuid, {
|
8362
8022
|
name: actionName,
|
8363
8023
|
calledAt: request.timestamp,
|
@@ -8684,15 +8344,7 @@ function handleIncomingMessageFromChild(evt) {
|
|
8684
8344
|
else {
|
8685
8345
|
// No handler, proxy to parent
|
8686
8346
|
handleIncomingMessageFromChildLogger('No handler for message %s from child found; relaying message on to parent, action: %s. Relayed message will have a new id.', getMessageIdsAsLogString(message), message.func);
|
8687
|
-
|
8688
|
-
if (Communication.childWindow) {
|
8689
|
-
const isPartialResponse = args.pop();
|
8690
|
-
handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
|
8691
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
8692
|
-
// @ts-ignore
|
8693
|
-
sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
|
8694
|
-
}
|
8695
|
-
});
|
8347
|
+
proxyChildMessageToParent(message);
|
8696
8348
|
}
|
8697
8349
|
}
|
8698
8350
|
}
|
@@ -8839,7 +8491,7 @@ function sendMessageEventToChild(actionName, args) {
|
|
8839
8491
|
* @internal
|
8840
8492
|
* Limited to Microsoft-internal use
|
8841
8493
|
*/
|
8842
|
-
function createMessageRequest(apiVersionTag, func, args) {
|
8494
|
+
function createMessageRequest(apiVersionTag, func, args, isProxiedFromChild) {
|
8843
8495
|
const messageId = CommunicationPrivate.nextMessageId++;
|
8844
8496
|
const messageUuid = new UUID();
|
8845
8497
|
CommunicationPrivate.legacyMessageIdsToUuidMap[messageId] = messageUuid;
|
@@ -8851,6 +8503,7 @@ function createMessageRequest(apiVersionTag, func, args) {
|
|
8851
8503
|
monotonicTimestamp: getCurrentTimestamp(),
|
8852
8504
|
args: args || [],
|
8853
8505
|
apiVersionTag: apiVersionTag,
|
8506
|
+
isProxiedFromChild: isProxiedFromChild !== null && isProxiedFromChild !== void 0 ? isProxiedFromChild : false,
|
8854
8507
|
};
|
8855
8508
|
}
|
8856
8509
|
/**
|
@@ -8916,6 +8569,22 @@ function getMessageIdsAsLogString(message) {
|
|
8916
8569
|
return `legacy id: ${message.id} (no uuid)`;
|
8917
8570
|
}
|
8918
8571
|
}
|
8572
|
+
/**
|
8573
|
+
* @internal
|
8574
|
+
* Limited to Microsoft-internal use
|
8575
|
+
*/
|
8576
|
+
function proxyChildMessageToParent(message) {
|
8577
|
+
const request = sendMessageToParentHelper(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "tasks.startTask" /* ApiName.Tasks_StartTask */), message.func, message.args, true);
|
8578
|
+
CommunicationPrivate.callbacks.set(request.uuid, (...args) => {
|
8579
|
+
if (Communication.childWindow) {
|
8580
|
+
const isPartialResponse = args.pop();
|
8581
|
+
handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
|
8582
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
8583
|
+
// @ts-ignore
|
8584
|
+
sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
|
8585
|
+
}
|
8586
|
+
});
|
8587
|
+
}
|
8919
8588
|
|
8920
8589
|
;// ./src/private/logs.ts
|
8921
8590
|
/**
|
@@ -13188,6 +12857,236 @@ function serializeValidSize(size) {
|
|
13188
12857
|
|
13189
12858
|
|
13190
12859
|
|
12860
|
+
|
12861
|
+
;// ./src/public/authentication.ts
|
12862
|
+
/**
|
12863
|
+
* Module to interact with the authentication-specific part of the SDK.
|
12864
|
+
*
|
12865
|
+
* This object is used for starting or completing authentication flows.
|
12866
|
+
* @module
|
12867
|
+
*/
|
12868
|
+
var authentication_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12869
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
12870
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
12871
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
12872
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12873
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
12874
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
12875
|
+
});
|
12876
|
+
};
|
12877
|
+
|
12878
|
+
|
12879
|
+
|
12880
|
+
|
12881
|
+
|
12882
|
+
|
12883
|
+
/**
|
12884
|
+
* Exceptional APIs telemetry versioning file: v1 and v2 APIs are mixed together in this file
|
12885
|
+
*/
|
12886
|
+
const authenticationTelemetryVersionNumber_v1 = "v1" /* ApiVersionNumber.V_1 */;
|
12887
|
+
const authenticationTelemetryVersionNumber_v2 = "v2" /* ApiVersionNumber.V_2 */;
|
12888
|
+
/**
|
12889
|
+
* @hidden
|
12890
|
+
* @internal
|
12891
|
+
* Limited to Microsoft-internal use; automatically called when library is initialized
|
12892
|
+
*/
|
12893
|
+
let authParams;
|
12894
|
+
/**
|
12895
|
+
* @deprecated
|
12896
|
+
* As of TeamsJS v2.0.0, this function has been deprecated in favor of a Promise-based pattern using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
|
12897
|
+
*
|
12898
|
+
* Registers handlers to be called with the result of an authentication flow triggered using {@link authentication.authenticate authentication.authenticate(authenticateParameters?: AuthenticateParameters): void}
|
12899
|
+
*
|
12900
|
+
* @param authenticateParameters - Configuration for authentication flow pop-up result communication
|
12901
|
+
*/
|
12902
|
+
function registerAuthenticationHandlers(authenticateParameters) {
|
12903
|
+
authParams = authenticateParameters;
|
12904
|
+
}
|
12905
|
+
function authenticate(authenticateParameters) {
|
12906
|
+
const isDifferentParamsInCall = authenticateParameters !== undefined;
|
12907
|
+
const authenticateParams = isDifferentParamsInCall
|
12908
|
+
? authenticateParameters
|
12909
|
+
: authParams;
|
12910
|
+
if (!authenticateParams) {
|
12911
|
+
throw new Error('No parameters are provided for authentication');
|
12912
|
+
}
|
12913
|
+
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.remove, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
12914
|
+
const apiVersionTag = authenticateParams.successCallback || authenticateParams.failureCallback
|
12915
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticate" /* ApiName.Authentication_Authenticate */)
|
12916
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.authenticate" /* ApiName.Authentication_Authenticate */);
|
12917
|
+
return authenticateHelper(apiVersionTag, authenticateParams)
|
12918
|
+
.then((value) => {
|
12919
|
+
try {
|
12920
|
+
if (authenticateParams && authenticateParams.successCallback) {
|
12921
|
+
authenticateParams.successCallback(value);
|
12922
|
+
return '';
|
12923
|
+
}
|
12924
|
+
return value;
|
12925
|
+
}
|
12926
|
+
finally {
|
12927
|
+
if (!isDifferentParamsInCall) {
|
12928
|
+
authParams = undefined;
|
12929
|
+
}
|
12930
|
+
}
|
12931
|
+
})
|
12932
|
+
.catch((err) => {
|
12933
|
+
try {
|
12934
|
+
if (authenticateParams && authenticateParams.failureCallback) {
|
12935
|
+
authenticateParams.failureCallback(err.message);
|
12936
|
+
return '';
|
12937
|
+
}
|
12938
|
+
throw err;
|
12939
|
+
}
|
12940
|
+
finally {
|
12941
|
+
if (!isDifferentParamsInCall) {
|
12942
|
+
authParams = undefined;
|
12943
|
+
}
|
12944
|
+
}
|
12945
|
+
});
|
12946
|
+
}
|
12947
|
+
function authenticateHelper(apiVersionTag, authenticateParameters) {
|
12948
|
+
return authentication_awaiter(this, void 0, void 0, function* () {
|
12949
|
+
// Convert any relative URLs into absolute URLs before sending them over to the parent window.
|
12950
|
+
const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url);
|
12951
|
+
validateUrl(fullyQualifiedURL);
|
12952
|
+
// Ask the parent window to open an authentication window with the parameters provided by the caller.
|
12953
|
+
return sendMessageToParentAsync(apiVersionTag, 'authentication.authenticate', [
|
12954
|
+
fullyQualifiedURL.href,
|
12955
|
+
authenticateParameters.width,
|
12956
|
+
authenticateParameters.height,
|
12957
|
+
authenticateParameters.isExternal,
|
12958
|
+
]).then(([success, response]) => {
|
12959
|
+
if (success) {
|
12960
|
+
return response;
|
12961
|
+
}
|
12962
|
+
else {
|
12963
|
+
throw new Error(response);
|
12964
|
+
}
|
12965
|
+
});
|
12966
|
+
});
|
12967
|
+
}
|
12968
|
+
function getAuthToken(authTokenRequest) {
|
12969
|
+
ensureInitializeCalled();
|
12970
|
+
const apiVersionTag = authTokenRequest && (authTokenRequest.successCallback || authTokenRequest.failureCallback)
|
12971
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */)
|
12972
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */);
|
12973
|
+
return getAuthTokenHelper(apiVersionTag, authTokenRequest)
|
12974
|
+
.then((value) => {
|
12975
|
+
if (authTokenRequest && authTokenRequest.successCallback) {
|
12976
|
+
authTokenRequest.successCallback(value);
|
12977
|
+
return '';
|
12978
|
+
}
|
12979
|
+
return value;
|
12980
|
+
})
|
12981
|
+
.catch((err) => {
|
12982
|
+
if (authTokenRequest && authTokenRequest.failureCallback) {
|
12983
|
+
authTokenRequest.failureCallback(err.message);
|
12984
|
+
return '';
|
12985
|
+
}
|
12986
|
+
throw err;
|
12987
|
+
});
|
12988
|
+
}
|
12989
|
+
function getAuthTokenHelper(apiVersionTag, authTokenRequest) {
|
12990
|
+
return new Promise((resolve) => {
|
12991
|
+
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getAuthToken', [
|
12992
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.resources,
|
12993
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.claims,
|
12994
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.silent,
|
12995
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.tenantId,
|
12996
|
+
]));
|
12997
|
+
}).then(([success, result]) => {
|
12998
|
+
if (success) {
|
12999
|
+
return result;
|
13000
|
+
}
|
13001
|
+
else {
|
13002
|
+
throw new Error(result);
|
13003
|
+
}
|
13004
|
+
});
|
13005
|
+
}
|
13006
|
+
function getUser(userRequest) {
|
13007
|
+
ensureInitializeCalled();
|
13008
|
+
const apiVersionTag = userRequest && (userRequest.successCallback || userRequest.failureCallback)
|
13009
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getUser" /* ApiName.Authentication_GetUser */)
|
13010
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getUser" /* ApiName.Authentication_GetUser */);
|
13011
|
+
return getUserHelper(apiVersionTag)
|
13012
|
+
.then((value) => {
|
13013
|
+
if (userRequest && userRequest.successCallback) {
|
13014
|
+
userRequest.successCallback(value);
|
13015
|
+
return null;
|
13016
|
+
}
|
13017
|
+
return value;
|
13018
|
+
})
|
13019
|
+
.catch((err) => {
|
13020
|
+
const errorMessage = `Error returned, code = ${err.errorCode}, message = ${err.message}`;
|
13021
|
+
if (userRequest && userRequest.failureCallback) {
|
13022
|
+
userRequest.failureCallback(errorMessage);
|
13023
|
+
return null;
|
13024
|
+
}
|
13025
|
+
throw new Error(errorMessage);
|
13026
|
+
});
|
13027
|
+
}
|
13028
|
+
function getUserHelper(apiVersionTag) {
|
13029
|
+
return new Promise((resolve) => {
|
13030
|
+
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getUser'));
|
13031
|
+
}).then(([success, result]) => {
|
13032
|
+
if (success) {
|
13033
|
+
return result;
|
13034
|
+
}
|
13035
|
+
else {
|
13036
|
+
throw result;
|
13037
|
+
}
|
13038
|
+
});
|
13039
|
+
}
|
13040
|
+
/**
|
13041
|
+
* @deprecated
|
13042
|
+
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
13043
|
+
* Please use the {@link authentication.notifySuccess authentication.notifySuccess(result?: string): void} instead.
|
13044
|
+
*/
|
13045
|
+
function authentication_notifySuccess(result, _callbackUrl) {
|
13046
|
+
ensureInitialized(runtime, FrameContexts.authentication);
|
13047
|
+
const apiVersionTag = _callbackUrl
|
13048
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */)
|
13049
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */);
|
13050
|
+
sendMessageToParent(apiVersionTag, 'authentication.authenticate.success', [result]);
|
13051
|
+
// Wait for the message to be sent before closing the window
|
13052
|
+
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
13053
|
+
}
|
13054
|
+
/**
|
13055
|
+
* @deprecated
|
13056
|
+
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
13057
|
+
* Please use the {@link authentication.notifyFailure authentication.notifyFailure(result?: string): void} instead.
|
13058
|
+
*/
|
13059
|
+
function authentication_notifyFailure(reason, _callbackUrl) {
|
13060
|
+
ensureInitialized(runtime, FrameContexts.authentication);
|
13061
|
+
const apiVersionTag = _callbackUrl
|
13062
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */)
|
13063
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */);
|
13064
|
+
sendMessageToParent(apiVersionTag, 'authentication.authenticate.failure', [reason]);
|
13065
|
+
// Wait for the message to be sent before closing the window
|
13066
|
+
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
13067
|
+
}
|
13068
|
+
/**
|
13069
|
+
* @hidden
|
13070
|
+
* Limited set of data residencies information exposed to 1P application developers
|
13071
|
+
*
|
13072
|
+
* @internal
|
13073
|
+
* Limited to Microsoft-internal use
|
13074
|
+
*/
|
13075
|
+
var DataResidency;
|
13076
|
+
(function (DataResidency) {
|
13077
|
+
/**
|
13078
|
+
* Public
|
13079
|
+
*/
|
13080
|
+
DataResidency["Public"] = "public";
|
13081
|
+
/**
|
13082
|
+
* European Union Data Boundary
|
13083
|
+
*/
|
13084
|
+
DataResidency["EUDB"] = "eudb";
|
13085
|
+
/**
|
13086
|
+
* Other, stored to cover fields that will not be exposed
|
13087
|
+
*/
|
13088
|
+
DataResidency["Other"] = "other";
|
13089
|
+
})(DataResidency || (DataResidency = {}));
|
13191
13090
|
|
13192
13091
|
;// ./src/internal/emailAddressValidation.ts
|
13193
13092
|
function validateEmailAddress(emailString) {
|
@@ -14341,16 +14240,17 @@ function isNAAChannelRecommended() {
|
|
14341
14240
|
}
|
14342
14241
|
function isNAAChannelRecommendedForLegacyTeamsMobile() {
|
14343
14242
|
return ensureInitialized(runtime) &&
|
14344
|
-
|
14243
|
+
isHostAndroidOrIOSOrIPadOSOrVisionOS() &&
|
14345
14244
|
runtime.isLegacyTeams &&
|
14346
14245
|
runtime.supports.nestedAppAuth
|
14347
14246
|
? true
|
14348
14247
|
: false;
|
14349
14248
|
}
|
14350
|
-
function
|
14249
|
+
function isHostAndroidOrIOSOrIPadOSOrVisionOS() {
|
14351
14250
|
return (GlobalVars.hostClientType === HostClientType.android ||
|
14352
14251
|
GlobalVars.hostClientType === HostClientType.ios ||
|
14353
|
-
GlobalVars.hostClientType === HostClientType.ipados
|
14252
|
+
GlobalVars.hostClientType === HostClientType.ipados ||
|
14253
|
+
GlobalVars.hostClientType === HostClientType.visionOS);
|
14354
14254
|
}
|
14355
14255
|
|
14356
14256
|
;// ./src/public/geoLocation/map.ts
|
@@ -16739,7 +16639,8 @@ function isWebStorageClearedOnUserLogOut() {
|
|
16739
16639
|
if (runtime.isLegacyTeams &&
|
16740
16640
|
(GlobalVars.hostClientType === HostClientType.android ||
|
16741
16641
|
GlobalVars.hostClientType === HostClientType.ios ||
|
16742
|
-
GlobalVars.hostClientType === HostClientType.ipados
|
16642
|
+
GlobalVars.hostClientType === HostClientType.ipados ||
|
16643
|
+
GlobalVars.hostClientType === HostClientType.visionOS) &&
|
16743
16644
|
(yield getHostName()) === HostName.teams) {
|
16744
16645
|
// On Teams Mobile, they haven't yet implemented this capability. However, for compatibility reasons, we need
|
16745
16646
|
// to act as if they do. If they did implement it, they would return true, so that's what we do here.
|