@mx-cartographer/experiences 7.6.26 → 7.6.28

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