@genesislcap/blank-app-seed 3.41.1 → 3.41.2

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.
@@ -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.41.1",
4
+ "version": "3.41.2",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.41.2](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.41.1...v3.41.2) (2025-03-20)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * correct path for login redirect 4b06ecb
9
+ * fix angular router e92e502
10
+ * react and angular router fix (#439) 6c7a4da
11
+ * react router fixes 1fd1742
12
+
3
13
  ## [3.41.1](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.41.0...v3.41.1) (2025-03-18)
4
14
 
5
15
 
@@ -28,12 +28,10 @@ export const configureFoundationLogin = ({
28
28
  router: Router;
29
29
  }) => {
30
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,
31
+ autoConnect: true,
34
32
  hostPath: AUTH_PATH,
35
33
  redirectHandler: () => {
36
- router.navigate([getUser().lastPath() ?? '{{kebabCase routes.[0].name}}'])
34
+ router.navigate(['{{kebabCase routes.[0].name}}'])
37
35
  },
38
36
  ...ssoSettings,
39
37
  logo: css `
@@ -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": {
@@ -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,11 +102,11 @@ 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
  );
@@ -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,7 +55,11 @@ 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
 
@@ -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,7 @@ 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 { AUTH_PATH } from '@/config';
13
13
 
14
14
  interface DefaultLayoutProps {
15
15
  children: ReactNode;
@@ -25,7 +25,6 @@ type ExtendedRouteObject = RouteObject & {
25
25
  const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
26
26
  const navigate = useNavigate();
27
27
  const designSystemProviderRef = useRef<HTMLElement>(null);
28
- const foundationHeaderRef = useRef<HTMLElement>(null);
29
28
  const routes = useRoutesContext() as ExtendedRouteObject[];
30
29
  const navItems = getNavItems(routes.flatMap((route) => ({
31
30
  path: route.path || '',
@@ -43,25 +42,13 @@ const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
43
42
  );
44
43
  }
45
44
  };
46
-
45
+
47
46
  useEffect(() => {
48
47
  if (designSystemProviderRef.current) {
49
48
  configureDesignSystem(designSystemProviderRef.current, designTokens);
50
49
  }
51
50
 
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
51
  return () => {
62
- if (foundationHeader) {
63
- foundationHeader.removeEventListener('luminance-icon-clicked', handleLuminanceIconClicked);
64
- }
65
52
  };
66
53
  }, []);
67
54
 
@@ -71,7 +58,8 @@ const DefaultLayout: React.FC<DefaultLayoutProps> = ({ children }) => {
71
58
  <rapid-design-system-provider ref={designSystemProviderRef} class={className}>
72
59
  <PBCElementsRenderer target={['layout-start']} />
73
60
  <foundation-header
74
- ref={foundationHeaderRef}
61
+ onluminance-icon-clicked={onLuminanceToggle}
62
+ onlogout-clicked={() => navigate(`/${AUTH_PATH}`)}
75
63
  show-luminance-toggle-button
76
64
  show-misc-toggle-button
77
65
  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
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?: {
@@ -1,24 +1,19 @@
1
1
  import {configure, define} from '@genesislcap/foundation-login';
2
- import { getUser } from '@genesislcap/foundation-user';
3
2
  import { DI } from '@genesislcap/web-core';
4
3
  import { AUTH_PATH } from '@/config';
5
- import type { Router } from '@/utils/history';
6
4
 
7
5
  /**
8
6
  * Configure the micro frontend
9
7
  */
10
- export const configureFoundationLogin = ({ router }:{ router: Router }) => {
8
+ export const configureFoundationLogin = ({ navigate }:{ navigate: any }) => {
11
9
  configure(DI.getOrCreateDOMContainer(), {
12
10
  autoConnect: true,
13
11
  autoAuth: true, // < Allow users to skip login
14
12
  showConnectionIndicator: true,
15
13
  hostPath: AUTH_PATH,
16
14
  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);
15
+ const lastPath = '/{{kebabCase routes.[0].name}}';
16
+ navigate(lastPath);
22
17
  },
23
18
  });
24
19
 
@@ -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';
@@ -1,4 +1,3 @@
1
- export * from './history';
2
1
  export * from './fdc3';
3
2
  export * from './layout';
4
3
  export * from './permissions';
@@ -59,7 +59,7 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
59
59
  configure(this.container, {
60
60
  hostPath: 'login',
61
61
  autoConnect: true,
62
- defaultRedirectUrl: publicPath + '{{kebabCase routes.[0].name}}',
62
+ defaultRedirectUrl: publicPath + '/{{kebabCase routes.[0].name}}',
63
63
  ...ssoSettings,
64
64
  });
65
65
  return define({
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.41.1",
4
+ "version": "3.41.2",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
@@ -1,5 +0,0 @@
1
- import { createBrowserHistory, History } from 'history';
2
-
3
- export type Router = History;
4
-
5
- export const history = createBrowserHistory() as History;