hazo_auth 10.17.0 → 10.18.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.
@@ -0,0 +1,118 @@
1
+ // file_description: Pure, dependency-free helpers to compute user-signup stats
2
+ // (rolling-window counts + % change vs the prior equal period, plus a YTD
3
+ // monthly series) from a list of users' created_at timestamps. Client-safe.
4
+
5
+ export interface SignupWindow {
6
+ /** stable key: 'all' | '7d' | '30d' | '90d' | '180d' | 'ytd' */
7
+ key: string;
8
+ /** short display label for the card */
9
+ label: string;
10
+ /** signups within the window ('all' = total users) */
11
+ count: number;
12
+ /** signups in the immediately-preceding equal-length period; null for 'all' */
13
+ prevCount: number | null;
14
+ /** rounded % change vs prevCount; null when prevCount is null or 0 */
15
+ pctChange: number | null;
16
+ }
17
+
18
+ export interface MonthlyPoint {
19
+ /** short month label, e.g. 'Jan' */
20
+ label: string;
21
+ /** signups created in that calendar month of the current year */
22
+ count: number;
23
+ }
24
+
25
+ export interface UserSignupStats {
26
+ total: number;
27
+ windows: SignupWindow[];
28
+ ytdMonthly: MonthlyPoint[];
29
+ }
30
+
31
+ const DAY_MS = 86_400_000;
32
+ const MONTHS = [
33
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
34
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
35
+ ];
36
+
37
+ function pctOf(count: number, prev: number | null): number | null {
38
+ if (prev === null || prev === 0) return null;
39
+ return Math.round(((count - prev) / prev) * 100);
40
+ }
41
+
42
+ /**
43
+ * Compute signup stats from users' created_at values.
44
+ *
45
+ * Rolling windows (7/30/90/180 days) compare against the immediately-preceding
46
+ * equal-length period. YTD compares against the prior year's same-length
47
+ * period (year-to-date last year). Rows with missing/invalid created_at are
48
+ * ignored for window/YTD math but still counted in `total` via the raw length?
49
+ * — No: total counts only parseable timestamps so windows and total stay
50
+ * consistent. (Unparseable created_at should not happen for real users.)
51
+ */
52
+ export function computeUserSignupStats(
53
+ users: ReadonlyArray<{ created_at?: string | null }>,
54
+ now: Date = new Date(),
55
+ ): UserSignupStats {
56
+ const nowMs = now.getTime();
57
+
58
+ const times: number[] = [];
59
+ for (const u of users) {
60
+ if (!u || !u.created_at) continue;
61
+ const t = new Date(u.created_at).getTime();
62
+ if (!Number.isNaN(t)) times.push(t);
63
+ }
64
+
65
+ const countBetween = (startMs: number, endMs: number): number =>
66
+ times.reduce((n, t) => (t >= startMs && t < endMs ? n + 1 : n), 0);
67
+
68
+ const total = times.length;
69
+
70
+ const rolling: { key: string; label: string; days: number }[] = [
71
+ { key: "7d", label: "7 days", days: 7 },
72
+ { key: "30d", label: "30 days", days: 30 },
73
+ { key: "90d", label: "3 months", days: 90 },
74
+ { key: "180d", label: "6 months", days: 180 },
75
+ ];
76
+
77
+ const windows: SignupWindow[] = [
78
+ { key: "all", label: "All time", count: total, prevCount: null, pctChange: null },
79
+ ];
80
+
81
+ for (const w of rolling) {
82
+ const span = w.days * DAY_MS;
83
+ const count = countBetween(nowMs - span, nowMs);
84
+ const prevCount = countBetween(nowMs - 2 * span, nowMs - span);
85
+ windows.push({
86
+ key: w.key,
87
+ label: w.label,
88
+ count,
89
+ prevCount,
90
+ pctChange: pctOf(count, prevCount),
91
+ });
92
+ }
93
+
94
+ // YTD vs prior-year YTD (same elapsed span in the previous year).
95
+ const ytdStart = new Date(now.getFullYear(), 0, 1).getTime();
96
+ const elapsed = nowMs - ytdStart;
97
+ const ytdCount = countBetween(ytdStart, nowMs);
98
+ const prevYtdStart = new Date(now.getFullYear() - 1, 0, 1).getTime();
99
+ const prevYtdCount = countBetween(prevYtdStart, prevYtdStart + elapsed);
100
+ windows.push({
101
+ key: "ytd",
102
+ label: "YTD",
103
+ count: ytdCount,
104
+ prevCount: prevYtdCount,
105
+ pctChange: pctOf(ytdCount, prevYtdCount),
106
+ });
107
+
108
+ // Monthly YTD series (Jan .. current month).
109
+ const ytdMonthly: MonthlyPoint[] = [];
110
+ const year = now.getFullYear();
111
+ for (let m = 0; m <= now.getMonth(); m++) {
112
+ const monthStart = new Date(year, m, 1).getTime();
113
+ const monthEnd = new Date(year, m + 1, 1).getTime();
114
+ ytdMonthly.push({ label: MONTHS[m], count: countBetween(monthStart, monthEnd) });
115
+ }
116
+
117
+ return { total, windows, ytdMonthly };
118
+ }
@@ -611,6 +611,28 @@ application_permission_list_defaults = admin_user_management,admin_role_manageme
611
611
  # Redirect when skip_invitation_check=true and user has no scope
612
612
  # no_scope_redirect = /
613
613
 
