@microsoft/teams-js 2.34.0 → 2.34.1-beta.1
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/dist/esm/packages/teams-js/dts/internal/pagesHelpers.d.ts +3 -0
- package/dist/esm/packages/teams-js/dts/public/authentication.d.ts +0 -6
- package/dist/esm/packages/teams-js/src/internal/appHelpers.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/handlers.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/pagesHelpers.js +1 -1
- package/dist/esm/packages/teams-js/src/public/authentication.js +1 -1
- package/dist/esm/packages/teams-js/src/public/pages/backStack.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +346 -473
- 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 -53
- 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);
|
@@ -1268,6 +1254,17 @@ __webpack_require__.d(appButton_namespaceObject, {
|
|
1268
1254
|
onHoverLeave: () => (onHoverLeave)
|
1269
1255
|
});
|
1270
1256
|
|
1257
|
+
// NAMESPACE OBJECT: ./src/public/pages/backStack.ts
|
1258
|
+
var backStack_namespaceObject = {};
|
1259
|
+
__webpack_require__.r(backStack_namespaceObject);
|
1260
|
+
__webpack_require__.d(backStack_namespaceObject, {
|
1261
|
+
_initialize: () => (backStack_initialize),
|
1262
|
+
isSupported: () => (backStack_isSupported),
|
1263
|
+
navigateBack: () => (navigateBack),
|
1264
|
+
registerBackButtonHandler: () => (registerBackButtonHandler),
|
1265
|
+
registerBackButtonHandlerHelper: () => (registerBackButtonHandlerHelper)
|
1266
|
+
});
|
1267
|
+
|
1271
1268
|
// NAMESPACE OBJECT: ./src/public/pages/currentApp.ts
|
1272
1269
|
var currentApp_namespaceObject = {};
|
1273
1270
|
__webpack_require__.r(currentApp_namespaceObject);
|
@@ -1320,17 +1317,6 @@ __webpack_require__.d(pages_namespaceObject, {
|
|
1320
1317
|
tabs: () => (tabs_namespaceObject)
|
1321
1318
|
});
|
1322
1319
|
|
1323
|
-
// NAMESPACE OBJECT: ./src/public/pages/backStack.ts
|
1324
|
-
var backStack_namespaceObject = {};
|
1325
|
-
__webpack_require__.r(backStack_namespaceObject);
|
1326
|
-
__webpack_require__.d(backStack_namespaceObject, {
|
1327
|
-
_initialize: () => (backStack_initialize),
|
1328
|
-
isSupported: () => (backStack_isSupported),
|
1329
|
-
navigateBack: () => (navigateBack),
|
1330
|
-
registerBackButtonHandler: () => (registerBackButtonHandler),
|
1331
|
-
registerBackButtonHandlerHelper: () => (registerBackButtonHandlerHelper)
|
1332
|
-
});
|
1333
|
-
|
1334
1320
|
// NAMESPACE OBJECT: ./src/private/logs.ts
|
1335
1321
|
var logs_namespaceObject = {};
|
1336
1322
|
__webpack_require__.r(logs_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);
|
@@ -4485,7 +4484,7 @@ function isSerializable(arg) {
|
|
4485
4484
|
* @hidden
|
4486
4485
|
* Package version.
|
4487
4486
|
*/
|
4488
|
-
const version = "2.34.
|
4487
|
+
const version = "2.34.1-beta.1";
|
4489
4488
|
|
4490
4489
|
;// ./src/internal/internalAPIs.ts
|
4491
4490
|
|
@@ -5284,371 +5283,6 @@ function transformLegacyContextToAppContext(legacyContext) {
|
|
5284
5283
|
return context;
|
5285
5284
|
}
|
5286
5285
|
|
5287
|
-
;// ./src/public/authentication.ts
|
5288
|
-
/**
|
5289
|
-
* Module to interact with the authentication-specific part of the SDK.
|
5290
|
-
*
|
5291
|
-
* This object is used for starting or completing authentication flows.
|
5292
|
-
* @module
|
5293
|
-
*/
|
5294
|
-
|
5295
|
-
|
5296
|
-
|
5297
|
-
|
5298
|
-
|
5299
|
-
|
5300
|
-
|
5301
|
-
|
5302
|
-
/**
|
5303
|
-
* Exceptional APIs telemetry versioning file: v1 and v2 APIs are mixed together in this file
|
5304
|
-
*/
|
5305
|
-
const authenticationTelemetryVersionNumber_v1 = "v1" /* ApiVersionNumber.V_1 */;
|
5306
|
-
const authenticationTelemetryVersionNumber_v2 = "v2" /* ApiVersionNumber.V_2 */;
|
5307
|
-
let authHandlers;
|
5308
|
-
let authWindowMonitor;
|
5309
|
-
/**
|
5310
|
-
* @hidden
|
5311
|
-
* @internal
|
5312
|
-
* Limited to Microsoft-internal use; automatically called when library is initialized
|
5313
|
-
*/
|
5314
|
-
function authentication_initialize() {
|
5315
|
-
registerHandler(getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.registerAuthenticateSuccessHandler" /* ApiName.Authentication_RegisterAuthenticateSuccessHandler */), 'authentication.authenticate.success', handleSuccess, false);
|
5316
|
-
registerHandler(getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.registerAuthenticateFailureHandler" /* ApiName.Authentication_RegisterAuthenticateFailureHandler */), 'authentication.authenticate.failure', handleFailure, false);
|
5317
|
-
}
|
5318
|
-
let authParams;
|
5319
|
-
/**
|
5320
|
-
* @deprecated
|
5321
|
-
* 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\>}
|
5322
|
-
*
|
5323
|
-
* Registers handlers to be called with the result of an authentication flow triggered using {@link authentication.authenticate authentication.authenticate(authenticateParameters?: AuthenticateParameters): void}
|
5324
|
-
*
|
5325
|
-
* @param authenticateParameters - Configuration for authentication flow pop-up result communication
|
5326
|
-
*/
|
5327
|
-
function registerAuthenticationHandlers(authenticateParameters) {
|
5328
|
-
authParams = authenticateParameters;
|
5329
|
-
}
|
5330
|
-
function authenticate(authenticateParameters) {
|
5331
|
-
const isDifferentParamsInCall = authenticateParameters !== undefined;
|
5332
|
-
const authenticateParams = isDifferentParamsInCall
|
5333
|
-
? authenticateParameters
|
5334
|
-
: authParams;
|
5335
|
-
if (!authenticateParams) {
|
5336
|
-
throw new Error('No parameters are provided for authentication');
|
5337
|
-
}
|
5338
|
-
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.remove, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
5339
|
-
const apiVersionTag = authenticateParams.successCallback || authenticateParams.failureCallback
|
5340
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticate" /* ApiName.Authentication_Authenticate */)
|
5341
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.authenticate" /* ApiName.Authentication_Authenticate */);
|
5342
|
-
return authenticateHelper(apiVersionTag, authenticateParams)
|
5343
|
-
.then((value) => {
|
5344
|
-
try {
|
5345
|
-
if (authenticateParams && authenticateParams.successCallback) {
|
5346
|
-
authenticateParams.successCallback(value);
|
5347
|
-
return '';
|
5348
|
-
}
|
5349
|
-
return value;
|
5350
|
-
}
|
5351
|
-
finally {
|
5352
|
-
if (!isDifferentParamsInCall) {
|
5353
|
-
authParams = undefined;
|
5354
|
-
}
|
5355
|
-
}
|
5356
|
-
})
|
5357
|
-
.catch((err) => {
|
5358
|
-
try {
|
5359
|
-
if (authenticateParams && authenticateParams.failureCallback) {
|
5360
|
-
authenticateParams.failureCallback(err.message);
|
5361
|
-
return '';
|
5362
|
-
}
|
5363
|
-
throw err;
|
5364
|
-
}
|
5365
|
-
finally {
|
5366
|
-
if (!isDifferentParamsInCall) {
|
5367
|
-
authParams = undefined;
|
5368
|
-
}
|
5369
|
-
}
|
5370
|
-
});
|
5371
|
-
}
|
5372
|
-
function authenticateHelper(apiVersionTag, authenticateParameters) {
|
5373
|
-
return new Promise((resolve, reject) => {
|
5374
|
-
if (GlobalVars.hostClientType !== HostClientType.web) {
|
5375
|
-
// Convert any relative URLs into absolute URLs before sending them over to the parent window.
|
5376
|
-
const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url);
|
5377
|
-
validateUrl(fullyQualifiedURL);
|
5378
|
-
// Ask the parent window to open an authentication window with the parameters provided by the caller.
|
5379
|
-
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.authenticate', [
|
5380
|
-
fullyQualifiedURL.href,
|
5381
|
-
authenticateParameters.width,
|
5382
|
-
authenticateParameters.height,
|
5383
|
-
authenticateParameters.isExternal,
|
5384
|
-
]).then(([success, response]) => {
|
5385
|
-
if (success) {
|
5386
|
-
return response;
|
5387
|
-
}
|
5388
|
-
else {
|
5389
|
-
throw new Error(response);
|
5390
|
-
}
|
5391
|
-
}));
|
5392
|
-
}
|
5393
|
-
else {
|
5394
|
-
// Open an authentication window with the parameters provided by the caller.
|
5395
|
-
authHandlers = {
|
5396
|
-
success: resolve,
|
5397
|
-
fail: reject,
|
5398
|
-
};
|
5399
|
-
openAuthenticationWindow(authenticateParameters);
|
5400
|
-
}
|
5401
|
-
});
|
5402
|
-
}
|
5403
|
-
function getAuthToken(authTokenRequest) {
|
5404
|
-
ensureInitializeCalled();
|
5405
|
-
const apiVersionTag = authTokenRequest && (authTokenRequest.successCallback || authTokenRequest.failureCallback)
|
5406
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */)
|
5407
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */);
|
5408
|
-
return getAuthTokenHelper(apiVersionTag, authTokenRequest)
|
5409
|
-
.then((value) => {
|
5410
|
-
if (authTokenRequest && authTokenRequest.successCallback) {
|
5411
|
-
authTokenRequest.successCallback(value);
|
5412
|
-
return '';
|
5413
|
-
}
|
5414
|
-
return value;
|
5415
|
-
})
|
5416
|
-
.catch((err) => {
|
5417
|
-
if (authTokenRequest && authTokenRequest.failureCallback) {
|
5418
|
-
authTokenRequest.failureCallback(err.message);
|
5419
|
-
return '';
|
5420
|
-
}
|
5421
|
-
throw err;
|
5422
|
-
});
|
5423
|
-
}
|
5424
|
-
function getAuthTokenHelper(apiVersionTag, authTokenRequest) {
|
5425
|
-
return new Promise((resolve) => {
|
5426
|
-
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getAuthToken', [
|
5427
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.resources,
|
5428
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.claims,
|
5429
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.silent,
|
5430
|
-
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.tenantId,
|
5431
|
-
]));
|
5432
|
-
}).then(([success, result]) => {
|
5433
|
-
if (success) {
|
5434
|
-
return result;
|
5435
|
-
}
|
5436
|
-
else {
|
5437
|
-
throw new Error(result);
|
5438
|
-
}
|
5439
|
-
});
|
5440
|
-
}
|
5441
|
-
function getUser(userRequest) {
|
5442
|
-
ensureInitializeCalled();
|
5443
|
-
const apiVersionTag = userRequest && (userRequest.successCallback || userRequest.failureCallback)
|
5444
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getUser" /* ApiName.Authentication_GetUser */)
|
5445
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getUser" /* ApiName.Authentication_GetUser */);
|
5446
|
-
return getUserHelper(apiVersionTag)
|
5447
|
-
.then((value) => {
|
5448
|
-
if (userRequest && userRequest.successCallback) {
|
5449
|
-
userRequest.successCallback(value);
|
5450
|
-
return null;
|
5451
|
-
}
|
5452
|
-
return value;
|
5453
|
-
})
|
5454
|
-
.catch((err) => {
|
5455
|
-
const errorMessage = `Error returned, code = ${err.errorCode}, message = ${err.message}`;
|
5456
|
-
if (userRequest && userRequest.failureCallback) {
|
5457
|
-
userRequest.failureCallback(errorMessage);
|
5458
|
-
return null;
|
5459
|
-
}
|
5460
|
-
throw new Error(errorMessage);
|
5461
|
-
});
|
5462
|
-
}
|
5463
|
-
function getUserHelper(apiVersionTag) {
|
5464
|
-
return new Promise((resolve) => {
|
5465
|
-
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getUser'));
|
5466
|
-
}).then(([success, result]) => {
|
5467
|
-
if (success) {
|
5468
|
-
return result;
|
5469
|
-
}
|
5470
|
-
else {
|
5471
|
-
throw result;
|
5472
|
-
}
|
5473
|
-
});
|
5474
|
-
}
|
5475
|
-
function closeAuthenticationWindow() {
|
5476
|
-
// Stop monitoring the authentication window
|
5477
|
-
stopAuthenticationWindowMonitor();
|
5478
|
-
// Try to close the authentication window and clear all properties associated with it
|
5479
|
-
try {
|
5480
|
-
if (Communication.childWindow) {
|
5481
|
-
Communication.childWindow.close();
|
5482
|
-
}
|
5483
|
-
}
|
5484
|
-
finally {
|
5485
|
-
Communication.childWindow = null;
|
5486
|
-
Communication.childOrigin = null;
|
5487
|
-
}
|
5488
|
-
}
|
5489
|
-
/**
|
5490
|
-
* Different browsers handle authentication flows in pop-up windows differently.
|
5491
|
-
* Firefox and Safari, which use Quantum and WebKit browser engines respectively, block the use of 'window.open' for pop-up windows.
|
5492
|
-
* Any chrome-based browser (Chrome, Edge, Brave, etc.) opens a new browser window without any user-prompts.
|
5493
|
-
* To ensure consistent behavior across all browsers, consider using the following function to create a new authentication window.
|
5494
|
-
*
|
5495
|
-
* @param authenticateParameters - Parameters describing the authentication window used for executing the authentication flow.
|
5496
|
-
*/
|
5497
|
-
function openAuthenticationWindow(authenticateParameters) {
|
5498
|
-
// Close the previously opened window if we have one
|
5499
|
-
closeAuthenticationWindow();
|
5500
|
-
// Start with a sensible default size
|
5501
|
-
let width = authenticateParameters.width || 600;
|
5502
|
-
let height = authenticateParameters.height || 400;
|
5503
|
-
// Ensure that the new window is always smaller than our app's window so that it never fully covers up our app
|
5504
|
-
width = Math.min(width, Communication.currentWindow.outerWidth - 400);
|
5505
|
-
height = Math.min(height, Communication.currentWindow.outerHeight - 200);
|
5506
|
-
// Convert any relative URLs into absolute URLs before sending them over to the parent window
|
5507
|
-
const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url.replace('{oauthRedirectMethod}', 'web'));
|
5508
|
-
validateUrl(fullyQualifiedURL);
|
5509
|
-
// We are running in the browser, so we need to center the new window ourselves
|
5510
|
-
let left = typeof Communication.currentWindow.screenLeft !== 'undefined'
|
5511
|
-
? Communication.currentWindow.screenLeft
|
5512
|
-
: Communication.currentWindow.screenX;
|
5513
|
-
let top = typeof Communication.currentWindow.screenTop !== 'undefined'
|
5514
|
-
? Communication.currentWindow.screenTop
|
5515
|
-
: Communication.currentWindow.screenY;
|
5516
|
-
left += Communication.currentWindow.outerWidth / 2 - width / 2;
|
5517
|
-
top += Communication.currentWindow.outerHeight / 2 - height / 2;
|
5518
|
-
// Open a child window with a desired set of standard browser features
|
5519
|
-
Communication.childWindow = Communication.currentWindow.open(fullyQualifiedURL.href, '_blank', 'toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=' +
|
5520
|
-
top +
|
5521
|
-
', left=' +
|
5522
|
-
left +
|
5523
|
-
', width=' +
|
5524
|
-
width +
|
5525
|
-
', height=' +
|
5526
|
-
height);
|
5527
|
-
if (Communication.childWindow) {
|
5528
|
-
// Start monitoring the authentication window so that we can detect if it gets closed before the flow completes
|
5529
|
-
startAuthenticationWindowMonitor();
|
5530
|
-
}
|
5531
|
-
else {
|
5532
|
-
// If we failed to open the window, fail the authentication flow
|
5533
|
-
handleFailure('FailedToOpenWindow');
|
5534
|
-
}
|
5535
|
-
}
|
5536
|
-
function stopAuthenticationWindowMonitor() {
|
5537
|
-
if (authWindowMonitor) {
|
5538
|
-
clearInterval(authWindowMonitor);
|
5539
|
-
authWindowMonitor = 0;
|
5540
|
-
}
|
5541
|
-
handlers_removeHandler('initialize');
|
5542
|
-
handlers_removeHandler('navigateCrossDomain');
|
5543
|
-
}
|
5544
|
-
function startAuthenticationWindowMonitor() {
|
5545
|
-
// Stop the previous window monitor if one is running
|
5546
|
-
stopAuthenticationWindowMonitor();
|
5547
|
-
// Create an interval loop that
|
5548
|
-
// - Notifies the caller of failure if it detects that the authentication window is closed
|
5549
|
-
// - Keeps pinging the authentication window while it is open to re-establish
|
5550
|
-
// contact with any pages along the authentication flow that need to communicate
|
5551
|
-
// with us
|
5552
|
-
authWindowMonitor = Communication.currentWindow.setInterval(() => {
|
5553
|
-
if (!Communication.childWindow || Communication.childWindow.closed) {
|
5554
|
-
handleFailure('CancelledByUser');
|
5555
|
-
}
|
5556
|
-
else {
|
5557
|
-
const savedChildOrigin = Communication.childOrigin;
|
5558
|
-
try {
|
5559
|
-
Communication.childOrigin = '*';
|
5560
|
-
sendMessageEventToChild('ping');
|
5561
|
-
}
|
5562
|
-
finally {
|
5563
|
-
Communication.childOrigin = savedChildOrigin;
|
5564
|
-
}
|
5565
|
-
}
|
5566
|
-
}, 100);
|
5567
|
-
// Set up an initialize-message handler that gives the authentication window its frame context
|
5568
|
-
registerHandler(getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticationWindow.registerInitializeHandler" /* ApiName.Authentication_AuthenticationWindow_RegisterInitializeHandler */), 'initialize', () => {
|
5569
|
-
return [FrameContexts.authentication, GlobalVars.hostClientType];
|
5570
|
-
});
|
5571
|
-
// Set up a navigateCrossDomain message handler that blocks cross-domain re-navigation attempts
|
5572
|
-
// in the authentication window. We could at some point choose to implement this method via a call to
|
5573
|
-
// authenticationWindow.location.href = url; however, we would first need to figure out how to
|
5574
|
-
// validate the URL against the tab's list of valid domains.
|
5575
|
-
registerHandler(getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticationWindow.registerNavigateCrossDomainHandler" /* ApiName.Authentication_AuthenticationWindow_RegisterNavigateCrossDomainHandler */), 'navigateCrossDomain', () => {
|
5576
|
-
return false;
|
5577
|
-
});
|
5578
|
-
}
|
5579
|
-
/**
|
5580
|
-
* @deprecated
|
5581
|
-
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
5582
|
-
* Please use the {@link authentication.notifySuccess authentication.notifySuccess(result?: string): void} instead.
|
5583
|
-
*/
|
5584
|
-
function authentication_notifySuccess(result, _callbackUrl) {
|
5585
|
-
ensureInitialized(runtime, FrameContexts.authentication);
|
5586
|
-
const apiVersionTag = _callbackUrl
|
5587
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */)
|
5588
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */);
|
5589
|
-
sendMessageToParent(apiVersionTag, 'authentication.authenticate.success', [result]);
|
5590
|
-
// Wait for the message to be sent before closing the window
|
5591
|
-
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
5592
|
-
}
|
5593
|
-
/**
|
5594
|
-
* @deprecated
|
5595
|
-
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
5596
|
-
* Please use the {@link authentication.notifyFailure authentication.notifyFailure(result?: string): void} instead.
|
5597
|
-
*/
|
5598
|
-
function authentication_notifyFailure(reason, _callbackUrl) {
|
5599
|
-
ensureInitialized(runtime, FrameContexts.authentication);
|
5600
|
-
const apiVersionTag = _callbackUrl
|
5601
|
-
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */)
|
5602
|
-
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */);
|
5603
|
-
sendMessageToParent(apiVersionTag, 'authentication.authenticate.failure', [reason]);
|
5604
|
-
// Wait for the message to be sent before closing the window
|
5605
|
-
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
5606
|
-
}
|
5607
|
-
function handleSuccess(result) {
|
5608
|
-
try {
|
5609
|
-
if (authHandlers) {
|
5610
|
-
authHandlers.success(result);
|
5611
|
-
}
|
5612
|
-
}
|
5613
|
-
finally {
|
5614
|
-
authHandlers = undefined;
|
5615
|
-
closeAuthenticationWindow();
|
5616
|
-
}
|
5617
|
-
}
|
5618
|
-
function handleFailure(reason) {
|
5619
|
-
try {
|
5620
|
-
if (authHandlers) {
|
5621
|
-
authHandlers.fail(new Error(reason));
|
5622
|
-
}
|
5623
|
-
}
|
5624
|
-
finally {
|
5625
|
-
authHandlers = undefined;
|
5626
|
-
closeAuthenticationWindow();
|
5627
|
-
}
|
5628
|
-
}
|
5629
|
-
/**
|
5630
|
-
* @hidden
|
5631
|
-
* Limited set of data residencies information exposed to 1P application developers
|
5632
|
-
*
|
5633
|
-
* @internal
|
5634
|
-
* Limited to Microsoft-internal use
|
5635
|
-
*/
|
5636
|
-
var DataResidency;
|
5637
|
-
(function (DataResidency) {
|
5638
|
-
/**
|
5639
|
-
* Public
|
5640
|
-
*/
|
5641
|
-
DataResidency["Public"] = "public";
|
5642
|
-
/**
|
5643
|
-
* European Union Data Boundary
|
5644
|
-
*/
|
5645
|
-
DataResidency["EUDB"] = "eudb";
|
5646
|
-
/**
|
5647
|
-
* Other, stored to cover fields that will not be exposed
|
5648
|
-
*/
|
5649
|
-
DataResidency["Other"] = "other";
|
5650
|
-
})(DataResidency || (DataResidency = {}));
|
5651
|
-
|
5652
5286
|
;// ./src/public/dialog/update.ts
|
5653
5287
|
/**
|
5654
5288
|
* Module to update the dialog
|
@@ -6542,7 +6176,6 @@ var appHelpers_awaiter = (undefined && undefined.__awaiter) || function (thisArg
|
|
6542
6176
|
|
6543
6177
|
|
6544
6178
|
|
6545
|
-
|
6546
6179
|
/**
|
6547
6180
|
* Number of milliseconds we'll give the initialization call to return before timing it out
|
6548
6181
|
*/
|
@@ -6675,7 +6308,6 @@ function initializeHelper(apiVersionTag, validMessageOrigins) {
|
|
6675
6308
|
}
|
6676
6309
|
GlobalVars.initializeCompleted = true;
|
6677
6310
|
});
|
6678
|
-
authentication_initialize();
|
6679
6311
|
menus_initialize();
|
6680
6312
|
config_initialize();
|
6681
6313
|
dialog_initialize();
|
@@ -6907,6 +6539,82 @@ function appButton_isSupported() {
|
|
6907
6539
|
: false;
|
6908
6540
|
}
|
6909
6541
|
|
6542
|
+
;// ./src/public/pages/backStack.ts
|
6543
|
+
/**
|
6544
|
+
* Provides APIs for handling the user's navigational history.
|
6545
|
+
* @module
|
6546
|
+
*/
|
6547
|
+
|
6548
|
+
|
6549
|
+
|
6550
|
+
|
6551
|
+
|
6552
|
+
|
6553
|
+
|
6554
|
+
/**
|
6555
|
+
* @hidden
|
6556
|
+
* Register backButtonPress handler.
|
6557
|
+
*
|
6558
|
+
* @internal
|
6559
|
+
* Limited to Microsoft-internal use.
|
6560
|
+
*/
|
6561
|
+
function backStack_initialize() {
|
6562
|
+
initializeBackStackHelper();
|
6563
|
+
}
|
6564
|
+
/**
|
6565
|
+
* Navigates back in the hosted application. See {@link pages.backStack.registerBackButtonHandler} for notes on usage.
|
6566
|
+
* @returns Promise that resolves when the navigation has completed.
|
6567
|
+
*/
|
6568
|
+
function navigateBack() {
|
6569
|
+
return backStackNavigateBackHelper(getApiVersionTag(pagesTelemetryVersionNumber, "pages.backStack.navigateBack" /* ApiName.Pages_BackStack_NavigateBack */));
|
6570
|
+
}
|
6571
|
+
/**
|
6572
|
+
* Registers a handler for user presses of the host client's back button. Experiences that maintain an internal
|
6573
|
+
* navigation stack should use this handler to navigate the user back within their frame. If an application finds
|
6574
|
+
* that after running its back button handler it cannot handle the event it should call the navigateBack
|
6575
|
+
* method to ask the host client to handle it instead.
|
6576
|
+
* @param handler - The handler to invoke when the user presses the host client's back button.
|
6577
|
+
*/
|
6578
|
+
function registerBackButtonHandler(handler) {
|
6579
|
+
registerBackButtonHandlerHelper(getApiVersionTag(pagesTelemetryVersionNumber, "pages.backStack.registerBackButtonHandler" /* ApiName.Pages_BackStack_RegisterBackButtonHandler */), handler, () => {
|
6580
|
+
if (!isNullOrUndefined(handler) && !backStack_isSupported()) {
|
6581
|
+
throw errorNotSupportedOnPlatform;
|
6582
|
+
}
|
6583
|
+
});
|
6584
|
+
}
|
6585
|
+
/**
|
6586
|
+
* @hidden
|
6587
|
+
* Undocumented helper function with shared code between deprecated version and current version of the registerBackButtonHandler API.
|
6588
|
+
*
|
6589
|
+
* @internal
|
6590
|
+
* Limited to Microsoft-internal use
|
6591
|
+
* @param apiVersionTag - The tag indicating API version number with name
|
6592
|
+
* @param handler - The handler to invoke when the user presses the host client's back button.
|
6593
|
+
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
|
6594
|
+
*/
|
6595
|
+
function registerBackButtonHandlerHelper(apiVersionTag, handler, versionSpecificHelper) {
|
6596
|
+
// allow for registration cleanup even when not finished initializing
|
6597
|
+
!isNullOrUndefined(handler) && ensureInitialized(runtime);
|
6598
|
+
if (versionSpecificHelper) {
|
6599
|
+
versionSpecificHelper();
|
6600
|
+
}
|
6601
|
+
setBackButtonPressHandler(handler);
|
6602
|
+
!isNullOrUndefined(handler) && sendMessageToParent(apiVersionTag, 'registerHandler', ['backButton']);
|
6603
|
+
}
|
6604
|
+
/**
|
6605
|
+
* Checks if the pages.backStack capability is supported by the host
|
6606
|
+
* @returns boolean to represent whether the pages.backStack capability is supported
|
6607
|
+
*
|
6608
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
6609
|
+
*/
|
6610
|
+
function backStack_isSupported() {
|
6611
|
+
return ensureInitialized(runtime) && runtime.supports.pages
|
6612
|
+
? runtime.supports.pages.backStack
|
6613
|
+
? true
|
6614
|
+
: false
|
6615
|
+
: false;
|
6616
|
+
}
|
6617
|
+
|
6910
6618
|
;// ./src/public/pages/currentApp.ts
|
6911
6619
|
/**
|
6912
6620
|
* Provides functions for navigating within your own app
|
@@ -7299,6 +7007,8 @@ function pages_isSupported() {
|
|
7299
7007
|
|
7300
7008
|
|
7301
7009
|
|
7010
|
+
|
7011
|
+
|
7302
7012
|
/**
|
7303
7013
|
* v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
|
7304
7014
|
*/
|
@@ -7412,73 +7122,19 @@ function isAppNavigationParametersObject(obj) {
|
|
7412
7122
|
function convertNavigateToAppParamsToAppNavigationParameters(params) {
|
7413
7123
|
return Object.assign(Object.assign({}, params), { appId: new AppId(params.appId), webUrl: params.webUrl ? new URL(params.webUrl) : undefined });
|
7414
7124
|
}
|
7415
|
-
function convertAppNavigationParametersToNavigateToAppParams(params) {
|
7416
|
-
return Object.assign(Object.assign({}, params), { appId: params.appId.toString(), webUrl: params.webUrl ? params.webUrl.toString() : undefined });
|
7417
|
-
}
|
7418
|
-
|
7419
|
-
|
7420
|
-
|
7421
|
-
|
7422
|
-
|
7423
|
-
|
7424
|
-
|
7425
|
-
|
7426
|
-
|
7427
|
-
|
7428
|
-
|
7429
|
-
|
7430
|
-
|
7431
|
-
|
7432
|
-
let backButtonPressHandler;
|
7433
|
-
/**
|
7434
|
-
* @hidden
|
7435
|
-
* Register backButtonPress handler.
|
7436
|
-
*
|
7437
|
-
* @internal
|
7438
|
-
* Limited to Microsoft-internal use.
|
7439
|
-
*/
|
7440
|
-
function backStack_initialize() {
|
7441
|
-
registerHandler(getApiVersionTag(pagesTelemetryVersionNumber, "pages.backStack.registerBackButtonPressHandler" /* ApiName.Pages_BackStack_RegisterBackButtonPressHandler */), 'backButtonPress', handleBackButtonPress, false);
|
7442
|
-
}
|
7443
|
-
/**
|
7444
|
-
* Navigates back in the hosted application. See {@link pages.backStack.registerBackButtonHandler} for notes on usage.
|
7445
|
-
* @returns Promise that resolves when the navigation has completed.
|
7446
|
-
*/
|
7447
|
-
function navigateBack() {
|
7448
|
-
return backStackNavigateBackHelper(getApiVersionTag(pagesTelemetryVersionNumber, "pages.backStack.navigateBack" /* ApiName.Pages_BackStack_NavigateBack */));
|
7449
|
-
}
|
7450
|
-
/**
|
7451
|
-
* Registers a handler for user presses of the host client's back button. Experiences that maintain an internal
|
7452
|
-
* navigation stack should use this handler to navigate the user back within their frame. If an application finds
|
7453
|
-
* that after running its back button handler it cannot handle the event it should call the navigateBack
|
7454
|
-
* method to ask the host client to handle it instead.
|
7455
|
-
* @param handler - The handler to invoke when the user presses the host client's back button.
|
7456
|
-
*/
|
7457
|
-
function registerBackButtonHandler(handler) {
|
7458
|
-
registerBackButtonHandlerHelper(getApiVersionTag(pagesTelemetryVersionNumber, "pages.backStack.registerBackButtonHandler" /* ApiName.Pages_BackStack_RegisterBackButtonHandler */), handler, () => {
|
7459
|
-
if (!isNullOrUndefined(handler) && !backStack_isSupported()) {
|
7460
|
-
throw errorNotSupportedOnPlatform;
|
7461
|
-
}
|
7462
|
-
});
|
7463
|
-
}
|
7464
|
-
/**
|
7465
|
-
* @hidden
|
7466
|
-
* Undocumented helper function with shared code between deprecated version and current version of the registerBackButtonHandler API.
|
7467
|
-
*
|
7468
|
-
* @internal
|
7469
|
-
* Limited to Microsoft-internal use
|
7470
|
-
* @param apiVersionTag - The tag indicating API version number with name
|
7471
|
-
* @param handler - The handler to invoke when the user presses the host client's back button.
|
7472
|
-
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
|
7473
|
-
*/
|
7474
|
-
function registerBackButtonHandlerHelper(apiVersionTag, handler, versionSpecificHelper) {
|
7475
|
-
// allow for registration cleanup even when not finished initializing
|
7476
|
-
!isNullOrUndefined(handler) && ensureInitialized(runtime);
|
7477
|
-
if (versionSpecificHelper) {
|
7478
|
-
versionSpecificHelper();
|
7479
|
-
}
|
7125
|
+
function convertAppNavigationParametersToNavigateToAppParams(params) {
|
7126
|
+
return Object.assign(Object.assign({}, params), { appId: params.appId.toString(), webUrl: params.webUrl ? params.webUrl.toString() : undefined });
|
7127
|
+
}
|
7128
|
+
//Back Stack Helpers
|
7129
|
+
let backButtonPressHandler;
|
7130
|
+
function getBackButtonPressHandler() {
|
7131
|
+
return backButtonPressHandler;
|
7132
|
+
}
|
7133
|
+
function setBackButtonPressHandler(handler) {
|
7480
7134
|
backButtonPressHandler = handler;
|
7481
|
-
|
7135
|
+
}
|
7136
|
+
function initializeBackStackHelper() {
|
7137
|
+
registerHandler(getApiVersionTag(pagesTelemetryVersionNumber, "pages.backStack.registerBackButtonPressHandler" /* ApiName.Pages_BackStack_RegisterBackButtonPressHandler */), 'backButtonPress', handleBackButtonPress, false);
|
7482
7138
|
}
|
7483
7139
|
function handleBackButtonPress() {
|
7484
7140
|
if (!backButtonPressHandler || !backButtonPressHandler()) {
|
@@ -7491,19 +7147,6 @@ function handleBackButtonPress() {
|
|
7491
7147
|
}
|
7492
7148
|
}
|
7493
7149
|
}
|
7494
|
-
/**
|
7495
|
-
* Checks if the pages.backStack capability is supported by the host
|
7496
|
-
* @returns boolean to represent whether the pages.backStack capability is supported
|
7497
|
-
*
|
7498
|
-
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
7499
|
-
*/
|
7500
|
-
function backStack_isSupported() {
|
7501
|
-
return ensureInitialized(runtime) && runtime.supports.pages
|
7502
|
-
? runtime.supports.pages.backStack
|
7503
|
-
? true
|
7504
|
-
: false
|
7505
|
-
: false;
|
7506
|
-
}
|
7507
7150
|
|
7508
7151
|
;// ./src/internal/handlers.ts
|
7509
7152
|
/* eslint-disable @typescript-eslint/ban-types */
|
@@ -7539,7 +7182,7 @@ class HandlersPrivate {
|
|
7539
7182
|
HandlersPrivate.handlers['themeChange'] = handleThemeChange;
|
7540
7183
|
HandlersPrivate.handlers['load'] = handleLoad;
|
7541
7184
|
HandlersPrivate.handlers['beforeUnload'] = handleBeforeUnload;
|
7542
|
-
|
7185
|
+
initializeBackStackHelper();
|
7543
7186
|
}
|
7544
7187
|
/**
|
7545
7188
|
* @internal
|
@@ -13225,6 +12868,236 @@ function serializeValidSize(size) {
|
|
13225
12868
|
|
13226
12869
|
|
13227
12870
|
|
12871
|
+
|
12872
|
+
;// ./src/public/authentication.ts
|
12873
|
+
/**
|
12874
|
+
* Module to interact with the authentication-specific part of the SDK.
|
12875
|
+
*
|
12876
|
+
* This object is used for starting or completing authentication flows.
|
12877
|
+
* @module
|
12878
|
+
*/
|
12879
|
+
var authentication_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12880
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
12881
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
12882
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
12883
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12884
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
12885
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
12886
|
+
});
|
12887
|
+
};
|
12888
|
+
|
12889
|
+
|
12890
|
+
|
12891
|
+
|
12892
|
+
|
12893
|
+
|
12894
|
+
/**
|
12895
|
+
* Exceptional APIs telemetry versioning file: v1 and v2 APIs are mixed together in this file
|
12896
|
+
*/
|
12897
|
+
const authenticationTelemetryVersionNumber_v1 = "v1" /* ApiVersionNumber.V_1 */;
|
12898
|
+
const authenticationTelemetryVersionNumber_v2 = "v2" /* ApiVersionNumber.V_2 */;
|
12899
|
+
/**
|
12900
|
+
* @hidden
|
12901
|
+
* @internal
|
12902
|
+
* Limited to Microsoft-internal use; automatically called when library is initialized
|
12903
|
+
*/
|
12904
|
+
let authParams;
|
12905
|
+
/**
|
12906
|
+
* @deprecated
|
12907
|
+
* 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\>}
|
12908
|
+
*
|
12909
|
+
* Registers handlers to be called with the result of an authentication flow triggered using {@link authentication.authenticate authentication.authenticate(authenticateParameters?: AuthenticateParameters): void}
|
12910
|
+
*
|
12911
|
+
* @param authenticateParameters - Configuration for authentication flow pop-up result communication
|
12912
|
+
*/
|
12913
|
+
function registerAuthenticationHandlers(authenticateParameters) {
|
12914
|
+
authParams = authenticateParameters;
|
12915
|
+
}
|
12916
|
+
function authenticate(authenticateParameters) {
|
12917
|
+
const isDifferentParamsInCall = authenticateParameters !== undefined;
|
12918
|
+
const authenticateParams = isDifferentParamsInCall
|
12919
|
+
? authenticateParameters
|
12920
|
+
: authParams;
|
12921
|
+
if (!authenticateParams) {
|
12922
|
+
throw new Error('No parameters are provided for authentication');
|
12923
|
+
}
|
12924
|
+
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.remove, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
12925
|
+
const apiVersionTag = authenticateParams.successCallback || authenticateParams.failureCallback
|
12926
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.authenticate" /* ApiName.Authentication_Authenticate */)
|
12927
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.authenticate" /* ApiName.Authentication_Authenticate */);
|
12928
|
+
return authenticateHelper(apiVersionTag, authenticateParams)
|
12929
|
+
.then((value) => {
|
12930
|
+
try {
|
12931
|
+
if (authenticateParams && authenticateParams.successCallback) {
|
12932
|
+
authenticateParams.successCallback(value);
|
12933
|
+
return '';
|
12934
|
+
}
|
12935
|
+
return value;
|
12936
|
+
}
|
12937
|
+
finally {
|
12938
|
+
if (!isDifferentParamsInCall) {
|
12939
|
+
authParams = undefined;
|
12940
|
+
}
|
12941
|
+
}
|
12942
|
+
})
|
12943
|
+
.catch((err) => {
|
12944
|
+
try {
|
12945
|
+
if (authenticateParams && authenticateParams.failureCallback) {
|
12946
|
+
authenticateParams.failureCallback(err.message);
|
12947
|
+
return '';
|
12948
|
+
}
|
12949
|
+
throw err;
|
12950
|
+
}
|
12951
|
+
finally {
|
12952
|
+
if (!isDifferentParamsInCall) {
|
12953
|
+
authParams = undefined;
|
12954
|
+
}
|
12955
|
+
}
|
12956
|
+
});
|
12957
|
+
}
|
12958
|
+
function authenticateHelper(apiVersionTag, authenticateParameters) {
|
12959
|
+
return authentication_awaiter(this, void 0, void 0, function* () {
|
12960
|
+
// Convert any relative URLs into absolute URLs before sending them over to the parent window.
|
12961
|
+
const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url);
|
12962
|
+
validateUrl(fullyQualifiedURL);
|
12963
|
+
// Ask the parent window to open an authentication window with the parameters provided by the caller.
|
12964
|
+
return sendMessageToParentAsync(apiVersionTag, 'authentication.authenticate', [
|
12965
|
+
fullyQualifiedURL.href,
|
12966
|
+
authenticateParameters.width,
|
12967
|
+
authenticateParameters.height,
|
12968
|
+
authenticateParameters.isExternal,
|
12969
|
+
]).then(([success, response]) => {
|
12970
|
+
if (success) {
|
12971
|
+
return response;
|
12972
|
+
}
|
12973
|
+
else {
|
12974
|
+
throw new Error(response);
|
12975
|
+
}
|
12976
|
+
});
|
12977
|
+
});
|
12978
|
+
}
|
12979
|
+
function getAuthToken(authTokenRequest) {
|
12980
|
+
ensureInitializeCalled();
|
12981
|
+
const apiVersionTag = authTokenRequest && (authTokenRequest.successCallback || authTokenRequest.failureCallback)
|
12982
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */)
|
12983
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getAuthToken" /* ApiName.Authentication_GetAuthToken */);
|
12984
|
+
return getAuthTokenHelper(apiVersionTag, authTokenRequest)
|
12985
|
+
.then((value) => {
|
12986
|
+
if (authTokenRequest && authTokenRequest.successCallback) {
|
12987
|
+
authTokenRequest.successCallback(value);
|
12988
|
+
return '';
|
12989
|
+
}
|
12990
|
+
return value;
|
12991
|
+
})
|
12992
|
+
.catch((err) => {
|
12993
|
+
if (authTokenRequest && authTokenRequest.failureCallback) {
|
12994
|
+
authTokenRequest.failureCallback(err.message);
|
12995
|
+
return '';
|
12996
|
+
}
|
12997
|
+
throw err;
|
12998
|
+
});
|
12999
|
+
}
|
13000
|
+
function getAuthTokenHelper(apiVersionTag, authTokenRequest) {
|
13001
|
+
return new Promise((resolve) => {
|
13002
|
+
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getAuthToken', [
|
13003
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.resources,
|
13004
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.claims,
|
13005
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.silent,
|
13006
|
+
authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.tenantId,
|
13007
|
+
]));
|
13008
|
+
}).then(([success, result]) => {
|
13009
|
+
if (success) {
|
13010
|
+
return result;
|
13011
|
+
}
|
13012
|
+
else {
|
13013
|
+
throw new Error(result);
|
13014
|
+
}
|
13015
|
+
});
|
13016
|
+
}
|
13017
|
+
function getUser(userRequest) {
|
13018
|
+
ensureInitializeCalled();
|
13019
|
+
const apiVersionTag = userRequest && (userRequest.successCallback || userRequest.failureCallback)
|
13020
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.getUser" /* ApiName.Authentication_GetUser */)
|
13021
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.getUser" /* ApiName.Authentication_GetUser */);
|
13022
|
+
return getUserHelper(apiVersionTag)
|
13023
|
+
.then((value) => {
|
13024
|
+
if (userRequest && userRequest.successCallback) {
|
13025
|
+
userRequest.successCallback(value);
|
13026
|
+
return null;
|
13027
|
+
}
|
13028
|
+
return value;
|
13029
|
+
})
|
13030
|
+
.catch((err) => {
|
13031
|
+
const errorMessage = `Error returned, code = ${err.errorCode}, message = ${err.message}`;
|
13032
|
+
if (userRequest && userRequest.failureCallback) {
|
13033
|
+
userRequest.failureCallback(errorMessage);
|
13034
|
+
return null;
|
13035
|
+
}
|
13036
|
+
throw new Error(errorMessage);
|
13037
|
+
});
|
13038
|
+
}
|
13039
|
+
function getUserHelper(apiVersionTag) {
|
13040
|
+
return new Promise((resolve) => {
|
13041
|
+
resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.getUser'));
|
13042
|
+
}).then(([success, result]) => {
|
13043
|
+
if (success) {
|
13044
|
+
return result;
|
13045
|
+
}
|
13046
|
+
else {
|
13047
|
+
throw result;
|
13048
|
+
}
|
13049
|
+
});
|
13050
|
+
}
|
13051
|
+
/**
|
13052
|
+
* @deprecated
|
13053
|
+
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
13054
|
+
* Please use the {@link authentication.notifySuccess authentication.notifySuccess(result?: string): void} instead.
|
13055
|
+
*/
|
13056
|
+
function authentication_notifySuccess(result, _callbackUrl) {
|
13057
|
+
ensureInitialized(runtime, FrameContexts.authentication);
|
13058
|
+
const apiVersionTag = _callbackUrl
|
13059
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */)
|
13060
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifySuccess" /* ApiName.Authentication_NotifySuccess */);
|
13061
|
+
sendMessageToParent(apiVersionTag, 'authentication.authenticate.success', [result]);
|
13062
|
+
// Wait for the message to be sent before closing the window
|
13063
|
+
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
13064
|
+
}
|
13065
|
+
/**
|
13066
|
+
* @deprecated
|
13067
|
+
* This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
|
13068
|
+
* Please use the {@link authentication.notifyFailure authentication.notifyFailure(result?: string): void} instead.
|
13069
|
+
*/
|
13070
|
+
function authentication_notifyFailure(reason, _callbackUrl) {
|
13071
|
+
ensureInitialized(runtime, FrameContexts.authentication);
|
13072
|
+
const apiVersionTag = _callbackUrl
|
13073
|
+
? getApiVersionTag(authenticationTelemetryVersionNumber_v1, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */)
|
13074
|
+
: getApiVersionTag(authenticationTelemetryVersionNumber_v2, "authentication.notifyFailure" /* ApiName.Authentication_NotifyFailure */);
|
13075
|
+
sendMessageToParent(apiVersionTag, 'authentication.authenticate.failure', [reason]);
|
13076
|
+
// Wait for the message to be sent before closing the window
|
13077
|
+
waitForMessageQueue(Communication.parentWindow, () => setTimeout(() => Communication.currentWindow.close(), 200));
|
13078
|
+
}
|
13079
|
+
/**
|
13080
|
+
* @hidden
|
13081
|
+
* Limited set of data residencies information exposed to 1P application developers
|
13082
|
+
*
|
13083
|
+
* @internal
|
13084
|
+
* Limited to Microsoft-internal use
|
13085
|
+
*/
|
13086
|
+
var DataResidency;
|
13087
|
+
(function (DataResidency) {
|
13088
|
+
/**
|
13089
|
+
* Public
|
13090
|
+
*/
|
13091
|
+
DataResidency["Public"] = "public";
|
13092
|
+
/**
|
13093
|
+
* European Union Data Boundary
|
13094
|
+
*/
|
13095
|
+
DataResidency["EUDB"] = "eudb";
|
13096
|
+
/**
|
13097
|
+
* Other, stored to cover fields that will not be exposed
|
13098
|
+
*/
|
13099
|
+
DataResidency["Other"] = "other";
|
13100
|
+
})(DataResidency || (DataResidency = {}));
|
13228
13101
|
|
13229
13102
|
;// ./src/internal/emailAddressValidation.ts
|
13230
13103
|
function validateEmailAddress(emailString) {
|