@mx-cartographer/experiences 7.10.21 → 7.10.22

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