@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,184 +1,767 @@
1
- import { useBrainyRichStore as e } from "../store/brainyrichStore.js";
2
- import { KpiGrid as t, SectionShell as n, formatMoney as r, statusBadgeVariant as i } from "./_shared.js";
3
- import { Landmark as a, Link2 as o, Plus as s, RefreshCw as c } from "lucide-react";
4
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
- import { Badge as d, Button as f, Card as p, CardContent as m, CardDescription as h, CardHeader as g, CardTitle as _, Table as v, TableBody as y, TableCell as b, TableHead as x, TableHeader as S, TableRow as C } from "@burdenoff/fe-libs/ui";
1
+ import { useAccount as e, useAllAccounts as t, useArchiveAccount as n, useCreateAccount as r, usePagedAccounts as i, usePagedTransactions as a, useRecordTransaction as ee, useUpdateAccount as te } from "../hooks/useBrainyRichApi.js";
2
+ import { LoadMore as o } from "../components/LoadMore.js";
3
+ import { ConfirmDialog as ne } from "../components/ConfirmDialog.js";
4
+ import { ActorName as s } from "../components/ActorName.js";
5
+ import { HouseholdPicker as c } from "../components/pickers.js";
6
+ import "../components/index.js";
7
+ import { EmptyState as l, ErrorState as u, KpiGrid as d, LoadingState as f, SectionShell as re, formatDate as p, formatMoney as m, statusBadgeVariant as ie } from "./_shared.js";
8
+ import { DocumentsPanel as h } from "../components/reuse/DocumentsPanel.js";
9
+ import { useState as g } from "react";
10
+ import { Archive as ae, ArrowDownRight as _, ArrowUpRight as v, Landmark as oe, MoreHorizontal as se, Pencil as ce, Plus as y, Receipt as b } from "lucide-react";
11
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
12
+ import { Badge as C, Button as w, Card as le, CardContent as ue, CardDescription as de, CardHeader as fe, CardTitle as pe, Dialog as T, DialogClose as me, DialogContent as E, DialogDescription as D, DialogFooter as O, DialogHeader as k, DialogTitle as A, DropdownMenu as he, DropdownMenuContent as ge, DropdownMenuItem as j, DropdownMenuTrigger as _e, Input as M, Label as N, Select as P, SelectContent as F, SelectItem as I, SelectTrigger as ve, SelectValue as ye, Sheet as L, SheetContent as R, SheetDescription as z, SheetHeader as B, SheetTitle as V, Table as be, TableBody as xe, TableCell as H, TableHead as U, TableHeader as Se, TableRow as Ce, Textarea as we } from "@burdenoff/fe-libs/ui";
6
13
  //#region src/brainyrich/pages/AccountsPage.tsx
