@burdenoff/microfe-brainyrich 2026.525.1 → 2026.706.1

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 (66) hide show
  1. package/dist/brainyrich/BrainyRichRoot.js +55 -90
  2. package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
  3. package/dist/brainyrich/BrainyRichRoutes.js +15 -35
  4. package/dist/brainyrich/BrainyRichRoutes.js.map +1 -1
  5. package/dist/brainyrich/components/ActorName.js +38 -0
  6. package/dist/brainyrich/components/ActorName.js.map +1 -0
  7. package/dist/brainyrich/components/ConfirmDialog.js +25 -0
  8. package/dist/brainyrich/components/ConfirmDialog.js.map +1 -0
  9. package/dist/brainyrich/components/LoadMore.js +24 -0
  10. package/dist/brainyrich/components/LoadMore.js.map +1 -0
  11. package/dist/brainyrich/components/index.js +5 -0
  12. package/dist/brainyrich/components/notify.js +38 -0
  13. package/dist/brainyrich/components/notify.js.map +1 -0
  14. package/dist/brainyrich/components/pickers.js +232 -0
  15. package/dist/brainyrich/components/pickers.js.map +1 -0
  16. package/dist/brainyrich/components/reuse/CommentThread.js +208 -0
  17. package/dist/brainyrich/components/reuse/CommentThread.js.map +1 -0
  18. package/dist/brainyrich/components/reuse/DocumentsPanel.js +237 -0
  19. package/dist/brainyrich/components/reuse/DocumentsPanel.js.map +1 -0
  20. package/dist/brainyrich/components/reuse/TagField.js +206 -0
  21. package/dist/brainyrich/components/reuse/TagField.js.map +1 -0
  22. package/dist/brainyrich/components/reuse/transport.js +24 -0
  23. package/dist/brainyrich/components/reuse/transport.js.map +1 -0
  24. package/dist/brainyrich/hooks/useBrainyRichApi.js +815 -0
  25. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
  26. package/dist/brainyrich/index.js +0 -1
  27. package/dist/brainyrich/pages/AccountsPage.js +743 -160
  28. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  29. package/dist/brainyrich/pages/AiAssistantPage.js +556 -363
  30. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  31. package/dist/brainyrich/pages/AnalyticsPage.js +601 -268
  32. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  33. package/dist/brainyrich/pages/DashboardPage.js +375 -231
  34. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  35. package/dist/brainyrich/pages/FamilyPage.js +599 -337
  36. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  37. package/dist/brainyrich/pages/GoalsPage.js +810 -141
  38. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  39. package/dist/brainyrich/pages/InvestmentsPage.js +410 -311
  40. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  41. package/dist/brainyrich/pages/PortfoliosPage.js +867 -156
  42. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  43. package/dist/brainyrich/pages/ReportsPage.js +421 -251
  44. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  45. package/dist/brainyrich/pages/RiskPage.js +557 -194
  46. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  47. package/dist/brainyrich/pages/TaxPage.js +655 -221
  48. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  49. package/dist/brainyrich/pages/_shared.js +222 -41
  50. package/dist/brainyrich/pages/_shared.js.map +1 -1
  51. package/dist/index.js +2 -3
  52. package/dist/node_modules/sonner/dist/index.js +163 -0
  53. package/dist/node_modules/sonner/dist/index.js.map +1 -0
  54. package/package.json +3 -2
  55. package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
  56. package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
  57. package/dist/brainyrich/pages/AssistantPage.js +0 -332
  58. package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
  59. package/dist/brainyrich/pages/EstatePage.js +0 -269
  60. package/dist/brainyrich/pages/EstatePage.js.map +0 -1
  61. package/dist/brainyrich/pages/InsurancePage.js +0 -181
  62. package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
  63. package/dist/brainyrich/pages/MarketplacePage.js +0 -450
  64. package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
  65. package/dist/brainyrich/store/brainyrichStore.js +0 -272
  66. package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
@@ -1,358 +1,620 @@
1
- import { useBrainyRichStore as e } from "../store/brainyrichStore.js";
2
- import { KpiGrid as t, SectionShell as n, formatMoney as r } from "./_shared.js";
3
- import { AlertTriangle as i, CheckCircle as a, Shield as o, Target as s, TrendingUp as c, UserPlus as l } from "lucide-react";
4
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
5
- import { Badge as f, Button as p, Card as m, CardContent as h, CardDescription as g, CardHeader as _, CardTitle as v, Tabs as y, TabsContent as b, TabsList as x, TabsTrigger as S } from "@burdenoff/fe-libs/ui";
1
+ import { tWithFallback as e } from "../utils/i18n.js";
2
+ import { useAccounts as t, useArchiveHousehold as n, useCreateHousehold as r, useGoals as i, useHousehold as a, usePagedHouseholds as o, usePortfolios as s, useUpdateHousehold as c } from "../hooks/useBrainyRichApi.js";
3
+ import { LoadMore as l } from "../components/LoadMore.js";
4
+ import { ConfirmDialog as u } from "../components/ConfirmDialog.js";
5
+ import { ActorName as d } from "../components/ActorName.js";
6
+ import "../components/index.js";
7
+ import { EmptyState as f, ErrorState as p, KpiGrid as m, LoadingState as h, SectionShell as g, formatDate as _, formatMoney as v, statusBadgeVariant as ee } from "./_shared.js";
8
+ import { DocumentsPanel as y } from "../components/reuse/DocumentsPanel.js";
9
+ import { TagField as b } from "../components/reuse/TagField.js";
10
+ import { CommentThread as x } from "../components/reuse/CommentThread.js";
11
+ import { useMemo as S, useState as C } from "react";
12
+ import { Archive as te, Briefcase as w, Eye as ne, Mail as re, MoreHorizontal as ie, Pencil as T, Target as E, Users as D, Wallet as O } from "lucide-react";
13
+ import { useI18n as ae } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
+ import { jsx as k, jsxs as A } from "react/jsx-runtime";
15
+ import { Badge as j, Button as M, Card as oe, CardContent as se, Dialog as N, DialogClose as P, DialogContent as F, DialogDescription as I, DialogFooter as L, DialogHeader as R, DialogTitle as z, DropdownMenu as ce, DropdownMenuContent as le, DropdownMenuItem as B, DropdownMenuSeparator as ue, DropdownMenuTrigger as de, Input as V, Label as H, Select as U, SelectContent as W, SelectItem as G, SelectTrigger as K, SelectValue as q, Sheet as J, SheetContent as Y, SheetDescription as fe, SheetHeader as pe, SheetTitle as me, Table as he, TableBody as ge, TableCell as X, TableHead as Z, TableHeader as _e, TableRow as ve, Textarea as ye } from "@burdenoff/fe-libs/ui";
6
16
  //#region src/brainyrich/pages/FamilyPage.tsx
