@mx-cartographer/experiences 7.11.20 → 7.11.21

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 (70) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/{AccountDetailsHeader-DCTCLB3K.mjs → AccountDetailsHeader-DkBNsLsI.mjs} +2 -2
  3. package/dist/{AccountListItem-CZk-bo6j.mjs → AccountListItem-BIVhda6q.mjs} +2 -2
  4. package/dist/{AccountStore-Cw54qb7Y.mjs → AccountStore-Brc0MNSF.mjs} +1 -1
  5. package/dist/BudgetUtil--_QXyszn.mjs +479 -0
  6. package/dist/{CategorySelectorDrawer-Blb22HWt.mjs → CategorySelectorDrawer-5n6Pil_E.mjs} +1 -1
  7. package/dist/{Connect-Df7iVTcV.mjs → Connect-eYIWqCEr.mjs} +1 -1
  8. package/dist/{ConnectDrawer-CVt-8rPJ.mjs → ConnectDrawer-CioFo6Wy.mjs} +2 -2
  9. package/dist/{ConnectionsDrawer-c7HaKeRj.mjs → ConnectionsDrawer-DqhSaMrJ.mjs} +2 -2
  10. package/dist/{CurrencyInput-bcKNJ22c.mjs → CurrencyInput-DuMktPu3.mjs} +1 -1
  11. package/dist/{ExportCsvAction-B5Mn5uyb.mjs → ExportCsvAction-Bg6gO_Cz.mjs} +3 -3
  12. package/dist/{GlobalAccountFilter-CbwySv6c.mjs → GlobalAccountFilter-B73Pw1hJ.mjs} +1 -1
  13. package/dist/{GoalStore-DXIP9dLt.mjs → GoalStore-0bd-Upkc.mjs} +1 -1
  14. package/dist/{Help-COWDMsJq.mjs → Help-CINT6-wG.mjs} +1 -1
  15. package/dist/{LineChart-DVn1AamK.mjs → LineChart-B1qbKR8q.mjs} +1 -1
  16. package/dist/{ListItemAction-5YhgdUZW.mjs → ListItemAction-CfXGuY7a.mjs} +1 -1
  17. package/dist/{ManageIncome-_ZP3uPwX.mjs → ManageIncome-C0ddaiMR.mjs} +10 -10
  18. package/dist/{MicroWidgetContainer-CMES42I1.mjs → MicroWidgetContainer-B_EnfvCq.mjs} +1 -1
  19. package/dist/{MiniWidgetContainer-DhEx4qKi.mjs → MiniWidgetContainer-Cu72GNsE.mjs} +1 -1
  20. package/dist/{NotificationSettings-D8uSK6m9.mjs → NotificationSettings-DCbMa5mg.mjs} +4 -4
  21. package/dist/{OriginalBalanceAction-DuVHcBdO.mjs → OriginalBalanceAction-CW_xOa6Z.mjs} +3 -3
  22. package/dist/{RecurringSettings-CSrJUzaC.mjs → RecurringSettings-CD1_vCES.mjs} +2 -2
  23. package/dist/{SpendingLegend-Cpd_jtoX.mjs → SpendingLegend-DHi0vx8B.mjs} +1 -1
  24. package/dist/StatusIndicator-wyBzyHJc.mjs +252 -0
  25. package/dist/{Transaction-BR682Yj5.mjs → Transaction-B_2AG36b.mjs} +1 -1
  26. package/dist/TransactionDetails-CgC3Qu7o.mjs +1474 -0
  27. package/dist/{TransactionStore-BbjZQa-N.mjs → TransactionStore-DIbZkSVI.mjs} +2 -2
  28. package/dist/{ViewMoreMicroCard-Bf1J0zYY.mjs → ViewMoreMicroCard-CLHlPWC-.mjs} +1 -1
  29. package/dist/{WidgetContainer-DSs6lJbr.mjs → WidgetContainer-BSCjBupR.mjs} +2 -2
  30. package/dist/accounts/index.es.js +13 -13
  31. package/dist/analytics/index.es.js +11 -11
  32. package/dist/budgets/api/BudgetsApi.d.ts +2 -0
  33. package/dist/budgets/components/MerchantBudgetDetailsDrawer.d.ts +17 -0
  34. package/dist/budgets/components/shared/BudgetDetailsTopSection.d.ts +13 -0
  35. package/dist/budgets/index.es.js +550 -609
  36. package/dist/budgets/store/BudgetsStore.d.ts +6 -0
  37. package/dist/budgets/utils/BudgetUtil.d.ts +5 -0
  38. package/dist/cashflow/index.es.js +8 -8
  39. package/dist/categories/index.es.js +1 -1
  40. package/dist/common/index.es.js +254 -224
  41. package/dist/common/types/localization/BudgetsCopy.d.ts +4 -0
  42. package/dist/dashboard/index.es.js +4 -4
  43. package/dist/debts/index.es.js +8 -8
  44. package/dist/{exportTransactionsToCSV-CKHt_UOp.mjs → exportTransactionsToCSV-EwhjfqsJ.mjs} +1 -1
  45. package/dist/finstrong/index.es.js +10 -10
  46. package/dist/goals/index.es.js +10 -10
  47. package/dist/help/index.es.js +4 -4
  48. package/dist/{hooks-zu7yblbi.mjs → hooks-BxkfR-Ff.mjs} +5 -5
  49. package/dist/insights/index.es.js +103 -104
  50. package/dist/investments/index.es.js +4 -4
  51. package/dist/merchants/index.es.js +1 -1
  52. package/dist/microinsights/index.es.js +1 -1
  53. package/dist/networth/index.es.js +6 -6
  54. package/dist/notifications/index.es.js +2 -2
  55. package/dist/recurringtransactions/index.es.js +9 -9
  56. package/dist/settings/index.es.js +7 -7
  57. package/dist/spending/index.es.js +8 -8
  58. package/dist/transactions/components/shared/transactiondetails/actions/AddMerchantBudgetAction.d.ts +5 -0
  59. package/dist/transactions/components/shared/transactiondetails/actions/index.d.ts +1 -0
  60. package/dist/transactions/index.es.js +16 -16
  61. package/dist/trends/index.es.js +12 -12
  62. package/dist/{useAccountDisplayName-CxYB0Wpw.mjs → useAccountDisplayName-DKwT1mWv.mjs} +1 -1
  63. package/dist/{useInsightsEnabled-CYLDtNYt.mjs → useInsightsEnabled-DL_oNyI0.mjs} +1 -1
  64. package/dist/{useWidgetLoadTimer-Bmgv_UeH.mjs → useWidgetLoadTimer-DgN1bTyu.mjs} +1 -1
  65. package/package.json +1 -1
  66. package/dist/BudgetUtil-QbRXtLKn.mjs +0 -101
  67. package/dist/StatusIndicator-0iX3Gnnu.mjs +0 -55
  68. package/dist/TransactionDetails-BEKQKH03.mjs +0 -1261
  69. package/dist/TransactionList-CXiLG0Ur.mjs +0 -204
  70. package/dist/User-BIgPTsU6.mjs +0 -372
