Skip to content

Commit fe65d4c

Browse files
authored
Chore: Release 10.2.0 (#3219)
* refactor: use strong types in authentication module (#3164) * Chore: Dependabot upgrades - April (#3124) * fix: remove character escape in json response formatting (#3163) * Fix: add parameters to token request (#3218) * Bump version to 10.2.0
1 parent ebecf21 commit fe65d4c

File tree

8 files changed

+1738
-1101
lines changed

8 files changed

+1738
-1101
lines changed

config/webpackDevServer.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,31 @@ module.exports = function (proxy, allowedHost) {
8989
// src/node_modules is not ignored to support absolute imports
9090
// https://github.com/facebook/create-react-app/issues/1065
9191
// Enable HTTPS if the HTTPS environment variable is set to 'true'
92-
https: protocol === 'https',
9392
host,
9493
historyApiFallback: {
9594
// Paths with dots should still use the history fallback.
9695
// See https://github.com/facebook/create-react-app/issues/387.
9796
disableDotRule: true
9897
},
9998
proxy,
100-
onBeforeSetupMiddleware(devServer) {
99+
setupMiddlewares: (middlewares, devServer) => {
101100
if (fs.existsSync(paths.proxySetup)) {
102101
// This registers user provided middleware for proxy reasons
103102
require(paths.proxySetup)(devServer.app);
104103
}
105104

106105
// This lets us fetch source contents from webpack for the error overlay
107-
devServer.app.use(evalSourceMapMiddleware(devServer));
106+
middlewares.push(evalSourceMapMiddleware(devServer));
108107
// This lets us open files from the runtime error overlay.
109-
devServer.app.use(errorOverlayMiddleware());
108+
middlewares.push(errorOverlayMiddleware());
110109

111110
// This service worker file is effectively a 'no-op' that will reset any
112111
// previous service worker registered for the same host:port combination.
113112
// We do this in development to avoid hitting the production cache if
114113
// it used the same host and port.
115114
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
116-
devServer.app.use(noopServiceWorkerMiddleware('/'));
115+
middlewares.push(noopServiceWorkerMiddleware('/'));
116+
return middlewares;
117117
}
118118
};
119119
};

package-lock.json

Lines changed: 1667 additions & 1029 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"name": "graph-explorer-v2",
3-
"version": "10.1.0",
3+
"version": "10.2.0",
44
"private": true,
55
"dependencies": {
66
"@augloop/types-core": "file:packages/types-core-2.16.189.tgz",
77
"@axe-core/webdriverjs": "4.8.5",
8-
"@azure/msal-browser": "3.10.0",
9-
"@babel/core": "7.23.3",
10-
"@babel/runtime": "7.23.8",
11-
"@fluentui/react": "8.112.5",
12-
"@fluentui/react-icons-mdl2": "1.3.52",
13-
"@microsoft/applicationinsights-react-js": "17.0.3",
14-
"@microsoft/applicationinsights-web": "3.0.5",
8+
"@azure/msal-browser": "3.14.0",
9+
"@babel/core": "7.24.6",
10+
"@babel/runtime": "7.24.5",
11+
"@fluentui/react": "8.117.7",
12+
"@fluentui/react-icons-mdl2": "1.3.63",
13+
"@microsoft/applicationinsights-react-js": "17.2.0",
14+
"@microsoft/applicationinsights-web": "3.2.1",
1515
"@microsoft/microsoft-graph-client": "3.0.7",
1616
"@monaco-editor/react": "4.6.0",
1717
"@ms-ofb/officebrowserfeedbacknpm": "file:packages/officebrowserfeedbacknpm-1.6.6.tgz",
18-
"adaptive-expressions": "4.21.4",
18+
"adaptive-expressions": "4.22.2",
1919
"adaptivecards": "3.0.2",
2020
"adaptivecards-templating": "2.3.1",
2121
"ajv": "8.12.0",
@@ -31,7 +31,7 @@
3131
"dotenv-expand": "11.0.6",
3232
"eslint-config-react-app": "7.0.1",
3333
"eslint-plugin-react": "7.33.2",
34-
"eslint-webpack-plugin": "4.0.1",
34+
"eslint-webpack-plugin": "4.1.0",
3535
"express": "4.19.2",
3636
"expvariantassignmentsdk": "file:packages/expvariantassignmentsdk-1.0.0.tgz",
3737
"file-loader": "6.2.0",
@@ -40,13 +40,13 @@
4040
"guid-typescript": "1.0.9",
4141
"isomorphic-fetch": "3.0.0",
4242
"localforage": "1.10.0",
43-
"mini-css-extract-plugin": "2.8.1",
43+
"mini-css-extract-plugin": "2.9.0",
4444
"monaco-editor": "0.30.1",
4545
"monaco-editor-webpack-plugin": "6.0.0",
4646
"office-ui-fabric-core": "11.1.0",
4747
"postcss-flexbugs-fixes": "5.0.2",
4848
"postcss-loader": "8.1.1",
49-
"postcss-preset-env": "9.3.0",
49+
"postcss-preset-env": "9.5.13",
5050
"re-resizable": "6.9.11",
5151
"react": "18.2.0",
5252
"react-app-polyfill": "3.0.0",
@@ -56,13 +56,13 @@
5656
"redux-thunk": "2.4.2",
5757
"resolve": "1.22.8",
5858
"sass": "1.72.0",
59-
"sass-loader": "14.1.1",
60-
"style-loader": "3.3.4",
61-
"typescript": "5.3.3",
59+
"sass-loader": "14.2.1",
60+
"style-loader": "4.0.0",
61+
"typescript": "5.4.5",
6262
"url": "0.11.3",
6363
"url-loader": "4.1.1",
64-
"webpack": "5.90.3",
65-
"webpack-dev-server": "4.15.1",
64+
"webpack": "5.91.0",
65+
"webpack-dev-server": "5.0.4",
6666
"webpack-manifest-plugin": "5.0.0",
6767
"workbox-webpack-plugin": "7.0.0"
6868
},
@@ -91,7 +91,7 @@
9191
],
9292
"devDependencies": {
9393
"@axe-core/playwright": "4.7.3",
94-
"@playwright/test": "1.42.0",
94+
"@playwright/test": "1.43.1",
9595
"@types/chromedriver": "81.0.1",
9696
"@types/isomorphic-fetch": "0.0.39",
9797
"@types/jest": "29.5.12",
@@ -102,11 +102,11 @@
102102
"@types/redux-logger": "3.0.11",
103103
"@types/redux-mock-store": "1.0.3",
104104
"@types/selenium-webdriver": "4.1.21",
105-
"@typescript-eslint/eslint-plugin": "6.20.0",
105+
"@typescript-eslint/eslint-plugin": "7.0.0",
106106
"@typescript-eslint/parser": "6.17.0",
107107
"acorn": "8.11.3",
108108
"babel-jest": "29.7.0",
109-
"chromedriver": "122.0.4",
109+
"chromedriver": "124.0.1",
110110
"eslint": "8.56.0",
111111
"html-webpack-plugin": "5.6.0",
112112
"jest": "29.7.0",

src/app/services/context/popups-context/PopupsContext.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import { createContext, useContext, useReducer } from 'react';
2-
import { PopupState, initialState } from '.';
2+
3+
import { PopupState } from '.';
34
import { reducedPopups } from './reducedPopups';
45

5-
const PopupStateContext = createContext<PopupState>(initialState);
6+
const PopupStateContext = createContext<PopupState>({
7+
popups: []
8+
});
69
const PopupDispatchContext = createContext<any>({});
710

811
export function PopupsProvider({ children }: any) {
9-
const [state, dispatch] = useReducer(reducedPopups, initialState);
12+
const [state, dispatch] = useReducer(reducedPopups, {
13+
popups: []
14+
});
1015

1116
return (
1217
<PopupStateContext.Provider value={state}>

src/app/views/common/monaco/util/format-json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function formatJsonStringForAllBrowsers(
1515
* 3. format the string (works for all browsers)
1616
*/
1717
try {
18-
body = JSON.stringify(body).replace(/(?:\\[rnt]|[\r\n\t]+)+/g, '');
18+
body = JSON.stringify(body);
1919
body = JSON.parse(body);
2020
} catch (error) {
2121
telemetry.trackException(

src/modules/authentication/AuthenticationWrapper.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AccountInfo,
33
AuthenticationResult,
4+
BrowserAuthError,
45
InteractionRequiredAuthError,
56
PopupRequest,
67
SilentRequest
@@ -45,8 +46,8 @@ export class AuthenticationWrapper implements IAuthenticationWrapper {
4546
public getSessionId(): string | null {
4647
const account = this.getAccount();
4748
if (account) {
48-
const idTokenClaims: any = account?.idTokenClaims;
49-
return idTokenClaims?.sid;
49+
const idTokenClaims = account?.idTokenClaims;
50+
return idTokenClaims?.sid ?? null;
5051
}
5152
return null;
5253
}
@@ -75,16 +76,19 @@ export class AuthenticationWrapper implements IAuthenticationWrapper {
7576
authority: this.getAuthority(),
7677
prompt: 'select_account',
7778
redirectUri: getCurrentUri(),
78-
extraQueryParameters: getExtraQueryParameters()
79+
extraQueryParameters: getExtraQueryParameters(),
80+
tokenQueryParameters: getExtraQueryParameters()
7981
};
8082
try {
8183
const result = await msalApplication.loginPopup(popUpRequest);
8284
this.storeHomeAccountId(result.account!);
8385
return result;
84-
} catch (error: any) {
85-
const { errorCode } = error;
86-
if (errorCode === 'interaction_in_progress') {
87-
this.eraseInteractionInProgressCookie();
86+
} catch (error: unknown) {
87+
if (error instanceof BrowserAuthError){
88+
const { errorCode } = error;
89+
if (errorCode === 'interaction_in_progress') {
90+
this.eraseInteractionInProgressCookie();
91+
}
8892
}
8993
throw error;
9094
}
@@ -166,17 +170,14 @@ export class AuthenticationWrapper implements IAuthenticationWrapper {
166170
const result = await msalApplication.acquireTokenSilent(silentRequest);
167171
this.storeHomeAccountId(result.account!);
168172
return result;
169-
} catch (error: any) {
173+
} catch (error: unknown) {
170174
if (error instanceof InteractionRequiredAuthError || !this.getAccount()) {
171175
return this.loginWithInteraction(scopes.length > 0 ? scopes : defaultScopes, sessionId);
172-
173-
} else if (signInAuthError(error)) {
174-
this.deleteHomeAccountId();
175-
throw error;
176176
}
177-
else {
178-
throw error;
177+
if (typeof error === 'string' && signInAuthError(error as string)) {
178+
this.deleteHomeAccountId();
179179
}
180+
throw error;
180181
}
181182
}
182183

@@ -207,8 +208,9 @@ export class AuthenticationWrapper implements IAuthenticationWrapper {
207208
authority: this.getAuthority(),
208209
prompt: 'select_account',
209210
redirectUri: getCurrentUri(),
211+
claims: this.getClaims(),
210212
extraQueryParameters: getExtraQueryParameters(),
211-
claims: this.getClaims()
213+
tokenQueryParameters: getExtraQueryParameters()
212214
};
213215

214216
if (this.consentingToNewScopes || this.performingStepUpAuth) {
@@ -225,22 +227,20 @@ export class AuthenticationWrapper implements IAuthenticationWrapper {
225227
const result = await msalApplication.loginPopup(popUpRequest);
226228
this.storeHomeAccountId(result.account!);
227229
return result;
228-
} catch (error: any) {
229-
const { errorCode } = error;
230-
if (signInAuthError(errorCode) && !this.consentingToNewScopes && (errorCode && errorCode !== 'user_cancelled')) {
231-
this.clearSession();
232-
if (errorCode === 'interaction_in_progress') {
233-
this.eraseInteractionInProgressCookie();
230+
} catch (error: unknown) {
231+
if(error instanceof BrowserAuthError){
232+
const { errorCode } = error;
233+
const valid = !this.consentingToNewScopes && errorCode !== 'user_cancelled';
234+
if (signInAuthError(errorCode) && valid) {
235+
this.clearSession();
236+
if (errorCode === 'interaction_in_progress') {
237+
this.eraseInteractionInProgressCookie();
238+
}
234239
}
235-
throw error;
236-
}
237-
else {
238-
throw error;
239240
}
240-
241+
throw error;
241242
}
242243
}
243-
244244
private storeHomeAccountId(account: AccountInfo): void {
245245
localStorage.setItem(HOME_ACCOUNT_KEY, account.homeAccountId);
246246
}

src/modules/authentication/msal-app.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { Configuration, LogLevel, PublicClientApplication } from '@azure/msal-br
22
import { eventTypes, telemetry } from '../../telemetry';
33

44
function getClientIdFromWindow() {
5-
return (window as any).ClientId;
5+
return window?.ClientId ?? '';
66
}
77

88
function getClientIdFromEnv() {
9-
return process.env.REACT_APP_CLIENT_ID;
9+
return process.env?.REACT_APP_CLIENT_ID ?? '';
1010
}
1111

1212
const windowHasClientId = getClientIdFromWindow();
@@ -29,20 +29,6 @@ export const configuration: Configuration = {
2929
return;
3030
}
3131
telemetry.trackEvent(eventTypes.AUTH_REQUEST_EVENT, { message, level });
32-
switch (level) {
33-
case LogLevel.Error:
34-
console.error('[MSAL]', message);
35-
return;
36-
case LogLevel.Info:
37-
console.info('[MSAL]', message);
38-
return;
39-
case LogLevel.Verbose:
40-
console.debug('[MSAL]', message);
41-
return;
42-
case LogLevel.Warning:
43-
console.warn('[MSAL]', message);
44-
return;
45-
}
4632
},
4733
piiLoggingEnabled: false
4834
}

src/types/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export {};
2+
declare global {
3+
interface Window {
4+
ClientId: string | undefined
5+
}
6+
}
7+
8+
window.ClientId = window.ClientId || undefined;

0 commit comments

Comments
 (0)