@abgov/nx-adsp 12.3.0 → 12.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/nx-adsp",
3
- "version": "12.3.0",
3
+ "version": "12.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "src/index.js",
6
6
  "description": "Government of Alberta - Nx plugin for ADSP apps.",
@@ -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(getDefaultMiddleware());
11
+ const mockStore = configureStore([]);
11
12
 
12
13
  describe('App', () => {
13
- let store, userManager;
14
-
14
+ let store;
15
+
15
16
  beforeEach(() => {
16
17
  store = mockStore({
17
- user: {},
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 userManager={userManager} />
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 userManager={userManager} />
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 React, { useEffect } from 'react';
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 '@abgov/web-components/index.css';
10
- import {
11
- fetchPrivateResource,
12
- fetchPublicResource,
13
- publicResourceSelector,
14
- privateResourceSelector
15
- } from './start.slice';
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
- interface AppProps {
18
- userManager: UserManager;
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 (user?.access_token) {
33
- dispatch(fetchPrivateResource(user?.access_token));
29
+ if (authenticated) {
30
+ dispatch(fetchPrivateResource());
34
31
  }
35
- }, [user, dispatch]);
32
+ }, [authenticated, dispatch]);
36
33
 
37
34
  return (
38
35
  <div className={styles.app}>
39
- <GoAMicrositeHeader type="alpha" />
40
- <GoAAppHeader
41
- url="/"
42
- heading="Digital Service Example"
43
- />
44
- <GoAHeroBanner
45
- heading="Quick start of a digital service"
46
- backgroundUrl={'../assets/banner.jpg'}
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
- Create the '<%= projectName %>' client in your realm to let users
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 (_, _thunkAPI) => {
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 (token: string, _thunkAPI) => {
34
- const response = await fetch(
35
- '/api/v1/private',
36
- { headers: { Authorization: `Bearer ${token}` } }
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
- initialStartState,
51
- (builder) => {
52
- builder
53
- .addCase(
54
- fetchPublicResource.pending,
55
- (state: StartState) => {
56
- state.loadingStatus = 'loading';
57
- }
58
- )
59
- .addCase(
60
- fetchPublicResource.fulfilled,
61
- (state: StartState, action: PayloadAction<ApiResourceResponse>) => {
62
- state.loadingStatus = 'loaded';
63
- state.apiPublicMessage = action.payload.message;
64
- }
65
- )
66
- .addCase(
67
- fetchPublicResource.rejected,
68
- (state: StartState, action) => {
69
- state.loadingStatus = 'error';
70
- state.error = action.error.message;
71
- }
72
- )
73
- .addCase(
74
- fetchPrivateResource.pending,
75
- (state: StartState) => {
76
- state.loadingStatus = 'loading';
77
- }
78
- )
79
- .addCase(
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 React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
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 { initializeConfig } from './app/config.slice';
9
+ import { initializeUser } from './app/user.slice';
16
10
  import { store } from './store';
17
11
 
18
- // Fetch configuration from web server; otherwise fallback to static environment.
19
- fetch('/config/config.json')
20
- .then(res => res.ok ?
21
- res.json() :
22
- environment
23
- )
24
- .then((env) => {
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
- store.dispatch(initializeConfig(env));
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());
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <body>
3
+ <script>parent.postMessage(location.href, location.origin);</script>
4
+ </body>
5
+ </html>
@@ -1,42 +1,19 @@
1
1
  import { configureStore } from '@reduxjs/toolkit';
2
- import {
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
- user: oidcReducer,
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
- template: './src/renew.html',
14
- chunks: ['renew'],
15
- filename: 'renew.html',
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,16 @@ 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* () {
60
61
  const normalizedOptions = yield normalizeOptions(host, options);
61
62
  const { applicationGenerator: initReact } = yield Promise.resolve().then(() => require('@nx/react'));
62
- const { reduxGenerator: initRedux } = yield Promise.resolve().then(() => require('@nx/react'));
63
63
  // Setting strict to false because of: https://github.com/nrwl/nx/issues/8180
64
64
  yield initReact(host, {
65
65
  name: options.name,
66
- style: 'styled-components',
66
+ style: 'css',
67
67
  skipFormat: true,
68
68
  linter: eslint_1.Linter.EsLint,
69
69
  unitTestRunner: 'jest',
@@ -71,19 +71,16 @@ function default_1(host, options) {
71
71
  strict: false,
72
72
  directory: `apps/${options.name}`,
73
73
  });
74
- yield initRedux(host, {
75
- name: 'intake',
76
- path: `apps/${options.name}/src/state/intake.slice.ts`,
77
- });
78
- (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
79
- '@abgov/react-components': '^4.18.0',
80
- '@abgov/web-components': '^1.19.0',
81
- '@types/react-router-dom': '~5.3.3',
82
- '@types/redux-mock-store': '~1.0.2',
74
+ (0, devkit_1.addDependenciesToPackageJson)(host, {
75
+ '@abgov/design-tokens': '1.8.0',
76
+ '@abgov/react-components': '6.10.0',
77
+ '@abgov/web-components': '1.39.3',
78
+ '@reduxjs/toolkit': '^2.5.1',
79
+ 'keycloak-js': '^23.0.7',
80
+ 'react-redux': '^9.2.0',
81
+ 'react-router-dom': '6.30.3',
82
+ }, {
83
83
  '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
84
  'redux-mock-store': '~1.5.4',
88
85
  });
89
86
  const addedProxy = addFiles(host, normalizedOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"react-app.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/react-app/react-app.ts"],"names":[],"mappings":";;AAkGA,4BA+EC;;AAjLD,wCAAyE;AACzE,uCAWoB;AACpB,uCAAoC;AACpC,6BAA6B;AAG7B,SAAe,gBAAgB,CAC7B,IAAU,EACV,OAAe;;QAEf,MAAM,WAAW,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QACjD,MAAM,WAAW,GAAG,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;QACzE,MAAM,kBAAkB,GAAG,cAAc,WAAW,EAAE,CAAC;QAEvD,MAAM,IAAI,GAAG,MAAM,IAAA,4BAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvD,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;YAC/C,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;YACpB,CAAC,CAAC,OAAO,CAAC,KAAK;gBACf,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;gBACjB,CAAC,CAAC,EAAE,CAAC;QAEP,uCACK,OAAO,KACV,WAAW;YACX,WAAW;YACX,kBAAkB;YAClB,IAAI;YACJ,YAAY,IACZ;IACJ,CAAC;CAAA;AAED,SAAS,QAAQ,CAAC,IAAU,EAAE,OAAyB;IACrD,MAAM,eAAe,iDAChB,OAAO,GACP,OAAO,CAAC,IAAI,KACf,IAAI,EAAE,EAAE,GACT,CAAC;IACF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,WAAW,EACnB,eAAe,CA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QACxC,MAAM,MAAM,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAE5D,MAAM,CAAC,OAAO,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
+ {"version":3,"file":"react-app.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/react-app/react-app.ts"],"names":[],"mappings":";;AAmGA,4BA0EC;;AA7KD,wCAAyE;AACzE,uCAWoB;AACpB,uCAAoC;AACpC,6BAA6B;A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I;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>
@@ -1,3 +0,0 @@
1
- import { processSilentRenew } from 'redux-oidc';
2
-
3
- processSilentRenew();