@mx-cartographer/experiences 6.26.32 → 7.0.0-alpha.mega1

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 (98) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Account-DY6nxO7y.mjs +30 -0
  3. package/dist/AccountDetailsContent-DvPs81kL.mjs +677 -0
  4. package/dist/AccountDetailsHeader-W2U7ZVm_.mjs +119 -0
  5. package/dist/AccountFields-DAVcbZy5.mjs +135 -0
  6. package/dist/AccountListItem-DFlbdcmT.mjs +90 -0
  7. package/dist/AccountStore-CU7qV3vg.mjs +230 -0
  8. package/dist/Accounts-BLlrQA5m.mjs +9 -0
  9. package/dist/BeatApi-DLu87ijw.mjs +21 -0
  10. package/dist/BeatStore-By4aGoRM.mjs +81 -0
  11. package/dist/BudgetUtil-Ci1TN0J5.mjs +101 -0
  12. package/dist/CashflowStore-D9Dpuz7X.mjs +91 -0
  13. package/dist/Category-5S6uwuXz.mjs +301 -0
  14. package/dist/CategorySelectorDrawer-rHyHHYuh.mjs +397 -0
  15. package/dist/CategoryStore-B5EW6I1d.mjs +183 -0
  16. package/dist/CategoryUtil-DRyruNgi.mjs +78 -0
  17. package/dist/ConnectDrawer-D9cR5phc.mjs +508 -0
  18. package/dist/ConnectionsDrawer-BzGqljSp.mjs +52 -0
  19. package/dist/CurrencyInput-D74cemI2.mjs +83 -0
  20. package/dist/CurrencyText-YUhH2caW.mjs +20 -0
  21. package/dist/DateUtil-BcuH7ErC.mjs +48 -0
  22. package/dist/DebtsStore-S0l9kr0r.mjs +60 -0
  23. package/dist/Dialog-CWW597AF.mjs +123 -0
  24. package/dist/Donut-1UMNcG67.mjs +57 -0
  25. package/dist/Drawer-kEE73B87.mjs +113 -0
  26. package/dist/EmptyState-Dcb-o2tl.mjs +55 -0
  27. package/dist/Fetch-CkFKy79O.mjs +116 -0
  28. package/dist/FinstrongStore-mkALvztw.mjs +101 -0
  29. package/dist/GoalStore-DioeeL-s.mjs +263 -0
  30. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  31. package/dist/Help-DhcC-C05.mjs +320 -0
  32. package/dist/Help-DpYRO8oA.mjs +3181 -0
  33. package/dist/IconBacking-B9oC6uL2.mjs +39 -0
  34. package/dist/InvestmentUtil-jOyOgzIB.mjs +134 -0
  35. package/dist/LineChart-CcyX38kK.mjs +499 -0
  36. package/dist/ListItemAction-BabpYivr.mjs +69 -0
  37. package/dist/Loader-Dp1P2gNw.mjs +14 -0
  38. package/dist/Localization-2MODESHW.mjs +30 -0
  39. package/dist/ManageIncome-ndMuhJMG.mjs +535 -0
  40. package/dist/MerchantStore-DVH-QOf0.mjs +37 -0
  41. package/dist/MicroWidgetContainer-CsvHLYKX.mjs +45 -0
  42. package/dist/MiniWidgetContainer-BoOp-A05.mjs +39 -0
  43. package/dist/NetWorthStore-PD-RUe09.mjs +150 -0
  44. package/dist/Notification-AMGWM1Al.mjs +78 -0
  45. package/dist/NotificationSettings-VhHuMAFU.mjs +667 -0
  46. package/dist/NotificationStore-DHtSGySy.mjs +67 -0
  47. package/dist/NumberFormatting-CtWHhyBX.mjs +40 -0
  48. package/dist/OriginalBalanceAction-D39mx6uE.mjs +115 -0
  49. package/dist/RecurringSettings-D_HnMYZP.mjs +57 -0
  50. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +263 -0
  51. package/dist/RepeatingTransaction-BPWfaB3f.mjs +282 -0
  52. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  53. package/dist/SettingsStore-CE7jDVFL.mjs +265 -0
  54. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +69 -0
  55. package/dist/SpendingData-BkrxzHdr.mjs +55 -0
  56. package/dist/StatusBar-BK_uYHAB.mjs +30 -0
  57. package/dist/TabContentContainer-j01JYR_7.mjs +21 -0
  58. package/dist/Transaction-CA0FW2Ij.mjs +312 -0
  59. package/dist/TransactionApi-DbbcjI2L.mjs +86 -0
  60. package/dist/TransactionDetails-WBHFmbxL.mjs +1283 -0
  61. package/dist/TransactionStore-CeLdmVnC.mjs +669 -0
  62. package/dist/TrendsStore-BHJUapXF.mjs +487 -0
  63. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +1959 -0
  64. package/dist/WidgetContainer-DWCusxYI.mjs +556 -0
  65. package/dist/accounts/index.es.js +752 -0
  66. package/dist/analytics/index.es.js +171 -0
  67. package/dist/budgets/index.es.js +1075 -0
  68. package/dist/cashflow/index.es.js +1098 -0
  69. package/dist/categories/index.es.js +9 -0
  70. package/dist/common/context/hooks.d.ts +13 -13
  71. package/dist/common/index.es.js +1451 -0
  72. package/dist/dashboard/index.es.js +181 -0
  73. package/dist/debts/index.es.js +1460 -0
  74. package/dist/exportTransactionsToCSV-CmwsKl2D.mjs +47 -0
  75. package/dist/finstrong/index.es.js +1455 -0
  76. package/dist/goals/index.es.js +1209 -0
  77. package/dist/help/components/content/section/index.d.ts +15 -15
  78. package/dist/help/index.es.js +14 -0
  79. package/dist/hooks-30y_BLwc.mjs +71 -0
  80. package/dist/index.d.ts +0 -22
  81. package/dist/insights/index.d.ts +1 -0
  82. package/dist/insights/index.es.js +4 -0
  83. package/dist/investments/index.es.js +1638 -0
  84. package/dist/merchants/index.es.js +79 -0
  85. package/dist/microinsights/index.es.js +16 -0
  86. package/dist/networth/index.es.js +576 -0
  87. package/dist/notifications/index.es.js +192 -0
  88. package/dist/recurringtransactions/index.es.js +879 -0
  89. package/dist/settings/index.es.js +879 -0
  90. package/dist/spending/index.es.js +570 -0
  91. package/dist/transactions/index.es.js +587 -0
  92. package/dist/trends/index.es.js +1086 -0
  93. package/dist/useCombineEvents-DaDBSR_1.mjs +92 -0
  94. package/dist/useDimensions-27p2evRx.mjs +36 -0
  95. package/dist/useScreenSize-B6JyS_Lj.mjs +36 -0
  96. package/package.json +155 -3
  97. package/dist/index.es.js +0 -30508
  98. package/dist/index.es.js.map +0 -1
