@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,261 +1,431 @@
1
- import { useBrainyRichStore as e } from "../store/brainyrichStore.js";
2
- import { KpiGrid as t, SectionShell as n } from "./_shared.js";
3
- import { Calendar as r, Clock as i, Download as a, FileText as o } from "lucide-react";
4
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
- import { Badge as l, Button as u, Card as d, CardContent as f, CardHeader as p, CardTitle as m } from "@burdenoff/fe-libs/ui";
1
+ import { useBrainyRich as e } from "../providers/BrainyRichProvider.js";
2
+ import { tWithFallback as t } from "../utils/i18n.js";
3
+ import { fetchAllAccounts as n, useAllTransactions as r, useNetWorthSummary as i } from "../hooks/useBrainyRichApi.js";
4
+ import { AllocationBars as a, EmptyState as o, ErrorState as s, KpiGrid as c, LoadingState as l, SectionShell as u, deltaToneClass as d, formatDate as f, formatMoney as p } from "./_shared.js";
5
+ import { useMemo as m, useState as h } from "react";
6
+ import { ChevronDown as g, Download as _, FileText as v, Layers as y, Printer as b, Receipt as x, Wallet as S } from "lucide-react";
7
+ import { useI18n as C } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
8
+ import { useQuery as w } from "@tanstack/react-query";
9
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
10
+ import { Badge as D, Button as ee, Card as O, CardContent as k, CardDescription as A, CardHeader as j, CardTitle as M, DropdownMenu as N, DropdownMenuContent as P, DropdownMenuItem as F, DropdownMenuTrigger as I, Table as L, TableBody as R, TableCell as z, TableHead as B, TableHeader as V, TableRow as H, Tabs as U, TabsList as W, TabsTrigger as G } from "@burdenoff/fe-libs/ui";
11
+ import { graphqlFetch as K } from "@burdenoff/fe-libs/shared/graphql";
6
12
  //#region src/brainyrich/pages/ReportsPage.tsx
