@crystaltech/hsms-shared-ui 0.0.5 → 0.0.7

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.
@@ -0,0 +1 @@
1
+ export declare const ForbiddenPage: () => import("react/jsx-runtime").JSX.Element;
@@ -1,26 +1,30 @@
1
1
  import { default as React } from 'react';
2
- export interface User {
2
+ export interface UserInfo {
3
3
  sub?: string;
4
4
  email?: string;
5
5
  name?: string;
6
6
  preferred_username?: string;
7
- image?: string;
8
7
  given_name?: string;
9
8
  family_name?: string;
9
+ organization_id?: string;
10
+ hospital_id?: string;
11
+ image?: string;
10
12
  realm_access?: {
11
13
  roles?: string[];
12
14
  };
13
15
  resource_access?: {
14
- account?: {
15
- roles?: string[];
16
+ [client: string]: {
17
+ roles: string[];
16
18
  };
17
19
  };
18
20
  }
19
21
  export interface ProtectedRouteProps {
20
- user?: User;
21
- authenticated?: boolean;
22
- children: React.ReactNode;
23
- redirectPath?: string;
22
+ user: UserInfo | null;
23
+ authenticated: boolean;
24
24
  roles?: string[];
25
+ clients?: string[];
26
+ redirectPath?: string;
27
+ children: React.ReactNode;
25
28
  }
26
29
  export declare const ProtectedRoute: React.FC<ProtectedRouteProps>;
30
+ export declare const hasAccess: (user: UserInfo | null, roles?: string[], clients?: string[]) => boolean;
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ActionFunction, LoaderFunction } from 'react-router-dom';
3
3
  import { ILayoutConfig } from '../components/layout/MainLayout';
4
- import { User } from './ProtectedRoute';
4
+ import { UserInfo } from './ProtectedRoute';
5
5
  interface RouteCommon {
6
6
  loader?: LoaderFunction;
7
7
  action?: ActionFunction;
@@ -14,9 +14,10 @@ export interface IPages {
14
14
  }
15
15
  interface RoutesConfigLayoutProps {
16
16
  pageTitle: string;
17
- user: User;
17
+ user: UserInfo;
18
18
  authenticated: boolean;
19
19
  userRoles?: string[];
20
+ clients?: string[];
20
21
  loginMethod: () => void;
21
22
  logoutHandler: () => void;
22
23
  redirectPath?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@crystaltech/hsms-shared-ui",
3
3
  "private": false,
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
File without changes