@@ -0,0 +1,570 @@
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import p from "react";
3
+ import { observer as x } from "mobx-react-lite";
4
+ import { startOfMonth as nt } from "date-fns/startOfMonth";
5
+ import { endOfMonth as ot } from "date-fns/endOfMonth";
6
+ import D from "@mui/material/Box";
7
+ import C from "@mui/material/Stack";
8
+ import N from "@mui/material/Tab";
9
+ import at from "@mui/material/Tabs";
10
+ import mt from "@mui/material/styles/useTheme";
11
+ import { b as V } from "../CategoryUtil-DRyruNgi.mjs";
12
+ import { c as b } from "../Category-5S6uwuXz.mjs";
13
+ import { Text as f, CategoryIcon as ht, CategoryIconVariants as ft } from "@mxenabled/mxui";
14
+ import { f as A } from "../NumberFormatting-CtWHhyBX.mjs";
15
+ import yt from "@mui/material/Button";
16
+ import { useTheme as it } from "@mui/material";
17
+ import { u as w, a as R, k as z, c as rt, j as st, n as Ct, g as _t } from "../hooks-30y_BLwc.mjs";
18
+ import { u as ct } from "../useScreenSize-B6JyS_Lj.mjs";
19
+ import { D as bt } from "../Donut-1UMNcG67.mjs";
20
+ import { L as F } from "../Loader-Dp1P2gNw.mjs";
21
+ import { M as St } from "../MiniWidgetContainer-BoOp-A05.mjs";
22
+ import { startOfToday as U } from "date-fns/startOfToday";
23
+ import { T as Tt, a as Mt } from "../TransactionDetails-WBHFmbxL.mjs";
24
+ import Dt from "@mui/material/Collapse";
25
+ import j from "@mui/material/Divider";
26
+ import q from "@mui/material/List";
27
+ import J from "@mui/material/ListItem";
28
+ import xt from "@mui/material/ListItemButton";
29
+ import { D as Q } from "../Drawer-kEE73B87.mjs";
30
+ import { A as Z, W as wt } from "../WidgetContainer-DWCusxYI.mjs";
31
+ const B = 5, vt = (n, l, r) => r.reduce((i, c) => {
32
+ if (c.total > 0) {
33
+ const a = n.find((s) => s.guid === c.category_guid);
34
+ if (!a) return i;
35
+ const o = a.parent_guid ?? a.guid, e = n.find((s) => s.guid === o);
36
+ if (!e) return i;
37
+ const d = {
38
+ guid: a.guid,
39
+ name: a.guid === o ? `General ${a.name}` : a.name,
40
+ color: V(e.guid, l),
41
+ amount: c.total
42
+ }, u = i.find((s) => s.guid === o);
43
+ u ? (u.amount += c.total, u.categoryTotals?.push(d)) : i.push({
44
+ guid: o,
45
+ name: e.name,
46
+ color: V(e.guid, l),
47
+ categoryTotals: [d],
48
+ amount: c.total
49
+ });
50
+ }
51
+ return i;
52
+ }, []), lt = (n, l, r, i) => {
53
+ const c = vt(n, r, i), a = c.filter(
54
+ (s) => s.guid !== b.INCOME && s.guid !== b.INVESTMENTS && s.guid !== b.TRANSFER
55
+ ).sort((s, g) => g.amount - s.amount), o = a.reduce(
56
+ (s, g) => s + g.amount,
57
+ 0
58
+ ), e = a.length > B ? B : a.length, d = a.slice(0, e), u = d.map((s) => ({
59
+ id: s.guid,
60
+ color: V(s.guid, r),
61
+ label: s.name,
62
+ value: s.amount / o * 100
63
+ }));
64
+ if (a.length > 5) {
65
+ const s = a.slice(B, c.length), g = s.reduce(
66
+ (S, _) => S + _.amount,
67
+ 0
68
+ );
69
+ d.push({
70
+ guid: "other",
71
+ color: r.palette.categories.others || "",
72
+ name: l.saving_goal_other,
73
+ categoryTotals: s,
74
+ amount: g
75
+ }), u.push({
76
+ id: "other",
77
+ color: r.palette.categories.others || "",
78
+ label: l.saving_goal_other,
79
+ value: g / o * 100
80
+ });
81
+ }
82
+ return {
83
+ categoryData: d,
84
+ donutData: u,
85
+ totalAmount: o
86
+ };
87
+ }, dt = (n, l, r) => {
88
+ const i = n.filter(
89
+ (e) => e.guid === b.INCOME || e.parent_guid === b.INCOME
90
+ ), c = l.filter((e) => i.some((d) => d.guid === e.category_guid)).sort((e, d) => e.total - d.total).map((e, d) => ({
91
+ guid: e.category_guid,
92
+ name: n.find((u) => u.guid === e.category_guid)?.name,
93
+ color: r[d],
94
+ categoryTotals: [],
95
+ amount: Math.abs(e.total)
96
+ })), a = c.reduce(
97
+ (e, d) => e + d.amount,
98
+ 0
99
+ ), o = c.map((e) => ({
100
+ id: e.guid,
101
+ color: e.color,
102
+ label: e.name,
103
+ value: e.amount / a * 100
104
+ }));
105
+ return {
106
+ categoryData: c,
107
+ donutData: o,
108
+ totalAmount: a
109
+ };
110
+ }, W = ({ amount: n, label: l }) => /* @__PURE__ */ m(C, { direction: "column", children: [
111
+ /* @__PURE__ */ t(f, { bold: !0, sx: { textTransform: "none" }, variant: "Body", children: l }),
112
+ /* @__PURE__ */ t(f, { variant: "XSmall", children: A(n, "0,0") })
113
+ ] }), At = ({
114
+ data: n,
115
+ isIncome: l = !1,
116
+ onSelected: r,
117
+ onViewTransactions: i,
118
+ selectedId: c,
119
+ size: a = 150,
120
+ totalLabel: o,
121
+ variant: e = "mini"
122
+ }) => {
123
+ const { spending: d } = w(), u = it(), { isTablet: s } = ct(), g = p.useMemo(
124
+ () => c ? n.categoryData.find((v) => v.guid === c) : void 0,
125
+ [c]
126
+ ), S = p.useMemo(() => n.donutData.length > 0 ? n.donutData : [{ id: "0", color: u.palette.divider, value: 100 }], [n, u]), _ = () => {
127
+ i?.(c);
128
+ }, y = s ? 32 : 48;
129
+ return /* @__PURE__ */ t(bt, { data: S, onClick: r, selectedId: c, size: a, children: /* @__PURE__ */ t(C, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ m(C, { alignItems: "center", justifyContent: "center", minHeight: a, minWidth: a, children: [
130
+ g && /* @__PURE__ */ m(
131
+ C,
132
+ {
133
+ alignItems: "center",
134
+ gap: e === "mini" ? 0 : 8,
135
+ mb: e === "mini" ? 0 : 8,
136
+ mt: e === "mini" ? 0 : -16,
137
+ sx: e === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
138
+ children: [
139
+ /* @__PURE__ */ t(
140
+ ht,
141
+ {
142
+ categoryGuid: l ? b.INCOME : g.guid,
143
+ size: e === "mini" ? 24 : y,
144
+ variant: ft.Transparent
145
+ }
146
+ ),
147
+ /* @__PURE__ */ t(f, { color: "secondary", noWrap: !0, variant: e === "mini" ? "Tiny" : "Body", children: g ? g.name : o })
148
+ ]
149
+ }
150
+ ),
151
+ !g && e === "full" && /* @__PURE__ */ t(f, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: o }),
152
+ /* @__PURE__ */ t(f, { variant: e === "mini" ? "H2" : "H1", children: g ? A(g.amount, "0,0") : A(n.totalAmount, "0,0") }),
153
+ !g && e === "mini" && /* @__PURE__ */ t(f, { color: "secondary", noWrap: !0, variant: "Tiny", children: o }),
154
+ e === "full" && /* @__PURE__ */ t(
155
+ yt,
156
+ {
157
+ "aria-label": `View ${g?.name || ""} Transactions`,
158
+ disabled: n.categoryData.length === 0,
159
+ onClick: _,
160
+ sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
161
+ variant: "text",
162
+ children: d.view_transactions
163
+ }
164
+ )
165
+ ] }) }) });
166
+ }, O = x(At), tt = ({ data: n, onSelected: l, selectedId: r }) => /* @__PURE__ */ t(C, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: n.categoryData.map((i) => /* @__PURE__ */ m(
167
+ C,
168
+ {
169
+ alignItems: "center",
170
+ "aria-label": i.name,
171
+ "aria-selected": i.guid === r,
172
+ direction: "row",
173
+ gap: 8,
174
+ onClick: () => l(i.guid),
175
+ role: "button",
176
+ sx: { cursor: "pointer" },
177
+ children: [
178
+ /* @__PURE__ */ t(D, { borderRadius: 4, height: 8, sx: { backgroundColor: i.color }, width: 8 }),
179
+ /* @__PURE__ */ t(f, { bold: i.guid === r, variant: "XSmall", children: i.name })
180
+ ]
181
+ },
182
+ i.guid
183
+ )) }), Et = () => {
184
+ const n = mt(), { goals: l, spending: r } = w(), { selectedAccounts: i } = R(), {
185
+ categories: c,
186
+ dateRangeCategoryTotals: a,
187
+ dataRangeTotalsLoaded: o,
188
+ loadDateRangeCategoryTotals: e
189
+ } = z(), d = p.useMemo(
190
+ () => [
191
+ n.palette.chartMono.chartMono5,
192
+ n.palette.chartMono.chartMono4,
193
+ n.palette.chartMono.chartMono3,
194
+ n.palette.chartMono.chartMono2,
195
+ n.palette.chartMono.chartMono1,
196
+ n.palette.chartMono.chartMono6
197
+ ],
198
+ [n]
199
+ );
200
+ p.useEffect(() => {
201
+ e(
202
+ i,
203
+ nt(/* @__PURE__ */ new Date()),
204
+ ot(/* @__PURE__ */ new Date())
205
+ ).finally();
206
+ }, [i]);
207
+ const [u, s] = p.useState(""), [g, S] = p.useState(0), _ = p.useMemo(
208
+ () => lt(c, l, n, a),
209
+ [c, a]
210
+ ), y = p.useMemo(
211
+ () => dt(c, a, d),
212
+ [c, a, d]
213
+ ), v = (E, L) => {
214
+ S(L), s("");
215
+ }, M = (E) => {
216
+ s(u === E ? "" : E);
217
+ };
218
+ return o ? /* @__PURE__ */ m(D, { width: "100%", children: [
219
+ /* @__PURE__ */ m(at, { onChange: v, value: g, variant: "fullWidth", children: [
220
+ /* @__PURE__ */ t(
221
+ N,
222
+ {
223
+ label: /* @__PURE__ */ t(
224
+ W,
225
+ {
226
+ amount: _.totalAmount,
227
+ label: r.spend_tab_title
228
+ }
229
+ )
230
+ }
231
+ ),
232
+ /* @__PURE__ */ t(
233
+ N,
234
+ {
235
+ label: /* @__PURE__ */ t(
236
+ W,
237
+ {
238
+ amount: y.totalAmount,
239
+ label: r.income_tab_title
240
+ }
241
+ )
242
+ }
243
+ )
244
+ ] }),
245
+ g === 0 && /* @__PURE__ */ t(D, { children: /* @__PURE__ */ m(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
246
+ /* @__PURE__ */ t(
247
+ O,
248
+ {
249
+ data: _,
250
+ onSelected: M,
251
+ selectedId: u,
252
+ totalLabel: r.total_spending
253
+ }
254
+ ),
255
+ /* @__PURE__ */ t(
256
+ tt,
257
+ {
258
+ data: _,
259
+ onSelected: M,
260
+ selectedId: u
261
+ }
262
+ )
263
+ ] }) }),
264
+ g === 1 && /* @__PURE__ */ t(D, { children: /* @__PURE__ */ m(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
265
+ /* @__PURE__ */ t(
266
+ O,
267
+ {
268
+ data: y,
269
+ isIncome: !0,
270
+ onSelected: M,
271
+ selectedId: u,
272
+ totalLabel: r.total_income
273
+ }
274
+ ),
275
+ /* @__PURE__ */ t(tt, { data: y, onSelected: M, selectedId: u })
276
+ ] }) })
277
+ ] }) : /* @__PURE__ */ t(F, { height: 250 });
278
+ }, It = x(Et), Lt = ({ onPrimaryCtaClick: n, sx: l = {} }) => {
279
+ const { visibleAccounts: r } = rt(), { spending: i } = w(), { isCopyLoaded: c, isInitialized: a, setSelectedAccounts: o } = R();
280
+ return p.useEffect(() => {
281
+ o(r);
282
+ }, [r]), !c || !a ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
283
+ St,
284
+ {
285
+ className: "mx-exp-spending-miniwidget",
286
+ onPrimaryCtaClick: n,
287
+ primaryCtaLabel: i.primary_cta,
288
+ sx: l,
289
+ title: i.mini_title,
290
+ children: /* @__PURE__ */ t(It, {})
291
+ }
292
+ );
293
+ }, he = x(Lt), Nt = ({
294
+ data: n,
295
+ onSelected: l,
296
+ selectedId: r = "",
297
+ title: i
298
+ }) => {
299
+ const { spending: c } = w(), a = n.categoryData.find((o) => o.guid === r);
300
+ return /* @__PURE__ */ m(C, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
301
+ /* @__PURE__ */ t(f, { bold: !0, sx: { py: 12 }, children: `${i} ${c.by_category}` }),
302
+ /* @__PURE__ */ t(j, { "aria-hidden": "true" }),
303
+ /* @__PURE__ */ t(q, { children: n.categoryData.map((o) => /* @__PURE__ */ m(p.Fragment, { children: [
304
+ /* @__PURE__ */ t(
305
+ J,
306
+ {
307
+ disableGutters: !0,
308
+ disablePadding: !0,
309
+ sx: {
310
+ minHeight: 44
311
+ },
312
+ children: /* @__PURE__ */ m(
313
+ xt,
314
+ {
315
+ "aria-expanded": a?.guid === o.guid,
316
+ onClick: () => l(o.guid),
317
+ sx: { minHeight: 44, px: 8, py: 0 },
318
+ children: [
319
+ /* @__PURE__ */ t(
320
+ D,
321
+ {
322
+ borderRadius: 4,
323
+ flexShrink: 0,
324
+ height: 8,
325
+ sx: { backgroundColor: o.color, mr: 8 },
326
+ width: 8
327
+ }
328
+ ),
329
+ /* @__PURE__ */ m(
330
+ C,
331
+ {
332
+ alignItems: "center",
333
+ direction: "row",
334
+ justifyContent: "space-between",
335
+ width: "100%",
336
+ children: [
337
+ /* @__PURE__ */ t(f, { bold: r === o.guid, children: o.name }),
338
+ /* @__PURE__ */ t(f, { bold: r === o.guid, variant: "Body", children: A(o.amount, "0,0") })
339
+ ]
340
+ }
341
+ )
342
+ ]
343
+ }
344
+ )
345
+ }
346
+ ),
347
+ /* @__PURE__ */ t(j, {}),
348
+ o.categoryTotals && o.categoryTotals.length > 0 && /* @__PURE__ */ t(Dt, { in: a?.guid === o.guid, unmountOnExit: !0, children: /* @__PURE__ */ m(q, { children: [
349
+ a?.categoryTotals?.map((e) => /* @__PURE__ */ t(
350
+ J,
351
+ {
352
+ sx: {
353
+ pl: 24,
354
+ pr: 8,
355
+ py: 0
356
+ },
357
+ children: /* @__PURE__ */ m(C, { direction: "row", justifyContent: "space-between", width: "100%", children: [
358
+ /* @__PURE__ */ m(f, { children: [
359
+ e.name,
360
+ " "
361
+ ] }),
362
+ /* @__PURE__ */ t(f, { children: A(e.amount, "0,0") })
363
+ ] })
364
+ },
365
+ e.guid
366
+ )),
367
+ /* @__PURE__ */ t(j, {})
368
+ ] }) })
369
+ ] }, o.guid)) }),
370
+ /* @__PURE__ */ t(f, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${c.total}: ${A(n.totalAmount, "0,0")}` })
371
+ ] });
372
+ }, Wt = x(Nt), Ot = ({
373
+ data: n,
374
+ onSelected: l,
375
+ onViewTransactions: r,
376
+ selectedId: i,
377
+ title: c
378
+ }) => {
379
+ const { isDesktop: a, isMobile: o } = ct(), { isLoadingCategoryTotals: e } = z(), { spending: d } = w();
380
+ return /* @__PURE__ */ m(
381
+ C,
382
+ {
383
+ alignItems: o ? "center" : "flex-start",
384
+ direction: o ? "column" : "row",
385
+ gap: { xs: 16, md: 64, xl: 100 },
386
+ justifyContent: "center",
387
+ pt: 50,
388
+ px: 8,
389
+ children: [
390
+ e && /* @__PURE__ */ t(
391
+ O,
392
+ {
393
+ data: {
394
+ categoryData: [],
395
+ donutData: [],
396
+ totalAmount: 0
397
+ },
398
+ onSelected: () => {
399
+ },
400
+ selectedId: "",
401
+ size: a ? 400 : 300,
402
+ totalLabel: "Loading ...",
403
+ variant: "full"
404
+ }
405
+ ),
406
+ !e && /* @__PURE__ */ t(
407
+ O,
408
+ {
409
+ data: n,
410
+ onSelected: l,
411
+ onViewTransactions: r,
412
+ selectedId: i,
413
+ size: a ? 400 : 300,
414
+ totalLabel: d.total_amount,
415
+ variant: "full"
416
+ }
417
+ ),
418
+ /* @__PURE__ */ t(Wt, { data: n, onSelected: l, selectedId: i, title: c })
419
+ ]
420
+ }
421
+ );
422
+ }, et = x(Ot), Rt = (n) => [
423
+ n.palette.chartMono.chartMono5,
424
+ n.palette.chartMono.chartMono4,
425
+ n.palette.chartMono.chartMono3,
426
+ n.palette.chartMono.chartMono2,
427
+ n.palette.chartMono.chartMono1,
428
+ n.palette.chartMono.chartMono6
429
+ ], kt = () => {
430
+ const n = it(), { clientConfig: l } = st(), { categories: r, dateRangeCategoryTotals: i, loadDateRangeCategoryTotals: c } = z(), { goals: a, spending: o } = w(), { displayedDateRange: e, selectedAccounts: d, selectedAccountGuids: u } = R(), { setFilter: s, sortedTransactions: g } = Ct(), S = l?.master?.deep_link_params?.account_guids, _ = l?.master?.deep_link_params?.view, [y, v] = p.useState(""), [M, E] = p.useState(_ === "income" ? 1 : 0), [L, H] = p.useState(""), [gt, P] = p.useState(!1);
431
+ p.useEffect(() => {
432
+ c(
433
+ d,
434
+ e.start,
435
+ e.end
436
+ ).finally();
437
+ }, [d, e]);
438
+ const k = p.useMemo(
439
+ () => lt(r, a, n, i),
440
+ [r, i]
441
+ ), X = p.useMemo(
442
+ () => dt(r, i, Rt(n)),
443
+ [r, i]
444
+ ), G = p.useMemo(
445
+ () => g.find((h) => h.guid === L),
446
+ [L, g]
447
+ ), ut = (h, I) => {
448
+ E(I), v("");
449
+ }, Y = (h) => {
450
+ v(y === h || h === "0" ? "" : h);
451
+ }, K = (h) => {
452
+ const I = {
453
+ accounts: S || u,
454
+ dateRange: e
455
+ };
456
+ if (M === 0)
457
+ if (h === "other") {
458
+ const T = k.categoryData.find(($) => $.guid === "other");
459
+ s({
460
+ ...I,
461
+ custom: ($) => !!T?.categoryTotals?.find((pt) => pt.guid === $.top_level_category_guid)
462
+ });
463
+ } else
464
+ s({
465
+ ...I,
466
+ custom: (T) => h ? T.top_level_category_guid === h : T.top_level_category_guid !== b.INCOME && T.top_level_category_guid !== b.INVESTMENTS && T.top_level_category_guid !== b.TRANSFER,
467
+ showSplits: !!h
468
+ });
469
+ else
470
+ s({
471
+ ...I,
472
+ custom: (T) => h ? T.category_guid === h : T.category_guid === b.INCOME || T.top_level_category_guid === b.INCOME
473
+ });
474
+ P(!0);
475
+ };
476
+ return /* @__PURE__ */ m(D, { children: [
477
+ /* @__PURE__ */ m(at, { onChange: ut, value: M, variant: "fullWidth", children: [
478
+ /* @__PURE__ */ t(
479
+ N,
480
+ {
481
+ label: /* @__PURE__ */ t(
482
+ W,
483
+ {
484
+ amount: k.totalAmount,
485
+ label: o.spend_tab_title
486
+ }
487
+ )
488
+ }
489
+ ),
490
+ /* @__PURE__ */ t(
491
+ N,
492
+ {
493
+ label: /* @__PURE__ */ t(
494
+ W,
495
+ {
496
+ amount: X.totalAmount,
497
+ label: o.income_tab_title
498
+ }
499
+ )
500
+ }
501
+ )
502
+ ] }),
503
+ M === 0 && /* @__PURE__ */ t(
504
+ et,
505
+ {
506
+ data: k,
507
+ onSelected: Y,
508
+ onViewTransactions: K,
509
+ selectedId: y,
510
+ title: o.spend_tab_title
511
+ }
512
+ ),
513
+ M === 1 && /* @__PURE__ */ t(
514
+ et,
515
+ {
516
+ data: X,
517
+ onSelected: Y,
518
+ onViewTransactions: K,
519
+ selectedId: y,
520
+ title: o.income_tab_title
521
+ }
522
+ ),
523
+ /* @__PURE__ */ t(
524
+ Q,
525
+ {
526
+ ariaLabelClose: o.close_drawer_aria,
527
+ isOpen: gt,
528
+ onClose: () => P(!1),
529
+ title: o.transactions_drawer_title,
530
+ children: /* @__PURE__ */ t(Tt, { onClick: H })
531
+ }
532
+ ),
533
+ /* @__PURE__ */ t(
534
+ Q,
535
+ {
536
+ ariaLabelClose: o.close_drawer_aria,
537
+ isOpen: !!G,
538
+ onClose: () => H(""),
539
+ title: o.transaction_details_drawer_title,
540
+ children: G && /* @__PURE__ */ t(Mt, { transaction: G })
541
+ }
542
+ )
543
+ ] });
544
+ }, Gt = x(kt), $t = ({ onBackClick: n, sx: l = {} }) => {
545
+ const { visibleAccounts: r } = rt(), { spending: i } = w(), { isCopyLoaded: c, isInitialized: a, setDisplayedDate: o, setSelectedAccounts: e } = R(), { onEvent: d } = _t(), { clientConfig: u } = st(), s = u?.master?.deep_link_params?.date_range, [g, S] = p.useState(!1);
546
+ p.useEffect(() => {
547
+ e(r);
548
+ }, [r]), p.useEffect(() => {
549
+ s && Array.isArray(s) && s.length === 2 ? o(s[0], s[1]) : o(nt(U()), ot(U())), S(!0), d(Z.SPENDING_VIEW);
550
+ }, []);
551
+ const _ = (y) => {
552
+ o(y[0], y[1]);
553
+ };
554
+ return !c || !a || !g ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
555
+ wt,
556
+ {
557
+ accountOptions: r,
558
+ calendarActions: { onRangeChanged: _ },
559
+ onAccountsFilterClick: () => d(Z.SPENDING_CLICK_FILTER),
560
+ onBackClick: n,
561
+ sx: l,
562
+ title: i.title,
563
+ children: /* @__PURE__ */ t(D, { height: "calc(100dvh - 150px)", overflow: "scroll", width: "100%", children: /* @__PURE__ */ t(Gt, {}) })
564
+ }
565
+ );
566
+ }, fe = x($t);
567
+ export {
568
+ he as SpendingMiniWidget,
569
+ fe as SpendingWidget
570
+ };