@moh-sso/state 0.0.0-stage → 1.3.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/README.md +21 -2
- package/dist/_types/packages/api/src/api/baseApi.d.ts +2 -0
- package/dist/_types/packages/api/src/index.d.ts +1 -0
- package/dist/_types/packages/auth/src/auth/auth.slice.d.ts +14 -0
- package/dist/_types/packages/auth/src/auth/auth.types.d.ts +61 -0
- package/dist/_types/packages/config/src/appMeta.d.ts +3 -0
- package/dist/_types/packages/config/src/index.d.ts +6 -0
- package/dist/_types/packages/config/src/lib/constants/api.constants.d.ts +178 -0
- package/dist/_types/packages/config/src/lib/constants/document-templates.d.ts +11 -0
- package/dist/_types/packages/config/src/lib/errors/errorMessages.d.ts +2 -0
- package/dist/_types/packages/config/src/lib/errors/errorSeverity.d.ts +3 -0
- package/dist/_types/packages/config/src/lib/errors/errorTypes.d.ts +1 -0
- package/dist/_types/packages/state/src/clients/clients.selectors.d.ts +534 -0
- package/dist/_types/packages/state/src/clients/clients.slice.d.ts +4 -0
- package/dist/_types/packages/state/src/document/documents.selectors.d.ts +1 -0
- package/dist/_types/packages/state/src/index.d.ts +29 -0
- package/dist/_types/packages/state/src/ui/ui.state.d.ts +1 -0
- package/dist/_types/packages/types/src/index.d.ts +6 -0
- package/dist/_types/packages/types/src/types/announcement-summary.types.d.ts +16 -0
- package/dist/_types/packages/types/src/types/client-role.types.d.ts +6 -0
- package/dist/_types/packages/types/src/types/client.types.d.ts +46 -0
- package/dist/_types/packages/types/src/types/document-processing.types.d.ts +1 -0
- package/dist/_types/packages/types/src/types/notifications.types.d.ts +96 -0
- package/dist/_types/packages/types/src/types/system-navigation.types.d.ts +18 -0
- package/dist/_types/packages/ui/src/accessibility/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/accessibility/useFocusTrap.d.ts +10 -0
- package/dist/_types/packages/ui/src/branding/BuildMeta.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/PublicFooter.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/data-display/DataTablePagination.d.ts +12 -0
- package/dist/_types/packages/ui/src/data-display/DataTableShell.d.ts +35 -0
- package/dist/_types/packages/ui/src/data-display/RowActionsCell.d.ts +7 -0
- package/dist/_types/packages/ui/src/data-display/TableEmptyState.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/TableStatusTag.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/comingsoon/ComingSoon.d.ts +7 -0
- package/dist/_types/packages/ui/src/feedback/emptystate/EmptyState.d.ts +15 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/ErrorState.d.ts +14 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/MicrofrontendErrorBoundary.d.ts +16 -0
- package/dist/_types/packages/ui/src/feedback/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/loadingstate/LoadingState.d.ts +5 -0
- package/dist/_types/packages/ui/src/forms/CaseFormsGrid.d.ts +1 -0
- package/dist/_types/packages/ui/src/forms/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/index.d.ts +16 -0
- package/dist/_types/packages/ui/src/layout/PageShell/PageShell.d.ts +9 -0
- package/dist/_types/packages/ui/src/layout/SectionCard/SectionCard.d.ts +11 -0
- package/dist/_types/packages/ui/src/layout/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppGridContent.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenu.component.d.ts +6 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenuItem.component.d.ts +13 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/appMenuGroups.d.ts +11 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/AppBreadcrumbs.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/BreadcrumbBar.d.ts +10 -0
- package/dist/_types/packages/ui/src/navigation/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/sidenav/ClientSideNav.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/FormInlineAlert.d.ts +7 -0
- package/dist/_types/packages/ui/src/notifications/NotificationsPanel.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/notifications/toast/ToastProvider.d.ts +20 -0
- package/dist/_types/packages/ui/src/notifications/toast/useToast.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/ReusableHeaderPanel.d.ts +17 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/header-panel.context.d.ts +23 -0
- package/dist/_types/packages/ui/src/overlays/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/overlays/modal/ReusableModal.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/modal/modal.context.d.ts +14 -0
- package/dist/_types/packages/ui/src/shell/ExternalAppHeader.d.ts +22 -0
- package/dist/_types/packages/ui/src/shell/PublicHeader.component.d.ts +8 -0
- package/dist/_types/packages/ui/src/shell/UserHeader.component.d.ts +17 -0
- package/dist/_types/packages/ui/src/shell/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/theme/ThemeProvider.d.ts +8 -0
- package/dist/_types/packages/ui/src/theme/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/utils/severity.d.ts +22 -0
- package/dist/_types/packages/ui/src/utils/status.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +100 -0
- package/package.json +38 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ReusableModalProps } from "./ReusableModal";
|
|
3
|
+
type ModalState = Omit<ReusableModalProps, "open"> & {
|
|
4
|
+
open: boolean;
|
|
5
|
+
};
|
|
6
|
+
type ModalContextType = {
|
|
7
|
+
openModal: (config: Omit<ModalState, "open">) => void;
|
|
8
|
+
closeModal: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function ModalProvider({ children }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
export declare function useModal(): ModalContextType;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ExternalAppLink = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
/** Absolute HTTP(S) launch URL approved by the application's backend. */
|
|
5
|
+
href: string;
|
|
6
|
+
};
|
|
7
|
+
export type ExternalAppHeaderProps = {
|
|
8
|
+
appName: string;
|
|
9
|
+
username: string;
|
|
10
|
+
/** Absolute portal launcher URL, including its deployment base path. */
|
|
11
|
+
portalUrl: string;
|
|
12
|
+
/** Supply only applications this user may launch. No portal API is called here. */
|
|
13
|
+
applications?: ExternalAppLink[];
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
onRetry?: () => void;
|
|
17
|
+
onProfile: () => void;
|
|
18
|
+
/** End the local application session and initiate the application's OIDC logout. */
|
|
19
|
+
onLogout: () => void;
|
|
20
|
+
};
|
|
21
|
+
/** Shared MOH chrome for independently hosted React apps. Requires no portal auth/store/router. */
|
|
22
|
+
export declare function ExternalAppHeader({ appName, username, portalUrl, applications, isLoading, isError, onRetry, onProfile, onLogout, }: ExternalAppHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type UserHeaderProps = {
|
|
4
|
+
appName?: string;
|
|
5
|
+
homeHref?: string;
|
|
6
|
+
username?: string | null;
|
|
7
|
+
appMenu?: ReactNode;
|
|
8
|
+
contextSelector?: ReactNode;
|
|
9
|
+
onNavigateHome?: () => void;
|
|
10
|
+
onLogout?: () => void;
|
|
11
|
+
onProfile?: () => void;
|
|
12
|
+
navigationExpanded?: boolean;
|
|
13
|
+
onToggleNavigation?: () => void;
|
|
14
|
+
onGlobalAction?: () => void;
|
|
15
|
+
};
|
|
16
|
+
declare const UserHeader: React.FC<UserHeaderProps>;
|
|
17
|
+
export default UserHeader;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as PublicHeader } from "./PublicHeader.component";
|
|
2
|
+
export { default as UserHeader } from "./UserHeader.component";
|
|
3
|
+
export type { UserHeaderProps } from "./UserHeader.component";
|
|
4
|
+
export { ExternalAppHeader } from "./ExternalAppHeader";
|
|
5
|
+
export type { ExternalAppHeaderProps, ExternalAppLink } from "./ExternalAppHeader";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type MohTheme = "white" | "g10" | "g90" | "g100";
|
|
3
|
+
type MohThemeProviderProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
theme?: MohTheme;
|
|
6
|
+
};
|
|
7
|
+
export declare function MohThemeProvider({ children, theme }: MohThemeProviderProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MohThemeProvider } from "./ThemeProvider";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ---------------------------------------------------
|
|
3
|
+
* Domain Severity (Business Layer)
|
|
4
|
+
* ---------------------------------------------------
|
|
5
|
+
*/
|
|
6
|
+
export type Severity = "info" | "success" | "warning" | "critical" | "danger";
|
|
7
|
+
/**
|
|
8
|
+
* ---------------------------------------------------
|
|
9
|
+
* Carbon Tag Type
|
|
10
|
+
* ---------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
export type CarbonTagType = "red" | "magenta" | "purple" | "blue" | "cyan" | "teal" | "green" | "gray" | "cool-gray" | "warm-gray" | "high-contrast" | "outline";
|
|
13
|
+
export declare function isSeverity(value: unknown): value is Severity;
|
|
14
|
+
export declare function normalizeSeverity(value?: string | null): Severity;
|
|
15
|
+
/**
|
|
16
|
+
* ---------------------------------------------------
|
|
17
|
+
* Public Helpers
|
|
18
|
+
* ---------------------------------------------------
|
|
19
|
+
*/
|
|
20
|
+
export declare const getSeverityTagType: (severity?: string | null) => CarbonTagType;
|
|
21
|
+
export declare const getSeverityLabel: (severity?: string | null) => string;
|
|
22
|
+
export declare const getSeverityRank: (severity?: string | null) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./_types/packages/state/src/index.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createSlice as i, createSelector as c, configureStore as u } from "@reduxjs/toolkit";
|
|
2
|
+
import { baseApi as n } from "@moh-sso/api";
|
|
3
|
+
const d = {
|
|
4
|
+
accessToken: null,
|
|
5
|
+
user: null,
|
|
6
|
+
loading: !0,
|
|
7
|
+
loaded: !1,
|
|
8
|
+
isAuthenticated: !1
|
|
9
|
+
}, s = i({
|
|
10
|
+
name: "auth",
|
|
11
|
+
initialState: d,
|
|
12
|
+
reducers: {
|
|
13
|
+
/* ---------------------------
|
|
14
|
+
* Bootstrap finished
|
|
15
|
+
* --------------------------- */
|
|
16
|
+
authLoaded(e) {
|
|
17
|
+
e.loading = !1, e.loaded = !0, e.isAuthenticated = !!e.user;
|
|
18
|
+
},
|
|
19
|
+
/* ---------------------------
|
|
20
|
+
* Successful login / refresh
|
|
21
|
+
*
|
|
22
|
+
* Access token is optional because backend stores it
|
|
23
|
+
* in an HttpOnly cookie.
|
|
24
|
+
* --------------------------- */
|
|
25
|
+
loginSuccess(e, t) {
|
|
26
|
+
e.user = t.payload.user, e.accessToken = t.payload.accessToken ?? null, e.isAuthenticated = !0, e.loading = !1, e.loaded = !0;
|
|
27
|
+
},
|
|
28
|
+
/* ---------------------------
|
|
29
|
+
* Token refresh only
|
|
30
|
+
*
|
|
31
|
+
* Kept for backward compatibility.
|
|
32
|
+
* Prefer not using this with HttpOnly cookies.
|
|
33
|
+
* --------------------------- */
|
|
34
|
+
setAccessToken(e, t) {
|
|
35
|
+
e.accessToken = t.payload;
|
|
36
|
+
},
|
|
37
|
+
/* ---------------------------
|
|
38
|
+
* Logout
|
|
39
|
+
* --------------------------- */
|
|
40
|
+
logout(e) {
|
|
41
|
+
e.accessToken = null, e.user = null, e.loading = !1, e.loaded = !0, e.isAuthenticated = !1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}), { loginSuccess: g, logout: k, setAccessToken: I, authLoaded: T } = s.actions, C = s.reducer, S = {
|
|
45
|
+
items: [],
|
|
46
|
+
activeClientId: null
|
|
47
|
+
}, a = i({
|
|
48
|
+
name: "clients",
|
|
49
|
+
initialState: S,
|
|
50
|
+
reducers: {
|
|
51
|
+
setClients(e, t) {
|
|
52
|
+
e.items = t.payload;
|
|
53
|
+
},
|
|
54
|
+
setActiveClient(e, t) {
|
|
55
|
+
e.activeClientId = t.payload;
|
|
56
|
+
},
|
|
57
|
+
clearActiveClient(e) {
|
|
58
|
+
e.activeClientId = null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}), { setClients: y, setActiveClient: b, clearActiveClient: w } = a.actions, h = a.reducer, o = (e) => e.clients, m = c(o, (e) => e.items), p = c(o, (e) => e.activeClientId), l = c(
|
|
62
|
+
[m, p],
|
|
63
|
+
(e, t) => e.find((r) => r.clientId === t) ?? e[0] ?? null
|
|
64
|
+
), A = (e) => {
|
|
65
|
+
if (!e) return null;
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(e);
|
|
68
|
+
} catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}, N = c(l, (e) => {
|
|
72
|
+
const t = e?.attributes?.["ui.sidenav"];
|
|
73
|
+
return A(t) ?? [];
|
|
74
|
+
}), J = c(
|
|
75
|
+
l,
|
|
76
|
+
(e) => e?.attributes?.["ui.icon"] ?? "app"
|
|
77
|
+
), L = c(
|
|
78
|
+
l,
|
|
79
|
+
(e) => e?.attributes?.["ui.home"] ?? "/"
|
|
80
|
+
), O = u({
|
|
81
|
+
reducer: {
|
|
82
|
+
auth: C,
|
|
83
|
+
clients: h,
|
|
84
|
+
[n.reducerPath]: n.reducer
|
|
85
|
+
},
|
|
86
|
+
middleware: (e) => e().concat(n.middleware)
|
|
87
|
+
});
|
|
88
|
+
export {
|
|
89
|
+
w as clearActiveClient,
|
|
90
|
+
l as selectActiveClient,
|
|
91
|
+
p as selectActiveClientId,
|
|
92
|
+
L as selectClientHome,
|
|
93
|
+
J as selectClientIcon,
|
|
94
|
+
N as selectClientSideNav,
|
|
95
|
+
m as selectClients,
|
|
96
|
+
o as selectClientsState,
|
|
97
|
+
b as setActiveClient,
|
|
98
|
+
y as setClients,
|
|
99
|
+
O as store
|
|
100
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moh-sso/state",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"version": "1.3.2",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"package.json"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "vite build --config vite.config.ts && node ../../scripts/write-package-declarations.mjs package state"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@moh-sso/api": "^1.3.2",
|
|
28
|
+
"@moh-sso/auth": "^1.3.2",
|
|
29
|
+
"@moh-sso/types": "^1.3.2"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@reduxjs/toolkit": "^2.11.2"
|
|
33
|
+
},
|
|
34
|
+
"private": false,
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/mohuganda/moh-sso-dashboard.git",
|
|
38
|
+
"directory": "frontend/packages/state"
|
|
39
|
+
}
|
|
40
|
+
}
|