@seliseblocks/genesis-os 4.0.0 → 4.0.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.
- package/CHANGELOG.md +24 -18
- package/LICENSE +20 -20
- package/README.md +250 -250
- package/dist/{blocks-app-layout.provider-NoJHvUfO.d.cts → blocks-app-layout.provider-C831nKua.d.cts} +1 -1
- package/dist/{blocks-app-layout.provider-B0h8Ynag.d.ts → blocks-app-layout.provider-CDK1FNn8.d.ts} +1 -1
- package/dist/{chunk-ICC7VU5S.js → chunk-2QDH2N7Z.js} +6 -6
- package/dist/chunk-2QDH2N7Z.js.map +1 -0
- package/dist/{chunk-IDLLTKIG.cjs → chunk-AL2E2WC4.cjs} +21 -21
- package/dist/chunk-AL2E2WC4.cjs.map +1 -0
- package/dist/{chunk-PSYK3CIF.js → chunk-CC33UJZK.js} +7 -7
- package/dist/chunk-CC33UJZK.js.map +1 -0
- package/dist/{chunk-CYOTAUOX.js → chunk-CEXYN2ZD.js} +3 -3
- package/dist/chunk-CEXYN2ZD.js.map +1 -0
- package/dist/{chunk-2AHYFVPZ.js → chunk-ENK42YC4.js} +2 -2
- package/dist/chunk-ENK42YC4.js.map +1 -0
- package/dist/{chunk-432ILOO2.js → chunk-GWZQFBJ5.js} +4 -4
- package/dist/chunk-GWZQFBJ5.js.map +1 -0
- package/dist/{chunk-VLNRQEGU.cjs → chunk-H6RIPPT3.cjs} +102 -44
- package/dist/chunk-H6RIPPT3.cjs.map +1 -0
- package/dist/{chunk-DTL2IWSR.cjs → chunk-HF24SZFI.cjs} +7 -7
- package/dist/chunk-HF24SZFI.cjs.map +1 -0
- package/dist/{chunk-3A2IBUPM.js → chunk-M4AKVWL4.js} +4 -4
- package/dist/chunk-M4AKVWL4.js.map +1 -0
- package/dist/{chunk-JY6SQDRS.js → chunk-MCOK3TFE.js} +5 -5
- package/dist/chunk-MCOK3TFE.js.map +1 -0
- package/dist/{chunk-QIUPVNC3.js → chunk-MH5BEN2P.js} +88 -31
- package/dist/chunk-MH5BEN2P.js.map +1 -0
- package/dist/{chunk-7IDH2A7L.js → chunk-MWEREW2W.js} +2 -2
- package/dist/chunk-MWEREW2W.js.map +1 -0
- package/dist/{chunk-UDENCRUH.cjs → chunk-MXZIA4LA.cjs} +20 -20
- package/dist/chunk-MXZIA4LA.cjs.map +1 -0
- package/dist/{chunk-USALSR5X.js → chunk-NF54AHIF.js} +2 -2
- package/dist/chunk-NF54AHIF.js.map +1 -0
- package/dist/{chunk-ZYUTSSBP.cjs → chunk-P34SPTPD.cjs} +805 -766
- package/dist/chunk-P34SPTPD.cjs.map +1 -0
- package/dist/{chunk-VMQOFMEM.cjs → chunk-PSATBGVF.cjs} +26 -26
- package/dist/chunk-PSATBGVF.cjs.map +1 -0
- package/dist/{chunk-6A7VSGOJ.cjs → chunk-Q7Y32IBM.cjs} +2 -2
- package/dist/chunk-Q7Y32IBM.cjs.map +1 -0
- package/dist/{chunk-4FMWATPK.cjs → chunk-SDWR3F3Y.cjs} +2 -2
- package/dist/chunk-SDWR3F3Y.cjs.map +1 -0
- package/dist/{chunk-KXY33QAB.cjs → chunk-VAKGHXK6.cjs} +2 -2
- package/dist/chunk-VAKGHXK6.cjs.map +1 -0
- package/dist/{chunk-63ZVMUCD.cjs → chunk-VNUPOJ7H.cjs} +5 -5
- package/dist/chunk-VNUPOJ7H.cjs.map +1 -0
- package/dist/{chunk-BBK7W3YW.js → chunk-XMM33UUZ.js} +397 -358
- package/dist/chunk-XMM33UUZ.js.map +1 -0
- package/dist/{chunk-6GIOOEHR.js → chunk-XUQVWFG5.js} +2 -2
- package/dist/chunk-XUQVWFG5.js.map +1 -0
- package/dist/{chunk-2R476BM5.cjs → chunk-Z6N3Y5AQ.cjs} +8 -8
- package/dist/chunk-Z6N3Y5AQ.cjs.map +1 -0
- package/dist/{chunk-S5IVIAPZ.cjs → chunk-ZK3WUWET.cjs} +2 -2
- package/dist/chunk-ZK3WUWET.cjs.map +1 -0
- package/dist/components/index.cjs +349 -349
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +12 -12
- package/dist/guards/index.cjs +12 -12
- package/dist/guards/index.js +6 -6
- package/dist/hooks/index.cjs +66 -62
- package/dist/hooks/index.d.cts +11 -4
- package/dist/hooks/index.d.ts +11 -4
- package/dist/hooks/index.js +8 -8
- package/dist/index.cjs +524 -520
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -12
- package/dist/layouts/index.cjs +19 -19
- package/dist/layouts/index.js +12 -12
- package/dist/lib/index.cjs +22 -22
- package/dist/lib/index.d.cts +2 -2
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +3 -3
- package/dist/pages/index.cjs +17 -17
- package/dist/pages/index.js +12 -12
- package/dist/providers/index.cjs +11 -11
- package/dist/providers/index.d.cts +2 -2
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js +6 -6
- package/dist/{runtime-env-czBfLEUX.d.cts → runtime-env-BdtgvU0N.d.cts} +1 -1
- package/dist/{runtime-env-Ddi8Vo0I.d.ts → runtime-env-ByALSfkR.d.ts} +1 -1
- package/dist/{runtime.types-DO4gvqoG.d.cts → runtime.types-DfALkK5X.d.cts} +1 -1
- package/dist/{runtime.types-DO4gvqoG.d.ts → runtime.types-DfALkK5X.d.ts} +1 -1
- package/dist/store/index.cjs +9 -9
- package/dist/store/index.js +2 -2
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs +73 -73
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +5 -5
- package/package.json +3 -3
- package/dist/chunk-2AHYFVPZ.js.map +0 -1
- package/dist/chunk-2R476BM5.cjs.map +0 -1
- package/dist/chunk-3A2IBUPM.js.map +0 -1
- package/dist/chunk-432ILOO2.js.map +0 -1
- package/dist/chunk-4FMWATPK.cjs.map +0 -1
- package/dist/chunk-63ZVMUCD.cjs.map +0 -1
- package/dist/chunk-6A7VSGOJ.cjs.map +0 -1
- package/dist/chunk-6GIOOEHR.js.map +0 -1
- package/dist/chunk-7IDH2A7L.js.map +0 -1
- package/dist/chunk-BBK7W3YW.js.map +0 -1
- package/dist/chunk-CYOTAUOX.js.map +0 -1
- package/dist/chunk-DTL2IWSR.cjs.map +0 -1
- package/dist/chunk-ICC7VU5S.js.map +0 -1
- package/dist/chunk-IDLLTKIG.cjs.map +0 -1
- package/dist/chunk-JY6SQDRS.js.map +0 -1
- package/dist/chunk-KXY33QAB.cjs.map +0 -1
- package/dist/chunk-PSYK3CIF.js.map +0 -1
- package/dist/chunk-QIUPVNC3.js.map +0 -1
- package/dist/chunk-S5IVIAPZ.cjs.map +0 -1
- package/dist/chunk-UDENCRUH.cjs.map +0 -1
- package/dist/chunk-USALSR5X.js.map +0 -1
- package/dist/chunk-VLNRQEGU.cjs.map +0 -1
- package/dist/chunk-VMQOFMEM.cjs.map +0 -1
- package/dist/chunk-ZYUTSSBP.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
# @seliseblocks/genesis-os
|
|
2
|
-
|
|
3
|
-
## 4.0.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
# @seliseblocks/genesis-os
|
|
2
|
+
|
|
3
|
+
## 4.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- added filtering in app-switcher
|
|
8
|
+
|
|
9
|
+
## 4.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- Renamed the package from `@seliseblocks/blocks-kit` to `@seliseblocks/genesis-os`. Update the dependency name and all import paths; no exported API changed.
|
|
14
|
+
- Require React 19.2.8 or newer. Support for React 18 is dropped, as is React 19.0.0 through 19.2.7: the `react`, `react-dom`, and `@types/react` peer ranges are now `^19.2.8`.
|
|
15
|
+
- Switched the router peer from `react-router-dom@^7` to `react-router@^8`. `react-router-dom` is frozen at 7.18.1 and never received a v8, and every 7.x release is affected by GHSA-qwww-vcr4-c8h2 (RSC-mode CSRF bypass, high), which is only patched in `react-router@8.3.0`. Host applications must install `react-router@^8` and change their own `react-router-dom` imports to `react-router`; the exported symbols are unchanged.
|
|
16
|
+
- Raised the `nuqs` peer floor to `^2.9.0`. Earlier 2.x releases declare no `react-router@8` support and ship no `nuqs/adapters/react-router/v8` entry point. Applications wiring up nuqs should import `NuqsAdapter` from `nuqs/adapters/react-router/v8`.
|
|
17
|
+
|
|
18
|
+
Releases before 4.0.0 were published under the `@seliseblocks/blocks-kit` name on the `0.0.x` line.
|
|
19
|
+
|
|
20
|
+
## 0.0.66
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- fix project store issue after project create
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 SELISE <Blocks/>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SELISE <Blocks/>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,250 +1,250 @@
|
|
|
1
|
-
# @seliseblocks/genesis-os
|
|
2
|
-
|
|
3
|
-
React app-shell composition package for SELISE Blocks applications: guards, layouts, providers, pages, stores, hooks, an HTTP client, and a shadcn/Radix based component library. It is the shared frontend foundation consumed by the Blocks service applications (IAM, OS, Data, Logic, Monitor, Release, Studio, Utilities, Localization).
|
|
4
|
-
|
|
5
|
-
Ships as ESM and CJS with bundled TypeScript declarations. Every module carries a `"use client"` banner, and `sideEffects` is `false`, so bundlers can tree-shake unused exports.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @seliseblocks/genesis-os
|
|
11
|
-
# or
|
|
12
|
-
yarn add @seliseblocks/genesis-os
|
|
13
|
-
# or
|
|
14
|
-
pnpm add @seliseblocks/genesis-os
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Peer Dependencies
|
|
18
|
-
|
|
19
|
-
Your application must provide these packages (`@types/react` is optional, for TypeScript users):
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{
|
|
23
|
-
"@tanstack/react-query": "^5.0.0",
|
|
24
|
-
"nuqs": "^2.9.0",
|
|
25
|
-
"react": "^19.2.8",
|
|
26
|
-
"react-dom": "^19.2.8",
|
|
27
|
-
"react-router": "^8.0.0",
|
|
28
|
-
"zustand": "^5.0.0"
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Styling Contract
|
|
33
|
-
|
|
34
|
-
This package intentionally ships **no CSS files**. Host applications are responsible for:
|
|
35
|
-
|
|
36
|
-
- Tailwind CSS setup, including scanning this package's dist output so its utility classes are generated:
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
// tailwind.config.ts
|
|
40
|
-
export default {
|
|
41
|
-
content: ["./app/**/*.{ts,tsx}", "./node_modules/@seliseblocks/genesis-os/dist/**/*.{js,jsx,ts,tsx}"],
|
|
42
|
-
};
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
- Tailwind CSS setup
|
|
46
|
-
- shared design tokens (CSS variables) for theming
|
|
47
|
-
- Any global CSS imports required by their design system
|
|
48
|
-
|
|
49
|
-
## Runtime Configuration
|
|
50
|
-
|
|
51
|
-
Service base URLs and keys are read at runtime, not baked in at build time. Provide them on `window.__BLOCKS_ENV__` before the app boots (typically an inline script in `index.html`), or through `import.meta.env`:
|
|
52
|
-
|
|
53
|
-
```html
|
|
54
|
-
<script>
|
|
55
|
-
window.__BLOCKS_ENV__ = {
|
|
56
|
-
BLOCKS_IAM_BASE_URL: "https://iam.example.com",
|
|
57
|
-
BLOCKS_LOGIC_BASE_URL: "https://logic.example.com",
|
|
58
|
-
BLOCKS_X_BLOCKS_KEY: "your-blocks-key",
|
|
59
|
-
};
|
|
60
|
-
</script>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Read values with `getRuntimeEnv` from `@seliseblocks/genesis-os/lib`. The full key list is the `RuntimeKey` union exported from `@seliseblocks/genesis-os/types` (per-service `*_BASE_URL`, `*_CLIENT_ID`, and `*_CALLBACK_URL` keys plus `BLOCKS_X_BLOCKS_KEY` and others).
|
|
64
|
-
|
|
65
|
-
## Quick Start
|
|
66
|
-
|
|
67
|
-
Wrap your app in the providers, then compose routes from the guards, layouts, and pages:
|
|
68
|
-
|
|
69
|
-
```tsx
|
|
70
|
-
import { NuqsAdapter } from "nuqs/adapters/react-router/v8";
|
|
71
|
-
import { StrictMode } from "react";
|
|
72
|
-
import { createRoot } from "react-dom/client";
|
|
73
|
-
import { createBrowserRouter, Navigate, Outlet, RouterProvider } from "react-router";
|
|
74
|
-
|
|
75
|
-
import { AuthResolver, ProtectedGuard, PublicGuard } from "@seliseblocks/genesis-os/guards";
|
|
76
|
-
import { ConsoleLayout } from "@seliseblocks/genesis-os/layouts";
|
|
77
|
-
import { CallbackPage, ConsolePage, LoginPage, ProfilePage } from "@seliseblocks/genesis-os/pages";
|
|
78
|
-
import { BlocksAppLayout, QueryProvider, ThemeProvider } from "@seliseblocks/genesis-os/providers";
|
|
79
|
-
|
|
80
|
-
const router = createBrowserRouter([
|
|
81
|
-
{
|
|
82
|
-
path: "/login/callback",
|
|
83
|
-
element: <CallbackPage defaultRedirectUrl="/app/console" />,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
element: (
|
|
87
|
-
<AuthResolver>
|
|
88
|
-
<Outlet />
|
|
89
|
-
</AuthResolver>
|
|
90
|
-
),
|
|
91
|
-
children: [
|
|
92
|
-
{
|
|
93
|
-
element: (
|
|
94
|
-
<PublicGuard>
|
|
95
|
-
<Outlet />
|
|
96
|
-
</PublicGuard>
|
|
97
|
-
),
|
|
98
|
-
children: [{ path: "/login", element: <LoginPage /> }],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
path: "/app",
|
|
102
|
-
element: (
|
|
103
|
-
<ProtectedGuard>
|
|
104
|
-
<ConsoleLayout>
|
|
105
|
-
<Outlet />
|
|
106
|
-
</ConsoleLayout>
|
|
107
|
-
</ProtectedGuard>
|
|
108
|
-
),
|
|
109
|
-
children: [
|
|
110
|
-
{ index: true, element: <Navigate to="console" replace /> },
|
|
111
|
-
{ path: "console", element: <ConsolePage /> },
|
|
112
|
-
{ path: "profile", element: <ProfilePage /> },
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
]);
|
|
118
|
-
|
|
119
|
-
createRoot(document.getElementById("root")!).render(
|
|
120
|
-
<StrictMode>
|
|
121
|
-
<QueryProvider>
|
|
122
|
-
<ThemeProvider>
|
|
123
|
-
<NuqsAdapter>
|
|
124
|
-
<BlocksAppLayout
|
|
125
|
-
config={{
|
|
126
|
-
name: "blocks-monitor",
|
|
127
|
-
appLogoUrl: { dark: "/logo-dark.svg", light: "/logo-light.svg" },
|
|
128
|
-
}}
|
|
129
|
-
>
|
|
130
|
-
<RouterProvider router={router} />
|
|
131
|
-
</BlocksAppLayout>
|
|
132
|
-
</NuqsAdapter>
|
|
133
|
-
</ThemeProvider>
|
|
134
|
-
</QueryProvider>
|
|
135
|
-
</StrictMode>,
|
|
136
|
-
);
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
`BlocksAppLayout` takes a `config` with the service `name` (one of the `ServiceName` union values, for example `"blocks-os"` or `"blocks-monitor"`) and an `appLogoUrl` (a string, or `{ dark, light }` variants).
|
|
140
|
-
|
|
141
|
-
## Package Exports
|
|
142
|
-
|
|
143
|
-
The main entry (`@seliseblocks/genesis-os`) re-exports everything below. Subpath imports keep intent clearer and are what the Blocks applications use.
|
|
144
|
-
|
|
145
|
-
| Subpath | Contents |
|
|
146
|
-
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
|
-
| `./guards` | `AuthResolver`, `ProtectedGuard`, `PublicGuard`, `ImpersonationChecker`, `ImpersonationSynchronizer`, `ImpersonationTerminator` |
|
|
148
|
-
| `./layouts` | `AuthLayout`, `ConsoleLayout`, `DashboardLayout`, `DashboardRoute`, `OidcLayout`, `PublicLayout`, `useOidcContext` |
|
|
149
|
-
| `./providers` | `BlocksAppLayout`, `QueryProvider`, `ThemeProvider`, `DashboardLayoutProvider`, `getQueryClient` |
|
|
150
|
-
| `./pages` | `CallbackPage`, `ConsolePage`, `DashboardOverview`, `LoginPage`, `ProfilePage` |
|
|
151
|
-
| `./store` | `useAuthStore`, `useAppSettingsStore`, `useImpersonateStore`, `useLanguageViewStore`, `useProjectStore`, `useUserStore`, `CreateAppConfigStore` |
|
|
152
|
-
| `./hooks` | See [Hooks](#hooks) below |
|
|
153
|
-
| `./components` | See [Components](#components) below |
|
|
154
|
-
| `./lib` | See [HTTP Client and Lib](#http-client-and-lib) below |
|
|
155
|
-
| `./utils` | General-purpose helpers, see [Utils](#utils) below |
|
|
156
|
-
| `./models` | Domain models: `AuthStateShape`, `AuthTokenPair`, `BaseUser`, `UserDetails`, `IProject`, `IProjectGroup`, `IDomain`, `IEnvRepository`, `INotification`, `IMyOrganization`, `ImpersonationState`, `RegisteredService`, and related payload/response types |
|
|
157
|
-
| `./types` | Shared types: `ApiResponse`, `ApiError`, `ApiErrorResponse`, `ApiPaginatedResponse`, `BaseRequestParams`, `Menu`, `NavigationMenuItem`, `NavigationNode`, `RuntimeKey`, `ProjectKey`, `Id` |
|
|
158
|
-
|
|
159
|
-
### Components
|
|
160
|
-
|
|
161
|
-
`@seliseblocks/genesis-os/components` bundles two groups:
|
|
162
|
-
|
|
163
|
-
- **Core components** (Radix UI + shadcn based): `Accordion`, `Alert`, `AlertDialog`, `AspectRatio`, `Avatar`, `Badge`, `Breadcrumb`, `Button`, `Calendar`, `Card`, `Carousel`, `ChartContainer`, `Checkbox`, `Collapsible`, `Command`, `ContextMenu`, `CopyToClipboardButton`, `DateRangePicker`, `Dialog`, `Drawer`, `DropdownMenu`, `FileUploader`, `Form`, `HoverCard`, `InfiniteScroller`, `Input`, `InputOTP`, `KanbanBoard`, `Label`, `MaskedText`, `Menubar`, `MultiSelect`, `NavigationMenu`, `Pagination`, `PasswordInput`, `Popover`, `Progress`, `RadioGroup`, `RenderConditionally`, `RenderAlternatively`, `ResizablePanel`, `ScrollArea`, `Select`, `Separator`, `Sheet`, `Sidebar`, `Skeleton`, `Slider`, `Spinner`, `Stepper`, `Switch`, `Table`, `TablePagination`, `Tabs`, `Textarea`, `Timeline`, `Toast`, `Toaster`, `Toggle`, `ToggleGroup`, `Tooltip`, and the `WizardStepper` family, along with their subcomponents (`CardContent`, `DialogTrigger`, `SelectItem`, and so on).
|
|
164
|
-
|
|
165
|
-
- **Common composites**: `AppSwitcher`, `ArchiveProject`, `BackToConsoleNavigator`, `ConfirmationModal`, `ConsoleHeader`, `CopyableSnippet`, `DashboardHeader`, `DashboardSectionCard`, `DataTable`, `EnvironmentCard`, `EnvironmentList`, `EnvironmentSelected`, `ErrorBoundary`, `ErrorDisplay`, `FilterToolbar`, `ImportFileModal`, `LanguageSelector`, `LoaderSpinner`, `LoadingButton`, `LoginHeader`, `Logo`, `LogoutButton`, `ModeToggle`, `Notification`, `NotificationBell`, `NotificationHeader`, `NotificationItem`, `NotificationList`, `ProjectList`, `ProjectDetail`, `ProjectEdit`, `ProjectActions`, `SidebarMenu`, `ThemeSwitcher`, `UserDropdownMenu`, and more.
|
|
166
|
-
|
|
167
|
-
```tsx
|
|
168
|
-
import { Button, Card, CardContent } from "@seliseblocks/genesis-os/components";
|
|
169
|
-
|
|
170
|
-
function MyComponent() {
|
|
171
|
-
return (
|
|
172
|
-
<Card>
|
|
173
|
-
<CardContent>
|
|
174
|
-
<Button variant="default">Click Me</Button>
|
|
175
|
-
</CardContent>
|
|
176
|
-
</Card>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Hooks
|
|
182
|
-
|
|
183
|
-
State and UI helpers: `useBoolean`, `useCopyToClipboard`, `useCountDown`, `useDebounce`, `useMediaQuery`, `useIsMobile`, `usePathSegments`, `usePopoverWidth`, `useTheme`, `useToast`, `useIcon`, `useLogo`, `useScopedPath`, `useBlocksAppConfigStore`.
|
|
184
|
-
|
|
185
|
-
Search: `useFuseIndex`, `useFuseSearch`, `useDebouncedFuseFilter`.
|
|
186
|
-
|
|
187
|
-
Query helpers: `useQueryClientKit`, `useQueryStatesKit`, `createQueryKeyFactory`.
|
|
188
|
-
|
|
189
|
-
Domain data (TanStack Query backed): `useGetProject`, `useGetProjects`, `useUpdateProject`, `useDisableProject`, `useGetEnvRepositories`, `useGetAllServices`, `useGetMyOrganizations`, `useGetNotifications`, `useMarkAsRead`, `useMarkAllAsRead`, `useStartImpersonation`, `useStopImpersonation`, `useImpersonationStatusChecker`, `useInitiateRedirect`, `usePrefetchRedirect`, `useLanguage`, `useLanguageSwitcher`, `useLogout`, `useFilteredMenus`, `useIsActiveMenu`.
|
|
190
|
-
|
|
191
|
-
```tsx
|
|
192
|
-
import { useBoolean, useToast } from "@seliseblocks/genesis-os/hooks";
|
|
193
|
-
|
|
194
|
-
function MyComponent() {
|
|
195
|
-
const { toast } = useToast();
|
|
196
|
-
const { value: isOpen, toggle } = useBoolean(false);
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<button
|
|
200
|
-
onClick={() => {
|
|
201
|
-
toggle();
|
|
202
|
-
toast({ title: isOpen ? "Closed" : "Opened" });
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
Toggle
|
|
206
|
-
</button>
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### HTTP Client and Lib
|
|
212
|
-
|
|
213
|
-
`@seliseblocks/genesis-os/lib` exports:
|
|
214
|
-
|
|
215
|
-
- `HttpClient` and `HttpError`: a fetch-based client with Blocks key headers, token refresh queueing, and auth-failure redirects
|
|
216
|
-
- Preconfigured instances wired to the runtime env: `iamClient`, `logicClient`, `notificationClient`
|
|
217
|
-
- `getRuntimeEnv`, `createRuntimeEnvGetter`, `resolveBaseUrl`, `resolveEnv`
|
|
218
|
-
- `CookieStorage`, `cn`, theme helpers (`applyTheme`, `getSystemTheme`), and motion presets (`fadeInUp`, `fadeInScale`, `fadeTransition`, `motionEase`, `staggerContainer`, `staggerItem`)
|
|
219
|
-
|
|
220
|
-
```tsx
|
|
221
|
-
import { getRuntimeEnv, HttpClient, logicClient } from "@seliseblocks/genesis-os/lib";
|
|
222
|
-
|
|
223
|
-
// Use a preconfigured instance:
|
|
224
|
-
async function fetchProjects() {
|
|
225
|
-
return logicClient.get("/api/Project/Gets?page=0&pageSize=100");
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Or configure your own:
|
|
229
|
-
const client = new HttpClient({
|
|
230
|
-
baseURL: () => getRuntimeEnv("BLOCKS_LOGIC_BASE_URL"),
|
|
231
|
-
blocksKey: () => getRuntimeEnv("BLOCKS_X_BLOCKS_KEY"),
|
|
232
|
-
});
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Utils
|
|
236
|
-
|
|
237
|
-
`@seliseblocks/genesis-os/utils` covers formatting (`formatDate`, `formatFullDate`, `formatNumber`, `formatCurrency`, `formatBytes`, `formatFileSize`, `formatDuration`), objects and arrays (`pick`, `omit`, `deepClone`, `deepEqual`, `deepMerge`, `groupBy`, `uniqueBy`), functions (`debounce`, `throttle`, `memoize`, `sleep`), validation (`isEmail`, `isUrl`, `isUuid`, `isPhone`, `isValidDomain`, `isValidSubdomain`), query strings (`parseQueryString`, `stringifyQueryString`), ids (`generateId`, `getUniqueID`), storage (`createStorage`, `createCookieStore`), error handling (`getErrorMessage`, `handleErrorMessages`, `hasErrorCode`), and toast helpers (`showSuccessToast`, `showErrorToast`, `showInfoToast`).
|
|
238
|
-
|
|
239
|
-
## Versioning and Compatibility
|
|
240
|
-
|
|
241
|
-
- The package is on a `0.0.x` release line and is versioned and published with [Changesets](https://github.com/changesets/changesets). While the major version is 0, any release may contain breaking changes; pin or use a caret range consciously.
|
|
242
|
-
- This package is consumed by ten downstream Blocks service repositories. Its exported names, signatures, types, and defaults are treated as a public API; changes to them are coordinated across all consumers. See [CONTRIBUTING](https://github.com/SELISEdigitalplatforms/blocks-genesis-react/blob/main/CONTRIBUTING.md) in the repository.
|
|
243
|
-
|
|
244
|
-
## Changelog
|
|
245
|
-
|
|
246
|
-
Release notes are generated by Changesets into `CHANGELOG.md`, which is included in the published npm package.
|
|
247
|
-
|
|
248
|
-
## License
|
|
249
|
-
|
|
250
|
-
MIT (c) SELISE Blocks
|
|
1
|
+
# @seliseblocks/genesis-os
|
|
2
|
+
|
|
3
|
+
React app-shell composition package for SELISE Blocks applications: guards, layouts, providers, pages, stores, hooks, an HTTP client, and a shadcn/Radix based component library. It is the shared frontend foundation consumed by the Blocks service applications (IAM, OS, Data, Logic, Monitor, Release, Studio, Utilities, Localization).
|
|
4
|
+
|
|
5
|
+
Ships as ESM and CJS with bundled TypeScript declarations. Every module carries a `"use client"` banner, and `sideEffects` is `false`, so bundlers can tree-shake unused exports.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @seliseblocks/genesis-os
|
|
11
|
+
# or
|
|
12
|
+
yarn add @seliseblocks/genesis-os
|
|
13
|
+
# or
|
|
14
|
+
pnpm add @seliseblocks/genesis-os
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Peer Dependencies
|
|
18
|
+
|
|
19
|
+
Your application must provide these packages (`@types/react` is optional, for TypeScript users):
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"@tanstack/react-query": "^5.0.0",
|
|
24
|
+
"nuqs": "^2.9.0",
|
|
25
|
+
"react": "^19.2.8",
|
|
26
|
+
"react-dom": "^19.2.8",
|
|
27
|
+
"react-router": "^8.0.0",
|
|
28
|
+
"zustand": "^5.0.0"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Styling Contract
|
|
33
|
+
|
|
34
|
+
This package intentionally ships **no CSS files**. Host applications are responsible for:
|
|
35
|
+
|
|
36
|
+
- Tailwind CSS setup, including scanning this package's dist output so its utility classes are generated:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// tailwind.config.ts
|
|
40
|
+
export default {
|
|
41
|
+
content: ["./app/**/*.{ts,tsx}", "./node_modules/@seliseblocks/genesis-os/dist/**/*.{js,jsx,ts,tsx}"],
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Tailwind CSS setup
|
|
46
|
+
- shared design tokens (CSS variables) for theming
|
|
47
|
+
- Any global CSS imports required by their design system
|
|
48
|
+
|
|
49
|
+
## Runtime Configuration
|
|
50
|
+
|
|
51
|
+
Service base URLs and keys are read at runtime, not baked in at build time. Provide them on `window.__BLOCKS_ENV__` before the app boots (typically an inline script in `index.html`), or through `import.meta.env`:
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<script>
|
|
55
|
+
window.__BLOCKS_ENV__ = {
|
|
56
|
+
BLOCKS_IAM_BASE_URL: "https://iam.example.com",
|
|
57
|
+
BLOCKS_LOGIC_BASE_URL: "https://logic.example.com",
|
|
58
|
+
BLOCKS_X_BLOCKS_KEY: "your-blocks-key",
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Read values with `getRuntimeEnv` from `@seliseblocks/genesis-os/lib`. The full key list is the `RuntimeKey` union exported from `@seliseblocks/genesis-os/types` (per-service `*_BASE_URL`, `*_CLIENT_ID`, and `*_CALLBACK_URL` keys plus `BLOCKS_X_BLOCKS_KEY` and others).
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
Wrap your app in the providers, then compose routes from the guards, layouts, and pages:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { NuqsAdapter } from "nuqs/adapters/react-router/v8";
|
|
71
|
+
import { StrictMode } from "react";
|
|
72
|
+
import { createRoot } from "react-dom/client";
|
|
73
|
+
import { createBrowserRouter, Navigate, Outlet, RouterProvider } from "react-router";
|
|
74
|
+
|
|
75
|
+
import { AuthResolver, ProtectedGuard, PublicGuard } from "@seliseblocks/genesis-os/guards";
|
|
76
|
+
import { ConsoleLayout } from "@seliseblocks/genesis-os/layouts";
|
|
77
|
+
import { CallbackPage, ConsolePage, LoginPage, ProfilePage } from "@seliseblocks/genesis-os/pages";
|
|
78
|
+
import { BlocksAppLayout, QueryProvider, ThemeProvider } from "@seliseblocks/genesis-os/providers";
|
|
79
|
+
|
|
80
|
+
const router = createBrowserRouter([
|
|
81
|
+
{
|
|
82
|
+
path: "/login/callback",
|
|
83
|
+
element: <CallbackPage defaultRedirectUrl="/app/console" />,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
element: (
|
|
87
|
+
<AuthResolver>
|
|
88
|
+
<Outlet />
|
|
89
|
+
</AuthResolver>
|
|
90
|
+
),
|
|
91
|
+
children: [
|
|
92
|
+
{
|
|
93
|
+
element: (
|
|
94
|
+
<PublicGuard>
|
|
95
|
+
<Outlet />
|
|
96
|
+
</PublicGuard>
|
|
97
|
+
),
|
|
98
|
+
children: [{ path: "/login", element: <LoginPage /> }],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
path: "/app",
|
|
102
|
+
element: (
|
|
103
|
+
<ProtectedGuard>
|
|
104
|
+
<ConsoleLayout>
|
|
105
|
+
<Outlet />
|
|
106
|
+
</ConsoleLayout>
|
|
107
|
+
</ProtectedGuard>
|
|
108
|
+
),
|
|
109
|
+
children: [
|
|
110
|
+
{ index: true, element: <Navigate to="console" replace /> },
|
|
111
|
+
{ path: "console", element: <ConsolePage /> },
|
|
112
|
+
{ path: "profile", element: <ProfilePage /> },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
]);
|
|
118
|
+
|
|
119
|
+
createRoot(document.getElementById("root")!).render(
|
|
120
|
+
<StrictMode>
|
|
121
|
+
<QueryProvider>
|
|
122
|
+
<ThemeProvider>
|
|
123
|
+
<NuqsAdapter>
|
|
124
|
+
<BlocksAppLayout
|
|
125
|
+
config={{
|
|
126
|
+
name: "blocks-monitor",
|
|
127
|
+
appLogoUrl: { dark: "/logo-dark.svg", light: "/logo-light.svg" },
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
<RouterProvider router={router} />
|
|
131
|
+
</BlocksAppLayout>
|
|
132
|
+
</NuqsAdapter>
|
|
133
|
+
</ThemeProvider>
|
|
134
|
+
</QueryProvider>
|
|
135
|
+
</StrictMode>,
|
|
136
|
+
);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`BlocksAppLayout` takes a `config` with the service `name` (one of the `ServiceName` union values, for example `"blocks-os"` or `"blocks-monitor"`) and an `appLogoUrl` (a string, or `{ dark, light }` variants).
|
|
140
|
+
|
|
141
|
+
## Package Exports
|
|
142
|
+
|
|
143
|
+
The main entry (`@seliseblocks/genesis-os`) re-exports everything below. Subpath imports keep intent clearer and are what the Blocks applications use.
|
|
144
|
+
|
|
145
|
+
| Subpath | Contents |
|
|
146
|
+
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
|
+
| `./guards` | `AuthResolver`, `ProtectedGuard`, `PublicGuard`, `ImpersonationChecker`, `ImpersonationSynchronizer`, `ImpersonationTerminator` |
|
|
148
|
+
| `./layouts` | `AuthLayout`, `ConsoleLayout`, `DashboardLayout`, `DashboardRoute`, `OidcLayout`, `PublicLayout`, `useOidcContext` |
|
|
149
|
+
| `./providers` | `BlocksAppLayout`, `QueryProvider`, `ThemeProvider`, `DashboardLayoutProvider`, `getQueryClient` |
|
|
150
|
+
| `./pages` | `CallbackPage`, `ConsolePage`, `DashboardOverview`, `LoginPage`, `ProfilePage` |
|
|
151
|
+
| `./store` | `useAuthStore`, `useAppSettingsStore`, `useImpersonateStore`, `useLanguageViewStore`, `useProjectStore`, `useUserStore`, `CreateAppConfigStore` |
|
|
152
|
+
| `./hooks` | See [Hooks](#hooks) below |
|
|
153
|
+
| `./components` | See [Components](#components) below |
|
|
154
|
+
| `./lib` | See [HTTP Client and Lib](#http-client-and-lib) below |
|
|
155
|
+
| `./utils` | General-purpose helpers, see [Utils](#utils) below |
|
|
156
|
+
| `./models` | Domain models: `AuthStateShape`, `AuthTokenPair`, `BaseUser`, `UserDetails`, `IProject`, `IProjectGroup`, `IDomain`, `IEnvRepository`, `INotification`, `IMyOrganization`, `ImpersonationState`, `RegisteredService`, and related payload/response types |
|
|
157
|
+
| `./types` | Shared types: `ApiResponse`, `ApiError`, `ApiErrorResponse`, `ApiPaginatedResponse`, `BaseRequestParams`, `Menu`, `NavigationMenuItem`, `NavigationNode`, `RuntimeKey`, `ProjectKey`, `Id` |
|
|
158
|
+
|
|
159
|
+
### Components
|
|
160
|
+
|
|
161
|
+
`@seliseblocks/genesis-os/components` bundles two groups:
|
|
162
|
+
|
|
163
|
+
- **Core components** (Radix UI + shadcn based): `Accordion`, `Alert`, `AlertDialog`, `AspectRatio`, `Avatar`, `Badge`, `Breadcrumb`, `Button`, `Calendar`, `Card`, `Carousel`, `ChartContainer`, `Checkbox`, `Collapsible`, `Command`, `ContextMenu`, `CopyToClipboardButton`, `DateRangePicker`, `Dialog`, `Drawer`, `DropdownMenu`, `FileUploader`, `Form`, `HoverCard`, `InfiniteScroller`, `Input`, `InputOTP`, `KanbanBoard`, `Label`, `MaskedText`, `Menubar`, `MultiSelect`, `NavigationMenu`, `Pagination`, `PasswordInput`, `Popover`, `Progress`, `RadioGroup`, `RenderConditionally`, `RenderAlternatively`, `ResizablePanel`, `ScrollArea`, `Select`, `Separator`, `Sheet`, `Sidebar`, `Skeleton`, `Slider`, `Spinner`, `Stepper`, `Switch`, `Table`, `TablePagination`, `Tabs`, `Textarea`, `Timeline`, `Toast`, `Toaster`, `Toggle`, `ToggleGroup`, `Tooltip`, and the `WizardStepper` family, along with their subcomponents (`CardContent`, `DialogTrigger`, `SelectItem`, and so on).
|
|
164
|
+
|
|
165
|
+
- **Common composites**: `AppSwitcher`, `ArchiveProject`, `BackToConsoleNavigator`, `ConfirmationModal`, `ConsoleHeader`, `CopyableSnippet`, `DashboardHeader`, `DashboardSectionCard`, `DataTable`, `EnvironmentCard`, `EnvironmentList`, `EnvironmentSelected`, `ErrorBoundary`, `ErrorDisplay`, `FilterToolbar`, `ImportFileModal`, `LanguageSelector`, `LoaderSpinner`, `LoadingButton`, `LoginHeader`, `Logo`, `LogoutButton`, `ModeToggle`, `Notification`, `NotificationBell`, `NotificationHeader`, `NotificationItem`, `NotificationList`, `ProjectList`, `ProjectDetail`, `ProjectEdit`, `ProjectActions`, `SidebarMenu`, `ThemeSwitcher`, `UserDropdownMenu`, and more.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
import { Button, Card, CardContent } from "@seliseblocks/genesis-os/components";
|
|
169
|
+
|
|
170
|
+
function MyComponent() {
|
|
171
|
+
return (
|
|
172
|
+
<Card>
|
|
173
|
+
<CardContent>
|
|
174
|
+
<Button variant="default">Click Me</Button>
|
|
175
|
+
</CardContent>
|
|
176
|
+
</Card>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Hooks
|
|
182
|
+
|
|
183
|
+
State and UI helpers: `useBoolean`, `useCopyToClipboard`, `useCountDown`, `useDebounce`, `useMediaQuery`, `useIsMobile`, `usePathSegments`, `usePopoverWidth`, `useTheme`, `useToast`, `useIcon`, `useLogo`, `useScopedPath`, `useBlocksAppConfigStore`.
|
|
184
|
+
|
|
185
|
+
Search: `useFuseIndex`, `useFuseSearch`, `useDebouncedFuseFilter`.
|
|
186
|
+
|
|
187
|
+
Query helpers: `useQueryClientKit`, `useQueryStatesKit`, `createQueryKeyFactory`.
|
|
188
|
+
|
|
189
|
+
Domain data (TanStack Query backed): `useGetProject`, `useGetProjects`, `useUpdateProject`, `useDisableProject`, `useGetEnvRepositories`, `useGetAllServices`, `useGetMyOrganizations`, `useGetNotifications`, `useMarkAsRead`, `useMarkAllAsRead`, `useStartImpersonation`, `useStopImpersonation`, `useImpersonationStatusChecker`, `useInitiateRedirect`, `usePrefetchRedirect`, `useLanguage`, `useLanguageSwitcher`, `useLogout`, `useFilteredMenus`, `useIsActiveMenu`.
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
import { useBoolean, useToast } from "@seliseblocks/genesis-os/hooks";
|
|
193
|
+
|
|
194
|
+
function MyComponent() {
|
|
195
|
+
const { toast } = useToast();
|
|
196
|
+
const { value: isOpen, toggle } = useBoolean(false);
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<button
|
|
200
|
+
onClick={() => {
|
|
201
|
+
toggle();
|
|
202
|
+
toast({ title: isOpen ? "Closed" : "Opened" });
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
205
|
+
Toggle
|
|
206
|
+
</button>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### HTTP Client and Lib
|
|
212
|
+
|
|
213
|
+
`@seliseblocks/genesis-os/lib` exports:
|
|
214
|
+
|
|
215
|
+
- `HttpClient` and `HttpError`: a fetch-based client with Blocks key headers, token refresh queueing, and auth-failure redirects
|
|
216
|
+
- Preconfigured instances wired to the runtime env: `iamClient`, `logicClient`, `notificationClient`
|
|
217
|
+
- `getRuntimeEnv`, `createRuntimeEnvGetter`, `resolveBaseUrl`, `resolveEnv`
|
|
218
|
+
- `CookieStorage`, `cn`, theme helpers (`applyTheme`, `getSystemTheme`), and motion presets (`fadeInUp`, `fadeInScale`, `fadeTransition`, `motionEase`, `staggerContainer`, `staggerItem`)
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
import { getRuntimeEnv, HttpClient, logicClient } from "@seliseblocks/genesis-os/lib";
|
|
222
|
+
|
|
223
|
+
// Use a preconfigured instance:
|
|
224
|
+
async function fetchProjects() {
|
|
225
|
+
return logicClient.get("/api/Project/Gets?page=0&pageSize=100");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Or configure your own:
|
|
229
|
+
const client = new HttpClient({
|
|
230
|
+
baseURL: () => getRuntimeEnv("BLOCKS_LOGIC_BASE_URL"),
|
|
231
|
+
blocksKey: () => getRuntimeEnv("BLOCKS_X_BLOCKS_KEY"),
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Utils
|
|
236
|
+
|
|
237
|
+
`@seliseblocks/genesis-os/utils` covers formatting (`formatDate`, `formatFullDate`, `formatNumber`, `formatCurrency`, `formatBytes`, `formatFileSize`, `formatDuration`), objects and arrays (`pick`, `omit`, `deepClone`, `deepEqual`, `deepMerge`, `groupBy`, `uniqueBy`), functions (`debounce`, `throttle`, `memoize`, `sleep`), validation (`isEmail`, `isUrl`, `isUuid`, `isPhone`, `isValidDomain`, `isValidSubdomain`), query strings (`parseQueryString`, `stringifyQueryString`), ids (`generateId`, `getUniqueID`), storage (`createStorage`, `createCookieStore`), error handling (`getErrorMessage`, `handleErrorMessages`, `hasErrorCode`), and toast helpers (`showSuccessToast`, `showErrorToast`, `showInfoToast`).
|
|
238
|
+
|
|
239
|
+
## Versioning and Compatibility
|
|
240
|
+
|
|
241
|
+
- The package is on a `0.0.x` release line and is versioned and published with [Changesets](https://github.com/changesets/changesets). While the major version is 0, any release may contain breaking changes; pin or use a caret range consciously.
|
|
242
|
+
- This package is consumed by ten downstream Blocks service repositories. Its exported names, signatures, types, and defaults are treated as a public API; changes to them are coordinated across all consumers. See [CONTRIBUTING](https://github.com/SELISEdigitalplatforms/blocks-genesis-react/blob/main/CONTRIBUTING.md) in the repository.
|
|
243
|
+
|
|
244
|
+
## Changelog
|
|
245
|
+
|
|
246
|
+
Release notes are generated by Changesets into `CHANGELOG.md`, which is included in the published npm package.
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
MIT (c) SELISE Blocks
|
package/dist/{blocks-app-layout.provider-NoJHvUfO.d.cts → blocks-app-layout.provider-C831nKua.d.cts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { a as AppConfigStoreState } from './app-config.store-PZM7lSZN.cjs';
|
|
3
|
-
import { R as RuntimeKey } from './runtime.types-
|
|
3
|
+
import { R as RuntimeKey } from './runtime.types-DfALkK5X.cjs';
|
|
4
4
|
|
|
5
5
|
type BlocksAppLayoutProps = {
|
|
6
6
|
children: React.ReactNode;
|
package/dist/{blocks-app-layout.provider-B0h8Ynag.d.ts → blocks-app-layout.provider-CDK1FNn8.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { a as AppConfigStoreState } from './app-config.store-PZM7lSZN.js';
|
|
3
|
-
import { R as RuntimeKey } from './runtime.types-
|
|
3
|
+
import { R as RuntimeKey } from './runtime.types-DfALkK5X.js';
|
|
4
4
|
|
|
5
5
|
type BlocksAppLayoutProps = {
|
|
6
6
|
children: React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useImpersonationStatusChecker, useStopImpersonation, useStartImpersonation, useGetProjects, projectService } from './chunk-
|
|
2
|
-
import { iamClient, AUTH_ENDPOINTS, HttpError } from './chunk-
|
|
3
|
-
import { useImpersonateStore } from './chunk-
|
|
4
|
-
import { useAuthStore, useProjectStore } from './chunk-
|
|
1
|
+
import { useImpersonationStatusChecker, useStopImpersonation, useStartImpersonation, useGetProjects, projectService } from './chunk-MCOK3TFE.js';
|
|
2
|
+
import { iamClient, AUTH_ENDPOINTS, HttpError } from './chunk-GWZQFBJ5.js';
|
|
3
|
+
import { useImpersonateStore } from './chunk-CEXYN2ZD.js';
|
|
4
|
+
import { useAuthStore, useProjectStore } from './chunk-ENK42YC4.js';
|
|
5
5
|
import { useEffect, useRef, useState, useCallback } from 'react';
|
|
6
6
|
import { useNavigate } from 'react-router';
|
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
@@ -243,5 +243,5 @@ function ImpersonationSynchronizer({
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
export { AppLoadingSpinner, AuthResolver, ImpersonationChecker, ImpersonationSynchronizer, ImpersonationTerminator, ProtectedGuard, PublicGuard };
|
|
246
|
-
//# sourceMappingURL=chunk-
|
|
247
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
//# sourceMappingURL=chunk-2QDH2N7Z.js.map
|
|
247
|
+
//# sourceMappingURL=chunk-2QDH2N7Z.js.map
|