@mx-cartographer/experiences 7.0.12 → 7.0.14-alpha-debts-missing-sorting-option-ram1

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