@mx-cartographer/experiences 7.0.58-alpha.mm5 → 7.0.58-alpha.mm7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/trends/index.es.js +268 -266
- package/package.json +1 -1
package/dist/trends/index.es.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { jsx as e, jsxs as C, Fragment as
|
|
1
|
+
import { jsx as e, jsxs as C, Fragment as Je } from "react/jsx-runtime";
|
|
2
2
|
import i from "react";
|
|
3
3
|
import { observer as v } from "mobx-react-lite";
|
|
4
|
-
import { Icon as ae, Text as Q, CategoryIcon as fe, P as X, H3 as xe, ChevronRightIcon as
|
|
4
|
+
import { Icon as ae, Text as Q, CategoryIcon as fe, P as X, H3 as xe, ChevronRightIcon as et } from "@mxenabled/mxui";
|
|
5
5
|
import W from "@mui/material/Box";
|
|
6
|
-
import
|
|
6
|
+
import b from "@mui/material/Stack";
|
|
7
7
|
import me from "@mui/material/Button";
|
|
8
8
|
import { addSeconds as ve } from "date-fns/addSeconds";
|
|
9
9
|
import { differenceInCalendarMonths as pe } from "date-fns/differenceInCalendarMonths";
|
|
10
|
-
import { a as
|
|
10
|
+
import { a as tt, g as nt, S as ot, L as Me } from "../TrendsStore-BKBnNQba.mjs";
|
|
11
11
|
import { T as mo } from "../TrendsStore-BKBnNQba.mjs";
|
|
12
|
-
import { i as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { u as R, m as K, g as
|
|
12
|
+
import { i as st, c as rt, d as at, e as it, f as ct, h as lt, b as Ae, g as Re, j as De } from "../SpendingData-D5vsfYKo.mjs";
|
|
13
|
+
import dt from "@mui/material/ToggleButton";
|
|
14
|
+
import ht from "@mui/material/ToggleButtonGroup";
|
|
15
|
+
import { u as R, m as K, g as N, b as ee, h as ie, d as ce, v as te, f as Te, p as ut, a as ke } from "../hooks-CE2TKk4a.mjs";
|
|
16
16
|
import { u as $ } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
17
17
|
import { f as q, D as z } from "../Dialog-CWW597AF.mjs";
|
|
18
18
|
import { DataGridPro as gt } from "@mui/x-data-grid-pro";
|
|
19
19
|
import { C as mt } from "../CurrencyText-YUhH2caW.mjs";
|
|
20
|
-
import { c as
|
|
20
|
+
import { c as Ne } from "../Category-CevNQ03n.mjs";
|
|
21
21
|
import { b as pt } from "../Localization-2MODESHW.mjs";
|
|
22
22
|
import { H as Ie } from "../HeaderCell-DjuifqHJ.mjs";
|
|
23
23
|
import { T as A, b as Ct } from "../ViewMoreMicroCard-BAz2NyEO.mjs";
|
|
24
|
-
import { A as y, W as
|
|
25
|
-
import { a as
|
|
24
|
+
import { A as y, W as He } from "../WidgetContainer-B8MRJ5Y1.mjs";
|
|
25
|
+
import { a as We, T as Oe } from "../TransactionDetails-DAp_CPCP.mjs";
|
|
26
26
|
import { D as Ce } from "../Drawer-kEE73B87.mjs";
|
|
27
27
|
import { L as J } from "../Loader-DUaFpDGv.mjs";
|
|
28
|
-
import { useTheme as
|
|
28
|
+
import { useTheme as Ve } from "@mui/material/styles";
|
|
29
29
|
import { L as ye } from "../LineChart-B2Y7zwMu.mjs";
|
|
30
30
|
import { M as ft } from "../MiniWidgetContainer-DTQdRK-3.mjs";
|
|
31
31
|
import { subMonths as Tt } from "date-fns";
|
|
@@ -38,7 +38,7 @@ import xt from "@mui/material/ListItem";
|
|
|
38
38
|
import vt from "@mui/material/ListItemButton";
|
|
39
39
|
import Mt from "@mui/material/ListItemIcon";
|
|
40
40
|
import At from "@mui/material/ListItemText";
|
|
41
|
-
import
|
|
41
|
+
import Ge from "@mui/material/styles/useTheme";
|
|
42
42
|
import Rt from "@mui/material/Divider";
|
|
43
43
|
import { useTheme as kt, Stack as Nt } from "@mui/material";
|
|
44
44
|
import Ht from "@mui/material/Paper";
|
|
@@ -47,25 +47,25 @@ import { E as Ot } from "../ExportCsvAction-CBJAfyAw.mjs";
|
|
|
47
47
|
import { u as Vt } from "../useInsightsEnabled-DSnpkUq0.mjs";
|
|
48
48
|
import { E as Gt } from "../EmptyState-w2yYDuKG.mjs";
|
|
49
49
|
import { k as Bt } from "../ConnectDrawer-DJA_S-rX.mjs";
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const Be = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
51
|
+
ht,
|
|
52
52
|
{
|
|
53
53
|
exclusive: !0,
|
|
54
54
|
onChange: o,
|
|
55
55
|
orientation: "horizontal",
|
|
56
56
|
value: t,
|
|
57
|
-
children: ["Chart", "Table"].map((n) => /* @__PURE__ */ e(
|
|
57
|
+
children: ["Chart", "Table"].map((n) => /* @__PURE__ */ e(dt, { color: "primary", sx: { width: 56 }, value: n, children: n === "Chart" ? /* @__PURE__ */ e(ae, { name: "table_chart_view" }) : /* @__PURE__ */ e(ae, { name: "format_list_bulleted" }) }, n))
|
|
58
58
|
}
|
|
59
|
-
),
|
|
60
|
-
const { trends: n } = R(), { isMobile: s, isDesktop: a } = $(), { getCategoryName:
|
|
61
|
-
const
|
|
59
|
+
), ze = ({ selectedDateRange: t, selectedCategoryGuid: o }) => {
|
|
60
|
+
const { trends: n } = R(), { isMobile: s, isDesktop: a } = $(), { getCategoryName: d } = K(), h = i.useMemo(() => {
|
|
61
|
+
const l = q(
|
|
62
62
|
t.start,
|
|
63
63
|
s ? z.MONTH_SHORT_YEAR : z.MONTH_YEAR
|
|
64
|
-
),
|
|
64
|
+
), c = q(
|
|
65
65
|
t.end,
|
|
66
66
|
s ? z.MONTH_SHORT_YEAR : z.MONTH_YEAR
|
|
67
67
|
);
|
|
68
|
-
return `${
|
|
68
|
+
return `${l} - ${c}`;
|
|
69
69
|
}, [t, s]);
|
|
70
70
|
return /* @__PURE__ */ C(W, { sx: { mr: 10, minWidth: "60%" }, children: [
|
|
71
71
|
/* @__PURE__ */ e(
|
|
@@ -79,17 +79,17 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
79
79
|
textOverflow: "unset"
|
|
80
80
|
},
|
|
81
81
|
variant: a ? "H3" : "Body",
|
|
82
|
-
children:
|
|
82
|
+
children: d(o) || n.sub_title
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
|
-
/* @__PURE__ */ e(Q, { variant: a ? "Body" : "Small", children:
|
|
85
|
+
/* @__PURE__ */ e(Q, { variant: a ? "Body" : "Small", children: h })
|
|
86
86
|
] });
|
|
87
87
|
}, zt = (t) => {
|
|
88
88
|
const o = t.row[t.field];
|
|
89
|
-
return /* @__PURE__ */ e(
|
|
89
|
+
return /* @__PURE__ */ e(b, { alignItems: "flex-end", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(mt, { amount: o, variant: "Small" }) });
|
|
90
90
|
}, Pt = ({ categoryGuid: t, topLevelCategoryGuid: o }) => {
|
|
91
|
-
const { categories: n } = R(), s = n.default_categories[t]?.replace(/&/g, "&") ??
|
|
92
|
-
return /* @__PURE__ */ C(
|
|
91
|
+
const { categories: n } = R(), s = n.default_categories[t]?.replace(/&/g, "&") ?? Ne[t];
|
|
92
|
+
return /* @__PURE__ */ C(b, { alignItems: "center", direction: "row", justifyContent: "center", children: [
|
|
93
93
|
/* @__PURE__ */ e(
|
|
94
94
|
W,
|
|
95
95
|
{
|
|
@@ -100,7 +100,7 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
100
100
|
),
|
|
101
101
|
/* @__PURE__ */ e(Q, { sx: { ml: 12, pb: 6 }, variant: "Small", children: s })
|
|
102
102
|
] });
|
|
103
|
-
}, Ft = (t) => /* @__PURE__ */ e(
|
|
103
|
+
}, Ft = (t) => /* @__PURE__ */ e(b, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
|
|
104
104
|
Pt,
|
|
105
105
|
{
|
|
106
106
|
categoryGuid: t.row.category,
|
|
@@ -113,17 +113,17 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
113
113
|
n.push(a), s.setMonth(s.getMonth() + 1);
|
|
114
114
|
}
|
|
115
115
|
return n;
|
|
116
|
-
},
|
|
116
|
+
}, Pe = ({
|
|
117
117
|
monthlyCategoryTotals: t,
|
|
118
118
|
selectedDateRange: o,
|
|
119
119
|
selectedCategory: n,
|
|
120
120
|
onClickRow: s,
|
|
121
121
|
height: a = "100dvh",
|
|
122
|
-
sx:
|
|
122
|
+
sx: d = {}
|
|
123
123
|
}) => {
|
|
124
|
-
const { onEvent:
|
|
125
|
-
{ field:
|
|
126
|
-
]), f = i.useMemo(() => Kt(o.start, o.end), [o]),
|
|
124
|
+
const { onEvent: h } = N(), l = q(/* @__PURE__ */ new Date(), z.MONTH_SHORT), [c, m] = i.useState([
|
|
125
|
+
{ field: l, sort: "desc" }
|
|
126
|
+
]), f = i.useMemo(() => Kt(o.start, o.end), [o]), u = [
|
|
127
127
|
{
|
|
128
128
|
field: "category",
|
|
129
129
|
flex: 1,
|
|
@@ -147,50 +147,50 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
147
147
|
sortable: !0,
|
|
148
148
|
hideSortIcons: !1,
|
|
149
149
|
type: "number",
|
|
150
|
-
sortComparator:
|
|
150
|
+
sortComparator: tt
|
|
151
151
|
})
|
|
152
152
|
)
|
|
153
|
-
],
|
|
153
|
+
], T = i.useMemo(() => {
|
|
154
154
|
const r = t.filter(
|
|
155
|
-
(p) => !
|
|
156
|
-
),
|
|
155
|
+
(p) => !st(p) && !rt(p)
|
|
156
|
+
), _ = (n ? r.filter(
|
|
157
157
|
(p) => p.category_guid === n || p.top_level_category_guid === n
|
|
158
158
|
) : r).reduce(
|
|
159
|
-
(p,
|
|
160
|
-
const { category_guid: w, top_level_category_guid:
|
|
159
|
+
(p, I) => {
|
|
160
|
+
const { category_guid: w, top_level_category_guid: E, month: k, total: D, year: O } = I, M = n ? w : E;
|
|
161
161
|
p[M] || (p[M] = {
|
|
162
162
|
id: M,
|
|
163
163
|
category: M,
|
|
164
164
|
category_guid: w,
|
|
165
|
-
top_level_category_guid:
|
|
165
|
+
top_level_category_guid: E
|
|
166
166
|
});
|
|
167
|
-
const L = q(new Date(O,
|
|
168
|
-
return p[M][L] || (p[M][L] = 0), p[M][L] = p[M][L] + Math.abs(
|
|
167
|
+
const L = q(new Date(O, k - 1), z.MONTH_SHORT);
|
|
168
|
+
return p[M][L] || (p[M][L] = 0), p[M][L] = p[M][L] + Math.abs(D), p;
|
|
169
169
|
},
|
|
170
170
|
{}
|
|
171
171
|
);
|
|
172
|
-
return Object.values(
|
|
172
|
+
return Object.values(_);
|
|
173
173
|
}, [t, n]);
|
|
174
|
-
return /* @__PURE__ */ e(W, { sx: { height: a, width: "100%", overflowX: "auto", boxShadow: "none", ...
|
|
174
|
+
return /* @__PURE__ */ e(W, { sx: { height: a, width: "100%", overflowX: "auto", boxShadow: "none", ...d }, children: /* @__PURE__ */ e(
|
|
175
175
|
gt,
|
|
176
176
|
{
|
|
177
|
-
columns:
|
|
177
|
+
columns: u,
|
|
178
178
|
disableColumnFilter: !0,
|
|
179
179
|
disableColumnMenu: !0,
|
|
180
180
|
hideFooter: !0,
|
|
181
|
-
initialState: { sorting: { sortModel:
|
|
181
|
+
initialState: { sorting: { sortModel: c } },
|
|
182
182
|
onRowClick: (r) => {
|
|
183
|
-
s?.(r.row.category),
|
|
183
|
+
s?.(r.row.category), h(y.TRENDS_CLICK_LIST_ITEM, {
|
|
184
184
|
...A,
|
|
185
|
-
listItem:
|
|
185
|
+
listItem: Ne[r.row.category]
|
|
186
186
|
});
|
|
187
187
|
},
|
|
188
188
|
onSortModelChange: (r) => {
|
|
189
|
-
m(r),
|
|
189
|
+
m(r), h(y.TRENDS_CLICK_TABLE_SORT, A);
|
|
190
190
|
},
|
|
191
|
-
rows:
|
|
191
|
+
rows: T,
|
|
192
192
|
slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
|
|
193
|
-
sortModel:
|
|
193
|
+
sortModel: c,
|
|
194
194
|
sortingOrder: ["asc", "desc"]
|
|
195
195
|
}
|
|
196
196
|
) });
|
|
@@ -202,68 +202,68 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
202
202
|
isOpen: n,
|
|
203
203
|
onClose: s
|
|
204
204
|
}) => {
|
|
205
|
-
const { onEvent: a } =
|
|
206
|
-
() =>
|
|
207
|
-
[m,
|
|
205
|
+
const { onEvent: a } = N(), { selectedAccountGuids: d } = ee(), { common: h } = R(), { setFilter: l, sortedTransactions: c } = ie(), [m, f] = i.useState(""), u = i.useMemo(
|
|
206
|
+
() => c.find((r) => r.guid === m),
|
|
207
|
+
[m, c]
|
|
208
208
|
);
|
|
209
209
|
i.useEffect(() => {
|
|
210
|
-
|
|
211
|
-
accounts:
|
|
210
|
+
l({
|
|
211
|
+
accounts: d,
|
|
212
212
|
dateRange: o,
|
|
213
213
|
custom: (r) => t === "" || t === r.category_guid || t === r.top_level_category_guid,
|
|
214
214
|
showSplits: !!t
|
|
215
215
|
});
|
|
216
|
-
}, [
|
|
217
|
-
const
|
|
216
|
+
}, [d, t, o]), i.useEffect(() => a(y.TRENDS_VIEW_TRANSACTIONS), []);
|
|
217
|
+
const T = () => {
|
|
218
218
|
f(""), s();
|
|
219
219
|
};
|
|
220
220
|
return /* @__PURE__ */ C(
|
|
221
221
|
Ce,
|
|
222
222
|
{
|
|
223
|
-
ariaLabelClose:
|
|
223
|
+
ariaLabelClose: h.close_aria,
|
|
224
224
|
isOpen: n,
|
|
225
|
-
onClose:
|
|
225
|
+
onClose: T,
|
|
226
226
|
title: $t.title,
|
|
227
227
|
children: [
|
|
228
|
-
|
|
229
|
-
!
|
|
228
|
+
u && /* @__PURE__ */ e(We, { transaction: u }),
|
|
229
|
+
!u && /* @__PURE__ */ e(Oe, { onClick: f })
|
|
230
230
|
]
|
|
231
231
|
}
|
|
232
232
|
);
|
|
233
233
|
}, Yt = v(jt), Ut = ({ onBackClick: t, sx: o }) => {
|
|
234
|
-
const { onEvent: n } =
|
|
234
|
+
const { onEvent: n } = N(), { isDesktop: s, isTablet: a, isMobile: d } = $(), { visibleAccounts: h } = ce(), { loadMonthlyCategoryTotals: l, monthlyCategoryTotals: c, getCategoryName: m } = K(), { sortedTransactions: f } = ie(), { selectedDateRange: u, setSelectedDateRange: T } = te(), { isCopyLoaded: r, isInitialized: g, selectedAccounts: _, setSelectedAccounts: p } = ee(), { trends: I } = R(), [w, E] = i.useState(!1), [k, D] = i.useState(!1), [O, M] = i.useState("Chart"), [L, P] = i.useState(""), [G, le] = i.useState(window.innerHeight), j = G - (d ? 315 : 345);
|
|
235
235
|
i.useEffect(() => {
|
|
236
236
|
const S = () => le(window.innerHeight);
|
|
237
237
|
return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
|
|
238
238
|
}, []), i.useEffect(() => {
|
|
239
|
-
p(
|
|
240
|
-
}, [
|
|
241
|
-
g &&
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
p(h);
|
|
240
|
+
}, [h]), i.useEffect(() => {
|
|
241
|
+
g && l(
|
|
242
|
+
_,
|
|
243
|
+
u.start,
|
|
244
|
+
u.end
|
|
245
245
|
).finally(() => {
|
|
246
|
-
|
|
246
|
+
E(!0);
|
|
247
247
|
});
|
|
248
|
-
}, [g,
|
|
248
|
+
}, [g, _, u]);
|
|
249
249
|
const ne = i.useMemo(() => {
|
|
250
250
|
if (!w) return { stackedDatasets: [], unstackedDatasets: [] };
|
|
251
|
-
const S =
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
const S = nt(
|
|
252
|
+
c,
|
|
253
|
+
u.start,
|
|
254
|
+
u.end
|
|
255
255
|
), H = L.length ? S.filter(
|
|
256
256
|
(B) => B.top_level_category_guid === L || B.category_guid === L
|
|
257
|
-
) :
|
|
257
|
+
) : at(S);
|
|
258
258
|
return {
|
|
259
|
-
stackedDatasets: H.filter(
|
|
260
|
-
unstackedDatasets: H.filter(
|
|
259
|
+
stackedDatasets: H.filter(it),
|
|
260
|
+
unstackedDatasets: H.filter(ct)
|
|
261
261
|
};
|
|
262
|
-
}, [
|
|
262
|
+
}, [c, L, u]), F = (S, H) => {
|
|
263
263
|
M(H ?? O), n(y.TRENDS_CLICK_TOGGLE_VIEW);
|
|
264
264
|
}, de = (S) => {
|
|
265
265
|
const H = ve(S?.[0], 1), B = S?.[1], ge = pe(B, H);
|
|
266
|
-
|
|
266
|
+
T({ start: H, end: B }), n(y.TRENDS_CLICK_TIME_WINDOW, {
|
|
267
267
|
time_period: ge + "M"
|
|
268
268
|
});
|
|
269
269
|
}, Y = () => {
|
|
@@ -280,19 +280,19 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
280
280
|
n(y.TRENDS_HOVER_POINT, { category: S });
|
|
281
281
|
};
|
|
282
282
|
return !r || !g || !w ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ C(
|
|
283
|
-
|
|
283
|
+
He,
|
|
284
284
|
{
|
|
285
|
-
accountOptions:
|
|
285
|
+
accountOptions: h,
|
|
286
286
|
calendarActions: { onRangeChanged: de },
|
|
287
|
-
dateRange:
|
|
287
|
+
dateRange: u,
|
|
288
288
|
dateRangeVariant: "timeframebuttons",
|
|
289
289
|
onAccountsFilterClick: Y,
|
|
290
290
|
onBackClick: t,
|
|
291
291
|
sx: o,
|
|
292
|
-
title:
|
|
292
|
+
title: I.title,
|
|
293
293
|
children: [
|
|
294
294
|
/* @__PURE__ */ C(
|
|
295
|
-
|
|
295
|
+
b,
|
|
296
296
|
{
|
|
297
297
|
sx: {
|
|
298
298
|
// eslint-disable-next-line no-nested-ternary
|
|
@@ -300,33 +300,33 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
300
300
|
},
|
|
301
301
|
children: [
|
|
302
302
|
/* @__PURE__ */ C(
|
|
303
|
-
|
|
303
|
+
b,
|
|
304
304
|
{
|
|
305
305
|
flexDirection: "row",
|
|
306
306
|
justifyContent: "space-between",
|
|
307
|
-
sx: { pb:
|
|
307
|
+
sx: { pb: d ? 12 : 24, pt: d ? 24 : 48 },
|
|
308
308
|
children: [
|
|
309
309
|
/* @__PURE__ */ e(
|
|
310
|
-
|
|
310
|
+
ze,
|
|
311
311
|
{
|
|
312
312
|
selectedCategoryGuid: L,
|
|
313
|
-
selectedDateRange:
|
|
313
|
+
selectedDateRange: u
|
|
314
314
|
}
|
|
315
315
|
),
|
|
316
|
-
/* @__PURE__ */ e(
|
|
316
|
+
/* @__PURE__ */ e(Be, { onTabChange: F, selectedTab: O })
|
|
317
317
|
]
|
|
318
318
|
}
|
|
319
319
|
),
|
|
320
|
-
/* @__PURE__ */ C(
|
|
320
|
+
/* @__PURE__ */ C(b, { alignItems: "center", flexDirection: "row", width: "100%", children: [
|
|
321
321
|
/* @__PURE__ */ e(W, { flexGrow: 1, children: L && /* @__PURE__ */ C(me, { onClick: () => P(""), sx: { p: 0, pr: 5 }, children: [
|
|
322
322
|
/* @__PURE__ */ e(ae, { name: "arrow_back" }),
|
|
323
|
-
|
|
323
|
+
I.all_categories
|
|
324
324
|
] }) }),
|
|
325
|
-
/* @__PURE__ */ e(me, { onClick: () =>
|
|
325
|
+
/* @__PURE__ */ e(me, { onClick: () => D(!0), sx: { px: 5 }, children: `${I.view_transactions} (${f.length})` })
|
|
326
326
|
] }),
|
|
327
327
|
/* @__PURE__ */ C(W, { children: [
|
|
328
328
|
O === "Chart" && /* @__PURE__ */ e(
|
|
329
|
-
|
|
329
|
+
ot,
|
|
330
330
|
{
|
|
331
331
|
availableHeight: j,
|
|
332
332
|
onClickLegend: he,
|
|
@@ -338,12 +338,12 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
338
338
|
}
|
|
339
339
|
),
|
|
340
340
|
O === "Table" && /* @__PURE__ */ e(
|
|
341
|
-
|
|
341
|
+
Pe,
|
|
342
342
|
{
|
|
343
|
-
monthlyCategoryTotals:
|
|
343
|
+
monthlyCategoryTotals: c,
|
|
344
344
|
onClickRow: oe,
|
|
345
345
|
selectedCategory: L,
|
|
346
|
-
selectedDateRange:
|
|
346
|
+
selectedDateRange: u
|
|
347
347
|
}
|
|
348
348
|
)
|
|
349
349
|
] })
|
|
@@ -354,16 +354,16 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
354
354
|
Yt,
|
|
355
355
|
{
|
|
356
356
|
categoryGuid: L,
|
|
357
|
-
dateRange:
|
|
358
|
-
isOpen:
|
|
359
|
-
onClose: () =>
|
|
357
|
+
dateRange: u,
|
|
358
|
+
isOpen: k,
|
|
359
|
+
onClose: () => D(!1)
|
|
360
360
|
}
|
|
361
361
|
)
|
|
362
362
|
]
|
|
363
363
|
}
|
|
364
364
|
);
|
|
365
365
|
}, io = v(Ut), Xt = () => {
|
|
366
|
-
const t =
|
|
366
|
+
const t = Ve(), { monthlyCategoryTotals: o } = K(), { trends: n } = R(), s = lt(o);
|
|
367
367
|
return /* @__PURE__ */ e(
|
|
368
368
|
ye,
|
|
369
369
|
{
|
|
@@ -381,19 +381,19 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
381
381
|
}
|
|
382
382
|
);
|
|
383
383
|
}, Zt = v(Xt), Qt = ({ onPrimaryCtaClick: t, sx: o }) => {
|
|
384
|
-
const { visibleAccounts: n } = ce(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: a } = K(), { isInitialized:
|
|
384
|
+
const { visibleAccounts: n } = ce(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: a } = K(), { isInitialized: d } = Te(), { trends: h } = R(), { isCopyLoaded: l, selectedAccounts: c, setSelectedAccounts: m } = ee();
|
|
385
385
|
return i.useEffect(() => {
|
|
386
386
|
m(n);
|
|
387
387
|
}, [n]), i.useEffect(() => {
|
|
388
|
-
|
|
389
|
-
}, [
|
|
388
|
+
d && s(c).finally();
|
|
389
|
+
}, [d, c]), !l || !d ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
|
|
390
390
|
ft,
|
|
391
391
|
{
|
|
392
392
|
onPrimaryCtaClick: t,
|
|
393
|
-
primaryCtaLabel:
|
|
394
|
-
subTitle:
|
|
393
|
+
primaryCtaLabel: h.primary_cta,
|
|
394
|
+
subTitle: h.sub_title,
|
|
395
395
|
sx: o,
|
|
396
|
-
title:
|
|
396
|
+
title: h.mini_title,
|
|
397
397
|
children: a ? /* @__PURE__ */ e(Zt, {}) : /* @__PURE__ */ e(J, {})
|
|
398
398
|
}
|
|
399
399
|
);
|
|
@@ -403,14 +403,14 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
403
403
|
transactionType: n,
|
|
404
404
|
percentage: s,
|
|
405
405
|
secondaryLabel: a,
|
|
406
|
-
shouldDisplayPercentage:
|
|
406
|
+
shouldDisplayPercentage: d
|
|
407
407
|
}) => {
|
|
408
|
-
const { availableWidth:
|
|
408
|
+
const { availableWidth: h } = ut(), l = i.useRef(null), c = i.useRef(null), m = Dt(Number(Math.abs(s)), {
|
|
409
409
|
style: "percent",
|
|
410
410
|
minimumIntegerDigits: 1
|
|
411
|
-
}), f =
|
|
411
|
+
}), f = h === 288 && Z(o, "0,0.00").length > 10 ? Z(o, "0,0") : Z(o, "0,0.00"), u = n === "spending" ? s > 0 : s >= 0, T = n === "spending" ? "error.main" : "success.main", r = n === "spending" ? "success.main" : "text.secondary", g = l?.current, _ = c?.current, p = g && _ ? g.scrollWidth > _.clientWidth - qt : !1;
|
|
412
412
|
return /* @__PURE__ */ C(
|
|
413
|
-
|
|
413
|
+
b,
|
|
414
414
|
{
|
|
415
415
|
sx: {
|
|
416
416
|
border: 1,
|
|
@@ -423,7 +423,7 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
423
423
|
},
|
|
424
424
|
children: [
|
|
425
425
|
/* @__PURE__ */ C(
|
|
426
|
-
|
|
426
|
+
b,
|
|
427
427
|
{
|
|
428
428
|
sx: {
|
|
429
429
|
alignItems: "center",
|
|
@@ -432,13 +432,13 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
432
432
|
},
|
|
433
433
|
children: [
|
|
434
434
|
/* @__PURE__ */ e(X, { color: "text.secondary", variant: "caption", children: t }),
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
d && /* @__PURE__ */ C(b, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
|
|
436
|
+
u ? /* @__PURE__ */ e(yt, { size: 20, sx: { color: T } }) : /* @__PURE__ */ e(_t, { size: 20, sx: { color: r } }),
|
|
437
437
|
/* @__PURE__ */ e(
|
|
438
438
|
X,
|
|
439
439
|
{
|
|
440
440
|
sx: {
|
|
441
|
-
color:
|
|
441
|
+
color: u ? T : r,
|
|
442
442
|
fontWeight: 600
|
|
443
443
|
},
|
|
444
444
|
variant: "body2",
|
|
@@ -450,9 +450,9 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
450
450
|
}
|
|
451
451
|
),
|
|
452
452
|
/* @__PURE__ */ C(
|
|
453
|
-
|
|
453
|
+
b,
|
|
454
454
|
{
|
|
455
|
-
ref:
|
|
455
|
+
ref: c,
|
|
456
456
|
sx: {
|
|
457
457
|
alignItems: "center",
|
|
458
458
|
flexDirection: "row",
|
|
@@ -462,15 +462,15 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
462
462
|
/* @__PURE__ */ e(
|
|
463
463
|
W,
|
|
464
464
|
{
|
|
465
|
-
ref:
|
|
465
|
+
ref: l,
|
|
466
466
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
467
467
|
children: /* @__PURE__ */ e(xe, { children: f })
|
|
468
468
|
}
|
|
469
469
|
),
|
|
470
|
-
|
|
470
|
+
d && h >= 450 && !p && /* @__PURE__ */ e(
|
|
471
471
|
X,
|
|
472
472
|
{
|
|
473
|
-
color:
|
|
473
|
+
color: u ? T : r,
|
|
474
474
|
variant: "caption",
|
|
475
475
|
children: a
|
|
476
476
|
}
|
|
@@ -483,48 +483,48 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
483
483
|
);
|
|
484
484
|
}, Jt = v(() => {
|
|
485
485
|
const { trends: t } = R();
|
|
486
|
-
return /* @__PURE__ */ C(
|
|
486
|
+
return /* @__PURE__ */ C(b, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
|
|
487
487
|
/* @__PURE__ */ e(bt, { size: 32 }),
|
|
488
|
-
/* @__PURE__ */ C(
|
|
488
|
+
/* @__PURE__ */ C(b, { children: [
|
|
489
489
|
/* @__PURE__ */ e(X, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
|
|
490
490
|
/* @__PURE__ */ e(X, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
|
|
491
491
|
] })
|
|
492
492
|
] });
|
|
493
493
|
}), lo = v(({ onCtaClick: t }) => {
|
|
494
|
-
const { visibleAccounts: o } = ce(), { onEvent: n } =
|
|
494
|
+
const { visibleAccounts: o } = ce(), { onEvent: n } = N(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: a, monthlyTotalsLoaded: d } = K(), h = {
|
|
495
495
|
start: Tt(/* @__PURE__ */ new Date(), 1),
|
|
496
496
|
end: /* @__PURE__ */ new Date()
|
|
497
|
-
}, { trends:
|
|
497
|
+
}, { trends: l } = R(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: f } = ee();
|
|
498
498
|
i.useEffect(() => {
|
|
499
499
|
m(o);
|
|
500
500
|
}, [o]), i.useEffect(() => {
|
|
501
|
-
f && a(
|
|
501
|
+
f && a(c, h.start).then(() => {
|
|
502
502
|
n(y.TRENDS_LOAD_WIDGET, {
|
|
503
503
|
state: o?.length ? "default" : "zeroState"
|
|
504
504
|
});
|
|
505
505
|
});
|
|
506
|
-
}, [f,
|
|
507
|
-
const { spendingData:
|
|
506
|
+
}, [f, c]);
|
|
507
|
+
const { spendingData: u, incomeData: T } = i.useMemo(
|
|
508
508
|
() => ({
|
|
509
|
-
spendingData: Ae(s,
|
|
510
|
-
incomeData: Re(s,
|
|
509
|
+
spendingData: Ae(s, h),
|
|
510
|
+
incomeData: Re(s, h)
|
|
511
511
|
}),
|
|
512
|
-
[s,
|
|
513
|
-
), [r, g] =
|
|
512
|
+
[s, h]
|
|
513
|
+
), [r, g] = u, [_, p] = T, I = De(g.y, r.y), w = De(p.y, _.y), E = f && !o?.length, k = () => {
|
|
514
514
|
n(
|
|
515
|
-
|
|
515
|
+
E ? y.TRENDS_CLICK_GET_STARTED : y.TRENDS_CLICK_VIEW_MORE
|
|
516
516
|
), t();
|
|
517
517
|
};
|
|
518
|
-
return !
|
|
518
|
+
return !d || !f ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
|
|
519
519
|
It,
|
|
520
520
|
{
|
|
521
521
|
className: "mx-trends-microwidget",
|
|
522
|
-
ctaLabel:
|
|
523
|
-
onCTAClick:
|
|
524
|
-
subHeader:
|
|
525
|
-
title:
|
|
526
|
-
children:
|
|
527
|
-
|
|
522
|
+
ctaLabel: l.micro_primary_cta_label,
|
|
523
|
+
onCTAClick: k,
|
|
524
|
+
subHeader: E ? void 0 : l.micro_subheader,
|
|
525
|
+
title: l.title,
|
|
526
|
+
children: E ? /* @__PURE__ */ e(Jt, {}) : /* @__PURE__ */ C(
|
|
527
|
+
b,
|
|
528
528
|
{
|
|
529
529
|
sx: {
|
|
530
530
|
alignItems: "stretch",
|
|
@@ -535,10 +535,10 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
535
535
|
/* @__PURE__ */ e(
|
|
536
536
|
Ee,
|
|
537
537
|
{
|
|
538
|
-
percentage:
|
|
539
|
-
secondaryLabel:
|
|
538
|
+
percentage: I,
|
|
539
|
+
secondaryLabel: l.micro_secondary_label,
|
|
540
540
|
shouldDisplayPercentage: g.y !== 0 && r.y !== 0,
|
|
541
|
-
title:
|
|
541
|
+
title: l.spending_label,
|
|
542
542
|
totalAmount: g.y,
|
|
543
543
|
transactionType: "spending"
|
|
544
544
|
}
|
|
@@ -547,9 +547,9 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
547
547
|
Ee,
|
|
548
548
|
{
|
|
549
549
|
percentage: w,
|
|
550
|
-
secondaryLabel:
|
|
551
|
-
shouldDisplayPercentage: p.y !== 0 &&
|
|
552
|
-
title:
|
|
550
|
+
secondaryLabel: l.micro_secondary_label,
|
|
551
|
+
shouldDisplayPercentage: p.y !== 0 && _.y !== 0,
|
|
552
|
+
title: l.income_label,
|
|
553
553
|
totalAmount: p.y,
|
|
554
554
|
transactionType: "income"
|
|
555
555
|
}
|
|
@@ -561,9 +561,9 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
561
561
|
);
|
|
562
562
|
}), en = v(
|
|
563
563
|
({ isExpanded: t, onClick: o }) => {
|
|
564
|
-
const n =
|
|
564
|
+
const n = Ge();
|
|
565
565
|
return /* @__PURE__ */ e(xt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(vt, { onClick: o, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
|
|
566
|
-
|
|
566
|
+
b,
|
|
567
567
|
{
|
|
568
568
|
sx: { color: n.palette.primary.main, flexDirection: "row", alignItems: "center" },
|
|
569
569
|
children: [
|
|
@@ -588,11 +588,11 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
588
588
|
name: n,
|
|
589
589
|
transactions: s,
|
|
590
590
|
onClick: a,
|
|
591
|
-
isLastItem:
|
|
592
|
-
showDivider:
|
|
591
|
+
isLastItem: d = !1,
|
|
592
|
+
showDivider: h = !0
|
|
593
593
|
}) => {
|
|
594
|
-
const { trends:
|
|
595
|
-
a?.(),
|
|
594
|
+
const { trends: l } = R(), { onEvent: c } = N(), m = `${s.length} ${s.length === 1 ? l.transaction : l.transactions}`, f = () => {
|
|
595
|
+
a?.(), c(y.TRENDS_CLICK_LIST_ITEM, {
|
|
596
596
|
...A,
|
|
597
597
|
listItem: n
|
|
598
598
|
});
|
|
@@ -604,33 +604,33 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
604
604
|
leftIcon: o ? /* @__PURE__ */ e(fe, { categoryGuid: o }) : void 0,
|
|
605
605
|
onClick: f,
|
|
606
606
|
rightContent: Z(Math.abs(t), "0,0.00"),
|
|
607
|
-
rightIcon: a ? /* @__PURE__ */ e(
|
|
607
|
+
rightIcon: a ? /* @__PURE__ */ e(et, {}) : void 0,
|
|
608
608
|
subtitle: m,
|
|
609
609
|
title: n
|
|
610
610
|
}
|
|
611
611
|
),
|
|
612
|
-
|
|
612
|
+
h && /* @__PURE__ */ e(Rt, { sx: { ml: d ? 24 : 68 } })
|
|
613
613
|
] }, o);
|
|
614
614
|
}
|
|
615
615
|
), tn = v(
|
|
616
616
|
({ availableHeight: t = 0, onCategoryClick: o }) => {
|
|
617
|
-
const { collapsedCategories: n, visibleCategories: s, setVisibleListLength: a } = te(), { isLargeDesktop:
|
|
617
|
+
const { collapsedCategories: n, visibleCategories: s, setVisibleListLength: a } = te(), { isLargeDesktop: d, isDesktop: h } = $(), { trends: l } = R(), { onEvent: c } = N(), [m, f] = i.useState(!1), u = h || d;
|
|
618
618
|
i.useEffect(() => {
|
|
619
|
-
const g = Math.floor(t / 64) - 1,
|
|
620
|
-
g !== s.length && (a(
|
|
619
|
+
const g = Math.floor(t / 64) - 1, _ = s.length + n.length;
|
|
620
|
+
g !== s.length && (a(u ? Math.max(g, 5) : 5), f(g >= _));
|
|
621
621
|
}, [t]);
|
|
622
|
-
const
|
|
623
|
-
f(!m),
|
|
622
|
+
const T = () => {
|
|
623
|
+
f(!m), c(y.TRENDS_CLICK_VIEW_MORE, {
|
|
624
624
|
...A
|
|
625
625
|
});
|
|
626
626
|
}, r = s.length + (m ? n.length : 0);
|
|
627
|
-
return /* @__PURE__ */ e(
|
|
628
|
-
/* @__PURE__ */ e(
|
|
629
|
-
s.map((g,
|
|
627
|
+
return /* @__PURE__ */ e(b, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ C(Lt, { children: [
|
|
628
|
+
/* @__PURE__ */ e(b, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(xe, { children: l.categories }) }),
|
|
629
|
+
s.map((g, _) => /* @__PURE__ */ e(
|
|
630
630
|
Le,
|
|
631
631
|
{
|
|
632
632
|
...g,
|
|
633
|
-
isLastItem:
|
|
633
|
+
isLastItem: _ === r - 1,
|
|
634
634
|
onClick: g.transactions.length > 0 ? () => o(g) : void 0,
|
|
635
635
|
showDivider: !0
|
|
636
636
|
},
|
|
@@ -641,8 +641,8 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
641
641
|
{
|
|
642
642
|
in: m,
|
|
643
643
|
sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
|
|
644
|
-
children: n.map((g,
|
|
645
|
-
const p = s.length +
|
|
644
|
+
children: n.map((g, _) => {
|
|
645
|
+
const p = s.length + _;
|
|
646
646
|
return /* @__PURE__ */ e(
|
|
647
647
|
Le,
|
|
648
648
|
{
|
|
@@ -656,40 +656,42 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
656
656
|
})
|
|
657
657
|
}
|
|
658
658
|
),
|
|
659
|
-
n.length > 0 && /* @__PURE__ */ e(en, { isExpanded: m, onClick:
|
|
659
|
+
n.length > 0 && /* @__PURE__ */ e(en, { isExpanded: m, onClick: T })
|
|
660
660
|
] }) });
|
|
661
661
|
}
|
|
662
662
|
), nn = ({ beats: t, onInsightCardClick: o }) => {
|
|
663
|
-
const n = kt(), { onEvent: s } =
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
663
|
+
const n = kt(), { onEvent: s } = N(), { isMobile: a, isDesktop: d, isLargeDesktop: h } = $(), { beatStore: l, endpoint: c, sessionToken: m } = Te(), { is_mobile_webview: f } = ke();
|
|
664
|
+
console.log({ is_mobile_webview: f });
|
|
665
|
+
const u = n.palette.mode === "dark", T = d || h, r = T || a ? 1 : 2, g = () => null, _ = (D) => {
|
|
666
|
+
o?.(D), s(y.TRENDS_CLICK_INSIGHT, A);
|
|
667
|
+
}, p = T ? 200 : 170, I = T ? 170 : 124, w = T ? 56 : 0, E = t.length > 0 ? p + w : I, k = T && t.length > 0 ? p : void 0;
|
|
668
|
+
return /* @__PURE__ */ e(Nt, { sx: { height: E }, children: /* @__PURE__ */ e(
|
|
667
669
|
Ct,
|
|
668
670
|
{
|
|
669
|
-
areBeatsLoading:
|
|
671
|
+
areBeatsLoading: l.isLoading,
|
|
670
672
|
beats: t,
|
|
671
|
-
endpoint:
|
|
672
|
-
heightOverrides:
|
|
673
|
-
logOutUser:
|
|
674
|
-
onCardClick:
|
|
673
|
+
endpoint: c,
|
|
674
|
+
heightOverrides: k,
|
|
675
|
+
logOutUser: g,
|
|
676
|
+
onCardClick: _,
|
|
675
677
|
showBorder: !0,
|
|
676
678
|
showCTAColocatedWithText: !1,
|
|
677
679
|
showCarouselControls: !0,
|
|
678
|
-
showHeader:
|
|
680
|
+
showHeader: T,
|
|
679
681
|
showIcon: !0,
|
|
680
682
|
showWithMargin: !1,
|
|
681
683
|
token: m,
|
|
682
|
-
useDarkMode:
|
|
684
|
+
useDarkMode: u,
|
|
683
685
|
userHasFullInsightFeedBeats: !1,
|
|
684
686
|
variant: "outlined",
|
|
685
|
-
visibleCardsCount:
|
|
687
|
+
visibleCardsCount: r
|
|
686
688
|
}
|
|
687
689
|
) });
|
|
688
690
|
}, on = v(nn), sn = v(({ chartLabel: t, chartColor: o }) => {
|
|
689
|
-
const { onEvent: n } =
|
|
691
|
+
const { onEvent: n } = N(), {
|
|
690
692
|
categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels: a }
|
|
691
693
|
} = te();
|
|
692
|
-
return /* @__PURE__ */ e(
|
|
694
|
+
return /* @__PURE__ */ e(b, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
|
|
693
695
|
ye,
|
|
694
696
|
{
|
|
695
697
|
baseline: "min",
|
|
@@ -719,13 +721,13 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
719
721
|
}
|
|
720
722
|
) });
|
|
721
723
|
}), rn = v(({ onClose: t }) => {
|
|
722
|
-
const o =
|
|
723
|
-
if (!
|
|
724
|
+
const o = Ge(), { onEvent: n } = N(), { common: s, trends: a } = R(), { selectedCategoryData: d, selectedDateRangeMonthRange: h } = te(), { sortedTransactions: l } = ie(), [c, m] = i.useState(null);
|
|
725
|
+
if (!d)
|
|
724
726
|
return null;
|
|
725
|
-
const { guid: f, name:
|
|
726
|
-
() =>
|
|
727
|
-
[
|
|
728
|
-
),
|
|
727
|
+
const { guid: f, name: u, is_income: T, totalAmount: r } = d, g = T ? a.category_income : a.category_spending, _ = Wt(f, o), p = T ? a.income_label : a.spending_label, I = ` ${d.transactions.length === 1 ? a.transaction : a.transactions} (${d.transactions.length})`, w = i.useMemo(
|
|
728
|
+
() => l.find((D) => D.guid === c),
|
|
729
|
+
[c, l]
|
|
730
|
+
), E = (D) => D.category_guid === f || D.top_level_category_guid === f, k = () => {
|
|
729
731
|
t?.(), n(y.TRENDS_CLICK_BACK, A);
|
|
730
732
|
};
|
|
731
733
|
return /* @__PURE__ */ C(
|
|
@@ -733,32 +735,32 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
733
735
|
{
|
|
734
736
|
ariaLabelClose: a.close_category_details,
|
|
735
737
|
isOpen: !0,
|
|
736
|
-
onClose:
|
|
738
|
+
onClose: k,
|
|
737
739
|
shouldShowHeaderShadow: !0,
|
|
738
740
|
title: g,
|
|
739
741
|
children: [
|
|
740
|
-
/* @__PURE__ */ C(
|
|
742
|
+
/* @__PURE__ */ C(b, { sx: { alignItems: "center", height: "100%" }, children: [
|
|
741
743
|
/* @__PURE__ */ C(Ht, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
|
|
742
744
|
/* @__PURE__ */ e(
|
|
743
745
|
Me,
|
|
744
746
|
{
|
|
745
747
|
leftIcon: /* @__PURE__ */ e(fe, { categoryGuid: f }),
|
|
746
748
|
rightContent: Z(Math.abs(r), "0,0.00"),
|
|
747
|
-
subtitle:
|
|
748
|
-
title:
|
|
749
|
+
subtitle: h,
|
|
750
|
+
title: u
|
|
749
751
|
}
|
|
750
752
|
),
|
|
751
|
-
/* @__PURE__ */ e(sn, { chartColor:
|
|
752
|
-
/* @__PURE__ */ C(
|
|
753
|
-
/* @__PURE__ */ e(Q, { bold: !0, variant: "body1", children:
|
|
754
|
-
/* @__PURE__ */ e(Ot, { filter:
|
|
753
|
+
/* @__PURE__ */ e(sn, { chartColor: _, chartLabel: p }),
|
|
754
|
+
/* @__PURE__ */ C(b, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
|
|
755
|
+
/* @__PURE__ */ e(Q, { bold: !0, variant: "body1", children: I }),
|
|
756
|
+
/* @__PURE__ */ e(Ot, { filter: E })
|
|
755
757
|
] })
|
|
756
758
|
] }),
|
|
757
759
|
/* @__PURE__ */ e(
|
|
758
|
-
|
|
760
|
+
Oe,
|
|
759
761
|
{
|
|
760
762
|
bgcolor: "transparent",
|
|
761
|
-
filter:
|
|
763
|
+
filter: E,
|
|
762
764
|
height: "calc(100vh - 475px)",
|
|
763
765
|
onClick: m
|
|
764
766
|
}
|
|
@@ -771,7 +773,7 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
771
773
|
isOpen: !!w,
|
|
772
774
|
onClose: () => m(""),
|
|
773
775
|
title: a.transaction,
|
|
774
|
-
children: w && /* @__PURE__ */ e(
|
|
776
|
+
children: w && /* @__PURE__ */ e(We, { transaction: w })
|
|
775
777
|
}
|
|
776
778
|
)
|
|
777
779
|
]
|
|
@@ -781,37 +783,37 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
781
783
|
const n = Re(t, o), s = Ae(t, o);
|
|
782
784
|
return [n, s].filter((a) => a.length > 0);
|
|
783
785
|
}, cn = (t, o) => {
|
|
784
|
-
const [n, s] = t, a = n,
|
|
786
|
+
const [n, s] = t, a = n, d = s ?? n, h = [];
|
|
785
787
|
if (a) {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
+
const l = a.reduce((c, m) => c + m.y, 0);
|
|
789
|
+
h.push({ label: o.income_label, amount: l });
|
|
788
790
|
}
|
|
789
|
-
if (
|
|
790
|
-
const
|
|
791
|
-
|
|
791
|
+
if (d) {
|
|
792
|
+
const l = d.reduce((c, m) => c + m.y, 0);
|
|
793
|
+
h.push({ label: o.spending_label, amount: l });
|
|
792
794
|
}
|
|
793
|
-
return
|
|
795
|
+
return h;
|
|
794
796
|
}, ln = ({
|
|
795
797
|
availableHeight: t = 0,
|
|
796
798
|
minHeight: o = 500,
|
|
797
799
|
selectedDateRange: n,
|
|
798
800
|
totals: s
|
|
799
801
|
}) => {
|
|
800
|
-
const a =
|
|
802
|
+
const a = Ve(), { onEvent: d } = N(), { trends: h } = R(), { isSmallMobile: l, isMobile: c, isSmallTablet: m, isTablet: f } = $(), u = [a.palette.chart?.chart1, a.palette.chart?.chart2], T = an(s, n), r = cn(T, h), [g, _] = i.useState(0), p = 458, I = 195, w = 56, E = c || l ? I : m || f ? p : g;
|
|
801
803
|
return i.useEffect(() => {
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
+
const D = Math.max(t - w, o);
|
|
805
|
+
_(D);
|
|
804
806
|
}, [t]), /* @__PURE__ */ e(
|
|
805
807
|
ye,
|
|
806
808
|
{
|
|
807
809
|
baseline: "min",
|
|
808
|
-
colors:
|
|
810
|
+
colors: u,
|
|
809
811
|
curveType: "bump",
|
|
810
|
-
datasets:
|
|
811
|
-
height:
|
|
812
|
+
datasets: T,
|
|
813
|
+
height: E,
|
|
812
814
|
labels: r,
|
|
813
815
|
onItemClick: () => {
|
|
814
|
-
|
|
816
|
+
d(y.TRENDS_CLICK_CHART, A);
|
|
815
817
|
},
|
|
816
818
|
showArea: !0,
|
|
817
819
|
showAxisHighlight: !0,
|
|
@@ -859,27 +861,27 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
859
861
|
"WeeklyNoSpendDays",
|
|
860
862
|
"WeeklySmallPurchasesSummary"
|
|
861
863
|
], un = ({ onBackClick: t, onInsightCardClick: o, sx: n }) => {
|
|
862
|
-
const { onEvent: s } =
|
|
864
|
+
const { onEvent: s } = N(), { config: a } = ke(), { isLargeDesktop: d, isDesktop: h, isMobile: l } = $(), { visibleAccounts: c } = ce(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: f, monthlyCategoryTotals: u } = K(), { setFilter: T } = ie(), { selectedDateRange: r, setSelectedCategoryData: g, setSelectedDateRange: _ } = te(), {
|
|
863
865
|
isCopyLoaded: p,
|
|
864
|
-
isInitialized:
|
|
866
|
+
isInitialized: I,
|
|
865
867
|
selectedAccounts: w,
|
|
866
|
-
selectedAccountGuids:
|
|
867
|
-
setSelectedAccounts:
|
|
868
|
-
} = ee(), { trends:
|
|
869
|
-
() =>
|
|
870
|
-
[
|
|
868
|
+
selectedAccountGuids: E,
|
|
869
|
+
setSelectedAccounts: k
|
|
870
|
+
} = ee(), { trends: D, connect: O } = R(), { beatStore: M } = Te(), P = Vt() && a.show_insights_widget_in_master, G = h || d, [le, _e] = i.useState(!1), [j, ne] = i.useState(!1), [F, de] = i.useState("Chart"), [Y, oe] = i.useState(""), [he, se] = i.useState(!1), [re, ue] = i.useState(window.innerHeight), S = G ? 56 : 0, H = re - 208, B = re - (P ? 550 + S : 266), [ge, be] = i.useState(!1), Fe = a.show_connections_widget_in_master ? "buttons" : "no-buttons", Se = i.useMemo(
|
|
871
|
+
() => c && c.length === 0 || u.length === 0,
|
|
872
|
+
[c, u]
|
|
871
873
|
);
|
|
872
874
|
i.useEffect(() => {
|
|
873
|
-
|
|
874
|
-
}, [
|
|
875
|
+
I && M.loadBeats().finally(() => ne(!0));
|
|
876
|
+
}, [I]);
|
|
875
877
|
const we = i.useMemo(() => j ? M.getFilteredBeats({ templates: hn }) : [], [j]);
|
|
876
878
|
i.useEffect(() => {
|
|
877
879
|
const x = () => ue(window.innerHeight);
|
|
878
880
|
return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
|
|
879
881
|
}, []), i.useEffect(() => {
|
|
880
|
-
|
|
881
|
-
}, [
|
|
882
|
-
|
|
882
|
+
k(c);
|
|
883
|
+
}, [c]), i.useEffect(() => {
|
|
884
|
+
I && m(w, r.start, r.end).then(() => {
|
|
883
885
|
f(
|
|
884
886
|
w,
|
|
885
887
|
r.start,
|
|
@@ -891,112 +893,112 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
891
893
|
time_period: `${pe(r.end, r.start)}M`
|
|
892
894
|
});
|
|
893
895
|
});
|
|
894
|
-
}, [
|
|
895
|
-
if (
|
|
896
|
+
}, [I, w, r]), i.useEffect(() => {
|
|
897
|
+
if (u.length !== 0) {
|
|
896
898
|
const x = {
|
|
897
|
-
accounts:
|
|
899
|
+
accounts: E,
|
|
898
900
|
dateRange: { start: r.start, end: r.end }
|
|
899
901
|
};
|
|
900
|
-
|
|
902
|
+
T({
|
|
901
903
|
...x,
|
|
902
|
-
custom: (V) => !!
|
|
904
|
+
custom: (V) => !!u.find(
|
|
903
905
|
(U) => U.top_level_category_guid === V.top_level_category_guid || U.category_guid === V.category_guid
|
|
904
906
|
)
|
|
905
907
|
});
|
|
906
908
|
}
|
|
907
|
-
}, [
|
|
908
|
-
const
|
|
909
|
+
}, [u]);
|
|
910
|
+
const Ke = (x) => {
|
|
909
911
|
g(x), se(!0);
|
|
910
|
-
}, Ke = () => {
|
|
911
|
-
g(null), se(!1);
|
|
912
912
|
}, $e = () => {
|
|
913
|
+
g(null), se(!1);
|
|
914
|
+
}, je = () => {
|
|
913
915
|
be(!0), s(y.TRENDS_CLICK_CONNECT_ACCOUNTS);
|
|
914
|
-
},
|
|
916
|
+
}, Ye = (x, V) => {
|
|
915
917
|
de(V ?? F), s(y.TRENDS_CLICK_TOGGLE_VIEW, {
|
|
916
918
|
...A,
|
|
917
919
|
toggleView: V
|
|
918
920
|
});
|
|
919
|
-
},
|
|
920
|
-
const V = ve(x?.[0], 1), U = x?.[1],
|
|
921
|
-
|
|
921
|
+
}, Ue = (x) => {
|
|
922
|
+
const V = ve(x?.[0], 1), U = x?.[1], qe = pe(U, V);
|
|
923
|
+
_({ start: V, end: U }), s(y.TRENDS_CLICK_TIME_WINDOW, {
|
|
922
924
|
...A,
|
|
923
|
-
time_period:
|
|
925
|
+
time_period: qe + "M"
|
|
924
926
|
});
|
|
925
|
-
},
|
|
927
|
+
}, Xe = (x) => {
|
|
926
928
|
s(y.TRENDS_CLICK_FILTER, {
|
|
927
929
|
...A,
|
|
928
930
|
filterValue: x
|
|
929
931
|
});
|
|
930
|
-
},
|
|
932
|
+
}, Ze = (x) => {
|
|
931
933
|
oe(x);
|
|
932
|
-
},
|
|
934
|
+
}, Qe = () => {
|
|
933
935
|
oe(""), s(y.TRENDS_CLICK_ALL_CATEGORIES, A);
|
|
934
936
|
};
|
|
935
937
|
return !p || !le ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ C(
|
|
936
|
-
|
|
938
|
+
He,
|
|
937
939
|
{
|
|
938
|
-
accountOptions:
|
|
939
|
-
calendarActions: { onRangeChanged:
|
|
940
|
+
accountOptions: c,
|
|
941
|
+
calendarActions: { onRangeChanged: Ue },
|
|
940
942
|
dateRange: r,
|
|
941
|
-
dateRangeVariant:
|
|
942
|
-
onAccountsFilterClick:
|
|
943
|
+
dateRangeVariant: l ? "timeframetabs" : "timeframebuttons",
|
|
944
|
+
onAccountsFilterClick: Xe,
|
|
943
945
|
onBackClick: t,
|
|
944
946
|
sx: n,
|
|
945
|
-
title:
|
|
947
|
+
title: D.title,
|
|
946
948
|
children: [
|
|
947
949
|
Se && /* @__PURE__ */ e(
|
|
948
950
|
Gt,
|
|
949
951
|
{
|
|
950
|
-
header:
|
|
952
|
+
header: D.zero_state_content_header,
|
|
951
953
|
icon: "",
|
|
952
|
-
onClick:
|
|
953
|
-
primaryButton:
|
|
954
|
-
subText:
|
|
954
|
+
onClick: je,
|
|
955
|
+
primaryButton: D.empty_state_primary,
|
|
956
|
+
subText: D.empty_state_sub_text,
|
|
955
957
|
sx: { height: H },
|
|
956
|
-
variant:
|
|
958
|
+
variant: Fe
|
|
957
959
|
}
|
|
958
960
|
),
|
|
959
961
|
!Se && /* @__PURE__ */ C(
|
|
960
|
-
|
|
962
|
+
b,
|
|
961
963
|
{
|
|
962
964
|
sx: {
|
|
963
|
-
px:
|
|
965
|
+
px: l ? 0 : 48
|
|
964
966
|
},
|
|
965
967
|
children: [
|
|
966
968
|
/* @__PURE__ */ C(
|
|
967
|
-
|
|
969
|
+
b,
|
|
968
970
|
{
|
|
969
971
|
flexDirection: "row",
|
|
970
972
|
justifyContent: "space-between",
|
|
971
|
-
sx: { pb:
|
|
973
|
+
sx: { pb: l ? 12 : 24, pt: l ? 24 : 48 },
|
|
972
974
|
children: [
|
|
973
975
|
/* @__PURE__ */ e(
|
|
974
|
-
|
|
976
|
+
ze,
|
|
975
977
|
{
|
|
976
978
|
selectedCategoryGuid: Y,
|
|
977
979
|
selectedDateRange: r
|
|
978
980
|
}
|
|
979
981
|
),
|
|
980
|
-
/* @__PURE__ */ e(
|
|
982
|
+
/* @__PURE__ */ e(Be, { onTabChange: Ye, selectedTab: F })
|
|
981
983
|
]
|
|
982
984
|
}
|
|
983
985
|
),
|
|
984
|
-
/* @__PURE__ */ e(
|
|
986
|
+
/* @__PURE__ */ e(b, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(W, { flexGrow: 1, children: Y && /* @__PURE__ */ C(me, { onClick: Qe, sx: { p: 0, pr: 5 }, children: [
|
|
985
987
|
/* @__PURE__ */ e(ae, { name: "arrow_back" }),
|
|
986
|
-
|
|
988
|
+
D.all_categories
|
|
987
989
|
] }) }) }),
|
|
988
|
-
/* @__PURE__ */ C(
|
|
989
|
-
F === "Chart" && /* @__PURE__ */ C(
|
|
990
|
+
/* @__PURE__ */ C(b, { flexDirection: G ? "row" : "column", gap: G ? 48 : 16, children: [
|
|
991
|
+
F === "Chart" && /* @__PURE__ */ C(Je, { children: [
|
|
990
992
|
/* @__PURE__ */ e(W, { sx: { width: G ? "68%" : "100%" }, children: /* @__PURE__ */ e(
|
|
991
993
|
dn,
|
|
992
994
|
{
|
|
993
995
|
availableHeight: H,
|
|
994
996
|
minHeight: 450,
|
|
995
997
|
selectedDateRange: r,
|
|
996
|
-
totals:
|
|
998
|
+
totals: u
|
|
997
999
|
}
|
|
998
1000
|
) }),
|
|
999
|
-
/* @__PURE__ */ C(
|
|
1001
|
+
/* @__PURE__ */ C(b, { gap: 16, sx: { width: G ? "32%" : "100%" }, children: [
|
|
1000
1002
|
P && j && we.length > 0 && /* @__PURE__ */ e(
|
|
1001
1003
|
on,
|
|
1002
1004
|
{
|
|
@@ -1008,23 +1010,23 @@ const Ge = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
1008
1010
|
tn,
|
|
1009
1011
|
{
|
|
1010
1012
|
availableHeight: B,
|
|
1011
|
-
onCategoryClick:
|
|
1013
|
+
onCategoryClick: Ke
|
|
1012
1014
|
}
|
|
1013
1015
|
)
|
|
1014
1016
|
] })
|
|
1015
1017
|
] }),
|
|
1016
1018
|
F === "Table" && /* @__PURE__ */ e(W, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
1017
|
-
|
|
1019
|
+
Pe,
|
|
1018
1020
|
{
|
|
1019
1021
|
height: "unset",
|
|
1020
|
-
monthlyCategoryTotals:
|
|
1021
|
-
onClickRow:
|
|
1022
|
+
monthlyCategoryTotals: u,
|
|
1023
|
+
onClickRow: Ze,
|
|
1022
1024
|
selectedCategory: Y,
|
|
1023
1025
|
selectedDateRange: r
|
|
1024
1026
|
}
|
|
1025
1027
|
) })
|
|
1026
1028
|
] }),
|
|
1027
|
-
he && /* @__PURE__ */ e(rn, { onClose:
|
|
1029
|
+
he && /* @__PURE__ */ e(rn, { onClose: $e })
|
|
1028
1030
|
]
|
|
1029
1031
|
}
|
|
1030
1032
|
),
|