@realiizlabs/admin 0.11.1 → 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 (43) 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.cjs +5 -3
  20. package/dist/shell/index.cjs.map +1 -1
  21. package/dist/shell/index.d.cts +7 -60
  22. package/dist/shell/index.d.ts +7 -60
  23. package/dist/shell/index.js +5 -3
  24. package/dist/shell/index.js.map +1 -1
  25. package/dist/studio/index.cjs +1150 -0
  26. package/dist/studio/index.cjs.map +1 -0
  27. package/dist/studio/index.d.cts +325 -0
  28. package/dist/studio/index.d.ts +325 -0
  29. package/dist/studio/index.js +1131 -0
  30. package/dist/studio/index.js.map +1 -0
  31. package/dist/studio-ui/index.cjs +3931 -0
  32. package/dist/studio-ui/index.cjs.map +1 -0
  33. package/dist/studio-ui/index.d.cts +375 -0
  34. package/dist/studio-ui/index.d.ts +375 -0
  35. package/dist/studio-ui/index.js +3900 -0
  36. package/dist/studio-ui/index.js.map +1 -0
  37. package/dist/types-BP5G1myE.d.cts +78 -0
  38. package/dist/types-BP5G1myE.d.ts +78 -0
  39. package/package.json +20 -2
  40. package/dist/chunk-2GSYBARR.js +0 -126
  41. package/dist/chunk-2GSYBARR.js.map +0 -1
  42. package/dist/chunk-JLR5K6RP.js +0 -289
  43. 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 };
@@ -355,11 +355,12 @@ var SHELL_CSS = `
355
355
  .rz-btn:hover .rz-arrow, a:hover .rz-arrow { transform: translate(2px, -2px); }
356
356
  .rz-btn:hover .rz-arrow--fwd, a:hover .rz-arrow--fwd { transform: translateX(4px); }
357
357
  }
358
- .rz-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; }
358
+ .rz-card { display: flex; flex-direction: column; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; }
359
359
  .rz-card--narrow { max-width: 760px; }
360
360
  .rz-card__title { font-size: .9375rem; font-weight: 600; margin-bottom: .35rem; }
361
361
  .rz-card__meta { color: var(--text-muted); font-size: .8rem; }
362
- .rz-card__actions { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }
362
+ .rz-card__actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .9rem; flex-wrap: wrap; }
363
+ .rz-card__note { margin-top: .5rem; }
363
364
  .rz-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
364
365
  .rz-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
365
366
  .rz-pagehead__eyebrow { font-family: var(--rz-font-mono); font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .3rem; }
@@ -583,10 +584,11 @@ function OutboundArrow() {
583
584
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 7h10v10" })
584
585
  ] });
585
586
  }
586
- function Card({ title, meta, children, actions, className }) {
587
+ function Card({ title, meta, note, children, actions, className }) {
587
588
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["rz-card", className].filter(Boolean).join(" "), children: [
588
589
  title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rz-card__title", children: title }),
589
590
  meta && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rz-card__meta", children: meta }),
591
+ note && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rz-card__note", children: note }),
590
592
  children,
591
593
  actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rz-card__actions", children: actions })
592
594
  ] });