@mx-cartographer/experiences 9.0.13 → 9.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,905 @@
1
+ import { jsxs as l, jsx as e, Fragment as W } from "react/jsx-runtime";
2
+ import u from "react";
3
+ import { observer as M } from "mobx-react-lite";
4
+ import j from "@mui/material/Box";
5
+ import F from "@mui/material/Divider";
6
+ import ne from "@mui/material/List";
7
+ import p from "@mui/material/Stack";
8
+ import { P as H, Text as y, MerchantLogo as ae, InstitutionLogo as Pe } from "@mxenabled/mxui";
9
+ import Ue from "@mui/material/ListItem";
10
+ import _e from "@mui/material/ListItemAvatar";
11
+ import Fe from "@mui/material/ListItemButton";
12
+ import pe from "@mui/material/ListItemText";
13
+ import { b as ze, f as oe } from "./NumberFormatting--XMeeBfr.mjs";
14
+ import { R as O, F as _, g as he, a as R, c as Ye, d as Be } from "./RecurringTransactionsUtil-CHWmqvW5.mjs";
15
+ import { subDays as ye } from "date-fns/subDays";
16
+ import { startOfToday as U } from "date-fns/startOfToday";
17
+ import { endOfMonth as We } from "date-fns/endOfMonth";
18
+ import fe from "@mui/material/Button";
19
+ import { CheckCircle as Ke, Cancel as qe, Icon as je, ChevronRight as He, Delete as Qe, Add as $e, ReceiptLong as Xe } from "@mxenabled/mx-icons";
20
+ import { T as Ze } from "./TransactionDetails-DQ_eE7M4.mjs";
21
+ import { a as Je } from "./AccountDetailsDrawer-BuxLfuIm.mjs";
22
+ import { u as Ve } from "./AccountDetailsHeader-ByGNPZpO.mjs";
23
+ import { C as ee } from "./Category-DEKZGLYe.mjs";
24
+ import { T as ge } from "./TransactionUtils-BphBJBbU.mjs";
25
+ import { u as Ce, T as et, S as tt, a as nt } from "./EmbeddedCard-BxgB26dd.mjs";
26
+ import { u as x, h as Y, g as re, f as K, a as at, c as ot, C as rt } from "./hooks-97sNJ_lf.mjs";
27
+ import { S as it } from "./SearchBox-Cpgu_gdO.mjs";
28
+ import { D as z } from "./Drawer-DsnW2o0v.mjs";
29
+ import { D as ie } from "./Dialog-Bvd2n8hz.mjs";
30
+ import { addYears as ue } from "date-fns/addYears";
31
+ import { getDayOfYear as st } from "date-fns/getDayOfYear";
32
+ import { setDayOfYear as ct } from "date-fns/setDayOfYear";
33
+ import { AdapterDateFns as lt } from "@mui/x-date-pickers/AdapterDateFnsV3";
34
+ import { DatePicker as dt } from "@mui/x-date-pickers";
35
+ import { LocalizationProvider as ut } from "@mui/x-date-pickers/LocalizationProvider";
36
+ import { S as q, D as te } from "./Select-CSpkK5cR.mjs";
37
+ import { A as D } from "./Analytics-WeZYytR0.mjs";
38
+ import { fromUnixTime as be } from "date-fns/fromUnixTime";
39
+ import { getUnixTime as mt } from "date-fns/getUnixTime";
40
+ import _t from "@mui/material/IconButton";
41
+ import pt from "@mui/material/Menu";
42
+ import ht from "@mui/material/MenuItem";
43
+ import { L as yt } from "./ListItemWrapper-BHIbqx7E.mjs";
44
+ import { f as Se, D as xe } from "./DateFormats-HudZ3Bjs.mjs";
45
+ import ft from "@mui/material/Card";
46
+ import gt from "@mui/material/CardActionArea";
47
+ import { useTheme as Ct, alpha as bt } from "@mui/material";
48
+ import { B as St } from "./BeatMaterialIcon-1KOfRZrA.mjs";
49
+ import { formatISO as xt } from "date-fns/formatISO";
50
+ import { k as kt } from "./DateUtil-CzBmbjmA.mjs";
51
+ const Q = (n) => n.top_level_category_guid !== ee.INCOME && n.transaction_type === ge.DEBIT, ke = (n, t) => Q(n) ? n.payee?.toLowerCase().includes(t.toLowerCase()) || n.description.toLowerCase().includes(t.toLowerCase()) || n.feed_description.toLowerCase().includes(t.toLowerCase()) : !1, $ = (n) => n.top_level_category_guid === ee.INCOME || n.top_level_category_guid === ee.TRANSFER && n.transaction_type === ge.CREDIT, Ae = (n, t) => $(n) ? n.payee?.toLowerCase().includes(t.toLowerCase()) || n.description?.toLowerCase().includes(t.toLowerCase()) || n.feed_description?.toLowerCase().includes(t.toLowerCase()) : !1, ve = M(
52
+ ({
53
+ bgcolor: n = "background.default",
54
+ description: t,
55
+ onSearch: i,
56
+ onSelected: a
57
+ }) => {
58
+ const { recurring: o } = x(), { searchValue: s, setSearchValue: r } = Ce();
59
+ return /* @__PURE__ */ l(p, { sx: { bgcolor: n, gap: 16, pt: 8 }, children: [
60
+ t && /* @__PURE__ */ e(H, { sx: { mx: 24 }, children: t }),
61
+ /* @__PURE__ */ e(
62
+ it,
63
+ {
64
+ ariaLabel: o.select_transaction_search_aria,
65
+ cancelAriaLabel: o.select_transaction_search_cancel_aria,
66
+ onChange: (d) => {
67
+ r(d), i(d);
68
+ },
69
+ placeholder: o.select_transaction_search_placeholder,
70
+ searchValue: s
71
+ }
72
+ ),
73
+ /* @__PURE__ */ e(
74
+ et,
75
+ {
76
+ bgcolor: n,
77
+ filter: (d) => !!d.merchant_guid,
78
+ height: "auto",
79
+ onClick: a,
80
+ showLoader: !1
81
+ }
82
+ )
83
+ ] });
84
+ }
85
+ ), me = (n, t) => (i) => {
86
+ if (i.repeating_transaction_guid) return !1;
87
+ const a = n.repeating_transaction_type === O.Income;
88
+ return t ? a ? Ae(i, t) : ke(i, t) : a ? $(i) : Q(i);
89
+ }, At = M(
90
+ ({ isOpen: n, onClose: t, recurringTransaction: i }) => {
91
+ const { recurring: a } = x(), { markRecurrenceAsPaid: o } = Y(), { filter: s, setFilter: r, transactions: d } = re(), { setSearchValue: h } = Ce();
92
+ u.useEffect(() => {
93
+ n ? r({ ...s, custom: me(i) }) : h("");
94
+ }, [n, i]);
95
+ const f = (m) => {
96
+ r({ ...s, custom: me(i, m) });
97
+ }, C = async (m) => {
98
+ const b = d.find((S) => S.guid === m);
99
+ b && (await o(i.guid, b), t());
100
+ };
101
+ return /* @__PURE__ */ e(
102
+ z,
103
+ {
104
+ ariaLabelClose: a.close_drawer_aria,
105
+ isOpen: n,
106
+ onClose: t,
107
+ title: a.link_transaction_button,
108
+ children: /* @__PURE__ */ e(ve, { onSearch: f, onSelected: C })
109
+ }
110
+ );
111
+ }
112
+ ), vt = ({ isOpen: n, onClose: t, onLinkTransaction: i }) => {
113
+ const { recurring: a } = x();
114
+ return /* @__PURE__ */ e(
115
+ ie,
116
+ {
117
+ copy: {
118
+ title: a.mark_as_paid_dialog_title,
119
+ close_aria: a.close_drawer_aria
120
+ },
121
+ isOpen: n,
122
+ maxWidth: "xs",
123
+ onClose: t,
124
+ onPrimaryAction: i,
125
+ primaryText: a.link_transaction_button,
126
+ sx: {
127
+ "& .MuiStack-root, & .MuiDialogContent-root": {
128
+ backgroundColor: "background.paper"
129
+ }
130
+ },
131
+ children: /* @__PURE__ */ e(y, { truncate: !1, children: a.link_transaction_description })
132
+ }
133
+ );
134
+ }, wt = ({
135
+ isOpen: n,
136
+ onClose: t,
137
+ onUnlinkTransaction: i
138
+ }) => {
139
+ const { recurring: a } = x();
140
+ return /* @__PURE__ */ e(
141
+ ie,
142
+ {
143
+ copy: {
144
+ title: a.mark_as_unpaid_dialog_title,
145
+ close_aria: a.close_drawer_aria
146
+ },
147
+ isOpen: n,
148
+ maxWidth: "xs",
149
+ onClose: t,
150
+ onPrimaryAction: i,
151
+ primaryText: a.unlink_transaction_button,
152
+ sx: {
153
+ "& .MuiStack-root, & .MuiDialogContent-root": {
154
+ backgroundColor: "background.paper"
155
+ }
156
+ },
157
+ children: /* @__PURE__ */ e(y, { truncate: !1, children: a.unlink_transaction_description })
158
+ }
159
+ );
160
+ }, we = ({
161
+ frequency: n,
162
+ firstDay: t,
163
+ secondDay: i,
164
+ onFrequencyChange: a,
165
+ onFirstDayChange: o,
166
+ onSecondDayChange: s
167
+ }) => {
168
+ const { recurring: r } = x(), d = u.useMemo(
169
+ () => [
170
+ { id: _.EveryWeek, label: r.frequency_every_week },
171
+ { id: _.EveryOtherWeek, label: r.frequency_every_other_week },
172
+ { id: _.TwiceAMonth, label: r.frequency_twice_a_month },
173
+ { id: _.EveryMonth, label: r.frequency_every_month },
174
+ { id: _.EveryOtherMonth, label: r.frequency_every_other_month },
175
+ { id: _.EveryQuarter, label: r.frequency_every_quarter },
176
+ { id: _.EveryOtherQuarter, label: r.frequency_every_other_quarter },
177
+ { id: _.EveryYear, label: r.frequency_every_year }
178
+ ],
179
+ [r]
180
+ ), h = [
181
+ { id: 0, label: r.weekday_sunday },
182
+ { id: 1, label: r.weekday_monday },
183
+ { id: 2, label: r.weekday_tuesday },
184
+ { id: 3, label: r.weekday_wednesday },
185
+ { id: 4, label: r.weekday_thursday },
186
+ { id: 5, label: r.weekday_friday },
187
+ { id: 6, label: r.weekday_saturday }
188
+ ], f = [...Array(31).keys()].map((k) => ({
189
+ id: k + 1,
190
+ label: ze(k + 1)
191
+ }));
192
+ f[30].label += ` (${r.last_day_of_month})`;
193
+ const C = f.slice(0, 15), m = f.slice(14), b = n === _.EveryWeek || n === _.EveryOtherWeek, S = n === _.TwiceAMonth || n === _.EveryMonth || n === _.EveryOtherMonth || n === _.EveryQuarter || n === _.EveryOtherQuarter, v = ct(U(), t), I = v < U() ? ue(v, 1) : v, L = (k) => {
194
+ k && o(st(k));
195
+ };
196
+ return /* @__PURE__ */ l(p, { gap: 24, sx: { m: 24 }, children: [
197
+ /* @__PURE__ */ e(
198
+ q,
199
+ {
200
+ label: r.frequency,
201
+ onChange: a,
202
+ options: d,
203
+ value: n
204
+ }
205
+ ),
206
+ b && /* @__PURE__ */ e(
207
+ q,
208
+ {
209
+ label: r.day_of_the_week,
210
+ onChange: o,
211
+ options: h,
212
+ value: t
213
+ }
214
+ ),
215
+ S && /* @__PURE__ */ e(
216
+ q,
217
+ {
218
+ label: n === _.TwiceAMonth ? r.first_day_of_the_month : r.day_of_the_month,
219
+ onChange: o,
220
+ options: n === _.TwiceAMonth ? C : f,
221
+ value: t
222
+ }
223
+ ),
224
+ n === _.TwiceAMonth && /* @__PURE__ */ e(
225
+ q,
226
+ {
227
+ label: r.second_day_of_the_month,
228
+ onChange: s,
229
+ options: m,
230
+ value: i || 0
231
+ }
232
+ ),
233
+ n === _.EveryYear && /* @__PURE__ */ e(ut, { dateAdapter: lt, children: /* @__PURE__ */ e(
234
+ dt,
235
+ {
236
+ disablePast: !0,
237
+ label: r.next_payment_date,
238
+ maxDate: ye(ue(U(), 1), 1),
239
+ minDate: U(),
240
+ onChange: L,
241
+ value: I
242
+ }
243
+ ) })
244
+ ] });
245
+ }, It = M(({ repeatingTransaction: n }) => {
246
+ const { recurring: t } = x(), { updateRepeatingTransaction: i } = Y(), { onEvent: a } = K(), [o, s] = u.useState(!1), [r, d] = u.useState(n.recurrence_type), [h, f] = u.useState(n.recurrence_day), [C, m] = u.useState(n.second_recurrence_day), b = async () => {
247
+ await i({
248
+ ...n,
249
+ recurrence_type: r,
250
+ recurrence_day: h,
251
+ second_recurrence_day: C
252
+ }), s(!1);
253
+ }, S = () => {
254
+ s(!0), a(D.RECURRING_TRANSACTIONS_DETAILS_CLICK_PAYMENT_SCHEDULE);
255
+ };
256
+ return /* @__PURE__ */ l(W, { children: [
257
+ /* @__PURE__ */ e(
258
+ te,
259
+ {
260
+ iconName: "sync",
261
+ label: t.activity_schedule,
262
+ onClick: S,
263
+ showChevron: !1,
264
+ value: `${he(t, n, !0)}`
265
+ }
266
+ ),
267
+ /* @__PURE__ */ e(
268
+ z,
269
+ {
270
+ ariaLabelClose: t.close_drawer_aria,
271
+ isOpen: o,
272
+ onClose: () => s(!1),
273
+ onPrimaryAction: b,
274
+ title: t.payment_schedule,
275
+ children: /* @__PURE__ */ e(
276
+ we,
277
+ {
278
+ firstDay: h,
279
+ frequency: r,
280
+ onFirstDayChange: f,
281
+ onFrequencyChange: d,
282
+ onSecondDayChange: m,
283
+ secondDay: C
284
+ }
285
+ )
286
+ }
287
+ )
288
+ ] });
289
+ }), Rt = (n, t) => {
290
+ const i = n.map((o) => ({
291
+ key: o.guid,
292
+ name: o.payee || o.description || o.feed_description,
293
+ amount: o.amount,
294
+ date: o.date,
295
+ merchantGuid: o.merchant_guid || "",
296
+ categoryGuid: o.top_level_category_guid || "",
297
+ category: o.category || "",
298
+ status: R.Paid,
299
+ transactionGuid: o.guid
300
+ })), a = t.map((o) => ({
301
+ key: `missed-${o.expectedDate.getTime()}`,
302
+ name: o.name,
303
+ amount: o.amount,
304
+ date: mt(o.expectedDate),
305
+ merchantGuid: o.merchantGuid,
306
+ categoryGuid: o.categoryGuid,
307
+ category: "",
308
+ status: R.Missed
309
+ }));
310
+ return [...i, ...a].sort((o, s) => s.date - o.date);
311
+ }, Dt = ({
312
+ isIncome: n = !1,
313
+ onMarkAsUnpaidClick: t,
314
+ onMarkAsPaidClick: i,
315
+ onTransactionClick: a,
316
+ recurringTransaction: o,
317
+ transactions: s
318
+ }) => {
319
+ const { recurring: r } = x(), { onEvent: d } = K(), { recurrences: h } = Y(), [f, C] = u.useState(null), [m, b] = u.useState(null), S = u.useMemo(
320
+ () => h.filter(
321
+ (c) => c.repeatingTransactionGuid === o.guid && c.status === R.Missed
322
+ ),
323
+ [h, o.guid]
324
+ ), v = u.useMemo(
325
+ () => Rt(s, S),
326
+ [s, S]
327
+ ), I = (c) => {
328
+ c.transactionGuid && a(c.transactionGuid);
329
+ }, L = (c, E) => {
330
+ c.stopPropagation(), C(c.currentTarget), b(E), d(D.RECURRING_TRANSACTIONS_LIST_CLICK_MORE_MENU);
331
+ }, k = () => {
332
+ C(null), b(null);
333
+ }, B = () => {
334
+ m && (m.status === R.Missed ? i() : m.transactionGuid && t(m.transactionGuid), k());
335
+ };
336
+ return /* @__PURE__ */ l(p, { direction: "column", sx: { minHeight: "30dvh" }, children: [
337
+ /* @__PURE__ */ e(y, { bold: !0, sx: { ml: 24, mt: 16, mb: 8 }, variant: "body1", children: r.past_activity }),
338
+ /* @__PURE__ */ e(ne, { sx: { flex: 1, overflow: "auto" }, children: v.map((c, E) => {
339
+ const T = c.status === R.Paid, N = c.status === R.Missed, g = E === v.length - 1;
340
+ return /* @__PURE__ */ l(u.Fragment, { children: [
341
+ /* @__PURE__ */ l(
342
+ yt,
343
+ {
344
+ onClick: T ? () => I(c) : void 0,
345
+ sx: { "& .MuiListItemButton-root": { pr: 10 } },
346
+ children: [
347
+ /* @__PURE__ */ e(_e, { children: /* @__PURE__ */ e(ae, { categoryGuid: c.categoryGuid, merchantGuid: c.merchantGuid }) }),
348
+ /* @__PURE__ */ e(
349
+ pe,
350
+ {
351
+ disableTypography: !0,
352
+ secondary: /* @__PURE__ */ l(p, { direction: "row", justifyContent: "space-between", children: [
353
+ /* @__PURE__ */ e(y, { variant: "caption", children: Se(be(c.date), xe.MONTH_DAY_YEAR) }),
354
+ /* @__PURE__ */ l(
355
+ p,
356
+ {
357
+ alignItems: "center",
358
+ direction: "row",
359
+ gap: 6,
360
+ sx: { textTransform: "uppercase" },
361
+ children: [
362
+ T && /* @__PURE__ */ e(Ke, { color: "success", filled: !0, size: 12 }),
363
+ N && /* @__PURE__ */ e(qe, { color: "error", filled: !0, size: 12 }),
364
+ /* @__PURE__ */ e(y, { bold: !0, color: "text.secondary", variant: "caption", children: T ? r.paid?.toLowerCase() : r.missed?.toLowerCase() })
365
+ ]
366
+ }
367
+ )
368
+ ] }),
369
+ children: /* @__PURE__ */ l(p, { direction: "row", justifyContent: "space-between", sx: { gap: 8 }, children: [
370
+ /* @__PURE__ */ e(y, { bold: !0, variant: "body1", children: c.name }),
371
+ /* @__PURE__ */ l(
372
+ y,
373
+ {
374
+ bold: !0,
375
+ color: n ? "success.main" : "text.primary",
376
+ sx: { flexShrink: 0 },
377
+ variant: "body1",
378
+ children: [
379
+ n ? "+" : "",
380
+ oe(c.amount, "0,0.00")
381
+ ]
382
+ }
383
+ )
384
+ ] })
385
+ }
386
+ ),
387
+ /* @__PURE__ */ e(
388
+ _t,
389
+ {
390
+ "aria-label": r.more_menu_aria,
391
+ onClick: (w) => L(w, c),
392
+ size: "small",
393
+ sx: { alignSelf: "center", ml: 4 },
394
+ children: /* @__PURE__ */ e(je, { name: "more_vert", size: 20, sx: { color: "text.secondary" } })
395
+ }
396
+ )
397
+ ]
398
+ }
399
+ ),
400
+ /* @__PURE__ */ e(F, { variant: g ? "fullWidth" : "inset" })
401
+ ] }, c.key);
402
+ }) }),
403
+ /* @__PURE__ */ e(
404
+ pt,
405
+ {
406
+ anchorEl: f,
407
+ anchorOrigin: { horizontal: "right", vertical: "bottom" },
408
+ disableScrollLock: !0,
409
+ onClose: k,
410
+ open: !!f,
411
+ transformOrigin: { horizontal: "right", vertical: "top" },
412
+ children: /* @__PURE__ */ e(ht, { onClick: B, sx: { p: 12 }, children: /* @__PURE__ */ e(y, { variant: "body1", children: m?.status === R.Missed ? r.mark_as_paid_cta : r.mark_as_unpaid_cta }) })
413
+ }
414
+ )
415
+ ] });
416
+ }, Mt = ({
417
+ expectedDate: n,
418
+ onMarkAsPaidClick: t,
419
+ status: i
420
+ }) => {
421
+ const a = Ct(), { recurring: o } = x(), s = i === R.Paid;
422
+ return /* @__PURE__ */ e(ft, { variant: "elevation", children: /* @__PURE__ */ e(gt, { onClick: t, children: /* @__PURE__ */ l(
423
+ p,
424
+ {
425
+ alignItems: "center",
426
+ direction: "row",
427
+ justifyContent: "space-between",
428
+ sx: { px: 16, py: 14 },
429
+ children: [
430
+ /* @__PURE__ */ l(p, { alignItems: "center", direction: "row", gap: 12, children: [
431
+ /* @__PURE__ */ e(
432
+ St,
433
+ {
434
+ bgColor: bt(a.palette.primary.main, 0.15),
435
+ name: s ? "check_circle" : "calendar_clock"
436
+ }
437
+ ),
438
+ /* @__PURE__ */ l(p, { direction: "column", children: [
439
+ /* @__PURE__ */ e(y, { fontSize: 11, variant: "body1", children: s ? o.paid : o.upcoming }),
440
+ /* @__PURE__ */ e(y, { bold: !0, variant: "body1", children: Se(n, xe.MONTH_DAY_YEAR) })
441
+ ] })
442
+ ] }),
443
+ /* @__PURE__ */ l(p, { alignItems: "center", direction: "row", gap: 4, children: [
444
+ /* @__PURE__ */ e(y, { bold: !0, variant: "body1", children: s ? o.mark_as_unpaid_cta : o.mark_as_paid_cta }),
445
+ /* @__PURE__ */ e(He, { size: 20 })
446
+ ] })
447
+ ]
448
+ }
449
+ ) }) });
450
+ }, Tt = M(
451
+ ({ onDeleted: n, recurringTransaction: t, selectedRecurrence: i }) => {
452
+ const { recurring: a } = x(), { selectedAccountGuids: o } = at(), { onEvent: s } = K(), { deleteRepeatingTransaction: r, markRecurrenceAsUnpaid: d, recurrences: h } = Y(), { detailedTransactions: f, setFilter: C, transactions: m } = re(), { setSelectedAccount: b, setSelectedMember: S } = Ve(), { members: v } = ot(), { amount: I, description: L, merchant_guid: k } = t, [B, c] = u.useState(!1), [E, T] = u.useState(!1), [N, g] = u.useState(!1), [w, X] = u.useState(!1), [Re, Z] = u.useState(""), [De, se] = u.useState(!1), [J, ce] = u.useState("");
453
+ u.useEffect(() => {
454
+ C({
455
+ accounts: o,
456
+ dateRange: { start: ye(U(), 90), end: We(U()) },
457
+ custom: (A) => A.repeating_transaction_guid === t.guid
458
+ });
459
+ }, [t.guid]);
460
+ const G = u.useMemo(
461
+ () => f.find((A) => A.guid === J),
462
+ [J, f]
463
+ ), P = t.repeating_transaction_type === O.Income, Me = u.useMemo(
464
+ () => m.filter((A) => A.repeating_transaction_guid === t.guid),
465
+ [m, t.guid]
466
+ ), Te = Ye(t, h), Le = () => {
467
+ if (t.account) {
468
+ b(t.account);
469
+ const A = v.find((V) => V.guid === t.account?.member_guid) || {};
470
+ A && S(A), c(!0);
471
+ }
472
+ }, Ee = async () => {
473
+ await r(t.guid), n();
474
+ }, Oe = () => {
475
+ T(!0), s(D.RECURRING_TRANSACTIONS_DETAILS_CLICK_DELETE);
476
+ }, le = () => {
477
+ g(!0), s(D.RECURRING_TRANSACTIONS_LIST_CLICK_MARK_AS_PAID);
478
+ }, Ne = () => {
479
+ g(!1), se(!0);
480
+ }, de = (A) => {
481
+ Z(A), X(!0), s(D.RECURRING_TRANSACTIONS_LIST_CLICK_MARK_AS_UNPAID);
482
+ }, Ge = async () => {
483
+ const A = m.find((V) => V.guid === Re);
484
+ A && await d(A), X(!1), Z("");
485
+ };
486
+ return /* @__PURE__ */ l(p, { bgcolor: "background.default", direction: "column", height: "100%", children: [
487
+ /* @__PURE__ */ l(p, { direction: "column", m: 24, children: [
488
+ /* @__PURE__ */ e(
489
+ ae,
490
+ {
491
+ categoryGuid: G?.category_guid || "",
492
+ merchantGuid: k,
493
+ size: 64,
494
+ sx: { mb: 12 }
495
+ }
496
+ ),
497
+ /* @__PURE__ */ e(y, { bold: !0, variant: "body1", children: L }),
498
+ /* @__PURE__ */ l(H, { color: P ? "success.main" : "text.primary", sx: { mt: 4, mb: 16 }, variant: "h1", children: [
499
+ P ? "+" : "",
500
+ oe(I, "0,0.00")
501
+ ] }),
502
+ /* @__PURE__ */ e(
503
+ Mt,
504
+ {
505
+ expectedDate: i?.occurredOnDate || i?.expectedDate || Te,
506
+ onMarkAsPaidClick: i?.status === R.Paid && i.transaction?.guid ? () => de(i.transaction.guid) : le,
507
+ status: i?.status
508
+ }
509
+ )
510
+ ] }),
511
+ /* @__PURE__ */ l(ne, { sx: { bgcolor: "background.paper" }, children: [
512
+ t.account && /* @__PURE__ */ l(W, { children: [
513
+ /* @__PURE__ */ e(
514
+ te,
515
+ {
516
+ iconName: "checkbook",
517
+ label: a.account,
518
+ onClick: Le,
519
+ showChevron: !1,
520
+ value: t.account.displayName || ""
521
+ }
522
+ ),
523
+ /* @__PURE__ */ e(F, { variant: "inset" })
524
+ ] }),
525
+ G?.category && /* @__PURE__ */ l(W, { children: [
526
+ /* @__PURE__ */ e(
527
+ te,
528
+ {
529
+ iconName: "monetization_on",
530
+ label: a.category,
531
+ value: G.category
532
+ }
533
+ ),
534
+ /* @__PURE__ */ e(F, { variant: "inset" })
535
+ ] }),
536
+ /* @__PURE__ */ e(It, { repeatingTransaction: t }),
537
+ /* @__PURE__ */ e(F, {})
538
+ ] }),
539
+ /* @__PURE__ */ e(
540
+ fe,
541
+ {
542
+ color: "error",
543
+ onClick: Oe,
544
+ startIcon: /* @__PURE__ */ e(Qe, {}),
545
+ sx: { mx: 24, my: 16 },
546
+ variant: "text",
547
+ children: P ? a.delete_income_title : a.delete_expense_title
548
+ }
549
+ ),
550
+ /* @__PURE__ */ e(
551
+ Dt,
552
+ {
553
+ isIncome: P,
554
+ onMarkAsPaidClick: le,
555
+ onMarkAsUnpaidClick: de,
556
+ onTransactionClick: ce,
557
+ recurringTransaction: t,
558
+ transactions: Me
559
+ }
560
+ ),
561
+ /* @__PURE__ */ e(
562
+ z,
563
+ {
564
+ ariaLabelClose: a.close_drawer_aria,
565
+ isOpen: !!J && !!G,
566
+ onClose: () => ce(""),
567
+ title: a.transaction_details_drawer_title,
568
+ children: G && /* @__PURE__ */ e(Ze, { transaction: G })
569
+ }
570
+ ),
571
+ /* @__PURE__ */ e(
572
+ ie,
573
+ {
574
+ copy: {
575
+ title: P ? a.delete_income_title : a.delete_expense_title,
576
+ close_aria: a.close_drawer_aria
577
+ },
578
+ isOpen: E,
579
+ onClose: () => T(!1),
580
+ onPrimaryAction: Ee,
581
+ children: /* @__PURE__ */ e(y, { children: P ? a.delete_income_description : a.delete_expense_description })
582
+ }
583
+ ),
584
+ /* @__PURE__ */ e(
585
+ vt,
586
+ {
587
+ isOpen: N,
588
+ onClose: () => g(!1),
589
+ onLinkTransaction: Ne
590
+ }
591
+ ),
592
+ /* @__PURE__ */ e(
593
+ wt,
594
+ {
595
+ isOpen: w,
596
+ onClose: () => {
597
+ X(!1), Z("");
598
+ },
599
+ onUnlinkTransaction: Ge
600
+ }
601
+ ),
602
+ /* @__PURE__ */ e(
603
+ At,
604
+ {
605
+ isOpen: De,
606
+ onClose: () => se(!1),
607
+ recurringTransaction: t
608
+ }
609
+ ),
610
+ /* @__PURE__ */ e(
611
+ Je,
612
+ {
613
+ isOpen: B,
614
+ onClose: () => c(!1)
615
+ }
616
+ )
617
+ ] });
618
+ }
619
+ ), Lt = M(
620
+ ({ onClick: n = () => {
621
+ }, repeatingTransaction: t }) => {
622
+ const { recurring: i } = x(), [a, o] = u.useState(!1), s = u.useMemo(
623
+ () => t.transactions.length === 0 ? "" : t.transactions[0].category_guid || "",
624
+ [t]
625
+ ), r = t.account?.displayName || "", d = t.repeating_transaction_type === O.Income, h = he(i, t, !0);
626
+ return /* @__PURE__ */ l(Ue, { disableGutters: !0, disablePadding: !0, children: [
627
+ /* @__PURE__ */ l(Fe, { onClick: () => {
628
+ n(t), o(!0);
629
+ }, children: [
630
+ /* @__PURE__ */ e(_e, { children: /* @__PURE__ */ e(
631
+ ae,
632
+ {
633
+ categoryGuid: s,
634
+ merchantGuid: t.merchant_guid
635
+ }
636
+ ) }),
637
+ /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ l(p, { direction: "row", gap: 4, sx: { justifyContent: "space-between" }, children: [
638
+ /* @__PURE__ */ l(p, { direction: "column", sx: { width: "50%" }, children: [
639
+ /* @__PURE__ */ e(y, { bold: !0, variant: "body1", children: t.description }),
640
+ /* @__PURE__ */ l(p, { alignItems: "center", direction: "row", gap: 6, children: [
641
+ t.account?.institution_guid && /* @__PURE__ */ e(
642
+ Pe,
643
+ {
644
+ alt: r,
645
+ institutionGuid: t.account?.institution_guid,
646
+ size: 12
647
+ }
648
+ ),
649
+ /* @__PURE__ */ e(y, { variant: "caption", children: r })
650
+ ] })
651
+ ] }),
652
+ /* @__PURE__ */ l(p, { alignItems: "flex-end", sx: { width: "50%" }, children: [
653
+ /* @__PURE__ */ l(
654
+ y,
655
+ {
656
+ bold: !0,
657
+ color: d ? "success.main" : "text.primary",
658
+ variant: "body1",
659
+ children: [
660
+ d ? "+" : "",
661
+ oe(t.amount, "0,0.00")
662
+ ]
663
+ }
664
+ ),
665
+ /* @__PURE__ */ e(
666
+ p,
667
+ {
668
+ direction: "row",
669
+ sx: {
670
+ alignItems: "center",
671
+ gap: 6,
672
+ justifyContent: "flex-end",
673
+ textTransform: "uppercase",
674
+ width: "100%"
675
+ },
676
+ children: /* @__PURE__ */ e(y, { bold: !0, color: "text.secondary", variant: "caption", children: h })
677
+ }
678
+ )
679
+ ] })
680
+ ] }) })
681
+ ] }),
682
+ /* @__PURE__ */ e(
683
+ z,
684
+ {
685
+ ariaLabelClose: i.close_drawer_aria,
686
+ isOpen: a,
687
+ onClose: () => o(!1),
688
+ title: t.repeating_transaction_type === O.Income ? i.income_details : i.expense_details,
689
+ children: /* @__PURE__ */ e(
690
+ Tt,
691
+ {
692
+ onDeleted: () => o(!1),
693
+ recurringTransaction: t,
694
+ selectedRecurrence: null
695
+ }
696
+ )
697
+ }
698
+ )
699
+ ] });
700
+ }
701
+ ), Et = M(
702
+ ({
703
+ bgcolor: n = "background.default",
704
+ firstDay: t,
705
+ secondDay: i,
706
+ frequency: a,
707
+ onFrequencyChange: o,
708
+ onFirstDayChange: s,
709
+ onSecondDayChange: r,
710
+ transaction: d
711
+ }) => {
712
+ const { recurring: h } = x();
713
+ return /* @__PURE__ */ l(p, { bgcolor: n, gap: 24, height: "100%", children: [
714
+ /* @__PURE__ */ l(p, { children: [
715
+ /* @__PURE__ */ e(tt, { bgcolor: n, children: kt(d.date) }),
716
+ /* @__PURE__ */ e(nt, { transaction: d })
717
+ ] }),
718
+ /* @__PURE__ */ l(j, { children: [
719
+ /* @__PURE__ */ e(y, { bold: !0, sx: { mx: 24 }, variant: "body1", children: h.payment_schedule }),
720
+ /* @__PURE__ */ e(
721
+ we,
722
+ {
723
+ firstDay: t,
724
+ frequency: a,
725
+ onFirstDayChange: s,
726
+ onFrequencyChange: o,
727
+ onSecondDayChange: r,
728
+ secondDay: i
729
+ }
730
+ )
731
+ ] })
732
+ ] });
733
+ }
734
+ ), Ie = M(
735
+ ({
736
+ isIncome: n = !1,
737
+ label: t,
738
+ onAddRecurringTransaction: i = () => null
739
+ }) => {
740
+ const { recurring: a } = x(), { filter: o, setFilter: s, transactions: r } = re(), { addRepeatingTransaction: d } = Y(), { user: h } = rt(), [f, C] = u.useState(!1), [m, b] = u.useState(""), [S, v] = u.useState(_.EveryMonth), [I, L] = u.useState(1), [k, B] = u.useState(15), c = u.useMemo(
741
+ () => r.find((g) => g.guid === m),
742
+ [m, r]
743
+ ), E = () => {
744
+ C(!0), s(n ? { ...o, custom: $ } : { ...o, custom: Q });
745
+ }, T = async () => {
746
+ if (!c) {
747
+ N();
748
+ return;
749
+ }
750
+ i();
751
+ const g = Be(S, be(c.date), I), w = {
752
+ account_guid: c.account_guid,
753
+ amount: c.amount,
754
+ created_by: 0,
755
+ // User
756
+ merchant_guid: c.merchant_guid,
757
+ description: c.payee || c.description || c.feed_description,
758
+ predicted_occurs_on: xt(g, { representation: "date" }),
759
+ recurrence_day: I,
760
+ recurrence_type: S,
761
+ repeating_transaction_type: n ? O.Income : O.Bill,
762
+ second_recurrence_day: k,
763
+ transaction_type: c.transaction_type,
764
+ user_guid: h.guid
765
+ };
766
+ await d(w, c), N();
767
+ }, N = () => {
768
+ b(""), C(!1);
769
+ };
770
+ return /* @__PURE__ */ l(W, { children: [
771
+ /* @__PURE__ */ e(fe, { onClick: E, startIcon: /* @__PURE__ */ e($e, { size: 24 }), variant: "contained", children: t }),
772
+ /* @__PURE__ */ e(
773
+ z,
774
+ {
775
+ ariaLabelClose: a.close_drawer_aria,
776
+ isOpen: f,
777
+ onClose: () => C(!1),
778
+ title: t,
779
+ children: /* @__PURE__ */ e(
780
+ ve,
781
+ {
782
+ description: n ? a.add_income_description : a.add_expense_description,
783
+ onSearch: (g) => {
784
+ s({
785
+ ...o,
786
+ custom: (w) => n ? g ? Ae(w, g) : $(w) : g ? ke(w, g) : Q(w)
787
+ });
788
+ },
789
+ onSelected: (g) => b(g)
790
+ }
791
+ )
792
+ }
793
+ ),
794
+ /* @__PURE__ */ e(
795
+ z,
796
+ {
797
+ ariaLabelClose: a.close_drawer_aria,
798
+ isOpen: !!m,
799
+ onClose: () => b(""),
800
+ onPrimaryAction: T,
801
+ title: n ? a.income_details : a.expense_details,
802
+ children: c && /* @__PURE__ */ e(
803
+ Et,
804
+ {
805
+ firstDay: I,
806
+ frequency: S,
807
+ onFirstDayChange: L,
808
+ onFrequencyChange: v,
809
+ onSecondDayChange: B,
810
+ secondDay: k,
811
+ transaction: c
812
+ }
813
+ )
814
+ }
815
+ )
816
+ ] });
817
+ }
818
+ ), Ot = M(
819
+ ({ zeroStateFor: n }) => {
820
+ const { recurring: t } = x(), { onEvent: i } = K(), a = n === "income", o = a ? t.recurring_setting_zero_state_income_title : t.recurring_setting_zero_state_expenses_title, s = a ? t.recurring_setting_zero_state_income_description : t.recurring_setting_zero_state_expenses_description, r = a ? t.add_income : t.add_expense;
821
+ return /* @__PURE__ */ l(p, { sx: { alignItems: "center", p: 24, pt: 48 }, children: [
822
+ /* @__PURE__ */ e(Xe, { size: 48 }),
823
+ /* @__PURE__ */ e(H, { sx: { my: 8, fontWeight: 600 }, variant: "body1", children: o }),
824
+ /* @__PURE__ */ e(H, { color: "text.secondary", sx: { mb: 32 }, variant: "subtitle2", children: s }),
825
+ /* @__PURE__ */ e(
826
+ Ie,
827
+ {
828
+ isIncome: a,
829
+ label: r,
830
+ onAddRecurringTransaction: () => {
831
+ i(
832
+ a ? D.RECURRING_TRANSACTIONS_CLICK_ADD_INCOME : D.RECURRING_ACTIVITY_CLICK_ADD_EXPENSE
833
+ );
834
+ }
835
+ }
836
+ )
837
+ ] });
838
+ }
839
+ ), Ln = M(({ forOverview: n = !1 }) => {
840
+ const { recurring: t } = x(), { detailedRepeatingTransactions: i } = Y(), { onEvent: a } = K(), o = (d) => {
841
+ a(D.RECURRING_TRANSACTIONS_CLICK_INCOME, {
842
+ repeating_transaction_guid: d.guid
843
+ });
844
+ }, s = () => {
845
+ a(D.RECURRING_TRANSACTIONS_CLICK_ADD_INCOME);
846
+ }, r = i.filter(
847
+ (d) => d.repeating_transaction_type === O.Income && (d.transactions.length > 0 || d.recurrence_type === _.EveryYear)
848
+ );
849
+ return /* @__PURE__ */ e(W, { children: r.length !== 0 ? /* @__PURE__ */ l(
850
+ p,
851
+ {
852
+ sx: {
853
+ height: n ? "calc(100vh - 62px)" : "calc(100vh - 109px)",
854
+ maxHeight: n ? "calc(100vh - 62px)" : "calc(100vh - 109px)"
855
+ },
856
+ children: [
857
+ n && /* @__PURE__ */ e(y, { bold: !0, sx: { mb: 4, mt: 12, mx: 24 }, variant: "body2", children: t.income }),
858
+ /* @__PURE__ */ e(j, { sx: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ e(ne, { sx: { bgcolor: "background.paper" }, children: r.map((d, h) => /* @__PURE__ */ l(u.Fragment, { children: [
859
+ /* @__PURE__ */ e(Lt, { onClick: o, repeatingTransaction: d }),
860
+ /* @__PURE__ */ e(
861
+ F,
862
+ {
863
+ variant: h < r.length - 1 ? "inset" : "fullWidth"
864
+ }
865
+ )
866
+ ] }, d.guid)) }) }),
867
+ /* @__PURE__ */ l(j, { children: [
868
+ /* @__PURE__ */ e(F, {}),
869
+ /* @__PURE__ */ e(
870
+ j,
871
+ {
872
+ sx: {
873
+ alignContent: "center",
874
+ bgcolor: "background.paper",
875
+ justifyContent: "flex-end",
876
+ px: 24,
877
+ py: 12,
878
+ textAlign: "right"
879
+ },
880
+ children: /* @__PURE__ */ e(
881
+ Ie,
882
+ {
883
+ isIncome: !0,
884
+ label: t.add_income,
885
+ onAddRecurringTransaction: s
886
+ }
887
+ )
888
+ }
889
+ )
890
+ ] })
891
+ ]
892
+ }
893
+ ) : /* @__PURE__ */ e(Ot, { zeroStateFor: "income" }) });
894
+ });
895
+ export {
896
+ Ie as A,
897
+ Ln as M,
898
+ Lt as R,
899
+ ve as S,
900
+ Ot as a,
901
+ $ as b,
902
+ Et as c,
903
+ Tt as d,
904
+ Ae as i
905
+ };