@mx-cartographer/experiences 9.2.6 → 9.2.7
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 +4 -0
- package/dist/{UserStore-BceB3WHz.mjs → UserStore-CgsAunf1.mjs} +188 -167
- package/dist/UserStore-CgsAunf1.mjs.map +1 -0
- package/dist/common/index.es.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/core/stores/CategoryStore.d.ts +2 -0
- package/dist/spending/index.es.js +208 -184
- package/dist/spending/index.es.js.map +1 -1
- package/dist/trends/index.es.js +576 -574
- package/dist/trends/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/UserStore-BceB3WHz.mjs.map +0 -1
package/dist/trends/index.es.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { jsxs as C, jsx as e, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { observer as
|
|
4
|
-
import { CategoryIcon as ve, Text as
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as C, jsx as e, Fragment as xt } from "react/jsx-runtime";
|
|
2
|
+
import p, { useRef as vt, useState as wt, useEffect as Dt } from "react";
|
|
3
|
+
import { observer as R } from "mobx-react-lite";
|
|
4
|
+
import { CategoryIcon as ve, Text as P, Icon as He, H3 as Oe, P as fe } from "@mxenabled/mxui";
|
|
5
|
+
import W from "@mui/material/Box";
|
|
6
6
|
import S from "@mui/material/Stack";
|
|
7
7
|
import Te from "@mui/material/Button";
|
|
8
8
|
import { addSeconds as et } from "date-fns/addSeconds";
|
|
9
9
|
import { differenceInCalendarMonths as Se } from "date-fns/differenceInCalendarMonths";
|
|
10
|
-
import
|
|
11
|
-
import { useTheme as
|
|
12
|
-
import { useItemTooltip as
|
|
13
|
-
import { LineChart as
|
|
14
|
-
import { u as
|
|
15
|
-
import { u as
|
|
10
|
+
import It from "numeral";
|
|
11
|
+
import { useTheme as K, styled as Lt, alpha as Et } from "@mui/material/styles";
|
|
12
|
+
import { useItemTooltip as Mt, ChartsTooltipContainer as At } from "@mui/x-charts/ChartsTooltip";
|
|
13
|
+
import { LineChart as Rt } from "@mui/x-charts/LineChart";
|
|
14
|
+
import { u as Y } from "../useScreenSize-mWpmnh5w.mjs";
|
|
15
|
+
import { u as kt } from "../useDimensions-CeDR9V8N.mjs";
|
|
16
16
|
import tt from "@mui/material/Card";
|
|
17
17
|
import ot from "@mui/material/CardContent";
|
|
18
18
|
import Ne from "@mui/material/Divider";
|
|
19
19
|
import Fe from "@mui/material/Grid";
|
|
20
20
|
import { b as nt } from "../Localization-DnoVyBNK.mjs";
|
|
21
|
-
import { u as
|
|
21
|
+
import { u as k, l as U, f as V, a as ye, g as we, c as De, B as Ce, D as st, e as Be, i as rt } from "../hooks-97sNJ_lf.mjs";
|
|
22
22
|
import { C as xe } from "../CurrencyText-CCbE6MmF.mjs";
|
|
23
|
-
import { a as Re, C as $e, b as
|
|
24
|
-
import { f as
|
|
25
|
-
import { f as re, a as
|
|
26
|
-
import { a as
|
|
27
|
-
import { c as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import { parseISO as
|
|
23
|
+
import { a as Re, C as $e, b as Ht } from "../Category-DEKZGLYe.mjs";
|
|
24
|
+
import { f as j, D as B } from "../DateFormats-HudZ3Bjs.mjs";
|
|
25
|
+
import { f as re, a as Nt } from "../NumberFormatting--XMeeBfr.mjs";
|
|
26
|
+
import { a as je, c as Wt, g as Gt } from "../TrendsUtil-D9z3kIj_.mjs";
|
|
27
|
+
import { c as Ot, i as Bt, d as Pt, e as Vt, g as at, b as it, f as Ke } from "../SpendingData-Fii_xATx.mjs";
|
|
28
|
+
import zt from "@mui/material/ToggleButton";
|
|
29
|
+
import Ft from "@mui/material/ToggleButtonGroup";
|
|
30
|
+
import { parseISO as ct } from "date-fns/parseISO";
|
|
31
31
|
import { H as ke } from "../HeaderCell-P8w6CmfO.mjs";
|
|
32
|
-
import { T as
|
|
33
|
-
import { useGridApiContext as
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import { A as
|
|
37
|
-
import { T as
|
|
32
|
+
import { T as O, a as $t } from "../ViewMoreMicroCard-B4oeGrbE.mjs";
|
|
33
|
+
import { useGridApiContext as jt, useGridRootProps as Kt, DataGridPro as Yt } from "@mui/x-data-grid-pro";
|
|
34
|
+
import Ut from "@mui/material/Badge";
|
|
35
|
+
import Xt from "@mui/material/IconButton";
|
|
36
|
+
import { A as D } from "../Analytics-D-jdcL72.mjs";
|
|
37
|
+
import { T as lt } from "../EmbeddedCard-CQEnrozC.mjs";
|
|
38
38
|
import { T as dt } from "../TransactionDetails-CLc7oeHT.mjs";
|
|
39
39
|
import { D as Pe } from "../Drawer-DsnW2o0v.mjs";
|
|
40
40
|
import { u as Ie } from "../useWidgetLoadTimer-B0tB-yzL.mjs";
|
|
41
41
|
import { L as Le } from "../Loader-CxeBwuPG.mjs";
|
|
42
42
|
import { W as ut } from "../WidgetContainer-DvKtBdhn.mjs";
|
|
43
43
|
import { L as Ve } from "../LineChart-CUfiH86G.mjs";
|
|
44
|
-
import { M as
|
|
45
|
-
import { subMonths as
|
|
46
|
-
import { TrendingUp as
|
|
47
|
-
import { M as
|
|
48
|
-
import
|
|
44
|
+
import { M as Zt } from "../MiniWidgetContainer-Bmv_WeUd.mjs";
|
|
45
|
+
import { subMonths as Qt } from "date-fns";
|
|
46
|
+
import { TrendingUp as qt, TrendingDown as Jt, MultilineChart as eo, ExpandLess as to, ExpandMore as oo, ChevronRight as no, ArrowBack as so } from "@mxenabled/mx-icons";
|
|
47
|
+
import { M as ro } from "../MicroWidgetContainer-B2NnKBgW.mjs";
|
|
48
|
+
import ao from "@mui/material/Collapse";
|
|
49
49
|
import We from "@mui/material/List";
|
|
50
50
|
import mt from "@mui/material/ListItem";
|
|
51
|
-
import
|
|
51
|
+
import io from "@mui/material/ListItemButton";
|
|
52
52
|
import co from "@mui/material/ListItemIcon";
|
|
53
53
|
import ht from "@mui/material/ListItemText";
|
|
54
|
-
import { g as
|
|
55
|
-
import { L as
|
|
56
|
-
import { Stack as
|
|
57
|
-
import
|
|
58
|
-
import { E as
|
|
59
|
-
import { u as
|
|
60
|
-
import { E as
|
|
61
|
-
import { C as
|
|
54
|
+
import { g as Ge } from "../TransactionUtils-BphBJBbU.mjs";
|
|
55
|
+
import { L as lo } from "../ListItemRow-kH1rn8Xu.mjs";
|
|
56
|
+
import { Stack as uo } from "@mui/material";
|
|
57
|
+
import mo from "@mui/material/ListItemAvatar";
|
|
58
|
+
import { E as ho } from "../ExportCsvAction-B_8I-Le6.mjs";
|
|
59
|
+
import { u as go } from "../useInsightsEnabled-D5Sdm0TJ.mjs";
|
|
60
|
+
import { E as po } from "../EmptyState-CJUDc3kD.mjs";
|
|
61
|
+
import { C as fo } from "../ConnectDrawer-CW4LA3H3.mjs";
|
|
62
62
|
const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
63
|
-
const { categories: s } =
|
|
63
|
+
const { categories: s } = k(), { getCategoryName: o } = U(), r = o(t);
|
|
64
64
|
return /* @__PURE__ */ C(S, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
|
|
65
65
|
/* @__PURE__ */ e(
|
|
66
|
-
|
|
66
|
+
W,
|
|
67
67
|
{
|
|
68
68
|
"aria-label": nt(s.category_icon_label_aria, r),
|
|
69
69
|
mb: 4,
|
|
@@ -71,22 +71,22 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
71
71
|
children: /* @__PURE__ */ e(ve, { categoryGuid: n })
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
|
-
/* @__PURE__ */ e(
|
|
74
|
+
/* @__PURE__ */ e(P, { variant: "body1", children: r })
|
|
75
75
|
] });
|
|
76
|
-
},
|
|
76
|
+
}, yo = ({
|
|
77
77
|
categoryGuids: { guid: t, topLevelGuid: n },
|
|
78
78
|
hoveredAreaData: s,
|
|
79
79
|
cursorPosition: o,
|
|
80
80
|
chartContainerRef: r
|
|
81
81
|
}) => {
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
82
|
+
const l = K(), a = vt(null), [c, u] = wt({ x: o.x, y: o.y });
|
|
83
|
+
if (Dt(() => {
|
|
84
84
|
(() => {
|
|
85
85
|
const m = a.current, _ = r.current;
|
|
86
86
|
if (!m || !_) return;
|
|
87
|
-
const
|
|
87
|
+
const g = m.getBoundingClientRect(), h = _.getBoundingClientRect();
|
|
88
88
|
let y = o.x, T = o.y;
|
|
89
|
-
y +
|
|
89
|
+
y + g.width * 2 > h.right ? y = o.x - g.width : y - g.width < h.left && (y = o.x), T + g.height * 2 > h.bottom && (T = o.y - g.height), u({ x: y, y: T });
|
|
90
90
|
})();
|
|
91
91
|
}, [o, r]), !s) return null;
|
|
92
92
|
const i = s.reduce((f, m) => f + m.y, 0);
|
|
@@ -96,22 +96,22 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
96
96
|
ref: a,
|
|
97
97
|
sx: {
|
|
98
98
|
position: "absolute",
|
|
99
|
-
top:
|
|
100
|
-
left:
|
|
99
|
+
top: c.y,
|
|
100
|
+
left: c.x,
|
|
101
101
|
width: 250,
|
|
102
102
|
pointerEvents: "none"
|
|
103
103
|
},
|
|
104
104
|
children: /* @__PURE__ */ C(ot, { children: [
|
|
105
|
-
/* @__PURE__ */ C(
|
|
105
|
+
/* @__PURE__ */ C(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
106
106
|
/* @__PURE__ */ e(gt, { categoryGuid: t, topLevelCategoryGuid: n }),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
107
|
+
/* @__PURE__ */ e(P, { variant: "body2", children: `${s.length}-month total` }),
|
|
108
108
|
/* @__PURE__ */ e(xe, { amount: i, bold: !0, formatString: "0,0", variant: "body2" })
|
|
109
109
|
] }),
|
|
110
110
|
/* @__PURE__ */ e(Ne, { sx: { my: 16, width: "100%" } }),
|
|
111
|
-
/* @__PURE__ */ e(Fe, { container: !0, children: s.map((f, m) => /* @__PURE__ */ C(
|
|
111
|
+
/* @__PURE__ */ e(Fe, { container: !0, children: s.map((f, m) => /* @__PURE__ */ C(p.Fragment, { children: [
|
|
112
112
|
m > 0 && m % 3 === 0 && /* @__PURE__ */ e(Ne, { sx: { my: 16, width: "100%" } }),
|
|
113
|
-
/* @__PURE__ */ e(Fe, { size: 4, children: /* @__PURE__ */ C(
|
|
114
|
-
/* @__PURE__ */ e(
|
|
113
|
+
/* @__PURE__ */ e(Fe, { size: 4, children: /* @__PURE__ */ C(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
114
|
+
/* @__PURE__ */ e(P, { color: l.palette.text.secondary, variant: "caption", children: f.x }),
|
|
115
115
|
/* @__PURE__ */ e(
|
|
116
116
|
xe,
|
|
117
117
|
{
|
|
@@ -126,15 +126,15 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
126
126
|
] })
|
|
127
127
|
}
|
|
128
128
|
);
|
|
129
|
-
},
|
|
129
|
+
}, Co = R(yo), _o = ({
|
|
130
130
|
sx: t,
|
|
131
131
|
categoryGuids: n,
|
|
132
132
|
hoveredLegend: s,
|
|
133
133
|
legendRef: o,
|
|
134
134
|
onHoverLegend: r,
|
|
135
|
-
onClickLegend:
|
|
135
|
+
onClickLegend: l
|
|
136
136
|
}) => {
|
|
137
|
-
const { isMobile: a } =
|
|
137
|
+
const { isMobile: a } = Y(), { getCategoryName: c } = U();
|
|
138
138
|
return /* @__PURE__ */ e(
|
|
139
139
|
S,
|
|
140
140
|
{
|
|
@@ -145,11 +145,11 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
145
145
|
ref: o,
|
|
146
146
|
sx: t,
|
|
147
147
|
children: n.map(({ guid: u, top_level_guid: i }) => {
|
|
148
|
-
const f = s === u, m = Re[u], _ = Re[i],
|
|
148
|
+
const f = s === u, m = Re[u], _ = Re[i], g = m ?? _ ?? Re.default, h = g + "33";
|
|
149
149
|
return /* @__PURE__ */ C(
|
|
150
150
|
Te,
|
|
151
151
|
{
|
|
152
|
-
onClick: () =>
|
|
152
|
+
onClick: () => l(u),
|
|
153
153
|
onMouseEnter: () => r(u),
|
|
154
154
|
onMouseLeave: () => r(null),
|
|
155
155
|
sx: {
|
|
@@ -165,18 +165,18 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
165
165
|
},
|
|
166
166
|
children: [
|
|
167
167
|
/* @__PURE__ */ e(
|
|
168
|
-
|
|
168
|
+
W,
|
|
169
169
|
{
|
|
170
170
|
sx: {
|
|
171
171
|
width: 16,
|
|
172
172
|
height: 16,
|
|
173
173
|
marginRight: a ? 5 : 10,
|
|
174
174
|
borderRadius: "2px",
|
|
175
|
-
backgroundColor: s ? f ?
|
|
175
|
+
backgroundColor: s ? f ? g : h : g
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
),
|
|
179
|
-
/* @__PURE__ */ e(
|
|
179
|
+
/* @__PURE__ */ e(P, { variant: "body1", children: c(u) })
|
|
180
180
|
]
|
|
181
181
|
},
|
|
182
182
|
u
|
|
@@ -184,128 +184,128 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
184
184
|
})
|
|
185
185
|
}
|
|
186
186
|
);
|
|
187
|
-
},
|
|
187
|
+
}, bo = ({
|
|
188
188
|
categoryGuids: { guid: t, topLevelGuid: n },
|
|
189
189
|
series: s,
|
|
190
190
|
xData: o
|
|
191
191
|
}) => {
|
|
192
|
-
const r =
|
|
192
|
+
const r = Mt(), l = K();
|
|
193
193
|
if (!r?.identifier) return null;
|
|
194
|
-
const { dataIndex: a, seriesId:
|
|
195
|
-
if (a == null || !
|
|
196
|
-
const i = s.find((m) => m.id ===
|
|
197
|
-
return i === void 0 || !f ? null : /* @__PURE__ */ e(tt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ C(
|
|
194
|
+
const { dataIndex: a, seriesId: c } = r.identifier;
|
|
195
|
+
if (a == null || !c) return null;
|
|
196
|
+
const i = s.find((m) => m.id === c)?.data?.[a], f = o?.[a];
|
|
197
|
+
return i === void 0 || !f ? null : /* @__PURE__ */ e(tt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ C(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
198
198
|
/* @__PURE__ */ e(gt, { categoryGuid: t, topLevelCategoryGuid: n }),
|
|
199
|
-
/* @__PURE__ */ e(
|
|
199
|
+
/* @__PURE__ */ e(P, { color: l.palette.text.secondary, variant: "body2", children: j(f, B.MONTH_SHORT_YEAR) }),
|
|
200
200
|
/* @__PURE__ */ e(xe, { amount: String(i), bold: !0, formatString: "0,0", variant: "body1" })
|
|
201
201
|
] }) }) });
|
|
202
|
-
},
|
|
202
|
+
}, To = ({
|
|
203
203
|
onHoverArea: t,
|
|
204
204
|
onHoverPoint: n,
|
|
205
205
|
onHoverLegend: s,
|
|
206
206
|
onClickLegend: o,
|
|
207
207
|
stackedDatasets: r,
|
|
208
|
-
unstackedDatasets:
|
|
208
|
+
unstackedDatasets: l = [],
|
|
209
209
|
availableHeight: a = 0,
|
|
210
|
-
minimumHeight:
|
|
210
|
+
minimumHeight: c = 350
|
|
211
211
|
}) => {
|
|
212
|
-
const u =
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
|
|
212
|
+
const u = K(), { isMobile: i } = Y(), [f, { height: m }] = kt(), _ = p.useRef(null), [g, h] = p.useState(0);
|
|
213
|
+
p.useEffect(() => {
|
|
214
|
+
const d = Math.max(a - m, c);
|
|
215
|
+
h(d);
|
|
216
216
|
}, [a, m]);
|
|
217
|
-
const [y, T] =
|
|
217
|
+
const [y, T] = p.useState(null), [x, H] = p.useState({
|
|
218
218
|
hoveredSeriesId: null,
|
|
219
219
|
hoveredAreaData: null,
|
|
220
220
|
isAreaHovered: !1,
|
|
221
221
|
cursorPos: { x: 0, y: 0 }
|
|
222
|
-
}), { hoveredSeriesId: L, hoveredAreaData: M, isAreaHovered:
|
|
223
|
-
(
|
|
224
|
-
) ?? [0],
|
|
225
|
-
...
|
|
226
|
-
),
|
|
222
|
+
}), { hoveredSeriesId: L, hoveredAreaData: M, isAreaHovered: I, cursorPos: E } = x, X = I && L && M, Z = !X, te = [...r, ...l], oe = te[0]?.dataset.length ?? 0, A = te.flatMap((d) => d.dataset.map((b) => b.x)), de = te.flatMap((d) => d.dataset.map((b) => b.y)), G = r[0]?.dataset?.map(
|
|
223
|
+
(d, b) => r.reduce((w, $) => w + $.dataset[b]?.y || 0, 0)
|
|
224
|
+
) ?? [0], ae = Math.max(...G), ie = Math.max(
|
|
225
|
+
...l.flatMap((d) => d.dataset.map((b) => b.y))
|
|
226
|
+
), z = Math.floor(Math.min(...de) / 100) * 100, ue = Math.ceil(Math.max(ae, ie) / 100) * 100, Q = r.map((d, b) => ({
|
|
227
227
|
id: `stacked-${b}`,
|
|
228
|
-
guid:
|
|
229
|
-
top_level_guid:
|
|
228
|
+
guid: d.category_guid,
|
|
229
|
+
top_level_guid: d.top_level_category_guid,
|
|
230
230
|
area: !0,
|
|
231
231
|
color: r[b].category_color ?? u.palette.primary.main,
|
|
232
|
-
data:
|
|
232
|
+
data: d.dataset.map((w) => w.y),
|
|
233
233
|
label: r[b].category_name,
|
|
234
234
|
stack: "total",
|
|
235
235
|
type: "line",
|
|
236
236
|
highlightScope: { highlight: "item" },
|
|
237
|
-
valueFormatter: (
|
|
238
|
-
})),
|
|
237
|
+
valueFormatter: (w) => re(w, "0,0")
|
|
238
|
+
})), F = l.map((d, b) => ({
|
|
239
239
|
id: `unstacked-${b}`,
|
|
240
|
-
guid:
|
|
241
|
-
top_level_guid:
|
|
240
|
+
guid: d.category_guid,
|
|
241
|
+
top_level_guid: d.top_level_category_guid,
|
|
242
242
|
area: !1,
|
|
243
|
-
color:
|
|
244
|
-
data:
|
|
245
|
-
label:
|
|
243
|
+
color: d.category_color,
|
|
244
|
+
data: d.dataset.map((w) => w.y),
|
|
245
|
+
label: d.category_name,
|
|
246
246
|
type: "line",
|
|
247
|
-
valueFormatter: (
|
|
248
|
-
})),
|
|
249
|
-
...
|
|
250
|
-
guid:
|
|
247
|
+
valueFormatter: (w) => re(w, "0,0")
|
|
248
|
+
})), ne = [...Q, ...F], q = [
|
|
249
|
+
...Q.map(({ guid: d, top_level_guid: b }) => ({
|
|
250
|
+
guid: d,
|
|
251
251
|
top_level_guid: b
|
|
252
252
|
})),
|
|
253
|
-
...
|
|
254
|
-
guid:
|
|
253
|
+
...F.map(({ guid: d, top_level_guid: b }) => ({
|
|
254
|
+
guid: d,
|
|
255
255
|
top_level_guid: b
|
|
256
256
|
}))
|
|
257
|
-
],
|
|
258
|
-
const
|
|
257
|
+
], J = (d) => {
|
|
258
|
+
const w = d.startsWith("stacked-") ? r[parseInt(d.split("-")[1])] : l[parseInt(d.split("-")[1])];
|
|
259
259
|
return {
|
|
260
|
-
guid:
|
|
261
|
-
topLevelGuid:
|
|
260
|
+
guid: w?.category_guid,
|
|
261
|
+
topLevelGuid: w?.top_level_category_guid
|
|
262
262
|
};
|
|
263
|
-
},
|
|
264
|
-
T(
|
|
265
|
-
},
|
|
266
|
-
o?.(
|
|
263
|
+
}, se = (d) => {
|
|
264
|
+
T(d), s?.(d ?? "");
|
|
265
|
+
}, ce = (d) => {
|
|
266
|
+
o?.(d ?? "");
|
|
267
267
|
}, le = () => {
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
const b = String(
|
|
272
|
-
if (
|
|
273
|
-
|
|
268
|
+
const d = J(String(L)).guid;
|
|
269
|
+
d && o?.(d);
|
|
270
|
+
}, me = (d) => {
|
|
271
|
+
const b = String(d?.seriesId), w = J(b).guid, $ = ne.find((ge) => ge.id === b), _e = $ && d?.dataIndex !== void 0, Ee = $ && d?.dataIndex === void 0;
|
|
272
|
+
if (_e)
|
|
273
|
+
H({
|
|
274
274
|
hoveredSeriesId: b,
|
|
275
275
|
hoveredAreaData: null,
|
|
276
276
|
isAreaHovered: !1,
|
|
277
|
-
cursorPos:
|
|
278
|
-
}), n?.(
|
|
279
|
-
else if (
|
|
280
|
-
const
|
|
281
|
-
x:
|
|
277
|
+
cursorPos: E
|
|
278
|
+
}), n?.(w);
|
|
279
|
+
else if (Ee) {
|
|
280
|
+
const ge = $?.data.map((Me, Ae) => ({
|
|
281
|
+
x: A[Ae],
|
|
282
282
|
y: Me
|
|
283
283
|
})) ?? [];
|
|
284
|
-
|
|
284
|
+
H({
|
|
285
285
|
hoveredSeriesId: b,
|
|
286
|
-
hoveredAreaData:
|
|
286
|
+
hoveredAreaData: ge,
|
|
287
287
|
isAreaHovered: !0,
|
|
288
|
-
cursorPos:
|
|
289
|
-
}), t?.(
|
|
288
|
+
cursorPos: E
|
|
289
|
+
}), t?.(w);
|
|
290
290
|
} else
|
|
291
|
-
|
|
291
|
+
H({
|
|
292
292
|
hoveredSeriesId: null,
|
|
293
293
|
hoveredAreaData: null,
|
|
294
294
|
isAreaHovered: !1,
|
|
295
|
-
cursorPos:
|
|
295
|
+
cursorPos: E
|
|
296
296
|
});
|
|
297
|
-
},
|
|
298
|
-
if (
|
|
297
|
+
}, he = (d) => {
|
|
298
|
+
if (d.target instanceof Element && d.target.classList[0]?.includes("MuiMarkElement-root"))
|
|
299
299
|
return;
|
|
300
|
-
const b =
|
|
301
|
-
|
|
302
|
-
...
|
|
300
|
+
const b = d.currentTarget.getBoundingClientRect();
|
|
301
|
+
H((w) => ({
|
|
302
|
+
...w,
|
|
303
303
|
cursorPos: {
|
|
304
|
-
x:
|
|
305
|
-
y:
|
|
304
|
+
x: d.clientX - b.left,
|
|
305
|
+
y: d.clientY - b.top
|
|
306
306
|
}
|
|
307
307
|
}));
|
|
308
|
-
},
|
|
308
|
+
}, v = {
|
|
309
309
|
p: 4,
|
|
310
310
|
"& .MuiBarLabel-root": {
|
|
311
311
|
fontSize: 10,
|
|
@@ -321,17 +321,17 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
321
321
|
'& [class*="MuiLineElement-series-unstacked-"]': {
|
|
322
322
|
strokeWidth: 3
|
|
323
323
|
},
|
|
324
|
-
...y &&
|
|
325
|
-
const
|
|
326
|
-
return
|
|
327
|
-
opacity:
|
|
328
|
-
},
|
|
324
|
+
...y && Q.reduce((d, b, w) => {
|
|
325
|
+
const $ = `.MuiAreaElement-series-stacked-${w}`;
|
|
326
|
+
return d[$] = {
|
|
327
|
+
opacity: Q[w].guid === y ? 0.9 : 0.2
|
|
328
|
+
}, d;
|
|
329
329
|
}, {})
|
|
330
330
|
};
|
|
331
331
|
return /* @__PURE__ */ e(
|
|
332
|
-
|
|
332
|
+
W,
|
|
333
333
|
{
|
|
334
|
-
onMouseMove:
|
|
334
|
+
onMouseMove: he,
|
|
335
335
|
ref: _,
|
|
336
336
|
sx: {
|
|
337
337
|
position: "relative",
|
|
@@ -352,68 +352,68 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
352
352
|
sx: { width: "100%", position: "relative" },
|
|
353
353
|
children: [
|
|
354
354
|
/* @__PURE__ */ e(
|
|
355
|
-
|
|
355
|
+
Rt,
|
|
356
356
|
{
|
|
357
|
-
height:
|
|
357
|
+
height: g,
|
|
358
358
|
hideLegend: !0,
|
|
359
359
|
margin: { bottom: 24, left: 12, right: 54, top: 48 },
|
|
360
360
|
onAreaClick: le,
|
|
361
|
-
onHighlightChange:
|
|
362
|
-
series:
|
|
361
|
+
onHighlightChange: me,
|
|
362
|
+
series: ne,
|
|
363
363
|
skipAnimation: !0,
|
|
364
364
|
slotProps: {
|
|
365
|
-
tooltip: { trigger:
|
|
365
|
+
tooltip: { trigger: Z ? "item" : "none" }
|
|
366
366
|
},
|
|
367
367
|
slots: {
|
|
368
|
-
tooltip:
|
|
369
|
-
|
|
368
|
+
tooltip: Z && L ? (d) => /* @__PURE__ */ e(At, { children: /* @__PURE__ */ e(
|
|
369
|
+
bo,
|
|
370
370
|
{
|
|
371
|
-
...
|
|
372
|
-
categoryGuids:
|
|
373
|
-
series:
|
|
374
|
-
xData:
|
|
371
|
+
...d,
|
|
372
|
+
categoryGuids: J(L),
|
|
373
|
+
series: ne,
|
|
374
|
+
xData: A
|
|
375
375
|
}
|
|
376
376
|
) }) : void 0
|
|
377
377
|
},
|
|
378
|
-
sx:
|
|
378
|
+
sx: v,
|
|
379
379
|
xAxis: [
|
|
380
380
|
{
|
|
381
|
-
data:
|
|
381
|
+
data: A,
|
|
382
382
|
scaleType: "time",
|
|
383
|
-
valueFormatter: (
|
|
384
|
-
tickNumber:
|
|
383
|
+
valueFormatter: (d) => j(d, B.MONTH_SHORT_YEAR),
|
|
384
|
+
tickNumber: oe
|
|
385
385
|
// How many ticks to show on the x-axis
|
|
386
386
|
}
|
|
387
387
|
],
|
|
388
388
|
yAxis: [
|
|
389
389
|
{
|
|
390
|
-
min:
|
|
391
|
-
max:
|
|
392
|
-
valueFormatter: (
|
|
390
|
+
min: z,
|
|
391
|
+
max: ue || 100,
|
|
392
|
+
valueFormatter: (d) => It(d).format("0a")
|
|
393
393
|
}
|
|
394
394
|
]
|
|
395
395
|
}
|
|
396
396
|
),
|
|
397
397
|
/* @__PURE__ */ e(
|
|
398
|
-
|
|
398
|
+
_o,
|
|
399
399
|
{
|
|
400
|
-
categoryGuids:
|
|
400
|
+
categoryGuids: q,
|
|
401
401
|
hoveredLegend: y,
|
|
402
402
|
legendRef: f,
|
|
403
|
-
onClickLegend:
|
|
404
|
-
onHoverLegend:
|
|
403
|
+
onClickLegend: ce,
|
|
404
|
+
onHoverLegend: se,
|
|
405
405
|
sx: { px: i ? 0 : 24 }
|
|
406
406
|
}
|
|
407
407
|
),
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
X && /* @__PURE__ */ e(
|
|
409
|
+
Co,
|
|
410
410
|
{
|
|
411
|
-
categoryGuids:
|
|
411
|
+
categoryGuids: J(L),
|
|
412
412
|
chartContainerRef: _,
|
|
413
|
-
cursorPosition:
|
|
414
|
-
hoveredAreaData: M.map((
|
|
415
|
-
...
|
|
416
|
-
x:
|
|
413
|
+
cursorPosition: E,
|
|
414
|
+
hoveredAreaData: M.map((d) => ({
|
|
415
|
+
...d,
|
|
416
|
+
x: j(d.x, B.MONTH_SHORT_YEAR)
|
|
417
417
|
}))
|
|
418
418
|
}
|
|
419
419
|
)
|
|
@@ -423,9 +423,9 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
423
423
|
}
|
|
424
424
|
);
|
|
425
425
|
}, pt = ({ selectedTab: t, onTabChange: n }) => {
|
|
426
|
-
const { common: s } =
|
|
426
|
+
const { common: s } = k();
|
|
427
427
|
return /* @__PURE__ */ e(
|
|
428
|
-
|
|
428
|
+
Ft,
|
|
429
429
|
{
|
|
430
430
|
"aria-label": s.view_toggle,
|
|
431
431
|
exclusive: !0,
|
|
@@ -433,7 +433,7 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
433
433
|
orientation: "horizontal",
|
|
434
434
|
value: t,
|
|
435
435
|
children: ["Chart", "Table"].map((o) => /* @__PURE__ */ e(
|
|
436
|
-
|
|
436
|
+
zt,
|
|
437
437
|
{
|
|
438
438
|
"aria-label": o === "Chart" ? s.view_chart : s.view_table,
|
|
439
439
|
"aria-pressed": t === o,
|
|
@@ -447,22 +447,22 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
447
447
|
}
|
|
448
448
|
);
|
|
449
449
|
}, ft = ({ selectedDateRange: t, selectedCategoryGuid: n }) => {
|
|
450
|
-
const { trends: s } =
|
|
451
|
-
const i = t.start.getFullYear() === t.end.getFullYear() ?
|
|
450
|
+
const { trends: s } = k(), { isMobile: o, isDesktop: r } = Y(), { getCategoryName: l } = U(), a = p.useMemo(() => {
|
|
451
|
+
const i = t.start.getFullYear() === t.end.getFullYear() ? j(
|
|
452
452
|
t.start,
|
|
453
|
-
o ?
|
|
454
|
-
) :
|
|
453
|
+
o ? B.MONTH_SHORT : B.MONTH_LONG
|
|
454
|
+
) : j(
|
|
455
455
|
t.start,
|
|
456
|
-
o ?
|
|
457
|
-
), f =
|
|
456
|
+
o ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
|
|
457
|
+
), f = j(
|
|
458
458
|
t.end,
|
|
459
|
-
o ?
|
|
459
|
+
o ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
|
|
460
460
|
);
|
|
461
461
|
return `${i} - ${f}`;
|
|
462
|
-
}, [t, o]), u =
|
|
463
|
-
return /* @__PURE__ */ C(
|
|
462
|
+
}, [t, o]), u = l(n) || (o ? s.sub_title : s.sub_title_by_category);
|
|
463
|
+
return /* @__PURE__ */ C(W, { children: [
|
|
464
464
|
/* @__PURE__ */ e(
|
|
465
|
-
|
|
465
|
+
Oe,
|
|
466
466
|
{
|
|
467
467
|
sx: {
|
|
468
468
|
fontSize: r ? null : 15,
|
|
@@ -472,40 +472,40 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
472
472
|
children: u
|
|
473
473
|
}
|
|
474
474
|
),
|
|
475
|
-
/* @__PURE__ */ e(
|
|
475
|
+
/* @__PURE__ */ e(P, { variant: r ? "subtitle1" : "body2", children: a })
|
|
476
476
|
] });
|
|
477
|
-
},
|
|
477
|
+
}, So = (t) => {
|
|
478
478
|
const n = t.id === "total";
|
|
479
479
|
return /* @__PURE__ */ C(S, { alignItems: "center", direction: "row", role: "rowheader", tabIndex: t.tabIndex, children: [
|
|
480
|
-
!n && /* @__PURE__ */ e(
|
|
481
|
-
/* @__PURE__ */ e(
|
|
480
|
+
!n && /* @__PURE__ */ e(W, { "aria-hidden": !0, children: /* @__PURE__ */ e(ve, { categoryGuid: t.row.top_level_category_guid, variant: "twotone" }) }),
|
|
481
|
+
/* @__PURE__ */ e(P, { bold: n, sx: { ml: 12 }, variant: n ? "body1" : "body2", children: t.row.category })
|
|
482
482
|
] });
|
|
483
|
-
},
|
|
484
|
-
const n = t.row.category_guid, s = t.row.top_level_category_guid, o = n === $e.INCOME || s === $e.INCOME, r = t.id === "total",
|
|
483
|
+
}, Ye = (t) => {
|
|
484
|
+
const n = t.row.category_guid, s = t.row.top_level_category_guid, o = n === $e.INCOME || s === $e.INCOME, r = t.id === "total", l = t.field === "total", a = l ? t.row[t.field] : t.row.monthlyAmounts[t.field];
|
|
485
485
|
return /* @__PURE__ */ e(S, { alignItems: "flex-end", direction: "row", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(
|
|
486
486
|
xe,
|
|
487
487
|
{
|
|
488
488
|
amount: o ? Math.abs(a) : a,
|
|
489
489
|
isIncome: o,
|
|
490
|
-
sx: { fontWeight: o ||
|
|
490
|
+
sx: { fontWeight: o || l || r ? 600 : 500 },
|
|
491
491
|
symbol: o ? "+" : void 0,
|
|
492
492
|
variant: r ? "body1" : "body2"
|
|
493
493
|
}
|
|
494
494
|
) });
|
|
495
495
|
}, Ue = (t, n) => {
|
|
496
|
-
const s =
|
|
496
|
+
const s = j(ct(n.isoDate), B.MONTH_LONG);
|
|
497
497
|
return t[s] = n.amount, t;
|
|
498
498
|
}, Xe = (t) => (n, s) => {
|
|
499
|
-
const o =
|
|
499
|
+
const o = j(ct(s.isoDate), B.MONTH_LONG);
|
|
500
500
|
return n + (t.includes(o) ? s.amount : 0);
|
|
501
|
-
},
|
|
501
|
+
}, xo = (t, n) => {
|
|
502
502
|
const s = [], o = new Date(t);
|
|
503
503
|
for (; o <= n; ) {
|
|
504
|
-
const r =
|
|
504
|
+
const r = j(o, B.MONTH_LONG);
|
|
505
505
|
s.push(r), o.setMonth(o.getMonth() + 1);
|
|
506
506
|
}
|
|
507
507
|
return s;
|
|
508
|
-
},
|
|
508
|
+
}, vo = (t, n) => {
|
|
509
509
|
const s = {
|
|
510
510
|
field: "category",
|
|
511
511
|
flex: 1,
|
|
@@ -513,25 +513,25 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
513
513
|
headerName: n.category_title,
|
|
514
514
|
minWidth: 210,
|
|
515
515
|
renderHeader: ke,
|
|
516
|
-
renderCell:
|
|
516
|
+
renderCell: So,
|
|
517
517
|
sortable: !0,
|
|
518
|
-
sortComparator:
|
|
518
|
+
sortComparator: Wt,
|
|
519
519
|
type: "string"
|
|
520
|
-
}, o = t.map((
|
|
521
|
-
field:
|
|
520
|
+
}, o = t.map((l) => ({
|
|
521
|
+
field: l,
|
|
522
522
|
flex: 1,
|
|
523
523
|
headerClassName: "trends-table-header",
|
|
524
|
-
headerName:
|
|
524
|
+
headerName: l,
|
|
525
525
|
minWidth: 100,
|
|
526
526
|
renderHeader: ke,
|
|
527
|
-
renderCell:
|
|
527
|
+
renderCell: Ye,
|
|
528
528
|
align: "center",
|
|
529
529
|
headerAlign: "center",
|
|
530
530
|
sortable: !0,
|
|
531
531
|
hideSortIcons: !1,
|
|
532
532
|
type: "number",
|
|
533
|
-
sortComparator:
|
|
534
|
-
valueGetter: (a,
|
|
533
|
+
sortComparator: je,
|
|
534
|
+
valueGetter: (a, c) => c.monthlyAmounts?.[l] ?? 0
|
|
535
535
|
})), r = {
|
|
536
536
|
field: "total",
|
|
537
537
|
flex: 1,
|
|
@@ -539,31 +539,31 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
539
539
|
headerName: n.table_column_total,
|
|
540
540
|
minWidth: 100,
|
|
541
541
|
renderHeader: ke,
|
|
542
|
-
renderCell:
|
|
542
|
+
renderCell: Ye,
|
|
543
543
|
align: "center",
|
|
544
544
|
headerAlign: "center",
|
|
545
545
|
sortable: !0,
|
|
546
546
|
hideSortIcons: !1,
|
|
547
547
|
type: "number",
|
|
548
|
-
sortComparator:
|
|
548
|
+
sortComparator: je
|
|
549
549
|
};
|
|
550
550
|
return [s, ...o, r];
|
|
551
551
|
}, Ze = (t, n, s, o, r) => {
|
|
552
|
-
const
|
|
553
|
-
let
|
|
554
|
-
return r && (
|
|
552
|
+
const l = t.filter((a) => a.is_income === s).map((a) => {
|
|
553
|
+
let c = a.totalMonthlyAmounts;
|
|
554
|
+
return r && (c = a.monthlyAmounts), {
|
|
555
555
|
id: a.guid,
|
|
556
556
|
category: a.name,
|
|
557
557
|
category_guid: a.guid,
|
|
558
558
|
isParent: !1,
|
|
559
559
|
top_level_category_guid: a.parent_guid || a.guid,
|
|
560
|
-
total:
|
|
561
|
-
monthlyAmounts:
|
|
560
|
+
total: c.reduce(Xe(o), 0),
|
|
561
|
+
monthlyAmounts: c.reduce(Ue, {})
|
|
562
562
|
};
|
|
563
563
|
});
|
|
564
564
|
if (r && r.is_income === s) {
|
|
565
565
|
const a = r.monthlyAmounts.reduce(Xe(o), 0);
|
|
566
|
-
a !== 0 &&
|
|
566
|
+
a !== 0 && l.push({
|
|
567
567
|
id: `sub-${r.guid}`,
|
|
568
568
|
category: nt(n.category_general, r.name),
|
|
569
569
|
category_guid: r.guid,
|
|
@@ -573,52 +573,52 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
|
|
|
573
573
|
monthlyAmounts: r.monthlyAmounts.reduce(Ue, {})
|
|
574
574
|
});
|
|
575
575
|
}
|
|
576
|
-
return
|
|
577
|
-
},
|
|
576
|
+
return l;
|
|
577
|
+
}, wo = Lt("div")({
|
|
578
578
|
display: "flex",
|
|
579
579
|
visibility: "hidden",
|
|
580
580
|
width: 0
|
|
581
581
|
});
|
|
582
|
-
function
|
|
582
|
+
function Do({
|
|
583
583
|
direction: t,
|
|
584
584
|
index: n,
|
|
585
585
|
sortingOrder: s,
|
|
586
586
|
disabled: o,
|
|
587
587
|
className: r,
|
|
588
|
-
field:
|
|
588
|
+
field: l
|
|
589
589
|
}) {
|
|
590
|
-
const a =
|
|
590
|
+
const a = jt(), c = Kt();
|
|
591
591
|
let u = null;
|
|
592
592
|
const i = {};
|
|
593
|
-
if (t === "asc" ? u =
|
|
594
|
-
const m = a.current.getColumn(
|
|
593
|
+
if (t === "asc" ? u = c.slots.columnSortedAscendingIcon : t === "desc" ? u = c.slots.columnSortedDescendingIcon : (u = c.slots.columnUnsortedIcon ?? null, i.sortingOrder = s), !u) return null;
|
|
594
|
+
const m = a.current.getColumn(l)?.headerName ?? l;
|
|
595
595
|
let _ = "";
|
|
596
596
|
t === "asc" ? _ = ", sorted ascending" : t === "desc" && (_ = ", sorted descending");
|
|
597
|
-
const
|
|
598
|
-
|
|
597
|
+
const g = ["Total", "Category"].includes(m) ? "" : " category totals", h = `Sort by ${m}${g}${_}`, y = /* @__PURE__ */ e(u, { className: "MuiDataGrid-sortIcon", fontSize: "small", ...i }), T = /* @__PURE__ */ e(
|
|
598
|
+
Xt,
|
|
599
599
|
{
|
|
600
600
|
disabled: o,
|
|
601
601
|
size: "small",
|
|
602
602
|
tabIndex: -1,
|
|
603
|
-
...
|
|
604
|
-
"aria-label":
|
|
603
|
+
...c.slotProps?.baseIconButton,
|
|
604
|
+
"aria-label": h,
|
|
605
605
|
className: `MuiDataGrid-sortButton${r ? ` ${r}` : ""}`,
|
|
606
|
-
title:
|
|
606
|
+
title: h,
|
|
607
607
|
children: y
|
|
608
608
|
}
|
|
609
609
|
);
|
|
610
|
-
return /* @__PURE__ */ e(
|
|
610
|
+
return /* @__PURE__ */ e(wo, { className: "MuiDataGrid-iconButtonContainer", children: n != null ? /* @__PURE__ */ e(Ut, { badgeContent: n, color: "default", overlap: "circular", children: T }) : T });
|
|
611
611
|
}
|
|
612
|
-
const
|
|
612
|
+
const Io = p.memo(Do), Qe = ({
|
|
613
613
|
columns: t,
|
|
614
614
|
onRowClick: n,
|
|
615
615
|
parentCategory: s,
|
|
616
616
|
rows: o,
|
|
617
617
|
totalRow: r
|
|
618
618
|
}) => {
|
|
619
|
-
const
|
|
619
|
+
const l = K(), { onEvent: a } = V(), c = l.palette.mode === "light";
|
|
620
620
|
return /* @__PURE__ */ e(
|
|
621
|
-
|
|
621
|
+
Yt,
|
|
622
622
|
{
|
|
623
623
|
columns: t,
|
|
624
624
|
disableColumnFilter: !0,
|
|
@@ -626,9 +626,9 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
626
626
|
hideFooter: !0,
|
|
627
627
|
initialState: { sorting: { sortModel: [{ field: "category", sort: "asc" }] } },
|
|
628
628
|
onRowClick: (u) => {
|
|
629
|
-
s || n?.(u.row.category_guid), a(
|
|
630
|
-
...
|
|
631
|
-
listItem:
|
|
629
|
+
s || n?.(u.row.category_guid), a(D.TRENDS_CLICK_LIST_ITEM, {
|
|
630
|
+
...O,
|
|
631
|
+
listItem: Ht[u.row.category_guid]
|
|
632
632
|
});
|
|
633
633
|
},
|
|
634
634
|
pinnedRows: {
|
|
@@ -637,7 +637,7 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
637
637
|
rowHeight: 64,
|
|
638
638
|
rows: o,
|
|
639
639
|
slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
|
|
640
|
-
slots: { columnHeaderSortIcon:
|
|
640
|
+
slots: { columnHeaderSortIcon: Io },
|
|
641
641
|
sortingOrder: ["asc", "desc"],
|
|
642
642
|
sx: {
|
|
643
643
|
borderColor: "divider",
|
|
@@ -645,11 +645,11 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
645
645
|
borderStyle: "solid",
|
|
646
646
|
borderRadius: 2,
|
|
647
647
|
"& .MuiDataGrid-columnHeaders": {
|
|
648
|
-
bgcolor:
|
|
648
|
+
bgcolor: c ? "neutral.50" : "neutral.800",
|
|
649
649
|
borderBottom: "none"
|
|
650
650
|
},
|
|
651
651
|
"& .trends-table-header": {
|
|
652
|
-
bgcolor:
|
|
652
|
+
bgcolor: c ? "neutral.50" : "neutral.800"
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
}
|
|
@@ -661,28 +661,28 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
661
661
|
height: o = "100%",
|
|
662
662
|
sx: r = {}
|
|
663
663
|
}) => {
|
|
664
|
-
const { trends:
|
|
664
|
+
const { trends: l } = k(), { trendsCategories: a } = U(), c = p.useMemo(() => xo(t.start, t.end), [t]), u = p.useMemo(() => vo(c, l), [c, l]), i = p.useMemo(() => {
|
|
665
665
|
if (n)
|
|
666
|
-
return a.find((
|
|
667
|
-
}, [n, a]), [f, m] =
|
|
668
|
-
let
|
|
669
|
-
return i && (
|
|
670
|
-
(
|
|
666
|
+
return a.find((g) => g.guid === n);
|
|
667
|
+
}, [n, a]), [f, m] = p.useMemo(() => {
|
|
668
|
+
let g = a;
|
|
669
|
+
return i && (g = i.subCategories.filter(
|
|
670
|
+
(h) => h.monthlyAmounts.some((y) => y.amount !== 0)
|
|
671
671
|
)), [
|
|
672
|
-
Ze(
|
|
673
|
-
Ze(
|
|
672
|
+
Ze(g, l, !0, c, i),
|
|
673
|
+
Ze(g, l, !1, c, i)
|
|
674
674
|
];
|
|
675
|
-
}, [a,
|
|
675
|
+
}, [a, c, i, l]), _ = {
|
|
676
676
|
id: "total",
|
|
677
|
-
category:
|
|
677
|
+
category: l.table_column_total,
|
|
678
678
|
category_guid: "total",
|
|
679
679
|
isParent: !1,
|
|
680
680
|
top_level_category_guid: "total",
|
|
681
|
-
total: m.reduce((
|
|
681
|
+
total: m.reduce((g, h) => g + h.total, 0),
|
|
682
682
|
monthlyAmounts: m.reduce(
|
|
683
|
-
(
|
|
684
|
-
|
|
685
|
-
}),
|
|
683
|
+
(g, h) => (Object.entries(h.monthlyAmounts).forEach(([y, T]) => {
|
|
684
|
+
g[y] = (g[y] || 0) + T;
|
|
685
|
+
}), g),
|
|
686
686
|
{}
|
|
687
687
|
)
|
|
688
688
|
};
|
|
@@ -714,26 +714,26 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
714
714
|
]
|
|
715
715
|
}
|
|
716
716
|
);
|
|
717
|
-
},
|
|
717
|
+
}, Lo = {
|
|
718
718
|
title: "Transaction List"
|
|
719
|
-
},
|
|
719
|
+
}, Eo = ({
|
|
720
720
|
categoryGuid: t,
|
|
721
721
|
dateRange: n,
|
|
722
722
|
isOpen: s,
|
|
723
723
|
onClose: o
|
|
724
724
|
}) => {
|
|
725
|
-
const { onEvent: r } =
|
|
726
|
-
() => u.find((
|
|
725
|
+
const { onEvent: r } = V(), { selectedAccountGuids: l } = ye(), { common: a } = k(), { setFilter: c, sortedTransactions: u } = we(), [i, f] = p.useState(""), m = p.useMemo(
|
|
726
|
+
() => u.find((g) => g.guid === i),
|
|
727
727
|
[i, u]
|
|
728
728
|
);
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
accounts:
|
|
729
|
+
p.useEffect(() => {
|
|
730
|
+
c({
|
|
731
|
+
accounts: l,
|
|
732
732
|
dateRange: n,
|
|
733
|
-
custom: (
|
|
733
|
+
custom: (g) => t === "" || t === g.category_guid || t === g.top_level_category_guid,
|
|
734
734
|
showSplits: !!t
|
|
735
735
|
});
|
|
736
|
-
}, [
|
|
736
|
+
}, [l, t, n]), p.useEffect(() => r(D.TRENDS_VIEW_TRANSACTIONS), []);
|
|
737
737
|
const _ = () => {
|
|
738
738
|
f(""), o();
|
|
739
739
|
};
|
|
@@ -743,97 +743,98 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
743
743
|
ariaLabelClose: a.close_aria,
|
|
744
744
|
isOpen: s,
|
|
745
745
|
onClose: _,
|
|
746
|
-
title:
|
|
746
|
+
title: Lo.title,
|
|
747
747
|
children: [
|
|
748
748
|
m && /* @__PURE__ */ e(dt, { transaction: m }),
|
|
749
|
-
!m && /* @__PURE__ */ e(
|
|
749
|
+
!m && /* @__PURE__ */ e(lt, { onClick: f })
|
|
750
750
|
]
|
|
751
751
|
}
|
|
752
752
|
);
|
|
753
|
-
},
|
|
754
|
-
const { onEvent: o } =
|
|
753
|
+
}, Mo = R(Eo), Ao = ({ onBackClick: t, onMenuClick: n, sx: s }) => {
|
|
754
|
+
const { onEvent: o } = V(), { isDesktop: r, isTablet: l, isMobile: a } = Y(), { isAccountDataLoaded: c, loadAccountData: u } = De(), {
|
|
755
755
|
categoriesLoaded: i,
|
|
756
756
|
loadCategories: f,
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
} = we(), { selectedDateRange: x, setSelectedDateRange: L } = ye(), { isInitialized: M, selectedAccounts: E } = fe(), { trends: v } = R(), [K, ae] = g.useState(!1), [Y, J] = g.useState(!1), [P, V] = g.useState("Chart"), [O, ee] = g.useState(""), [Ce, ie] = g.useState(window.innerHeight), j = Ce - (a ? 315 : 345);
|
|
757
|
+
monthlyCategoryTotals: m,
|
|
758
|
+
getCategoryName: _,
|
|
759
|
+
reloadCategoryTotals: g
|
|
760
|
+
} = U(), {
|
|
761
|
+
isTransactionDataLoaded: h,
|
|
762
|
+
loadTransactionData: y,
|
|
763
|
+
sortedTransactions: T
|
|
764
|
+
} = we(), { selectedDateRange: x, setSelectedDateRange: H } = Ce(), { isInitialized: L, selectedAccounts: M, selectedAccountGuids: I } = ye(), { trends: E } = k(), [X, Z] = p.useState(!1), [te, oe] = p.useState(!1), [A, de] = p.useState("Chart"), [G, ae] = p.useState(""), [ie, z] = p.useState(window.innerHeight), Q = ie - (a ? 315 : 345);
|
|
766
765
|
Ie({
|
|
767
766
|
widgetName: "TrendsFullWidget",
|
|
768
|
-
isLoaded:
|
|
769
|
-
}),
|
|
770
|
-
const
|
|
771
|
-
return window.addEventListener("resize",
|
|
772
|
-
}, []),
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
767
|
+
isLoaded: X
|
|
768
|
+
}), p.useEffect(() => {
|
|
769
|
+
const v = () => z(window.innerHeight);
|
|
770
|
+
return window.addEventListener("resize", v), c || u().finally(), i || f().finally(), h || y().finally(), () => window.removeEventListener("resize", v);
|
|
771
|
+
}, []), p.useEffect(() => {
|
|
772
|
+
L && c && g(M, x.start, x.end).finally(
|
|
773
|
+
() => {
|
|
774
|
+
Z(!0), o(D.TRENDS_LOAD_WIDGET, {
|
|
775
|
+
...O,
|
|
776
|
+
time_period: `${Se(x.end, x.start)}M`
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
}, [
|
|
781
|
+
L,
|
|
782
|
+
c,
|
|
783
|
+
I.join(","),
|
|
784
|
+
x.start.getTime(),
|
|
785
|
+
x.end.getTime()
|
|
786
|
+
]);
|
|
787
|
+
const F = p.useMemo(() => {
|
|
788
|
+
if (!X) return { stackedDatasets: [], unstackedDatasets: [] };
|
|
789
|
+
const v = Gt(
|
|
790
|
+
m,
|
|
790
791
|
x.start,
|
|
791
792
|
x.end
|
|
792
|
-
),
|
|
793
|
-
(b) => b.top_level_category_guid ===
|
|
794
|
-
) :
|
|
793
|
+
), d = G.length ? v.filter(
|
|
794
|
+
(b) => b.top_level_category_guid === G || b.category_guid === G
|
|
795
|
+
) : Ot(v);
|
|
795
796
|
return {
|
|
796
|
-
stackedDatasets:
|
|
797
|
-
unstackedDatasets:
|
|
797
|
+
stackedDatasets: d.filter(Pt),
|
|
798
|
+
unstackedDatasets: d.filter(Bt)
|
|
798
799
|
};
|
|
799
|
-
}, [
|
|
800
|
-
|
|
801
|
-
},
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
time_period:
|
|
800
|
+
}, [m, G, x]), ne = (v, d) => {
|
|
801
|
+
de(d ?? A), o(D.TRENDS_CLICK_TOGGLE_VIEW);
|
|
802
|
+
}, q = (v) => {
|
|
803
|
+
const d = et(v?.[0], 1), b = v?.[1], w = Se(b, d);
|
|
804
|
+
H({ start: d, end: b }), o(D.TRENDS_CLICK_TIME_WINDOW, {
|
|
805
|
+
time_period: w + "M"
|
|
805
806
|
});
|
|
806
|
-
},
|
|
807
|
-
o(
|
|
808
|
-
},
|
|
809
|
-
|
|
810
|
-
},
|
|
811
|
-
|
|
812
|
-
}, le = (
|
|
813
|
-
o(
|
|
814
|
-
},
|
|
815
|
-
o(
|
|
816
|
-
},
|
|
817
|
-
o(
|
|
807
|
+
}, J = () => {
|
|
808
|
+
o(D.TRENDS_CLICK_FILTER);
|
|
809
|
+
}, se = (v) => {
|
|
810
|
+
ae(v);
|
|
811
|
+
}, ce = (v) => {
|
|
812
|
+
ae(v), o(D.TRENDS_CLICK_LEGEND, { category: _(v) });
|
|
813
|
+
}, le = (v) => {
|
|
814
|
+
o(D.TRENDS_HOVER_LEGEND, { category: _(v) });
|
|
815
|
+
}, me = (v) => {
|
|
816
|
+
o(D.TRENDS_HOVER_AREA, { category: v });
|
|
817
|
+
}, he = (v) => {
|
|
818
|
+
o(D.TRENDS_HOVER_POINT, { category: v });
|
|
818
819
|
};
|
|
819
|
-
return !
|
|
820
|
+
return !L || !c || !X ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ C(
|
|
820
821
|
ut,
|
|
821
822
|
{
|
|
822
|
-
calendarActions: { onRangeChanged:
|
|
823
|
+
calendarActions: { onRangeChanged: q },
|
|
823
824
|
dateRange: x,
|
|
824
825
|
dateRangeVariant: "timeframebuttons",
|
|
825
|
-
onAccountsFilterClick:
|
|
826
|
+
onAccountsFilterClick: J,
|
|
826
827
|
onBackClick: t,
|
|
827
828
|
onMenuClick: n,
|
|
828
829
|
sx: s,
|
|
829
|
-
title:
|
|
830
|
+
title: E.title,
|
|
830
831
|
children: [
|
|
831
832
|
/* @__PURE__ */ C(
|
|
832
833
|
S,
|
|
833
834
|
{
|
|
834
835
|
sx: {
|
|
835
836
|
// eslint-disable-next-line no-nested-ternary
|
|
836
|
-
px: r ? 48 :
|
|
837
|
+
px: r ? 48 : l ? 24 : 12
|
|
837
838
|
},
|
|
838
839
|
children: [
|
|
839
840
|
/* @__PURE__ */ C(
|
|
@@ -846,39 +847,39 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
846
847
|
/* @__PURE__ */ e(
|
|
847
848
|
ft,
|
|
848
849
|
{
|
|
849
|
-
selectedCategoryGuid:
|
|
850
|
+
selectedCategoryGuid: G,
|
|
850
851
|
selectedDateRange: x
|
|
851
852
|
}
|
|
852
853
|
),
|
|
853
|
-
/* @__PURE__ */ e(pt, { onTabChange:
|
|
854
|
+
/* @__PURE__ */ e(pt, { onTabChange: ne, selectedTab: A })
|
|
854
855
|
]
|
|
855
856
|
}
|
|
856
857
|
),
|
|
857
858
|
/* @__PURE__ */ C(S, { alignItems: "center", flexDirection: "row", width: "100%", children: [
|
|
858
|
-
/* @__PURE__ */ e(
|
|
859
|
+
/* @__PURE__ */ e(W, { flexGrow: 1, children: G && /* @__PURE__ */ C(Te, { onClick: () => ae(""), sx: { p: 0, pr: 5 }, children: [
|
|
859
860
|
/* @__PURE__ */ e(He, { name: "arrow_back" }),
|
|
860
|
-
|
|
861
|
+
E.all_categories
|
|
861
862
|
] }) }),
|
|
862
|
-
/* @__PURE__ */ e(Te, { onClick: () =>
|
|
863
|
+
/* @__PURE__ */ e(Te, { onClick: () => oe(!0), sx: { px: 5 }, children: `${E.view_transactions} (${T.length})` })
|
|
863
864
|
] }),
|
|
864
|
-
/* @__PURE__ */ C(
|
|
865
|
-
|
|
866
|
-
|
|
865
|
+
/* @__PURE__ */ C(W, { children: [
|
|
866
|
+
A === "Chart" && /* @__PURE__ */ e(
|
|
867
|
+
To,
|
|
867
868
|
{
|
|
868
|
-
availableHeight:
|
|
869
|
-
onClickLegend:
|
|
870
|
-
onHoverArea:
|
|
869
|
+
availableHeight: Q,
|
|
870
|
+
onClickLegend: ce,
|
|
871
|
+
onHoverArea: me,
|
|
871
872
|
onHoverLegend: le,
|
|
872
|
-
onHoverPoint:
|
|
873
|
-
stackedDatasets:
|
|
874
|
-
unstackedDatasets:
|
|
873
|
+
onHoverPoint: he,
|
|
874
|
+
stackedDatasets: F.stackedDatasets,
|
|
875
|
+
unstackedDatasets: F.unstackedDatasets
|
|
875
876
|
}
|
|
876
877
|
),
|
|
877
|
-
|
|
878
|
+
A === "Table" && /* @__PURE__ */ e(
|
|
878
879
|
yt,
|
|
879
880
|
{
|
|
880
|
-
onClickRow:
|
|
881
|
-
selectedCategory:
|
|
881
|
+
onClickRow: se,
|
|
882
|
+
selectedCategory: G,
|
|
882
883
|
selectedDateRange: x
|
|
883
884
|
}
|
|
884
885
|
)
|
|
@@ -887,19 +888,19 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
887
888
|
}
|
|
888
889
|
),
|
|
889
890
|
/* @__PURE__ */ e(
|
|
890
|
-
|
|
891
|
+
Mo,
|
|
891
892
|
{
|
|
892
|
-
categoryGuid:
|
|
893
|
+
categoryGuid: G,
|
|
893
894
|
dateRange: x,
|
|
894
|
-
isOpen:
|
|
895
|
-
onClose: () =>
|
|
895
|
+
isOpen: te,
|
|
896
|
+
onClose: () => oe(!1)
|
|
896
897
|
}
|
|
897
898
|
)
|
|
898
899
|
]
|
|
899
900
|
}
|
|
900
901
|
);
|
|
901
|
-
},
|
|
902
|
-
const { monthlyCategoryTotals: t } =
|
|
902
|
+
}, ss = R(Ao), Ro = () => {
|
|
903
|
+
const { monthlyCategoryTotals: t } = U(), { trends: n } = k(), s = K(), { availableHeight: o = 300 } = st(), r = p.useMemo(() => Vt(t), [t]);
|
|
903
904
|
return /* @__PURE__ */ e(
|
|
904
905
|
Ve,
|
|
905
906
|
{
|
|
@@ -916,39 +917,39 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
916
917
|
valueFormatterString: "0,0"
|
|
917
918
|
}
|
|
918
919
|
);
|
|
919
|
-
},
|
|
920
|
-
const { isAccountDataLoaded: s, loadAccountData: o } = De(), { loadMonthlyCategoryTotals: r, monthlyTotalsLoaded:
|
|
921
|
-
return
|
|
920
|
+
}, ko = R(Ro), Ho = ({ onPrimaryCtaClick: t, sx: n }) => {
|
|
921
|
+
const { isAccountDataLoaded: s, loadAccountData: o } = De(), { loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: l } = U(), { isInitialized: a } = Be(), { trends: c } = k(), { selectedAccounts: u } = ye();
|
|
922
|
+
return p.useEffect(() => {
|
|
922
923
|
s || o().finally();
|
|
923
924
|
}, []), Ie({
|
|
924
925
|
widgetName: "TrendsMiniWidget",
|
|
925
|
-
isLoaded:
|
|
926
|
-
}),
|
|
926
|
+
isLoaded: l
|
|
927
|
+
}), p.useEffect(() => {
|
|
927
928
|
a && s && r(u).finally();
|
|
928
|
-
}, [s, a, u]), !s || !a || !
|
|
929
|
-
|
|
929
|
+
}, [s, a, u]), !s || !a || !l ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ e(
|
|
930
|
+
Zt,
|
|
930
931
|
{
|
|
931
932
|
contentStyles: { height: "calc(100% - 72px)", minHeight: 300, ":last-child": { pb: 0 } },
|
|
932
933
|
onPrimaryCtaClick: t,
|
|
933
|
-
primaryCtaLabel:
|
|
934
|
-
subTitle:
|
|
934
|
+
primaryCtaLabel: c.primary_cta,
|
|
935
|
+
subTitle: c.sub_title,
|
|
935
936
|
sx: { height: "100%", ...n },
|
|
936
|
-
title:
|
|
937
|
-
children: /* @__PURE__ */ e(
|
|
937
|
+
title: c.mini_title,
|
|
938
|
+
children: /* @__PURE__ */ e(ko, {})
|
|
938
939
|
}
|
|
939
940
|
);
|
|
940
|
-
},
|
|
941
|
+
}, rs = R(Ho), No = 70, qe = ({
|
|
941
942
|
title: t,
|
|
942
943
|
totalAmount: n,
|
|
943
944
|
transactionType: s,
|
|
944
945
|
percentage: o,
|
|
945
946
|
secondaryLabel: r,
|
|
946
|
-
shouldDisplayPercentage:
|
|
947
|
+
shouldDisplayPercentage: l
|
|
947
948
|
}) => {
|
|
948
|
-
const { availableWidth: a } = st(),
|
|
949
|
+
const { availableWidth: a } = st(), c = p.useRef(null), u = p.useRef(null), i = Nt(Number(Math.abs(o)), {
|
|
949
950
|
style: "percent",
|
|
950
951
|
minimumIntegerDigits: 1
|
|
951
|
-
}), f = a === 288 && re(n, "0,0.00").length > 10 ? re(n, "0,0") : re(n, "0,0.00"), m = s === "spending" ? o > 0 : o >= 0, _ = s === "spending" ? "error.main" : "success.main",
|
|
952
|
+
}), f = a === 288 && re(n, "0,0.00").length > 10 ? re(n, "0,0") : re(n, "0,0.00"), m = s === "spending" ? o > 0 : o >= 0, _ = s === "spending" ? "error.main" : "success.main", g = s === "spending" ? "success.main" : "text.secondary", h = c?.current, y = u?.current, T = h && y ? h.scrollWidth > y.clientWidth - No : !1;
|
|
952
953
|
return /* @__PURE__ */ C(
|
|
953
954
|
S,
|
|
954
955
|
{
|
|
@@ -971,14 +972,14 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
971
972
|
justifyContent: "space-between"
|
|
972
973
|
},
|
|
973
974
|
children: [
|
|
974
|
-
/* @__PURE__ */ e(
|
|
975
|
-
|
|
976
|
-
m ? /* @__PURE__ */ e(
|
|
975
|
+
/* @__PURE__ */ e(fe, { color: "text.secondary", variant: "caption", children: t }),
|
|
976
|
+
l && /* @__PURE__ */ C(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
|
|
977
|
+
m ? /* @__PURE__ */ e(qt, { size: 20, sx: { color: _ } }) : /* @__PURE__ */ e(Jt, { size: 20, sx: { color: g } }),
|
|
977
978
|
/* @__PURE__ */ e(
|
|
978
|
-
|
|
979
|
+
fe,
|
|
979
980
|
{
|
|
980
981
|
sx: {
|
|
981
|
-
color: m ? _ :
|
|
982
|
+
color: m ? _ : g,
|
|
982
983
|
fontWeight: 600
|
|
983
984
|
},
|
|
984
985
|
variant: "body2",
|
|
@@ -1000,17 +1001,17 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1000
1001
|
},
|
|
1001
1002
|
children: [
|
|
1002
1003
|
/* @__PURE__ */ e(
|
|
1003
|
-
|
|
1004
|
+
W,
|
|
1004
1005
|
{
|
|
1005
|
-
ref:
|
|
1006
|
+
ref: c,
|
|
1006
1007
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
1007
|
-
children: /* @__PURE__ */ e(
|
|
1008
|
+
children: /* @__PURE__ */ e(Oe, { children: f })
|
|
1008
1009
|
}
|
|
1009
1010
|
),
|
|
1010
|
-
|
|
1011
|
-
|
|
1011
|
+
l && a >= 450 && !T && /* @__PURE__ */ e(
|
|
1012
|
+
fe,
|
|
1012
1013
|
{
|
|
1013
|
-
color: m ? _ :
|
|
1014
|
+
color: m ? _ : g,
|
|
1014
1015
|
variant: "caption",
|
|
1015
1016
|
children: r
|
|
1016
1017
|
}
|
|
@@ -1021,54 +1022,54 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1021
1022
|
]
|
|
1022
1023
|
}
|
|
1023
1024
|
);
|
|
1024
|
-
},
|
|
1025
|
-
const { trends: t } =
|
|
1025
|
+
}, Wo = R(() => {
|
|
1026
|
+
const { trends: t } = k();
|
|
1026
1027
|
return /* @__PURE__ */ C(S, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
|
|
1027
|
-
/* @__PURE__ */ e(
|
|
1028
|
+
/* @__PURE__ */ e(eo, { size: 32 }),
|
|
1028
1029
|
/* @__PURE__ */ C(S, { children: [
|
|
1029
|
-
/* @__PURE__ */ e(
|
|
1030
|
-
/* @__PURE__ */ e(
|
|
1030
|
+
/* @__PURE__ */ e(fe, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
|
|
1031
|
+
/* @__PURE__ */ e(fe, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
|
|
1031
1032
|
] })
|
|
1032
1033
|
] });
|
|
1033
|
-
}),
|
|
1034
|
+
}), as = R(({ onCtaClick: t }) => {
|
|
1034
1035
|
const { isAccountDataLoaded: n, loadAccountData: s, visibleAccounts: o } = De();
|
|
1035
|
-
|
|
1036
|
+
p.useEffect(() => {
|
|
1036
1037
|
n || s().finally();
|
|
1037
1038
|
}, []);
|
|
1038
|
-
const { onEvent: r } =
|
|
1039
|
-
start:
|
|
1039
|
+
const { onEvent: r } = V(), { monthlyCategoryTotals: l, loadMonthlyCategoryTotals: a, monthlyTotalsLoaded: c } = U(), u = {
|
|
1040
|
+
start: Qt(/* @__PURE__ */ new Date(), 1),
|
|
1040
1041
|
end: /* @__PURE__ */ new Date()
|
|
1041
|
-
}, { trends: i } =
|
|
1042
|
+
}, { trends: i } = k(), { selectedAccounts: f, isInitialized: m } = ye();
|
|
1042
1043
|
Ie({
|
|
1043
1044
|
widgetName: "TrendsMicroWidget",
|
|
1044
|
-
isLoaded:
|
|
1045
|
-
}),
|
|
1045
|
+
isLoaded: c
|
|
1046
|
+
}), p.useEffect(() => {
|
|
1046
1047
|
m && a(f, u.start).then(() => {
|
|
1047
|
-
r(
|
|
1048
|
+
r(D.TRENDS_LOAD_WIDGET, {
|
|
1048
1049
|
state: o?.length ? "default" : "zeroState"
|
|
1049
1050
|
});
|
|
1050
1051
|
});
|
|
1051
1052
|
}, [m, f]);
|
|
1052
|
-
const { spendingData: _, incomeData:
|
|
1053
|
+
const { spendingData: _, incomeData: g } = p.useMemo(
|
|
1053
1054
|
() => ({
|
|
1054
|
-
spendingData: it(
|
|
1055
|
-
incomeData: at(
|
|
1055
|
+
spendingData: it(l, u),
|
|
1056
|
+
incomeData: at(l, u)
|
|
1056
1057
|
}),
|
|
1057
|
-
[
|
|
1058
|
-
), [
|
|
1058
|
+
[l, u]
|
|
1059
|
+
), [h, y] = _, [T, x] = g, H = Ke(y.y, h.y), L = Ke(x.y, T.y), M = m && !o?.length, I = () => {
|
|
1059
1060
|
r(
|
|
1060
|
-
M ?
|
|
1061
|
+
M ? D.TRENDS_CLICK_GET_STARTED : D.TRENDS_CLICK_VIEW_MORE
|
|
1061
1062
|
), t();
|
|
1062
1063
|
};
|
|
1063
|
-
return !
|
|
1064
|
-
|
|
1064
|
+
return !c || !m ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ e(
|
|
1065
|
+
ro,
|
|
1065
1066
|
{
|
|
1066
1067
|
className: "mx-trends-microwidget",
|
|
1067
1068
|
ctaLabel: i.micro_primary_cta_label,
|
|
1068
|
-
onCTAClick:
|
|
1069
|
+
onCTAClick: I,
|
|
1069
1070
|
subHeader: M ? void 0 : i.micro_subheader,
|
|
1070
1071
|
title: i.title,
|
|
1071
|
-
children: M ? /* @__PURE__ */ e(
|
|
1072
|
+
children: M ? /* @__PURE__ */ e(Wo, {}) : /* @__PURE__ */ C(
|
|
1072
1073
|
S,
|
|
1073
1074
|
{
|
|
1074
1075
|
sx: {
|
|
@@ -1080,9 +1081,9 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1080
1081
|
/* @__PURE__ */ e(
|
|
1081
1082
|
qe,
|
|
1082
1083
|
{
|
|
1083
|
-
percentage:
|
|
1084
|
+
percentage: H,
|
|
1084
1085
|
secondaryLabel: i.micro_secondary_label,
|
|
1085
|
-
shouldDisplayPercentage: y.y !== 0 &&
|
|
1086
|
+
shouldDisplayPercentage: y.y !== 0 && h.y !== 0,
|
|
1086
1087
|
title: i.spending_label,
|
|
1087
1088
|
totalAmount: y.y,
|
|
1088
1089
|
transactionType: "spending"
|
|
@@ -1093,9 +1094,9 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1093
1094
|
{
|
|
1094
1095
|
percentage: L,
|
|
1095
1096
|
secondaryLabel: i.micro_secondary_label,
|
|
1096
|
-
shouldDisplayPercentage:
|
|
1097
|
+
shouldDisplayPercentage: x.y !== 0 && T.y !== 0,
|
|
1097
1098
|
title: i.income_label,
|
|
1098
|
-
totalAmount:
|
|
1099
|
+
totalAmount: x.y,
|
|
1099
1100
|
transactionType: "income"
|
|
1100
1101
|
}
|
|
1101
1102
|
)
|
|
@@ -1104,17 +1105,17 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1104
1105
|
)
|
|
1105
1106
|
}
|
|
1106
1107
|
);
|
|
1107
|
-
}), Go =
|
|
1108
|
+
}), Go = R(
|
|
1108
1109
|
({ isExpanded: t, onClick: n }) => {
|
|
1109
|
-
const s =
|
|
1110
|
-
return /* @__PURE__ */ e(mt, { children: /* @__PURE__ */ e(
|
|
1110
|
+
const s = K();
|
|
1111
|
+
return /* @__PURE__ */ e(mt, { children: /* @__PURE__ */ e(io, { onClick: n, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
|
|
1111
1112
|
S,
|
|
1112
1113
|
{
|
|
1113
1114
|
sx: { color: s.palette.primary.main, flexDirection: "row", alignItems: "center" },
|
|
1114
1115
|
children: [
|
|
1115
|
-
/* @__PURE__ */ e(ht, { children: /* @__PURE__ */ e(
|
|
1116
|
-
/* @__PURE__ */ e(co, { sx: { color: s.palette.primary.main }, children: t ? /* @__PURE__ */ e(
|
|
1117
|
-
|
|
1116
|
+
/* @__PURE__ */ e(ht, { children: /* @__PURE__ */ e(P, { bold: !0, variant: "body2", children: t ? "View less" : "View more" }) }),
|
|
1117
|
+
/* @__PURE__ */ e(co, { sx: { color: s.palette.primary.main }, children: t ? /* @__PURE__ */ e(to, {}) : /* @__PURE__ */ e(
|
|
1118
|
+
oo,
|
|
1118
1119
|
{
|
|
1119
1120
|
sx: {
|
|
1120
1121
|
transition: "transform 0.3s ease-in-out",
|
|
@@ -1126,89 +1127,89 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1126
1127
|
}
|
|
1127
1128
|
) }) });
|
|
1128
1129
|
}
|
|
1129
|
-
), Je =
|
|
1130
|
+
), Je = R(
|
|
1130
1131
|
({
|
|
1131
1132
|
totalAmount: t,
|
|
1132
1133
|
guid: n,
|
|
1133
1134
|
name: s,
|
|
1134
1135
|
transactions: o,
|
|
1135
1136
|
onClick: r,
|
|
1136
|
-
isLastItem:
|
|
1137
|
+
isLastItem: l = !1,
|
|
1137
1138
|
showDivider: a = !0
|
|
1138
1139
|
}) => {
|
|
1139
|
-
const { trends:
|
|
1140
|
-
r?.(), u(
|
|
1141
|
-
...
|
|
1140
|
+
const { trends: c } = k(), { onEvent: u } = V(), i = K(), f = `${o.length} ${o.length === 1 ? c.transaction : c.transactions}`, m = () => {
|
|
1141
|
+
r?.(), u(D.TRENDS_CLICK_LIST_ITEM, {
|
|
1142
|
+
...O,
|
|
1142
1143
|
listItem: s
|
|
1143
1144
|
});
|
|
1144
1145
|
};
|
|
1145
|
-
return /* @__PURE__ */ C(
|
|
1146
|
+
return /* @__PURE__ */ C(p.Fragment, { children: [
|
|
1146
1147
|
/* @__PURE__ */ e(
|
|
1147
|
-
|
|
1148
|
+
lo,
|
|
1148
1149
|
{
|
|
1149
1150
|
leftIcon: n ? /* @__PURE__ */ e(
|
|
1150
1151
|
ve,
|
|
1151
1152
|
{
|
|
1152
1153
|
categoryGuid: n,
|
|
1153
1154
|
sx: {
|
|
1154
|
-
bgcolor:
|
|
1155
|
-
border: `1px solid ${
|
|
1155
|
+
bgcolor: Et(Ge(n, i), 0.15),
|
|
1156
|
+
border: `1px solid ${Ge(n, i)}`,
|
|
1156
1157
|
color: "text.primary"
|
|
1157
1158
|
}
|
|
1158
1159
|
}
|
|
1159
1160
|
) : void 0,
|
|
1160
1161
|
onClick: m,
|
|
1161
1162
|
rightContent: re(Math.abs(t), "0,0.00"),
|
|
1162
|
-
rightIcon: r ? /* @__PURE__ */ e(
|
|
1163
|
+
rightIcon: r ? /* @__PURE__ */ e(no, {}) : void 0,
|
|
1163
1164
|
subtitle: f,
|
|
1164
1165
|
title: s
|
|
1165
1166
|
}
|
|
1166
1167
|
),
|
|
1167
|
-
a && /* @__PURE__ */ e(Ne, { component: "li", sx: { ml:
|
|
1168
|
+
a && /* @__PURE__ */ e(Ne, { component: "li", sx: { ml: l ? 24 : 68 } })
|
|
1168
1169
|
] }, n);
|
|
1169
1170
|
}
|
|
1170
|
-
),
|
|
1171
|
+
), Oo = R(
|
|
1171
1172
|
({ availableHeight: t = 0, onCategoryClick: n }) => {
|
|
1172
|
-
const { collapsedCategories: s, visibleCategories: o, setVisibleListLength: r } =
|
|
1173
|
-
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1173
|
+
const { collapsedCategories: s, visibleCategories: o, setVisibleListLength: r } = Ce(), { isLargeDesktop: l, isDesktop: a } = Y(), { trends: c } = k(), { onEvent: u } = V(), [i, f] = p.useState(!1), m = a || l;
|
|
1174
|
+
p.useEffect(() => {
|
|
1175
|
+
const h = Math.floor(t / 64) - 1, y = o.length + s.length;
|
|
1176
|
+
h !== o.length && (r(m ? Math.max(h, 5) : 5), f(h >= y));
|
|
1176
1177
|
}, [t]);
|
|
1177
1178
|
const _ = () => {
|
|
1178
|
-
f(!i), u(
|
|
1179
|
-
...
|
|
1179
|
+
f(!i), u(D.TRENDS_CLICK_VIEW_MORE, {
|
|
1180
|
+
...O
|
|
1180
1181
|
});
|
|
1181
|
-
},
|
|
1182
|
+
}, g = o.length + (i ? s.length : 0);
|
|
1182
1183
|
return /* @__PURE__ */ C(S, { sx: { width: "100%" }, children: [
|
|
1183
|
-
/* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(
|
|
1184
|
+
/* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Oe, { children: c.categories }) }),
|
|
1184
1185
|
/* @__PURE__ */ C(We, { children: [
|
|
1185
|
-
o.map((
|
|
1186
|
+
o.map((h, y) => /* @__PURE__ */ e(
|
|
1186
1187
|
Je,
|
|
1187
1188
|
{
|
|
1188
|
-
...
|
|
1189
|
-
isLastItem: y ===
|
|
1190
|
-
onClick:
|
|
1189
|
+
...h,
|
|
1190
|
+
isLastItem: y === g - 1,
|
|
1191
|
+
onClick: h.transactions.length > 0 ? () => n(h) : void 0,
|
|
1191
1192
|
showDivider: !0
|
|
1192
1193
|
},
|
|
1193
|
-
|
|
1194
|
+
h.guid
|
|
1194
1195
|
)),
|
|
1195
1196
|
/* @__PURE__ */ e(
|
|
1196
|
-
|
|
1197
|
+
ao,
|
|
1197
1198
|
{
|
|
1198
1199
|
component: "li",
|
|
1199
1200
|
in: i,
|
|
1200
1201
|
sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
|
|
1201
|
-
children: /* @__PURE__ */ e(We, { children: s.map((
|
|
1202
|
+
children: /* @__PURE__ */ e(We, { children: s.map((h, y) => {
|
|
1202
1203
|
const T = o.length + y;
|
|
1203
1204
|
return /* @__PURE__ */ e(
|
|
1204
1205
|
Je,
|
|
1205
1206
|
{
|
|
1206
|
-
...
|
|
1207
|
-
isLastItem: T ===
|
|
1208
|
-
onClick:
|
|
1207
|
+
...h,
|
|
1208
|
+
isLastItem: T === g - 1,
|
|
1209
|
+
onClick: h.transactions.length > 0 ? () => n(h) : void 0,
|
|
1209
1210
|
showDivider: !0
|
|
1210
1211
|
},
|
|
1211
|
-
|
|
1212
|
+
h.guid
|
|
1212
1213
|
);
|
|
1213
1214
|
}) })
|
|
1214
1215
|
}
|
|
@@ -1217,17 +1218,17 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1217
1218
|
] })
|
|
1218
1219
|
] });
|
|
1219
1220
|
}
|
|
1220
|
-
),
|
|
1221
|
-
const { onEvent: s } =
|
|
1222
|
-
n?.(T), s(
|
|
1223
|
-
},
|
|
1224
|
-
return /* @__PURE__ */ e(
|
|
1225
|
-
|
|
1221
|
+
), Bo = ({ beats: t, onInsightCardClick: n }) => {
|
|
1222
|
+
const { onEvent: s } = V(), { isMobile: o, isDesktop: r, isLargeDesktop: l } = Y(), { beatStore: a, endpoint: c, sessionToken: u } = Be(), i = r || l, f = i || o ? 1 : 2, m = () => null, _ = (T) => {
|
|
1223
|
+
n?.(T), s(D.TRENDS_CLICK_INSIGHT, O);
|
|
1224
|
+
}, g = i ? 200 : 170, h = i ? 170 : 124, y = t.length > 0 ? g : h;
|
|
1225
|
+
return /* @__PURE__ */ e(uo, { sx: { height: y }, children: /* @__PURE__ */ e(
|
|
1226
|
+
$t,
|
|
1226
1227
|
{
|
|
1227
1228
|
areBeatsLoading: a.isLoading,
|
|
1228
1229
|
beats: t,
|
|
1229
1230
|
cardStyle: "border",
|
|
1230
|
-
endpoint:
|
|
1231
|
+
endpoint: c,
|
|
1231
1232
|
headerSx: { p: 0 },
|
|
1232
1233
|
logOutUser: m,
|
|
1233
1234
|
onCardClick: _,
|
|
@@ -1240,10 +1241,10 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1240
1241
|
visibleCardsCount: f
|
|
1241
1242
|
}
|
|
1242
1243
|
) });
|
|
1243
|
-
},
|
|
1244
|
-
const { onEvent: s } =
|
|
1244
|
+
}, Po = R(Bo), Vo = R(({ chartLabel: t, chartColor: n }) => {
|
|
1245
|
+
const { onEvent: s } = V(), {
|
|
1245
1246
|
categoryDetailsChartData: { monthlyAmounts: o, tooltipLabels: r }
|
|
1246
|
-
} =
|
|
1247
|
+
} = Ce();
|
|
1247
1248
|
return /* @__PURE__ */ e(S, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
|
|
1248
1249
|
Ve,
|
|
1249
1250
|
{
|
|
@@ -1258,7 +1259,7 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1258
1259
|
stroke: n
|
|
1259
1260
|
}),
|
|
1260
1261
|
onItemClick: () => {
|
|
1261
|
-
s(
|
|
1262
|
+
s(D.TRENDS_CLICK_CHART, O);
|
|
1262
1263
|
},
|
|
1263
1264
|
showArea: !0,
|
|
1264
1265
|
showAverage: !0,
|
|
@@ -1273,22 +1274,22 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1273
1274
|
valueFormatterString: "0,0"
|
|
1274
1275
|
}
|
|
1275
1276
|
) });
|
|
1276
|
-
}),
|
|
1277
|
-
const t =
|
|
1278
|
-
if (!
|
|
1277
|
+
}), zo = R(() => {
|
|
1278
|
+
const t = K(), { is_mobile_webview: n } = rt(), { isDesktop: s, isSmallTablet: o, isTablet: r } = Y(), { common: l, trends: a } = k(), { selectedCategoryData: c, selectedDateRangeMonthRange: u } = Ce(), { sortedTransactions: i } = we(), [f, m] = p.useState(null);
|
|
1279
|
+
if (!c)
|
|
1279
1280
|
return null;
|
|
1280
|
-
const { guid: _, name:
|
|
1281
|
-
() => i.find((
|
|
1281
|
+
const { guid: _, name: g, is_income: h, totalAmount: y } = c, T = Ge(_, t), x = h ? a.income_label : a.spending_label, H = ` ${c.transactions.length === 1 ? a.transaction : a.transactions} (${c.transactions.length})`, L = p.useMemo(
|
|
1282
|
+
() => i.find((E) => E.guid === f),
|
|
1282
1283
|
[f, i]
|
|
1283
|
-
), M = i.length > 0 && !n && (s || r && !o),
|
|
1284
|
+
), M = i.length > 0 && !n && (s || r && !o), I = (E) => E.category_guid === _ || E.top_level_category_guid === _;
|
|
1284
1285
|
return /* @__PURE__ */ C(S, { sx: { alignItems: "center", height: "100%" }, children: [
|
|
1285
1286
|
/* @__PURE__ */ C(S, { sx: { borderRadius: 0, pb: 4, pt: 16, px: 12, width: "100%" }, children: [
|
|
1286
1287
|
/* @__PURE__ */ e(We, { sx: { px: 12 }, children: /* @__PURE__ */ C(mt, { children: [
|
|
1287
|
-
/* @__PURE__ */ e(
|
|
1288
|
+
/* @__PURE__ */ e(mo, { children: /* @__PURE__ */ e(ve, { categoryGuid: _ }) }),
|
|
1288
1289
|
/* @__PURE__ */ e(
|
|
1289
1290
|
ht,
|
|
1290
1291
|
{
|
|
1291
|
-
primary:
|
|
1292
|
+
primary: g,
|
|
1292
1293
|
secondary: u,
|
|
1293
1294
|
slotProps: {
|
|
1294
1295
|
primary: { component: "div", variant: "h3", fontSize: 18, fontWeight: 700 },
|
|
@@ -1296,19 +1297,19 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1296
1297
|
}
|
|
1297
1298
|
}
|
|
1298
1299
|
),
|
|
1299
|
-
/* @__PURE__ */ e(
|
|
1300
|
+
/* @__PURE__ */ e(P, { component: "div", variant: "h3", children: re(Math.abs(y), "0,0.00") })
|
|
1300
1301
|
] }) }),
|
|
1301
|
-
/* @__PURE__ */ e(
|
|
1302
|
+
/* @__PURE__ */ e(Vo, { chartColor: T, chartLabel: x }),
|
|
1302
1303
|
/* @__PURE__ */ C(S, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 12 }, children: [
|
|
1303
|
-
/* @__PURE__ */ e(
|
|
1304
|
-
M && /* @__PURE__ */ e(
|
|
1304
|
+
/* @__PURE__ */ e(P, { bold: !0, variant: "body1", children: H }),
|
|
1305
|
+
M && /* @__PURE__ */ e(ho, { filter: I })
|
|
1305
1306
|
] })
|
|
1306
1307
|
] }),
|
|
1307
1308
|
/* @__PURE__ */ e(
|
|
1308
|
-
|
|
1309
|
+
lt,
|
|
1309
1310
|
{
|
|
1310
1311
|
bgcolor: "transparent",
|
|
1311
|
-
filter:
|
|
1312
|
+
filter: I,
|
|
1312
1313
|
height: "calc(100vh - 475px)",
|
|
1313
1314
|
onClick: m
|
|
1314
1315
|
}
|
|
@@ -1316,7 +1317,7 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1316
1317
|
/* @__PURE__ */ e(
|
|
1317
1318
|
Pe,
|
|
1318
1319
|
{
|
|
1319
|
-
ariaLabelClose:
|
|
1320
|
+
ariaLabelClose: l.close_aria,
|
|
1320
1321
|
isOpen: !!L,
|
|
1321
1322
|
onClose: () => m(""),
|
|
1322
1323
|
title: a.transaction,
|
|
@@ -1324,30 +1325,30 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1324
1325
|
}
|
|
1325
1326
|
)
|
|
1326
1327
|
] });
|
|
1327
|
-
}),
|
|
1328
|
+
}), Fo = (t, n) => {
|
|
1328
1329
|
const s = at(t, n), o = it(t, n);
|
|
1329
1330
|
return [s, o].filter((r) => r.length > 0);
|
|
1330
|
-
},
|
|
1331
|
-
const [s, o] = t, r = s,
|
|
1331
|
+
}, $o = (t, n) => {
|
|
1332
|
+
const [s, o] = t, r = s, l = o ?? s, a = [];
|
|
1332
1333
|
if (r) {
|
|
1333
|
-
const
|
|
1334
|
-
a.push({ label: n.income_label, amount:
|
|
1334
|
+
const c = r.reduce((u, i) => u + i.y, 0);
|
|
1335
|
+
a.push({ label: n.income_label, amount: c });
|
|
1335
1336
|
}
|
|
1336
|
-
if (
|
|
1337
|
-
const
|
|
1338
|
-
a.push({ label: n.spending_label, amount:
|
|
1337
|
+
if (l) {
|
|
1338
|
+
const c = l.reduce((u, i) => u + i.y, 0);
|
|
1339
|
+
a.push({ label: n.spending_label, amount: c });
|
|
1339
1340
|
}
|
|
1340
1341
|
return a;
|
|
1341
|
-
},
|
|
1342
|
+
}, jo = ({
|
|
1342
1343
|
availableHeight: t = 0,
|
|
1343
1344
|
minHeight: n = 500,
|
|
1344
1345
|
selectedDateRange: s,
|
|
1345
1346
|
totals: o
|
|
1346
1347
|
}) => {
|
|
1347
|
-
const r =
|
|
1348
|
-
return
|
|
1349
|
-
const
|
|
1350
|
-
y(
|
|
1348
|
+
const r = K(), { onEvent: l } = V(), { trends: a } = k(), { isSmallMobile: c, isMobile: u, isSmallTablet: i, isTablet: f } = Y(), m = [r.palette.chart?.chart1, r.palette.chart?.chart2], _ = Fo(o, s), g = $o(_, a), [h, y] = p.useState(0), T = 458, x = 195, H = 56, L = u || c ? x : i || f ? T : h;
|
|
1349
|
+
return p.useEffect(() => {
|
|
1350
|
+
const I = Math.max(t - H, n);
|
|
1351
|
+
y(I);
|
|
1351
1352
|
}, [t]), /* @__PURE__ */ e(
|
|
1352
1353
|
Ve,
|
|
1353
1354
|
{
|
|
@@ -1356,9 +1357,9 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1356
1357
|
curveType: "bump",
|
|
1357
1358
|
datasets: _,
|
|
1358
1359
|
height: L,
|
|
1359
|
-
labels:
|
|
1360
|
+
labels: g,
|
|
1360
1361
|
onItemClick: () => {
|
|
1361
|
-
|
|
1362
|
+
l(D.TRENDS_CLICK_CHART, O);
|
|
1362
1363
|
},
|
|
1363
1364
|
showArea: !0,
|
|
1364
1365
|
showAxisHighlight: !0,
|
|
@@ -1371,7 +1372,7 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1371
1372
|
valueFormatterString: "0.0a"
|
|
1372
1373
|
}
|
|
1373
1374
|
);
|
|
1374
|
-
},
|
|
1375
|
+
}, Ko = R(jo), Yo = [
|
|
1375
1376
|
"BillAmountNotStandard",
|
|
1376
1377
|
"CategorySpendingV2",
|
|
1377
1378
|
"CostOfLivingToIncome",
|
|
@@ -1405,101 +1406,102 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1405
1406
|
"WeeklyNewMerchantsV2",
|
|
1406
1407
|
"WeeklyNoSpendDays",
|
|
1407
1408
|
"WeeklySmallPurchasesSummary"
|
|
1408
|
-
],
|
|
1409
|
+
], Uo = (t, n, s) => ({
|
|
1409
1410
|
description: n ? t.empty_state_sub_text : t.empty_state_sub_text_no_aggregation,
|
|
1410
1411
|
header: n ? t.zero_state_content_header : t.zero_state_content_header_no_aggregation,
|
|
1411
1412
|
onClickHandler: n ? s : void 0,
|
|
1412
1413
|
primaryButton: n ? t.empty_state_primary : void 0
|
|
1413
|
-
}),
|
|
1414
|
+
}), Xo = ({
|
|
1414
1415
|
onBackClick: t,
|
|
1415
1416
|
onMenuClick: n,
|
|
1416
1417
|
onInsightCardClick: s,
|
|
1417
1418
|
sx: o
|
|
1418
1419
|
}) => {
|
|
1419
|
-
const { onEvent: r } =
|
|
1420
|
+
const { onEvent: r } = V(), { config: l } = rt(), { isDesktop: a, isLargeDesktop: c, isMobile: u } = Y(), { isAccountDataLoaded: i, loadAccountData: f, visibleAccounts: m } = De(), {
|
|
1420
1421
|
categoriesLoaded: _,
|
|
1421
|
-
loadCategories:
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
} = q(), { isTransactionDataLoaded: x, loadTransactionData: L, setFilter: M } = we(), { selectedCategoryData: E, selectedDateRange: v, setSelectedCategoryData: K, setSelectedDateRange: ae } = ye(), { isInitialized: Y, selectedAccounts: J, selectedAccountGuids: P } = fe(), { trends: V, connect: O } = R(), { beatStore: ee } = Be(), ie = po() && c.show_insights_widget_in_master, te = a || d, [j, ne] = g.useState(!1), [U, de] = g.useState(!1), [B, ue] = g.useState("Chart"), [se, le] = g.useState(""), [ce, me] = g.useState(window.innerHeight), D = te ? 56 : 0, l = ce - 208, b = ce - (ie ? 550 + D : 266), [I, z] = g.useState(!1), Ee = c.show_connections_widget_in_master;
|
|
1422
|
+
loadCategories: g,
|
|
1423
|
+
monthlyCategoryTotals: h,
|
|
1424
|
+
monthlyTotalsLoaded: y,
|
|
1425
|
+
reloadCategoryTotals: T
|
|
1426
|
+
} = U(), { isTransactionDataLoaded: x, loadTransactionData: H, setFilter: L } = we(), { selectedCategoryData: M, selectedDateRange: I, setSelectedCategoryData: E, setSelectedDateRange: X } = Ce(), { isInitialized: Z, selectedAccounts: te, selectedAccountGuids: oe } = ye(), { trends: A, connect: de } = k(), { beatStore: G } = Be(), ie = go() && l.show_insights_widget_in_master, z = a || c, [ue, Q] = p.useState(!1), [F, ne] = p.useState(!1), [q, J] = p.useState("Chart"), [se, ce] = p.useState(""), [le, me] = p.useState(window.innerHeight), he = z ? 56 : 0, v = le - 208, d = le - (ie ? 550 + he : 266), [b, w] = p.useState(!1), $ = l.show_connections_widget_in_master;
|
|
1427
1427
|
Ie({
|
|
1428
1428
|
widgetName: "TrendsWidget",
|
|
1429
|
-
isLoaded:
|
|
1429
|
+
isLoaded: ue
|
|
1430
1430
|
});
|
|
1431
|
-
const _e =
|
|
1432
|
-
|
|
1433
|
-
const
|
|
1434
|
-
return window.addEventListener("resize",
|
|
1435
|
-
}, []),
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1431
|
+
const _e = p.useMemo(() => F ? G.getFilteredBeats({ templates: Yo }) : [], [F]);
|
|
1432
|
+
p.useEffect(() => {
|
|
1433
|
+
const N = () => me(window.innerHeight);
|
|
1434
|
+
return window.addEventListener("resize", N), i || f().finally(), _ || g().finally(), x || H().finally(), () => window.removeEventListener("resize", N);
|
|
1435
|
+
}, []), p.useEffect(() => {
|
|
1436
|
+
Z && i && (G.loadBeats().finally(() => ne(!0)), T(te, I.start, I.end).finally(
|
|
1437
|
+
() => {
|
|
1438
|
+
Q(!0), r(D.TRENDS_LOAD_WIDGET, {
|
|
1439
|
+
...O,
|
|
1440
|
+
time_period: `${Se(I.end, I.start)}M`
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
));
|
|
1444
|
+
}, [
|
|
1445
|
+
Z,
|
|
1446
|
+
i,
|
|
1447
|
+
oe.join(","),
|
|
1448
|
+
I.start.getTime(),
|
|
1449
|
+
I.end.getTime()
|
|
1450
|
+
]), p.useEffect(() => {
|
|
1451
|
+
if (h.length !== 0) {
|
|
1452
|
+
const N = {
|
|
1453
|
+
accounts: oe,
|
|
1454
|
+
dateRange: { start: I.start, end: I.end }
|
|
1453
1455
|
};
|
|
1454
|
-
|
|
1455
|
-
...
|
|
1456
|
-
custom: (
|
|
1457
|
-
(
|
|
1456
|
+
L({
|
|
1457
|
+
...N,
|
|
1458
|
+
custom: (ee) => !!h.find(
|
|
1459
|
+
(pe) => pe.top_level_category_guid === ee.top_level_category_guid || pe.category_guid === ee.category_guid
|
|
1458
1460
|
)
|
|
1459
1461
|
});
|
|
1460
1462
|
}
|
|
1461
|
-
}, [
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1463
|
+
}, [h]);
|
|
1464
|
+
const Ee = (N) => {
|
|
1465
|
+
E(N);
|
|
1466
|
+
}, ge = () => {
|
|
1467
|
+
E(null), r(D.TRENDS_CLICK_BACK, O);
|
|
1464
1468
|
}, Me = () => {
|
|
1465
|
-
|
|
1466
|
-
}, Ae = () => {
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
...W,
|
|
1471
|
-
toggleView: oe
|
|
1469
|
+
w(!0), r(D.TRENDS_CLICK_CONNECT_ACCOUNTS);
|
|
1470
|
+
}, Ae = (N, ee) => {
|
|
1471
|
+
J(ee ?? q), r(D.TRENDS_CLICK_TOGGLE_VIEW, {
|
|
1472
|
+
...O,
|
|
1473
|
+
toggleView: ee
|
|
1472
1474
|
});
|
|
1473
|
-
},
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
...
|
|
1477
|
-
time_period:
|
|
1475
|
+
}, Ct = (N) => {
|
|
1476
|
+
const ee = et(N?.[0], 1), pe = N?.[1], St = Se(pe, ee);
|
|
1477
|
+
X({ start: ee, end: pe }), r(D.TRENDS_CLICK_TIME_WINDOW, {
|
|
1478
|
+
...O,
|
|
1479
|
+
time_period: St + "M"
|
|
1478
1480
|
});
|
|
1479
|
-
},
|
|
1480
|
-
r(
|
|
1481
|
-
...
|
|
1482
|
-
filterValue:
|
|
1481
|
+
}, _t = (N) => {
|
|
1482
|
+
r(D.TRENDS_CLICK_FILTER, {
|
|
1483
|
+
...O,
|
|
1484
|
+
filterValue: N
|
|
1483
1485
|
});
|
|
1484
|
-
},
|
|
1485
|
-
|
|
1486
|
-
},
|
|
1487
|
-
|
|
1486
|
+
}, bt = (N) => {
|
|
1487
|
+
ce(N);
|
|
1488
|
+
}, Tt = () => {
|
|
1489
|
+
ce(""), r(D.TRENDS_CLICK_ALL_CATEGORIES, O);
|
|
1488
1490
|
};
|
|
1489
|
-
if (!
|
|
1491
|
+
if (!Z || !i || !ue || !y)
|
|
1490
1492
|
return /* @__PURE__ */ e(Le, {});
|
|
1491
|
-
const ze = m.length === 0 ||
|
|
1493
|
+
const ze = m.length === 0 || h.length === 0, be = Uo(A, $, Me);
|
|
1492
1494
|
return /* @__PURE__ */ C(
|
|
1493
1495
|
ut,
|
|
1494
1496
|
{
|
|
1495
|
-
calendarActions: { onRangeChanged:
|
|
1496
|
-
dateRange:
|
|
1497
|
+
calendarActions: { onRangeChanged: Ct },
|
|
1498
|
+
dateRange: I,
|
|
1497
1499
|
dateRangeVariant: u ? "timeframetabs" : "timeframebuttons",
|
|
1498
|
-
onAccountsFilterClick:
|
|
1500
|
+
onAccountsFilterClick: _t,
|
|
1499
1501
|
onBackClick: t,
|
|
1500
1502
|
onMenuClick: n,
|
|
1501
1503
|
sx: o,
|
|
1502
|
-
title:
|
|
1504
|
+
title: A.title,
|
|
1503
1505
|
children: [
|
|
1504
1506
|
/* @__PURE__ */ C(
|
|
1505
1507
|
S,
|
|
@@ -1519,96 +1521,96 @@ const Lo = g.memo(Io), Qe = ({
|
|
|
1519
1521
|
ft,
|
|
1520
1522
|
{
|
|
1521
1523
|
selectedCategoryGuid: se,
|
|
1522
|
-
selectedDateRange:
|
|
1524
|
+
selectedDateRange: I
|
|
1523
1525
|
}
|
|
1524
1526
|
),
|
|
1525
|
-
/* @__PURE__ */ e(pt, { onTabChange:
|
|
1527
|
+
/* @__PURE__ */ e(pt, { onTabChange: Ae, selectedTab: q })
|
|
1526
1528
|
]
|
|
1527
1529
|
}
|
|
1528
1530
|
),
|
|
1529
|
-
/* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", sx: { pb: 8 }, width: "100%", children: /* @__PURE__ */ e(
|
|
1530
|
-
/* @__PURE__ */ e(
|
|
1531
|
-
|
|
1531
|
+
/* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", sx: { pb: 8 }, width: "100%", children: /* @__PURE__ */ e(W, { flexGrow: 1, children: se && /* @__PURE__ */ C(Te, { onClick: Tt, sx: { p: 0, pr: 5 }, children: [
|
|
1532
|
+
/* @__PURE__ */ e(so, {}),
|
|
1533
|
+
A.all_categories
|
|
1532
1534
|
] }) }) }),
|
|
1533
1535
|
ze && /* @__PURE__ */ e(
|
|
1534
|
-
|
|
1536
|
+
po,
|
|
1535
1537
|
{
|
|
1536
1538
|
header: be.header,
|
|
1537
1539
|
icon: "multiline_chart",
|
|
1538
1540
|
onClick: be.onClickHandler,
|
|
1539
1541
|
primaryButton: be.primaryButton,
|
|
1540
1542
|
subText: be.description,
|
|
1541
|
-
sx: { height:
|
|
1543
|
+
sx: { height: v, maxWidth: 432 }
|
|
1542
1544
|
}
|
|
1543
1545
|
),
|
|
1544
|
-
!ze && /* @__PURE__ */ C(S, { flexDirection:
|
|
1545
|
-
|
|
1546
|
-
/* @__PURE__ */ e(
|
|
1547
|
-
|
|
1546
|
+
!ze && /* @__PURE__ */ C(S, { flexDirection: z ? "row" : "column", gap: z ? 48 : 16, children: [
|
|
1547
|
+
q === "Chart" && /* @__PURE__ */ C(xt, { children: [
|
|
1548
|
+
/* @__PURE__ */ e(W, { sx: { width: z ? "68%" : "100%" }, children: /* @__PURE__ */ e(
|
|
1549
|
+
Ko,
|
|
1548
1550
|
{
|
|
1549
|
-
availableHeight:
|
|
1551
|
+
availableHeight: v,
|
|
1550
1552
|
minHeight: 450,
|
|
1551
|
-
selectedDateRange:
|
|
1552
|
-
totals:
|
|
1553
|
+
selectedDateRange: I,
|
|
1554
|
+
totals: h
|
|
1553
1555
|
}
|
|
1554
1556
|
) }),
|
|
1555
|
-
/* @__PURE__ */ C(S, { gap: 16, sx: { width:
|
|
1556
|
-
ie &&
|
|
1557
|
-
|
|
1557
|
+
/* @__PURE__ */ C(S, { gap: 16, sx: { width: z ? "32%" : "100%" }, children: [
|
|
1558
|
+
ie && F && _e.length > 0 && /* @__PURE__ */ e(
|
|
1559
|
+
Po,
|
|
1558
1560
|
{
|
|
1559
1561
|
beats: _e,
|
|
1560
1562
|
onInsightCardClick: s
|
|
1561
1563
|
}
|
|
1562
1564
|
),
|
|
1563
1565
|
/* @__PURE__ */ e(
|
|
1564
|
-
|
|
1566
|
+
Oo,
|
|
1565
1567
|
{
|
|
1566
|
-
availableHeight:
|
|
1567
|
-
onCategoryClick:
|
|
1568
|
+
availableHeight: d,
|
|
1569
|
+
onCategoryClick: Ee
|
|
1568
1570
|
}
|
|
1569
1571
|
)
|
|
1570
1572
|
] })
|
|
1571
1573
|
] }),
|
|
1572
|
-
|
|
1574
|
+
q === "Table" && /* @__PURE__ */ e(W, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
1573
1575
|
yt,
|
|
1574
1576
|
{
|
|
1575
1577
|
height: "unset",
|
|
1576
|
-
onClickRow:
|
|
1578
|
+
onClickRow: bt,
|
|
1577
1579
|
selectedCategory: se,
|
|
1578
|
-
selectedDateRange:
|
|
1580
|
+
selectedDateRange: I
|
|
1579
1581
|
}
|
|
1580
1582
|
) })
|
|
1581
1583
|
] }),
|
|
1582
1584
|
/* @__PURE__ */ e(
|
|
1583
1585
|
Pe,
|
|
1584
1586
|
{
|
|
1585
|
-
ariaLabelClose:
|
|
1586
|
-
isOpen: !!
|
|
1587
|
-
onClose:
|
|
1587
|
+
ariaLabelClose: A.close_category_details,
|
|
1588
|
+
isOpen: !!M,
|
|
1589
|
+
onClose: ge,
|
|
1588
1590
|
shouldShowHeaderShadow: !0,
|
|
1589
|
-
title:
|
|
1590
|
-
children:
|
|
1591
|
+
title: M?.is_income ? A.category_income : A.category_spending,
|
|
1592
|
+
children: M && /* @__PURE__ */ e(zo, {})
|
|
1591
1593
|
}
|
|
1592
1594
|
)
|
|
1593
1595
|
]
|
|
1594
1596
|
}
|
|
1595
1597
|
),
|
|
1596
1598
|
/* @__PURE__ */ e(
|
|
1597
|
-
|
|
1599
|
+
fo,
|
|
1598
1600
|
{
|
|
1599
|
-
onClose: () =>
|
|
1600
|
-
showConnectWidget:
|
|
1601
|
-
title:
|
|
1601
|
+
onClose: () => w(!1),
|
|
1602
|
+
showConnectWidget: b,
|
|
1603
|
+
title: de.mini_title
|
|
1602
1604
|
}
|
|
1603
1605
|
)
|
|
1604
1606
|
]
|
|
1605
1607
|
}
|
|
1606
1608
|
);
|
|
1607
|
-
},
|
|
1609
|
+
}, is = R(Xo);
|
|
1608
1610
|
export {
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1611
|
+
ss as TrendsFullWidget,
|
|
1612
|
+
as as TrendsMicroWidget,
|
|
1613
|
+
rs as TrendsMiniWidget,
|
|
1614
|
+
is as TrendsWidget
|
|
1613
1615
|
};
|
|
1614
1616
|
//# sourceMappingURL=index.es.js.map
|