@mx-cartographer/experiences 7.0.0 → 7.0.1-alpha.al0
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/trends/index.es.js +503 -507
- package/package.json +1 -1
package/dist/trends/index.es.js
CHANGED
@@ -1,73 +1,73 @@
|
|
1
|
-
import { jsx as e, jsxs as
|
2
|
-
import
|
1
|
+
import { jsx as e, jsxs as T } from "react/jsx-runtime";
|
2
|
+
import i from "react";
|
3
3
|
import { observer as M } from "mobx-react-lite";
|
4
|
-
import { Icon as
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import { addSeconds as
|
9
|
-
import { differenceInCalendarMonths as
|
10
|
-
import { a as
|
11
|
-
import { T as
|
12
|
-
import { i as
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import { u as
|
4
|
+
import { Icon as te, Text as Z, CategoryIcon as fe, P as U, H3 as we, ChevronRightIcon as Ge } from "@mxenabled/mxui";
|
5
|
+
import G from "@mui/material/Box";
|
6
|
+
import b from "@mui/material/Stack";
|
7
|
+
import ge from "@mui/material/Button";
|
8
|
+
import { addSeconds as De } from "date-fns/addSeconds";
|
9
|
+
import { differenceInCalendarMonths as pe } from "date-fns/differenceInCalendarMonths";
|
10
|
+
import { a as Be, g as ze, S as Fe, L as Ie, u as Pe } from "../TrendsStore-DR8etTL2.mjs";
|
11
|
+
import { T as Xn } from "../TrendsStore-DR8etTL2.mjs";
|
12
|
+
import { i as Ke, c as $e, d as je, e as Ye, f as Ue, h as Xe, b as Ee, g as Le, j as ye } from "../SpendingData-D5vsfYKo.mjs";
|
13
|
+
import Ze from "@mui/material/ToggleButton";
|
14
|
+
import Qe from "@mui/material/ToggleButtonGroup";
|
15
|
+
import { u as k, l as F, e as N, a as P, f as ne, c as oe, v as J, m as xe, p as qe } from "../hooks-02T565vf.mjs";
|
16
16
|
import { u as K } from "../useScreenSize-B6JyS_Lj.mjs";
|
17
|
-
import { f as
|
18
|
-
import { DataGridPro as
|
19
|
-
import { C as
|
20
|
-
import { c as
|
21
|
-
import { b as
|
22
|
-
import { H as
|
23
|
-
import { T as
|
24
|
-
import { A as
|
25
|
-
import { a as
|
26
|
-
import { D as
|
27
|
-
import { L as
|
28
|
-
import { useTheme as
|
29
|
-
import { L as
|
30
|
-
import { M as
|
31
|
-
import { subMonths as
|
32
|
-
import { TrendingUp as
|
33
|
-
import { a as
|
34
|
-
import { M as
|
35
|
-
import
|
36
|
-
import
|
37
|
-
import
|
38
|
-
import
|
39
|
-
import
|
40
|
-
import
|
41
|
-
import
|
42
|
-
import
|
43
|
-
import { useTheme as
|
44
|
-
import
|
45
|
-
import { b as
|
46
|
-
import { E as
|
47
|
-
import { E as
|
48
|
-
const
|
49
|
-
|
17
|
+
import { f as Q, D as z } from "../Dialog-CWW597AF.mjs";
|
18
|
+
import { DataGridPro as Je } from "@mui/x-data-grid-pro";
|
19
|
+
import { C as et } from "../CurrencyText-YUhH2caW.mjs";
|
20
|
+
import { c as ve } from "../Category-CevNQ03n.mjs";
|
21
|
+
import { b as tt } from "../Localization-2MODESHW.mjs";
|
22
|
+
import { H as _e } from "../HeaderCell-DjuifqHJ.mjs";
|
23
|
+
import { T as R, b as nt } from "../ViewMoreMicroCard-BZI5VMNW.mjs";
|
24
|
+
import { A as _, W as Me } from "../WidgetContainer-BG-fdDOf.mjs";
|
25
|
+
import { a as Ae, T as Re } from "../TransactionDetails-D4B9DSWo.mjs";
|
26
|
+
import { D as Ce } from "../Drawer-kEE73B87.mjs";
|
27
|
+
import { L as q } from "../Loader-Dp1P2gNw.mjs";
|
28
|
+
import { useTheme as ke } from "@mui/material/styles";
|
29
|
+
import { L as Te } from "../LineChart-CYiUS-px.mjs";
|
30
|
+
import { M as ot } from "../MiniWidgetContainer-DqKQNubH.mjs";
|
31
|
+
import { subMonths as st } from "date-fns";
|
32
|
+
import { TrendingUp as rt, TrendingDown as at, MultilineChart as it, ExpandLess as ct, ExpandMore as lt } from "@mxenabled/mx-icons";
|
33
|
+
import { a as dt, f as X } from "../NumberFormatting-CtWHhyBX.mjs";
|
34
|
+
import { M as ht } from "../MicroWidgetContainer-DmYiksbT.mjs";
|
35
|
+
import ut from "@mui/material/Collapse";
|
36
|
+
import mt from "@mui/material/List";
|
37
|
+
import gt from "@mui/material/ListItem";
|
38
|
+
import pt from "@mui/material/ListItemButton";
|
39
|
+
import Ct from "@mui/material/ListItemIcon";
|
40
|
+
import ft from "@mui/material/ListItemText";
|
41
|
+
import He from "@mui/material/styles/useTheme";
|
42
|
+
import Tt from "@mui/material/Divider";
|
43
|
+
import { useTheme as yt, Stack as _t } from "@mui/material";
|
44
|
+
import bt from "@mui/material/Paper";
|
45
|
+
import { b as St } from "../CategoryUtil-BR3H5i6n.mjs";
|
46
|
+
import { E as wt } from "../ExportCsvAction-dpvaZxbS.mjs";
|
47
|
+
import { E as Dt } from "../EmptyState-Dcb-o2tl.mjs";
|
48
|
+
const Ne = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
49
|
+
Qe,
|
50
50
|
{
|
51
51
|
exclusive: !0,
|
52
52
|
onChange: o,
|
53
53
|
orientation: "horizontal",
|
54
54
|
value: n,
|
55
|
-
children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(
|
55
|
+
children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(Ze, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(te, { name: "table_chart_view" }) : /* @__PURE__ */ e(te, { name: "format_list_bulleted" }) }, t))
|
56
56
|
}
|
57
|
-
),
|
58
|
-
const { trends: t } =
|
59
|
-
const
|
57
|
+
), We = ({ selectedDateRange: n, selectedCategoryGuid: o }) => {
|
58
|
+
const { trends: t } = k(), { isMobile: s, isDesktop: r } = K(), { getCategoryName: d } = F(), a = i.useMemo(() => {
|
59
|
+
const c = Q(
|
60
60
|
n.start,
|
61
|
-
s ?
|
62
|
-
), h =
|
61
|
+
s ? z.MONTH_SHORT_YEAR : z.MONTH_YEAR
|
62
|
+
), h = Q(
|
63
63
|
n.end,
|
64
|
-
s ?
|
64
|
+
s ? z.MONTH_SHORT_YEAR : z.MONTH_YEAR
|
65
65
|
);
|
66
|
-
return `${
|
66
|
+
return `${c} - ${h}`;
|
67
67
|
}, [n, s]);
|
68
|
-
return /* @__PURE__ */
|
68
|
+
return /* @__PURE__ */ T(G, { sx: { mr: 10, minWidth: "60%" }, children: [
|
69
69
|
/* @__PURE__ */ e(
|
70
|
-
|
70
|
+
Z,
|
71
71
|
{
|
72
72
|
display: "block",
|
73
73
|
fontWeight: 700,
|
@@ -76,270 +76,270 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
76
76
|
overflow: "visible",
|
77
77
|
textOverflow: "unset"
|
78
78
|
},
|
79
|
-
variant:
|
79
|
+
variant: r ? "H3" : "Body",
|
80
80
|
children: d(o) || t.sub_title
|
81
81
|
}
|
82
82
|
),
|
83
|
-
/* @__PURE__ */ e(
|
83
|
+
/* @__PURE__ */ e(Z, { variant: r ? "Body" : "Small", children: a })
|
84
84
|
] });
|
85
|
-
},
|
85
|
+
}, It = (n) => {
|
86
86
|
const o = n.row[n.field];
|
87
|
-
return /* @__PURE__ */ e(
|
88
|
-
},
|
89
|
-
const { categories: t } =
|
90
|
-
return /* @__PURE__ */
|
87
|
+
return /* @__PURE__ */ e(b, { alignItems: "flex-end", tabIndex: n.tabIndex, children: /* @__PURE__ */ e(et, { amount: o, variant: "Small" }) });
|
88
|
+
}, Et = ({ categoryGuid: n, topLevelCategoryGuid: o }) => {
|
89
|
+
const { categories: t } = k(), s = t.default_categories[n]?.replace(/&/g, "&") ?? ve[n];
|
90
|
+
return /* @__PURE__ */ T(b, { alignItems: "center", direction: "row", justifyContent: "center", children: [
|
91
91
|
/* @__PURE__ */ e(
|
92
|
-
|
92
|
+
G,
|
93
93
|
{
|
94
|
-
"aria-label":
|
94
|
+
"aria-label": tt(t.category_icon_label_aria, s),
|
95
95
|
role: "img",
|
96
|
-
children: /* @__PURE__ */ e(
|
96
|
+
children: /* @__PURE__ */ e(fe, { categoryGuid: o })
|
97
97
|
}
|
98
98
|
),
|
99
|
-
/* @__PURE__ */ e(
|
99
|
+
/* @__PURE__ */ e(Z, { sx: { ml: 12, pb: 6 }, variant: "Small", children: s })
|
100
100
|
] });
|
101
|
-
},
|
102
|
-
|
101
|
+
}, Lt = (n) => /* @__PURE__ */ e(b, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
|
102
|
+
Et,
|
103
103
|
{
|
104
104
|
categoryGuid: n.row.category,
|
105
105
|
topLevelCategoryGuid: n.row.top_level_category_guid
|
106
106
|
}
|
107
|
-
) }),
|
107
|
+
) }), xt = (n, o) => {
|
108
108
|
const t = [], s = new Date(n);
|
109
109
|
for (; s <= o; ) {
|
110
|
-
const
|
111
|
-
t.push(
|
110
|
+
const r = Q(s, z.MONTH);
|
111
|
+
t.push(r), s.setMonth(s.getMonth() + 1);
|
112
112
|
}
|
113
113
|
return t;
|
114
|
-
},
|
114
|
+
}, Oe = ({
|
115
115
|
monthlyCategoryTotals: n,
|
116
116
|
selectedDateRange: o,
|
117
117
|
selectedCategory: t,
|
118
118
|
onClickRow: s,
|
119
|
-
height:
|
119
|
+
height: r = "100dvh",
|
120
120
|
sx: d = {}
|
121
121
|
}) => {
|
122
|
-
const { onEvent:
|
123
|
-
{ field:
|
124
|
-
]),
|
122
|
+
const { onEvent: a } = N(), c = Q(/* @__PURE__ */ new Date(), z.MONTH_SHORT), [h, m] = i.useState([
|
123
|
+
{ field: c, sort: "desc" }
|
124
|
+
]), g = i.useMemo(() => xt(o.start, o.end), [o]), C = [
|
125
125
|
{
|
126
126
|
field: "category",
|
127
127
|
headerName: "Category",
|
128
128
|
minWidth: 175,
|
129
|
-
renderHeader:
|
130
|
-
renderCell:
|
129
|
+
renderHeader: _e,
|
130
|
+
renderCell: Lt,
|
131
131
|
sortable: !0,
|
132
132
|
type: "string"
|
133
133
|
},
|
134
|
-
...
|
135
|
-
(
|
136
|
-
field:
|
137
|
-
headerName:
|
134
|
+
...g.map(
|
135
|
+
(l) => ({
|
136
|
+
field: l,
|
137
|
+
headerName: l,
|
138
138
|
minWidth: 75,
|
139
|
-
renderHeader:
|
140
|
-
renderCell:
|
139
|
+
renderHeader: _e,
|
140
|
+
renderCell: It,
|
141
141
|
align: "right",
|
142
142
|
headerAlign: "right",
|
143
143
|
sortable: !0,
|
144
144
|
hideSortIcons: !1,
|
145
145
|
type: "number",
|
146
|
-
sortComparator:
|
146
|
+
sortComparator: Be
|
147
147
|
})
|
148
148
|
)
|
149
|
-
],
|
150
|
-
const
|
151
|
-
(
|
152
|
-
),
|
153
|
-
(
|
154
|
-
) :
|
155
|
-
(
|
156
|
-
const { category_guid:
|
157
|
-
|
158
|
-
id:
|
159
|
-
category:
|
160
|
-
category_guid:
|
149
|
+
], u = i.useMemo(() => {
|
150
|
+
const l = n.filter(
|
151
|
+
(f) => !Ke(f) && !$e(f)
|
152
|
+
), y = (t ? l.filter(
|
153
|
+
(f) => f.category_guid === t || f.top_level_category_guid === t
|
154
|
+
) : l).reduce(
|
155
|
+
(f, w) => {
|
156
|
+
const { category_guid: D, top_level_category_guid: I, month: x, total: E, year: H } = w, A = t ? D : I;
|
157
|
+
f[A] || (f[A] = {
|
158
|
+
id: A,
|
159
|
+
category: A,
|
160
|
+
category_guid: D,
|
161
161
|
top_level_category_guid: I
|
162
162
|
});
|
163
|
-
const
|
164
|
-
return
|
163
|
+
const v = Q(new Date(H, x - 1), z.MONTH_SHORT);
|
164
|
+
return f[A][v] || (f[A][v] = 0), f[A][v] = f[A][v] + E, f;
|
165
165
|
},
|
166
166
|
{}
|
167
167
|
);
|
168
|
-
return Object.values(
|
168
|
+
return Object.values(y);
|
169
169
|
}, [n, t]);
|
170
|
-
return /* @__PURE__ */ e(
|
171
|
-
|
170
|
+
return /* @__PURE__ */ e(G, { sx: { height: r, width: "100%", overflowX: "auto", boxShadow: "none", ...d }, children: /* @__PURE__ */ e(
|
171
|
+
Je,
|
172
172
|
{
|
173
|
-
columns:
|
173
|
+
columns: C,
|
174
174
|
disableColumnFilter: !0,
|
175
175
|
disableColumnMenu: !0,
|
176
176
|
hideFooter: !0,
|
177
177
|
initialState: { sorting: { sortModel: h } },
|
178
|
-
onRowClick: (
|
179
|
-
s?.(
|
180
|
-
...
|
181
|
-
listItem:
|
178
|
+
onRowClick: (l) => {
|
179
|
+
s?.(l.row.category), a(_.TRENDS_CLICK_LIST_ITEM, {
|
180
|
+
...R,
|
181
|
+
listItem: ve[l.row.category]
|
182
182
|
});
|
183
183
|
},
|
184
|
-
onSortModelChange: (
|
185
|
-
m(
|
184
|
+
onSortModelChange: (l) => {
|
185
|
+
m(l), a(_.TRENDS_CLICK_TABLE_SORT, R);
|
186
186
|
},
|
187
|
-
rows:
|
187
|
+
rows: u,
|
188
188
|
slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
|
189
189
|
sortModel: h,
|
190
190
|
sortingOrder: ["asc", "desc"]
|
191
191
|
}
|
192
192
|
) });
|
193
|
-
},
|
193
|
+
}, vt = {
|
194
194
|
title: "Transaction List"
|
195
|
-
},
|
195
|
+
}, Mt = ({
|
196
196
|
categoryGuid: n,
|
197
197
|
dateRange: o,
|
198
198
|
isOpen: t,
|
199
199
|
onClose: s
|
200
200
|
}) => {
|
201
|
-
const { onEvent:
|
202
|
-
() => h.find((
|
201
|
+
const { onEvent: r } = N(), { selectedAccountGuids: d } = P(), { common: a } = k(), { setFilter: c, sortedTransactions: h } = ne(), [m, g] = i.useState(""), C = i.useMemo(
|
202
|
+
() => h.find((l) => l.guid === m),
|
203
203
|
[m, h]
|
204
204
|
);
|
205
|
-
|
206
|
-
|
205
|
+
i.useEffect(() => {
|
206
|
+
c({
|
207
207
|
accounts: d,
|
208
208
|
dateRange: o,
|
209
|
-
custom: (
|
209
|
+
custom: (l) => n === "" || n === l.category_guid || n === l.top_level_category_guid,
|
210
210
|
showSplits: !!n
|
211
211
|
});
|
212
|
-
}, [d, n, o]),
|
213
|
-
const
|
214
|
-
|
212
|
+
}, [d, n, o]), i.useEffect(() => r(_.TRENDS_VIEW_TRANSACTIONS), []);
|
213
|
+
const u = () => {
|
214
|
+
g(""), s();
|
215
215
|
};
|
216
|
-
return /* @__PURE__ */
|
217
|
-
|
216
|
+
return /* @__PURE__ */ T(
|
217
|
+
Ce,
|
218
218
|
{
|
219
|
-
ariaLabelClose:
|
219
|
+
ariaLabelClose: a.close_aria,
|
220
220
|
isOpen: t,
|
221
|
-
onClose:
|
222
|
-
title:
|
221
|
+
onClose: u,
|
222
|
+
title: vt.title,
|
223
223
|
children: [
|
224
|
-
|
225
|
-
!
|
224
|
+
C && /* @__PURE__ */ e(Ae, { transaction: C }),
|
225
|
+
!C && /* @__PURE__ */ e(Re, { onClick: g })
|
226
226
|
]
|
227
227
|
}
|
228
228
|
);
|
229
|
-
},
|
230
|
-
const { onEvent: t } =
|
231
|
-
|
232
|
-
const S = () =>
|
229
|
+
}, At = M(Mt), Rt = ({ onBackClick: n, sx: o }) => {
|
230
|
+
const { onEvent: t } = N(), { isDesktop: s, isTablet: r, isMobile: d } = K(), { visibleAccounts: a } = oe(), { loadMonthlyCategoryTotals: c, monthlyCategoryTotals: h, getCategoryName: m } = F(), { sortedTransactions: g } = ne(), { selectedDateRange: C, setSelectedDateRange: u } = J(), { isCopyLoaded: l, isInitialized: p, selectedAccounts: y, setSelectedAccounts: f } = P(), { trends: w } = k(), [D, I] = i.useState(!1), [x, E] = i.useState(!1), [H, A] = i.useState("Chart"), [v, W] = i.useState(""), [se, $] = i.useState(window.innerHeight), ae = se - (d ? 315 : 345);
|
231
|
+
i.useEffect(() => {
|
232
|
+
const S = () => $(window.innerHeight);
|
233
233
|
return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
|
234
|
-
}, []),
|
235
|
-
|
236
|
-
}, [
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
234
|
+
}, []), i.useEffect(() => {
|
235
|
+
f(a);
|
236
|
+
}, [a]), i.useEffect(() => {
|
237
|
+
p && c(
|
238
|
+
y,
|
239
|
+
C.start,
|
240
|
+
C.end
|
241
241
|
).finally(() => {
|
242
242
|
I(!0);
|
243
243
|
});
|
244
|
-
}, [
|
245
|
-
const
|
246
|
-
if (!
|
247
|
-
const S =
|
244
|
+
}, [p, y, C]);
|
245
|
+
const j = i.useMemo(() => {
|
246
|
+
if (!D) return { stackedDatasets: [], unstackedDatasets: [] };
|
247
|
+
const S = ze(
|
248
248
|
h,
|
249
|
-
|
250
|
-
|
251
|
-
),
|
252
|
-
(
|
253
|
-
) :
|
249
|
+
C.start,
|
250
|
+
C.end
|
251
|
+
), O = v.length ? S.filter(
|
252
|
+
(B) => B.top_level_category_guid === v || B.category_guid === v
|
253
|
+
) : je(S);
|
254
254
|
return {
|
255
|
-
stackedDatasets:
|
256
|
-
unstackedDatasets:
|
255
|
+
stackedDatasets: O.filter(Ye),
|
256
|
+
unstackedDatasets: O.filter(Ue)
|
257
257
|
};
|
258
|
-
}, [h,
|
259
|
-
|
260
|
-
},
|
261
|
-
const
|
262
|
-
|
263
|
-
time_period:
|
258
|
+
}, [h, v, C]), ee = (S, O) => {
|
259
|
+
A(O ?? H), t(_.TRENDS_CLICK_TOGGLE_VIEW);
|
260
|
+
}, ie = (S) => {
|
261
|
+
const O = De(S?.[0], 1), B = S?.[1], L = pe(B, O);
|
262
|
+
u({ start: O, end: B }), t(_.TRENDS_CLICK_TIME_WINDOW, {
|
263
|
+
time_period: L + "M"
|
264
264
|
});
|
265
265
|
}, ce = () => {
|
266
|
-
t(
|
266
|
+
t(_.TRENDS_CLICK_FILTER);
|
267
267
|
}, le = (S) => {
|
268
|
-
|
268
|
+
W(S);
|
269
269
|
}, de = (S) => {
|
270
|
-
|
270
|
+
W(S), t(_.TRENDS_CLICK_LEGEND, { category: m(S) });
|
271
271
|
}, he = (S) => {
|
272
|
-
t(
|
272
|
+
t(_.TRENDS_HOVER_LEGEND, { category: m(S) });
|
273
273
|
}, ue = (S) => {
|
274
|
-
t(
|
274
|
+
t(_.TRENDS_HOVER_AREA, { category: S });
|
275
275
|
}, me = (S) => {
|
276
|
-
t(
|
276
|
+
t(_.TRENDS_HOVER_POINT, { category: S });
|
277
277
|
};
|
278
|
-
return !
|
279
|
-
|
278
|
+
return !l || !p || !D ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ T(
|
279
|
+
Me,
|
280
280
|
{
|
281
|
-
accountOptions:
|
282
|
-
calendarActions: { onRangeChanged:
|
283
|
-
dateRange:
|
281
|
+
accountOptions: a,
|
282
|
+
calendarActions: { onRangeChanged: ie },
|
283
|
+
dateRange: C,
|
284
284
|
dateRangeVariant: "timeframebuttons",
|
285
285
|
onAccountsFilterClick: ce,
|
286
286
|
onBackClick: n,
|
287
287
|
sx: o,
|
288
|
-
title:
|
288
|
+
title: w.title,
|
289
289
|
children: [
|
290
|
-
/* @__PURE__ */
|
291
|
-
|
290
|
+
/* @__PURE__ */ T(
|
291
|
+
b,
|
292
292
|
{
|
293
293
|
sx: {
|
294
294
|
// eslint-disable-next-line no-nested-ternary
|
295
|
-
px: s ? 48 :
|
295
|
+
px: s ? 48 : r ? 24 : 12
|
296
296
|
},
|
297
297
|
children: [
|
298
|
-
/* @__PURE__ */
|
299
|
-
|
298
|
+
/* @__PURE__ */ T(
|
299
|
+
b,
|
300
300
|
{
|
301
301
|
flexDirection: "row",
|
302
302
|
justifyContent: "space-between",
|
303
303
|
sx: { pb: d ? 12 : 24, pt: d ? 24 : 48 },
|
304
304
|
children: [
|
305
305
|
/* @__PURE__ */ e(
|
306
|
-
|
306
|
+
We,
|
307
307
|
{
|
308
|
-
selectedCategoryGuid:
|
309
|
-
selectedDateRange:
|
308
|
+
selectedCategoryGuid: v,
|
309
|
+
selectedDateRange: C
|
310
310
|
}
|
311
311
|
),
|
312
|
-
/* @__PURE__ */ e(
|
312
|
+
/* @__PURE__ */ e(Ne, { onTabChange: ee, selectedTab: H })
|
313
313
|
]
|
314
314
|
}
|
315
315
|
),
|
316
|
-
/* @__PURE__ */
|
317
|
-
/* @__PURE__ */ e(
|
318
|
-
/* @__PURE__ */ e(
|
319
|
-
|
316
|
+
/* @__PURE__ */ T(b, { alignItems: "center", flexDirection: "row", width: "100%", children: [
|
317
|
+
/* @__PURE__ */ e(G, { flexGrow: 1, children: v && /* @__PURE__ */ T(ge, { onClick: () => W(""), sx: { p: 0, pr: 5 }, children: [
|
318
|
+
/* @__PURE__ */ e(te, { name: "arrow_back" }),
|
319
|
+
w.all_categories
|
320
320
|
] }) }),
|
321
|
-
/* @__PURE__ */ e(
|
321
|
+
/* @__PURE__ */ e(ge, { onClick: () => E(!0), sx: { px: 5 }, children: `${w.view_transactions} (${g.length})` })
|
322
322
|
] }),
|
323
|
-
/* @__PURE__ */
|
324
|
-
|
325
|
-
|
323
|
+
/* @__PURE__ */ T(G, { children: [
|
324
|
+
H === "Chart" && /* @__PURE__ */ e(
|
325
|
+
Fe,
|
326
326
|
{
|
327
|
-
availableHeight:
|
327
|
+
availableHeight: ae,
|
328
328
|
onClickLegend: de,
|
329
329
|
onHoverArea: ue,
|
330
330
|
onHoverLegend: he,
|
331
331
|
onHoverPoint: me,
|
332
|
-
stackedDatasets:
|
333
|
-
unstackedDatasets:
|
332
|
+
stackedDatasets: j.stackedDatasets,
|
333
|
+
unstackedDatasets: j.unstackedDatasets
|
334
334
|
}
|
335
335
|
),
|
336
|
-
|
337
|
-
|
336
|
+
H === "Table" && /* @__PURE__ */ e(
|
337
|
+
Oe,
|
338
338
|
{
|
339
339
|
monthlyCategoryTotals: h,
|
340
340
|
onClickRow: le,
|
341
|
-
selectedCategory:
|
342
|
-
selectedDateRange:
|
341
|
+
selectedCategory: v,
|
342
|
+
selectedDateRange: C
|
343
343
|
}
|
344
344
|
)
|
345
345
|
] })
|
@@ -347,21 +347,21 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
347
347
|
}
|
348
348
|
),
|
349
349
|
/* @__PURE__ */ e(
|
350
|
-
|
350
|
+
At,
|
351
351
|
{
|
352
|
-
categoryGuid:
|
353
|
-
dateRange:
|
354
|
-
isOpen:
|
355
|
-
onClose: () =>
|
352
|
+
categoryGuid: v,
|
353
|
+
dateRange: C,
|
354
|
+
isOpen: x,
|
355
|
+
onClose: () => E(!1)
|
356
356
|
}
|
357
357
|
)
|
358
358
|
]
|
359
359
|
}
|
360
360
|
);
|
361
|
-
},
|
362
|
-
const n =
|
361
|
+
}, Pn = M(Rt), kt = () => {
|
362
|
+
const n = ke(), { monthlyCategoryTotals: o } = F(), { trends: t } = k(), s = Xe(o);
|
363
363
|
return /* @__PURE__ */ e(
|
364
|
-
|
364
|
+
Te,
|
365
365
|
{
|
366
366
|
baseline: "min",
|
367
367
|
colors: [n.palette.primary.main],
|
@@ -376,37 +376,37 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
376
376
|
valueFormatterString: "0,0"
|
377
377
|
}
|
378
378
|
);
|
379
|
-
},
|
380
|
-
const { visibleAccounts: t } =
|
381
|
-
return
|
379
|
+
}, Ht = M(kt), Nt = ({ onPrimaryCtaClick: n, sx: o }) => {
|
380
|
+
const { visibleAccounts: t } = oe(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: r } = F(), { isInitialized: d } = xe(), { trends: a } = k(), { isCopyLoaded: c, selectedAccounts: h, setSelectedAccounts: m } = P();
|
381
|
+
return i.useEffect(() => {
|
382
382
|
m(t);
|
383
|
-
}, [t]),
|
383
|
+
}, [t]), i.useEffect(() => {
|
384
384
|
d && s(h).finally();
|
385
|
-
}, [d, h]), !
|
386
|
-
|
385
|
+
}, [d, h]), !c || !d ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ e(
|
386
|
+
ot,
|
387
387
|
{
|
388
388
|
onPrimaryCtaClick: n,
|
389
|
-
primaryCtaLabel:
|
390
|
-
subTitle:
|
389
|
+
primaryCtaLabel: a.primary_cta,
|
390
|
+
subTitle: a.sub_title,
|
391
391
|
sx: o,
|
392
|
-
title:
|
393
|
-
children:
|
392
|
+
title: a.mini_title,
|
393
|
+
children: r ? /* @__PURE__ */ e(Ht, {}) : /* @__PURE__ */ e(q, {})
|
394
394
|
}
|
395
395
|
);
|
396
|
-
},
|
396
|
+
}, Kn = M(Nt), Wt = 70, be = ({
|
397
397
|
title: n,
|
398
398
|
totalAmount: o,
|
399
399
|
transactionType: t,
|
400
400
|
percentage: s,
|
401
|
-
secondaryLabel:
|
401
|
+
secondaryLabel: r,
|
402
402
|
shouldDisplayPercentage: d
|
403
403
|
}) => {
|
404
|
-
const { availableWidth:
|
404
|
+
const { availableWidth: a } = qe(), c = i.useRef(null), h = i.useRef(null), m = dt(Number(Math.abs(s)), {
|
405
405
|
style: "percent",
|
406
406
|
minimumIntegerDigits: 1
|
407
|
-
}),
|
408
|
-
return /* @__PURE__ */
|
409
|
-
|
407
|
+
}), g = a === 288 && X(o, "0,0.00").length > 10 ? X(o, "0,0") : X(o, "0,0.00"), C = t === "spending" ? s > 0 : s >= 0, u = t === "spending" ? "error.main" : "success.main", l = t === "spending" ? "success.main" : "text.secondary", p = c?.current, y = h?.current, f = p && y ? p.scrollWidth > y.clientWidth - Wt : !1;
|
408
|
+
return /* @__PURE__ */ T(
|
409
|
+
b,
|
410
410
|
{
|
411
411
|
sx: {
|
412
412
|
border: 1,
|
@@ -418,8 +418,8 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
418
418
|
py: 8
|
419
419
|
},
|
420
420
|
children: [
|
421
|
-
/* @__PURE__ */
|
422
|
-
|
421
|
+
/* @__PURE__ */ T(
|
422
|
+
b,
|
423
423
|
{
|
424
424
|
sx: {
|
425
425
|
alignItems: "center",
|
@@ -427,14 +427,14 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
427
427
|
justifyContent: "space-between"
|
428
428
|
},
|
429
429
|
children: [
|
430
|
-
/* @__PURE__ */ e(
|
431
|
-
d && /* @__PURE__ */
|
432
|
-
|
430
|
+
/* @__PURE__ */ e(U, { color: "text.secondary", variant: "caption", children: n }),
|
431
|
+
d && /* @__PURE__ */ T(b, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
|
432
|
+
C ? /* @__PURE__ */ e(rt, { size: 20, sx: { color: u } }) : /* @__PURE__ */ e(at, { size: 20, sx: { color: l } }),
|
433
433
|
/* @__PURE__ */ e(
|
434
|
-
|
434
|
+
U,
|
435
435
|
{
|
436
436
|
sx: {
|
437
|
-
color:
|
437
|
+
color: C ? u : l,
|
438
438
|
fontWeight: 600
|
439
439
|
},
|
440
440
|
variant: "body2",
|
@@ -445,8 +445,8 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
445
445
|
]
|
446
446
|
}
|
447
447
|
),
|
448
|
-
/* @__PURE__ */
|
449
|
-
|
448
|
+
/* @__PURE__ */ T(
|
449
|
+
b,
|
450
450
|
{
|
451
451
|
ref: h,
|
452
452
|
sx: {
|
@@ -456,19 +456,19 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
456
456
|
},
|
457
457
|
children: [
|
458
458
|
/* @__PURE__ */ e(
|
459
|
-
|
459
|
+
G,
|
460
460
|
{
|
461
|
-
ref:
|
461
|
+
ref: c,
|
462
462
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
463
|
-
children: /* @__PURE__ */ e(
|
463
|
+
children: /* @__PURE__ */ e(we, { children: g })
|
464
464
|
}
|
465
465
|
),
|
466
|
-
d &&
|
467
|
-
|
466
|
+
d && a >= 450 && !f && /* @__PURE__ */ e(
|
467
|
+
U,
|
468
468
|
{
|
469
|
-
color:
|
469
|
+
color: C ? u : l,
|
470
470
|
variant: "caption",
|
471
|
-
children:
|
471
|
+
children: r
|
472
472
|
}
|
473
473
|
)
|
474
474
|
]
|
@@ -477,50 +477,50 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
477
477
|
]
|
478
478
|
}
|
479
479
|
);
|
480
|
-
},
|
481
|
-
const { trends: n } =
|
482
|
-
return /* @__PURE__ */
|
483
|
-
/* @__PURE__ */ e(
|
484
|
-
/* @__PURE__ */
|
485
|
-
/* @__PURE__ */ e(
|
486
|
-
/* @__PURE__ */ e(
|
480
|
+
}, Ot = M(() => {
|
481
|
+
const { trends: n } = k();
|
482
|
+
return /* @__PURE__ */ T(b, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
|
483
|
+
/* @__PURE__ */ e(it, { size: 32 }),
|
484
|
+
/* @__PURE__ */ T(b, { children: [
|
485
|
+
/* @__PURE__ */ e(U, { fontWeight: 600, variant: "body1", children: n.zero_state_content_header }),
|
486
|
+
/* @__PURE__ */ e(U, { color: "text.secondary", variant: "subtitle2", children: n.zero_state_content_description })
|
487
487
|
] })
|
488
488
|
] });
|
489
|
-
}),
|
490
|
-
const { visibleAccounts: o } =
|
491
|
-
start:
|
489
|
+
}), $n = M(({ onCtaClick: n }) => {
|
490
|
+
const { visibleAccounts: o } = oe(), { onEvent: t } = N(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: d } = F(), a = {
|
491
|
+
start: st(/* @__PURE__ */ new Date(), 1),
|
492
492
|
end: /* @__PURE__ */ new Date()
|
493
|
-
}, { trends:
|
494
|
-
|
493
|
+
}, { trends: c } = k(), { selectedAccounts: h, setSelectedAccounts: m, isInitialized: g } = P();
|
494
|
+
i.useEffect(() => {
|
495
495
|
m(o);
|
496
|
-
}, [o]),
|
497
|
-
|
498
|
-
t(
|
496
|
+
}, [o]), i.useEffect(() => {
|
497
|
+
g && r(h, a.start).then(() => {
|
498
|
+
t(_.TRENDS_LOAD_WIDGET, {
|
499
499
|
state: o?.length ? "default" : "zeroState"
|
500
500
|
});
|
501
501
|
});
|
502
|
-
}, [
|
503
|
-
const { spendingData:
|
502
|
+
}, [g, h]);
|
503
|
+
const { spendingData: C, incomeData: u } = i.useMemo(
|
504
504
|
() => ({
|
505
|
-
spendingData:
|
506
|
-
incomeData:
|
505
|
+
spendingData: Ee(s, a),
|
506
|
+
incomeData: Le(s, a)
|
507
507
|
}),
|
508
|
-
[s,
|
509
|
-
), [
|
508
|
+
[s, a]
|
509
|
+
), [l, p] = C, [y, f] = u, w = ye(p.y, l.y), D = ye(f.y, y.y), I = g && !o?.length, x = () => {
|
510
510
|
t(
|
511
|
-
I ?
|
511
|
+
I ? _.TRENDS_CLICK_GET_STARTED : _.TRENDS_CLICK_VIEW_MORE
|
512
512
|
), n();
|
513
513
|
};
|
514
|
-
return !d || !
|
515
|
-
|
514
|
+
return !d || !g ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ e(
|
515
|
+
ht,
|
516
516
|
{
|
517
517
|
className: "mx-trends-microwidget",
|
518
|
-
ctaLabel:
|
519
|
-
onCTAClick:
|
520
|
-
subHeader: I ? void 0 :
|
521
|
-
title:
|
522
|
-
children: I ? /* @__PURE__ */ e(
|
523
|
-
|
518
|
+
ctaLabel: c.micro_primary_cta_label,
|
519
|
+
onCTAClick: x,
|
520
|
+
subHeader: I ? void 0 : c.micro_subheader,
|
521
|
+
title: c.title,
|
522
|
+
children: I ? /* @__PURE__ */ e(Ot, {}) : /* @__PURE__ */ T(
|
523
|
+
b,
|
524
524
|
{
|
525
525
|
sx: {
|
526
526
|
alignItems: "stretch",
|
@@ -529,24 +529,24 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
529
529
|
},
|
530
530
|
children: [
|
531
531
|
/* @__PURE__ */ e(
|
532
|
-
|
532
|
+
be,
|
533
533
|
{
|
534
|
-
percentage:
|
535
|
-
secondaryLabel:
|
536
|
-
shouldDisplayPercentage:
|
537
|
-
title:
|
538
|
-
totalAmount:
|
534
|
+
percentage: w,
|
535
|
+
secondaryLabel: c.micro_secondary_label,
|
536
|
+
shouldDisplayPercentage: p.y !== 0 && l.y !== 0,
|
537
|
+
title: c.spending_label,
|
538
|
+
totalAmount: p.y,
|
539
539
|
transactionType: "spending"
|
540
540
|
}
|
541
541
|
),
|
542
542
|
/* @__PURE__ */ e(
|
543
|
-
|
543
|
+
be,
|
544
544
|
{
|
545
|
-
percentage:
|
546
|
-
secondaryLabel:
|
547
|
-
shouldDisplayPercentage:
|
548
|
-
title:
|
549
|
-
totalAmount:
|
545
|
+
percentage: D,
|
546
|
+
secondaryLabel: c.micro_secondary_label,
|
547
|
+
shouldDisplayPercentage: f.y !== 0 && y.y !== 0,
|
548
|
+
title: c.income_label,
|
549
|
+
totalAmount: f.y,
|
550
550
|
transactionType: "income"
|
551
551
|
}
|
552
552
|
)
|
@@ -555,17 +555,17 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
555
555
|
)
|
556
556
|
}
|
557
557
|
);
|
558
|
-
}),
|
558
|
+
}), Vt = M(
|
559
559
|
({ isExpanded: n, onClick: o }) => {
|
560
|
-
const t =
|
561
|
-
return /* @__PURE__ */ e(
|
562
|
-
|
560
|
+
const t = He();
|
561
|
+
return /* @__PURE__ */ e(gt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(pt, { onClick: o, sx: { justifyContent: "center" }, children: /* @__PURE__ */ T(
|
562
|
+
b,
|
563
563
|
{
|
564
564
|
sx: { color: t.palette.primary.main, flexDirection: "row", alignItems: "center" },
|
565
565
|
children: [
|
566
|
-
/* @__PURE__ */ e(
|
567
|
-
/* @__PURE__ */ e(
|
568
|
-
|
566
|
+
/* @__PURE__ */ e(ft, { children: /* @__PURE__ */ e(Z, { bold: !0, variant: "body2", children: n ? "View less" : "View more" }) }),
|
567
|
+
/* @__PURE__ */ e(Ct, { sx: { color: t.palette.primary.main }, children: n ? /* @__PURE__ */ e(ct, {}) : /* @__PURE__ */ e(
|
568
|
+
lt,
|
569
569
|
{
|
570
570
|
sx: {
|
571
571
|
transition: "transform 0.3s ease-in-out",
|
@@ -577,85 +577,85 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
577
577
|
}
|
578
578
|
) }) });
|
579
579
|
}
|
580
|
-
),
|
580
|
+
), Se = M(
|
581
581
|
({
|
582
582
|
totalAmount: n,
|
583
583
|
guid: o,
|
584
584
|
name: t,
|
585
585
|
transactions: s,
|
586
|
-
onClick:
|
586
|
+
onClick: r,
|
587
587
|
isLastItem: d = !1,
|
588
|
-
showDivider:
|
588
|
+
showDivider: a = !0
|
589
589
|
}) => {
|
590
|
-
const { trends:
|
591
|
-
|
592
|
-
...
|
590
|
+
const { trends: c } = k(), { onEvent: h } = N(), m = `${s.length} ${s.length === 1 ? c.transaction : c.transactions}`, g = () => {
|
591
|
+
r?.(), h(_.TRENDS_CLICK_LIST_ITEM, {
|
592
|
+
...R,
|
593
593
|
listItem: t
|
594
594
|
});
|
595
595
|
};
|
596
|
-
return /* @__PURE__ */
|
596
|
+
return /* @__PURE__ */ T(i.Fragment, { children: [
|
597
597
|
/* @__PURE__ */ e(
|
598
|
-
|
598
|
+
Ie,
|
599
599
|
{
|
600
|
-
leftIcon: o ? /* @__PURE__ */ e(
|
601
|
-
onClick:
|
602
|
-
rightContent:
|
603
|
-
rightIcon:
|
600
|
+
leftIcon: o ? /* @__PURE__ */ e(fe, { categoryGuid: o }) : void 0,
|
601
|
+
onClick: g,
|
602
|
+
rightContent: X(Math.abs(n), "0,0.00"),
|
603
|
+
rightIcon: r ? /* @__PURE__ */ e(Ge, {}) : void 0,
|
604
604
|
subtitle: m,
|
605
605
|
title: t
|
606
606
|
}
|
607
607
|
),
|
608
|
-
|
608
|
+
a && /* @__PURE__ */ e(Tt, { sx: { ml: d ? 24 : 68 } })
|
609
609
|
] }, o);
|
610
610
|
}
|
611
|
-
),
|
611
|
+
), Gt = M(
|
612
612
|
({ availableHeight: n = 0, onCategoryClick: o }) => {
|
613
|
-
const { collapsedCategories: t, visibleCategories: s, setVisibleListLength:
|
614
|
-
|
615
|
-
const
|
616
|
-
|
613
|
+
const { collapsedCategories: t, visibleCategories: s, setVisibleListLength: r } = J(), { isLargeDesktop: d, isDesktop: a } = K(), { trends: c } = k(), { onEvent: h } = N(), [m, g] = i.useState(!1), C = a || d;
|
614
|
+
i.useEffect(() => {
|
615
|
+
const p = Math.floor(n / 64) - 1, y = s.length + t.length;
|
616
|
+
p !== s.length && (r(C ? Math.max(p, 5) : 5), g(p >= y));
|
617
617
|
}, [n]);
|
618
|
-
const
|
619
|
-
|
620
|
-
...
|
618
|
+
const u = () => {
|
619
|
+
g(!m), h(_.TRENDS_CLICK_VIEW_MORE, {
|
620
|
+
...R
|
621
621
|
});
|
622
|
-
},
|
623
|
-
return /* @__PURE__ */ e(
|
624
|
-
/* @__PURE__ */ e(
|
625
|
-
s.map((
|
626
|
-
|
622
|
+
}, l = s.length + (m ? t.length : 0);
|
623
|
+
return /* @__PURE__ */ e(b, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ T(mt, { children: [
|
624
|
+
/* @__PURE__ */ e(b, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(we, { children: c.categories }) }),
|
625
|
+
s.map((p, y) => /* @__PURE__ */ e(
|
626
|
+
Se,
|
627
627
|
{
|
628
|
-
...
|
629
|
-
isLastItem:
|
630
|
-
onClick:
|
628
|
+
...p,
|
629
|
+
isLastItem: y === l - 1,
|
630
|
+
onClick: p.transactions.length > 0 ? () => o(p) : void 0,
|
631
631
|
showDivider: !0
|
632
632
|
},
|
633
|
-
|
633
|
+
p.guid
|
634
634
|
)),
|
635
635
|
/* @__PURE__ */ e(
|
636
|
-
|
636
|
+
ut,
|
637
637
|
{
|
638
638
|
in: m,
|
639
639
|
sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
|
640
|
-
children: t.map((
|
641
|
-
const
|
640
|
+
children: t.map((p, y) => {
|
641
|
+
const f = s.length + y;
|
642
642
|
return /* @__PURE__ */ e(
|
643
|
-
|
643
|
+
Se,
|
644
644
|
{
|
645
|
-
...
|
646
|
-
isLastItem:
|
647
|
-
onClick:
|
645
|
+
...p,
|
646
|
+
isLastItem: f === l - 1,
|
647
|
+
onClick: p.transactions.length > 0 ? () => o(p) : void 0,
|
648
648
|
showDivider: !0
|
649
649
|
},
|
650
|
-
|
650
|
+
p.guid
|
651
651
|
);
|
652
652
|
})
|
653
653
|
}
|
654
654
|
),
|
655
|
-
t.length > 0 && /* @__PURE__ */ e(
|
655
|
+
t.length > 0 && /* @__PURE__ */ e(Vt, { isExpanded: m, onClick: u })
|
656
656
|
] }) });
|
657
657
|
}
|
658
|
-
),
|
658
|
+
), Bt = [
|
659
659
|
"BillAmountNotStandard",
|
660
660
|
"CategorySpendingV2",
|
661
661
|
"CostOfLivingToIncome",
|
@@ -689,46 +689,46 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
689
689
|
"WeeklyNewMerchantsV2",
|
690
690
|
"WeeklyNoSpendDays",
|
691
691
|
"WeeklySmallPurchasesSummary"
|
692
|
-
],
|
693
|
-
const o =
|
694
|
-
|
695
|
-
m &&
|
692
|
+
], zt = ({ onInsightCardClick: n }) => {
|
693
|
+
const o = yt(), { onEvent: t } = N(), { isMobile: s, isDesktop: r, isLargeDesktop: d } = K(), { beatStore: a, endpoint: c, sessionToken: h } = xe(), { isInitialized: m } = P(), [g, C] = i.useState(!1), u = o.palette.mode === "dark", l = r || d, p = l || s ? 1 : 2;
|
694
|
+
i.useEffect(() => {
|
695
|
+
m && a.loadBeats().finally(() => C(!0));
|
696
696
|
}, [m]);
|
697
|
-
const
|
698
|
-
n?.(
|
699
|
-
},
|
700
|
-
return /* @__PURE__ */ e(
|
701
|
-
|
697
|
+
const y = i.useMemo(() => g ? a.getFilteredBeats({ templates: Bt }) : [], [g]), f = () => null, w = (E) => {
|
698
|
+
n?.(E), t(_.TRENDS_CLICK_INSIGHT, R);
|
699
|
+
}, D = l ? 200 : 170, I = l ? 170 : 124, x = y.length > 0 ? D : I;
|
700
|
+
return /* @__PURE__ */ e(_t, { sx: { height: x }, children: /* @__PURE__ */ e(
|
701
|
+
nt,
|
702
702
|
{
|
703
|
-
areBeatsLoading:
|
704
|
-
beats:
|
705
|
-
endpoint:
|
706
|
-
logOutUser:
|
707
|
-
onCardClick:
|
703
|
+
areBeatsLoading: a.isLoading,
|
704
|
+
beats: y,
|
705
|
+
endpoint: c,
|
706
|
+
logOutUser: f,
|
707
|
+
onCardClick: w,
|
708
708
|
showBorder: !0,
|
709
709
|
showCTAColocatedWithText: !1,
|
710
710
|
showCarouselControls: !0,
|
711
|
-
showHeader:
|
711
|
+
showHeader: l,
|
712
712
|
showIcon: !0,
|
713
713
|
showWithMargin: !1,
|
714
714
|
token: h,
|
715
|
-
useDarkMode:
|
715
|
+
useDarkMode: u,
|
716
716
|
userHasFullInsightFeedBeats: !1,
|
717
717
|
variant: "outlined",
|
718
|
-
visibleCardsCount:
|
718
|
+
visibleCardsCount: p
|
719
719
|
}
|
720
720
|
) });
|
721
|
-
},
|
722
|
-
const { onEvent: t } =
|
723
|
-
categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels:
|
724
|
-
} =
|
725
|
-
return /* @__PURE__ */ e(
|
726
|
-
|
721
|
+
}, Ft = M(zt), Pt = M(({ chartLabel: n, chartColor: o }) => {
|
722
|
+
const { onEvent: t } = N(), {
|
723
|
+
categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels: r }
|
724
|
+
} = J();
|
725
|
+
return /* @__PURE__ */ e(b, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
|
726
|
+
Te,
|
727
727
|
{
|
728
728
|
baseline: "min",
|
729
729
|
colors: [o],
|
730
730
|
curveType: "bump",
|
731
|
-
customTooltipLabels:
|
731
|
+
customTooltipLabels: r,
|
732
732
|
datasets: [s],
|
733
733
|
height: 265,
|
734
734
|
labels: [n],
|
@@ -736,7 +736,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
736
736
|
stroke: o
|
737
737
|
}),
|
738
738
|
onItemClick: () => {
|
739
|
-
t(
|
739
|
+
t(_.TRENDS_CLICK_CHART, R);
|
740
740
|
},
|
741
741
|
showArea: !0,
|
742
742
|
showAverage: !0,
|
@@ -751,44 +751,44 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
751
751
|
valueFormatterString: "0,0"
|
752
752
|
}
|
753
753
|
) });
|
754
|
-
}),
|
755
|
-
const o =
|
754
|
+
}), Kt = M(({ onClose: n }) => {
|
755
|
+
const o = He(), { onEvent: t } = N(), { common: s, trends: r } = k(), { selectedCategoryData: d, selectedDateRangeMonthRange: a } = J(), { sortedTransactions: c } = ne(), [h, m] = i.useState(null);
|
756
756
|
if (!d)
|
757
757
|
return null;
|
758
|
-
const { guid:
|
759
|
-
() =>
|
760
|
-
[h,
|
761
|
-
), I = (
|
762
|
-
n?.(), t(
|
758
|
+
const { guid: g, name: C, is_income: u, totalAmount: l } = d, p = u ? r.category_income : r.category_spending, y = St(g, o), f = u ? r.income_label : r.spending_label, w = ` ${d.transactions.length === 1 ? r.transaction : r.transactions} (${d.transactions.length})`, D = i.useMemo(
|
759
|
+
() => c.find((E) => E.guid === h),
|
760
|
+
[h, c]
|
761
|
+
), I = (E) => E.category_guid === g || E.top_level_category_guid === g, x = () => {
|
762
|
+
n?.(), t(_.TRENDS_CLICK_BACK, R);
|
763
763
|
};
|
764
|
-
return /* @__PURE__ */
|
765
|
-
|
764
|
+
return /* @__PURE__ */ T(
|
765
|
+
Ce,
|
766
766
|
{
|
767
|
-
ariaLabelClose:
|
767
|
+
ariaLabelClose: r.close_category_details,
|
768
768
|
isOpen: !0,
|
769
|
-
onClose:
|
769
|
+
onClose: x,
|
770
770
|
shouldShowHeaderShadow: !0,
|
771
|
-
title:
|
771
|
+
title: p,
|
772
772
|
children: [
|
773
|
-
/* @__PURE__ */
|
774
|
-
/* @__PURE__ */
|
773
|
+
/* @__PURE__ */ T(b, { sx: { alignItems: "center", height: "100%" }, children: [
|
774
|
+
/* @__PURE__ */ T(bt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
|
775
775
|
/* @__PURE__ */ e(
|
776
|
-
|
776
|
+
Ie,
|
777
777
|
{
|
778
|
-
leftIcon: /* @__PURE__ */ e(
|
779
|
-
rightContent:
|
780
|
-
subtitle:
|
781
|
-
title:
|
778
|
+
leftIcon: /* @__PURE__ */ e(fe, { categoryGuid: g }),
|
779
|
+
rightContent: X(Math.abs(l), "0,0.00"),
|
780
|
+
subtitle: a,
|
781
|
+
title: C
|
782
782
|
}
|
783
783
|
),
|
784
|
-
/* @__PURE__ */ e(
|
785
|
-
/* @__PURE__ */
|
786
|
-
/* @__PURE__ */ e(
|
787
|
-
/* @__PURE__ */ e(
|
784
|
+
/* @__PURE__ */ e(Pt, { chartColor: y, chartLabel: f }),
|
785
|
+
/* @__PURE__ */ T(b, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
|
786
|
+
/* @__PURE__ */ e(Z, { bold: !0, variant: "body1", children: w }),
|
787
|
+
/* @__PURE__ */ e(wt, { filter: I })
|
788
788
|
] })
|
789
789
|
] }),
|
790
790
|
/* @__PURE__ */ e(
|
791
|
-
|
791
|
+
Re,
|
792
792
|
{
|
793
793
|
filter: I,
|
794
794
|
height: "calc(100vh - 475px)",
|
@@ -797,53 +797,53 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
797
797
|
)
|
798
798
|
] }),
|
799
799
|
/* @__PURE__ */ e(
|
800
|
-
|
800
|
+
Ce,
|
801
801
|
{
|
802
802
|
ariaLabelClose: s.close_aria,
|
803
|
-
isOpen: !!
|
803
|
+
isOpen: !!D,
|
804
804
|
onClose: () => m(""),
|
805
|
-
title:
|
806
|
-
children:
|
805
|
+
title: r.transaction,
|
806
|
+
children: D && /* @__PURE__ */ e(Ae, { transaction: D })
|
807
807
|
}
|
808
808
|
)
|
809
809
|
]
|
810
810
|
}
|
811
811
|
);
|
812
|
-
}),
|
813
|
-
const t =
|
814
|
-
return [t, s].filter((
|
815
|
-
},
|
816
|
-
const [t, s] = n,
|
817
|
-
if (
|
818
|
-
const
|
819
|
-
|
812
|
+
}), $t = (n, o) => {
|
813
|
+
const t = Le(n, o), s = Ee(n, o);
|
814
|
+
return [t, s].filter((r) => r.length > 0);
|
815
|
+
}, jt = (n, o) => {
|
816
|
+
const [t, s] = n, r = t, d = s ?? t, a = [];
|
817
|
+
if (r) {
|
818
|
+
const c = r.reduce((h, m) => h + m.y, 0);
|
819
|
+
a.push({ label: o.income_label, amount: c });
|
820
820
|
}
|
821
821
|
if (d) {
|
822
|
-
const
|
823
|
-
|
822
|
+
const c = d.reduce((h, m) => h + m.y, 0);
|
823
|
+
a.push({ label: o.spending_label, amount: c });
|
824
824
|
}
|
825
|
-
return
|
826
|
-
},
|
825
|
+
return a;
|
826
|
+
}, Yt = ({
|
827
827
|
availableHeight: n = 0,
|
828
828
|
minHeight: o = 500,
|
829
829
|
selectedDateRange: t,
|
830
830
|
totals: s
|
831
831
|
}) => {
|
832
|
-
const
|
833
|
-
return
|
834
|
-
const
|
835
|
-
|
832
|
+
const r = ke(), { onEvent: d } = N(), { trends: a } = k(), { isSmallMobile: c, isMobile: h, isSmallTablet: m, isTablet: g } = K(), C = [r.palette.chart?.chart1, r.palette.chart?.chart2], u = $t(s, t), l = jt(u, a), [p, y] = i.useState(0), f = 458, w = 195, D = 56, I = h || c ? w : m || g ? f : p;
|
833
|
+
return i.useEffect(() => {
|
834
|
+
const E = Math.max(n - D, o);
|
835
|
+
y(E);
|
836
836
|
}, [n]), /* @__PURE__ */ e(
|
837
|
-
|
837
|
+
Te,
|
838
838
|
{
|
839
839
|
baseline: "min",
|
840
|
-
colors:
|
840
|
+
colors: C,
|
841
841
|
curveType: "bump",
|
842
|
-
datasets:
|
842
|
+
datasets: u,
|
843
843
|
height: I,
|
844
|
-
labels:
|
844
|
+
labels: l,
|
845
845
|
onItemClick: () => {
|
846
|
-
d(
|
846
|
+
d(_.TRENDS_CLICK_CHART, R);
|
847
847
|
},
|
848
848
|
showArea: !0,
|
849
849
|
showAxisHighlight: !0,
|
@@ -856,156 +856,152 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
856
856
|
valueFormatterString: "0,0"
|
857
857
|
}
|
858
858
|
);
|
859
|
-
},
|
860
|
-
const { onEvent: s } =
|
861
|
-
|
862
|
-
|
863
|
-
monthlyCategoryTotals: u,
|
864
|
-
monthlyTotalsLoaded: p
|
865
|
-
} = F(), { setFilter: b } = re(), { selectedDateRange: r, setSelectedCategoryData: g, setSelectedDateRange: T } = q(), {
|
866
|
-
isCopyLoaded: C,
|
867
|
-
isInitialized: E,
|
859
|
+
}, Ut = M(Yt), Xt = ({ onBackClick: n, onInsightCardClick: o, sx: t }) => {
|
860
|
+
const { onEvent: s } = N(), { isLargeDesktop: r, isDesktop: d, isMobile: a } = K(), { visibleAccounts: c } = oe(), { loadDateRangeCategoryTotals: h, loadMonthlyCategoryTotals: m, monthlyCategoryTotals: g } = F(), { setFilter: C } = ne(), { selectedDateRange: u, setSelectedCategoryData: l, setSelectedDateRange: p } = J(), {
|
861
|
+
isCopyLoaded: y,
|
862
|
+
isInitialized: f,
|
868
863
|
selectedAccounts: w,
|
869
|
-
selectedAccountGuids:
|
870
|
-
setSelectedAccounts:
|
871
|
-
} = P(), { trends:
|
872
|
-
|
873
|
-
const
|
874
|
-
return window.addEventListener("resize",
|
875
|
-
}, []),
|
876
|
-
|
877
|
-
}, [
|
878
|
-
|
864
|
+
selectedAccountGuids: D,
|
865
|
+
setSelectedAccounts: I
|
866
|
+
} = P(), { trends: x } = k(), E = Pe(), H = d || r, [A, v] = i.useState(!1), [W, se] = i.useState("Chart"), [$, re] = i.useState(""), [ae, j] = i.useState(!1), [ee, ie] = i.useState(window.innerHeight), ce = ee - 208, le = ee - (E ? 494 : 266);
|
867
|
+
i.useEffect(() => {
|
868
|
+
const L = () => ie(window.innerHeight);
|
869
|
+
return window.addEventListener("resize", L), () => window.removeEventListener("resize", L);
|
870
|
+
}, []), i.useEffect(() => {
|
871
|
+
I(c);
|
872
|
+
}, [c]), i.useEffect(() => {
|
873
|
+
f && h(w, u.start, u.end).then(() => {
|
879
874
|
m(
|
880
875
|
w,
|
881
|
-
|
882
|
-
|
876
|
+
u.start,
|
877
|
+
u.end
|
883
878
|
);
|
884
879
|
}).finally(() => {
|
885
|
-
|
886
|
-
...
|
887
|
-
time_period: `${
|
880
|
+
v(!0), s(_.TRENDS_LOAD_WIDGET, {
|
881
|
+
...R,
|
882
|
+
time_period: `${pe(u.end, u.start)}M`
|
888
883
|
});
|
889
884
|
});
|
890
|
-
}, [
|
891
|
-
if (
|
892
|
-
const
|
893
|
-
accounts:
|
894
|
-
dateRange: { start:
|
885
|
+
}, [f, w, u]), i.useEffect(() => {
|
886
|
+
if (g.length !== 0) {
|
887
|
+
const L = {
|
888
|
+
accounts: D,
|
889
|
+
dateRange: { start: u.start, end: u.end }
|
895
890
|
};
|
896
|
-
|
897
|
-
...
|
898
|
-
custom: (
|
899
|
-
(
|
891
|
+
C({
|
892
|
+
...L,
|
893
|
+
custom: (V) => !!g.find(
|
894
|
+
(Y) => Y.top_level_category_guid === V.top_level_category_guid || Y.category_guid === V.category_guid
|
900
895
|
)
|
901
896
|
});
|
902
897
|
}
|
903
|
-
}, [
|
904
|
-
const
|
905
|
-
|
906
|
-
},
|
907
|
-
|
908
|
-
},
|
909
|
-
|
910
|
-
...
|
911
|
-
toggleView:
|
898
|
+
}, [g]);
|
899
|
+
const de = (L) => {
|
900
|
+
l(L), j(!0);
|
901
|
+
}, he = () => {
|
902
|
+
l(null), j(!1);
|
903
|
+
}, ue = (L, V) => {
|
904
|
+
se(V ?? W), s(_.TRENDS_CLICK_TOGGLE_VIEW, {
|
905
|
+
...R,
|
906
|
+
toggleView: V
|
912
907
|
});
|
913
|
-
},
|
914
|
-
const
|
915
|
-
|
916
|
-
...
|
917
|
-
time_period:
|
908
|
+
}, me = (L) => {
|
909
|
+
const V = De(L?.[0], 1), Y = L?.[1], Ve = pe(Y, V);
|
910
|
+
p({ start: V, end: Y }), s(_.TRENDS_CLICK_TIME_WINDOW, {
|
911
|
+
...R,
|
912
|
+
time_period: Ve + "M"
|
918
913
|
});
|
919
|
-
},
|
920
|
-
s(
|
921
|
-
...
|
922
|
-
filterValue:
|
914
|
+
}, S = (L) => {
|
915
|
+
s(_.TRENDS_CLICK_FILTER, {
|
916
|
+
...R,
|
917
|
+
filterValue: L
|
923
918
|
});
|
924
|
-
},
|
925
|
-
|
926
|
-
},
|
927
|
-
|
919
|
+
}, O = (L) => {
|
920
|
+
re(L);
|
921
|
+
}, B = () => {
|
922
|
+
re(""), s(_.TRENDS_CLICK_ALL_CATEGORIES, R);
|
928
923
|
};
|
929
|
-
return !
|
930
|
-
|
924
|
+
return !y || !A ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ T(
|
925
|
+
Me,
|
931
926
|
{
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
subText: D.empty_state_sub_text
|
938
|
-
}
|
939
|
-
) : /* @__PURE__ */ f(
|
940
|
-
Ae,
|
941
|
-
{
|
942
|
-
accountOptions: l,
|
943
|
-
calendarActions: { onRangeChanged: S },
|
944
|
-
dateRange: r,
|
945
|
-
dateRangeVariant: i ? "timeframetabs" : "timeframebuttons",
|
946
|
-
onAccountsFilterClick: W,
|
927
|
+
accountOptions: c,
|
928
|
+
calendarActions: { onRangeChanged: me },
|
929
|
+
dateRange: u,
|
930
|
+
dateRangeVariant: a ? "timeframetabs" : "timeframebuttons",
|
931
|
+
onAccountsFilterClick: S,
|
947
932
|
onBackClick: n,
|
948
933
|
sx: t,
|
949
|
-
title:
|
934
|
+
title: x.title,
|
950
935
|
children: [
|
951
|
-
/* @__PURE__ */
|
952
|
-
|
936
|
+
/* @__PURE__ */ T(
|
937
|
+
b,
|
953
938
|
{
|
954
939
|
sx: {
|
955
|
-
px:
|
940
|
+
px: a ? 0 : 48
|
956
941
|
},
|
957
942
|
children: [
|
958
|
-
/* @__PURE__ */
|
959
|
-
|
943
|
+
/* @__PURE__ */ T(
|
944
|
+
b,
|
960
945
|
{
|
961
946
|
flexDirection: "row",
|
962
947
|
justifyContent: "space-between",
|
963
|
-
sx: { pb:
|
948
|
+
sx: { pb: a ? 12 : 24, pt: a ? 24 : 48 },
|
964
949
|
children: [
|
965
950
|
/* @__PURE__ */ e(
|
966
|
-
|
951
|
+
We,
|
967
952
|
{
|
968
|
-
selectedCategoryGuid:
|
969
|
-
selectedDateRange:
|
953
|
+
selectedCategoryGuid: $,
|
954
|
+
selectedDateRange: u
|
970
955
|
}
|
971
956
|
),
|
972
|
-
/* @__PURE__ */ e(
|
957
|
+
/* @__PURE__ */ e(Ne, { onTabChange: ue, selectedTab: W })
|
973
958
|
]
|
974
959
|
}
|
975
960
|
),
|
976
|
-
|
977
|
-
|
978
|
-
|
961
|
+
A && c.length === 0 && /* @__PURE__ */ e(
|
962
|
+
Dt,
|
963
|
+
{
|
964
|
+
header: "",
|
965
|
+
icon: "",
|
966
|
+
onClick: () => {
|
967
|
+
},
|
968
|
+
primaryButton: x.empty_state_primary,
|
969
|
+
subText: x.empty_state_sub_text
|
970
|
+
}
|
971
|
+
),
|
972
|
+
/* @__PURE__ */ e(b, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(G, { flexGrow: 1, children: $ && /* @__PURE__ */ T(ge, { onClick: B, sx: { p: 0, pr: 5 }, children: [
|
973
|
+
/* @__PURE__ */ e(te, { name: "arrow_back" }),
|
974
|
+
x.all_categories
|
979
975
|
] }) }) }),
|
980
|
-
/* @__PURE__ */
|
981
|
-
/* @__PURE__ */
|
982
|
-
|
983
|
-
|
976
|
+
/* @__PURE__ */ T(b, { flexDirection: H ? "row" : "column", gap: H ? 48 : 16, children: [
|
977
|
+
/* @__PURE__ */ T(G, { sx: { width: H ? "68%" : "100%" }, children: [
|
978
|
+
W === "Chart" && /* @__PURE__ */ e(
|
979
|
+
Ut,
|
984
980
|
{
|
985
|
-
availableHeight:
|
981
|
+
availableHeight: ce,
|
986
982
|
minHeight: 450,
|
987
|
-
selectedDateRange:
|
988
|
-
totals:
|
983
|
+
selectedDateRange: u,
|
984
|
+
totals: g
|
989
985
|
}
|
990
986
|
),
|
991
|
-
|
992
|
-
|
987
|
+
W === "Table" && /* @__PURE__ */ e(
|
988
|
+
Oe,
|
993
989
|
{
|
994
990
|
height: "unset",
|
995
|
-
monthlyCategoryTotals:
|
996
|
-
onClickRow:
|
997
|
-
selectedCategory:
|
998
|
-
selectedDateRange:
|
991
|
+
monthlyCategoryTotals: g,
|
992
|
+
onClickRow: O,
|
993
|
+
selectedCategory: $,
|
994
|
+
selectedDateRange: u
|
999
995
|
}
|
1000
996
|
)
|
1001
997
|
] }),
|
1002
|
-
/* @__PURE__ */
|
1003
|
-
|
998
|
+
W === "Chart" && /* @__PURE__ */ T(b, { gap: 16, sx: { width: H ? "32%" : "100%" }, children: [
|
999
|
+
E && /* @__PURE__ */ e(Ft, { onInsightCardClick: o }),
|
1004
1000
|
/* @__PURE__ */ e(
|
1005
|
-
|
1001
|
+
Gt,
|
1006
1002
|
{
|
1007
|
-
availableHeight:
|
1008
|
-
onCategoryClick:
|
1003
|
+
availableHeight: le,
|
1004
|
+
onCategoryClick: de
|
1009
1005
|
}
|
1010
1006
|
)
|
1011
1007
|
] })
|
@@ -1013,15 +1009,15 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
1013
1009
|
]
|
1014
1010
|
}
|
1015
1011
|
),
|
1016
|
-
|
1012
|
+
ae && /* @__PURE__ */ e(Kt, { onClose: he })
|
1017
1013
|
]
|
1018
1014
|
}
|
1019
1015
|
);
|
1020
|
-
},
|
1016
|
+
}, jn = M(Xt);
|
1021
1017
|
export {
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1018
|
+
Pn as TrendsFullWidget,
|
1019
|
+
$n as TrendsMicroWidget,
|
1020
|
+
Kn as TrendsMiniWidget,
|
1021
|
+
Xn as TrendsStore,
|
1022
|
+
jn as TrendsWidget
|
1027
1023
|
};
|