@mx-cartographer/experiences 8.0.0-alpha.sms2 → 9.0.0-alpha.mega1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/dist/{Account-Cp30A3ad.mjs → Account-BIKn4XEZ.mjs} +1 -1
  3. package/dist/Account-CMjOp7S2.mjs +118 -0
  4. package/dist/AccountApi-DgZ8ILj1.mjs +19 -0
  5. package/dist/AccountDetailsHeader-BOV91g1o.mjs +95 -0
  6. package/dist/AccountDisplayName-CO7z3v99.mjs +11 -0
  7. package/dist/{AccountFields-CW6cIthP.mjs → AccountFields-BRRH37K1.mjs} +10 -11
  8. package/dist/{AccountListItem-DxmAs98Z.mjs → AccountListItem-Ds5C0mOT.mjs} +4 -4
  9. package/dist/{AccountStore-hIs-yA6W.mjs → AccountStore-BFKvXJSD.mjs} +79 -69
  10. package/dist/{Accounts-DUHkUyK4.mjs → Accounts-CuE8aSZN.mjs} +1 -1
  11. package/dist/{BudgetUtil-CIDAPPPT.mjs → BudgetUtil-CDSOZXem.mjs} +4 -4
  12. package/dist/CategorySelectorDrawer-C4aZYP4N.mjs +418 -0
  13. package/dist/CategoryStore-DEqAnHbi.mjs +186 -0
  14. package/dist/{CategoryUtil-DfVKKkRf.mjs → CategoryUtil-CFHBvaV4.mjs} +1 -1
  15. package/dist/{ConnectionsDrawer-CSo6AFkG.mjs → ConnectionsDrawer-BExzgE16.mjs} +5 -5
  16. package/dist/{CurrencyInput-BrGvhgVK.mjs → CurrencyInput-DDQ4DBrE.mjs} +1 -1
  17. package/dist/{CurrencyText-Dr0EZ7bp.mjs → CurrencyText-C-85TnUF.mjs} +3 -3
  18. package/dist/{DateUtil-CDPZw_-m.mjs → DateUtil-CVsMhbZU.mjs} +3 -3
  19. package/dist/{DebtsStore-hi1cqrRk.mjs → DebtsStore-Dv_T7Dts.mjs} +12 -12
  20. package/dist/{Dialog-CDV0kKxj.mjs → Dialog-CWymUiuO.mjs} +32 -35
  21. package/dist/Drawer-Bet2ZPJo.mjs +176 -0
  22. package/dist/{ExportCsvAction-CQ1grpwo.mjs → ExportCsvAction-oG_Mn66T.mjs} +3 -3
  23. package/dist/{FinstrongStore-dKZOZ2hM.mjs → FinstrongStore-BjFkMTIL.mjs} +6 -6
  24. package/dist/GlobalAccountFilter-BpWlPAl5.mjs +316 -0
  25. package/dist/{GoalStore-CFeAJloA.mjs → GoalStore-Dbjgft2i.mjs} +155 -137
  26. package/dist/{Help-i4OasOO-.mjs → Help-BW_ar-4B.mjs} +2 -2
  27. package/dist/LineChart-DHj-Bufi.mjs +580 -0
  28. package/dist/{ListItemAction-BNCWQAN_.mjs → ListItemAction-Cbr3417C.mjs} +10 -10
  29. package/dist/{ManageIncome-D_qVX5dN.mjs → ManageIncome-DIIyqDTp.mjs} +85 -85
  30. package/dist/{MicroWidgetContainer-BGpNl5ZS.mjs → MicroWidgetContainer-DSyYwRCU.mjs} +2 -2
  31. package/dist/{MiniWidgetContainer-D7MkHG15.mjs → MiniWidgetContainer-DKn7ndO6.mjs} +1 -1
  32. package/dist/NetWorthStore-B6ziBtaH.mjs +168 -0
  33. package/dist/NotificationSettings-e789PcRb.mjs +676 -0
  34. package/dist/{OriginalBalanceAction-62e0mU_3.mjs → OriginalBalanceAction-DFoG79Ba.mjs} +3 -3
  35. package/dist/{RecurringSettings-RfZ8Wuhh.mjs → RecurringSettings-BpCUcE8w.mjs} +4 -4
  36. package/dist/{RecurringTransactionsStore-D3EOKZ2B.mjs → RecurringTransactionsStore-D_--5PWH.mjs} +1 -1
  37. package/dist/{RecurringTransactions-Bhx56aA3.mjs → RepeatingTransaction-C2txVA9O.mjs} +3 -3
  38. package/dist/{SettingsStore-BASMQSIp.mjs → SettingsStore-CInvh-rQ.mjs} +1 -1
  39. package/dist/SpendingData-B7NuTQ9s.mjs +53 -0
  40. package/dist/SpendingLegend-BxefXiQd.mjs +193 -0
  41. package/dist/TransactionDetails-CPwv9xtZ.mjs +1374 -0
  42. package/dist/{TransactionStore-DgLrYW4C.mjs → TransactionStore-D2aMUClq.mjs} +128 -111
  43. package/dist/TrendsStore-BdsYfCc7.mjs +183 -0
  44. package/dist/{User-DqNX2GAK.mjs → User-CulNdZUr.mjs} +21 -20
  45. package/dist/ViewMoreMicroCard-CDWR16_h.mjs +1147 -0
  46. package/dist/WidgetContainer-mzejMmz2.mjs +555 -0
  47. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +1 -0
  48. package/dist/accounts/index.es.js +933 -232
  49. package/dist/accounts/stores/AccountStore.d.ts +6 -2
  50. package/dist/accounts/utils/AccountDetails.d.ts +5 -0
  51. package/dist/analytics/index.es.js +2 -2
  52. package/dist/budgets/components/AddBudgets.d.ts +2 -1
  53. package/dist/budgets/index.es.js +561 -522
  54. package/dist/cashflow/index.es.js +397 -396
  55. package/dist/categories/components/CustomCategories/AddSubcategory.d.ts +1 -0
  56. package/dist/categories/components/CustomCategories/DeleteSubcategory.d.ts +1 -0
  57. package/dist/categories/components/CustomCategories/RenameSubcategory.d.ts +1 -0
  58. package/dist/categories/components/SubcategoryRow.d.ts +1 -0
  59. package/dist/categories/index.es.js +2 -2
  60. package/dist/categories/stores/CategoryStore.d.ts +5 -3
  61. package/dist/common/components/GlobalAccountFilter.d.ts +11 -0
  62. package/dist/common/components/WidgetContainer.d.ts +7 -6
  63. package/dist/common/components/charts/linechart/CustomTooltip.d.ts +6 -1
  64. package/dist/common/components/charts/stackedlinechart/CustomPointTooltip.d.ts +5 -2
  65. package/dist/common/components/globalaccountfilter/GlobalAccountFilterList.d.ts +7 -0
  66. package/dist/common/components/index.d.ts +2 -2
  67. package/dist/common/hooks/index.d.ts +1 -0
  68. package/dist/common/hooks/useWidgetLoadTimer.d.ts +6 -0
  69. package/dist/common/index.es.js +325 -306
  70. package/dist/common/stores/GlobalUiStore.d.ts +7 -4
  71. package/dist/common/types/localization/AccountsCopy.d.ts +6 -0
  72. package/dist/common/types/localization/CategoryCopy.d.ts +3 -0
  73. package/dist/common/types/localization/CommonCopy.d.ts +3 -0
  74. package/dist/common/types/localization/GoalsCopy.d.ts +3 -1
  75. package/dist/common/types/localization/MicroInsightsCopy.d.ts +1 -0
  76. package/dist/common/types/localization/TransactionsCopy.d.ts +4 -0
  77. package/dist/common/types/localization/TrendsCopy.d.ts +4 -0
  78. package/dist/dashboard/index.es.js +95 -125
  79. package/dist/debts/index.es.js +466 -460
  80. package/dist/{exportTransactionsToCSV-BFpuIAXW.mjs → exportTransactionsToCSV-BU1jTY0Q.mjs} +4 -4
  81. package/dist/finstrong/components/shared/CustomDoubleBarPlot.d.ts +4 -5
  82. package/dist/finstrong/index.es.js +1660 -1553
  83. package/dist/goals/index.es.js +716 -677
  84. package/dist/goals/stores/GoalStore.d.ts +2 -0
  85. package/dist/help/index.es.js +14 -10
  86. package/dist/{hooks-C41HAxM5.mjs → hooks-fY_n74f7.mjs} +16 -16
  87. package/dist/investments/index.es.js +464 -457
  88. package/dist/merchants/index.es.js +1 -1
  89. package/dist/microinsights/MicroCardTemplate.d.ts +23 -0
  90. package/dist/microinsights/beaticons/BeatMaterialIcon.d.ts +8 -0
  91. package/dist/microinsights/beaticons/MonthlySpendComparisonIcon.d.ts +1 -2
  92. package/dist/microinsights/beaticons/index.d.ts +1 -0
  93. package/dist/microinsights/cards/InsightCard.d.ts +0 -2
  94. package/dist/microinsights/cards/ViewMoreMicroCard.d.ts +2 -5
  95. package/dist/microinsights/index.d.ts +2 -2
  96. package/dist/microinsights/index.es.js +824 -14
  97. package/dist/networth/components/NetWorthChart.d.ts +3 -2
  98. package/dist/networth/components/NetWorthList.d.ts +3 -3
  99. package/dist/networth/index.es.js +433 -438
  100. package/dist/networth/stores/NetWorthStore.d.ts +20 -9
  101. package/dist/networth/utils/NetWorthUtils.d.ts +2 -2
  102. package/dist/notifications/index.es.js +5 -5
  103. package/dist/recurringtransactions/index.es.js +331 -325
  104. package/dist/settings/index.es.js +293 -285
  105. package/dist/spending/components/SpendingChart.d.ts +1 -1
  106. package/dist/spending/components/SpendingList.d.ts +1 -1
  107. package/dist/spending/components/SpendingTabLabel.d.ts +1 -0
  108. package/dist/spending/index.es.js +250 -235
  109. package/dist/transactions/index.es.js +288 -281
  110. package/dist/transactions/stores/TransactionStore.d.ts +5 -0
  111. package/dist/trends/components/TrendsTable.d.ts +0 -2
  112. package/dist/trends/index.es.js +876 -802
  113. package/dist/trends/utils/TrendsData.d.ts +1 -0
  114. package/dist/trends/utils/TrendsTable.d.ts +12 -0
  115. package/dist/{useAccountDisplayName-usSZCQ7I.mjs → useAccountDisplayName-DbkgGLdg.mjs} +2 -2
  116. package/dist/useAriaLive-B3_pRUio.mjs +35 -0
  117. package/dist/{useInsightsEnabled-CNjP5cfR.mjs → useInsightsEnabled-dhmXeSyF.mjs} +1 -1
  118. package/dist/useWidgetLoadTimer-CrUzxN-P.mjs +19 -0
  119. package/package.json +26 -21
  120. package/dist/AccountDetailsContent-C1HumFnW.mjs +0 -683
  121. package/dist/AccountDetailsHeader-NMx79DGs.mjs +0 -87
  122. package/dist/CategorySelectorDrawer-DqDAA_5I.mjs +0 -399
  123. package/dist/CategoryStore-MUwRWH9e.mjs +0 -176
  124. package/dist/ConnectDrawer-Dn1MlqLz.mjs +0 -545
  125. package/dist/Drawer-Dqe5EqvA.mjs +0 -163
  126. package/dist/LineChart-bc1D9xBE.mjs +0 -581
  127. package/dist/NetWorthStore-8FFC1Bs0.mjs +0 -150
  128. package/dist/NotificationSettings-BsWiYD94.mjs +0 -672
  129. package/dist/SpendingData-DPQ96k3x.mjs +0 -55
  130. package/dist/SpendingLegend-CZzDb-7d.mjs +0 -193
  131. package/dist/TransactionDetails-Duv1X9ec.mjs +0 -1379
  132. package/dist/TrendsStore-_mRaFUdf.mjs +0 -182
  133. package/dist/ViewMoreMicroCard-CH9E-jOx.mjs +0 -1930
  134. package/dist/WidgetContainer-B1Jzb4XA.mjs +0 -565
  135. package/dist/common/components/accountfilter/AccountFilter.d.ts +0 -20
  136. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +0 -31
  137. package/dist/common/components/accountfilter/index.d.ts +0 -1
  138. package/dist/microinsights/cards/BaseCard.d.ts +0 -13
  139. package/dist/{ToggleListItem-ciFTiqRS.mjs → Notification-Bs1fdbzI.mjs} +1 -1
