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