@mx-cartographer/experiences 7.5.0-alpha.bb1 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/trends/index.es.js
CHANGED
|
@@ -1,116 +1,114 @@
|
|
|
1
1
|
import { jsxs as f, jsx as e, Fragment as ct } from "react/jsx-runtime";
|
|
2
2
|
import u, { useRef as lt, useState as dt, useEffect as ut } from "react";
|
|
3
|
-
import { observer as
|
|
4
|
-
import { CategoryIcon as
|
|
5
|
-
import
|
|
3
|
+
import { observer as R } from "mobx-react-lite";
|
|
4
|
+
import { CategoryIcon as Se, Text as P, Icon as _e, P as he, H3 as Ye, ChevronRightIcon as ht } from "@mxenabled/mxui";
|
|
5
|
+
import N from "@mui/material/Box";
|
|
6
6
|
import S from "@mui/material/Stack";
|
|
7
|
-
import
|
|
7
|
+
import be from "@mui/material/Button";
|
|
8
8
|
import { addSeconds as je } from "date-fns/addSeconds";
|
|
9
|
-
import { differenceInCalendarMonths as
|
|
9
|
+
import { differenceInCalendarMonths as ke } from "date-fns/differenceInCalendarMonths";
|
|
10
10
|
import { useTheme as me } from "@mui/material/styles";
|
|
11
11
|
import { LineChart as gt } from "@mui/x-charts";
|
|
12
|
-
import { u as
|
|
12
|
+
import { u as J } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
13
13
|
import { u as mt } from "../useDimensions-27p2evRx.mjs";
|
|
14
14
|
import pt from "@mui/material/Card";
|
|
15
15
|
import Ct from "@mui/material/CardContent";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { u as k, m as $, g as V, b as pe, h as
|
|
16
|
+
import He from "@mui/material/Divider";
|
|
17
|
+
import Ge from "@mui/material/Grid";
|
|
18
|
+
import { u as k, m as $, g as V, b as pe, h as xe, d as ve, v as Ce, p as Ue, f as We, a as yt } from "../hooks-ZMp65DFz.mjs";
|
|
19
19
|
import { b as ft } from "../Localization-2MODESHW.mjs";
|
|
20
|
-
import { C as
|
|
20
|
+
import { C as Te } from "../CurrencyText-Dr0EZ7bp.mjs";
|
|
21
21
|
import { useTheme as _t, Card as bt, CardContent as Tt, Box as St, Stack as xt } from "@mui/material";
|
|
22
|
-
import { f as
|
|
23
|
-
import { C as
|
|
22
|
+
import { f as U, a as G } from "../Dialog-BPTr3qHE.mjs";
|
|
23
|
+
import { C as Ae, b as Be, c as vt } from "../Category-CevNQ03n.mjs";
|
|
24
24
|
import { f as se, a as wt } from "../NumberFormatting-DjTD0t3W.mjs";
|
|
25
|
-
import { c as It, a as
|
|
26
|
-
import { T as
|
|
27
|
-
import { c as Et, i as Dt, d as Mt, e as At, b as Ze, g as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import { parseISO as
|
|
31
|
-
import {
|
|
32
|
-
import { isBefore as Nt } from "date-fns/isBefore";
|
|
33
|
-
import { isEqual as Wt, subMonths as Ot } from "date-fns";
|
|
34
|
-
import { DataGridPro as Gt } from "@mui/x-data-grid-pro";
|
|
25
|
+
import { c as It, a as Ve, g as Lt, L as Xe } from "../TrendsStore-yO7qYv97.mjs";
|
|
26
|
+
import { T as Vn } from "../TrendsStore-yO7qYv97.mjs";
|
|
27
|
+
import { c as Et, i as Dt, d as Mt, e as At, b as Ze, g as Qe, f as Fe } from "../SpendingData-DQ1b9uqq.mjs";
|
|
28
|
+
import Rt from "@mui/material/ToggleButton";
|
|
29
|
+
import kt from "@mui/material/ToggleButtonGroup";
|
|
30
|
+
import { parseISO as Pe } from "date-fns/parseISO";
|
|
31
|
+
import { DataGridPro as Ht } from "@mui/x-data-grid-pro";
|
|
35
32
|
import { H as Re } from "../HeaderCell-DjuifqHJ.mjs";
|
|
36
|
-
import { T as
|
|
37
|
-
import { A as I, W as
|
|
33
|
+
import { T as B, b as Nt } from "../ViewMoreMicroCard-DwR0v_ll.mjs";
|
|
34
|
+
import { A as I, W as qe } from "../WidgetContainer-CoFDmQRE.mjs";
|
|
38
35
|
import { a as Je, T as et } from "../TransactionDetails-m5PddMQn.mjs";
|
|
39
|
-
import { D as
|
|
40
|
-
import { u as
|
|
36
|
+
import { D as Ne } from "../Drawer-By9V-B5L.mjs";
|
|
37
|
+
import { u as we } from "../useWidgetLoadTimer-hIOioiKx.mjs";
|
|
41
38
|
import { L as ge } from "../Loader-DUaFpDGv.mjs";
|
|
42
|
-
import { L as
|
|
43
|
-
import { M as
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import
|
|
39
|
+
import { L as Oe } from "../LineChart-BQRxZF3p.mjs";
|
|
40
|
+
import { M as Wt } from "../MiniWidgetContainer-Bg02sF1Y.mjs";
|
|
41
|
+
import { subMonths as Ot } from "date-fns";
|
|
42
|
+
import { TrendingUp as Gt, TrendingDown as Bt, MultilineChart as Vt, ExpandLess as Ft, ExpandMore as Pt } from "@mxenabled/mx-icons";
|
|
43
|
+
import { M as $t } from "../MicroWidgetContainer-r6mtxRer.mjs";
|
|
44
|
+
import zt from "@mui/material/Collapse";
|
|
45
|
+
import Kt from "@mui/material/List";
|
|
46
|
+
import Yt from "@mui/material/ListItem";
|
|
47
|
+
import jt from "@mui/material/ListItemButton";
|
|
48
|
+
import Ut from "@mui/material/ListItemIcon";
|
|
49
|
+
import Xt from "@mui/material/ListItemText";
|
|
52
50
|
import tt from "@mui/material/styles/useTheme";
|
|
53
|
-
import
|
|
54
|
-
import { b as
|
|
55
|
-
import { E as
|
|
56
|
-
import { u as
|
|
57
|
-
import { E as
|
|
58
|
-
import { l as
|
|
51
|
+
import Zt from "@mui/material/Paper";
|
|
52
|
+
import { b as Qt } from "../CategoryUtil-DUM8NuGO.mjs";
|
|
53
|
+
import { E as qt } from "../ExportCsvAction-Cglo8Mca.mjs";
|
|
54
|
+
import { u as Jt } from "../useInsightsEnabled-B7dxpDrX.mjs";
|
|
55
|
+
import { E as eo } from "../EmptyState-DoxNUae-.mjs";
|
|
56
|
+
import { l as to } from "../ConnectDrawer-BkvlItWx.mjs";
|
|
59
57
|
const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
60
58
|
const { categories: n } = k(), { getCategoryName: o } = $(), s = o(t);
|
|
61
59
|
return /* @__PURE__ */ f(S, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
|
|
62
60
|
/* @__PURE__ */ e(
|
|
63
|
-
|
|
61
|
+
N,
|
|
64
62
|
{
|
|
65
63
|
"aria-label": ft(n.category_icon_label_aria, s),
|
|
66
64
|
mb: 4,
|
|
67
65
|
role: "img",
|
|
68
|
-
children: /* @__PURE__ */ e(
|
|
66
|
+
children: /* @__PURE__ */ e(Se, { categoryGuid: r })
|
|
69
67
|
}
|
|
70
68
|
),
|
|
71
69
|
/* @__PURE__ */ e(P, { variant: "Body", children: s })
|
|
72
70
|
] });
|
|
73
|
-
},
|
|
71
|
+
}, oo = ({
|
|
74
72
|
categoryGuids: { guid: t, topLevelGuid: r },
|
|
75
73
|
hoveredAreaData: n,
|
|
76
74
|
cursorPosition: o,
|
|
77
75
|
chartContainerRef: s
|
|
78
76
|
}) => {
|
|
79
|
-
const h = me(), g = lt(null), [
|
|
77
|
+
const h = me(), g = lt(null), [d, c] = dt({ x: o.x, y: o.y });
|
|
80
78
|
if (ut(() => {
|
|
81
79
|
(() => {
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
const i =
|
|
80
|
+
const l = g.current, b = s.current;
|
|
81
|
+
if (!l || !b) return;
|
|
82
|
+
const i = l.getBoundingClientRect(), C = b.getBoundingClientRect();
|
|
85
83
|
let p = o.x, _ = o.y;
|
|
86
84
|
p + i.width * 2 > C.right ? p = o.x - i.width : p - i.width < C.left && (p = o.x), _ + i.height * 2 > C.bottom && (_ = o.y - i.height), c({ x: p, y: _ });
|
|
87
85
|
})();
|
|
88
86
|
}, [o, s]), !n) return null;
|
|
89
|
-
const m = n.reduce((y,
|
|
87
|
+
const m = n.reduce((y, l) => y + l.y, 0);
|
|
90
88
|
return /* @__PURE__ */ e(
|
|
91
89
|
pt,
|
|
92
90
|
{
|
|
93
91
|
ref: g,
|
|
94
92
|
sx: {
|
|
95
93
|
position: "absolute",
|
|
96
|
-
top:
|
|
97
|
-
left:
|
|
94
|
+
top: d.y,
|
|
95
|
+
left: d.x,
|
|
98
96
|
width: 250,
|
|
99
97
|
pointerEvents: "none"
|
|
100
98
|
},
|
|
101
99
|
children: /* @__PURE__ */ f(Ct, { children: [
|
|
102
|
-
/* @__PURE__ */ f(
|
|
100
|
+
/* @__PURE__ */ f(N, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
103
101
|
/* @__PURE__ */ e(ot, { categoryGuid: t, topLevelCategoryGuid: r }),
|
|
104
102
|
/* @__PURE__ */ e(P, { variant: "Small", children: `${n.length}-month total` }),
|
|
105
|
-
/* @__PURE__ */ e(
|
|
103
|
+
/* @__PURE__ */ e(Te, { amount: m, bold: !0, formatString: "0,0", variant: "body2" })
|
|
106
104
|
] }),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
108
|
-
/* @__PURE__ */ e(
|
|
109
|
-
|
|
110
|
-
/* @__PURE__ */ e(
|
|
105
|
+
/* @__PURE__ */ e(He, { sx: { my: 16, width: "100%" } }),
|
|
106
|
+
/* @__PURE__ */ e(Ge, { container: !0, children: n.map((y, l) => /* @__PURE__ */ f(u.Fragment, { children: [
|
|
107
|
+
l > 0 && l % 3 === 0 && /* @__PURE__ */ e(He, { sx: { my: 16, width: "100%" } }),
|
|
108
|
+
/* @__PURE__ */ e(Ge, { item: !0, xs: 4, children: /* @__PURE__ */ f(N, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
111
109
|
/* @__PURE__ */ e(P, { color: h.palette.text.secondary, variant: "XSmall", children: y.x }),
|
|
112
110
|
/* @__PURE__ */ e(
|
|
113
|
-
|
|
111
|
+
Te,
|
|
114
112
|
{
|
|
115
113
|
amount: y.y,
|
|
116
114
|
bold: !0,
|
|
@@ -119,23 +117,23 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
119
117
|
}
|
|
120
118
|
)
|
|
121
119
|
] }) })
|
|
122
|
-
] },
|
|
120
|
+
] }, l)) })
|
|
123
121
|
] })
|
|
124
122
|
}
|
|
125
123
|
);
|
|
126
|
-
},
|
|
124
|
+
}, no = R(oo), so = ({
|
|
127
125
|
categoryGuids: { guid: t, topLevelGuid: r },
|
|
128
126
|
itemData: { dataIndex: n },
|
|
129
127
|
series: o,
|
|
130
128
|
xData: s
|
|
131
129
|
}) => {
|
|
132
|
-
const h = _t(), g = o.data[n],
|
|
133
|
-
return g === void 0 || !
|
|
130
|
+
const h = _t(), g = o.data[n], d = s[n];
|
|
131
|
+
return g === void 0 || !d ? null : /* @__PURE__ */ e(bt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ f(St, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
134
132
|
/* @__PURE__ */ e(ot, { categoryGuid: t, topLevelCategoryGuid: r }),
|
|
135
|
-
/* @__PURE__ */ e(P, { color: h.palette.text.secondary, variant: "Small", children:
|
|
136
|
-
/* @__PURE__ */ e(
|
|
133
|
+
/* @__PURE__ */ e(P, { color: h.palette.text.secondary, variant: "Small", children: U(d, G.MONTH_SHORT_YEAR) }),
|
|
134
|
+
/* @__PURE__ */ e(Te, { amount: String(g), bold: !0, formatString: "0,0", variant: "Body" })
|
|
137
135
|
] }) }) });
|
|
138
|
-
},
|
|
136
|
+
}, ro = ({
|
|
139
137
|
sx: t,
|
|
140
138
|
categoryGuids: r,
|
|
141
139
|
hoveredLegend: n,
|
|
@@ -143,7 +141,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
143
141
|
onHoverLegend: s,
|
|
144
142
|
onClickLegend: h
|
|
145
143
|
}) => {
|
|
146
|
-
const { isMobile: g } =
|
|
144
|
+
const { isMobile: g } = J(), { getCategoryName: d } = $();
|
|
147
145
|
return /* @__PURE__ */ e(
|
|
148
146
|
S,
|
|
149
147
|
{
|
|
@@ -154,9 +152,9 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
154
152
|
ref: o,
|
|
155
153
|
sx: t,
|
|
156
154
|
children: r.map(({ guid: c, top_level_guid: m }) => {
|
|
157
|
-
const y = n === c,
|
|
155
|
+
const y = n === c, l = Ae[c], b = Ae[m], i = l ?? b ?? Ae.default, C = i + "33";
|
|
158
156
|
return /* @__PURE__ */ f(
|
|
159
|
-
|
|
157
|
+
be,
|
|
160
158
|
{
|
|
161
159
|
onClick: () => h(c),
|
|
162
160
|
onMouseEnter: () => s(c),
|
|
@@ -174,7 +172,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
174
172
|
},
|
|
175
173
|
children: [
|
|
176
174
|
/* @__PURE__ */ e(
|
|
177
|
-
|
|
175
|
+
N,
|
|
178
176
|
{
|
|
179
177
|
sx: {
|
|
180
178
|
width: 16,
|
|
@@ -185,7 +183,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
185
|
),
|
|
188
|
-
/* @__PURE__ */ e(P, { variant: "Body", children:
|
|
186
|
+
/* @__PURE__ */ e(P, { variant: "Body", children: d(c) })
|
|
189
187
|
]
|
|
190
188
|
},
|
|
191
189
|
c
|
|
@@ -193,7 +191,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
193
191
|
})
|
|
194
192
|
}
|
|
195
193
|
);
|
|
196
|
-
},
|
|
194
|
+
}, ao = ({
|
|
197
195
|
onHoverArea: t,
|
|
198
196
|
onHoverPoint: r,
|
|
199
197
|
onHoverLegend: n,
|
|
@@ -201,23 +199,23 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
201
199
|
stackedDatasets: s,
|
|
202
200
|
unstackedDatasets: h = [],
|
|
203
201
|
availableHeight: g = 0,
|
|
204
|
-
minimumHeight:
|
|
202
|
+
minimumHeight: d = 350
|
|
205
203
|
}) => {
|
|
206
|
-
const c = me(), { isMobile: m } =
|
|
204
|
+
const c = me(), { isMobile: m } = J(), [y, { height: l }] = mt(), b = u.useRef(null), [i, C] = u.useState(0);
|
|
207
205
|
u.useEffect(() => {
|
|
208
|
-
const a = Math.max(g -
|
|
206
|
+
const a = Math.max(g - l, d);
|
|
209
207
|
C(a);
|
|
210
|
-
}, [g,
|
|
211
|
-
const [p, _] = u.useState(null), [
|
|
208
|
+
}, [g, l]);
|
|
209
|
+
const [p, _] = u.useState(null), [x, v] = u.useState({
|
|
212
210
|
hoveredSeriesId: null,
|
|
213
211
|
hoveredAreaData: null,
|
|
214
212
|
isAreaHovered: !1,
|
|
215
213
|
cursorPos: { x: 0, y: 0 }
|
|
216
|
-
}), { hoveredSeriesId: D, hoveredAreaData:
|
|
217
|
-
(a, T) => s.reduce((E,
|
|
214
|
+
}), { hoveredSeriesId: D, hoveredAreaData: M, isAreaHovered: L, cursorPos: A } = x, ee = L && D && M, W = !ee, F = [...s, ...h], z = F[0]?.dataset.length ?? 0, X = F.flatMap((a) => a.dataset.map((T) => T.x)), ye = F.flatMap((a) => a.dataset.map((T) => T.y)), te = s[0]?.dataset?.map(
|
|
215
|
+
(a, T) => s.reduce((E, j) => E + j.dataset[T]?.y || 0, 0)
|
|
218
216
|
) ?? [0], re = Math.max(...te), Z = Math.max(
|
|
219
217
|
...h.flatMap((a) => a.dataset.map((T) => T.y))
|
|
220
|
-
), ce = Math.floor(Math.min(...ye) / 100) * 100, oe = Math.ceil(Math.max(re, Z) / 100) * 100,
|
|
218
|
+
), ce = Math.floor(Math.min(...ye) / 100) * 100, oe = Math.ceil(Math.max(re, Z) / 100) * 100, K = s.map((a, T) => ({
|
|
221
219
|
id: `stacked-${T}`,
|
|
222
220
|
guid: a.category_guid,
|
|
223
221
|
top_level_guid: a.top_level_category_guid,
|
|
@@ -239,8 +237,8 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
239
237
|
label: a.category_name,
|
|
240
238
|
type: "line",
|
|
241
239
|
valueFormatter: (E) => se(E, "0,0")
|
|
242
|
-
})), ne = [...
|
|
243
|
-
...
|
|
240
|
+
})), ne = [...K, ...ae], ie = [
|
|
241
|
+
...K.map(({ guid: a, top_level_guid: T }) => ({
|
|
244
242
|
guid: a,
|
|
245
243
|
top_level_guid: T
|
|
246
244
|
})),
|
|
@@ -248,7 +246,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
248
246
|
guid: a,
|
|
249
247
|
top_level_guid: T
|
|
250
248
|
}))
|
|
251
|
-
],
|
|
249
|
+
], Q = (a) => {
|
|
252
250
|
const E = a.startsWith("stacked-") ? s[parseInt(a.split("-")[1])] : h[parseInt(a.split("-")[1])];
|
|
253
251
|
return {
|
|
254
252
|
guid: E?.category_guid,
|
|
@@ -258,35 +256,35 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
258
256
|
_(a), n?.(a ?? "");
|
|
259
257
|
}, O = (a) => {
|
|
260
258
|
o?.(a ?? "");
|
|
261
|
-
},
|
|
262
|
-
const a =
|
|
259
|
+
}, Y = () => {
|
|
260
|
+
const a = Q(String(D)).guid;
|
|
263
261
|
a && o?.(a);
|
|
264
262
|
}, le = (a) => {
|
|
265
|
-
const T = String(a?.seriesId), E =
|
|
266
|
-
if (
|
|
263
|
+
const T = String(a?.seriesId), E = Q(T).guid, j = ne.find((de) => de.id === T), Le = j && a?.dataIndex !== void 0, Ee = j && a?.dataIndex === void 0;
|
|
264
|
+
if (Le)
|
|
267
265
|
v({
|
|
268
266
|
hoveredSeriesId: T,
|
|
269
267
|
hoveredAreaData: null,
|
|
270
268
|
isAreaHovered: !1,
|
|
271
|
-
cursorPos:
|
|
269
|
+
cursorPos: A
|
|
272
270
|
}), r?.(E);
|
|
273
|
-
else if (
|
|
274
|
-
const de =
|
|
275
|
-
x: X[
|
|
276
|
-
y:
|
|
271
|
+
else if (Ee) {
|
|
272
|
+
const de = j?.data.map((De, Me) => ({
|
|
273
|
+
x: X[Me],
|
|
274
|
+
y: De
|
|
277
275
|
})) ?? [];
|
|
278
276
|
v({
|
|
279
277
|
hoveredSeriesId: T,
|
|
280
278
|
hoveredAreaData: de,
|
|
281
279
|
isAreaHovered: !0,
|
|
282
|
-
cursorPos:
|
|
280
|
+
cursorPos: A
|
|
283
281
|
}), t?.(E);
|
|
284
282
|
} else
|
|
285
283
|
v({
|
|
286
284
|
hoveredSeriesId: null,
|
|
287
285
|
hoveredAreaData: null,
|
|
288
286
|
isAreaHovered: !1,
|
|
289
|
-
cursorPos:
|
|
287
|
+
cursorPos: A
|
|
290
288
|
});
|
|
291
289
|
}, fe = (a) => {
|
|
292
290
|
const T = a.currentTarget.getBoundingClientRect();
|
|
@@ -297,7 +295,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
297
295
|
y: a.clientY - T.top
|
|
298
296
|
}
|
|
299
297
|
}));
|
|
300
|
-
},
|
|
298
|
+
}, Ie = {
|
|
301
299
|
p: 4,
|
|
302
300
|
"& .MuiBarLabel-root": {
|
|
303
301
|
fontSize: 10,
|
|
@@ -313,15 +311,15 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
313
311
|
'& [class*="MuiLineElement-series-unstacked-"]': {
|
|
314
312
|
strokeWidth: 3
|
|
315
313
|
},
|
|
316
|
-
...p &&
|
|
317
|
-
const
|
|
318
|
-
return a[
|
|
319
|
-
opacity:
|
|
314
|
+
...p && K.reduce((a, T, E) => {
|
|
315
|
+
const j = `.MuiAreaElement-series-stacked-${E}`;
|
|
316
|
+
return a[j] = {
|
|
317
|
+
opacity: K[E].guid === p ? 0.9 : 0.2
|
|
320
318
|
}, a;
|
|
321
319
|
}, {})
|
|
322
320
|
};
|
|
323
321
|
return /* @__PURE__ */ e(
|
|
324
|
-
|
|
322
|
+
N,
|
|
325
323
|
{
|
|
326
324
|
onMouseMove: fe,
|
|
327
325
|
ref: b,
|
|
@@ -348,7 +346,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
348
346
|
{
|
|
349
347
|
height: i,
|
|
350
348
|
margin: { bottom: 50 },
|
|
351
|
-
onAreaClick:
|
|
349
|
+
onAreaClick: Y,
|
|
352
350
|
onHighlightChange: le,
|
|
353
351
|
series: ne,
|
|
354
352
|
skipAnimation: !0,
|
|
@@ -359,15 +357,15 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
359
357
|
},
|
|
360
358
|
slots: {
|
|
361
359
|
itemContent: (a) => W && D ? /* @__PURE__ */ e(
|
|
362
|
-
|
|
360
|
+
so,
|
|
363
361
|
{
|
|
364
|
-
categoryGuids:
|
|
362
|
+
categoryGuids: Q(D),
|
|
365
363
|
xData: X,
|
|
366
364
|
...a
|
|
367
365
|
}
|
|
368
366
|
) : null
|
|
369
367
|
},
|
|
370
|
-
sx:
|
|
368
|
+
sx: Ie,
|
|
371
369
|
tooltip: {
|
|
372
370
|
trigger: W ? "item" : "none"
|
|
373
371
|
},
|
|
@@ -375,8 +373,8 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
375
373
|
{
|
|
376
374
|
data: X,
|
|
377
375
|
scaleType: "time",
|
|
378
|
-
valueFormatter: (a) =>
|
|
379
|
-
tickNumber:
|
|
376
|
+
valueFormatter: (a) => U(a, G.MONTH_SHORT_YEAR),
|
|
377
|
+
tickNumber: z
|
|
380
378
|
// How many ticks to show on the x-axis
|
|
381
379
|
}
|
|
382
380
|
],
|
|
@@ -389,7 +387,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
389
387
|
}
|
|
390
388
|
),
|
|
391
389
|
/* @__PURE__ */ e(
|
|
392
|
-
|
|
390
|
+
ro,
|
|
393
391
|
{
|
|
394
392
|
categoryGuids: ie,
|
|
395
393
|
hoveredLegend: p,
|
|
@@ -399,15 +397,15 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
399
397
|
sx: { px: m ? 0 : 24 }
|
|
400
398
|
}
|
|
401
399
|
),
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
ee && /* @__PURE__ */ e(
|
|
401
|
+
no,
|
|
404
402
|
{
|
|
405
|
-
categoryGuids:
|
|
403
|
+
categoryGuids: Q(D),
|
|
406
404
|
chartContainerRef: b,
|
|
407
|
-
cursorPosition:
|
|
408
|
-
hoveredAreaData:
|
|
405
|
+
cursorPosition: A,
|
|
406
|
+
hoveredAreaData: M.map((a) => ({
|
|
409
407
|
...a,
|
|
410
|
-
x:
|
|
408
|
+
x: U(a.x, G.MONTH_SHORT_YEAR)
|
|
411
409
|
}))
|
|
412
410
|
}
|
|
413
411
|
)
|
|
@@ -417,29 +415,29 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
417
415
|
}
|
|
418
416
|
);
|
|
419
417
|
}, nt = ({ selectedTab: t, onTabChange: r }) => /* @__PURE__ */ e(
|
|
420
|
-
|
|
418
|
+
kt,
|
|
421
419
|
{
|
|
422
420
|
exclusive: !0,
|
|
423
421
|
onChange: r,
|
|
424
422
|
orientation: "horizontal",
|
|
425
423
|
value: t,
|
|
426
|
-
children: ["Chart", "Table"].map((n) => /* @__PURE__ */ e(
|
|
424
|
+
children: ["Chart", "Table"].map((n) => /* @__PURE__ */ e(Rt, { color: "primary", sx: { width: 56 }, value: n, children: n === "Chart" ? /* @__PURE__ */ e(_e, { name: "table_chart_view" }) : /* @__PURE__ */ e(_e, { name: "format_list_bulleted" }) }, n))
|
|
427
425
|
}
|
|
428
426
|
), st = ({ selectedDateRange: t, selectedCategoryGuid: r }) => {
|
|
429
|
-
const { trends: n } = k(), { isMobile: o, isDesktop: s } =
|
|
430
|
-
const
|
|
427
|
+
const { trends: n } = k(), { isMobile: o, isDesktop: s } = J(), { getCategoryName: h } = $(), g = u.useMemo(() => {
|
|
428
|
+
const d = t.start.getFullYear() === t.end.getFullYear() ? U(
|
|
431
429
|
t.start,
|
|
432
|
-
o ?
|
|
433
|
-
) :
|
|
430
|
+
o ? G.MONTH_SHORT : G.MONTH_LONG
|
|
431
|
+
) : U(
|
|
434
432
|
t.start,
|
|
435
|
-
o ?
|
|
436
|
-
), c =
|
|
433
|
+
o ? G.MONTH_SHORT_YEAR : G.MONTH_YEAR
|
|
434
|
+
), c = U(
|
|
437
435
|
t.end,
|
|
438
|
-
o ?
|
|
436
|
+
o ? G.MONTH_SHORT_YEAR : G.MONTH_YEAR
|
|
439
437
|
);
|
|
440
|
-
return `${
|
|
438
|
+
return `${d} - ${c}`;
|
|
441
439
|
}, [t, o]);
|
|
442
|
-
return /* @__PURE__ */ f(
|
|
440
|
+
return /* @__PURE__ */ f(N, { sx: { mr: 10, minWidth: "60%" }, children: [
|
|
443
441
|
/* @__PURE__ */ e(
|
|
444
442
|
P,
|
|
445
443
|
{
|
|
@@ -457,9 +455,9 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
457
455
|
/* @__PURE__ */ e(P, { variant: s ? "subtitle1" : "body2", children: g })
|
|
458
456
|
] });
|
|
459
457
|
}, $e = (t) => {
|
|
460
|
-
const r = t.row.category_guid, n = t.row.top_level_category_guid, o = r ===
|
|
458
|
+
const r = t.row.category_guid, n = t.row.top_level_category_guid, o = r === Be.INCOME || n === Be.INCOME, s = t.row[t.field];
|
|
461
459
|
return /* @__PURE__ */ e(S, { alignItems: "flex-end", direction: "row", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(
|
|
462
|
-
|
|
460
|
+
Te,
|
|
463
461
|
{
|
|
464
462
|
amount: s,
|
|
465
463
|
isIncome: o,
|
|
@@ -468,22 +466,22 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
468
466
|
variant: "body2"
|
|
469
467
|
}
|
|
470
468
|
) });
|
|
471
|
-
},
|
|
469
|
+
}, io = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
472
470
|
const { getCategoryName: n } = $(), { categories: o } = k(), s = o.default_categories[t]?.replace(/&/g, "&") ?? n(t);
|
|
473
471
|
return /* @__PURE__ */ f(S, { alignItems: "center", direction: "row", justifyContent: "center", children: [
|
|
474
|
-
/* @__PURE__ */ e(
|
|
475
|
-
/* @__PURE__ */ e(P, { sx: { ml: 12
|
|
472
|
+
/* @__PURE__ */ e(N, { "aria-hidden": !0, children: /* @__PURE__ */ e(Se, { categoryGuid: r, variant: "twotone" }) }),
|
|
473
|
+
/* @__PURE__ */ e(P, { sx: { ml: 12 }, variant: "body2", children: s })
|
|
476
474
|
] });
|
|
477
|
-
},
|
|
478
|
-
|
|
475
|
+
}, co = (t) => /* @__PURE__ */ e(S, { alignItems: "center", direction: "row", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(
|
|
476
|
+
io,
|
|
479
477
|
{
|
|
480
478
|
categoryGuid: t.row.category,
|
|
481
479
|
topLevelCategoryGuid: t.row.top_level_category_guid
|
|
482
480
|
}
|
|
483
|
-
) }),
|
|
481
|
+
) }), lo = (t, r) => {
|
|
484
482
|
const n = [], o = new Date(t);
|
|
485
483
|
for (; o <= r; ) {
|
|
486
|
-
const s =
|
|
484
|
+
const s = U(o, G.MONTH_LONG);
|
|
487
485
|
n.push(s), o.setMonth(o.getMonth() + 1);
|
|
488
486
|
}
|
|
489
487
|
return n;
|
|
@@ -494,15 +492,15 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
494
492
|
height: o = "100%",
|
|
495
493
|
sx: s = {}
|
|
496
494
|
}) => {
|
|
497
|
-
const h = me(), { onEvent: g } = V(), { transactions:
|
|
495
|
+
const h = me(), { onEvent: g } = V(), { transactions: d, spending: c } = k(), { trendsCategories: m } = $(), y = u.useMemo(() => lo(t.start, t.end), [t]), l = h.palette.mode === "light", b = [
|
|
498
496
|
{
|
|
499
497
|
field: "category",
|
|
500
498
|
flex: 1,
|
|
501
499
|
headerClassName: "trends-table-header",
|
|
502
|
-
headerName:
|
|
500
|
+
headerName: d.category_title,
|
|
503
501
|
minWidth: 175,
|
|
504
502
|
renderHeader: Re,
|
|
505
|
-
renderCell:
|
|
503
|
+
renderCell: co,
|
|
506
504
|
sortable: !0,
|
|
507
505
|
sortComparator: It,
|
|
508
506
|
type: "string"
|
|
@@ -521,7 +519,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
521
519
|
sortable: !0,
|
|
522
520
|
hideSortIcons: !1,
|
|
523
521
|
type: "number",
|
|
524
|
-
sortComparator:
|
|
522
|
+
sortComparator: Ve
|
|
525
523
|
})
|
|
526
524
|
),
|
|
527
525
|
{
|
|
@@ -537,7 +535,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
537
535
|
sortable: !0,
|
|
538
536
|
hideSortIcons: !1,
|
|
539
537
|
type: "number",
|
|
540
|
-
sortComparator:
|
|
538
|
+
sortComparator: Ve
|
|
541
539
|
}
|
|
542
540
|
], i = u.useMemo(() => {
|
|
543
541
|
if (r)
|
|
@@ -545,33 +543,31 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
545
543
|
}, [r, m]), C = u.useMemo(() => {
|
|
546
544
|
let p = m;
|
|
547
545
|
return i && (p = i.subCategories.filter(
|
|
548
|
-
(_) => _.monthlyAmounts.some((
|
|
546
|
+
(_) => _.monthlyAmounts.some((x) => x.amount !== 0)
|
|
549
547
|
)), p.map((_) => {
|
|
550
|
-
let
|
|
551
|
-
i && (
|
|
552
|
-
const v =
|
|
553
|
-
(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const z = J(_e(M.isoDate), B.MONTH_LONG);
|
|
557
|
-
return x[z] = M.amount, x;
|
|
548
|
+
let x = _.totalMonthlyAmounts;
|
|
549
|
+
i && (x = _.monthlyAmounts);
|
|
550
|
+
const v = x.reduce(
|
|
551
|
+
(M, L) => {
|
|
552
|
+
const A = U(Pe(L.isoDate), G.MONTH_LONG);
|
|
553
|
+
return M[A] = L.amount, M;
|
|
558
554
|
},
|
|
559
555
|
{}
|
|
560
|
-
),
|
|
561
|
-
|
|
562
|
-
0
|
|
563
|
-
);
|
|
556
|
+
), D = x.reduce((M, L) => {
|
|
557
|
+
const A = U(Pe(L.isoDate), G.MONTH_LONG);
|
|
558
|
+
return M + (y.includes(A) ? L.amount : 0);
|
|
559
|
+
}, 0);
|
|
564
560
|
return {
|
|
565
561
|
id: _.guid,
|
|
566
562
|
category: _.guid,
|
|
567
563
|
top_level_category_guid: _.parent_guid || _.guid,
|
|
568
|
-
total:
|
|
569
|
-
...
|
|
564
|
+
total: D,
|
|
565
|
+
...v
|
|
570
566
|
};
|
|
571
567
|
});
|
|
572
568
|
}, [m]);
|
|
573
|
-
return /* @__PURE__ */ e(
|
|
574
|
-
|
|
569
|
+
return /* @__PURE__ */ e(N, { sx: { height: o, width: "100%", overflowX: "auto", boxShadow: "none", ...s }, children: /* @__PURE__ */ e(
|
|
570
|
+
Ht,
|
|
575
571
|
{
|
|
576
572
|
columns: b,
|
|
577
573
|
disableColumnFilter: !0,
|
|
@@ -580,7 +576,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
580
576
|
initialState: { sorting: { sortModel: [{ field: "category", sort: "asc" }] } },
|
|
581
577
|
onRowClick: (p) => {
|
|
582
578
|
i || n?.(p.row.category), g(I.TRENDS_CLICK_LIST_ITEM, {
|
|
583
|
-
...
|
|
579
|
+
...B,
|
|
584
580
|
listItem: vt[p.row.category]
|
|
585
581
|
});
|
|
586
582
|
},
|
|
@@ -594,28 +590,29 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
594
590
|
borderStyle: "solid",
|
|
595
591
|
borderRadius: 2,
|
|
596
592
|
"& .MuiDataGrid-columnHeaders": {
|
|
593
|
+
bgcolor: l ? "neutral.50" : "neutral.800",
|
|
597
594
|
borderBottom: "none"
|
|
598
595
|
},
|
|
599
596
|
"& .trends-table-header": {
|
|
600
|
-
bgcolor:
|
|
597
|
+
bgcolor: l ? "neutral.50" : "neutral.800"
|
|
601
598
|
}
|
|
602
599
|
}
|
|
603
600
|
}
|
|
604
601
|
) });
|
|
605
|
-
},
|
|
602
|
+
}, uo = {
|
|
606
603
|
title: "Transaction List"
|
|
607
|
-
},
|
|
604
|
+
}, ho = ({
|
|
608
605
|
categoryGuid: t,
|
|
609
606
|
dateRange: r,
|
|
610
607
|
isOpen: n,
|
|
611
608
|
onClose: o
|
|
612
609
|
}) => {
|
|
613
|
-
const { onEvent: s } = V(), { selectedAccountGuids: h } = pe(), { common: g } = k(), { setFilter:
|
|
610
|
+
const { onEvent: s } = V(), { selectedAccountGuids: h } = pe(), { common: g } = k(), { setFilter: d, sortedTransactions: c } = xe(), [m, y] = u.useState(""), l = u.useMemo(
|
|
614
611
|
() => c.find((i) => i.guid === m),
|
|
615
612
|
[m, c]
|
|
616
613
|
);
|
|
617
614
|
u.useEffect(() => {
|
|
618
|
-
|
|
615
|
+
d({
|
|
619
616
|
accounts: h,
|
|
620
617
|
dateRange: r,
|
|
621
618
|
custom: (i) => t === "" || t === i.category_guid || t === i.top_level_category_guid,
|
|
@@ -626,21 +623,21 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
626
623
|
y(""), o();
|
|
627
624
|
};
|
|
628
625
|
return /* @__PURE__ */ f(
|
|
629
|
-
|
|
626
|
+
Ne,
|
|
630
627
|
{
|
|
631
628
|
ariaLabelClose: g.close_aria,
|
|
632
629
|
isOpen: n,
|
|
633
630
|
onClose: b,
|
|
634
|
-
title:
|
|
631
|
+
title: uo.title,
|
|
635
632
|
children: [
|
|
636
|
-
|
|
637
|
-
!
|
|
633
|
+
l && /* @__PURE__ */ e(Je, { transaction: l }),
|
|
634
|
+
!l && /* @__PURE__ */ e(et, { onClick: y })
|
|
638
635
|
]
|
|
639
636
|
}
|
|
640
637
|
);
|
|
641
|
-
},
|
|
642
|
-
const { onEvent: n } = V(), { isDesktop: o, isTablet: s, isMobile: h } =
|
|
643
|
-
|
|
638
|
+
}, go = R(ho), mo = ({ onBackClick: t, sx: r }) => {
|
|
639
|
+
const { onEvent: n } = V(), { isDesktop: o, isTablet: s, isMobile: h } = J(), { visibleAccounts: g } = ve(), { loadMonthlyCategoryTotals: d, monthlyCategoryTotals: c, getCategoryName: m } = $(), { sortedTransactions: y } = xe(), { selectedDateRange: l, setSelectedDateRange: b } = Ce(), { isCopyLoaded: i, isInitialized: C, selectedAccounts: p, setSelectedAccounts: _ } = pe(), { trends: x } = k(), [v, D] = u.useState(!1), [M, L] = u.useState(!1), [A, ee] = u.useState("Chart"), [W, F] = u.useState(""), [z, X] = u.useState(window.innerHeight), te = z - (h ? 315 : 345);
|
|
640
|
+
we({
|
|
644
641
|
widgetName: "TrendsFullWidget",
|
|
645
642
|
isLoaded: v
|
|
646
643
|
}), u.useEffect(() => {
|
|
@@ -649,37 +646,37 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
649
646
|
}, []), u.useEffect(() => {
|
|
650
647
|
_(g);
|
|
651
648
|
}, [g]), u.useEffect(() => {
|
|
652
|
-
C &&
|
|
649
|
+
C && d(
|
|
653
650
|
p,
|
|
654
|
-
|
|
655
|
-
|
|
651
|
+
l.start,
|
|
652
|
+
l.end
|
|
656
653
|
).finally(() => {
|
|
657
654
|
D(!0);
|
|
658
655
|
});
|
|
659
|
-
}, [C, p,
|
|
656
|
+
}, [C, p, l]);
|
|
660
657
|
const re = u.useMemo(() => {
|
|
661
658
|
if (!v) return { stackedDatasets: [], unstackedDatasets: [] };
|
|
662
659
|
const w = Lt(
|
|
663
660
|
c,
|
|
664
|
-
|
|
665
|
-
|
|
661
|
+
l.start,
|
|
662
|
+
l.end
|
|
666
663
|
), O = W.length ? w.filter(
|
|
667
|
-
(
|
|
664
|
+
(Y) => Y.top_level_category_guid === W || Y.category_guid === W
|
|
668
665
|
) : Et(w);
|
|
669
666
|
return {
|
|
670
667
|
stackedDatasets: O.filter(Dt),
|
|
671
668
|
unstackedDatasets: O.filter(Mt)
|
|
672
669
|
};
|
|
673
|
-
}, [c, W,
|
|
674
|
-
|
|
670
|
+
}, [c, W, l]), Z = (w, O) => {
|
|
671
|
+
ee(O ?? A), n(I.TRENDS_CLICK_TOGGLE_VIEW);
|
|
675
672
|
}, ce = (w) => {
|
|
676
|
-
const O = je(w?.[0], 1),
|
|
677
|
-
b({ start: O, end:
|
|
673
|
+
const O = je(w?.[0], 1), Y = w?.[1], le = ke(Y, O);
|
|
674
|
+
b({ start: O, end: Y }), n(I.TRENDS_CLICK_TIME_WINDOW, {
|
|
678
675
|
time_period: le + "M"
|
|
679
676
|
});
|
|
680
677
|
}, oe = () => {
|
|
681
678
|
n(I.TRENDS_CLICK_FILTER);
|
|
682
|
-
},
|
|
679
|
+
}, K = (w) => {
|
|
683
680
|
F(w);
|
|
684
681
|
}, ae = (w) => {
|
|
685
682
|
F(w), n(I.TRENDS_CLICK_LEGEND, { category: m(w) });
|
|
@@ -687,20 +684,20 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
687
684
|
n(I.TRENDS_HOVER_LEGEND, { category: m(w) });
|
|
688
685
|
}, ie = (w) => {
|
|
689
686
|
n(I.TRENDS_HOVER_AREA, { category: w });
|
|
690
|
-
},
|
|
687
|
+
}, Q = (w) => {
|
|
691
688
|
n(I.TRENDS_HOVER_POINT, { category: w });
|
|
692
689
|
};
|
|
693
690
|
return !i || !C || !v ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ f(
|
|
694
|
-
|
|
691
|
+
qe,
|
|
695
692
|
{
|
|
696
693
|
accountOptions: g,
|
|
697
694
|
calendarActions: { onRangeChanged: ce },
|
|
698
|
-
dateRange:
|
|
695
|
+
dateRange: l,
|
|
699
696
|
dateRangeVariant: "timeframebuttons",
|
|
700
697
|
onAccountsFilterClick: oe,
|
|
701
698
|
onBackClick: t,
|
|
702
699
|
sx: r,
|
|
703
|
-
title:
|
|
700
|
+
title: x.title,
|
|
704
701
|
children: [
|
|
705
702
|
/* @__PURE__ */ f(
|
|
706
703
|
S,
|
|
@@ -721,39 +718,39 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
721
718
|
st,
|
|
722
719
|
{
|
|
723
720
|
selectedCategoryGuid: W,
|
|
724
|
-
selectedDateRange:
|
|
721
|
+
selectedDateRange: l
|
|
725
722
|
}
|
|
726
723
|
),
|
|
727
|
-
/* @__PURE__ */ e(nt, { onTabChange: Z, selectedTab:
|
|
724
|
+
/* @__PURE__ */ e(nt, { onTabChange: Z, selectedTab: A })
|
|
728
725
|
]
|
|
729
726
|
}
|
|
730
727
|
),
|
|
731
728
|
/* @__PURE__ */ f(S, { alignItems: "center", flexDirection: "row", width: "100%", children: [
|
|
732
|
-
/* @__PURE__ */ e(
|
|
733
|
-
/* @__PURE__ */ e(
|
|
734
|
-
|
|
729
|
+
/* @__PURE__ */ e(N, { flexGrow: 1, children: W && /* @__PURE__ */ f(be, { onClick: () => F(""), sx: { p: 0, pr: 5 }, children: [
|
|
730
|
+
/* @__PURE__ */ e(_e, { name: "arrow_back" }),
|
|
731
|
+
x.all_categories
|
|
735
732
|
] }) }),
|
|
736
|
-
/* @__PURE__ */ e(
|
|
733
|
+
/* @__PURE__ */ e(be, { onClick: () => L(!0), sx: { px: 5 }, children: `${x.view_transactions} (${y.length})` })
|
|
737
734
|
] }),
|
|
738
|
-
/* @__PURE__ */ f(
|
|
739
|
-
|
|
740
|
-
|
|
735
|
+
/* @__PURE__ */ f(N, { children: [
|
|
736
|
+
A === "Chart" && /* @__PURE__ */ e(
|
|
737
|
+
ao,
|
|
741
738
|
{
|
|
742
739
|
availableHeight: te,
|
|
743
740
|
onClickLegend: ae,
|
|
744
741
|
onHoverArea: ie,
|
|
745
742
|
onHoverLegend: ne,
|
|
746
|
-
onHoverPoint:
|
|
743
|
+
onHoverPoint: Q,
|
|
747
744
|
stackedDatasets: re.stackedDatasets,
|
|
748
745
|
unstackedDatasets: re.unstackedDatasets
|
|
749
746
|
}
|
|
750
747
|
),
|
|
751
|
-
|
|
748
|
+
A === "Table" && /* @__PURE__ */ e(
|
|
752
749
|
rt,
|
|
753
750
|
{
|
|
754
|
-
onClickRow:
|
|
751
|
+
onClickRow: K,
|
|
755
752
|
selectedCategory: W,
|
|
756
|
-
selectedDateRange:
|
|
753
|
+
selectedDateRange: l
|
|
757
754
|
}
|
|
758
755
|
)
|
|
759
756
|
] })
|
|
@@ -761,21 +758,21 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
761
758
|
}
|
|
762
759
|
),
|
|
763
760
|
/* @__PURE__ */ e(
|
|
764
|
-
|
|
761
|
+
go,
|
|
765
762
|
{
|
|
766
763
|
categoryGuid: W,
|
|
767
|
-
dateRange:
|
|
768
|
-
isOpen:
|
|
769
|
-
onClose: () =>
|
|
764
|
+
dateRange: l,
|
|
765
|
+
isOpen: M,
|
|
766
|
+
onClose: () => L(!1)
|
|
770
767
|
}
|
|
771
768
|
)
|
|
772
769
|
]
|
|
773
770
|
}
|
|
774
771
|
);
|
|
775
|
-
},
|
|
772
|
+
}, Hn = R(mo), po = () => {
|
|
776
773
|
const { monthlyCategoryTotals: t } = $(), { trends: r } = k(), n = me(), { availableHeight: o = 300 } = Ue(), s = At(t);
|
|
777
774
|
return /* @__PURE__ */ e(
|
|
778
|
-
|
|
775
|
+
Oe,
|
|
779
776
|
{
|
|
780
777
|
baseline: "min",
|
|
781
778
|
colors: [n.palette.primary.main],
|
|
@@ -790,17 +787,17 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
790
787
|
valueFormatterString: "0,0"
|
|
791
788
|
}
|
|
792
789
|
);
|
|
793
|
-
},
|
|
794
|
-
const { visibleAccounts: n } =
|
|
795
|
-
return
|
|
790
|
+
}, Co = R(po), yo = ({ onPrimaryCtaClick: t, sx: r }) => {
|
|
791
|
+
const { visibleAccounts: n } = ve(), { loadMonthlyCategoryTotals: o, monthlyTotalsLoaded: s } = $(), { isInitialized: h } = We(), { trends: g } = k(), { isCopyLoaded: d, selectedAccounts: c, setSelectedAccounts: m } = pe();
|
|
792
|
+
return we({
|
|
796
793
|
widgetName: "TrendsMiniWidget",
|
|
797
794
|
isLoaded: s
|
|
798
795
|
}), u.useEffect(() => {
|
|
799
796
|
m(n);
|
|
800
797
|
}, [n]), u.useEffect(() => {
|
|
801
798
|
h && o(c).finally();
|
|
802
|
-
}, [h, c]), !
|
|
803
|
-
|
|
799
|
+
}, [h, c]), !d || !h ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(
|
|
800
|
+
Wt,
|
|
804
801
|
{
|
|
805
802
|
contentStyles: { height: "calc(100% - 72px)", ":last-child": { pb: 0 } },
|
|
806
803
|
onPrimaryCtaClick: t,
|
|
@@ -808,10 +805,10 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
808
805
|
subTitle: g.sub_title,
|
|
809
806
|
sx: { height: "100%", ...r },
|
|
810
807
|
title: g.mini_title,
|
|
811
|
-
children: s ? /* @__PURE__ */ e(
|
|
808
|
+
children: s ? /* @__PURE__ */ e(Co, {}) : /* @__PURE__ */ e(ge, {})
|
|
812
809
|
}
|
|
813
810
|
);
|
|
814
|
-
},
|
|
811
|
+
}, Nn = R(yo), fo = 70, ze = ({
|
|
815
812
|
title: t,
|
|
816
813
|
totalAmount: r,
|
|
817
814
|
transactionType: n,
|
|
@@ -819,10 +816,10 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
819
816
|
secondaryLabel: s,
|
|
820
817
|
shouldDisplayPercentage: h
|
|
821
818
|
}) => {
|
|
822
|
-
const { availableWidth: g } = Ue(),
|
|
819
|
+
const { availableWidth: g } = Ue(), d = u.useRef(null), c = u.useRef(null), m = wt(Number(Math.abs(o)), {
|
|
823
820
|
style: "percent",
|
|
824
821
|
minimumIntegerDigits: 1
|
|
825
|
-
}), y = g === 288 && se(r, "0,0.00").length > 10 ? se(r, "0,0") : se(r, "0,0.00"),
|
|
822
|
+
}), y = g === 288 && se(r, "0,0.00").length > 10 ? se(r, "0,0") : se(r, "0,0.00"), l = n === "spending" ? o > 0 : o >= 0, b = n === "spending" ? "error.main" : "success.main", i = n === "spending" ? "success.main" : "text.secondary", C = d?.current, p = c?.current, _ = C && p ? C.scrollWidth > p.clientWidth - fo : !1;
|
|
826
823
|
return /* @__PURE__ */ f(
|
|
827
824
|
S,
|
|
828
825
|
{
|
|
@@ -847,12 +844,12 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
847
844
|
children: [
|
|
848
845
|
/* @__PURE__ */ e(he, { color: "text.secondary", variant: "caption", children: t }),
|
|
849
846
|
h && /* @__PURE__ */ f(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
|
|
850
|
-
|
|
847
|
+
l ? /* @__PURE__ */ e(Gt, { size: 20, sx: { color: b } }) : /* @__PURE__ */ e(Bt, { size: 20, sx: { color: i } }),
|
|
851
848
|
/* @__PURE__ */ e(
|
|
852
849
|
he,
|
|
853
850
|
{
|
|
854
851
|
sx: {
|
|
855
|
-
color:
|
|
852
|
+
color: l ? b : i,
|
|
856
853
|
fontWeight: 600
|
|
857
854
|
},
|
|
858
855
|
variant: "body2",
|
|
@@ -874,9 +871,9 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
874
871
|
},
|
|
875
872
|
children: [
|
|
876
873
|
/* @__PURE__ */ e(
|
|
877
|
-
|
|
874
|
+
N,
|
|
878
875
|
{
|
|
879
|
-
ref:
|
|
876
|
+
ref: d,
|
|
880
877
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
881
878
|
children: /* @__PURE__ */ e(Ye, { children: y })
|
|
882
879
|
}
|
|
@@ -884,7 +881,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
884
881
|
h && g >= 450 && !_ && /* @__PURE__ */ e(
|
|
885
882
|
he,
|
|
886
883
|
{
|
|
887
|
-
color:
|
|
884
|
+
color: l ? b : i,
|
|
888
885
|
variant: "caption",
|
|
889
886
|
children: s
|
|
890
887
|
}
|
|
@@ -895,21 +892,21 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
895
892
|
]
|
|
896
893
|
}
|
|
897
894
|
);
|
|
898
|
-
},
|
|
895
|
+
}, _o = R(() => {
|
|
899
896
|
const { trends: t } = k();
|
|
900
897
|
return /* @__PURE__ */ f(S, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
|
|
901
|
-
/* @__PURE__ */ e(
|
|
898
|
+
/* @__PURE__ */ e(Vt, { size: 32 }),
|
|
902
899
|
/* @__PURE__ */ f(S, { children: [
|
|
903
900
|
/* @__PURE__ */ e(he, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
|
|
904
901
|
/* @__PURE__ */ e(he, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
|
|
905
902
|
] })
|
|
906
903
|
] });
|
|
907
|
-
}),
|
|
908
|
-
const { visibleAccounts: r } =
|
|
904
|
+
}), Wn = R(({ onCtaClick: t }) => {
|
|
905
|
+
const { visibleAccounts: r } = ve(), { onEvent: n } = V(), { monthlyCategoryTotals: o, loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: h } = $(), g = {
|
|
909
906
|
start: Ot(/* @__PURE__ */ new Date(), 1),
|
|
910
907
|
end: /* @__PURE__ */ new Date()
|
|
911
|
-
}, { trends:
|
|
912
|
-
|
|
908
|
+
}, { trends: d } = k(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: y } = pe();
|
|
909
|
+
we({
|
|
913
910
|
widgetName: "TrendsMicroWidget",
|
|
914
911
|
isLoaded: h
|
|
915
912
|
}), u.useEffect(() => {
|
|
@@ -921,26 +918,26 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
921
918
|
});
|
|
922
919
|
});
|
|
923
920
|
}, [y, c]);
|
|
924
|
-
const { spendingData:
|
|
921
|
+
const { spendingData: l, incomeData: b } = u.useMemo(
|
|
925
922
|
() => ({
|
|
926
923
|
spendingData: Ze(o, g),
|
|
927
|
-
incomeData:
|
|
924
|
+
incomeData: Qe(o, g)
|
|
928
925
|
}),
|
|
929
926
|
[o, g]
|
|
930
|
-
), [i, C] =
|
|
927
|
+
), [i, C] = l, [p, _] = b, x = Fe(C.y, i.y), v = Fe(_.y, p.y), D = y && !r?.length, M = () => {
|
|
931
928
|
n(
|
|
932
929
|
D ? I.TRENDS_CLICK_GET_STARTED : I.TRENDS_CLICK_VIEW_MORE
|
|
933
930
|
), t();
|
|
934
931
|
};
|
|
935
932
|
return !h || !y ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(
|
|
936
|
-
|
|
933
|
+
$t,
|
|
937
934
|
{
|
|
938
935
|
className: "mx-trends-microwidget",
|
|
939
|
-
ctaLabel:
|
|
940
|
-
onCTAClick:
|
|
941
|
-
subHeader: D ? void 0 :
|
|
942
|
-
title:
|
|
943
|
-
children: D ? /* @__PURE__ */ e(
|
|
936
|
+
ctaLabel: d.micro_primary_cta_label,
|
|
937
|
+
onCTAClick: M,
|
|
938
|
+
subHeader: D ? void 0 : d.micro_subheader,
|
|
939
|
+
title: d.title,
|
|
940
|
+
children: D ? /* @__PURE__ */ e(_o, {}) : /* @__PURE__ */ f(
|
|
944
941
|
S,
|
|
945
942
|
{
|
|
946
943
|
sx: {
|
|
@@ -952,10 +949,10 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
952
949
|
/* @__PURE__ */ e(
|
|
953
950
|
ze,
|
|
954
951
|
{
|
|
955
|
-
percentage:
|
|
956
|
-
secondaryLabel:
|
|
952
|
+
percentage: x,
|
|
953
|
+
secondaryLabel: d.micro_secondary_label,
|
|
957
954
|
shouldDisplayPercentage: C.y !== 0 && i.y !== 0,
|
|
958
|
-
title:
|
|
955
|
+
title: d.spending_label,
|
|
959
956
|
totalAmount: C.y,
|
|
960
957
|
transactionType: "spending"
|
|
961
958
|
}
|
|
@@ -964,9 +961,9 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
964
961
|
ze,
|
|
965
962
|
{
|
|
966
963
|
percentage: v,
|
|
967
|
-
secondaryLabel:
|
|
964
|
+
secondaryLabel: d.micro_secondary_label,
|
|
968
965
|
shouldDisplayPercentage: _.y !== 0 && p.y !== 0,
|
|
969
|
-
title:
|
|
966
|
+
title: d.income_label,
|
|
970
967
|
totalAmount: _.y,
|
|
971
968
|
transactionType: "income"
|
|
972
969
|
}
|
|
@@ -976,17 +973,17 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
976
973
|
)
|
|
977
974
|
}
|
|
978
975
|
);
|
|
979
|
-
}),
|
|
976
|
+
}), bo = R(
|
|
980
977
|
({ isExpanded: t, onClick: r }) => {
|
|
981
978
|
const n = tt();
|
|
982
|
-
return /* @__PURE__ */ e(
|
|
979
|
+
return /* @__PURE__ */ e(Yt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(jt, { onClick: r, sx: { justifyContent: "center" }, children: /* @__PURE__ */ f(
|
|
983
980
|
S,
|
|
984
981
|
{
|
|
985
982
|
sx: { color: n.palette.primary.main, flexDirection: "row", alignItems: "center" },
|
|
986
983
|
children: [
|
|
987
|
-
/* @__PURE__ */ e(
|
|
988
|
-
/* @__PURE__ */ e(
|
|
989
|
-
|
|
984
|
+
/* @__PURE__ */ e(Xt, { children: /* @__PURE__ */ e(P, { bold: !0, variant: "body2", children: t ? "View less" : "View more" }) }),
|
|
985
|
+
/* @__PURE__ */ e(Ut, { sx: { color: n.palette.primary.main }, children: t ? /* @__PURE__ */ e(Ft, {}) : /* @__PURE__ */ e(
|
|
986
|
+
Pt,
|
|
990
987
|
{
|
|
991
988
|
sx: {
|
|
992
989
|
transition: "transform 0.3s ease-in-out",
|
|
@@ -998,7 +995,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
998
995
|
}
|
|
999
996
|
) }) });
|
|
1000
997
|
}
|
|
1001
|
-
), Ke =
|
|
998
|
+
), Ke = R(
|
|
1002
999
|
({
|
|
1003
1000
|
totalAmount: t,
|
|
1004
1001
|
guid: r,
|
|
@@ -1008,9 +1005,9 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1008
1005
|
isLastItem: h = !1,
|
|
1009
1006
|
showDivider: g = !0
|
|
1010
1007
|
}) => {
|
|
1011
|
-
const { trends:
|
|
1008
|
+
const { trends: d } = k(), { onEvent: c } = V(), m = `${o.length} ${o.length === 1 ? d.transaction : d.transactions}`, y = () => {
|
|
1012
1009
|
s?.(), c(I.TRENDS_CLICK_LIST_ITEM, {
|
|
1013
|
-
...
|
|
1010
|
+
...B,
|
|
1014
1011
|
listItem: n
|
|
1015
1012
|
});
|
|
1016
1013
|
};
|
|
@@ -1018,7 +1015,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1018
1015
|
/* @__PURE__ */ e(
|
|
1019
1016
|
Xe,
|
|
1020
1017
|
{
|
|
1021
|
-
leftIcon: r ? /* @__PURE__ */ e(
|
|
1018
|
+
leftIcon: r ? /* @__PURE__ */ e(Se, { categoryGuid: r }) : void 0,
|
|
1022
1019
|
onClick: y,
|
|
1023
1020
|
rightContent: se(Math.abs(t), "0,0.00"),
|
|
1024
1021
|
rightIcon: s ? /* @__PURE__ */ e(ht, {}) : void 0,
|
|
@@ -1026,23 +1023,23 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1026
1023
|
title: n
|
|
1027
1024
|
}
|
|
1028
1025
|
),
|
|
1029
|
-
g && /* @__PURE__ */ e(
|
|
1026
|
+
g && /* @__PURE__ */ e(He, { sx: { ml: h ? 24 : 68 } })
|
|
1030
1027
|
] }, r);
|
|
1031
1028
|
}
|
|
1032
|
-
),
|
|
1029
|
+
), To = R(
|
|
1033
1030
|
({ availableHeight: t = 0, onCategoryClick: r }) => {
|
|
1034
|
-
const { collapsedCategories: n, visibleCategories: o, setVisibleListLength: s } = Ce(), { isLargeDesktop: h, isDesktop: g } =
|
|
1031
|
+
const { collapsedCategories: n, visibleCategories: o, setVisibleListLength: s } = Ce(), { isLargeDesktop: h, isDesktop: g } = J(), { trends: d } = k(), { onEvent: c } = V(), [m, y] = u.useState(!1), l = g || h;
|
|
1035
1032
|
u.useEffect(() => {
|
|
1036
1033
|
const C = Math.floor(t / 64) - 1, p = o.length + n.length;
|
|
1037
|
-
C !== o.length && (s(
|
|
1034
|
+
C !== o.length && (s(l ? Math.max(C, 5) : 5), y(C >= p));
|
|
1038
1035
|
}, [t]);
|
|
1039
1036
|
const b = () => {
|
|
1040
1037
|
y(!m), c(I.TRENDS_CLICK_VIEW_MORE, {
|
|
1041
|
-
...
|
|
1038
|
+
...B
|
|
1042
1039
|
});
|
|
1043
1040
|
}, i = o.length + (m ? n.length : 0);
|
|
1044
|
-
return /* @__PURE__ */ e(S, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(
|
|
1045
|
-
/* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Ye, { children:
|
|
1041
|
+
return /* @__PURE__ */ e(S, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(Kt, { children: [
|
|
1042
|
+
/* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Ye, { children: d.categories }) }),
|
|
1046
1043
|
o.map((C, p) => /* @__PURE__ */ e(
|
|
1047
1044
|
Ke,
|
|
1048
1045
|
{
|
|
@@ -1054,7 +1051,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1054
1051
|
C.guid
|
|
1055
1052
|
)),
|
|
1056
1053
|
/* @__PURE__ */ e(
|
|
1057
|
-
|
|
1054
|
+
zt,
|
|
1058
1055
|
{
|
|
1059
1056
|
in: m,
|
|
1060
1057
|
sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
|
|
@@ -1073,21 +1070,21 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1073
1070
|
})
|
|
1074
1071
|
}
|
|
1075
1072
|
),
|
|
1076
|
-
n.length > 0 && /* @__PURE__ */ e(
|
|
1073
|
+
n.length > 0 && /* @__PURE__ */ e(bo, { isExpanded: m, onClick: b })
|
|
1077
1074
|
] }) });
|
|
1078
1075
|
}
|
|
1079
|
-
),
|
|
1080
|
-
const { onEvent: n } = V(), { isMobile: o, isDesktop: s, isLargeDesktop: h } =
|
|
1081
|
-
r?.(v), n(I.TRENDS_CLICK_INSIGHT,
|
|
1082
|
-
}, i = m ? 200 : 170, C = m ? 170 : 124, p = m ? 56 : 0, _ = t.length > 0 ? i + p : C,
|
|
1076
|
+
), So = ({ beats: t, onInsightCardClick: r }) => {
|
|
1077
|
+
const { onEvent: n } = V(), { isMobile: o, isDesktop: s, isLargeDesktop: h } = J(), { beatStore: g, endpoint: d, sessionToken: c } = We(), m = s || h, y = m || o ? 1 : 2, l = () => null, b = (v) => {
|
|
1078
|
+
r?.(v), n(I.TRENDS_CLICK_INSIGHT, B);
|
|
1079
|
+
}, i = m ? 200 : 170, C = m ? 170 : 124, p = m ? 56 : 0, _ = t.length > 0 ? i + p : C, x = m && t.length > 0 ? i : void 0;
|
|
1083
1080
|
return /* @__PURE__ */ e(xt, { sx: { height: _ }, children: /* @__PURE__ */ e(
|
|
1084
|
-
|
|
1081
|
+
Nt,
|
|
1085
1082
|
{
|
|
1086
1083
|
areBeatsLoading: g.isLoading,
|
|
1087
1084
|
beats: t,
|
|
1088
|
-
endpoint:
|
|
1089
|
-
heightOverrides:
|
|
1090
|
-
logOutUser:
|
|
1085
|
+
endpoint: d,
|
|
1086
|
+
heightOverrides: x,
|
|
1087
|
+
logOutUser: l,
|
|
1091
1088
|
onCardClick: b,
|
|
1092
1089
|
showBorder: !0,
|
|
1093
1090
|
showCTAColocatedWithText: !1,
|
|
@@ -1101,12 +1098,12 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1101
1098
|
visibleCardsCount: y
|
|
1102
1099
|
}
|
|
1103
1100
|
) });
|
|
1104
|
-
},
|
|
1101
|
+
}, xo = R(So), vo = R(({ chartLabel: t, chartColor: r }) => {
|
|
1105
1102
|
const { onEvent: n } = V(), {
|
|
1106
1103
|
categoryDetailsChartData: { monthlyAmounts: o, tooltipLabels: s }
|
|
1107
1104
|
} = Ce();
|
|
1108
1105
|
return /* @__PURE__ */ e(S, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
|
|
1109
|
-
|
|
1106
|
+
Oe,
|
|
1110
1107
|
{
|
|
1111
1108
|
baseline: "min",
|
|
1112
1109
|
colors: [r],
|
|
@@ -1119,7 +1116,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1119
1116
|
stroke: r
|
|
1120
1117
|
}),
|
|
1121
1118
|
onItemClick: () => {
|
|
1122
|
-
n(I.TRENDS_CLICK_CHART,
|
|
1119
|
+
n(I.TRENDS_CLICK_CHART, B);
|
|
1123
1120
|
},
|
|
1124
1121
|
showArea: !0,
|
|
1125
1122
|
showAverage: !0,
|
|
@@ -1134,40 +1131,40 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1134
1131
|
valueFormatterString: "0,0"
|
|
1135
1132
|
}
|
|
1136
1133
|
) });
|
|
1137
|
-
}),
|
|
1138
|
-
const r = tt(), { onEvent: n } = V(), { common: o, trends: s } = k(), { selectedCategoryData: h, selectedDateRangeMonthRange: g } = Ce(), { sortedTransactions:
|
|
1134
|
+
}), wo = R(({ onClose: t }) => {
|
|
1135
|
+
const r = tt(), { onEvent: n } = V(), { common: o, trends: s } = k(), { selectedCategoryData: h, selectedDateRangeMonthRange: g } = Ce(), { sortedTransactions: d } = xe(), [c, m] = u.useState(null);
|
|
1139
1136
|
if (!h)
|
|
1140
1137
|
return null;
|
|
1141
|
-
const { guid: y, name:
|
|
1142
|
-
() =>
|
|
1143
|
-
[c,
|
|
1144
|
-
), D = (
|
|
1145
|
-
t?.(), n(I.TRENDS_CLICK_BACK,
|
|
1138
|
+
const { guid: y, name: l, is_income: b, totalAmount: i } = h, C = b ? s.category_income : s.category_spending, p = Qt(y, r), _ = b ? s.income_label : s.spending_label, x = ` ${h.transactions.length === 1 ? s.transaction : s.transactions} (${h.transactions.length})`, v = u.useMemo(
|
|
1139
|
+
() => d.find((L) => L.guid === c),
|
|
1140
|
+
[c, d]
|
|
1141
|
+
), D = (L) => L.category_guid === y || L.top_level_category_guid === y, M = () => {
|
|
1142
|
+
t?.(), n(I.TRENDS_CLICK_BACK, B);
|
|
1146
1143
|
};
|
|
1147
1144
|
return /* @__PURE__ */ f(
|
|
1148
|
-
|
|
1145
|
+
Ne,
|
|
1149
1146
|
{
|
|
1150
1147
|
ariaLabelClose: s.close_category_details,
|
|
1151
1148
|
isOpen: !0,
|
|
1152
|
-
onClose:
|
|
1149
|
+
onClose: M,
|
|
1153
1150
|
shouldShowHeaderShadow: !0,
|
|
1154
1151
|
title: C,
|
|
1155
1152
|
children: [
|
|
1156
1153
|
/* @__PURE__ */ f(S, { sx: { alignItems: "center", height: "100%" }, children: [
|
|
1157
|
-
/* @__PURE__ */ f(
|
|
1154
|
+
/* @__PURE__ */ f(Zt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
|
|
1158
1155
|
/* @__PURE__ */ e(
|
|
1159
1156
|
Xe,
|
|
1160
1157
|
{
|
|
1161
|
-
leftIcon: /* @__PURE__ */ e(
|
|
1158
|
+
leftIcon: /* @__PURE__ */ e(Se, { categoryGuid: y }),
|
|
1162
1159
|
rightContent: se(Math.abs(i), "0,0.00"),
|
|
1163
1160
|
subtitle: g,
|
|
1164
|
-
title:
|
|
1161
|
+
title: l
|
|
1165
1162
|
}
|
|
1166
1163
|
),
|
|
1167
|
-
/* @__PURE__ */ e(
|
|
1164
|
+
/* @__PURE__ */ e(vo, { chartColor: p, chartLabel: _ }),
|
|
1168
1165
|
/* @__PURE__ */ f(S, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
|
|
1169
|
-
/* @__PURE__ */ e(P, { bold: !0, variant: "body1", children:
|
|
1170
|
-
/* @__PURE__ */ e(
|
|
1166
|
+
/* @__PURE__ */ e(P, { bold: !0, variant: "body1", children: x }),
|
|
1167
|
+
/* @__PURE__ */ e(qt, { filter: D })
|
|
1171
1168
|
] })
|
|
1172
1169
|
] }),
|
|
1173
1170
|
/* @__PURE__ */ e(
|
|
@@ -1181,7 +1178,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1181
1178
|
)
|
|
1182
1179
|
] }),
|
|
1183
1180
|
/* @__PURE__ */ e(
|
|
1184
|
-
|
|
1181
|
+
Ne,
|
|
1185
1182
|
{
|
|
1186
1183
|
ariaLabelClose: o.close_aria,
|
|
1187
1184
|
isOpen: !!v,
|
|
@@ -1193,41 +1190,41 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1193
1190
|
]
|
|
1194
1191
|
}
|
|
1195
1192
|
);
|
|
1196
|
-
}),
|
|
1197
|
-
const n =
|
|
1193
|
+
}), Io = (t, r) => {
|
|
1194
|
+
const n = Qe(t, r), o = Ze(t, r);
|
|
1198
1195
|
return [n, o].filter((s) => s.length > 0);
|
|
1199
|
-
},
|
|
1196
|
+
}, Lo = (t, r) => {
|
|
1200
1197
|
const [n, o] = t, s = n, h = o ?? n, g = [];
|
|
1201
1198
|
if (s) {
|
|
1202
|
-
const
|
|
1203
|
-
g.push({ label: r.income_label, amount:
|
|
1199
|
+
const d = s.reduce((c, m) => c + m.y, 0);
|
|
1200
|
+
g.push({ label: r.income_label, amount: d });
|
|
1204
1201
|
}
|
|
1205
1202
|
if (h) {
|
|
1206
|
-
const
|
|
1207
|
-
g.push({ label: r.spending_label, amount:
|
|
1203
|
+
const d = h.reduce((c, m) => c + m.y, 0);
|
|
1204
|
+
g.push({ label: r.spending_label, amount: d });
|
|
1208
1205
|
}
|
|
1209
1206
|
return g;
|
|
1210
|
-
},
|
|
1207
|
+
}, Eo = ({
|
|
1211
1208
|
availableHeight: t = 0,
|
|
1212
1209
|
minHeight: r = 500,
|
|
1213
1210
|
selectedDateRange: n,
|
|
1214
1211
|
totals: o
|
|
1215
1212
|
}) => {
|
|
1216
|
-
const s = me(), { onEvent: h } = V(), { trends: g } = k(), { isSmallMobile:
|
|
1213
|
+
const s = me(), { onEvent: h } = V(), { trends: g } = k(), { isSmallMobile: d, isMobile: c, isSmallTablet: m, isTablet: y } = J(), l = [s.palette.chart?.chart1, s.palette.chart?.chart2], b = Io(o, n), i = Lo(b, g), [C, p] = u.useState(0), _ = 458, x = 195, v = 56, D = c || d ? x : m || y ? _ : C;
|
|
1217
1214
|
return u.useEffect(() => {
|
|
1218
|
-
const
|
|
1219
|
-
p(
|
|
1215
|
+
const L = Math.max(t - v, r);
|
|
1216
|
+
p(L);
|
|
1220
1217
|
}, [t]), /* @__PURE__ */ e(
|
|
1221
|
-
|
|
1218
|
+
Oe,
|
|
1222
1219
|
{
|
|
1223
1220
|
baseline: "min",
|
|
1224
|
-
colors:
|
|
1221
|
+
colors: l,
|
|
1225
1222
|
curveType: "bump",
|
|
1226
1223
|
datasets: b,
|
|
1227
1224
|
height: D,
|
|
1228
1225
|
labels: i,
|
|
1229
1226
|
onItemClick: () => {
|
|
1230
|
-
h(I.TRENDS_CLICK_CHART,
|
|
1227
|
+
h(I.TRENDS_CLICK_CHART, B);
|
|
1231
1228
|
},
|
|
1232
1229
|
showArea: !0,
|
|
1233
1230
|
showAxisHighlight: !0,
|
|
@@ -1240,7 +1237,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1240
1237
|
valueFormatterString: "0.0a"
|
|
1241
1238
|
}
|
|
1242
1239
|
);
|
|
1243
|
-
},
|
|
1240
|
+
}, Do = R(Eo), Mo = [
|
|
1244
1241
|
"BillAmountNotStandard",
|
|
1245
1242
|
"CategorySpendingV2",
|
|
1246
1243
|
"CostOfLivingToIncome",
|
|
@@ -1274,31 +1271,31 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1274
1271
|
"WeeklyNewMerchantsV2",
|
|
1275
1272
|
"WeeklyNoSpendDays",
|
|
1276
1273
|
"WeeklySmallPurchasesSummary"
|
|
1277
|
-
],
|
|
1278
|
-
const { onEvent: o } = V(), { config: s } = yt(), { isLargeDesktop: h, isDesktop: g, isMobile:
|
|
1274
|
+
], Ao = ({ onBackClick: t, onInsightCardClick: r, sx: n }) => {
|
|
1275
|
+
const { onEvent: o } = V(), { config: s } = yt(), { isLargeDesktop: h, isDesktop: g, isMobile: d } = J(), { visibleAccounts: c } = ve(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: y, monthlyCategoryTotals: l } = $(), { setFilter: b } = xe(), { selectedDateRange: i, setSelectedCategoryData: C, setSelectedDateRange: p } = Ce(), {
|
|
1279
1276
|
isCopyLoaded: _,
|
|
1280
|
-
isInitialized:
|
|
1277
|
+
isInitialized: x,
|
|
1281
1278
|
selectedAccounts: v,
|
|
1282
1279
|
selectedAccountGuids: D,
|
|
1283
|
-
setSelectedAccounts:
|
|
1284
|
-
} = pe(), { trends:
|
|
1285
|
-
() => c && c.length === 0 ||
|
|
1286
|
-
[c,
|
|
1280
|
+
setSelectedAccounts: M
|
|
1281
|
+
} = pe(), { trends: L, connect: A } = k(), { beatStore: ee } = We(), F = Jt() && s.show_insights_widget_in_master, z = g || h, [X, ye] = u.useState(!1), [te, re] = u.useState(!1), [Z, ce] = u.useState("Chart"), [oe, K] = u.useState(""), [ae, ne] = u.useState(!1), [ie, Q] = u.useState(window.innerHeight), w = z ? 56 : 0, O = ie - 208, Y = ie - (F ? 550 + w : 266), [le, fe] = u.useState(!1), Ie = s.show_connections_widget_in_master ? "buttons" : "no-buttons", a = u.useMemo(
|
|
1282
|
+
() => c && c.length === 0 || l.length === 0,
|
|
1283
|
+
[c, l]
|
|
1287
1284
|
);
|
|
1288
|
-
|
|
1285
|
+
we({
|
|
1289
1286
|
widgetName: "TrendsWidget",
|
|
1290
1287
|
isLoaded: X
|
|
1291
1288
|
}), u.useEffect(() => {
|
|
1292
|
-
|
|
1293
|
-
}, [
|
|
1294
|
-
const T = u.useMemo(() => te ?
|
|
1289
|
+
x && ee.loadBeats().finally(() => re(!0));
|
|
1290
|
+
}, [x]);
|
|
1291
|
+
const T = u.useMemo(() => te ? ee.getFilteredBeats({ templates: Mo }) : [], [te]);
|
|
1295
1292
|
u.useEffect(() => {
|
|
1296
|
-
const
|
|
1297
|
-
return window.addEventListener("resize",
|
|
1293
|
+
const H = () => Q(window.innerHeight);
|
|
1294
|
+
return window.addEventListener("resize", H), () => window.removeEventListener("resize", H);
|
|
1298
1295
|
}, []), u.useEffect(() => {
|
|
1299
|
-
|
|
1296
|
+
M(c);
|
|
1300
1297
|
}, [c]), u.useEffect(() => {
|
|
1301
|
-
|
|
1298
|
+
x && Promise.all([
|
|
1302
1299
|
m(
|
|
1303
1300
|
v,
|
|
1304
1301
|
i.start,
|
|
@@ -1307,80 +1304,80 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1307
1304
|
y(v, i.start, i.end)
|
|
1308
1305
|
]).finally(() => {
|
|
1309
1306
|
ye(!0), o(I.TRENDS_LOAD_WIDGET, {
|
|
1310
|
-
...
|
|
1311
|
-
time_period: `${
|
|
1307
|
+
...B,
|
|
1308
|
+
time_period: `${ke(i.end, i.start)}M`
|
|
1312
1309
|
});
|
|
1313
1310
|
});
|
|
1314
|
-
}, [
|
|
1315
|
-
if (
|
|
1316
|
-
const
|
|
1311
|
+
}, [x, v, i]), u.useEffect(() => {
|
|
1312
|
+
if (l.length !== 0) {
|
|
1313
|
+
const H = {
|
|
1317
1314
|
accounts: D,
|
|
1318
1315
|
dateRange: { start: i.start, end: i.end }
|
|
1319
1316
|
};
|
|
1320
1317
|
b({
|
|
1321
|
-
...
|
|
1322
|
-
custom: (
|
|
1323
|
-
(ue) => ue.top_level_category_guid ===
|
|
1318
|
+
...H,
|
|
1319
|
+
custom: (q) => !!l.find(
|
|
1320
|
+
(ue) => ue.top_level_category_guid === q.top_level_category_guid || ue.category_guid === q.category_guid
|
|
1324
1321
|
)
|
|
1325
1322
|
});
|
|
1326
1323
|
}
|
|
1327
|
-
}, [
|
|
1328
|
-
const E = (
|
|
1329
|
-
C(
|
|
1330
|
-
},
|
|
1324
|
+
}, [l]);
|
|
1325
|
+
const E = (H) => {
|
|
1326
|
+
C(H), ne(!0);
|
|
1327
|
+
}, j = () => {
|
|
1331
1328
|
C(null), ne(!1);
|
|
1332
|
-
},
|
|
1329
|
+
}, Le = () => {
|
|
1333
1330
|
fe(!0), o(I.TRENDS_CLICK_CONNECT_ACCOUNTS);
|
|
1334
|
-
},
|
|
1335
|
-
ce(
|
|
1336
|
-
...
|
|
1337
|
-
toggleView:
|
|
1331
|
+
}, Ee = (H, q) => {
|
|
1332
|
+
ce(q ?? Z), o(I.TRENDS_CLICK_TOGGLE_VIEW, {
|
|
1333
|
+
...B,
|
|
1334
|
+
toggleView: q
|
|
1338
1335
|
});
|
|
1339
|
-
}, de = (
|
|
1340
|
-
const
|
|
1341
|
-
p({ start:
|
|
1342
|
-
...
|
|
1336
|
+
}, de = (H) => {
|
|
1337
|
+
const q = je(H?.[0], 1), ue = H?.[1], it = ke(ue, q);
|
|
1338
|
+
p({ start: q, end: ue }), o(I.TRENDS_CLICK_TIME_WINDOW, {
|
|
1339
|
+
...B,
|
|
1343
1340
|
time_period: it + "M"
|
|
1344
1341
|
});
|
|
1345
|
-
},
|
|
1342
|
+
}, De = (H) => {
|
|
1346
1343
|
o(I.TRENDS_CLICK_FILTER, {
|
|
1347
|
-
...
|
|
1348
|
-
filterValue:
|
|
1344
|
+
...B,
|
|
1345
|
+
filterValue: H
|
|
1349
1346
|
});
|
|
1350
|
-
},
|
|
1351
|
-
|
|
1347
|
+
}, Me = (H) => {
|
|
1348
|
+
K(H);
|
|
1352
1349
|
}, at = () => {
|
|
1353
|
-
|
|
1350
|
+
K(""), o(I.TRENDS_CLICK_ALL_CATEGORIES, B);
|
|
1354
1351
|
};
|
|
1355
1352
|
return !_ || !X ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ f(
|
|
1356
|
-
|
|
1353
|
+
qe,
|
|
1357
1354
|
{
|
|
1358
1355
|
accountOptions: c,
|
|
1359
1356
|
calendarActions: { onRangeChanged: de },
|
|
1360
1357
|
dateRange: i,
|
|
1361
|
-
dateRangeVariant:
|
|
1362
|
-
onAccountsFilterClick:
|
|
1358
|
+
dateRangeVariant: d ? "timeframetabs" : "timeframebuttons",
|
|
1359
|
+
onAccountsFilterClick: De,
|
|
1363
1360
|
onBackClick: t,
|
|
1364
1361
|
sx: n,
|
|
1365
|
-
title:
|
|
1362
|
+
title: L.title,
|
|
1366
1363
|
children: [
|
|
1367
1364
|
a && /* @__PURE__ */ e(
|
|
1368
|
-
|
|
1365
|
+
eo,
|
|
1369
1366
|
{
|
|
1370
|
-
header:
|
|
1367
|
+
header: L.zero_state_content_header,
|
|
1371
1368
|
icon: "",
|
|
1372
|
-
onClick:
|
|
1373
|
-
primaryButton:
|
|
1374
|
-
subText:
|
|
1369
|
+
onClick: Le,
|
|
1370
|
+
primaryButton: L.empty_state_primary,
|
|
1371
|
+
subText: L.empty_state_sub_text,
|
|
1375
1372
|
sx: { height: O },
|
|
1376
|
-
variant:
|
|
1373
|
+
variant: Ie
|
|
1377
1374
|
}
|
|
1378
1375
|
),
|
|
1379
1376
|
!a && /* @__PURE__ */ f(
|
|
1380
1377
|
S,
|
|
1381
1378
|
{
|
|
1382
1379
|
sx: {
|
|
1383
|
-
px:
|
|
1380
|
+
px: d ? 0 : 48
|
|
1384
1381
|
},
|
|
1385
1382
|
children: [
|
|
1386
1383
|
/* @__PURE__ */ f(
|
|
@@ -1388,7 +1385,7 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1388
1385
|
{
|
|
1389
1386
|
flexDirection: "row",
|
|
1390
1387
|
justifyContent: "space-between",
|
|
1391
|
-
sx: { pb:
|
|
1388
|
+
sx: { pb: d ? 12 : 24, pt: d ? 24 : 48 },
|
|
1392
1389
|
children: [
|
|
1393
1390
|
/* @__PURE__ */ e(
|
|
1394
1391
|
st,
|
|
@@ -1397,72 +1394,72 @@ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
|
|
|
1397
1394
|
selectedDateRange: i
|
|
1398
1395
|
}
|
|
1399
1396
|
),
|
|
1400
|
-
/* @__PURE__ */ e(nt, { onTabChange:
|
|
1397
|
+
/* @__PURE__ */ e(nt, { onTabChange: Ee, selectedTab: Z })
|
|
1401
1398
|
]
|
|
1402
1399
|
}
|
|
1403
1400
|
),
|
|
1404
|
-
/* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(
|
|
1405
|
-
/* @__PURE__ */ e(
|
|
1406
|
-
|
|
1401
|
+
/* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(N, { flexGrow: 1, children: oe && /* @__PURE__ */ f(be, { onClick: at, sx: { p: 0, pr: 5 }, children: [
|
|
1402
|
+
/* @__PURE__ */ e(_e, { name: "arrow_back" }),
|
|
1403
|
+
L.all_categories
|
|
1407
1404
|
] }) }) }),
|
|
1408
|
-
/* @__PURE__ */ f(S, { flexDirection:
|
|
1405
|
+
/* @__PURE__ */ f(S, { flexDirection: z ? "row" : "column", gap: z ? 48 : 16, children: [
|
|
1409
1406
|
Z === "Chart" && /* @__PURE__ */ f(ct, { children: [
|
|
1410
|
-
/* @__PURE__ */ e(
|
|
1411
|
-
|
|
1407
|
+
/* @__PURE__ */ e(N, { sx: { width: z ? "68%" : "100%" }, children: /* @__PURE__ */ e(
|
|
1408
|
+
Do,
|
|
1412
1409
|
{
|
|
1413
1410
|
availableHeight: O,
|
|
1414
1411
|
minHeight: 450,
|
|
1415
1412
|
selectedDateRange: i,
|
|
1416
|
-
totals:
|
|
1413
|
+
totals: l
|
|
1417
1414
|
}
|
|
1418
1415
|
) }),
|
|
1419
|
-
/* @__PURE__ */ f(S, { gap: 16, sx: { width:
|
|
1416
|
+
/* @__PURE__ */ f(S, { gap: 16, sx: { width: z ? "32%" : "100%" }, children: [
|
|
1420
1417
|
F && te && T.length > 0 && /* @__PURE__ */ e(
|
|
1421
|
-
|
|
1418
|
+
xo,
|
|
1422
1419
|
{
|
|
1423
1420
|
beats: T,
|
|
1424
1421
|
onInsightCardClick: r
|
|
1425
1422
|
}
|
|
1426
1423
|
),
|
|
1427
1424
|
/* @__PURE__ */ e(
|
|
1428
|
-
|
|
1425
|
+
To,
|
|
1429
1426
|
{
|
|
1430
|
-
availableHeight:
|
|
1427
|
+
availableHeight: Y,
|
|
1431
1428
|
onCategoryClick: E
|
|
1432
1429
|
}
|
|
1433
1430
|
)
|
|
1434
1431
|
] })
|
|
1435
1432
|
] }),
|
|
1436
|
-
Z === "Table" && /* @__PURE__ */ e(
|
|
1433
|
+
Z === "Table" && /* @__PURE__ */ e(N, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
1437
1434
|
rt,
|
|
1438
1435
|
{
|
|
1439
1436
|
height: "unset",
|
|
1440
|
-
onClickRow:
|
|
1437
|
+
onClickRow: Me,
|
|
1441
1438
|
selectedCategory: oe,
|
|
1442
1439
|
selectedDateRange: i
|
|
1443
1440
|
}
|
|
1444
1441
|
) })
|
|
1445
1442
|
] }),
|
|
1446
|
-
ae && /* @__PURE__ */ e(
|
|
1443
|
+
ae && /* @__PURE__ */ e(wo, { onClose: j })
|
|
1447
1444
|
]
|
|
1448
1445
|
}
|
|
1449
1446
|
),
|
|
1450
1447
|
/* @__PURE__ */ e(
|
|
1451
|
-
|
|
1448
|
+
to,
|
|
1452
1449
|
{
|
|
1453
1450
|
onClose: () => fe(!1),
|
|
1454
1451
|
showConnectWidget: le,
|
|
1455
|
-
title:
|
|
1452
|
+
title: A.mini_title
|
|
1456
1453
|
}
|
|
1457
1454
|
)
|
|
1458
1455
|
]
|
|
1459
1456
|
}
|
|
1460
1457
|
);
|
|
1461
|
-
},
|
|
1458
|
+
}, On = R(Ao);
|
|
1462
1459
|
export {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1460
|
+
Hn as TrendsFullWidget,
|
|
1461
|
+
Wn as TrendsMicroWidget,
|
|
1462
|
+
Nn as TrendsMiniWidget,
|
|
1463
|
+
Vn as TrendsStore,
|
|
1464
|
+
On as TrendsWidget
|
|
1468
1465
|
};
|