@abgov/nx-adsp 12.3.0 → 12.4.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/package.json +1 -1
- package/src/generators/angular-app/files/nginx.conf__tmpl__ +14 -7
- package/src/generators/mern/mern.js +5 -21
- package/src/generators/mern/mern.js.map +1 -1
- package/src/generators/mern/schema.d.ts +0 -4
- package/src/generators/react-app/files/nginx.conf__tmpl__ +18 -7
- package/src/generators/react-app/files/src/app/app.spec.tsx__tmpl__ +12 -17
- package/src/generators/react-app/files/src/app/app.tsx__tmpl__ +41 -71
- package/src/generators/react-app/files/src/app/intake.slice.ts__tmpl__ +21 -0
- package/src/generators/react-app/files/src/app/start.slice.ts__tmpl__ +44 -59
- package/src/generators/react-app/files/src/app/user.slice.ts__tmpl__ +71 -0
- package/src/generators/react-app/files/src/environments/environment.ts__tmpl__ +1 -4
- package/src/generators/react-app/files/src/main.tsx__tmpl__ +17 -64
- package/src/generators/react-app/files/src/silent-check-sso.html__tmpl__ +5 -0
- package/src/generators/react-app/files/src/store.ts__tmpl__ +6 -29
- package/src/generators/react-app/files/webpack.config.js__tmpl__ +5 -4
- package/src/generators/react-app/react-app.js +17 -14
- package/src/generators/react-app/react-app.js.map +1 -1
- package/src/generators/react-app/files/src/access.ts__tmpl__ +0 -26
- package/src/generators/react-app/files/src/react-oidc.d.ts__tmpl__ +0 -14
- package/src/generators/react-app/files/src/renew.html__tmpl__ +0 -1
- package/src/generators/react-app/files/src/renew.ts__tmpl__ +0 -3
package/package.json
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
events {
|
|
2
|
-
worker_connections
|
|
2
|
+
worker_connections 1024;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
http {
|
|
5
6
|
sendfile on;
|
|
6
7
|
include mime.types;
|
|
7
8
|
default_type application/octet-stream;
|
|
8
9
|
|
|
10
|
+
gzip on;
|
|
11
|
+
gzip_types text/plain text/css application/javascript application/json image/svg+xml font/woff2;
|
|
12
|
+
gzip_min_length 1000;
|
|
13
|
+
|
|
9
14
|
server {
|
|
10
|
-
|
|
11
15
|
listen 8080;
|
|
12
16
|
root /opt/app-root/src;
|
|
13
17
|
index index.html;
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
20
|
+
add_header X-Content-Type-Options "nosniff" always;
|
|
21
|
+
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
22
|
+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
23
|
+
|
|
24
|
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
17
25
|
expires 30d;
|
|
18
26
|
add_header Cache-Control "public, no-transform";
|
|
19
|
-
}
|
|
27
|
+
}
|
|
20
28
|
|
|
21
29
|
location / {
|
|
22
|
-
gzip on;
|
|
23
30
|
try_files $uri /index.html;
|
|
24
31
|
}
|
|
25
32
|
<% nginxProxies.forEach(function(nginxProxy){ %>
|
|
@@ -3,40 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const path = require("path");
|
|
7
6
|
const nx_oc_1 = require("@abgov/nx-oc");
|
|
8
7
|
const express_service_1 = require("../express-service/express-service");
|
|
9
8
|
const react_app_1 = require("../react-app/react-app");
|
|
10
9
|
function normalizeOptions(host, options) {
|
|
11
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
-
const name = (0, devkit_1.names)(options.name).fileName;
|
|
13
|
-
const projectDirectory = name;
|
|
14
|
-
const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
|
|
15
|
-
const projectRoot = `${(0, devkit_1.getWorkspaceLayout)(host).appsDir}/${projectDirectory}`;
|
|
16
|
-
const openshiftDirectory = `.openshift/${projectDirectory}`;
|
|
17
11
|
const adsp = yield (0, nx_oc_1.getAdspConfiguration)(host, options);
|
|
18
|
-
return Object.assign(Object.assign({}, options), {
|
|
19
|
-
projectRoot,
|
|
20
|
-
projectDirectory,
|
|
21
|
-
openshiftDirectory,
|
|
22
|
-
adsp });
|
|
12
|
+
return Object.assign(Object.assign({}, options), { adsp });
|
|
23
13
|
});
|
|
24
14
|
}
|
|
25
|
-
function addFiles(host, options) {
|
|
26
|
-
const templateOptions = Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), template: '' });
|
|
27
|
-
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files'), options.projectRoot, templateOptions);
|
|
28
|
-
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'openshift'), `${options.openshiftDirectory}`, templateOptions);
|
|
29
|
-
}
|
|
30
15
|
function default_1(host, options) {
|
|
31
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
17
|
const normalizedOptions = yield normalizeOptions(host, options);
|
|
33
|
-
|
|
34
|
-
yield (0,
|
|
18
|
+
const projectName = (0, devkit_1.names)(options.name).fileName;
|
|
19
|
+
yield (0, express_service_1.default)(host, Object.assign(Object.assign({}, normalizedOptions), { name: `${projectName}-service` }));
|
|
20
|
+
yield (0, react_app_1.default)(host, Object.assign(Object.assign({}, normalizedOptions), { name: `${projectName}-app`, proxy: {
|
|
35
21
|
location: '/api/',
|
|
36
|
-
proxyPass: `http://${
|
|
22
|
+
proxyPass: `http://${projectName}-service:3333/${projectName}-service/`,
|
|
37
23
|
} }));
|
|
38
|
-
// Currently no files specific to MERN generator.
|
|
39
|
-
// addFiles(host, normalizedOptions);
|
|
40
24
|
yield (0, devkit_1.formatFiles)(host);
|
|
41
25
|
return () => {
|
|
42
26
|
(0, devkit_1.installPackagesTask)(host);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mern.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/mern/mern.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"mern.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/mern/mern.ts"],"names":[],"mappings":";;AAcA,4BAuBC;;AArCD,uCAA2E;AAC3E,wCAAoD;AACpD,wEAAoE;AACpE,sDAAkD;AAGlD,SAAe,gBAAgB,CAC7B,IAAU,EACV,OAAe;;QAEf,MAAM,IAAI,GAAG,MAAM,IAAA,4BAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvD,uCAAY,OAAO,KAAE,IAAI,IAAG;IAC9B,CAAC;CAAA;AAED,mBAA+B,IAAU,EAAE,OAAe;;QACxD,MAAM,iBAAiB,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChE,MAAM,WAAW,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QAEjD,MAAM,IAAA,yBAAkB,EAAC,IAAI,kCACxB,iBAAiB,KACpB,IAAI,EAAE,GAAG,WAAW,UAAU,IAC9B,CAAC;QAEH,MAAM,IAAA,mBAAY,EAAC,IAAI,kCAClB,iBAAiB,KACpB,IAAI,EAAE,GAAG,WAAW,MAAM,EAC1B,KAAK,EAAE;gBACL,QAAQ,EAAE,OAAO;gBACjB,SAAS,EAAE,UAAU,WAAW,iBAAiB,WAAW,WAAW;aACxE,IACD,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
events {
|
|
2
|
-
worker_connections
|
|
2
|
+
worker_connections 1024;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
http {
|
|
5
6
|
sendfile on;
|
|
6
7
|
include mime.types;
|
|
7
8
|
default_type application/octet-stream;
|
|
8
9
|
|
|
10
|
+
gzip on;
|
|
11
|
+
gzip_types text/plain text/css application/javascript application/json image/svg+xml font/woff2;
|
|
12
|
+
gzip_min_length 1000;
|
|
13
|
+
|
|
9
14
|
server {
|
|
10
|
-
|
|
11
15
|
listen 8080;
|
|
12
16
|
root /opt/app-root/src;
|
|
13
17
|
index index.html;
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
20
|
+
add_header X-Content-Type-Options "nosniff" always;
|
|
21
|
+
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
22
|
+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
23
|
+
|
|
24
|
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
17
25
|
expires 30d;
|
|
18
26
|
add_header Cache-Control "public, no-transform";
|
|
19
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
location = /silent-check-sso.html {
|
|
30
|
+
add_header Cache-Control "no-store";
|
|
31
|
+
}
|
|
20
32
|
|
|
21
33
|
location / {
|
|
22
|
-
gzip on;
|
|
23
34
|
try_files $uri /index.html;
|
|
24
35
|
}
|
|
25
36
|
<% nginxProxies.forEach(function(nginxProxy){ %>
|
|
@@ -1,39 +1,35 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Provider } from 'react-redux';
|
|
3
|
-
import { getDefaultMiddleware } from '@reduxjs/toolkit';
|
|
4
1
|
import { render } from '@testing-library/react';
|
|
2
|
+
import { Provider } from 'react-redux';
|
|
5
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
6
4
|
import configureStore from 'redux-mock-store';
|
|
7
5
|
|
|
8
6
|
import App from './app';
|
|
7
|
+
import { CONFIG_FEATURE_KEY } from './config.slice';
|
|
8
|
+
import { START_FEATURE_KEY } from './start.slice';
|
|
9
|
+
import { USER_FEATURE_KEY } from './user.slice';
|
|
9
10
|
|
|
10
|
-
const mockStore = configureStore(
|
|
11
|
+
const mockStore = configureStore([]);
|
|
11
12
|
|
|
12
13
|
describe('App', () => {
|
|
13
|
-
let store
|
|
14
|
-
|
|
14
|
+
let store;
|
|
15
|
+
|
|
15
16
|
beforeEach(() => {
|
|
16
17
|
store = mockStore({
|
|
17
|
-
|
|
18
|
+
[USER_FEATURE_KEY]: { initialized: false, authenticated: false, name: '', email: '' },
|
|
19
|
+
[CONFIG_FEATURE_KEY]: { initialized: false, environment: {}, directory: {} },
|
|
20
|
+
[START_FEATURE_KEY]: { apiPublicMessage: null, apiPrivateMessage: null, loadingStatus: 'not loaded', error: null },
|
|
18
21
|
intake: {},
|
|
19
|
-
start: {}
|
|
20
22
|
});
|
|
21
|
-
|
|
22
|
-
userManager = {
|
|
23
|
-
signoutRedirect: jest.fn(),
|
|
24
|
-
signinRedirect: jest.fn()
|
|
25
|
-
}
|
|
26
23
|
});
|
|
27
24
|
|
|
28
25
|
it('should render successfully', () => {
|
|
29
26
|
const { baseElement } = render(
|
|
30
27
|
<BrowserRouter>
|
|
31
28
|
<Provider store={store}>
|
|
32
|
-
<App
|
|
29
|
+
<App />
|
|
33
30
|
</Provider>
|
|
34
31
|
</BrowserRouter>
|
|
35
32
|
);
|
|
36
|
-
|
|
37
33
|
expect(baseElement).toBeTruthy();
|
|
38
34
|
});
|
|
39
35
|
|
|
@@ -41,11 +37,10 @@ describe('App', () => {
|
|
|
41
37
|
const { getByText } = render(
|
|
42
38
|
<BrowserRouter>
|
|
43
39
|
<Provider store={store}>
|
|
44
|
-
<App
|
|
40
|
+
<App />
|
|
45
41
|
</Provider>
|
|
46
42
|
</BrowserRouter>
|
|
47
43
|
);
|
|
48
|
-
|
|
49
44
|
expect(getByText('Welcome to <%= projectName %>!')).toBeTruthy();
|
|
50
45
|
});
|
|
51
46
|
});
|
|
@@ -1,96 +1,66 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
GoabAppHeader,
|
|
3
|
+
GoabButton,
|
|
4
|
+
GoabButtonGroup,
|
|
5
|
+
GoabHeroBanner,
|
|
6
|
+
GoabMicrositeHeader,
|
|
7
|
+
} from '@abgov/react-components';
|
|
8
|
+
import { useEffect } from 'react';
|
|
2
9
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { UserManager } from 'oidc-client';
|
|
4
|
-
import { UserState } from 'redux-oidc';
|
|
5
|
-
import { GoAAppHeader, GoAButton, GoAMicrositeHeader, GoAHeroBanner } from '@abgov/react-components';
|
|
6
10
|
|
|
7
11
|
import { AppDispatch } from '../store';
|
|
8
12
|
import styles from './app.module.css';
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
publicResourceSelector,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import {
|
|
14
|
+
fetchPrivateResource,
|
|
15
|
+
fetchPublicResource,
|
|
16
|
+
privateResourceSelector,
|
|
17
|
+
publicResourceSelector,
|
|
18
|
+
} from './start.slice';
|
|
19
|
+
import { loginUser, logoutUser, userSelector } from './user.slice';
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function App({ userManager }: AppProps) {
|
|
22
|
-
const user = useSelector(
|
|
23
|
-
(state: {user: UserState}) => state.user.user
|
|
24
|
-
);
|
|
21
|
+
export function App() {
|
|
22
|
+
const dispatch = useDispatch<AppDispatch>();
|
|
23
|
+
const { authenticated, name } = useSelector(userSelector);
|
|
25
24
|
const publicResource = useSelector(publicResourceSelector);
|
|
26
25
|
const privateResource = useSelector(privateResourceSelector);
|
|
27
26
|
|
|
28
|
-
const dispatch = useDispatch<AppDispatch>();
|
|
29
|
-
|
|
30
27
|
useEffect(() => {
|
|
31
28
|
dispatch(fetchPublicResource());
|
|
32
|
-
if (
|
|
33
|
-
dispatch(fetchPrivateResource(
|
|
29
|
+
if (authenticated) {
|
|
30
|
+
dispatch(fetchPrivateResource());
|
|
34
31
|
}
|
|
35
|
-
}, [
|
|
32
|
+
}, [authenticated, dispatch]);
|
|
36
33
|
|
|
37
34
|
return (
|
|
38
35
|
<div className={styles.app}>
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
<GoabMicrositeHeader type="alpha" />
|
|
37
|
+
<GoabAppHeader url="/" heading="<%= projectName %>">
|
|
38
|
+
<GoabButtonGroup alignment="end">
|
|
39
|
+
{name && <span>{name}</span>}
|
|
40
|
+
{!authenticated ? (
|
|
41
|
+
<GoabButton type="tertiary" onClick={() => dispatch(loginUser())}>
|
|
42
|
+
Sign in
|
|
43
|
+
</GoabButton>
|
|
44
|
+
) : (
|
|
45
|
+
<GoabButton type="tertiary" onClick={() => dispatch(logoutUser())}>
|
|
46
|
+
Sign out
|
|
47
|
+
</GoabButton>
|
|
48
|
+
)}
|
|
49
|
+
</GoabButtonGroup>
|
|
50
|
+
</GoabAppHeader>
|
|
51
|
+
<GoabHeroBanner heading="<%= projectName %>" backgroundUrl="/assets/banner.jpg" />
|
|
48
52
|
<main>
|
|
49
53
|
<section>
|
|
50
54
|
<h2>Welcome to <%= projectName %>!</h2>
|
|
51
|
-
<p>
|
|
52
|
-
Don't panic. Start editing the project to build your digital service.
|
|
53
|
-
</p>
|
|
55
|
+
<p>Don't panic. Start editing the project to build your digital service.</p>
|
|
54
56
|
<h3>A few things you might want to do next:</h3>
|
|
55
57
|
<ul className={styles.nextSteps}>
|
|
56
|
-
<li>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
user ?
|
|
60
|
-
<GoAButton ml="s" onClick={() => userManager.signoutRedirect()}>
|
|
61
|
-
Sign Out
|
|
62
|
-
</GoAButton> :
|
|
63
|
-
<GoAButton ml="s" onClick={() => userManager.signinRedirect()}>
|
|
64
|
-
Sign In
|
|
65
|
-
</GoAButton>
|
|
66
|
-
}
|
|
67
|
-
</li>
|
|
68
|
-
<li>
|
|
69
|
-
Make requests to the backend API by either updating nginx.conf or enabling CORS on the API.
|
|
70
|
-
</li>
|
|
71
|
-
<li>
|
|
72
|
-
Add requests to public API resources: {publicResource || 'Not retrieved'}
|
|
73
|
-
</li>
|
|
74
|
-
<li>
|
|
75
|
-
Add requests to private API resources: {privateResource || 'Not retrieved'}
|
|
76
|
-
</li>
|
|
58
|
+
<li>Register the '<%= projectName %>' client in your realm and set CLIENT_SECRET.</li>
|
|
59
|
+
<li>Add requests to public API resources: {publicResource || 'Not retrieved'}</li>
|
|
60
|
+
<li>Add requests to private API resources: {privateResource || 'Not retrieved'}</li>
|
|
77
61
|
</ul>
|
|
78
62
|
</section>
|
|
79
63
|
</main>
|
|
80
|
-
<footer className={styles.footer}>
|
|
81
|
-
<div className="goa-socialconnect">
|
|
82
|
-
<div className="goa-title">
|
|
83
|
-
Connect with us on
|
|
84
|
-
</div>
|
|
85
|
-
<ul>
|
|
86
|
-
<li className={styles.github}>
|
|
87
|
-
<a href="https://github.com/abgov" rel="noreferrer" target="_blank">
|
|
88
|
-
GitHub
|
|
89
|
-
</a>
|
|
90
|
-
</li>
|
|
91
|
-
</ul>
|
|
92
|
-
</div>
|
|
93
|
-
</footer>
|
|
94
64
|
</div>
|
|
95
65
|
);
|
|
96
66
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
export const INTAKE_FEATURE_KEY = 'intake';
|
|
4
|
+
|
|
5
|
+
export interface IntakeState {
|
|
6
|
+
loadingStatus: 'not loaded' | 'loading' | 'loaded' | 'error';
|
|
7
|
+
error: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const initialIntakeState: IntakeState = {
|
|
11
|
+
loadingStatus: 'not loaded',
|
|
12
|
+
error: null,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const intakeSlice = createSlice({
|
|
16
|
+
name: INTAKE_FEATURE_KEY,
|
|
17
|
+
initialState: initialIntakeState,
|
|
18
|
+
reducers: {},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const intakeReducer = intakeSlice.reducer;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createAsyncThunk,
|
|
3
|
-
createReducer,
|
|
4
|
-
createSelector,
|
|
5
|
-
PayloadAction
|
|
1
|
+
import {
|
|
2
|
+
createAsyncThunk,
|
|
3
|
+
createReducer,
|
|
4
|
+
createSelector,
|
|
5
|
+
PayloadAction,
|
|
6
6
|
} from '@reduxjs/toolkit';
|
|
7
7
|
|
|
8
|
+
import { getAccessToken } from './user.slice';
|
|
9
|
+
|
|
8
10
|
export const START_FEATURE_KEY = 'start';
|
|
9
11
|
|
|
10
12
|
export interface StartState {
|
|
@@ -18,23 +20,21 @@ interface ApiResourceResponse {
|
|
|
18
20
|
message: string;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
// Redux thunk to get value from a public API.
|
|
22
23
|
export const fetchPublicResource = createAsyncThunk(
|
|
23
24
|
'start/fetchPublicResource',
|
|
24
|
-
async (
|
|
25
|
+
async () => {
|
|
25
26
|
const response = await fetch('/api/v1/public');
|
|
26
27
|
return response.json();
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
|
|
30
|
-
// Redux thunk to get value from a private API; access token is a required input.
|
|
31
31
|
export const fetchPrivateResource = createAsyncThunk(
|
|
32
32
|
'start/fetchPrivateResource',
|
|
33
|
-
async (
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
33
|
+
async () => {
|
|
34
|
+
const token = await getAccessToken();
|
|
35
|
+
const response = await fetch('/api/v1/private', {
|
|
36
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
37
|
+
});
|
|
38
38
|
return response.json();
|
|
39
39
|
}
|
|
40
40
|
);
|
|
@@ -46,52 +46,37 @@ export const initialStartState: StartState = {
|
|
|
46
46
|
error: null,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
export const startReducer= createReducer(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
fetchPrivateResource.fulfilled,
|
|
81
|
-
(state: StartState, action: PayloadAction<ApiResourceResponse>) => {
|
|
82
|
-
state.loadingStatus = 'loaded';
|
|
83
|
-
state.apiPrivateMessage = action.payload.message;
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
.addCase(
|
|
87
|
-
fetchPrivateResource.rejected,
|
|
88
|
-
(state: StartState, action) => {
|
|
89
|
-
state.loadingStatus = 'error';
|
|
90
|
-
state.error = action.error.message;
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
);
|
|
49
|
+
export const startReducer = createReducer(initialStartState, (builder) => {
|
|
50
|
+
builder
|
|
51
|
+
.addCase(fetchPublicResource.pending, (state: StartState) => {
|
|
52
|
+
state.loadingStatus = 'loading';
|
|
53
|
+
})
|
|
54
|
+
.addCase(
|
|
55
|
+
fetchPublicResource.fulfilled,
|
|
56
|
+
(state: StartState, action: PayloadAction<ApiResourceResponse>) => {
|
|
57
|
+
state.loadingStatus = 'loaded';
|
|
58
|
+
state.apiPublicMessage = action.payload.message;
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
.addCase(fetchPublicResource.rejected, (state: StartState, action) => {
|
|
62
|
+
state.loadingStatus = 'error';
|
|
63
|
+
state.error = action.error.message;
|
|
64
|
+
})
|
|
65
|
+
.addCase(fetchPrivateResource.pending, (state: StartState) => {
|
|
66
|
+
state.loadingStatus = 'loading';
|
|
67
|
+
})
|
|
68
|
+
.addCase(
|
|
69
|
+
fetchPrivateResource.fulfilled,
|
|
70
|
+
(state: StartState, action: PayloadAction<ApiResourceResponse>) => {
|
|
71
|
+
state.loadingStatus = 'loaded';
|
|
72
|
+
state.apiPrivateMessage = action.payload.message;
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
.addCase(fetchPrivateResource.rejected, (state: StartState, action) => {
|
|
76
|
+
state.loadingStatus = 'error';
|
|
77
|
+
state.error = action.error.message;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
95
80
|
|
|
96
81
|
export const publicResourceSelector = createSelector(
|
|
97
82
|
(state: unknown): StartState => state[START_FEATURE_KEY],
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import Keycloak from 'keycloak-js';
|
|
3
|
+
|
|
4
|
+
import { environment } from '../environments/environment';
|
|
5
|
+
|
|
6
|
+
const keycloak = new Keycloak({
|
|
7
|
+
url: environment.access.url,
|
|
8
|
+
realm: environment.access.realm,
|
|
9
|
+
clientId: environment.access.client_id,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const USER_FEATURE_KEY = 'user';
|
|
13
|
+
|
|
14
|
+
export interface UserState {
|
|
15
|
+
initialized: boolean;
|
|
16
|
+
authenticated: boolean;
|
|
17
|
+
name: string;
|
|
18
|
+
email: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const initialUserState: UserState = {
|
|
22
|
+
initialized: false,
|
|
23
|
+
authenticated: false,
|
|
24
|
+
name: '',
|
|
25
|
+
email: '',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const initializeUser = createAsyncThunk('user/initialize', async () => {
|
|
29
|
+
const authenticated = await keycloak.init({
|
|
30
|
+
onLoad: 'check-sso',
|
|
31
|
+
pkceMethod: 'S256',
|
|
32
|
+
silentCheckSsoRedirectUri: `${window.location.origin}/silent-check-sso.html`,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
authenticated,
|
|
36
|
+
name: keycloak.tokenParsed?.name as string,
|
|
37
|
+
email: keycloak.tokenParsed?.email as string,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const loginUser = createAsyncThunk('user/login', async () => {
|
|
42
|
+
await keycloak.login();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const logoutUser = createAsyncThunk('user/logout', async () => {
|
|
46
|
+
await keycloak.logout({ redirectUri: window.location.origin });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export async function getAccessToken(): Promise<string> {
|
|
50
|
+
await keycloak.updateToken(30);
|
|
51
|
+
return keycloak.token;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const userSlice = createSlice({
|
|
55
|
+
name: USER_FEATURE_KEY,
|
|
56
|
+
initialState: initialUserState,
|
|
57
|
+
reducers: {},
|
|
58
|
+
extraReducers: (builder) => {
|
|
59
|
+
builder.addCase(initializeUser.fulfilled, (state, { payload }) => {
|
|
60
|
+
state.initialized = true;
|
|
61
|
+
state.authenticated = payload.authenticated;
|
|
62
|
+
state.name = payload.name || '';
|
|
63
|
+
state.email = payload.email || '';
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const userReducer = userSlice.reducer;
|
|
69
|
+
|
|
70
|
+
export const userSelector = (state: { [USER_FEATURE_KEY]: UserState }) =>
|
|
71
|
+
state[USER_FEATURE_KEY];
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
-
// When building for production, this file is replaced with `environment.prod.ts`.
|
|
3
|
-
|
|
4
1
|
export const environment = {
|
|
5
2
|
production: false,
|
|
6
3
|
directory: {
|
|
7
4
|
url: '<%= directoryServiceUrl %>',
|
|
8
5
|
},
|
|
9
6
|
access: {
|
|
10
|
-
url: '<%= accessServiceUrl
|
|
7
|
+
url: '<%= accessServiceUrl %>/auth',
|
|
11
8
|
realm: '<%= tenantRealm %>',
|
|
12
9
|
client_id: 'urn:ads:<%= tenant %>:<%= projectName %>'
|
|
13
10
|
}
|
|
@@ -1,70 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import '@abgov/web-components';
|
|
2
|
+
import '@abgov/web-components/index.css';
|
|
3
|
+
import { StrictMode } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
4
5
|
import { Provider } from 'react-redux';
|
|
5
|
-
import {
|
|
6
|
-
CallbackComponent,
|
|
7
|
-
loadUser,
|
|
8
|
-
OidcProvider,
|
|
9
|
-
SignoutCallbackComponent,
|
|
10
|
-
} from 'redux-oidc';
|
|
6
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
11
7
|
|
|
12
|
-
import { environment } from './environments/environment';
|
|
13
|
-
import { createUserManager } from './access';
|
|
14
8
|
import App from './app/app';
|
|
15
|
-
import {
|
|
9
|
+
import { initializeUser } from './app/user.slice';
|
|
16
10
|
import { store } from './store';
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
const root = createRoot(document.getElementById('root') as HTMLElement);
|
|
13
|
+
root.render(
|
|
14
|
+
<Provider store={store}>
|
|
15
|
+
<StrictMode>
|
|
16
|
+
<BrowserRouter>
|
|
17
|
+
<App />
|
|
18
|
+
</BrowserRouter>
|
|
19
|
+
</StrictMode>
|
|
20
|
+
</Provider>
|
|
21
|
+
);
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
const userManager = createUserManager(env.access);
|
|
28
|
-
loadUser(store, userManager);
|
|
29
|
-
|
|
30
|
-
ReactDOM.render(
|
|
31
|
-
<Provider store={store}>
|
|
32
|
-
<OidcProvider store={store} userManager={userManager}>
|
|
33
|
-
<React.StrictMode>
|
|
34
|
-
<Router>
|
|
35
|
-
<Switch>
|
|
36
|
-
<Route
|
|
37
|
-
path="/auth/callback"
|
|
38
|
-
render={({history}) =>
|
|
39
|
-
<CallbackComponent
|
|
40
|
-
userManager={userManager}
|
|
41
|
-
successCallback={() => history.push('/')}
|
|
42
|
-
errorCallback={() => history.push('/')}
|
|
43
|
-
>
|
|
44
|
-
<span>signing in...</span>
|
|
45
|
-
</CallbackComponent>
|
|
46
|
-
}
|
|
47
|
-
/>
|
|
48
|
-
<Route
|
|
49
|
-
path="/signout/callback"
|
|
50
|
-
render={({history}) =>
|
|
51
|
-
<SignoutCallbackComponent
|
|
52
|
-
userManager={userManager}
|
|
53
|
-
successCallback={() => history.push('/')}
|
|
54
|
-
errorCallback={() => history.push('/')}
|
|
55
|
-
>
|
|
56
|
-
<span>signing out...</span>
|
|
57
|
-
</SignoutCallbackComponent>
|
|
58
|
-
}
|
|
59
|
-
/>
|
|
60
|
-
<Route>
|
|
61
|
-
<App userManager={userManager} />
|
|
62
|
-
</Route>
|
|
63
|
-
</Switch>
|
|
64
|
-
</Router>
|
|
65
|
-
</React.StrictMode>
|
|
66
|
-
</OidcProvider>
|
|
67
|
-
</Provider>,
|
|
68
|
-
document.getElementById('root')
|
|
69
|
-
);
|
|
70
|
-
});
|
|
23
|
+
store.dispatch(initializeUser());
|
|
@@ -1,42 +1,19 @@
|
|
|
1
1
|
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
|
|
3
|
-
reducer as oidcReducer,
|
|
4
|
-
LOAD_USER_ERROR,
|
|
5
|
-
LOADING_USER,
|
|
6
|
-
USER_EXPIRED,
|
|
7
|
-
USER_EXPIRING,
|
|
8
|
-
USER_FOUND,
|
|
9
|
-
USER_LOADED,
|
|
10
|
-
USER_SIGNED_OUT,
|
|
11
|
-
} from 'redux-oidc';
|
|
2
|
+
|
|
12
3
|
import { CONFIG_FEATURE_KEY, configReducer } from './app/config.slice';
|
|
13
|
-
import { START_FEATURE_KEY, startReducer } from './app/start.slice';
|
|
14
4
|
import { INTAKE_FEATURE_KEY, intakeReducer } from './app/intake.slice';
|
|
5
|
+
import { START_FEATURE_KEY, startReducer } from './app/start.slice';
|
|
6
|
+
import { USER_FEATURE_KEY, userReducer } from './app/user.slice';
|
|
15
7
|
|
|
16
8
|
export const store = configureStore({
|
|
17
9
|
reducer: {
|
|
18
|
-
|
|
10
|
+
[USER_FEATURE_KEY]: userReducer,
|
|
19
11
|
[CONFIG_FEATURE_KEY]: configReducer,
|
|
20
12
|
[START_FEATURE_KEY]: startReducer,
|
|
21
13
|
[INTAKE_FEATURE_KEY]: intakeReducer,
|
|
22
14
|
},
|
|
23
15
|
devTools: process.env.NODE_ENV !== 'production',
|
|
24
|
-
// Optional Redux store enhancers
|
|
25
|
-
enhancers: [],
|
|
26
|
-
middleware: (getDefault) =>
|
|
27
|
-
getDefault({
|
|
28
|
-
serializableCheck: {
|
|
29
|
-
ignoredActions: [
|
|
30
|
-
LOAD_USER_ERROR,
|
|
31
|
-
LOADING_USER,
|
|
32
|
-
USER_EXPIRED,
|
|
33
|
-
USER_EXPIRING,
|
|
34
|
-
USER_FOUND,
|
|
35
|
-
USER_LOADED,
|
|
36
|
-
USER_SIGNED_OUT,
|
|
37
|
-
],
|
|
38
|
-
ignoredPaths: ['user'],
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
16
|
});
|
|
17
|
+
|
|
42
18
|
export type AppDispatch = typeof store.dispatch;
|
|
19
|
+
export type RootState = ReturnType<typeof store.getState>;
|
|
@@ -6,13 +6,14 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
6
6
|
module.exports = composePlugins(withNx(), withReact(), (config) => {
|
|
7
7
|
// Update the webpack config as needed here.
|
|
8
8
|
// e.g. `config.plugins.push(new MyPlugin())`
|
|
9
|
-
config.entry['renew'] = ['./src/renew.ts'];
|
|
10
9
|
|
|
10
|
+
// Required for keycloak-js silent SSO check.
|
|
11
11
|
config.plugins.push(
|
|
12
12
|
new HtmlWebpackPlugin({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
templateContent:
|
|
14
|
+
'<html><body><script>parent.postMessage(location.href, location.origin);</script></body></html>',
|
|
15
|
+
chunks: [],
|
|
16
|
+
filename: 'silent-check-sso.html',
|
|
16
17
|
})
|
|
17
18
|
);
|
|
18
19
|
|
|
@@ -54,16 +54,17 @@ function addFiles(host, options) {
|
|
|
54
54
|
function removeFiles(host, options) {
|
|
55
55
|
host.delete(`${options.projectRoot}/src/app/logo.svg`);
|
|
56
56
|
host.delete(`${options.projectRoot}/src/app/star.svg`);
|
|
57
|
+
host.delete(`${options.projectRoot}/src/app/nx-welcome.tsx`);
|
|
57
58
|
}
|
|
58
59
|
function default_1(host, options) {
|
|
59
60
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
var _a, _b;
|
|
60
62
|
const normalizedOptions = yield normalizeOptions(host, options);
|
|
61
63
|
const { applicationGenerator: initReact } = yield Promise.resolve().then(() => require('@nx/react'));
|
|
62
|
-
const { reduxGenerator: initRedux } = yield Promise.resolve().then(() => require('@nx/react'));
|
|
63
64
|
// Setting strict to false because of: https://github.com/nrwl/nx/issues/8180
|
|
64
65
|
yield initReact(host, {
|
|
65
66
|
name: options.name,
|
|
66
|
-
style: '
|
|
67
|
+
style: 'css',
|
|
67
68
|
skipFormat: true,
|
|
68
69
|
linter: eslint_1.Linter.EsLint,
|
|
69
70
|
unitTestRunner: 'jest',
|
|
@@ -71,25 +72,27 @@ function default_1(host, options) {
|
|
|
71
72
|
strict: false,
|
|
72
73
|
directory: `apps/${options.name}`,
|
|
73
74
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
|
|
75
|
+
(0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
76
|
+
'@abgov/design-tokens': '1.8.0',
|
|
77
|
+
'@abgov/react-components': '6.10.0',
|
|
78
|
+
'@abgov/web-components': '1.39.3',
|
|
79
|
+
'@reduxjs/toolkit': '^2.5.1',
|
|
80
|
+
'keycloak-js': '^23.0.7',
|
|
81
|
+
'react-redux': '^9.2.0',
|
|
82
|
+
'react-router-dom': '6.30.3',
|
|
83
|
+
}, {
|
|
83
84
|
'html-webpack-plugin': '~5.5.0',
|
|
84
|
-
'oidc-client': '~1.11.5',
|
|
85
|
-
'redux-oidc': '~4.0.0-beta1',
|
|
86
|
-
'react-router-dom': '~5.2.0',
|
|
87
85
|
'redux-mock-store': '~1.5.4',
|
|
88
86
|
});
|
|
89
87
|
const addedProxy = addFiles(host, normalizedOptions);
|
|
90
88
|
removeFiles(host, normalizedOptions);
|
|
91
89
|
const layout = (0, devkit_1.getWorkspaceLayout)(host);
|
|
92
90
|
const config = (0, devkit_1.readProjectConfiguration)(host, options.name);
|
|
91
|
+
// Remove the generated fileReplacements for production — we use a single
|
|
92
|
+
// environment.ts with runtime env vars rather than a build-time swap.
|
|
93
|
+
if ((_b = (_a = config.targets.build.configurations) === null || _a === void 0 ? void 0 : _a.production) === null || _b === void 0 ? void 0 : _b.fileReplacements) {
|
|
94
|
+
delete config.targets.build.configurations.production.fileReplacements;
|
|
95
|
+
}
|
|
93
96
|
config.targets.build.options = Object.assign(Object.assign({}, config.targets.build.options), { assets: [
|
|
94
97
|
...config.targets.build.options.assets,
|
|
95
98
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-app.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/react-app/react-app.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"react-app.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/react-app/react-app.ts"],"names":[],"mappings":";;AAmGA,4BAgFC;;AAnL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O,CAAC,KAAK,CAAC,OAAO,mCACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KAC/B,MAAM,EAAE;gBACN,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;gBACtC;oBACE,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE;oBAC1C,MAAM,EAAE,IAAI;iBACb;aACF,EACD,aAAa,EAAE,GAAG,iBAAiB,CAAC,WAAW,oBAAoB,GACpE,CAAC;QAEF,IAAI,UAAU,EAAE,CAAC;YACf,oEAAoE;YACpE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,mCACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KAC/B,WAAW,EAAE,GAAG,iBAAiB,CAAC,WAAW,kBAAkB,GAChE,CAAC;QACJ,CAAC;QAED,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEvD,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,MAAM,IAAA,2BAAmB,EAAC,IAAI,kCACzB,iBAAiB,KACpB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,iBAAiB,CAAC,WAAW,IACtC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createUserManager as createOidcUserManager } from 'redux-oidc';
|
|
2
|
-
|
|
3
|
-
interface CreateUserManagerProps {
|
|
4
|
-
url: string;
|
|
5
|
-
realm: string;
|
|
6
|
-
client_id: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function createUserManager({
|
|
10
|
-
url,
|
|
11
|
-
realm,
|
|
12
|
-
client_id
|
|
13
|
-
}: CreateUserManagerProps) {
|
|
14
|
-
|
|
15
|
-
const appUrl = `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`;
|
|
16
|
-
const settings = {
|
|
17
|
-
client_id,
|
|
18
|
-
redirect_uri: `${appUrl}/auth/callback`,
|
|
19
|
-
post_logout_redirect_uri: `${appUrl}/signout/callback`,
|
|
20
|
-
silent_redirect_uri: `${appUrl}/renew.html`,
|
|
21
|
-
response_type: 'code',
|
|
22
|
-
authority: `${url}/auth/realms/${realm}`,
|
|
23
|
-
automaticSilentRenew: true,
|
|
24
|
-
};
|
|
25
|
-
return createOidcUserManager(settings);
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Declarations to allow redux-oidc to work with react 18
|
|
2
|
-
declare module 'redux-oidc' {
|
|
3
|
-
export interface CallbackComponentProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface OidcProviderProps<TSTate> {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface SignoutCallbackComponentProps {
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head></head><body><script></script></body></html>
|