7
- function w() {
8
- let { accounts: w } = e(), T = w.reduce((e, t) => e + t.balance, 0), E = w.filter((e) => e.status === "Connected").length;
9
- return /* @__PURE__ */ u(n, {
10
- title: "Account Management",
11
- description: "Connect and manage all your financial accounts in one place",
12
- actionLabel: "Link Account",
13
- badges: [`${w.length} Accounts`],
14
+ var Te = [
15
+ "BANK",
16
+ "BROKERAGE",
17
+ "RETIREMENT",
18
+ "CASH",
19
+ "CRYPTO",
20
+ "REAL_ESTATE",
21
+ "ALTERNATIVE",
22
+ "LIABILITY"
23
+ ], Ee = [
24
+ "BUY",
25
+ "SELL",
26
+ "DIVIDEND",
27
+ "INTEREST",
28
+ "DEPOSIT",
29
+ "WITHDRAWAL",
30
+ "FEE",
31
+ "TRANSFER"
32
+ ];
33
+ function W(e) {
34
+ return e === "DEPOSIT" || e === "DIVIDEND" || e === "INTEREST" || e === "SELL" || e === "TRANSFER";
35
+ }
36
+ function G(e) {
37
+ if (e.trim() === "") return;
38
+ let t = Number(e);
39
+ return Number.isFinite(t) ? t : void 0;
40
+ }
41
+ var K = {
42
+ name: "",
43
+ type: "BANK",
44
+ institution: "",
45
+ currency: "USD",
46
+ cashBalance: "",
47
+ accountMask: "",
48
+ householdId: null
49
+ }, De = {
50
+ type: "DEPOSIT",
51
+ tradeDate: "",
52
+ symbol: "",
53
+ quantity: "",
54
+ price: "",
55
+ amount: "",
56
+ fee: "",
57
+ notes: ""
58
+ };
59
+ function q() {
60
+ let e = t().data, a = i(), [s, c] = g(void 0), [p, h] = g(!1), [_, v] = g(K), [b, L] = g(null), [R, z] = g(K), [B, V] = g(null), [Te, W] = g(!1), [q, J] = g(De), Y = r(), X = te(), Ae = n(), Z = ee(), je = e.reduce((e, t) => e + (t.cashBalance ?? 0), 0), Me = e.filter((e) => e.status === "ACTIVE").length, Ne = new Set(e.map((e) => e.institution).filter((e) => !!e)).size, Pe = e[0]?.currency ?? "USD";
61
+ function Fe() {
62
+ v(K), h(!0);
63
+ }
64
+ function Ie() {
65
+ _.name.trim() && Y.mutate({
66
+ name: _.name.trim(),
67
+ type: _.type,
68
+ institution: _.institution.trim() || null,
69
+ currency: _.currency.trim() || "USD",
70
+ cashBalance: G(_.cashBalance) ?? 0,
71
+ accountMask: _.accountMask.trim() || null,
72
+ householdId: _.householdId
73
+ }, { onSuccess: () => h(!1) });
74
+ }
75
+ function Le(e) {
76
+ L(e), z({
77
+ name: e.name,
78
+ type: e.type,
79
+ institution: e.institution ?? "",
80
+ currency: e.currency,
81
+ cashBalance: String(e.cashBalance ?? ""),
82
+ accountMask: e.accountMask ?? "",
83
+ householdId: e.householdId
84
+ });
85
+ }
86
+ function Re() {
87
+ !b || !R.name.trim() || X.mutate({
88
+ id: b.id,
89
+ input: {
90
+ name: R.name.trim(),
91
+ type: R.type,
92
+ institution: R.institution.trim() || null,
93
+ currency: R.currency.trim() || "USD",
94
+ cashBalance: G(R.cashBalance) ?? 0,
95
+ accountMask: R.accountMask.trim() || null,
96
+ householdId: R.householdId
97
+ }
98
+ }, { onSuccess: () => L(null) });
99
+ }
100
+ function ze() {
101
+ if (!B) return;
102
+ let e = B.id;
103
+ Ae.mutate(e, { onSuccess: () => {
104
+ V(null), s === e && c(void 0);
105
+ } });
106
+ }
107
+ function Be() {
108
+ J(De), W(!0);
109
+ }
110
+ let Q = G(q.amount), $ = Q !== void 0 && Q > 0, Ve = !!(s && q.tradeDate) && $;
111
+ function He() {
112
+ if (!s || !q.tradeDate || !$) return;
113
+ let e = new Date(q.tradeDate);
114
+ Number.isNaN(e.getTime()) || Z.mutate({
115
+ accountId: s,
116
+ type: q.type,
117
+ tradeDate: e.toISOString(),
118
+ symbol: q.symbol.trim() || null,
119
+ quantity: G(q.quantity),
120
+ price: G(q.price),
121
+ amount: Q,
122
+ fee: G(q.fee),
123
+ notes: q.notes.trim() || null
124
+ }, { onSuccess: () => W(!1) });
125
+ }
126
+ return /* @__PURE__ */ S(re, {
127
+ title: "Accounts",
128
+ description: "Linked bank, brokerage and retirement accounts with recent activity.",
129
+ badges: [`${e.length} account${e.length === 1 ? "" : "s"}`],
130
+ actionLabel: "New account",
131
+ onAction: Fe,
14
132
  children: [
15
- /* @__PURE__ */ l(t, { items: [
133
+ /* @__PURE__ */ x(d, { items: [
16
134
  {
17
- label: "Total Balance",
18
- value: r(T),
19
- trend: "+2.3% this month"
135
+ label: "Total accounts",
136
+ value: String(e.length)
20
137
  },
21
138
  {
22
- label: "Connected",
23
- value: `${E}/${w.length}`,
24
- trend: "Active connections"
139
+ label: "Total cash",
140
+ value: m(je, Pe)
25
141
  },
26
142
  {
27
- label: "Last Sync",
28
- value: "2h ago",
29
- trend: "Auto-sync enabled"
143
+ label: "Active",
144
+ value: `${Me}/${e.length}`
30
145
  },
31
146
  {
32
- label: "Account Types",
33
- value: String(new Set(w.map((e) => e.type)).size),
34
- trend: "Diversified"
147
+ label: "Institutions",
148
+ value: String(Ne)
35
149
  }
36
150
  ] }),
37
- /* @__PURE__ */ u(p, { children: [/* @__PURE__ */ u(g, {
38
- className: "flex flex-row items-center justify-between",
39
- children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ u(_, {
40
- className: "flex items-center gap-2",
41
- children: [/* @__PURE__ */ l(a, { className: "h-5 w-5" }), "Linked Accounts"]
42
- }), /* @__PURE__ */ l(h, { children: "Your connected financial institutions" })] }), /* @__PURE__ */ u("div", {
43
- className: "flex gap-2",
44
- children: [/* @__PURE__ */ u(f, {
45
- variant: "outline",
46
- size: "sm",
47
- children: [/* @__PURE__ */ l(c, { className: "mr-1 h-4 w-4" }), "Sync All"]
48
- }), /* @__PURE__ */ u(f, {
49
- size: "sm",
50
- children: [/* @__PURE__ */ l(s, { className: "mr-1 h-4 w-4" }), "Link Account"]
51
- })]
52
- })]
53
- }), /* @__PURE__ */ l(m, { children: /* @__PURE__ */ u(v, { children: [/* @__PURE__ */ l(S, { children: /* @__PURE__ */ u(C, { children: [
54
- /* @__PURE__ */ l(x, { children: "Institution" }),
55
- /* @__PURE__ */ l(x, { children: "Type" }),
56
- /* @__PURE__ */ l(x, {
57
- className: "text-right",
58
- children: "Balance"
151
+ /* @__PURE__ */ S(le, { children: [/* @__PURE__ */ S(fe, { children: [/* @__PURE__ */ S(pe, {
152
+ className: "flex items-center gap-2",
153
+ children: [/* @__PURE__ */ x(oe, {
154
+ className: "h-5 w-5",
155
+ "aria-hidden": "true"
156
+ }), "Linked accounts"]
157
+ }), /* @__PURE__ */ x(de, { children: "Select an account to view holdings and transactions." })] }), /* @__PURE__ */ x(ue, { children: a.isLoading ? /* @__PURE__ */ x(f, {}) : a.isError ? /* @__PURE__ */ x(u, { onRetry: () => a.refetch() }) : a.items.length === 0 ? /* @__PURE__ */ x(l, {
158
+ icon: /* @__PURE__ */ x(oe, {
159
+ className: "size-6",
160
+ "aria-hidden": "true"
59
161
  }),
60
- /* @__PURE__ */ l(x, { children: "Status" }),
61
- /* @__PURE__ */ l(x, {
62
- className: "text-right",
63
- children: "Actions"
162
+ title: "No accounts yet",
163
+ description: "Add your first bank, brokerage or retirement account to start tracking net worth.",
164
+ action: /* @__PURE__ */ S(w, {
165
+ size: "sm",
166
+ onClick: Fe,
167
+ children: [/* @__PURE__ */ x(y, {
168
+ className: "size-4",
169
+ "aria-hidden": "true"
170
+ }), "New account"]
64
171
  })
65
- ] }) }), /* @__PURE__ */ l(y, { children: w.map((e) => /* @__PURE__ */ u(C, { children: [
66
- /* @__PURE__ */ l(b, { children: /* @__PURE__ */ u("div", {
67
- className: "flex items-center gap-3",
68
- children: [/* @__PURE__ */ l("div", {
69
- className: "flex h-9 w-9 items-center justify-center rounded-full bg-blue-100 text-xs font-bold text-blue-600",
70
- children: e.institution.slice(0, 2).toUpperCase()
71
- }), /* @__PURE__ */ l("span", {
72
- className: "font-medium",
73
- children: e.institution
74
- })]
75
- }) }),
76
- /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(d, {
77
- variant: "outline",
78
- children: e.type
79
- }) }),
80
- /* @__PURE__ */ l(b, {
81
- className: "text-right font-semibold",
82
- children: r(e.balance)
83
- }),
84
- /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(d, {
85
- variant: i(e.status),
86
- children: e.status
87
- }) }),
88
- /* @__PURE__ */ l(b, {
89
- className: "text-right",
90
- children: /* @__PURE__ */ u("div", {
91
- className: "flex justify-end gap-1",
92
- children: [/* @__PURE__ */ l(f, {
172
+ }) : /* @__PURE__ */ S("div", {
173
+ className: "overflow-x-auto",
174
+ children: [/* @__PURE__ */ S(be, { children: [/* @__PURE__ */ x(Se, { children: /* @__PURE__ */ S(Ce, { children: [
175
+ /* @__PURE__ */ x(U, { children: "Account" }),
176
+ /* @__PURE__ */ x(U, { children: "Type" }),
177
+ /* @__PURE__ */ x(U, {
178
+ className: "text-right",
179
+ children: "Cash balance"
180
+ }),
181
+ /* @__PURE__ */ x(U, { children: "Status" }),
182
+ /* @__PURE__ */ x(U, {
183
+ className: "w-12 text-right",
184
+ children: "Actions"
185
+ })
186
+ ] }) }), /* @__PURE__ */ x(xe, { children: a.items.map((e) => /* @__PURE__ */ S(Ce, {
187
+ className: "cursor-pointer",
188
+ onClick: () => c(e.id),
189
+ children: [
190
+ /* @__PURE__ */ x(H, { children: /* @__PURE__ */ S("div", {
191
+ className: "flex items-center gap-3",
192
+ children: [/* @__PURE__ */ x("div", {
193
+ className: "flex h-9 w-9 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground",
194
+ children: (e.institution ?? e.name).slice(0, 2).toUpperCase()
195
+ }), /* @__PURE__ */ S("div", {
196
+ className: "min-w-0",
197
+ children: [/* @__PURE__ */ x("p", {
198
+ className: "truncate font-medium text-text-primary",
199
+ children: e.name
200
+ }), /* @__PURE__ */ S("p", {
201
+ className: "truncate text-xs text-text-secondary",
202
+ children: [e.institution ?? "Manual account", e.accountMask ? ` · ••${e.accountMask}` : ""]
203
+ })]
204
+ })]
205
+ }) }),
206
+ /* @__PURE__ */ x(H, { children: /* @__PURE__ */ x(C, {
93
207
  variant: "outline",
94
- size: "sm",
95
- children: /* @__PURE__ */ l(c, { className: "h-3 w-3" })
96
- }), /* @__PURE__ */ l(f, {
208
+ children: e.type.replace(/_/g, " ")
209
+ }) }),
210
+ /* @__PURE__ */ x(H, {
211
+ className: "text-right font-semibold text-text-primary",
212
+ children: m(e.cashBalance, e.currency)
213
+ }),
214
+ /* @__PURE__ */ x(H, { children: /* @__PURE__ */ x(C, {
215
+ variant: ie(e.status),
216
+ children: e.status
217
+ }) }),
218
+ /* @__PURE__ */ x(H, {
219
+ className: "text-right",
220
+ onClick: (e) => e.stopPropagation(),
221
+ children: /* @__PURE__ */ S(he, { children: [/* @__PURE__ */ x(_e, {
222
+ asChild: !0,
223
+ children: /* @__PURE__ */ x(w, {
224
+ variant: "ghost",
225
+ size: "sm",
226
+ "aria-label": `Actions for ${e.name}`,
227
+ children: /* @__PURE__ */ x(se, {
228
+ className: "size-4",
229
+ "aria-hidden": "true"
230
+ })
231
+ })
232
+ }), /* @__PURE__ */ S(ge, {
233
+ align: "end",
234
+ children: [/* @__PURE__ */ S(j, {
235
+ onClick: () => Le(e),
236
+ children: [/* @__PURE__ */ x(ce, {
237
+ className: "size-4",
238
+ "aria-hidden": "true"
239
+ }), "Edit"]
240
+ }), /* @__PURE__ */ S(j, {
241
+ className: "text-status-error-text",
242
+ onClick: () => V(e),
243
+ children: [/* @__PURE__ */ x(ae, {
244
+ className: "size-4",
245
+ "aria-hidden": "true"
246
+ }), "Archive"]
247
+ })]
248
+ })] })
249
+ })
250
+ ]
251
+ }, e.id)) })] }), /* @__PURE__ */ x(o, {
252
+ hasMore: a.hasMore,
253
+ onClick: a.loadMore,
254
+ loading: a.isFetchingNextPage,
255
+ className: "mt-4"
256
+ })]
257
+ }) })] }),
258
+ /* @__PURE__ */ x(T, {
259
+ open: p,
260
+ onOpenChange: h,
261
+ children: /* @__PURE__ */ S(E, { children: [
262
+ /* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: "New account" }), /* @__PURE__ */ x(D, { children: "Add a bank, brokerage or retirement account." })] }),
263
+ /* @__PURE__ */ x(Oe, {
264
+ form: _,
265
+ onChange: v
266
+ }),
267
+ /* @__PURE__ */ S(O, { children: [/* @__PURE__ */ x(me, {
268
+ asChild: !0,
269
+ children: /* @__PURE__ */ x(w, {
97
270
  variant: "outline",
98
- size: "sm",
99
- children: /* @__PURE__ */ l(o, { className: "h-3 w-3" })
271
+ children: "Cancel"
272
+ })
273
+ }), /* @__PURE__ */ x(w, {
274
+ onClick: Ie,
275
+ disabled: !_.name.trim() || Y.isPending,
276
+ children: Y.isPending ? "Creating…" : "Create account"
277
+ })] })
278
+ ] })
279
+ }),
280
+ /* @__PURE__ */ x(T, {
281
+ open: !!b,
282
+ onOpenChange: (e) => !e && L(null),
283
+ children: /* @__PURE__ */ S(E, { children: [
284
+ /* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: "Edit account" }), /* @__PURE__ */ x(D, { children: "Update account details." })] }),
285
+ /* @__PURE__ */ x(Oe, {
286
+ form: R,
287
+ onChange: z
288
+ }),
289
+ /* @__PURE__ */ S(O, { children: [/* @__PURE__ */ x(w, {
290
+ variant: "outline",
291
+ onClick: () => L(null),
292
+ children: "Cancel"
293
+ }), /* @__PURE__ */ x(w, {
294
+ onClick: Re,
295
+ disabled: !R.name.trim() || X.isPending,
296
+ children: X.isPending ? "Saving…" : "Save changes"
297
+ })] })
298
+ ] })
299
+ }),
300
+ /* @__PURE__ */ x(ne, {
301
+ open: !!B,
302
+ onOpenChange: (e) => !e && V(null),
303
+ title: "Archive account?",
304
+ description: B ? `“${B.name}” will be archived and hidden from active lists. This does not delete its history.` : void 0,
305
+ confirmLabel: "Archive account",
306
+ pendingLabel: "Archiving…",
307
+ destructive: !0,
308
+ pending: Ae.isPending,
309
+ onConfirm: ze
310
+ }),
311
+ /* @__PURE__ */ x(ke, {
312
+ accountId: s,
313
+ onClose: () => c(void 0),
314
+ onRecordTransaction: Be
315
+ }),
316
+ /* @__PURE__ */ x(T, {
317
+ open: Te,
318
+ onOpenChange: W,
319
+ children: /* @__PURE__ */ S(E, { children: [
320
+ /* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: "Record transaction" }), /* @__PURE__ */ x(D, { children: "Log activity against the selected account." })] }),
321
+ /* @__PURE__ */ S("div", {
322
+ className: "grid gap-4",
323
+ children: [
324
+ /* @__PURE__ */ S("div", {
325
+ className: "grid grid-cols-2 gap-4",
326
+ children: [/* @__PURE__ */ S("div", {
327
+ className: "space-y-2",
328
+ children: [/* @__PURE__ */ x(N, {
329
+ htmlFor: "tx-type",
330
+ children: "Type"
331
+ }), /* @__PURE__ */ S(P, {
332
+ value: q.type,
333
+ onValueChange: (e) => J((t) => ({
334
+ ...t,
335
+ type: e
336
+ })),
337
+ children: [/* @__PURE__ */ x(ve, {
338
+ id: "tx-type",
339
+ children: /* @__PURE__ */ x(ye, {})
340
+ }), /* @__PURE__ */ x(F, { children: Ee.map((e) => /* @__PURE__ */ x(I, {
341
+ value: e,
342
+ children: e.replace(/_/g, " ")
343
+ }, e)) })]
344
+ })]
345
+ }), /* @__PURE__ */ S("div", {
346
+ className: "space-y-2",
347
+ children: [/* @__PURE__ */ x(N, {
348
+ htmlFor: "tx-date",
349
+ children: "Trade date"
350
+ }), /* @__PURE__ */ x(M, {
351
+ id: "tx-date",
352
+ type: "date",
353
+ value: q.tradeDate,
354
+ onChange: (e) => J((t) => ({
355
+ ...t,
356
+ tradeDate: e.target.value
357
+ }))
358
+ })]
359
+ })]
360
+ }),
361
+ /* @__PURE__ */ S("div", {
362
+ className: "grid grid-cols-2 gap-4",
363
+ children: [/* @__PURE__ */ S("div", {
364
+ className: "space-y-2",
365
+ children: [/* @__PURE__ */ x(N, {
366
+ htmlFor: "tx-symbol",
367
+ children: "Symbol"
368
+ }), /* @__PURE__ */ x(M, {
369
+ id: "tx-symbol",
370
+ value: q.symbol,
371
+ onChange: (e) => J((t) => ({
372
+ ...t,
373
+ symbol: e.target.value
374
+ })),
375
+ placeholder: "e.g. VOO"
376
+ })]
377
+ }), /* @__PURE__ */ S("div", {
378
+ className: "space-y-2",
379
+ children: [
380
+ /* @__PURE__ */ x(N, {
381
+ htmlFor: "tx-amount",
382
+ children: "Amount"
383
+ }),
384
+ /* @__PURE__ */ x(M, {
385
+ id: "tx-amount",
386
+ type: "number",
387
+ min: "0",
388
+ step: "any",
389
+ value: q.amount,
390
+ onChange: (e) => J((t) => ({
391
+ ...t,
392
+ amount: e.target.value
393
+ })),
394
+ "aria-invalid": q.amount.trim() !== "" && !$,
395
+ "aria-describedby": "tx-amount-hint"
396
+ }),
397
+ /* @__PURE__ */ x("p", {
398
+ id: "tx-amount-hint",
399
+ className: "text-xs text-text-secondary",
400
+ children: q.amount.trim() !== "" && !$ ? "Enter an amount greater than 0." : "Positive amount; direction is set by the type."
401
+ })
402
+ ]
403
+ })]
404
+ }),
405
+ /* @__PURE__ */ S("div", {
406
+ className: "grid grid-cols-3 gap-4",
407
+ children: [
408
+ /* @__PURE__ */ S("div", {
409
+ className: "space-y-2",
410
+ children: [/* @__PURE__ */ x(N, {
411
+ htmlFor: "tx-qty",
412
+ children: "Quantity"
413
+ }), /* @__PURE__ */ x(M, {
414
+ id: "tx-qty",
415
+ type: "number",
416
+ value: q.quantity,
417
+ onChange: (e) => J((t) => ({
418
+ ...t,
419
+ quantity: e.target.value
420
+ }))
421
+ })]
422
+ }),
423
+ /* @__PURE__ */ S("div", {
424
+ className: "space-y-2",
425
+ children: [/* @__PURE__ */ x(N, {
426
+ htmlFor: "tx-price",
427
+ children: "Price"
428
+ }), /* @__PURE__ */ x(M, {
429
+ id: "tx-price",
430
+ type: "number",
431
+ value: q.price,
432
+ onChange: (e) => J((t) => ({
433
+ ...t,
434
+ price: e.target.value
435
+ }))
436
+ })]
437
+ }),
438
+ /* @__PURE__ */ S("div", {
439
+ className: "space-y-2",
440
+ children: [/* @__PURE__ */ x(N, {
441
+ htmlFor: "tx-fee",
442
+ children: "Fee"
443
+ }), /* @__PURE__ */ x(M, {
444
+ id: "tx-fee",
445
+ type: "number",
446
+ value: q.fee,
447
+ onChange: (e) => J((t) => ({
448
+ ...t,
449
+ fee: e.target.value
450
+ }))
451
+ })]
452
+ })
453
+ ]
454
+ }),
455
+ /* @__PURE__ */ S("div", {
456
+ className: "space-y-2",
457
+ children: [/* @__PURE__ */ x(N, {
458
+ htmlFor: "tx-notes",
459
+ children: "Notes"
460
+ }), /* @__PURE__ */ x(we, {
461
+ id: "tx-notes",
462
+ value: q.notes,
463
+ onChange: (e) => J((t) => ({
464
+ ...t,
465
+ notes: e.target.value
466
+ })),
467
+ placeholder: "Optional note"
468
+ })]
469
+ })
470
+ ]
471
+ }),
472
+ /* @__PURE__ */ S(O, { children: [/* @__PURE__ */ x(w, {
473
+ variant: "outline",
474
+ onClick: () => W(!1),
475
+ children: "Cancel"
476
+ }), /* @__PURE__ */ x(w, {
477
+ onClick: He,
478
+ disabled: !Ve || Z.isPending,
479
+ children: Z.isPending ? "Saving…" : "Record transaction"
480
+ })] })
481
+ ] })
482
+ })
483
+ ]
484
+ });
485
+ }
486
+ function Oe({ form: e, onChange: t }) {
487
+ return /* @__PURE__ */ S("div", {
488
+ className: "grid gap-4",
489
+ children: [
490
+ /* @__PURE__ */ S("div", {
491
+ className: "space-y-2",
492
+ children: [/* @__PURE__ */ x(N, {
493
+ htmlFor: "acct-name",
494
+ children: "Name"
495
+ }), /* @__PURE__ */ x(M, {
496
+ id: "acct-name",
497
+ value: e.name,
498
+ onChange: (e) => t((t) => ({
499
+ ...t,
500
+ name: e.target.value
501
+ })),
502
+ placeholder: "e.g. Everyday Checking"
503
+ })]
504
+ }),
505
+ /* @__PURE__ */ S("div", {
506
+ className: "grid grid-cols-2 gap-4",
507
+ children: [/* @__PURE__ */ S("div", {
508
+ className: "space-y-2",
509
+ children: [/* @__PURE__ */ x(N, {
510
+ htmlFor: "acct-type",
511
+ children: "Type"
512
+ }), /* @__PURE__ */ S(P, {
513
+ value: e.type,
514
+ onValueChange: (e) => t((t) => ({
515
+ ...t,
516
+ type: e
517
+ })),
518
+ children: [/* @__PURE__ */ x(ve, {
519
+ id: "acct-type",
520
+ children: /* @__PURE__ */ x(ye, {})
521
+ }), /* @__PURE__ */ x(F, { children: Te.map((e) => /* @__PURE__ */ x(I, {
522
+ value: e,
523
+ children: e.replace(/_/g, " ")
524
+ }, e)) })]
525
+ })]
526
+ }), /* @__PURE__ */ S("div", {
527
+ className: "space-y-2",
528
+ children: [/* @__PURE__ */ x(N, {
529
+ htmlFor: "acct-currency",
530
+ children: "Currency"
531
+ }), /* @__PURE__ */ x(M, {
532
+ id: "acct-currency",
533
+ value: e.currency,
534
+ onChange: (e) => t((t) => ({
535
+ ...t,
536
+ currency: e.target.value.toUpperCase()
537
+ })),
538
+ placeholder: "USD"
539
+ })]
540
+ })]
541
+ }),
542
+ /* @__PURE__ */ S("div", {
543
+ className: "space-y-2",
544
+ children: [/* @__PURE__ */ x(N, {
545
+ htmlFor: "acct-institution",
546
+ children: "Institution"
547
+ }), /* @__PURE__ */ x(M, {
548
+ id: "acct-institution",
549
+ value: e.institution,
550
+ onChange: (e) => t((t) => ({
551
+ ...t,
552
+ institution: e.target.value
553
+ })),
554
+ placeholder: "e.g. Chase"
555
+ })]
556
+ }),
557
+ /* @__PURE__ */ S("div", {
558
+ className: "grid grid-cols-2 gap-4",
559
+ children: [/* @__PURE__ */ S("div", {
560
+ className: "space-y-2",
561
+ children: [/* @__PURE__ */ x(N, {
562
+ htmlFor: "acct-balance",
563
+ children: "Cash balance"
564
+ }), /* @__PURE__ */ x(M, {
565
+ id: "acct-balance",
566
+ type: "number",
567
+ value: e.cashBalance,
568
+ onChange: (e) => t((t) => ({
569
+ ...t,
570
+ cashBalance: e.target.value
571
+ }))
572
+ })]
573
+ }), /* @__PURE__ */ S("div", {
574
+ className: "space-y-2",
575
+ children: [/* @__PURE__ */ x(N, {
576
+ htmlFor: "acct-mask",
577
+ children: "Account mask"
578
+ }), /* @__PURE__ */ x(M, {
579
+ id: "acct-mask",
580
+ value: e.accountMask,
581
+ onChange: (e) => t((t) => ({
582
+ ...t,
583
+ accountMask: e.target.value
584
+ })),
585
+ placeholder: "Last 4 digits"
586
+ })]
587
+ })]
588
+ }),
589
+ /* @__PURE__ */ x(c, {
590
+ value: e.householdId,
591
+ onChange: (e) => t((t) => ({
592
+ ...t,
593
+ householdId: e
594
+ }))
595
+ })
596
+ ]
597
+ });
598
+ }
599
+ function ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
600
+ let { data: i, isLoading: ee, isError: te, refetch: ne } = e(t), c = a(t ? { accountId: t } : {}), d = t ? c.items : [];
601
+ return /* @__PURE__ */ x(L, {
602
+ open: !!t,
603
+ onOpenChange: (e) => !e && n(),
604
+ children: /* @__PURE__ */ S(R, {
605
+ className: "w-full overflow-y-auto sm:max-w-lg",
606
+ children: [/* @__PURE__ */ S(B, { children: [/* @__PURE__ */ x(V, { children: i?.name ?? "Account" }), /* @__PURE__ */ x(z, { children: i ? `${i.institution ?? "Manual account"} · ${i.type.replace(/_/g, " ")}` : "Loading account details…" })] }), ee ? /* @__PURE__ */ x("div", {
607
+ className: "mt-6",
608
+ children: /* @__PURE__ */ x(f, { rows: 3 })
609
+ }) : te ? /* @__PURE__ */ x("div", {
610
+ className: "mt-6",
611
+ children: /* @__PURE__ */ x(u, { onRetry: () => ne() })
612
+ }) : i ? /* @__PURE__ */ S("div", {
613
+ className: "mt-6 space-y-6",
614
+ children: [
615
+ /* @__PURE__ */ S("div", {
616
+ className: "grid grid-cols-2 gap-4",
617
+ children: [/* @__PURE__ */ S("div", {
618
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
619
+ children: [/* @__PURE__ */ x("p", {
620
+ className: "text-xs text-text-secondary",
621
+ children: "Cash balance"
622
+ }), /* @__PURE__ */ x("p", {
623
+ className: "text-xl font-semibold text-text-primary",
624
+ children: m(i.cashBalance, i.currency)
625
+ })]
626
+ }), /* @__PURE__ */ S("div", {
627
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
628
+ children: [/* @__PURE__ */ x("p", {
629
+ className: "text-xs text-text-secondary",
630
+ children: "Status"
631
+ }), /* @__PURE__ */ x(C, {
632
+ variant: ie(i.status),
633
+ children: i.status
634
+ })]
100
635
  })]
101
- })
102
- })
103
- ] }, e.id)) })] }) })] }),
104
- /* @__PURE__ */ u("div", {
105
- className: "grid gap-4 md:grid-cols-2",
106
- children: [/* @__PURE__ */ u(p, { children: [/* @__PURE__ */ u(g, { children: [/* @__PURE__ */ l(_, {
107
- className: "text-base",
108
- children: "Account Distribution"
109
- }), /* @__PURE__ */ l(h, { children: "Balance allocation by account type" })] }), /* @__PURE__ */ l(m, {
110
- className: "space-y-3",
111
- children: w.map((e) => {
112
- let t = Math.round(e.balance / T * 100);
113
- return /* @__PURE__ */ u("div", {
114
- className: "space-y-1",
115
- children: [/* @__PURE__ */ u("div", {
116
- className: "flex justify-between text-sm",
117
- children: [/* @__PURE__ */ u("span", { children: [
118
- e.institution,
119
- " (",
120
- e.type,
121
- ")"
122
- ] }), /* @__PURE__ */ u("span", {
123
- className: "font-medium",
124
- children: [t, "%"]
636
+ }),
637
+ /* @__PURE__ */ S("div", {
638
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
639
+ children: [/* @__PURE__ */ x("p", {
640
+ className: "text-xs text-text-secondary",
641
+ children: "Owner"
642
+ }), /* @__PURE__ */ x(s, {
643
+ id: i.ownerId,
644
+ className: "text-sm font-medium text-text-primary"
645
+ })]
646
+ }),
647
+ /* @__PURE__ */ S("div", {
648
+ className: "space-y-3",
649
+ children: [/* @__PURE__ */ x("h3", {
650
+ className: "text-sm font-semibold text-text-primary",
651
+ children: "Holdings"
652
+ }), i.holdings.length === 0 ? /* @__PURE__ */ x(l, {
653
+ title: "No holdings",
654
+ description: "This account has no positions recorded yet."
655
+ }) : /* @__PURE__ */ x("div", {
656
+ className: "space-y-2",
657
+ children: i.holdings.map((e) => /* @__PURE__ */ S("div", {
658
+ className: "flex items-center justify-between rounded-lg border border-border-subtle bg-bg-surface p-3",
659
+ children: [/* @__PURE__ */ S("div", {
660
+ className: "min-w-0",
661
+ children: [/* @__PURE__ */ x("p", {
662
+ className: "truncate text-sm font-medium text-text-primary",
663
+ children: e.symbol
664
+ }), e.name ? /* @__PURE__ */ x("p", {
665
+ className: "truncate text-xs text-text-secondary",
666
+ children: e.name
667
+ }) : null]
668
+ }), /* @__PURE__ */ x("span", {
669
+ className: "text-sm font-semibold text-text-primary",
670
+ children: m(e.marketValue, e.currency)
125
671
  })]
126
- }), /* @__PURE__ */ l("div", {
127
- className: "h-2 rounded bg-muted overflow-hidden",
128
- children: /* @__PURE__ */ l("div", {
129
- className: "h-2 rounded bg-primary",
130
- style: { width: `${t}%` }
131
- })
672
+ }, e.id))
673
+ })]
674
+ }),
675
+ /* @__PURE__ */ S("div", {
676
+ className: "space-y-3",
677
+ children: [/* @__PURE__ */ S("div", {
678
+ className: "flex items-center justify-between",
679
+ children: [/* @__PURE__ */ x("h3", {
680
+ className: "text-sm font-semibold text-text-primary",
681
+ children: "Recent transactions"
682
+ }), /* @__PURE__ */ S(w, {
683
+ size: "sm",
684
+ variant: "outline",
685
+ onClick: r,
686
+ children: [/* @__PURE__ */ x(b, {
687
+ className: "size-4",
688
+ "aria-hidden": "true"
689
+ }), "Record"]
690
+ })]
691
+ }), c.isLoading ? /* @__PURE__ */ x(f, { rows: 2 }) : c.isError ? /* @__PURE__ */ x(u, { onRetry: () => c.refetch() }) : d.length === 0 ? /* @__PURE__ */ x(l, {
692
+ icon: /* @__PURE__ */ x(b, {
693
+ className: "size-6",
694
+ "aria-hidden": "true"
695
+ }),
696
+ title: "No transactions",
697
+ description: "Record a transaction to see activity here.",
698
+ action: /* @__PURE__ */ S(w, {
699
+ size: "sm",
700
+ onClick: r,
701
+ children: [/* @__PURE__ */ x(y, {
702
+ className: "size-4",
703
+ "aria-hidden": "true"
704
+ }), "Record transaction"]
705
+ })
706
+ }) : /* @__PURE__ */ S("div", {
707
+ className: "space-y-2",
708
+ children: [d.map((e) => {
709
+ let t = W(e.type), n = t ? v : _, r = t ? "text-status-success-text" : "text-status-error-text";
710
+ return /* @__PURE__ */ S("div", {
711
+ className: "flex items-center justify-between rounded-lg border border-border-subtle bg-bg-surface p-3",
712
+ children: [/* @__PURE__ */ S("div", {
713
+ className: "min-w-0",
714
+ children: [/* @__PURE__ */ S("div", {
715
+ className: "flex items-center gap-2",
716
+ children: [/* @__PURE__ */ x(C, {
717
+ variant: "outline",
718
+ children: e.type.replace(/_/g, " ")
719
+ }), e.symbol ? /* @__PURE__ */ x("span", {
720
+ className: "truncate text-xs text-text-secondary",
721
+ children: e.symbol
722
+ }) : null]
723
+ }), /* @__PURE__ */ x("p", {
724
+ className: "mt-1 text-xs text-text-secondary",
725
+ children: p(e.tradeDate)
726
+ })]
727
+ }), /* @__PURE__ */ S("span", {
728
+ className: `inline-flex items-center gap-1 text-sm font-semibold ${r}`,
729
+ children: [
730
+ /* @__PURE__ */ x(n, {
731
+ className: "size-4",
732
+ "aria-hidden": "true"
733
+ }),
734
+ t ? "+" : "−",
735
+ m(Math.abs(e.amount), e.currency)
736
+ ]
737
+ })]
738
+ }, e.id);
739
+ }), /* @__PURE__ */ x(o, {
740
+ hasMore: c.hasMore,
741
+ onClick: c.loadMore,
742
+ loading: c.isFetchingNextPage
132
743
  })]
133
- }, e.id);
134
- })
135
- })] }), /* @__PURE__ */ u(p, { children: [/* @__PURE__ */ u(g, { children: [/* @__PURE__ */ l(_, {
136
- className: "text-base",
137
- children: "Recent Transactions"
138
- }), /* @__PURE__ */ l(h, { children: "Latest activity across linked accounts" })] }), /* @__PURE__ */ l(m, {
139
- className: "space-y-3",
140
- children: [
141
- {
142
- desc: "SIP - Axis Bluechip Fund",
143
- account: "HDFC Securities",
144
- amount: -15e3,
145
- date: "2026-06-01"
146
- },
147
- {
148
- desc: "Salary Credit - Tech Corp",
149
- account: "ICICI Bank",
150
- amount: 185e3,
151
- date: "2026-05-31"
152
- },
153
- {
154
- desc: "EPF Monthly Contribution",
155
- account: "EPF Trust",
156
- amount: -12500,
157
- date: "2026-05-28"
158
- }
159
- ].map((e, t) => /* @__PURE__ */ u("div", {
160
- className: "flex items-center justify-between rounded-lg border p-3",
161
- children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
162
- className: "text-sm font-medium",
163
- children: e.desc
164
- }), /* @__PURE__ */ u("p", {
165
- className: "text-xs text-muted-foreground",
166
- children: [
167
- e.account,
168
- " · ",
169
- e.date
170
- ]
171
- })] }), /* @__PURE__ */ u("span", {
172
- className: `text-sm font-semibold ${e.amount >= 0 ? "text-emerald-600" : "text-red-600"}`,
173
- children: [e.amount >= 0 ? "+" : "", r(e.amount)]
174
744
  })]
175
- }, t))
176
- })] })]
177
- })
178
- ]
745
+ }),
746
+ /* @__PURE__ */ x("div", {
747
+ className: "space-y-3",
748
+ children: /* @__PURE__ */ x(h, {
749
+ entityType: "brainyrich-account",
750
+ entityId: i.id
751
+ })
752
+ })
753
+ ]
754
+ }) : /* @__PURE__ */ x("div", {
755
+ className: "mt-6",
756
+ children: /* @__PURE__ */ x(l, {
757
+ title: "Account not found",
758
+ description: "This account is no longer available."
759
+ })
760
+ })]
761
+ })
179
762
  });
180
763
  }
181
764
  //#endregion
182
- export { w as AccountsPage };
765
+ export { q as AccountsPage };
183
766
 
184
767
  //# sourceMappingURL=AccountsPage.js.map