@burdenoff/microfe-brainyrich 2026.525.1 → 2026.705.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 (45) hide show
  1. package/dist/brainyrich/BrainyRichRoot.js +53 -88
  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/hooks/useBrainyRichApi.js +543 -0
  6. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
  7. package/dist/brainyrich/index.js +0 -1
  8. package/dist/brainyrich/pages/AccountsPage.js +690 -160
  9. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  10. package/dist/brainyrich/pages/AiAssistantPage.js +537 -363
  11. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  12. package/dist/brainyrich/pages/AnalyticsPage.js +587 -268
  13. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  14. package/dist/brainyrich/pages/DashboardPage.js +350 -232
  15. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  16. package/dist/brainyrich/pages/FamilyPage.js +550 -337
  17. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  18. package/dist/brainyrich/pages/GoalsPage.js +775 -142
  19. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  20. package/dist/brainyrich/pages/InvestmentsPage.js +410 -311
  21. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  22. package/dist/brainyrich/pages/PortfoliosPage.js +823 -154
  23. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  24. package/dist/brainyrich/pages/ReportsPage.js +388 -251
  25. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  26. package/dist/brainyrich/pages/RiskPage.js +411 -196
  27. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  28. package/dist/brainyrich/pages/TaxPage.js +622 -221
  29. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  30. package/dist/brainyrich/pages/_shared.js +222 -41
  31. package/dist/brainyrich/pages/_shared.js.map +1 -1
  32. package/dist/index.js +2 -3
  33. package/package.json +1 -1
  34. package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
  35. package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
  36. package/dist/brainyrich/pages/AssistantPage.js +0 -332
  37. package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
  38. package/dist/brainyrich/pages/EstatePage.js +0 -269
  39. package/dist/brainyrich/pages/EstatePage.js.map +0 -1
  40. package/dist/brainyrich/pages/InsurancePage.js +0 -181
  41. package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
  42. package/dist/brainyrich/pages/MarketplacePage.js +0 -450
  43. package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
  44. package/dist/brainyrich/store/brainyrichStore.js +0 -272
  45. package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
@@ -1,358 +1,571 @@
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, useHouseholds as o, usePortfolios as s, useUpdateHousehold as c } from "../hooks/useBrainyRichApi.js";
3
+ import { EmptyState as l, ErrorState as u, KpiGrid as d, LoadingState as f, SectionShell as p, formatDate as m, formatMoney as h, statusBadgeVariant as g } from "./_shared.js";
4
+ import { useMemo as _, useState as v } from "react";
5
+ import { Archive as y, Briefcase as b, Eye as ee, Mail as te, MoreHorizontal as ne, Pencil as x, Target as S, Users as C, Wallet as w } from "lucide-react";
6
+ import { useI18n as re } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
8
+ import { Badge as D, Button as O, Card as k, CardContent as A, Dialog as j, DialogClose as M, DialogContent as N, DialogDescription as P, DialogFooter as F, DialogHeader as I, DialogTitle as L, DropdownMenu as ie, DropdownMenuContent as ae, DropdownMenuItem as R, DropdownMenuSeparator as oe, DropdownMenuTrigger as se, Input as z, Label as B, Select as V, SelectContent as H, SelectItem as U, SelectTrigger as W, SelectValue as G, Sheet as K, SheetContent as ce, SheetDescription as le, SheetHeader as ue, SheetTitle as de, Table as fe, TableBody as pe, TableCell as q, TableHead as J, TableHeader as me, TableRow as Y, Textarea as he } from "@burdenoff/fe-libs/ui";
6
9
  //#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"
