@genesislcap/blank-app-seed 3.40.1 → 3.41.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.
Files changed (29) hide show
  1. package/.genx/package.json +1 -1
  2. package/.genx/versions.json +3 -3
  3. package/CHANGELOG.md +44 -0
  4. package/client-tmp/angular/angular.json +3 -0
  5. package/client-tmp/angular/src/app/app.component.ts +12 -6
  6. package/client-tmp/angular/src/app/guards/auth.guard.ts +1 -1
  7. package/client-tmp/angular/src/app/layouts/default/default.layout.html +1 -0
  8. package/client-tmp/angular/src/app/layouts/default/default.layout.ts +6 -2
  9. package/client-tmp/angular/src/app/services/route.service.ts +2 -2
  10. package/client-tmp/angular/src/app/share/foundation-auth.ts +29 -15
  11. package/client-tmp/angular/src/proxy.conf.json +12 -0
  12. package/client-tmp/react/package.json +2 -2
  13. package/client-tmp/react/src/App.tsx +4 -9
  14. package/client-tmp/react/src/config.ts +2 -2
  15. package/client-tmp/react/src/guards/ProtectedGuard.tsx +7 -4
  16. package/client-tmp/react/src/layouts/default/DefaultLayout.tsx +12 -17
  17. package/client-tmp/react/src/pages/AuthPage/AuthPage.tsx +15 -7
  18. package/client-tmp/react/src/pbc/container.tsx +2 -2
  19. package/client-tmp/react/src/share/foundation-login.ts +28 -19
  20. package/client-tmp/react/src/store/RoutesContext.tsx +2 -2
  21. package/client-tmp/react/src/utils/index.ts +1 -2
  22. package/client-tmp/react/webpack.config.js +16 -2
  23. package/client-tmp/web-components/package.json +4 -1
  24. package/client-tmp/web-components/public/initSSO.js +1 -1
  25. package/client-tmp/web-components/src/routes/config.ts +36 -81
  26. package/package.json +1 -1
  27. package/server/{{appName}}-app/src/main/genesis/scripts/genesis-router.kts +13 -0
  28. package/client-tmp/angular/src/app/share/foundation-login.ts +0 -47
  29. package/client-tmp/react/src/utils/history.ts +0 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.40.1",