614
+ [hazo_auth__legal_docs]
615
+ # Legal document acceptance system (admin Users > Legal Docs tab, and the
616
+ # registration/login acceptance gate). Absent section = feature disabled.
617
+ #
618
+ # display_mode: "separate" shows each doc as its own tab/step; "combined"
619
+ # concatenates them into a single acceptance screen.
620
+ # display_mode = separate
621
+ #
622
+ # Each doc is declared with a numbered doc_N_key / doc_N_title / doc_N_path
623
+ # triplet (N starts at 1, no gaps). doc_N_path is resolved relative to
624
+ # process.cwd() (same base as this INI file) unless given as an absolute
625
+ # path. hazo_auth ships generic starter templates at legal/tos.md and
626
+ # legal/privacy.md inside its own package — point at them via your app's
627
+ # node_modules, or copy them into your own project and edit freely:
628
+ #
629
+ # doc_1_key = terms
630
+ # doc_1_title = Terms of Service
631
+ # doc_1_path = node_modules/hazo_auth/legal/tos.md
632
+ # doc_2_key = privacy
633
+ # doc_2_title = Privacy Policy
634
+ # doc_2_path = node_modules/hazo_auth/legal/privacy.md
635
+
614
636
  [hazo_auth__multi_tenancy]
615
637
  # Multi-tenancy configuration for organization hierarchy
