@genesislcap/blank-app-seed 3.33.3 → 3.34.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.
Files changed (55) hide show
  1. package/.genx/package.json +1 -1
  2. package/.genx/prompts/api.js +2 -9
  3. package/.genx/static.js +0 -1
  4. package/.genx/templates/angular/component/component.hbs +5 -7
  5. package/.genx/templates/react/component/component.hbs +5 -7
  6. package/.genx/templates/web-components/component/component.hbs +5 -7
  7. package/.genx/versions.json +3 -3
  8. package/.gitignore +1 -0
  9. package/CHANGELOG.md +37 -0
  10. package/README.md +4 -4
  11. package/client-tmp/react/package.json +22 -7
  12. package/client-tmp/react/public/favicon.ico +0 -0
  13. package/client-tmp/react/public/index.html +13 -0
  14. package/client-tmp/react/src/App.tsx +95 -68
  15. package/client-tmp/react/src/config.ts +2 -16
  16. package/client-tmp/react/src/custom-elements.d.ts +3 -1
  17. package/client-tmp/react/src/environments/environment.prod.ts +8 -0
  18. package/client-tmp/react/src/environments/environment.ts +9 -0
  19. package/client-tmp/react/src/guards/ProtectedGuard.tsx +64 -0
  20. package/client-tmp/react/src/helpers/hasPermissionHelper.tsx +10 -0
  21. package/client-tmp/react/src/helpers/isAuthenticatedHelper.tsx +14 -0
  22. package/client-tmp/react/src/helpers/isConnectedHelper.tsx +16 -0
  23. package/client-tmp/react/src/layouts/blank/BlankLayout.tsx +1 -1
  24. package/client-tmp/react/src/layouts/default/DefaultLayout.tsx +26 -15
  25. package/client-tmp/react/src/main.tsx +21 -5
  26. package/client-tmp/react/src/pages/NotFoundPage/NotFoundPage.css +0 -0
  27. package/client-tmp/react/src/pages/NotFoundPage/NotFoundPage.tsx +14 -0
  28. package/client-tmp/react/src/pages/NotPermittedPage/NotPermittedPage.test.tsx +1 -1
  29. package/client-tmp/react/src/pages/NotPermittedPage/NotPermittedPage.tsx +1 -1
  30. package/client-tmp/react/src/pbc/README.md +7 -0
  31. package/client-tmp/react/src/pbc/container.tsx +44 -0
  32. package/client-tmp/react/src/pbc/elementsRenderer.tsx +40 -0
  33. package/client-tmp/react/src/pbc/utils.ts +121 -0
  34. package/client-tmp/react/src/services/store.service.ts +48 -0
  35. package/client-tmp/react/src/share/foundation-login.ts +13 -6
  36. package/client-tmp/react/src/share/genesis-components.ts +49 -23
  37. package/client-tmp/react/src/store/AuthContext.tsx +0 -2
  38. package/client-tmp/react/src/store/RoutesContext.tsx +74 -0
  39. package/client-tmp/react/src/types/LayoutName.ts +3 -0
  40. package/client-tmp/react/src/types/RouteLayouts.ts +3 -1
  41. package/client-tmp/react/src/utils/getLayoutNameByRoute.ts +5 -0
  42. package/client-tmp/react/src/utils/history.ts +4 -2
  43. package/client-tmp/react/src/utils/index.ts +2 -1
  44. package/client-tmp/react/test/e2e/fixture.ts +1 -1
  45. package/client-tmp/react/tsconfig.app.json +1 -22
  46. package/client-tmp/react/tsconfig.json +30 -10
  47. package/client-tmp/react/vite.config.ts +26 -15
  48. package/client-tmp/react/webpack.config.js +103 -0
  49. package/package.json +1 -1
  50. package/testData/excel/.gitkeep +0 -0
  51. package/client-tmp/react/env.development.json +0 -3
  52. package/client-tmp/react/src/guards/AuthGuard.tsx +0 -32
  53. package/client-tmp/react/src/guards/PermissionsGuard.tsx +0 -37
  54. package/client-tmp/react/src/index.ts +0 -21
  55. package/client-tmp/react/src/reportWebVitals.ts +0 -13