@@ -1,87 +0,0 @@
1
- import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
- import { observer as m } from "mobx-react-lite";
3
- import e from "@mui/material/Stack";
4
- import { H3 as _, InstitutionLogo as x, Text as a, H2 as T } from "@mxenabled/mxui";
5
- import d from "react";
6
- import { G as N, d as f, m as D, f as w, u as E } from "./hooks-C41HAxM5.mjs";
7
- import { g as I } from "./AccountFields-CW6cIthP.mjs";
8
- import G from "@mui/material/Card";
9
- import v from "@mui/material/CardContent";
10
- import O from "@mui/material/CardHeader";
11
- import { L as H } from "./Loader-BSWSYqvn.mjs";
12
- import { f as M, a as P } from "./Dialog-CDV0kKxj.mjs";
13
- import { I as L, P as U, S as j } from "./Account-Cp30A3ad.mjs";
14
- import { u as z } from "./useAccountDisplayName-usSZCQ7I.mjs";
15
- import { f as B } from "./NumberFormatting-DjTD0t3W.mjs";
16
- const p = () => {
17
- if (!d.useContext(N))
18
- throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
19
- return f().uiStore;
20
- }, Y = ({ sx: n, ChartComponent: s }) => {
21
- const { loadMonthlyCategoryTotals: c } = D(), { isInitialized: o } = w(), { selectedAccount: r } = p(), [l, u] = d.useState(!1);
22
- return d.useEffect(() => {
23
- o && c([r]).finally(() => {
24
- u(!0);
25
- });
26
- }, [o, r]), !o || !l ? /* @__PURE__ */ t(H, {}) : /* @__PURE__ */ i(
27
- G,
28
- {
29
- sx: {
30
- "& .MuiCardContent-root:last-child": {
31
- pb: 0
32
- },
33
- ...n
34
- },
35
- children: [
36
- /* @__PURE__ */ t(
37
- O,
38
- {
39
- sx: { pb: 0 },
40
- title: /* @__PURE__ */ t(_, { sx: { pb: 4 }, children: M(/* @__PURE__ */ new Date(), P.MONTH_LONG) })
41
- }
42
- ),
43
- /* @__PURE__ */ t(v, { sx: { p: 0 }, children: s ? /* @__PURE__ */ t(s, {}) : null })
44
- ]
45
- }
46
- );
47
- }, k = m(Y), R = ({
48
- customDetailsChart: n,
49
- ChartComponent: s
50
- }) => {
51
- const { institutions: c } = f(), { selectedAccount: o } = p(), { accounts: r } = E(), { firstSubtitle: l, firstValue: u, hasAvailableBalance: C, secondSubtitle: h, secondValue: S } = I(o, r), b = c.find(
52
- (y) => y.guid === o?.institution_guid
53
- ), A = [
54
- ...L,
55
- ...U,
56
- ...j
57
- ].includes(o.account_type), g = z(o);
58
- return /* @__PURE__ */ i(e, { bgcolor: "background.default", p: 24, children: [
59
- /* @__PURE__ */ i(e, { gap: 12, children: [
60
- /* @__PURE__ */ t(
61
- x,
62
- {
63
- alt: r.institution_logo_alt,
64
- institutionGuid: o.institution_guid || "",
65
- size: 64
66
- }
67
- ),
68
- /* @__PURE__ */ t(a, { variant: "Small", children: b?.name })
69
- ] }),
70
- /* @__PURE__ */ i(e, { gap: 8, mb: 24, mt: 4, children: [
71
- /* @__PURE__ */ t(T, { children: g }),
72
- /* @__PURE__ */ i(e, { direction: "row", justifyContent: "space-between", children: [
73
- /* @__PURE__ */ t(a, { bold: C, variant: "Body", children: l }),
74
- /* @__PURE__ */ t(a, { bold: !0, variant: "Body", children: B(u, "0,0.00") })
75
- ] }),
76
- /* @__PURE__ */ i(e, { direction: "row", justifyContent: "space-between", children: [
77
- /* @__PURE__ */ t(a, { variant: "Small", children: h }),
78
- /* @__PURE__ */ t(a, { variant: "Small", children: S })
79
- ] })
80
- ] }),
81
- A && /* @__PURE__ */ t(e, { children: n || /* @__PURE__ */ t(k, { ChartComponent: s }) })
82
- ] });
83
- }, rt = m(R);
84
- export {
85
- rt as A,
86
- p as u
87
- };
@@ -1,399 +0,0 @@
1
- import { jsx as t, jsxs as E } from "react/jsx-runtime";
2
- import { observer as g } from "mobx-react-lite";
3
- import C from "react";
4
- import $ from "@mui/material/Stack";
5
- import { G as K, m as y, u as b, g as D, b as U } from "./hooks-C41HAxM5.mjs";
6
- import Y from "@mui/material/List";
7
- import V from "@mui/material/Paper";
8
- import v from "@mui/material/Divider";
9
- import x from "@mui/material/ListItem";
10
- import W from "@mui/material/ListItemAvatar";
11
- import N from "@mui/material/ListItemButton";
12
- import F from "@mui/material/ListItemIcon";
13
- import G from "@mui/material/ListItemText";
14
- import { CheckCircle as M, Edit as j, Delete as X, ExpandMore as z } from "@mxenabled/mx-icons";
15
- import { Text as B, TextField as q, CategoryIcon as H } from "@mxenabled/mxui";
16
- import J from "@mui/material/Collapse";
17
- import Q from "@mui/material/DialogContent";
18
- import { b as S } from "./Localization-2MODESHW.mjs";
19
- import { D as Z } from "./Dialog-CDV0kKxj.mjs";
20
- import ee from "@mui/material/Box";
21
- import te from "@mui/material/Chip";
22
- import I from "@mui/material/IconButton";
23
- import { L as k } from "./Loader-BSWSYqvn.mjs";
24
- import { S as oe } from "./SearchBox-B2_zLv8-.mjs";
25
- import { D as ae } from "./Drawer-Dqe5EqvA.mjs";
26
- const p = () => {
27
- if (!C.useContext(K))
28
- throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
29
- return y().uiStore;
30
- }, m = {
31
- ON_CATEGORY_EXPANDED: "onCategoryExpanded",
32
- ON_CATEGORY_COLLAPSED: "onCategoryCollapsed",
33
- ON_CATEGORY_SELECTED: "onCategorySelected",
34
- ON_SUBCATEGORY_ADD_CLICK: "onSubcategoryAddClick",
35
- ON_SUBCATEGORY_ADD_CANCEL_CLICK: "onSubcategoryAddCancelClick",
36
- ON_SUBCATEGORY_ADDED: "onSubcategoryAdded",
37
- ON_SUBCATEGORY_EDIT_CLICK: "onSubcategoryEditClick",
38
- ON_SUBCATEGORY_EDIT_CANCEL_CLICK: "onSubcategoryEditCancelClick",
39
- ON_SUBCATEGORY_DELETE_CLICK: "onSubcategoryDeleteClick",
40
- ON_SUBCATEGORY_DELETED: "onSubcategoryDeleted",
41
- ON_SUBCATEGORY_SAVED: "onSubcategorySaved"
42
- };
43
- var L = /* @__PURE__ */ ((e) => (e.ADD = "add", e.EDIT = "edit", e.DELETE = "delete", e))(L || {});
44
- const re = ({
45
- categoryName: e = "",
46
- onClose: o,
47
- onSave: r,
48
- isOpen: c,
49
- type: s
50
- }) => {
51
- const [a, i] = C.useState(e), { categories: n } = b(), { setShouldDisableDrawerScroll: l } = p();
52
- let u = "", d = [];
53
- const _ = s === "delete";
54
- switch (s) {
55
- case "add":
56
- u = n.add_subcategory_title;
57
- break;
58
- case "edit":
59
- u = S(n.edit_subcategory_title, e);
60
- break;
61
- case "delete":
62
- u = n.delete_subcategory_heading, d = S(
63
- n.all_transactions_in_this_subcategory,
64
- /* @__PURE__ */ t(B, { bold: !0, children: S(n.all_parent_category, e) })
65
- );
66
- break;
67
- }
68
- return /* @__PURE__ */ t(
69
- Z,
70
- {
71
- copy: {
72
- title: u
73
- },
74
- disablePrimaryButton: !a,
75
- isOpen: c,
76
- onClose: () => {
77
- l(!1), o();
78
- },
79
- onPrimaryAction: () => {
80
- l(!1), r(a);
81
- },
82
- children: /* @__PURE__ */ t(Q, { children: _ ? /* @__PURE__ */ t(B, { children: d }) : /* @__PURE__ */ t(
83
- q,
84
- {
85
- inputProps: {
86
- "aria-label": s === "edit" ? n.edit_subcategory_aria : n.add_subcategory_aria
87
- },
88
- name: "modify-subcategory",
89
- onChange: (h) => i(h.target.value),
90
- placeholder: n.input_placeholder,
91
- sx: { width: "100%" },
92
- value: a
93
- }
94
- ) })
95
- }
96
- );
97
- }, R = g(re), ne = ({ parentCategory: e }) => {
98
- const [o, r] = C.useState(!1), { addCategory: c } = y(), { categories: s } = b(), { onEvent: a } = D(), { setShouldDisableDrawerScroll: i } = p(), n = async (d) => {
99
- await c(d.trim(), e.guid), a(m.ON_SUBCATEGORY_ADDED), r(!1);
100
- }, l = async () => {
101
- a(m.ON_SUBCATEGORY_ADD_CLICK), i(!0), r(!0);
102
- }, u = () => {
103
- r(!1), a(m.ON_SUBCATEGORY_ADD_CANCEL_CLICK);
104
- };
105
- return /* @__PURE__ */ E(x, { disableGutters: !0, disablePadding: !0, children: [
106
- /* @__PURE__ */ t(N, { onClick: l, sx: { ml: 60 }, children: /* @__PURE__ */ t(
107
- G,
108
- {
109
- primary: s.add_subcategory_button,
110
- primaryTypographyProps: { color: "primary", fontWeight: "normal", variant: "Body" }
111
- }
112
- ) }),
113
- o && /* @__PURE__ */ t(
114
- R,
115
- {
116
- isOpen: o,
117
- onClose: u,
118
- onSave: n,
119
- type: L.ADD
120
- }
121
- )
122
- ] });
123
- }, se = g(ne), ie = ({
124
- setShowRename: e,
125
- subCategory: o,
126
- showRename: r
127
- }) => {
128
- const { updateCategory: c } = y(), { onEvent: s } = D(), a = async (n) => {
129
- await c({ ...o, name: n }), s(m.ON_SUBCATEGORY_SAVED), e(!1);
130
- }, i = () => {
131
- e(!1), s(m.ON_SUBCATEGORY_EDIT_CANCEL_CLICK);
132
- };
133
- return /* @__PURE__ */ t(
134
- R,
135
- {
136
- categoryName: o.name,
137
- isOpen: r,
138
- onClose: i,
139
- onSave: a,
140
- type: L.EDIT
141
- }
142
- );
143
- }, ce = g(ie), le = ({
144
- parentCategory: e,
145
- showDelete: o,
146
- setShowDelete: r,
147
- subCategory: c
148
- }) => {
149
- const { onEvent: s } = D(), { removeCategory: a } = y(), i = () => {
150
- r(!1), s(m.ON_SUBCATEGORY_DELETE_CLICK);
151
- }, n = async () => {
152
- s(m.ON_SUBCATEGORY_DELETED), await a(c.guid), r(!1);
153
- };
154
- return /* @__PURE__ */ t(
155
- R,
156
- {
157
- categoryName: e.name,
158
- isOpen: o,
159
- onClose: i,
160
- onSave: n,
161
- type: L.DELETE
162
- }
163
- );
164
- }, de = g(le), ue = ({ parentCategory: e, subCategory: o }) => {
165
- const {
166
- onSelect: r,
167
- selectedGuid: c,
168
- setSelectedGuid: s,
169
- setShouldDisableDrawerScroll: a,
170
- showSelected: i,
171
- unselectable: n,
172
- unselectableText: l
173
- } = p(), { categories: u } = b(), { onEvent: d } = D(), [_, h] = C.useState(!1), [f, O] = C.useState(!1), T = !!o.revision, A = o.guid === c, w = !n.some((P) => P === o.guid);
174
- return /* @__PURE__ */ E(
175
- x,
176
- {
177
- className: "mx-cat-subcategory-row",
178
- disableGutters: !0,
179
- disablePadding: !0,
180
- sx: { pl: 58 },
181
- children: [
182
- /* @__PURE__ */ E(
183
- N,
184
- {
185
- "aria-pressed": A,
186
- color: "secondary",
187
- onClick: () => {
188
- w && (s(o.guid), r(o.guid), d(m.ON_CATEGORY_SELECTED));
189
- },
190
- sx: { height: 44 },
191
- children: [
192
- /* @__PURE__ */ t(
193
- G,
194
- {
195
- primary: o.name,
196
- primaryTypographyProps: { fontWeight: "normal", variant: "Body" }
197
- }
198
- ),
199
- i && A && /* @__PURE__ */ t(M, { fontSize: "small" }),
200
- !w && /* @__PURE__ */ t(te, { label: l })
201
- ]
202
- }
203
- ),
204
- T && /* @__PURE__ */ E(ee, { className: "mx-cat-subcategory-edit-container", sx: { marginRight: 24 }, children: [
205
- /* @__PURE__ */ t(
206
- I,
207
- {
208
- "aria-label": S(u.edit_subcategory_aria, o.name),
209
- onClick: () => {
210
- h(!0), a(!0), d(m.ON_SUBCATEGORY_EDIT_CLICK);
211
- },
212
- children: /* @__PURE__ */ t(j, { color: "secondary" })
213
- }
214
- ),
215
- /* @__PURE__ */ t(
216
- I,
217
- {
218
- "aria-label": S(u.delete_subcategory_aria, o.name),
219
- edge: "end",
220
- onClick: () => {
221
- O(!0), a(!0), d(m.ON_SUBCATEGORY_DELETE_CLICK);
222
- },
223
- children: /* @__PURE__ */ t(X, { color: "secondary" })
224
- }
225
- )
226
- ] }),
227
- f && /* @__PURE__ */ t(
228
- de,
229
- {
230
- parentCategory: e,
231
- setShowDelete: O,
232
- showDelete: f,
233
- subCategory: o
234
- }
235
- ),
236
- _ && /* @__PURE__ */ t(
237
- ce,
238
- {
239
- setShowRename: h,
240
- showRename: _,
241
- subCategory: o
242
- }
243
- )
244
- ]
245
- }
246
- );
247
- }, me = g(ue), Ce = ({ categories: e, parentCategory: o }) => {
248
- const { expandedGuid: r, searchValue: c } = p(), s = o.guid === r, a = !!c;
249
- return /* @__PURE__ */ t(
250
- J,
251
- {
252
- in: s || a,
253
- sx: { backgroundColor: "background.default" },
254
- timeout: "auto",
255
- unmountOnExit: !0,
256
- children: /* @__PURE__ */ E(
257
- Y,
258
- {
259
- "aria-labelledby": `category-${o.guid}`,
260
- className: "mx-cat-subcategory-list",
261
- id: `subcategories-${o.guid}`,
262
- children: [
263
- e.map((i) => /* @__PURE__ */ E(C.Fragment, { children: [
264
- /* @__PURE__ */ t(me, { parentCategory: o, subCategory: i }),
265
- /* @__PURE__ */ t(v, { sx: { ml: 58 } })
266
- ] }, i.guid)),
267
- !a && /* @__PURE__ */ t(se, { parentCategory: o })
268
- ]
269
- }
270
- )
271
- }
272
- );
273
- }, ge = g(Ce), _e = ({ category: e, subCategories: o }) => {
274
- const { expandedGuid: r, searchValue: c, setExpandedGuid: s } = p(), { onEvent: a } = D(), i = e.guid === r, n = () => {
275
- const l = e.guid !== r ? e.guid : null;
276
- s(l), a(l ? m.ON_CATEGORY_EXPANDED : m.ON_CATEGORY_COLLAPSED);
277
- };
278
- return /* @__PURE__ */ E(C.Fragment, { children: [
279
- /* @__PURE__ */ t(x, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ E(
280
- N,
281
- {
282
- "aria-controls": `subcategories-${e.guid}`,
283
- "aria-expanded": e.guid === r,
284
- "aria-label": e.name,
285
- id: `category-${e.guid}`,
286
- onClick: n,
287
- children: [
288
- /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(H, { categoryGuid: e.guid }) }),
289
- /* @__PURE__ */ t(
290
- G,
291
- {
292
- primary: e.name,
293
- primaryTypographyProps: { fontWeight: "normal", variant: "Body" }
294
- }
295
- ),
296
- /* @__PURE__ */ t(F, { children: /* @__PURE__ */ t(
297
- z,
298
- {
299
- sx: {
300
- transition: "transform 0.3s ease-in-out",
301
- transform: i || c ? "rotate(180deg)" : "rotate(0deg)"
302
- }
303
- }
304
- ) })
305
- ]
306
- },
307
- e.guid
308
- ) }),
309
- /* @__PURE__ */ t(v, { sx: { ml: 58 } }),
310
- /* @__PURE__ */ t(ge, { categories: o, parentCategory: e })
311
- ] });
312
- }, Ee = g(_e), pe = () => {
313
- const { categories: e } = y(), { searchValue: o } = p(), { categories: r } = b(), s = ((a, i = "") => a.reduce((n, l) => {
314
- if (l.parent_guid === null) {
315
- const d = [
316
- {
317
- ...l,
318
- name: S(r.all_parent_category, l.name),
319
- parent_guid: l.guid
320
- },
321
- ...a
322
- ].filter(
323
- (_) => _.parent_guid === l.guid && _.name.toLowerCase().includes(i.toLowerCase())
324
- );
325
- if (l.name.toLowerCase().includes(i.toLowerCase()) || d.length > 0)
326
- return [...n, { category: { ...l }, children: d }];
327
- }
328
- return n;
329
- }, []))(e, o);
330
- return /* @__PURE__ */ t(V, { className: "mx-cat-category-list", sx: { boxShadow: "none" }, children: /* @__PURE__ */ t(Y, { children: s.map((a) => /* @__PURE__ */ t(
331
- Ee,
332
- {
333
- category: a.category,
334
- subCategories: a.children
335
- },
336
- a.category.guid
337
- )) }) });
338
- }, he = g(pe), Se = ({
339
- initialSelected: e,
340
- onSelect: o = void 0,
341
- showSelected: r = !0,
342
- unselectable: c = [],
343
- unselectableText: s = "Unselectable"
344
- }) => {
345
- const { categories: a, loadCategories: i } = y(), { common: n } = b(), { isCopyLoaded: l } = U(), {
346
- searchValue: u,
347
- setOnSelect: d,
348
- setSearchValue: _,
349
- setSelectedGuid: h,
350
- setShowSelected: f,
351
- setUnselectable: O,
352
- setUnselectableText: T
353
- } = p();
354
- return C.useEffect(() => {
355
- o && d(o);
356
- }), C.useEffect(() => {
357
- a.length || i();
358
- }, []), C.useEffect(() => {
359
- e && h(e), f(r), O(c), T(s);
360
- }, [e, r, c, s]), l ? /* @__PURE__ */ E($, { className: "mx-cat-category-selector", sx: { width: "100%" }, children: [
361
- /* @__PURE__ */ t(
362
- oe,
363
- {
364
- ariaLabel: n.search_aria,
365
- cancelAriaLabel: n.cancel_search_aria,
366
- onChange: (A) => _(A),
367
- placeholder: n.search_placeholder,
368
- searchValue: u
369
- }
370
- ),
371
- /* @__PURE__ */ t(he, {})
372
- ] }) : /* @__PURE__ */ t(k, {});
373
- }, ye = g(Se), be = ({
374
- id: e,
375
- onClose: o,
376
- title: r,
377
- showDrawer: c,
378
- ...s
379
- }) => {
380
- const { common: a } = b(), { isCopyLoaded: i } = U();
381
- return i ? /* @__PURE__ */ t(
382
- ae,
383
- {
384
- ariaLabelClose: a.close_aria,
385
- className: "mx-cat-category-selector-drawer",
386
- id: e,
387
- isOpen: c,
388
- onClose: o,
389
- title: r,
390
- children: /* @__PURE__ */ t(ye, { ...s })
391
- }
392
- ) : /* @__PURE__ */ t(k, {});
393
- }, ze = g(be);
394
- export {
395
- ye as C,
396
- ze as a,
397
- Ee as b,
398
- p as u
399
- };
@@ -1,176 +0,0 @@
1
- import { makeAutoObservable as g } from "mobx";
2
- import { getUnixTime as n } from "date-fns/getUnixTime";
3
- import { subMonths as d } from "date-fns/subMonths";
4
- import { startOfMonth as y } from "date-fns/startOfMonth";
5
- import { endOfMonth as u } from "date-fns/endOfMonth";
6
- import { a as C, g as T } from "./CategoryUtil-DfVKKkRf.mjs";
7
- import { F as m, A as r } from "./Fetch-DecPFeGU.mjs";
8
- import { b as p, c as f } from "./Category-Ccoew_sA.mjs";
9
- class c {
10
- fetchInstance;
11
- constructor(t, e, a) {
12
- this.fetchInstance = new m(t, e, void 0, a);
13
- }
14
- addCategory = async (t) => this.fetchInstance.post(r.CATEGORIES, t).then((e) => e.category);
15
- getCategories = async () => this.fetchInstance.get(r.CATEGORIES).then((t) => t.categories);
16
- getDateRangeCategoryTotals = async (t, e, a) => a.length === 0 ? [] : this.fetchInstance.post(`${r.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
17
- account_guid: a.map((o) => o.guid)
18
- }).then((o) => o.date_range_category_totals);
19
- getMonthlyCategoryTotals = async (t, e, a) => {
20
- try {
21
- const o = `${r.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`;
22
- if (a) {
23
- const s = a.length === 0 ? [""] : a.map((h) => h.guid);
24
- return (await this.fetchInstance.post(o, { account_guid: s })).monthly_category_totals;
25
- } else
26
- return (await this.fetchInstance.get(o)).monthly_category_totals;
27
- } catch (o) {
28
- throw console.error("Error fetching monthly category totals:", o), o;
29
- }
30
- };
31
- removeCategory = async (t) => this.fetchInstance.delete(`${r.CATEGORIES}/${t}`);
32
- updateCategory = async (t) => this.fetchInstance.put(`${r.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
33
- }
34
- class w {
35
- expandedGuid = null;
36
- selectedGuid = null;
37
- searchValue = "";
38
- showSelected = !0;
39
- shouldDisableDrawerScroll = !1;
40
- unselectable = [];
41
- unselectableText = "";
42
- savedOnSelect;
43
- // todo
44
- constructor() {
45
- g(this);
46
- }
47
- setExpandedGuid = (t) => this.expandedGuid = t;
48
- setSelectedGuid = (t) => this.selectedGuid = t;
49
- setSearchValue = (t) => this.searchValue = t;
50
- setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
51
- setShowSelected = (t) => this.showSelected = t;
52
- setUnselectable = (t) => this.unselectable = t;
53
- setUnselectableText = (t) => this.unselectableText = t;
54
- onSelect = (t) => this.savedOnSelect(t);
55
- setOnSelect = (t) => this.savedOnSelect = t;
56
- }
57
- class O {
58
- globalStore;
59
- uiStore;
60
- api = new c("/", "");
61
- categories = [];
62
- categoriesLoaded = !1;
63
- dateRangeCategoryTotals = [];
64
- monthlyCategoryTotals = [];
65
- dateRangeTotalsLoaded = !1;
66
- isLoadingCategoryTotals = !1;
67
- monthlyTotalsLoaded = !1;
68
- constructor(t) {
69
- this.globalStore = t, this.uiStore = new w(), this.api = new c(t.endpoint, t.sessionToken, t.onError), g(this);
70
- }
71
- get detailedCategories() {
72
- return this.globalStore.isInitialized ? C(
73
- this.categories,
74
- this.globalStore.copyStore.copy.categories,
75
- this.dateRangeCategoryTotals,
76
- this.monthlyCategoryTotals
77
- ) : [];
78
- }
79
- get detailedCategoriesWithTransactions() {
80
- return T(
81
- this.detailedCategories,
82
- this.globalStore.transactionStore.sortedTransactions
83
- );
84
- }
85
- get incomeCategories() {
86
- return this.detailedCategories.filter((t) => t.is_income);
87
- }
88
- get spendCategories() {
89
- return this.detailedCategories.filter(
90
- (t) => !t.is_income && !t.isTransfer && t.guid !== p.INVESTMENTS
91
- );
92
- }
93
- get transferCategories() {
94
- return this.detailedCategories.filter((t) => t.isTransfer);
95
- }
96
- setCategories = (t) => {
97
- this.categories = t, this.categoriesLoaded = !0;
98
- };
99
- setMonthlyCategoryTotals = (t) => {
100
- this.monthlyCategoryTotals = t, this.monthlyTotalsLoaded = !0;
101
- };
102
- setDateRangeCategoryTotals = (t) => {
103
- this.dateRangeCategoryTotals = t, this.dateRangeTotalsLoaded = !0;
104
- };
105
- addCategory = async (t, e) => {
106
- const a = { name: t, parent_guid: e };
107
- try {
108
- await this.api.addCategory(a), await this.loadCategories();
109
- } catch (o) {
110
- console.error(`Error occurred while adding category: ${o}`);
111
- }
112
- };
113
- loadCategories = async () => {
114
- try {
115
- const t = await this.api.getCategories();
116
- this.setCategories(t);
117
- } catch (t) {
118
- console.error(`Error occurred while getting categories: ${t}`);
119
- }
120
- };
121
- loadDateRangeCategoryTotals = async (t, e, a) => {
122
- this.setIsLoadingCategoryTotals(!0);
123
- try {
124
- const o = await this.api.getDateRangeCategoryTotals(
125
- n(e),
126
- n(a),
127
- t
128
- );
129
- this.setDateRangeCategoryTotals(o);
130
- } catch (o) {
131
- console.error(`Error occurred while getting date range category totals: ${o}`);
132
- } finally {
133
- this.setIsLoadingCategoryTotals(!1);
134
- }
135
- };
136
- loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, a) => {
137
- const o = n(y(e ?? d(/* @__PURE__ */ new Date(), 11))), s = n(u(a ?? /* @__PURE__ */ new Date()));
138
- try {
139
- const i = await this.api.getMonthlyCategoryTotals(o, s, t);
140
- this.setMonthlyCategoryTotals(i);
141
- } catch (i) {
142
- console.error(`Error occurred while getting monthly category totals: ${i}`);
143
- }
144
- };
145
- reloadCategoryTotals = async (t, e, a) => {
146
- this.setIsLoadingCategoryTotals(!0);
147
- try {
148
- await this.loadMonthlyCategoryTotals(t, e, a), await this.loadDateRangeCategoryTotals(t, e, a);
149
- } catch (o) {
150
- console.error(`Error occurred while getting category totals: ${o}`);
151
- }
152
- };
153
- removeCategory = async (t) => {
154
- try {
155
- await this.api.removeCategory(t), await this.loadCategories();
156
- } catch (e) {
157
- console.error(`Error occurred while removing category: ${e}`);
158
- }
159
- };
160
- setIsLoadingCategoryTotals = (t) => {
161
- this.isLoadingCategoryTotals = t;
162
- };
163
- updateCategory = async (t) => {
164
- try {
165
- await this.api.updateCategory(t), await this.loadCategories();
166
- } catch (e) {
167
- console.error(`Error occurred while updating category: ${e}`);
168
- }
169
- };
170
- // TODO: Remove this after refactoring Trends components to use detailedCategories
171
- getCategoryName = (t) => this.categories.find((a) => a.guid === t)?.name ?? f[t];
172
- }
173
- export {
174
- O as C,
175
- c as a
176
- };