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