@mx-cartographer/experiences 7.0.11-alpha.mega1 → 7.0.11

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