@mx-cartographer/experiences 6.26.18-alpha.mega4 → 6.26.18-alpha.sms1

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 (97) hide show
  1. package/dist/common/context/hooks.d.ts +13 -13
  2. package/dist/help/components/content/section/index.d.ts +15 -15
  3. package/dist/index.d.ts +22 -0
  4. package/dist/index.es.js +30335 -0
  5. package/dist/index.es.js.map +1 -0
  6. package/package.json +3 -155
  7. package/dist/Account-DM32_5k9.mjs +0 -30
  8. package/dist/AccountDetailsContent-B_qRSB8l.mjs +0 -677
  9. package/dist/AccountDetailsHeader-CAm6ADMq.mjs +0 -119
  10. package/dist/AccountFields-Bb4pds0q.mjs +0 -135
  11. package/dist/AccountListItem-G7iAesaO.mjs +0 -90
  12. package/dist/AccountStore-RSanus_m.mjs +0 -230
  13. package/dist/Accounts-BfAQRG8R.mjs +0 -9
  14. package/dist/BeatApi-DLu87ijw.mjs +0 -21
  15. package/dist/BeatStore-By4aGoRM.mjs +0 -81
  16. package/dist/BudgetUtil-DcqclhiQ.mjs +0 -101
  17. package/dist/CashflowStore-D9Dpuz7X.mjs +0 -91
  18. package/dist/Category-5S6uwuXz.mjs +0 -301
  19. package/dist/CategorySelectorDrawer-DgrePTRg.mjs +0 -397
  20. package/dist/CategoryStore-B5EW6I1d.mjs +0 -183
  21. package/dist/CategoryUtil-DRyruNgi.mjs +0 -78
  22. package/dist/ConnectDrawer-DPnfeIfn.mjs +0 -508
  23. package/dist/ConnectionsDrawer-BCzpuNsK.mjs +0 -52
  24. package/dist/CurrencyInput-DzsPiUsU.mjs +0 -83
  25. package/dist/CurrencyText-YUhH2caW.mjs +0 -20
  26. package/dist/DateUtil-BcuH7ErC.mjs +0 -48
  27. package/dist/DebtsStore-C6VcBnpG.mjs +0 -60
  28. package/dist/Dialog-CWW597AF.mjs +0 -123
  29. package/dist/Donut-1UMNcG67.mjs +0 -57
  30. package/dist/Drawer-kEE73B87.mjs +0 -113
  31. package/dist/EmptyState-Dcb-o2tl.mjs +0 -55
  32. package/dist/Fetch-CkFKy79O.mjs +0 -116
  33. package/dist/FinstrongStore-mkALvztw.mjs +0 -101
  34. package/dist/GoalStore-DyCr4wNc.mjs +0 -263
  35. package/dist/HeaderCell-DjuifqHJ.mjs +0 -6
  36. package/dist/Help-DhcC-C05.mjs +0 -320
  37. package/dist/Help-toqAK5eD.mjs +0 -3173
  38. package/dist/IconBacking-B9oC6uL2.mjs +0 -39
  39. package/dist/InvestmentUtil-jOyOgzIB.mjs +0 -134
  40. package/dist/LineChart-CQWu5KoO.mjs +0 -403
  41. package/dist/ListItemAction-Df3OPMOW.mjs +0 -69
  42. package/dist/Loader-Dp1P2gNw.mjs +0 -14
  43. package/dist/Localization-2MODESHW.mjs +0 -30
  44. package/dist/ManageIncome-BVt_XQbo.mjs +0 -535
  45. package/dist/MerchantStore-DVH-QOf0.mjs +0 -37
  46. package/dist/MicroWidgetContainer-DaLW43tE.mjs +0 -45
  47. package/dist/MiniWidgetContainer-BcNPxZt2.mjs +0 -39
  48. package/dist/NetWorthStore-DE8CQBMM.mjs +0 -150
  49. package/dist/Notification-AMGWM1Al.mjs +0 -78
  50. package/dist/NotificationSettings-CPZN0l8X.mjs +0 -667
  51. package/dist/NotificationStore-DHtSGySy.mjs +0 -67
  52. package/dist/NumberFormatting-CtWHhyBX.mjs +0 -40
  53. package/dist/OriginalBalanceAction-s9sUxofR.mjs +0 -115
  54. package/dist/RecurringSettings-DIEsympT.mjs +0 -57
  55. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +0 -263
  56. package/dist/RepeatingTransaction-BPWfaB3f.mjs +0 -282
  57. package/dist/SearchBox-B2_zLv8-.mjs +0 -42
  58. package/dist/SettingsStore-CE7jDVFL.mjs +0 -265
  59. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +0 -69
  60. package/dist/SpendingData-ByFCw95X.mjs +0 -53
  61. package/dist/StatusBar-BK_uYHAB.mjs +0 -30
  62. package/dist/TabContentContainer-j01JYR_7.mjs +0 -21
  63. package/dist/Transaction-C-5-Iuab.mjs +0 -312
  64. package/dist/TransactionApi-DbbcjI2L.mjs +0 -86
  65. package/dist/TransactionDetails-B5qfs9Zh.mjs +0 -1283
  66. package/dist/TransactionStore-BWi6_2Ny.mjs +0 -669
  67. package/dist/TrendsStore-Borh98aN.mjs +0 -448
  68. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +0 -1959
  69. package/dist/WidgetContainer-CmGNZW0M.mjs +0 -548
  70. package/dist/accounts/index.es.js +0 -752
  71. package/dist/analytics/index.es.js +0 -171
  72. package/dist/budgets/index.es.js +0 -1070
  73. package/dist/cashflow/index.es.js +0 -1098
  74. package/dist/categories/index.es.js +0 -9
  75. package/dist/common/index.es.js +0 -1451
  76. package/dist/dashboard/index.es.js +0 -181
  77. package/dist/debts/index.es.js +0 -1460
  78. package/dist/exportTransactionsToCSV-j4g8bdVZ.mjs +0 -47
  79. package/dist/finstrong/index.es.js +0 -1455
  80. package/dist/goals/index.es.js +0 -1209
  81. package/dist/help/index.es.js +0 -14
  82. package/dist/hooks-ClhFlg78.mjs +0 -71
  83. package/dist/insights/index.d.ts +0 -1
  84. package/dist/insights/index.es.js +0 -4
  85. package/dist/investments/index.es.js +0 -1638
  86. package/dist/merchants/index.es.js +0 -79
  87. package/dist/microinsights/index.es.js +0 -16
  88. package/dist/networth/index.es.js +0 -542
  89. package/dist/notifications/index.es.js +0 -192
  90. package/dist/recurringtransactions/index.es.js +0 -879
  91. package/dist/settings/index.es.js +0 -879
  92. package/dist/spending/index.es.js +0 -570
  93. package/dist/transactions/index.es.js +0 -587
  94. package/dist/trends/index.es.js +0 -1103
  95. package/dist/useCombineEvents-DaDBSR_1.mjs +0 -92
  96. package/dist/useDimensions-27p2evRx.mjs +0 -36
  97. package/dist/useScreenSize-B6JyS_Lj.mjs +0 -36
