@mx-cartographer/experiences 8.0.14 → 8.0.15

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