@mx-cartographer/experiences 7.0.0-alpha.mega1 → 7.0.1-alpha.al0

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