10
+ var ge = [
11
+ "PROSPECT",
12
+ "ONBOARDING",
13
+ "ACTIVE",
14
+ "INACTIVE"
15
+ ], _e = [
16
+ "CONSERVATIVE",
17
+ "MODERATE",
18
+ "BALANCED",
19
+ "GROWTH",
20
+ "AGGRESSIVE"
21
+ ], ve = [
22
+ "USD",
23
+ "EUR",
24
+ "GBP",
25
+ "INR",
26
+ "AED",
27
+ "SGD"
28
+ ], X = {
29
+ name: "",
30
+ status: "PROSPECT",
31
+ riskProfile: "BALANCED",
32
+ currency: "USD",
33
+ advisorId: "",
34
+ primaryContactName: "",
35
+ primaryContactEmail: "",
36
+ notes: "",
37
+ tags: ""
38
+ };
39
+ function Z(e) {
40
+ return e.split(",").map((e) => e.trim()).filter(Boolean);
41
+ }
42
+ function ye() {
43
+ let { t } = re(), i = (n, r, i) => e(t, n, r, i), { data: a, isLoading: s, isError: m, refetch: b } = o(), S = r(), w = c(), j = n(), [M, N] = v(!1), [P, F] = v(null), [I, L] = v(X), [z, B] = v(void 0), V = (e, t) => L((n) => ({
44
+ ...n,
45
+ [e]: t
46
+ })), H = () => {
47
+ F(null), L(X), N(!0);
48
+ }, U = (e) => {
49
+ F(e), L({
50
+ name: e.name,
51
+ status: e.status,
52
+ riskProfile: e.riskProfile,
53
+ currency: e.currency,
54
+ advisorId: e.advisorId ?? "",
55
+ primaryContactName: e.primaryContactName ?? "",
56
+ primaryContactEmail: e.primaryContactEmail ?? "",
57
+ notes: e.notes ?? "",
58
+ tags: e.tags.join(", ")
59
+ }), N(!0);
60
+ }, W = _(() => ({
61
+ total: a.length,
62
+ active: a.filter((e) => e.status === "ACTIVE").length,
63
+ pipeline: a.filter((e) => e.status === "PROSPECT" || e.status === "ONBOARDING").length,
64
+ aum: a.reduce((e, t) => e + (Number.isFinite(t.aum) ? t.aum : 0), 0),
65
+ currency: a[0]?.currency ?? "USD"
66
+ }), [a]), G = S.isPending || w.isPending, K = I.name.trim().length > 0 && !G;
67
+ return /* @__PURE__ */ E(p, {
68
+ title: i("brainyrich.households.title", "Households"),
69
+ description: i("brainyrich.households.description", "Client households and family units under advisement"),
70
+ badges: a.length ? [i("brainyrich.households.count", "{count} households", { count: a.length })] : [],
71
+ actionLabel: i("brainyrich.households.new", "New household"),
72
+ onAction: H,
73
+ children: [
74
+ /* @__PURE__ */ T(d, { items: [
75
+ {
76
+ label: i("brainyrich.households.kpi.total", "Households"),
77
+ value: String(W.total)
78
+ },
79
+ {
80
+ label: i("brainyrich.households.kpi.active", "Active"),
81
+ value: String(W.active)
82
+ },
83
+ {
84
+ label: i("brainyrich.households.kpi.pipeline", "In pipeline"),
85
+ value: String(W.pipeline),
86
+ trend: i("brainyrich.households.kpi.pipelineHint", "Prospect + onboarding")
87
+ },
88
+ {
89
+ label: i("brainyrich.households.kpi.aum", "Total AUM"),
90
+ value: h(W.aum, W.currency)
91
+ }
92
+ ] }),
93
+ s ? /* @__PURE__ */ T(f, { rows: 5 }) : m ? /* @__PURE__ */ T(u, {
94
+ title: i("brainyrich.households.error.title", "Could not load households"),
95
+ onRetry: () => b()
96
+ }) : a.length === 0 ? /* @__PURE__ */ T(l, {
97
+ icon: /* @__PURE__ */ T(C, {
98
+ className: "size-6",
99
+ "aria-hidden": "true"
100
+ }),
101
+ title: i("brainyrich.households.empty.title", "No households yet"),
102
+ description: i("brainyrich.households.empty.description", "Create your first client household to start organizing accounts, portfolios and goals."),
103
+ action: /* @__PURE__ */ T(O, {
104
+ size: "sm",
105
+ onClick: H,
106
+ children: i("brainyrich.households.new", "New household")
107
+ })
108
+ }) : /* @__PURE__ */ T(k, { children: /* @__PURE__ */ T(A, {
109
+ className: "p-0",
110
+ children: /* @__PURE__ */ T("div", {
111
+ className: "overflow-x-auto",
112
+ children: /* @__PURE__ */ E(fe, { children: [/* @__PURE__ */ T(me, { children: /* @__PURE__ */ E(Y, { children: [
113
+ /* @__PURE__ */ T(J, { children: i("brainyrich.households.col.name", "Household") }),
114
+ /* @__PURE__ */ T(J, { children: i("brainyrich.households.col.status", "Status") }),
115
+ /* @__PURE__ */ T(J, { children: i("brainyrich.households.col.risk", "Risk profile") }),
116
+ /* @__PURE__ */ T(J, { children: i("brainyrich.households.col.contact", "Primary contact") }),
117
+ /* @__PURE__ */ T(J, {
118
+ className: "text-right",
119
+ children: i("brainyrich.households.col.aum", "AUM")
124
120
  }),
125
- /* @__PURE__ */ u(S, {
126
- value: "goals",
127
- children: "Family Goals"
121
+ /* @__PURE__ */ T(J, {
122
+ className: "w-12 text-right",
123
+ children: /* @__PURE__ */ T("span", {
124
+ className: "sr-only",
125
+ children: i("brainyrich.households.col.actions", "Actions")
126
+ })
128
127
  })
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
128
+ ] }) }), /* @__PURE__ */ T(pe, { children: a.map((e) => /* @__PURE__ */ E(Y, { children: [
129
+ /* @__PURE__ */ E(q, { children: [/* @__PURE__ */ T("button", {
130
+ type: "button",
131
+ className: "text-left font-medium text-text-primary hover:underline",
132
+ onClick: () => B(e.id),
133
+ children: e.name
134
+ }), e.tags.length > 0 ? /* @__PURE__ */ T("div", {
135
+ className: "mt-1 flex flex-wrap gap-1",
136
+ children: e.tags.map((e) => /* @__PURE__ */ T(D, {
137
+ variant: "outline",
138
+ className: "text-xs",
139
+ children: e
140
+ }, e))
141
+ }) : null] }),
142
+ /* @__PURE__ */ T(q, { children: /* @__PURE__ */ T(D, {
143
+ variant: g(e.status),
144
+ children: e.status
145
+ }) }),
146
+ /* @__PURE__ */ T(q, { children: /* @__PURE__ */ T(D, {
147
+ variant: "secondary",
148
+ children: e.riskProfile
149
+ }) }),
150
+ /* @__PURE__ */ T(q, { children: e.primaryContactName ? /* @__PURE__ */ E("div", {
151
+ className: "space-y-0.5",
152
+ children: [/* @__PURE__ */ T("p", {
153
+ className: "text-sm text-text-primary",
154
+ children: e.primaryContactName
155
+ }), e.primaryContactEmail ? /* @__PURE__ */ E("p", {
156
+ className: "flex items-center gap-1 text-xs text-text-secondary",
157
+ children: [/* @__PURE__ */ T(te, {
158
+ className: "size-3",
159
+ "aria-hidden": "true"
160
+ }), e.primaryContactEmail]
161
+ }) : null]
162
+ }) : /* @__PURE__ */ T("span", {
163
+ className: "text-sm text-text-muted",
164
+ children: "—"
165
+ }) }),
166
+ /* @__PURE__ */ T(q, {
167
+ className: "text-right font-medium text-text-primary",
168
+ children: h(e.aum, e.currency)
169
+ }),
170
+ /* @__PURE__ */ T(q, {
171
+ className: "text-right",
172
+ children: /* @__PURE__ */ E(ie, { children: [/* @__PURE__ */ T(se, {
173
+ asChild: !0,
174
+ children: /* @__PURE__ */ T(O, {
175
+ variant: "ghost",
176
+ size: "icon",
177
+ "aria-label": i("brainyrich.households.rowMenu", "Household actions"),
178
+ children: /* @__PURE__ */ T(ne, {
179
+ className: "size-4",
180
+ "aria-hidden": "true"
182
181
  })
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
182
  })
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",
183
+ }), /* @__PURE__ */ E(ae, {
184
+ align: "end",
285
185
  children: [
286
- /* @__PURE__ */ u(f, {
287
- variant: e.status === "Active" ? "default" : "secondary",
288
- children: e.status
186
+ /* @__PURE__ */ E(R, {
187
+ onClick: () => B(e.id),
188
+ children: [/* @__PURE__ */ T(ee, {
189
+ className: "size-4",
190
+ "aria-hidden": "true"
191
+ }), i("brainyrich.households.action.view", "View details")]
289
192
  }),
290
- /* @__PURE__ */ u("span", {
291
- className: "text-xs text-muted-foreground",
292
- children: e.lastActive
193
+ /* @__PURE__ */ E(R, {
194
+ onClick: () => U(e),
195
+ children: [/* @__PURE__ */ T(x, {
196
+ className: "size-4",
197
+ "aria-hidden": "true"
198
+ }), i("brainyrich.households.action.edit", "Edit")]
293
199
  }),
294
- /* @__PURE__ */ u(p, {
295
- variant: "outline",
296
- size: "sm",
297
- children: /* @__PURE__ */ u(o, { className: "h-3 w-3" })
200
+ /* @__PURE__ */ T(oe, {}),
201
+ /* @__PURE__ */ E(R, {
202
+ className: "text-status-error-text focus:text-status-error-text",
203
+ disabled: j.isPending,
204
+ onClick: () => j.mutate(e.id),
205
+ children: [/* @__PURE__ */ T(y, {
206
+ className: "size-4",
207
+ "aria-hidden": "true"
208
+ }), i("brainyrich.households.action.archive", "Archive")]
298
209
  })
299
210
  ]
211
+ })] })
212
+ })
213
+ ] }, e.id)) })] })
214
+ })
215
+ }) }),
216
+ /* @__PURE__ */ T(be, {
217
+ open: M,
218
+ onOpenChange: N,
219
+ editing: P,
220
+ form: I,
221
+ setField: V,
222
+ onSubmit: () => {
223
+ if (K) if (P) {
224
+ let e = {
225
+ name: I.name.trim(),
226
+ status: I.status,
227
+ riskProfile: I.riskProfile,
228
+ currency: I.currency,
229
+ primaryContactName: I.primaryContactName.trim() || null,
230
+ primaryContactEmail: I.primaryContactEmail.trim() || null,
231
+ notes: I.notes.trim() || null,
232
+ tags: Z(I.tags)
233
+ };
234
+ w.mutate({
235
+ id: P.id,
236
+ input: e
237
+ }, { onSuccess: () => N(!1) });
238
+ } else {
239
+ let e = {
240
+ name: I.name.trim(),
241
+ status: I.status,
242
+ riskProfile: I.riskProfile,
243
+ currency: I.currency,
244
+ primaryContactName: I.primaryContactName.trim() || null,
245
+ primaryContactEmail: I.primaryContactEmail.trim() || null,
246
+ notes: I.notes.trim() || null,
247
+ tags: Z(I.tags)
248
+ };
249
+ I.advisorId.trim() && (e.advisorId = I.advisorId.trim()), S.mutate(e, { onSuccess: () => N(!1) });
250
+ }
251
+ },
252
+ canSubmit: K,
253
+ submitting: G,
254
+ tr: i
255
+ }),
256
+ /* @__PURE__ */ T(xe, {
257
+ householdId: z,
258
+ onClose: () => B(void 0),
259
+ onEdit: (e) => {
260
+ B(void 0), U(e);
261
+ },
262
+ tr: i
263
+ })
264
+ ]
265
+ });
266
+ }
267
+ function be({ open: e, onOpenChange: t, editing: n, form: r, setField: i, onSubmit: a, canSubmit: o, submitting: s, tr: c }) {
268
+ return /* @__PURE__ */ T(j, {
269
+ open: e,
270
+ onOpenChange: t,
271
+ children: /* @__PURE__ */ E(N, {
272
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
273
+ children: [/* @__PURE__ */ E(I, { children: [/* @__PURE__ */ T(L, { children: n ? c("brainyrich.households.form.editTitle", "Edit household") : c("brainyrich.households.form.createTitle", "New household") }), /* @__PURE__ */ T(P, { children: c("brainyrich.households.form.subtitle", "A household groups a client family’s accounts, portfolios and goals.") })] }), /* @__PURE__ */ E("form", {
274
+ className: "space-y-4",
275
+ onSubmit: (e) => {
276
+ e.preventDefault(), a();
277
+ },
278
+ children: [
279
+ /* @__PURE__ */ E("div", {
280
+ className: "space-y-2",
281
+ children: [/* @__PURE__ */ E(B, {
282
+ htmlFor: "hh-name",
283
+ children: [c("brainyrich.households.form.name", "Name"), " *"]
284
+ }), /* @__PURE__ */ T(z, {
285
+ id: "hh-name",
286
+ value: r.name,
287
+ onChange: (e) => i("name", e.target.value),
288
+ placeholder: c("brainyrich.households.form.namePh", "e.g. The Raghavan Family"),
289
+ required: !0
290
+ })]
291
+ }),
292
+ /* @__PURE__ */ E("div", {
293
+ className: "grid gap-4 sm:grid-cols-2",
294
+ children: [/* @__PURE__ */ E("div", {
295
+ className: "space-y-2",
296
+ children: [/* @__PURE__ */ T(B, { children: c("brainyrich.households.form.status", "Status") }), /* @__PURE__ */ E(V, {
297
+ value: r.status,
298
+ onValueChange: (e) => i("status", e),
299
+ children: [/* @__PURE__ */ T(W, { children: /* @__PURE__ */ T(G, {}) }), /* @__PURE__ */ T(H, { children: ge.map((e) => /* @__PURE__ */ T(U, {
300
+ value: e,
301
+ children: e
302
+ }, e)) })]
303
+ })]
304
+ }), /* @__PURE__ */ E("div", {
305
+ className: "space-y-2",
306
+ children: [/* @__PURE__ */ T(B, { children: c("brainyrich.households.form.risk", "Risk profile") }), /* @__PURE__ */ E(V, {
307
+ value: r.riskProfile,
308
+ onValueChange: (e) => i("riskProfile", e),
309
+ children: [/* @__PURE__ */ T(W, { children: /* @__PURE__ */ T(G, {}) }), /* @__PURE__ */ T(H, { children: _e.map((e) => /* @__PURE__ */ T(U, {
310
+ value: e,
311
+ children: e
312
+ }, e)) })]
313
+ })]
314
+ })]
315
+ }),
316
+ /* @__PURE__ */ E("div", {
317
+ className: "grid gap-4 sm:grid-cols-2",
318
+ children: [/* @__PURE__ */ E("div", {
319
+ className: "space-y-2",
320
+ children: [/* @__PURE__ */ T(B, {
321
+ htmlFor: "hh-contact-name",
322
+ children: c("brainyrich.households.form.contactName", "Primary contact")
323
+ }), /* @__PURE__ */ T(z, {
324
+ id: "hh-contact-name",
325
+ value: r.primaryContactName,
326
+ onChange: (e) => i("primaryContactName", e.target.value),
327
+ placeholder: c("brainyrich.households.form.contactNamePh", "Full name")
328
+ })]
329
+ }), /* @__PURE__ */ E("div", {
330
+ className: "space-y-2",
331
+ children: [/* @__PURE__ */ T(B, {
332
+ htmlFor: "hh-contact-email",
333
+ children: c("brainyrich.households.form.contactEmail", "Contact email")
334
+ }), /* @__PURE__ */ T(z, {
335
+ id: "hh-contact-email",
336
+ type: "email",
337
+ value: r.primaryContactEmail,
338
+ onChange: (e) => i("primaryContactEmail", e.target.value),
339
+ placeholder: "name@example.com"
300
340
  })]
301
- }, e.id))
341
+ })]
342
+ }),
343
+ /* @__PURE__ */ E("div", {
344
+ className: "grid gap-4 sm:grid-cols-2",
345
+ children: [/* @__PURE__ */ E("div", {
346
+ className: "space-y-2",
347
+ children: [/* @__PURE__ */ T(B, { children: c("brainyrich.households.form.currency", "Currency") }), /* @__PURE__ */ E(V, {
348
+ value: r.currency,
349
+ onValueChange: (e) => i("currency", e),
350
+ children: [/* @__PURE__ */ T(W, { children: /* @__PURE__ */ T(G, {}) }), /* @__PURE__ */ T(H, { children: ve.map((e) => /* @__PURE__ */ T(U, {
351
+ value: e,
352
+ children: e
353
+ }, e)) })]
354
+ })]
355
+ }), n ? null : /* @__PURE__ */ E("div", {
356
+ className: "space-y-2",
357
+ children: [/* @__PURE__ */ T(B, {
358
+ htmlFor: "hh-advisor",
359
+ children: c("brainyrich.households.form.advisor", "Advisor ID")
360
+ }), /* @__PURE__ */ T(z, {
361
+ id: "hh-advisor",
362
+ value: r.advisorId,
363
+ onChange: (e) => i("advisorId", e.target.value),
364
+ placeholder: c("brainyrich.households.form.advisorPh", "Optional")
365
+ })]
366
+ })]
367
+ }),
368
+ /* @__PURE__ */ E("div", {
369
+ className: "space-y-2",
370
+ children: [/* @__PURE__ */ T(B, {
371
+ htmlFor: "hh-tags",
372
+ children: c("brainyrich.households.form.tags", "Tags")
373
+ }), /* @__PURE__ */ T(z, {
374
+ id: "hh-tags",
375
+ value: r.tags,
376
+ onChange: (e) => i("tags", e.target.value),
377
+ placeholder: c("brainyrich.households.form.tagsPh", "Comma-separated")
378
+ })]
379
+ }),
380
+ /* @__PURE__ */ E("div", {
381
+ className: "space-y-2",
382
+ children: [/* @__PURE__ */ T(B, {
383
+ htmlFor: "hh-notes",
384
+ children: c("brainyrich.households.form.notes", "Notes")
385
+ }), /* @__PURE__ */ T(he, {
386
+ id: "hh-notes",
387
+ value: r.notes,
388
+ onChange: (e) => i("notes", e.target.value),
389
+ rows: 3
390
+ })]
391
+ }),
392
+ /* @__PURE__ */ E(F, { children: [/* @__PURE__ */ T(M, {
393
+ asChild: !0,
394
+ children: /* @__PURE__ */ T(O, {
395
+ type: "button",
396
+ variant: "outline",
397
+ children: c("brainyrich.common.cancel", "Cancel")
398
+ })
399
+ }), /* @__PURE__ */ T(O, {
400
+ type: "submit",
401
+ disabled: !o,
402
+ children: s ? c("brainyrich.common.saving", "Saving…") : n ? c("brainyrich.common.save", "Save changes") : c("brainyrich.households.form.create", "Create household")
302
403
  })] })
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
- })]
404
+ ]
405
+ })]
406
+ })
407
+ });
408
+ }
409
+ function xe({ householdId: e, onClose: n, onEdit: r, tr: o }) {
410
+ let { data: c, isLoading: d, isError: p, refetch: _ } = a(e), { data: v } = t(e ? { householdId: e } : {}), { data: y } = s(e ? { householdId: e } : {}), { data: ee } = i(e ? { householdId: e } : {});
411
+ return /* @__PURE__ */ T(K, {
412
+ open: !!e,
413
+ onOpenChange: (e) => e ? void 0 : n(),
414
+ children: /* @__PURE__ */ T(ce, {
415
+ className: "w-full overflow-y-auto sm:max-w-md",
416
+ children: d ? /* @__PURE__ */ T("div", {
417
+ className: "p-2",
418
+ children: /* @__PURE__ */ T(f, { rows: 4 })
419
+ }) : p ? /* @__PURE__ */ T(u, {
420
+ title: o("brainyrich.households.detail.error", "Could not load household"),
421
+ onRetry: () => _()
422
+ }) : c ? /* @__PURE__ */ E("div", {
423
+ className: "space-y-6",
424
+ children: [
425
+ /* @__PURE__ */ E(ue, {
426
+ className: "space-y-2",
427
+ children: [
428
+ /* @__PURE__ */ T(de, { children: c.name }),
429
+ /* @__PURE__ */ T(le, { children: o("brainyrich.households.detail.subtitle", "Household overview") }),
430
+ /* @__PURE__ */ E("div", {
431
+ className: "flex flex-wrap items-center gap-2 pt-1",
432
+ children: [/* @__PURE__ */ T(D, {
433
+ variant: g(c.status),
434
+ children: c.status
435
+ }), /* @__PURE__ */ T(D, {
436
+ variant: "secondary",
437
+ children: c.riskProfile
438
+ })]
439
+ })
440
+ ]
441
+ }),
442
+ /* @__PURE__ */ E("div", {
443
+ className: "grid grid-cols-3 gap-3",
444
+ children: [
445
+ /* @__PURE__ */ T(Q, {
446
+ icon: /* @__PURE__ */ T(w, {
447
+ className: "size-4",
448
+ "aria-hidden": "true"
328
449
  }),
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
- })
450
+ label: o("brainyrich.households.detail.accounts", "Accounts"),
451
+ value: String(v.length)
452
+ }),
453
+ /* @__PURE__ */ T(Q, {
454
+ icon: /* @__PURE__ */ T(b, {
455
+ className: "size-4",
456
+ "aria-hidden": "true"
335
457
  }),
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);
458
+ label: o("brainyrich.households.detail.portfolios", "Portfolios"),
459
+ value: String(y.length)
460
+ }),
461
+ /* @__PURE__ */ T(Q, {
462
+ icon: /* @__PURE__ */ T(S, {
463
+ className: "size-4",
464
+ "aria-hidden": "true"
465
+ }),
466
+ label: o("brainyrich.households.detail.goals", "Goals"),
467
+ value: String(ee.length)
468
+ })
469
+ ]
470
+ }),
471
+ /* @__PURE__ */ T(k, { children: /* @__PURE__ */ E(A, {
472
+ className: "space-y-3 p-4 text-sm",
473
+ children: [
474
+ /* @__PURE__ */ T($, {
475
+ label: o("brainyrich.households.detail.aum", "AUM"),
476
+ value: h(c.aum, c.currency)
477
+ }),
478
+ /* @__PURE__ */ T($, {
479
+ label: o("brainyrich.households.form.currency", "Currency"),
480
+ value: c.currency
481
+ }),
482
+ /* @__PURE__ */ T($, {
483
+ label: o("brainyrich.households.detail.contact", "Primary contact"),
484
+ value: c.primaryContactName ?? "—"
485
+ }),
486
+ /* @__PURE__ */ T($, {
487
+ label: o("brainyrich.households.form.contactEmail", "Contact email"),
488
+ value: c.primaryContactEmail ?? "—"
489
+ }),
490
+ /* @__PURE__ */ T($, {
491
+ label: o("brainyrich.households.detail.created", "Created"),
492
+ value: m(c.createdAt)
493
+ }),
494
+ /* @__PURE__ */ T($, {
495
+ label: o("brainyrich.households.detail.updated", "Last updated"),
496
+ value: m(c.updatedAt)
497
+ })
498
+ ]
499
+ }) }),
500
+ c.tags.length > 0 ? /* @__PURE__ */ T("div", {
501
+ className: "flex flex-wrap gap-1",
502
+ children: c.tags.map((e) => /* @__PURE__ */ T(D, {
503
+ variant: "outline",
504
+ children: e
505
+ }, e))
506
+ }) : null,
507
+ c.notes ? /* @__PURE__ */ E("div", {
508
+ className: "space-y-1",
509
+ children: [/* @__PURE__ */ T("p", {
510
+ className: "text-xs font-medium text-text-secondary",
511
+ children: o("brainyrich.households.form.notes", "Notes")
512
+ }), /* @__PURE__ */ T("p", {
513
+ className: "text-sm text-text-primary",
514
+ children: c.notes
515
+ })]
516
+ }) : null,
517
+ /* @__PURE__ */ E(O, {
518
+ variant: "outline",
519
+ className: "w-full",
520
+ onClick: () => r(c),
521
+ children: [/* @__PURE__ */ T(x, {
522
+ className: "size-4",
523
+ "aria-hidden": "true"
524
+ }), o("brainyrich.households.action.edit", "Edit")]
349
525
  })
350
- })
351
- ]
526
+ ]
527
+ }) : /* @__PURE__ */ T(l, {
528
+ icon: /* @__PURE__ */ T(C, {
529
+ className: "size-6",
530
+ "aria-hidden": "true"
531
+ }),
532
+ title: o("brainyrich.households.detail.missing", "Household not found")
533
+ })
534
+ })
535
+ });
536
+ }
537
+ function Q({ icon: e, label: t, value: n }) {
538
+ return /* @__PURE__ */ E("div", {
539
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-3 text-center",
540
+ children: [
541
+ /* @__PURE__ */ T("div", {
542
+ className: "mx-auto mb-1 flex size-8 items-center justify-center rounded-full bg-bg-sunken text-text-secondary",
543
+ children: e
544
+ }),
545
+ /* @__PURE__ */ T("p", {
546
+ className: "text-lg font-semibold text-text-primary",
547
+ children: n
548
+ }),
549
+ /* @__PURE__ */ T("p", {
550
+ className: "text-xs text-text-secondary",
551
+ children: t
552
+ })
553
+ ]
554
+ });
555
+ }
556
+ function $({ label: e, value: t }) {
557
+ return /* @__PURE__ */ E("div", {
558
+ className: "flex items-center justify-between gap-4",
559
+ children: [/* @__PURE__ */ T("span", {
560
+ className: "text-text-secondary",
561
+ children: e
562
+ }), /* @__PURE__ */ T("span", {
563
+ className: "text-right font-medium text-text-primary",
564
+ children: t
352
565
  })]
353
566
  });
354
567
  }
355
568
  //#endregion
356
- export { T as FamilyPage };
569
+ export { ye as FamilyPage };
357
570
 
358
571
  //# sourceMappingURL=FamilyPage.js.map