@mx-cartographer/experiences 7.0.23-alpha.al11 → 7.0.23-alpha.al12
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 +192 -190
- package/package.json +1 -1
package/dist/trends/index.es.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as e, jsxs as f, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import a from "react";
|
|
3
3
|
import { observer as A } from "mobx-react-lite";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as ae, Text as Q, CategoryIcon as Te, P as X, H3 as De, ChevronRightIcon as Ke } from "@mxenabled/mxui";
|
|
5
5
|
import O from "@mui/material/Box";
|
|
6
6
|
import _ from "@mui/material/Stack";
|
|
7
7
|
import Ce from "@mui/material/Button";
|
|
8
8
|
import { addSeconds as Ie } from "date-fns/addSeconds";
|
|
9
|
-
import { differenceInCalendarMonths as
|
|
9
|
+
import { differenceInCalendarMonths as re } from "date-fns/differenceInCalendarMonths";
|
|
10
10
|
import { a as $e, g as je, S as Ye, L as Ee, u as Ue } from "../TrendsStore-WrHxzdbQ.mjs";
|
|
11
11
|
import { T as to } from "../TrendsStore-WrHxzdbQ.mjs";
|
|
12
12
|
import { i as Xe, c as Ze, d as Qe, e as qe, f as Je, h as et, b as Le, g as xe, j as _e } from "../SpendingData-D5vsfYKo.mjs";
|
|
13
13
|
import tt from "@mui/material/ToggleButton";
|
|
14
14
|
import nt from "@mui/material/ToggleButtonGroup";
|
|
15
|
-
import { u as R, k as
|
|
16
|
-
import { u as
|
|
17
|
-
import { f as
|
|
15
|
+
import { u as R, k as K, e as N, a as $, f as ie, c as ce, v as ee, l as ve, p as ot, m as st } from "../hooks-DkUqN6JE.mjs";
|
|
16
|
+
import { u as j } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
17
|
+
import { f as q, D as B } from "../Dialog-CWW597AF.mjs";
|
|
18
18
|
import { DataGridPro as rt } from "@mui/x-data-grid-pro";
|
|
19
19
|
import { C as at } from "../CurrencyText-YUhH2caW.mjs";
|
|
20
20
|
import { c as Me } from "../Category-CevNQ03n.mjs";
|
|
@@ -24,13 +24,13 @@ import { T as M, b as ct } from "../ViewMoreMicroCard-DFAY0tA8.mjs";
|
|
|
24
24
|
import { A as y, W as Ae } from "../WidgetContainer-CdBs9WOZ.mjs";
|
|
25
25
|
import { a as Re, T as ke } from "../TransactionDetails-C-z3HGTT.mjs";
|
|
26
26
|
import { D as fe } from "../Drawer-kEE73B87.mjs";
|
|
27
|
-
import { L as
|
|
27
|
+
import { L as J } from "../Loader-DUaFpDGv.mjs";
|
|
28
28
|
import { useTheme as Ne } from "@mui/material/styles";
|
|
29
29
|
import { L as ye } from "../LineChart-BWWmmJxV.mjs";
|
|
30
30
|
import { M as lt } from "../MiniWidgetContainer-CTyjmE1h.mjs";
|
|
31
31
|
import { subMonths as dt } from "date-fns";
|
|
32
32
|
import { TrendingUp as ht, TrendingDown as ut, MultilineChart as mt, ExpandLess as gt, ExpandMore as pt } from "@mxenabled/mx-icons";
|
|
33
|
-
import { a as Ct, f as
|
|
33
|
+
import { a as Ct, f as Z } from "../NumberFormatting-CtWHhyBX.mjs";
|
|
34
34
|
import { M as ft } from "../MicroWidgetContainer-Dxz8uBN9.mjs";
|
|
35
35
|
import Tt from "@mui/material/Collapse";
|
|
36
36
|
import yt from "@mui/material/List";
|
|
@@ -52,22 +52,22 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
52
52
|
onChange: o,
|
|
53
53
|
orientation: "horizontal",
|
|
54
54
|
value: n,
|
|
55
|
-
children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(tt, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(
|
|
55
|
+
children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(tt, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(ae, { name: "table_chart_view" }) : /* @__PURE__ */ e(ae, { name: "format_list_bulleted" }) }, t))
|
|
56
56
|
}
|
|
57
57
|
), Oe = ({ selectedDateRange: n, selectedCategoryGuid: o }) => {
|
|
58
|
-
const { trends: t } = R(), { isMobile: s, isDesktop:
|
|
59
|
-
const
|
|
58
|
+
const { trends: t } = R(), { isMobile: s, isDesktop: i } = j(), { getCategoryName: h } = K(), d = a.useMemo(() => {
|
|
59
|
+
const l = q(
|
|
60
60
|
n.start,
|
|
61
61
|
s ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
|
|
62
|
-
),
|
|
62
|
+
), c = q(
|
|
63
63
|
n.end,
|
|
64
64
|
s ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
|
|
65
65
|
);
|
|
66
|
-
return `${
|
|
66
|
+
return `${l} - ${c}`;
|
|
67
67
|
}, [n, s]);
|
|
68
68
|
return /* @__PURE__ */ f(O, { sx: { mr: 10, minWidth: "60%" }, children: [
|
|
69
69
|
/* @__PURE__ */ e(
|
|
70
|
-
|
|
70
|
+
Q,
|
|
71
71
|
{
|
|
72
72
|
display: "block",
|
|
73
73
|
fontWeight: 700,
|
|
@@ -76,11 +76,11 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
76
76
|
overflow: "visible",
|
|
77
77
|
textOverflow: "unset"
|
|
78
78
|
},
|
|
79
|
-
variant:
|
|
79
|
+
variant: i ? "H3" : "Body",
|
|
80
80
|
children: h(o) || t.sub_title
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
|
-
/* @__PURE__ */ e(
|
|
83
|
+
/* @__PURE__ */ e(Q, { variant: i ? "Body" : "Small", children: d })
|
|
84
84
|
] });
|
|
85
85
|
}, At = (n) => {
|
|
86
86
|
const o = n.row[n.field];
|
|
@@ -96,7 +96,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
96
96
|
children: /* @__PURE__ */ e(Te, { categoryGuid: o })
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
|
-
/* @__PURE__ */ e(
|
|
99
|
+
/* @__PURE__ */ e(Q, { sx: { ml: 12, pb: 6 }, variant: "Small", children: s })
|
|
100
100
|
] });
|
|
101
101
|
}, kt = (n) => /* @__PURE__ */ e(_, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
|
|
102
102
|
Rt,
|
|
@@ -107,8 +107,8 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
107
107
|
) }), Nt = (n, o) => {
|
|
108
108
|
const t = [], s = new Date(n);
|
|
109
109
|
for (; s <= o; ) {
|
|
110
|
-
const
|
|
111
|
-
t.push(
|
|
110
|
+
const i = q(s, B.MONTH);
|
|
111
|
+
t.push(i), s.setMonth(s.getMonth() + 1);
|
|
112
112
|
}
|
|
113
113
|
return t;
|
|
114
114
|
}, Ve = ({
|
|
@@ -116,12 +116,12 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
116
116
|
selectedDateRange: o,
|
|
117
117
|
selectedCategory: t,
|
|
118
118
|
onClickRow: s,
|
|
119
|
-
height:
|
|
119
|
+
height: i = "100dvh",
|
|
120
120
|
sx: h = {}
|
|
121
121
|
}) => {
|
|
122
|
-
const { onEvent: d } = N(),
|
|
123
|
-
{ field:
|
|
124
|
-
]), C =
|
|
122
|
+
const { onEvent: d } = N(), l = q(/* @__PURE__ */ new Date(), B.MONTH_SHORT), [c, m] = a.useState([
|
|
123
|
+
{ field: l, sort: "desc" }
|
|
124
|
+
]), C = a.useMemo(() => Nt(o.start, o.end), [o]), u = [
|
|
125
125
|
{
|
|
126
126
|
field: "category",
|
|
127
127
|
flex: 1,
|
|
@@ -148,35 +148,35 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
148
148
|
sortComparator: $e
|
|
149
149
|
})
|
|
150
150
|
)
|
|
151
|
-
], b =
|
|
151
|
+
], b = a.useMemo(() => {
|
|
152
152
|
const r = n.filter(
|
|
153
153
|
(p) => !Xe(p) && !Ze(p)
|
|
154
154
|
), T = (t ? r.filter(
|
|
155
155
|
(p) => p.category_guid === t || p.top_level_category_guid === t
|
|
156
156
|
) : r).reduce(
|
|
157
|
-
(p,
|
|
158
|
-
const { category_guid:
|
|
157
|
+
(p, w) => {
|
|
158
|
+
const { category_guid: D, top_level_category_guid: E, month: k, total: I, year: H } = w, L = t ? D : E;
|
|
159
159
|
p[L] || (p[L] = {
|
|
160
160
|
id: L,
|
|
161
161
|
category: L,
|
|
162
|
-
category_guid:
|
|
162
|
+
category_guid: D,
|
|
163
163
|
top_level_category_guid: E
|
|
164
164
|
});
|
|
165
|
-
const x =
|
|
166
|
-
return p[L][x] || (p[L][x] = 0), p[L][x] = p[L][x] + Math.abs(
|
|
165
|
+
const x = q(new Date(H, k - 1), B.MONTH_SHORT);
|
|
166
|
+
return p[L][x] || (p[L][x] = 0), p[L][x] = p[L][x] + Math.abs(I), p;
|
|
167
167
|
},
|
|
168
168
|
{}
|
|
169
169
|
);
|
|
170
170
|
return Object.values(T);
|
|
171
171
|
}, [n, t]);
|
|
172
|
-
return /* @__PURE__ */ e(O, { sx: { height:
|
|
172
|
+
return /* @__PURE__ */ e(O, { sx: { height: i, width: "100%", overflowX: "auto", boxShadow: "none", ...h }, children: /* @__PURE__ */ e(
|
|
173
173
|
rt,
|
|
174
174
|
{
|
|
175
175
|
columns: u,
|
|
176
176
|
disableColumnFilter: !0,
|
|
177
177
|
disableColumnMenu: !0,
|
|
178
178
|
hideFooter: !0,
|
|
179
|
-
initialState: { sorting: { sortModel:
|
|
179
|
+
initialState: { sorting: { sortModel: c } },
|
|
180
180
|
onRowClick: (r) => {
|
|
181
181
|
s?.(r.row.category), d(y.TRENDS_CLICK_LIST_ITEM, {
|
|
182
182
|
...M,
|
|
@@ -188,7 +188,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
188
188
|
},
|
|
189
189
|
rows: b,
|
|
190
190
|
slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
|
|
191
|
-
sortModel:
|
|
191
|
+
sortModel: c,
|
|
192
192
|
sortingOrder: ["asc", "desc"]
|
|
193
193
|
}
|
|
194
194
|
) });
|
|
@@ -200,18 +200,18 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
200
200
|
isOpen: t,
|
|
201
201
|
onClose: s
|
|
202
202
|
}) => {
|
|
203
|
-
const { onEvent:
|
|
204
|
-
() =>
|
|
205
|
-
[m,
|
|
203
|
+
const { onEvent: i } = N(), { selectedAccountGuids: h } = $(), { common: d } = R(), { setFilter: l, sortedTransactions: c } = ie(), [m, C] = a.useState(""), u = a.useMemo(
|
|
204
|
+
() => c.find((r) => r.guid === m),
|
|
205
|
+
[m, c]
|
|
206
206
|
);
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
a.useEffect(() => {
|
|
208
|
+
l({
|
|
209
209
|
accounts: h,
|
|
210
210
|
dateRange: o,
|
|
211
211
|
custom: (r) => n === "" || n === r.category_guid || n === r.top_level_category_guid,
|
|
212
212
|
showSplits: !!n
|
|
213
213
|
});
|
|
214
|
-
}, [h, n, o]),
|
|
214
|
+
}, [h, n, o]), a.useEffect(() => i(y.TRENDS_VIEW_TRANSACTIONS), []);
|
|
215
215
|
const b = () => {
|
|
216
216
|
C(""), s();
|
|
217
217
|
};
|
|
@@ -229,14 +229,14 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
229
229
|
}
|
|
230
230
|
);
|
|
231
231
|
}, Ot = A(Wt), Vt = ({ onBackClick: n, sx: o }) => {
|
|
232
|
-
const { onEvent: t } = N(), { isDesktop: s, isTablet:
|
|
233
|
-
|
|
234
|
-
const S = () =>
|
|
232
|
+
const { onEvent: t } = N(), { isDesktop: s, isTablet: i, isMobile: h } = j(), { visibleAccounts: d } = ce(), { loadMonthlyCategoryTotals: l, monthlyCategoryTotals: c, getCategoryName: m } = K(), { sortedTransactions: C } = ie(), { selectedDateRange: u, setSelectedDateRange: b } = ee(), { isCopyLoaded: r, isInitialized: g, selectedAccounts: T, setSelectedAccounts: p } = $(), { trends: w } = R(), [D, E] = a.useState(!1), [k, I] = a.useState(!1), [H, L] = a.useState("Chart"), [x, z] = a.useState(""), [le, F] = a.useState(window.innerHeight), de = le - (h ? 315 : 345);
|
|
233
|
+
a.useEffect(() => {
|
|
234
|
+
const S = () => F(window.innerHeight);
|
|
235
235
|
return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
|
|
236
|
-
}, []),
|
|
236
|
+
}, []), a.useEffect(() => {
|
|
237
237
|
p(d);
|
|
238
|
-
}, [d]),
|
|
239
|
-
g &&
|
|
238
|
+
}, [d]), a.useEffect(() => {
|
|
239
|
+
g && l(
|
|
240
240
|
T,
|
|
241
241
|
u.start,
|
|
242
242
|
u.end
|
|
@@ -244,10 +244,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
244
244
|
E(!0);
|
|
245
245
|
});
|
|
246
246
|
}, [g, T, u]);
|
|
247
|
-
const
|
|
248
|
-
if (!
|
|
247
|
+
const P = a.useMemo(() => {
|
|
248
|
+
if (!D) return { stackedDatasets: [], unstackedDatasets: [] };
|
|
249
249
|
const S = je(
|
|
250
|
-
|
|
250
|
+
c,
|
|
251
251
|
u.start,
|
|
252
252
|
u.end
|
|
253
253
|
), W = x.length ? S.filter(
|
|
@@ -257,44 +257,44 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
257
257
|
stackedDatasets: W.filter(qe),
|
|
258
258
|
unstackedDatasets: W.filter(Je)
|
|
259
259
|
};
|
|
260
|
-
}, [
|
|
260
|
+
}, [c, x, u]), te = (S, W) => {
|
|
261
261
|
L(W ?? H), t(y.TRENDS_CLICK_TOGGLE_VIEW);
|
|
262
262
|
}, he = (S) => {
|
|
263
|
-
const W = Ie(S?.[0], 1), G = S?.[1], pe =
|
|
263
|
+
const W = Ie(S?.[0], 1), G = S?.[1], pe = re(G, W);
|
|
264
264
|
b({ start: W, end: G }), t(y.TRENDS_CLICK_TIME_WINDOW, {
|
|
265
265
|
time_period: pe + "M"
|
|
266
266
|
});
|
|
267
|
-
},
|
|
267
|
+
}, ne = () => {
|
|
268
268
|
t(y.TRENDS_CLICK_FILTER);
|
|
269
|
-
},
|
|
269
|
+
}, oe = (S) => {
|
|
270
270
|
z(S);
|
|
271
271
|
}, ue = (S) => {
|
|
272
272
|
z(S), t(y.TRENDS_CLICK_LEGEND, { category: m(S) });
|
|
273
|
-
},
|
|
273
|
+
}, se = (S) => {
|
|
274
274
|
t(y.TRENDS_HOVER_LEGEND, { category: m(S) });
|
|
275
275
|
}, me = (S) => {
|
|
276
276
|
t(y.TRENDS_HOVER_AREA, { category: S });
|
|
277
277
|
}, ge = (S) => {
|
|
278
278
|
t(y.TRENDS_HOVER_POINT, { category: S });
|
|
279
279
|
};
|
|
280
|
-
return !r || !g || !
|
|
280
|
+
return !r || !g || !D ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ f(
|
|
281
281
|
Ae,
|
|
282
282
|
{
|
|
283
283
|
accountOptions: d,
|
|
284
284
|
calendarActions: { onRangeChanged: he },
|
|
285
285
|
dateRange: u,
|
|
286
286
|
dateRangeVariant: "timeframebuttons",
|
|
287
|
-
onAccountsFilterClick:
|
|
287
|
+
onAccountsFilterClick: ne,
|
|
288
288
|
onBackClick: n,
|
|
289
289
|
sx: o,
|
|
290
|
-
title:
|
|
290
|
+
title: w.title,
|
|
291
291
|
children: [
|
|
292
292
|
/* @__PURE__ */ f(
|
|
293
293
|
_,
|
|
294
294
|
{
|
|
295
295
|
sx: {
|
|
296
296
|
// eslint-disable-next-line no-nested-ternary
|
|
297
|
-
px: s ? 48 :
|
|
297
|
+
px: s ? 48 : i ? 24 : 12
|
|
298
298
|
},
|
|
299
299
|
children: [
|
|
300
300
|
/* @__PURE__ */ f(
|
|
@@ -311,16 +311,16 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
311
311
|
selectedDateRange: u
|
|
312
312
|
}
|
|
313
313
|
),
|
|
314
|
-
/* @__PURE__ */ e(We, { onTabChange:
|
|
314
|
+
/* @__PURE__ */ e(We, { onTabChange: te, selectedTab: H })
|
|
315
315
|
]
|
|
316
316
|
}
|
|
317
317
|
),
|
|
318
318
|
/* @__PURE__ */ f(_, { alignItems: "center", flexDirection: "row", width: "100%", children: [
|
|
319
319
|
/* @__PURE__ */ e(O, { flexGrow: 1, children: x && /* @__PURE__ */ f(Ce, { onClick: () => z(""), sx: { p: 0, pr: 5 }, children: [
|
|
320
|
-
/* @__PURE__ */ e(
|
|
321
|
-
|
|
320
|
+
/* @__PURE__ */ e(ae, { name: "arrow_back" }),
|
|
321
|
+
w.all_categories
|
|
322
322
|
] }) }),
|
|
323
|
-
/* @__PURE__ */ e(Ce, { onClick: () =>
|
|
323
|
+
/* @__PURE__ */ e(Ce, { onClick: () => I(!0), sx: { px: 5 }, children: `${w.view_transactions} (${C.length})` })
|
|
324
324
|
] }),
|
|
325
325
|
/* @__PURE__ */ f(O, { children: [
|
|
326
326
|
H === "Chart" && /* @__PURE__ */ e(
|
|
@@ -329,17 +329,17 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
329
329
|
availableHeight: de,
|
|
330
330
|
onClickLegend: ue,
|
|
331
331
|
onHoverArea: me,
|
|
332
|
-
onHoverLegend:
|
|
332
|
+
onHoverLegend: se,
|
|
333
333
|
onHoverPoint: ge,
|
|
334
|
-
stackedDatasets:
|
|
335
|
-
unstackedDatasets:
|
|
334
|
+
stackedDatasets: P.stackedDatasets,
|
|
335
|
+
unstackedDatasets: P.unstackedDatasets
|
|
336
336
|
}
|
|
337
337
|
),
|
|
338
338
|
H === "Table" && /* @__PURE__ */ e(
|
|
339
339
|
Ve,
|
|
340
340
|
{
|
|
341
|
-
monthlyCategoryTotals:
|
|
342
|
-
onClickRow:
|
|
341
|
+
monthlyCategoryTotals: c,
|
|
342
|
+
onClickRow: oe,
|
|
343
343
|
selectedCategory: x,
|
|
344
344
|
selectedDateRange: u
|
|
345
345
|
}
|
|
@@ -354,14 +354,14 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
354
354
|
categoryGuid: x,
|
|
355
355
|
dateRange: u,
|
|
356
356
|
isOpen: k,
|
|
357
|
-
onClose: () =>
|
|
357
|
+
onClose: () => I(!1)
|
|
358
358
|
}
|
|
359
359
|
)
|
|
360
360
|
]
|
|
361
361
|
}
|
|
362
362
|
);
|
|
363
363
|
}, Xn = A(Vt), Gt = () => {
|
|
364
|
-
const n = Ne(), { monthlyCategoryTotals: o } =
|
|
364
|
+
const n = Ne(), { monthlyCategoryTotals: o } = K(), { trends: t } = R(), s = et(o);
|
|
365
365
|
return /* @__PURE__ */ e(
|
|
366
366
|
ye,
|
|
367
367
|
{
|
|
@@ -379,12 +379,12 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
379
379
|
}
|
|
380
380
|
);
|
|
381
381
|
}, Bt = A(Gt), zt = ({ onPrimaryCtaClick: n, sx: o }) => {
|
|
382
|
-
const { visibleAccounts: t } =
|
|
383
|
-
return
|
|
382
|
+
const { visibleAccounts: t } = ce(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: i } = K(), { isInitialized: h } = ve(), { trends: d } = R(), { isCopyLoaded: l, selectedAccounts: c, setSelectedAccounts: m } = $();
|
|
383
|
+
return a.useEffect(() => {
|
|
384
384
|
m(t);
|
|
385
|
-
}, [t]),
|
|
386
|
-
h && s(
|
|
387
|
-
}, [h,
|
|
385
|
+
}, [t]), a.useEffect(() => {
|
|
386
|
+
h && s(c).finally();
|
|
387
|
+
}, [h, c]), !l || !h ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
|
|
388
388
|
lt,
|
|
389
389
|
{
|
|
390
390
|
onPrimaryCtaClick: n,
|
|
@@ -392,7 +392,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
392
392
|
subTitle: d.sub_title,
|
|
393
393
|
sx: o,
|
|
394
394
|
title: d.mini_title,
|
|
395
|
-
children:
|
|
395
|
+
children: i ? /* @__PURE__ */ e(Bt, {}) : /* @__PURE__ */ e(J, {})
|
|
396
396
|
}
|
|
397
397
|
);
|
|
398
398
|
}, Zn = A(zt), Ft = 70, Se = ({
|
|
@@ -400,13 +400,13 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
400
400
|
totalAmount: o,
|
|
401
401
|
transactionType: t,
|
|
402
402
|
percentage: s,
|
|
403
|
-
secondaryLabel:
|
|
403
|
+
secondaryLabel: i,
|
|
404
404
|
shouldDisplayPercentage: h
|
|
405
405
|
}) => {
|
|
406
|
-
const { availableWidth: d } = ot(),
|
|
406
|
+
const { availableWidth: d } = ot(), l = a.useRef(null), c = a.useRef(null), m = Ct(Number(Math.abs(s)), {
|
|
407
407
|
style: "percent",
|
|
408
408
|
minimumIntegerDigits: 1
|
|
409
|
-
}), C = d === 288 &&
|
|
409
|
+
}), C = d === 288 && Z(o, "0,0.00").length > 10 ? Z(o, "0,0") : Z(o, "0,0.00"), u = t === "spending" ? s > 0 : s >= 0, b = t === "spending" ? "error.main" : "success.main", r = t === "spending" ? "success.main" : "text.secondary", g = l?.current, T = c?.current, p = g && T ? g.scrollWidth > T.clientWidth - Ft : !1;
|
|
410
410
|
return /* @__PURE__ */ f(
|
|
411
411
|
_,
|
|
412
412
|
{
|
|
@@ -429,11 +429,11 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
429
429
|
justifyContent: "space-between"
|
|
430
430
|
},
|
|
431
431
|
children: [
|
|
432
|
-
/* @__PURE__ */ e(
|
|
432
|
+
/* @__PURE__ */ e(X, { color: "text.secondary", variant: "caption", children: n }),
|
|
433
433
|
h && /* @__PURE__ */ f(_, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
|
|
434
434
|
u ? /* @__PURE__ */ e(ht, { size: 20, sx: { color: b } }) : /* @__PURE__ */ e(ut, { size: 20, sx: { color: r } }),
|
|
435
435
|
/* @__PURE__ */ e(
|
|
436
|
-
|
|
436
|
+
X,
|
|
437
437
|
{
|
|
438
438
|
sx: {
|
|
439
439
|
color: u ? b : r,
|
|
@@ -450,7 +450,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
450
450
|
/* @__PURE__ */ f(
|
|
451
451
|
_,
|
|
452
452
|
{
|
|
453
|
-
ref:
|
|
453
|
+
ref: c,
|
|
454
454
|
sx: {
|
|
455
455
|
alignItems: "center",
|
|
456
456
|
flexDirection: "row",
|
|
@@ -460,17 +460,17 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
460
460
|
/* @__PURE__ */ e(
|
|
461
461
|
O,
|
|
462
462
|
{
|
|
463
|
-
ref:
|
|
463
|
+
ref: l,
|
|
464
464
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
465
465
|
children: /* @__PURE__ */ e(De, { children: C })
|
|
466
466
|
}
|
|
467
467
|
),
|
|
468
468
|
h && d >= 450 && !p && /* @__PURE__ */ e(
|
|
469
|
-
|
|
469
|
+
X,
|
|
470
470
|
{
|
|
471
471
|
color: u ? b : r,
|
|
472
472
|
variant: "caption",
|
|
473
|
-
children:
|
|
473
|
+
children: i
|
|
474
474
|
}
|
|
475
475
|
)
|
|
476
476
|
]
|
|
@@ -484,43 +484,43 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
484
484
|
return /* @__PURE__ */ f(_, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
|
|
485
485
|
/* @__PURE__ */ e(mt, { size: 32 }),
|
|
486
486
|
/* @__PURE__ */ f(_, { children: [
|
|
487
|
-
/* @__PURE__ */ e(
|
|
488
|
-
/* @__PURE__ */ e(
|
|
487
|
+
/* @__PURE__ */ e(X, { fontWeight: 600, variant: "body1", children: n.zero_state_content_header }),
|
|
488
|
+
/* @__PURE__ */ e(X, { color: "text.secondary", variant: "subtitle2", children: n.zero_state_content_description })
|
|
489
489
|
] })
|
|
490
490
|
] });
|
|
491
491
|
}), Qn = A(({ onCtaClick: n }) => {
|
|
492
|
-
const { visibleAccounts: o } =
|
|
492
|
+
const { visibleAccounts: o } = ce(), { onEvent: t } = N(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: i, monthlyTotalsLoaded: h } = K(), d = {
|
|
493
493
|
start: dt(/* @__PURE__ */ new Date(), 1),
|
|
494
494
|
end: /* @__PURE__ */ new Date()
|
|
495
|
-
}, { trends:
|
|
496
|
-
|
|
495
|
+
}, { trends: l } = R(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: C } = $();
|
|
496
|
+
a.useEffect(() => {
|
|
497
497
|
m(o);
|
|
498
|
-
}, [o]),
|
|
499
|
-
C &&
|
|
498
|
+
}, [o]), a.useEffect(() => {
|
|
499
|
+
C && i(c, d.start).then(() => {
|
|
500
500
|
t(y.TRENDS_LOAD_WIDGET, {
|
|
501
501
|
state: o?.length ? "default" : "zeroState"
|
|
502
502
|
});
|
|
503
503
|
});
|
|
504
|
-
}, [C,
|
|
505
|
-
const { spendingData: u, incomeData: b } =
|
|
504
|
+
}, [C, c]);
|
|
505
|
+
const { spendingData: u, incomeData: b } = a.useMemo(
|
|
506
506
|
() => ({
|
|
507
507
|
spendingData: Le(s, d),
|
|
508
508
|
incomeData: xe(s, d)
|
|
509
509
|
}),
|
|
510
510
|
[s, d]
|
|
511
|
-
), [r, g] = u, [T, p] = b,
|
|
511
|
+
), [r, g] = u, [T, p] = b, w = _e(g.y, r.y), D = _e(p.y, T.y), E = C && !o?.length, k = () => {
|
|
512
512
|
t(
|
|
513
513
|
E ? y.TRENDS_CLICK_GET_STARTED : y.TRENDS_CLICK_VIEW_MORE
|
|
514
514
|
), n();
|
|
515
515
|
};
|
|
516
|
-
return !h || !C ? /* @__PURE__ */ e(
|
|
516
|
+
return !h || !C ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
|
|
517
517
|
ft,
|
|
518
518
|
{
|
|
519
519
|
className: "mx-trends-microwidget",
|
|
520
|
-
ctaLabel:
|
|
520
|
+
ctaLabel: l.micro_primary_cta_label,
|
|
521
521
|
onCTAClick: k,
|
|
522
|
-
subHeader: E ? void 0 :
|
|
523
|
-
title:
|
|
522
|
+
subHeader: E ? void 0 : l.micro_subheader,
|
|
523
|
+
title: l.title,
|
|
524
524
|
children: E ? /* @__PURE__ */ e(Pt, {}) : /* @__PURE__ */ f(
|
|
525
525
|
_,
|
|
526
526
|
{
|
|
@@ -533,10 +533,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
533
533
|
/* @__PURE__ */ e(
|
|
534
534
|
Se,
|
|
535
535
|
{
|
|
536
|
-
percentage:
|
|
537
|
-
secondaryLabel:
|
|
536
|
+
percentage: w,
|
|
537
|
+
secondaryLabel: l.micro_secondary_label,
|
|
538
538
|
shouldDisplayPercentage: g.y !== 0 && r.y !== 0,
|
|
539
|
-
title:
|
|
539
|
+
title: l.spending_label,
|
|
540
540
|
totalAmount: g.y,
|
|
541
541
|
transactionType: "spending"
|
|
542
542
|
}
|
|
@@ -544,10 +544,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
544
544
|
/* @__PURE__ */ e(
|
|
545
545
|
Se,
|
|
546
546
|
{
|
|
547
|
-
percentage:
|
|
548
|
-
secondaryLabel:
|
|
547
|
+
percentage: D,
|
|
548
|
+
secondaryLabel: l.micro_secondary_label,
|
|
549
549
|
shouldDisplayPercentage: p.y !== 0 && T.y !== 0,
|
|
550
|
-
title:
|
|
550
|
+
title: l.income_label,
|
|
551
551
|
totalAmount: p.y,
|
|
552
552
|
transactionType: "income"
|
|
553
553
|
}
|
|
@@ -565,7 +565,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
565
565
|
{
|
|
566
566
|
sx: { color: t.palette.primary.main, flexDirection: "row", alignItems: "center" },
|
|
567
567
|
children: [
|
|
568
|
-
/* @__PURE__ */ e(wt, { children: /* @__PURE__ */ e(
|
|
568
|
+
/* @__PURE__ */ e(wt, { children: /* @__PURE__ */ e(Q, { bold: !0, variant: "body2", children: n ? "View less" : "View more" }) }),
|
|
569
569
|
/* @__PURE__ */ e(St, { sx: { color: t.palette.primary.main }, children: n ? /* @__PURE__ */ e(gt, {}) : /* @__PURE__ */ e(
|
|
570
570
|
pt,
|
|
571
571
|
{
|
|
@@ -585,24 +585,24 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
585
585
|
guid: o,
|
|
586
586
|
name: t,
|
|
587
587
|
transactions: s,
|
|
588
|
-
onClick:
|
|
588
|
+
onClick: i,
|
|
589
589
|
isLastItem: h = !1,
|
|
590
590
|
showDivider: d = !0
|
|
591
591
|
}) => {
|
|
592
|
-
const { trends:
|
|
593
|
-
|
|
592
|
+
const { trends: l } = R(), { onEvent: c } = N(), m = `${s.length} ${s.length === 1 ? l.transaction : l.transactions}`, C = () => {
|
|
593
|
+
i?.(), c(y.TRENDS_CLICK_LIST_ITEM, {
|
|
594
594
|
...M,
|
|
595
595
|
listItem: t
|
|
596
596
|
});
|
|
597
597
|
};
|
|
598
|
-
return /* @__PURE__ */ f(
|
|
598
|
+
return /* @__PURE__ */ f(a.Fragment, { children: [
|
|
599
599
|
/* @__PURE__ */ e(
|
|
600
600
|
Ee,
|
|
601
601
|
{
|
|
602
602
|
leftIcon: o ? /* @__PURE__ */ e(Te, { categoryGuid: o }) : void 0,
|
|
603
603
|
onClick: C,
|
|
604
|
-
rightContent:
|
|
605
|
-
rightIcon:
|
|
604
|
+
rightContent: Z(Math.abs(n), "0,0.00"),
|
|
605
|
+
rightIcon: i ? /* @__PURE__ */ e(Ke, {}) : void 0,
|
|
606
606
|
subtitle: m,
|
|
607
607
|
title: t
|
|
608
608
|
}
|
|
@@ -612,18 +612,18 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
612
612
|
}
|
|
613
613
|
), $t = A(
|
|
614
614
|
({ availableHeight: n = 0, onCategoryClick: o }) => {
|
|
615
|
-
const { collapsedCategories: t, visibleCategories: s, setVisibleListLength:
|
|
616
|
-
|
|
615
|
+
const { collapsedCategories: t, visibleCategories: s, setVisibleListLength: i } = ee(), { isLargeDesktop: h, isDesktop: d } = j(), { trends: l } = R(), { onEvent: c } = N(), [m, C] = a.useState(!1), u = d || h;
|
|
616
|
+
a.useEffect(() => {
|
|
617
617
|
const g = Math.floor(n / 64) - 1, T = s.length + t.length;
|
|
618
|
-
g !== s.length && (
|
|
618
|
+
g !== s.length && (i(u ? Math.max(g, 5) : 5), C(g >= T));
|
|
619
619
|
}, [n]);
|
|
620
620
|
const b = () => {
|
|
621
|
-
C(!m),
|
|
621
|
+
C(!m), c(y.TRENDS_CLICK_VIEW_MORE, {
|
|
622
622
|
...M
|
|
623
623
|
});
|
|
624
624
|
}, r = s.length + (m ? t.length : 0);
|
|
625
625
|
return /* @__PURE__ */ e(_, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(yt, { children: [
|
|
626
|
-
/* @__PURE__ */ e(_, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(De, { children:
|
|
626
|
+
/* @__PURE__ */ e(_, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(De, { children: l.categories }) }),
|
|
627
627
|
s.map((g, T) => /* @__PURE__ */ e(
|
|
628
628
|
we,
|
|
629
629
|
{
|
|
@@ -692,28 +692,28 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
692
692
|
"WeeklyNoSpendDays",
|
|
693
693
|
"WeeklySmallPurchasesSummary"
|
|
694
694
|
], Yt = ({ onInsightCardClick: n }) => {
|
|
695
|
-
const o = It(), { onEvent: t } = N(), { isMobile: s, isDesktop:
|
|
696
|
-
|
|
695
|
+
const o = It(), { onEvent: t } = N(), { isMobile: s, isDesktop: i, isLargeDesktop: h } = j(), { beatStore: d, endpoint: l, sessionToken: c } = ve(), { isInitialized: m } = $(), [C, u] = a.useState(!1), b = o.palette.mode === "dark", r = i || h, g = r || s ? 1 : 2;
|
|
696
|
+
a.useEffect(() => {
|
|
697
697
|
m && d.loadBeats().finally(() => u(!0));
|
|
698
698
|
}, [m]);
|
|
699
|
-
const T =
|
|
700
|
-
n?.(
|
|
701
|
-
},
|
|
699
|
+
const T = a.useMemo(() => C ? d.getFilteredBeats({ templates: jt }) : [], [C]), p = () => null, w = (I) => {
|
|
700
|
+
n?.(I), t(y.TRENDS_CLICK_INSIGHT, M);
|
|
701
|
+
}, D = r ? 200 : 170, E = r ? 170 : 124, k = T.length > 0 ? D : E;
|
|
702
702
|
return /* @__PURE__ */ e(Et, { sx: { height: k }, children: /* @__PURE__ */ e(
|
|
703
703
|
ct,
|
|
704
704
|
{
|
|
705
705
|
areBeatsLoading: d.isLoading,
|
|
706
706
|
beats: T,
|
|
707
|
-
endpoint:
|
|
707
|
+
endpoint: l,
|
|
708
708
|
logOutUser: p,
|
|
709
|
-
onCardClick:
|
|
709
|
+
onCardClick: w,
|
|
710
710
|
showBorder: !0,
|
|
711
711
|
showCTAColocatedWithText: !1,
|
|
712
712
|
showCarouselControls: !0,
|
|
713
713
|
showHeader: r,
|
|
714
714
|
showIcon: !0,
|
|
715
715
|
showWithMargin: !1,
|
|
716
|
-
token:
|
|
716
|
+
token: c,
|
|
717
717
|
useDarkMode: b,
|
|
718
718
|
userHasFullInsightFeedBeats: !1,
|
|
719
719
|
variant: "outlined",
|
|
@@ -722,15 +722,15 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
722
722
|
) });
|
|
723
723
|
}, Ut = A(Yt), Xt = A(({ chartLabel: n, chartColor: o }) => {
|
|
724
724
|
const { onEvent: t } = N(), {
|
|
725
|
-
categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels:
|
|
726
|
-
} =
|
|
725
|
+
categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels: i }
|
|
726
|
+
} = ee();
|
|
727
727
|
return /* @__PURE__ */ e(_, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
|
|
728
728
|
ye,
|
|
729
729
|
{
|
|
730
730
|
baseline: "min",
|
|
731
731
|
colors: [o],
|
|
732
732
|
curveType: "bump",
|
|
733
|
-
customTooltipLabels:
|
|
733
|
+
customTooltipLabels: i,
|
|
734
734
|
datasets: [s],
|
|
735
735
|
height: 265,
|
|
736
736
|
labels: [n],
|
|
@@ -754,19 +754,19 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
754
754
|
}
|
|
755
755
|
) });
|
|
756
756
|
}), Zt = A(({ onClose: n }) => {
|
|
757
|
-
const o = He(), { onEvent: t } = N(), { common: s, trends:
|
|
757
|
+
const o = He(), { onEvent: t } = N(), { common: s, trends: i } = R(), { selectedCategoryData: h, selectedDateRangeMonthRange: d } = ee(), { sortedTransactions: l } = ie(), [c, m] = a.useState(null);
|
|
758
758
|
if (!h)
|
|
759
759
|
return null;
|
|
760
|
-
const { guid: C, name: u, is_income: b, totalAmount: r } = h, g = b ?
|
|
761
|
-
() =>
|
|
762
|
-
[
|
|
763
|
-
), E = (
|
|
760
|
+
const { guid: C, name: u, is_income: b, totalAmount: r } = h, g = b ? i.category_income : i.category_spending, T = xt(C, o), p = b ? i.income_label : i.spending_label, w = ` ${h.transactions.length === 1 ? i.transaction : i.transactions} (${h.transactions.length})`, D = a.useMemo(
|
|
761
|
+
() => l.find((I) => I.guid === c),
|
|
762
|
+
[c, l]
|
|
763
|
+
), E = (I) => I.category_guid === C || I.top_level_category_guid === C, k = () => {
|
|
764
764
|
n?.(), t(y.TRENDS_CLICK_BACK, M);
|
|
765
765
|
};
|
|
766
766
|
return /* @__PURE__ */ f(
|
|
767
767
|
fe,
|
|
768
768
|
{
|
|
769
|
-
ariaLabelClose:
|
|
769
|
+
ariaLabelClose: i.close_category_details,
|
|
770
770
|
isOpen: !0,
|
|
771
771
|
onClose: k,
|
|
772
772
|
shouldShowHeaderShadow: !0,
|
|
@@ -778,14 +778,14 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
778
778
|
Ee,
|
|
779
779
|
{
|
|
780
780
|
leftIcon: /* @__PURE__ */ e(Te, { categoryGuid: C }),
|
|
781
|
-
rightContent:
|
|
781
|
+
rightContent: Z(Math.abs(r), "0,0.00"),
|
|
782
782
|
subtitle: d,
|
|
783
783
|
title: u
|
|
784
784
|
}
|
|
785
785
|
),
|
|
786
786
|
/* @__PURE__ */ e(Xt, { chartColor: T, chartLabel: p }),
|
|
787
787
|
/* @__PURE__ */ f(_, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
|
|
788
|
-
/* @__PURE__ */ e(
|
|
788
|
+
/* @__PURE__ */ e(Q, { bold: !0, variant: "body1", children: w }),
|
|
789
789
|
/* @__PURE__ */ e(vt, { filter: E })
|
|
790
790
|
] })
|
|
791
791
|
] }),
|
|
@@ -803,10 +803,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
803
803
|
fe,
|
|
804
804
|
{
|
|
805
805
|
ariaLabelClose: s.close_aria,
|
|
806
|
-
isOpen: !!
|
|
806
|
+
isOpen: !!D,
|
|
807
807
|
onClose: () => m(""),
|
|
808
|
-
title:
|
|
809
|
-
children:
|
|
808
|
+
title: i.transaction,
|
|
809
|
+
children: D && /* @__PURE__ */ e(Re, { transaction: D })
|
|
810
810
|
}
|
|
811
811
|
)
|
|
812
812
|
]
|
|
@@ -814,16 +814,16 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
814
814
|
);
|
|
815
815
|
}), Qt = (n, o) => {
|
|
816
816
|
const t = xe(n, o), s = Le(n, o);
|
|
817
|
-
return [t, s].filter((
|
|
817
|
+
return [t, s].filter((i) => i.length > 0);
|
|
818
818
|
}, qt = (n, o) => {
|
|
819
|
-
const [t, s] = n,
|
|
820
|
-
if (
|
|
821
|
-
const
|
|
822
|
-
d.push({ label: o.income_label, amount:
|
|
819
|
+
const [t, s] = n, i = t, h = s ?? t, d = [];
|
|
820
|
+
if (i) {
|
|
821
|
+
const l = i.reduce((c, m) => c + m.y, 0);
|
|
822
|
+
d.push({ label: o.income_label, amount: l });
|
|
823
823
|
}
|
|
824
824
|
if (h) {
|
|
825
|
-
const
|
|
826
|
-
d.push({ label: o.spending_label, amount:
|
|
825
|
+
const l = h.reduce((c, m) => c + m.y, 0);
|
|
826
|
+
d.push({ label: o.spending_label, amount: l });
|
|
827
827
|
}
|
|
828
828
|
return d;
|
|
829
829
|
}, Jt = ({
|
|
@@ -832,10 +832,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
832
832
|
selectedDateRange: t,
|
|
833
833
|
totals: s
|
|
834
834
|
}) => {
|
|
835
|
-
const
|
|
836
|
-
return
|
|
837
|
-
const
|
|
838
|
-
T(
|
|
835
|
+
const i = Ne(), { onEvent: h } = N(), { trends: d } = R(), { isSmallMobile: l, isMobile: c, isSmallTablet: m, isTablet: C } = j(), u = [i.palette.chart?.chart1, i.palette.chart?.chart2], b = Qt(s, t), r = qt(b, d), [g, T] = a.useState(0), p = 458, w = 195, D = 56, E = c || l ? w : m || C ? p : g;
|
|
836
|
+
return a.useEffect(() => {
|
|
837
|
+
const I = Math.max(n - D, o);
|
|
838
|
+
T(I);
|
|
839
839
|
}, [n]), /* @__PURE__ */ e(
|
|
840
840
|
ye,
|
|
841
841
|
{
|
|
@@ -860,35 +860,37 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
860
860
|
}
|
|
861
861
|
);
|
|
862
862
|
}, en = A(Jt), tn = ({ onBackClick: n, onInsightCardClick: o, sx: t }) => {
|
|
863
|
-
const { onEvent: s } = N(), { config:
|
|
863
|
+
const { onEvent: s } = N(), { config: i } = st(), { isLargeDesktop: h, isDesktop: d, isMobile: l } = j(), { visibleAccounts: c } = ce(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: C, monthlyCategoryTotals: u } = K(), { setFilter: b } = ie(), { selectedDateRange: r, setSelectedCategoryData: g, setSelectedDateRange: T } = ee(), {
|
|
864
864
|
isCopyLoaded: p,
|
|
865
|
-
isInitialized:
|
|
866
|
-
selectedAccounts:
|
|
865
|
+
isInitialized: w,
|
|
866
|
+
selectedAccounts: D,
|
|
867
867
|
selectedAccountGuids: E,
|
|
868
868
|
setSelectedAccounts: k
|
|
869
|
-
} =
|
|
870
|
-
|
|
869
|
+
} = $(), { trends: I } = R(), H = Ue(), L = d || h, [x, z] = a.useState(!1), [le, F] = a.useState(!1), [Y, de] = a.useState("Chart"), [P, te] = a.useState(""), [he, ne] = a.useState(!1), [oe, ue] = a.useState(window.innerHeight), se = oe - 208, me = oe - (H ? 494 : 266);
|
|
870
|
+
a.useEffect(() => {
|
|
871
871
|
const v = () => ue(window.innerHeight);
|
|
872
872
|
return window.addEventListener("resize", v), () => window.removeEventListener("resize", v);
|
|
873
|
-
}, []),
|
|
874
|
-
k(
|
|
875
|
-
}, [
|
|
876
|
-
|
|
873
|
+
}, []), a.useEffect(() => {
|
|
874
|
+
k(c);
|
|
875
|
+
}, [c]), a.useEffect(() => {
|
|
876
|
+
w && c?.length ? (F(!1), m(D, r.start, r.end).then(() => {
|
|
877
877
|
C(
|
|
878
|
-
|
|
878
|
+
D,
|
|
879
879
|
r.start,
|
|
880
880
|
r.end
|
|
881
881
|
);
|
|
882
882
|
}).finally(() => {
|
|
883
883
|
z(!0), s(y.TRENDS_LOAD_WIDGET, {
|
|
884
884
|
...M,
|
|
885
|
-
time_period: `${
|
|
885
|
+
time_period: `${re(r.end, r.start)}M`
|
|
886
886
|
});
|
|
887
|
-
}) :
|
|
887
|
+
})) : w && !c?.length && (F(!0), z(!0), s(y.TRENDS_LOAD_WIDGET, {
|
|
888
888
|
...M,
|
|
889
|
-
time_period: `${
|
|
889
|
+
time_period: `${re(r.end, r.start)}M`
|
|
890
890
|
}));
|
|
891
|
-
}, [
|
|
891
|
+
}, [w, D, r]), a.useEffect(() => {
|
|
892
|
+
w && !c?.length ? F(!0) : c?.length && F(!1);
|
|
893
|
+
}, [w, c]), a.useEffect(() => {
|
|
892
894
|
if (u.length !== 0) {
|
|
893
895
|
const v = {
|
|
894
896
|
accounts: E,
|
|
@@ -897,23 +899,23 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
897
899
|
b({
|
|
898
900
|
...v,
|
|
899
901
|
custom: (V) => !!u.find(
|
|
900
|
-
(
|
|
902
|
+
(U) => U.top_level_category_guid === V.top_level_category_guid || U.category_guid === V.category_guid
|
|
901
903
|
)
|
|
902
904
|
});
|
|
903
905
|
}
|
|
904
906
|
}, [u]);
|
|
905
907
|
const ge = (v) => {
|
|
906
|
-
g(v),
|
|
908
|
+
g(v), ne(!0);
|
|
907
909
|
}, S = () => {
|
|
908
|
-
g(null),
|
|
910
|
+
g(null), ne(!1);
|
|
909
911
|
}, W = (v, V) => {
|
|
910
|
-
de(V ??
|
|
912
|
+
de(V ?? Y), s(y.TRENDS_CLICK_TOGGLE_VIEW, {
|
|
911
913
|
...M,
|
|
912
914
|
toggleView: V
|
|
913
915
|
});
|
|
914
916
|
}, G = (v) => {
|
|
915
|
-
const V = Ie(v?.[0], 1),
|
|
916
|
-
T({ start: V, end:
|
|
917
|
+
const V = Ie(v?.[0], 1), U = v?.[1], Fe = re(U, V);
|
|
918
|
+
T({ start: V, end: U }), s(y.TRENDS_CLICK_TIME_WINDOW, {
|
|
917
919
|
...M,
|
|
918
920
|
time_period: Fe + "M"
|
|
919
921
|
});
|
|
@@ -923,38 +925,38 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
923
925
|
filterValue: v
|
|
924
926
|
});
|
|
925
927
|
}, Ge = (v) => {
|
|
926
|
-
|
|
928
|
+
te(v);
|
|
927
929
|
}, Be = () => {
|
|
928
|
-
|
|
929
|
-
}, ze =
|
|
930
|
-
return !p || !x ? /* @__PURE__ */ e(
|
|
930
|
+
te(""), s(y.TRENDS_CLICK_ALL_CATEGORIES, M);
|
|
931
|
+
}, ze = i.show_connections_widget_in_master ? "buttons" : "no-buttons";
|
|
932
|
+
return !p || !x ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
|
|
931
933
|
Ae,
|
|
932
934
|
{
|
|
933
|
-
accountOptions:
|
|
935
|
+
accountOptions: c,
|
|
934
936
|
calendarActions: { onRangeChanged: G },
|
|
935
937
|
dateRange: r,
|
|
936
|
-
dateRangeVariant:
|
|
938
|
+
dateRangeVariant: l ? "timeframetabs" : "timeframebuttons",
|
|
937
939
|
onAccountsFilterClick: pe,
|
|
938
940
|
onBackClick: n,
|
|
939
941
|
sx: t,
|
|
940
|
-
title:
|
|
941
|
-
children:
|
|
942
|
+
title: I.title,
|
|
943
|
+
children: le ? /* @__PURE__ */ e(
|
|
942
944
|
Mt,
|
|
943
945
|
{
|
|
944
|
-
header:
|
|
946
|
+
header: I.zero_state_content_header,
|
|
945
947
|
icon: "",
|
|
946
948
|
onClick: () => {
|
|
947
949
|
},
|
|
948
|
-
primaryButton:
|
|
949
|
-
subText:
|
|
950
|
-
sx: { height:
|
|
950
|
+
primaryButton: I.empty_state_primary,
|
|
951
|
+
subText: I.empty_state_sub_text,
|
|
952
|
+
sx: { height: se },
|
|
951
953
|
variant: ze
|
|
952
954
|
}
|
|
953
955
|
) : /* @__PURE__ */ f(
|
|
954
956
|
_,
|
|
955
957
|
{
|
|
956
958
|
sx: {
|
|
957
|
-
px:
|
|
959
|
+
px: l ? 0 : 48
|
|
958
960
|
},
|
|
959
961
|
children: [
|
|
960
962
|
/* @__PURE__ */ f(
|
|
@@ -962,29 +964,29 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
962
964
|
{
|
|
963
965
|
flexDirection: "row",
|
|
964
966
|
justifyContent: "space-between",
|
|
965
|
-
sx: { pb:
|
|
967
|
+
sx: { pb: l ? 12 : 24, pt: l ? 24 : 48 },
|
|
966
968
|
children: [
|
|
967
969
|
/* @__PURE__ */ e(
|
|
968
970
|
Oe,
|
|
969
971
|
{
|
|
970
|
-
selectedCategoryGuid:
|
|
972
|
+
selectedCategoryGuid: P,
|
|
971
973
|
selectedDateRange: r
|
|
972
974
|
}
|
|
973
975
|
),
|
|
974
|
-
/* @__PURE__ */ e(We, { onTabChange: W, selectedTab:
|
|
976
|
+
/* @__PURE__ */ e(We, { onTabChange: W, selectedTab: Y })
|
|
975
977
|
]
|
|
976
978
|
}
|
|
977
979
|
),
|
|
978
|
-
/* @__PURE__ */ e(_, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(O, { flexGrow: 1, children:
|
|
979
|
-
/* @__PURE__ */ e(
|
|
980
|
-
|
|
980
|
+
/* @__PURE__ */ e(_, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(O, { flexGrow: 1, children: P && /* @__PURE__ */ f(Ce, { onClick: Be, sx: { p: 0, pr: 5 }, children: [
|
|
981
|
+
/* @__PURE__ */ e(ae, { name: "arrow_back" }),
|
|
982
|
+
I.all_categories
|
|
981
983
|
] }) }) }),
|
|
982
984
|
/* @__PURE__ */ f(_, { flexDirection: L ? "row" : "column", gap: L ? 48 : 16, children: [
|
|
983
|
-
|
|
985
|
+
Y === "Chart" && /* @__PURE__ */ f(Pe, { children: [
|
|
984
986
|
/* @__PURE__ */ e(O, { sx: { width: L ? "68%" : "100%" }, children: /* @__PURE__ */ e(
|
|
985
987
|
en,
|
|
986
988
|
{
|
|
987
|
-
availableHeight:
|
|
989
|
+
availableHeight: se,
|
|
988
990
|
minHeight: 450,
|
|
989
991
|
selectedDateRange: r,
|
|
990
992
|
totals: u
|
|
@@ -1001,13 +1003,13 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
|
|
|
1001
1003
|
)
|
|
1002
1004
|
] })
|
|
1003
1005
|
] }),
|
|
1004
|
-
|
|
1006
|
+
Y === "Table" && /* @__PURE__ */ e(O, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
1005
1007
|
Ve,
|
|
1006
1008
|
{
|
|
1007
1009
|
height: "unset",
|
|
1008
1010
|
monthlyCategoryTotals: u,
|
|
1009
1011
|
onClickRow: Ge,
|
|
1010
|
-
selectedCategory:
|
|
1012
|
+
selectedCategory: P,
|
|
1011
1013
|
selectedDateRange: r
|
|
1012
1014
|
}
|
|
1013
1015
|
) })
|