@realiizlabs/admin 0.11.2 → 0.13.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.
Files changed (39) hide show
  1. package/dist/Sidebar-CNuphww6.d.cts +60 -0
  2. package/dist/Sidebar-CNuphww6.d.ts +60 -0
  3. package/dist/auth/index.d.cts +5 -127
  4. package/dist/auth/index.d.ts +5 -127
  5. package/dist/auth-ui/index.js +124 -1
  6. package/dist/auth-ui/index.js.map +1 -1
  7. package/dist/forms/index.js +287 -1
  8. package/dist/forms/index.js.map +1 -1
  9. package/dist/forms-ui/index.js +355 -6
  10. package/dist/forms-ui/index.js.map +1 -1
  11. package/dist/git/index.cjs.map +1 -1
  12. package/dist/git/index.d.cts +3 -77
  13. package/dist/git/index.d.ts +3 -77
  14. package/dist/git/index.js.map +1 -1
  15. package/dist/members-nhbRSYyr.d.cts +106 -0
  16. package/dist/members-nhbRSYyr.d.ts +106 -0
  17. package/dist/roles-BjWuj2_v.d.cts +25 -0
  18. package/dist/roles-Dnwj-DAm.d.ts +25 -0
  19. package/dist/shell/index.d.cts +3 -58
  20. package/dist/shell/index.d.ts +3 -58
  21. package/dist/studio/index.cjs +1150 -0
  22. package/dist/studio/index.cjs.map +1 -0
  23. package/dist/studio/index.d.cts +325 -0
  24. package/dist/studio/index.d.ts +325 -0
  25. package/dist/studio/index.js +1131 -0
  26. package/dist/studio/index.js.map +1 -0
  27. package/dist/studio-ui/index.cjs +3931 -0
  28. package/dist/studio-ui/index.cjs.map +1 -0
  29. package/dist/studio-ui/index.d.cts +375 -0
  30. package/dist/studio-ui/index.d.ts +375 -0
  31. package/dist/studio-ui/index.js +3900 -0
  32. package/dist/studio-ui/index.js.map +1 -0
  33. package/dist/types-BP5G1myE.d.cts +78 -0
  34. package/dist/types-BP5G1myE.d.ts +78 -0
  35. package/package.json +20 -2
  36. package/dist/chunk-2GSYBARR.js +0 -126
  37. package/dist/chunk-2GSYBARR.js.map +0 -1
  38. package/dist/chunk-JLR5K6RP.js +0 -289
  39. package/dist/chunk-JLR5K6RP.js.map +0 -1
