@mx-cartographer/experiences 6.26.0-alpha.sms7 → 6.26.1-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 (95) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/dist/AccountStore-DkL93tXL.mjs +317 -0
  3. package/dist/AccountStore-DkL93tXL.mjs.map +1 -0
  4. package/dist/BudgetUtil-CVqAdv-j.mjs +187 -0
  5. package/dist/BudgetUtil-CVqAdv-j.mjs.map +1 -0
  6. package/dist/CashflowStore-gPEEBiXo.mjs +53 -0
  7. package/dist/CashflowStore-gPEEBiXo.mjs.map +1 -0
  8. package/dist/CategoryStore-m7oieLzP.mjs +260 -0
  9. package/dist/CategoryStore-m7oieLzP.mjs.map +1 -0
  10. package/dist/ConnectMiniWidget-CQWafYtQ.mjs +22966 -0
  11. package/dist/ConnectMiniWidget-CQWafYtQ.mjs.map +1 -0
  12. package/dist/DebtsStore-cUhIgJx6.mjs +145 -0
  13. package/dist/DebtsStore-cUhIgJx6.mjs.map +1 -0
  14. package/dist/Donut-CGNFni9y.mjs +58 -0
  15. package/dist/Donut-CGNFni9y.mjs.map +1 -0
  16. package/dist/FinstrongStore-BDG7l0nI.mjs +183 -0
  17. package/dist/FinstrongStore-BDG7l0nI.mjs.map +1 -0
  18. package/dist/GoalStore-o2waGeyf.mjs +293 -0
  19. package/dist/GoalStore-o2waGeyf.mjs.map +1 -0
  20. package/dist/Loader-CwdK8lfx.mjs +147 -0
  21. package/dist/Loader-CwdK8lfx.mjs.map +1 -0
  22. package/dist/MerchantStore-Cck9IGIH.mjs +125 -0
  23. package/dist/MerchantStore-Cck9IGIH.mjs.map +1 -0
  24. package/dist/NetWorthStore-D5eUfGQt.mjs +66 -0
  25. package/dist/NetWorthStore-D5eUfGQt.mjs.map +1 -0
  26. package/dist/NotificationStore-DCxw8W7u.mjs +141 -0
  27. package/dist/NotificationStore-DCxw8W7u.mjs.map +1 -0
  28. package/dist/RecurringTransactionsStore-Bijrgllq.mjs +337 -0
  29. package/dist/RecurringTransactionsStore-Bijrgllq.mjs.map +1 -0
  30. package/dist/SettingsStore-BhOYgUOa.mjs +352 -0
  31. package/dist/SettingsStore-BhOYgUOa.mjs.map +1 -0
  32. package/dist/TransactionApi-Dnbyi1JL.mjs +175 -0
  33. package/dist/TransactionApi-Dnbyi1JL.mjs.map +1 -0
  34. package/dist/TransactionStore-CiEtt5XJ.mjs +417 -0
  35. package/dist/TransactionStore-CiEtt5XJ.mjs.map +1 -0
  36. package/dist/TrendsStore-Idq3QfoA.mjs +131 -0
  37. package/dist/TrendsStore-Idq3QfoA.mjs.map +1 -0
  38. package/dist/accounts/index.es.js +18 -0
  39. package/dist/accounts/index.es.js.map +1 -0
  40. package/dist/analytics/index.es.js +170 -0
  41. package/dist/analytics/index.es.js.map +1 -0
  42. package/dist/budgets/index.es.js +1116 -0
  43. package/dist/budgets/index.es.js.map +1 -0
  44. package/dist/cashflow/index.es.js +118 -0
  45. package/dist/cashflow/index.es.js.map +1 -0
  46. package/dist/categories/index.es.js +10 -0
  47. package/dist/categories/index.es.js.map +1 -0
  48. package/dist/categories/util/CategoryUtil.d.ts +3 -2
  49. package/dist/common/components/charts/StackedLineChart.d.ts +2 -2
  50. package/dist/common/components/charts/stackedlinechart/CustomLegend.d.ts +1 -0
  51. package/dist/common/context/hooks.d.ts +13 -13
  52. package/dist/common/index.es.js +1549 -0
  53. package/dist/common/index.es.js.map +1 -0
  54. package/dist/common/types/AppData.d.ts +2 -0
  55. package/dist/common/types/Category.d.ts +2 -8
  56. package/dist/common/types/index.d.ts +1 -1
  57. package/dist/dashboard/index.es.js +257 -0
  58. package/dist/dashboard/index.es.js.map +1 -0
  59. package/dist/debts/index.es.js +9 -0
  60. package/dist/debts/index.es.js.map +1 -0
  61. package/dist/finstrong/index.es.js +11 -0
  62. package/dist/finstrong/index.es.js.map +1 -0
  63. package/dist/goals/index.es.js +9 -0
  64. package/dist/goals/index.es.js.map +1 -0
  65. package/dist/help/components/content/section/index.d.ts +15 -15
  66. package/dist/help/index.es.js +6 -0
  67. package/dist/help/index.es.js.map +1 -0
  68. package/dist/investments/index.es.js +1694 -0
  69. package/dist/investments/index.es.js.map +1 -0
  70. package/dist/merchants/index.es.js +7 -0
  71. package/dist/merchants/index.es.js.map +1 -0
  72. package/dist/microinsights/index.es.js +21 -0
  73. package/dist/microinsights/index.es.js.map +1 -0
  74. package/dist/networth/index.es.js +11 -0
  75. package/dist/networth/index.es.js.map +1 -0
  76. package/dist/notifications/index.es.js +116 -0
  77. package/dist/notifications/index.es.js.map +1 -0
  78. package/dist/recurringtransactions/index.es.js +14 -0
  79. package/dist/recurringtransactions/index.es.js.map +1 -0
  80. package/dist/settings/index.es.js +112 -0
  81. package/dist/settings/index.es.js.map +1 -0
  82. package/dist/spending/index.es.js +632 -0
  83. package/dist/spending/index.es.js.map +1 -0
  84. package/dist/transactions/index.es.js +19 -0
  85. package/dist/transactions/index.es.js.map +1 -0
  86. package/dist/trends/components/CategoriesList.d.ts +5 -5
  87. package/dist/trends/components/CategoriesListItem.d.ts +7 -4
  88. package/dist/trends/components/CategoryDetailChart.d.ts +5 -1
  89. package/dist/trends/index.es.js +10 -0
  90. package/dist/trends/index.es.js.map +1 -0
  91. package/dist/trends/stores/TrendsStore.d.ts +11 -16
  92. package/package.json +91 -3
  93. package/dist/index.d.ts +0 -22
  94. package/dist/index.es.js +0 -29873
  95. package/dist/index.es.js.map +0 -1
