@nubitio/admin 1.3.1 → 1.4.0
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/index.cjs +31 -61
- package/dist/index.d.cts +35 -91
- package/dist/index.d.mts +35 -91
- package/dist/index.mjs +29 -58
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,17 +20,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let react_router_dom = require("react-router-dom");
|
|
25
24
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
26
25
|
let react = require("react");
|
|
27
|
-
react = __toESM(react, 1);
|
|
28
26
|
let _nubitio_ui = require("@nubitio/ui");
|
|
29
27
|
let _nubitio_core = require("@nubitio/core");
|
|
30
28
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
31
29
|
let _nubitio_crud = require("@nubitio/crud");
|
|
32
30
|
let _nubitio_hydra = require("@nubitio/hydra");
|
|
33
|
-
|
|
31
|
+
react = __toESM(react, 1);
|
|
32
|
+
// packages/admin/FeatureHubLayout.tsx
|
|
34
33
|
function normalizeIcon(icon) {
|
|
35
34
|
if (!icon) return void 0;
|
|
36
35
|
if (icon.startsWith("ph ")) return icon;
|
|
@@ -104,8 +103,7 @@ function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner
|
|
|
104
103
|
]
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
|
-
|
|
108
|
-
//#region packages/admin/AdminHeader.tsx
|
|
106
|
+
// packages/admin/AdminHeader.tsx
|
|
109
107
|
function ActionPopover({ action }) {
|
|
110
108
|
const { open, toggle, setOpen, containerRef } = (0, _nubitio_ui.useFloatingPanel)();
|
|
111
109
|
if (action.onClick) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -203,8 +201,7 @@ const AdminHeader = ({ title, menuToggleEnabled, toggleMenu, className, actions
|
|
|
203
201
|
})
|
|
204
202
|
});
|
|
205
203
|
};
|
|
206
|
-
|
|
207
|
-
//#region packages/admin/useScreenSize.ts
|
|
204
|
+
// packages/admin/useScreenSize.ts
|
|
208
205
|
let handlers = [];
|
|
209
206
|
const xSmallMedia = window.matchMedia("(max-width: 575.98px)");
|
|
210
207
|
const smallMedia = window.matchMedia("(min-width: 576px) and (max-width: 991.98px)");
|
|
@@ -255,8 +252,7 @@ const useScreenSizeClass = () => {
|
|
|
255
252
|
if (isSmall) return "screen-small";
|
|
256
253
|
return "screen-x-small";
|
|
257
254
|
};
|
|
258
|
-
|
|
259
|
-
//#region packages/admin/AdminSidebarMenu.tsx
|
|
255
|
+
// packages/admin/AdminSidebarMenu.tsx
|
|
260
256
|
const normalizeRoute = (path) => {
|
|
261
257
|
if (!path) return "";
|
|
262
258
|
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
@@ -390,8 +386,7 @@ const AdminSidebarMenu = ({ items, compactMode = false, selectedItemChanged, ope
|
|
|
390
386
|
]
|
|
391
387
|
});
|
|
392
388
|
};
|
|
393
|
-
|
|
394
|
-
//#region packages/admin/AdminShell.tsx
|
|
389
|
+
// packages/admin/AdminShell.tsx
|
|
395
390
|
const AdminShell = ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant = "default", brand, headerContent, sidebarContext, bottomNavigation, children }) => {
|
|
396
391
|
const navigate = (0, react_router_dom.useNavigate)();
|
|
397
392
|
const strings = (0, _nubitio_ui.useUiStrings)();
|
|
@@ -502,8 +497,7 @@ const AdminShell = ({ title, menuItems, headerActions, renderUserMenu, renderThe
|
|
|
502
497
|
]
|
|
503
498
|
});
|
|
504
499
|
};
|
|
505
|
-
|
|
506
|
-
//#region packages/admin/AdminBottomNavigation.tsx
|
|
500
|
+
// packages/admin/AdminBottomNavigation.tsx
|
|
507
501
|
function AdminBottomNavigation({ items, label }) {
|
|
508
502
|
const { pathname } = (0, react_router_dom.useLocation)();
|
|
509
503
|
const strings = (0, _nubitio_ui.useUiStrings)();
|
|
@@ -534,8 +528,7 @@ function AdminBottomNavigation({ items, label }) {
|
|
|
534
528
|
}, item.path))
|
|
535
529
|
});
|
|
536
530
|
}
|
|
537
|
-
|
|
538
|
-
//#region packages/admin/auth/csrfFetch.ts
|
|
531
|
+
// packages/admin/auth/csrfFetch.ts
|
|
539
532
|
const MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
540
533
|
"POST",
|
|
541
534
|
"PUT",
|
|
@@ -563,8 +556,7 @@ function csrfFetch(input, init = {}) {
|
|
|
563
556
|
headers
|
|
564
557
|
});
|
|
565
558
|
}
|
|
566
|
-
|
|
567
|
-
//#region packages/admin/auth/SessionContext.tsx
|
|
559
|
+
// packages/admin/auth/SessionContext.tsx
|
|
568
560
|
const SessionContext = (0, react.createContext)(null);
|
|
569
561
|
function joinApiPath$7(apiBaseUrl, path) {
|
|
570
562
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
@@ -635,8 +627,7 @@ function StaticSessionProvider({ profile, children }) {
|
|
|
635
627
|
children
|
|
636
628
|
});
|
|
637
629
|
}
|
|
638
|
-
|
|
639
|
-
//#region packages/admin/hooks/useFeature.ts
|
|
630
|
+
// packages/admin/hooks/useFeature.ts
|
|
640
631
|
function useFeature(featureKey) {
|
|
641
632
|
const { session } = useSession();
|
|
642
633
|
if (session.status !== "authenticated") return false;
|
|
@@ -649,8 +640,7 @@ function useFeatureConfig(featureKey) {
|
|
|
649
640
|
if (!entry?.enabled) return {};
|
|
650
641
|
return entry.config ?? {};
|
|
651
642
|
}
|
|
652
|
-
|
|
653
|
-
//#region packages/admin/features/FeatureGate.tsx
|
|
643
|
+
// packages/admin/features/FeatureGate.tsx
|
|
654
644
|
function FeatureGate({ featureKey, ...props }) {
|
|
655
645
|
const enabled = useFeature(featureKey);
|
|
656
646
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_nubitio_ui.FeatureGate, {
|
|
@@ -659,8 +649,7 @@ function FeatureGate({ featureKey, ...props }) {
|
|
|
659
649
|
...props
|
|
660
650
|
});
|
|
661
651
|
}
|
|
662
|
-
|
|
663
|
-
//#region packages/admin/quota/QuotaUsageBanner.tsx
|
|
652
|
+
// packages/admin/quota/QuotaUsageBanner.tsx
|
|
664
653
|
function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel = "View plans", className = "" }) {
|
|
665
654
|
if (max <= 0) return null;
|
|
666
655
|
const atLimit = count >= max;
|
|
@@ -690,8 +679,7 @@ function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, ne
|
|
|
690
679
|
function quotaUsageAboveGrid(banner) {
|
|
691
680
|
return () => banner;
|
|
692
681
|
}
|
|
693
|
-
|
|
694
|
-
//#region packages/admin/billing/PlanPanel.tsx
|
|
682
|
+
// packages/admin/billing/PlanPanel.tsx
|
|
695
683
|
function formatTrialEnds(iso) {
|
|
696
684
|
const date = new Date(iso);
|
|
697
685
|
if (Number.isNaN(date.getTime())) return iso;
|
|
@@ -779,8 +767,7 @@ function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSe
|
|
|
779
767
|
})]
|
|
780
768
|
});
|
|
781
769
|
}
|
|
782
|
-
|
|
783
|
-
//#region packages/admin/quota/parseQuotaError.ts
|
|
770
|
+
// packages/admin/quota/parseQuotaError.ts
|
|
784
771
|
function readErrorDetail(error) {
|
|
785
772
|
if (typeof error !== "object" || error === null) return "";
|
|
786
773
|
const record = error;
|
|
@@ -808,8 +795,7 @@ function quotaErrorToastMessage(quota, labels) {
|
|
|
808
795
|
const label = labels?.[quota.resource] ?? quota.resource;
|
|
809
796
|
return `Plan limit reached: ${quota.current}/${quota.limit} ${label}. Upgrade your plan to continue.`;
|
|
810
797
|
}
|
|
811
|
-
|
|
812
|
-
//#region packages/admin/quota/useQuotaUsage.ts
|
|
798
|
+
// packages/admin/quota/useQuotaUsage.ts
|
|
813
799
|
function readCollectionTotal(body) {
|
|
814
800
|
if (Array.isArray(body)) return body.length;
|
|
815
801
|
if (typeof body !== "object" || body === null) return 0;
|
|
@@ -846,8 +832,7 @@ function useQuotaUsage({ featureKey, collectionPath, staleTimeMs = 1e4 }) {
|
|
|
846
832
|
refetch
|
|
847
833
|
};
|
|
848
834
|
}
|
|
849
|
-
|
|
850
|
-
//#region packages/admin/notifications/useNotifications.ts
|
|
835
|
+
// packages/admin/notifications/useNotifications.ts
|
|
851
836
|
/** Reads a Hydra collection body (`hydra:member`) or a plain array — same shape useQuotaUsage relies on. */
|
|
852
837
|
function readCollectionItems(body) {
|
|
853
838
|
if (Array.isArray(body)) return body;
|
|
@@ -886,8 +871,7 @@ function useNotifications({ apiUrl = "/api/notifications", staleTimeMs = 1e4 } =
|
|
|
886
871
|
refetch: query.refetch
|
|
887
872
|
};
|
|
888
873
|
}
|
|
889
|
-
|
|
890
|
-
//#region packages/admin/notifications/NotificationPanel.tsx
|
|
874
|
+
// packages/admin/notifications/NotificationPanel.tsx
|
|
891
875
|
function formatRelativeTime(iso) {
|
|
892
876
|
const date = new Date(iso);
|
|
893
877
|
if (Number.isNaN(date.getTime())) return "";
|
|
@@ -959,8 +943,7 @@ function NotificationPanel({ title = "Notifications", emptyTitle = "You're all c
|
|
|
959
943
|
]
|
|
960
944
|
});
|
|
961
945
|
}
|
|
962
|
-
|
|
963
|
-
//#region packages/admin/auth/LoginPage.tsx
|
|
946
|
+
// packages/admin/auth/LoginPage.tsx
|
|
964
947
|
function joinApiPath$6(apiBaseUrl, path) {
|
|
965
948
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
966
949
|
}
|
|
@@ -1092,8 +1075,7 @@ function LoginPage({ onLoggedIn, apiBaseUrl = "/api/", loginPath = "auth/login",
|
|
|
1092
1075
|
}) })
|
|
1093
1076
|
});
|
|
1094
1077
|
}
|
|
1095
|
-
|
|
1096
|
-
//#region packages/admin/auth/ForgotPasswordPage.tsx
|
|
1078
|
+
// packages/admin/auth/ForgotPasswordPage.tsx
|
|
1097
1079
|
function joinApiPath$5(apiBaseUrl, path) {
|
|
1098
1080
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1099
1081
|
}
|
|
@@ -1164,8 +1146,7 @@ function ForgotPasswordPage({ apiBaseUrl = "/api/" }) {
|
|
|
1164
1146
|
}) })
|
|
1165
1147
|
});
|
|
1166
1148
|
}
|
|
1167
|
-
|
|
1168
|
-
//#region packages/admin/auth/ResetPasswordPage.tsx
|
|
1149
|
+
// packages/admin/auth/ResetPasswordPage.tsx
|
|
1169
1150
|
function joinApiPath$4(apiBaseUrl, path) {
|
|
1170
1151
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1171
1152
|
}
|
|
@@ -1260,8 +1241,7 @@ function ResetPasswordPage({ apiBaseUrl = "/api/" }) {
|
|
|
1260
1241
|
}) })
|
|
1261
1242
|
});
|
|
1262
1243
|
}
|
|
1263
|
-
|
|
1264
|
-
//#region packages/admin/auth/AcceptInvitationPage.tsx
|
|
1244
|
+
// packages/admin/auth/AcceptInvitationPage.tsx
|
|
1265
1245
|
function joinApiPath$3(apiBaseUrl, path) {
|
|
1266
1246
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1267
1247
|
}
|
|
@@ -1377,8 +1357,7 @@ function AcceptInvitationPage({ apiBaseUrl = "/api/" }) {
|
|
|
1377
1357
|
}) })
|
|
1378
1358
|
});
|
|
1379
1359
|
}
|
|
1380
|
-
|
|
1381
|
-
//#region packages/admin/auth/AccountPage.tsx
|
|
1360
|
+
// packages/admin/auth/AccountPage.tsx
|
|
1382
1361
|
function joinApiPath$2(apiBaseUrl, path) {
|
|
1383
1362
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1384
1363
|
}
|
|
@@ -1664,8 +1643,7 @@ function AccountPage({ apiBaseUrl = "/api/" }) {
|
|
|
1664
1643
|
]
|
|
1665
1644
|
});
|
|
1666
1645
|
}
|
|
1667
|
-
|
|
1668
|
-
//#region packages/admin/auth/RegisterPage.tsx
|
|
1646
|
+
// packages/admin/auth/RegisterPage.tsx
|
|
1669
1647
|
function joinApiPath$1(apiBaseUrl, path) {
|
|
1670
1648
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1671
1649
|
}
|
|
@@ -1784,8 +1762,7 @@ function RegisterPage({ fields, onRegistered, apiBaseUrl = "/api/", registerPath
|
|
|
1784
1762
|
}) })
|
|
1785
1763
|
});
|
|
1786
1764
|
}
|
|
1787
|
-
|
|
1788
|
-
//#region packages/admin/runtime/useAppRuntime.ts
|
|
1765
|
+
// packages/admin/runtime/useAppRuntime.ts
|
|
1789
1766
|
function useAppRuntime() {
|
|
1790
1767
|
const [toasts, setToasts] = (0, react.useState)([]);
|
|
1791
1768
|
const dismiss = (0, react.useCallback)((id) => {
|
|
@@ -1813,8 +1790,7 @@ function useAppRuntime() {
|
|
|
1813
1790
|
dismiss
|
|
1814
1791
|
};
|
|
1815
1792
|
}
|
|
1816
|
-
|
|
1817
|
-
//#region packages/admin/runtime/useRuntimeConfig.ts
|
|
1793
|
+
// packages/admin/runtime/useRuntimeConfig.ts
|
|
1818
1794
|
function joinApiPath(apiBaseUrl, path) {
|
|
1819
1795
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1820
1796
|
}
|
|
@@ -1856,8 +1832,7 @@ function useRuntimeConfig({ apiBaseUrl = "/api/", path = "runtime-config", enabl
|
|
|
1856
1832
|
refresh
|
|
1857
1833
|
};
|
|
1858
1834
|
}
|
|
1859
|
-
|
|
1860
|
-
//#region packages/admin/runtime/ToastHost.tsx
|
|
1835
|
+
// packages/admin/runtime/ToastHost.tsx
|
|
1861
1836
|
const TYPE_CLASS = {
|
|
1862
1837
|
success: "nb-toast--success",
|
|
1863
1838
|
error: "nb-toast--error",
|
|
@@ -1881,8 +1856,7 @@ function ToastHost({ toasts, onDismiss }) {
|
|
|
1881
1856
|
}, toast.id))
|
|
1882
1857
|
});
|
|
1883
1858
|
}
|
|
1884
|
-
|
|
1885
|
-
//#region packages/admin/devtools/NubitDevToolsPanel.tsx
|
|
1859
|
+
// packages/admin/devtools/NubitDevToolsPanel.tsx
|
|
1886
1860
|
const PROVIDER_TREE = [
|
|
1887
1861
|
"MercureProvider",
|
|
1888
1862
|
"SchemaProvider",
|
|
@@ -2033,8 +2007,7 @@ function NubitDevToolsPanel() {
|
|
|
2033
2007
|
})]
|
|
2034
2008
|
});
|
|
2035
2009
|
}
|
|
2036
|
-
|
|
2037
|
-
//#region packages/admin/app/ErrorBoundary.tsx
|
|
2010
|
+
// packages/admin/app/ErrorBoundary.tsx
|
|
2038
2011
|
/**
|
|
2039
2012
|
* Keeps a thrown field renderer from taking the whole admin down with it.
|
|
2040
2013
|
*/
|
|
@@ -2081,8 +2054,7 @@ var ErrorBoundary = class extends react.Component {
|
|
|
2081
2054
|
});
|
|
2082
2055
|
}
|
|
2083
2056
|
};
|
|
2084
|
-
|
|
2085
|
-
//#region packages/admin/app/filterMenuByRoles.ts
|
|
2057
|
+
// packages/admin/app/filterMenuByRoles.ts
|
|
2086
2058
|
function hasAnyRole(required, roles) {
|
|
2087
2059
|
if (required === void 0) return true;
|
|
2088
2060
|
return (Array.isArray(required) ? required : [required]).some((role) => roles.includes(role));
|
|
@@ -2120,8 +2092,7 @@ function filterMenuByRoles(items, roles) {
|
|
|
2120
2092
|
function resolveAppMenu(menu, ctx) {
|
|
2121
2093
|
return typeof menu === "function" ? menu(ctx) : menu;
|
|
2122
2094
|
}
|
|
2123
|
-
|
|
2124
|
-
//#region packages/admin/app/createNubitApp.tsx
|
|
2095
|
+
// packages/admin/app/createNubitApp.tsx
|
|
2125
2096
|
function defaultUserMenu({ username, close, logout }) {
|
|
2126
2097
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2127
2098
|
style: {
|
|
@@ -2320,7 +2291,6 @@ function createNubitApp(config) {
|
|
|
2320
2291
|
}
|
|
2321
2292
|
return { App };
|
|
2322
2293
|
}
|
|
2323
|
-
//#endregion
|
|
2324
2294
|
exports.AcceptInvitationPage = AcceptInvitationPage;
|
|
2325
2295
|
exports.AccountPage = AccountPage;
|
|
2326
2296
|
exports.AdminBottomNavigation = AdminBottomNavigation;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,6 @@ import React$1, { ReactNode } from "react";
|
|
|
2
2
|
import { FeatureGateProps as FeatureGateProps$1, ThemeProviderProps } from "@nubitio/ui";
|
|
3
3
|
import { CoreRuntime } from "@nubitio/core";
|
|
4
4
|
import { QueryClient } from "@tanstack/react-query";
|
|
5
|
-
//#region packages/admin/FeatureHubLayout.d.ts
|
|
6
5
|
interface FeatureHubTab {
|
|
7
6
|
key: string;
|
|
8
7
|
label: string;
|
|
@@ -32,9 +31,7 @@ interface FeatureHubLayoutProps {
|
|
|
32
31
|
density?: FeatureHubDensity;
|
|
33
32
|
className?: string;
|
|
34
33
|
}
|
|
35
|
-
declare function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner, tabsAriaLabel, density, className }: FeatureHubLayoutProps): import("react").JSX.Element;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region packages/admin/AdminHeader.d.ts
|
|
34
|
+
export declare function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner, tabsAriaLabel, density, className }: FeatureHubLayoutProps): import("react").JSX.Element;
|
|
38
35
|
interface AdminHeaderAction {
|
|
39
36
|
id: string;
|
|
40
37
|
icon: string;
|
|
@@ -59,9 +56,7 @@ interface AdminHeaderProps {
|
|
|
59
56
|
}) => React$1.ReactNode;
|
|
60
57
|
renderThemeSwitcher?: () => React$1.ReactNode;
|
|
61
58
|
}
|
|
62
|
-
declare const AdminHeader: ({ title, menuToggleEnabled, toggleMenu, className, actions, content, renderUserMenu, renderThemeSwitcher }: AdminHeaderProps) => React$1.JSX.Element;
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region packages/admin/AdminSidebarMenu.d.ts
|
|
59
|
+
export declare const AdminHeader: ({ title, menuToggleEnabled, toggleMenu, className, actions, content, renderUserMenu, renderThemeSwitcher }: AdminHeaderProps) => React$1.JSX.Element;
|
|
65
60
|
interface AdminMenuSubItem {
|
|
66
61
|
text: string;
|
|
67
62
|
path: string;
|
|
@@ -86,9 +81,7 @@ interface AdminSidebarMenuProps {
|
|
|
86
81
|
brand?: React$1.ReactNode;
|
|
87
82
|
context?: React$1.ReactNode;
|
|
88
83
|
}
|
|
89
|
-
declare const AdminSidebarMenu: ({ items, compactMode, selectedItemChanged, openMenu, footer, brand, context }: AdminSidebarMenuProps) => React$1.JSX.Element;
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region packages/admin/AdminShell.d.ts
|
|
84
|
+
export declare const AdminSidebarMenu: ({ items, compactMode, selectedItemChanged, openMenu, footer, brand, context }: AdminSidebarMenuProps) => React$1.JSX.Element;
|
|
92
85
|
interface AdminShellProps {
|
|
93
86
|
title?: string;
|
|
94
87
|
menuItems: AdminMenuItem[];
|
|
@@ -108,9 +101,7 @@ interface AdminShellProps {
|
|
|
108
101
|
bottomNavigation?: React$1.ReactNode;
|
|
109
102
|
children: React$1.ReactNode;
|
|
110
103
|
}
|
|
111
|
-
declare const AdminShell: ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant, brand, headerContent, sidebarContext, bottomNavigation, children }: AdminShellProps) => React$1.JSX.Element;
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region packages/admin/AdminBottomNavigation.d.ts
|
|
104
|
+
export declare const AdminShell: ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant, brand, headerContent, sidebarContext, bottomNavigation, children }: AdminShellProps) => React$1.JSX.Element;
|
|
114
105
|
interface AdminBottomNavigationItem {
|
|
115
106
|
text: string;
|
|
116
107
|
path: string;
|
|
@@ -122,18 +113,14 @@ interface AdminBottomNavigationProps {
|
|
|
122
113
|
items: AdminBottomNavigationItem[];
|
|
123
114
|
label?: string;
|
|
124
115
|
}
|
|
125
|
-
declare function AdminBottomNavigation({ items, label }: AdminBottomNavigationProps): import("react").JSX.Element;
|
|
126
|
-
|
|
127
|
-
//#region packages/admin/useScreenSize.d.ts
|
|
128
|
-
declare const useScreenSize: () => {
|
|
116
|
+
export declare function AdminBottomNavigation({ items, label }: AdminBottomNavigationProps): import("react").JSX.Element;
|
|
117
|
+
export declare const useScreenSize: () => {
|
|
129
118
|
isXSmall: boolean;
|
|
130
119
|
isSmall: boolean;
|
|
131
120
|
isMedium: boolean;
|
|
132
121
|
isLarge: boolean;
|
|
133
122
|
};
|
|
134
|
-
declare const useScreenSizeClass: () => "screen-large" | "screen-medium" | "screen-small" | "screen-x-small";
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region packages/admin/auth/SessionContext.d.ts
|
|
123
|
+
export declare const useScreenSizeClass: () => "screen-large" | "screen-medium" | "screen-small" | "screen-x-small";
|
|
137
124
|
type AppProfile = 'internal' | 'saas' | 'hybrid';
|
|
138
125
|
type SessionTenant = {
|
|
139
126
|
id?: number;
|
|
@@ -186,25 +173,19 @@ interface SessionContextValue {
|
|
|
186
173
|
roles: string[];
|
|
187
174
|
username: string | null;
|
|
188
175
|
}
|
|
189
|
-
declare function SessionProvider({ apiBaseUrl, mePath, logoutPath, children }: SessionProviderConfig & {
|
|
176
|
+
export declare function SessionProvider({ apiBaseUrl, mePath, logoutPath, children }: SessionProviderConfig & {
|
|
190
177
|
children: React$1.ReactNode;
|
|
191
178
|
}): React$1.JSX.Element;
|
|
192
|
-
declare function useSession(): SessionContextValue;
|
|
179
|
+
export declare function useSession(): SessionContextValue;
|
|
193
180
|
/** Seeds session state from a known profile (e.g. after a custom /api/me fetch). */
|
|
194
|
-
declare function StaticSessionProvider({ profile, children }: {
|
|
181
|
+
export declare function StaticSessionProvider({ profile, children }: {
|
|
195
182
|
profile: SessionProfile;
|
|
196
183
|
children: React$1.ReactNode;
|
|
197
184
|
}): React$1.JSX.Element;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
declare function useFeature(featureKey: string): boolean;
|
|
201
|
-
declare function useFeatureConfig(featureKey: string): Record<string, unknown>;
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region packages/admin/features/FeatureGate.d.ts
|
|
185
|
+
export declare function useFeature(featureKey: string): boolean;
|
|
186
|
+
export declare function useFeatureConfig(featureKey: string): Record<string, unknown>;
|
|
204
187
|
type FeatureGateProps = Omit<FeatureGateProps$1, 'enabled'>;
|
|
205
|
-
declare function FeatureGate({ featureKey, ...props }: FeatureGateProps): React$1.JSX.Element;
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region packages/admin/quota/QuotaUsageBanner.d.ts
|
|
188
|
+
export declare function FeatureGate({ featureKey, ...props }: FeatureGateProps): React$1.JSX.Element;
|
|
208
189
|
interface QuotaUsageBannerProps {
|
|
209
190
|
count: number;
|
|
210
191
|
max: number;
|
|
@@ -217,10 +198,8 @@ interface QuotaUsageBannerProps {
|
|
|
217
198
|
upgradeLabel?: string;
|
|
218
199
|
className?: string;
|
|
219
200
|
}
|
|
220
|
-
declare function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel, className }: QuotaUsageBannerProps): import("react").JSX.Element | null;
|
|
221
|
-
declare function quotaUsageAboveGrid(banner: ReactNode): () => ReactNode;
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region packages/admin/billing/PlanPanel.d.ts
|
|
201
|
+
export declare function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel, className }: QuotaUsageBannerProps): import("react").JSX.Element | null;
|
|
202
|
+
export declare function quotaUsageAboveGrid(banner: ReactNode): () => ReactNode;
|
|
224
203
|
interface PlanDefinition {
|
|
225
204
|
id: string;
|
|
226
205
|
name: string;
|
|
@@ -247,25 +226,21 @@ interface PlanPanelProps {
|
|
|
247
226
|
labels?: PlanPanelLabels;
|
|
248
227
|
className?: string;
|
|
249
228
|
}
|
|
250
|
-
declare function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSelectPlan, selectingPlanId, labels, className }: PlanPanelProps): import("react").JSX.Element;
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region packages/admin/quota/parseQuotaError.d.ts
|
|
229
|
+
export declare function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSelectPlan, selectingPlanId, labels, className }: PlanPanelProps): import("react").JSX.Element;
|
|
253
230
|
interface ParsedQuotaError {
|
|
254
231
|
resource: string;
|
|
255
232
|
current: number;
|
|
256
233
|
limit: number;
|
|
257
234
|
message: string;
|
|
258
235
|
}
|
|
259
|
-
declare function parseQuotaError(error: unknown): ParsedQuotaError | null;
|
|
260
|
-
declare function quotaErrorToastMessage(quota: ParsedQuotaError, labels?: Partial<Record<string, string>>): string;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region packages/admin/quota/useQuotaUsage.d.ts
|
|
236
|
+
export declare function parseQuotaError(error: unknown): ParsedQuotaError | null;
|
|
237
|
+
export declare function quotaErrorToastMessage(quota: ParsedQuotaError, labels?: Partial<Record<string, string>>): string;
|
|
263
238
|
interface UseQuotaUsageOptions {
|
|
264
239
|
featureKey: string;
|
|
265
240
|
collectionPath: string;
|
|
266
241
|
staleTimeMs?: number;
|
|
267
242
|
}
|
|
268
|
-
declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQuotaUsageOptions): {
|
|
243
|
+
export declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQuotaUsageOptions): {
|
|
269
244
|
count: number;
|
|
270
245
|
max: number;
|
|
271
246
|
atLimit: boolean;
|
|
@@ -273,8 +248,6 @@ declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQ
|
|
|
273
248
|
loading: boolean;
|
|
274
249
|
refetch: () => Promise<import("@tanstack/react-query").QueryObserverResult<number, Error>>;
|
|
275
250
|
};
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region packages/admin/notifications/useNotifications.d.ts
|
|
278
251
|
interface NotificationItem {
|
|
279
252
|
id: number | string;
|
|
280
253
|
subject: string;
|
|
@@ -287,24 +260,20 @@ interface UseNotificationsOptions {
|
|
|
287
260
|
staleTimeMs?: number;
|
|
288
261
|
}
|
|
289
262
|
/** Fetches the current user's notifications and keeps them live via Mercure — see InAppNotificationChannel on the backend. */
|
|
290
|
-
declare function useNotifications({ apiUrl, staleTimeMs }?: UseNotificationsOptions): {
|
|
263
|
+
export declare function useNotifications({ apiUrl, staleTimeMs }?: UseNotificationsOptions): {
|
|
291
264
|
items: NotificationItem[];
|
|
292
265
|
unreadCount: number;
|
|
293
266
|
loading: boolean;
|
|
294
267
|
markAsRead: (id: NotificationItem["id"]) => void;
|
|
295
268
|
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NotificationItem[], Error>>;
|
|
296
269
|
};
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region packages/admin/notifications/NotificationPanel.d.ts
|
|
299
270
|
interface NotificationPanelProps extends UseNotificationsOptions {
|
|
300
271
|
title?: string;
|
|
301
272
|
emptyTitle?: string;
|
|
302
273
|
markAllReadLabel?: string;
|
|
303
274
|
}
|
|
304
275
|
/** Renders inside an AdminHeaderAction.renderPanel — see AdminHeader's `actions` prop. */
|
|
305
|
-
declare function NotificationPanel({ title, emptyTitle, markAllReadLabel, ...options }: NotificationPanelProps): React$1.JSX.Element;
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region packages/admin/auth/LoginPage.d.ts
|
|
276
|
+
export declare function NotificationPanel({ title, emptyTitle, markAllReadLabel, ...options }: NotificationPanelProps): React$1.JSX.Element;
|
|
308
277
|
interface LoginOidcProvider {
|
|
309
278
|
id: string;
|
|
310
279
|
label: string;
|
|
@@ -319,33 +288,23 @@ interface LoginPageProps {
|
|
|
319
288
|
oidcProviders?: LoginOidcProvider[];
|
|
320
289
|
forgotPasswordTo?: string;
|
|
321
290
|
}
|
|
322
|
-
declare function LoginPage({ onLoggedIn, apiBaseUrl, loginPath, title, hint, defaultUsername, oidcProviders, forgotPasswordTo }: LoginPageProps): import("react").JSX.Element;
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region packages/admin/auth/ForgotPasswordPage.d.ts
|
|
291
|
+
export declare function LoginPage({ onLoggedIn, apiBaseUrl, loginPath, title, hint, defaultUsername, oidcProviders, forgotPasswordTo }: LoginPageProps): import("react").JSX.Element;
|
|
325
292
|
interface ForgotPasswordPageProps {
|
|
326
293
|
apiBaseUrl?: string;
|
|
327
294
|
}
|
|
328
|
-
declare function ForgotPasswordPage({ apiBaseUrl }: ForgotPasswordPageProps): import("react").JSX.Element;
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region packages/admin/auth/ResetPasswordPage.d.ts
|
|
295
|
+
export declare function ForgotPasswordPage({ apiBaseUrl }: ForgotPasswordPageProps): import("react").JSX.Element;
|
|
331
296
|
interface ResetPasswordPageProps {
|
|
332
297
|
apiBaseUrl?: string;
|
|
333
298
|
}
|
|
334
|
-
declare function ResetPasswordPage({ apiBaseUrl }: ResetPasswordPageProps): import("react").JSX.Element;
|
|
335
|
-
//#endregion
|
|
336
|
-
//#region packages/admin/auth/AcceptInvitationPage.d.ts
|
|
299
|
+
export declare function ResetPasswordPage({ apiBaseUrl }: ResetPasswordPageProps): import("react").JSX.Element;
|
|
337
300
|
interface AcceptInvitationPageProps {
|
|
338
301
|
apiBaseUrl?: string;
|
|
339
302
|
}
|
|
340
|
-
declare function AcceptInvitationPage({ apiBaseUrl }: AcceptInvitationPageProps): import("react").JSX.Element;
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region packages/admin/auth/AccountPage.d.ts
|
|
303
|
+
export declare function AcceptInvitationPage({ apiBaseUrl }: AcceptInvitationPageProps): import("react").JSX.Element;
|
|
343
304
|
interface AccountPageProps {
|
|
344
305
|
apiBaseUrl?: string;
|
|
345
306
|
}
|
|
346
|
-
declare function AccountPage({ apiBaseUrl }: AccountPageProps): import("react").JSX.Element;
|
|
347
|
-
//#endregion
|
|
348
|
-
//#region packages/admin/auth/RegisterPage.d.ts
|
|
307
|
+
export declare function AccountPage({ apiBaseUrl }: AccountPageProps): import("react").JSX.Element;
|
|
349
308
|
type RegisterFieldType = 'text' | 'email' | 'password' | 'select';
|
|
350
309
|
interface RegisterSelectOption {
|
|
351
310
|
value: string;
|
|
@@ -380,22 +339,18 @@ interface RegisterPageProps {
|
|
|
380
339
|
};
|
|
381
340
|
loginPrompt?: string;
|
|
382
341
|
}
|
|
383
|
-
declare function RegisterPage({ fields, onRegistered, apiBaseUrl, registerPath, title, hint, submitLabel, busyLabel, loginLink, loginPrompt }: RegisterPageProps): import("react").JSX.Element;
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region packages/admin/runtime/useAppRuntime.d.ts
|
|
342
|
+
export declare function RegisterPage({ fields, onRegistered, apiBaseUrl, registerPath, title, hint, submitLabel, busyLabel, loginLink, loginPrompt }: RegisterPageProps): import("react").JSX.Element;
|
|
386
343
|
type NotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
387
344
|
type ToastItem = {
|
|
388
345
|
id: number;
|
|
389
346
|
message: string;
|
|
390
347
|
type: NotificationType;
|
|
391
348
|
};
|
|
392
|
-
declare function useAppRuntime(): {
|
|
349
|
+
export declare function useAppRuntime(): {
|
|
393
350
|
runtime: CoreRuntime;
|
|
394
351
|
toasts: ToastItem[];
|
|
395
352
|
dismiss: (id: number) => void;
|
|
396
353
|
};
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region packages/admin/runtime/useRuntimeConfig.d.ts
|
|
399
354
|
/** Free-form JSON from GET /api/runtime-config — each app defines the shape. */
|
|
400
355
|
type RuntimeConfig = Record<string, unknown>;
|
|
401
356
|
type RuntimeConfigState = {
|
|
@@ -416,22 +371,18 @@ interface UseRuntimeConfigOptions {
|
|
|
416
371
|
/** When false, skips the fetch (e.g. endpoint not enabled). @default true */
|
|
417
372
|
enabled?: boolean;
|
|
418
373
|
}
|
|
419
|
-
declare function useRuntimeConfig({ apiBaseUrl, path, enabled }?: UseRuntimeConfigOptions): {
|
|
374
|
+
export declare function useRuntimeConfig({ apiBaseUrl, path, enabled }?: UseRuntimeConfigOptions): {
|
|
420
375
|
state: RuntimeConfigState;
|
|
421
376
|
config: RuntimeConfig | null;
|
|
422
377
|
loading: boolean;
|
|
423
378
|
error: boolean;
|
|
424
379
|
refresh: () => Promise<void>;
|
|
425
380
|
};
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region packages/admin/runtime/ToastHost.d.ts
|
|
428
381
|
interface ToastHostProps {
|
|
429
382
|
toasts: ToastItem[];
|
|
430
383
|
onDismiss: (id: number) => void;
|
|
431
384
|
}
|
|
432
|
-
declare function ToastHost({ toasts, onDismiss }: ToastHostProps): import("react").JSX.Element | null;
|
|
433
|
-
//#endregion
|
|
434
|
-
//#region packages/admin/app/types.d.ts
|
|
385
|
+
export declare function ToastHost({ toasts, onDismiss }: ToastHostProps): import("react").JSX.Element | null;
|
|
435
386
|
type NubitAppRoute = {
|
|
436
387
|
path: string;
|
|
437
388
|
element: ReactNode;
|
|
@@ -500,19 +451,12 @@ type CreateNubitAppConfig = {
|
|
|
500
451
|
type NubitApp = {
|
|
501
452
|
App: React.ComponentType;
|
|
502
453
|
};
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
declare function
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region packages/admin/devtools/NubitDevToolsPanel.d.ts
|
|
508
|
-
declare function NubitDevToolsPanel(): React$1.JSX.Element | null;
|
|
509
|
-
//#endregion
|
|
510
|
-
//#region packages/admin/app/filterMenuByRoles.d.ts
|
|
511
|
-
declare function hasAnyRole(required: string | string[] | undefined, roles: string[]): boolean;
|
|
454
|
+
export declare function createNubitApp(config: CreateNubitAppConfig): NubitApp;
|
|
455
|
+
export declare function NubitDevToolsPanel(): React$1.JSX.Element | null;
|
|
456
|
+
export declare function hasAnyRole(required: string | string[] | undefined, roles: string[]): boolean;
|
|
512
457
|
/**
|
|
513
458
|
* Removes menu entries whose `roles` constraint is not satisfied. Sub-items with
|
|
514
459
|
* `roles` are filtered; empty parent groups are dropped.
|
|
515
460
|
*/
|
|
516
|
-
declare function filterMenuByRoles(items: NubitAppMenuItem[], roles: string[]): AdminMenuItem[];
|
|
517
|
-
|
|
518
|
-
export { AcceptInvitationPage, type AcceptInvitationPageProps, AccountPage, type AccountPageProps, AdminBottomNavigation, type AdminBottomNavigationItem, type AdminBottomNavigationProps, AdminHeader, type AdminHeaderAction, type AdminHeaderProps, type AdminMenuItem, type AdminMenuSubItem, AdminShell, type AdminShellProps, AdminSidebarMenu, type AdminSidebarMenuProps, type AdminSidebarMenuSelectEvent, type AppProfile, type CreateNubitAppConfig, FeatureGate, type FeatureGateProps, type FeatureHubBanner, type FeatureHubDensity, FeatureHubLayout, type FeatureHubLayoutProps, type FeatureHubTab, ForgotPasswordPage, type ForgotPasswordPageProps, type LoginOidcProvider, LoginPage, type LoginPageProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationType, type NubitApp, type NubitAppMenuContext, type NubitAppMenuItem, type NubitAppMenuSubItem, type NubitAppRoute, type NubitAppUserMenuContext, NubitDevToolsPanel, type ParsedQuotaError, type PlanDefinition, PlanPanel, type PlanPanelLabels, type PlanPanelProps, QuotaUsageBanner, type QuotaUsageBannerProps, type RegisterField, type RegisterFieldType, RegisterPage, type RegisterPageProps, type RegisterSelectOption, ResetPasswordPage, type ResetPasswordPageProps, type RuntimeConfig, type RuntimeConfigState, type SessionContextValue, type SessionFeatureEntitlement, type SessionPermissionLimit, type SessionProfile, SessionProvider, type SessionProviderConfig, type SessionState, type SessionTenant, StaticSessionProvider, ToastHost, type ToastHostProps, type ToastItem, type UseNotificationsOptions, type UseQuotaUsageOptions, type UseRuntimeConfigOptions, createNubitApp, filterMenuByRoles, hasAnyRole, parseQuotaError, quotaErrorToastMessage, quotaUsageAboveGrid, useAppRuntime, useFeature, useFeatureConfig, useNotifications, useQuotaUsage, useRuntimeConfig, useScreenSize, useScreenSizeClass, useSession };
|
|
461
|
+
export declare function filterMenuByRoles(items: NubitAppMenuItem[], roles: string[]): AdminMenuItem[];
|
|
462
|
+
export type { AcceptInvitationPageProps, AccountPageProps, AdminBottomNavigationItem, AdminBottomNavigationProps, AdminHeaderAction, AdminHeaderProps, AdminMenuItem, AdminMenuSubItem, AdminShellProps, AdminSidebarMenuProps, AdminSidebarMenuSelectEvent, AppProfile, CreateNubitAppConfig, FeatureGateProps, FeatureHubBanner, FeatureHubDensity, FeatureHubLayoutProps, FeatureHubTab, ForgotPasswordPageProps, LoginOidcProvider, LoginPageProps, NotificationItem, NotificationPanelProps, NotificationType, NubitApp, NubitAppMenuContext, NubitAppMenuItem, NubitAppMenuSubItem, NubitAppRoute, NubitAppUserMenuContext, ParsedQuotaError, PlanDefinition, PlanPanelLabels, PlanPanelProps, QuotaUsageBannerProps, RegisterField, RegisterFieldType, RegisterPageProps, RegisterSelectOption, ResetPasswordPageProps, RuntimeConfig, RuntimeConfigState, SessionContextValue, SessionFeatureEntitlement, SessionPermissionLimit, SessionProfile, SessionProviderConfig, SessionState, SessionTenant, ToastHostProps, ToastItem, UseNotificationsOptions, UseQuotaUsageOptions, UseRuntimeConfigOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import React$1, { ReactNode } from "react";
|
|
|
2
2
|
import { FeatureGateProps as FeatureGateProps$1, ThemeProviderProps } from "@nubitio/ui";
|
|
3
3
|
import { CoreRuntime } from "@nubitio/core";
|
|
4
4
|
import { QueryClient } from "@tanstack/react-query";
|
|
5
|
-
//#region packages/admin/FeatureHubLayout.d.ts
|
|
6
5
|
interface FeatureHubTab {
|
|
7
6
|
key: string;
|
|
8
7
|
label: string;
|
|
@@ -32,9 +31,7 @@ interface FeatureHubLayoutProps {
|
|
|
32
31
|
density?: FeatureHubDensity;
|
|
33
32
|
className?: string;
|
|
34
33
|
}
|
|
35
|
-
declare function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner, tabsAriaLabel, density, className }: FeatureHubLayoutProps): import("react").JSX.Element;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region packages/admin/AdminHeader.d.ts
|
|
34
|
+
export declare function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner, tabsAriaLabel, density, className }: FeatureHubLayoutProps): import("react").JSX.Element;
|
|
38
35
|
interface AdminHeaderAction {
|
|
39
36
|
id: string;
|
|
40
37
|
icon: string;
|
|
@@ -59,9 +56,7 @@ interface AdminHeaderProps {
|
|
|
59
56
|
}) => React$1.ReactNode;
|
|
60
57
|
renderThemeSwitcher?: () => React$1.ReactNode;
|
|
61
58
|
}
|
|
62
|
-
declare const AdminHeader: ({ title, menuToggleEnabled, toggleMenu, className, actions, content, renderUserMenu, renderThemeSwitcher }: AdminHeaderProps) => React$1.JSX.Element;
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region packages/admin/AdminSidebarMenu.d.ts
|
|
59
|
+
export declare const AdminHeader: ({ title, menuToggleEnabled, toggleMenu, className, actions, content, renderUserMenu, renderThemeSwitcher }: AdminHeaderProps) => React$1.JSX.Element;
|
|
65
60
|
interface AdminMenuSubItem {
|
|
66
61
|
text: string;
|
|
67
62
|
path: string;
|
|
@@ -86,9 +81,7 @@ interface AdminSidebarMenuProps {
|
|
|
86
81
|
brand?: React$1.ReactNode;
|
|
87
82
|
context?: React$1.ReactNode;
|
|
88
83
|
}
|
|
89
|
-
declare const AdminSidebarMenu: ({ items, compactMode, selectedItemChanged, openMenu, footer, brand, context }: AdminSidebarMenuProps) => React$1.JSX.Element;
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region packages/admin/AdminShell.d.ts
|
|
84
|
+
export declare const AdminSidebarMenu: ({ items, compactMode, selectedItemChanged, openMenu, footer, brand, context }: AdminSidebarMenuProps) => React$1.JSX.Element;
|
|
92
85
|
interface AdminShellProps {
|
|
93
86
|
title?: string;
|
|
94
87
|
menuItems: AdminMenuItem[];
|
|
@@ -108,9 +101,7 @@ interface AdminShellProps {
|
|
|
108
101
|
bottomNavigation?: React$1.ReactNode;
|
|
109
102
|
children: React$1.ReactNode;
|
|
110
103
|
}
|
|
111
|
-
declare const AdminShell: ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant, brand, headerContent, sidebarContext, bottomNavigation, children }: AdminShellProps) => React$1.JSX.Element;
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region packages/admin/AdminBottomNavigation.d.ts
|
|
104
|
+
export declare const AdminShell: ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant, brand, headerContent, sidebarContext, bottomNavigation, children }: AdminShellProps) => React$1.JSX.Element;
|
|
114
105
|
interface AdminBottomNavigationItem {
|
|
115
106
|
text: string;
|
|
116
107
|
path: string;
|
|
@@ -122,18 +113,14 @@ interface AdminBottomNavigationProps {
|
|
|
122
113
|
items: AdminBottomNavigationItem[];
|
|
123
114
|
label?: string;
|
|
124
115
|
}
|
|
125
|
-
declare function AdminBottomNavigation({ items, label }: AdminBottomNavigationProps): import("react").JSX.Element;
|
|
126
|
-
|
|
127
|
-
//#region packages/admin/useScreenSize.d.ts
|
|
128
|
-
declare const useScreenSize: () => {
|
|
116
|
+
export declare function AdminBottomNavigation({ items, label }: AdminBottomNavigationProps): import("react").JSX.Element;
|
|
117
|
+
export declare const useScreenSize: () => {
|
|
129
118
|
isXSmall: boolean;
|
|
130
119
|
isSmall: boolean;
|
|
131
120
|
isMedium: boolean;
|
|
132
121
|
isLarge: boolean;
|
|
133
122
|
};
|
|
134
|
-
declare const useScreenSizeClass: () => "screen-large" | "screen-medium" | "screen-small" | "screen-x-small";
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region packages/admin/auth/SessionContext.d.ts
|
|
123
|
+
export declare const useScreenSizeClass: () => "screen-large" | "screen-medium" | "screen-small" | "screen-x-small";
|
|
137
124
|
type AppProfile = 'internal' | 'saas' | 'hybrid';
|
|
138
125
|
type SessionTenant = {
|
|
139
126
|
id?: number;
|
|
@@ -186,25 +173,19 @@ interface SessionContextValue {
|
|
|
186
173
|
roles: string[];
|
|
187
174
|
username: string | null;
|
|
188
175
|
}
|
|
189
|
-
declare function SessionProvider({ apiBaseUrl, mePath, logoutPath, children }: SessionProviderConfig & {
|
|
176
|
+
export declare function SessionProvider({ apiBaseUrl, mePath, logoutPath, children }: SessionProviderConfig & {
|
|
190
177
|
children: React$1.ReactNode;
|
|
191
178
|
}): React$1.JSX.Element;
|
|
192
|
-
declare function useSession(): SessionContextValue;
|
|
179
|
+
export declare function useSession(): SessionContextValue;
|
|
193
180
|
/** Seeds session state from a known profile (e.g. after a custom /api/me fetch). */
|
|
194
|
-
declare function StaticSessionProvider({ profile, children }: {
|
|
181
|
+
export declare function StaticSessionProvider({ profile, children }: {
|
|
195
182
|
profile: SessionProfile;
|
|
196
183
|
children: React$1.ReactNode;
|
|
197
184
|
}): React$1.JSX.Element;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
declare function useFeature(featureKey: string): boolean;
|
|
201
|
-
declare function useFeatureConfig(featureKey: string): Record<string, unknown>;
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region packages/admin/features/FeatureGate.d.ts
|
|
185
|
+
export declare function useFeature(featureKey: string): boolean;
|
|
186
|
+
export declare function useFeatureConfig(featureKey: string): Record<string, unknown>;
|
|
204
187
|
type FeatureGateProps = Omit<FeatureGateProps$1, 'enabled'>;
|
|
205
|
-
declare function FeatureGate({ featureKey, ...props }: FeatureGateProps): React$1.JSX.Element;
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region packages/admin/quota/QuotaUsageBanner.d.ts
|
|
188
|
+
export declare function FeatureGate({ featureKey, ...props }: FeatureGateProps): React$1.JSX.Element;
|
|
208
189
|
interface QuotaUsageBannerProps {
|
|
209
190
|
count: number;
|
|
210
191
|
max: number;
|
|
@@ -217,10 +198,8 @@ interface QuotaUsageBannerProps {
|
|
|
217
198
|
upgradeLabel?: string;
|
|
218
199
|
className?: string;
|
|
219
200
|
}
|
|
220
|
-
declare function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel, className }: QuotaUsageBannerProps): import("react").JSX.Element | null;
|
|
221
|
-
declare function quotaUsageAboveGrid(banner: ReactNode): () => ReactNode;
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region packages/admin/billing/PlanPanel.d.ts
|
|
201
|
+
export declare function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel, className }: QuotaUsageBannerProps): import("react").JSX.Element | null;
|
|
202
|
+
export declare function quotaUsageAboveGrid(banner: ReactNode): () => ReactNode;
|
|
224
203
|
interface PlanDefinition {
|
|
225
204
|
id: string;
|
|
226
205
|
name: string;
|
|
@@ -247,25 +226,21 @@ interface PlanPanelProps {
|
|
|
247
226
|
labels?: PlanPanelLabels;
|
|
248
227
|
className?: string;
|
|
249
228
|
}
|
|
250
|
-
declare function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSelectPlan, selectingPlanId, labels, className }: PlanPanelProps): import("react").JSX.Element;
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region packages/admin/quota/parseQuotaError.d.ts
|
|
229
|
+
export declare function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSelectPlan, selectingPlanId, labels, className }: PlanPanelProps): import("react").JSX.Element;
|
|
253
230
|
interface ParsedQuotaError {
|
|
254
231
|
resource: string;
|
|
255
232
|
current: number;
|
|
256
233
|
limit: number;
|
|
257
234
|
message: string;
|
|
258
235
|
}
|
|
259
|
-
declare function parseQuotaError(error: unknown): ParsedQuotaError | null;
|
|
260
|
-
declare function quotaErrorToastMessage(quota: ParsedQuotaError, labels?: Partial<Record<string, string>>): string;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region packages/admin/quota/useQuotaUsage.d.ts
|
|
236
|
+
export declare function parseQuotaError(error: unknown): ParsedQuotaError | null;
|
|
237
|
+
export declare function quotaErrorToastMessage(quota: ParsedQuotaError, labels?: Partial<Record<string, string>>): string;
|
|
263
238
|
interface UseQuotaUsageOptions {
|
|
264
239
|
featureKey: string;
|
|
265
240
|
collectionPath: string;
|
|
266
241
|
staleTimeMs?: number;
|
|
267
242
|
}
|
|
268
|
-
declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQuotaUsageOptions): {
|
|
243
|
+
export declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQuotaUsageOptions): {
|
|
269
244
|
count: number;
|
|
270
245
|
max: number;
|
|
271
246
|
atLimit: boolean;
|
|
@@ -273,8 +248,6 @@ declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQ
|
|
|
273
248
|
loading: boolean;
|
|
274
249
|
refetch: () => Promise<import("@tanstack/react-query").QueryObserverResult<number, Error>>;
|
|
275
250
|
};
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region packages/admin/notifications/useNotifications.d.ts
|
|
278
251
|
interface NotificationItem {
|
|
279
252
|
id: number | string;
|
|
280
253
|
subject: string;
|
|
@@ -287,24 +260,20 @@ interface UseNotificationsOptions {
|
|
|
287
260
|
staleTimeMs?: number;
|
|
288
261
|
}
|
|
289
262
|
/** Fetches the current user's notifications and keeps them live via Mercure — see InAppNotificationChannel on the backend. */
|
|
290
|
-
declare function useNotifications({ apiUrl, staleTimeMs }?: UseNotificationsOptions): {
|
|
263
|
+
export declare function useNotifications({ apiUrl, staleTimeMs }?: UseNotificationsOptions): {
|
|
291
264
|
items: NotificationItem[];
|
|
292
265
|
unreadCount: number;
|
|
293
266
|
loading: boolean;
|
|
294
267
|
markAsRead: (id: NotificationItem["id"]) => void;
|
|
295
268
|
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NotificationItem[], Error>>;
|
|
296
269
|
};
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region packages/admin/notifications/NotificationPanel.d.ts
|
|
299
270
|
interface NotificationPanelProps extends UseNotificationsOptions {
|
|
300
271
|
title?: string;
|
|
301
272
|
emptyTitle?: string;
|
|
302
273
|
markAllReadLabel?: string;
|
|
303
274
|
}
|
|
304
275
|
/** Renders inside an AdminHeaderAction.renderPanel — see AdminHeader's `actions` prop. */
|
|
305
|
-
declare function NotificationPanel({ title, emptyTitle, markAllReadLabel, ...options }: NotificationPanelProps): React$1.JSX.Element;
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region packages/admin/auth/LoginPage.d.ts
|
|
276
|
+
export declare function NotificationPanel({ title, emptyTitle, markAllReadLabel, ...options }: NotificationPanelProps): React$1.JSX.Element;
|
|
308
277
|
interface LoginOidcProvider {
|
|
309
278
|
id: string;
|
|
310
279
|
label: string;
|
|
@@ -319,33 +288,23 @@ interface LoginPageProps {
|
|
|
319
288
|
oidcProviders?: LoginOidcProvider[];
|
|
320
289
|
forgotPasswordTo?: string;
|
|
321
290
|
}
|
|
322
|
-
declare function LoginPage({ onLoggedIn, apiBaseUrl, loginPath, title, hint, defaultUsername, oidcProviders, forgotPasswordTo }: LoginPageProps): import("react").JSX.Element;
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region packages/admin/auth/ForgotPasswordPage.d.ts
|
|
291
|
+
export declare function LoginPage({ onLoggedIn, apiBaseUrl, loginPath, title, hint, defaultUsername, oidcProviders, forgotPasswordTo }: LoginPageProps): import("react").JSX.Element;
|
|
325
292
|
interface ForgotPasswordPageProps {
|
|
326
293
|
apiBaseUrl?: string;
|
|
327
294
|
}
|
|
328
|
-
declare function ForgotPasswordPage({ apiBaseUrl }: ForgotPasswordPageProps): import("react").JSX.Element;
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region packages/admin/auth/ResetPasswordPage.d.ts
|
|
295
|
+
export declare function ForgotPasswordPage({ apiBaseUrl }: ForgotPasswordPageProps): import("react").JSX.Element;
|
|
331
296
|
interface ResetPasswordPageProps {
|
|
332
297
|
apiBaseUrl?: string;
|
|
333
298
|
}
|
|
334
|
-
declare function ResetPasswordPage({ apiBaseUrl }: ResetPasswordPageProps): import("react").JSX.Element;
|
|
335
|
-
//#endregion
|
|
336
|
-
//#region packages/admin/auth/AcceptInvitationPage.d.ts
|
|
299
|
+
export declare function ResetPasswordPage({ apiBaseUrl }: ResetPasswordPageProps): import("react").JSX.Element;
|
|
337
300
|
interface AcceptInvitationPageProps {
|
|
338
301
|
apiBaseUrl?: string;
|
|
339
302
|
}
|
|
340
|
-
declare function AcceptInvitationPage({ apiBaseUrl }: AcceptInvitationPageProps): import("react").JSX.Element;
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region packages/admin/auth/AccountPage.d.ts
|
|
303
|
+
export declare function AcceptInvitationPage({ apiBaseUrl }: AcceptInvitationPageProps): import("react").JSX.Element;
|
|
343
304
|
interface AccountPageProps {
|
|
344
305
|
apiBaseUrl?: string;
|
|
345
306
|
}
|
|
346
|
-
declare function AccountPage({ apiBaseUrl }: AccountPageProps): import("react").JSX.Element;
|
|
347
|
-
//#endregion
|
|
348
|
-
//#region packages/admin/auth/RegisterPage.d.ts
|
|
307
|
+
export declare function AccountPage({ apiBaseUrl }: AccountPageProps): import("react").JSX.Element;
|
|
349
308
|
type RegisterFieldType = 'text' | 'email' | 'password' | 'select';
|
|
350
309
|
interface RegisterSelectOption {
|
|
351
310
|
value: string;
|
|
@@ -380,22 +339,18 @@ interface RegisterPageProps {
|
|
|
380
339
|
};
|
|
381
340
|
loginPrompt?: string;
|
|
382
341
|
}
|
|
383
|
-
declare function RegisterPage({ fields, onRegistered, apiBaseUrl, registerPath, title, hint, submitLabel, busyLabel, loginLink, loginPrompt }: RegisterPageProps): import("react").JSX.Element;
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region packages/admin/runtime/useAppRuntime.d.ts
|
|
342
|
+
export declare function RegisterPage({ fields, onRegistered, apiBaseUrl, registerPath, title, hint, submitLabel, busyLabel, loginLink, loginPrompt }: RegisterPageProps): import("react").JSX.Element;
|
|
386
343
|
type NotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
387
344
|
type ToastItem = {
|
|
388
345
|
id: number;
|
|
389
346
|
message: string;
|
|
390
347
|
type: NotificationType;
|
|
391
348
|
};
|
|
392
|
-
declare function useAppRuntime(): {
|
|
349
|
+
export declare function useAppRuntime(): {
|
|
393
350
|
runtime: CoreRuntime;
|
|
394
351
|
toasts: ToastItem[];
|
|
395
352
|
dismiss: (id: number) => void;
|
|
396
353
|
};
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region packages/admin/runtime/useRuntimeConfig.d.ts
|
|
399
354
|
/** Free-form JSON from GET /api/runtime-config — each app defines the shape. */
|
|
400
355
|
type RuntimeConfig = Record<string, unknown>;
|
|
401
356
|
type RuntimeConfigState = {
|
|
@@ -416,22 +371,18 @@ interface UseRuntimeConfigOptions {
|
|
|
416
371
|
/** When false, skips the fetch (e.g. endpoint not enabled). @default true */
|
|
417
372
|
enabled?: boolean;
|
|
418
373
|
}
|
|
419
|
-
declare function useRuntimeConfig({ apiBaseUrl, path, enabled }?: UseRuntimeConfigOptions): {
|
|
374
|
+
export declare function useRuntimeConfig({ apiBaseUrl, path, enabled }?: UseRuntimeConfigOptions): {
|
|
420
375
|
state: RuntimeConfigState;
|
|
421
376
|
config: RuntimeConfig | null;
|
|
422
377
|
loading: boolean;
|
|
423
378
|
error: boolean;
|
|
424
379
|
refresh: () => Promise<void>;
|
|
425
380
|
};
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region packages/admin/runtime/ToastHost.d.ts
|
|
428
381
|
interface ToastHostProps {
|
|
429
382
|
toasts: ToastItem[];
|
|
430
383
|
onDismiss: (id: number) => void;
|
|
431
384
|
}
|
|
432
|
-
declare function ToastHost({ toasts, onDismiss }: ToastHostProps): import("react").JSX.Element | null;
|
|
433
|
-
//#endregion
|
|
434
|
-
//#region packages/admin/app/types.d.ts
|
|
385
|
+
export declare function ToastHost({ toasts, onDismiss }: ToastHostProps): import("react").JSX.Element | null;
|
|
435
386
|
type NubitAppRoute = {
|
|
436
387
|
path: string;
|
|
437
388
|
element: ReactNode;
|
|
@@ -500,19 +451,12 @@ type CreateNubitAppConfig = {
|
|
|
500
451
|
type NubitApp = {
|
|
501
452
|
App: React.ComponentType;
|
|
502
453
|
};
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
declare function
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region packages/admin/devtools/NubitDevToolsPanel.d.ts
|
|
508
|
-
declare function NubitDevToolsPanel(): React$1.JSX.Element | null;
|
|
509
|
-
//#endregion
|
|
510
|
-
//#region packages/admin/app/filterMenuByRoles.d.ts
|
|
511
|
-
declare function hasAnyRole(required: string | string[] | undefined, roles: string[]): boolean;
|
|
454
|
+
export declare function createNubitApp(config: CreateNubitAppConfig): NubitApp;
|
|
455
|
+
export declare function NubitDevToolsPanel(): React$1.JSX.Element | null;
|
|
456
|
+
export declare function hasAnyRole(required: string | string[] | undefined, roles: string[]): boolean;
|
|
512
457
|
/**
|
|
513
458
|
* Removes menu entries whose `roles` constraint is not satisfied. Sub-items with
|
|
514
459
|
* `roles` are filtered; empty parent groups are dropped.
|
|
515
460
|
*/
|
|
516
|
-
declare function filterMenuByRoles(items: NubitAppMenuItem[], roles: string[]): AdminMenuItem[];
|
|
517
|
-
|
|
518
|
-
export { AcceptInvitationPage, type AcceptInvitationPageProps, AccountPage, type AccountPageProps, AdminBottomNavigation, type AdminBottomNavigationItem, type AdminBottomNavigationProps, AdminHeader, type AdminHeaderAction, type AdminHeaderProps, type AdminMenuItem, type AdminMenuSubItem, AdminShell, type AdminShellProps, AdminSidebarMenu, type AdminSidebarMenuProps, type AdminSidebarMenuSelectEvent, type AppProfile, type CreateNubitAppConfig, FeatureGate, type FeatureGateProps, type FeatureHubBanner, type FeatureHubDensity, FeatureHubLayout, type FeatureHubLayoutProps, type FeatureHubTab, ForgotPasswordPage, type ForgotPasswordPageProps, type LoginOidcProvider, LoginPage, type LoginPageProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationType, type NubitApp, type NubitAppMenuContext, type NubitAppMenuItem, type NubitAppMenuSubItem, type NubitAppRoute, type NubitAppUserMenuContext, NubitDevToolsPanel, type ParsedQuotaError, type PlanDefinition, PlanPanel, type PlanPanelLabels, type PlanPanelProps, QuotaUsageBanner, type QuotaUsageBannerProps, type RegisterField, type RegisterFieldType, RegisterPage, type RegisterPageProps, type RegisterSelectOption, ResetPasswordPage, type ResetPasswordPageProps, type RuntimeConfig, type RuntimeConfigState, type SessionContextValue, type SessionFeatureEntitlement, type SessionPermissionLimit, type SessionProfile, SessionProvider, type SessionProviderConfig, type SessionState, type SessionTenant, StaticSessionProvider, ToastHost, type ToastHostProps, type ToastItem, type UseNotificationsOptions, type UseQuotaUsageOptions, type UseRuntimeConfigOptions, createNubitApp, filterMenuByRoles, hasAnyRole, parseQuotaError, quotaErrorToastMessage, quotaUsageAboveGrid, useAppRuntime, useFeature, useFeatureConfig, useNotifications, useQuotaUsage, useRuntimeConfig, useScreenSize, useScreenSizeClass, useSession };
|
|
461
|
+
export declare function filterMenuByRoles(items: NubitAppMenuItem[], roles: string[]): AdminMenuItem[];
|
|
462
|
+
export type { AcceptInvitationPageProps, AccountPageProps, AdminBottomNavigationItem, AdminBottomNavigationProps, AdminHeaderAction, AdminHeaderProps, AdminMenuItem, AdminMenuSubItem, AdminShellProps, AdminSidebarMenuProps, AdminSidebarMenuSelectEvent, AppProfile, CreateNubitAppConfig, FeatureGateProps, FeatureHubBanner, FeatureHubDensity, FeatureHubLayoutProps, FeatureHubTab, ForgotPasswordPageProps, LoginOidcProvider, LoginPageProps, NotificationItem, NotificationPanelProps, NotificationType, NubitApp, NubitAppMenuContext, NubitAppMenuItem, NubitAppMenuSubItem, NubitAppRoute, NubitAppUserMenuContext, ParsedQuotaError, PlanDefinition, PlanPanelLabels, PlanPanelProps, QuotaUsageBannerProps, RegisterField, RegisterFieldType, RegisterPageProps, RegisterSelectOption, ResetPasswordPageProps, RuntimeConfig, RuntimeConfigState, SessionContextValue, SessionFeatureEntitlement, SessionPermissionLimit, SessionProfile, SessionProviderConfig, SessionState, SessionTenant, ToastHostProps, ToastItem, UseNotificationsOptions, UseQuotaUsageOptions, UseRuntimeConfigOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { CoreConfigProvider, CoreProvider, DEFAULT_CSRF_HEADER_NAME, MercureProv
|
|
|
6
6
|
import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
7
7
|
import { DevToolsProvider, SessionPermissionsProvider, SmartCrudRolesProvider, isDevEnvironment, useDevTools } from "@nubitio/crud";
|
|
8
8
|
import { HydraResourceSchemaProvider, HydraResourceStoreProvider, SchemaProvider } from "@nubitio/hydra";
|
|
9
|
-
|
|
9
|
+
// packages/admin/FeatureHubLayout.tsx
|
|
10
10
|
function normalizeIcon(icon) {
|
|
11
11
|
if (!icon) return void 0;
|
|
12
12
|
if (icon.startsWith("ph ")) return icon;
|
|
@@ -80,8 +80,7 @@ function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner
|
|
|
80
80
|
]
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
//#region packages/admin/AdminHeader.tsx
|
|
83
|
+
// packages/admin/AdminHeader.tsx
|
|
85
84
|
function ActionPopover({ action }) {
|
|
86
85
|
const { open, toggle, setOpen, containerRef } = useFloatingPanel();
|
|
87
86
|
if (action.onClick) return /* @__PURE__ */ jsxs("div", {
|
|
@@ -179,8 +178,7 @@ const AdminHeader = ({ title, menuToggleEnabled, toggleMenu, className, actions
|
|
|
179
178
|
})
|
|
180
179
|
});
|
|
181
180
|
};
|
|
182
|
-
|
|
183
|
-
//#region packages/admin/useScreenSize.ts
|
|
181
|
+
// packages/admin/useScreenSize.ts
|
|
184
182
|
let handlers = [];
|
|
185
183
|
const xSmallMedia = window.matchMedia("(max-width: 575.98px)");
|
|
186
184
|
const smallMedia = window.matchMedia("(min-width: 576px) and (max-width: 991.98px)");
|
|
@@ -231,8 +229,7 @@ const useScreenSizeClass = () => {
|
|
|
231
229
|
if (isSmall) return "screen-small";
|
|
232
230
|
return "screen-x-small";
|
|
233
231
|
};
|
|
234
|
-
|
|
235
|
-
//#region packages/admin/AdminSidebarMenu.tsx
|
|
232
|
+
// packages/admin/AdminSidebarMenu.tsx
|
|
236
233
|
const normalizeRoute = (path) => {
|
|
237
234
|
if (!path) return "";
|
|
238
235
|
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
@@ -366,8 +363,7 @@ const AdminSidebarMenu = ({ items, compactMode = false, selectedItemChanged, ope
|
|
|
366
363
|
]
|
|
367
364
|
});
|
|
368
365
|
};
|
|
369
|
-
|
|
370
|
-
//#region packages/admin/AdminShell.tsx
|
|
366
|
+
// packages/admin/AdminShell.tsx
|
|
371
367
|
const AdminShell = ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, variant = "default", brand, headerContent, sidebarContext, bottomNavigation, children }) => {
|
|
372
368
|
const navigate = useNavigate();
|
|
373
369
|
const strings = useUiStrings();
|
|
@@ -478,8 +474,7 @@ const AdminShell = ({ title, menuItems, headerActions, renderUserMenu, renderThe
|
|
|
478
474
|
]
|
|
479
475
|
});
|
|
480
476
|
};
|
|
481
|
-
|
|
482
|
-
//#region packages/admin/AdminBottomNavigation.tsx
|
|
477
|
+
// packages/admin/AdminBottomNavigation.tsx
|
|
483
478
|
function AdminBottomNavigation({ items, label }) {
|
|
484
479
|
const { pathname } = useLocation();
|
|
485
480
|
const strings = useUiStrings();
|
|
@@ -510,8 +505,7 @@ function AdminBottomNavigation({ items, label }) {
|
|
|
510
505
|
}, item.path))
|
|
511
506
|
});
|
|
512
507
|
}
|
|
513
|
-
|
|
514
|
-
//#region packages/admin/auth/csrfFetch.ts
|
|
508
|
+
// packages/admin/auth/csrfFetch.ts
|
|
515
509
|
const MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
516
510
|
"POST",
|
|
517
511
|
"PUT",
|
|
@@ -539,8 +533,7 @@ function csrfFetch(input, init = {}) {
|
|
|
539
533
|
headers
|
|
540
534
|
});
|
|
541
535
|
}
|
|
542
|
-
|
|
543
|
-
//#region packages/admin/auth/SessionContext.tsx
|
|
536
|
+
// packages/admin/auth/SessionContext.tsx
|
|
544
537
|
const SessionContext = createContext(null);
|
|
545
538
|
function joinApiPath$7(apiBaseUrl, path) {
|
|
546
539
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
@@ -611,8 +604,7 @@ function StaticSessionProvider({ profile, children }) {
|
|
|
611
604
|
children
|
|
612
605
|
});
|
|
613
606
|
}
|
|
614
|
-
|
|
615
|
-
//#region packages/admin/hooks/useFeature.ts
|
|
607
|
+
// packages/admin/hooks/useFeature.ts
|
|
616
608
|
function useFeature(featureKey) {
|
|
617
609
|
const { session } = useSession();
|
|
618
610
|
if (session.status !== "authenticated") return false;
|
|
@@ -625,8 +617,7 @@ function useFeatureConfig(featureKey) {
|
|
|
625
617
|
if (!entry?.enabled) return {};
|
|
626
618
|
return entry.config ?? {};
|
|
627
619
|
}
|
|
628
|
-
|
|
629
|
-
//#region packages/admin/features/FeatureGate.tsx
|
|
620
|
+
// packages/admin/features/FeatureGate.tsx
|
|
630
621
|
function FeatureGate({ featureKey, ...props }) {
|
|
631
622
|
const enabled = useFeature(featureKey);
|
|
632
623
|
return /* @__PURE__ */ jsx(FeatureGate$1, {
|
|
@@ -635,8 +626,7 @@ function FeatureGate({ featureKey, ...props }) {
|
|
|
635
626
|
...props
|
|
636
627
|
});
|
|
637
628
|
}
|
|
638
|
-
|
|
639
|
-
//#region packages/admin/quota/QuotaUsageBanner.tsx
|
|
629
|
+
// packages/admin/quota/QuotaUsageBanner.tsx
|
|
640
630
|
function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel = "View plans", className = "" }) {
|
|
641
631
|
if (max <= 0) return null;
|
|
642
632
|
const atLimit = count >= max;
|
|
@@ -666,8 +656,7 @@ function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, ne
|
|
|
666
656
|
function quotaUsageAboveGrid(banner) {
|
|
667
657
|
return () => banner;
|
|
668
658
|
}
|
|
669
|
-
|
|
670
|
-
//#region packages/admin/billing/PlanPanel.tsx
|
|
659
|
+
// packages/admin/billing/PlanPanel.tsx
|
|
671
660
|
function formatTrialEnds(iso) {
|
|
672
661
|
const date = new Date(iso);
|
|
673
662
|
if (Number.isNaN(date.getTime())) return iso;
|
|
@@ -755,8 +744,7 @@ function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSe
|
|
|
755
744
|
})]
|
|
756
745
|
});
|
|
757
746
|
}
|
|
758
|
-
|
|
759
|
-
//#region packages/admin/quota/parseQuotaError.ts
|
|
747
|
+
// packages/admin/quota/parseQuotaError.ts
|
|
760
748
|
function readErrorDetail(error) {
|
|
761
749
|
if (typeof error !== "object" || error === null) return "";
|
|
762
750
|
const record = error;
|
|
@@ -784,8 +772,7 @@ function quotaErrorToastMessage(quota, labels) {
|
|
|
784
772
|
const label = labels?.[quota.resource] ?? quota.resource;
|
|
785
773
|
return `Plan limit reached: ${quota.current}/${quota.limit} ${label}. Upgrade your plan to continue.`;
|
|
786
774
|
}
|
|
787
|
-
|
|
788
|
-
//#region packages/admin/quota/useQuotaUsage.ts
|
|
775
|
+
// packages/admin/quota/useQuotaUsage.ts
|
|
789
776
|
function readCollectionTotal(body) {
|
|
790
777
|
if (Array.isArray(body)) return body.length;
|
|
791
778
|
if (typeof body !== "object" || body === null) return 0;
|
|
@@ -822,8 +809,7 @@ function useQuotaUsage({ featureKey, collectionPath, staleTimeMs = 1e4 }) {
|
|
|
822
809
|
refetch
|
|
823
810
|
};
|
|
824
811
|
}
|
|
825
|
-
|
|
826
|
-
//#region packages/admin/notifications/useNotifications.ts
|
|
812
|
+
// packages/admin/notifications/useNotifications.ts
|
|
827
813
|
/** Reads a Hydra collection body (`hydra:member`) or a plain array — same shape useQuotaUsage relies on. */
|
|
828
814
|
function readCollectionItems(body) {
|
|
829
815
|
if (Array.isArray(body)) return body;
|
|
@@ -862,8 +848,7 @@ function useNotifications({ apiUrl = "/api/notifications", staleTimeMs = 1e4 } =
|
|
|
862
848
|
refetch: query.refetch
|
|
863
849
|
};
|
|
864
850
|
}
|
|
865
|
-
|
|
866
|
-
//#region packages/admin/notifications/NotificationPanel.tsx
|
|
851
|
+
// packages/admin/notifications/NotificationPanel.tsx
|
|
867
852
|
function formatRelativeTime(iso) {
|
|
868
853
|
const date = new Date(iso);
|
|
869
854
|
if (Number.isNaN(date.getTime())) return "";
|
|
@@ -935,8 +920,7 @@ function NotificationPanel({ title = "Notifications", emptyTitle = "You're all c
|
|
|
935
920
|
]
|
|
936
921
|
});
|
|
937
922
|
}
|
|
938
|
-
|
|
939
|
-
//#region packages/admin/auth/LoginPage.tsx
|
|
923
|
+
// packages/admin/auth/LoginPage.tsx
|
|
940
924
|
function joinApiPath$6(apiBaseUrl, path) {
|
|
941
925
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
942
926
|
}
|
|
@@ -1068,8 +1052,7 @@ function LoginPage({ onLoggedIn, apiBaseUrl = "/api/", loginPath = "auth/login",
|
|
|
1068
1052
|
}) })
|
|
1069
1053
|
});
|
|
1070
1054
|
}
|
|
1071
|
-
|
|
1072
|
-
//#region packages/admin/auth/ForgotPasswordPage.tsx
|
|
1055
|
+
// packages/admin/auth/ForgotPasswordPage.tsx
|
|
1073
1056
|
function joinApiPath$5(apiBaseUrl, path) {
|
|
1074
1057
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1075
1058
|
}
|
|
@@ -1140,8 +1123,7 @@ function ForgotPasswordPage({ apiBaseUrl = "/api/" }) {
|
|
|
1140
1123
|
}) })
|
|
1141
1124
|
});
|
|
1142
1125
|
}
|
|
1143
|
-
|
|
1144
|
-
//#region packages/admin/auth/ResetPasswordPage.tsx
|
|
1126
|
+
// packages/admin/auth/ResetPasswordPage.tsx
|
|
1145
1127
|
function joinApiPath$4(apiBaseUrl, path) {
|
|
1146
1128
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1147
1129
|
}
|
|
@@ -1236,8 +1218,7 @@ function ResetPasswordPage({ apiBaseUrl = "/api/" }) {
|
|
|
1236
1218
|
}) })
|
|
1237
1219
|
});
|
|
1238
1220
|
}
|
|
1239
|
-
|
|
1240
|
-
//#region packages/admin/auth/AcceptInvitationPage.tsx
|
|
1221
|
+
// packages/admin/auth/AcceptInvitationPage.tsx
|
|
1241
1222
|
function joinApiPath$3(apiBaseUrl, path) {
|
|
1242
1223
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1243
1224
|
}
|
|
@@ -1353,8 +1334,7 @@ function AcceptInvitationPage({ apiBaseUrl = "/api/" }) {
|
|
|
1353
1334
|
}) })
|
|
1354
1335
|
});
|
|
1355
1336
|
}
|
|
1356
|
-
|
|
1357
|
-
//#region packages/admin/auth/AccountPage.tsx
|
|
1337
|
+
// packages/admin/auth/AccountPage.tsx
|
|
1358
1338
|
function joinApiPath$2(apiBaseUrl, path) {
|
|
1359
1339
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1360
1340
|
}
|
|
@@ -1640,8 +1620,7 @@ function AccountPage({ apiBaseUrl = "/api/" }) {
|
|
|
1640
1620
|
]
|
|
1641
1621
|
});
|
|
1642
1622
|
}
|
|
1643
|
-
|
|
1644
|
-
//#region packages/admin/auth/RegisterPage.tsx
|
|
1623
|
+
// packages/admin/auth/RegisterPage.tsx
|
|
1645
1624
|
function joinApiPath$1(apiBaseUrl, path) {
|
|
1646
1625
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1647
1626
|
}
|
|
@@ -1760,8 +1739,7 @@ function RegisterPage({ fields, onRegistered, apiBaseUrl = "/api/", registerPath
|
|
|
1760
1739
|
}) })
|
|
1761
1740
|
});
|
|
1762
1741
|
}
|
|
1763
|
-
|
|
1764
|
-
//#region packages/admin/runtime/useAppRuntime.ts
|
|
1742
|
+
// packages/admin/runtime/useAppRuntime.ts
|
|
1765
1743
|
function useAppRuntime() {
|
|
1766
1744
|
const [toasts, setToasts] = useState([]);
|
|
1767
1745
|
const dismiss = useCallback((id) => {
|
|
@@ -1789,8 +1767,7 @@ function useAppRuntime() {
|
|
|
1789
1767
|
dismiss
|
|
1790
1768
|
};
|
|
1791
1769
|
}
|
|
1792
|
-
|
|
1793
|
-
//#region packages/admin/runtime/useRuntimeConfig.ts
|
|
1770
|
+
// packages/admin/runtime/useRuntimeConfig.ts
|
|
1794
1771
|
function joinApiPath(apiBaseUrl, path) {
|
|
1795
1772
|
return `${apiBaseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
1796
1773
|
}
|
|
@@ -1832,8 +1809,7 @@ function useRuntimeConfig({ apiBaseUrl = "/api/", path = "runtime-config", enabl
|
|
|
1832
1809
|
refresh
|
|
1833
1810
|
};
|
|
1834
1811
|
}
|
|
1835
|
-
|
|
1836
|
-
//#region packages/admin/runtime/ToastHost.tsx
|
|
1812
|
+
// packages/admin/runtime/ToastHost.tsx
|
|
1837
1813
|
const TYPE_CLASS = {
|
|
1838
1814
|
success: "nb-toast--success",
|
|
1839
1815
|
error: "nb-toast--error",
|
|
@@ -1857,8 +1833,7 @@ function ToastHost({ toasts, onDismiss }) {
|
|
|
1857
1833
|
}, toast.id))
|
|
1858
1834
|
});
|
|
1859
1835
|
}
|
|
1860
|
-
|
|
1861
|
-
//#region packages/admin/devtools/NubitDevToolsPanel.tsx
|
|
1836
|
+
// packages/admin/devtools/NubitDevToolsPanel.tsx
|
|
1862
1837
|
const PROVIDER_TREE = [
|
|
1863
1838
|
"MercureProvider",
|
|
1864
1839
|
"SchemaProvider",
|
|
@@ -2009,8 +1984,7 @@ function NubitDevToolsPanel() {
|
|
|
2009
1984
|
})]
|
|
2010
1985
|
});
|
|
2011
1986
|
}
|
|
2012
|
-
|
|
2013
|
-
//#region packages/admin/app/ErrorBoundary.tsx
|
|
1987
|
+
// packages/admin/app/ErrorBoundary.tsx
|
|
2014
1988
|
/**
|
|
2015
1989
|
* Keeps a thrown field renderer from taking the whole admin down with it.
|
|
2016
1990
|
*/
|
|
@@ -2057,8 +2031,7 @@ var ErrorBoundary = class extends Component {
|
|
|
2057
2031
|
});
|
|
2058
2032
|
}
|
|
2059
2033
|
};
|
|
2060
|
-
|
|
2061
|
-
//#region packages/admin/app/filterMenuByRoles.ts
|
|
2034
|
+
// packages/admin/app/filterMenuByRoles.ts
|
|
2062
2035
|
function hasAnyRole(required, roles) {
|
|
2063
2036
|
if (required === void 0) return true;
|
|
2064
2037
|
return (Array.isArray(required) ? required : [required]).some((role) => roles.includes(role));
|
|
@@ -2096,8 +2069,7 @@ function filterMenuByRoles(items, roles) {
|
|
|
2096
2069
|
function resolveAppMenu(menu, ctx) {
|
|
2097
2070
|
return typeof menu === "function" ? menu(ctx) : menu;
|
|
2098
2071
|
}
|
|
2099
|
-
|
|
2100
|
-
//#region packages/admin/app/createNubitApp.tsx
|
|
2072
|
+
// packages/admin/app/createNubitApp.tsx
|
|
2101
2073
|
function defaultUserMenu({ username, close, logout }) {
|
|
2102
2074
|
return /* @__PURE__ */ jsxs("div", {
|
|
2103
2075
|
style: {
|
|
@@ -2296,5 +2268,4 @@ function createNubitApp(config) {
|
|
|
2296
2268
|
}
|
|
2297
2269
|
return { App };
|
|
2298
2270
|
}
|
|
2299
|
-
//#endregion
|
|
2300
2271
|
export { AcceptInvitationPage, AccountPage, AdminBottomNavigation, AdminHeader, AdminShell, AdminSidebarMenu, FeatureGate, FeatureHubLayout, ForgotPasswordPage, LoginPage, NotificationPanel, NubitDevToolsPanel, PlanPanel, QuotaUsageBanner, RegisterPage, ResetPasswordPage, SessionProvider, StaticSessionProvider, ToastHost, createNubitApp, filterMenuByRoles, hasAnyRole, parseQuotaError, quotaErrorToastMessage, quotaUsageAboveGrid, useAppRuntime, useFeature, useFeatureConfig, useNotifications, useQuotaUsage, useRuntimeConfig, useScreenSize, useScreenSizeClass, useSession };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubitio/admin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Admin shell layout components: responsive sidebar, header, and screen size utilities for Nubit apps.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"react": "^18.2.0 || ^19.0.0",
|
|
54
54
|
"react-dom": "^18.2.0 || ^19.0.0",
|
|
55
55
|
"react-router-dom": "^6.0.0 || ^7.0.0",
|
|
56
|
-
"@nubitio/
|
|
57
|
-
"@nubitio/crud": "^1.
|
|
58
|
-
"@nubitio/
|
|
59
|
-
"@nubitio/ui": "^1.
|
|
56
|
+
"@nubitio/core": "^1.4.0",
|
|
57
|
+
"@nubitio/crud": "^1.4.0",
|
|
58
|
+
"@nubitio/hydra": "^1.4.0",
|
|
59
|
+
"@nubitio/ui": "^1.4.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"react-router-dom": "^
|
|
62
|
+
"react-router-dom": "^7.18.6"
|
|
63
63
|
}
|
|
64
64
|
}
|