@@ -1,1070 +0,0 @@
1
- import { jsx as e, jsxs as d, Fragment as ke } from "react/jsx-runtime";
2
- import l from "react";
3
- import { observer as I } from "mobx-react-lite";
4
- import { endOfMonth as Me } from "date-fns/endOfMonth";
5
- import { startOfMonth as ye } from "date-fns/startOfMonth";
6
- import W from "@mui/material/Box";
7
- import b from "@mui/material/Stack";
8
- import q from "@mui/material/styles/useTheme";
9
- import { Icon as $, Text as p, CategoryIcon as H, H1 as $e, H3 as fe } from "@mxenabled/mxui";
10
- import { u as Ge } from "../BudgetUtil-DcqclhiQ.mjs";
11
- import { C as Pe } from "../ConnectionsDrawer-BCzpuNsK.mjs";
12
- import * as E from "d3";
13
- import Ne from "@mui/material/Tooltip";
14
- import { e as w, k as j, u as D, g as X, a as J, p as je, f as Q, n as ee, j as ze, c as Ce } from "../hooks-ClhFlg78.mjs";
15
- import { L as P } from "../Loader-Dp1P2gNw.mjs";
16
- import { E as se } from "../EmptyState-Dcb-o2tl.mjs";
17
- import { u as le } from "../useScreenSize-B6JyS_Lj.mjs";
18
- import { A as k, W as Ue } from "../WidgetContainer-CmGNZW0M.mjs";
19
- import K from "@mui/material/List";
20
- import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
21
- import Be from "@mui/material/Button";
22
- import te from "@mui/material/Divider";
23
- import V from "@mui/material/ListItem";
24
- import ne from "@mui/material/ListItemAvatar";
25
- import Y from "@mui/material/ListItemButton";
26
- import Z from "@mui/material/ListItemText";
27
- import { b as L } from "../Localization-2MODESHW.mjs";
28
- import { D as M } from "../Drawer-kEE73B87.mjs";
29
- import Fe from "@mui/material/ListItemSecondaryAction";
30
- import { C as We } from "../CurrencyInput-DzsPiUsU.mjs";
31
- import { a as N } from "../Dialog-CWW597AF.mjs";
32
- import { M as He } from "../MiniWidgetContainer-BcNPxZt2.mjs";
33
- import { isAfter as Xe } from "date-fns/isAfter";
34
- import Ke from "@mui/material/Alert";
35
- import Ve from "@mui/material/Snackbar";
36
- import pe from "@mui/material/Tab";
37
- import Ye from "@mui/material/Tabs";
38
- import { e as Ze } from "../exportTransactionsToCSV-j4g8bdVZ.mjs";
39
- import { T as Se, a as qe } from "../TransactionDetails-B5qfs9Zh.mjs";
40
- import de from "@mui/material/Card";
41
- import ue from "@mui/material/CardContent";
42
- import { S as ce } from "../StatusBar-BK_uYHAB.mjs";
43
- import { S as Ae } from "../SingleSegmentDonut-BgbLgwHi.mjs";
44
- import { u as Je, b as Qe } from "../CategorySelectorDrawer-DgrePTRg.mjs";
45
- import xe from "@mui/material/CardHeader";
46
- import { subDays as et } from "date-fns/subDays";
47
- import tt from "@mui/material/IconButton";
48
- import { M as nt } from "../ManageIncome-BVt_XQbo.mjs";
49
- const he = 5, ot = 100, at = 25, rt = (t) => {
50
- const o = (a) => {
51
- a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
52
- }, i = (a) => {
53
- a.subject.fx = a.x, a.subject.fy = a.y;
54
- }, s = (a) => {
55
- a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
56
- };
57
- return E.drag().on("start", o).on("drag", i).on("end", s);
58
- }, st = (t) => {
59
- let o = t.transaction_total / t.amount;
60
- o < 0 ? o = 0 : o > 1 && (o = 1);
61
- const i = o * 2 * Math.PI, s = E.interpolate(0, i), a = E.arc().cornerRadius(5).innerRadius(t.radius - he * 2).outerRadius(t.radius - he).startAngle(0).endAngle(0);
62
- return (n) => (a.endAngle(s(n)), a(t) || "");
63
- }, it = (t) => {
64
- E.selectAll(".bubble").call(rt(t));
65
- }, ct = (t, o, i) => {
66
- t.alpha(1).restart().force(
67
- "x",
68
- E.forceX().x(i / 2).strength(0.01)
69
- ).force(
70
- "y",
71
- E.forceY().y(o / 2).strength(0.01)
72
- );
73
- }, lt = (t, o) => E.scaleLinear().domain([t, o]).range([at, ot]), dt = (t) => {
74
- const o = t.reduce((n, r) => {
75
- const c = Math.max(r.transaction_total, r.amount);
76
- return c > n ? c : n;
77
- }, 0), i = t.reduce((n, r) => {
78
- const c = Math.max(r.transaction_total, r.amount);
79
- return c < n ? c : n;
80
- }, o), s = lt(i, o), a = t.map((n) => {
81
- const r = s(Math.max(n.transaction_total, n.amount)) || 25;
82
- return {
83
- ...n,
84
- radius: r
85
- };
86
- });
87
- return E.forceSimulation(a).velocityDecay(0.05).force("collide", E.forceCollide((n) => n.radius + 2).strength(0.5)).on("tick", () => {
88
- E.selectAll(".bubble").data(a).attr("transform", (n) => `translate(${n.x},${n.y})`);
89
- });
90
- }, _e = 5, ut = 2e3;
91
- function mt({ bubble: t }) {
92
- const o = q(), {
93
- guid: i,
94
- budgetColors: { mercury: s },
95
- radius: a
96
- } = t, n = `mercury-${i}`;
97
- l.useEffect(() => {
98
- E.select(`.${n}`).selectAll(".status").remove(), E.select(`.${n}`).append("path").transition().duration(ut).delay(0).attr("class", "status").attr("style", `fill: ${s}; fill-opacity: 1;`).attrTween("d", () => st(t));
99
- }, [t]);
100
- const r = E.arc().innerRadius((c) => c - 2 * _e).outerRadius((c) => c - _e).startAngle(0).endAngle(2 * Math.PI);
101
- return /* @__PURE__ */ e("g", { className: n, children: /* @__PURE__ */ e(
102
- "path",
103
- {
104
- d: r(a) || "",
105
- style: { fill: o.palette.common.white, fillOpacity: 0.35 }
106
- }
107
- ) });
108
- }
109
- const G = 75, ie = 50;
110
- function gt({ bubble: t, isDraggable: o, onClick: i = () => {
111
- } }) {
112
- const [s, a] = l.useState(!1);
113
- if (!t) return;
114
- const {
115
- budgetColors: { background: n, text: r },
116
- category: { icon: c, name: y },
117
- guid: h,
118
- description: m,
119
- radius: g,
120
- x: f,
121
- y: _
122
- } = t;
123
- let u = -12, C = -12;
124
- g > G ? (u = -14, C = -45) : g > ie && (C = -32);
125
- const B = `${t.category.name}: ${m}`, A = {
126
- modifiers: [
127
- {
128
- name: "offset",
129
- options: { offset: [0, 15] }
130
- }
131
- ]
132
- };
133
- return /* @__PURE__ */ d(
134
- "g",
135
- {
136
- className: "bubble",
137
- id: `bubble-${h}`,
138
- onClick: () => i(t),
139
- onMouseEnter: () => a(!0),
140
- onMouseLeave: () => a(!1),
141
- style: { cursor: o ? "pointer" : "default" },
142
- textAnchor: "middle",
143
- x: f,
144
- y: _,
145
- children: [
146
- /* @__PURE__ */ e(
147
- Ne,
148
- {
149
- followCursor: !0,
150
- open: s,
151
- slotProps: { popper: A },
152
- title: B,
153
- children: /* @__PURE__ */ e("circle", { fill: n, id: `circle-${h}`, r: g })
154
- }
155
- ),
156
- /* @__PURE__ */ e("svg", { x: u, y: C, children: /* @__PURE__ */ e($, { name: c, size: g <= G ? 24 : 32, sx: { fill: r } }) }),
157
- g > G && /* @__PURE__ */ e(
158
- p,
159
- {
160
- bold: !0,
161
- component: "text",
162
- id: `budget-category-${h}`,
163
- sx: { fill: r },
164
- variant: "Small",
165
- y: 4,
166
- children: y
167
- }
168
- ),
169
- g > ie && /* @__PURE__ */ e(
170
- p,
171
- {
172
- bold: !0,
173
- component: "text",
174
- id: `budget-description-${h}-1`,
175
- sx: { fill: r },
176
- variant: "Body",
177
- y: g <= G ? 12 : 24,
178
- children: g <= G ? m.split(" ")[0] : m
179
- }
180
- ),
181
- g <= G && g > ie && /* @__PURE__ */ e(
182
- p,
183
- {
184
- component: "text",
185
- id: `budget-description-${h}-2`,
186
- sx: { fill: r },
187
- variant: "XSmall",
188
- y: 28,
189
- children: m.split(" ")[1]
190
- }
191
- ),
192
- /* @__PURE__ */ e(mt, { bubble: t })
193
- ]
194
- },
195
- h
196
- );
197
- }
198
- let F;
199
- const pt = ({
200
- height: t,
201
- width: o,
202
- isDraggable: i = !1,
203
- onClick: s = () => {
204
- }
205
- }) => {
206
- const { detailedBudgets: a } = w();
207
- return F = l.useMemo(() => dt(a), [a]), l.useEffect(() => {
208
- ct(F, t, o), i && it(F);
209
- }, [F, t, o]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: F.nodes().map((n) => /* @__PURE__ */ e(gt, { bubble: n, isDraggable: i, onClick: s }, n.guid)) });
210
- }, ht = I(pt), _t = ({
211
- isMiniWidget: t = !1,
212
- onConnectAccountsClick: o,
213
- createBudgetOnClick: i
214
- }) => {
215
- const { recalculateBudgets: s } = w(), { spendCategories: a } = j(), { budgets: n } = D(), [r, c] = l.useState(!1), [y, h] = l.useState(!1), [m, g] = l.useState(!1), f = l.useMemo(() => [...a.filter((u) => u.totalAverageAmount > 0)], [a]), _ = async () => {
216
- g(!0);
217
- const { data: u, isSuccess: C } = await s(f);
218
- g(!1), C ? (u.length === 0 && c(!0), h(!1)) : h(!0);
219
- };
220
- return m ? /* @__PURE__ */ e(P, {}) : y ? /* @__PURE__ */ e(
221
- se,
222
- {
223
- header: n.autogenerate_budgets_error_header,
224
- icon: "error",
225
- iconColor: "#4D4D4D",
226
- onClick: (u) => {
227
- u === "primary" ? _() : i();
228
- },
229
- primaryButton: n.autogenerate_budgets_error_primary_button,
230
- secondaryButton: n.zero_state_generate_budgets_secondary_button,
231
- subText: n.autogenerate_budgets_error_subheader,
232
- sx: {
233
- width: { sm: 468 },
234
- ".buttons-footer": {
235
- width: 208
236
- }
237
- }
238
- }
239
- ) : /* @__PURE__ */ e(ke, { children: r ? /* @__PURE__ */ e(
240
- se,
241
- {
242
- header: n.zero_state_generate_budgets_header,
243
- icon: "error",
244
- iconColor: "#4D4D4D",
245
- onClick: (u) => {
246
- u === "primary" ? o() : i();
247
- },
248
- primaryButton: n.zero_state_generate_budgets_primary_button,
249
- secondaryButton: n.zero_state_generate_budgets_secondary_button,
250
- subText: n.zero_state_generate_budgets_subheader,
251
- sx: {
252
- width: t ? "100%" : { sm: 500 },
253
- height: t ? "100%" : { sm: 468 },
254
- mt: 50,
255
- ".buttons-footer": {
256
- width: 208,
257
- height: 100
258
- },
259
- padding: t ? 5 : 0
260
- }
261
- }
262
- ) : /* @__PURE__ */ e(
263
- se,
264
- {
265
- header: n.create_budgets_title,
266
- icon: "bubble_chart",
267
- iconColor: "#1A1A1A",
268
- onClick: (u) => {
269
- u === "primary" ? _() : i();
270
- },
271
- primaryButton: n.empty_state_primary_button,
272
- secondaryButton: t ? void 0 : n.empty_state_secondary_button,
273
- subText: n.empty_state_subheader,
274
- sx: {
275
- width: t ? "100%" : { sm: 432 },
276
- height: t ? "100%" : { sm: 468 },
277
- mt: 50,
278
- ".buttons-footer": {
279
- width: 208,
280
- height: 100
281
- },
282
- padding: t ? 4 : 0
283
- }
284
- }
285
- ) });
286
- }, ve = I(
287
- ({
288
- createBudgetOnClick: t = () => {
289
- },
290
- height: o,
291
- isDraggable: i = !1,
292
- isMiniWidget: s = !1,
293
- shouldShowZeroState: a,
294
- unavailableWidth: n = 24
295
- }) => {
296
- const { onEvent: r } = X(), { setSelectedBudget: c } = w(), { isLoadingCategoryTotals: y } = j(), { isInitialized: h } = J(), { accounts: m } = D(), { availableWidth: g } = je(), { isMobile: f } = le(), [_, u] = l.useState(!1), C = l.useMemo(() => g - n, [g]), B = (x) => {
297
- c(x), r(k.BUDGETS_CLICK_BUDGET_CATEGORY, {
298
- budget_category: x.category.name,
299
- click_type: "bubble"
300
- });
301
- }, A = () => {
302
- u(!0), r(k.ACCOUNTS_CLICK_CONNECT);
303
- };
304
- return y ? /* @__PURE__ */ e(b, { alignItems: "center", height: o, justifyContent: "center", width: Math.abs(C), children: /* @__PURE__ */ e(P, {}) }) : /* @__PURE__ */ d(W, { ml: a || f ? 0 : 24, sx: { alignSelf: "center" }, children: [
305
- a || !h ? /* @__PURE__ */ e(
306
- _t,
307
- {
308
- createBudgetOnClick: t,
309
- isMiniWidget: s,
310
- onConnectAccountsClick: A
311
- }
312
- ) : /* @__PURE__ */ e(
313
- ht,
314
- {
315
- height: o,
316
- isDraggable: i,
317
- onClick: B,
318
- width: C
319
- }
320
- ),
321
- /* @__PURE__ */ e(
322
- Pe,
323
- {
324
- onClose: () => u(!1),
325
- showConnectionsWidget: _,
326
- title: m.manage_connections
327
- }
328
- )
329
- ] });
330
- }
331
- ), bt = I(() => {
332
- const { budgets: t } = D(), { totalBudgeted: o } = w(), { incomeTotal: i } = Q(), s = i - o;
333
- return /* @__PURE__ */ d(b, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
334
- /* @__PURE__ */ d(b, { alignItems: "center", children: [
335
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: T(i, "0,0") }),
336
- /* @__PURE__ */ e(p, { color: "secondary", variant: "Small", children: t.projected_income })
337
- ] }),
338
- /* @__PURE__ */ e(p, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
339
- /* @__PURE__ */ d(b, { alignItems: "center", children: [
340
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: T(o, "0,0") }),
341
- /* @__PURE__ */ e(p, { color: "secondary", variant: "Small", children: t.budgeted })
342
- ] }),
343
- /* @__PURE__ */ e(p, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
344
- /* @__PURE__ */ d(b, { alignItems: "center", children: [
345
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: T(s, "0,0") }),
346
- /* @__PURE__ */ e(p, { color: "secondary", variant: "Small", children: t.remaining })
347
- ] })
348
- ] });
349
- }), yt = I(
350
- ({ category: t }) => {
351
- const { budgets: o } = D(), { budgets: i } = w(), s = l.useMemo(() => {
352
- const a = i.find((c) => c.category_guid === t.guid), n = T(t.totalAverageAmount, "0,0"), r = a ? L(o.recalculate_previous_budget, T(a.amount, "0,0")) : o.recalculate_new_budget;
353
- return `${n} - ${r}`;
354
- }, [o, i]);
355
- return /* @__PURE__ */ d(l.Fragment, { children: [
356
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { children: [
357
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid, variant: "filled" }) }),
358
- /* @__PURE__ */ e(Z, { primary: t.name, secondary: s })
359
- ] }) }),
360
- /* @__PURE__ */ e(te, {})
361
- ] }, t.guid);
362
- }
363
- ), ft = ({ onRecalculateBudgets: t }) => {
364
- const { budgets: o, common: i } = D(), { spendCategories: s } = j(), { recalculateBudgets: a, setAlert: n } = w(), [r, c] = l.useState(!1), y = s.filter((m) => m.totalAverageAmount > 0), h = async () => {
365
- await a(y), c(!1), n(o.alert_recalculated_budgets), t?.();
366
- };
367
- return /* @__PURE__ */ d(l.Fragment, { children: [
368
- /* @__PURE__ */ e(Be, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: o.recalculate_button }),
369
- /* @__PURE__ */ e(p, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: o.recalculate_help }),
370
- /* @__PURE__ */ e(
371
- M,
372
- {
373
- ariaLabelClose: i.close_aria,
374
- isOpen: r,
375
- onClose: () => c(!1),
376
- onPrimaryAction: h,
377
- title: o.recalculate_title,
378
- children: /* @__PURE__ */ d(b, { children: [
379
- /* @__PURE__ */ d(b, { mx: 24, my: 16, children: [
380
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: o.recalculate_description_top }),
381
- /* @__PURE__ */ e(p, { variant: "ParagraphSmall", children: o.recalculate_description_bottom })
382
- ] }),
383
- /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: y.map((m) => /* @__PURE__ */ e(yt, { category: m }, m.guid)) }) })
384
- ] })
385
- }
386
- )
387
- ] });
388
- }, oe = ({
389
- amount: t,
390
- categoryName: o,
391
- onAmountChanged: i
392
- }) => {
393
- const { budgets: s } = D(), { totalBudgeted: a } = w(), { incomeTotal: n } = Q(), r = n - a;
394
- return /* @__PURE__ */ d(b, { gap: 16, children: [
395
- /* @__PURE__ */ d(b, { children: [
396
- /* @__PURE__ */ e(p, { children: L(
397
- s.add_description_top,
398
- T(r, "0,0")
399
- ) }),
400
- /* @__PURE__ */ e(p, { children: L(s.add_description_bottom, o) })
401
- ] }),
402
- /* @__PURE__ */ e(
403
- We,
404
- {
405
- amount: t,
406
- autoFocus: !0,
407
- label: s.add_label,
408
- minAmount: 0,
409
- setAmount: i,
410
- sx: { ".MuiTypography-Body": { p: 0 } }
411
- }
412
- )
413
- ] });
414
- }, Ct = I(({ category: t, onAddBudget: o }) => {
415
- const { budgets: i, common: s } = D(), [a, n] = l.useState(!1), [r, c] = l.useState(
416
- `${t.totalAmount === 0 ? "" : t.totalAmount}`
417
- );
418
- return /* @__PURE__ */ d(l.Fragment, { children: [
419
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { onClick: () => n(!0), children: [
420
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid }) }),
421
- /* @__PURE__ */ e(
422
- Z,
423
- {
424
- primary: t.name,
425
- secondary: T(t.totalAmount, "0,0")
426
- }
427
- ),
428
- /* @__PURE__ */ e(Fe, { children: /* @__PURE__ */ e($, { name: "add", size: 20 }) })
429
- ] }) }, t.guid),
430
- /* @__PURE__ */ e(
431
- N,
432
- {
433
- copy: { close_aria: s.close_aria, title: i.add_title },
434
- disablePrimaryButton: Number(r) <= 0,
435
- isOpen: a,
436
- onClose: () => n(!1),
437
- onPrimaryAction: () => o(t, Number(r)),
438
- primaryText: i.add_save_button,
439
- children: /* @__PURE__ */ e(oe, { amount: r, categoryName: t.name, onAmountChanged: c })
440
- }
441
- )
442
- ] });
443
- }), Te = I(({ onRecalculateBudgets: t }) => {
444
- const { budgets: o } = D(), { addBudget: i, setAlert: s, unbudgetedCategories: a } = w(), n = async (r, c) => {
445
- await i(r, c), s(L(o.alert_budget_created, r.name));
446
- };
447
- return /* @__PURE__ */ d(b, { children: [
448
- /* @__PURE__ */ e(bt, {}),
449
- /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: a.map((r) => /* @__PURE__ */ e(
450
- Ct,
451
- {
452
- category: r,
453
- onAddBudget: n
454
- },
455
- r.guid
456
- )) }) }),
457
- /* @__PURE__ */ e(ft, { onRecalculateBudgets: t })
458
- ] });
459
- }), Bt = (t) => {
460
- const o = q(), { onEvent: i } = X(), { detailedBudgets: s, isDataLoaded: a, loadBudgetData: n, setTheme: r } = w(), { budgets: c, common: y } = D(), { isCopyLoaded: h, isInitialized: m, selectedAccounts: g } = J(), { reloadCategoryTotals: f } = j(), _ = Ge(), u = s.length === 0, [C, B] = l.useState(!1), A = () => {
461
- B(!0), i(k.BUDGETS_CLICK_ADD);
462
- }, x = () => {
463
- B(!1);
464
- };
465
- return l.useEffect(() => {
466
- r(o);
467
- }, [o]), l.useEffect(() => {
468
- m && !a && f(g, ye(/* @__PURE__ */ new Date()), Me(/* @__PURE__ */ new Date())).then(
469
- () => {
470
- n().finally();
471
- }
472
- );
473
- }, [m, g]), h ? /* @__PURE__ */ d(
474
- He,
475
- {
476
- primaryCtaLabel: u ? c.get_started_cta : c.details_cta,
477
- title: c.budgets_title,
478
- ...t,
479
- children: [
480
- a ? /* @__PURE__ */ d(b, { height: 450, mt: 32, children: [
481
- /* @__PURE__ */ e(
482
- ve,
483
- {
484
- createBudgetOnClick: A,
485
- height: 370,
486
- isMiniWidget: !0,
487
- shouldShowZeroState: u
488
- }
489
- ),
490
- !u && /* @__PURE__ */ d(W, { ml: 16, children: [
491
- /* @__PURE__ */ e(p, { bold: !0, color: _ < 0 ? "error.main" : "success.main", children: T(Math.abs(_), "0,0") }),
492
- /* @__PURE__ */ e(p, { children: _ < 0 ? c.overspent_in_budgets : c.left_in_budgets })
493
- ] })
494
- ] }) : /* @__PURE__ */ e(P, {}),
495
- /* @__PURE__ */ e(
496
- M,
497
- {
498
- ariaLabelClose: y.close_aria,
499
- isOpen: C,
500
- onClose: () => B(!1),
501
- title: c.add_new_title,
502
- children: /* @__PURE__ */ e(Te, { onRecalculateBudgets: x })
503
- }
504
- )
505
- ]
506
- }
507
- ) : /* @__PURE__ */ e(P, {});
508
- }, vn = I(Bt), we = ({ budget: t }) => {
509
- const {
510
- amount: o,
511
- budgetColors: { background: i },
512
- category: { name: s },
513
- category_guid: a,
514
- percentage: n,
515
- transaction_total: r
516
- } = t, c = [
517
- {
518
- color: i,
519
- percentage: `${n}%`
520
- }
521
- ];
522
- return /* @__PURE__ */ e(de, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ d(b, { alignItems: "center", gap: 16, children: [
523
- /* @__PURE__ */ e(H, { categoryGuid: a, size: 56 }),
524
- /* @__PURE__ */ e($e, { children: `${T(r, "0,0")} / ${T(o, "0,0")}` }),
525
- /* @__PURE__ */ e(p, { bold: !0, variant: "XSmall", children: s }),
526
- /* @__PURE__ */ e(ce, { data: c, height: 10 })
527
- ] }) }) });
528
- }, St = I(() => {
529
- const { budgets: t } = D();
530
- return /* @__PURE__ */ d(b, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
531
- /* @__PURE__ */ e($, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
532
- /* @__PURE__ */ e(p, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
533
- /* @__PURE__ */ e(p, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
534
- ] });
535
- }), At = I(({ budget: t }) => {
536
- const {
537
- amount: o,
538
- budgetColors: { background: i },
539
- category: s,
540
- percentage: a,
541
- transaction_total: n
542
- } = t, { setSelectedSubBudget: r } = w();
543
- return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { onClick: () => r(t), children: [
544
- /* @__PURE__ */ e(ne, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ae, { color: i, percent: a, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
545
- /* @__PURE__ */ e(
546
- Z,
547
- {
548
- primary: /* @__PURE__ */ e(b, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: t.category.name }) }),
549
- secondary: /* @__PURE__ */ e(b, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(p, { fontWeight: 400, variant: "Body", children: `
550
- ${T(n, "0,0")} /
551
- ${T(o, "0,0")}
552
- ` }) })
553
- }
554
- )
555
- ] }) });
556
- }), xt = I(({ category: t, parentBudget: o }) => {
557
- const { budgets: i, common: s } = D(), { setExpandedGuid: a, setOnSelect: n } = Je(), { addBudget: r } = w(), [c, y] = l.useState(!1), [h, m] = l.useState(!1), [g, f] = l.useState(""), [_, u] = l.useState(void 0);
558
- l.useEffect(() => {
559
- n((A) => {
560
- const x = t.subCategories.find((v) => v.guid === A);
561
- x && (u(x), f(`${x.currentAmount === 0 ? "" : x.currentAmount}`), m(!0));
562
- });
563
- }, []);
564
- const C = () => {
565
- a(t.guid), y(!0);
566
- }, B = async () => {
567
- _ && Number(g) > 0 && (await r(_, Number(g), o.guid), m(!1), y(!1), u(void 0));
568
- };
569
- return /* @__PURE__ */ d(W, { children: [
570
- /* @__PURE__ */ e(V, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Y, { onClick: C, children: /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ d(b, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
571
- /* @__PURE__ */ d(b, { alignItems: "center", direction: "row", gap: 8, children: [
572
- /* @__PURE__ */ e($, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
573
- /* @__PURE__ */ e(p, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
574
- ] }),
575
- /* @__PURE__ */ e($, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
576
- ] }) }) }) }),
577
- /* @__PURE__ */ e(te, {}),
578
- /* @__PURE__ */ e(
579
- M,
580
- {
581
- ariaLabelClose: s.close_aria,
582
- isOpen: c,
583
- onClose: () => y(!1),
584
- title: i.add_sub_budget_title,
585
- children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(Qe, { category: t, subCategories: t.subCategories }) })
586
- }
587
- ),
588
- /* @__PURE__ */ e(
589
- N,
590
- {
591
- copy: { close_aria: s.close_aria, title: i.add_title },
592
- disablePrimaryButton: Number(g) <= 0,
593
- isOpen: h,
594
- onClose: () => m(!1),
595
- onPrimaryAction: B,
596
- primaryText: i.add_save_button,
597
- children: /* @__PURE__ */ e(
598
- oe,
599
- {
600
- amount: g,
601
- categoryName: _?.name || "",
602
- onAmountChanged: f
603
- }
604
- )
605
- }
606
- )
607
- ] });
608
- }), vt = I(({ budget: t }) => {
609
- const { category: o, subBudgets: i } = t, { budgets: s, common: a } = D(), { deleteBudget: n, selectedSubBudget: r, setSelectedSubBudget: c, updateBudget: y } = w(), { filter: h, setFilter: m } = ee(), [g, f] = l.useState(!1), [_, u] = l.useState(!1), [C, B] = l.useState("");
610
- l.useEffect(() => {
611
- r && (B(`${r.amount}`), m({
612
- ...h,
613
- custom: (S) => S.category_guid === r.category_guid
614
- }));
615
- }, [r]);
616
- const A = async () => {
617
- r && await y({
618
- ...r,
619
- amount: Number(C)
620
- });
621
- }, x = async () => {
622
- r && await n(r.guid), u(!1), v();
623
- }, v = () => {
624
- m({
625
- ...h,
626
- custom: (S) => S.category_guid === t.category_guid || S.top_level_category_guid === t.category_guid
627
- }), c(void 0);
628
- };
629
- return /* @__PURE__ */ d(l.Fragment, { children: [
630
- /* @__PURE__ */ d(K, { sx: { bgcolor: "background.paper" }, children: [
631
- i.length === 0 ? /* @__PURE__ */ e(St, {}) : i.map((S) => /* @__PURE__ */ d(l.Fragment, { children: [
632
- /* @__PURE__ */ e(At, { budget: S }),
633
- /* @__PURE__ */ e(te, {})
634
- ] }, S.guid)),
635
- /* @__PURE__ */ e(xt, { category: o, parentBudget: t })
636
- ] }),
637
- /* @__PURE__ */ e(
638
- M,
639
- {
640
- ariaLabelClose: a.close_aria,
641
- isOpen: !!r,
642
- onClose: v,
643
- onPrimaryAction: () => f(!0),
644
- onSecondaryAction: () => u(!0),
645
- primaryText: s.details_edit_button,
646
- secondaryText: s.details_delete_button,
647
- title: s.details_title,
648
- children: r && /* @__PURE__ */ d(b, { gap: 24, children: [
649
- /* @__PURE__ */ e(we, { budget: r }),
650
- /* @__PURE__ */ e(Se, { height: "100%" })
651
- ] })
652
- }
653
- ),
654
- r && /* @__PURE__ */ d(l.Fragment, { children: [
655
- /* @__PURE__ */ e(
656
- N,
657
- {
658
- copy: { close_aria: a.close_aria, title: s.details_edit_title },
659
- disablePrimaryButton: Number(C) <= 0,
660
- isOpen: g,
661
- onClose: () => f(!1),
662
- onPrimaryAction: A,
663
- primaryText: s.edit_save_button,
664
- children: /* @__PURE__ */ e(
665
- oe,
666
- {
667
- amount: C,
668
- categoryName: r.category.name,
669
- onAmountChanged: B
670
- }
671
- )
672
- }
673
- ),
674
- /* @__PURE__ */ e(
675
- N,
676
- {
677
- copy: { close_aria: a.close_aria, title: s.delete_title },
678
- isOpen: _,
679
- onClose: () => u(!1),
680
- onPrimaryAction: x,
681
- primaryColor: "error",
682
- primaryText: "Delete",
683
- secondaryColor: "secondary",
684
- children: /* @__PURE__ */ e(p, { variant: "Paragraph", children: L(s.delete_description, r.category.name) })
685
- }
686
- )
687
- ] })
688
- ] });
689
- }), Tt = I(({ budget: t }) => {
690
- const { is_mobile_webview: o } = ze(), { setAlert: i } = w(), { budgets: s, common: a, transactions: n } = D(), { isDesktop: r } = le(), {
691
- sortedTransactions: c,
692
- sortedTransactionsWithSplits: y,
693
- tags: h
694
- } = ee(), [m, g] = l.useState(0), [f, _] = l.useState(""), u = l.useMemo(
695
- () => c.find((x) => x.guid === f),
696
- [f, c]
697
- ), C = (x, v) => {
698
- g(v);
699
- }, B = () => {
700
- Ze(y, h), i(s.alert_csv_downloaded);
701
- }, A = c.length > 0 && !o && r;
702
- return /* @__PURE__ */ d(b, { gap: 24, children: [
703
- /* @__PURE__ */ e(we, { budget: t }),
704
- /* @__PURE__ */ d(b, { children: [
705
- /* @__PURE__ */ d(
706
- Ye,
707
- {
708
- onChange: C,
709
- sx: { width: "100%" },
710
- textColor: "primary",
711
- value: m,
712
- variant: "fullWidth",
713
- children: [
714
- /* @__PURE__ */ e(pe, { label: s.details_transactions_tab }),
715
- /* @__PURE__ */ e(pe, { label: s.details_subbudgets_tab })
716
- ]
717
- }
718
- ),
719
- m === 0 && /* @__PURE__ */ d(b, { children: [
720
- A && /* @__PURE__ */ e(b, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
721
- Be,
722
- {
723
- onClick: B,
724
- startIcon: /* @__PURE__ */ e($, { name: "ios_share" }),
725
- variant: "text",
726
- children: n.export_csv_btn
727
- }
728
- ) }),
729
- /* @__PURE__ */ e(Se, { height: "100%", onClick: _ })
730
- ] }),
731
- m === 1 && /* @__PURE__ */ e(vt, { budget: t }),
732
- /* @__PURE__ */ e(
733
- M,
734
- {
735
- ariaLabelClose: a.close_aria,
736
- isOpen: !!u,
737
- onClose: () => _(""),
738
- title: s.details_transaction_drawer,
739
- children: u && /* @__PURE__ */ e(qe, { transaction: u })
740
- }
741
- )
742
- ] })
743
- ] });
744
- }), wt = I(() => {
745
- const { selectedAccountGuids: t } = J(), { budgets: o, common: i } = D(), {
746
- dateRange: s,
747
- deleteBudget: a,
748
- selectedBudget: n,
749
- selectedSubBudget: r,
750
- setAlert: c,
751
- setSelectedBudget: y,
752
- updateBudget: h
753
- } = w(), { setFilter: m } = ee(), [g, f] = l.useState(!1), [_, u] = l.useState(!1), [C, B] = l.useState(!1), [A, x] = l.useState("");
754
- l.useEffect(() => {
755
- n && !r && (x(`${n.amount}`), f(!0), m({
756
- accounts: t,
757
- dateRange: s,
758
- custom: (R) => R.category_guid === n.category_guid || R.top_level_category_guid === n.category_guid,
759
- showSplits: !0
760
- }));
761
- }, [n]);
762
- const v = async () => {
763
- n && (await h({
764
- ...n,
765
- amount: Number(A),
766
- percentage: n.category.totalAmount / Number(A) * 100
767
- }), c(L(o.alert_budget_updated, n.category.name)));
768
- }, S = async () => {
769
- n && (await a(n.guid), c(L(o.alert_budget_deleted, n.category.name))), B(!1), O();
770
- }, O = () => {
771
- f(!1), setTimeout(() => {
772
- y(void 0);
773
- }, 250);
774
- };
775
- if (n)
776
- return /* @__PURE__ */ d(l.Fragment, { children: [
777
- /* @__PURE__ */ e(
778
- M,
779
- {
780
- ariaLabelClose: i.close_aria,
781
- isOpen: g,
782
- onClose: O,
783
- onPrimaryAction: () => u(!0),
784
- onSecondaryAction: () => B(!0),
785
- primaryText: o.details_edit_button,
786
- secondaryColor: "error",
787
- secondaryText: o.details_delete_button,
788
- title: o.details_title,
789
- children: /* @__PURE__ */ e(Tt, { budget: n })
790
- }
791
- ),
792
- /* @__PURE__ */ e(
793
- N,
794
- {
795
- copy: { close_aria: i.close_aria, title: o.details_edit_title },
796
- disablePrimaryButton: Number(A) <= 0,
797
- isOpen: _,
798
- onClose: () => u(!1),
799
- onPrimaryAction: v,
800
- primaryText: o.edit_save_button,
801
- children: /* @__PURE__ */ e(
802
- oe,
803
- {
804
- amount: A,
805
- categoryName: n.category.name,
806
- onAmountChanged: x
807
- }
808
- )
809
- }
810
- ),
811
- /* @__PURE__ */ e(
812
- N,
813
- {
814
- copy: { close_aria: i.close_aria, title: o.delete_title },
815
- isOpen: C,
816
- onClose: () => B(!1),
817
- onPrimaryAction: S,
818
- primaryColor: "error",
819
- primaryText: o.details_delete_button,
820
- secondaryColor: "secondary",
821
- children: /* @__PURE__ */ e(p, { variant: "Paragraph", children: L(o.delete_description, n.category.name) })
822
- }
823
- )
824
- ] });
825
- }), Dt = ({ budget: t, onClick: o }) => {
826
- const {
827
- amount: i,
828
- budgetColors: { background: s, description: a },
829
- category_guid: n,
830
- description: r,
831
- percentage: c,
832
- subBudgets: y,
833
- transaction_total: h
834
- } = t;
835
- return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { onClick: () => o?.(t), children: [
836
- /* @__PURE__ */ e(ne, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ae, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: n, variant: "basic" }) }) }),
837
- /* @__PURE__ */ e(
838
- Z,
839
- {
840
- primary: /* @__PURE__ */ d(b, { component: "span", direction: "row", justifyContent: "space-between", children: [
841
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: t.category.name }),
842
- /* @__PURE__ */ e(p, { fontWeight: 400, variant: "Body", children: `
843
- ${T(h, "0,0")} /
844
- ${T(i, "0,0")}
845
- ` })
846
- ] }),
847
- secondary: /* @__PURE__ */ d(b, { component: "span", direction: "row", justifyContent: "space-between", children: [
848
- /* @__PURE__ */ e(p, { variant: "XSmall", children: `${y.length} Sub-budgets` }),
849
- /* @__PURE__ */ e(p, { bold: c > 100, color: a, variant: "XSmall", children: r })
850
- ] })
851
- }
852
- )
853
- ] }) });
854
- }, It = I(() => {
855
- const { onEvent: t } = X(), { budgets: o } = D(), { detailedBudgets: i, setSelectedBudget: s } = w(), a = (n) => {
856
- s(n), t(k.BUDGETS_CLICK_BUDGET_CATEGORY, {
857
- budget_category: n.category.name,
858
- click_type: "list"
859
- });
860
- };
861
- return /* @__PURE__ */ d(de, { elevation: 2, children: [
862
- /* @__PURE__ */ e(xe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(fe, { children: o.budget_categories_title }) }),
863
- /* @__PURE__ */ e(ue, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(K, { children: i.map((n) => /* @__PURE__ */ d(l.Fragment, { children: [
864
- /* @__PURE__ */ e(Dt, { budget: n, onClick: a }),
865
- /* @__PURE__ */ e(te, {})
866
- ] }, n.guid)) }) })
867
- ] });
868
- }), Et = I(() => {
869
- const t = q(), { onEvent: o } = X(), { visibleAccounts: i } = Ce(), { budgets: s, common: a, recurring: n } = D(), { incomeCategories: r, spendCategories: c } = j(), { detailedBudgets: y, totalBudgeted: h } = w(), { incomeTotal: m } = Q(), { setFilter: g } = ee(), [f, _] = l.useState(!1), [u, C] = l.useMemo(() => {
870
- const v = c.reduce((z, ae) => z + ae.totalAmount, 0);
871
- let S = v / h;
872
- S > 1 && (S = 1);
873
- let O = t.palette.success.main;
874
- S > 0.8 && S < 1 ? O = t.palette.warning.main : S >= 1 && (O = t.palette.error.main);
875
- const R = [
876
- {
877
- color: O,
878
- percentage: `${S}`
879
- }
880
- ];
881
- return [v, R];
882
- }, [y, c]), [B, A] = l.useMemo(() => {
883
- const v = Math.abs(
884
- r.reduce((R, z) => R + z.totalAmount, 0)
885
- );
886
- let S = v / m;
887
- S > 1 && (S = 1);
888
- const O = [
889
- {
890
- color: t.palette.secondary.main,
891
- percentage: `${S}`
892
- }
893
- ];
894
- return [v, O];
895
- }, [r, m]), x = () => {
896
- g({
897
- accounts: i.map((v) => v.guid),
898
- dateRange: {
899
- start: et(/* @__PURE__ */ new Date(), 90),
900
- end: /* @__PURE__ */ new Date()
901
- }
902
- }), _(!0), o(k.BUDGETS_CLICK_EDIT_INCOME);
903
- };
904
- return /* @__PURE__ */ d(de, { elevation: 2, sx: { overflow: "visible" }, children: [
905
- /* @__PURE__ */ e(xe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(fe, { children: s.overview_title }) }),
906
- /* @__PURE__ */ e(ue, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ d(b, { gap: 24, children: [
907
- /* @__PURE__ */ d(b, { gap: 8, children: [
908
- /* @__PURE__ */ e(p, { bold: !0, sx: { mb: 8 }, variant: "Body", children: s.spending_title }),
909
- /* @__PURE__ */ e(ce, { data: C, height: 16 }),
910
- /* @__PURE__ */ e(p, { variant: "Small", children: L(
911
- s.spending_description,
912
- T(u, "0,0"),
913
- T(h, "0,0")
914
- ) })
915
- ] }),
916
- /* @__PURE__ */ d(b, { gap: 8, children: [
917
- /* @__PURE__ */ d(b, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
918
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: s.income_title }),
919
- /* @__PURE__ */ e(
920
- tt,
921
- {
922
- "aria-label": n.manage_income,
923
- onClick: x,
924
- sx: { p: 0 },
925
- children: /* @__PURE__ */ e($, { color: "primary", name: "edit" })
926
- }
927
- )
928
- ] }),
929
- /* @__PURE__ */ e(ce, { data: A, height: 16 }),
930
- /* @__PURE__ */ e(p, { variant: "Small", children: L(
931
- s.income_description,
932
- T(B, "0,0"),
933
- T(m, "0,0")
934
- ) })
935
- ] })
936
- ] }) }),
937
- /* @__PURE__ */ e(
938
- M,
939
- {
940
- ariaLabelClose: a.close_aria,
941
- isOpen: f,
942
- onClose: () => _(!1),
943
- title: n.manage_income,
944
- children: /* @__PURE__ */ d(b, { gap: 4, children: [
945
- /* @__PURE__ */ e(p, { bold: !0, sx: { mt: 12, mx: 24 }, variant: "Small", children: s.income_title }),
946
- /* @__PURE__ */ e(nt, {})
947
- ] })
948
- }
949
- )
950
- ] });
951
- }), be = 480, Tn = I(({ onBackClick: t, sx: o }) => {
952
- const i = q(), { onEvent: s } = X(), { visibleAccounts: a } = Ce(), { budgets: n, common: r } = D(), { isCopyLoaded: c, isInitialized: y, selectedAccounts: h, setDisplayedDate: m, setSelectedAccounts: g } = J(), {
953
- alert: f,
954
- dateRange: _,
955
- isDataLoaded: u,
956
- loadBudgetData: C,
957
- setDateRange: B,
958
- setAlert: A,
959
- setTheme: x,
960
- detailedBudgets: v
961
- } = w(), { loadRepeatingTransactions: S, setDateRange: O } = Q(), { reloadCategoryTotals: R } = j(), { isSmallTablet: z, isMobile: ae, isSmallMobile: De } = le(), U = z || ae || De, [Ie, re] = l.useState(!1);
962
- l.useEffect(() => {
963
- x(i), g(a), m(_.start, _.end), s(k.BUDGETS_VIEW);
964
- }, []), l.useEffect(() => {
965
- g(a);
966
- }, [a]), l.useEffect(() => {
967
- y && (R(h, _.start, _.end).finally(), O(_), u || (S().finally(), C().finally()));
968
- }, [y, h, _]);
969
- const Ee = (ge) => {
970
- B({ start: ge[0] || /* @__PURE__ */ new Date(), end: ge[1] || /* @__PURE__ */ new Date() });
971
- }, Oe = () => {
972
- s(k.BUDGETS_CLICK_FILTER);
973
- }, me = () => {
974
- re(!0), s(k.BUDGETS_CLICK_ADD);
975
- }, Le = () => {
976
- re(!1);
977
- }, Re = Xe(_.end, ye(/* @__PURE__ */ new Date()));
978
- return !c || !y || !u ? /* @__PURE__ */ e(P, {}) : /* @__PURE__ */ d(
979
- Ue,
980
- {
981
- accountOptions: a,
982
- actions: [
983
- {
984
- iconName: "add",
985
- label: n.add_title,
986
- onClick: me
987
- }
988
- ],
989
- calendarActions: { onRangeChanged: Ee, shouldDisableNext: Re },
990
- onAccountsFilterClick: Oe,
991
- onBackClick: t,
992
- sx: o,
993
- title: n.budgets_title,
994
- children: [
995
- (!y || !u) && /* @__PURE__ */ e(P, {}),
996
- y && u && /* @__PURE__ */ d(
997
- b,
998
- {
999
- direction: U ? "column" : "row",
1000
- height: "100%",
1001
- sx: { justifyContent: "center" },
1002
- width: "100%",
1003
- children: [
1004
- /* @__PURE__ */ e(b, { height: U ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1005
- ve,
1006
- {
1007
- createBudgetOnClick: me,
1008
- height: U ? 450 : 800,
1009
- isDraggable: !0,
1010
- shouldShowZeroState: v.length === 0,
1011
- unavailableWidth: U ? 0 : be
1012
- }
1013
- ) }),
1014
- v.length !== 0 && /* @__PURE__ */ d(
1015
- b,
1016
- {
1017
- gap: 24,
1018
- height: "100%",
1019
- sx: { mr: 24, mt: 48 },
1020
- width: U ? "100%" : be,
1021
- children: [
1022
- /* @__PURE__ */ e(Et, {}),
1023
- /* @__PURE__ */ e(It, {})
1024
- ]
1025
- }
1026
- )
1027
- ]
1028
- }
1029
- ),
1030
- /* @__PURE__ */ e(wt, {}),
1031
- /* @__PURE__ */ e(
1032
- M,
1033
- {
1034
- ariaLabelClose: r.close_aria,
1035
- isOpen: Ie,
1036
- onClose: () => re(!1),
1037
- title: n.add_new_title,
1038
- children: /* @__PURE__ */ e(Te, { onRecalculateBudgets: Le })
1039
- }
1040
- ),
1041
- /* @__PURE__ */ e(
1042
- Ve,
1043
- {
1044
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1045
- autoHideDuration: 3500,
1046
- onClose: () => {
1047
- A("");
1048
- },
1049
- open: !!f,
1050
- children: /* @__PURE__ */ e(
1051
- Ke,
1052
- {
1053
- onClose: () => {
1054
- A("");
1055
- },
1056
- severity: "success",
1057
- variant: "filled",
1058
- children: f
1059
- }
1060
- )
1061
- }
1062
- )
1063
- ]
1064
- }
1065
- );
1066
- });
1067
- export {
1068
- vn as BubbleBudgetsMiniWidget,
1069
- Tn as BubbleBudgetsWidget
1070
- };