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