@@ -1,6 +1,6 @@
1
1
  import { base, Page } from '@genesislcap/foundation-testing/e2e';
2
2
  import { ProtectedPage } from './pages';
3
- import { PORT } from '../../playwright.config';
3
+ import { PORT } from '@/playwright.config';
4
4
 
5
5
  export type FixtureConfig = {
6
6
  API_HOST: string;
@@ -1,25 +1,4 @@
1
1
  {
2
- "compilerOptions": {
3
- "composite": true,
4
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
- "target": "ES2020",
6
- "useDefineForClassFields": true,
7
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
8
- "module": "ESNext",
9
- "skipLibCheck": true,
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "moduleDetection": "force",
15
- "noEmit": true,
16
- "jsx": "react-jsx",
17
- "strict": true,
18
- "esModuleInterop": true,
19
- "noUnusedLocals": true,
20
- "noUnusedParameters": true,
21
- "noFallthroughCasesInSwitch": true,
22
- "types": ["node", "react"]
23
- },
2
+ "extends": "./tsconfig.json",
24
3
  "include": ["src" , "src/**/*.d.ts"],
25
4
  }
@@ -1,14 +1,34 @@
1
1
  {
2
- "files": [],
3
- "references": [
4
- {
5
- "path": "./tsconfig.app.json"
6
- },
7
- {
8
- "path": "./tsconfig.node.json"
9
- }
10
- ],
11
2
  "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "target": "ES2020",
6
+ "useDefineForClassFields": false,
7
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
8
+ "module": "ESNext",
9
+ "skipLibCheck": true,
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+ "jsx": "react-jsx",
17
+ "strict": true,
12
18
  "esModuleInterop": true,
13
- }
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "baseUrl": "./",
23
+ "paths": {
24
+ "@/*": ["src/*"]
25
+ },
26
+ "experimentalDecorators": true,
27
+ "emitDecoratorMetadata": true
28
+ },
29
+ "include": [
30
+ "src" ,
31
+ "src/**/*.d.ts",
32
+ "src/pbc/**/*.ts",
33
+ ],
14
34
  }
@@ -1,44 +1,55 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
  import { resolve, dirname } from 'path';
3
3
  import { defineConfig, UserConfig } from 'vite';
4
- import fs from 'fs';
5
4
  import react from '@vitejs/plugin-react';
6
5
  import visualizer from 'rollup-plugin-visualizer';
6
+ import tsconfigPaths from 'vite-plugin-tsconfig-paths';
7
7
 
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
 
