@mx-cartographer/experiences 7.10.31 → 7.10.32

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