7
- var C = [
8
- {
9
- id: "f1",
10
- name: "Vikram Raghavan",
11
- role: "Primary Owner",
12
- status: "Active",
13
- permissions: "Full Access",
14
- lastActive: "Just now"
15
- },
16
- {
17
- id: "f2",
18
- name: "Priya Raghavan",
19
- role: "Spouse",
20
- status: "Active",
21
- permissions: "Financial Planning, View Accounts",
22
- lastActive: "30 min ago"
23
- },
24
- {
25
- id: "f3",
26
- name: "Aditya Raghavan",
27
- role: "Child",
28
- status: "Active",
29
- permissions: "View Goals, Education Fund",
30
- lastActive: "2 hrs ago"
31
- },
32
- {
33
- id: "f4",
34
- name: "Kavya Raghavan",
35
- role: "Child",
36
- status: "Pending",
37
- permissions: "View Goals, Education Fund",
38
- lastActive: "Invited"
39
- }
40
- ], w = [
41
- {
42
- id: "fg1",
43
- title: "Emergency Fund",
44
- category: "Safety Net",
45
- target: 6e5,
46
- current: 54e4,
47
- status: "On Track",
48
- assignees: ["Vikram", "Priya"]
49
- },
50
- {
51
- id: "fg2",
52
- title: "Aditya's College Fund",
53
- category: "Education",
54
- target: 25e5,
55
- current: 118e4,
56
- status: "On Track",
57
- assignees: [
58
- "Vikram",
59
- "Priya",
60
- "Aditya"
61
- ]
62
- },
63
- {
64
- id: "fg3",
65
- title: "Family Vacation - Japan",
66
- category: "Lifestyle",
67
- target: 4e5,
68
- current: 31e4,
69
- status: "On Track",
70
- assignees: ["Vikram", "Priya"]
71
- },
72
- {
73
- id: "fg4",
74
- title: "Home Renovation",
75
- category: "Home",
76
- target: 12e5,
77
- current: 38e4,
78
- status: "Behind",
79
- assignees: ["Vikram", "Priya"]
80
- }
81
- ];
82
- function T() {
83
- let { goals: T } = e();
84
- return /* @__PURE__ */ d(n, {
85
- title: "Family Wealth Hub",
86
- description: "Collaborative financial planning for your family members",
87
- actionLabel: "Invite Member",
88
- badges: ["4 Family Members"],
89
- children: [/* @__PURE__ */ u(t, { items: [
90
- {
91
- label: "Active Members",
92
- value: "3/4",
93
- trend: "1 pending invite"
94
- },
95
- {
96
- label: "Family Net Worth",
97
- value: r(245e4),
98
- trend: "+6.2% YTD"
99
- },
100
- {
101
- label: "Family Goals",
102
- value: `${w.filter((e) => e.status === "On Track").length}/${w.length}`,
103
- trend: "On track"
104
- },
105
- {
106
- label: "Monthly Budget",
107
- value: r(95e3),
108
- trend: "Shared allocation"
109
- }
110
- ] }), /* @__PURE__ */ d(y, {
111
- defaultValue: "overview",
112
- className: "space-y-4",
113
- children: [
114
- /* @__PURE__ */ d(x, {
115
- className: "grid w-full grid-cols-3",
116
- children: [
117
- /* @__PURE__ */ u(S, {
118
- value: "overview",
119
- children: "Overview"
120
- }),
121
- /* @__PURE__ */ u(S, {
122
- value: "members",
123
- children: "Members"
17
+ var be = [
18
+ "PROSPECT",
19
+ "ONBOARDING",
20
+ "ACTIVE",
21
+ "INACTIVE"
22
+ ], xe = [
23
+ "CONSERVATIVE",
24
+ "MODERATE",
25
+ "BALANCED",
26
+ "GROWTH",
27
+ "AGGRESSIVE"
28
+ ], Se = [
29
+ "USD",
30
+ "EUR",
31
+ "GBP",
32
+ "INR",
33
+ "AED",
34
+ "SGD"
35
+ ], Ce = {
36
+ name: "",
37
+ status: "PROSPECT",
38
+ riskProfile: "BALANCED",
39
+ currency: "USD",
40
+ advisorId: "",
41
+ primaryContactName: "",
42
+ primaryContactEmail: "",
43
+ notes: "",
44
+ tags: ""
45
+ };
46
+ function we(e) {
47
+ return e.split(",").map((e) => e.trim()).filter(Boolean);
48
+ }
49
+ function Te() {
50
+ let { t } = ae(), i = (n, r, i) => e(t, n, r, i), { items: a, hasMore: s, loadMore: d, isLoading: _, isFetchingNextPage: y, isError: b, refetch: x } = o(), w = r(), E = c(), O = n(), [N, P] = C(!1), [F, I] = C(null), [L, R] = C(Ce), [z, V] = C(void 0), [H, U] = C(null), W = (e, t) => R((n) => ({
51
+ ...n,
52
+ [e]: t
53
+ })), G = () => {
54
+ I(null), R(Ce), P(!0);
55
+ }, K = (e) => {
56
+ I(e), R({
57
+ name: e.name,
58
+ status: e.status,
59
+ riskProfile: e.riskProfile,
60
+ currency: e.currency,
61
+ advisorId: e.advisorId ?? "",
62
+ primaryContactName: e.primaryContactName ?? "",
63
+ primaryContactEmail: e.primaryContactEmail ?? "",
64
+ notes: e.notes ?? "",
65
+ tags: e.tags.join(", ")
66
+ }), P(!0);
67
+ }, q = S(() => ({
68
+ total: a.length,
69
+ active: a.filter((e) => e.status === "ACTIVE").length,
70
+ pipeline: a.filter((e) => e.status === "PROSPECT" || e.status === "ONBOARDING").length,
71
+ aum: a.reduce((e, t) => e + (Number.isFinite(t.aum) ? t.aum : 0), 0),
72
+ currency: a[0]?.currency ?? "USD"
73
+ }), [a]), J = w.isPending || E.isPending, Y = L.name.trim().length > 0 && !J;
74
+ return /* @__PURE__ */ A(g, {
75
+ title: i("brainyrich.households.title", "Households"),
76
+ description: i("brainyrich.households.description", "Client households and family units under advisement"),
77
+ badges: a.length ? [i("brainyrich.households.count", "{count} households", { count: a.length })] : [],
78
+ actionLabel: i("brainyrich.households.new", "New household"),
79
+ onAction: G,
80
+ children: [
81
+ /* @__PURE__ */ k(m, { items: [
82
+ {
83
+ label: i("brainyrich.households.kpi.total", "Households"),
84
+ value: String(q.total)
85
+ },
86
+ {
87
+ label: i("brainyrich.households.kpi.active", "Active"),
88
+ value: String(q.active)
89
+ },
90
+ {
91
+ label: i("brainyrich.households.kpi.pipeline", "In pipeline"),
92
+ value: String(q.pipeline),
93
+ trend: i("brainyrich.households.kpi.pipelineHint", "Prospect + onboarding")
94
+ },
95
+ {
96
+ label: i("brainyrich.households.kpi.aum", "Total AUM"),
97
+ value: v(q.aum, q.currency)
98
+ }
99
+ ] }),
100
+ _ ? /* @__PURE__ */ k(h, { rows: 5 }) : b ? /* @__PURE__ */ k(p, {
101
+ title: i("brainyrich.households.error.title", "Could not load households"),
102
+ onRetry: () => x()
103
+ }) : a.length === 0 ? /* @__PURE__ */ k(f, {
104
+ icon: /* @__PURE__ */ k(D, {
105
+ className: "size-6",
106
+ "aria-hidden": "true"
107
+ }),
108
+ title: i("brainyrich.households.empty.title", "No households yet"),
109
+ description: i("brainyrich.households.empty.description", "Create your first client household to start organizing accounts, portfolios and goals."),
110
+ action: /* @__PURE__ */ k(M, {
111
+ size: "sm",
112
+ onClick: G,
113
+ children: i("brainyrich.households.new", "New household")
114
+ })
115
+ }) : /* @__PURE__ */ k(oe, { children: /* @__PURE__ */ k(se, {
116
+ className: "p-0",
117
+ children: /* @__PURE__ */ k("div", {
118
+ className: "overflow-x-auto",
119
+ children: /* @__PURE__ */ A(he, { children: [/* @__PURE__ */ k(_e, { children: /* @__PURE__ */ A(ve, { children: [
120
+ /* @__PURE__ */ k(Z, { children: i("brainyrich.households.col.name", "Household") }),
121
+ /* @__PURE__ */ k(Z, { children: i("brainyrich.households.col.status", "Status") }),
122
+ /* @__PURE__ */ k(Z, { children: i("brainyrich.households.col.risk", "Risk profile") }),
123
+ /* @__PURE__ */ k(Z, { children: i("brainyrich.households.col.contact", "Primary contact") }),
124
+ /* @__PURE__ */ k(Z, {
125
+ className: "text-right",
126
+ children: i("brainyrich.households.col.aum", "AUM")
124
127
  }),
125
- /* @__PURE__ */ u(S, {
126
- value: "goals",
127
- children: "Family Goals"
128
+ /* @__PURE__ */ k(Z, {
129
+ className: "w-12 text-right",
130
+ children: /* @__PURE__ */ k("span", {
131
+ className: "sr-only",
132
+ children: i("brainyrich.households.col.actions", "Actions")
133
+ })
128
134
  })
129
- ]
130
- }),
131
- /* @__PURE__ */ d(b, {
132
- value: "overview",
133
- className: "space-y-4",
134
- children: [/* @__PURE__ */ d("div", {
135
- className: "grid gap-4 lg:grid-cols-2",
136
- children: [/* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(_, { children: /* @__PURE__ */ d(v, {
137
- className: "flex items-center gap-2 text-base",
138
- children: [/* @__PURE__ */ u(c, { className: "h-4 w-4" }), "Recent Family Activity"]
139
- }) }), /* @__PURE__ */ u(h, {
140
- className: "space-y-3",
141
- children: [
142
- {
143
- member: "Priya Raghavan",
144
- action: "Updated emergency fund goal",
145
- time: "2 hours ago"
146
- },
147
- {
148
- member: "Vikram Raghavan",
149
- action: "Added $5,000 to vacation savings",
150
- time: "1 day ago"
151
- },
152
- {
153
- member: "Aditya Raghavan",
154
- action: "Checked college fund progress",
155
- time: "2 days ago"
156
- },
157
- {
158
- member: "Priya Raghavan",
159
- action: "Invited Kavya to family account",
160
- time: "3 days ago"
161
- }
162
- ].map((e, t) => /* @__PURE__ */ d("div", {
163
- className: "flex items-center gap-3 rounded-lg border p-2.5",
164
- children: [
165
- /* @__PURE__ */ u("div", {
166
- className: "flex h-8 w-8 items-center justify-center rounded-full bg-blue-100 text-xs font-bold text-blue-600",
167
- children: e.member.split(" ").map((e) => e[0]).join("")
168
- }),
169
- /* @__PURE__ */ d("div", {
170
- className: "flex-1",
171
- children: [/* @__PURE__ */ u("p", {
172
- className: "text-sm font-medium",
173
- children: e.member
174
- }), /* @__PURE__ */ u("p", {
175
- className: "text-xs text-muted-foreground",
176
- children: e.action
177
- })]
178
- }),
179
- /* @__PURE__ */ u("span", {
180
- className: "text-xs text-muted-foreground",
181
- children: e.time
135
+ ] }) }), /* @__PURE__ */ k(ge, { children: a.map((e) => /* @__PURE__ */ A(ve, { children: [
136
+ /* @__PURE__ */ A(X, { children: [/* @__PURE__ */ k("button", {
137
+ type: "button",
138
+ className: "text-left font-medium text-text-primary hover:underline",
139
+ onClick: () => V(e.id),
140
+ children: e.name
141
+ }), e.tags.length > 0 ? /* @__PURE__ */ k("div", {
142
+ className: "mt-1 flex flex-wrap gap-1",
143
+ children: e.tags.map((e) => /* @__PURE__ */ k(j, {
144
+ variant: "outline",
145
+ className: "text-xs",
146
+ children: e
147
+ }, e))
148
+ }) : null] }),
149
+ /* @__PURE__ */ k(X, { children: /* @__PURE__ */ k(j, {
150
+ variant: ee(e.status),
151
+ children: e.status
152
+ }) }),
153
+ /* @__PURE__ */ k(X, { children: /* @__PURE__ */ k(j, {
154
+ variant: "secondary",
155
+ children: e.riskProfile
156
+ }) }),
157
+ /* @__PURE__ */ k(X, { children: e.primaryContactName ? /* @__PURE__ */ A("div", {
158
+ className: "space-y-0.5",
159
+ children: [/* @__PURE__ */ k("p", {
160
+ className: "text-sm text-text-primary",
161
+ children: e.primaryContactName
162
+ }), e.primaryContactEmail ? /* @__PURE__ */ A("p", {
163
+ className: "flex items-center gap-1 text-xs text-text-secondary",
164
+ children: [/* @__PURE__ */ k(re, {
165
+ className: "size-3",
166
+ "aria-hidden": "true"
167
+ }), e.primaryContactEmail]
168
+ }) : null]
169
+ }) : /* @__PURE__ */ k("span", {
170
+ className: "text-sm text-text-muted",
171
+ children: "—"
172
+ }) }),
173
+ /* @__PURE__ */ k(X, {
174
+ className: "text-right font-medium text-text-primary",
175
+ children: v(e.aum, e.currency)
176
+ }),
177
+ /* @__PURE__ */ k(X, {
178
+ className: "text-right",
179
+ children: /* @__PURE__ */ A(ce, { children: [/* @__PURE__ */ k(de, {
180
+ asChild: !0,
181
+ children: /* @__PURE__ */ k(M, {
182
+ variant: "ghost",
183
+ size: "icon",
184
+ "aria-label": i("brainyrich.households.rowMenu", "Household actions"),
185
+ children: /* @__PURE__ */ k(ie, {
186
+ className: "size-4",
187
+ "aria-hidden": "true"
182
188
  })
183
- ]
184
- }, t))
185
- })] }), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(_, { children: /* @__PURE__ */ d(v, {
186
- className: "flex items-center gap-2 text-base",
187
- children: [/* @__PURE__ */ u(s, { className: "h-4 w-4" }), "Goal Progress Summary"]
188
- }) }), /* @__PURE__ */ u(h, {
189
- className: "space-y-3",
190
- children: w.map((e) => {
191
- let t = Math.round(e.current / e.target * 100);
192
- return /* @__PURE__ */ d("div", {
193
- className: "space-y-1",
194
- children: [
195
- /* @__PURE__ */ d("div", {
196
- className: "flex justify-between text-sm",
197
- children: [/* @__PURE__ */ u("span", {
198
- className: "font-medium",
199
- children: e.title
200
- }), /* @__PURE__ */ d("span", { children: [t, "%"] })]
201
- }),
202
- /* @__PURE__ */ u("div", {
203
- className: "h-2 rounded bg-muted overflow-hidden",
204
- children: /* @__PURE__ */ u("div", {
205
- className: `h-2 rounded ${e.status === "On Track" ? "bg-emerald-500" : "bg-yellow-500"}`,
206
- style: { width: `${t}%` }
207
- })
208
- }),
209
- /* @__PURE__ */ d("div", {
210
- className: "flex justify-between text-xs text-muted-foreground",
211
- children: [/* @__PURE__ */ u("span", { children: r(e.current) }), /* @__PURE__ */ u("span", { children: r(e.target) })]
212
- })
213
- ]
214
- }, e.id);
215
- })
216
- })] })]
217
- }), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(v, { children: "Family Financial Health" }) }), /* @__PURE__ */ u(h, { children: /* @__PURE__ */ u("div", {
218
- className: "grid grid-cols-1 md:grid-cols-3 gap-4",
219
- children: [
220
- {
221
- icon: a,
222
- label: "Emergency Fund",
223
- detail: "90% funded",
224
- color: "bg-emerald-50 text-emerald-600"
225
- },
226
- {
227
- icon: c,
228
- label: "Savings Rate",
229
- detail: "24% monthly",
230
- color: "bg-blue-50 text-blue-600"
231
- },
232
- {
233
- icon: i,
234
- label: "Insurance Review",
235
- detail: "Due for update",
236
- color: "bg-yellow-50 text-yellow-600"
237
- }
238
- ].map((e) => /* @__PURE__ */ d("div", {
239
- className: `text-center p-4 rounded-lg ${e.color.split(" ")[0]}`,
240
- children: [
241
- /* @__PURE__ */ u(e.icon, { className: `h-7 w-7 mx-auto mb-2 ${e.color.split(" ")[1]}` }),
242
- /* @__PURE__ */ u("p", {
243
- className: "font-semibold text-sm",
244
- children: e.label
245
- }),
246
- /* @__PURE__ */ u("p", {
247
- className: "text-xs text-muted-foreground",
248
- children: e.detail
249
189
  })
250
- ]
251
- }, e.label))
252
- }) })] })]
253
- }),
254
- /* @__PURE__ */ u(b, {
255
- value: "members",
256
- className: "space-y-4",
257
- children: /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ d(_, {
258
- className: "flex flex-row items-center justify-between",
259
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u(v, { children: "Family Members" }), /* @__PURE__ */ u(g, { children: "Manage access and permissions" })] }), /* @__PURE__ */ d(p, {
260
- size: "sm",
261
- children: [/* @__PURE__ */ u(l, { className: "mr-1 h-4 w-4" }), "Invite"]
262
- })]
263
- }), /* @__PURE__ */ u(h, {
264
- className: "space-y-3",
265
- children: C.map((e) => /* @__PURE__ */ d("div", {
266
- className: "flex items-center justify-between rounded-lg border p-3",
267
- children: [/* @__PURE__ */ d("div", {
268
- className: "flex items-center gap-3",
269
- children: [/* @__PURE__ */ u("div", {
270
- className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 font-bold text-sm text-blue-600",
271
- children: e.name.split(" ").map((e) => e[0]).join("")
272
- }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
273
- className: "font-medium text-sm",
274
- children: e.name
275
- }), /* @__PURE__ */ d("p", {
276
- className: "text-xs text-muted-foreground",
277
- children: [
278
- e.role,
279
- " · ",
280
- e.permissions
281
- ]
282
- })] })]
283
- }), /* @__PURE__ */ d("div", {
284
- className: "flex items-center gap-2",
190
+ }), /* @__PURE__ */ A(le, {
191
+ align: "end",
285
192
  children: [
286
- /* @__PURE__ */ u(f, {
287
- variant: e.status === "Active" ? "default" : "secondary",
288
- children: e.status
193
+ /* @__PURE__ */ A(B, {
194
+ onClick: () => V(e.id),
195
+ children: [/* @__PURE__ */ k(ne, {
196
+ className: "size-4",
197
+ "aria-hidden": "true"
198
+ }), i("brainyrich.households.action.view", "View details")]
289
199
  }),
290
- /* @__PURE__ */ u("span", {
291
- className: "text-xs text-muted-foreground",
292
- children: e.lastActive
200
+ /* @__PURE__ */ A(B, {
201
+ onClick: () => K(e),
202
+ children: [/* @__PURE__ */ k(T, {
203
+ className: "size-4",
204
+ "aria-hidden": "true"
205
+ }), i("brainyrich.households.action.edit", "Edit")]
293
206
  }),
294
- /* @__PURE__ */ u(p, {
295
- variant: "outline",
296
- size: "sm",
297
- children: /* @__PURE__ */ u(o, { className: "h-3 w-3" })
207
+ /* @__PURE__ */ k(ue, {}),
208
+ /* @__PURE__ */ A(B, {
209
+ className: "text-status-error-text focus:text-status-error-text",
210
+ onClick: () => U(e),
211
+ children: [/* @__PURE__ */ k(te, {
212
+ className: "size-4",
213
+ "aria-hidden": "true"
214
+ }), i("brainyrich.households.action.archive", "Archive")]
298
215
  })
299
216
  ]
217
+ })] })
218
+ })
219
+ ] }, e.id)) })] })
220
+ })
221
+ }) }),
222
+ !_ && !b && a.length > 0 ? /* @__PURE__ */ k(l, {
223
+ hasMore: s,
224
+ onClick: d,
225
+ loading: y,
226
+ label: i("brainyrich.households.loadMore", "Load more households")
227
+ }) : null,
228
+ /* @__PURE__ */ k(Ee, {
229
+ open: N,
230
+ onOpenChange: P,
231
+ editing: F,
232
+ form: L,
233
+ setField: W,
234
+ onSubmit: () => {
235
+ if (Y) if (F) {
236
+ let e = {
237
+ name: L.name.trim(),
238
+ status: L.status,
239
+ riskProfile: L.riskProfile,
240
+ currency: L.currency,
241
+ primaryContactName: L.primaryContactName.trim() || null,
242
+ primaryContactEmail: L.primaryContactEmail.trim() || null,
243
+ notes: L.notes.trim() || null,
244
+ tags: we(L.tags)
245
+ };
246
+ E.mutate({
247
+ id: F.id,
248
+ input: e
249
+ }, { onSuccess: () => P(!1) });
250
+ } else {
251
+ let e = {
252
+ name: L.name.trim(),
253
+ status: L.status,
254
+ riskProfile: L.riskProfile,
255
+ currency: L.currency,
256
+ primaryContactName: L.primaryContactName.trim() || null,
257
+ primaryContactEmail: L.primaryContactEmail.trim() || null,
258
+ notes: L.notes.trim() || null,
259
+ tags: we(L.tags)
260
+ };
261
+ L.advisorId.trim() && (e.advisorId = L.advisorId.trim()), w.mutate(e, { onSuccess: () => P(!1) });
262
+ }
263
+ },
264
+ canSubmit: Y,
265
+ submitting: J,
266
+ tr: i
267
+ }),
268
+ /* @__PURE__ */ k(De, {
269
+ householdId: z,
270
+ onClose: () => V(void 0),
271
+ onEdit: (e) => {
272
+ V(void 0), K(e);
273
+ },
274
+ tr: i
275
+ }),
276
+ /* @__PURE__ */ k(u, {
277
+ open: !!H,
278
+ onOpenChange: (e) => e ? void 0 : U(null),
279
+ title: i("brainyrich.households.archive.title", "Archive household?"),
280
+ description: i("brainyrich.households.archive.description", "Archiving “{name}” removes it from the active list. You can still access its records, but it will no longer appear here.", { name: H?.name ?? "" }),
281
+ confirmLabel: i("brainyrich.households.action.archive", "Archive"),
282
+ pendingLabel: i("brainyrich.households.archive.pending", "Archiving…"),
283
+ destructive: !0,
284
+ pending: O.isPending,
285
+ onConfirm: () => {
286
+ H && O.mutate(H.id, { onSuccess: () => U(null) });
287
+ }
288
+ })
289
+ ]
290
+ });
291
+ }
292
+ function Ee({ open: e, onOpenChange: t, editing: n, form: r, setField: i, onSubmit: a, canSubmit: o, submitting: s, tr: c }) {
293
+ return /* @__PURE__ */ k(N, {
294
+ open: e,
295
+ onOpenChange: t,
296
+ children: /* @__PURE__ */ A(F, {
297
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
298
+ children: [/* @__PURE__ */ A(R, { children: [/* @__PURE__ */ k(z, { children: n ? c("brainyrich.households.form.editTitle", "Edit household") : c("brainyrich.households.form.createTitle", "New household") }), /* @__PURE__ */ k(I, { children: c("brainyrich.households.form.subtitle", "A household groups a client family’s accounts, portfolios and goals.") })] }), /* @__PURE__ */ A("form", {
299
+ className: "space-y-4",
300
+ onSubmit: (e) => {
301
+ e.preventDefault(), a();
302
+ },
303
+ children: [
304
+ /* @__PURE__ */ A("div", {
305
+ className: "space-y-2",
306
+ children: [/* @__PURE__ */ A(H, {
307
+ htmlFor: "hh-name",
308
+ children: [c("brainyrich.households.form.name", "Name"), " *"]
309
+ }), /* @__PURE__ */ k(V, {
310
+ id: "hh-name",
311
+ value: r.name,
312
+ onChange: (e) => i("name", e.target.value),
313
+ placeholder: c("brainyrich.households.form.namePh", "e.g. The Raghavan Family"),
314
+ required: !0
315
+ })]
316
+ }),
317
+ /* @__PURE__ */ A("div", {
318
+ className: "grid gap-4 sm:grid-cols-2",
319
+ children: [/* @__PURE__ */ A("div", {
320
+ className: "space-y-2",
321
+ children: [/* @__PURE__ */ k(H, { children: c("brainyrich.households.form.status", "Status") }), /* @__PURE__ */ A(U, {
322
+ value: r.status,
323
+ onValueChange: (e) => i("status", e),
324
+ children: [/* @__PURE__ */ k(K, { children: /* @__PURE__ */ k(q, {}) }), /* @__PURE__ */ k(W, { children: be.map((e) => /* @__PURE__ */ k(G, {
325
+ value: e,
326
+ children: e
327
+ }, e)) })]
328
+ })]
329
+ }), /* @__PURE__ */ A("div", {
330
+ className: "space-y-2",
331
+ children: [/* @__PURE__ */ k(H, { children: c("brainyrich.households.form.risk", "Risk profile") }), /* @__PURE__ */ A(U, {
332
+ value: r.riskProfile,
333
+ onValueChange: (e) => i("riskProfile", e),
334
+ children: [/* @__PURE__ */ k(K, { children: /* @__PURE__ */ k(q, {}) }), /* @__PURE__ */ k(W, { children: xe.map((e) => /* @__PURE__ */ k(G, {
335
+ value: e,
336
+ children: e
337
+ }, e)) })]
338
+ })]
339
+ })]
340
+ }),
341
+ /* @__PURE__ */ A("div", {
342
+ className: "grid gap-4 sm:grid-cols-2",
343
+ children: [/* @__PURE__ */ A("div", {
344
+ className: "space-y-2",
345
+ children: [/* @__PURE__ */ k(H, {
346
+ htmlFor: "hh-contact-name",
347
+ children: c("brainyrich.households.form.contactName", "Primary contact")
348
+ }), /* @__PURE__ */ k(V, {
349
+ id: "hh-contact-name",
350
+ value: r.primaryContactName,
351
+ onChange: (e) => i("primaryContactName", e.target.value),
352
+ placeholder: c("brainyrich.households.form.contactNamePh", "Full name")
353
+ })]
354
+ }), /* @__PURE__ */ A("div", {
355
+ className: "space-y-2",
356
+ children: [/* @__PURE__ */ k(H, {
357
+ htmlFor: "hh-contact-email",
358
+ children: c("brainyrich.households.form.contactEmail", "Contact email")
359
+ }), /* @__PURE__ */ k(V, {
360
+ id: "hh-contact-email",
361
+ type: "email",
362
+ value: r.primaryContactEmail,
363
+ onChange: (e) => i("primaryContactEmail", e.target.value),
364
+ placeholder: "name@example.com"
300
365
  })]
301
- }, e.id))
366
+ })]
367
+ }),
368
+ /* @__PURE__ */ A("div", {
369
+ className: "grid gap-4 sm:grid-cols-2",
370
+ children: [/* @__PURE__ */ A("div", {
371
+ className: "space-y-2",
372
+ children: [/* @__PURE__ */ k(H, { children: c("brainyrich.households.form.currency", "Currency") }), /* @__PURE__ */ A(U, {
373
+ value: r.currency,
374
+ onValueChange: (e) => i("currency", e),
375
+ children: [/* @__PURE__ */ k(K, { children: /* @__PURE__ */ k(q, {}) }), /* @__PURE__ */ k(W, { children: Se.map((e) => /* @__PURE__ */ k(G, {
376
+ value: e,
377
+ children: e
378
+ }, e)) })]
379
+ })]
380
+ }), n ? null : /* @__PURE__ */ A("div", {
381
+ className: "space-y-2",
382
+ children: [/* @__PURE__ */ k(H, {
383
+ htmlFor: "hh-advisor",
384
+ children: c("brainyrich.households.form.advisor", "Advisor ID")
385
+ }), /* @__PURE__ */ k(V, {
386
+ id: "hh-advisor",
387
+ value: r.advisorId,
388
+ onChange: (e) => i("advisorId", e.target.value),
389
+ placeholder: c("brainyrich.households.form.advisorPh", "Optional")
390
+ })]
391
+ })]
392
+ }),
393
+ n ? /* @__PURE__ */ k(b, {
394
+ entityType: "brainyrich-household",
395
+ entityId: n.id,
396
+ label: c("brainyrich.households.form.tags", "Tags")
397
+ }) : /* @__PURE__ */ A("div", {
398
+ className: "space-y-2",
399
+ children: [/* @__PURE__ */ k(H, {
400
+ htmlFor: "hh-tags",
401
+ children: c("brainyrich.households.form.tags", "Tags")
402
+ }), /* @__PURE__ */ k(V, {
403
+ id: "hh-tags",
404
+ value: r.tags,
405
+ onChange: (e) => i("tags", e.target.value),
406
+ placeholder: c("brainyrich.households.form.tagsPh", "Comma-separated")
407
+ })]
408
+ }),
409
+ /* @__PURE__ */ A("div", {
410
+ className: "space-y-2",
411
+ children: [/* @__PURE__ */ k(H, {
412
+ htmlFor: "hh-notes",
413
+ children: c("brainyrich.households.form.notes", "Notes")
414
+ }), /* @__PURE__ */ k(ye, {
415
+ id: "hh-notes",
416
+ value: r.notes,
417
+ onChange: (e) => i("notes", e.target.value),
418
+ rows: 3
419
+ })]
420
+ }),
421
+ /* @__PURE__ */ A(L, { children: [/* @__PURE__ */ k(P, {
422
+ asChild: !0,
423
+ children: /* @__PURE__ */ k(M, {
424
+ type: "button",
425
+ variant: "outline",
426
+ children: c("brainyrich.common.cancel", "Cancel")
427
+ })
428
+ }), /* @__PURE__ */ k(M, {
429
+ type: "submit",
430
+ disabled: !o,
431
+ children: s ? c("brainyrich.common.saving", "Saving…") : n ? c("brainyrich.common.save", "Save changes") : c("brainyrich.households.form.create", "Create household")
302
432
  })] })
303
- }),
304
- /* @__PURE__ */ u(b, {
305
- value: "goals",
306
- className: "space-y-4",
307
- children: w.map((e) => {
308
- let t = Math.round(e.current / e.target * 100);
309
- return /* @__PURE__ */ u(m, { children: /* @__PURE__ */ d(h, {
310
- className: "p-4 space-y-3",
311
- children: [
312
- /* @__PURE__ */ d("div", {
313
- className: "flex items-center justify-between",
314
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
315
- className: "font-semibold",
316
- children: e.title
317
- }), /* @__PURE__ */ d("p", {
318
- className: "text-xs text-muted-foreground",
319
- children: [
320
- e.category,
321
- " · Assigned to: ",
322
- e.assignees.join(", ")
323
- ]
324
- })] }), /* @__PURE__ */ u(f, {
325
- variant: e.status === "On Track" ? "default" : "secondary",
326
- children: e.status
327
- })]
433
+ ]
434
+ })]
435
+ })
436
+ });
437
+ }
438
+ function De({ householdId: e, onClose: n, onEdit: r, tr: o }) {
439
+ let { data: c, isLoading: l, isError: u, refetch: m } = a(e), { data: g } = t(e ? { householdId: e } : {}), { data: b } = s(e ? { householdId: e } : {}), { data: S } = i(e ? { householdId: e } : {});
440
+ return /* @__PURE__ */ k(J, {
441
+ open: !!e,
442
+ onOpenChange: (e) => e ? void 0 : n(),
443
+ children: /* @__PURE__ */ k(Y, {
444
+ className: "w-full overflow-y-auto sm:max-w-md",
445
+ children: l ? /* @__PURE__ */ k("div", {
446
+ className: "p-2",
447
+ children: /* @__PURE__ */ k(h, { rows: 4 })
448
+ }) : u ? /* @__PURE__ */ k(p, {
449
+ title: o("brainyrich.households.detail.error", "Could not load household"),
450
+ onRetry: () => m()
451
+ }) : c ? /* @__PURE__ */ A("div", {
452
+ className: "space-y-6",
453
+ children: [
454
+ /* @__PURE__ */ A(pe, {
455
+ className: "space-y-2",
456
+ children: [
457
+ /* @__PURE__ */ k(me, { children: c.name }),
458
+ /* @__PURE__ */ k(fe, { children: o("brainyrich.households.detail.subtitle", "Household overview") }),
459
+ /* @__PURE__ */ A("div", {
460
+ className: "flex flex-wrap items-center gap-2 pt-1",
461
+ children: [/* @__PURE__ */ k(j, {
462
+ variant: ee(c.status),
463
+ children: c.status
464
+ }), /* @__PURE__ */ k(j, {
465
+ variant: "secondary",
466
+ children: c.riskProfile
467
+ })]
468
+ })
469
+ ]
470
+ }),
471
+ /* @__PURE__ */ A("div", {
472
+ className: "grid grid-cols-3 gap-3",
473
+ children: [
474
+ /* @__PURE__ */ k(Q, {
475
+ icon: /* @__PURE__ */ k(O, {
476
+ className: "size-4",
477
+ "aria-hidden": "true"
328
478
  }),
329
- /* @__PURE__ */ u("div", {
330
- className: "h-3 rounded bg-muted overflow-hidden",
331
- children: /* @__PURE__ */ u("div", {
332
- className: `h-3 rounded ${e.status === "On Track" ? "bg-emerald-500" : "bg-yellow-500"}`,
333
- style: { width: `${t}%` }
334
- })
479
+ label: o("brainyrich.households.detail.accounts", "Accounts"),
480
+ value: String(g.length)
481
+ }),
482
+ /* @__PURE__ */ k(Q, {
483
+ icon: /* @__PURE__ */ k(w, {
484
+ className: "size-4",
485
+ "aria-hidden": "true"
335
486
  }),
336
- /* @__PURE__ */ d("div", {
337
- className: "flex justify-between text-sm",
338
- children: [/* @__PURE__ */ d("span", { children: [r(e.current), " saved"] }), /* @__PURE__ */ d("span", {
339
- className: "font-medium",
340
- children: [
341
- t,
342
- "% of ",
343
- r(e.target)
344
- ]
345
- })]
346
- })
347
- ]
348
- }) }, e.id);
487
+ label: o("brainyrich.households.detail.portfolios", "Portfolios"),
488
+ value: String(b.length)
489
+ }),
490
+ /* @__PURE__ */ k(Q, {
491
+ icon: /* @__PURE__ */ k(E, {
492
+ className: "size-4",
493
+ "aria-hidden": "true"
494
+ }),
495
+ label: o("brainyrich.households.detail.goals", "Goals"),
496
+ value: String(S.length)
497
+ })
498
+ ]
499
+ }),
500
+ /* @__PURE__ */ k(oe, { children: /* @__PURE__ */ A(se, {
501
+ className: "space-y-3 p-4 text-sm",
502
+ children: [
503
+ /* @__PURE__ */ k($, {
504
+ label: o("brainyrich.households.detail.aum", "AUM"),
505
+ value: v(c.aum, c.currency)
506
+ }),
507
+ /* @__PURE__ */ k($, {
508
+ label: o("brainyrich.households.form.currency", "Currency"),
509
+ value: c.currency
510
+ }),
511
+ /* @__PURE__ */ k($, {
512
+ label: o("brainyrich.households.detail.contact", "Primary contact"),
513
+ value: c.primaryContactName ?? "—"
514
+ }),
515
+ /* @__PURE__ */ k($, {
516
+ label: o("brainyrich.households.form.contactEmail", "Contact email"),
517
+ value: c.primaryContactEmail ?? "—"
518
+ }),
519
+ /* @__PURE__ */ A("div", {
520
+ className: "flex items-center justify-between gap-4",
521
+ children: [/* @__PURE__ */ k("span", {
522
+ className: "text-text-secondary",
523
+ children: o("brainyrich.households.detail.advisor", "Advisor")
524
+ }), /* @__PURE__ */ k("span", {
525
+ className: "text-right font-medium text-text-primary",
526
+ children: c.advisorId ? /* @__PURE__ */ k(d, { id: c.advisorId }) : o("brainyrich.common.unassigned", "Unassigned")
527
+ })]
528
+ }),
529
+ /* @__PURE__ */ k($, {
530
+ label: o("brainyrich.households.detail.created", "Created"),
531
+ value: _(c.createdAt)
532
+ }),
533
+ /* @__PURE__ */ k($, {
534
+ label: o("brainyrich.households.detail.updated", "Last updated"),
535
+ value: _(c.updatedAt)
536
+ })
537
+ ]
538
+ }) }),
539
+ c.tags.length > 0 ? /* @__PURE__ */ k("div", {
540
+ className: "flex flex-wrap gap-1",
541
+ children: c.tags.map((e) => /* @__PURE__ */ k(j, {
542
+ variant: "outline",
543
+ children: e
544
+ }, e))
545
+ }) : null,
546
+ c.notes ? /* @__PURE__ */ A("div", {
547
+ className: "space-y-1",
548
+ children: [/* @__PURE__ */ k("p", {
549
+ className: "text-xs font-medium text-text-secondary",
550
+ children: o("brainyrich.households.detail.summary", "Summary")
551
+ }), /* @__PURE__ */ k("p", {
552
+ className: "text-sm text-text-primary",
553
+ children: c.notes
554
+ })]
555
+ }) : null,
556
+ /* @__PURE__ */ k(y, {
557
+ entityType: "brainyrich-household",
558
+ entityId: c.id,
559
+ heading: o("brainyrich.households.detail.documents", "Documents")
560
+ }),
561
+ /* @__PURE__ */ k(x, {
562
+ entityType: "brainyrich-household",
563
+ entityId: c.id,
564
+ heading: o("brainyrich.households.detail.discussion", "Discussion")
565
+ }),
566
+ /* @__PURE__ */ A(M, {
567
+ variant: "outline",
568
+ className: "w-full",
569
+ onClick: () => r(c),
570
+ children: [/* @__PURE__ */ k(T, {
571
+ className: "size-4",
572
+ "aria-hidden": "true"
573
+ }), o("brainyrich.households.action.edit", "Edit")]
349
574
  })
350
- })
351
- ]
575
+ ]
576
+ }) : /* @__PURE__ */ k(f, {
577
+ icon: /* @__PURE__ */ k(D, {
578
+ className: "size-6",
579
+ "aria-hidden": "true"
580
+ }),
581
+ title: o("brainyrich.households.detail.missing", "Household not found")
582
+ })
583
+ })
584
+ });
585
+ }
586
+ function Q({ icon: e, label: t, value: n }) {
587
+ return /* @__PURE__ */ A("div", {
588
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-3 text-center",
589
+ children: [
590
+ /* @__PURE__ */ k("div", {
591
+ className: "mx-auto mb-1 flex size-8 items-center justify-center rounded-full bg-bg-sunken text-text-secondary",
592
+ children: e
593
+ }),
594
+ /* @__PURE__ */ k("p", {
595
+ className: "text-lg font-semibold text-text-primary",
596
+ children: n
597
+ }),
598
+ /* @__PURE__ */ k("p", {
599
+ className: "text-xs text-text-secondary",
600
+ children: t
601
+ })
602
+ ]
603
+ });
604
+ }
605
+ function $({ label: e, value: t }) {
606
+ return /* @__PURE__ */ A("div", {
607
+ className: "flex items-center justify-between gap-4",
608
+ children: [/* @__PURE__ */ k("span", {
609
+ className: "text-text-secondary",
610
+ children: e
611
+ }), /* @__PURE__ */ k("span", {
612
+ className: "text-right font-medium text-text-primary",
613
+ children: t
352
614
  })]
353
615
  });
354
616
  }
355
617
  //#endregion
356
- export { T as FamilyPage };
618
+ export { Te as FamilyPage };
357
619
 
358
620
  //# sourceMappingURL=FamilyPage.js.map