Skip to content

Commit 32cfa71

Browse files
ElinorWjobalathewahomeOfficeGlobalOfficeGlobal
authored
chore(release): 4.3.0 (#852)
* Fix: support different content types (#814) * Feature: Add Adaptive cards JSON Schema code (#828) * Feature: samples testing (#833) * Feature: Adds 'Report an Issue' menu option (#834) * Feature: clickable links on message bar (#835) * fix: intermittent create page error (#837) * Fix: Add 'Maximize sidebar' aria-label (#842) * Task: upgrade technologies (#844) * Fix: expand maxWidth allow more humanName chars (#764) * Fix: autocomplete options not displaying (#847) * fix: adaptive cards destroy (#848) * Fix: Graph Explorer link colors (#846) * Fix: Adaptive cards instrumentation (#849) * Fix: adjust column width (#850) * Task: prevent storing access token (#851) Co-authored-by: jobala <[email protected]> Co-authored-by: Charles Wahome <[email protected]> Co-authored-by: OfficeGlobal <[email protected]> Co-authored-by: OfficeGlobal <[email protected]> Co-authored-by: Azure Static Web Apps <[email protected]> Co-authored-by: Millicent Achieng <[email protected]> Co-authored-by: Sébastien Levert <[email protected]> Co-authored-by: Ezrqn Kemboi <[email protected]> Co-authored-by: Vincent Biret <[email protected]> Co-authored-by: Joseph Ngugi <[email protected]> Co-authored-by: Maggie Kimani <[email protected]>
1 parent 5207e09 commit 32cfa71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4250
-25946
lines changed

config/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ module.exports = function (webpackEnv) {
397397
maxChunks: 1,
398398
}),
399399
new MonacoWebpackPlugin({
400-
languages: ['json', 'javascript', 'java', 'objective-c', 'csharp']
400+
languages: ['json', 'javascript', 'java', 'objective-c', 'csharp', 'html']
401401
}),
402402
// Generates an `index.html` file with the <script> injected.
403403
new HtmlWebpackPlugin(

package-lock.json

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

package.json

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "graph-explorer-v2",
3-
"version": "4.2.0",
3+
"version": "4.3.0",
44
"private": true,
55
"dependencies": {
6-
"@babel/core": "7.2.2",
6+
"@babel/core": "7.12.13",
7+
"@babel/eslint-parser": "7.12.13",
78
"@microsoft/applicationinsights-react-js": "2.3.1",
89
"@microsoft/applicationinsights-web": "2.3.1",
910
"@microsoft/microsoft-graph-client": "2.1.0",
@@ -13,10 +14,9 @@
1314
"adaptivecards": "1.2.3",
1415
"adaptivecards-templating": "1.4.0",
1516
"babel-core": "7.0.0-bridge.0",
16-
"babel-eslint": "9.0.0",
17-
"babel-loader": "8.0.5",
18-
"babel-plugin-named-asset-import": "0.3.1",
19-
"babel-preset-react-app": "7.0.1",
17+
"babel-loader": "8.2.2",
18+
"babel-plugin-named-asset-import": "0.3.7",
19+
"babel-preset-react-app": "10.0.0",
2020
"bfj": "6.1.1",
2121
"bootstrap": "4.3.1",
2222
"case-sensitive-paths-webpack-plugin": "2.2.0",
@@ -71,7 +71,7 @@
7171
"sass-loader": "7.1.0",
7272
"style-loader": "0.23.1",
7373
"terser-webpack-plugin": "1.2.2",
74-
"typescript": "3.3.3",
74+
"typescript": "4.1.5",
7575
"url-loader": "1.1.2",
7676
"webpack": "4.28.3",
7777
"webpack-dev-server": "3.11.0",
@@ -114,27 +114,34 @@
114114
"@types/redux-logger": "3.0.7",
115115
"@types/redux-mock-store": "1.0.0",
116116
"@types/selenium-webdriver": "4.0.6",
117-
"@typescript-eslint/eslint-plugin": "3.10.1",
118-
"@typescript-eslint/eslint-plugin-tslint": "3.5.0",
119-
"@typescript-eslint/parser": "3.10.1",
117+
"@typescript-eslint/eslint-plugin": "4.15.0",
118+
"@typescript-eslint/eslint-plugin-tslint": "4.15.0",
119+
"@typescript-eslint/parser": "4.15.0",
120120
"axe-core": "3.4.2",
121121
"axe-sarif-converter": "2.3.0",
122122
"axe-webdriverjs": "2.3.0",
123-
"babel-jest": "23.6.0",
124-
"chromedriver": "^84.0.1",
123+
"axios": "0.21.1",
124+
"babel-jest": "26.6.3",
125+
"braces": "2.3.1",
126+
"chromedriver": "^88.0.0",
125127
"enzyme": "3.9.0",
126128
"enzyme-adapter-react-16": "1.9.1",
127129
"eslint": "5.16.0",
128-
"jest-fetch-mock": "2.1.1",
130+
"immer": "8.0.1",
131+
"jest-fetch-mock": "3.0.3",
132+
"node-fetch": "2.6.1",
133+
"node-notifier": "8.0.1",
129134
"react-test-renderer": "16.8.3",
130135
"redux-logger": "3.0.6",
131136
"redux-mock-store": "1.5.3",
132137
"selenium-webdriver": "4.0.0-alpha.7",
138+
"serialize-javascript": "3.1.0",
133139
"standard-version": "8.0.2",
134140
"start-server-and-test": "1.11.7",
135141
"ts-jest": "25.2.0",
136142
"tslint": "5.12.1",
137143
"tslint-config-prettier": "1.18.0",
138-
"tslint-react": "4.0.0"
144+
"tslint-react": "4.0.0",
145+
"yargs-parser": "13.1.2"
139146
}
140147
}

src/app/services/actions/auth-action-creators.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Mode } from '../../../types/enums';
33
import { logOut, logOutPopUp } from '../graph-client/msal-service';
44
import { GET_AUTH_TOKEN_SUCCESS, GET_CONSENTED_SCOPES_SUCCESS, LOGOUT_SUCCESS } from '../redux-constants';
55

