@eintrek/erp-shell 0.1.10 → 0.1.11
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/dist/auth/permission-gate-shell.d.ts +22 -0
- package/dist/auth/permission-provider.d.ts +44 -0
- package/dist/auth/permission-utils.d.ts +22 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +259 -59
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +260 -55
- package/dist/index.js.map +1 -1
- package/dist/navigation/app-layout-shell.d.ts +59 -0
- package/package.json +2 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Shape the shell needs from an organization to wire the URL `[code]` segment
|
|
4
|
+
* back to the active org id. Hosts already keep richer types around — this is
|
|
5
|
+
* deliberately the smallest subset to avoid leaking app-specific generics.
|
|
6
|
+
*/
|
|
7
|
+
export interface AppLayoutShellOrganization {
|
|
8
|
+
id: string | number;
|
|
9
|
+
code?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface AppLayoutShellProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The sidebar (app-specific, fed with the app's navigation data). Rendered
|
|
15
|
+
* inside a fixed positioning context — `closeOnNavigation` etc. is the
|
|
16
|
+
* sidebar's own concern; read layout state via `useSidebar()` if needed.
|
|
17
|
+
*/
|
|
18
|
+
sidebar: React.ReactNode;
|
|
19
|
+
/** App-branded loading screen — shown while the session is loading or a
|
|
20
|
+
* redirect is in flight. */
|
|
21
|
+
loadingComponent: React.ReactNode;
|
|
22
|
+
/** App-branded breadcrumb (the host wires in its label map). Defaults to
|
|
23
|
+
* empty so apps that don't want one can skip it. */
|
|
24
|
+
breadcrumb?: React.ReactNode;
|
|
25
|
+
/** Optional wrapper around the page content — typically the app's
|
|
26
|
+
* PermissionProvider, which feeds per-app permission rules into the
|
|
27
|
+
* shared PermissionRulesContext. Identity function when omitted. */
|
|
28
|
+
permissionProvider?: (children: React.ReactNode) => React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Active org id from the host's ERP context (cookie-backed). Used to detect
|
|
31
|
+
* URL-vs-context mismatch when the user opens a bookmark for a different
|
|
32
|
+
* org. Don't read it from a hook in the shell — each app composes its own
|
|
33
|
+
* ERP context on top of `useOrganizationIdState`.
|
|
34
|
+
*/
|
|
35
|
+
organizationId: string | number | null | undefined;
|
|
36
|
+
/** Setter from the host's ERP context, used to sync URL → context when the
|
|
37
|
+
* `[code]` segment doesn't match the cookie. */
|
|
38
|
+
setOrganizationId: (id: string | number | null) => Promise<void> | void;
|
|
39
|
+
/** Orgs the user belongs to — used to resolve URL `[code]` → org `id`. */
|
|
40
|
+
organizations: AppLayoutShellOrganization[];
|
|
41
|
+
/** Absolute path to redirect to when the session has no accessToken (e.g.
|
|
42
|
+
* token refresh failed). The shell appends `?error=NoAccessToken&callbackUrl=…`. */
|
|
43
|
+
signInUrl: string;
|
|
44
|
+
/** Absolute path to redirect to when the URL has no `[code]` segment. */
|
|
45
|
+
selectOrganizationUrl: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Top-level app chrome: sticky header, sidebar slot, content gutter and the
|
|
49
|
+
* session/org-context plumbing that both Accounting and HR need. Apps wrap
|
|
50
|
+
* it inside their `SidebarProvider` (server-rendered with the cookie-backed
|
|
51
|
+
* `defaultOpen`) and their `ERPProvider`, then pass app-specific bits as
|
|
52
|
+
* props.
|
|
53
|
+
*
|
|
54
|
+
* The padding contract is deliberately owned here so future style tweaks
|
|
55
|
+
* (e.g. the recent left/right/bottom gutter pass) propagate to both apps via
|
|
56
|
+
* an erp-shell bump — domain components must NOT add their own root padding
|
|
57
|
+
* or content gets indented twice.
|
|
58
|
+
*/
|
|
59
|
+
export declare function AppLayoutShell({ children, sidebar, loadingComponent, breadcrumb, permissionProvider, organizationId, setOrganizationId, organizations, signInUrl, selectOrganizationUrl, }: AppLayoutShellProps): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eintrek/erp-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Shared frontend platform for ERP apps — HTTP client, providers, navigation, hooks.",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
43
43
|
"@tanstack/react-query": "^5.90.2",
|
|
44
44
|
"@tanstack/react-query-devtools": "^5.90.2",
|
|
45
|
-
"@eintrek/erp-theme": "
|
|
45
|
+
"@eintrek/erp-theme": "^1.4.3",
|
|
46
46
|
"@types/node": "^22.13.0",
|
|
47
47
|
"@types/react": "^19.0.0",
|
|
48
48
|
"@types/react-dom": "^19.0.0",
|