616
638
  # Enables hierarchical organization structures for company-wide access control
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ export interface UserSignupStatsCardsProps {
3
+ users: ReadonlyArray<{
4
+ created_at?: string | null;
5
+ }>;
6
+ /** Injectable for tests / stable stories. Defaults to now. */
7
+ now?: Date;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Total + rolling-window signup cards (All time, 7d, 30d, 3mo, 6mo, YTD) each
12
+ * with % change vs the prior equal period, plus a mini YTD monthly bar chart.
13
+ * Computes everything client-side from the already-loaded users list.
14
+ */
15
+ export declare function UserSignupStatsCards({ users, now, className }: UserSignupStatsCardsProps): React.JSX.Element;
16
+ //# sourceMappingURL=user_signup_stats_cards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_signup_stats_cards.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/user_signup_stats_cards.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAOvC,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,aAAa,CAAC;QAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACrD,8DAA8D;IAC9D,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwFD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,yBAAyB,qBAaxF"}
@@ -0,0 +1,47 @@
1
+ // file_description: Mini stat cards (total + rolling windows with % change vs the
2
+ // prior equal period) plus a small YTD monthly signups bar chart, for the top of
3
+ // the Manage Users tab. Pure/dependency-free (inline SVG chart).
4
+ "use client";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { useMemo } from "react";
7
+ import { computeUserSignupStats, } from "../../../../lib/user_signup_stats.js";
8
+ function DeltaBadge({ pct }) {
9
+ if (pct === null) {
10
+ return _jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" });
11
+ }
12
+ const up = pct >= 0;
13
+ const cls = up ? "text-emerald-600" : "text-red-600";
14
+ const arrow = up ? "▲" : "▼";
15
+ return (_jsxs("span", { className: `text-xs font-medium ${cls}`, title: "vs. previous equal period", children: [arrow, " ", up ? "+" : "", pct, "%"] }));
16
+ }
17
+ function StatCard({ w }) {
18
+ return (_jsxs("div", { className: "cls_user_signup_stat_card rounded-lg border bg-card p-3", children: [_jsx("div", { className: "text-xs text-muted-foreground", children: w.label }), _jsxs("div", { className: "mt-1 flex items-baseline justify-between gap-2", children: [_jsx("span", { className: "text-2xl font-bold tabular-nums", children: w.count.toLocaleString() }), w.key !== "all" && _jsx(DeltaBadge, { pct: w.pctChange })] }), w.key !== "all" && w.prevCount !== null && (_jsxs("div", { className: "mt-0.5 text-[11px] text-muted-foreground", children: ["prev ", w.prevCount.toLocaleString()] })), w.key === "all" && (_jsx("div", { className: "mt-0.5 text-[11px] text-muted-foreground", children: "total users" }))] }));
19
+ }
20
+ function YtdMiniChart({ data }) {
21
+ var _a, _b, _c, _d;
22
+ const total = data.reduce((n, d) => n + d.count, 0);
23
+ const max = Math.max(1, ...data.map((d) => d.count));
24
+ // Inline SVG bar chart — no chart library dependency.
25
+ const W = 220;
26
+ const H = 56;
27
+ const gap = 3;
28
+ const n = Math.max(1, data.length);
29
+ const bw = (W - gap * (n - 1)) / n;
30
+ return (_jsxs("div", { className: "cls_user_signup_ytd_chart rounded-lg border bg-card p-3 sm:col-span-2", children: [_jsxs("div", { className: "flex items-baseline justify-between", children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Signups by month (YTD)" }), _jsx("div", { className: "text-sm font-semibold tabular-nums", children: total.toLocaleString() })] }), _jsx("svg", { role: "img", "aria-label": `Year-to-date signups by month: ${data
31
+ .map((d) => `${d.label} ${d.count}`)
32
+ .join(", ")}`, viewBox: `0 0 ${W} ${H}`, className: "mt-2 w-full", preserveAspectRatio: "none", children: data.map((d, i) => {
33
+ const h = Math.round((d.count / max) * (H - 2));
34
+ const x = i * (bw + gap);
35
+ const y = H - h;
36
+ return (_jsx("rect", { x: x, y: y, width: bw, height: h, rx: 1.5, className: "fill-primary", children: _jsx("title", { children: `${d.label}: ${d.count}` }) }, d.label));
37
+ }) }), _jsxs("div", { className: "mt-1 flex justify-between text-[10px] text-muted-foreground", children: [_jsx("span", { children: (_b = (_a = data[0]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : "" }), _jsx("span", { children: (_d = (_c = data[data.length - 1]) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : "" })] })] }));
38
+ }
39
+ /**
40
+ * Total + rolling-window signup cards (All time, 7d, 30d, 3mo, 6mo, YTD) each
41
+ * with % change vs the prior equal period, plus a mini YTD monthly bar chart.
42
+ * Computes everything client-side from the already-loaded users list.
43
+ */
44
+ export function UserSignupStatsCards({ users, now, className }) {
45
+ const stats = useMemo(() => computeUserSignupStats(users, now), [users, now]);
46
+ return (_jsxs("div", { className: `cls_user_signup_stats_cards mb-4 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-8 ${className !== null && className !== void 0 ? className : ""}`, children: [stats.windows.map((w) => (_jsx(StatCard, { w: w }, w.key))), _jsx(YtdMiniChart, { data: stats.ytdMonthly })] }));
47
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/user_management/index.tsx"],"names":[],"mappings":"AAyDA,4CAA4C;AAC5C,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;CACvC,CAAC;AAwJF;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,YAAoB,EAAE,gBAAwB,EAAE,kBAAuB,EAAE,EAAE,yBAAyB,+BA8jDrJ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/user_management/index.tsx"],"names":[],"mappings":"AA0DA,4CAA4C;AAC5C,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;CACvC,CAAC;AAwJF;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,YAAoB,EAAE,gBAAwB,EAAE,kBAAuB,EAAE,EAAE,yBAAyB,+BAikDrJ"}
@@ -9,6 +9,7 @@ import { use_hazo_auth } from "../shared/hooks/use_hazo_auth.js";
9
9
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../ui/table.js";
10
10
  import { Button } from "../../ui/button.js";
11
11
  import { Avatar, AvatarImage, AvatarFallback } from "../../ui/avatar.js";
12
+ import { UserSignupStatsCards } from "./components/user_signup_stats_cards.js";
12
13
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../../ui/alert-dialog.js";
13
14
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../ui/dialog.js";
14
15
  import { Input } from "../../ui/input.js";
@@ -565,31 +566,31 @@ export function UserManagementLayout({ className, hrbacEnabled = false, userType
565
566
  };
566
567
  return (_jsxs("div", { className: `cls_user_management_layout flex flex-col gap-4 w-full ${className || ""}`, children: [authResult.loading ? (_jsx("div", { className: "cls_user_management_permissions_loading flex items-center justify-center p-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) })) : !hasAnyPermission ? (_jsxs("div", { className: "cls_user_management_no_permissions flex flex-col items-center justify-center p-8 gap-4", children: [_jsx("p", { className: "text-lg font-semibold text-slate-700", children: "Access Denied" }), _jsx("p", { className: "text-sm text-muted-foreground text-center", children: "You don't have permission to access User Management. Please contact your administrator." }), process.env.NODE_ENV === "development" && (_jsxs("div", { className: "mt-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md text-xs text-left w-full max-w-lg", children: [_jsx("p", { className: "font-semibold text-yellow-800 mb-2", children: "Dev Debug Info" }), _jsxs("p", { className: "text-yellow-700", children: [_jsx("span", { className: "font-medium", children: "Your permissions:" }), " ", authResult.authenticated && authResult.permissions.length > 0
567
568
  ? authResult.permissions.join(", ")
568
- : "(none)"] }), _jsxs("p", { className: "text-yellow-700 mt-1", children: [_jsx("span", { className: "font-medium", children: "Required (any of):" }), " ", "admin_user_management, admin_role_management, admin_permission_management, admin_scope_hierarchy_management, admin_user_scope_assignment, admin_system"] })] }))] })) : (_jsxs(Tabs, { defaultValue: active_tab, onValueChange: set_active_tab, className: "cls_user_management_tabs w-full", children: [_jsxs(TabsList, { className: "cls_user_management_tabs_list flex w-full flex-wrap", children: [showUsersTab && (_jsx(TabsTrigger, { value: "users", className: "cls_user_management_tabs_trigger flex-1", children: "Manage Users" })), showRolesTab && (_jsx(TabsTrigger, { value: "roles", className: "cls_user_management_tabs_trigger flex-1", children: "Roles" })), showPermissionsTab && (_jsx(TabsTrigger, { value: "permissions", className: "cls_user_management_tabs_trigger flex-1", children: "Permissions" })), showScopeHierarchyTab && (_jsx(TabsTrigger, { value: "scope_hierarchy", className: "cls_user_management_tabs_trigger flex-1", children: "Scope Hierarchy" })), showUserScopesTab && (_jsx(TabsTrigger, { value: "user_scopes", className: "cls_user_management_tabs_trigger flex-1", children: "User Scopes" })), hasSystemPermission && (_jsx(TabsTrigger, { value: "legal_docs", className: "cls_user_management_tabs_trigger flex-1", children: "Legal Docs" }))] }), showUsersTab && (_jsx(TabsContent, { value: "users", className: "cls_user_management_tab_users w-full", children: usersLoading ? (_jsx("div", { className: "cls_user_management_users_loading flex items-center justify-center p-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) })) : (_jsx("div", { className: "cls_user_management_users_table_container border rounded-lg overflow-auto w-full", children: _jsxs(Table, { className: "cls_user_management_users_table w-full", children: [_jsx(TableHeader, { className: "cls_user_management_users_table_header", children: _jsxs(TableRow, { className: "cls_user_management_users_table_header_row", children: [_jsx(TableHead, { className: "cls_user_management_users_table_header_profile_pic w-16", children: "Photo" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_id", children: "ID" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_name", children: "Name" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_email", children: "Email" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_email_verified", children: "Email Verified" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_is_active", children: "Active" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_last_logon", children: "Last Logon" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_created_at", children: "Created At" }), userTypesEnabled && (_jsx(TableHead, { className: "cls_user_management_users_table_header_user_type", children: "User Type" })), _jsx(TableHead, { className: "cls_user_management_users_table_header_actions text-right", children: "Actions" })] }) }), _jsx(TableBody, { className: "cls_user_management_users_table_body", children: users.length === 0 ? (_jsx(TableRow, { className: "cls_user_management_users_table_row_empty", children: _jsx(TableCell, { colSpan: userTypesEnabled ? 10 : 9, className: "text-center text-muted-foreground py-8", children: "No users found." }) })) : (users.map((user) => (_jsxs(TableRow, { className: "cls_user_management_users_table_row cursor-pointer hover:bg-muted/50", onClick: () => {
569
- setSelectedUser(user);
570
- setUserDetailDialogOpen(true);
571
- }, children: [_jsx(TableCell, { className: "cls_user_management_users_table_cell_profile_pic", children: _jsxs(Avatar, { className: "cls_user_management_users_table_avatar h-8 w-8", children: [_jsx(AvatarImage, { src: user.profile_picture_url || undefined, alt: user.name ? `Profile picture of ${user.name}` : "Profile picture", className: "cls_user_management_users_table_avatar_image" }), _jsx(AvatarFallback, { className: "cls_user_management_users_table_avatar_fallback bg-slate-200 text-slate-600 text-xs", children: getUserInitials(user) })] }) }), _jsxs(TableCell, { className: "cls_user_management_users_table_cell_id font-mono text-xs", children: [user.id.substring(0, 8), "..."] }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_name", children: user.name || "-" }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_email", children: user.email_address }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_email_verified", children: user.email_verified ? (_jsx("span", { className: "text-green-600", children: "Yes" })) : (_jsx("span", { className: "text-red-600", children: "No" })) }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_is_active", children: _jsxs("div", { className: "flex flex-col gap-0.5", children: [user.is_active ? (_jsx("span", { className: "text-green-600", children: "Active" })) : (_jsx("span", { className: "text-red-600", children: "Inactive" })), user.legal_acceptance_status !== 'none' && (_jsx("span", { className: user.legal_acceptance_status === 'current'
572
- ? 'text-green-600 text-xs font-medium'
573
- : 'text-amber-600 text-xs font-medium', children: user.legal_acceptance_status === 'current' ? '✓ Legal' : '⚠ Legal' }))] }) }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_last_logon", children: user.last_logon
574
- ? new Date(user.last_logon).toLocaleDateString()
575
- : "-" }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_created_at", children: user.created_at
576
- ? new Date(user.created_at).toLocaleDateString()
577
- : "-" }), userTypesEnabled && (_jsx(TableCell, { className: "cls_user_management_users_table_cell_user_type", children: (() => {
578
- const typeInfo = getUserTypeInfo(user.user_type);
579
- return typeInfo ? (_jsx(UserTypeBadge, { label: typeInfo.label, color: typeInfo.badge_color })) : (_jsx("span", { className: "text-muted-foreground", children: "-" }));
580
- })() })), _jsx(TableCell, { className: "cls_user_management_users_table_cell_actions text-right", children: _jsx(TooltipProvider, { children: _jsxs("div", { className: "cls_user_management_users_table_actions flex items-center justify-end gap-2", onClick: (e) => e.stopPropagation(), children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
581
- setSelectedUser(user);
582
- setAssignRolesDialogOpen(true);
583
- }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_assign_roles", children: _jsx(UserPlus, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Assign Roles" }) })] }), user.is_active && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
584
- setSelectedUser(user);
585
- setDeactivateDialogOpen(true);
586
- }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_deactivate", children: _jsx(UserX, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Deactivate" }) })] })), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
587
- setSelectedUser(user);
588
- setResetPasswordDialogOpen(true);
589
- }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_reset_password", children: _jsx(KeyRound, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Reset Password" }) })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
590
- setSelectedUser(user);
591
- setDeleteDialogOpen(true);
592
- }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_delete text-destructive", children: _jsx(Trash2, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Delete User" }) })] })] }) }) })] }, user.id)))) })] }) })) })), showRolesTab && (_jsx(TabsContent, { value: "roles", className: "cls_user_management_tab_roles w-full", children: _jsx(RolesMatrix, { add_button_enabled: true, role_name_selection_enabled: false, onSave: (data) => {
569
+ : "(none)"] }), _jsxs("p", { className: "text-yellow-700 mt-1", children: [_jsx("span", { className: "font-medium", children: "Required (any of):" }), " ", "admin_user_management, admin_role_management, admin_permission_management, admin_scope_hierarchy_management, admin_user_scope_assignment, admin_system"] })] }))] })) : (_jsxs(Tabs, { defaultValue: active_tab, onValueChange: set_active_tab, className: "cls_user_management_tabs w-full", children: [_jsxs(TabsList, { className: "cls_user_management_tabs_list flex w-full flex-wrap", children: [showUsersTab && (_jsx(TabsTrigger, { value: "users", className: "cls_user_management_tabs_trigger flex-1", children: "Manage Users" })), showRolesTab && (_jsx(TabsTrigger, { value: "roles", className: "cls_user_management_tabs_trigger flex-1", children: "Roles" })), showPermissionsTab && (_jsx(TabsTrigger, { value: "permissions", className: "cls_user_management_tabs_trigger flex-1", children: "Permissions" })), showScopeHierarchyTab && (_jsx(TabsTrigger, { value: "scope_hierarchy", className: "cls_user_management_tabs_trigger flex-1", children: "Scope Hierarchy" })), showUserScopesTab && (_jsx(TabsTrigger, { value: "user_scopes", className: "cls_user_management_tabs_trigger flex-1", children: "User Scopes" })), hasSystemPermission && (_jsx(TabsTrigger, { value: "legal_docs", className: "cls_user_management_tabs_trigger flex-1", children: "Legal Docs" }))] }), showUsersTab && (_jsxs(TabsContent, { value: "users", className: "cls_user_management_tab_users w-full", children: [!usersLoading && users.length > 0 && (_jsx(UserSignupStatsCards, { users: users })), usersLoading ? (_jsx("div", { className: "cls_user_management_users_loading flex items-center justify-center p-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) })) : (_jsx("div", { className: "cls_user_management_users_table_container border rounded-lg overflow-auto w-full", children: _jsxs(Table, { className: "cls_user_management_users_table w-full", children: [_jsx(TableHeader, { className: "cls_user_management_users_table_header", children: _jsxs(TableRow, { className: "cls_user_management_users_table_header_row", children: [_jsx(TableHead, { className: "cls_user_management_users_table_header_profile_pic w-16", children: "Photo" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_id", children: "ID" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_name", children: "Name" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_email", children: "Email" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_email_verified", children: "Email Verified" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_is_active", children: "Active" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_last_logon", children: "Last Logon" }), _jsx(TableHead, { className: "cls_user_management_users_table_header_created_at", children: "Created At" }), userTypesEnabled && (_jsx(TableHead, { className: "cls_user_management_users_table_header_user_type", children: "User Type" })), _jsx(TableHead, { className: "cls_user_management_users_table_header_actions text-right", children: "Actions" })] }) }), _jsx(TableBody, { className: "cls_user_management_users_table_body", children: users.length === 0 ? (_jsx(TableRow, { className: "cls_user_management_users_table_row_empty", children: _jsx(TableCell, { colSpan: userTypesEnabled ? 10 : 9, className: "text-center text-muted-foreground py-8", children: "No users found." }) })) : (users.map((user) => (_jsxs(TableRow, { className: "cls_user_management_users_table_row cursor-pointer hover:bg-muted/50", onClick: () => {
570
+ setSelectedUser(user);
571
+ setUserDetailDialogOpen(true);
572
+ }, children: [_jsx(TableCell, { className: "cls_user_management_users_table_cell_profile_pic", children: _jsxs(Avatar, { className: "cls_user_management_users_table_avatar h-8 w-8", children: [_jsx(AvatarImage, { src: user.profile_picture_url || undefined, alt: user.name ? `Profile picture of ${user.name}` : "Profile picture", className: "cls_user_management_users_table_avatar_image" }), _jsx(AvatarFallback, { className: "cls_user_management_users_table_avatar_fallback bg-slate-200 text-slate-600 text-xs", children: getUserInitials(user) })] }) }), _jsxs(TableCell, { className: "cls_user_management_users_table_cell_id font-mono text-xs", children: [user.id.substring(0, 8), "..."] }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_name", children: user.name || "-" }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_email", children: user.email_address }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_email_verified", children: user.email_verified ? (_jsx("span", { className: "text-green-600", children: "Yes" })) : (_jsx("span", { className: "text-red-600", children: "No" })) }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_is_active", children: _jsxs("div", { className: "flex flex-col gap-0.5", children: [user.is_active ? (_jsx("span", { className: "text-green-600", children: "Active" })) : (_jsx("span", { className: "text-red-600", children: "Inactive" })), user.legal_acceptance_status !== 'none' && (_jsx("span", { className: user.legal_acceptance_status === 'current'
573
+ ? 'text-green-600 text-xs font-medium'
574
+ : 'text-amber-600 text-xs font-medium', children: user.legal_acceptance_status === 'current' ? '✓ Legal' : '⚠ Legal' }))] }) }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_last_logon", children: user.last_logon
575
+ ? new Date(user.last_logon).toLocaleDateString()
576
+ : "-" }), _jsx(TableCell, { className: "cls_user_management_users_table_cell_created_at", children: user.created_at
577
+ ? new Date(user.created_at).toLocaleDateString()
578
+ : "-" }), userTypesEnabled && (_jsx(TableCell, { className: "cls_user_management_users_table_cell_user_type", children: (() => {
579
+ const typeInfo = getUserTypeInfo(user.user_type);
580
+ return typeInfo ? (_jsx(UserTypeBadge, { label: typeInfo.label, color: typeInfo.badge_color })) : (_jsx("span", { className: "text-muted-foreground", children: "-" }));
581
+ })() })), _jsx(TableCell, { className: "cls_user_management_users_table_cell_actions text-right", children: _jsx(TooltipProvider, { children: _jsxs("div", { className: "cls_user_management_users_table_actions flex items-center justify-end gap-2", onClick: (e) => e.stopPropagation(), children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
582
+ setSelectedUser(user);
583
+ setAssignRolesDialogOpen(true);
584
+ }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_assign_roles", children: _jsx(UserPlus, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Assign Roles" }) })] }), user.is_active && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
585
+ setSelectedUser(user);
586
+ setDeactivateDialogOpen(true);
587
+ }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_deactivate", children: _jsx(UserX, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Deactivate" }) })] })), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
588
+ setSelectedUser(user);
589
+ setResetPasswordDialogOpen(true);
590
+ }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_reset_password", children: _jsx(KeyRound, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Reset Password" }) })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
591
+ setSelectedUser(user);
592
+ setDeleteDialogOpen(true);
593
+ }, variant: "outline", size: "sm", className: "cls_user_management_users_table_action_delete text-destructive", children: _jsx(Trash2, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: "Delete User" }) })] })] }) }) })] }, user.id)))) })] }) }))] })), showRolesTab && (_jsx(TabsContent, { value: "roles", className: "cls_user_management_tab_roles w-full", children: _jsx(RolesMatrix, { add_button_enabled: true, role_name_selection_enabled: false, onSave: (data) => {
593
594
  // Data is already saved by RolesMatrix component
594
595
  console.log("Roles saved:", data);
595
596
  } }) })), showPermissionsTab && (_jsx(TabsContent, { value: "permissions", className: "cls_user_management_tab_permissions w-full", children: _jsxs("div", { className: "cls_user_management_permissions_container flex flex-col gap-4 w-full", children: [_jsxs("div", { className: "cls_user_management_permissions_header flex items-center justify-between", children: [_jsx("div", { className: "cls_user_management_permissions_header_left flex items-center gap-2", children: _jsxs(Button, { onClick: () => setAddPermissionDialogOpen(true), variant: "default", size: "sm", className: "cls_user_management_permissions_add_button", children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), "Add Permission"] }) }), _jsx("div", { className: "cls_user_management_permissions_header_right", children: _jsx(Button, { onClick: handleMigratePermissions, disabled: migrateLoading, variant: "default", size: "sm", className: "cls_user_management_permissions_migrate_button", children: migrateLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }), "Migrating..."] })) : ("Migrate config to database") }) })] }), permissionsLoading ? (_jsx("div", { className: "cls_user_management_permissions_loading flex items-center justify-center p-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) })) : (_jsx("div", { className: "cls_user_management_permissions_table_container border rounded-lg overflow-auto w-full", children: _jsxs(Table, { className: "cls_user_management_permissions_table w-full", children: [_jsx(TableHeader, { className: "cls_user_management_permissions_table_header", children: _jsxs(TableRow, { className: "cls_user_management_permissions_table_header_row", children: [_jsx(TableHead, { className: "cls_user_management_permissions_table_header_name", children: "Permission Name" }), _jsx(TableHead, { className: "cls_user_management_permissions_table_header_description", children: "Description" }), _jsx(TableHead, { className: "cls_user_management_permissions_table_header_source", children: "Source" }), _jsx(TableHead, { className: "cls_user_management_permissions_table_header_actions text-right", children: "Actions" })] }) }), _jsx(TableBody, { className: "cls_user_management_permissions_table_body", children: permissions.length === 0 ? (_jsx(TableRow, { className: "cls_user_management_permissions_table_row_empty", children: _jsx(TableCell, { colSpan: 4, className: "text-center text-muted-foreground py-8", children: "No permissions found." }) })) : (permissions.map((permission) => (_jsxs(TableRow, { className: "cls_user_management_permissions_table_row", children: [_jsx(TableCell, { className: `cls_user_management_permissions_table_cell_name font-medium ${permission.source === "db" ? "text-blue-600" : "text-purple-600"}`, children: permission.permission_name }), _jsx(TableCell, { className: "cls_user_management_permissions_table_cell_description", children: permission.description || "-" }), _jsx(TableCell, { className: "cls_user_management_permissions_table_cell_source", children: _jsx("span", { className: `px-2 py-1 rounded text-xs font-medium ${permission.source === "db"
@@ -7,7 +7,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
7
7
  declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
8
8
  declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const SheetContent: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
10
- side?: "bottom" | "left" | "right" | "top" | null | undefined;
10
+ side?: "top" | "bottom" | "left" | "right" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
12
12
  declare const SheetHeader: {
13
13
  ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
@@ -0,0 +1,37 @@
1
+ export interface SignupWindow {
2
+ /** stable key: 'all' | '7d' | '30d' | '90d' | '180d' | 'ytd' */
3
+ key: string;
4
+ /** short display label for the card */
5
+ label: string;
6
+ /** signups within the window ('all' = total users) */
7
+ count: number;
8
+ /** signups in the immediately-preceding equal-length period; null for 'all' */
9
+ prevCount: number | null;
10
+ /** rounded % change vs prevCount; null when prevCount is null or 0 */
11
+ pctChange: number | null;
12
+ }
13
+ export interface MonthlyPoint {
14
+ /** short month label, e.g. 'Jan' */
15
+ label: string;
16
+ /** signups created in that calendar month of the current year */
17
+ count: number;
18
+ }
19
+ export interface UserSignupStats {
20
+ total: number;
21
+ windows: SignupWindow[];
22
+ ytdMonthly: MonthlyPoint[];
23
+ }
24
+ /**
25
+ * Compute signup stats from users' created_at values.
26
+ *
27
+ * Rolling windows (7/30/90/180 days) compare against the immediately-preceding
28
+ * equal-length period. YTD compares against the prior year's same-length
29
+ * period (year-to-date last year). Rows with missing/invalid created_at are
30
+ * ignored for window/YTD math but still counted in `total` via the raw length?
31
+ * — No: total counts only parseable timestamps so windows and total stay
32
+ * consistent. (Unparseable created_at should not happen for real users.)
33
+ */
34
+ export declare function computeUserSignupStats(users: ReadonlyArray<{
35
+ created_at?: string | null;
36
+ }>, now?: Date): UserSignupStats;
37
+ //# sourceMappingURL=user_signup_stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_signup_stats.d.ts","sourceRoot":"","sources":["../../src/lib/user_signup_stats.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sEAAsE;IACtE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,EAAE,YAAY,EAAE,CAAC;CAC5B;AAaD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EACpD,GAAG,GAAE,IAAiB,GACrB,eAAe,CA+DjB"}
@@ -0,0 +1,79 @@
1
+ // file_description: Pure, dependency-free helpers to compute user-signup stats
2
+ // (rolling-window counts + % change vs the prior equal period, plus a YTD
3
+ // monthly series) from a list of users' created_at timestamps. Client-safe.
4
+ const DAY_MS = 86400000;
5
+ const MONTHS = [
6
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
7
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
8
+ ];
9
+ function pctOf(count, prev) {
10
+ if (prev === null || prev === 0)
11
+ return null;
12
+ return Math.round(((count - prev) / prev) * 100);
13
+ }
14
+ /**
15
+ * Compute signup stats from users' created_at values.
16
+ *
17
+ * Rolling windows (7/30/90/180 days) compare against the immediately-preceding
18
+ * equal-length period. YTD compares against the prior year's same-length
19
+ * period (year-to-date last year). Rows with missing/invalid created_at are
20
+ * ignored for window/YTD math but still counted in `total` via the raw length?
21
+ * — No: total counts only parseable timestamps so windows and total stay
22
+ * consistent. (Unparseable created_at should not happen for real users.)
23
+ */
24
+ export function computeUserSignupStats(users, now = new Date()) {
25
+ const nowMs = now.getTime();
26
+ const times = [];
27
+ for (const u of users) {
28
+ if (!u || !u.created_at)
29
+ continue;
30
+ const t = new Date(u.created_at).getTime();
31
+ if (!Number.isNaN(t))
32
+ times.push(t);
33
+ }
34
+ const countBetween = (startMs, endMs) => times.reduce((n, t) => (t >= startMs && t < endMs ? n + 1 : n), 0);
35
+ const total = times.length;
36
+ const rolling = [
37
+ { key: "7d", label: "7 days", days: 7 },
38
+ { key: "30d", label: "30 days", days: 30 },
39
+ { key: "90d", label: "3 months", days: 90 },
40
+ { key: "180d", label: "6 months", days: 180 },
41
+ ];
42
+ const windows = [
43
+ { key: "all", label: "All time", count: total, prevCount: null, pctChange: null },
44
+ ];
45
+ for (const w of rolling) {
46
+ const span = w.days * DAY_MS;
47
+ const count = countBetween(nowMs - span, nowMs);
48
+ const prevCount = countBetween(nowMs - 2 * span, nowMs - span);
49
+ windows.push({
50
+ key: w.key,
51
+ label: w.label,
52
+ count,
53
+ prevCount,
54
+ pctChange: pctOf(count, prevCount),
55
+ });
56
+ }
57
+ // YTD vs prior-year YTD (same elapsed span in the previous year).
58
+ const ytdStart = new Date(now.getFullYear(), 0, 1).getTime();
59
+ const elapsed = nowMs - ytdStart;
60
+ const ytdCount = countBetween(ytdStart, nowMs);
61
+ const prevYtdStart = new Date(now.getFullYear() - 1, 0, 1).getTime();
62
+ const prevYtdCount = countBetween(prevYtdStart, prevYtdStart + elapsed);
63
+ windows.push({
64
+ key: "ytd",
65
+ label: "YTD",
66
+ count: ytdCount,
67
+ prevCount: prevYtdCount,
68
+ pctChange: pctOf(ytdCount, prevYtdCount),
69
+ });
70
+ // Monthly YTD series (Jan .. current month).
71
+ const ytdMonthly = [];
72
+ const year = now.getFullYear();
73
+ for (let m = 0; m <= now.getMonth(); m++) {
74
+ const monthStart = new Date(year, m, 1).getTime();
75
+ const monthEnd = new Date(year, m + 1, 1).getTime();
76
+ ytdMonthly.push({ label: MONTHS[m], count: countBetween(monthStart, monthEnd) });
77
+ }
78
+ return { total, windows, ytdMonthly };
79
+ }
@@ -11,11 +11,11 @@ export declare function GET(request: NextRequest): Promise<NextResponse<{
11
11
  has_more: boolean;
12
12
  total_pages: number;
13
13
  };
14
- source: "project" | "node_modules";
14
+ source: "node_modules" | "project";
15
15
  }> | NextResponse<{
16
16
  success: boolean;
17
17
  categories: string[];
18
- source: "project" | "node_modules" | null;
18
+ source: "node_modules" | "project" | null;
19
19
  }> | NextResponse<{
20
20
  error: string;
21
21
  }>>;
@@ -0,0 +1,63 @@
1
+ # Privacy Policy
2
+
3
+ Version: 1.0
4
+
5
+ _This is generic starter content shipped with hazo_auth's legal-docs
6
+ acceptance system. It is boilerplate, not legal advice — replace the
7
+ bracketed placeholders and have counsel review it before relying on it in
8
+ production, especially to confirm compliance with applicable laws such as
9
+ GDPR or CCPA._
10
+
11
+ ## 1. Information We Collect
12
+
13
+ We collect information you provide directly, such as your name, email
14
+ address, and password (stored as a salted hash, never in plain text), along
15
+ with information generated by your use of the Service, such as login
16
+ timestamps, IP address, and usage activity.
17
+
18
+ ## 2. How We Use It
19
+
20
+ We use the information we collect to provide, maintain, and improve the
21
+ Service; to authenticate you and secure your account; to communicate with
22
+ you about your account or the Service; and to comply with legal obligations.
23
+
24
+ ## 3. Data Sharing
25
+
26
+ We do not sell your personal information. We may share information with
27
+ service providers who help us operate the Service (for example, hosting and
28
+ email delivery providers), each bound by confidentiality obligations, or
29
+ when required by law, to protect our rights, or in connection with a merger,
30
+ acquisition, or sale of assets.
31
+
32
+ ## 4. Data Retention
33
+
34
+ We retain your information for as long as your account is active or as
35
+ needed to provide the Service. We may retain and use information as
36
+ necessary to comply with legal obligations, resolve disputes, and enforce
37
+ our agreements.
38
+
39
+ ## 5. Your Rights
40
+
41
+ Depending on your jurisdiction, you may have the right to access, correct,
42
+ export, or delete your personal information, and to object to or restrict
43
+ certain processing. To exercise these rights, contact us using the details
44
+ below.
45
+
46
+ ## 6. Cookies
47
+
48
+ We use cookies and similar technologies to keep you signed in, remember your
49
+ preferences, and understand how the Service is used. You can control cookies
50
+ through your browser settings, though disabling them may affect the
51
+ Service's functionality.
52
+
53
+ ## 7. Changes to This Policy
54
+
55
+ We may update this Privacy Policy from time to time. If we make material
56
+ changes, we will provide notice (for example, by updating the "Version"
57
+ above or notifying you through the Service). Continued use of the Service
58
+ after changes take effect constitutes acceptance of the revised policy.
59
+
60
+ ## 8. Contact
61
+
62
+ Questions about this Privacy Policy can be sent to
63
+ [privacy@yourcompany.example].
package/legal/tos.md ADDED
@@ -0,0 +1,65 @@
1
+ # Terms of Service
2
+
3
+ Version: 1.0
4
+
5
+ _This is generic starter content shipped with hazo_auth's legal-docs acceptance
6
+ system. It is boilerplate, not legal advice — replace the bracketed
7
+ placeholders and have counsel review it before relying on it in production._
8
+
9
+ ## 1. Acceptance of Terms
10
+
11
+ By creating an account or otherwise using [Your Company Name]'s service (the
12
+ "Service"), you agree to be bound by these Terms of Service ("Terms"). If you
13
+ do not agree to these Terms, do not use the Service.
14
+
15
+ ## 2. Use of Service
16
+
17
+ You may use the Service only for lawful purposes and in accordance with these
18
+ Terms. You agree not to use the Service in any way that violates any
19
+ applicable law or regulation, or that infringes the rights of, restricts, or
20
+ inhibits anyone else's use of the Service.
21
+
22
+ ## 3. User Accounts
23
+
24
+ You are responsible for maintaining the confidentiality of your account
25
+ credentials and for all activity that occurs under your account. Notify us
26
+ immediately of any unauthorized use of your account. You must provide
27
+ accurate and complete information when creating an account and keep it up to
28
+ date.
29
+
30
+ ## 4. Prohibited Uses
31
+
32
+ You agree not to: (a) reverse engineer, decompile, or attempt to extract the
33
+ source code of the Service, except where permitted by law; (b) interfere with
34
+ or disrupt the integrity or performance of the Service; (c) attempt to gain
35
+ unauthorized access to the Service or its related systems; (d) use the
36
+ Service to transmit any unlawful, harassing, defamatory, or infringing
37
+ content; or (e) use the Service in a manner that could damage, disable, or
38
+ impair it.
39
+
40
+ ## 5. Termination
41
+
42
+ We may suspend or terminate your access to the Service at any time, with or
43
+ without cause or notice, including for conduct that we believe violates these
44
+ Terms or is harmful to other users, us, or third parties. You may stop using
45
+ the Service and close your account at any time.
46
+
47
+ ## 6. Limitation of Liability
48
+
49
+ To the fullest extent permitted by law, [Your Company Name] and its
50
+ affiliates shall not be liable for any indirect, incidental, special,
51
+ consequential, or punitive damages, or any loss of profits or revenues,
52
+ whether incurred directly or indirectly, arising from your use of the
53
+ Service. The Service is provided "as is" and "as available" without
54
+ warranties of any kind, express or implied.
55
+
56
+ ## 7. Changes to Terms
57
+
58
+ We may update these Terms from time to time. If we make material changes, we
59
+ will provide notice (for example, by updating the "Version" above or
60
+ notifying you through the Service). Continued use of the Service after
61
+ changes take effect constitutes acceptance of the revised Terms.
62
+
63
+ ## 8. Contact
64
+
65
+ Questions about these Terms can be sent to [support@yourcompany.example].
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_auth",
3
- "version": "10.17.0",
3
+ "version": "10.18.0",
4
4
  "description": "Zero-config authentication UI components for Next.js with RBAC, OAuth, scope-based multi-tenancy, and invitations",
5
5
  "keywords": [
6
6
  "authentication",
@@ -198,6 +198,7 @@
198
198
  "!cli-src/lib/auto_test/**/*",
199
199
  "public/profile_pictures/library/**/*",
200
200
  "public/hazo_auth/images/**/*",
201
+ "legal/**/*",
201
202
  "config/**/*.example.ini",
202
203
  "README.md",
203
204
  "SETUP_CHECKLIST.md",