4
+ "version": "3.41.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
@@ -1,5 +1,5 @@
1
1
  {
2
- "UI": "14.234.1",
3
- "GSF": "8.8.0",
4
- "Auth": "8.8.0"
2
+ "UI": "14.246.2",
3
+ "GSF": "8.9.0",
4
+ "Auth": "8.9.0"
5
5
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.41.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.40.1...v3.41.0) (2025-03-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * bump GSF to 8.9 [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) (#436) 1295e2b
9
+ * release 8.9 [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) (#437) 1172438
10
+ * use foundation-auth as default login [FUI-2196](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/2196) (#427) abd0c48
11
+ * use foundation-auth as default login [FUI-2196](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/2196) (#427) b8c1d13
12
+ * use public path for navigation when available [FUI-2071](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/2071) (#410) 5e6c1af
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * automated dependency version update [skip-ci] [PSD-9](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/9) 7229060
18
+ * automated dependency version update [skip-ci] [PSD-9](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/9) (#414) bca5113
19
+ * automated dependency version update [skip-ci] [PSD-9](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/9) (#426) d3751d1
20
+ * automated dependency version update [skip-ci] [PSD-9](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/9) (#429) 7f512d2
21
+ * automated dependency version update [skip-ci] [PSD-9](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/9) (#431) c2eb359
22
+ * customEvent tooltip update GENC-847 (#419) 80f5e8e
23
+ * include auth in config [FUI-2196](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/2196) 1c549d5
24
+ * revert changes 65040e4
25
+ * revert changes from 8.9 (#430) 4133d7e, closes FUI-2196 PSD-9
26
+ * update versions build trigger f8783d3
27
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) e897283
28
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) d5fd0da
29
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) eb67c93
30
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) d7d9ecb
31
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) c456aad
32
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) e84d97f
33
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 761fc00
34
+ * updating server version information for Auth [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 266dfd6
35
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 520e1bb
36
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 0772186
37
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) ff4366b
38
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 6f4446a
39
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) f4b429c
40
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 7dc3ae2
41
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) e95345c
42
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) bcff53d
43
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 1992fef
44
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) 9decda0
45
+ * updating server version information for GSF [PSD-0](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/0) b63f98e
46
+
3
47
  ## [3.40.1](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.40.0...v3.40.1) (2025-02-17)
4
48
 
5
49
 
@@ -74,6 +74,9 @@
74
74
  },
75
75
  "serve": {
76
76
  "builder": "@angular-builders/custom-webpack:dev-server",
77
+ "options": {
78
+ "proxyConfig": "src/proxy.conf.json"
79
+ },
77
80
  "configurations": {
78
81
  "production": {
79
82
  "buildTarget": "{{pkgName}}:build:production"
@@ -1,11 +1,12 @@
1
1
  import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { Router, NavigationEnd } from '@angular/router';
3
- import getLayoutNameByRoute from './utils/getLayoutNameByRoute';
4
- import type { LayoutComponentName } from './types/layout';
5
- import { configureFoundationLogin } from './share/foundation-login';
3
+ import { Connect } from '@genesislcap/foundation-comms';
4
+ import { customEventFactory, registerStylesTarget } from '../pbc/utils';
5
+ import { configureFoundationAuth } from './share/foundation-auth';
6
6
  import { registerComponents } from './share/genesis-components';
7
7
  import { getStore } from './store';
8
- import { customEventFactory, registerStylesTarget } from '../pbc/utils';
8
+ import type { LayoutComponentName } from './types/layout';
9
+ import getLayoutNameByRoute from './utils/getLayoutNameByRoute';
9
10
  {{#if FDC3.channels.length}}
10
11
  import { listenToChannel, onFDC3Ready } from './utils';
11
12
  {{/if}}
@@ -20,12 +21,17 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit {
20
21
  title = '{{capitalCase appName}}';
21
22
  store = getStore();
22
23
 
24
+ // @ts-ignore
25
+ @Connect connect: Connect;
26
+
23
27
  constructor(
24
28
  private el: ElementRef,
25
29
  router: Router,
26
30
  ) {
27
- configureFoundationLogin({ router });
28
-
31
+ // @ts-ignore
32
+ configureFoundationAuth({ router, connectService: this.connect });
33
+
34
+
29
35
  // Set layout componet based on route
30
36
  router.events.subscribe((event: any) => {
31
37
  if (event instanceof NavigationEnd) {
@@ -9,7 +9,7 @@ export class AuthGuard extends PermissionsGuard {
9
9
  override async canActivate(): Promise<boolean> {
10
10
  if (!this.user.isAuthenticated) {
11
11
  this.user.trackPath();
12
- this.router.navigate([`/${AUTH_PATH}`]);
12
+ await this.router.navigate([`/${AUTH_PATH}`]);
13
13
  return false;
14
14
  }
15
15
  return true;
@@ -5,6 +5,7 @@
5
5
  show-luminance-toggle-button
6
6
  show-misc-toggle-button
7
7
  (luminance-icon-clicked)="onLuminanceToogle()"
8
+ (logout-clicked)="onLogout()"
8
9
  [navigateTo]="navigateAngular"
9
10
  [routeNavItems]="navItems"
10
11
  >
@@ -29,11 +29,15 @@ export class DefaultLayoutComponent extends BaseLayout implements AfterViewInit
29
29
  configureDesignSystem(this.designSystemProviderElement.nativeElement, designTokens);
30
30
  registerStylesTarget(this.el.nativeElement, 'layout');
31
31
  }
32
-
32
+
33
33
  navigateAngular = (path: string) => {
34
34
  this.router.navigate([path]);
35
35
  };
36
-
36
+
37
+ onLogout = () => {
38
+ this.router.navigate(['/login']);
39
+ };
40
+
37
41
  onLuminanceToogle = (): void => {
38
42
  baseLayerLuminance.setValueFor(
39
43
  this.designSystemProviderElement.nativeElement,
@@ -39,7 +39,7 @@ export class RouteService {
39
39
  navItems: [
40
40
  {
41
41
  navId: 'header',
42
- title: '{{#if this.title}}{{this.title}}{{else}}{{this.name}}{{/if}}',
42
+ title: '{{#if this.title}}{{capitalCase this.title}}{{else}}{{this.name}}{{/if}}',
43
43
  icon: {
44
44
  name: '{{this.icon}}',
45
45
  variant: 'solid',
@@ -53,7 +53,7 @@ export class RouteService {
53
53
 
54
54
  /**
55
55
  * @privateRemarks
56
- * The shell has access to context, so it's possible for it to return a pre-mapped framework variant of routes.
56
+ * The shell has access to context, so it's possible for it to return a pre-mapped framework variant of routes.
57
57
  * In this iteration we're doing it inline, given the angular version may move and here we know the shape we need.
58
58
  */
59
59
  pbcRoutes(): Routes {
@@ -1,20 +1,34 @@
1
- // import { configure } from '@genesislcap/foundation-auth/config';
2
1
  import type { Router } from '@angular/router';
2
+ import { configure, defaultAuthConfig } from '@genesislcap/foundation-auth/config';
3
+ import type { Connect } from '@genesislcap/foundation-comms';
4
+ import { getUser } from '@genesislcap/foundation-user';
5
+ import { GENESIS_SOCKET_URL } from '@genesislcap/foundation-utils';
6
+ import { AUTH_PATH } from '../app.config';
3
7
 
4
8
  /**
5
9
  * Configure the micro frontend
6
10
  */
7
- export const configureFoundationAuth = ({
8
- router,
9
- connectService,
10
- }: {
11
- router: Router;
12
- connectService: any;
13
- }) => null
14
- // configure({
15
- // omitRoutes: ['request-account'],
16
- // postLoginRedirect: async () => {
17
- // await connectService.init();
18
- // router.navigate([`/${INTERNAL_URLS.homepage}`]);
19
- // },
20
- // });
11
+ export const configureFoundationAuth = ({ router, connectService,}: { router: Router; connectService: Connect; }) => {
12
+ const baseElement = document.querySelector('base');
13
+ const basePath = baseElement?.getAttribute('href') || '';
14
+
15
+ configure({
16
+ name: 'client-app-login',
17
+ omitRoutes: ['request-account', 'forgot-password'],
18
+ fields: {
19
+ ...defaultAuthConfig.fields,
20
+ username: {
21
+ ...defaultAuthConfig.fields.username,
22
+ },
23
+ },
24
+ hostPath: basePath + AUTH_PATH,
25
+ postLoginRedirect: async () => {
26
+ const url = GENESIS_SOCKET_URL;
27
+ await connectService.connect(url);
28
+
29
+ const lastPath = getUser().lastPath()?.replace(basePath, '');
30
+
31
+ router.navigate([lastPath ?? '{{kebabCase routes.[0].name}}']);
32
+ },
33
+ });
34
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "/sm": {
3
+ "target": "{{apiHost}}",
4
+ "secure": false,
5
+ "pathRewrite": { "^/sm": "" }
6
+ },
7
+ "/gwf": {
8
+ "target": "{{apiHost}}",
9
+ "secure": false,
10
+ "ws": true
11
+ }
12
+ }
@@ -58,7 +58,7 @@
58
58
  "history": "^5.3.0",
59
59
  "react": "^19.0.0",
60
60
  "react-dom": "^19.0.0",
61
- "react-router-dom": "7.0.2",
61
+ "react-router": "^7.1.3",
62
62
  "web-vitals": "^2.1.4"
63
63
  },
64
64
  "devDependencies": {
@@ -77,7 +77,7 @@
77
77
  "@types/css-modules": "^1.0.5",
78
78
  "@types/jest": "^29.5.12",
79
79
  "@types/node": "^20.14.10",
80
- "@types/react": "^19.0.1",
80
+ "@types/react": "^19.0.1",
81
81
  "@types/react-dom": "^19.0.2",
82
82
  "@typescript-eslint/eslint-plugin": "^7.13.1",
83
83
  "@typescript-eslint/parser": "^7.13.1",
@@ -1,7 +1,6 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { unstable_HistoryRouter as HistoryRouter, Routes, Route, useLocation } from 'react-router-dom';
2
+ import {Routes, Route, useLocation, BrowserRouter} from 'react-router';
3
3
  import {
4
- history,
5
4
  setApiHost,
6
5
  getLayoutNameByRoute,
7
6
  {{#if FDC3.channels.length~}}
@@ -17,7 +16,6 @@ import { AuthProvider } from './store/AuthContext';
17
16
  import { RoutesProvider, useRoutesContext } from './store/RoutesContext';
18
17
  import AuthPage from './pages/AuthPage/AuthPage';
19
18
  import { registerComponents as genesisRegisterComponents } from './share/genesis-components';
20
- import { configureFoundationLogin } from './share/foundation-login';
21
19
  import ProtectedGuard from './guards/ProtectedGuard';
22
20
  import { storeService } from '@/services/store.service';
23
21
 
@@ -33,10 +31,8 @@ const DynamicLayout = () => {
33
31
 
34
32
  useEffect(() => {
35
33
  handleRouteChange(location);
36
- const unlisten = history.listen(handleRouteChange);
37
34
 
38
35
  return () => {
39
- unlisten();
40
36
  }
41
37
  }, [location]);
42
38
 
@@ -82,7 +78,6 @@ const App: React.FC<AppProps> = ({ rootElement }) => {
82
78
 
83
79
  setApiHost();
84
80
  genesisRegisterComponents();
85
- configureFoundationLogin({ router: history });
86
81
 
87
82
  useEffect(() => {
88
83
  registerStylesTarget(document.body, 'main');
@@ -107,14 +102,14 @@ const App: React.FC<AppProps> = ({ rootElement }) => {
107
102
  return (
108
103
  <AuthProvider>
109
104
  <RoutesProvider>
110
- <HistoryRouter history={history as any}>
105
+ <BrowserRouter>
111
106
  <Routes>
112
107
  <Route path="*" element={<DynamicLayout />} />
113
108
  </Routes>
114
- </HistoryRouter>
109
+ </BrowserRouter>
115
110
  </RoutesProvider>
116
111
  </AuthProvider>
117
112
  );
118
113
  };
119
114
 
120
- export default App;
115
+ export default App;
@@ -2,11 +2,11 @@ import { RouteLayouts } from './types/RouteLayouts';
2
2
  import { environment } from '@environment';
3
3
 
4
4
  export const routeLayouts: RouteLayouts = {
5
- '/auth': 'blank',
5
+ '/login': 'blank',
6
6
  '/': 'blank',
7
7
  };
8
8
 
9
- export const AUTH_PATH = 'auth';
9
+ export const AUTH_PATH = 'login';
10
10
  export const NOT_PERMITTED_PATH = 'not-permitted';
11
11
 
12
12
  export const API_DATA = {
@@ -1,6 +1,5 @@
1
1
  import { useState, useEffect, ReactNode } from 'react';
2
- import { RouteObject } from 'react-router';
3
- import { useNavigate } from 'react-router-dom';
2
+ import {RouteObject, useNavigate} from 'react-router';
4
3
  import isConnectedHelper from '@/helpers/isConnectedHelper';
5
4
  import isAuthenticatedHelper from '@/helpers/isAuthenticatedHelper';
6
5
  import hasPermissionHelper from '@/helpers/hasPermissionHelper';
@@ -56,11 +55,15 @@ const ProtectedGuard: React.FC<{ children: ReactNode }> = ({ children }: { child
56
55
  }
57
56
 
58
57
  if (permissionState) {
59
- navigate(`/${redirectUrlByPermissionState[permissionState]}`);
58
+ const baseElement = document.querySelector('base');
59
+ const basePath = baseElement?.getAttribute('href') || '';
60
+
61
+ const redirect = `${basePath}${redirectUrlByPermissionState[permissionState]}`;
62
+ navigate(`/${redirect}`);
60
63
  }
61
64
  }, [routes, isConnected, isAuthenticated, hasPermission]);
62
65
 
63
66
  return children;
64
67
  };
65
68
 
66
- export default ProtectedGuard;
69
+ export default ProtectedGuard;
@@ -1,7 +1,6 @@
1
1
  import React, { ReactNode, useEffect, useRef } from 'react';
2
- import { RouteObject } from 'react-router';
2
+ import { RouteObject, useNavigate } from 'react-router';
3
3
  import { configureDesignSystem, getNavItems } from '@genesislcap/foundation-ui';
4
- import { useNavigate } from 'react-router-dom';
5
4
  import {
6
5
  baseLayerLuminance,
7
6
  StandardLuminance,
@@ -10,6 +9,9 @@ import styles from './DefaultLayout.module.css';
10
9
  import PBCElementsRenderer from '@/pbc/elementsRenderer';
11
10
  import * as designTokens from '@/styles/design-tokens.json';
12
11
  import { useRoutesContext } from '@/store/RoutesContext';
12
+ import { connectService } from '@/services/connect.service.ts';
13
+ import { getUser } from '@genesislcap/foundation-user';
14
+ import { AUTH_PATH } from '@/config';
13
15
 
14
16
  interface DefaultLayoutProps {
15
17
  children: ReactNode;
@@ -25,7 +27,6 @@ type ExtendedRouteObject = RouteObject & {
25
27
  const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
26
28
  const navigate = useNavigate();
27
29
  const designSystemProviderRef = useRef<HTMLElement>(null);
28
- const foundationHeaderRef = useRef<HTMLElement>(null);
29
30
  const routes = useRoutesContext() as ExtendedRouteObject[];
30
31
  const navItems = getNavItems(routes.flatMap((route) => ({
31
32
  path: route.path || '',
@@ -43,25 +44,18 @@ const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
43
44
  );
44
45
  }
45
46
  };
46
-
47
+
48
+ if (!connectService.isConnected()) {
49
+ getUser().trackPath();
50
+ navigate(`/${AUTH_PATH}`)
51
+ }
52
+
47
53
  useEffect(() => {
48
54
  if (designSystemProviderRef.current) {
49
55
  configureDesignSystem(designSystemProviderRef.current, designTokens);
50
56
  }
51
57
 
52
- const handleLuminanceIconClicked = () => {
53
- onLuminanceToggle();
54
- };
55
-
56
- const foundationHeader = foundationHeaderRef.current;
57
- if (foundationHeader) {
58
- foundationHeader.addEventListener('luminance-icon-clicked', handleLuminanceIconClicked);
59
- }
60
-
61
58
  return () => {
62
- if (foundationHeader) {
63
- foundationHeader.removeEventListener('luminance-icon-clicked', handleLuminanceIconClicked);
64
- }
65
59
  };
66
60
  }, []);
67
61
 
@@ -71,7 +65,8 @@ const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
71
65
  <rapid-design-system-provider ref={designSystemProviderRef} class={className}>
72
66
  <PBCElementsRenderer target={['layout-start']} />
73
67
  <foundation-header
74
- ref={foundationHeaderRef}
68
+ onluminance-icon-clicked={onLuminanceToggle}
69
+ onlogout-clicked={() => navigate(`/${AUTH_PATH}`)}
75
70
  show-luminance-toggle-button
76
71
  show-misc-toggle-button
77
72
  routeNavItems={navItems}
@@ -1,12 +1,20 @@
1
- import React from 'react';
1
+ import React, {useEffect} from 'react';
2
2
  import './AuthPage.css';
3
+ import { configureFoundationLogin } from "@/share/foundation-login.ts";
4
+ import { useNavigate } from "react-router";
3
5
 
4
6
  const AuthPage: React.FC = () => {
5
- return (
6
- <section className="auth-page">
7
- <client-app-login></client-app-login>
8
- </section>
9
- );
7
+ const navigate = useNavigate();
8
+
9
+ useEffect(() => {
10
+ configureFoundationLogin({ navigate });
11
+ }, []);
12
+
13
+ return (
14
+ <section className="auth-page">
15
+ <client-app-login></client-app-login>
16
+ </section>
17
+ );
10
18
  };
11
19
 
12
- export default AuthPage;
20
+ export default AuthPage;
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useRef, RouteObject } from 'react';
2
2
  import { deriveElementTag } from './utils';
3
3
  import { useRoutesContext } from '@/store/RoutesContext';
4
- import { useLocation } from 'react-router-dom';
4
+ import { useLocation } from 'react-router';
5
5
 
6
6
  type ExtendedRouteObject = RouteObject & {
7
7
  data?: {
@@ -41,4 +41,4 @@ const PBCContainer: React.FC = () => {
41
41
  return <div ref={containerRef} className="container" style=\{{ width: '100%', height: '100%' }}></div>;
42
42
  };
43
43
 
44
- export default PBCContainer;
44
+ export default PBCContainer;
@@ -1,28 +1,37 @@
1
- import {configure, define} from '@genesislcap/foundation-login';
1
+ import { configure, defaultAuthConfig } from '@genesislcap/foundation-auth/config';
2
2
  import { getUser } from '@genesislcap/foundation-user';
3
- import { DI } from '@genesislcap/web-core';
4
3
  import { AUTH_PATH } from '@/config';
5
- import type { Router } from '@/utils/history';
4
+ import { GENESIS_SOCKET_URL } from '@genesislcap/foundation-utils';
5
+ import { Connect } from '@genesislcap/foundation-comms';
6
+ import { DI } from '@genesislcap/web-core';
7
+ import type { NavigateFunction } from 'react-router';
6
8
 
7
9
  /**
8
10
  * Configure the micro frontend
9
11
  */
10
- export const configureFoundationLogin = ({ router }:{ router: Router }) => {
11
- configure(DI.getOrCreateDOMContainer(), {
12
- autoConnect: true,
13
- autoAuth: true, // < Allow users to skip login
14
- showConnectionIndicator: true,
15
- hostPath: AUTH_PATH,
16
- redirectHandler: () => {
17
- // workaround for redirect from foundation-login
18
- setTimeout(() => {
19
- const lastPath = getUser().lastPath() ?? '/{{kebabCase routes.[0].name}}';
20
- router.push(lastPath);
21
- }, 0);
12
+ export const configureFoundationLogin = ({navigate}: { navigate: NavigateFunction}) => {
13
+ const baseElement = document.querySelector('base');
14
+ const basePath = baseElement?.getAttribute('href') || '';
15
+ const connect = DI.getOrCreateDOMContainer().get(Connect);
16
+
17
+
18
+ configure({
19
+ name: 'client-app-login',
20
+ omitRoutes: ['request-account', 'forgot-password'],
21
+ fields: {
22
+ ...defaultAuthConfig.fields,
23
+ username: {
24
+ ...defaultAuthConfig.fields.username,
25
+ },
22
26
  },
23
- });
27
+ hostPath: basePath + AUTH_PATH,
28
+ postLoginRedirect: async () => {
29
+ const url = GENESIS_SOCKET_URL;
30
+ await connect.connect(url);
24
31
 
25
- return define({
26
- name: `client-app-login`,
27
- });
32
+ const redirectUrl = '/{{kebabCase routes.[0].name}}';
33
+ navigate(redirectUrl);
34
+ },
35
+ })
28
36
  }
37
+
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, useContext, ReactNode } from 'react';
2
- import { RouteObject, Navigate } from 'react-router-dom';
2
+ import { RouteObject, Navigate } from 'react-router';
3
3
  import { getApp } from '@genesislcap/foundation-shell/app';
4
4
  import AuthPage from '@/pages/AuthPage/AuthPage';
5
5
  import NotFoundPage from '@/pages/NotFoundPage/NotFoundPage';
@@ -71,4 +71,4 @@ export const RoutesProvider: React.FC<{ children: ReactNode }> = ({ children })
71
71
 
72
72
  export const useRoutesContext = () => {
73
73
  return useContext(RoutesContext);
74
- };
74
+ };
@@ -1,6 +1,5 @@
1
- export * from './history';
2
1
  export * from './fdc3';
3
2
  export * from './layout';
4
3
  export * from './permissions';
5
4
  export * from './setApiHost';
6
- export * from './getLayoutNameByRoute';
5
+ export * from './getLayoutNameByRoute';
@@ -7,7 +7,7 @@ module.exports = (env, argv) => {
7
7
  const https = process.env.HTTPS === 'true';
8
8
  const open = !(process.env.NO_OPEN === 'true');
9
9
  const environmentFile = mode === 'production'
10
- ? 'environment.prod.ts'
10
+ ? 'environment.prod.ts'
11
11
  : 'environment.ts';
12
12
  const environmentPath = resolve(__dirname, 'src/environments', environmentFile);
13
13
 
@@ -76,6 +76,20 @@ module.exports = (env, argv) => {
76
76
  ],
77
77
  devServer: {
78
78
  server: https ? 'https' : 'http',
79
+ proxy: [
80
+ {
81
+ context: "/sm",
82
+ "target": "{{apiHost}}",
83
+ "secure": false,
84
+ "pathRewrite": {"^/sm": ""},
85
+ },
86
+ {
87
+ context: "/gwf",
88
+ "target": "{{apiHost}}",
89
+ "secure": false,
90
+ "ws": true
91
+ }
92
+ ],
79
93
  open,
80
94
  static: {
81
95
  directory: join(__dirname, 'public'),
@@ -100,4 +114,4 @@ module.exports = (env, argv) => {
100
114
  modules: false,
101
115
  },
102
116
  };
103
- };
117
+ };
@@ -89,6 +89,7 @@
89
89
  "lint-staged": "^12.4.1"
90
90
  },
91
91
  "dependencies": {
92
+ "@genesislcap/foundation-auth": "{{versions.UI}}",
92
93
  "@genesislcap/foundation-comms": "{{versions.UI}}",
93
94
  "@genesislcap/foundation-entity-management": "{{versions.UI}}",
94
95
  "@genesislcap/foundation-events": "{{versions.UI}}",
@@ -117,6 +118,7 @@
117
118
  "tslib": "^2.3.1"
118
119
  },
119
120
  "overrides": {
121
+ "@genesislcap/foundation-auth": "{{versions.UI}}",
120
122
  "@genesislcap/foundation-comms": "{{versions.UI}}",
121
123
  "@genesislcap/foundation-entity-management": "{{versions.UI}}",
122
124
  "@genesislcap/foundation-events": "{{versions.UI}}",
@@ -139,6 +141,7 @@
139
141
  "@genesislcap/g2plot-chart": "{{versions.UI}}",
140
142
  "@genesislcap/rapid-design-system": "{{versions.UI}}",
141
143
  "@genesislcap/rapid-grid-pro": "{{versions.UI}}",
142
- "@genesislcap/web-core": "{{versions.UI}}"
144
+ "@genesislcap/web-core": "{{versions.UI}}",
145
+ "typescript": "5.6.3"
143
146
  }
144
147
  }
@@ -1,4 +1,4 @@
1
- // Set the appHostURL from which the providers are to be fetched.
1
+ // Set the appHostURL from which the providers are to be fetched
2
2
  const appHostURL = `${location.protocol}//${location.host}/gwf/`;
3
3
 
4
4
  const fetchIDPs = async () => {
@@ -1,16 +1,14 @@
1
- import { Auth, Session } from '@genesislcap/foundation-comms';
2
- import { defaultLoginConfig, LoginConfig } from '@genesislcap/foundation-login';
1
+ import { getUser, navigateTo } from '@genesislcap/foundation-auth';
2
+ import { Auth, Connect } from '@genesislcap/foundation-comms';
3
3
  import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
4
- import { PUBLIC_PATH } from '@genesislcap/foundation-utils';
5
- import { NavigationPhase, optional, Route } from '@genesislcap/web-core';
4
+ import { GENESIS_SOCKET_URL, PUBLIC_PATH } from '@genesislcap/foundation-utils';
6
5
  import { defaultLayout, loginLayout } from '../layouts';
7
- import { logger } from '../utils';
8
- {{#each routes}}
9
- import { {{pascalCase this.name}} } from './{{kebabCase this.name}}/{{kebabCase this.name}}';
10
- {{/each}}
11
6
  import { NotFound } from './not-found/not-found';
12
7
  import { defaultNotPermittedRoute, NotPermitted } from './not-permitted/not-permitted';
13
8
  import { LoginSettings } from './types';
9
+ {{#each routes}}
10
+ import { {{pascalCase this.name}} } from './{{kebabCase this.name}}/{{kebabCase this.name}}';
11
+ {{/each}}
14
12
 
15
13
  // eslint-disable-next-line
16
14
  declare var ENABLE_SSO: string;
@@ -29,17 +27,13 @@ const ssoSettings =
29
27
  const publicPath = typeof PUBLIC_PATH !== 'undefined' ? PUBLIC_PATH : '';
30
28
 
31
29
  export class MainRouterConfig extends FoundationRouterConfiguration<LoginSettings> {
32
- constructor(
33
- @Auth private auth: Auth,
34
- @Session private session: Session,
35
- @optional(LoginConfig)
36
- private loginConfig: LoginConfig = { ...defaultLoginConfig, autoAuth: true, autoConnect: true },
37
- ) {
38
- super();
39
- }
30
+ @Connect private connect: Connect;
31
+ @Auth private auth: Auth;
40
32
 
41
33
  async configure() {
42
34
  this.configureAnalytics();
35
+ this.configureRoutePermittedChecks();
36
+ this.configureFallbackRouteDefinition();
43
37
  this.title = '{{capitalCase appName}}';
44
38
  this.defaultLayout = defaultLayout;
45
39
 
@@ -52,22 +46,31 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
52
46
  name: 'login',
53
47
  title: 'Login',
54
48
  element: async () => {
55
- const { configure, define } = await import(
56
- /* webpackChunkName: "foundation-login" */
57
- '@genesislcap/foundation-login'
49
+ const { configure, defaultAuthConfig } = await import(
50
+ '@genesislcap/foundation-auth/config'
58
51
  );
59
- configure(this.container, {
60
- hostPath: 'login',
61
- autoConnect: true,
62
- defaultRedirectUrl: publicPath + '{{kebabCase routes.[0].name}}',
52
+ return configure({
53
+ omitRoutes: ['request-account', 'forgot-password'],
54
+ fields: {
55
+ ...defaultAuthConfig.fields,
56
+ username: {
57
+ ...defaultAuthConfig.fields.username,
58
+ pattern: '^[a-zA-Z0-9.@_:-]*$',
59
+ },
60
+ },
61
+ hostPath: this.loginPath,
62
+ postLoginRedirect: async () => {
63
+ await this.connect.connect(GENESIS_SOCKET_URL);
64
+ navigateTo(getUser().lastPath() ?? publicPath + '{{kebabCase routes.[0].name}}');
65
+ },
66
+ postLogoutRedirect: () => {
67
+ if (this.connect.isConnected) {
68
+ this.connect.disconnect();
69
+ }
70
+ defaultAuthConfig.postLogoutRedirect();
71
+ },
63
72
  ...ssoSettings,
64
73
  });
65
- return define({
66
- name: `{{rootElement}}-login`,
67
- /**
68
- * You can augment the template and styles here when needed.
69
- */
70
- });
71
74
  },
72
75
  layout: loginLayout,
73
76
  settings: { public: true },
@@ -103,70 +106,22 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
103
106
  {{/each}}
104
107
  );
105
108
 
106
- /**
107
- * Example of a FallbackRouteDefinition
108
- */
109
- this.routes.fallback(() =>
110
- this.auth.isLoggedIn ? { redirect: 'not-found' } : { redirect: authPath },
111
- );
112
-
113
- /**
114
- * Example of a NavigationContributor
115
- */
116
109
  this.contributors.push({
117
110
  navigate: async (phase) => {
118
111
  const settings = phase.route.settings;
119
112
 
120
113
  /**
121
- * If public route don't block
114
+ * If the route is public or the user is authenticated don't block
122
115
  */
123
- if (settings && settings.public) {
116
+ if (settings?.public || this.user.isAuthenticated) {
124
117
  return;
125
118
  }
126
119
 
127
120
  /**
128
- * If logged in don't block
121
+ * Otherwise route them to login
129
122
  */
130
- if (this.auth.isLoggedIn) {
131
- this.redirectIfNotPermitted(settings, phase);
132
- return;
133
- }
134
-
135
- /**
136
- * If allowAutoAuth and session is valid try to connect+auto-login
137
- */
138
- if (this.loginConfig.autoAuth && (await this.reAuthFromSession(settings, phase))) {
139
- return;
140
- }
141
-
142
- /**
143
- * Otherwise route them somewhere, like to a login
144
- */
145
- phase.cancel(() => {
146
- this.session.captureReturnUrl();
147
- Route.name.replace(phase.router, authPath);
148
- });
123
+ this.navigationPhaseLoginRedirect(phase);
149
124
  },
150
125
  });
151
126
  }
152
-
153
- private async reAuthFromSession(settings: LoginSettings, phase: NavigationPhase) {
154
- return this.auth.reAuthFromSession().then((authenticated) => {
155
- logger.info(`reAuthFromSession. authenticated: ${authenticated}`);
156
- if (authenticated) {
157
- this.redirectIfNotPermitted(settings, phase);
158
- }
159
- return authenticated;
160
- });
161
- }
162
-
163
- private redirectIfNotPermitted(settings: LoginSettings, phase: NavigationPhase) {
164
- const { path } = phase.route.endpoint;
165
- if (settings?.isPermitted && !settings.isPermitted()) {
166
- logger.warn(`Not permitted - Redirecting URL from ${path} to ${defaultNotPermittedRoute}.`);
167
- phase.cancel(() => {
168
- Route.name.replace(phase.router, defaultNotPermittedRoute);
169
- });
170
- }
171
- }
172
127
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "3.40.1",
4
+ "version": "3.41.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
@@ -0,0 +1,13 @@
1
+ package scripts
2
+
3
+ router {
4
+ webPort = 9064
5
+ socketPort = 9065
6
+
7
+ cookieAuthentication {
8
+ enabled = true
9
+ httpOnly = true
10
+ secure = false
11
+ sameSite = SameSite.Lax
12
+ }
13
+ }
@@ -1,47 +0,0 @@
1
- import {configure, define} from '@genesislcap/foundation-login';
2
- import type { Router } from '@angular/router';
3
- import { getUser } from '@genesislcap/foundation-user';
4
- import { css, DI } from '@genesislcap/web-core';
5
- import { AUTH_PATH } from '../app.config';
6
- import logo from '../../assets/logo.svg';
7
-
8
- // eslint-disable-next-line
9
- declare var ENABLE_SSO: boolean;
10
-
11
- const ssoSettings =
12
- typeof ENABLE_SSO !== 'undefined' && ENABLE_SSO === true
13
- ? {
14
- autoAuth: true,
15
- sso: {
16
- toggled: true,
17
- identityProvidersPath: 'sso/list',
18
- },
19
- }
20
- : {};
21
-
22
- /**
23
- * Configure the micro frontend
24
- */
25
- export const configureFoundationLogin = ({
26
- router,
27
- }: {
28
- router: Router;
29
- }) => {
30
- configure(DI.getOrCreateDOMContainer(), {
31
- // autoConnect: true, // < Guard in place to ensure connection. Keeping the connect form in place for now.
32
- autoAuth: true, // < Allow users to skip login
33
- showConnectionIndicator: true,
34
- hostPath: AUTH_PATH,
35
- redirectHandler: () => {
36
- router.navigate([getUser().lastPath() ?? '{{kebabCase routes.[0].name}}'])
37
- },
38
- ...ssoSettings,
39
- logo: css `
40
- content: url("${logo}");
41
- `,
42
- });
43
-
44
- return define({
45
- name: `client-app-login`,
46
- });
47
- }
@@ -1,5 +0,0 @@
1
- import { createBrowserHistory, History } from 'history';
2
-
3
- export type Router = History;
4
-
5
- export const history = createBrowserHistory() as History;