@@ -0,0 +1,632 @@
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import u from "react";
3
+ import { observer as D } from "mobx-react-lite";
4
+ import "bowser";
5
+ import "date-fns/getUnixTime";
6
+ import "date-fns/intlFormat";
7
+ import { aK as b, b7 as V, aM as E, av as ot, b8 as U, a5 as mt, a7 as ht, b9 as q, aw as ft } from "../ConnectMiniWidget-CQWafYtQ.mjs";
8
+ import "date-fns/addMonths";
9
+ import "date-fns/addQuarters";
10
+ import "date-fns/addWeeks";
11
+ import "date-fns/addYears";
12
+ import "date-fns/getDay";
13
+ import "date-fns/isBefore";
14
+ import "date-fns/nextDay";
15
+ import "date-fns/setDate";
16
+ import { startOfToday as J } from "date-fns/startOfToday";
17
+ import "date-fns/fromUnixTime";
18
+ import "numeral";
19
+ import { useTheme as nt } from "@mui/material";
20
+ import yt from "@mui/material/Button";
21
+ import { Text as h, CategoryIcon as Ct, CategoryIconVariants as _t } from "@mxenabled/mxui";
22
+ import "@mui/material/Tooltip";
23
+ import x from "@mui/material/Box";
24
+ import "@mui/material/IconButton";
25
+ import { b as v, d as R, h as z, L as F, f as at, M as bt, g as it, i as St, c as Tt } from "../Loader-CwdK8lfx.mjs";
26
+ import Mt from "@mui/material/styles/useTheme";
27
+ import "@mui/material/useMediaQuery";
28
+ import "@mxenabled/cssinjs";
29
+ import "date-fns/addDays";
30
+ import "date-fns/eachDayOfInterval";
31
+ import "date-fns/eachWeekOfInterval";
32
+ import { endOfMonth as rt } from "date-fns/endOfMonth";
33
+ import "date-fns/format";
34
+ import "date-fns/isSameMonth";
35
+ import { startOfMonth as st } from "date-fns/startOfMonth";
36
+ import "date-fns/subMonths";
37
+ import "@mui/material/Paper";
38
+ import "@mxenabled/mx-icons";
39
+ import "date-fns/isSameDay";
40
+ import "date-fns/isWithinInterval";
41
+ import "d3";
42
+ import "@mui/material/styles";
43
+ import "@mui/x-charts";
44
+ import "@mui/x-charts/ChartsTooltip";
45
+ import C from "@mui/material/Stack";
46
+ import "date-fns/differenceInCalendarDays";
47
+ import "date-fns/endOfToday";
48
+ import "date-fns/endOfYear";
49
+ import "date-fns/startOfYear";
50
+ import "date-fns/subDays";
51
+ import "date-fns/subYears";
52
+ import "@mui/material/ButtonGroup";
53
+ import N from "@mui/material/Tab";
54
+ import ct from "@mui/material/Tabs";
55
+ import "@mui/material/ToggleButton";
56
+ import "@mui/material/ToggleButtonGroup";
57
+ import "@mui/material/Dialog";
58
+ import "@mui/material/DialogContent";
59
+ import "@mui/material/Card";
60
+ import "@mui/material/CardContent";
61
+ import "@mui/material/CardHeader";
62
+ import "uuid";
63
+ import "@mui/material/FormControlLabel";
64
+ import "@mui/material/Radio";
65
+ import "@mui/material/Avatar";
66
+ import Q from "@mui/material/ListItem";
67
+ import "@mui/material/ListItemAvatar";
68
+ import xt from "@mui/material/ListItemButton";
69
+ import "@mui/material/ListItemText";
70
+ import "@mui/material/ListItemIcon";
71
+ import "@mui/material/MenuItem";
72
+ import "@mui/material/TextField";
73
+ import "@mui/material/Switch";
74
+ import "mobx";
75
+ import "posthog-js";
76
+ import "date-fns/differenceInDays";
77
+ import "@mui/x-data-grid-pro";
78
+ import "date-fns";
79
+ import j from "@mui/material/Divider";
80
+ import Z from "@mui/material/List";
81
+ import "date-fns/formatISO";
82
+ import "date-fns/isAfter";
83
+ import "date-fns/parseISO";
84
+ import "date-fns/subQuarters";
85
+ import "date-fns/lastDayOfMonth";
86
+ import "date-fns/setDayOfYear";
87
+ import "date-fns/addSeconds";
88
+ import "date-fns/differenceInCalendarMonths";
89
+ import "date-fns/getMonth";
90
+ import "@mui/material/CircularProgress";
91
+ import { D as Dt } from "../Donut-CGNFni9y.mjs";
92
+ import vt from "@mui/material/Collapse";
93
+ const B = 5, wt = (o, l, r) => r.reduce((i, c) => {
94
+ if (c.total > 0) {
95
+ const a = o.find((s) => s.guid === c.category_guid);
96
+ if (!a) return i;
97
+ const n = a.parent_guid ?? a.guid, e = o.find((s) => s.guid === n);
98
+ if (!e) return i;
99
+ const d = {
100
+ guid: a.guid,
101
+ name: a.guid === n ? `General ${a.name}` : a.name,
102
+ color: V(e.guid, l),
103
+ amount: c.total
104
+ }, g = i.find((s) => s.guid === n);
105
+ g ? (g.amount += c.total, g.categoryTotals?.push(d)) : i.push({
106
+ guid: n,
107
+ name: e.name,
108
+ color: V(e.guid, l),
109
+ categoryTotals: [d],
110
+ amount: c.total
111
+ });
112
+ }
113
+ return i;
114
+ }, []), lt = (o, l, r, i) => {
115
+ const c = wt(o, r, i), a = c.filter(
116
+ (s) => s.guid !== b.INCOME && s.guid !== b.INVESTMENTS && s.guid !== b.TRANSFER
117
+ ).sort((s, p) => p.amount - s.amount), n = a.reduce(
118
+ (s, p) => s + p.amount,
119
+ 0
120
+ ), e = a.length > B ? B : a.length, d = a.slice(0, e), g = d.map((s) => ({
121
+ id: s.guid,
122
+ color: V(s.guid, r),
123
+ label: s.name,
124
+ value: s.amount / n * 100
125
+ }));
126
+ if (a.length > 5) {
127
+ const s = a.slice(B, c.length), p = s.reduce(
128
+ (S, _) => S + _.amount,
129
+ 0
130
+ );
131
+ d.push({
132
+ guid: "other",
133
+ color: r.palette.categories.others || "",
134
+ name: l.saving_goal_other,
135
+ categoryTotals: s,
136
+ amount: p
137
+ }), g.push({
138
+ id: "other",
139
+ color: r.palette.categories.others || "",
140
+ label: l.saving_goal_other,
141
+ value: p / n * 100
142
+ });
143
+ }
144
+ return {
145
+ categoryData: d,
146
+ donutData: g,
147
+ totalAmount: n
148
+ };
149
+ }, dt = (o, l, r) => {
150
+ const i = o.filter(
151
+ (e) => e.guid === b.INCOME || e.parent_guid === b.INCOME
152
+ ), c = l.filter((e) => i.some((d) => d.guid === e.category_guid)).sort((e, d) => e.total - d.total).map((e, d) => ({
153
+ guid: e.category_guid,
154
+ name: o.find((g) => g.guid === e.category_guid)?.name,
155
+ color: r[d],
156
+ categoryTotals: [],
157
+ amount: Math.abs(e.total)
158
+ })), a = c.reduce(
159
+ (e, d) => e + d.amount,
160
+ 0
161
+ ), n = c.map((e) => ({
162
+ id: e.guid,
163
+ color: e.color,
164
+ label: e.name,
165
+ value: e.amount / a * 100
166
+ }));
167
+ return {
168
+ categoryData: c,
169
+ donutData: n,
170
+ totalAmount: a
171
+ };
172
+ }, O = ({ amount: o, label: l }) => /* @__PURE__ */ m(C, { direction: "column", children: [
173
+ /* @__PURE__ */ t(h, { bold: !0, sx: { textTransform: "none" }, variant: "Body", children: l }),
174
+ /* @__PURE__ */ t(h, { variant: "XSmall", children: E(o, "0,0") })
175
+ ] }), Et = ({
176
+ data: o,
177
+ isIncome: l = !1,
178
+ onSelected: r,
179
+ onViewTransactions: i,
180
+ selectedId: c,
181
+ size: a = 150,
182
+ totalLabel: n,
183
+ variant: e = "mini"
184
+ }) => {
185
+ const { spending: d } = v(), g = nt(), { isTablet: s } = ot(), p = u.useMemo(
186
+ () => c ? o.categoryData.find((w) => w.guid === c) : void 0,
187
+ [c]
188
+ ), S = u.useMemo(() => o.donutData.length > 0 ? o.donutData : [{ id: "0", color: g.palette.divider, value: 100 }], [o, g]), _ = () => {
189
+ i?.(c);
190
+ }, f = s ? 32 : 48;
191
+ return /* @__PURE__ */ t(Dt, { 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: [
192
+ p && /* @__PURE__ */ m(
193
+ C,
194
+ {
195
+ alignItems: "center",
196
+ gap: e === "mini" ? 0 : 8,
197
+ mb: e === "mini" ? 0 : 8,
198
+ mt: e === "mini" ? 0 : -16,
199
+ sx: e === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
200
+ children: [
201
+ /* @__PURE__ */ t(
202
+ Ct,
203
+ {
204
+ categoryGuid: l ? b.INCOME : p.guid,
205
+ size: e === "mini" ? 24 : f,
206
+ variant: _t.Transparent
207
+ }
208
+ ),
209
+ /* @__PURE__ */ t(h, { color: "secondary", noWrap: !0, variant: e === "mini" ? "Tiny" : "Body", children: p ? p.name : n })
210
+ ]
211
+ }
212
+ ),
213
+ !p && e === "full" && /* @__PURE__ */ t(h, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: n }),
214
+ /* @__PURE__ */ t(h, { variant: e === "mini" ? "H2" : "H1", children: p ? E(p.amount, "0,0") : E(o.totalAmount, "0,0") }),
215
+ !p && e === "mini" && /* @__PURE__ */ t(h, { color: "secondary", noWrap: !0, variant: "Tiny", children: n }),
216
+ e === "full" && /* @__PURE__ */ t(
217
+ yt,
218
+ {
219
+ "aria-label": `View ${p?.name || ""} Transactions`,
220
+ disabled: o.categoryData.length === 0,
221
+ onClick: _,
222
+ sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
223
+ variant: "text",
224
+ children: d.view_transactions
225
+ }
226
+ )
227
+ ] }) }) });
228
+ }, W = D(Et), tt = ({ data: o, onSelected: l, selectedId: r }) => /* @__PURE__ */ t(C, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: o.categoryData.map((i) => /* @__PURE__ */ m(
229
+ C,
230
+ {
231
+ alignItems: "center",
232
+ "aria-label": i.name,
233
+ "aria-selected": i.guid === r,
234
+ direction: "row",
235
+ gap: 8,
236
+ onClick: () => l(i.guid),
237
+ role: "button",
238
+ sx: { cursor: "pointer" },
239
+ children: [
240
+ /* @__PURE__ */ t(x, { borderRadius: 4, height: 8, sx: { backgroundColor: i.color }, width: 8 }),
241
+ /* @__PURE__ */ t(h, { bold: i.guid === r, variant: "XSmall", children: i.name })
242
+ ]
243
+ },
244
+ i.guid
245
+ )) }), It = () => {
246
+ const o = Mt(), { goals: l, spending: r } = v(), { selectedAccounts: i } = R(), {
247
+ categories: c,
248
+ dateRangeCategoryTotals: a,
249
+ dataRangeTotalsLoaded: n,
250
+ loadDateRangeCategoryTotals: e
251
+ } = z(), d = u.useMemo(
252
+ () => [
253
+ o.palette.chartMono.chartMono5,
254
+ o.palette.chartMono.chartMono4,
255
+ o.palette.chartMono.chartMono3,
256
+ o.palette.chartMono.chartMono2,
257
+ o.palette.chartMono.chartMono1,
258
+ o.palette.chartMono.chartMono6
259
+ ],
260
+ [o]
261
+ );
262
+ u.useEffect(() => {
263
+ e(
264
+ i,
265
+ st(/* @__PURE__ */ new Date()),
266
+ rt(/* @__PURE__ */ new Date())
267
+ ).finally();
268
+ }, [i]);
269
+ const [g, s] = u.useState(""), [p, S] = u.useState(0), _ = u.useMemo(
270
+ () => lt(c, l, o, a),
271
+ [c, a]
272
+ ), f = u.useMemo(
273
+ () => dt(c, a, d),
274
+ [c, a, d]
275
+ ), w = (I, L) => {
276
+ S(L), s("");
277
+ }, M = (I) => {
278
+ s(g === I ? "" : I);
279
+ };
280
+ return n ? /* @__PURE__ */ m(x, { width: "100%", children: [
281
+ /* @__PURE__ */ m(ct, { onChange: w, value: p, variant: "fullWidth", children: [
282
+ /* @__PURE__ */ t(
283
+ N,
284
+ {
285
+ label: /* @__PURE__ */ t(
286
+ O,
287
+ {
288
+ amount: _.totalAmount,
289
+ label: r.spend_tab_title
290
+ }
291
+ )
292
+ }
293
+ ),
294
+ /* @__PURE__ */ t(
295
+ N,
296
+ {
297
+ label: /* @__PURE__ */ t(
298
+ O,
299
+ {
300
+ amount: f.totalAmount,
301
+ label: r.income_tab_title
302
+ }
303
+ )
304
+ }
305
+ )
306
+ ] }),
307
+ p === 0 && /* @__PURE__ */ t(x, { children: /* @__PURE__ */ m(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
308
+ /* @__PURE__ */ t(
309
+ W,
310
+ {
311
+ data: _,
312
+ onSelected: M,
313
+ selectedId: g,
314
+ totalLabel: r.total_spending
315
+ }
316
+ ),
317
+ /* @__PURE__ */ t(
318
+ tt,
319
+ {
320
+ data: _,
321
+ onSelected: M,
322
+ selectedId: g
323
+ }
324
+ )
325
+ ] }) }),
326
+ p === 1 && /* @__PURE__ */ t(x, { children: /* @__PURE__ */ m(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
327
+ /* @__PURE__ */ t(
328
+ W,
329
+ {
330
+ data: f,
331
+ isIncome: !0,
332
+ onSelected: M,
333
+ selectedId: g,
334
+ totalLabel: r.total_income
335
+ }
336
+ ),
337
+ /* @__PURE__ */ t(tt, { data: f, onSelected: M, selectedId: g })
338
+ ] }) })
339
+ ] }) : /* @__PURE__ */ t(F, { height: 250 });
340
+ }, At = D(It), Lt = ({ onPrimaryCtaClick: o, sx: l = {} }) => {
341
+ const { visibleAccounts: r } = at(), { spending: i } = v(), { isCopyLoaded: c, isInitialized: a, setSelectedAccounts: n } = R();
342
+ return u.useEffect(() => {
343
+ n(r);
344
+ }, [r]), !c || !a ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
345
+ bt,
346
+ {
347
+ className: "mx-exp-spending-miniwidget",
348
+ onPrimaryCtaClick: o,
349
+ primaryCtaLabel: i.primary_cta,
350
+ sx: l,
351
+ title: i.mini_title,
352
+ children: /* @__PURE__ */ t(At, {})
353
+ }
354
+ );
355
+ }, xo = D(Lt), Nt = ({
356
+ data: o,
357
+ onSelected: l,
358
+ selectedId: r = "",
359
+ title: i
360
+ }) => {
361
+ const { spending: c } = v(), a = o.categoryData.find((n) => n.guid === r);
362
+ return /* @__PURE__ */ m(C, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
363
+ /* @__PURE__ */ t(h, { bold: !0, sx: { py: 12 }, children: `${i} ${c.by_category}` }),
364
+ /* @__PURE__ */ t(j, { "aria-hidden": "true" }),
365
+ /* @__PURE__ */ t(Z, { children: o.categoryData.map((n) => /* @__PURE__ */ m(u.Fragment, { children: [
366
+ /* @__PURE__ */ t(
367
+ Q,
368
+ {
369
+ disableGutters: !0,
370
+ disablePadding: !0,
371
+ sx: {
372
+ minHeight: 44
373
+ },
374
+ children: /* @__PURE__ */ m(
375
+ xt,
376
+ {
377
+ "aria-expanded": a?.guid === n.guid,
378
+ onClick: () => l(n.guid),
379
+ sx: { minHeight: 44, px: 8, py: 0 },
380
+ children: [
381
+ /* @__PURE__ */ t(
382
+ x,
383
+ {
384
+ borderRadius: 4,
385
+ flexShrink: 0,
386
+ height: 8,
387
+ sx: { backgroundColor: n.color, mr: 8 },
388
+ width: 8
389
+ }
390
+ ),
391
+ /* @__PURE__ */ m(
392
+ C,
393
+ {
394
+ alignItems: "center",
395
+ direction: "row",
396
+ justifyContent: "space-between",
397
+ width: "100%",
398
+ children: [
399
+ /* @__PURE__ */ t(h, { bold: r === n.guid, children: n.name }),
400
+ /* @__PURE__ */ t(h, { bold: r === n.guid, variant: "Body", children: E(n.amount, "0,0") })
401
+ ]
402
+ }
403
+ )
404
+ ]
405
+ }
406
+ )
407
+ }
408
+ ),
409
+ /* @__PURE__ */ t(j, {}),
410
+ n.categoryTotals && n.categoryTotals.length > 0 && /* @__PURE__ */ t(vt, { in: a?.guid === n.guid, unmountOnExit: !0, children: /* @__PURE__ */ m(Z, { children: [
411
+ a?.categoryTotals?.map((e) => /* @__PURE__ */ t(
412
+ Q,
413
+ {
414
+ sx: {
415
+ pl: 24,
416
+ pr: 8,
417
+ py: 0
418
+ },
419
+ children: /* @__PURE__ */ m(C, { direction: "row", justifyContent: "space-between", width: "100%", children: [
420
+ /* @__PURE__ */ m(h, { children: [
421
+ e.name,
422
+ " "
423
+ ] }),
424
+ /* @__PURE__ */ t(h, { children: E(e.amount, "0,0") })
425
+ ] })
426
+ },
427
+ e.guid
428
+ )),
429
+ /* @__PURE__ */ t(j, {})
430
+ ] }) })
431
+ ] }, n.guid)) }),
432
+ /* @__PURE__ */ t(h, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${c.total}: ${E(o.totalAmount, "0,0")}` })
433
+ ] });
434
+ }, Ot = D(Nt), Wt = ({
435
+ data: o,
436
+ onSelected: l,
437
+ onViewTransactions: r,
438
+ selectedId: i,
439
+ title: c
440
+ }) => {
441
+ const { isDesktop: a, isMobile: n } = ot(), { isLoadingCategoryTotals: e } = z(), { spending: d } = v();
442
+ return /* @__PURE__ */ m(
443
+ C,
444
+ {
445
+ alignItems: n ? "center" : "flex-start",
446
+ direction: n ? "column" : "row",
447
+ gap: { xs: 16, md: 64, xl: 100 },
448
+ justifyContent: "center",
449
+ pt: 50,
450
+ px: 8,
451
+ children: [
452
+ e && /* @__PURE__ */ t(
453
+ W,
454
+ {
455
+ data: {
456
+ categoryData: [],
457
+ donutData: [],
458
+ totalAmount: 0
459
+ },
460
+ onSelected: () => {
461
+ },
462
+ selectedId: "",
463
+ size: a ? 400 : 300,
464
+ totalLabel: "Loading ...",
465
+ variant: "full"
466
+ }
467
+ ),
468
+ !e && /* @__PURE__ */ t(
469
+ W,
470
+ {
471
+ data: o,
472
+ onSelected: l,
473
+ onViewTransactions: r,
474
+ selectedId: i,
475
+ size: a ? 400 : 300,
476
+ totalLabel: d.total_amount,
477
+ variant: "full"
478
+ }
479
+ ),
480
+ /* @__PURE__ */ t(Ot, { data: o, onSelected: l, selectedId: i, title: c })
481
+ ]
482
+ }
483
+ );
484
+ }, et = D(Wt), Rt = (o) => [
485
+ o.palette.chartMono.chartMono5,
486
+ o.palette.chartMono.chartMono4,
487
+ o.palette.chartMono.chartMono3,
488
+ o.palette.chartMono.chartMono2,
489
+ o.palette.chartMono.chartMono1,
490
+ o.palette.chartMono.chartMono6
491
+ ], Gt = () => {
492
+ const o = nt(), { clientConfig: l } = it(), { categories: r, dateRangeCategoryTotals: i, loadDateRangeCategoryTotals: c } = z(), { goals: a, spending: n } = v(), { displayedDateRange: e, selectedAccounts: d, selectedAccountGuids: g } = R(), { setFilter: s, sortedTransactions: p } = St(), S = l?.master?.deep_link_params?.account_guids, _ = l?.master?.deep_link_params?.view, [f, w] = u.useState(""), [M, I] = u.useState(_ === "income" ? 1 : 0), [L, H] = u.useState(""), [pt, P] = u.useState(!1);
493
+ u.useEffect(() => {
494
+ c(
495
+ d,
496
+ e.start,
497
+ e.end
498
+ ).finally();
499
+ }, [d, e]);
500
+ const G = u.useMemo(
501
+ () => lt(r, a, o, i),
502
+ [r, i]
503
+ ), K = u.useMemo(
504
+ () => dt(r, i, Rt(o)),
505
+ [r, i]
506
+ ), k = u.useMemo(
507
+ () => p.find((y) => y.guid === L),
508
+ [L, p]
509
+ ), gt = (y, A) => {
510
+ I(A), w("");
511
+ }, X = (y) => {
512
+ w(f === y || y === "0" ? "" : y);
513
+ }, Y = (y) => {
514
+ const A = {
515
+ accounts: S || g,
516
+ dateRange: e
517
+ };
518
+ if (M === 0)
519
+ if (y === "other") {
520
+ const T = G.categoryData.find(($) => $.guid === "other");
521
+ s({
522
+ ...A,
523
+ custom: ($) => !!T?.categoryTotals?.find((ut) => ut.guid === $.top_level_category_guid)
524
+ });
525
+ } else
526
+ s({
527
+ ...A,
528
+ custom: (T) => y ? T.top_level_category_guid === y : T.top_level_category_guid !== b.INCOME && T.top_level_category_guid !== b.INVESTMENTS && T.top_level_category_guid !== b.TRANSFER
529
+ });
530
+ else
531
+ s({
532
+ ...A,
533
+ custom: (T) => y ? T.category_guid === y : T.category_guid === b.INCOME || T.top_level_category_guid === b.INCOME
534
+ });
535
+ P(!0);
536
+ };
537
+ return /* @__PURE__ */ m(x, { children: [
538
+ /* @__PURE__ */ m(ct, { onChange: gt, value: M, variant: "fullWidth", children: [
539
+ /* @__PURE__ */ t(
540
+ N,
541
+ {
542
+ label: /* @__PURE__ */ t(
543
+ O,
544
+ {
545
+ amount: G.totalAmount,
546
+ label: n.spend_tab_title
547
+ }
548
+ )
549
+ }
550
+ ),
551
+ /* @__PURE__ */ t(
552
+ N,
553
+ {
554
+ label: /* @__PURE__ */ t(
555
+ O,
556
+ {
557
+ amount: K.totalAmount,
558
+ label: n.income_tab_title
559
+ }
560
+ )
561
+ }
562
+ )
563
+ ] }),
564
+ M === 0 && /* @__PURE__ */ t(
565
+ et,
566
+ {
567
+ data: G,
568
+ onSelected: X,
569
+ onViewTransactions: Y,
570
+ selectedId: f,
571
+ title: n.spend_tab_title
572
+ }
573
+ ),
574
+ M === 1 && /* @__PURE__ */ t(
575
+ et,
576
+ {
577
+ data: K,
578
+ onSelected: X,
579
+ onViewTransactions: Y,
580
+ selectedId: f,
581
+ title: n.income_tab_title
582
+ }
583
+ ),
584
+ /* @__PURE__ */ t(
585
+ U,
586
+ {
587
+ ariaLabelClose: n.close_drawer_aria,
588
+ isOpen: pt,
589
+ onClose: () => P(!1),
590
+ title: n.transactions_drawer_title,
591
+ children: /* @__PURE__ */ t(mt, { onClick: H })
592
+ }
593
+ ),
594
+ /* @__PURE__ */ t(
595
+ U,
596
+ {
597
+ ariaLabelClose: n.close_drawer_aria,
598
+ isOpen: !!k,
599
+ onClose: () => H(""),
600
+ title: n.transaction_details_drawer_title,
601
+ children: k && /* @__PURE__ */ t(ht, { transaction: k })
602
+ }
603
+ )
604
+ ] });
605
+ }, kt = D(Gt), $t = ({ onBackClick: o, sx: l = {} }) => {
606
+ const { visibleAccounts: r } = at(), { spending: i } = v(), { isCopyLoaded: c, isInitialized: a, setDisplayedDate: n, setSelectedAccounts: e } = R(), { onEvent: d } = Tt(), { clientConfig: g } = it(), s = g?.master?.deep_link_params?.date_range, [p, S] = u.useState(!1);
607
+ u.useEffect(() => {
608
+ e(r);
609
+ }, [r]), u.useEffect(() => {
610
+ s && Array.isArray(s) && s.length === 2 ? n(s[0], s[1]) : n(st(J()), rt(J())), S(!0), d(q.SPENDING_VIEW);
611
+ }, []);
612
+ const _ = (f) => {
613
+ n(f[0], f[1]);
614
+ };
615
+ return !c || !a || !p ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
616
+ ft,
617
+ {
618
+ accountOptions: r,
619
+ calendarActions: { onRangeChanged: _ },
620
+ onAccountsFilterClick: () => d(q.SPENDING_CLICK_FILTER),
621
+ onBackClick: o,
622
+ sx: l,
623
+ title: i.title,
624
+ children: /* @__PURE__ */ t(x, { height: "calc(100dvh - 150px)", overflow: "scroll", width: "100%", children: /* @__PURE__ */ t(kt, {}) })
625
+ }
626
+ );
627
+ }, Do = D($t);
628
+ export {
629
+ xo as SpendingMiniWidget,
630
+ Do as SpendingWidget
631
+ };
632
+ //# sourceMappingURL=index.es.js.map