7
- var h = [
8
- {
9
- category: "Portfolio Reports",
10
- items: [
11
- {
12
- name: "Portfolio Performance",
13
- desc: "Comprehensive return analysis",
14
- frequency: "Monthly",
15
- last: "2026-06-01"
16
- },
17
- {
18
- name: "Asset Allocation",
19
- desc: "Current vs target allocation",
20
- frequency: "Quarterly",
21
- last: "2026-05-01"
22
- },
23
- {
24
- name: "Holdings Summary",
25
- desc: "Detailed position report",
26
- frequency: "Weekly",
27
- last: "2026-06-08"
28
- }
29
- ]
30
- },
31
- {
32
- category: "Tax Reports",
33
- items: [
34
- {
35
- name: "Tax Loss Harvesting",
36
- desc: "Realized & unrealized gains/losses",
37
- frequency: "Monthly",
38
- last: "2026-06-01"
39
- },
40
- {
41
- name: "Tax-Efficient Strategies",
42
- desc: "Optimization recommendations",
43
- frequency: "Quarterly",
44
- last: "2026-04-01"
45
- },
46
- {
47
- name: "Year-End Tax Summary",
48
- desc: "Annual tax impact analysis",
49
- frequency: "Annually",
50
- last: "2025-12-31"
51
- }
52
- ]
53
- },
54
- {
55
- category: "Risk Reports",
56
- items: [{
57
- name: "Risk Assessment",
58
- desc: "Portfolio risk metrics",
59
- frequency: "Monthly",
60
- last: "2026-06-01"
61
- }, {
62
- name: "Stress Test Results",
63
- desc: "Crisis scenario analysis",
64
- frequency: "Quarterly",
65
- last: "2026-04-01"
66
- }]
67
- }
68
- ], g = [
69
- {
70
- name: "Weekly Holdings Summary",
71
- nextRun: "2026-06-15",
72
- frequency: "Weekly",
73
- recipients: "you@brainyrich.com"
74
- },
75
- {
76
- name: "Monthly Performance Report",
77
- nextRun: "2026-07-01",
78
- frequency: "Monthly",
79
- recipients: "you@brainyrich.com"
80
- },
81
- {
82
- name: "Quarterly Tax Summary",
83
- nextRun: "2026-10-01",
84
- frequency: "Quarterly",
85
- recipients: "you@brainyrich.com, advisor@firm.com"
86
- }
87
- ];
88
- function _() {
89
- let { reports: _ } = e();
90
- return /* @__PURE__ */ c(n, {
91
- title: "Reports & Documents",
92
- description: "Generate, schedule, and download your financial reports",
93
- actionLabel: "Generate Custom Report",
94
- badges: [`${_.length} Recent Reports`],
95
- children: [/* @__PURE__ */ s(t, { items: [
96
- {
97
- label: "Total Reports",
98
- value: "127",
99
- trend: "Generated this year"
100
- },
101
- {
102
- label: "Scheduled Reports",
103
- value: String(g.length),
104
- trend: "Active schedules"
105
- },
106
- {
107
- label: "Ready to Download",
108
- value: String(_.length)
109
- },
110
- {
111
- label: "Report Formats",
112
- value: "3",
113
- trend: "PDF, Excel, CSV"
114
- }
115
- ] }), /* @__PURE__ */ c("div", {
116
- className: "grid gap-4 lg:grid-cols-3",
117
- children: [/* @__PURE__ */ s("div", {
118
- className: "lg:col-span-2 space-y-4",
119
- children: h.map((e) => /* @__PURE__ */ c(d, { children: [/* @__PURE__ */ s(p, { children: /* @__PURE__ */ s(m, {
120
- className: "text-base",
121
- children: e.category
122
- }) }), /* @__PURE__ */ s(f, {
123
- className: "space-y-2",
124
- children: e.items.map((e) => /* @__PURE__ */ c("div", {
125
- className: "flex items-center justify-between rounded-lg border p-3",
126
- children: [
127
- /* @__PURE__ */ c("div", {
128
- className: "flex-1",
129
- children: [/* @__PURE__ */ s("p", {
130
- className: "font-medium text-sm",
131
- children: e.name
132
- }), /* @__PURE__ */ s("p", {
133
- className: "text-xs text-muted-foreground",
134
- children: e.desc
135
- })]
136
- }),
137
- /* @__PURE__ */ c("div", {
138
- className: "text-center mx-4",
139
- children: [/* @__PURE__ */ s(l, {
140
- variant: "outline",
141
- className: "text-[10px]",
142
- children: e.frequency
143
- }), /* @__PURE__ */ c("p", {
144
- className: "text-[10px] text-muted-foreground mt-0.5",
145
- children: ["Last: ", e.last]
146
- })]
147
- }),
148
- /* @__PURE__ */ c("div", {
149
- className: "flex gap-1",
150
- children: [/* @__PURE__ */ s(u, {
151
- variant: "outline",
152
- size: "sm",
153
- children: "Generate"
154
- }), /* @__PURE__ */ s(u, {
155
- variant: "outline",
156
- size: "sm",
157
- children: /* @__PURE__ */ s(r, { className: "h-3 w-3" })
158
- })]
159
- })
160
- ]
161
- }, e.name))
162
- })] }, e.category))
163
- }), /* @__PURE__ */ c("div", {
164
- className: "space-y-4",
13
+ function q(e, t) {
14
+ let n = (e) => {
15
+ let t = String(e ?? "");
16
+ return /[",\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
17
+ };
18
+ return [e, ...t].map((e) => e.map(n).join(",")).join("\n");
19
+ }
20
+ function J(e, t) {
21
+ let n = new Blob([t], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n), i = document.createElement("a");
22
+ i.href = r, i.download = e, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
23
+ }
24
+ var Y = "query BraReportHoldings($accountId: ID) {\n braListHoldings(accountId: $accountId) {\n id workspaceId accountId portfolioId symbol name assetClass quantity lastPrice\n costBasis marketValue currency asOf createdAt updatedAt\n }\n}";
25
+ function X() {
26
+ let { apiGatewayUrl: t } = e(), r = w({
27
+ queryKey: [
28
+ "brainyrich",
29
+ "holdings",
30
+ "report-all"
31
+ ],
32
+ queryFn: async () => {
33
+ let e = await n(t);
34
+ return (await Promise.all(e.map(async (e) => {
35
+ let n = await K({
36
+ gateway: "workspace",
37
+ baseUrl: t,
38
+ query: Y,
39
+ variables: { accountId: e.id },
40
+ workspaceToken: !0
41
+ });
42
+ if (n.errors?.length) throw Error(n.errors[0]?.message ?? "Failed to load holdings");
43
+ return n.data?.braListHoldings ?? [];
44
+ }))).flat();
45
+ }
46
+ });
47
+ return {
48
+ ...r,
49
+ data: r.data ?? []
50
+ };
51
+ }
52
+ function Z() {
53
+ let { t: e } = C(), n = (n, r, i) => t(e, n, r, i), [a, o] = h("networth"), s = i(), l = X(), d = r(), v = s.data, w = v?.currency ?? "USD", D = m(() => l.data.slice().sort((e, t) => t.marketValue - e.marketValue), [l.data]), O = m(() => d.data.slice().sort((e, t) => new Date(t.tradeDate).getTime() - new Date(e.tradeDate).getTime()), [d.data]), k = v ? [
54
+ {
55
+ label: n("brainyrich.reports.kpis.netWorth", "Net Worth"),
56
+ value: p(v.totalNetWorth, w)
57
+ },
58
+ {
59
+ label: n("brainyrich.reports.kpis.marketValue", "Invested Value"),
60
+ value: p(v.totalMarketValue, w)
61
+ },
62
+ {
63
+ label: n("brainyrich.reports.kpis.holdings", "Holdings on Schedule"),
64
+ value: String(D.length)
65
+ },
66
+ {
67
+ label: n("brainyrich.reports.kpis.transactions", "Ledger Entries"),
68
+ value: String(O.length)
69
+ }
70
+ ] : [{
71
+ label: n("brainyrich.reports.kpis.holdings", "Holdings on Schedule"),
72
+ value: String(D.length)
73
+ }, {
74
+ label: n("brainyrich.reports.kpis.transactions", "Ledger Entries"),
75
+ value: String(O.length)
76
+ }], A = () => {
77
+ if (a === "networth") {
78
+ if (!v) return;
79
+ J("brainyrich-net-worth-statement.csv", q([
80
+ "Metric",
81
+ "Amount",
82
+ "Currency"
83
+ ], [
84
+ [
85
+ "Total Net Worth",
86
+ v.totalNetWorth,
87
+ w
88
+ ],
89
+ [
90
+ "Total Market Value",
91
+ v.totalMarketValue,
92
+ w
93
+ ],
94
+ [
95
+ "Total Cash",
96
+ v.totalCash,
97
+ w
98
+ ],
99
+ [
100
+ "Account Count",
101
+ v.accountCount,
102
+ ""
103
+ ],
104
+ ...v.byAssetClass.map((e) => [
105
+ `Asset Class: ${e.assetClass.replace(/_/g, " ")}`,
106
+ e.marketValue,
107
+ w
108
+ ])
109
+ ]));
110
+ return;
111
+ }
112
+ if (a === "holdings") {
113
+ J("brainyrich-holdings-schedule.csv", q([
114
+ "Symbol",
115
+ "Name",
116
+ "Asset Class",
117
+ "Quantity",
118
+ "Cost Basis",
119
+ "Market Value",
120
+ "Currency"
121
+ ], D.map((e) => [
122
+ e.symbol,
123
+ e.name ?? "",
124
+ e.assetClass.replace(/_/g, " "),
125
+ e.quantity,
126
+ e.costBasis,
127
+ e.marketValue,
128
+ e.currency
129
+ ])));
130
+ return;
131
+ }
132
+ J("brainyrich-transaction-ledger.csv", q([
133
+ "Trade Date",
134
+ "Type",
135
+ "Symbol",
136
+ "Quantity",
137
+ "Price",
138
+ "Amount",
139
+ "Fee",
140
+ "Currency"
141
+ ], O.map((e) => [
142
+ f(e.tradeDate),
143
+ e.type,
144
+ e.symbol ?? "",
145
+ e.quantity,
146
+ e.price,
147
+ e.amount,
148
+ e.fee,
149
+ e.currency
150
+ ])));
151
+ }, j = a === "networth" && (s.isLoading || !v) || a === "holdings" && (l.isLoading || D.length === 0) || a === "transactions" && (d.isLoading || O.length === 0);
152
+ return /* @__PURE__ */ E(u, {
153
+ title: n("brainyrich.reports.title", "Reports & Statements"),
154
+ description: n("brainyrich.reports.description", "Generate statements directly from your live portfolio data — no fabricated schedules."),
155
+ actions: /* @__PURE__ */ E(N, { children: [/* @__PURE__ */ T(I, {
156
+ asChild: !0,
157
+ children: /* @__PURE__ */ E(ee, {
158
+ size: "sm",
159
+ disabled: j,
160
+ "aria-label": n("brainyrich.reports.actions.export", "Print / Export"),
165
161
  children: [
166
- /* @__PURE__ */ c(d, { children: [/* @__PURE__ */ s(p, { children: /* @__PURE__ */ c(m, {
167
- className: "flex items-center gap-2 text-base",
168
- children: [/* @__PURE__ */ s(o, { className: "h-4 w-4" }), "Recent Reports"]
169
- }) }), /* @__PURE__ */ s(f, {
170
- className: "space-y-3",
171
- children: _.map((e) => /* @__PURE__ */ c("div", {
172
- className: "rounded-lg border p-3",
173
- children: [
174
- /* @__PURE__ */ s("p", {
175
- className: "font-medium text-sm",
176
- children: e.title
177
- }),
178
- /* @__PURE__ */ c("p", {
179
- className: "text-xs text-muted-foreground",
180
- children: [
181
- e.period,
182
- " · Generated ",
183
- e.generatedAt
184
- ]
185
- }),
186
- /* @__PURE__ */ c(u, {
187
- variant: "outline",
188
- size: "sm",
189
- className: "mt-2 w-full",
190
- children: [/* @__PURE__ */ s(a, { className: "mr-1 h-3 w-3" }), "Download"]
191
- })
192
- ]
193
- }, e.id))
194
- })] }),
195
- /* @__PURE__ */ c(d, { children: [/* @__PURE__ */ s(p, { children: /* @__PURE__ */ c(m, {
196
- className: "flex items-center gap-2 text-base",
197
- children: [/* @__PURE__ */ s(i, { className: "h-4 w-4" }), "Scheduled Reports"]
198
- }) }), /* @__PURE__ */ s(f, {
199
- className: "space-y-3",
200
- children: g.map((e) => /* @__PURE__ */ c("div", {
201
- className: "rounded-lg border p-3",
202
- children: [
203
- /* @__PURE__ */ s("p", {
204
- className: "font-medium text-sm",
205
- children: e.name
206
- }),
207
- /* @__PURE__ */ c("p", {
208
- className: "text-xs text-muted-foreground",
209
- children: [
210
- "Next: ",
211
- e.nextRun,
212
- " · ",
213
- e.frequency
214
- ]
215
- }),
216
- /* @__PURE__ */ s("p", {
217
- className: "text-xs text-muted-foreground",
218
- children: e.recipients
219
- })
220
- ]
221
- }, e.name))
222
- })] }),
223
- /* @__PURE__ */ c(d, { children: [/* @__PURE__ */ s(p, { children: /* @__PURE__ */ s(m, {
224
- className: "text-base",
225
- children: "Export Formats"
226
- }) }), /* @__PURE__ */ s(f, {
227
- className: "space-y-2",
228
- children: [
229
- {
230
- format: "PDF",
231
- status: "Available"
232
- },
233
- {
234
- format: "Excel (.xlsx)",
235
- status: "Available"
236
- },
237
- {
238
- format: "CSV",
239
- status: "Available"
240
- },
241
- {
242
- format: "Interactive Dashboard",
243
- status: "Coming Soon"
244
- }
245
- ].map((e) => /* @__PURE__ */ c("div", {
246
- className: "flex justify-between text-sm",
247
- children: [/* @__PURE__ */ s("span", { children: e.format }), /* @__PURE__ */ s("span", {
248
- className: e.status === "Available" ? "text-emerald-600" : "text-yellow-600",
249
- children: e.status === "Available" ? "Available" : "Coming Soon"
250
- })]
251
- }, e.format))
252
- })] })
162
+ /* @__PURE__ */ T(_, {
163
+ className: "size-4",
164
+ "aria-hidden": "true"
165
+ }),
166
+ n("brainyrich.reports.actions.export", "Print / Export"),
167
+ /* @__PURE__ */ T(g, {
168
+ className: "size-4",
169
+ "aria-hidden": "true"
170
+ })
253
171
  ]
172
+ })
173
+ }), /* @__PURE__ */ E(P, {
174
+ align: "end",
175
+ children: [/* @__PURE__ */ E(F, {
176
+ onSelect: A,
177
+ children: [/* @__PURE__ */ T(_, {
178
+ className: "size-4",
179
+ "aria-hidden": "true"
180
+ }), n("brainyrich.reports.actions.downloadCsv", "Download CSV")]
181
+ }), /* @__PURE__ */ E(F, {
182
+ onSelect: () => window.print(),
183
+ children: [/* @__PURE__ */ T(b, {
184
+ className: "size-4",
185
+ "aria-hidden": "true"
186
+ }), n("brainyrich.reports.actions.print", "Print statement")]
187
+ })]
188
+ })] }),
189
+ children: [
190
+ /* @__PURE__ */ T(c, { items: k }),
191
+ /* @__PURE__ */ T(U, {
192
+ value: a,
193
+ onValueChange: (e) => o(e),
194
+ children: /* @__PURE__ */ E(W, { children: [
195
+ /* @__PURE__ */ E(G, {
196
+ value: "networth",
197
+ children: [/* @__PURE__ */ T(S, {
198
+ className: "size-4",
199
+ "aria-hidden": "true"
200
+ }), n("brainyrich.reports.tabs.netWorth", "Net Worth")]
201
+ }),
202
+ /* @__PURE__ */ E(G, {
203
+ value: "holdings",
204
+ children: [/* @__PURE__ */ T(y, {
205
+ className: "size-4",
206
+ "aria-hidden": "true"
207
+ }), n("brainyrich.reports.tabs.holdings", "Holdings")]
208
+ }),
209
+ /* @__PURE__ */ E(G, {
210
+ value: "transactions",
211
+ children: [/* @__PURE__ */ T(x, {
212
+ className: "size-4",
213
+ "aria-hidden": "true"
214
+ }), n("brainyrich.reports.tabs.ledger", "Ledger")]
215
+ })
216
+ ] })
217
+ }),
218
+ a === "networth" ? /* @__PURE__ */ T(Q, {
219
+ query: s,
220
+ translate: n
221
+ }) : a === "holdings" ? /* @__PURE__ */ T(te, {
222
+ query: l,
223
+ holdings: D,
224
+ translate: n
225
+ }) : /* @__PURE__ */ T(ne, {
226
+ query: d,
227
+ transactions: O,
228
+ translate: n
229
+ })
230
+ ]
231
+ });
232
+ }
233
+ function Q({ query: e, translate: t }) {
234
+ let n = e.data, r = n?.currency ?? "USD", i = m(() => {
235
+ if (!n) return [];
236
+ let e = n.byAssetClass.reduce((e, t) => e + t.marketValue, 0);
237
+ return e <= 0 ? [] : n.byAssetClass.slice().sort((e, t) => t.marketValue - e.marketValue).map((t) => ({
238
+ label: t.assetClass.replace(/_/g, " "),
239
+ value: t.marketValue / e * 100,
240
+ caption: p(t.marketValue, r)
241
+ }));
242
+ }, [n, r]);
243
+ return /* @__PURE__ */ E(O, { children: [/* @__PURE__ */ E(j, { children: [/* @__PURE__ */ E(M, {
244
+ className: "flex items-center gap-2",
245
+ children: [/* @__PURE__ */ T(S, {
246
+ className: "size-5",
247
+ "aria-hidden": "true"
248
+ }), t("brainyrich.reports.netWorth.title", "Net Worth Statement")]
249
+ }), /* @__PURE__ */ T(A, { children: t("brainyrich.reports.netWorth.description", "Consolidated assets, cash, and asset-class allocation as of today.") })] }), /* @__PURE__ */ T(k, { children: e.isLoading ? /* @__PURE__ */ T(l, { rows: 3 }) : e.isError ? /* @__PURE__ */ T(s, { onRetry: () => e.refetch() }) : n ? /* @__PURE__ */ E("div", {
250
+ className: "space-y-6",
251
+ children: [/* @__PURE__ */ E("div", {
252
+ className: "grid gap-4 sm:grid-cols-3",
253
+ children: [
254
+ /* @__PURE__ */ T($, {
255
+ label: t("brainyrich.reports.netWorth.total", "Total Net Worth"),
256
+ value: p(n.totalNetWorth, r),
257
+ emphasis: !0
258
+ }),
259
+ /* @__PURE__ */ T($, {
260
+ label: t("brainyrich.reports.netWorth.invested", "Invested Value"),
261
+ value: p(n.totalMarketValue, r)
262
+ }),
263
+ /* @__PURE__ */ T($, {
264
+ label: t("brainyrich.reports.netWorth.cash", "Cash & Liquidity"),
265
+ value: p(n.totalCash, r)
266
+ })
267
+ ]
268
+ }), /* @__PURE__ */ E("div", {
269
+ className: "space-y-3",
270
+ children: [/* @__PURE__ */ T("p", {
271
+ className: "text-sm font-medium text-text-primary",
272
+ children: t("brainyrich.reports.netWorth.allocation", "Allocation by Asset Class")
273
+ }), i.length > 0 ? /* @__PURE__ */ T(a, { data: i }) : /* @__PURE__ */ T("p", {
274
+ className: "text-sm text-text-secondary",
275
+ children: t("brainyrich.reports.netWorth.noAllocation", "No holdings to allocate yet.")
254
276
  })]
255
277
  })]
278
+ }) : /* @__PURE__ */ T(o, {
279
+ icon: /* @__PURE__ */ T(S, {
280
+ className: "size-6",
281
+ "aria-hidden": "true"
282
+ }),
283
+ title: t("brainyrich.reports.netWorth.emptyTitle", "No net-worth data yet"),
284
+ description: t("brainyrich.reports.netWorth.emptyDesc", "Link an account and add holdings to generate a net-worth statement.")
285
+ }) })] });
286
+ }
287
+ function $({ label: e, value: t, emphasis: n }) {
288
+ return /* @__PURE__ */ E("div", {
289
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
290
+ children: [/* @__PURE__ */ T("p", {
291
+ className: "text-xs text-text-secondary",
292
+ children: e
293
+ }), /* @__PURE__ */ T("p", {
294
+ className: n ? "mt-1 text-2xl font-semibold text-text-primary" : "mt-1 text-xl font-semibold text-text-primary",
295
+ children: t
296
+ })]
256
297
  });
257
298
  }
299
+ function te({ query: e, holdings: t, translate: n }) {
300
+ return /* @__PURE__ */ E(O, { children: [/* @__PURE__ */ E(j, { children: [/* @__PURE__ */ E(M, {
301
+ className: "flex items-center gap-2",
302
+ children: [/* @__PURE__ */ T(y, {
303
+ className: "size-5",
304
+ "aria-hidden": "true"
305
+ }), n("brainyrich.reports.holdings.title", "Holdings Schedule")]
306
+ }), /* @__PURE__ */ T(A, { children: n("brainyrich.reports.holdings.description", "Every position across your portfolios with cost basis and market value.") })] }), /* @__PURE__ */ T(k, { children: e.isLoading ? /* @__PURE__ */ T(l, { rows: 4 }) : e.isError ? /* @__PURE__ */ T(s, { onRetry: () => e.refetch() }) : t.length > 0 ? /* @__PURE__ */ T("div", {
307
+ className: "overflow-x-auto",
308
+ children: /* @__PURE__ */ E(L, { children: [/* @__PURE__ */ T(V, { children: /* @__PURE__ */ E(H, { children: [
309
+ /* @__PURE__ */ T(B, { children: n("brainyrich.reports.holdings.symbol", "Symbol") }),
310
+ /* @__PURE__ */ T(B, { children: n("brainyrich.reports.holdings.assetClass", "Asset Class") }),
311
+ /* @__PURE__ */ T(B, {
312
+ className: "text-right",
313
+ children: n("brainyrich.reports.holdings.quantity", "Quantity")
314
+ }),
315
+ /* @__PURE__ */ T(B, {
316
+ className: "text-right",
317
+ children: n("brainyrich.reports.holdings.costBasis", "Cost Basis")
318
+ }),
319
+ /* @__PURE__ */ T(B, {
320
+ className: "text-right",
321
+ children: n("brainyrich.reports.holdings.marketValue", "Market Value")
322
+ }),
323
+ /* @__PURE__ */ T(B, {
324
+ className: "text-right",
325
+ children: n("brainyrich.reports.holdings.gainLoss", "Unrealized")
326
+ })
327
+ ] }) }), /* @__PURE__ */ T(R, { children: t.map((e) => {
328
+ let t = e.marketValue - e.costBasis;
329
+ return /* @__PURE__ */ E(H, { children: [
330
+ /* @__PURE__ */ E(z, { children: [/* @__PURE__ */ T("div", {
331
+ className: "font-medium text-text-primary",
332
+ children: e.symbol
333
+ }), e.name ? /* @__PURE__ */ T("div", {
334
+ className: "text-xs text-text-secondary",
335
+ children: e.name
336
+ }) : null] }),
337
+ /* @__PURE__ */ T(z, { children: /* @__PURE__ */ T(D, {
338
+ variant: "outline",
339
+ children: e.assetClass.replace(/_/g, " ")
340
+ }) }),
341
+ /* @__PURE__ */ T(z, {
342
+ className: "text-right tabular-nums text-text-primary",
343
+ children: e.quantity
344
+ }),
345
+ /* @__PURE__ */ T(z, {
346
+ className: "text-right tabular-nums text-text-primary",
347
+ children: p(e.costBasis, e.currency)
348
+ }),
349
+ /* @__PURE__ */ T(z, {
350
+ className: "text-right tabular-nums text-text-primary",
351
+ children: p(e.marketValue, e.currency)
352
+ }),
353
+ /* @__PURE__ */ E(z, {
354
+ className: `text-right tabular-nums font-medium ${d(t)}`,
355
+ children: [t > 0 ? "+" : "", p(t, e.currency)]
356
+ })
357
+ ] }, e.id);
358
+ }) })] })
359
+ }) : /* @__PURE__ */ T(o, {
360
+ icon: /* @__PURE__ */ T(y, {
361
+ className: "size-6",
362
+ "aria-hidden": "true"
363
+ }),
364
+ title: n("brainyrich.reports.holdings.emptyTitle", "No holdings on file"),
365
+ description: n("brainyrich.reports.holdings.emptyDesc", "Add holdings to your portfolios to generate a holdings schedule.")
366
+ }) })] });
367
+ }
368
+ function ne({ query: e, transactions: t, translate: n }) {
369
+ return /* @__PURE__ */ E(O, { children: [/* @__PURE__ */ E(j, { children: [/* @__PURE__ */ E(M, {
370
+ className: "flex items-center gap-2",
371
+ children: [/* @__PURE__ */ T(x, {
372
+ className: "size-5",
373
+ "aria-hidden": "true"
374
+ }), n("brainyrich.reports.ledger.title", "Transaction Ledger")]
375
+ }), /* @__PURE__ */ T(A, { children: n("brainyrich.reports.ledger.description", "Every recorded transaction across your accounts, newest first.") })] }), /* @__PURE__ */ T(k, { children: e.isLoading ? /* @__PURE__ */ T(l, { rows: 4 }) : e.isError ? /* @__PURE__ */ T(s, { onRetry: () => e.refetch() }) : t.length > 0 ? /* @__PURE__ */ T("div", {
376
+ className: "overflow-x-auto",
377
+ children: /* @__PURE__ */ E(L, { children: [/* @__PURE__ */ T(V, { children: /* @__PURE__ */ E(H, { children: [
378
+ /* @__PURE__ */ T(B, { children: n("brainyrich.reports.ledger.date", "Trade Date") }),
379
+ /* @__PURE__ */ T(B, { children: n("brainyrich.reports.ledger.type", "Type") }),
380
+ /* @__PURE__ */ T(B, { children: n("brainyrich.reports.ledger.symbol", "Symbol") }),
381
+ /* @__PURE__ */ T(B, {
382
+ className: "text-right",
383
+ children: n("brainyrich.reports.ledger.quantity", "Quantity")
384
+ }),
385
+ /* @__PURE__ */ T(B, {
386
+ className: "text-right",
387
+ children: n("brainyrich.reports.ledger.price", "Price")
388
+ }),
389
+ /* @__PURE__ */ T(B, {
390
+ className: "text-right",
391
+ children: n("brainyrich.reports.ledger.amount", "Amount")
392
+ })
393
+ ] }) }), /* @__PURE__ */ T(R, { children: t.map((e) => /* @__PURE__ */ E(H, { children: [
394
+ /* @__PURE__ */ T(z, {
395
+ className: "text-text-primary",
396
+ children: f(e.tradeDate)
397
+ }),
398
+ /* @__PURE__ */ T(z, { children: /* @__PURE__ */ T(D, {
399
+ variant: "outline",
400
+ children: e.type
401
+ }) }),
402
+ /* @__PURE__ */ T(z, {
403
+ className: "text-text-primary",
404
+ children: e.symbol ?? "—"
405
+ }),
406
+ /* @__PURE__ */ T(z, {
407
+ className: "text-right tabular-nums text-text-primary",
408
+ children: e.quantity
409
+ }),
410
+ /* @__PURE__ */ T(z, {
411
+ className: "text-right tabular-nums text-text-primary",
412
+ children: p(e.price, e.currency)
413
+ }),
414
+ /* @__PURE__ */ T(z, {
415
+ className: "text-right tabular-nums text-text-primary",
416
+ children: p(e.amount, e.currency)
417
+ })
418
+ ] }, e.id)) })] })
419
+ }) : /* @__PURE__ */ T(o, {
420
+ icon: /* @__PURE__ */ T(v, {
421
+ className: "size-6",
422
+ "aria-hidden": "true"
423
+ }),
424
+ title: n("brainyrich.reports.ledger.emptyTitle", "No transactions recorded"),
425
+ description: n("brainyrich.reports.ledger.emptyDesc", "Record transactions on your accounts to build a ledger statement.")
426
+ }) })] });
427
+ }
258
428
  //#endregion
259
- export { _ as ReportsPage };
429
+ export { Z as ReportsPage };
260
430
 
261
431
  //# sourceMappingURL=ReportsPage.js.map