@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
@@ -0,0 +1,815 @@
1
+ import { useBrainyRich as e } from "../providers/BrainyRichProvider.js";
2
+ import { errorMessage as t, notify as n } from "../components/notify.js";
3
+ import { useInfiniteQuery as r, useMutation as i, useQuery as a, useQueryClient as o } from "@tanstack/react-query";
4
+ import { graphqlFetch as ee } from "@burdenoff/fe-libs/shared/graphql";
5
+ //#region src/brainyrich/hooks/useBrainyRichApi.ts
6
+ var te = () => {
7
+ let e = globalThis;
8
+ e.__graphqlFetchResponseCache?.clear(), e.__graphqlFetchPendingResponses?.clear(), e.__boffGraphQLResponseCache?.clear();
9
+ }, s = async (e, t, n, r) => {
10
+ let i = await ee({
11
+ gateway: "workspace",
12
+ baseUrl: n,
13
+ query: e,
14
+ variables: t,
15
+ workspaceToken: !0,
16
+ suppressGlobalErrorEvent: r?.suppressGlobalError ?? !1
17
+ });
18
+ if (i.errors?.length) throw Error(i.errors[0]?.message ?? "GraphQL request failed");
19
+ if (!i.data) throw Error("GraphQL response did not include data");
20
+ return i.data;
21
+ }, c = async (e, t, n) => {
22
+ let r = await s(e, t, n, { suppressGlobalError: !0 });
23
+ return te(), r;
24
+ };
25
+ function l(e) {
26
+ return {
27
+ onSuccess: (t, r) => {
28
+ e.onSuccess?.(t, r), e.success && n.success(typeof e.success == "function" ? e.success(t, r) : e.success);
29
+ },
30
+ onError: (e) => n.error(t(e))
31
+ };
32
+ }
33
+ var u = {
34
+ netWorth: ["brainyrich", "net-worth"],
35
+ accounts: ["brainyrich", "accounts"],
36
+ account: (e) => [
37
+ "brainyrich",
38
+ "account",
39
+ e
40
+ ],
41
+ portfolios: ["brainyrich", "portfolios"],
42
+ portfolio: (e) => [
43
+ "brainyrich",
44
+ "portfolio",
45
+ e
46
+ ],
47
+ holdings: ["brainyrich", "holdings"],
48
+ modelPortfolios: ["brainyrich", "model-portfolios"],
49
+ modelPortfolio: (e) => [
50
+ "brainyrich",
51
+ "model-portfolio",
52
+ e
53
+ ],
54
+ goals: ["brainyrich", "goals"],
55
+ goal: (e) => [
56
+ "brainyrich",
57
+ "goal",
58
+ e
59
+ ],
60
+ goalFundings: (e) => [
61
+ "brainyrich",
62
+ "goal-fundings",
63
+ e
64
+ ],
65
+ households: ["brainyrich", "households"],
66
+ household: (e) => [
67
+ "brainyrich",
68
+ "household",
69
+ e
70
+ ],
71
+ insights: ["brainyrich", "insights"],
72
+ insight: (e) => [
73
+ "brainyrich",
74
+ "insight",
75
+ e
76
+ ],
77
+ transactions: ["brainyrich", "transactions"],
78
+ rebalances: ["brainyrich", "rebalance-proposals"],
79
+ health: ["brainyrich", "health"]
80
+ }, d = { limit: 100 }, f = "\n id workspaceId accountId portfolioId symbol name assetClass quantity lastPrice\n costBasis marketValue currency asOf createdAt updatedAt\n", p = "\n id workspaceId accountId holdingId type symbol quantity price amount fee currency\n tradeDate settleDate notes createdAt updatedAt\n", m = "\n id workspaceId ownerId householdId name type status institution accountMask\n cashBalance currency isManual createdAt updatedAt\n", h = "\n id workspaceId ownerId householdId name description status baseCurrency\n modelPortfolioId driftThresholdPct targetAllocation tags createdAt updatedAt\n", g = "\n id workspaceId modelPortfolioId assetClass targetPct createdAt updatedAt\n", _ = "\n id workspaceId name description riskProfile baseCurrency isActive createdAt updatedAt\n", v = "\n id workspaceId goalId accountId allocationPct fixedAmount createdAt updatedAt\n", y = "\n id workspaceId ownerId householdId name type status projection targetAmount\n targetDate monthlyContribution priority currency notes tags createdAt updatedAt\n", b = "\n id workspaceId name status riskProfile advisorId aum currency primaryContactName\n primaryContactEmail notes tags createdAt updatedAt\n", x = "\n id workspaceId ownerId type severity status title detail metrics subjectId\n subjectType acknowledgedById resolvedAt createdAt updatedAt\n", S = "\n id workspaceId portfolioId householdId status driftPct rationale trades\n proposedById approvedById executedAt createdAt updatedAt\n", ne = "\n workspaceId ownerId totalNetWorth totalMarketValue totalCash accountCount currency\n byAssetClass { assetClass marketValue }\n", re = (t) => {
81
+ let { apiGatewayUrl: n } = e();
82
+ return a({
83
+ queryKey: [...u.netWorth, t ?? "me"],
84
+ queryFn: async () => (await s(`query BraNetWorthSummary($ownerId: ID) {
85
+ braNetWorthSummary(ownerId: $ownerId) { ${ne} }
86
+ }`, { ownerId: t }, n)).braNetWorthSummary
87
+ });
88
+ }, C = (t = {}) => {
89
+ let { apiGatewayUrl: n } = e(), r = a({
90
+ queryKey: [...u.accounts, t],
91
+ queryFn: async () => (await s(`query BraListAccounts($householdId: ID, $status: BraAccountStatus, $pagination: PaginationInput) {
92
+ braListAccounts(householdId: $householdId, status: $status, pagination: $pagination) {
93
+ items { ${m} }
94
+ pageInfo { cursor hasMore }
95
+ }
96
+ }`, {
97
+ householdId: t.householdId,
98
+ status: t.status,
99
+ pagination: t.pagination ?? d
100
+ }, n)).braListAccounts
101
+ });
102
+ return {
103
+ ...r,
104
+ data: r.data?.items ?? [],
105
+ pageInfo: r.data?.pageInfo
106
+ };
107
+ }, w = (t) => {
108
+ let { apiGatewayUrl: n } = e();
109
+ return a({
110
+ queryKey: u.account(t ?? ""),
111
+ enabled: !!t,
112
+ queryFn: async () => (await s(`query BraAccount($id: ID!) {
113
+ braAccount(id: $id) {
114
+ ${m}
115
+ holdings { ${f} }
116
+ transactions { ${p} }
117
+ }
118
+ }`, { id: t }, n)).braAccount
119
+ });
120
+ }, T = () => {
121
+ let { apiGatewayUrl: t } = e(), n = o();
122
+ return i({
123
+ mutationFn: async (e) => (await c(`mutation BraCreateAccount($input: BraCreateAccountInput!) {
124
+ braCreateAccount(input: $input) { ${m} }
125
+ }`, { input: e }, t)).braCreateAccount,
126
+ ...l({
127
+ success: "Account created",
128
+ onSuccess: () => {
129
+ n.invalidateQueries({ queryKey: u.accounts }), n.invalidateQueries({ queryKey: u.netWorth });
130
+ }
131
+ })
132
+ });
133
+ }, E = () => {
134
+ let { apiGatewayUrl: t } = e(), n = o();
135
+ return i({
136
+ mutationFn: async (e) => (await c(`mutation BraUpdateAccount($id: ID!, $input: BraUpdateAccountInput!) {
137
+ braUpdateAccount(id: $id, input: $input) { ${m} }
138
+ }`, e, t)).braUpdateAccount,
139
+ ...l({
140
+ success: "Account updated",
141
+ onSuccess: (e) => {
142
+ n.invalidateQueries({ queryKey: u.accounts }), n.invalidateQueries({ queryKey: u.account(e.id) }), n.invalidateQueries({ queryKey: u.netWorth });
143
+ }
144
+ })
145
+ });
146
+ }, D = () => {
147
+ let { apiGatewayUrl: t } = e(), n = o();
148
+ return i({
149
+ mutationFn: async (e) => (await c("mutation BraArchiveAccount($id: ID!) { braArchiveAccount(id: $id) }", { id: e }, t)).braArchiveAccount,
150
+ ...l({
151
+ success: "Account archived",
152
+ onSuccess: () => {
153
+ n.invalidateQueries({ queryKey: u.accounts }), n.invalidateQueries({ queryKey: u.netWorth });
154
+ }
155
+ })
156
+ });
157
+ }, O = (t = {}) => {
158
+ let { apiGatewayUrl: n } = e(), r = a({
159
+ queryKey: [...u.portfolios, t],
160
+ queryFn: async () => (await s(`query BraListPortfolios($householdId: ID, $status: BraPortfolioStatus, $pagination: PaginationInput) {
161
+ braListPortfolios(householdId: $householdId, status: $status, pagination: $pagination) {
162
+ items { ${h} }
163
+ pageInfo { cursor hasMore }
164
+ }
165
+ }`, {
166
+ householdId: t.householdId,
167
+ status: t.status,
168
+ pagination: t.pagination ?? d
169
+ }, n)).braListPortfolios
170
+ });
171
+ return {
172
+ ...r,
173
+ data: r.data?.items ?? [],
174
+ pageInfo: r.data?.pageInfo
175
+ };
176
+ }, k = (t) => {
177
+ let { apiGatewayUrl: n } = e();
178
+ return a({
179
+ queryKey: u.portfolio(t ?? ""),
180
+ enabled: !!t,
181
+ queryFn: async () => (await s(`query BraPortfolio($id: ID!) {
182
+ braPortfolio(id: $id) {
183
+ ${h}
184
+ holdings { ${f} }
185
+ }
186
+ }`, { id: t }, n)).braPortfolio
187
+ });
188
+ }, A = () => {
189
+ let { apiGatewayUrl: t } = e(), n = o();
190
+ return i({
191
+ mutationFn: async (e) => (await c(`mutation BraCreatePortfolio($input: BraCreatePortfolioInput!) {
192
+ braCreatePortfolio(input: $input) { ${h} }
193
+ }`, { input: e }, t)).braCreatePortfolio,
194
+ ...l({
195
+ success: "Portfolio created",
196
+ onSuccess: () => n.invalidateQueries({ queryKey: u.portfolios })
197
+ })
198
+ });
199
+ }, j = () => {
200
+ let { apiGatewayUrl: t } = e(), n = o();
201
+ return i({
202
+ mutationFn: async (e) => (await c(`mutation BraUpdatePortfolio($id: ID!, $input: BraUpdatePortfolioInput!) {
203
+ braUpdatePortfolio(id: $id, input: $input) { ${h} }
204
+ }`, e, t)).braUpdatePortfolio,
205
+ ...l({
206
+ success: "Portfolio updated",
207
+ onSuccess: (e) => {
208
+ n.invalidateQueries({ queryKey: u.portfolios }), n.invalidateQueries({ queryKey: u.portfolio(e.id) });
209
+ }
210
+ })
211
+ });
212
+ }, M = () => {
213
+ let { apiGatewayUrl: t } = e(), n = o();
214
+ return i({
215
+ mutationFn: async (e) => (await c("mutation BraArchivePortfolio($id: ID!) { braArchivePortfolio(id: $id) }", { id: e }, t)).braArchivePortfolio,
216
+ ...l({
217
+ success: "Portfolio archived",
218
+ onSuccess: () => n.invalidateQueries({ queryKey: u.portfolios })
219
+ })
220
+ });
221
+ }, N = (t) => {
222
+ let { apiGatewayUrl: n } = e(), r = a({
223
+ queryKey: [...u.holdings, t],
224
+ enabled: !!(t.accountId || t.portfolioId),
225
+ queryFn: async () => (await s(`query BraListHoldings($accountId: ID, $portfolioId: ID) {
226
+ braListHoldings(accountId: $accountId, portfolioId: $portfolioId) { ${f} }
227
+ }`, {
228
+ accountId: t.accountId,
229
+ portfolioId: t.portfolioId
230
+ }, n)).braListHoldings
231
+ });
232
+ return {
233
+ ...r,
234
+ data: r.data ?? []
235
+ };
236
+ }, P = () => {
237
+ let { apiGatewayUrl: t } = e(), n = o();
238
+ return i({
239
+ mutationFn: async (e) => (await c(`mutation BraCreateHolding($input: BraCreateHoldingInput!) {
240
+ braCreateHolding(input: $input) { ${f} }
241
+ }`, { input: e }, t)).braCreateHolding,
242
+ ...l({
243
+ success: "Holding added",
244
+ onSuccess: (e) => {
245
+ n.invalidateQueries({ queryKey: u.holdings }), n.invalidateQueries({ queryKey: u.account(e.accountId) }), e.portfolioId && n.invalidateQueries({ queryKey: u.portfolio(e.portfolioId) }), n.invalidateQueries({ queryKey: u.netWorth });
246
+ }
247
+ })
248
+ });
249
+ }, F = () => {
250
+ let { apiGatewayUrl: t } = e(), n = o();
251
+ return i({
252
+ mutationFn: async (e) => (await c(`mutation BraUpdateHolding($id: ID!, $input: BraUpdateHoldingInput!) {
253
+ braUpdateHolding(id: $id, input: $input) { ${f} }
254
+ }`, e, t)).braUpdateHolding,
255
+ ...l({
256
+ success: "Holding updated",
257
+ onSuccess: (e) => {
258
+ n.invalidateQueries({ queryKey: u.holdings }), n.invalidateQueries({ queryKey: u.account(e.accountId) }), e.portfolioId && n.invalidateQueries({ queryKey: u.portfolio(e.portfolioId) }), n.invalidateQueries({ queryKey: u.netWorth });
259
+ }
260
+ })
261
+ });
262
+ }, I = () => {
263
+ let { apiGatewayUrl: t } = e(), n = o();
264
+ return i({
265
+ mutationFn: async (e) => (await c("mutation BraDeleteHolding($id: ID!) { braDeleteHolding(id: $id) }", { id: e }, t)).braDeleteHolding,
266
+ ...l({
267
+ success: "Holding removed",
268
+ onSuccess: () => {
269
+ n.invalidateQueries({ queryKey: u.holdings }), n.invalidateQueries({ queryKey: u.accounts }), n.invalidateQueries({ queryKey: u.portfolios }), n.invalidateQueries({ queryKey: u.netWorth });
270
+ }
271
+ })
272
+ });
273
+ }, L = () => {
274
+ let { apiGatewayUrl: t } = e(), n = a({
275
+ queryKey: u.modelPortfolios,
276
+ queryFn: async () => (await s(`query BraListModelPortfolios {
277
+ braListModelPortfolios {
278
+ ${_}
279
+ allocations { ${g} }
280
+ }
281
+ }`, {}, t)).braListModelPortfolios
282
+ });
283
+ return {
284
+ ...n,
285
+ data: n.data ?? []
286
+ };
287
+ }, R = (t) => {
288
+ let { apiGatewayUrl: n } = e();
289
+ return a({
290
+ queryKey: u.modelPortfolio(t ?? ""),
291
+ enabled: !!t,
292
+ queryFn: async () => (await s(`query BraModelPortfolio($id: ID!) {
293
+ braModelPortfolio(id: $id) {
294
+ ${_}
295
+ allocations { ${g} }
296
+ }
297
+ }`, { id: t }, n)).braModelPortfolio
298
+ });
299
+ }, z = () => {
300
+ let { apiGatewayUrl: t } = e(), n = o();
301
+ return i({
302
+ mutationFn: async (e) => (await c(`mutation BraCreateModelPortfolio($input: BraCreateModelPortfolioInput!) {
303
+ braCreateModelPortfolio(input: $input) {
304
+ ${_}
305
+ allocations { ${g} }
306
+ }
307
+ }`, { input: e }, t)).braCreateModelPortfolio,
308
+ ...l({
309
+ success: "Model portfolio created",
310
+ onSuccess: () => n.invalidateQueries({ queryKey: u.modelPortfolios })
311
+ })
312
+ });
313
+ }, B = (t = {}) => {
314
+ let { apiGatewayUrl: n } = e(), r = a({
315
+ queryKey: [...u.goals, t],
316
+ queryFn: async () => (await s(`query BraListGoals($householdId: ID, $status: BraGoalStatus, $pagination: PaginationInput) {
317
+ braListGoals(householdId: $householdId, status: $status, pagination: $pagination) {
318
+ items { ${y} }
319
+ pageInfo { cursor hasMore }
320
+ }
321
+ }`, {
322
+ householdId: t.householdId,
323
+ status: t.status,
324
+ pagination: t.pagination ?? d
325
+ }, n)).braListGoals
326
+ });
327
+ return {
328
+ ...r,
329
+ data: r.data?.items ?? [],
330
+ pageInfo: r.data?.pageInfo
331
+ };
332
+ }, V = (t) => {
333
+ let { apiGatewayUrl: n } = e();
334
+ return a({
335
+ queryKey: u.goal(t ?? ""),
336
+ enabled: !!t,
337
+ queryFn: async () => (await s(`query BraGoal($id: ID!) {
338
+ braGoal(id: $id) {
339
+ ${y}
340
+ fundings { ${v} }
341
+ }
342
+ }`, { id: t }, n)).braGoal
343
+ });
344
+ }, H = (t) => {
345
+ let { apiGatewayUrl: n } = e(), r = a({
346
+ queryKey: u.goalFundings(t ?? ""),
347
+ enabled: !!t,
348
+ queryFn: async () => (await s(`query BraListGoalFundings($goalId: ID!) {
349
+ braListGoalFundings(goalId: $goalId) { ${v} }
350
+ }`, { goalId: t }, n)).braListGoalFundings
351
+ });
352
+ return {
353
+ ...r,
354
+ data: r.data ?? []
355
+ };
356
+ }, U = () => {
357
+ let { apiGatewayUrl: t } = e(), n = o();
358
+ return i({
359
+ mutationFn: async (e) => (await c(`mutation BraCreateGoal($input: BraCreateGoalInput!) {
360
+ braCreateGoal(input: $input) { ${y} }
361
+ }`, { input: e }, t)).braCreateGoal,
362
+ ...l({
363
+ success: "Goal created",
364
+ onSuccess: () => n.invalidateQueries({ queryKey: u.goals })
365
+ })
366
+ });
367
+ }, W = () => {
368
+ let { apiGatewayUrl: t } = e(), n = o();
369
+ return i({
370
+ mutationFn: async (e) => (await c(`mutation BraUpdateGoal($id: ID!, $input: BraUpdateGoalInput!) {
371
+ braUpdateGoal(id: $id, input: $input) { ${y} }
372
+ }`, e, t)).braUpdateGoal,
373
+ ...l({
374
+ success: "Goal updated",
375
+ onSuccess: (e) => {
376
+ n.invalidateQueries({ queryKey: u.goals }), n.invalidateQueries({ queryKey: u.goal(e.id) });
377
+ }
378
+ })
379
+ });
380
+ }, G = () => {
381
+ let { apiGatewayUrl: t } = e(), n = o();
382
+ return i({
383
+ mutationFn: async (e) => (await c("mutation BraArchiveGoal($id: ID!) { braArchiveGoal(id: $id) }", { id: e }, t)).braArchiveGoal,
384
+ ...l({
385
+ success: "Goal archived",
386
+ onSuccess: () => n.invalidateQueries({ queryKey: u.goals })
387
+ })
388
+ });
389
+ }, K = () => {
390
+ let { apiGatewayUrl: t } = e(), n = o();
391
+ return i({
392
+ mutationFn: async (e) => (await c(`mutation BraRecalcGoalProjection($id: ID!, $fundedAmount: Float!) {
393
+ braRecalcGoalProjection(id: $id, fundedAmount: $fundedAmount) { ${y} }
394
+ }`, e, t)).braRecalcGoalProjection,
395
+ ...l({
396
+ success: "Projection recalculated",
397
+ onSuccess: (e) => {
398
+ n.invalidateQueries({ queryKey: u.goals }), n.invalidateQueries({ queryKey: u.goal(e.id) });
399
+ }
400
+ })
401
+ });
402
+ }, ie = () => {
403
+ let { apiGatewayUrl: t } = e(), n = o();
404
+ return i({
405
+ mutationFn: async (e) => (await c(`mutation BraLinkGoalFunding($input: BraLinkGoalFundingInput!) {
406
+ braLinkGoalFunding(input: $input) { ${v} }
407
+ }`, { input: e }, t)).braLinkGoalFunding,
408
+ ...l({
409
+ success: "Funding linked",
410
+ onSuccess: (e) => {
411
+ n.invalidateQueries({ queryKey: u.goalFundings(e.goalId) }), n.invalidateQueries({ queryKey: u.goal(e.goalId) });
412
+ }
413
+ })
414
+ });
415
+ }, q = () => {
416
+ let { apiGatewayUrl: t } = e(), n = o();
417
+ return i({
418
+ mutationFn: async (e) => (await c("mutation BraUnlinkGoalFunding($id: ID!) { braUnlinkGoalFunding(id: $id) }", { id: e }, t)).braUnlinkGoalFunding,
419
+ ...l({
420
+ success: "Funding unlinked",
421
+ onSuccess: () => {
422
+ n.invalidateQueries({ queryKey: u.goals }), n.invalidateQueries({ queryKey: [...u.goals] }), n.invalidateQueries({ queryKey: ["brainyrich", "goal-fundings"] }), n.invalidateQueries({ queryKey: ["brainyrich", "goal"] });
423
+ }
424
+ })
425
+ });
426
+ }, J = (t = {}) => {
427
+ let { apiGatewayUrl: n } = e(), r = a({
428
+ queryKey: [...u.households, t],
429
+ queryFn: async () => (await s(`query BraListHouseholds($status: BraHouseholdStatus, $pagination: PaginationInput) {
430
+ braListHouseholds(status: $status, pagination: $pagination) {
431
+ items { ${b} }
432
+ pageInfo { cursor hasMore }
433
+ }
434
+ }`, {
435
+ status: t.status,
436
+ pagination: t.pagination ?? d
437
+ }, n)).braListHouseholds
438
+ });
439
+ return {
440
+ ...r,
441
+ data: r.data?.items ?? [],
442
+ pageInfo: r.data?.pageInfo
443
+ };
444
+ }, Y = (t) => {
445
+ let { apiGatewayUrl: n } = e();
446
+ return a({
447
+ queryKey: u.household(t ?? ""),
448
+ enabled: !!t,
449
+ queryFn: async () => (await s(`query BraHousehold($id: ID!) {
450
+ braHousehold(id: $id) { ${b} }
451
+ }`, { id: t }, n)).braHousehold
452
+ });
453
+ }, ae = () => {
454
+ let { apiGatewayUrl: t } = e(), n = o();
455
+ return i({
456
+ mutationFn: async (e) => (await c(`mutation BraCreateHousehold($input: BraCreateHouseholdInput!) {
457
+ braCreateHousehold(input: $input) { ${b} }
458
+ }`, { input: e }, t)).braCreateHousehold,
459
+ ...l({
460
+ success: "Household created",
461
+ onSuccess: () => n.invalidateQueries({ queryKey: u.households })
462
+ })
463
+ });
464
+ }, oe = () => {
465
+ let { apiGatewayUrl: t } = e(), n = o();
466
+ return i({
467
+ mutationFn: async (e) => (await c(`mutation BraUpdateHousehold($id: ID!, $input: BraUpdateHouseholdInput!) {
468
+ braUpdateHousehold(id: $id, input: $input) { ${b} }
469
+ }`, e, t)).braUpdateHousehold,
470
+ ...l({
471
+ success: "Household updated",
472
+ onSuccess: (e) => {
473
+ n.invalidateQueries({ queryKey: u.households }), n.invalidateQueries({ queryKey: u.household(e.id) });
474
+ }
475
+ })
476
+ });
477
+ }, se = () => {
478
+ let { apiGatewayUrl: t } = e(), n = o();
479
+ return i({
480
+ mutationFn: async (e) => (await c("mutation BraArchiveHousehold($id: ID!) { braArchiveHousehold(id: $id) }", { id: e }, t)).braArchiveHousehold,
481
+ ...l({
482
+ success: "Household archived",
483
+ onSuccess: () => n.invalidateQueries({ queryKey: u.households })
484
+ })
485
+ });
486
+ }, ce = (t = {}) => {
487
+ let { apiGatewayUrl: n } = e(), r = a({
488
+ queryKey: [...u.insights, t],
489
+ queryFn: async () => (await s(`query BraListInsights($severity: BraInsightSeverity, $status: BraInsightStatus, $subjectId: ID, $subjectType: String, $pagination: PaginationInput) {
490
+ braListInsights(severity: $severity, status: $status, subjectId: $subjectId, subjectType: $subjectType, pagination: $pagination) {
491
+ items { ${x} }
492
+ pageInfo { cursor hasMore }
493
+ }
494
+ }`, {
495
+ severity: t.severity,
496
+ status: t.status,
497
+ subjectId: t.subjectId,
498
+ subjectType: t.subjectType,
499
+ pagination: t.pagination ?? d
500
+ }, n)).braListInsights
501
+ });
502
+ return {
503
+ ...r,
504
+ data: r.data?.items ?? [],
505
+ pageInfo: r.data?.pageInfo
506
+ };
507
+ }, le = () => {
508
+ let { apiGatewayUrl: t } = e(), n = o();
509
+ return i({
510
+ mutationFn: async (e) => (await c(`mutation BraCreateInsight($input: BraCreateInsightInput!) {
511
+ braCreateInsight(input: $input) { ${x} }
512
+ }`, { input: e }, t)).braCreateInsight,
513
+ ...l({
514
+ success: "Insight created",
515
+ onSuccess: () => n.invalidateQueries({ queryKey: u.insights })
516
+ })
517
+ });
518
+ }, ue = () => {
519
+ let { apiGatewayUrl: t } = e(), n = o();
520
+ return i({
521
+ mutationFn: async (e) => (await c(`mutation BraAcknowledgeInsight($id: ID!) {
522
+ braAcknowledgeInsight(id: $id) { ${x} }
523
+ }`, { id: e }, t)).braAcknowledgeInsight,
524
+ ...l({
525
+ success: "Insight acknowledged",
526
+ onSuccess: (e) => {
527
+ n.invalidateQueries({ queryKey: u.insights }), n.invalidateQueries({ queryKey: u.insight(e.id) });
528
+ }
529
+ })
530
+ });
531
+ }, de = () => {
532
+ let { apiGatewayUrl: t } = e(), n = o();
533
+ return i({
534
+ mutationFn: async (e) => (await c(`mutation BraDismissInsight($id: ID!) {
535
+ braDismissInsight(id: $id) { ${x} }
536
+ }`, { id: e }, t)).braDismissInsight,
537
+ ...l({
538
+ success: "Insight dismissed",
539
+ onSuccess: (e) => {
540
+ n.invalidateQueries({ queryKey: u.insights }), n.invalidateQueries({ queryKey: u.insight(e.id) });
541
+ }
542
+ })
543
+ });
544
+ }, fe = () => {
545
+ let { apiGatewayUrl: t } = e(), n = o();
546
+ return i({
547
+ mutationFn: async (e) => (await c(`mutation BraResolveInsight($id: ID!) {
548
+ braResolveInsight(id: $id) { ${x} }
549
+ }`, { id: e }, t)).braResolveInsight,
550
+ ...l({
551
+ success: "Insight resolved",
552
+ onSuccess: (e) => {
553
+ n.invalidateQueries({ queryKey: u.insights }), n.invalidateQueries({ queryKey: u.insight(e.id) });
554
+ }
555
+ })
556
+ });
557
+ }, pe = () => {
558
+ let { apiGatewayUrl: t } = e(), n = o();
559
+ return i({
560
+ mutationFn: async (e) => (await c(`mutation BraRecordTransaction($input: BraCreateTransactionInput!) {
561
+ braRecordTransaction(input: $input) { ${p} }
562
+ }`, { input: e }, t)).braRecordTransaction,
563
+ ...l({
564
+ success: "Transaction recorded",
565
+ onSuccess: (e) => {
566
+ n.invalidateQueries({ queryKey: u.transactions }), n.invalidateQueries({ queryKey: u.account(e.accountId) }), n.invalidateQueries({ queryKey: u.netWorth });
567
+ }
568
+ })
569
+ });
570
+ }, me = (t = {}) => {
571
+ let { apiGatewayUrl: n } = e(), r = a({
572
+ queryKey: [...u.rebalances, t],
573
+ queryFn: async () => (await s(`query BraListRebalanceProposals($householdId: ID, $portfolioId: ID, $status: BraRebalanceStatus) {
574
+ braListRebalanceProposals(householdId: $householdId, portfolioId: $portfolioId, status: $status) {
575
+ ${S}
576
+ }
577
+ }`, {
578
+ householdId: t.householdId,
579
+ portfolioId: t.portfolioId,
580
+ status: t.status
581
+ }, n)).braListRebalanceProposals
582
+ });
583
+ return {
584
+ ...r,
585
+ data: r.data ?? []
586
+ };
587
+ }, he = () => {
588
+ let { apiGatewayUrl: t } = e(), n = o();
589
+ return i({
590
+ mutationFn: async (e) => (await c(`mutation BraCreateRebalanceProposal($input: BraCreateRebalanceProposalInput!) {
591
+ braCreateRebalanceProposal(input: $input) { ${S} }
592
+ }`, { input: e }, t)).braCreateRebalanceProposal,
593
+ ...l({
594
+ success: "Rebalance proposal created",
595
+ onSuccess: () => n.invalidateQueries({ queryKey: u.rebalances })
596
+ })
597
+ });
598
+ }, ge = () => {
599
+ let { apiGatewayUrl: t } = e(), n = o();
600
+ return i({
601
+ mutationFn: async (e) => (await c(`mutation BraTransitionRebalanceProposal($id: ID!, $status: BraRebalanceStatus!) {
602
+ braTransitionRebalanceProposal(id: $id, status: $status) { ${S} }
603
+ }`, e, t)).braTransitionRebalanceProposal,
604
+ ...l({
605
+ success: (e) => `Rebalance ${e.status.toLowerCase()}`,
606
+ onSuccess: () => n.invalidateQueries({ queryKey: u.rebalances })
607
+ })
608
+ });
609
+ };
610
+ function X(t) {
611
+ let { apiGatewayUrl: n } = e(), i = t.pageSize ?? d.limit ?? 100, a = r({
612
+ queryKey: t.queryKey,
613
+ enabled: t.enabled ?? !0,
614
+ initialPageParam: null,
615
+ queryFn: async ({ pageParam: e }) => {
616
+ let r = e ? {
617
+ limit: i,
618
+ cursor: e
619
+ } : { limit: i }, a = await s(t.query, t.buildVariables(r), n);
620
+ return t.select(a);
621
+ },
622
+ getNextPageParam: (e) => e.pageInfo.hasMore && e.pageInfo.cursor ? e.pageInfo.cursor : void 0
623
+ });
624
+ return {
625
+ items: (a.data?.pages ?? []).flatMap((e) => e.items),
626
+ hasMore: !!a.hasNextPage,
627
+ loadMore: () => {
628
+ a.fetchNextPage();
629
+ },
630
+ isLoading: a.isLoading,
631
+ isFetchingNextPage: a.isFetchingNextPage,
632
+ isError: a.isError,
633
+ refetch: () => {
634
+ a.refetch();
635
+ }
636
+ };
637
+ }
638
+ var _e = (e = {}) => X({
639
+ queryKey: [
640
+ ...u.accounts,
641
+ "paged",
642
+ e
643
+ ],
644
+ query: `query BraListAccounts($householdId: ID, $status: BraAccountStatus, $pagination: PaginationInput) {
645
+ braListAccounts(householdId: $householdId, status: $status, pagination: $pagination) {
646
+ items { ${m} }
647
+ pageInfo { cursor hasMore }
648
+ }
649
+ }`,
650
+ buildVariables: (t) => ({
651
+ householdId: e.householdId,
652
+ status: e.status,
653
+ pagination: t
654
+ }),
655
+ select: (e) => e.braListAccounts
656
+ }), ve = (e = {}) => X({
657
+ queryKey: [
658
+ ...u.portfolios,
659
+ "paged",
660
+ e
661
+ ],
662
+ query: `query BraListPortfolios($householdId: ID, $status: BraPortfolioStatus, $pagination: PaginationInput) {
663
+ braListPortfolios(householdId: $householdId, status: $status, pagination: $pagination) {
664
+ items { ${h} }
665
+ pageInfo { cursor hasMore }
666
+ }
667
+ }`,
668
+ buildVariables: (t) => ({
669
+ householdId: e.householdId,
670
+ status: e.status,
671
+ pagination: t
672
+ }),
673
+ select: (e) => e.braListPortfolios
674
+ }), Z = (e = {}) => X({
675
+ queryKey: [
676
+ ...u.goals,
677
+ "paged",
678
+ e
679
+ ],
680
+ query: `query BraListGoals($householdId: ID, $status: BraGoalStatus, $pagination: PaginationInput) {
681
+ braListGoals(householdId: $householdId, status: $status, pagination: $pagination) {
682
+ items { ${y} }
683
+ pageInfo { cursor hasMore }
684
+ }
685
+ }`,
686
+ buildVariables: (t) => ({
687
+ householdId: e.householdId,
688
+ status: e.status,
689
+ pagination: t
690
+ }),
691
+ select: (e) => e.braListGoals
692
+ }), ye = (e = {}) => X({
693
+ queryKey: [
694
+ ...u.households,
695
+ "paged",
696
+ e
697
+ ],
698
+ query: `query BraListHouseholds($status: BraHouseholdStatus, $pagination: PaginationInput) {
699
+ braListHouseholds(status: $status, pagination: $pagination) {
700
+ items { ${b} }
701
+ pageInfo { cursor hasMore }
702
+ }
703
+ }`,
704
+ buildVariables: (t) => ({
705
+ status: e.status,
706
+ pagination: t
707
+ }),
708
+ select: (e) => e.braListHouseholds
709
+ }), be = (e = {}) => X({
710
+ queryKey: [
711
+ ...u.insights,
712
+ "paged",
713
+ e
714
+ ],
715
+ query: `query BraListInsights($severity: BraInsightSeverity, $status: BraInsightStatus, $subjectId: ID, $subjectType: String, $pagination: PaginationInput) {
716
+ braListInsights(severity: $severity, status: $status, subjectId: $subjectId, subjectType: $subjectType, pagination: $pagination) {
717
+ items { ${x} }
718
+ pageInfo { cursor hasMore }
719
+ }
720
+ }`,
721
+ buildVariables: (t) => ({
722
+ severity: e.severity,
723
+ status: e.status,
724
+ subjectId: e.subjectId,
725
+ subjectType: e.subjectType,
726
+ pagination: t
727
+ }),
728
+ select: (e) => e.braListInsights
729
+ }), xe = (e = {}) => X({
730
+ queryKey: [
731
+ ...u.transactions,
732
+ "paged",
733
+ e
734
+ ],
735
+ query: `query BraListTransactions($accountId: ID, $type: BraTransactionType, $pagination: PaginationInput) {
736
+ braListTransactions(accountId: $accountId, type: $type, pagination: $pagination) {
737
+ items { ${p} }
738
+ pageInfo { cursor hasMore }
739
+ }
740
+ }`,
741
+ buildVariables: (t) => ({
742
+ accountId: e.accountId,
743
+ type: e.type,
744
+ pagination: t
745
+ }),
746
+ select: (e) => e.braListTransactions
747
+ });
748
+ async function Q(e, t = 200, n = 500) {
749
+ let r = [], i;
750
+ for (let a = 0; a < n; a++) {
751
+ let n = await e(i ? {
752
+ limit: t,
753
+ cursor: i
754
+ } : { limit: t });
755
+ if (r.push(...n.items), !n.pageInfo.hasMore || !n.pageInfo.cursor) break;
756
+ i = n.pageInfo.cursor;
757
+ }
758
+ return r;
759
+ }
760
+ async function Se(e, t = {}, n = 200) {
761
+ return Q(async (n) => (await s(`query BraListTransactions($accountId: ID, $type: BraTransactionType, $pagination: PaginationInput) {
762
+ braListTransactions(accountId: $accountId, type: $type, pagination: $pagination) {
763
+ items { ${p} }
764
+ pageInfo { cursor hasMore }
765
+ }
766
+ }`, {
767
+ accountId: t.accountId,
768
+ type: t.type,
769
+ pagination: n
770
+ }, e)).braListTransactions, n);
771
+ }
772
+ var Ce = (t = {}) => {
773
+ let { apiGatewayUrl: n } = e(), r = a({
774
+ queryKey: [
775
+ ...u.transactions,
776
+ "all",
777
+ t
778
+ ],
779
+ queryFn: () => Se(n, t)
780
+ });
781
+ return {
782
+ ...r,
783
+ data: r.data ?? []
784
+ };
785
+ };
786
+ async function $(e, t = {}, n = 200) {
787
+ return Q(async (n) => (await s(`query BraListAccounts($householdId: ID, $status: BraAccountStatus, $pagination: PaginationInput) {
788
+ braListAccounts(householdId: $householdId, status: $status, pagination: $pagination) {
789
+ items { ${m} }
790
+ pageInfo { cursor hasMore }
791
+ }
792
+ }`, {
793
+ householdId: t.householdId,
794
+ status: t.status,
795
+ pagination: n
796
+ }, e)).braListAccounts, n);
797
+ }
798
+ var we = (t = {}) => {
799
+ let { apiGatewayUrl: n } = e(), r = a({
800
+ queryKey: [
801
+ ...u.accounts,
802
+ "all",
803
+ t
804
+ ],
805
+ queryFn: () => $(n, t)
806
+ });
807
+ return {
808
+ ...r,
809
+ data: r.data ?? []
810
+ };
811
+ };
812
+ //#endregion
813
+ export { $ as fetchAllAccounts, w as useAccount, C as useAccounts, ue as useAcknowledgeInsight, we as useAllAccounts, Ce as useAllTransactions, D as useArchiveAccount, G as useArchiveGoal, se as useArchiveHousehold, M as useArchivePortfolio, T as useCreateAccount, U as useCreateGoal, P as useCreateHolding, ae as useCreateHousehold, le as useCreateInsight, z as useCreateModelPortfolio, A as useCreatePortfolio, he as useCreateRebalanceProposal, I as useDeleteHolding, de as useDismissInsight, V as useGoal, H as useGoalFundings, B as useGoals, N as useHoldings, Y as useHousehold, J as useHouseholds, ce as useInsights, ie as useLinkGoalFunding, R as useModelPortfolio, L as useModelPortfolios, re as useNetWorthSummary, _e as usePagedAccounts, Z as usePagedGoals, ye as usePagedHouseholds, be as usePagedInsights, ve as usePagedPortfolios, xe as usePagedTransactions, k as usePortfolio, O as usePortfolios, me as useRebalanceProposals, K as useRecalcGoalProjection, pe as useRecordTransaction, fe as useResolveInsight, ge as useTransitionRebalanceProposal, q as useUnlinkGoalFunding, E as useUpdateAccount, W as useUpdateGoal, F as useUpdateHolding, oe as useUpdateHousehold, j as useUpdatePortfolio };
814
+
815
+ //# sourceMappingURL=useBrainyRichApi.js.map