@azure/msal-browser 3.6.0 → 3.7.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/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +9 -9
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +4 -2
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +32 -17
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +4 -2
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +5 -1
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/AuthResult.d.ts +7 -0
- package/dist/naa/AuthResult.d.ts.map +1 -0
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.d.ts +11 -15
- package/dist/naa/BridgeProxy.d.ts.map +1 -1
- package/dist/naa/BridgeProxy.mjs +33 -31
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeRequest.d.ts +3 -2
- package/dist/naa/BridgeRequest.d.ts.map +1 -1
- package/dist/naa/BridgeRequestEnvelope.d.ts +2 -3
- package/dist/naa/BridgeRequestEnvelope.d.ts.map +1 -1
- package/dist/naa/BridgeResponseEnvelope.d.ts +5 -2
- package/dist/naa/BridgeResponseEnvelope.d.ts.map +1 -1
- package/dist/naa/BridgeStatusCode.d.ts +11 -10
- package/dist/naa/BridgeStatusCode.d.ts.map +1 -1
- package/dist/naa/BridgeStatusCode.mjs +11 -12
- package/dist/naa/BridgeStatusCode.mjs.map +1 -1
- package/dist/naa/IBridgeProxy.d.ts +3 -5
- package/dist/naa/IBridgeProxy.d.ts.map +1 -1
- package/dist/naa/{InitializeBridgeResponse.d.ts → InitContext.d.ts} +2 -2
- package/dist/naa/InitContext.d.ts.map +1 -0
- package/dist/naa/TokenRequest.d.ts +1 -2
- package/dist/naa/TokenRequest.d.ts.map +1 -1
- package/dist/naa/TokenResponse.d.ts +1 -3
- package/dist/naa/TokenResponse.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +2 -2
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +18 -18
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.d.ts +2 -1
- package/dist/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +54 -3
- package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +1 -3
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +63 -26
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.d.ts +4 -0
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.mjs +10 -2
- package/dist/utils/BrowserConstants.mjs.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +3384 -3298
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +3384 -3298
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -71
- package/package.json +2 -2
- package/src/cache/BrowserCacheManager.ts +7 -19
- package/src/cache/TokenCache.ts +3 -2
- package/src/controllers/StandardController.ts +50 -21
- package/src/interaction_client/NativeInteractionClient.ts +2 -1
- package/src/interaction_client/SilentRefreshClient.ts +8 -0
- package/src/naa/AuthResult.ts +12 -0
- package/src/naa/BridgeProxy.ts +59 -68
- package/src/naa/BridgeRequest.ts +6 -2
- package/src/naa/BridgeRequestEnvelope.ts +1 -13
- package/src/naa/BridgeResponseEnvelope.ts +5 -7
- package/src/naa/BridgeStatusCode.ts +12 -10
- package/src/naa/IBridgeProxy.ts +3 -14
- package/src/naa/{InitializeBridgeResponse.ts → InitContext.ts} +1 -1
- package/src/naa/TokenRequest.ts +1 -2
- package/src/naa/TokenResponse.ts +1 -4
- package/src/naa/mapping/NestedAppAuthAdapter.ts +19 -19
- package/src/operatingcontext/BaseOperatingContext.ts +64 -7
- package/src/packageMetadata.ts +1 -1
- package/src/telemetry/BrowserPerformanceClient.ts +95 -42
- package/src/utils/BrowserConstants.ts +11 -0
- package/dist/naa/AccountRequests.d.ts +0 -10
- package/dist/naa/AccountRequests.d.ts.map +0 -1
- package/dist/naa/InitializeBridgeResponse.d.ts.map +0 -1
- package/src/naa/AccountRequests.ts +0 -16
|
@@ -7,7 +7,6 @@ import { TokenRequest } from "../TokenRequest";
|
|
|
7
7
|
import { AccountInfo as NaaAccountInfo } from "../AccountInfo";
|
|
8
8
|
import { RedirectRequest } from "../../request/RedirectRequest";
|
|
9
9
|
import { PopupRequest } from "../../request/PopupRequest";
|
|
10
|
-
import { TokenResponse } from "../TokenResponse";
|
|
11
10
|
import {
|
|
12
11
|
AccountInfo as MsalAccountInfo,
|
|
13
12
|
AuthError,
|
|
@@ -29,6 +28,7 @@ import { isBridgeError } from "../BridgeError";
|
|
|
29
28
|
import { BridgeStatusCode } from "../BridgeStatusCode";
|
|
30
29
|
import { AuthenticationResult } from "../../response/AuthenticationResult";
|
|
31
30
|
import {} from "../../error/BrowserAuthErrorCodes";
|
|
31
|
+
import { AuthResult } from "../AuthResult";
|
|
32
32
|
|
|
33
33
|
export class NestedAppAuthAdapter {
|
|
34
34
|
protected crypto: ICrypto;
|
|
@@ -66,7 +66,7 @@ export class NestedAppAuthAdapter {
|
|
|
66
66
|
this.clientCapabilities
|
|
67
67
|
);
|
|
68
68
|
const tokenRequest: TokenRequest = {
|
|
69
|
-
|
|
69
|
+
platformBrokerId: request.account?.homeAccountId,
|
|
70
70
|
clientId: this.clientId,
|
|
71
71
|
authority: request.authority,
|
|
72
72
|
scope: request.scopes.join(" "),
|
|
@@ -74,7 +74,6 @@ export class NestedAppAuthAdapter {
|
|
|
74
74
|
request.correlationId !== undefined
|
|
75
75
|
? request.correlationId
|
|
76
76
|
: this.crypto.createNewGuid(),
|
|
77
|
-
nonce: request.nonce,
|
|
78
77
|
claims: !StringUtils.isEmptyObj(claims) ? claims : undefined,
|
|
79
78
|
state: request.state,
|
|
80
79
|
authenticationScheme:
|
|
@@ -87,34 +86,35 @@ export class NestedAppAuthAdapter {
|
|
|
87
86
|
|
|
88
87
|
public fromNaaTokenResponse(
|
|
89
88
|
request: TokenRequest,
|
|
90
|
-
response:
|
|
89
|
+
response: AuthResult,
|
|
91
90
|
reqTimestamp: number
|
|
92
91
|
): AuthenticationResult {
|
|
93
|
-
if (!response.id_token || !response.access_token) {
|
|
92
|
+
if (!response.token.id_token || !response.token.access_token) {
|
|
94
93
|
throw createClientAuthError(ClientAuthErrorCodes.nullOrEmptyToken);
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
const expiresOn = new Date(
|
|
98
|
-
(reqTimestamp + (response.expires_in || 0)) * 1000
|
|
97
|
+
(reqTimestamp + (response.token.expires_in || 0)) * 1000
|
|
99
98
|
);
|
|
100
99
|
const idTokenClaims = AuthToken.extractTokenClaims(
|
|
101
|
-
response.id_token,
|
|
100
|
+
response.token.id_token,
|
|
102
101
|
this.crypto.base64Decode
|
|
103
102
|
);
|
|
104
103
|
const account = this.fromNaaAccountInfo(
|
|
105
104
|
response.account,
|
|
106
105
|
idTokenClaims
|
|
107
106
|
);
|
|
107
|
+
const scopes = response.token.scope || request.scope;
|
|
108
108
|
|
|
109
109
|
const authenticationResult: AuthenticationResult = {
|
|
110
|
-
authority: response.authority || account.environment,
|
|
110
|
+
authority: response.token.authority || account.environment,
|
|
111
111
|
uniqueId: account.localAccountId,
|
|
112
112
|
tenantId: account.tenantId,
|
|
113
|
-
scopes:
|
|
113
|
+
scopes: scopes.split(" "),
|
|
114
114
|
account,
|
|
115
|
-
idToken: response.
|
|
115
|
+
idToken: response.token.id_token,
|
|
116
116
|
idTokenClaims,
|
|
117
|
-
accessToken: response.access_token,
|
|
117
|
+
accessToken: response.token.access_token,
|
|
118
118
|
fromCache: true,
|
|
119
119
|
expiresOn: expiresOn,
|
|
120
120
|
tokenType:
|
|
@@ -204,32 +204,32 @@ export class NestedAppAuthAdapter {
|
|
|
204
204
|
| InteractionRequiredAuthError {
|
|
205
205
|
if (isBridgeError(error)) {
|
|
206
206
|
switch (error.status) {
|
|
207
|
-
case BridgeStatusCode.
|
|
207
|
+
case BridgeStatusCode.UserCancel:
|
|
208
208
|
return new ClientAuthError(
|
|
209
209
|
ClientAuthErrorCodes.userCanceled
|
|
210
210
|
);
|
|
211
|
-
case BridgeStatusCode.
|
|
211
|
+
case BridgeStatusCode.NoNetwork:
|
|
212
212
|
return new ClientAuthError(
|
|
213
213
|
ClientAuthErrorCodes.noNetworkConnectivity
|
|
214
214
|
);
|
|
215
|
-
case BridgeStatusCode.
|
|
215
|
+
case BridgeStatusCode.AccountUnavailable:
|
|
216
216
|
return new ClientAuthError(
|
|
217
217
|
ClientAuthErrorCodes.noAccountFound
|
|
218
218
|
);
|
|
219
|
-
case BridgeStatusCode.
|
|
219
|
+
case BridgeStatusCode.Disabled:
|
|
220
220
|
return new ClientAuthError(
|
|
221
221
|
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled
|
|
222
222
|
);
|
|
223
|
-
case BridgeStatusCode.
|
|
223
|
+
case BridgeStatusCode.NestedAppAuthUnavailable:
|
|
224
224
|
return new ClientAuthError(
|
|
225
225
|
error.code ||
|
|
226
226
|
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled,
|
|
227
227
|
error.description
|
|
228
228
|
);
|
|
229
|
-
case BridgeStatusCode.
|
|
230
|
-
case BridgeStatusCode.
|
|
229
|
+
case BridgeStatusCode.TransientError:
|
|
230
|
+
case BridgeStatusCode.PersistentError:
|
|
231
231
|
return new ServerError(error.code, error.description);
|
|
232
|
-
case BridgeStatusCode.
|
|
232
|
+
case BridgeStatusCode.UserInteractionRequired:
|
|
233
233
|
return new InteractionRequiredAuthError(
|
|
234
234
|
error.code,
|
|
235
235
|
error.description
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Logger } from "@azure/msal-common";
|
|
6
|
+
import { Logger, LogLevel } from "@azure/msal-common";
|
|
7
7
|
import {
|
|
8
8
|
BrowserConfiguration,
|
|
9
9
|
buildConfiguration,
|
|
10
10
|
Configuration,
|
|
11
11
|
} from "../config/Configuration";
|
|
12
12
|
import { version, name } from "../packageMetadata";
|
|
13
|
+
import {
|
|
14
|
+
BrowserCacheLocation,
|
|
15
|
+
LOG_LEVEL_CACHE_KEY,
|
|
16
|
+
LOG_PII_CACHE_KEY,
|
|
17
|
+
} from "../utils/BrowserConstants";
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
20
|
* Base class for operating context
|
|
@@ -24,6 +29,31 @@ export abstract class BaseOperatingContext {
|
|
|
24
29
|
protected available: boolean;
|
|
25
30
|
protected browserEnvironment: boolean;
|
|
26
31
|
|
|
32
|
+
protected static loggerCallback(level: LogLevel, message: string): void {
|
|
33
|
+
switch (level) {
|
|
34
|
+
case LogLevel.Error:
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.error(message);
|
|
37
|
+
return;
|
|
38
|
+
case LogLevel.Info:
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.info(message);
|
|
41
|
+
return;
|
|
42
|
+
case LogLevel.Verbose:
|
|
43
|
+
// eslint-disable-next-line no-console
|
|
44
|
+
console.debug(message);
|
|
45
|
+
return;
|
|
46
|
+
case LogLevel.Warning:
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.warn(message);
|
|
49
|
+
return;
|
|
50
|
+
default:
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.log(message);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
27
57
|
constructor(config: Configuration) {
|
|
28
58
|
/*
|
|
29
59
|
* If loaded in an environment where window is not available,
|
|
@@ -31,13 +61,40 @@ export abstract class BaseOperatingContext {
|
|
|
31
61
|
* This is to support server-side rendering environments.
|
|
32
62
|
*/
|
|
33
63
|
this.browserEnvironment = typeof window !== "undefined";
|
|
34
|
-
|
|
35
64
|
this.config = buildConfiguration(config, this.browserEnvironment);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
65
|
+
|
|
66
|
+
let sessionStorage: Storage | undefined;
|
|
67
|
+
try {
|
|
68
|
+
sessionStorage = window[BrowserCacheLocation.SessionStorage];
|
|
69
|
+
// Mute errors if it's a non-browser environment or cookies are blocked.
|
|
70
|
+
} catch (e) {}
|
|
71
|
+
|
|
72
|
+
const logLevelKey = sessionStorage?.getItem(LOG_LEVEL_CACHE_KEY);
|
|
73
|
+
const piiLoggingKey = sessionStorage
|
|
74
|
+
?.getItem(LOG_PII_CACHE_KEY)
|
|
75
|
+
?.toLowerCase();
|
|
76
|
+
|
|
77
|
+
const piiLoggingEnabled =
|
|
78
|
+
piiLoggingKey === "true"
|
|
79
|
+
? true
|
|
80
|
+
: piiLoggingKey === "false"
|
|
81
|
+
? false
|
|
82
|
+
: undefined;
|
|
83
|
+
const loggerOptions = { ...this.config.system.loggerOptions };
|
|
84
|
+
|
|
85
|
+
const logLevel =
|
|
86
|
+
logLevelKey && Object.keys(LogLevel).includes(logLevelKey)
|
|
87
|
+
? LogLevel[logLevelKey]
|
|
88
|
+
: undefined;
|
|
89
|
+
if (logLevel) {
|
|
90
|
+
loggerOptions.loggerCallback = BaseOperatingContext.loggerCallback;
|
|
91
|
+
loggerOptions.logLevel = logLevel;
|
|
92
|
+
}
|
|
93
|
+
if (piiLoggingEnabled !== undefined) {
|
|
94
|
+
loggerOptions.piiLoggingEnabled = piiLoggingEnabled;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.logger = new Logger(loggerOptions, name, version);
|
|
41
98
|
this.available = false;
|
|
42
99
|
}
|
|
43
100
|
|
package/src/packageMetadata.ts
CHANGED
|
@@ -4,20 +4,65 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
Constants,
|
|
8
|
+
InProgressPerformanceEvent,
|
|
9
|
+
IPerformanceClient,
|
|
7
10
|
Logger,
|
|
11
|
+
PerformanceClient,
|
|
8
12
|
PerformanceEvent,
|
|
9
13
|
PerformanceEvents,
|
|
10
|
-
IPerformanceClient,
|
|
11
|
-
PerformanceClient,
|
|
12
|
-
IPerformanceMeasurement,
|
|
13
|
-
InProgressPerformanceEvent,
|
|
14
|
-
SubMeasurement,
|
|
15
14
|
PreQueueEvent,
|
|
16
|
-
|
|
15
|
+
SubMeasurement,
|
|
17
16
|
} from "@azure/msal-common";
|
|
18
|
-
import { BrowserPerformanceMeasurement } from "./BrowserPerformanceMeasurement";
|
|
19
17
|
import { Configuration } from "../config/Configuration";
|
|
20
18
|
import { name, version } from "../packageMetadata";
|
|
19
|
+
import {
|
|
20
|
+
BROWSER_PERF_ENABLED_KEY,
|
|
21
|
+
BrowserCacheLocation,
|
|
22
|
+
} from "../utils/BrowserConstants";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns browser performance measurement module if session flag is enabled. Returns undefined otherwise.
|
|
26
|
+
*/
|
|
27
|
+
function getPerfMeasurementModule() {
|
|
28
|
+
let sessionStorage: Storage | undefined;
|
|
29
|
+
try {
|
|
30
|
+
sessionStorage = window[BrowserCacheLocation.SessionStorage];
|
|
31
|
+
const perfEnabled = sessionStorage?.getItem(BROWSER_PERF_ENABLED_KEY);
|
|
32
|
+
if (Number(perfEnabled) === 1) {
|
|
33
|
+
return import("./BrowserPerformanceMeasurement");
|
|
34
|
+
}
|
|
35
|
+
// Mute errors if it's a non-browser environment or cookies are blocked.
|
|
36
|
+
} catch (e) {}
|
|
37
|
+
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns boolean, indicating whether browser supports window.performance.now() function.
|
|
43
|
+
*/
|
|
44
|
+
function supportsBrowserPerformanceNow(): boolean {
|
|
45
|
+
return (
|
|
46
|
+
typeof window !== "undefined" &&
|
|
47
|
+
typeof window.performance !== "undefined" &&
|
|
48
|
+
typeof window.performance.now === "function"
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns event duration in milliseconds using window performance API if available. Returns undefined otherwise.
|
|
54
|
+
* @param startTime {DOMHighResTimeStamp | undefined}
|
|
55
|
+
* @returns {number | undefined}
|
|
56
|
+
*/
|
|
57
|
+
function getPerfDurationMs(
|
|
58
|
+
startTime: DOMHighResTimeStamp | undefined
|
|
59
|
+
): number | undefined {
|
|
60
|
+
if (!startTime || !supportsBrowserPerformanceNow()) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return Math.round(window.performance.now() - startTime);
|
|
65
|
+
}
|
|
21
66
|
|
|
22
67
|
export class BrowserPerformanceClient
|
|
23
68
|
extends PerformanceClient
|
|
@@ -42,13 +87,6 @@ export class BrowserPerformanceClient
|
|
|
42
87
|
);
|
|
43
88
|
}
|
|
44
89
|
|
|
45
|
-
startPerformanceMeasurement(
|
|
46
|
-
measureName: string,
|
|
47
|
-
correlationId: string
|
|
48
|
-
): IPerformanceMeasurement {
|
|
49
|
-
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
90
|
generateId(): string {
|
|
53
91
|
return window.crypto.randomUUID();
|
|
54
92
|
}
|
|
@@ -60,32 +98,27 @@ export class BrowserPerformanceClient
|
|
|
60
98
|
private deleteIncompleteSubMeasurements(
|
|
61
99
|
inProgressEvent: InProgressPerformanceEvent
|
|
62
100
|
): void {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
101
|
+
void getPerfMeasurementModule()?.then((module) => {
|
|
102
|
+
const rootEvent = this.eventsByCorrelationId.get(
|
|
103
|
+
inProgressEvent.event.correlationId
|
|
104
|
+
);
|
|
105
|
+
const isRootEvent =
|
|
106
|
+
rootEvent &&
|
|
107
|
+
rootEvent.eventId === inProgressEvent.event.eventId;
|
|
108
|
+
const incompleteMeasurements: SubMeasurement[] = [];
|
|
109
|
+
if (isRootEvent && rootEvent?.incompleteSubMeasurements) {
|
|
110
|
+
rootEvent.incompleteSubMeasurements.forEach(
|
|
111
|
+
(subMeasurement: SubMeasurement) => {
|
|
112
|
+
incompleteMeasurements.push({ ...subMeasurement });
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
// Clean up remaining marks for incomplete sub-measurements
|
|
117
|
+
module.BrowserPerformanceMeasurement.flushMeasurements(
|
|
77
118
|
inProgressEvent.event.correlationId,
|
|
78
119
|
incompleteMeasurements
|
|
79
120
|
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
supportsBrowserPerformanceNow(): boolean {
|
|
84
|
-
return (
|
|
85
|
-
typeof window !== "undefined" &&
|
|
86
|
-
typeof window.performance !== "undefined" &&
|
|
87
|
-
typeof window.performance.now === "function"
|
|
88
|
-
);
|
|
121
|
+
});
|
|
89
122
|
}
|
|
90
123
|
|
|
91
124
|
/**
|
|
@@ -102,11 +135,25 @@ export class BrowserPerformanceClient
|
|
|
102
135
|
): InProgressPerformanceEvent {
|
|
103
136
|
// Capture page visibilityState and then invoke start/end measurement
|
|
104
137
|
const startPageVisibility = this.getPageVisibility();
|
|
105
|
-
|
|
106
138
|
const inProgressEvent = super.startMeasurement(
|
|
107
139
|
measureName,
|
|
108
140
|
correlationId
|
|
109
141
|
);
|
|
142
|
+
const startTime: number | undefined = supportsBrowserPerformanceNow()
|
|
143
|
+
? window.performance.now()
|
|
144
|
+
: undefined;
|
|
145
|
+
|
|
146
|
+
const browserMeasurement = getPerfMeasurementModule()?.then(
|
|
147
|
+
(module) => {
|
|
148
|
+
return new module.BrowserPerformanceMeasurement(
|
|
149
|
+
measureName,
|
|
150
|
+
inProgressEvent.event.correlationId
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
void browserMeasurement?.then((measurement) =>
|
|
155
|
+
measurement.startMeasurement()
|
|
156
|
+
);
|
|
110
157
|
|
|
111
158
|
return {
|
|
112
159
|
...inProgressEvent,
|
|
@@ -114,18 +161,24 @@ export class BrowserPerformanceClient
|
|
|
114
161
|
event?: Partial<PerformanceEvent>
|
|
115
162
|
): PerformanceEvent | null => {
|
|
116
163
|
const res = inProgressEvent.end({
|
|
164
|
+
...event,
|
|
117
165
|
startPageVisibility,
|
|
118
166
|
endPageVisibility: this.getPageVisibility(),
|
|
119
|
-
|
|
167
|
+
durationMs: getPerfDurationMs(startTime),
|
|
120
168
|
});
|
|
169
|
+
void browserMeasurement?.then((measurement) =>
|
|
170
|
+
measurement.endMeasurement()
|
|
171
|
+
);
|
|
121
172
|
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
122
173
|
|
|
123
174
|
return res;
|
|
124
175
|
},
|
|
125
176
|
discard: () => {
|
|
126
177
|
inProgressEvent.discard();
|
|
178
|
+
void browserMeasurement?.then((measurement) =>
|
|
179
|
+
measurement.flushMeasurement()
|
|
180
|
+
);
|
|
127
181
|
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
128
|
-
inProgressEvent.measurement.flushMeasurement();
|
|
129
182
|
},
|
|
130
183
|
};
|
|
131
184
|
}
|
|
@@ -140,7 +193,7 @@ export class BrowserPerformanceClient
|
|
|
140
193
|
eventName: PerformanceEvents,
|
|
141
194
|
correlationId?: string
|
|
142
195
|
): void {
|
|
143
|
-
if (!
|
|
196
|
+
if (!supportsBrowserPerformanceNow()) {
|
|
144
197
|
this.logger.trace(
|
|
145
198
|
`BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for ${eventName}`
|
|
146
199
|
);
|
|
@@ -193,7 +246,7 @@ export class BrowserPerformanceClient
|
|
|
193
246
|
queueTime?: number,
|
|
194
247
|
manuallyCompleted?: boolean
|
|
195
248
|
): void {
|
|
196
|
-
if (!
|
|
249
|
+
if (!supportsBrowserPerformanceNow()) {
|
|
197
250
|
this.logger.trace(
|
|
198
251
|
`BrowserPerformanceClient: window performance API not available, unable to add queue measurement for ${eventName}`
|
|
199
252
|
);
|
|
@@ -239,3 +239,14 @@ export const CacheLookupPolicy = {
|
|
|
239
239
|
} as const;
|
|
240
240
|
export type CacheLookupPolicy =
|
|
241
241
|
(typeof CacheLookupPolicy)[keyof typeof CacheLookupPolicy];
|
|
242
|
+
|
|
243
|
+
export const iFrameRenewalPolicies: CacheLookupPolicy[] = [
|
|
244
|
+
CacheLookupPolicy.Default,
|
|
245
|
+
CacheLookupPolicy.Skip,
|
|
246
|
+
CacheLookupPolicy.RefreshTokenAndNetwork,
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
export const LOG_LEVEL_CACHE_KEY = "msal.browser.log.level";
|
|
250
|
+
export const LOG_PII_CACHE_KEY = "msal.browser.log.pii";
|
|
251
|
+
|
|
252
|
+
export const BROWSER_PERF_ENABLED_KEY = "msal.browser.performance.enabled";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccountRequests.d.ts","sourceRoot":"","sources":["../../src/naa/AccountRequests.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,sBAAsB,GAAG;IACjC,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InitializeBridgeResponse.d.ts","sourceRoot":"","sources":["../../src/naa/InitializeBridgeResponse.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,wBAAwB;IACrC,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type AccountByHomeIdRequest = {
|
|
7
|
-
homeAccountId: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type AccountByLocalIdRequest = {
|
|
11
|
-
localAccountId: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type AccountByUsernameRequest = {
|
|
15
|
-
username: string;
|
|
16
|
-
};
|