@microsoft/teams-js 2.34.0 → 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/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/public/authentication.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +244 -382
- 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);
|
@@ -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.0";
|
4487
|
+
const version = "2.34.1-beta.0";
|
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();
|
@@ -13225,6 +12857,236 @@ function serializeValidSize(size) {
|
|
13225
12857
|
|
13226
12858
|
|
13227
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 = {}));
|
13228
13090
|
|
13229
13091
|
;// ./src/internal/emailAddressValidation.ts
|
13230
13092
|
function validateEmailAddress(emailString) {
|