@@ -0,0 +1,106 @@
1
+ import { SupabaseClient } from '@supabase/supabase-js';
2
+
3
+ /**
4
+ * Types for the identity layer. All config arrives as arguments — never env.
5
+ */
6
+ /**
7
+ * Either cookie-store shape a host can hand us:
8
+ * - @supabase/ssr's CookieMethodsServer: { getAll, setAll }
9
+ * - Next's `await cookies()` store: { getAll, set }
10
+ * `setAll` is preferred when present; otherwise each cookie goes through `set`.
11
+ */
12
+ interface CookieStore {
13
+ getAll(): {
14
+ name: string;
15
+ value: string;
16
+ }[] | Promise<{
17
+ name: string;
18
+ value: string;
19
+ }[]>;
20
+ setAll?(cookies: {
21
+ name: string;
22
+ value: string;
23
+ options?: Record<string, unknown>;
24
+ }[]): void | Promise<void>;
25
+ set?(name: string, value: string, options?: Record<string, unknown>): unknown;
26
+ }
27
+ /** Enough to read the signed-in user with the anon key + their cookies. */
28
+ interface IdentityContext {
29
+ url: string;
30
+ anonKey: string;
31
+ cookies: CookieStore;
32
+ }
33
+ /** Server-only. The service-role key bypasses RLS; the module checks roles in code first. */
34
+ interface ServiceContext {
35
+ url: string;
36
+ serviceRoleKey: string;
37
+ }
38
+ type SiteRole = "staff" | "owner" | "editor";
39
+ declare const ROLE_RANK: Record<SiteRole, number>;
40
+ interface IdentityUser {
41
+ id: string;
42
+ email: string | null;
43
+ }
44
+ interface SiteMembership {
45
+ userId: string;
46
+ siteId: string;
47
+ role: "owner" | "editor";
48
+ }
49
+
50
+ /**
51
+ * createIdentityClient — a Supabase client bound to the request's cookies.
52
+ *
53
+ * Built per request from arguments. A Next 16 route does:
54
+ *
55
+ * const store = await cookies();
56
+ * const client = createIdentityClient({ url, anonKey, cookies: store });
57
+ *
58
+ * No `next` import here. The CookieStore interface accepts either shape a
59
+ * host might hand us: @supabase/ssr's { getAll, setAll }, or Next's
60
+ * cookies() store, which has { getAll, set } — the session cookies are
61
+ * written through whichever exists. (Observed 2026-09-08: with only setAll
62
+ * supported, Next's store silently wrote nothing and every sign-in bounced.)
63
+ */
64
+
65
+ type IdentityClient = SupabaseClient;
66
+ declare function createIdentityClient(ctx: IdentityContext): IdentityClient;
67
+
68
+ /**
69
+ * Per-site branding — the Business tab. Reads and writes public.sites through
70
+ * the signed-in user's client, so RLS decides who may (members read; owners
71
+ * and staff write). Nothing here needs the service role.
72
+ */
73
+
74
+ interface SiteBranding {
75
+ name: string;
76
+ logoUrl: string | null;
77
+ faviconUrl: string | null;
78
+ businessEmail: string | null;
79
+ businessPhone: string | null;
80
+ }
81
+ type BrandingPatch = Partial<SiteBranding> & {
82
+ name: string;
83
+ };
84
+ declare function getSiteBranding(client: IdentityClient, siteId: string): Promise<SiteBranding | null>;
85
+ /** Upsert the row. RLS refuses anyone but the site's owners or staff. */
86
+ declare function updateSiteBranding(client: IdentityClient, siteId: string, patch: BrandingPatch): Promise<void>;
87
+
88
+ /**
89
+ * The Team roster — public.site_members(site_id), a SECURITY DEFINER function
90
+ * that returns rows only to that site's owners or staff (editors get a 42501).
91
+ * Read with the signed-in user's client; writes are in service.ts.
92
+ */
93
+
94
+ interface SiteMember {
95
+ userId: string;
96
+ email: string;
97
+ name: string | null;
98
+ avatarUrl: string | null;
99
+ role: "owner" | "editor";
100
+ /** "invited" until the person has signed in once. */
101
+ status: "invited" | "active";
102
+ invitedAt: string;
103
+ }
104
+ declare function listSiteMembers(client: IdentityClient, siteId: string): Promise<SiteMember[]>;
105
+
106
+ export { type BrandingPatch as B, type CookieStore as C, type IdentityClient as I, ROLE_RANK as R, type ServiceContext as S, type IdentityUser as a, type IdentityContext as b, type SiteBranding as c, type SiteMember as d, type SiteMembership as e, type SiteRole as f, createIdentityClient as g, getSiteBranding as h, listSiteMembers as l, updateSiteBranding as u };
@@ -0,0 +1,106 @@
1
+ import { SupabaseClient } from '@supabase/supabase-js';
2
+
3
+ /**
4
+ * Types for the identity layer. All config arrives as arguments — never env.
5
+ */
6
+ /**
7
+ * Either cookie-store shape a host can hand us:
8
+ * - @supabase/ssr's CookieMethodsServer: { getAll, setAll }
9
+ * - Next's `await cookies()` store: { getAll, set }
10
+ * `setAll` is preferred when present; otherwise each cookie goes through `set`.
11
+ */
12
+ interface CookieStore {
13
+ getAll(): {
14
+ name: string;
15
+ value: string;
16
+ }[] | Promise<{
17
+ name: string;
18
+ value: string;
19
+ }[]>;
20
+ setAll?(cookies: {
21
+ name: string;
22
+ value: string;
23
+ options?: Record<string, unknown>;
24
+ }[]): void | Promise<void>;
25
+ set?(name: string, value: string, options?: Record<string, unknown>): unknown;
26
+ }
27
+ /** Enough to read the signed-in user with the anon key + their cookies. */
28
+ interface IdentityContext {
29
+ url: string;
30
+ anonKey: string;
31
+ cookies: CookieStore;
32
+ }
33
+ /** Server-only. The service-role key bypasses RLS; the module checks roles in code first. */
34
+ interface ServiceContext {
35
+ url: string;
36
+ serviceRoleKey: string;
37
+ }
38
+ type SiteRole = "staff" | "owner" | "editor";
39
+ declare const ROLE_RANK: Record<SiteRole, number>;
40
+ interface IdentityUser {
41
+ id: string;
42
+ email: string | null;
43
+ }
44
+ interface SiteMembership {
45
+ userId: string;
46
+ siteId: string;
47
+ role: "owner" | "editor";
48
+ }
49
+
50
+ /**
51
+ * createIdentityClient — a Supabase client bound to the request's cookies.
52
+ *
53
+ * Built per request from arguments. A Next 16 route does:
54
+ *
55
+ * const store = await cookies();
56
+ * const client = createIdentityClient({ url, anonKey, cookies: store });
57
+ *
58
+ * No `next` import here. The CookieStore interface accepts either shape a
59
+ * host might hand us: @supabase/ssr's { getAll, setAll }, or Next's
60
+ * cookies() store, which has { getAll, set } — the session cookies are
61
+ * written through whichever exists. (Observed 2026-09-08: with only setAll
62
+ * supported, Next's store silently wrote nothing and every sign-in bounced.)
63
+ */
64
+
65
+ type IdentityClient = SupabaseClient;
66
+ declare function createIdentityClient(ctx: IdentityContext): IdentityClient;
67
+
68
+ /**
69
+ * Per-site branding — the Business tab. Reads and writes public.sites through
70
+ * the signed-in user's client, so RLS decides who may (members read; owners
71
+ * and staff write). Nothing here needs the service role.
72
+ */
73
+
74
+ interface SiteBranding {
75
+ name: string;
76
+ logoUrl: string | null;
77
+ faviconUrl: string | null;
78
+ businessEmail: string | null;
79
+ businessPhone: string | null;
80
+ }
81
+ type BrandingPatch = Partial<SiteBranding> & {
82
+ name: string;
83
+ };
84
+ declare function getSiteBranding(client: IdentityClient, siteId: string): Promise<SiteBranding | null>;
85
+ /** Upsert the row. RLS refuses anyone but the site's owners or staff. */
86
+ declare function updateSiteBranding(client: IdentityClient, siteId: string, patch: BrandingPatch): Promise<void>;
87
+
88
+ /**
89
+ * The Team roster — public.site_members(site_id), a SECURITY DEFINER function
90
+ * that returns rows only to that site's owners or staff (editors get a 42501).
91
+ * Read with the signed-in user's client; writes are in service.ts.
92
+ */
93
+
94
+ interface SiteMember {
95
+ userId: string;
96
+ email: string;
97
+ name: string | null;
98
+ avatarUrl: string | null;
99
+ role: "owner" | "editor";
100
+ /** "invited" until the person has signed in once. */
101
+ status: "invited" | "active";
102
+ invitedAt: string;
103
+ }
104
+ declare function listSiteMembers(client: IdentityClient, siteId: string): Promise<SiteMember[]>;
105
+
106
+ export { type BrandingPatch as B, type CookieStore as C, type IdentityClient as I, ROLE_RANK as R, type ServiceContext as S, type IdentityUser as a, type IdentityContext as b, type SiteBranding as c, type SiteMember as d, type SiteMembership as e, type SiteRole as f, createIdentityClient as g, getSiteBranding as h, listSiteMembers as l, updateSiteBranding as u };
@@ -0,0 +1,25 @@
1
+ import { f as SiteRole, I as IdentityClient, a as IdentityUser } from './members-nhbRSYyr.cjs';
2
+
3
+ /**
4
+ * Role resolution and the request gate.
5
+ *
6
+ * Two selects on the caller's OWN rows — both permitted by RLS with the anon
7
+ * key, so this never needs the service role. Staff wins over any site role.
8
+ */
9
+
10
+ declare function getSiteRole(client: IdentityClient, siteId: string, userId?: string): Promise<SiteRole | null>;
11
+ declare function roleAtLeast(actual: SiteRole | null, minimum: SiteRole): boolean;
12
+ interface RequireOptions {
13
+ /** Default "editor" — any member of the site. */
14
+ minimumRole?: SiteRole;
15
+ }
16
+ /**
17
+ * The gate. Throws UnauthenticatedError (→ sign in) or ForbiddenError (→ 403);
18
+ * otherwise returns the user and their effective role for this site.
19
+ */
20
+ declare function requireSiteUser(client: IdentityClient, siteId: string, opts?: RequireOptions): Promise<{
21
+ user: IdentityUser;
22
+ role: SiteRole;
23
+ }>;
24
+
25
+ export { type RequireOptions as R, roleAtLeast as a, getSiteRole as g, requireSiteUser as r };
@@ -0,0 +1,25 @@
1
+ import { f as SiteRole, I as IdentityClient, a as IdentityUser } from './members-nhbRSYyr.js';
2
+
3
+ /**
4
+ * Role resolution and the request gate.
5
+ *
6
+ * Two selects on the caller's OWN rows — both permitted by RLS with the anon
7
+ * key, so this never needs the service role. Staff wins over any site role.
8
+ */
9
+
10
+ declare function getSiteRole(client: IdentityClient, siteId: string, userId?: string): Promise<SiteRole | null>;
11
+ declare function roleAtLeast(actual: SiteRole | null, minimum: SiteRole): boolean;
12
+ interface RequireOptions {
13
+ /** Default "editor" — any member of the site. */
14
+ minimumRole?: SiteRole;
15
+ }
16
+ /**
17
+ * The gate. Throws UnauthenticatedError (→ sign in) or ForbiddenError (→ 403);
18
+ * otherwise returns the user and their effective role for this site.
19
+ */
20
+ declare function requireSiteUser(client: IdentityClient, siteId: string, opts?: RequireOptions): Promise<{
21
+ user: IdentityUser;
22
+ role: SiteRole;
23
+ }>;
24
+
25
+ export { type RequireOptions as R, roleAtLeast as a, getSiteRole as g, requireSiteUser as r };
@@ -1,62 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ButtonHTMLAttributes, AnchorHTMLAttributes } from 'react';
3
-
4
- /**
5
- * Light / dark, remembered per browser. The attribute lives on the .rz-admin
6
- * root (not <html>) so the host site's own theme is never touched.
7
- *
8
- * No flash of the wrong theme: the server renders defaultTheme, and the effect
9
- * only flips when a stored value differs — a single client-side change, never
10
- * a mismatch between server HTML and first client render.
11
- */
12
- type Theme = "light" | "dark";
13
- declare function useTheme(defaultTheme?: Theme): [Theme, (t: Theme) => void];
14
- declare function ThemeToggle({ theme, onChange }: {
15
- theme: Theme;
16
- onChange: (t: Theme) => void;
17
- }): react.JSX.Element;
18
-
19
- interface ShellUser {
20
- email: string;
21
- name?: string | null;
22
- /** Profile photo; initials show when absent. */
23
- avatarUrl?: string | null;
24
- }
25
- declare function firstNameOf(user: ShellUser): string;
26
- declare function initialsOf(user: ShellUser): string;
27
- declare function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, helpHref }: {
28
- user: ShellUser;
29
- role: string;
30
- theme: Theme;
31
- onTheme: (t: Theme) => void;
32
- signOutPath: string;
33
- /** The Account page (My Profile · Change Password · Team · Business). Omit to hide the item. */
34
- accountHref?: string;
35
- /** The Help centre. Omit to hide the item. */
36
- helpHref?: string;
37
- }): react.JSX.Element;
38
-
39
- /**
40
- * Sidebar — items from the content-type registry (via navFromContentTypes),
41
- * active by href prefix, collapsible with the state remembered per browser.
42
- * Plain anchors: the package does not know which router the host uses.
43
- */
44
- interface NavItem {
45
- id: string;
46
- label: string;
47
- href: string;
48
- /** Icon id; unknown ids fall back to a document icon. Defaults to `id`. */
49
- icon?: string;
50
- /** Shown greyed out and not navigable — a section that is coming but not built yet. */
51
- disabled?: boolean;
52
- }
53
- declare function isActive(item: NavItem, activeHref: string, basePath: string): boolean;
54
- declare function Sidebar({ items, pinned, activeHref, basePath }: {
55
- items: NavItem[];
56
- pinned?: NavItem[];
57
- activeHref: string;
58
- basePath: string;
59
- }): react.JSX.Element;
3
+ import { S as ShellUser, N as NavItem, T as Theme } from '../Sidebar-CNuphww6.cjs';
4
+ export { A as AccountMenu, a as Sidebar, b as ThemeToggle, f as firstNameOf, i as initialsOf, c as isActive, u as useTheme } from '../Sidebar-CNuphww6.cjs';
60
5
 
