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