6-
export function getAuthTokenSuccess(response: string): IAction {
6+
export function getAuthTokenSuccess(response: boolean): any {
77
return {
88
type: GET_AUTH_TOKEN_SUCCESS,
99
response,
@@ -16,7 +16,7 @@ export function getConsentedScopesSuccess(response: string[]): IAction {
1616
};
1717
}
1818

19-
export function signOutSuccess(response: string): IAction {
19+
export function signOutSuccess(response: boolean): any {
2020
return {
2121
type: LOGOUT_SUCCESS,
2222
response,
@@ -31,12 +31,12 @@ export function signOut() {
3131
} else {
3232
logOutPopUp();
3333
}
34-
dispatch(signOutSuccess(''));
34+
dispatch(signOutSuccess(false));
3535
};
3636
}
3737

38-
export function signIn(token: string) {
39-
return (dispatch: Function) => dispatch(getAuthTokenSuccess(token));
38+
export function signIn() {
39+
return (dispatch: Function) => dispatch(getAuthTokenSuccess(true));
4040
}
4141

4242
export function storeScopes(consentedScopes: string[]) {

src/app/services/actions/autocomplete-action-creators.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export function fetchAutocompletePending(): any {
2727

2828
export function fetchAutoCompleteOptions(url: string, version: string): Function {
2929
return async (dispatch: Function, getState: Function) => {
30-
const devxApi = getState().devxApi;
30+
const devxApiUrl = getState().devxApi.baseUrl;
3131
dispatch(fetchAutocompletePending());
32-
const autoOptions = await suggestions.getSuggestions(url, devxApi, version);
32+
const autoOptions = await suggestions.getSuggestions(url, devxApiUrl, version);
3333
if (autoOptions) {
3434
return dispatch(fetchAutocompleteSuccess(autoOptions));
3535
}

src/app/services/actions/devxApi-action-creators.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { IAction } from '../../../types/action';
12
import { SET_DEVX_API_URL_SUCCESS } from '../redux-constants';
23

3-
export function setDevxApiUrl(response: string): any {
4+
export function setDevxApiUrl(response: object): IAction {
45
return {
56
type: SET_DEVX_API_URL_SUCCESS,
67
response,

src/app/services/actions/permissions-action-creator.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export function fetchScopes(query?: IQuery): Function {
3434
return async (dispatch: Function, getState: Function) => {
3535
try {
3636
const { devxApi } = getState();
37-
let permissionsUrl = `${devxApi}/permissions`;
37+
let permissionsUrl = `${devxApi.baseUrl}/permissions`;
38+
3839
let hasUrl = false; // whether permissions are for a specific url
3940

4041
if (query) {
@@ -49,6 +50,10 @@ export function fetchScopes(query?: IQuery): Function {
4950
hasUrl = true;
5051
}
5152

53+
if (devxApi.parameters) {
54+
permissionsUrl = `${permissionsUrl}${query ? '&' : '?'}${devxApi.parameters}`;
55+
}
56+
5257
const headers = {
5358
'Content-Type': 'application/json',
5459
'Accept-Language': geLocale
@@ -83,7 +88,7 @@ export function consentToScopes(scopes: string[]): Function {
8388
return async (dispatch: Function) => {
8489
const authResponse = await acquireNewAccessToken(scopes);
8590
if (authResponse && authResponse.accessToken) {
86-
dispatch(getAuthTokenSuccess(authResponse.accessToken));
91+
dispatch(getAuthTokenSuccess(true));
8792
dispatch(getConsentedScopesSuccess(authResponse.scopes));
8893
}
8994
};

src/app/services/actions/query-action-creator-util.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ export function isImageResponse(contentType: string | undefined) {
5858
}
5959

6060
export function getContentType(headers: Headers) {
61-
const full = headers.get('content-type');
62-
if (full) {
63-
const delimiterPos = full.indexOf(';');
61+
const contentType = headers.get('content-type');
62+
if (contentType) {
63+
const delimiterPos = contentType.indexOf(';');
6464
if (delimiterPos !== -1) {
65-
return full.substr(0, delimiterPos);
65+
return contentType.substr(0, delimiterPos);
6666
} else {
67-
return full;
67+
return contentType;
6868
}
6969
}
7070
}
@@ -81,8 +81,7 @@ export function parseResponse(response: any, respHeaders: any): Promise<any> {
8181
return response.json();
8282

8383
case ContentType.XML:
84-
return response.text();
85-
84+
case ContentType.HTML:
8685
case ContentType.TextPlain:
8786
return response.text();
8887

src/app/services/actions/samples-action-creators.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export function fetchSamplesPending(): any {
2828
export function fetchSamples(): Function {
2929
return async (dispatch: Function, getState: Function) => {
3030
const { devxApi } = getState();
31-
const samplesUrl = `${devxApi}/samples`;
31+
let samplesUrl = `${devxApi.baseUrl}/samples`;
32+
33+
samplesUrl = (devxApi.parameters) ? `${samplesUrl}?${devxApi.parameters}` : `${samplesUrl}`;
3234

3335
const headers = {
3436
'Content-Type': 'application/json',

src/app/services/graph-client/msal-service.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ const defaultUserScopes = DEFAULT_USER_SCOPES.split(' ');
88
const loginType = getLoginType();
99
msalApplication.handleRedirectCallback(authCallback);
1010

11+
const loginRequest: AuthenticationParameters = {
12+
scopes: defaultUserScopes,
13+
authority: getAuthority(),
14+
prompt: 'select_account',
15+
redirectUri: getCurrentUri().toLowerCase(),
16+
extraQueryParameters: { mkt: geLocale }
17+
};
18+
1119
export function getSessionId() {
1220
const account = msalApplication.getAccount();
1321

@@ -16,6 +24,11 @@ export function getSessionId() {
1624
}
1725
}
1826

27+
export async function getToken() {
28+
const authResponse = await msalApplication.acquireTokenSilent(loginRequest);
29+
return authResponse;
30+
}
31+
1932
// get current uri for redirect uri purpose
2033
// ref - https://github.com/AzureAD/microsoft-authentication-library-for
2134
// -js/blob/9274fac6d100a6300eb2faa4c94aa2431b1ca4b0/lib/msal-browser/src/utils/BrowserUtils.ts#L49
@@ -24,27 +37,19 @@ function getCurrentUri(): string {
2437
}
2538

2639
function getAuthority(): string {
27-
// support for tenanted endpoint
28-
const urlParams = new URLSearchParams(location.search);
29-
let tenant = urlParams.get('tenant');
40+
// support for tenanted endpoint
41+
const urlParams = new URLSearchParams(location.search);
42+
let tenant = urlParams.get('tenant');
3043

31-
if (tenant === null) {
32-
tenant = 'common';
44+
if (tenant === null) {
45+
tenant = 'common';
3346
}
3447

3548
return `https://login.microsoftonline.com/${tenant}/`;
3649
}
3750

3851
export async function logIn(sessionId = ''): Promise<any> {
3952

40-
const loginRequest: AuthenticationParameters = {
41-
scopes: defaultUserScopes,
42-
authority: getAuthority(),
43-
prompt: 'select_account',
44-
redirectUri: getCurrentUri().toLowerCase(),
45-
extraQueryParameters: { mkt: geLocale }
46-
};
47-
4853
if (sessionId !== '') {
4954
loginRequest.sid = sessionId;
5055

@@ -61,11 +66,10 @@ export async function logIn(sessionId = ''): Promise<any> {
6166
if (loginType === LoginType.Popup) {
6267
try {
6368
await msalApplication.loginPopup(loginRequest);
64-
const authResponse = await msalApplication.acquireTokenSilent(loginRequest);
65-
return authResponse;
69+
return await getToken();
6670
} catch (error) {
6771
if (requiresInteraction(error)) {
68-
return acquireTokenWIthInteraction(loginRequest);
72+
return acquireTokenWIthInteraction();
6973
} else {
7074
throw error;
7175
}
@@ -75,7 +79,7 @@ export async function logIn(sessionId = ''): Promise<any> {
7579
}
7680
}
7781

78-
async function acquireTokenWIthInteraction(loginRequest: AuthenticationParameters) {
82+
async function acquireTokenWIthInteraction() {
7983
try {
8084
const authResponse = await msalApplication.acquireTokenPopup(loginRequest);
8185
return authResponse;
@@ -116,10 +120,7 @@ export function logOutPopUp() {
116120
* @returns {Promise.<any>}
117121
*/
118122
export async function acquireNewAccessToken(scopes: string[] = []): Promise<any> {
119-
const loginRequest: AuthenticationParameters = {
120-
scopes,
121-
authority: getAuthority(),
122-
};
123+
loginRequest.scopes = scopes;
123124
if (loginType === LoginType.Popup) {
124125
try {
125126
const authResponse = await msalApplication.acquireTokenPopup(loginRequest);

0 commit comments

Comments
 (0)