61
6
  interface AdminShellProps {
62
7
  siteName: string;
@@ -213,4 +158,4 @@ declare function Tabs({ options, value, onChange, label }: {
213
158
  label?: string;
214
159
  }): react.JSX.Element;
215
160
 
216
- export { AccountMenu, AdminShell, type AdminShellProps, Button, type ButtonSize, type ButtonVariant, Card, EmptyState, ForwardArrow, Icon, type IconName, LinkButton, type NavItem, OutboundArrow, PageHeader, type PillTone, SHELL_CSS, type ShellUser, Sidebar, StatusPill, type StepState, Steps, type TabOption, Tabs, type Theme, ThemeToggle, TopBar, buttonClass, buttonStyle, firstNameOf, iconFor, initialsOf, isActive, useTheme };
161
+ export { AdminShell, type AdminShellProps, Button, type ButtonSize, type ButtonVariant, Card, EmptyState, ForwardArrow, Icon, type IconName, LinkButton, NavItem, OutboundArrow, PageHeader, type PillTone, SHELL_CSS, ShellUser, StatusPill, type StepState, Steps, type TabOption, Tabs, Theme, TopBar, buttonClass, buttonStyle, iconFor };
@@ -1,62 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ButtonHTMLAttributes, AnchorHTMLAttributes } from 'react';
3
-
4
- /**
5
- * Light / dark, remembered per browser. The attribute lives on the .rz-admin
6
- * root (not <html>) so the host site's own theme is never touched.
7
- *
8
- * No flash of the wrong theme: the server renders defaultTheme, and the effect
9
- * only flips when a stored value differs — a single client-side change, never
10
- * a mismatch between server HTML and first client render.
11
- */
12
- type Theme = "light" | "dark";
13
- declare function useTheme(defaultTheme?: Theme): [Theme, (t: Theme) => void];
14
- declare function ThemeToggle({ theme, onChange }: {
15
- theme: Theme;
16
- onChange: (t: Theme) => void;
17
- }): react.JSX.Element;
18
-
19
- interface ShellUser {
20
- email: string;
21
- name?: string | null;
22
- /** Profile photo; initials show when absent. */
23
- avatarUrl?: string | null;
24
- }
25
- declare function firstNameOf(user: ShellUser): string;
26
- declare function initialsOf(user: ShellUser): string;
27
- declare function AccountMenu({ user, role, theme, onTheme, signOutPath, accountHref, helpHref }: {
28
- user: ShellUser;
29
- role: string;
30
- theme: Theme;
31
- onTheme: (t: Theme) => void;
32
- signOutPath: string;
33
- /** The Account page (My Profile · Change Password · Team · Business). Omit to hide the item. */
34
- accountHref?: string;
35
- /** The Help centre. Omit to hide the item. */
36
- helpHref?: string;
37
- }): react.JSX.Element;
38
-
39
- /**
40
- * Sidebar — items from the content-type registry (via navFromContentTypes),
41
- * active by href prefix, collapsible with the state remembered per browser.
42
- * Plain anchors: the package does not know which router the host uses.
43
- */
44
- interface NavItem {
45
- id: string;
46
- label: string;
47
- href: string;
48
- /** Icon id; unknown ids fall back to a document icon. Defaults to `id`. */
49
- icon?: string;
50
- /** Shown greyed out and not navigable — a section that is coming but not built yet. */
51
- disabled?: boolean;
52
- }
53
- declare function isActive(item: NavItem, activeHref: string, basePath: string): boolean;
54
- declare function Sidebar({ items, pinned, activeHref, basePath }: {
55
- items: NavItem[];
56
- pinned?: NavItem[];
57
- activeHref: string;
58
- basePath: string;
59
- }): react.JSX.Element;
3
+ import { S as ShellUser, N as NavItem, T as Theme } from '../Sidebar-CNuphww6.js';
4
+ export { A as AccountMenu, a as Sidebar, b as ThemeToggle, f as firstNameOf, i as initialsOf, c as isActive, u as useTheme } from '../Sidebar-CNuphww6.js';
60
5
 
61
6
  interface AdminShellProps {
62
7
  siteName: string;
@@ -213,4 +158,4 @@ declare function Tabs({ options, value, onChange, label }: {
213
158
  label?: string;
214
159
  }): react.JSX.Element;
215
160
 
216
- export { AccountMenu, AdminShell, type AdminShellProps, Button, type ButtonSize, type ButtonVariant, Card, EmptyState, ForwardArrow, Icon, type IconName, LinkButton, type NavItem, OutboundArrow, PageHeader, type PillTone, SHELL_CSS, type ShellUser, Sidebar, StatusPill, type StepState, Steps, type TabOption, Tabs, type Theme, ThemeToggle, TopBar, buttonClass, buttonStyle, firstNameOf, iconFor, initialsOf, isActive, useTheme };
161
+ export { AdminShell, type AdminShellProps, Button, type ButtonSize, type ButtonVariant, Card, EmptyState, ForwardArrow, Icon, type IconName, LinkButton, NavItem, OutboundArrow, PageHeader, type PillTone, SHELL_CSS, ShellUser, StatusPill, type StepState, Steps, type TabOption, Tabs, Theme, TopBar, buttonClass, buttonStyle, iconFor };