10
10
  export default defineConfig(({ mode }: { mode: string }): UserConfig => {
11
11
  const https: boolean = process.env.HTTPS === 'true';
12
12
  const open: boolean = !(process.env.NO_OPEN === 'true');
13
- const jsonFilePath: string = resolve(process.cwd(), `env.${mode}.json`);
14
- const envConfig: Record<string, string> = {};
15
-
16
- if (fs.existsSync(jsonFilePath)) {
17
- const jsonContent: string = fs.readFileSync(jsonFilePath, 'utf-8');
18
- const parsedConfig: Record<string, any> = JSON.parse(jsonContent);
19
-
20
- for (const key in parsedConfig) {
21
- envConfig[`import.meta.env.${key}`] = JSON.stringify(parsedConfig[key]);
22
- }
23
- }
13
+ const environmentFile = mode === 'production'
14
+ ? 'environment.prod.ts'
15
+ : 'environment.ts';
16
+ const environmentPath = resolve(__dirname, 'src/environments', environmentFile);
24
17
 
25
18
  const config: UserConfig = {
26
- define: envConfig,
19
+ define: {
20
+ BUILDER: JSON.stringify('vite'),
21
+ },
27
22
  server: {
28
23
  https,
29
24
  open,
25
+ fs: {
26
+ strict: false,
27
+ }
30
28
  },
31
29
  plugins: [
32
30
  react(),
31
+ tsconfigPaths(),
33
32
  ],
34
33
  build: {
35
34
  rollupOptions: {
36
- plugins: []
37
- }
35
+ plugins: [],
36
+ treeshake: false,
37
+ },
38
38
  },
39
39
  resolve: {
40
40
  alias: {
41
41
  'foundationZero/ZeroDesignSystem': resolve(__dirname, 'node_modules/@genesislcap/foundation-zero'),
42
+ '@': resolve(__dirname, 'src'),
43
+ '@environment': environmentPath,
44
+ 'pbc': resolve(__dirname, 'src/pbc'),
45
+ },
46
+ preserveSymlinks: true,
47
+ },
48
+ esbuild: {
49
+ tsconfigRaw: {
50
+ compilerOptions: {
51
+ experimentalDecorators: true,
52
+ },
42
53
  },
43
54
  },
44
55
  };
@@ -0,0 +1,103 @@
1
+ const { resolve, join } = require('path');
2
+ const webpack = require('webpack');
3
+ const Dotenv = require('dotenv-webpack');
4
+
5
+ module.exports = (env, argv) => {
6
+ const mode = argv.mode || 'development';
7
+ const https = process.env.HTTPS === 'true';
8
+ const open = !(process.env.NO_OPEN === 'true');
9
+ const environmentFile = mode === 'production'
10
+ ? 'environment.prod.ts'
11
+ : 'environment.ts';
12
+ const environmentPath = resolve(__dirname, 'src/environments', environmentFile);
13
+
14
+ return {
15
+ mode,
16
+ entry: './src/main.tsx',
17
+ output: {
18
+ path: resolve(__dirname, 'dist'),
19
+ filename: 'bundle.js',
20
+ },
21
+ resolve: {
22
+ extensions: ['.tsx', '.ts', '.js'],
23
+ alias: {
24
+ 'foundationZero/ZeroDesignSystem': resolve(__dirname, 'node_modules/@genesislcap/foundation-zero'),
25
+ '@': resolve(__dirname, 'src'),
26
+ '@environment': environmentPath,
27
+ 'pbc': resolve(__dirname, 'src/pbc'),
28
+ },
29
+ symlinks: true,
30
+ },
31
+ module: {
32
+ rules: [
33
+ {
34
+ test: /\.tsx?$/,
35
+ use: {
36
+ loader: 'ts-loader',
37
+ options: {
38
+ transpileOnly: true,
39
+ },
40
+ },
41
+ exclude: /node_modules/,
42
+ },
43
+ {
44
+ test: /\.jsx?$/,
45
+ exclude: /node_modules/,
46
+ use: {
47
+ loader: 'babel-loader',
48
+ options: {
49
+ presets: ['@babel/preset-env', '@babel/preset-react'],
50
+ },
51
+ },
52
+ },
53
+ {
54
+ test: /\.css$/,
55
+ use: ['style-loader', 'css-loader'],
56
+ },
57
+ {
58
+ test: /\.svg$/,
59
+ type: 'asset/resource',
60
+ },
61
+ {
62
+ test: /\.(png|jpe?g|gif)$/i,
63
+ use: [
64
+ {
65
+ loader: 'file-loader',
66
+ },
67
+ ],
68
+ },
69
+ ],
70
+ },
71
+ plugins: [
72
+ new Dotenv(),
73
+ new webpack.DefinePlugin({
74
+ BUILDER: JSON.stringify('webpack'),
75
+ }),
76
+ ],
77
+ devServer: {
78
+ server: https ? 'https' : 'http',
79
+ open,
80
+ static: {
81
+ directory: join(__dirname, 'public'),
82
+ },
83
+ client: {
84
+ overlay: {
85
+ errors: false,
86
+ warnings: false,
87
+ runtimeErrors: false,
88
+ },
89
+ },
90
+ compress: true,
91
+ port: 3000,
92
+ historyApiFallback: true,
93
+ },
94
+ stats: {
95
+ all: false,
96
+ errors: true,
97
+ warnings: true,
98
+ timings: true,
99
+ assets: true,
100
+ modules: false,
101
+ },
102
+ };
103
+ };
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.33.3",
4
+ "version": "3.34.1",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
File without changes
@@ -1,3 +0,0 @@
1
- {
2
- "VITE_API_HOST": "{{apiHost}}"
3
- }
@@ -1,32 +0,0 @@
1
- import { useEffect, useState, ReactNode } from 'react';
2
- import { useAuth } from '../store/AuthContext';
3
- import { Navigate } from 'react-router-dom';
4
- import { AUTH_PATH } from '../config';
5
- interface AuthGuardProps {
6
- children: ReactNode;
7
- }
8
- const AuthGuard: React.FC<AuthGuardProps> = ({ children }: AuthGuardProps) => {
9
- const { user, checkAuthStatus } = useAuth();
10
- const [isLoading, setIsLoading] = useState(true);
11
-
12
- useEffect(() => {
13
- const verifyAuth = async () => {
14
- await checkAuthStatus();
15
- setIsLoading(false);
16
- };
17
-
18
- verifyAuth();
19
- }, [checkAuthStatus]);
20
-
21
- if (isLoading) {
22
- return <div>Loading...</div>; // Or some loading component
23
- }
24
-
25
- if (!user) {
26
- return <Navigate to={`/${AUTH_PATH}`} />;
27
- }
28
-
29
- return <>{children}</>;
30
- };
31
-
32
- export default AuthGuard;
@@ -1,37 +0,0 @@
1
- import { useEffect, useState, ReactNode } from 'react';
2
- import { useNavigate } from 'react-router-dom';
3
- import { getUser } from '@genesislcap/foundation-user';
4
- import { NOT_PERMITTED_PATH } from '../config';
5
-
6
- interface PermissionsGuardProps {
7
- children: ReactNode;
8
- permissionCode?: string;
9
- }
10
-
11
- const PermissionsGuard: React.FC<PermissionsGuardProps> = ({ children, permissionCode }: PermissionsGuardProps) => {
12
- const navigate = useNavigate();
13
- const [isAuthorized, setIsAuthorized] = useState(false);
14
- const [isLoading, setIsLoading] = useState(true);
15
-
16
- useEffect(() => {
17
- const checkPermission = async () => {
18
- const user = getUser();
19
- if (permissionCode && !user.hasPermission(permissionCode)) {
20
- navigate(`/${NOT_PERMITTED_PATH}`);
21
- } else {
22
- setIsAuthorized(true);
23
- }
24
- setIsLoading(false);
25
- };
26
-
27
- checkPermission();
28
- }, [navigate, permissionCode]);
29
-
30
- if (isLoading) {
31
- return <div>Loading...</div>; // Or some loading component
32
- }
33
-
34
- return isAuthorized ? <>{children}</> : null;
35
- };
36
-
37
- export default PermissionsGuard;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom/client';
3
- import './styles/styles.css';
4
- import App from './App';
5
- import reportWebVitals from './reportWebVitals';
6
-
7
- const rootElement = document.getElementById('root');
8
-
9
- if (rootElement) {
10
- const root = ReactDOM.createRoot(rootElement);
11
- root.render(
12
- <React.StrictMode>
13
- <App />
14
- </React.StrictMode>,
15
- );
16
-
17
- // If you want to start measuring performance in your app, pass a function
18
- // to log results (for example: reportWebVitals(console.log))
19
- // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
20
- reportWebVitals();
21
- }
@@ -1,13 +0,0 @@
1
- const reportWebVitals = onPerfEntry => {
2
- if (onPerfEntry && onPerfEntry instanceof Function) {
3
- import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
- getCLS(onPerfEntry);
5
- getFID(onPerfEntry);
6
- getFCP(onPerfEntry);
7
- getLCP(onPerfEntry);
8
- getTTFB(onPerfEntry);
9
- });
10
- }
11
- };
12
-
13
- export default reportWebVitals;