@mx-cartographer/experiences 9.0.3 → 9.1.0-alpha.bb1

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 (121) hide show
  1. package/CHANGELOG.md +0 -4
  2. package/dist/Analytics-BKzTPees.mjs +61 -0
  3. package/dist/GlobalCopyApi-BeXzaDH9.mjs +487 -0
  4. package/dist/HeaderCell-EhCUSjvj.mjs +10 -0
  5. package/dist/Loader-BlVzRtUd.mjs +73 -0
  6. package/dist/MiniWidgetContainer-COwnjfy7.mjs +110 -0
  7. package/dist/OriginalBalanceAction-sbiqaxok.mjs +110 -0
  8. package/dist/SpendingLegend-D15ixlQ1.mjs +222 -0
  9. package/dist/accounts/index.es.js +12 -1598
  10. package/dist/accounts-DkyAiLpg.mjs +15632 -0
  11. package/dist/analytics/index.es.js +155 -139
  12. package/dist/budgets/index.es.js +1317 -1266
  13. package/dist/cashflow/index.es.js +1047 -942
  14. package/dist/categories/index.es.js +4 -4
  15. package/dist/common/index.es.js +101 -310
  16. package/dist/core/index.es.js +80 -104
  17. package/dist/core-BexP5oiV.mjs +4047 -0
  18. package/dist/dashboard/index.es.js +185 -141
  19. package/dist/debts/index.es.js +1384 -1272
  20. package/dist/finstrong/index.es.js +3366 -3471
  21. package/dist/goals/index.es.js +1103 -984
  22. package/dist/help/index.es.js +3 -25
  23. package/dist/help-CctDYrAH.mjs +2308 -0
  24. package/dist/insights/index.es.js +93 -4843
  25. package/dist/investments/index.es.js +1533 -1522
  26. package/dist/merchants/index.es.js +75 -64
  27. package/dist/microinsights/index.es.js +15 -824
  28. package/dist/microinsights-CRf3ChsJ.mjs +1814 -0
  29. package/dist/networth/index.es.js +550 -503
  30. package/dist/notifications/index.es.js +169 -161
  31. package/dist/recurringtransactions/index.es.js +10 -962
  32. package/dist/recurringtransactions-gbJ_NA8u.mjs +1564 -0
  33. package/dist/settings/index.es.js +13 -880
  34. package/dist/settings-ZMHe439l.mjs +1526 -0
  35. package/dist/spending/index.es.js +400 -456
  36. package/dist/transactions/index.es.js +10 -603
  37. package/dist/trends/index.es.js +1268 -1407
  38. package/package.json +28 -28
  39. package/dist/Account-BaJmiJAG.mjs +0 -118
  40. package/dist/Account-BxHMlV9R.mjs +0 -30
  41. package/dist/AccountDetailsHeader-DIysk_4w.mjs +0 -95
  42. package/dist/AccountDisplayName-CO7z3v99.mjs +0 -11
  43. package/dist/AccountFields-mwJ8NXsX.mjs +0 -141
  44. package/dist/AccountListItem-BDXHs4tV.mjs +0 -94
  45. package/dist/AccountUtils-T5_Odvos.mjs +0 -27
  46. package/dist/Accounts-CseLC3lL.mjs +0 -5
  47. package/dist/Analytics-CkYXKvco.mjs +0 -53
  48. package/dist/Analytics-CzGzz_sE.mjs +0 -136
  49. package/dist/ApiEndpoints-DXwIYNUV.mjs +0 -49
  50. package/dist/BudgetUtil-Bg2AQJpQ.mjs +0 -74
  51. package/dist/Category-DEKZGLYe.mjs +0 -301
  52. package/dist/CategorySelectorDrawer-8soGrhB8.mjs +0 -430
  53. package/dist/Connect-Dk6GZEsA.mjs +0 -39
  54. package/dist/ConnectCard-CCep7Zqe.mjs +0 -54
  55. package/dist/ConnectDrawer-Cnjr3Ddg.mjs +0 -58
  56. package/dist/ConnectionsDrawer-CtfPXk0M.mjs +0 -54
  57. package/dist/CurrencyDialog-DumQCTPO.mjs +0 -373
  58. package/dist/CurrencyInput-adTIRtL3.mjs +0 -87
  59. package/dist/CurrencyText-CCbE6MmF.mjs +0 -20
  60. package/dist/DateFormats-HudZ3Bjs.mjs +0 -64
  61. package/dist/DateUtil-Bhq59ZVg.mjs +0 -58
  62. package/dist/DebtUtils-DD3186U-.mjs +0 -153
  63. package/dist/Dialog-Bvd2n8hz.mjs +0 -66
  64. package/dist/Donut-SzzfZDHF.mjs +0 -88
  65. package/dist/Drawer-BXqqBMxg.mjs +0 -174
  66. package/dist/EmbeddedCard-DPwJjqMH.mjs +0 -856
  67. package/dist/EmptyState-CJUDc3kD.mjs +0 -84
  68. package/dist/Error-Dogaw2jO.mjs +0 -84
  69. package/dist/ErrorBoundary-CsdOcnJ9.mjs +0 -23
  70. package/dist/ExportCsvAction-Bw02ZJEj.mjs +0 -24
  71. package/dist/GlobalAccountFilter-7Cg2-9A5.mjs +0 -237
  72. package/dist/GlobalCopyApi-wcnDUzMV.mjs +0 -128
  73. package/dist/GoalsUtil-C9EnLWvC.mjs +0 -107
  74. package/dist/HeaderCell-P8w6CmfO.mjs +0 -6
  75. package/dist/Help-CkQTjORd.mjs +0 -299
  76. package/dist/Help-DJ8PrVHX.mjs +0 -3209
  77. package/dist/IconBacking-DgT8DCeh.mjs +0 -39
  78. package/dist/InformationTooltip-4su8bn1e.mjs +0 -41
  79. package/dist/InvestmentUtil-BItV7uEs.mjs +0 -134
  80. package/dist/LineChart-CejWS_rh.mjs +0 -612
  81. package/dist/ListItemAction-CzZ8s39Z.mjs +0 -69
  82. package/dist/ListItemRow-kH1rn8Xu.mjs +0 -67
  83. package/dist/ListItemWrapper-B5r-YQQ_.mjs +0 -42
  84. package/dist/Loader-CxeBwuPG.mjs +0 -21
  85. package/dist/Localization-DnoVyBNK.mjs +0 -38
  86. package/dist/ManageIncome-D1yBODQi.mjs +0 -595
  87. package/dist/MicroWidgetContainer-CfKdQfhi.mjs +0 -45
  88. package/dist/MiniWidgetContainer-BdPiUU-u.mjs +0 -66
  89. package/dist/NetWorthUtils-DilGN1nW.mjs +0 -95
  90. package/dist/Notification-DTNYSd8P.mjs +0 -7
  91. package/dist/NotificationSettings-B4JA5IKE.mjs +0 -677
  92. package/dist/NotificationUtils-BRGFTePr.mjs +0 -23
  93. package/dist/NumberFormatting--XMeeBfr.mjs +0 -49
  94. package/dist/OriginalBalanceAction-BybTXDtO.mjs +0 -114
  95. package/dist/RecurringSettings-D2xbNb67.mjs +0 -88
  96. package/dist/RecurringTransactionsUtil-B3rLEx_g.mjs +0 -253
  97. package/dist/ResponsiveButton-CC9F_Ezk.mjs +0 -45
  98. package/dist/SearchBox-Cpgu_gdO.mjs +0 -50
  99. package/dist/Select-BFt-HD-L.mjs +0 -55
  100. package/dist/SelectionBox-B4xELRgp.mjs +0 -48
  101. package/dist/SingleSegmentDonut-7Uy6VEld.mjs +0 -69
  102. package/dist/Sizes-DISGrlUg.mjs +0 -6
  103. package/dist/SkeletonLoader-BaNboJjD.mjs +0 -38
  104. package/dist/SpendingData-Fii_xATx.mjs +0 -53
  105. package/dist/SpendingLegend-5Ct_FZ8o.mjs +0 -193
  106. package/dist/StatusBar-CPfSXe80.mjs +0 -30
  107. package/dist/TabContentContainer-CnMXkVqr.mjs +0 -21
  108. package/dist/ToggleListItem-Dl1lXNwj.mjs +0 -91
  109. package/dist/TransactionDetails-DctXr07p.mjs +0 -1714
  110. package/dist/TransactionUtils-BphBJBbU.mjs +0 -234
  111. package/dist/TrendsUtil-D9z3kIj_.mjs +0 -69
  112. package/dist/UserStore-CRpKQjpP.mjs +0 -3002
  113. package/dist/ViewMoreMicroCard-BD_MNc2z.mjs +0 -1295
  114. package/dist/WidgetContainer-CmbU4CBH.mjs +0 -482
  115. package/dist/hooks-BaO_gOI6.mjs +0 -77
  116. package/dist/useAccountDisplayName-CFa_MrS6.mjs +0 -15
  117. package/dist/useAriaLive-MkYebyUR.mjs +0 -35
  118. package/dist/useDimensions-CeDR9V8N.mjs +0 -36
  119. package/dist/useInsightsEnabled-DaNLPmUU.mjs +0 -11
  120. package/dist/useScreenSize-mWpmnh5w.mjs +0 -36
  121. package/dist/useWidgetLoadTimer-CJb-RELP.mjs +0 -19
