@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
@@ -0,0 +1,418 @@
1
+ import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
+ import { observer as E } from "mobx-react-lite";
3
+ import _ from "react";
4
+ import K from "@mui/material/Stack";
5
+ import { G as V, m as b, u as h, g as D, b as U } from "./hooks-fY_n74f7.mjs";
6
+ import Y from "@mui/material/List";
7
+ import W from "@mui/material/Paper";
8
+ import k from "@mui/material/Divider";
9
+ import x from "@mui/material/ListItem";
10
+ import F from "@mui/material/ListItemAvatar";
11
+ import N from "@mui/material/ListItemButton";
12
+ import M from "@mui/material/ListItemIcon";
13
+ import G from "@mui/material/ListItemText";
14
+ import { CheckCircle as j, Edit as X, Delete as z, ExpandMore as q } from "@mxenabled/mx-icons";
15
+ import { Text as I, TextField as H, CategoryIcon as J } from "@mxenabled/mxui";
16
+ import Q from "@mui/material/Collapse";
17
+ import Z from "@mui/material/DialogContent";
18
+ import { b as p } from "./Localization-2MODESHW.mjs";
19
+ import { a as ee } from "./Dialog-CWymUiuO.mjs";
20
+ import te from "@mui/material/Box";
21
+ import oe from "@mui/material/Chip";
22
+ import v from "@mui/material/IconButton";
23
+ import { u as ae } from "./useAriaLive-B3_pRUio.mjs";
24
+ import { L as P } from "./Loader-BSWSYqvn.mjs";
25
+ import { S as re } from "./SearchBox-B2_zLv8-.mjs";
26
+ import { D as ne } from "./Drawer-Bet2ZPJo.mjs";
27
+ const S = () => {
28
+ if (!_.useContext(V))
29
+ throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
30
+ return b().uiStore;
31
+ }, C = {
32
+ ON_CATEGORY_EXPANDED: "onCategoryExpanded",
33
+ ON_CATEGORY_COLLAPSED: "onCategoryCollapsed",
34
+ ON_CATEGORY_SELECTED: "onCategorySelected",
35
+ ON_SUBCATEGORY_ADD_CLICK: "onSubcategoryAddClick",
36
+ ON_SUBCATEGORY_ADD_CANCEL_CLICK: "onSubcategoryAddCancelClick",
37
+ ON_SUBCATEGORY_ADDED: "onSubcategoryAdded",
38
+ ON_SUBCATEGORY_EDIT_CLICK: "onSubcategoryEditClick",
39
+ ON_SUBCATEGORY_EDIT_CANCEL_CLICK: "onSubcategoryEditCancelClick",
40
+ ON_SUBCATEGORY_DELETE_CLICK: "onSubcategoryDeleteClick",
41
+ ON_SUBCATEGORY_DELETED: "onSubcategoryDeleted",
42
+ ON_SUBCATEGORY_SAVED: "onSubcategorySaved"
43
+ };
44
+ var L = /* @__PURE__ */ ((e) => (e.ADD = "add", e.EDIT = "edit", e.DELETE = "delete", e))(L || {});
45
+ const se = ({
46
+ categoryName: e = "",
47
+ onClose: s,
48
+ onSave: o,
49
+ isOpen: l,
50
+ type: i
51
+ }) => {
52
+ const [a, c] = _.useState(e), { categories: r } = h(), { setShouldDisableDrawerScroll: n } = S();
53
+ let d = "", m = [];
54
+ const u = i === "delete";
55
+ switch (i) {
56
+ case "add":
57
+ d = r.add_subcategory_title;
58
+ break;
59
+ case "edit":
60
+ d = p(r.edit_subcategory_title, e);
61
+ break;
62
+ case "delete":
63
+ d = r.delete_subcategory_heading, m = p(
64
+ r.all_transactions_in_this_subcategory,
65
+ /* @__PURE__ */ t(I, { bold: !0, children: p(r.all_parent_category, e) })
66
+ );
67
+ break;
68
+ }
69
+ return /* @__PURE__ */ t(
70
+ ee,
71
+ {
72
+ copy: {
73
+ title: d
74
+ },
75
+ disablePrimaryButton: !a,
76
+ isOpen: l,
77
+ onClose: () => {
78
+ n(!1), s();
79
+ },
80
+ onPrimaryAction: () => {
81
+ n(!1), o(a);
82
+ },
83
+ children: /* @__PURE__ */ t(Z, { children: u ? /* @__PURE__ */ t(I, { children: m }) : /* @__PURE__ */ t(
84
+ H,
85
+ {
86
+ inputProps: {
87
+ "aria-label": i === "edit" ? r.edit_subcategory_aria : r.add_subcategory_aria
88
+ },
89
+ name: "modify-subcategory",
90
+ onChange: (y) => c(y.target.value),
91
+ placeholder: r.input_placeholder,
92
+ sx: { width: "100%" },
93
+ value: a
94
+ }
95
+ ) })
96
+ }
97
+ );
98
+ }, R = E(se), ie = ({ announce: e, parentCategory: s }) => {
99
+ const [o, l] = _.useState(!1), { addCategory: i } = b(), { categories: a } = h(), { onEvent: c } = D(), { setShouldDisableDrawerScroll: r } = S(), n = async (u) => {
100
+ await i(u.trim(), s.guid), e(p(a.add_subcategory_announcement, u)), c(C.ON_SUBCATEGORY_ADDED), l(!1);
101
+ }, d = async () => {
102
+ c(C.ON_SUBCATEGORY_ADD_CLICK), r(!0), l(!0);
103
+ }, m = () => {
104
+ l(!1), c(C.ON_SUBCATEGORY_ADD_CANCEL_CLICK);
105
+ };
106
+ return /* @__PURE__ */ g(x, { disableGutters: !0, disablePadding: !0, children: [
107
+ /* @__PURE__ */ t(N, { onClick: d, sx: { ml: 60 }, children: /* @__PURE__ */ t(
108
+ G,
109
+ {
110
+ primary: a.add_subcategory_button,
111
+ primaryTypographyProps: { color: "primary", fontWeight: "normal", variant: "Body" }
112
+ }
113
+ ) }),
114
+ o && /* @__PURE__ */ t(
115
+ R,
116
+ {
117
+ isOpen: o,
118
+ onClose: m,
119
+ onSave: n,
120
+ type: L.ADD
121
+ }
122
+ )
123
+ ] });
124
+ }, ce = E(ie), le = ({
125
+ announce: e,
126
+ setShowRename: s,
127
+ subCategory: o,
128
+ showRename: l
129
+ }) => {
130
+ const { onEvent: i } = D(), { updateCategory: a } = b(), { categories: c } = h(), r = async (d) => {
131
+ await a({ ...o, name: d }), e(p(c.edit_subcategory_announcement, o.name, d)), i(C.ON_SUBCATEGORY_SAVED), s(!1);
132
+ }, n = () => {
133
+ s(!1), i(C.ON_SUBCATEGORY_EDIT_CANCEL_CLICK);
134
+ };
135
+ return /* @__PURE__ */ t(
136
+ R,
137
+ {
138
+ categoryName: o.name,
139
+ isOpen: l,
140
+ onClose: n,
141
+ onSave: r,
142
+ type: L.EDIT
143
+ }
144
+ );
145
+ }, de = E(le), ue = ({
146
+ announce: e,
147
+ parentCategory: s,
148
+ showDelete: o,
149
+ setShowDelete: l,
150
+ subCategory: i
151
+ }) => {
152
+ const { onEvent: a } = D(), { removeCategory: c } = b(), { categories: r } = h(), n = () => {
153
+ l(!1), a(C.ON_SUBCATEGORY_DELETE_CLICK);
154
+ }, d = async () => {
155
+ await c(i.guid), e(p(r.delete_subcategory_announcement, i.name)), a(C.ON_SUBCATEGORY_DELETED), l(!1);
156
+ };
157
+ return /* @__PURE__ */ t(
158
+ R,
159
+ {
160
+ categoryName: s.name,
161
+ isOpen: o,
162
+ onClose: n,
163
+ onSave: d,
164
+ type: L.DELETE
165
+ }
166
+ );
167
+ }, me = E(ue), Ce = ({
168
+ announce: e,
169
+ parentCategory: s,
170
+ subCategory: o
171
+ }) => {
172
+ const {
173
+ onSelect: l,
174
+ selectedGuid: i,
175
+ setSelectedGuid: a,
176
+ setShouldDisableDrawerScroll: c,
177
+ showSelected: r,
178
+ unselectable: n,
179
+ unselectableText: d
180
+ } = S(), { categories: m } = h(), { onEvent: u } = D(), [y, f] = _.useState(!1), [O, A] = _.useState(!1), T = !!o.revision, w = o.guid === i, B = !n.some(($) => $ === o.guid);
181
+ return /* @__PURE__ */ g(
182
+ x,
183
+ {
184
+ className: "mx-cat-subcategory-row",
185
+ disableGutters: !0,
186
+ disablePadding: !0,
187
+ sx: { pl: 58 },
188
+ children: [
189
+ /* @__PURE__ */ g(
190
+ N,
191
+ {
192
+ "aria-pressed": w,
193
+ color: "secondary",
194
+ onClick: () => {
195
+ B && (a(o.guid), l(o.guid), u(C.ON_CATEGORY_SELECTED));
196
+ },
197
+ sx: { height: 44 },
198
+ children: [
199
+ /* @__PURE__ */ t(
200
+ G,
201
+ {
202
+ primary: o.name,
203
+ primaryTypographyProps: { fontWeight: "normal", variant: "Body" }
204
+ }
205
+ ),
206
+ r && w && /* @__PURE__ */ t(j, { fontSize: "small" }),
207
+ !B && /* @__PURE__ */ t(oe, { label: d })
208
+ ]
209
+ }
210
+ ),
211
+ T && /* @__PURE__ */ g(te, { className: "mx-cat-subcategory-edit-container", sx: { marginRight: 24 }, children: [
212
+ /* @__PURE__ */ t(
213
+ v,
214
+ {
215
+ "aria-label": p(m.edit_subcategory_aria, o.name),
216
+ onClick: () => {
217
+ f(!0), c(!0), u(C.ON_SUBCATEGORY_EDIT_CLICK);
218
+ },
219
+ children: /* @__PURE__ */ t(X, { color: "secondary" })
220
+ }
221
+ ),
222
+ /* @__PURE__ */ t(
223
+ v,
224
+ {
225
+ "aria-label": p(m.delete_subcategory_aria, o.name),
226
+ edge: "end",
227
+ onClick: () => {
228
+ A(!0), c(!0), u(C.ON_SUBCATEGORY_DELETE_CLICK);
229
+ },
230
+ children: /* @__PURE__ */ t(z, { color: "secondary" })
231
+ }
232
+ )
233
+ ] }),
234
+ O && /* @__PURE__ */ t(
235
+ me,
236
+ {
237
+ announce: e,
238
+ parentCategory: s,
239
+ setShowDelete: A,
240
+ showDelete: O,
241
+ subCategory: o
242
+ }
243
+ ),
244
+ y && /* @__PURE__ */ t(
245
+ de,
246
+ {
247
+ announce: e,
248
+ setShowRename: f,
249
+ showRename: y,
250
+ subCategory: o
251
+ }
252
+ )
253
+ ]
254
+ }
255
+ );
256
+ }, ge = E(Ce), _e = ({ categories: e, parentCategory: s }) => {
257
+ const { expandedGuid: o, searchValue: l } = S(), { announce: i, ariaLive: a } = ae(), c = s.guid === o, r = !!l;
258
+ return /* @__PURE__ */ g(
259
+ Q,
260
+ {
261
+ in: c || r,
262
+ sx: { backgroundColor: "background.default" },
263
+ timeout: "auto",
264
+ unmountOnExit: !0,
265
+ children: [
266
+ a,
267
+ /* @__PURE__ */ g(
268
+ Y,
269
+ {
270
+ "aria-labelledby": `category-${s.guid}`,
271
+ className: "mx-cat-subcategory-list",
272
+ id: `subcategories-${s.guid}`,
273
+ children: [
274
+ e.map((n) => /* @__PURE__ */ g(_.Fragment, { children: [
275
+ /* @__PURE__ */ t(
276
+ ge,
277
+ {
278
+ announce: i,
279
+ parentCategory: s,
280
+ subCategory: n
281
+ }
282
+ ),
283
+ /* @__PURE__ */ t(k, { sx: { ml: 58 } })
284
+ ] }, n.guid)),
285
+ !r && /* @__PURE__ */ t(ce, { announce: i, parentCategory: s })
286
+ ]
287
+ }
288
+ )
289
+ ]
290
+ }
291
+ );
292
+ }, Ee = E(_e), pe = ({ category: e, subCategories: s }) => {
293
+ const { expandedGuid: o, searchValue: l, setExpandedGuid: i } = S(), { onEvent: a } = D(), c = e.guid === o, r = () => {
294
+ const n = e.guid !== o ? e.guid : null;
295
+ i(n), a(n ? C.ON_CATEGORY_EXPANDED : C.ON_CATEGORY_COLLAPSED);
296
+ };
297
+ return /* @__PURE__ */ g(_.Fragment, { children: [
298
+ /* @__PURE__ */ t(x, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ g(
299
+ N,
300
+ {
301
+ "aria-controls": `subcategories-${e.guid}`,
302
+ "aria-expanded": e.guid === o,
303
+ "aria-label": e.name,
304
+ id: `category-${e.guid}`,
305
+ onClick: r,
306
+ children: [
307
+ /* @__PURE__ */ t(F, { children: /* @__PURE__ */ t(J, { categoryGuid: e.guid }) }),
308
+ /* @__PURE__ */ t(
309
+ G,
310
+ {
311
+ primary: e.name,
312
+ primaryTypographyProps: { fontWeight: "normal", variant: "Body" }
313
+ }
314
+ ),
315
+ /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(
316
+ q,
317
+ {
318
+ sx: {
319
+ transition: "transform 0.3s ease-in-out",
320
+ transform: c || l ? "rotate(180deg)" : "rotate(0deg)"
321
+ }
322
+ }
323
+ ) })
324
+ ]
325
+ },
326
+ e.guid
327
+ ) }),
328
+ /* @__PURE__ */ t(k, { sx: { ml: 58 } }),
329
+ /* @__PURE__ */ t(Ee, { categories: s, parentCategory: e })
330
+ ] });
331
+ }, he = E(pe), Se = () => {
332
+ const { categories: e } = b(), { searchValue: s } = S(), { categories: o } = h(), i = ((a, c = "") => a.reduce((r, n) => {
333
+ if (n.parent_guid === null) {
334
+ const m = [
335
+ {
336
+ ...n,
337
+ name: p(o.all_parent_category, n.name),
338
+ parent_guid: n.guid
339
+ },
340
+ ...a
341
+ ].filter(
342
+ (u) => u.parent_guid === n.guid && u.name.toLowerCase().includes(c.toLowerCase())
343
+ );
344
+ if (n.name.toLowerCase().includes(c.toLowerCase()) || m.length > 0)
345
+ return [...r, { category: { ...n }, children: m }];
346
+ }
347
+ return r;
348
+ }, []))(e, s);
349
+ return /* @__PURE__ */ t(W, { className: "mx-cat-category-list", sx: { boxShadow: "none" }, children: /* @__PURE__ */ t(Y, { children: i.map((a) => /* @__PURE__ */ t(
350
+ he,
351
+ {
352
+ category: a.category,
353
+ subCategories: a.children
354
+ },
355
+ a.category.guid
356
+ )) }) });
357
+ }, ye = E(Se), be = ({
358
+ initialSelected: e,
359
+ onSelect: s = void 0,
360
+ showSelected: o = !0,
361
+ unselectable: l = [],
362
+ unselectableText: i = "Unselectable"
363
+ }) => {
364
+ const { categories: a, loadCategories: c } = b(), { common: r } = h(), { isCopyLoaded: n } = U(), {
365
+ searchValue: d,
366
+ setOnSelect: m,
367
+ setSearchValue: u,
368
+ setSelectedGuid: y,
369
+ setShowSelected: f,
370
+ setUnselectable: O,
371
+ setUnselectableText: A
372
+ } = S();
373
+ return _.useEffect(() => {
374
+ s && m(s);
375
+ }), _.useEffect(() => {
376
+ a.length || c();
377
+ }, []), _.useEffect(() => {
378
+ e && y(e), f(o), O(l), A(i);
379
+ }, [e, o, l, i]), n ? /* @__PURE__ */ g(K, { className: "mx-cat-category-selector", sx: { width: "100%" }, children: [
380
+ /* @__PURE__ */ t(
381
+ re,
382
+ {
383
+ ariaLabel: r.search_aria,
384
+ cancelAriaLabel: r.cancel_search_aria,
385
+ onChange: (T) => u(T),
386
+ placeholder: r.search_placeholder,
387
+ searchValue: d
388
+ }
389
+ ),
390
+ /* @__PURE__ */ t(ye, {})
391
+ ] }) : /* @__PURE__ */ t(P, {});
392
+ }, De = E(be), fe = ({
393
+ id: e,
394
+ onClose: s,
395
+ title: o,
396
+ showDrawer: l,
397
+ ...i
398
+ }) => {
399
+ const { common: a } = h(), { isCopyLoaded: c } = U();
400
+ return c ? /* @__PURE__ */ t(
401
+ ne,
402
+ {
403
+ ariaLabelClose: a.close_aria,
404
+ className: "mx-cat-category-selector-drawer",
405
+ id: e,
406
+ isOpen: l,
407
+ onClose: s,
408
+ title: o,
409
+ children: /* @__PURE__ */ t(De, { ...i })
410
+ }
411
+ ) : /* @__PURE__ */ t(P, {});
412
+ }, Je = E(fe);
413
+ export {
414
+ he as C,
415
+ De as a,
416
+ Je as b,
417
+ S as u
418
+ };
@@ -0,0 +1,186 @@
1
+ import { makeAutoObservable as y } from "mobx";
2
+ import { getUnixTime as n } from "date-fns/getUnixTime";
3
+ import { subMonths as c } from "date-fns/subMonths";
4
+ import { startOfMonth as C } from "date-fns/startOfMonth";
5
+ import { endOfMonth as h } from "date-fns/endOfMonth";
6
+ import { a as T, g as m } from "./CategoryUtil-CFHBvaV4.mjs";
7
+ import { F as f, A as i } from "./Fetch-DecPFeGU.mjs";
8
+ import { b as l, c as p } from "./Category-Ccoew_sA.mjs";
9
+ class d {
10
+ fetchInstance;
11
+ constructor(t, e, o) {
12
+ this.fetchInstance = new f(t, e, void 0, o);
13
+ }
14
+ addCategory = async (t) => this.fetchInstance.post(i.CATEGORIES, t).then((e) => e.category);
15
+ getCategories = async () => this.fetchInstance.get(i.CATEGORIES).then((t) => t.categories);
16
+ getDateRangeCategoryTotals = async (t, e, o) => o.length === 0 ? [] : this.fetchInstance.post(`${i.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
17
+ account_guid: o.map((a) => a.guid)
18
+ }).then((a) => a.date_range_category_totals);
19
+ getMonthlyCategoryTotals = async (t, e, o) => {
20
+ try {
21
+ const a = `${i.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`;
22
+ if (o) {
23
+ const r = o.length === 0 ? [""] : o.map((u) => u.guid);
24
+ return (await this.fetchInstance.post(a, { account_guid: r })).monthly_category_totals;
25
+ } else
26
+ return (await this.fetchInstance.get(a)).monthly_category_totals;
27
+ } catch (a) {
28
+ throw console.error("Error fetching monthly category totals:", a), a;
29
+ }
30
+ };
31
+ removeCategory = async (t) => this.fetchInstance.delete(`${i.CATEGORIES}/${t}`);
32
+ updateCategory = async (t) => this.fetchInstance.put(`${i.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
33
+ }
34
+ class S {
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
+ y(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 $ {
58
+ globalStore;
59
+ uiStore;
60
+ api = new d("/", "");
61
+ categories = [];
62
+ categoriesLoaded = !1;
63
+ categoriesLoading = !1;
64
+ dateRangeCategoryTotals = [];
65
+ monthlyCategoryTotals = [];
66
+ dateRangeTotalsLoaded = !1;
67
+ dateRangeTotalsLoading = !1;
68
+ monthlyTotalsLoaded = !1;
69
+ monthlyTotalsLoading = !1;
70
+ constructor(t) {
71
+ this.globalStore = t, this.uiStore = new S(), this.api = new d(t.endpoint, t.sessionToken, t.onError), y(this);
72
+ }
73
+ get detailedCategories() {
74
+ return this.globalStore.isInitialized ? T(
75
+ this.categories,
76
+ this.globalStore.copyStore.copy.categories,
77
+ this.dateRangeCategoryTotals,
78
+ this.monthlyCategoryTotals
79
+ ) : [];
80
+ }
81
+ get detailedCategoriesWithTransactions() {
82
+ return m(
83
+ this.detailedCategories,
84
+ this.globalStore.transactionStore.sortedTransactions
85
+ );
86
+ }
87
+ get incomeCategories() {
88
+ return this.detailedCategories.filter((t) => t.is_income);
89
+ }
90
+ get spendCategories() {
91
+ return this.detailedCategories.filter(
92
+ (t) => !t.is_income && !t.isTransfer && t.guid !== l.INVESTMENTS
93
+ );
94
+ }
95
+ get transferCategories() {
96
+ return this.detailedCategories.filter((t) => t.isTransfer);
97
+ }
98
+ setCategories = (t) => {
99
+ this.categories = t, this.categoriesLoading = !1, this.categoriesLoaded = !0;
100
+ };
101
+ setMonthlyCategoryTotals = (t) => {
102
+ this.monthlyCategoryTotals = t, this.monthlyTotalsLoading = !1, this.monthlyTotalsLoaded = !0;
103
+ };
104
+ setDateRangeCategoryTotals = (t) => {
105
+ this.dateRangeCategoryTotals = t, this.dateRangeTotalsLoading = !1, this.dateRangeTotalsLoaded = !0;
106
+ };
107
+ get trendsCategories() {
108
+ return this.detailedCategories.filter((t) => t.totalAmount !== 0).filter((t) => t.guid !== l.INVESTMENTS && t.guid !== l.TRANSFER);
109
+ }
110
+ addCategory = async (t, e) => {
111
+ const o = { name: t, parent_guid: e };
112
+ try {
113
+ await this.api.addCategory(o), await this.loadCategories();
114
+ } catch (a) {
115
+ console.error(`Error occurred while adding category: ${a}`);
116
+ }
117
+ };
118
+ loadCategories = async () => {
119
+ if (!this.categoriesLoading) {
120
+ this.categoriesLoading = !0;
121
+ try {
122
+ const t = await this.api.getCategories();
123
+ this.setCategories(t);
124
+ } catch (t) {
125
+ console.error(`Error occurred while getting categories: ${t}`);
126
+ }
127
+ }
128
+ };
129
+ loadDateRangeCategoryTotals = async (t, e, o) => {
130
+ if (!this.dateRangeTotalsLoading) {
131
+ this.dateRangeTotalsLoading = !0;
132
+ try {
133
+ const a = await this.api.getDateRangeCategoryTotals(
134
+ n(e),
135
+ n(o),
136
+ t
137
+ );
138
+ this.setDateRangeCategoryTotals(a);
139
+ } catch (a) {
140
+ console.error(`Error occurred while getting date range category totals: ${a}`);
141
+ }
142
+ }
143
+ };
144
+ loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, o) => {
145
+ if (this.monthlyTotalsLoading) return;
146
+ this.monthlyTotalsLoading = !0;
147
+ const a = n(C(e ?? c(/* @__PURE__ */ new Date(), 11))), r = n(h(o ?? /* @__PURE__ */ new Date()));
148
+ try {
149
+ const s = await this.api.getMonthlyCategoryTotals(a, r, t);
150
+ this.setMonthlyCategoryTotals(s);
151
+ } catch (s) {
152
+ console.error(`Error occurred while getting monthly category totals: ${s}`);
153
+ }
154
+ };
155
+ reloadCategoryTotals = async (t, e, o) => {
156
+ const a = e ?? c(/* @__PURE__ */ new Date(), 11), r = o ?? h(/* @__PURE__ */ new Date());
157
+ try {
158
+ await Promise.all([
159
+ this.loadMonthlyCategoryTotals(t, a, r),
160
+ this.loadDateRangeCategoryTotals(t, a, r)
161
+ ]);
162
+ } catch (s) {
163
+ console.error(`Error occurred while getting category totals: ${s}`);
164
+ }
165
+ };
166
+ removeCategory = async (t) => {
167
+ try {
168
+ await this.api.removeCategory(t), await this.loadCategories();
169
+ } catch (e) {
170
+ console.error(`Error occurred while removing category: ${e}`);
171
+ }
172
+ };
173
+ updateCategory = async (t) => {
174
+ try {
175
+ await this.api.updateCategory(t), await this.loadCategories();
176
+ } catch (e) {
177
+ console.error(`Error occurred while updating category: ${e}`);
178
+ }
179
+ };
180
+ // TODO: Remove this after refactoring Trends components to use detailedCategories
181
+ getCategoryName = (t) => this.categories.find((o) => o.guid === t)?.name ?? p[t];
182
+ }
183
+ export {
184
+ $ as C,
185
+ d as a
186
+ };
@@ -4,7 +4,7 @@ import { startOfToday as C } from "date-fns/startOfToday";
4
4
  import { subMonths as N } from "date-fns/subMonths";
5
5
  import { CategoryIconList as O } from "@mxenabled/mxui";
6
6
  import { C as b, a as D, b as E } from "./Category-Ccoew_sA.mjs";
7
- import { f as R, a as v } from "./Dialog-CDV0kKxj.mjs";
7
+ import { f as R, D as v } from "./Dialog-CWymUiuO.mjs";
8
8
  const H = 3, f = 12, k = (t, o, e, r) => t.filter((n) => !n.parent_guid).map(
9
9
  (n) => p(
10
10
  n,
@@ -3,9 +3,9 @@ import s from "react";
3
3
  import { observer as E } from "mobx-react-lite";
4
4
  import { useTheme as b } from "@mui/material/styles";
5
5
  import { ConnectionsWidget as D } from "@mxenabled/web-widget-sdk";
6
- import { d as a, e as c, f as i } from "./ConnectDrawer-Dn1MlqLz.mjs";
7
- import { d as L, e as w, u as _ } from "./hooks-C41HAxM5.mjs";
8
- import { D as x } from "./Drawer-Dqe5EqvA.mjs";
6
+ import { C as a, a as c, M as i } from "./GlobalAccountFilter-BpWlPAl5.mjs";
7
+ import { d as L, e as w, u as _ } from "./hooks-fY_n74f7.mjs";
8
+ import { D as x } from "./Drawer-Bet2ZPJo.mjs";
9
9
  const I = ({
10
10
  onClose: l,
11
11
  showConnectionsWidget: o,
@@ -47,7 +47,7 @@ const I = ({
47
47
  ] })
48
48
  }
49
49
  );
50
- }, W = E(I);
50
+ }, M = E(I);
51
51
  export {
52
- W as C
52
+ M as C
53
53
  };
@@ -5,7 +5,7 @@ import { v4 as B } from "uuid";
5
5
  import { useTokens as L, TextField as O, P as _ } from "@mxenabled/mxui";
6
6
  import { b as y, g as C } from "./Localization-2MODESHW.mjs";
7
7
  import { g as W, C as j, f as g, M as b } from "./NumberFormatting-DjTD0t3W.mjs";
8
- import { u as D } from "./hooks-C41HAxM5.mjs";
8
+ import { u as D } from "./hooks-fY_n74f7.mjs";
9
9
  const Q = ({
10
10
  allowDecimals: o = !0,
11
11
  ariaLabel: h,
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i } from "react/jsx-runtime";
2
- import { Text as u } from "@mxenabled/mxui";
3
- import { f as x } from "./NumberFormatting-DjTD0t3W.mjs";
2
+ import { P as u } from "@mxenabled/mxui";
3
+ import { f as a } from "./NumberFormatting-DjTD0t3W.mjs";
4
4
  const y = ({
5
5
  isIncome: e = !1,
6
6
  amount: o = 0,
@@ -13,7 +13,7 @@ const y = ({
13
13
  ...f
14
14
  }) => /* @__PURE__ */ i(u, { bold: s, color: r || (e ? "success.main" : "text.primary"), sx: n, variant: c, ...f, children: [
15
15
  t && t,
16
- x(Number(o), m ?? "0,0.00")
16
+ a(Number(o), m ?? "0,0.00")
17
17
  ] });
18
18
  export {
19
19
  y as C
@@ -7,8 +7,8 @@ import { isBefore as n } from "date-fns/isBefore";
7
7
  import { nextDay as c } from "date-fns/nextDay";
8
8
  import { setDate as d } from "date-fns/setDate";
9
9
  import { startOfToday as o } from "date-fns/startOfToday";
10
- import { fromUnixTime as i } from "date-fns/fromUnixTime";
11
- import { f as D, a as f } from "./Dialog-CDV0kKxj.mjs";
10
+ import { fromUnixTime as D } from "date-fns/fromUnixTime";
11
+ import { f as i, D as f } from "./Dialog-CWymUiuO.mjs";
12
12
  const x = (t) => {
13
13
  const e = y(t);
14
14
  let r = c(t, e);
@@ -34,7 +34,7 @@ const x = (t) => {
34
34
  }, Q = (t) => {
35
35
  const e = p(t);
36
36
  return a(e, 1);
37
- }, w = (t) => l(t, 1), F = (t) => D(i(t), f.DAY_OF_WEEK_MONTH_DAY), H = (t) => t ? D(i(t), f.MONTH_YEAR) : "";
37
+ }, w = (t) => l(t, 1), F = (t) => i(D(t), f.DAY_OF_WEEK_MONTH_DAY), H = (t) => t ? i(D(t), f.MONTH_YEAR) : "";
38
38
  export {
39
39
  Q as a,
40
40
  p as b,