@mx-cartographer/experiences 6.26.18-alpha.mega4 → 6.26.18-alpha.sms1

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