@@ -1,1261 +0,0 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import c from "react";
3
- import { observer as f } from "mobx-react-lite";
4
- import U from "@mui/material/Box";
5
- import re from "@mui/material/Divider";
6
- import ne from "@mui/material/List";
7
- import te from "@mui/material/Paper";
8
- import v from "@mui/material/Stack";
9
- import { useTheme as V } from "@mui/material/styles";
10
- import { CategoryIcon as he, CategoryIconVariants as Ce, Text as C, P as X, MerchantLogo as Se, TextField as ye, Icon as ae, IconWeight as ue, Toast as ke } from "@mxenabled/mxui";
11
- import { C as Pe, a as Me, b as Ge, i as Be } from "./User-BIgPTsU6.mjs";
12
- import se from "@mui/material/Button";
13
- import $e from "@mui/material/FormGroup";
14
- import J from "@mui/material/IconButton";
15
- import be from "@mui/material/TextField";
16
- import { u as le } from "./useAriaLive-MkYebyUR.mjs";
17
- import { O as y } from "./Transaction-BR682Yj5.mjs";
18
- import { h as D, m as xe, g as O, u as A, i as Ke, b as Fe, o as He } from "./hooks-zu7yblbi.mjs";
19
- import { A as G } from "./Analytics-i5h6BxR1.mjs";
20
- import Ue from "@mui/material/ToggleButton";
21
- import fe from "@mui/material/styles/useTheme";
22
- import { Icon as E, Delete as oe, ChevronRight as Ve, Cancel as ie, Search as ze, Edit as We, Flag as Ye } from "@mxenabled/mx-icons";
23
- import { fromUnixTime as ge } from "date-fns/fromUnixTime";
24
- import B from "@mui/material/Avatar";
25
- import P from "@mui/material/ListItem";
26
- import $ from "@mui/material/ListItemAvatar";
27
- import M from "@mui/material/ListItemText";
28
- import { f as Ae, D as Ne } from "./DateFormats-BMpMrZpW.mjs";
29
- import K from "@mui/material/ListItemButton";
30
- import F from "@mui/material/ListItemIcon";
31
- import { f as Q } from "./NumberFormatting-QCaNwbjv.mjs";
32
- import { b as R } from "./Localization-CPkpIwIx.mjs";
33
- import { a as Ie } from "./CategorySelectorDrawer-Blb22HWt.mjs";
34
- import { u as W } from "./TransactionList-CXiLG0Ur.mjs";
35
- import { D as z } from "./Dialog-DdCwLgrl.mjs";
36
- import { getUnixTime as Xe } from "date-fns/getUnixTime";
37
- import { D as ce } from "./Drawer-DV4NTsFg.mjs";
38
- import Te from "@mui/material/InputAdornment";
39
- import je from "@mui/material/Checkbox";
40
- import pe from "@mui/material/Grid";
41
- import { C as qe } from "./CurrencyInput-bcKNJ22c.mjs";
42
- import Je from "@mui/material/Switch";
43
- import { L as Qe } from "./Loader-D3rjKx72.mjs";
44
- var j = /* @__PURE__ */ ((t) => (t[t.Category = 0] = "Category", t[t.Date = 1] = "Date", t[t.Memo = 2] = "Memo", t[t.Tags = 3] = "Tags", t))(j || {}), q = /* @__PURE__ */ ((t) => (t[t.MerchantBudget = 0] = "MerchantBudget", t[t.SplitTransaction = 1] = "SplitTransaction", t[t.HideTransaction = 2] = "HideTransaction", t[t.MerchantLogo = 3] = "MerchantLogo", t))(q || {});
45
- const Ze = [
46
- 0,
47
- 1,
48
- 2,
49
- 3
50
- /* Tags */
51
- ], et = [
52
- 1,
53
- 2,
54
- 3
55
- /* MerchantLogo */
56
- ], tt = ({ transaction: t }) => {
57
- const { addOrUpdateTransactionRule: o, updateTransaction: i } = D(), { categories: a } = xe(), { onEvent: r } = O(), { setShouldDisableDrawerScroll: n, updateManualTransaction: s } = W(), { transactions: d } = A(), u = V(), [_, g] = c.useState(!1), [m, p] = c.useState(""), h = async (T) => {
58
- await i({ ...t, category_guid: m }), T && await o(m, t), p(""), r(G.TRANSACTION_DETAILS_CLICK_CATEGORY, {
59
- transaction_guid: t.guid
60
- });
61
- }, N = (T) => {
62
- if (t.is_manual && !t.guid) {
63
- const w = a.find((k) => k.guid === T);
64
- s({
65
- ...t,
66
- category: w?.name,
67
- category_guid: T,
68
- top_level_category_guid: w?.parent_guid || T
69
- });
70
- } else
71
- p(T);
72
- b();
73
- }, b = () => {
74
- g(!1), n(!1);
75
- }, L = c.useMemo(
76
- () => a.find((T) => T.guid === m),
77
- [m]
78
- ), S = u.palette.mode === "dark" ? "grey.800" : "grey.100";
79
- return /* @__PURE__ */ l(P, { disableGutters: !0, disablePadding: !0, children: [
80
- /* @__PURE__ */ l(
81
- K,
82
- {
83
- onClick: () => {
84
- r(y.ON_TRANSACTION_CATEGORY_CLICK), g(!0);
85
- },
86
- children: [
87
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: S }, variant: "rounded", children: /* @__PURE__ */ e(
88
- he,
89
- {
90
- categoryGuid: t.top_level_category_guid,
91
- size: 24,
92
- sx: { color: "text.primary" },
93
- variant: Ce.Transparent
94
- }
95
- ) }) }),
96
- /* @__PURE__ */ e(
97
- M,
98
- {
99
- primary: d.category_title,
100
- primaryTypographyProps: { variant: "XSmall" },
101
- secondary: /* @__PURE__ */ e(C, { bold: !0, sx: { color: "text.primary" }, variant: "Body", children: t.category ?? d.actions_select_a_category })
102
- }
103
- ),
104
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
105
- ]
106
- }
107
- ),
108
- /* @__PURE__ */ e(
109
- Ie,
110
- {
111
- initialSelected: t.category_guid,
112
- onClose: b,
113
- onSelect: N,
114
- showDrawer: _,
115
- title: d.actions_select_a_category
116
- }
117
- ),
118
- /* @__PURE__ */ e(
119
- z,
120
- {
121
- copy: {
122
- title: R(
123
- d.actions_apply_to_all_transaction_types,
124
- t.description
125
- )
126
- },
127
- isOpen: !!m,
128
- onClose: () => p(""),
129
- onPrimaryAction: () => h(!0),
130
- onSecondaryAction: () => h(!1),
131
- primaryText: d.actions_apply_to_all,
132
- secondaryText: d.actions_this_time_only,
133
- children: /* @__PURE__ */ e(X, { variant: "Paragraph", children: R(
134
- d.actions_all_past_and_future,
135
- t.description,
136
- L?.name
137
- ) })
138
- }
139
- )
140
- ] });
141
- }, at = ({ transaction: t }) => {
142
- const { onEvent: o } = O(), { updateTransaction: i } = D(), { updateManualTransaction: a } = W(), { common: r, transactions: n } = A(), s = V(), [d, u] = c.useState(!1), [_, g] = c.useState(t.date), m = (N) => {
143
- g(Xe(N));
144
- }, p = async () => {
145
- if (t.is_manual && !t.guid) {
146
- a({ ...t, date: _ }), u(!1);
147
- return;
148
- }
149
- await i({ ...t, date: _ }), o(G.TRANSACTION_DETAILS_CLICK_DATE, { transaction_guid: t.guid }), u(!1);
150
- }, h = s.palette.mode === "dark" ? "grey.800" : "grey.100";
151
- return /* @__PURE__ */ l(P, { className: "mx-txn-date-action", disableGutters: !0, disablePadding: !0, children: [
152
- /* @__PURE__ */ l(
153
- K,
154
- {
155
- onClick: () => {
156
- o(y.ON_TRANSACTION_DATE_CLICK), u(!0);
157
- },
158
- children: [
159
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: h }, variant: "rounded", children: /* @__PURE__ */ e(E, { name: "calendar_month", sx: { color: "text.primary" } }) }) }),
160
- /* @__PURE__ */ e(
161
- M,
162
- {
163
- primary: n.date_title,
164
- primaryTypographyProps: { variant: "XSmall" },
165
- secondary: /* @__PURE__ */ e(C, { bold: !0, sx: { color: "text.primary" }, variant: "Body", children: Ae(ge(t.date), Ne.YEAR_MONTH_DAY) })
166
- }
167
- ),
168
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
169
- ]
170
- }
171
- ),
172
- /* @__PURE__ */ e(
173
- ce,
174
- {
175
- ariaLabelClose: r.close_aria,
176
- isOpen: d,
177
- onClose: () => u(!1),
178
- onPrimaryAction: p,
179
- primaryText: r.save_button,
180
- secondaryText: r.cancel_button,
181
- title: n.date_edit_title,
182
- children: /* @__PURE__ */ e(v, { alignItems: "center", mt: 40, children: /* @__PURE__ */ e(
183
- Pe,
184
- {
185
- beginDate: ge(_),
186
- copy: {
187
- nextAria: n.date_next_aria,
188
- prevAria: n.date_prev_aria,
189
- today: r.date_range_picker.today
190
- },
191
- onDateSelected: m,
192
- selectionType: Me.Single
193
- }
194
- ) })
195
- }
196
- )
197
- ] });
198
- }, rt = ({ transaction: t }) => {
199
- const { onEvent: o } = O(), { removeTransaction: i } = D(), { setShouldDisableDrawerScroll: a } = W(), { common: r, transactions: n } = A(), [s, d] = c.useState(!1), u = async () => {
200
- await i(t.guid), o(y.ON_TRANSACTION_DELETE_DELETED);
201
- };
202
- return /* @__PURE__ */ l(U, { className: "mx-txn-delete", children: [
203
- t && /* @__PURE__ */ e(P, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ l(
204
- K,
205
- {
206
- onClick: () => {
207
- o(y.ON_TRANSACTION_DELETE_CLICK), a(!0), d(!0);
208
- },
209
- children: [
210
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { variant: "rounded", children: /* @__PURE__ */ e(oe, { color: "secondary", fontSize: "small" }) }) }),
211
- /* @__PURE__ */ e(
212
- M,
213
- {
214
- primary: n.manual_transaction_delete_title,
215
- secondary: n.manual_transaction_delete_subtitle
216
- }
217
- ),
218
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(oe, {}) })
219
- ]
220
- }
221
- ) }),
222
- /* @__PURE__ */ e(
223
- z,
224
- {
225
- copy: { title: n.manual_transaction_delete_title },
226
- isOpen: s,
227
- onClose: () => {
228
- a(!1), d(!1);
229
- },
230
- onPrimaryAction: u,
231
- onSecondaryAction: () => o(y.ON_TRANSACTION_DELETE_CANCEL),
232
- primaryText: r.delete_button,
233
- secondaryText: r.cancel_button,
234
- children: /* @__PURE__ */ e(C, { sx: { whiteSpace: "normal" }, variant: "Paragraph", children: n.manual_transaction_delete_description })
235
- }
236
- )
237
- ] });
238
- }, nt = f(rt), ot = ({ transaction: t }) => {
239
- const { onEvent: o } = O(), { updateTransaction: i } = D(), { setShouldDisableDrawerScroll: a } = W(), { common: r, transactions: n } = A(), s = V(), [d, u] = c.useState(!1), _ = async () => {
240
- await i({ ...t, merchant_guid: "" }), o(G.TRANSACTION_DETAILS_CLICK_DELETE_LOGO, {
241
- transaction_guid: t.guid
242
- });
243
- }, g = s.palette.mode === "dark" ? "grey.800" : "grey.100";
244
- return /* @__PURE__ */ e(c.Fragment, { children: t && /* @__PURE__ */ l(P, { className: "mx-txn-delete-logo", disableGutters: !0, disablePadding: !0, children: [
245
- /* @__PURE__ */ l(
246
- K,
247
- {
248
- onClick: () => {
249
- o(y.ON_TRANSACTION_DELETE_LOGO_CLICK), u(!0);
250
- },
251
- children: [
252
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: g }, variant: "rounded", children: /* @__PURE__ */ e(E, { name: "delete", sx: { color: "text.primary" } }) }) }),
253
- /* @__PURE__ */ e(M, { primary: n.merchant_logo_title, secondary: n.merchant_logo_desc }),
254
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
255
- ]
256
- }
257
- ),
258
- /* @__PURE__ */ l(
259
- z,
260
- {
261
- copy: { title: n.merchant_logo_modal_title },
262
- isOpen: d,
263
- onClose: () => {
264
- a(!1), u(!1);
265
- },
266
- onPrimaryAction: _,
267
- onSecondaryAction: () => o(y.ON_TRANSACTION_DELETE_LOGO_CANCEL),
268
- primaryText: r.delete_button,
269
- secondaryText: r.cancel_button,
270
- title: n.merchant_logo_modal_title,
271
- children: [
272
- /* @__PURE__ */ e(C, { sx: { whiteSpace: "normal" }, variant: "Paragraph", children: n.merchant_logo_modal_desc }),
273
- /* @__PURE__ */ e(C, { bold: !0, sx: { whiteSpace: "normal" }, variant: "Paragraph", children: ` ${n.merchant_logo_modal_desc_bold}` })
274
- ]
275
- }
276
- )
277
- ] }) });
278
- }, it = f(ot), st = ({ transaction: t }) => {
279
- const { onEvent: o } = O(), { updateTransaction: i } = D(), { setShouldDisableDrawerScroll: a } = W(), { common: r, transactions: n } = A(), s = V(), [d, u] = c.useState(!1), _ = t.is_hidden, g = async () => {
280
- await i({ ...t, is_hidden: !t.is_hidden }), o(
281
- _ ? y.ON_TRANSACTION_UNHIDDEN : y.ON_TRANSACTION_HIDDEN
282
- );
283
- }, m = s.palette.mode === "dark" ? "grey.800" : "grey.100";
284
- return /* @__PURE__ */ e(c.Fragment, { children: t && /* @__PURE__ */ l(P, { className: "mx-txn-hide-transaction", disableGutters: !0, disablePadding: !0, children: [
285
- /* @__PURE__ */ l(
286
- K,
287
- {
288
- "aria-checked": _,
289
- "aria-labelledby": "hide-transaction-text",
290
- onClick: () => {
291
- o(
292
- _ ? y.ON_TRANSACTION_UNHIDE_CLICK : y.ON_TRANSACTION_HIDE_CLICK
293
- ), o(
294
- _ ? "transaction_details_click_unhide_transaction" : "transaction_details_click_hide_transaction",
295
- {
296
- transaction_guid: t.guid
297
- }
298
- ), u(!0);
299
- },
300
- role: "switch",
301
- children: [
302
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: m }, variant: "rounded", children: _ ? /* @__PURE__ */ e(E, { name: "visibility_off", sx: { color: "text.primary" } }) : /* @__PURE__ */ e(E, { name: "visibility", sx: { color: "text.primary" } }) }) }),
303
- /* @__PURE__ */ e(
304
- M,
305
- {
306
- id: "hide-transaction-text",
307
- primary: _ ? n.hide_trnx_subtitle_unhide_trnx : n.hide_trnx_subtitle_hide_trnx,
308
- secondary: _ ? n.hide_trnx_desc_unhiding : n.hide_trnx_desc_hiding
309
- }
310
- ),
311
- /* @__PURE__ */ e(F, { "aria-hidden": "true", children: /* @__PURE__ */ e(
312
- Je,
313
- {
314
- checked: _,
315
- inputProps: { tabIndex: -1 },
316
- sx: { pointerEvents: "none" },
317
- tabIndex: -1
318
- }
319
- ) })
320
- ]
321
- }
322
- ),
323
- /* @__PURE__ */ e(
324
- z,
325
- {
326
- copy: {
327
- title: _ ? n.hide_trnx_subtitle_unhide_trnx : n.hide_trnx_subtitle_hide_trnx
328
- },
329
- isOpen: d,
330
- onClose: () => {
331
- a(!1), u(!1);
332
- },
333
- onPrimaryAction: g,
334
- onSecondaryAction: () => o(
335
- _ ? y.ON_TRANSACTION_UNHIDE_CANCEL_CLICK : y.ON_TRANSACTION_HIDE_CANCEL_CLICK
336
- ),
337
- primaryText: _ ? r.unhide_button : r.hide_button,
338
- secondaryText: r.cancel_button,
339
- children: /* @__PURE__ */ e(C, { truncate: !1, variant: "Paragraph", children: _ ? n.hide_trnx_desc_unhiding : n.hide_trnx_desc_hiding })
340
- }
341
- )
342
- ] }) });
343
- }, lt = f(st), ve = ({ transaction: t }) => {
344
- const { amount: o, description: i, isIncome: a, merchant_guid: r, payee: n, top_level_category_guid: s } = t;
345
- return /* @__PURE__ */ l(v, { className: "mx-txn-amount-header", direction: "row", gap: 12, px: 16, py: 24, children: [
346
- /* @__PURE__ */ e(
347
- Se,
348
- {
349
- categoryGuid: s || "",
350
- merchantGuid: r || "",
351
- size: 64
352
- }
353
- ),
354
- /* @__PURE__ */ l(v, { overflow: "hidden'", children: [
355
- /* @__PURE__ */ e(C, { bold: !0, mb: 4, truncate: !0, variant: "Body", children: i || n }),
356
- /* @__PURE__ */ l(X, { color: a ? "success.main" : "text.primary", truncate: !0, variant: "H1", children: [
357
- a ? "+" : "",
358
- Q(o, "0,0.00")
359
- ] })
360
- ] })
361
- ] });
362
- }, ct = ({ transaction: t }) => {
363
- const { onEvent: o } = O(), { updateTransaction: i } = D(), { updateManualTransaction: a } = W(), { common: r, transactions: n } = A(), s = V(), [d, u] = c.useState(!1), [_, g] = c.useState("");
364
- c.useEffect(() => {
365
- d && g(t.memo ? t.memo : "");
366
- }, [d]);
367
- const m = async () => {
368
- if (t.is_manual && !t.guid) {
369
- a({ ...t, memo: _ }), u(!1);
370
- return;
371
- }
372
- await i({ ...t, memo: _ }), o(G.TRANSACTION_DETAILS_CLICK_MEMO, { transaction_guid: t.guid }), u(!1);
373
- }, p = s.palette.mode === "dark" ? "grey.800" : "grey.100";
374
- return /* @__PURE__ */ l(P, { className: "mx-txn-memo-action", disableGutters: !0, disablePadding: !0, children: [
375
- /* @__PURE__ */ l(
376
- K,
377
- {
378
- onClick: () => {
379
- o(y.ON_TRANSACTION_MEMO_CLICK), u(!0);
380
- },
381
- children: [
382
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: p }, variant: "rounded", children: /* @__PURE__ */ e(E, { name: "article", sx: { color: "text.primary" } }) }) }),
383
- /* @__PURE__ */ e(
384
- M,
385
- {
386
- primary: n.memo_title,
387
- primaryTypographyProps: { variant: "XSmall" },
388
- secondary: /* @__PURE__ */ e(
389
- C,
390
- {
391
- bold: !0,
392
- sx: { overflowWrap: "break-word", whiteSpace: "wrap", color: "text.primary" },
393
- variant: "Body",
394
- children: t.memo ? t.memo : n.memo_desc
395
- }
396
- )
397
- }
398
- ),
399
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
400
- ]
401
- }
402
- ),
403
- /* @__PURE__ */ l(
404
- ce,
405
- {
406
- ariaLabelClose: r.close_aria,
407
- isOpen: d,
408
- onClose: () => u(!1),
409
- onPrimaryAction: m,
410
- title: n.memo_title,
411
- children: [
412
- /* @__PURE__ */ e(ve, { transaction: t }),
413
- /* @__PURE__ */ e(
414
- be,
415
- {
416
- "aria-label": n.memo_desc_aria,
417
- focused: !0,
418
- multiline: !0,
419
- name: "memo",
420
- onChange: (h) => g(h.target.value),
421
- placeholder: n.memo_desc,
422
- rows: 4,
423
- sx: { mx: 16, width: "calc(100% - 32px)" },
424
- value: _
425
- }
426
- )
427
- ]
428
- }
429
- )
430
- ] });
431
- }, dt = f(ct), _t = ({
432
- index: t,
433
- onDeleteRow: o,
434
- onCategoryChanged: i,
435
- onUpdateAmount: a,
436
- split: r
437
- }) => {
438
- const { onEvent: n } = O(), { transactions: s } = A(), [d, u] = c.useState(`${r.amount}`), [_, g] = c.useState(!1), m = t === 0, p = (h) => {
439
- isNaN(Number(h)) || (u(h), a(t, Number(h)));
440
- };
441
- return /* @__PURE__ */ l(U, { bgcolor: "background.paper", className: "mx-txn-split-manager-row", pb: 4, px: 8, children: [
442
- /* @__PURE__ */ l(pe, { alignItems: m ? "center" : "start", container: !0, children: [
443
- /* @__PURE__ */ e(pe, { item: !0, xs: 7, children: /* @__PURE__ */ l(v, { alignItems: "start", children: [
444
- /* @__PURE__ */ e(
445
- se,
446
- {
447
- endIcon: /* @__PURE__ */ e(Ve, {}),
448
- onClick: () => g(!0),
449
- startIcon: /* @__PURE__ */ e(he, { categoryGuid: r.top_level_category_guid }),
450
- sx: { px: 12, py: 8 },
451
- children: r.category
452
- }
453
- ),
454
- /* @__PURE__ */ e(U, { children: !r.category_guid && /* @__PURE__ */ l(v, { color: "error.main", direction: "row", gap: 8, p: 12, children: [
455
- /* @__PURE__ */ e("span", { "aria-label": "error", role: "img", children: /* @__PURE__ */ e(ie, { sx: { fontSize: 15 } }) }),
456
- /* @__PURE__ */ e(C, { variant: "Small", children: s.split_transaction_errors_select_category })
457
- ] }) })
458
- ] }) }),
459
- /* @__PURE__ */ e(pe, { item: !0, xs: 5, children: m ? /* @__PURE__ */ e("div", { className: "mx-txn-split-manager-row-top-container", children: /* @__PURE__ */ e(C, { children: Q(r.amount, "0,0.00") }) }) : /* @__PURE__ */ l(v, { alignItems: "start", children: [
460
- /* @__PURE__ */ l(v, { alignItems: "start", direction: "row", gap: 8, children: [
461
- /* @__PURE__ */ e(
462
- qe,
463
- {
464
- amount: d,
465
- ariaLabel: s.split_transaction_edit_split_amount,
466
- label: s.split_transaction_edit_split_amount,
467
- minAmount: 0.01,
468
- name: "split-amount-input",
469
- setAmount: p,
470
- sx: {
471
- ".MuiOutlinedInput-input": { p: 12 }
472
- },
473
- type: "number"
474
- }
475
- ),
476
- /* @__PURE__ */ e(
477
- J,
478
- {
479
- "aria-label": s.split_transaction_delete_split_btn,
480
- color: "secondary",
481
- onClick: () => {
482
- n(y.ON_TRANSACTION_SPLIT_DELETE_CLICK), o(t);
483
- },
484
- sx: { w: 44, h: 44 },
485
- children: /* @__PURE__ */ e(oe, {})
486
- }
487
- )
488
- ] }),
489
- !d && /* @__PURE__ */ l(v, { color: "error.main", direction: "row", gap: 8, py: 12, children: [
490
- /* @__PURE__ */ e("span", { "aria-label": "error", role: "img", children: /* @__PURE__ */ e(ie, { sx: { fontSize: 15 } }) }),
491
- /* @__PURE__ */ e(C, { variant: "Small", children: s.split_transaction_errors_enter_an_amount })
492
- ] })
493
- ] }) })
494
- ] }),
495
- /* @__PURE__ */ e(
496
- Ie,
497
- {
498
- initialSelected: r.category_guid,
499
- onClose: () => g(!1),
500
- onSelect: (h) => {
501
- i(t, h), g(!1);
502
- },
503
- showDrawer: _,
504
- title: s.actions_select_a_category
505
- }
506
- )
507
- ] });
508
- }, mt = f(_t), ut = ({
509
- onAddSplit: t,
510
- onCategoryChanged: o,
511
- onDeleteSplit: i,
512
- onUpdateAmount: a,
513
- splits: r,
514
- transaction: n
515
- }) => {
516
- const { transactions: s } = A(), { onEvent: d } = O(), [u, _] = c.useState(""), { announce: g, ariaLive: m } = le();
517
- return c.useEffect(() => {
518
- if (r.length <= 1)
519
- _(s.split_transaction_errors_min_splits), g(s.split_transaction_errors_min_splits);
520
- else if (r[0].amount < 0) {
521
- const p = R(
522
- s.split_transaction_errors_totals_must_equal_amount,
523
- Q(n.amount, "0,0.00")
524
- );
525
- _(p), g(p);
526
- } else
527
- _(""), g("");
528
- }, [r]), /* @__PURE__ */ l(U, { className: "mx-txn-split-manager", children: [
529
- m,
530
- r.map((p, h) => /* @__PURE__ */ e(
531
- mt,
532
- {
533
- index: h,
534
- onCategoryChanged: o,
535
- onDeleteRow: i,
536
- onUpdateAmount: a,
537
- split: p
538
- },
539
- h
540
- )),
541
- u && /* @__PURE__ */ l(v, { color: "error.main", direction: "row", gap: 8, p: 16, children: [
542
- /* @__PURE__ */ e("span", { "aria-label": "error", role: "img", children: /* @__PURE__ */ e(ie, { sx: { fontSize: 15 } }) }),
543
- /* @__PURE__ */ e(C, { variant: "Small", children: u })
544
- ] }),
545
- /* @__PURE__ */ e(U, { p: 16, children: /* @__PURE__ */ e(
546
- se,
547
- {
548
- "aria-label": s.split_transaction_add_split_btn,
549
- onClick: () => {
550
- d(y.ON_TRANSACTION_SPLIT_ADD_CLICK), t();
551
- },
552
- children: s.split_transaction_add_split_btn
553
- }
554
- ) })
555
- ] });
556
- }, pt = f(ut), gt = ({ transaction: t }) => {
557
- const { onEvent: o } = O(), { announce: i, ariaLive: a } = le(), { splitTransaction: r, unSplitTransaction: n } = D(), { common: s, transactions: d } = A(), { setShouldDisableDrawerScroll: u } = W(), { categories: _ } = xe(), g = V(), m = {
558
- ...t,
559
- amount: t.amount - 1,
560
- guid: "",
561
- has_been_split: !1,
562
- parent_guid: t.guid
563
- }, p = {
564
- ...t,
565
- amount: 1,
566
- category_guid: void 0,
567
- category: d.split_transaction_select_category_btn,
568
- guid: "",
569
- has_been_split: !1,
570
- parent_guid: t.guid,
571
- top_level_category_guid: void 0
572
- }, [h, N] = c.useState(!1), [b, L] = c.useState(!1), [S, T] = c.useState([]), w = () => {
573
- const x = [...S];
574
- x.push({ ...p }), x[0].amount -= 1, T(x), i(
575
- R(
576
- d.split_transaction_add_split_announcement,
577
- x.length
578
- )
579
- );
580
- }, k = (x) => {
581
- if (x > 0) {
582
- const H = S[x], I = [...S];
583
- I.splice(x, 1), I[0].amount += H.amount, T(I), i(
584
- R(d.split_transaction_delete_split_announcement, x + 1)
585
- );
586
- }
587
- }, Z = (x, H) => {
588
- const I = [...S];
589
- I[x].amount = H, I[0].amount = t.amount - I.reduce(
590
- (Y, me, Re) => Y + (Re !== 0 ? me.amount : 0),
591
- 0
592
- ), T(I);
593
- }, de = (x, H) => {
594
- const I = [...S], Y = _.find((me) => me.guid === H);
595
- Y && (I[x] = {
596
- ...I[x],
597
- category_guid: H,
598
- category: Y.name,
599
- top_level_category_guid: Y.parent_guid || H
600
- }, T(I), i(
601
- R(
602
- d.split_transaction_select_category_announcement,
603
- Y.name,
604
- x + 1
605
- )
606
- ));
607
- }, _e = () => {
608
- if (t.parent_guid || t.has_been_split) {
609
- L(!0);
610
- return;
611
- }
612
- T([{ ...m }, { ...p }]), o(G.TRANSACTION_DETAILS_CLICK_SPLIT, {
613
- transaction_guid: t.guid
614
- }), N(!0);
615
- }, Ee = async () => {
616
- o(y.ON_TRANSACTION_SPLIT_SAVE_CLICK), await r({ ...t, has_been_split: !0 }, S), N(!1);
617
- }, Oe = async () => {
618
- o(y.ON_TRANSACTION_SPLIT_CANCEL_CLICK), T([{ ...m }, { ...p }]), N(!1);
619
- }, De = async () => {
620
- o(G.TRANSACTION_DETAILS_CLICK_UNSPLIT, {
621
- transaction_guid: t.guid
622
- });
623
- const x = t.parent_guid ?? t.guid;
624
- await n(x);
625
- }, Le = c.useMemo(() => {
626
- const x = S.some((I) => !I.category_guid), H = S.some((I) => I.amount <= 0);
627
- return x || H;
628
- }, [S]), we = g.palette.mode === "dark" ? "grey.800" : "grey.100";
629
- return /* @__PURE__ */ e(c.Fragment, { children: t && /* @__PURE__ */ l(P, { disableGutters: !0, disablePadding: !0, children: [
630
- /* @__PURE__ */ l(K, { onClick: _e, children: [
631
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: we }, variant: "rounded", children: /* @__PURE__ */ e(E, { name: "call_split", sx: { color: "text.primary" } }) }) }),
632
- /* @__PURE__ */ e(
633
- M,
634
- {
635
- primary: t.has_been_split || t.parent_guid ? d.split_transaction_unsplit_title : d.split_transaction_title,
636
- secondary: t.has_been_split || t.parent_guid ? d.split_transaction_unsplit_subtitle : d.split_transaction_desc
637
- }
638
- ),
639
- /* @__PURE__ */ e(F, { children: t.has_been_split || t.parent_guid ? /* @__PURE__ */ e(E, { name: "delete" }) : /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
640
- ] }),
641
- /* @__PURE__ */ l(
642
- ce,
643
- {
644
- ariaLabelClose: s.close_aria,
645
- isOpen: h,
646
- isPrimaryDisabled: Le,
647
- onClose: Oe,
648
- onPrimaryAction: Ee,
649
- primaryText: s.save_button,
650
- secondaryText: s.cancel_button,
651
- title: d.split_transaction_title,
652
- children: [
653
- a,
654
- /* @__PURE__ */ e(ve, { transaction: t }),
655
- /* @__PURE__ */ e(
656
- pt,
657
- {
658
- onAddSplit: w,
659
- onCategoryChanged: de,
660
- onDeleteSplit: k,
661
- onUpdateAmount: Z,
662
- splits: S,
663
- transaction: t
664
- }
665
- )
666
- ]
667
- }
668
- ),
669
- /* @__PURE__ */ e(
670
- z,
671
- {
672
- copy: { title: d.split_transaction_unsplit_title },
673
- isOpen: b,
674
- onClose: () => {
675
- u(!1), L(!1);
676
- },
677
- onPrimaryAction: De,
678
- onSecondaryAction: () => {
679
- o(y.ON_TRANSACTION_UNSPLIT_CANCEL);
680
- },
681
- primaryText: s.delete_button,
682
- secondaryText: s.cancel_button,
683
- children: /* @__PURE__ */ e(X, { variant: "Paragraph", children: R(
684
- d.split_transaction_unsplit_description,
685
- t.description
686
- ) })
687
- }
688
- )
689
- ] }) });
690
- }, ht = f(gt), yt = () => {
691
- const t = fe(), { onEvent: o } = O(), { addTag: i } = D(), { transactions: a } = A(), [r, n] = c.useState(!1), [s, d] = c.useState(""), [u, _] = c.useState(""), g = c.useRef(null);
692
- c.useEffect(() => {
693
- r && g?.current?.focus();
694
- }, [r]);
695
- const m = () => {
696
- o(
697
- r ? y.ON_TRANSACTION_TAGS_TAG_ADD_CANCEL_CLICK : y.ON_TRANSACTION_TAGS_TAG_ADD_CLICK
698
- ), r || d(""), n(!r);
699
- }, p = async () => {
700
- o(y.ON_TRANSACTION_TAGS_TAG_ADDED), await i(s), n(!1);
701
- };
702
- return c.useEffect(() => {
703
- _(s.length > 40 ? a.tags_error_name_must_be_40_chars : "");
704
- }, [s]), /* @__PURE__ */ l(U, { className: "mx-txn-tag-manager-header", children: [
705
- /* @__PURE__ */ l(
706
- v,
707
- {
708
- alignItems: "center",
709
- bgcolor: t.palette.background.default,
710
- direction: "row",
711
- justifyContent: "space-between",
712
- px: 24,
713
- py: 16,
714
- children: [
715
- /* @__PURE__ */ e(C, { bold: !0, children: a.tags_your_tags }),
716
- /* @__PURE__ */ e(
717
- se,
718
- {
719
- "aria-expanded": r,
720
- "aria-label": a.tags_add_tag_btn_aria,
721
- onClick: m,
722
- children: a.tags_add_tag_btn
723
- }
724
- )
725
- ]
726
- }
727
- ),
728
- /* @__PURE__ */ l(
729
- z,
730
- {
731
- copy: { title: a.tags_add_tag_btn },
732
- isOpen: r,
733
- onClose: () => n(!1),
734
- onPrimaryAction: p,
735
- onSecondaryAction: () => n(!1),
736
- children: [
737
- /* @__PURE__ */ e(
738
- ye,
739
- {
740
- "aria-label": a.tags_placeholder,
741
- name: "add-tag",
742
- onChange: (h) => d(h.target.value),
743
- placeholder: a.tags_placeholder,
744
- sx: { width: "100%" },
745
- value: s
746
- }
747
- ),
748
- /* @__PURE__ */ e(X, { id: "add-tag-error", sx: { color: "error.main" }, variant: "ParagraphSmall", children: u })
749
- ]
750
- }
751
- )
752
- ] });
753
- }, Tt = f(yt), Ct = ({ onSearchValueChanged: t, searchValue: o }) => {
754
- const { common: i, transactions: a } = A(), r = /* @__PURE__ */ e(
755
- J,
756
- {
757
- "aria-label": a.tags_cancel_search || "Search",
758
- onClick: () => t(""),
759
- children: /* @__PURE__ */ e(ie, {})
760
- }
761
- );
762
- return /* @__PURE__ */ e(U, { className: "mx-txn-tag-manager-search", px: 24, py: 16, children: /* @__PURE__ */ e(
763
- ye,
764
- {
765
- InputProps: {
766
- startAdornment: /* @__PURE__ */ e(Te, { position: "start", children: /* @__PURE__ */ e(ze, { color: "disabled" }) }),
767
- endAdornment: /* @__PURE__ */ e(Te, { position: "end", sx: { padding: 0 }, children: o ? r : null })
768
- },
769
- "aria-label": i.search_aria,
770
- name: "search",
771
- onChange: (n) => t(n.target.value),
772
- placeholder: i.search_placeholder,
773
- sx: { bgcolor: "background.paper", width: "100%" },
774
- value: o
775
- }
776
- ) });
777
- }, St = f(Ct), bt = ({ onTagChecked: t, selectedTags: o, tag: i }) => {
778
- const { onEvent: a } = O(), { removeTag: r, updateTag: n } = D(), { common: s, transactions: d } = A(), [u, _] = c.useState(!1), [g, m] = c.useState(!1), [p, h] = c.useState(""), [N, b] = c.useState(""), L = async () => {
779
- a(y.ON_TRANSACTION_TAGS_TAG_EDIT_SAVED), i && await n({ ...i, name: p }), _(!1);
780
- }, S = async () => {
781
- a(y.ON_TRANSACTION_TAGS_TAG_DELETED), await r(i.guid), m(!1);
782
- };
783
- c.useEffect(() => {
784
- b(p.length > 40 ? d.tags_error_name_must_be_40_chars : "");
785
- }, [p]);
786
- const T = () => {
787
- a(y.ON_TRANSACTION_TAGS_TAG_EDIT_CLICK), h(i.name), _(!0);
788
- }, w = () => {
789
- a(y.ON_TRANSACTION_TAGS_TAG_DELETE_CLICK), m(!0);
790
- };
791
- return /* @__PURE__ */ l(
792
- P,
793
- {
794
- className: "mx-txn-transaction-manager-row",
795
- disableGutters: !0,
796
- disablePadding: !0,
797
- secondaryAction: !i.is_default_tag && /* @__PURE__ */ l(v, { direction: "row", children: [
798
- /* @__PURE__ */ e(
799
- J,
800
- {
801
- "aria-label": `Edit ${i.name} tag`,
802
- color: "secondary",
803
- onClick: T,
804
- children: /* @__PURE__ */ e(We, { color: "secondary" })
805
- }
806
- ),
807
- /* @__PURE__ */ e(
808
- J,
809
- {
810
- "aria-label": `Delete ${i.name} tag`,
811
- color: "secondary",
812
- onClick: w,
813
- children: /* @__PURE__ */ e(oe, { color: "secondary" })
814
- }
815
- )
816
- ] }),
817
- children: [
818
- /* @__PURE__ */ l(
819
- K,
820
- {
821
- "aria-checked": o.includes(i.guid),
822
- onClick: () => t(i.guid),
823
- role: "checkbox",
824
- children: [
825
- /* @__PURE__ */ e(F, { sx: { ml: 0 }, children: /* @__PURE__ */ e(
826
- je,
827
- {
828
- "aria-hidden": !0,
829
- checked: o.includes(i.guid),
830
- edge: "start",
831
- tabIndex: -1
832
- }
833
- ) }),
834
- /* @__PURE__ */ e(M, { children: i.name })
835
- ]
836
- }
837
- ),
838
- /* @__PURE__ */ l(
839
- z,
840
- {
841
- copy: { title: "Update tag name" },
842
- isOpen: u,
843
- onClose: () => _(!1),
844
- onPrimaryAction: L,
845
- onSecondaryAction: () => _(!1),
846
- children: [
847
- /* @__PURE__ */ e(
848
- ye,
849
- {
850
- "aria-describedby": N ? "update-tag-error" : void 0,
851
- "aria-label": d.tags_update_the_tag_name,
852
- name: "update-tag",
853
- onChange: (k) => h(k.target.value),
854
- placeholder: "Tag name",
855
- sx: { width: "100%" },
856
- value: p
857
- }
858
- ),
859
- /* @__PURE__ */ e(X, { id: "update-tag-error", sx: { color: "error.main" }, variant: "ParagraphSmall", children: N })
860
- ]
861
- }
862
- ),
863
- /* @__PURE__ */ e(
864
- z,
865
- {
866
- copy: { title: d.tags_delete_title },
867
- isOpen: g,
868
- onClose: () => m(!1),
869
- onPrimaryAction: S,
870
- onSecondaryAction: () => a(y.ON_TRANSACTION_TAGS_TAG_DELETE_CANCEL_CLICK),
871
- primaryText: s.delete_button,
872
- secondaryText: s.cancel_button,
873
- children: /* @__PURE__ */ e(C, { truncate: !1, children: d.tags_deleting_this_tag_will_remove_it })
874
- }
875
- )
876
- ]
877
- }
878
- );
879
- }, xt = f(bt), ft = ({ selectedTags: t, onTagChecked: o }) => {
880
- const { tags: i } = D(), [a, r] = c.useState(""), n = i.filter(
881
- (s) => s.name.toLowerCase().includes(a.toLowerCase())
882
- );
883
- return /* @__PURE__ */ l("div", { className: "mx-txn-tag-manager", children: [
884
- /* @__PURE__ */ e(
885
- St,
886
- {
887
- onSearchValueChanged: (s) => r(s),
888
- searchValue: a
889
- }
890
- ),
891
- /* @__PURE__ */ e(Tt, {}),
892
- /* @__PURE__ */ e(te, { sx: { boxShadow: "none" }, children: /* @__PURE__ */ e(ne, { children: n.map((s) => /* @__PURE__ */ l(c.Fragment, { children: [
893
- /* @__PURE__ */ e(xt, { onTagChecked: o, selectedTags: t, tag: s }),
894
- /* @__PURE__ */ e(re, { sx: { ml: 24 } })
895
- ] }, s.guid)) }) })
896
- ] });
897
- }, At = f(ft), Nt = ({ transaction: t }) => {
898
- const { onEvent: o } = O(), { tags: i, updateTaggings: a, updateTransaction: r } = D(), { common: n, transactions: s } = A(), { updateManualTransaction: d } = W(), u = V(), [_, g] = c.useState(!1), [m, p] = c.useState(t.tags);
899
- c.useEffect(() => {
900
- p(t.tags);
901
- }, [_, t]);
902
- const h = (S) => {
903
- const T = [...m], w = m.indexOf(S);
904
- w >= 0 ? T.splice(w, 1) : T.push(S), p(T);
905
- }, N = async () => {
906
- if (t.is_manual && !t.guid) {
907
- d({ ...t, tags: m }), g(!1);
908
- return;
909
- }
910
- await a(m, t.guid), await r({ ...t, tags: m }), o(G.TRANSACTION_DETAILS_CLICK_TAGS, { transaction_guid: t.guid }), g(!1);
911
- }, b = c.useMemo(
912
- () => t.tags.map(
913
- (S, T, w) => `${i.find((k) => k.guid === S)?.name}${T < w.length - 1 ? " / " : ""}`
914
- ),
915
- [i, t]
916
- ), L = u.palette.mode === "dark" ? "grey.800" : "grey.100";
917
- return /* @__PURE__ */ l(P, { disableGutters: !0, disablePadding: !0, children: [
918
- /* @__PURE__ */ l(
919
- K,
920
- {
921
- onClick: () => {
922
- o(y.ON_TRANSACTION_TAGS_CLICK), g(!0);
923
- },
924
- children: [
925
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: L }, variant: "rounded", children: /* @__PURE__ */ e(E, { name: "local_offer", sx: { color: "text.primary" } }) }) }),
926
- /* @__PURE__ */ e(
927
- M,
928
- {
929
- primary: s.tags_title,
930
- primaryTypographyProps: { variant: "XSmall" },
931
- secondary: /* @__PURE__ */ e(C, { bold: !0, sx: { color: "text.primary" }, variant: "Body", children: t.tags?.length > 0 ? b : s.tags_desc })
932
- }
933
- ),
934
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
935
- ]
936
- }
937
- ),
938
- /* @__PURE__ */ e(
939
- ce,
940
- {
941
- ariaLabelClose: n.close_aria,
942
- isOpen: _,
943
- onClose: () => g(!1),
944
- onPrimaryAction: N,
945
- primaryText: n.save_button,
946
- secondaryText: n.cancel_button,
947
- title: s.tags_title,
948
- children: /* @__PURE__ */ e(At, { onTagChecked: h, selectedTags: m })
949
- }
950
- )
951
- ] });
952
- }, It = f(Nt), vt = ({ transaction: t, viewOnly: o = !1 }) => {
953
- const { updateTransaction: i } = D(), { common: a, transactions: r } = A(), { onEvent: n } = O(), { announce: s, ariaLive: d } = le(), [u, _] = c.useState(!1), [g, m] = c.useState(""), p = c.useRef(null);
954
- c.useEffect(() => {
955
- u && (m(t.description), p?.current?.focus());
956
- }, [u]);
957
- const h = () => {
958
- _(!0), n(y.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK), setTimeout(() => document.getElementById("transaction-description-input")?.focus(), 0);
959
- }, N = async () => {
960
- n(G.TRANSACTION_DETAILS_CLICK_DESCRIPTION, {
961
- transaction_guid: t.guid
962
- }), await i({ ...t, description: g }), _(!1), s(`${r.payee_title}: ${g}`), setTimeout(() => document.getElementById("transaction-description-edit-button")?.focus(), 0);
963
- };
964
- return /* @__PURE__ */ l(U, { className: "mx-txn-transaction-description", children: [
965
- d,
966
- u ? /* @__PURE__ */ l($e, { row: !0, children: [
967
- /* @__PURE__ */ e(
968
- be,
969
- {
970
- "aria-label": r.payee_title,
971
- id: "transaction-description-input",
972
- inputProps: { maxLength: 140 },
973
- label: r.payee_title,
974
- name: r.payee_title,
975
- onChange: (b) => m(b.target.value),
976
- ref: p,
977
- sx: {
978
- backgroundColor: "background.paper",
979
- ".MuiOutlinedInput-root": { borderTopRightRadius: 0, borderBottomRightRadius: 0 },
980
- ".MuiOutlinedInput-input": { p: 11 },
981
- width: 250
982
- },
983
- value: g
984
- }
985
- ),
986
- /* @__PURE__ */ e(
987
- se,
988
- {
989
- disabled: !g,
990
- onClick: N,
991
- sx: {
992
- borderTopLeftRadius: 0,
993
- borderBottomLeftRadius: 0
994
- },
995
- variant: "outlined",
996
- children: a.save_button
997
- }
998
- )
999
- ] }) : /* @__PURE__ */ l(v, { alignItems: "center", direction: "row", gap: 4, sx: { minHeight: 44 }, children: [
1000
- /* @__PURE__ */ e(C, { bold: !0, children: t.description }),
1001
- !o && /* @__PURE__ */ e(
1002
- J,
1003
- {
1004
- "aria-label": r.payee_edit,
1005
- id: "transaction-description-edit-button",
1006
- onClick: h,
1007
- sx: { color: "action.active" },
1008
- children: /* @__PURE__ */ e(ae, { name: "create", size: 22 })
1009
- }
1010
- )
1011
- ] })
1012
- ] });
1013
- }, Et = f(vt), Ot = ({ transaction: t }) => {
1014
- const { updateTransaction: o } = D(), { transactions: i } = A(), { onEvent: a } = O(), r = fe(), n = async () => {
1015
- a(G.TRANSACTION_DETAILS_CLICK_FLAG, { transaction_guid: t.guid }), await o({ ...t, is_flagged: !t.is_flagged });
1016
- };
1017
- return /* @__PURE__ */ e("div", { className: "mx-txn-transaction-flag", children: /* @__PURE__ */ e(
1018
- Ue,
1019
- {
1020
- "aria-label": i.flag_btn_aria,
1021
- "aria-pressed": t.is_flagged,
1022
- color: "warning",
1023
- onClick: n,
1024
- selected: t.is_flagged,
1025
- sx: {
1026
- borderRadius: 6,
1027
- color: r.palette.secondary.main,
1028
- "&.Mui-selected": {
1029
- color: r.palette.common.white,
1030
- backgroundColor: r.palette.warning.dark,
1031
- ":hover": {
1032
- color: r.palette.common.white,
1033
- backgroundColor: r.palette.warning.main
1034
- }
1035
- },
1036
- ":hover": {
1037
- color: r.palette.warning.contrastText,
1038
- backgroundColor: r.palette.warning.light
1039
- }
1040
- },
1041
- value: "flagged",
1042
- children: /* @__PURE__ */ e(Ye, { color: "inherit" })
1043
- }
1044
- ) });
1045
- }, Dt = f(Ot), ee = (t, o, i, a = !0, r = "inset") => a ? /* @__PURE__ */ l(c.Fragment, { children: [
1046
- /* @__PURE__ */ l(P, { disableGutters: !0, disablePadding: !0, children: [
1047
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: "border.light" }, variant: "rounded", children: t }) }),
1048
- /* @__PURE__ */ e(
1049
- M,
1050
- {
1051
- primary: o,
1052
- primaryTypographyProps: { variant: "XSmall" },
1053
- secondary: i
1054
- }
1055
- )
1056
- ] }),
1057
- /* @__PURE__ */ e(re, { variant: r })
1058
- ] }) : null, Lt = ({ transaction: t }) => {
1059
- const { transactions: o } = A(), { tags: i } = D(), a = c.useMemo(() => {
1060
- const r = new Map(i.map((n) => [n.guid, n.name]));
1061
- return t.tags.map((n) => r.get(n)).filter(Boolean).join(" / ");
1062
- }, [i, t.tags]);
1063
- return /* @__PURE__ */ l(ne, { sx: { "& .MuiListItem-root": { px: 24, py: 12 } }, children: [
1064
- ee(
1065
- /* @__PURE__ */ e(
1066
- he,
1067
- {
1068
- categoryGuid: t.top_level_category_guid,
1069
- size: 24,
1070
- sx: { color: "text.primary" },
1071
- variant: Ce.Transparent
1072
- }
1073
- ),
1074
- o.category_title,
1075
- /* @__PURE__ */ e(C, { bold: !0, variant: "Body", children: t.category ?? o.actions_select_a_category })
1076
- ),
1077
- ee(
1078
- /* @__PURE__ */ e(ae, { name: "calendar_month", sx: { color: "text.primary" }, weight: ue.Dark }),
1079
- o.date_title,
1080
- /* @__PURE__ */ e(C, { bold: !0, variant: "Body", children: Ae(ge(t.date), Ne.YEAR_MONTH_DAY) })
1081
- ),
1082
- ee(
1083
- /* @__PURE__ */ e(ae, { name: "article", sx: { color: "text.primary" }, weight: ue.Dark }),
1084
- o.memo_title,
1085
- /* @__PURE__ */ e(C, { bold: !0, sx: { overflowWrap: "break-word", whiteSpace: "wrap" }, variant: "Body", children: t.memo ?? o.memo_desc }),
1086
- !!t.memo,
1087
- t.tags?.length > 0 ? "inset" : "fullWidth"
1088
- ),
1089
- ee(
1090
- /* @__PURE__ */ e(ae, { name: "local_offer", sx: { color: "text.primary" }, weight: ue.Dark }),
1091
- o.tags_title,
1092
- /* @__PURE__ */ e(C, { bold: !0, variant: "Body", children: t.tags?.length ? a : o.tags_desc }),
1093
- !!t.tags?.length,
1094
- "fullWidth"
1095
- )
1096
- ] });
1097
- }, wt = f(Lt), Rt = f(({ transaction: t }) => {
1098
- const [o, i] = c.useState(!1), [a, r] = c.useState(""), [n, s] = c.useState(!1), [d, u] = c.useState(!1), _ = V(), { addMerchantBudget: g, getMerchantBudgetByMerchantGuid: m, alert: p, setAlert: h } = Ke(), N = _.palette.mode === "dark" ? "grey.800" : "grey.100", { budgets: b, common: L } = A(), { announce: S, ariaLive: T } = le(), w = () => {
1099
- i(!0);
1100
- }, k = t?.merchant_guid ? m(t.merchant_guid) : void 0, Z = () => {
1101
- i(!1), r("");
1102
- }, de = async () => {
1103
- if (d) return;
1104
- u(!0);
1105
- const { isSuccess: _e } = await g(t.merchant_guid, Number(a));
1106
- _e ? (s(!1), h(
1107
- R(b.alert_budget_created, t.description)
1108
- ), S(
1109
- R(b.alert_budget_created, t.description)
1110
- )) : (s(!0), h(
1111
- R(
1112
- b.alert_merchant_budget_not_created,
1113
- t.description
1114
- )
1115
- ), S(
1116
- R(
1117
- b.alert_merchant_budget_not_created,
1118
- t.description
1119
- )
1120
- )), Z(), u(!1);
1121
- };
1122
- return /* @__PURE__ */ l(c.Fragment, { children: [
1123
- T,
1124
- t && /* @__PURE__ */ e(P, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ l(K, { onClick: w, children: [
1125
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(B, { sx: { bgcolor: N }, variant: "rounded", children: /* @__PURE__ */ e(E, { name: "bubble_chart", sx: { color: "text.primary" } }) }) }),
1126
- /* @__PURE__ */ e(
1127
- M,
1128
- {
1129
- primary: b.add_merchant_budget_primary_text,
1130
- primaryTypographyProps: { variant: "caption" },
1131
- secondary: /* @__PURE__ */ e(C, { bold: !0, sx: { color: "text.primary" }, variant: "body1", children: k ? `${Q(k.amount, "0,0.00")} / ${L.month_text}` : b.add_merchant_budget_secondary_text })
1132
- }
1133
- ),
1134
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(E, { name: "chevron_right", sx: { color: "text.primary" } }) })
1135
- ] }) }),
1136
- /* @__PURE__ */ e(
1137
- Ge,
1138
- {
1139
- closeAriaLabel: L.close_aria,
1140
- content: R(
1141
- b.create_budget_content,
1142
- /* @__PURE__ */ e("b", { children: t.description }),
1143
- t.amount
1144
- ),
1145
- handleInputChange: r,
1146
- handleModalClose: Z,
1147
- handlePrimaryAction: de,
1148
- handleSecondaryAction: () => i(!1),
1149
- inputLabel: L.amount_text,
1150
- inputValue: a,
1151
- isOpen: o && !k,
1152
- primaryText: b.dialog_primary_button_text,
1153
- secondaryText: L.cancel_button,
1154
- title: b.dialog_create_budget_title
1155
- }
1156
- ),
1157
- !!p && /* @__PURE__ */ e(
1158
- ke,
1159
- {
1160
- actionText: b.autogenerate_budgets_error_primary_button,
1161
- "aria-label": p,
1162
- "aria-live": n ? "assertive" : "polite",
1163
- autoHideDuration: 3500,
1164
- handleClose: () => h(""),
1165
- message: p,
1166
- multiLine: !0,
1167
- onActionClick: () => i(!0),
1168
- open: !!p,
1169
- severity: n ? "error" : "success",
1170
- showAction: n,
1171
- showClose: !0,
1172
- snackbarSx: {
1173
- //TODO - remove the customization and update the Toast component in MXUI to handle multi-line messages and long action text
1174
- "& .MuiAlert-root": {
1175
- alignItems: "self-start",
1176
- minHeight: 0,
1177
- "& .MuiAlert-message": {
1178
- pt: 8
1179
- }
1180
- },
1181
- "&.MuiSnackbar-root": {
1182
- width: "fit-content"
1183
- },
1184
- "& .MuiAlert-action .MuiStack-root": {
1185
- flexDirection: "row",
1186
- display: "flex",
1187
- alignItems: "center",
1188
- width: "max-content"
1189
- }
1190
- }
1191
- }
1192
- )
1193
- ] });
1194
- }), kt = ({
1195
- bottomActions: t = et,
1196
- canFlagTransaction: o = !0,
1197
- topActions: i = Ze,
1198
- transaction: a
1199
- }) => {
1200
- const { onEvent: r } = O(), { isCopyLoaded: n } = Fe(), { userFeatures: s } = He(), d = V(), u = a?.number && a.number.length > 4;
1201
- if (c.useEffect(
1202
- () => r(G.TRANSACTION_DETAILS_VIEW, { transaction_guid: a.guid }),
1203
- []
1204
- ), !n)
1205
- return /* @__PURE__ */ e(Qe, {});
1206
- const _ = Be(s, "MX_TXN_DETAILS_VIEW_ONLY"), g = d.palette.mode === "dark" ? "grey.800" : "grey.100";
1207
- return /* @__PURE__ */ e(U, { className: "mx-txn-transaction-details", width: "100%", children: a && /* @__PURE__ */ l(v, { children: [
1208
- /* @__PURE__ */ l(v, { gap: 12, p: 24, children: [
1209
- /* @__PURE__ */ e(te, { elevation: 2, sx: { width: 64 }, children: /* @__PURE__ */ e(
1210
- Se,
1211
- {
1212
- categoryGuid: a.top_level_category_guid || "",
1213
- merchantGuid: a.merchant_guid || "",
1214
- size: 64
1215
- }
1216
- ) }),
1217
- /* @__PURE__ */ e(Et, { transaction: a, viewOnly: _ }),
1218
- /* @__PURE__ */ l(v, { direction: "row", justifyContent: "space-between", sx: { minHeight: 44 }, children: [
1219
- /* @__PURE__ */ l(X, { color: a.isIncome ? "success.main" : "text.primary", variant: "H1", children: [
1220
- a.isIncome ? "+" : "",
1221
- Q(a.amount, "0,0.00")
1222
- ] }),
1223
- !_ && o && /* @__PURE__ */ e(Dt, { transaction: a })
1224
- ] }),
1225
- /* @__PURE__ */ l(v, { sx: { bgcolor: g, borderRadius: "4px", gap: 4, p: 8 }, children: [
1226
- /* @__PURE__ */ e(C, { bold: !0, children: `${a.account}
1227
- ${u ? a.number : "•".repeat(4).concat(a.number ?? "")}` }),
1228
- /* @__PURE__ */ e(C, { bold: !0, variant: "Tiny", children: a.feed_description })
1229
- ] })
1230
- ] }),
1231
- /* @__PURE__ */ e(te, { square: !0, sx: { boxShadow: "none" }, children: _ ? /* @__PURE__ */ e(wt, { transaction: a }) : /* @__PURE__ */ e(ne, { children: i.map((m, p) => /* @__PURE__ */ l(c.Fragment, { children: [
1232
- m === j.Category && /* @__PURE__ */ e(tt, { transaction: a }),
1233
- m === j.Date && /* @__PURE__ */ e(at, { transaction: a }),
1234
- m === j.Memo && /* @__PURE__ */ e(dt, { transaction: a }),
1235
- m === j.Tags && /* @__PURE__ */ e(It, { transaction: a }),
1236
- /* @__PURE__ */ e(re, { variant: p < i.length - 1 ? "inset" : "fullWidth" })
1237
- ] }, m)) }) }),
1238
- !_ && t.length > 0 && /* @__PURE__ */ l(c.Fragment, { children: [
1239
- /* @__PURE__ */ e(C, { bold: !0, mb: 8, ml: 26, mt: 16, variant: "Body", children: "Actions" }),
1240
- /* @__PURE__ */ e(te, { square: !0, sx: { boxShadow: "none" }, children: /* @__PURE__ */ l(ne, { children: [
1241
- t.map((m, p) => /* @__PURE__ */ l(c.Fragment, { children: [
1242
- m === q.MerchantBudget && /* @__PURE__ */ e(Rt, { transaction: a }),
1243
- m === q.SplitTransaction && /* @__PURE__ */ e(ht, { transaction: a }),
1244
- m === q.HideTransaction && /* @__PURE__ */ e(lt, { transaction: a }),
1245
- m === q.MerchantLogo && /* @__PURE__ */ e(it, { transaction: a }),
1246
- /* @__PURE__ */ e(re, { variant: p < t.length - 1 ? "inset" : "fullWidth" })
1247
- ] }, m)),
1248
- a.is_manual && !a.parent_guid && !a.has_been_split && /* @__PURE__ */ e(nt, { transaction: a })
1249
- ] }) })
1250
- ] })
1251
- ] }) });
1252
- }, Aa = f(kt);
1253
- export {
1254
- q as B,
1255
- tt as C,
1256
- at as D,
1257
- dt as M,
1258
- Aa as T,
1259
- It as a,
1260
- j as b
1261
- };