@@ -1,1714 +0,0 @@
1
- import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
- import l, { useMemo as ke } from "react";
3
- import { observer as w } from "mobx-react-lite";
4
- import Ue from "@mui/material/Alert";
5
- import V from "@mui/material/Box";
6
- import Te from "@mui/material/Divider";
7
- import be from "@mui/material/List";
8
- import he from "@mui/material/Paper";
9
- import We from "@mui/material/Snackbar";
10
- import L from "@mui/material/Stack";
11
- import { useTheme as F, alpha as xe } from "@mui/material/styles";
12
- import { P as ee, Text as x, H2 as Ve, MerchantLogo as Ce, Toast as Ye, CategoryIcon as Oe, CategoryIconVariants as Ge, TextField as Le, Icon as ye } from "@mxenabled/mxui";
13
- import { endOfMonth as Be } from "date-fns/endOfMonth";
14
- import { getUnixTime as Ie } from "date-fns/getUnixTime";
15
- import { isBefore as je } from "date-fns/isBefore";
16
- import { startOfMonth as De } from "date-fns/startOfMonth";
17
- import { b as E } from "./Localization-DnoVyBNK.mjs";
18
- import { f as W } from "./NumberFormatting--XMeeBfr.mjs";
19
- import { a as qe, i as Qe } from "./BudgetUtil-Bg2AQJpQ.mjs";
20
- import me from "@mui/material/Button";
21
- import Xe from "@mui/material/FormGroup";
22
- import ue from "@mui/material/IconButton";
23
- import $e from "@mui/material/TextField";
24
- import { u as Ae } from "./useAriaLive-MkYebyUR.mjs";
25
- import { b as Ze, T as Je, u as ne, O as C, c as et, d as tt, E as at, C as nt } from "./EmbeddedCard-DPwJjqMH.mjs";
26
- import { u as O, h as R, o as rt, d as ot, l as we, g as G, b as it, C as st } from "./hooks-BaO_gOI6.mjs";
27
- import { A as Y } from "./Analytics-CzGzz_sE.mjs";
28
- import lt from "@mui/material/ToggleButton";
29
- import { ChevronRight as Ke, Icon as P, Delete as fe, Cancel as Se, Search as ct, Edit as dt, Flag as ut } from "@mxenabled/mx-icons";
30
- import { fromUnixTime as ve } from "date-fns/fromUnixTime";
31
- import j from "@mui/material/Avatar";
32
- import z from "@mui/material/ListItem";
33
- import q from "@mui/material/ListItemAvatar";
34
- import U from "@mui/material/ListItemText";
35
- import { f as Me, D as Re } from "./DateFormats-HudZ3Bjs.mjs";
36
- import { BarChart as mt } from "@mui/x-charts";
37
- import { L as _t } from "./Loader-CxeBwuPG.mjs";
38
- import Q from "@mui/material/ListItemButton";
39
- import X from "@mui/material/ListItemIcon";
40
- import { b as Fe } from "./CategorySelectorDrawer-8soGrhB8.mjs";
41
- import { D as ae } from "./Dialog-Bvd2n8hz.mjs";
42
- import { D as _e } from "./Drawer-BXqqBMxg.mjs";
43
- import { b as gt, C as pt, a as ht } from "./CurrencyDialog-DumQCTPO.mjs";
44
- import Pe from "@mui/material/InputAdornment";
45
- import yt from "@mui/material/Checkbox";
46
- import { j as Tt } from "./DateUtil-Bhq59ZVg.mjs";
47
- import Ne from "@mui/material/Grid";
48
- import { C as bt } from "./CurrencyInput-adTIRtL3.mjs";
49
- import Ct from "@mui/material/Switch";
50
- var de = /* @__PURE__ */ ((t) => (t[t.Category = 0] = "Category", t[t.Date = 1] = "Date", t[t.Memo = 2] = "Memo", t[t.Tags = 3] = "Tags", t))(de || {}), ie = /* @__PURE__ */ ((t) => (t[t.MerchantBudget = 0] = "MerchantBudget", t[t.SplitTransaction = 1] = "SplitTransaction", t[t.HideTransaction = 2] = "HideTransaction", t[t.MerchantLogo = 3] = "MerchantLogo", t))(ie || {});
51
- const ft = [
52
- 0,
53
- 1,
54
- 2,
55
- 3
56
- /* Tags */
57
- ], St = [
58
- 1,
59
- 2,
60
- 3
61
- /* MerchantLogo */
62
- ], At = ({
63
- startDate: t,
64
- onViewHistory: n,
65
- totalTransaction: s,
66
- amount: a,
67
- spentPercentage: r,
68
- remainingAmount: o,
69
- iconColor: i,
70
- icon: _
71
- }) => {
72
- const { budgets: c } = O();
73
- return /* @__PURE__ */ e(l.Fragment, { children: /* @__PURE__ */ m(
74
- V,
75
- {
76
- sx: {
77
- bgcolor: "background.paper",
78
- borderBottomColor: "divider",
79
- borderBottomStyle: "solid",
80
- borderBottomWidth: 1
81
- },
82
- children: [
83
- /* @__PURE__ */ m(
84
- L,
85
- {
86
- sx: {
87
- alignItems: "center",
88
- flexDirection: "row",
89
- gap: 12,
90
- justifyContent: "space-between",
91
- pt: 16,
92
- px: 24
93
- },
94
- children: [
95
- /* @__PURE__ */ e(ee, { bold: !0, variant: "subtitle1", children: Tt(t) }),
96
- n && /* @__PURE__ */ e(me, { endIcon: /* @__PURE__ */ e(Ke, {}), onClick: n, sx: { height: 28 }, children: /* @__PURE__ */ e(x, { bold: !0, variant: "body2", children: c.spending_history }) })
97
- ]
98
- }
99
- ),
100
- /* @__PURE__ */ e(
101
- Ze,
102
- {
103
- amount: /* @__PURE__ */ m(L, { sx: { alignItems: "baseline", flexDirection: "row", gap: 4 }, children: [
104
- /* @__PURE__ */ e(Ve, { children: W(s, "0,0.00") }),
105
- /* @__PURE__ */ e(ee, { color: "text.secondary", variant: "body2", children: "/" }),
106
- /* @__PURE__ */ e(ee, { color: "text.secondary", variant: "body2", children: W(a, "0,0.00") })
107
- ] }),
108
- completeColor: `${i}.main`,
109
- icon: _,
110
- label: c.spent_label,
111
- leftLabel: E(c.percent_spent, r.toFixed()),
112
- percentComplete: r,
113
- rightLabel: E(
114
- c.balance_left,
115
- W(o, "0,0.00")
116
- ),
117
- sx: {
118
- pb: 24,
119
- pt: 16,
120
- px: 24
121
- }
122
- }
123
- )
124
- ]
125
- }
126
- ) });
127
- }, xt = ({
128
- merchantBudget: t,
129
- transaction: n,
130
- onClose: s,
131
- isOpen: a,
132
- setCurrencyDialogAction: r,
133
- renderingToast: o
134
- }) => {
135
- const { budgets: i, common: _ } = O(), { sortedTransactions: c } = R(), d = l.useMemo(() => c.reduce((h, I) => I.parent_guid ? h : h + I.amount, 0), [c]), { remainingAmount: u, spentPercentage: g, iconColor: p } = qe(
136
- d,
137
- t.amount ?? 0
138
- );
139
- return /* @__PURE__ */ m(
140
- _e,
141
- {
142
- ariaLabelClose: _.close_aria,
143
- footerStyles: {
144
- px: 24,
145
- py: 16
146
- },
147
- isOpen: a,
148
- onClose: s,
149
- onPrimaryAction: () => r(Ee.EDIT),
150
- onSecondaryAction: () => {
151
- r(Ee.DELETE);
152
- },
153
- primaryText: i.details_edit_button,
154
- secondaryColor: "error",
155
- secondaryText: i.details_delete_button,
156
- sx: {
157
- "& .list-wrapper": {
158
- pr: 24
159
- }
160
- },
161
- title: E(i.details_type_title, t.merchant_name),
162
- children: [
163
- /* @__PURE__ */ e(
164
- At,
165
- {
166
- amount: t.amount,
167
- icon: /* @__PURE__ */ e(
168
- Ce,
169
- {
170
- categoryGuid: n.top_level_category_guid || "",
171
- merchantGuid: n.merchant_guid || ""
172
- }
173
- ),
174
- iconColor: p,
175
- remainingAmount: u,
176
- spentPercentage: g,
177
- startDate: n.date,
178
- totalTransaction: d
179
- }
180
- ),
181
- /* @__PURE__ */ e(Je, {}),
182
- o?.()
183
- ]
184
- }
185
- );
186
- }, Nt = w(xt);
187
- var Ee = /* @__PURE__ */ ((t) => (t.CREATE = "create", t.EDIT = "edit", t.DELETE = "delete", t))(Ee || {});
188
- const It = w(({ transaction: t }) => {
189
- const [n, s] = l.useState(null), [a, r] = l.useState(""), [o, i] = l.useState(!1), _ = l.useRef(!1), [c, d] = l.useState(null), u = F(), {
190
- addMerchantBudget: g,
191
- updateMerchantBudget: p,
192
- deleteMerchantBudget: h,
193
- getMerchantBudgetByMerchantGuid: I,
194
- alert: M,
195
- setAlert: B
196
- } = rt(), { setFilter: k } = R(), { accounts: f } = ot(), A = u.palette.mode === "dark" ? "grey.800" : "grey.100", { budgets: y, common: Z } = O(), { announce: se, ariaLive: le } = Ae(), [te, $] = l.useState(!1), b = t?.merchant_guid ? I(t.merchant_guid) : void 0, K = () => {
197
- d(n), s(null), r("");
198
- }, re = () => {
199
- b ? $(!0) : s(
200
- "create"
201
- /* CREATE */
202
- );
203
- }, H = {
204
- create: {
205
- content: E(
206
- y.create_budget_content,
207
- /* @__PURE__ */ e("strong", { children: t.description }),
208
- `${W(t.amount, "0,0.00")}`
209
- ),
210
- title: y.dialog_create_budget_title,
211
- primaryButtonText: y.dialog_primary_button_text,
212
- errorAlertMessage: E(
213
- y.alert_merchant_budget_not_created,
214
- t.description
215
- ),
216
- errorRetryAction: () => s(
217
- "create"
218
- /* CREATE */
219
- ),
220
- successAlertMessage: E(
221
- y.alert_budget_created,
222
- t.description
223
- ),
224
- apiTrigger: async () => await g(t.merchant_guid, Number(a))
225
- },
226
- edit: {
227
- content: E(
228
- y.edit_budget_content,
229
- /* @__PURE__ */ e("strong", { children: t.description })
230
- ),
231
- title: y.details_edit_title,
232
- primaryButtonText: y.add_save_button,
233
- errorAlertMessage: E(
234
- y.error_alert_edit_merchant_budget,
235
- t.description
236
- ),
237
- errorRetryAction: () => s(
238
- "edit"
239
- /* EDIT */
240
- ),
241
- successAlertMessage: E(
242
- y.success_alert_edit_merchant_budget,
243
- t.description
244
- ),
245
- apiTrigger: async () => await p({
246
- ...b,
247
- amount: Number(a)
248
- })
249
- },
250
- delete: {
251
- content: E(
252
- y.delete_description,
253
- /* @__PURE__ */ e("strong", { children: t.description })
254
- ),
255
- title: y.delete_title,
256
- primaryButtonText: y.details_delete_button,
257
- errorAlertMessage: E(
258
- y.error_alert_delete_merchant_budget,
259
- t.description
260
- ),
261
- errorRetryAction: () => s(
262
- "delete"
263
- /* DELETE */
264
- ),
265
- successAlertMessage: E(
266
- y.success_alert_delete_merchant_budget,
267
- t.description
268
- ),
269
- apiTrigger: async () => await h(b.guid)
270
- }
271
- }, oe = async () => {
272
- if (_.current) return;
273
- _.current = !0;
274
- const { apiTrigger: v, successAlertMessage: S, errorAlertMessage: T } = H[n], { isSuccess: D } = await v(), J = D ? S : T;
275
- K(), i(!D), B(J), se(J), D && n === "delete" && $(!1), _.current = !1;
276
- };
277
- l.useEffect(() => {
278
- const v = {
279
- start: De(new Date(t.date * 1e3)),
280
- end: Be(new Date(t.date * 1e3))
281
- };
282
- te && k({
283
- accounts: f.map((S) => S.guid),
284
- custom: te ? (S) => S.merchant_guid === t.merchant_guid : (S) => S.guid === t.guid,
285
- dateRange: v
286
- });
287
- }, [te, t, f]);
288
- const N = () => /* @__PURE__ */ e(
289
- Ye,
290
- {
291
- actionText: y.autogenerate_budgets_error_primary_button,
292
- autoHideDuration: 3500,
293
- closeAriaLabel: Z.close_aria,
294
- handleClose: () => B(""),
295
- message: M,
296
- onActionClick: H[c]?.errorRetryAction,
297
- open: !!M,
298
- severity: o ? "error" : "success",
299
- showAction: o,
300
- showClose: !0
301
- }
302
- );
303
- return /* @__PURE__ */ m(l.Fragment, { children: [
304
- le,
305
- /* @__PURE__ */ e(z, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ m(Q, { onClick: re, children: [
306
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: A }, variant: "rounded", children: /* @__PURE__ */ e(P, { name: "bubble_chart", sx: { color: "text.primary" } }) }) }),
307
- /* @__PURE__ */ e(
308
- U,
309
- {
310
- primary: y.add_merchant_budget_primary_text,
311
- secondary: /* @__PURE__ */ e(x, { bold: !0, sx: { color: "text.primary" }, variant: "body1", children: b ? `${W(b.amount, "0,0.00")} / ${Z.month_text}` : y.add_merchant_budget_secondary_text }),
312
- slotProps: { primary: { variant: "caption", fontSize: 11, fontWeight: "normal" } }
313
- }
314
- ),
315
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
316
- ] }) }),
317
- !!b && /* @__PURE__ */ e(
318
- Nt,
319
- {
320
- isOpen: te,
321
- merchantBudget: b,
322
- onClose: () => $(!1),
323
- renderingToast: () => M && N(),
324
- setCurrencyDialogAction: (v) => {
325
- v === "edit" && r(b?.amount.toString() || ""), s(v);
326
- },
327
- transaction: t
328
- }
329
- ),
330
- n && /* @__PURE__ */ e(
331
- gt,
332
- {
333
- closeAriaLabel: Z.close_aria,
334
- content: H[n].content,
335
- handleInputChange: r,
336
- handleModalClose: K,
337
- handlePrimaryAction: oe,
338
- handleSecondaryAction: K,
339
- inputLabel: n !== "delete" ? Z.amount_text : "",
340
- inputValue: a,
341
- isOpen: !!n,
342
- primaryText: H[n].primaryButtonText,
343
- secondaryText: Z.cancel_button,
344
- title: H[n].title
345
- }
346
- ),
347
- !!M && N()
348
- ] });
349
- }), Dt = ({ transaction: t }) => {
350
- const { addOrUpdateTransactionRule: n, updateTransaction: s } = R(), { categories: a } = we(), { onEvent: r } = G(), { setShouldDisableDrawerScroll: o, updateManualTransaction: i } = ne(), { transactions: _ } = O(), c = F(), [d, u] = l.useState(!1), [g, p] = l.useState(""), h = async (f) => {
351
- await s({ ...t, category_guid: g }), f && await n(g, t), p(""), r(Y.TRANSACTION_DETAILS_CLICK_CATEGORY, {
352
- transaction_guid: t.guid
353
- });
354
- }, I = (f) => {
355
- if (t.is_manual && !t.guid) {
356
- const A = a.find((y) => y.guid === f);
357
- i({
358
- ...t,
359
- category: A?.name,
360
- category_guid: f,
361
- top_level_category_guid: A?.parent_guid || f
362
- });
363
- } else
364
- p(f);
365
- M();
366
- }, M = () => {
367
- u(!1), o(!1);
368
- }, B = l.useMemo(
369
- () => a.find((f) => f.guid === g),
370
- [g]
371
- ), k = c.palette.mode === "dark" ? "grey.800" : "grey.100";
372
- return /* @__PURE__ */ m(z, { disableGutters: !0, disablePadding: !0, children: [
373
- /* @__PURE__ */ m(
374
- Q,
375
- {
376
- onClick: () => {
377
- r(C.ON_TRANSACTION_CATEGORY_CLICK), u(!0);
378
- },
379
- children: [
380
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: k }, variant: "rounded", children: /* @__PURE__ */ e(
381
- Oe,
382
- {
383
- categoryGuid: t.top_level_category_guid,
384
- size: 24,
385
- sx: { color: "text.primary" },
386
- variant: Ge.Transparent
387
- }
388
- ) }) }),
389
- /* @__PURE__ */ e(
390
- U,
391
- {
392
- primary: _.category_title,
393
- secondary: /* @__PURE__ */ e(x, { bold: !0, sx: { color: "text.primary" }, variant: "body1", children: t.category ?? _.actions_select_a_category }),
394
- slotProps: { primary: { variant: "caption", fontSize: 11, fontWeight: "normal" } }
395
- }
396
- ),
397
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
398
- ]
399
- }
400
- ),
401
- /* @__PURE__ */ e(
402
- Fe,
403
- {
404
- initialSelected: t.category_guid,
405
- onClose: M,
406
- onSelect: I,
407
- showDrawer: d,
408
- title: _.actions_select_a_category
409
- }
410
- ),
411
- /* @__PURE__ */ e(
412
- ae,
413
- {
414
- copy: {
415
- title: E(
416
- _.actions_apply_to_all_transaction_types,
417
- t.description
418
- )
419
- },
420
- isOpen: !!g,
421
- onClose: () => p(""),
422
- onPrimaryAction: () => h(!0),
423
- onSecondaryAction: () => h(!1),
424
- primaryText: _.actions_apply_to_all,
425
- secondaryText: _.actions_this_time_only,
426
- children: /* @__PURE__ */ e(ee, { variant: "subtitle1", children: E(
427
- _.actions_all_past_and_future,
428
- t.description,
429
- B?.name
430
- ) })
431
- }
432
- )
433
- ] });
434
- }, vt = ({ transaction: t }) => {
435
- const { onEvent: n } = G(), { updateTransaction: s } = R(), { updateManualTransaction: a } = ne(), { common: r, transactions: o } = O(), i = F(), [_, c] = l.useState(!1), [d, u] = l.useState(t.date), g = (I) => {
436
- u(Ie(I));
437
- }, p = async () => {
438
- if (t.is_manual && !t.guid) {
439
- a({ ...t, date: d }), c(!1);
440
- return;
441
- }
442
- await s({ ...t, date: d }), n(Y.TRANSACTION_DETAILS_CLICK_DATE, { transaction_guid: t.guid }), c(!1);
443
- }, h = i.palette.mode === "dark" ? "grey.800" : "grey.100";
444
- return /* @__PURE__ */ m(z, { className: "mx-txn-date-action", disableGutters: !0, disablePadding: !0, children: [
445
- /* @__PURE__ */ m(
446
- Q,
447
- {
448
- onClick: () => {
449
- n(C.ON_TRANSACTION_DATE_CLICK), c(!0);
450
- },
451
- children: [
452
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: h }, variant: "rounded", children: /* @__PURE__ */ e(P, { name: "calendar_month", sx: { color: "text.primary" } }) }) }),
453
- /* @__PURE__ */ e(
454
- U,
455
- {
456
- primary: o.date_title,
457
- secondary: /* @__PURE__ */ e(x, { bold: !0, sx: { color: "text.primary" }, variant: "body1", children: Me(ve(t.date), Re.YEAR_MONTH_DAY) }),
458
- slotProps: { primary: { variant: "caption", fontSize: 11, fontWeight: "normal" } }
459
- }
460
- ),
461
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
462
- ]
463
- }
464
- ),
465
- /* @__PURE__ */ e(
466
- _e,
467
- {
468
- ariaLabelClose: r.close_aria,
469
- isOpen: _,
470
- onClose: () => c(!1),
471
- onPrimaryAction: p,
472
- primaryText: r.save_button,
473
- secondaryText: r.cancel_button,
474
- title: o.date_edit_title,
475
- children: /* @__PURE__ */ e(L, { alignItems: "center", mt: 40, children: /* @__PURE__ */ e(
476
- pt,
477
- {
478
- beginDate: ve(d),
479
- copy: {
480
- nextAria: o.date_next_aria,
481
- prevAria: o.date_prev_aria,
482
- today: r.date_range_picker.today
483
- },
484
- onDateSelected: g,
485
- selectionType: ht.Single
486
- }
487
- ) })
488
- }
489
- )
490
- ] });
491
- }, Et = ({ transaction: t }) => {
492
- const { onEvent: n } = G(), { removeTransaction: s } = R(), { setShouldDisableDrawerScroll: a } = ne(), { common: r, transactions: o } = O(), [i, _] = l.useState(!1), c = async () => {
493
- await s(t.guid), n(C.ON_TRANSACTION_DELETE_DELETED);
494
- };
495
- return /* @__PURE__ */ m(V, { className: "mx-txn-delete", children: [
496
- t && /* @__PURE__ */ e(z, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ m(
497
- Q,
498
- {
499
- onClick: () => {
500
- n(C.ON_TRANSACTION_DELETE_CLICK), a(!0), _(!0);
501
- },
502
- children: [
503
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { variant: "rounded", children: /* @__PURE__ */ e(fe, { color: "secondary", fontSize: "small" }) }) }),
504
- /* @__PURE__ */ e(
505
- U,
506
- {
507
- primary: o.manual_transaction_delete_title,
508
- secondary: o.manual_transaction_delete_subtitle
509
- }
510
- ),
511
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(fe, {}) })
512
- ]
513
- }
514
- ) }),
515
- /* @__PURE__ */ e(
516
- ae,
517
- {
518
- copy: { title: o.manual_transaction_delete_title },
519
- isOpen: i,
520
- onClose: () => {
521
- a(!1), _(!1);
522
- },
523
- onPrimaryAction: c,
524
- onSecondaryAction: () => n(C.ON_TRANSACTION_DELETE_CANCEL),
525
- primaryText: r.delete_button,
526
- secondaryText: r.cancel_button,
527
- children: /* @__PURE__ */ e(x, { variant: "subtitle1", children: o.manual_transaction_delete_description })
528
- }
529
- )
530
- ] });
531
- }, Ot = w(Et), Lt = ({ transaction: t }) => {
532
- const { onEvent: n } = G(), { updateTransaction: s } = R(), { setShouldDisableDrawerScroll: a } = ne(), { common: r, transactions: o } = O(), i = F(), [_, c] = l.useState(!1), d = async () => {
533
- await s({ ...t, merchant_guid: "" }), n(Y.TRANSACTION_DETAILS_CLICK_DELETE_LOGO, {
534
- transaction_guid: t.guid
535
- });
536
- }, u = i.palette.mode === "dark" ? "grey.800" : "grey.100";
537
- return /* @__PURE__ */ e(l.Fragment, { children: t && /* @__PURE__ */ m(z, { className: "mx-txn-delete-logo", disableGutters: !0, disablePadding: !0, children: [
538
- /* @__PURE__ */ m(
539
- Q,
540
- {
541
- onClick: () => {
542
- n(C.ON_TRANSACTION_DELETE_LOGO_CLICK), c(!0);
543
- },
544
- children: [
545
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: u }, variant: "rounded", children: /* @__PURE__ */ e(P, { name: "delete", sx: { color: "text.primary" } }) }) }),
546
- /* @__PURE__ */ e(U, { primary: o.merchant_logo_title, secondary: o.merchant_logo_desc }),
547
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
548
- ]
549
- }
550
- ),
551
- /* @__PURE__ */ m(
552
- ae,
553
- {
554
- copy: { title: o.merchant_logo_modal_title },
555
- isOpen: _,
556
- onClose: () => {
557
- a(!1), c(!1);
558
- },
559
- onPrimaryAction: d,
560
- onSecondaryAction: () => n(C.ON_TRANSACTION_DELETE_LOGO_CANCEL),
561
- primaryText: r.delete_button,
562
- secondaryText: r.cancel_button,
563
- title: o.merchant_logo_modal_title,
564
- children: [
565
- /* @__PURE__ */ e(x, { variant: "subtitle1", children: o.merchant_logo_modal_desc }),
566
- /* @__PURE__ */ e(x, { bold: !0, variant: "subtitle1", children: ` ${o.merchant_logo_modal_desc_bold}` })
567
- ]
568
- }
569
- )
570
- ] }) });
571
- }, wt = w(Lt), Mt = ({ transaction: t }) => {
572
- const { onEvent: n } = G(), { setAlert: s, updateTransaction: a } = R(), { setShouldDisableDrawerScroll: r } = ne(), { common: o, transactions: i } = O(), _ = F(), [c, d] = l.useState(!1), u = t.is_hidden, g = async () => {
573
- try {
574
- await a({ ...t, is_hidden: !t.is_hidden }), n(
575
- u ? C.ON_TRANSACTION_UNHIDDEN : C.ON_TRANSACTION_HIDDEN
576
- ), s(u ? i.transaction_included : i.transaction_excluded);
577
- } catch {
578
- s(u ? i.transaction_not_included : i.transaction_not_excluded);
579
- }
580
- }, p = _.palette.mode === "dark" ? "grey.800" : "grey.100";
581
- return /* @__PURE__ */ e(l.Fragment, { children: t && /* @__PURE__ */ m(z, { className: "mx-txn-hide-transaction", disableGutters: !0, disablePadding: !0, children: [
582
- /* @__PURE__ */ m(
583
- Q,
584
- {
585
- "aria-checked": u,
586
- "aria-labelledby": "hide-transaction-text",
587
- onClick: () => {
588
- n(
589
- u ? C.ON_TRANSACTION_UNHIDE_CLICK : C.ON_TRANSACTION_HIDE_CLICK
590
- ), n(
591
- u ? "transaction_details_click_unhide_transaction" : "transaction_details_click_hide_transaction",
592
- {
593
- transaction_guid: t.guid
594
- }
595
- ), d(!0);
596
- },
597
- role: "switch",
598
- children: [
599
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: p }, variant: "rounded", children: u ? /* @__PURE__ */ e(P, { name: "visibility_off", sx: { color: "text.primary" } }) : /* @__PURE__ */ e(P, { name: "visibility", sx: { color: "text.primary" } }) }) }),
600
- /* @__PURE__ */ e(
601
- U,
602
- {
603
- id: "hide-transaction-text",
604
- primary: i.exclude_transaction,
605
- secondary: i.excluding_transaction
606
- }
607
- ),
608
- /* @__PURE__ */ e(X, { "aria-hidden": "true", children: /* @__PURE__ */ e(
609
- Ct,
610
- {
611
- checked: u,
612
- slotProps: { input: { tabIndex: -1 } },
613
- sx: { pointerEvents: "none" },
614
- tabIndex: -1
615
- }
616
- ) })
617
- ]
618
- }
619
- ),
620
- /* @__PURE__ */ e(
621
- ae,
622
- {
623
- copy: {
624
- title: u ? i.include_transaction : i.exclude_transaction
625
- },
626
- isOpen: c,
627
- onClose: () => {
628
- r(!1), d(!1);
629
- },
630
- onPrimaryAction: g,
631
- onSecondaryAction: () => n(
632
- u ? C.ON_TRANSACTION_UNHIDE_CANCEL_CLICK : C.ON_TRANSACTION_HIDE_CANCEL_CLICK
633
- ),
634
- primaryText: u ? i.include : i.exclude,
635
- secondaryText: o.cancel_button,
636
- children: /* @__PURE__ */ e(x, { truncate: !1, variant: "subtitle1", children: u ? i.including_transaction : i.excluding_transaction })
637
- }
638
- )
639
- ] }) });
640
- }, Rt = w(Mt), He = ({ transaction: t }) => {
641
- const { amount: n, description: s, isIncome: a, merchant_guid: r, payee: o, top_level_category_guid: i } = t;
642
- return /* @__PURE__ */ m(L, { className: "mx-txn-amount-header", direction: "row", gap: 12, px: 16, py: 24, children: [
643
- /* @__PURE__ */ e(
644
- Ce,
645
- {
646
- categoryGuid: i || "",
647
- merchantGuid: r || "",
648
- size: 64
649
- }
650
- ),
651
- /* @__PURE__ */ m(L, { overflow: "hidden'", children: [
652
- /* @__PURE__ */ e(x, { bold: !0, mb: 4, truncate: !0, variant: "body1", children: s || o }),
653
- /* @__PURE__ */ m(ee, { color: a ? "success.main" : "text.primary", truncate: !0, variant: "h1", children: [
654
- a ? "+" : "",
655
- W(n, "0,0.00")
656
- ] })
657
- ] })
658
- ] });
659
- }, kt = ({ transaction: t }) => {
660
- const { onEvent: n } = G(), { updateTransaction: s } = R(), { updateManualTransaction: a } = ne(), { common: r, transactions: o } = O(), i = F(), [_, c] = l.useState(!1), [d, u] = l.useState("");
661
- l.useEffect(() => {
662
- _ && u(t.memo ? t.memo : "");
663
- }, [_]);
664
- const g = async () => {
665
- if (t.is_manual && !t.guid) {
666
- a({ ...t, memo: d }), c(!1);
667
- return;
668
- }
669
- await s({ ...t, memo: d }), n(Y.TRANSACTION_DETAILS_CLICK_MEMO, { transaction_guid: t.guid }), c(!1);
670
- }, p = i.palette.mode === "dark" ? "grey.800" : "grey.100";
671
- return /* @__PURE__ */ m(z, { className: "mx-txn-memo-action", disableGutters: !0, disablePadding: !0, children: [
672
- /* @__PURE__ */ m(
673
- Q,
674
- {
675
- onClick: () => {
676
- n(C.ON_TRANSACTION_MEMO_CLICK), c(!0);
677
- },
678
- children: [
679
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: p }, variant: "rounded", children: /* @__PURE__ */ e(P, { name: "article", sx: { color: "text.primary" } }) }) }),
680
- /* @__PURE__ */ e(
681
- U,
682
- {
683
- primary: o.memo_title,
684
- secondary: /* @__PURE__ */ e(x, { bold: !0, sx: { color: "text.primary" }, variant: "body1", children: t.memo ? t.memo : o.memo_desc }),
685
- slotProps: { primary: { variant: "caption", fontSize: 11, fontWeight: "normal" } }
686
- }
687
- ),
688
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
689
- ]
690
- }
691
- ),
692
- /* @__PURE__ */ m(
693
- _e,
694
- {
695
- ariaLabelClose: r.close_aria,
696
- isOpen: _,
697
- onClose: () => c(!1),
698
- onPrimaryAction: g,
699
- title: o.memo_title,
700
- children: [
701
- /* @__PURE__ */ e(He, { transaction: t }),
702
- /* @__PURE__ */ e(
703
- $e,
704
- {
705
- "aria-label": o.memo_desc_aria,
706
- focused: !0,
707
- multiline: !0,
708
- name: "memo",
709
- onChange: (h) => u(h.target.value),
710
- placeholder: o.memo_desc,
711
- rows: 4,
712
- sx: { mx: 16, width: "calc(100% - 32px)" },
713
- value: d
714
- }
715
- )
716
- ]
717
- }
718
- )
719
- ] });
720
- }, Pt = w(kt), Gt = ({
721
- index: t,
722
- onDeleteRow: n,
723
- onCategoryChanged: s,
724
- onUpdateAmount: a,
725
- split: r
726
- }) => {
727
- const { onEvent: o } = G(), { transactions: i } = O(), [_, c] = l.useState(`${r.amount}`), [d, u] = l.useState(!1), g = t === 0, p = (h) => {
728
- isNaN(Number(h)) || (c(h), a(t, Number(h)));
729
- };
730
- return /* @__PURE__ */ m(V, { bgcolor: "background.paper", className: "mx-txn-split-manager-row", pb: 4, px: 8, children: [
731
- /* @__PURE__ */ m(Ne, { alignItems: g ? "center" : "start", container: !0, children: [
732
- /* @__PURE__ */ e(Ne, { size: 7, children: /* @__PURE__ */ m(L, { alignItems: "start", children: [
733
- /* @__PURE__ */ e(
734
- me,
735
- {
736
- endIcon: /* @__PURE__ */ e(Ke, {}),
737
- onClick: () => u(!0),
738
- startIcon: /* @__PURE__ */ e(Oe, { categoryGuid: r.top_level_category_guid }),
739
- sx: { px: 12, py: 8 },
740
- children: r.category
741
- }
742
- ),
743
- /* @__PURE__ */ e(V, { children: !r.category_guid && /* @__PURE__ */ m(L, { color: "error.main", direction: "row", gap: 8, p: 12, children: [
744
- /* @__PURE__ */ e("span", { "aria-label": "error", role: "img", children: /* @__PURE__ */ e(Se, { sx: { fontSize: 15 } }) }),
745
- /* @__PURE__ */ e(x, { variant: "body2", children: i.split_transaction_errors_select_category })
746
- ] }) })
747
- ] }) }),
748
- /* @__PURE__ */ e(Ne, { size: 5, children: g ? /* @__PURE__ */ e("div", { className: "mx-txn-split-manager-row-top-container", children: /* @__PURE__ */ e(x, { children: W(r.amount, "0,0.00") }) }) : /* @__PURE__ */ m(L, { alignItems: "start", children: [
749
- /* @__PURE__ */ m(L, { alignItems: "start", direction: "row", gap: 8, children: [
750
- /* @__PURE__ */ e(
751
- bt,
752
- {
753
- amount: _,
754
- ariaLabel: i.split_transaction_edit_split_amount,
755
- label: i.split_transaction_edit_split_amount,
756
- minAmount: 0.01,
757
- name: "split-amount-input",
758
- setAmount: p,
759
- sx: {
760
- ".MuiOutlinedInput-input": { p: 12 }
761
- },
762
- type: "number"
763
- }
764
- ),
765
- /* @__PURE__ */ e(
766
- ue,
767
- {
768
- "aria-label": i.split_transaction_delete_split_btn,
769
- color: "secondary",
770
- onClick: () => {
771
- o(C.ON_TRANSACTION_SPLIT_DELETE_CLICK), n(t);
772
- },
773
- sx: { w: 44, h: 44 },
774
- children: /* @__PURE__ */ e(fe, {})
775
- }
776
- )
777
- ] }),
778
- !_ && /* @__PURE__ */ m(L, { color: "error.main", direction: "row", gap: 8, py: 12, children: [
779
- /* @__PURE__ */ e("span", { "aria-label": "error", role: "img", children: /* @__PURE__ */ e(Se, { sx: { fontSize: 15 } }) }),
780
- /* @__PURE__ */ e(x, { variant: "body2", children: i.split_transaction_errors_enter_an_amount })
781
- ] })
782
- ] }) })
783
- ] }),
784
- /* @__PURE__ */ e(
785
- Fe,
786
- {
787
- initialSelected: r.category_guid,
788
- onClose: () => u(!1),
789
- onSelect: (h) => {
790
- s(t, h), u(!1);
791
- },
792
- showDrawer: d,
793
- title: i.actions_select_a_category
794
- }
795
- )
796
- ] });
797
- }, Bt = w(Gt), $t = ({
798
- onAddSplit: t,
799
- onCategoryChanged: n,
800
- onDeleteSplit: s,
801
- onUpdateAmount: a,
802
- splits: r,
803
- transaction: o
804
- }) => {
805
- const { transactions: i } = O(), { onEvent: _ } = G(), [c, d] = l.useState(""), { announce: u, ariaLive: g } = Ae();
806
- return l.useEffect(() => {
807
- if (r.length <= 1)
808
- d(i.split_transaction_errors_min_splits), u(i.split_transaction_errors_min_splits);
809
- else if (r[0].amount < 0) {
810
- const p = E(
811
- i.split_transaction_errors_totals_must_equal_amount,
812
- W(o.amount, "0,0.00")
813
- );
814
- d(p), u(p);
815
- } else
816
- d(""), u("");
817
- }, [r]), /* @__PURE__ */ m(V, { className: "mx-txn-split-manager", children: [
818
- g,
819
- r.map((p, h) => /* @__PURE__ */ e(
820
- Bt,
821
- {
822
- index: h,
823
- onCategoryChanged: n,
824
- onDeleteRow: s,
825
- onUpdateAmount: a,
826
- split: p
827
- },
828
- h
829
- )),
830
- c && /* @__PURE__ */ m(L, { bgcolor: "background.paper", color: "error.main", direction: "row", gap: 8, p: 16, children: [
831
- /* @__PURE__ */ e("span", { "aria-label": "error", role: "img", children: /* @__PURE__ */ e(Se, { sx: { fontSize: 15 } }) }),
832
- /* @__PURE__ */ e(x, { variant: "body2", children: c })
833
- ] }),
834
- /* @__PURE__ */ e(V, { p: 16, children: /* @__PURE__ */ e(
835
- me,
836
- {
837
- "aria-label": i.split_transaction_add_split_btn,
838
- onClick: () => {
839
- _(C.ON_TRANSACTION_SPLIT_ADD_CLICK), t();
840
- },
841
- children: i.split_transaction_add_split_btn
842
- }
843
- ) })
844
- ] });
845
- }, Kt = w($t), Ft = ({ transaction: t }) => {
846
- const { onEvent: n } = G(), { announce: s, ariaLive: a } = Ae(), { splitTransaction: r, unSplitTransaction: o } = R(), { common: i, transactions: _ } = O(), { setShouldDisableDrawerScroll: c } = ne(), { categories: d } = we(), u = F(), g = {
847
- ...t,
848
- amount: t.amount - 1,
849
- guid: "",
850
- has_been_split: !1,
851
- parent_guid: t.guid
852
- }, p = {
853
- ...t,
854
- amount: 1,
855
- category_guid: void 0,
856
- category: _.split_transaction_select_category_btn,
857
- guid: "",
858
- has_been_split: !1,
859
- parent_guid: t.guid,
860
- top_level_category_guid: void 0
861
- }, [h, I] = l.useState(!1), [M, B] = l.useState(!1), [k, f] = l.useState(!1), [A, y] = l.useState([]), Z = () => {
862
- const N = [...A];
863
- N.push({ ...p }), N[0].amount -= 1, y(N), s(
864
- E(
865
- _.split_transaction_add_split_announcement,
866
- N.length
867
- )
868
- );
869
- }, se = (N) => {
870
- if (N > 0) {
871
- const v = A[N], S = [...A];
872
- S.splice(N, 1), S[0].amount += v.amount, y(S), s(
873
- E(_.split_transaction_delete_split_announcement, N + 1)
874
- );
875
- }
876
- }, le = (N, v) => {
877
- const S = [...A];
878
- S[N].amount = v, S[0].amount = t.amount - S.reduce(
879
- (T, D, J) => T + (J !== 0 ? D.amount : 0),
880
- 0
881
- ), y(S);
882
- }, te = (N, v) => {
883
- const S = [...A], T = d.find((D) => D.guid === v);
884
- T && (S[N] = {
885
- ...S[N],
886
- category_guid: v,
887
- category: T.name,
888
- top_level_category_guid: T.parent_guid || v
889
- }, y(S), s(
890
- E(
891
- _.split_transaction_select_category_announcement,
892
- T.name,
893
- N + 1
894
- )
895
- ));
896
- }, $ = () => {
897
- if (t.parent_guid || t.has_been_split) {
898
- B(!0);
899
- return;
900
- }
901
- y([{ ...g }, { ...p }]), n(Y.TRANSACTION_DETAILS_CLICK_SPLIT, {
902
- transaction_guid: t.guid
903
- }), I(!0);
904
- }, b = async () => {
905
- if (!k) {
906
- f(!0);
907
- try {
908
- n(C.ON_TRANSACTION_SPLIT_SAVE_CLICK), await r({ ...t, has_been_split: !0 }, A), I(!1);
909
- } finally {
910
- f(!1);
911
- }
912
- }
913
- }, K = async () => {
914
- k || (n(C.ON_TRANSACTION_SPLIT_CANCEL_CLICK), y([{ ...g }, { ...p }]), f(!1), I(!1));
915
- }, re = async () => {
916
- n(Y.TRANSACTION_DETAILS_CLICK_UNSPLIT, {
917
- transaction_guid: t.guid
918
- });
919
- const N = t.parent_guid ?? t.guid;
920
- await o(N);
921
- }, H = l.useMemo(() => {
922
- const N = A.some((S) => !S.category_guid), v = A.some((S) => S.amount <= 0);
923
- return N || v;
924
- }, [A]), oe = u.palette.mode === "dark" ? "grey.800" : "grey.100";
925
- return /* @__PURE__ */ e(l.Fragment, { children: t && /* @__PURE__ */ m(z, { disableGutters: !0, disablePadding: !0, children: [
926
- /* @__PURE__ */ m(Q, { onClick: $, children: [
927
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: oe }, variant: "rounded", children: /* @__PURE__ */ e(P, { name: "call_split", sx: { color: "text.primary" } }) }) }),
928
- /* @__PURE__ */ e(
929
- U,
930
- {
931
- primary: t.has_been_split || t.parent_guid ? _.split_transaction_unsplit_title : _.split_transaction_title,
932
- secondary: t.has_been_split || t.parent_guid ? _.split_transaction_unsplit_subtitle : _.split_transaction_desc
933
- }
934
- ),
935
- /* @__PURE__ */ e(X, { children: t.has_been_split || t.parent_guid ? /* @__PURE__ */ e(P, { name: "delete" }) : /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
936
- ] }),
937
- /* @__PURE__ */ m(
938
- _e,
939
- {
940
- ariaLabelClose: i.close_aria,
941
- isOpen: h,
942
- isPrimaryDisabled: H || k,
943
- onClose: K,
944
- onPrimaryAction: b,
945
- primaryText: i.save_button,
946
- secondaryText: i.cancel_button,
947
- title: _.split_transaction_title,
948
- children: [
949
- a,
950
- /* @__PURE__ */ e(He, { transaction: t }),
951
- /* @__PURE__ */ e(
952
- Kt,
953
- {
954
- onAddSplit: Z,
955
- onCategoryChanged: te,
956
- onDeleteSplit: se,
957
- onUpdateAmount: le,
958
- splits: A,
959
- transaction: t
960
- }
961
- )
962
- ]
963
- }
964
- ),
965
- /* @__PURE__ */ e(
966
- ae,
967
- {
968
- copy: { title: _.split_transaction_unsplit_title },
969
- isOpen: M,
970
- onClose: () => {
971
- c(!1), B(!1);
972
- },
973
- onPrimaryAction: re,
974
- onSecondaryAction: () => {
975
- n(C.ON_TRANSACTION_UNSPLIT_CANCEL);
976
- },
977
- primaryText: i.delete_button,
978
- secondaryText: i.cancel_button,
979
- children: /* @__PURE__ */ e(ee, { variant: "subtitle1", children: E(
980
- _.split_transaction_unsplit_description,
981
- t.description
982
- ) })
983
- }
984
- )
985
- ] }) });
986
- }, Ht = w(Ft), zt = () => {
987
- const t = F(), { onEvent: n } = G(), { addTag: s } = R(), { transactions: a } = O(), [r, o] = l.useState(!1), [i, _] = l.useState(""), [c, d] = l.useState(""), u = l.useRef(null);
988
- l.useEffect(() => {
989
- r && u?.current?.focus();
990
- }, [r]);
991
- const g = () => {
992
- n(
993
- r ? C.ON_TRANSACTION_TAGS_TAG_ADD_CANCEL_CLICK : C.ON_TRANSACTION_TAGS_TAG_ADD_CLICK
994
- ), r || _(""), o(!r);
995
- }, p = async () => {
996
- n(C.ON_TRANSACTION_TAGS_TAG_ADDED), await s(i), o(!1);
997
- };
998
- return l.useEffect(() => {
999
- d(i.length > 40 ? a.tags_error_name_must_be_40_chars : "");
1000
- }, [i]), /* @__PURE__ */ m(V, { className: "mx-txn-tag-manager-header", children: [
1001
- /* @__PURE__ */ m(
1002
- L,
1003
- {
1004
- alignItems: "center",
1005
- bgcolor: t.palette.background.default,
1006
- direction: "row",
1007
- justifyContent: "space-between",
1008
- px: 24,
1009
- py: 16,
1010
- children: [
1011
- /* @__PURE__ */ e(x, { bold: !0, children: a.tags_your_tags }),
1012
- /* @__PURE__ */ e(
1013
- me,
1014
- {
1015
- "aria-expanded": r,
1016
- "aria-label": a.tags_add_tag_btn_aria,
1017
- onClick: g,
1018
- children: a.tags_add_tag_btn
1019
- }
1020
- )
1021
- ]
1022
- }
1023
- ),
1024
- /* @__PURE__ */ m(
1025
- ae,
1026
- {
1027
- copy: { title: a.tags_add_tag_btn },
1028
- isOpen: r,
1029
- onClose: () => o(!1),
1030
- onPrimaryAction: p,
1031
- onSecondaryAction: () => o(!1),
1032
- children: [
1033
- /* @__PURE__ */ e(
1034
- Le,
1035
- {
1036
- "aria-label": a.tags_placeholder,
1037
- name: "add-tag",
1038
- onChange: (h) => _(h.target.value),
1039
- placeholder: a.tags_placeholder,
1040
- sx: { width: "100%" },
1041
- value: i
1042
- }
1043
- ),
1044
- /* @__PURE__ */ e(ee, { id: "add-tag-error", sx: { color: "error.main" }, variant: "subtitle2", children: c })
1045
- ]
1046
- }
1047
- )
1048
- ] });
1049
- }, Ut = w(zt), Wt = ({ onSearchValueChanged: t, searchValue: n }) => {
1050
- const { common: s, transactions: a } = O(), r = /* @__PURE__ */ e(
1051
- ue,
1052
- {
1053
- "aria-label": a.tags_cancel_search || "Search",
1054
- onClick: () => t(""),
1055
- children: /* @__PURE__ */ e(Se, {})
1056
- }
1057
- );
1058
- return /* @__PURE__ */ e(V, { className: "mx-txn-tag-manager-search", px: 24, py: 16, children: /* @__PURE__ */ e(
1059
- Le,
1060
- {
1061
- "aria-label": s.search_aria,
1062
- name: "search",
1063
- onChange: (o) => t(o.target.value),
1064
- placeholder: s.search_placeholder,
1065
- slotProps: {
1066
- input: {
1067
- startAdornment: /* @__PURE__ */ e(Pe, { position: "start", children: /* @__PURE__ */ e(ct, { color: "disabled" }) }),
1068
- endAdornment: /* @__PURE__ */ e(Pe, { position: "end", sx: { padding: 0 }, children: n ? r : null })
1069
- }
1070
- },
1071
- sx: { bgcolor: "background.paper", width: "100%" },
1072
- value: n
1073
- }
1074
- ) });
1075
- }, Vt = w(Wt), Yt = ({ onTagChecked: t, selectedTags: n, tag: s }) => {
1076
- const { onEvent: a } = G(), { removeTag: r, updateTag: o } = R(), { common: i, transactions: _ } = O(), [c, d] = l.useState(!1), [u, g] = l.useState(!1), [p, h] = l.useState(""), [I, M] = l.useState(""), B = async () => {
1077
- a(C.ON_TRANSACTION_TAGS_TAG_EDIT_SAVED), s && await o({ ...s, name: p }), d(!1);
1078
- }, k = async () => {
1079
- a(C.ON_TRANSACTION_TAGS_TAG_DELETED), await r(s.guid), g(!1);
1080
- };
1081
- l.useEffect(() => {
1082
- M(p.length > 40 ? _.tags_error_name_must_be_40_chars : "");
1083
- }, [p]);
1084
- const f = () => {
1085
- a(C.ON_TRANSACTION_TAGS_TAG_EDIT_CLICK), h(s.name), d(!0);
1086
- }, A = () => {
1087
- a(C.ON_TRANSACTION_TAGS_TAG_DELETE_CLICK), g(!0);
1088
- };
1089
- return /* @__PURE__ */ m(
1090
- z,
1091
- {
1092
- className: "mx-txn-transaction-manager-row",
1093
- disableGutters: !0,
1094
- disablePadding: !0,
1095
- secondaryAction: !s.is_default_tag && /* @__PURE__ */ m(L, { direction: "row", children: [
1096
- /* @__PURE__ */ e(
1097
- ue,
1098
- {
1099
- "aria-label": `Edit ${s.name} tag`,
1100
- color: "secondary",
1101
- onClick: f,
1102
- children: /* @__PURE__ */ e(dt, { color: "secondary" })
1103
- }
1104
- ),
1105
- /* @__PURE__ */ e(
1106
- ue,
1107
- {
1108
- "aria-label": `Delete ${s.name} tag`,
1109
- color: "secondary",
1110
- onClick: A,
1111
- children: /* @__PURE__ */ e(fe, { color: "secondary" })
1112
- }
1113
- )
1114
- ] }),
1115
- children: [
1116
- /* @__PURE__ */ m(
1117
- Q,
1118
- {
1119
- "aria-checked": n.includes(s.guid),
1120
- onClick: () => t(s.guid),
1121
- role: "checkbox",
1122
- children: [
1123
- /* @__PURE__ */ e(X, { sx: { ml: 0 }, children: /* @__PURE__ */ e(
1124
- yt,
1125
- {
1126
- "aria-hidden": !0,
1127
- checked: n.includes(s.guid),
1128
- edge: "start",
1129
- tabIndex: -1
1130
- }
1131
- ) }),
1132
- /* @__PURE__ */ e(U, { children: s.name })
1133
- ]
1134
- }
1135
- ),
1136
- /* @__PURE__ */ m(
1137
- ae,
1138
- {
1139
- copy: { title: "Update tag name" },
1140
- isOpen: c,
1141
- onClose: () => d(!1),
1142
- onPrimaryAction: B,
1143
- onSecondaryAction: () => d(!1),
1144
- children: [
1145
- /* @__PURE__ */ e(
1146
- Le,
1147
- {
1148
- "aria-describedby": I ? "update-tag-error" : void 0,
1149
- "aria-label": _.tags_update_the_tag_name,
1150
- name: "update-tag",
1151
- onChange: (y) => h(y.target.value),
1152
- placeholder: "Tag name",
1153
- sx: { width: "100%" },
1154
- value: p
1155
- }
1156
- ),
1157
- /* @__PURE__ */ e(ee, { id: "update-tag-error", sx: { color: "error.main" }, variant: "subtitle2", children: I })
1158
- ]
1159
- }
1160
- ),
1161
- /* @__PURE__ */ e(
1162
- ae,
1163
- {
1164
- copy: { title: _.tags_delete_title },
1165
- isOpen: u,
1166
- onClose: () => g(!1),
1167
- onPrimaryAction: k,
1168
- onSecondaryAction: () => a(C.ON_TRANSACTION_TAGS_TAG_DELETE_CANCEL_CLICK),
1169
- primaryText: i.delete_button,
1170
- secondaryText: i.cancel_button,
1171
- children: /* @__PURE__ */ e(x, { truncate: !1, children: _.tags_deleting_this_tag_will_remove_it })
1172
- }
1173
- )
1174
- ]
1175
- }
1176
- );
1177
- }, jt = w(Yt), qt = ({ selectedTags: t, onTagChecked: n }) => {
1178
- const { tags: s } = R(), [a, r] = l.useState(""), o = s.filter(
1179
- (i) => i.name.toLowerCase().includes(a.toLowerCase())
1180
- );
1181
- return /* @__PURE__ */ m("div", { className: "mx-txn-tag-manager", children: [
1182
- /* @__PURE__ */ e(
1183
- Vt,
1184
- {
1185
- onSearchValueChanged: (i) => r(i),
1186
- searchValue: a
1187
- }
1188
- ),
1189
- /* @__PURE__ */ e(Ut, {}),
1190
- /* @__PURE__ */ e(he, { sx: { boxShadow: "none" }, children: /* @__PURE__ */ e(be, { children: o.map((i) => /* @__PURE__ */ m(l.Fragment, { children: [
1191
- /* @__PURE__ */ e(jt, { onTagChecked: n, selectedTags: t, tag: i }),
1192
- /* @__PURE__ */ e(Te, { sx: { ml: 24 } })
1193
- ] }, i.guid)) }) })
1194
- ] });
1195
- }, Qt = w(qt), Xt = ({ transaction: t }) => {
1196
- const { onEvent: n } = G(), { tags: s, updateTaggings: a, updateTransaction: r } = R(), { common: o, transactions: i } = O(), { updateManualTransaction: _ } = ne(), c = F(), [d, u] = l.useState(!1), [g, p] = l.useState(t.tags);
1197
- l.useEffect(() => {
1198
- p(t.tags);
1199
- }, [d, t]);
1200
- const h = (k) => {
1201
- const f = [...g], A = g.indexOf(k);
1202
- A >= 0 ? f.splice(A, 1) : f.push(k), p(f);
1203
- }, I = async () => {
1204
- if (t.is_manual && !t.guid) {
1205
- _({ ...t, tags: g }), u(!1);
1206
- return;
1207
- }
1208
- await a(g, t.guid), await r({ ...t, tags: g }), n(Y.TRANSACTION_DETAILS_CLICK_TAGS, { transaction_guid: t.guid }), u(!1);
1209
- }, M = l.useMemo(
1210
- () => t.tags.map(
1211
- (k, f, A) => `${s.find((y) => y.guid === k)?.name}${f < A.length - 1 ? " / " : ""}`
1212
- ),
1213
- [s, t]
1214
- ), B = c.palette.mode === "dark" ? "grey.800" : "grey.100";
1215
- return /* @__PURE__ */ m(z, { disableGutters: !0, disablePadding: !0, children: [
1216
- /* @__PURE__ */ m(
1217
- Q,
1218
- {
1219
- onClick: () => {
1220
- n(C.ON_TRANSACTION_TAGS_CLICK), u(!0);
1221
- },
1222
- children: [
1223
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: B }, variant: "rounded", children: /* @__PURE__ */ e(P, { name: "local_offer", sx: { color: "text.primary" } }) }) }),
1224
- /* @__PURE__ */ e(
1225
- U,
1226
- {
1227
- primary: i.tags_title,
1228
- secondary: /* @__PURE__ */ e(x, { bold: !0, sx: { color: "text.primary" }, variant: "body1", children: t.tags?.length > 0 ? M : i.tags_desc }),
1229
- slotProps: { primary: { variant: "caption", fontSize: 11, fontWeight: "normal" } }
1230
- }
1231
- ),
1232
- /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(P, { name: "chevron_right", sx: { color: "text.primary" } }) })
1233
- ]
1234
- }
1235
- ),
1236
- /* @__PURE__ */ e(
1237
- _e,
1238
- {
1239
- ariaLabelClose: o.close_aria,
1240
- isOpen: d,
1241
- onClose: () => u(!1),
1242
- onPrimaryAction: I,
1243
- primaryText: o.save_button,
1244
- secondaryText: o.cancel_button,
1245
- title: i.tags_title,
1246
- children: /* @__PURE__ */ e(Qt, { onTagChecked: h, selectedTags: g })
1247
- }
1248
- )
1249
- ] });
1250
- }, Zt = w(Xt), Jt = ({ transaction: t, viewOnly: n = !1 }) => {
1251
- const { updateTransaction: s } = R(), { common: a, transactions: r } = O(), { onEvent: o } = G(), { announce: i, ariaLive: _ } = Ae(), [c, d] = l.useState(!1), [u, g] = l.useState(""), p = l.useRef(null);
1252
- l.useEffect(() => {
1253
- c && (g(t.description), p?.current?.focus());
1254
- }, [c]);
1255
- const h = () => {
1256
- d(!0), o(C.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK), setTimeout(() => document.getElementById("transaction-description-input")?.focus(), 0);
1257
- }, I = async () => {
1258
- o(Y.TRANSACTION_DETAILS_CLICK_DESCRIPTION, {
1259
- transaction_guid: t.guid
1260
- }), await s({ ...t, description: u }), d(!1), i(`${r.payee_title}: ${u}`), setTimeout(() => document.getElementById("transaction-description-edit-button")?.focus(), 0);
1261
- };
1262
- return /* @__PURE__ */ m(V, { className: "mx-txn-transaction-description", children: [
1263
- _,
1264
- c ? /* @__PURE__ */ m(Xe, { row: !0, children: [
1265
- /* @__PURE__ */ e(
1266
- $e,
1267
- {
1268
- "aria-label": r.payee_title,
1269
- id: "transaction-description-input",
1270
- label: r.payee_title,
1271
- name: r.payee_title,
1272
- onChange: (M) => g(M.target.value),
1273
- ref: p,
1274
- slotProps: { htmlInput: { maxLength: 140 } },
1275
- sx: {
1276
- backgroundColor: "background.paper",
1277
- ".MuiOutlinedInput-root": { borderTopRightRadius: 0, borderBottomRightRadius: 0 },
1278
- ".MuiOutlinedInput-input": { p: 11 },
1279
- width: 250
1280
- },
1281
- value: u
1282
- }
1283
- ),
1284
- /* @__PURE__ */ e(
1285
- me,
1286
- {
1287
- disabled: !u,
1288
- onClick: I,
1289
- sx: {
1290
- borderTopLeftRadius: 0,
1291
- borderBottomLeftRadius: 0
1292
- },
1293
- variant: "outlined",
1294
- children: a.save_button
1295
- }
1296
- )
1297
- ] }) : /* @__PURE__ */ m(L, { alignItems: "center", direction: "row", gap: 4, sx: { minHeight: 44 }, children: [
1298
- /* @__PURE__ */ e(x, { bold: !0, children: t.description }),
1299
- !n && /* @__PURE__ */ e(
1300
- ue,
1301
- {
1302
- "aria-label": r.payee_edit,
1303
- id: "transaction-description-edit-button",
1304
- onClick: h,
1305
- sx: { color: "action.active" },
1306
- children: /* @__PURE__ */ e(ye, { name: "create", size: 22 })
1307
- }
1308
- )
1309
- ] })
1310
- ] });
1311
- }, ea = w(Jt), ta = ({ transaction: t }) => {
1312
- const { updateTransaction: n } = R(), { transactions: s } = O(), { onEvent: a } = G(), r = F(), o = r.palette.mode === "dark", i = async () => {
1313
- a(Y.TRANSACTION_DETAILS_CLICK_FLAG, { transaction_guid: t.guid }), await n({ ...t, is_flagged: !t.is_flagged });
1314
- };
1315
- return /* @__PURE__ */ e("div", { className: "mx-txn-transaction-flag", children: /* @__PURE__ */ e(
1316
- lt,
1317
- {
1318
- "aria-label": s.flag_btn_aria,
1319
- "aria-pressed": t.is_flagged,
1320
- color: o ? "primary" : "warning",
1321
- onClick: i,
1322
- selected: t.is_flagged,
1323
- sx: {
1324
- borderRadius: 6,
1325
- color: o ? "common.white" : "secondary.main",
1326
- "&.Mui-selected": {
1327
- color: o ? "primary.main" : "common.white",
1328
- backgroundColor: o ? xe(r.palette.primary.main, 0.25) : "warning.dark",
1329
- ":hover": {
1330
- color: o ? "primary.main" : "common.white",
1331
- backgroundColor: o ? xe(r.palette.primary.main, 0.2) : "warning.main"
1332
- }
1333
- },
1334
- ":hover": {
1335
- color: o ? "common.white" : "warning.contrastText",
1336
- backgroundColor: o ? xe(r.palette.primary.main, 0.2) : "warning.light"
1337
- }
1338
- },
1339
- value: "flagged",
1340
- children: /* @__PURE__ */ e(ut, { color: "inherit" })
1341
- }
1342
- ) });
1343
- }, aa = w(ta), pe = (t, n, s, a = !0, r = "inset") => a ? /* @__PURE__ */ m(l.Fragment, { children: [
1344
- /* @__PURE__ */ m(z, { disableGutters: !0, disablePadding: !0, children: [
1345
- /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(j, { sx: { bgcolor: "neutral.light" }, variant: "rounded", children: t }) }),
1346
- /* @__PURE__ */ e(
1347
- U,
1348
- {
1349
- primary: n,
1350
- secondary: s,
1351
- slotProps: { primary: { variant: "caption", fontSize: 11, fontWeight: "normal" } }
1352
- }
1353
- )
1354
- ] }),
1355
- /* @__PURE__ */ e(Te, { variant: r })
1356
- ] }) : null, na = ({ transaction: t }) => {
1357
- const { transactions: n } = O(), { tags: s } = R(), a = l.useMemo(() => {
1358
- const r = new Map(s.map((o) => [o.guid, o.name]));
1359
- return t.tags.map((o) => r.get(o)).filter(Boolean).join(" / ");
1360
- }, [s, t.tags]);
1361
- return /* @__PURE__ */ m(be, { sx: { "& .MuiListItem-root": { px: 24, py: 12 } }, children: [
1362
- pe(
1363
- /* @__PURE__ */ e(
1364
- Oe,
1365
- {
1366
- categoryGuid: t.top_level_category_guid,
1367
- size: 24,
1368
- sx: { color: "text.primary" },
1369
- variant: Ge.Transparent
1370
- }
1371
- ),
1372
- n.category_title,
1373
- /* @__PURE__ */ e(x, { bold: !0, variant: "body1", children: t.category ?? n.actions_select_a_category })
1374
- ),
1375
- pe(
1376
- /* @__PURE__ */ e(ye, { name: "calendar_month", sx: { color: "text.primary" } }),
1377
- n.date_title,
1378
- /* @__PURE__ */ e(x, { bold: !0, variant: "body1", children: Me(ve(t.date), Re.YEAR_MONTH_DAY) })
1379
- ),
1380
- pe(
1381
- /* @__PURE__ */ e(ye, { name: "article", sx: { color: "text.primary" } }),
1382
- n.memo_title,
1383
- /* @__PURE__ */ e(x, { bold: !0, variant: "body1", children: t.memo ?? n.memo_desc }),
1384
- !!t.memo,
1385
- t.tags?.length > 0 ? "inset" : "fullWidth"
1386
- ),
1387
- pe(
1388
- /* @__PURE__ */ e(ye, { name: "local_offer", sx: { color: "text.primary" } }),
1389
- n.tags_title,
1390
- /* @__PURE__ */ e(x, { bold: !0, variant: "body1", children: t.tags?.length ? a : n.tags_desc }),
1391
- !!t.tags?.length,
1392
- "fullWidth"
1393
- )
1394
- ] });
1395
- }, ra = w(na), oa = ({
1396
- data: t,
1397
- color: n,
1398
- width: s = 85,
1399
- height: a = 65
1400
- }) => {
1401
- const r = F(), o = {
1402
- series: [
1403
- {
1404
- data: t.map(({ value: c }) => c),
1405
- type: "bar"
1406
- }
1407
- ],
1408
- xAxis: [
1409
- {
1410
- data: t.map(({ label: c }) => c),
1411
- scaleType: "band",
1412
- categoryGapRatio: 0.3
1413
- }
1414
- ]
1415
- }, i = t.map(
1416
- (c, d) => d === t.length - 1 ? n(r) : `${n(r)}80`
1417
- ), _ = (c, d) => {
1418
- if (c <= 0 || d <= 0) return "";
1419
- const u = Math.min(6, c / 2, d / 2);
1420
- return `M${u},0 L${c - u},0 Q${c},0 ${c},${u} L${c},${d} L0,${d} L0,${u} Q0,0 ${u},0 Z`;
1421
- };
1422
- return /* @__PURE__ */ e(
1423
- L,
1424
- {
1425
- sx: {
1426
- width: s,
1427
- height: a
1428
- },
1429
- children: /* @__PURE__ */ e(
1430
- mt,
1431
- {
1432
- axisHighlight: {
1433
- x: "none",
1434
- y: "none"
1435
- },
1436
- height: a,
1437
- margin: {
1438
- bottom: -10,
1439
- left: 0,
1440
- right: 0,
1441
- top: 10
1442
- },
1443
- series: o.series,
1444
- slots: {
1445
- bar: ({ ownerState: c, ...d }) => {
1446
- const { ariaLabel: u } = t[c.dataIndex];
1447
- return /* @__PURE__ */ e("g", { "aria-label": u, children: /* @__PURE__ */ e(
1448
- "path",
1449
- {
1450
- d: _(d.width, d.height),
1451
- fill: i[c.dataIndex],
1452
- transform: `translate(${d.x}, ${d.y})`
1453
- }
1454
- ) });
1455
- },
1456
- axisTickLabel: ({ text: c, ...d }) => {
1457
- const u = t[t.length - 1]?.label;
1458
- return /* @__PURE__ */ e(
1459
- "text",
1460
- {
1461
- ...d,
1462
- style: {
1463
- ...d.style,
1464
- fontSize: 6.75,
1465
- lineHeight: "9px",
1466
- fontWeight: u === c ? "bold" : 400
1467
- },
1468
- children: c
1469
- }
1470
- );
1471
- }
1472
- },
1473
- sx: {
1474
- "& .MuiChartsAxis-bottom .MuiChartsAxis-tickContainer:first-of-type .MuiChartsAxis-tick": {
1475
- display: "none"
1476
- }
1477
- },
1478
- width: s,
1479
- xAxis: o.xAxis,
1480
- yAxis: [{ width: 0, position: "none" }]
1481
- }
1482
- )
1483
- }
1484
- );
1485
- }, ia = {
1486
- BILL_AMOUNT_NOT_STANDARD: "BillAmountNotStandard"
1487
- }, sa = (t, n) => {
1488
- if (n)
1489
- switch (n.template) {
1490
- case ia.BILL_AMOUNT_NOT_STANDARD: {
1491
- const s = n.data_series ? et(n.data_series) : [], a = tt(s, n.payload?.merchant_name);
1492
- return {
1493
- instanceSlot: /* @__PURE__ */ e(
1494
- oa,
1495
- {
1496
- color: (r) => r.palette.categories.billsUtilities,
1497
- data: a.slice(-3)
1498
- }
1499
- ),
1500
- dataSeries: s,
1501
- chartData: a,
1502
- callToAction: t.view_history
1503
- };
1504
- }
1505
- default:
1506
- return null;
1507
- }
1508
- return null;
1509
- }, la = ({
1510
- bottomActions: t = St,
1511
- canFlagTransaction: n = !0,
1512
- topActions: s = ft,
1513
- transaction: a
1514
- }) => {
1515
- const { onEvent: r } = G(), { isCopyLoaded: o } = it(), { userFeatures: i } = st(), { accounts: _, common: c, insights_feed: d } = O(), { detailedCategories: u } = we(), {
1516
- alert: g,
1517
- associatedBeats: p,
1518
- detailedTransactions: h,
1519
- cachedStartDate: I,
1520
- loadEmbeddedInstanceTransactions: M,
1521
- setAlert: B
1522
- } = R(), [k, f] = l.useState(!1), [A, y] = l.useState(!1), [Z, se] = l.useState(!1), le = F(), te = a?.number && a.number.length > 4, $ = l.useMemo(() => p.find((T) => T.associated_transaction_guid === a.guid), [p, a]), b = sa(c, $), [K, re] = l.useState(
1523
- b ? b.dataSeries.length - 1 : 0
1524
- );
1525
- l.useEffect(
1526
- () => r(Y.TRANSACTION_DETAILS_VIEW, { transaction_guid: a.guid }),
1527
- []
1528
- ), l.useEffect(() => {
1529
- if (!b || b.dataSeries.length === 0) return;
1530
- const { date: T } = b.dataSeries[K], D = De(T);
1531
- je(D, I) && (y(!0), M(D).finally(() => {
1532
- y(!1);
1533
- }));
1534
- }, [K, b, I]);
1535
- const H = t.includes(ie.MerchantBudget) && !a?.merchant_guid ? t.filter((T) => T !== ie.MerchantBudget) : t, oe = ke(() => {
1536
- if (b) {
1537
- const T = u.find(
1538
- (ze) => ze.guid === a.top_level_category_guid
1539
- ), D = $?.payload?.average_amount ?? 0, J = a.amount;
1540
- let ge = d.general.increased_text;
1541
- J - D < 0 && (ge = d.general.decreased_text);
1542
- const ce = D === 0 ? 0 : Math.round(Math.abs(J - D) / D * 100);
1543
- return { category: T, percentageAmount: ce, changetype: ge };
1544
- }
1545
- return null;
1546
- }, [b, u]), N = ke(() => {
1547
- if (!b?.dataSeries?.length)
1548
- return [];
1549
- const { guid: T, date: D } = b.dataSeries[K], J = De(D), ge = Be(D);
1550
- return h.filter((ce) => ce.date >= Ie(J) && ce.date <= Ie(ge) && ce.guid === T);
1551
- }, [K, b, h, A]);
1552
- if (!o)
1553
- return /* @__PURE__ */ e(_t, {});
1554
- const v = Qe(i, "MX_TXN_DETAILS_VIEW_ONLY"), S = le.palette.mode === "dark" ? "grey.800" : "grey.100";
1555
- return /* @__PURE__ */ m(V, { className: "mx-txn-transaction-details", width: "100%", children: [
1556
- a && /* @__PURE__ */ m(L, { children: [
1557
- /* @__PURE__ */ m(L, { gap: 12, p: 24, children: [
1558
- /* @__PURE__ */ e(he, { elevation: 2, sx: { width: 64 }, children: /* @__PURE__ */ e(
1559
- Ce,
1560
- {
1561
- categoryGuid: a.top_level_category_guid || "",
1562
- merchantGuid: a.merchant_guid || "",
1563
- size: 64
1564
- }
1565
- ) }),
1566
- /* @__PURE__ */ e(ea, { transaction: a, viewOnly: v }),
1567
- /* @__PURE__ */ m(L, { direction: "row", justifyContent: "space-between", sx: { minHeight: 44 }, children: [
1568
- /* @__PURE__ */ m(ee, { color: a.isIncome ? "success.main" : "text.primary", variant: "h1", children: [
1569
- a.isIncome ? "+" : "",
1570
- W(a.amount, "0,0.00")
1571
- ] }),
1572
- !v && n && /* @__PURE__ */ e(aa, { transaction: a })
1573
- ] }),
1574
- b?.instanceSlot && /* @__PURE__ */ e(
1575
- at,
1576
- {
1577
- callToAction: b.callToAction,
1578
- description: E(
1579
- d.general.embedded_description,
1580
- oe.changetype,
1581
- /* @__PURE__ */ e("strong", { children: oe.percentageAmount })
1582
- ),
1583
- instanceSlot: b.instanceSlot,
1584
- onCtaClick: () => {
1585
- f(!0);
1586
- },
1587
- title: $.html_micro_title
1588
- }
1589
- ),
1590
- /* @__PURE__ */ m(L, { sx: { bgcolor: S, borderRadius: "4px", gap: 4, p: 8 }, children: [
1591
- /* @__PURE__ */ e(x, { bold: !0, children: `${a.account}
1592
- ${te ? a.number : "•".repeat(4).concat(a.number ?? "")}` }),
1593
- /* @__PURE__ */ e(x, { bold: !0, truncate: !0, variant: "tiny", children: a.feed_description })
1594
- ] })
1595
- ] }),
1596
- /* @__PURE__ */ e(he, { square: !0, sx: { boxShadow: "none" }, children: v ? /* @__PURE__ */ e(ra, { transaction: a }) : /* @__PURE__ */ e(be, { children: s.map((T, D) => /* @__PURE__ */ m(l.Fragment, { children: [
1597
- T === de.Category && /* @__PURE__ */ e(Dt, { transaction: a }),
1598
- T === de.Date && /* @__PURE__ */ e(vt, { transaction: a }),
1599
- T === de.Memo && /* @__PURE__ */ e(Pt, { transaction: a }),
1600
- T === de.Tags && /* @__PURE__ */ e(Zt, { transaction: a }),
1601
- /* @__PURE__ */ e(
1602
- Te,
1603
- {
1604
- component: "li",
1605
- variant: D < s.length - 1 ? "inset" : "fullWidth"
1606
- }
1607
- )
1608
- ] }, T)) }) }),
1609
- !v && H.length > 0 && /* @__PURE__ */ m(l.Fragment, { children: [
1610
- /* @__PURE__ */ e(x, { bold: !0, mb: 8, ml: 26, mt: 16, variant: "body1", children: _.actions }),
1611
- /* @__PURE__ */ e(he, { square: !0, sx: { boxShadow: "none" }, children: /* @__PURE__ */ m(be, { children: [
1612
- H.map((T, D) => /* @__PURE__ */ m(l.Fragment, { children: [
1613
- T === ie.MerchantBudget && /* @__PURE__ */ e(It, { transaction: a }),
1614
- T === ie.SplitTransaction && /* @__PURE__ */ e(Ht, { transaction: a }),
1615
- T === ie.HideTransaction && /* @__PURE__ */ e(Rt, { transaction: a }),
1616
- T === ie.MerchantLogo && /* @__PURE__ */ e(wt, { transaction: a }),
1617
- /* @__PURE__ */ e(
1618
- Te,
1619
- {
1620
- component: "li",
1621
- variant: D < H.length - 1 ? "inset" : "fullWidth"
1622
- }
1623
- )
1624
- ] }, T)),
1625
- a.is_manual && !a.parent_guid && !a.has_been_split && /* @__PURE__ */ e(Ot, { transaction: a })
1626
- ] }) })
1627
- ] })
1628
- ] }),
1629
- $ && b && /* @__PURE__ */ e(
1630
- nt,
1631
- {
1632
- ariaLabel: Me(
1633
- b?.dataSeries[K]?.date,
1634
- Re.MONTH
1635
- ),
1636
- barChartProps: {
1637
- amounts: {
1638
- average: $.payload.average_amount,
1639
- formattedAverage: W($.payload.average_amount, "0,0")
1640
- },
1641
- color: oe.category?.color || "",
1642
- data: b.chartData,
1643
- margin: { bottom: 10, left: 24, right: 24, top: 20 },
1644
- monthlyAmountLabel: d.general.monthly_amount,
1645
- onBarClick: (T) => {
1646
- re(T);
1647
- },
1648
- trendAmountLabel: d.general.trend,
1649
- legendPosition: "top"
1650
- },
1651
- beat: {
1652
- heading: $.html_title,
1653
- subHeading: {
1654
- category_guid: a.category_guid ?? "",
1655
- merchant_guid: a.merchant_guid ?? "",
1656
- description: a.description ?? ""
1657
- }
1658
- },
1659
- data: b.chartData,
1660
- defaultSelectedIndex: K,
1661
- icon: /* @__PURE__ */ e(
1662
- Ce,
1663
- {
1664
- alt: a.description ?? "",
1665
- categoryGuid: a.category_guid ?? "",
1666
- merchantGuid: a.merchant_guid ?? "",
1667
- size: 16
1668
- }
1669
- ),
1670
- isOpen: k,
1671
- onClose: () => {
1672
- f(!1), re(b.dataSeries.length - 1);
1673
- },
1674
- onTabChange: (T) => {
1675
- re(T);
1676
- },
1677
- tipSection: Z ? void 0 : {
1678
- message: E(
1679
- d.general.tip_section_message,
1680
- /* @__PURE__ */ e("strong", { children: d.general.tip_section_title }),
1681
- /* @__PURE__ */ e("strong", { children: $.primary_transaction?.description })
1682
- ),
1683
- onDismiss: () => se(!0)
1684
- },
1685
- title: d.general.transaction_history_title,
1686
- transactionListProps: {
1687
- showLoader: A,
1688
- showInsights: !0,
1689
- transaction: N
1690
- }
1691
- }
1692
- ),
1693
- /* @__PURE__ */ e(
1694
- We,
1695
- {
1696
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1697
- autoHideDuration: 3500,
1698
- onClose: () => B(""),
1699
- open: !!g,
1700
- children: /* @__PURE__ */ e(Ue, { closeText: "", onClose: () => B(""), severity: "success", variant: "filled", children: g })
1701
- }
1702
- )
1703
- ] });
1704
- }, rn = w(la);
1705
- export {
1706
- ie as B,
1707
- Dt as C,
1708
- vt as D,
1709
- Pt as M,
1710
- rn as T,
1711
- Zt as a,
1712
- de as b,
1713
- At as c
1714
- };