@nubitio/admin 1.1.1 → 1.1.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/dist/index.cjs +116 -62
- package/dist/index.d.cts +39 -141
- package/dist/index.d.mts +40 -142
- package/dist/index.mjs +116 -62
- package/package.json +8 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React$1, { ReactNode } from "react";
|
|
2
2
|
import { FeatureGateProps as FeatureGateProps$1 } from "@nubitio/ui";
|
|
3
|
-
import { QueryClient } from "@tanstack/react-query";
|
|
4
3
|
import { CoreRuntime } from "@nubitio/core";
|
|
5
|
-
|
|
4
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
6
5
|
//#region packages/admin/FeatureHubLayout.d.ts
|
|
7
6
|
interface FeatureHubTab {
|
|
8
7
|
key: string;
|
|
@@ -33,17 +32,7 @@ interface FeatureHubLayoutProps {
|
|
|
33
32
|
density?: FeatureHubDensity;
|
|
34
33
|
className?: string;
|
|
35
34
|
}
|
|
36
|
-
declare function FeatureHubLayout({
|
|
37
|
-
title,
|
|
38
|
-
subtitle,
|
|
39
|
-
tabs,
|
|
40
|
-
basePath,
|
|
41
|
-
defaultPath,
|
|
42
|
-
banner,
|
|
43
|
-
tabsAriaLabel,
|
|
44
|
-
density,
|
|
45
|
-
className
|
|
46
|
-
}: FeatureHubLayoutProps): import("react").JSX.Element;
|
|
35
|
+
declare function FeatureHubLayout({ title, subtitle, tabs, basePath, defaultPath, banner, tabsAriaLabel, density, className }: FeatureHubLayoutProps): import("react").JSX.Element;
|
|
47
36
|
//#endregion
|
|
48
37
|
//#region packages/admin/AdminHeader.d.ts
|
|
49
38
|
interface AdminHeaderAction {
|
|
@@ -68,15 +57,7 @@ interface AdminHeaderProps {
|
|
|
68
57
|
}) => React$1.ReactNode;
|
|
69
58
|
renderThemeSwitcher?: () => React$1.ReactNode;
|
|
70
59
|
}
|
|
71
|
-
declare const AdminHeader: ({
|
|
72
|
-
title,
|
|
73
|
-
menuToggleEnabled,
|
|
74
|
-
toggleMenu,
|
|
75
|
-
className,
|
|
76
|
-
actions,
|
|
77
|
-
renderUserMenu,
|
|
78
|
-
renderThemeSwitcher
|
|
79
|
-
}: AdminHeaderProps) => React$1.JSX.Element;
|
|
60
|
+
declare const AdminHeader: ({ title, menuToggleEnabled, toggleMenu, className, actions, renderUserMenu, renderThemeSwitcher }: AdminHeaderProps) => React$1.JSX.Element;
|
|
80
61
|
//#endregion
|
|
81
62
|
//#region packages/admin/AdminSidebarMenu.d.ts
|
|
82
63
|
interface AdminMenuSubItem {
|
|
@@ -101,13 +82,7 @@ interface AdminSidebarMenuProps {
|
|
|
101
82
|
openMenu?: (e: React$1.PointerEvent) => void;
|
|
102
83
|
footer?: React$1.ReactNode;
|
|
103
84
|
}
|
|
104
|
-
declare const AdminSidebarMenu: ({
|
|
105
|
-
items,
|
|
106
|
-
compactMode,
|
|
107
|
-
selectedItemChanged,
|
|
108
|
-
openMenu,
|
|
109
|
-
footer
|
|
110
|
-
}: AdminSidebarMenuProps) => React$1.JSX.Element;
|
|
85
|
+
declare const AdminSidebarMenu: ({ items, compactMode, selectedItemChanged, openMenu, footer }: AdminSidebarMenuProps) => React$1.JSX.Element;
|
|
111
86
|
//#endregion
|
|
112
87
|
//#region packages/admin/AdminShell.d.ts
|
|
113
88
|
interface AdminShellProps {
|
|
@@ -121,15 +96,7 @@ interface AdminShellProps {
|
|
|
121
96
|
footer?: React$1.ReactNode;
|
|
122
97
|
children: React$1.ReactNode;
|
|
123
98
|
}
|
|
124
|
-
declare const AdminShell: ({
|
|
125
|
-
title,
|
|
126
|
-
menuItems,
|
|
127
|
-
headerActions,
|
|
128
|
-
renderUserMenu,
|
|
129
|
-
renderThemeSwitcher,
|
|
130
|
-
footer,
|
|
131
|
-
children
|
|
132
|
-
}: AdminShellProps) => React$1.JSX.Element;
|
|
99
|
+
declare const AdminShell: ({ title, menuItems, headerActions, renderUserMenu, renderThemeSwitcher, footer, children }: AdminShellProps) => React$1.JSX.Element;
|
|
133
100
|
//#endregion
|
|
134
101
|
//#region packages/admin/useScreenSize.d.ts
|
|
135
102
|
declare const useScreenSize: () => {
|
|
@@ -158,12 +125,16 @@ type SessionPermissionLimit = {
|
|
|
158
125
|
};
|
|
159
126
|
type SessionProfile = {
|
|
160
127
|
username: string;
|
|
161
|
-
roles: string[];
|
|
128
|
+
roles: string[];
|
|
129
|
+
/** Present when the backend runs nubitio/admin-bundle ≥ 0.1 session contract. */
|
|
162
130
|
appProfile?: AppProfile;
|
|
163
131
|
tenant?: SessionTenant;
|
|
164
|
-
features?: Record<string, SessionFeatureEntitlement>;
|
|
165
|
-
|
|
166
|
-
|
|
132
|
+
features?: Record<string, SessionFeatureEntitlement>;
|
|
133
|
+
/** Effective `resource.action` names when the authorization module is on. */
|
|
134
|
+
permissions?: string[];
|
|
135
|
+
/** Permission name → amount cap, as `/api/me` publishes it. */
|
|
136
|
+
limits?: Record<string, SessionPermissionLimit>;
|
|
137
|
+
/** IANA zone the UI must render timestamps in. Storage is always UTC. */
|
|
167
138
|
timeZone?: string;
|
|
168
139
|
};
|
|
169
140
|
type SessionState = {
|
|
@@ -189,20 +160,12 @@ interface SessionContextValue {
|
|
|
189
160
|
roles: string[];
|
|
190
161
|
username: string | null;
|
|
191
162
|
}
|
|
192
|
-
declare function SessionProvider({
|
|
193
|
-
apiBaseUrl,
|
|
194
|
-
mePath,
|
|
195
|
-
logoutPath,
|
|
196
|
-
children
|
|
197
|
-
}: SessionProviderConfig & {
|
|
163
|
+
declare function SessionProvider({ apiBaseUrl, mePath, logoutPath, children }: SessionProviderConfig & {
|
|
198
164
|
children: React$1.ReactNode;
|
|
199
165
|
}): React$1.JSX.Element;
|
|
200
166
|
declare function useSession(): SessionContextValue;
|
|
201
167
|
/** Seeds session state from a known profile (e.g. after a custom /api/me fetch). */
|
|
202
|
-
declare function StaticSessionProvider({
|
|
203
|
-
profile,
|
|
204
|
-
children
|
|
205
|
-
}: {
|
|
168
|
+
declare function StaticSessionProvider({ profile, children }: {
|
|
206
169
|
profile: SessionProfile;
|
|
207
170
|
children: React$1.ReactNode;
|
|
208
171
|
}): React$1.JSX.Element;
|
|
@@ -213,10 +176,7 @@ declare function useFeatureConfig(featureKey: string): Record<string, unknown>;
|
|
|
213
176
|
//#endregion
|
|
214
177
|
//#region packages/admin/features/FeatureGate.d.ts
|
|
215
178
|
type FeatureGateProps = Omit<FeatureGateProps$1, 'enabled'>;
|
|
216
|
-
declare function FeatureGate({
|
|
217
|
-
featureKey,
|
|
218
|
-
...props
|
|
219
|
-
}: FeatureGateProps): React$1.JSX.Element;
|
|
179
|
+
declare function FeatureGate({ featureKey, ...props }: FeatureGateProps): React$1.JSX.Element;
|
|
220
180
|
//#endregion
|
|
221
181
|
//#region packages/admin/quota/QuotaUsageBanner.d.ts
|
|
222
182
|
interface QuotaUsageBannerProps {
|
|
@@ -231,18 +191,7 @@ interface QuotaUsageBannerProps {
|
|
|
231
191
|
upgradeLabel?: string;
|
|
232
192
|
className?: string;
|
|
233
193
|
}
|
|
234
|
-
declare function QuotaUsageBanner({
|
|
235
|
-
count,
|
|
236
|
-
max,
|
|
237
|
-
unitLabel,
|
|
238
|
-
planLabel,
|
|
239
|
-
atLimitMessage,
|
|
240
|
-
nearLimitMessage,
|
|
241
|
-
defaultMessage,
|
|
242
|
-
upgradeHref,
|
|
243
|
-
upgradeLabel,
|
|
244
|
-
className
|
|
245
|
-
}: QuotaUsageBannerProps): import("react").JSX.Element | null;
|
|
194
|
+
declare function QuotaUsageBanner({ count, max, unitLabel, planLabel, atLimitMessage, nearLimitMessage, defaultMessage, upgradeHref, upgradeLabel, className }: QuotaUsageBannerProps): import("react").JSX.Element | null;
|
|
246
195
|
declare function quotaUsageAboveGrid(banner: ReactNode): () => ReactNode;
|
|
247
196
|
//#endregion
|
|
248
197
|
//#region packages/admin/billing/PlanPanel.d.ts
|
|
@@ -272,16 +221,7 @@ interface PlanPanelProps {
|
|
|
272
221
|
labels?: PlanPanelLabels;
|
|
273
222
|
className?: string;
|
|
274
223
|
}
|
|
275
|
-
declare function PlanPanel({
|
|
276
|
-
plans,
|
|
277
|
-
currentPlanId,
|
|
278
|
-
subscriptionStatus,
|
|
279
|
-
trialEndsAt,
|
|
280
|
-
onSelectPlan,
|
|
281
|
-
selectingPlanId,
|
|
282
|
-
labels,
|
|
283
|
-
className
|
|
284
|
-
}: PlanPanelProps): import("react").JSX.Element;
|
|
224
|
+
declare function PlanPanel({ plans, currentPlanId, subscriptionStatus, trialEndsAt, onSelectPlan, selectingPlanId, labels, className }: PlanPanelProps): import("react").JSX.Element;
|
|
285
225
|
//#endregion
|
|
286
226
|
//#region packages/admin/quota/parseQuotaError.d.ts
|
|
287
227
|
interface ParsedQuotaError {
|
|
@@ -299,11 +239,7 @@ interface UseQuotaUsageOptions {
|
|
|
299
239
|
collectionPath: string;
|
|
300
240
|
staleTimeMs?: number;
|
|
301
241
|
}
|
|
302
|
-
declare function useQuotaUsage({
|
|
303
|
-
featureKey,
|
|
304
|
-
collectionPath,
|
|
305
|
-
staleTimeMs
|
|
306
|
-
}: UseQuotaUsageOptions): {
|
|
242
|
+
declare function useQuotaUsage({ featureKey, collectionPath, staleTimeMs }: UseQuotaUsageOptions): {
|
|
307
243
|
count: number;
|
|
308
244
|
max: number;
|
|
309
245
|
atLimit: boolean;
|
|
@@ -325,15 +261,12 @@ interface UseNotificationsOptions {
|
|
|
325
261
|
staleTimeMs?: number;
|
|
326
262
|
}
|
|
327
263
|
/** Fetches the current user's notifications and keeps them live via Mercure — see InAppNotificationChannel on the backend. */
|
|
328
|
-
declare function useNotifications({
|
|
329
|
-
apiUrl,
|
|
330
|
-
staleTimeMs
|
|
331
|
-
}?: UseNotificationsOptions): {
|
|
264
|
+
declare function useNotifications({ apiUrl, staleTimeMs }?: UseNotificationsOptions): {
|
|
332
265
|
items: NotificationItem[];
|
|
333
266
|
unreadCount: number;
|
|
334
267
|
loading: boolean;
|
|
335
268
|
markAsRead: (id: NotificationItem["id"]) => void;
|
|
336
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<
|
|
269
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NotificationItem[], Error>>;
|
|
337
270
|
};
|
|
338
271
|
//#endregion
|
|
339
272
|
//#region packages/admin/notifications/NotificationPanel.d.ts
|
|
@@ -343,12 +276,7 @@ interface NotificationPanelProps extends UseNotificationsOptions {
|
|
|
343
276
|
markAllReadLabel?: string;
|
|
344
277
|
}
|
|
345
278
|
/** Renders inside an AdminHeaderAction.renderPanel — see AdminHeader's `actions` prop. */
|
|
346
|
-
declare function NotificationPanel({
|
|
347
|
-
title,
|
|
348
|
-
emptyTitle,
|
|
349
|
-
markAllReadLabel,
|
|
350
|
-
...options
|
|
351
|
-
}: NotificationPanelProps): React$1.JSX.Element;
|
|
279
|
+
declare function NotificationPanel({ title, emptyTitle, markAllReadLabel, ...options }: NotificationPanelProps): React$1.JSX.Element;
|
|
352
280
|
//#endregion
|
|
353
281
|
//#region packages/admin/auth/LoginPage.d.ts
|
|
354
282
|
interface LoginOidcProvider {
|
|
@@ -365,48 +293,31 @@ interface LoginPageProps {
|
|
|
365
293
|
oidcProviders?: LoginOidcProvider[];
|
|
366
294
|
forgotPasswordTo?: string;
|
|
367
295
|
}
|
|
368
|
-
declare function LoginPage({
|
|
369
|
-
onLoggedIn,
|
|
370
|
-
apiBaseUrl,
|
|
371
|
-
loginPath,
|
|
372
|
-
title,
|
|
373
|
-
hint,
|
|
374
|
-
defaultUsername,
|
|
375
|
-
oidcProviders,
|
|
376
|
-
forgotPasswordTo
|
|
377
|
-
}: LoginPageProps): import("react").JSX.Element;
|
|
296
|
+
declare function LoginPage({ onLoggedIn, apiBaseUrl, loginPath, title, hint, defaultUsername, oidcProviders, forgotPasswordTo }: LoginPageProps): import("react").JSX.Element;
|
|
378
297
|
//#endregion
|
|
379
298
|
//#region packages/admin/auth/ForgotPasswordPage.d.ts
|
|
380
299
|
interface ForgotPasswordPageProps {
|
|
381
300
|
apiBaseUrl?: string;
|
|
382
301
|
}
|
|
383
|
-
declare function ForgotPasswordPage({
|
|
384
|
-
apiBaseUrl
|
|
385
|
-
}: ForgotPasswordPageProps): import("react").JSX.Element;
|
|
302
|
+
declare function ForgotPasswordPage({ apiBaseUrl }: ForgotPasswordPageProps): import("react").JSX.Element;
|
|
386
303
|
//#endregion
|
|
387
304
|
//#region packages/admin/auth/ResetPasswordPage.d.ts
|
|
388
305
|
interface ResetPasswordPageProps {
|
|
389
306
|
apiBaseUrl?: string;
|
|
390
307
|
}
|
|
391
|
-
declare function ResetPasswordPage({
|
|
392
|
-
apiBaseUrl
|
|
393
|
-
}: ResetPasswordPageProps): import("react").JSX.Element;
|
|
308
|
+
declare function ResetPasswordPage({ apiBaseUrl }: ResetPasswordPageProps): import("react").JSX.Element;
|
|
394
309
|
//#endregion
|
|
395
310
|
//#region packages/admin/auth/AcceptInvitationPage.d.ts
|
|
396
311
|
interface AcceptInvitationPageProps {
|
|
397
312
|
apiBaseUrl?: string;
|
|
398
313
|
}
|
|
399
|
-
declare function AcceptInvitationPage({
|
|
400
|
-
apiBaseUrl
|
|
401
|
-
}: AcceptInvitationPageProps): import("react").JSX.Element;
|
|
314
|
+
declare function AcceptInvitationPage({ apiBaseUrl }: AcceptInvitationPageProps): import("react").JSX.Element;
|
|
402
315
|
//#endregion
|
|
403
316
|
//#region packages/admin/auth/AccountPage.d.ts
|
|
404
317
|
interface AccountPageProps {
|
|
405
318
|
apiBaseUrl?: string;
|
|
406
319
|
}
|
|
407
|
-
declare function AccountPage({
|
|
408
|
-
apiBaseUrl
|
|
409
|
-
}: AccountPageProps): import("react").JSX.Element;
|
|
320
|
+
declare function AccountPage({ apiBaseUrl }: AccountPageProps): import("react").JSX.Element;
|
|
410
321
|
//#endregion
|
|
411
322
|
//#region packages/admin/auth/RegisterPage.d.ts
|
|
412
323
|
type RegisterFieldType = 'text' | 'email' | 'password' | 'select';
|
|
@@ -443,18 +354,7 @@ interface RegisterPageProps {
|
|
|
443
354
|
};
|
|
444
355
|
loginPrompt?: string;
|
|
445
356
|
}
|
|
446
|
-
declare function RegisterPage({
|
|
447
|
-
fields,
|
|
448
|
-
onRegistered,
|
|
449
|
-
apiBaseUrl,
|
|
450
|
-
registerPath,
|
|
451
|
-
title,
|
|
452
|
-
hint,
|
|
453
|
-
submitLabel,
|
|
454
|
-
busyLabel,
|
|
455
|
-
loginLink,
|
|
456
|
-
loginPrompt
|
|
457
|
-
}: RegisterPageProps): import("react").JSX.Element;
|
|
357
|
+
declare function RegisterPage({ fields, onRegistered, apiBaseUrl, registerPath, title, hint, submitLabel, busyLabel, loginLink, loginPrompt }: RegisterPageProps): import("react").JSX.Element;
|
|
458
358
|
//#endregion
|
|
459
359
|
//#region packages/admin/runtime/useAppRuntime.d.ts
|
|
460
360
|
type NotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
@@ -490,11 +390,7 @@ interface UseRuntimeConfigOptions {
|
|
|
490
390
|
/** When false, skips the fetch (e.g. endpoint not enabled). @default true */
|
|
491
391
|
enabled?: boolean;
|
|
492
392
|
}
|
|
493
|
-
declare function useRuntimeConfig({
|
|
494
|
-
apiBaseUrl,
|
|
495
|
-
path,
|
|
496
|
-
enabled
|
|
497
|
-
}?: UseRuntimeConfigOptions): {
|
|
393
|
+
declare function useRuntimeConfig({ apiBaseUrl, path, enabled }?: UseRuntimeConfigOptions): {
|
|
498
394
|
state: RuntimeConfigState;
|
|
499
395
|
config: RuntimeConfig | null;
|
|
500
396
|
loading: boolean;
|
|
@@ -507,10 +403,7 @@ interface ToastHostProps {
|
|
|
507
403
|
toasts: ToastItem[];
|
|
508
404
|
onDismiss: (id: number) => void;
|
|
509
405
|
}
|
|
510
|
-
declare function ToastHost({
|
|
511
|
-
toasts,
|
|
512
|
-
onDismiss
|
|
513
|
-
}: ToastHostProps): import("react").JSX.Element | null;
|
|
406
|
+
declare function ToastHost({ toasts, onDismiss }: ToastHostProps): import("react").JSX.Element | null;
|
|
514
407
|
//#endregion
|
|
515
408
|
//#region packages/admin/app/types.d.ts
|
|
516
409
|
type NubitAppRoute = {
|
|
@@ -518,10 +411,12 @@ type NubitAppRoute = {
|
|
|
518
411
|
element: ReactNode;
|
|
519
412
|
};
|
|
520
413
|
type NubitAppMenuSubItem = AdminMenuSubItem & {
|
|
521
|
-
/** UX-only — hide unless the session has one of these roles. */
|
|
414
|
+
/** UX-only — hide unless the session has one of these roles. */
|
|
415
|
+
roles?: string | string[];
|
|
522
416
|
};
|
|
523
417
|
type NubitAppMenuItem = Omit<AdminMenuItem, 'items'> & {
|
|
524
|
-
/** UX-only — hide unless the session has one of these roles. */
|
|
418
|
+
/** UX-only — hide unless the session has one of these roles. */
|
|
419
|
+
roles?: string | string[];
|
|
525
420
|
items?: NubitAppMenuSubItem[];
|
|
526
421
|
};
|
|
527
422
|
type NubitAppMenuContext = {
|
|
@@ -540,7 +435,8 @@ type CreateNubitAppConfig = {
|
|
|
540
435
|
homePath?: string;
|
|
541
436
|
locale?: string;
|
|
542
437
|
timezone?: string;
|
|
543
|
-
currency?: string;
|
|
438
|
+
currency?: string;
|
|
439
|
+
/** Base URL for generated theme CSS files. Default `/themes/`. */
|
|
544
440
|
themeBasePath?: string;
|
|
545
441
|
menu: NubitAppMenuItem[] | ((ctx: NubitAppMenuContext) => NubitAppMenuItem[]);
|
|
546
442
|
routes: NubitAppRoute[];
|
|
@@ -560,11 +456,13 @@ type CreateNubitAppConfig = {
|
|
|
560
456
|
};
|
|
561
457
|
shell?: Pick<AdminShellProps, 'headerActions' | 'footer'>;
|
|
562
458
|
renderThemeSwitcher?: () => ReactNode;
|
|
563
|
-
renderUserMenu?: (ctx: NubitAppUserMenuContext) => ReactNode;
|
|
459
|
+
renderUserMenu?: (ctx: NubitAppUserMenuContext) => ReactNode;
|
|
460
|
+
/** Wraps authenticated shell content (inside Hydra providers). */
|
|
564
461
|
Wrapper?: React.ComponentType<{
|
|
565
462
|
children: ReactNode;
|
|
566
463
|
}>;
|
|
567
|
-
queryClient?: QueryClient;
|
|
464
|
+
queryClient?: QueryClient;
|
|
465
|
+
/** Register Mercure + Hydra schema/store providers. Default true. */
|
|
568
466
|
hydra?: boolean;
|
|
569
467
|
/**
|
|
570
468
|
* Show the Nubit DevTools panel (field mapping, provider tree).
|