@mx-cartographer/experiences 6.26.33-alpha.mm0 → 7.0.0-alpha.mega1

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 (104) hide show
  1. package/CHANGELOG.md +2 -3
  2. package/dist/Account-DY6nxO7y.mjs +30 -0
  3. package/dist/AccountDetailsContent-DvPs81kL.mjs +677 -0
  4. package/dist/AccountDetailsHeader-W2U7ZVm_.mjs +119 -0
  5. package/dist/AccountFields-DAVcbZy5.mjs +135 -0
  6. package/dist/AccountListItem-DFlbdcmT.mjs +90 -0
  7. package/dist/AccountStore-CU7qV3vg.mjs +230 -0
  8. package/dist/Accounts-BLlrQA5m.mjs +9 -0
  9. package/dist/BeatApi-DLu87ijw.mjs +21 -0
  10. package/dist/BeatStore-By4aGoRM.mjs +81 -0
  11. package/dist/BudgetUtil-Ci1TN0J5.mjs +101 -0
  12. package/dist/CashflowStore-D9Dpuz7X.mjs +91 -0
  13. package/dist/Category-5S6uwuXz.mjs +301 -0
  14. package/dist/CategorySelectorDrawer-rHyHHYuh.mjs +397 -0
  15. package/dist/CategoryStore-B5EW6I1d.mjs +183 -0
  16. package/dist/CategoryUtil-DRyruNgi.mjs +78 -0
  17. package/dist/ConnectDrawer-D9cR5phc.mjs +508 -0
  18. package/dist/ConnectionsDrawer-BzGqljSp.mjs +52 -0
  19. package/dist/CurrencyInput-D74cemI2.mjs +83 -0
  20. package/dist/CurrencyText-YUhH2caW.mjs +20 -0
  21. package/dist/DateUtil-BcuH7ErC.mjs +48 -0
  22. package/dist/DebtsStore-S0l9kr0r.mjs +60 -0
  23. package/dist/Dialog-CWW597AF.mjs +123 -0
  24. package/dist/Donut-1UMNcG67.mjs +57 -0
  25. package/dist/Drawer-kEE73B87.mjs +113 -0
  26. package/dist/EmptyState-Dcb-o2tl.mjs +55 -0
  27. package/dist/Fetch-CkFKy79O.mjs +116 -0
  28. package/dist/FinstrongStore-mkALvztw.mjs +101 -0
  29. package/dist/GoalStore-DioeeL-s.mjs +263 -0
  30. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  31. package/dist/Help-DhcC-C05.mjs +320 -0
  32. package/dist/Help-DpYRO8oA.mjs +3181 -0
  33. package/dist/IconBacking-B9oC6uL2.mjs +39 -0
  34. package/dist/InvestmentUtil-jOyOgzIB.mjs +134 -0
  35. package/dist/LineChart-CcyX38kK.mjs +499 -0
  36. package/dist/ListItemAction-BabpYivr.mjs +69 -0
  37. package/dist/Loader-Dp1P2gNw.mjs +14 -0
  38. package/dist/Localization-2MODESHW.mjs +30 -0
  39. package/dist/ManageIncome-ndMuhJMG.mjs +535 -0
  40. package/dist/MerchantStore-DVH-QOf0.mjs +37 -0
  41. package/dist/MicroWidgetContainer-CsvHLYKX.mjs +45 -0
  42. package/dist/MiniWidgetContainer-BoOp-A05.mjs +39 -0
  43. package/dist/NetWorthStore-PD-RUe09.mjs +150 -0
  44. package/dist/Notification-AMGWM1Al.mjs +78 -0
  45. package/dist/NotificationSettings-VhHuMAFU.mjs +667 -0
  46. package/dist/NotificationStore-DHtSGySy.mjs +67 -0
  47. package/dist/NumberFormatting-CtWHhyBX.mjs +40 -0
  48. package/dist/OriginalBalanceAction-D39mx6uE.mjs +115 -0
  49. package/dist/RecurringSettings-D_HnMYZP.mjs +57 -0
  50. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +263 -0
  51. package/dist/RepeatingTransaction-BPWfaB3f.mjs +282 -0
  52. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  53. package/dist/SettingsStore-CE7jDVFL.mjs +265 -0
  54. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +69 -0
  55. package/dist/SpendingData-BkrxzHdr.mjs +55 -0
  56. package/dist/StatusBar-BK_uYHAB.mjs +30 -0
  57. package/dist/TabContentContainer-j01JYR_7.mjs +21 -0
  58. package/dist/Transaction-CA0FW2Ij.mjs +312 -0
  59. package/dist/TransactionApi-DbbcjI2L.mjs +86 -0
  60. package/dist/TransactionDetails-WBHFmbxL.mjs +1283 -0
  61. package/dist/TransactionStore-CeLdmVnC.mjs +669 -0
  62. package/dist/TrendsStore-BHJUapXF.mjs +487 -0
  63. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +1959 -0
  64. package/dist/WidgetContainer-DWCusxYI.mjs +556 -0
  65. package/dist/accounts/index.es.js +752 -0
  66. package/dist/analytics/index.es.js +171 -0
  67. package/dist/budgets/index.es.js +1075 -0
  68. package/dist/cashflow/index.es.js +1098 -0
  69. package/dist/categories/index.es.js +9 -0
  70. package/dist/common/components/WidgetContainer.d.ts +1 -1
  71. package/dist/common/components/charts/LineChart.d.ts +0 -1
  72. package/dist/common/constants/Analytics.d.ts +10 -20
  73. package/dist/common/context/hooks.d.ts +13 -13
  74. package/dist/common/index.es.js +1451 -0
  75. package/dist/dashboard/index.es.js +181 -0
  76. package/dist/debts/index.es.js +1460 -0
  77. package/dist/exportTransactionsToCSV-CmwsKl2D.mjs +47 -0
  78. package/dist/finstrong/index.es.js +1455 -0
  79. package/dist/goals/index.es.js +1209 -0
  80. package/dist/help/components/content/section/index.d.ts +15 -15
  81. package/dist/help/index.es.js +14 -0
  82. package/dist/hooks-30y_BLwc.mjs +71 -0
  83. package/dist/index.d.ts +0 -22
  84. package/dist/insights/index.d.ts +1 -0
  85. package/dist/insights/index.es.js +4 -0
  86. package/dist/investments/index.es.js +1638 -0
  87. package/dist/merchants/index.es.js +79 -0
  88. package/dist/microinsights/components/carouselheader/CarouselHeader.d.ts +0 -1
  89. package/dist/microinsights/components/microBeatCarousel/MicroBeatCarousel.d.ts +0 -1
  90. package/dist/microinsights/index.es.js +16 -0
  91. package/dist/networth/index.es.js +576 -0
  92. package/dist/notifications/index.es.js +192 -0
  93. package/dist/recurringtransactions/index.es.js +879 -0
  94. package/dist/settings/index.es.js +879 -0
  95. package/dist/spending/index.es.js +570 -0
  96. package/dist/transactions/index.es.js +587 -0
  97. package/dist/trends/index.es.js +1086 -0
  98. package/dist/useCombineEvents-DaDBSR_1.mjs +92 -0
  99. package/dist/useDimensions-27p2evRx.mjs +36 -0
  100. package/dist/useScreenSize-B6JyS_Lj.mjs +36 -0
  101. package/package.json +155 -3
  102. package/dist/index.es.js +0 -30564
  103. package/dist/index.es.js.map +0 -1
  104. package/dist/trends/constants/TrendsWidget.d.ts +0 -3
@@ -0,0 +1,1098 @@
1
+ import { jsxs as o, Fragment as B, jsx as e } from "react/jsx-runtime";
2
+ import f, { useState as K } from "react";
3
+ import { observer as T } from "mobx-react-lite";
4
+ import D from "@mui/material/Box";
5
+ import k from "@mui/material/Button";
6
+ import v from "@mui/material/Divider";
7
+ import r from "@mui/material/Stack";
8
+ import ie from "@mui/material/styles/useTheme";
9
+ import { Text as p, P as O, Icon as H, InstitutionLogo as xe, H1 as ce, H2 as qe } from "@mxenabled/mxui";
10
+ import { G as Xe, t as le, u as L, p as ae, c as Oe, a as X, o as de, f as U, g as Ne, n as ke } from "../hooks-30y_BLwc.mjs";
11
+ import { C as R } from "../CurrencyText-YUhH2caW.mjs";
12
+ import { u as me } from "../useScreenSize-B6JyS_Lj.mjs";
13
+ import { L as re } from "../Loader-Dp1P2gNw.mjs";
14
+ import { I as ue } from "../CashflowStore-D9Dpuz7X.mjs";
15
+ import { C as Hn } from "../CashflowStore-D9Dpuz7X.mjs";
16
+ import { b as q } from "../Localization-2MODESHW.mjs";
17
+ import { M as Ye } from "../MiniWidgetContainer-BoOp-A05.mjs";
18
+ import { R as Qe } from "../RecurringSettings-D_HnMYZP.mjs";
19
+ import Ve from "@mui/material/Tabs";
20
+ import Ce from "@mui/material/Tab";
21
+ import { getUnixTime as j } from "date-fns/getUnixTime";
22
+ import Z from "@mui/material/List";
23
+ import ee from "@mui/material/ListItem";
24
+ import { A as Ke } from "../AccountListItem-DFlbdcmT.mjs";
25
+ import { f as Y, D as Q } from "../Dialog-CWW597AF.mjs";
26
+ import Je from "@mui/material/ListSubheader";
27
+ import { f as J } from "../NumberFormatting-CtWHhyBX.mjs";
28
+ import { isAfter as He } from "date-fns/isAfter";
29
+ import { isBefore as Fe } from "date-fns/isBefore";
30
+ import { isToday as We } from "date-fns/isToday";
31
+ import { startOfToday as z } from "date-fns/startOfToday";
32
+ import { addDays as we } from "date-fns/addDays";
33
+ import { alpha as Ze, keyframes as et } from "@mui/material/styles";
34
+ import { DataGridPro as tt } from "@mui/x-data-grid-pro";
35
+ import { T as _e } from "../TabContentContainer-j01JYR_7.mjs";
36
+ import { M as nt, S as ot, i as it, c as Se, b as at } from "../ManageIncome-ndMuhJMG.mjs";
37
+ import { D as $e } from "../Drawer-kEE73B87.mjs";
38
+ import { formatISO as rt } from "date-fns/formatISO";
39
+ import { fromUnixTime as ye } from "date-fns/fromUnixTime";
40
+ import { startOfMonth as st } from "date-fns/startOfMonth";
41
+ import { subDays as Ge } from "date-fns/subDays";
42
+ import { S as ct, b as lt } from "../TransactionDetails-WBHFmbxL.mjs";
43
+ import { F as dt, R as Ie, e as De } from "../RepeatingTransaction-BPWfaB3f.mjs";
44
+ import { h as mt } from "../DateUtil-BcuH7ErC.mjs";
45
+ import { endOfToday as ut } from "date-fns/endOfToday";
46
+ import { W as ve, A as Ae } from "../WidgetContainer-DWCusxYI.mjs";
47
+ import { F as ht, A as M } from "../Fetch-CkFKy79O.mjs";
48
+ const V = () => {
49
+ if (!f.useContext(Xe))
50
+ throw new Error("useCashflowUiStore() must be used within the GlobalDataContext");
51
+ return le().uiStore;
52
+ }, pt = ({ remaining: i }) => {
53
+ const { cashflow: n } = L();
54
+ return /* @__PURE__ */ o(B, { children: [
55
+ /* @__PURE__ */ e(
56
+ D,
57
+ {
58
+ sx: {
59
+ borderRadius: "1px",
60
+ backgroundColor: i < 0 ? "error.main" : i > 0 ? "success.main" : "warning.main",
61
+ height: 6,
62
+ width: 6
63
+ }
64
+ }
65
+ ),
66
+ /* @__PURE__ */ e(p, { bold: !0, sx: { flexGrow: 1, fontSize: 12 }, children: n.remaining_cash }),
67
+ /* @__PURE__ */ e(R, { amount: i, bold: !0, sx: { fontSize: 12 } })
68
+ ] });
69
+ }, he = T(pt), ft = ({ onAddIncomeClick: i }) => {
70
+ const n = ie(), { availableWidth: t } = ae(), { isMobile: s } = me(), { visibleCashAccounts: d, visibleCashBalance: g } = Oe(), { selectedAccountGuids: m } = X(), { cashflow: c } = L(), { userProfile: C } = de(), {
71
+ daysUntilNextIncome: a,
72
+ expensesTilNextIncome: u,
73
+ selectedCashAccounts: l,
74
+ setNextIncome: b,
75
+ setSelectedCashAccounts: _,
76
+ setUpcomingExpenses: S
77
+ } = V(), { isDataLoaded: y, nextIncomeRecurrence: h, upcomingExpenses: I } = U();
78
+ f.useEffect(() => {
79
+ _(
80
+ d.filter((w) => m.includes(w.guid))
81
+ );
82
+ }, [d, m]), f.useEffect(() => {
83
+ h && b(h), S(I);
84
+ }, [h, I]);
85
+ const A = f.useMemo(
86
+ () => d.filter((w) => m.includes(w.guid)).reduce((w, G) => w + (G?.balance || 0), 0),
87
+ [m, I]
88
+ ), F = f.useMemo(
89
+ () => u.filter((w) => m.includes(w.accountGuid || "")).reduce((w, G) => w + G.amount, 0),
90
+ [m, u]
91
+ ), P = f.useMemo(
92
+ () => A - F,
93
+ [A, F]
94
+ ), $ = C?.has_completed_cash_flow_onboarding && !!i;
95
+ return y ? /* @__PURE__ */ e(D, { className: "mx-cashflow", pl: 16, pr: 16, pt: 16, children: t > 610 ? /* @__PURE__ */ o(
96
+ r,
97
+ {
98
+ border: `1px solid ${n.palette.border.light}`,
99
+ borderRadius: 1,
100
+ direction: "row",
101
+ justifyContent: "space-between",
102
+ px: 24,
103
+ children: [
104
+ /* @__PURE__ */ o(r, { pb: 14, pt: 12, children: [
105
+ /* @__PURE__ */ e(R, { amount: A, variant: "H2" }),
106
+ /* @__PURE__ */ e(O, { variant: "XSmall", whiteSpace: "nowrap", children: q(
107
+ c.total_cash_accounts,
108
+ l.length
109
+ ) })
110
+ ] }),
111
+ /* @__PURE__ */ e(r, { pt: 18, children: /* @__PURE__ */ e(H, { name: "remove" }) }),
112
+ /* @__PURE__ */ o(r, { pb: 14, pt: 12, children: [
113
+ /* @__PURE__ */ e(R, { amount: F, variant: "H2" }),
114
+ /* @__PURE__ */ e(O, { variant: "XSmall", whiteSpace: "nowrap", children: q(c.expenses_due, u.length) })
115
+ ] }),
116
+ /* @__PURE__ */ e(r, { pt: 18, children: /* @__PURE__ */ e(H, { name: "equal" }) }),
117
+ /* @__PURE__ */ o(r, { pb: 14, pr: 24, pt: 12, children: [
118
+ /* @__PURE__ */ e(R, { amount: P, variant: "H2" }),
119
+ /* @__PURE__ */ o(r, { alignItems: "center", direction: "row", gap: 8, children: [
120
+ /* @__PURE__ */ e(O, { variant: "XSmall", whiteSpace: "nowrap", children: c.available_to_spend }),
121
+ /* @__PURE__ */ e(ue, { body: c.tooltip_body, title: c.tooltip_title })
122
+ ] })
123
+ ] }),
124
+ /* @__PURE__ */ e(r, { borderLeft: `1px solid ${n.palette.border.light}`, pb: 12, pl: 24, pt: 12, children: $ ? /* @__PURE__ */ o(B, { children: [
125
+ /* @__PURE__ */ e(p, { variant: "H2", children: q(c.days, a) }),
126
+ /* @__PURE__ */ e(O, { variant: "XSmall", whiteSpace: "nowrap", children: c.next_paycheck })
127
+ ] }) : /* @__PURE__ */ e(
128
+ k,
129
+ {
130
+ onClick: i,
131
+ startIcon: /* @__PURE__ */ e(H, { name: "add" }),
132
+ sx: { fontSize: 13, lineHeight: "initial" },
133
+ children: c.add_income
134
+ }
135
+ ) })
136
+ ]
137
+ }
138
+ ) : /* @__PURE__ */ o(r, { border: `1px solid ${n.palette.border.light}`, borderRadius: 1, children: [
139
+ /* @__PURE__ */ o(r, { direction: "row", justifyContent: "space-between", p: 16, children: [
140
+ /* @__PURE__ */ e(p, { variant: "Small", children: q(
141
+ c.total_cash_accounts,
142
+ l.length
143
+ ) }),
144
+ /* @__PURE__ */ e(R, { amount: g, bold: !0, variant: "XSmall" })
145
+ ] }),
146
+ /* @__PURE__ */ e(v, {}),
147
+ /* @__PURE__ */ o(r, { direction: "row", justifyContent: "space-between", p: 16, children: [
148
+ /* @__PURE__ */ e(p, { variant: "Small", children: q(c.expenses_due, u.length) }),
149
+ /* @__PURE__ */ e(R, { amount: F, bold: !0, symbol: "-", variant: "XSmall" })
150
+ ] }),
151
+ /* @__PURE__ */ e(v, {}),
152
+ /* @__PURE__ */ e(
153
+ r,
154
+ {
155
+ alignItems: "center",
156
+ bgcolor: "background.default",
157
+ direction: "row",
158
+ gap: 8,
159
+ height: 48,
160
+ justifyContent: "space-between",
161
+ px: 16,
162
+ sx: { borderBottomLeftRadius: 4, borderBottomRightRadius: 4 },
163
+ children: /* @__PURE__ */ e(he, { remaining: P })
164
+ }
165
+ ),
166
+ /* @__PURE__ */ e(v, {}),
167
+ $ ? /* @__PURE__ */ o(r, { direction: "row", justifyContent: "space-between", p: 16, children: [
168
+ /* @__PURE__ */ e(p, { variant: "Small", children: c.next_paycheck }),
169
+ /* @__PURE__ */ e(p, { bold: !0, variant: "XSmall", children: q(c.days, a) })
170
+ ] }) : /* @__PURE__ */ o(
171
+ r,
172
+ {
173
+ alignItems: "center",
174
+ direction: "row",
175
+ justifyContent: "space-between",
176
+ pl: 16,
177
+ pr: 2,
178
+ py: 2,
179
+ children: [
180
+ /* @__PURE__ */ e(p, { variant: "Small", children: c.next_paycheck }),
181
+ /* @__PURE__ */ e(
182
+ k,
183
+ {
184
+ onClick: i,
185
+ startIcon: /* @__PURE__ */ e(H, { name: "add" }),
186
+ sx: { fontSize: 13 },
187
+ children: c.add_income
188
+ }
189
+ )
190
+ ]
191
+ }
192
+ )
193
+ ] }) }) : /* @__PURE__ */ e(re, { height: s ? 210 : 120 });
194
+ }, gt = T(ft), bt = ({ onPrimaryCtaClick: i, sx: n = {} }) => {
195
+ const { cashflow: t } = L(), { isCopyLoaded: s, isInitialized: d } = X(), { loadRepeatingTransactions: g } = U();
196
+ return f.useEffect(() => {
197
+ d && g().finally();
198
+ }, [d]), s ? /* @__PURE__ */ e(
199
+ Ye,
200
+ {
201
+ className: "mx-exp-cashflow-miniwidget",
202
+ onPrimaryCtaClick: i,
203
+ primaryCtaLabel: t.primary_cta,
204
+ subTitle: t.sub_title,
205
+ sx: n,
206
+ title: t.title,
207
+ children: /* @__PURE__ */ e(gt, { onAddIncomeClick: i })
208
+ }
209
+ ) : /* @__PURE__ */ e(re, {});
210
+ }, Rn = T(bt), xt = ({ remaining: i }) => /* @__PURE__ */ e(
211
+ ee,
212
+ {
213
+ sx: {
214
+ alignItems: "center",
215
+ backgroundColor: "background.highlight",
216
+ display: "flex",
217
+ gap: 12,
218
+ padding: "12px 24px",
219
+ borderBottomLeftRadius: "3px",
220
+ borderBottomRightRadius: "3px",
221
+ minHeight: "auto"
222
+ },
223
+ children: /* @__PURE__ */ e(he, { remaining: i })
224
+ }
225
+ );
226
+ var te = /* @__PURE__ */ ((i) => (i.EXPENSE = "expense", i.INCOME = "income", i))(te || {});
227
+ const Ct = ({ recurrence: i }) => /* @__PURE__ */ o(B, { children: [
228
+ /* @__PURE__ */ o(ee, { sx: { display: "flex", alignItems: "center", gap: 16, px: 24, py: 12 }, children: [
229
+ /* @__PURE__ */ o(r, { alignItems: "center", height: 32, width: 32, children: [
230
+ /* @__PURE__ */ e(p, { bold: !0, sx: { fontSize: 11 }, children: Y(i.expectedDate, Q.MONTH) }),
231
+ /* @__PURE__ */ e(p, { bold: !0, sx: { fontSize: 11 }, children: Y(i.expectedDate, Q.DAY) })
232
+ ] }),
233
+ /* @__PURE__ */ e(p, { sx: { flexGrow: 1, fontSize: 13 }, children: i.name }),
234
+ /* @__PURE__ */ e(
235
+ R,
236
+ {
237
+ amount: i.amount,
238
+ bold: !0,
239
+ sx: { textAlign: "right", fontSize: 13 }
240
+ }
241
+ )
242
+ ] }),
243
+ /* @__PURE__ */ e(v, {})
244
+ ] }), Ee = T(Ct), wt = ({ total: i, type: n }) => {
245
+ const { cashflow: t } = L();
246
+ return /* @__PURE__ */ o(B, { children: [
247
+ /* @__PURE__ */ o(
248
+ Je,
249
+ {
250
+ sx: {
251
+ alignItems: "center",
252
+ backgroundColor: "background.highlight",
253
+ display: "flex",
254
+ justifyContent: "space-between",
255
+ pb: 4,
256
+ pt: 12,
257
+ px: 24
258
+ },
259
+ children: [
260
+ /* @__PURE__ */ e(p, { bold: !0, sx: { fontSize: 12 }, children: n === te.EXPENSE ? t.expenses : t.income }),
261
+ /* @__PURE__ */ o(p, { bold: !0, sx: { fontSize: 13 }, children: [
262
+ n === te.EXPENSE ? "-" : "+",
263
+ J(i, "0,0.00")
264
+ ] })
265
+ ]
266
+ }
267
+ ),
268
+ /* @__PURE__ */ e(v, {})
269
+ ] });
270
+ }, Te = T(wt), oe = (i, n) => (t) => t.accountGuid === i.guid && (We(t.expectedDate) || He(t.expectedDate, n.start)) && Fe(t.expectedDate, n.end), _t = () => {
271
+ const { availableWidth: i } = ae(), { cashflow: n } = L(), { upcomingExpenses: t, upcomingIncome: s } = U(), { dateRange: d, selectedCashAccounts: g } = V();
272
+ return /* @__PURE__ */ o(r, { children: [
273
+ /* @__PURE__ */ o(r, { direction: i < 400 ? "column" : "row", justifyContent: "space-between", children: [
274
+ /* @__PURE__ */ e(p, { bold: !0, sx: { fontSize: 15, mb: 12, whiteSpace: "normal" }, children: n.accounts_breakdown }),
275
+ /* @__PURE__ */ o(p, { bold: !0, sx: { fontSize: 15, mb: 12, whiteSpace: "normal" }, children: [
276
+ Y(d.start, Q.FULL_MONTH_DAY),
277
+ " -",
278
+ " ",
279
+ Y(d.end, Q.FULL_MONTH_DAY)
280
+ ] })
281
+ ] }),
282
+ /* @__PURE__ */ e(r, { children: g.map((m) => {
283
+ const c = s.filter(oe(m, d)).sort((l, b) => j(l.expectedDate) - j(b.expectedDate)), C = t.filter(
284
+ oe(m, d)
285
+ ), a = c.reduce(
286
+ (l, b) => l + b.amount,
287
+ 0
288
+ ), u = C.reduce(
289
+ (l, b) => l + b.amount,
290
+ 0
291
+ );
292
+ return /* @__PURE__ */ o(
293
+ Z,
294
+ {
295
+ sx: {
296
+ border: "1px solid",
297
+ borderColor: "border.light",
298
+ mb: 24,
299
+ borderRadius: 1
300
+ },
301
+ children: [
302
+ /* @__PURE__ */ e(
303
+ Ke,
304
+ {
305
+ account: m,
306
+ listItemProps: {
307
+ disableGutters: !1,
308
+ disablePadding: !1,
309
+ sx: { borderTopRadius: 1, pr: 24 }
310
+ }
311
+ }
312
+ ),
313
+ /* @__PURE__ */ e(v, {}),
314
+ c.length > 0 && /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(
315
+ Z,
316
+ {
317
+ subheader: /* @__PURE__ */ e(Te, { total: a, type: te.INCOME }),
318
+ sx: { width: "100%" },
319
+ children: c.map((l) => /* @__PURE__ */ e(Ee, { recurrence: l }, l.repeatingTransactionGuid))
320
+ }
321
+ ) }),
322
+ C.length > 0 && /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(
323
+ Z,
324
+ {
325
+ subheader: /* @__PURE__ */ e(Te, { total: u, type: te.EXPENSE }),
326
+ sx: { width: "100%" },
327
+ children: C.map((l) => /* @__PURE__ */ e(Ee, { recurrence: l }, l.repeatingTransactionGuid))
328
+ }
329
+ ) }),
330
+ /* @__PURE__ */ e(
331
+ xt,
332
+ {
333
+ remaining: (m.available_balance || m.balance || 0) + a - u
334
+ }
335
+ )
336
+ ]
337
+ },
338
+ m.guid
339
+ );
340
+ }) })
341
+ ] });
342
+ }, St = T(_t), yt = () => {
343
+ const { availableWidth: i } = ae(), n = ie(), { cashflow: t } = L(), { upcomingExpenses: s, upcomingIncome: d } = U(), { dateRange: g, selectedCashAccounts: m } = V(), c = [
344
+ {
345
+ field: "account",
346
+ flex: 1.5,
347
+ headerName: t.accounts,
348
+ renderCell: ({ value: { name: a, nickname: u, institution_guid: l, account_number: b } }) => {
349
+ const _ = u || a;
350
+ return /* @__PURE__ */ o(r, { alignItems: "center", flexDirection: "row", gap: 12, children: [
351
+ /* @__PURE__ */ e(
352
+ xe,
353
+ {
354
+ alt: t.institution_logo,
355
+ institutionGuid: l || "",
356
+ size: 16
357
+ }
358
+ ),
359
+ `${_} ${b ? `*${b}` : ""}`
360
+ ] });
361
+ }
362
+ },
363
+ {
364
+ field: "balance",
365
+ flex: 1,
366
+ headerName: t.balance,
367
+ type: "number",
368
+ renderCell: (a) => J(a.value, "0,0.00")
369
+ },
370
+ {
371
+ field: "income",
372
+ flex: 1,
373
+ headerName: t.projected_income,
374
+ type: "number",
375
+ renderCell: (a) => `+${J(a.value, "0,0.00")}`
376
+ },
377
+ {
378
+ field: "expenses",
379
+ flex: 1.1,
380
+ headerName: t.projected_expenses,
381
+ type: "number",
382
+ renderCell: (a) => `-${J(a.value, "0,0.00")}`
383
+ },
384
+ {
385
+ field: "remaining",
386
+ flex: 1,
387
+ headerName: t.remaining,
388
+ type: "number",
389
+ renderCell: (a) => {
390
+ const u = a.row.balance + a.row.income - a.row.expenses;
391
+ return /* @__PURE__ */ e(
392
+ p,
393
+ {
394
+ color: Math.sign(u) === -1 ? n.palette.error.main : n.palette.text.primary,
395
+ variant: "Small",
396
+ children: J(u, "0,0.00")
397
+ }
398
+ );
399
+ }
400
+ }
401
+ ], C = f.useMemo(() => m.map((a) => {
402
+ const u = s.filter(
403
+ oe(a, { start: z(), end: we(z(), 30) })
404
+ ).reduce((_, S) => _ + S.amount, 0), l = d.filter(
405
+ oe(a, { start: z(), end: we(z(), 30) })
406
+ ).reduce((_, S) => _ + S.amount, 0), b = (a.balance || 0) + l - u;
407
+ return {
408
+ account: a,
409
+ balance: a.balance || 0,
410
+ id: a.guid,
411
+ income: l,
412
+ expenses: u,
413
+ remaining: b
414
+ };
415
+ }), [m, s, d]);
416
+ return /* @__PURE__ */ o(
417
+ D,
418
+ {
419
+ sx: {
420
+ width: "100%"
421
+ },
422
+ children: [
423
+ /* @__PURE__ */ o(
424
+ r,
425
+ {
426
+ direction: i < 540 ? "column" : "row",
427
+ justifyContent: "space-between",
428
+ mb: 12,
429
+ children: [
430
+ /* @__PURE__ */ o(r, { alignItems: "center", direction: "row", gap: 8, children: [
431
+ /* @__PURE__ */ e(
432
+ p,
433
+ {
434
+ bold: !0,
435
+ sx: {
436
+ fontSize: 15,
437
+ whiteSpace: "normal"
438
+ },
439
+ children: t.cash_inflow_and_outflow
440
+ }
441
+ ),
442
+ /* @__PURE__ */ e(
443
+ ue,
444
+ {
445
+ body: t.table_tooltip_body,
446
+ title: t.table_tooltip_title
447
+ }
448
+ )
449
+ ] }),
450
+ /* @__PURE__ */ o(p, { bold: !0, sx: { fontSize: 15, whiteSpace: "normal" }, children: [
451
+ Y(g.start, Q.FULL_MONTH_DAY),
452
+ " -",
453
+ " ",
454
+ Y(g.end, Q.FULL_MONTH_DAY)
455
+ ] })
456
+ ]
457
+ }
458
+ ),
459
+ i > 650 ? /* @__PURE__ */ e(
460
+ tt,
461
+ {
462
+ columnHeaderHeight: 48,
463
+ columns: c,
464
+ density: "standard",
465
+ disableColumnMenu: !0,
466
+ disableRowSelectionOnClick: !0,
467
+ hideFooter: !0,
468
+ rowHeight: 48,
469
+ rows: C,
470
+ sx: {
471
+ border: "1px solid",
472
+ borderColor: "border.light",
473
+ borderRadius: 1,
474
+ "& .MuiDataGrid-columnHeader .MuiIconButton-root": {
475
+ color: n.palette.primary.main,
476
+ "&:hover": {
477
+ backgroundColor: Ze(n.palette.primary.main, 0.1)
478
+ }
479
+ },
480
+ "& .MuiDataGrid-sortIcon": {
481
+ color: n.palette.primary.main
482
+ }
483
+ }
484
+ }
485
+ ) : C.map((a) => {
486
+ const { name: u, nickname: l, institution_guid: b, account_number: _ } = a.account, S = l || u;
487
+ return /* @__PURE__ */ e(
488
+ Z,
489
+ {
490
+ sx: {
491
+ border: "1px solid",
492
+ borderColor: "border.light",
493
+ borderRadius: 1,
494
+ marginBottom: 24
495
+ },
496
+ children: /* @__PURE__ */ e(ee, { sx: { minHeight: "auto" }, children: /* @__PURE__ */ o(r, { width: "100%", children: [
497
+ /* @__PURE__ */ o(
498
+ r,
499
+ {
500
+ alignItems: "center",
501
+ flexDirection: "row",
502
+ justifyContent: "space-between",
503
+ px: 16,
504
+ py: 12,
505
+ children: [
506
+ /* @__PURE__ */ o(r, { alignItems: "center", flexDirection: "row", gap: 8, width: "50%", children: [
507
+ /* @__PURE__ */ e(
508
+ xe,
509
+ {
510
+ alt: t.institution_logo,
511
+ institutionGuid: b || "",
512
+ size: 16
513
+ }
514
+ ),
515
+ /* @__PURE__ */ e(p, { variant: "Small", children: `${S} ${_ ? `*${_}` : ""}` })
516
+ ] }),
517
+ /* @__PURE__ */ e(R, { amount: a.balance, bold: !0, variant: "Small" })
518
+ ]
519
+ }
520
+ ),
521
+ /* @__PURE__ */ e(v, { sx: { width: "100%" } }),
522
+ /* @__PURE__ */ o(
523
+ r,
524
+ {
525
+ alignItems: "center",
526
+ flexDirection: "row",
527
+ justifyContent: "space-between",
528
+ px: 16,
529
+ py: 12,
530
+ children: [
531
+ /* @__PURE__ */ e(p, { variant: "Small", children: t.projected_income }),
532
+ /* @__PURE__ */ e(R, { amount: a.income, bold: !0, symbol: "+", variant: "Small" })
533
+ ]
534
+ }
535
+ ),
536
+ /* @__PURE__ */ e(v, { sx: { width: "100%" } }),
537
+ /* @__PURE__ */ o(
538
+ r,
539
+ {
540
+ alignItems: "center",
541
+ flexDirection: "row",
542
+ justifyContent: "space-between",
543
+ px: 16,
544
+ py: 12,
545
+ children: [
546
+ /* @__PURE__ */ e(p, { variant: "Small", children: t.projected_expenses }),
547
+ /* @__PURE__ */ e(R, { amount: a.expenses, bold: !0, symbol: "-", variant: "Small" })
548
+ ]
549
+ }
550
+ ),
551
+ /* @__PURE__ */ e(v, { sx: { width: "100%" } }),
552
+ /* @__PURE__ */ e(
553
+ r,
554
+ {
555
+ alignItems: "center",
556
+ bgcolor: "background.default",
557
+ flexDirection: "row",
558
+ gap: 8,
559
+ justifyContent: "space-between",
560
+ px: 16,
561
+ py: 12,
562
+ sx: { borderBottomLeftRadius: "4px", borderBottomRightRadius: "4px" },
563
+ children: /* @__PURE__ */ e(he, { remaining: a.remaining })
564
+ }
565
+ )
566
+ ] }) })
567
+ },
568
+ a.id
569
+ );
570
+ })
571
+ ]
572
+ }
573
+ );
574
+ }, It = T(yt), Dt = () => {
575
+ const { cashflow: i } = L(), { isDesktop: n } = me(), { onEvent: t } = Ne(), [s, d] = f.useState(0), g = (m, c) => {
576
+ d(c);
577
+ };
578
+ return f.useEffect(() => {
579
+ t(s === 0 ? "cash_flow_summary" : "cash_flow_details");
580
+ }, [s]), /* @__PURE__ */ o(D, { children: [
581
+ /* @__PURE__ */ o(
582
+ Ve,
583
+ {
584
+ "aria-label": i.cashflow_summary_and_details,
585
+ centered: !0,
586
+ onChange: g,
587
+ textColor: "primary",
588
+ value: s,
589
+ variant: "fullWidth",
590
+ children: [
591
+ /* @__PURE__ */ e(
592
+ Ce,
593
+ {
594
+ "aria-controls": "cashflow-tabpanel-0",
595
+ id: "cashflow-tab-0",
596
+ label: i.summary,
597
+ sx: {
598
+ textTransform: "none"
599
+ }
600
+ }
601
+ ),
602
+ /* @__PURE__ */ e(
603
+ Ce,
604
+ {
605
+ "aria-controls": "cashflow-tabpanel-1",
606
+ id: "cashflow-tab-1",
607
+ label: i.details,
608
+ sx: {
609
+ textTransform: "none"
610
+ }
611
+ }
612
+ )
613
+ ]
614
+ }
615
+ ),
616
+ /* @__PURE__ */ e(D, { sx: { mb: 32 } }),
617
+ /* @__PURE__ */ e(_e, { index: 0, name: "cashflow", value: s, children: /* @__PURE__ */ e(D, { sx: { m: n ? 48 : 16 }, children: /* @__PURE__ */ e(It, {}) }) }),
618
+ /* @__PURE__ */ e(_e, { index: 1, name: "cashflow", value: s, children: /* @__PURE__ */ e(D, { sx: { m: n ? 48 : 16 }, children: /* @__PURE__ */ e(St, {}) }) })
619
+ ] });
620
+ }, vt = T(Dt), ne = ({
621
+ amount: i,
622
+ isMobile: n = !1,
623
+ isTotal: t = !1,
624
+ label: s,
625
+ symbol: d,
626
+ tooltip: g
627
+ }) => /* @__PURE__ */ o(
628
+ r,
629
+ {
630
+ bgcolor: t ? "background.default" : "transparent",
631
+ direction: n ? "row" : "column",
632
+ justifyContent: n ? "space-between" : "initial",
633
+ padding: n ? "14px 16px" : 0,
634
+ sx: { borderBottomLeftRadius: 4, borderBottomRightRadius: 4 },
635
+ children: [
636
+ !n && /* @__PURE__ */ e(R, { amount: i, component: "h2", variant: "H2" }),
637
+ /* @__PURE__ */ o(r, { alignItems: "center", component: "span", direction: "row", gap: 8, mt: 2, children: [
638
+ /* @__PURE__ */ e(p, { bold: t, variant: "Small", children: s }),
639
+ g
640
+ ] }),
641
+ n && /* @__PURE__ */ e(R, { amount: i, component: "h2", symbol: d, variant: "Small" })
642
+ ]
643
+ }
644
+ ), Re = (i, n) => (t) => t.accountGuid && i.includes(t.accountGuid) && (We(t.expectedDate) || He(t.expectedDate, n.start)) && Fe(t.expectedDate, n.end), At = () => {
645
+ const { availableWidth: i } = ae(), { cashflow: n } = L(), { upcomingExpenses: t, upcomingIncome: s } = U(), { selectedAccountGuids: d } = X(), { dateRange: g, selectedCashAccounts: m } = V(), { userProfile: c } = de(), [C, a] = f.useState(!1), u = f.useMemo(
646
+ () => t.filter(Re(d, g)),
647
+ [g, d, t]
648
+ ), l = f.useMemo(
649
+ () => s.filter(Re(d, g)),
650
+ [g, d, s]
651
+ ), b = f.useMemo(
652
+ () => m.reduce((I, A) => I + (A?.balance || 0), 0),
653
+ [m]
654
+ ), _ = u.reduce((I, A) => I + A.amount, 0), S = l.reduce((I, A) => I + A.amount, 0), y = b - _ + S, h = i < 725;
655
+ return /* @__PURE__ */ o(r, { sx: { mx: h ? 16 : 0, my: h ? 24 : 42 }, children: [
656
+ /* @__PURE__ */ o(
657
+ r,
658
+ {
659
+ border: h ? "1px solid" : "none",
660
+ borderColor: "border.light",
661
+ borderRadius: 2,
662
+ flexDirection: h ? "column" : "row",
663
+ gap: h ? 0 : 24,
664
+ justifyContent: "center",
665
+ children: [
666
+ /* @__PURE__ */ e(
667
+ ne,
668
+ {
669
+ amount: b,
670
+ isMobile: h,
671
+ label: n.cash_and_bank
672
+ }
673
+ ),
674
+ h && /* @__PURE__ */ e(v, {}),
675
+ c?.has_completed_cash_flow_onboarding ? /* @__PURE__ */ o(B, { children: [
676
+ !h && /* @__PURE__ */ e(p, { sx: { fontSize: 25, lineHeight: 1 }, children: "+" }),
677
+ /* @__PURE__ */ e(
678
+ ne,
679
+ {
680
+ amount: S,
681
+ isMobile: h,
682
+ label: n.to_be_received,
683
+ symbol: h ? "+" : void 0
684
+ }
685
+ )
686
+ ] }) : /* @__PURE__ */ e(
687
+ k,
688
+ {
689
+ onClick: () => a(!0),
690
+ startIcon: /* @__PURE__ */ e(H, { name: "add" }),
691
+ sx: { fontSize: 13 },
692
+ children: n.add_income
693
+ }
694
+ ),
695
+ h ? /* @__PURE__ */ e(v, {}) : /* @__PURE__ */ e(p, { sx: { fontSize: 25, lineHeight: 1 }, children: "-" }),
696
+ /* @__PURE__ */ e(
697
+ ne,
698
+ {
699
+ amount: _,
700
+ isMobile: h,
701
+ label: n.to_be_paid_out,
702
+ symbol: h ? "-" : void 0
703
+ }
704
+ ),
705
+ h ? /* @__PURE__ */ e(v, {}) : /* @__PURE__ */ e(p, { sx: { fontSize: 25, lineHeight: 1 }, children: "=" }),
706
+ /* @__PURE__ */ e(
707
+ ne,
708
+ {
709
+ amount: y,
710
+ isMobile: h,
711
+ isTotal: h,
712
+ label: n.remaining_cash,
713
+ tooltip: /* @__PURE__ */ e(
714
+ ue,
715
+ {
716
+ body: n.remaining_income_tooltip_body,
717
+ title: n.remaining_income_tooltip_title
718
+ }
719
+ )
720
+ }
721
+ )
722
+ ]
723
+ }
724
+ ),
725
+ /* @__PURE__ */ e(
726
+ $e,
727
+ {
728
+ ariaLabelClose: n.close_manage_income_aria,
729
+ isOpen: C,
730
+ onClose: () => a(!1),
731
+ shouldShowHeaderBorders: !1,
732
+ title: n.manage_income,
733
+ children: /* @__PURE__ */ e(nt, {})
734
+ }
735
+ )
736
+ ] });
737
+ }, Et = T(At), Tt = ({ handleNextStep: i }) => {
738
+ const { completeOnboarding: n } = le(), { cashflow: t } = L(), s = ie();
739
+ return /* @__PURE__ */ o(r, { children: [
740
+ /* @__PURE__ */ e(ce, { pb: 12, children: t.welcome_title }),
741
+ /* @__PURE__ */ e(
742
+ qe,
743
+ {
744
+ color: s.palette.primary.light,
745
+ pb: 8,
746
+ sx: { wordBreak: "break-word", whiteSpace: "initial" },
747
+ variant: "H3",
748
+ children: t.welcome_sub_title
749
+ }
750
+ ),
751
+ /* @__PURE__ */ e(O, { pb: 32, children: t.welcome_description }),
752
+ /* @__PURE__ */ o(r, { direction: "column", mb: 32, spacing: 32, children: [
753
+ /* @__PURE__ */ o(O, { sx: { display: "flex", alignItems: "center", fontSize: 18 }, children: [
754
+ /* @__PURE__ */ e(
755
+ D,
756
+ {
757
+ bgcolor: s.palette.primary.lighter,
758
+ borderRadius: 1,
759
+ component: "span",
760
+ height: 44,
761
+ mr: 24,
762
+ sx: { display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 },
763
+ width: 44,
764
+ children: /* @__PURE__ */ e(H, { color: "primary", name: "currency_exchange" })
765
+ }
766
+ ),
767
+ t.bullet_one
768
+ ] }),
769
+ /* @__PURE__ */ o(O, { sx: { display: "flex", alignItems: "center", fontSize: 18 }, children: [
770
+ /* @__PURE__ */ e(
771
+ D,
772
+ {
773
+ bgcolor: s.palette.primary.lighter,
774
+ borderRadius: 1,
775
+ component: "span",
776
+ height: 44,
777
+ mr: 24,
778
+ sx: { display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 },
779
+ width: 44,
780
+ children: /* @__PURE__ */ e(H, { color: "primary", name: "cardiology" })
781
+ }
782
+ ),
783
+ t.bullet_two
784
+ ] }),
785
+ /* @__PURE__ */ o(O, { sx: { display: "flex", alignItems: "center", fontSize: 18 }, children: [
786
+ /* @__PURE__ */ e(
787
+ D,
788
+ {
789
+ bgcolor: s.palette.primary.lighter,
790
+ borderRadius: 1,
791
+ component: "span",
792
+ height: 44,
793
+ mr: 24,
794
+ sx: { display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 },
795
+ width: 44,
796
+ children: /* @__PURE__ */ e(H, { color: "primary", name: "flare" })
797
+ }
798
+ ),
799
+ t.bullet_three
800
+ ] })
801
+ ] }),
802
+ /* @__PURE__ */ o(r, { direction: "row", spacing: 16, children: [
803
+ /* @__PURE__ */ e(k, { onClick: i, variant: "contained", children: t.get_started_button }),
804
+ /* @__PURE__ */ e(k, { onClick: n, variant: "outlined", children: t.skip_button })
805
+ ] })
806
+ ] });
807
+ }, Rt = T(Tt), Le = "https://content.moneydesktop.com/storage/MD_Assets/md/cashflow", Me = {
808
+ CASHFLOW_ONBOARDING: `${Le}/cashflow-onboarding.png`,
809
+ CASHFLOW_LOADING_ANIMATION: `${Le}/loading-animation.gif`
810
+ }, Lt = () => {
811
+ const { cashflow: i } = L();
812
+ return /* @__PURE__ */ o(f.Fragment, { children: [
813
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("img", { alt: "Loading", src: Me.CASHFLOW_LOADING_ANIMATION }) }),
814
+ /* @__PURE__ */ e(ce, { pb: 12, children: i.loading_title }),
815
+ /* @__PURE__ */ e(O, { children: i.loading_description })
816
+ ] });
817
+ }, Ot = T(Lt), Nt = et`
818
+ from {
819
+ transform: rotate(0deg);
820
+ }
821
+ to {
822
+ transform: rotate(360deg);
823
+ }
824
+ `, kt = () => {
825
+ const { addRepeatingTransaction: i, repeatingTransactions: n } = U(), { cashflow: t, common: s } = L(), { completeOnboarding: d } = le(), { isDirty: g } = V(), { isMobile: m } = me(), { isCopyLoaded: c, setDisplayedDate: C } = X(), { filter: a, setFilter: u, transactions: l } = ke(), b = ie(), [_, S] = K(!0), [y, h] = f.useState(dt.EveryMonth), [I, A] = f.useState(1), [F, P] = f.useState(15), [$, w] = K(!1), [G, pe] = K(1), [N, je] = K([]), [fe, se] = K(""), W = f.useMemo(
826
+ () => l.find((x) => x.guid === fe),
827
+ [fe, l]
828
+ ), ze = !!n.filter(
829
+ (x) => x.repeating_transaction_type === Ie.Income
830
+ ).length, ge = async () => {
831
+ pe(2), C(
832
+ // Beginning of the month, 90 days before today
833
+ st(Ge(z(), 90)),
834
+ z()
835
+ ), u({ ...a, custom: Se }), pe(3);
836
+ }, Be = async () => {
837
+ if (!(N.length < 1)) {
838
+ w(!0);
839
+ for (let x = 0; x < N.length; x++) {
840
+ const E = N[x], be = De(y, ye(E.date)), Pe = {
841
+ account_guid: E.account_guid,
842
+ amount: E.amount,
843
+ merchant_guid: E.merchant_guid,
844
+ description: E.feed_description || E.description,
845
+ predicted_occurs_on: rt(be, { representation: "date" }),
846
+ recurrence_day: be.getDay(),
847
+ recurrence_type: y,
848
+ repeating_transaction_type: Ie.Income,
849
+ transaction_type: E.transaction_type
850
+ };
851
+ await i(Pe, E);
852
+ }
853
+ await d();
854
+ }
855
+ }, Ue = !W && _ || !W && N.length < 1;
856
+ return c ? /* @__PURE__ */ o(
857
+ D,
858
+ {
859
+ sx: {
860
+ display: "flex",
861
+ alignItems: m ? "flex-start" : "center",
862
+ backgroundColor: b.palette.background.paper,
863
+ backgroundImage: m ? null : `url(${Me.CASHFLOW_ONBOARDING})`,
864
+ backgroundRepeat: "no-repeat",
865
+ backgroundPosition: "left 100px",
866
+ backgroundSize: "35%",
867
+ py: 24
868
+ },
869
+ children: [
870
+ G === 1 && /* @__PURE__ */ e(
871
+ D,
872
+ {
873
+ sx: {
874
+ ...m ? { display: "flex", flexDirection: "column", maxWidth: "100%", padding: "0 16px" } : { maxWidth: 590, ml: "40%", mr: 90 }
875
+ },
876
+ children: /* @__PURE__ */ e(Rt, { handleNextStep: ge })
877
+ }
878
+ ),
879
+ G === 2 && /* @__PURE__ */ e(
880
+ D,
881
+ {
882
+ sx: {
883
+ ...m ? { display: "flex", flexDirection: "column", maxWidth: "100%", padding: "0 16px" } : { maxWidth: 590, ml: "40%", mr: 90 }
884
+ },
885
+ children: /* @__PURE__ */ e(Ot, {})
886
+ }
887
+ ),
888
+ G === 3 && /* @__PURE__ */ o(
889
+ D,
890
+ {
891
+ sx: {
892
+ ...m ? { display: "flex", flexDirection: "column", maxWidth: "100%", padding: "0 16px" } : { maxWidth: 590, ml: "40%", mr: 90 }
893
+ },
894
+ children: [
895
+ /* @__PURE__ */ e(ce, { pb: 12, children: t.add_income_title }),
896
+ /* @__PURE__ */ e(O, { mb: 24, children: t.add_income_description }),
897
+ N.length > 0 && !W && /* @__PURE__ */ o(B, { children: [
898
+ /* @__PURE__ */ e(Z, { children: N.map((x, E) => /* @__PURE__ */ o(f.Fragment, { children: [
899
+ /* @__PURE__ */ e(ct, { bgcolor: "background.paper", children: mt(
900
+ j(x.nextDate || x.date)
901
+ ) }),
902
+ /* @__PURE__ */ e(lt, { transaction: x }),
903
+ E !== N.length - 1 && /* @__PURE__ */ e(v, {})
904
+ ] }, x.guid)) }),
905
+ /* @__PURE__ */ o(r, { alignItems: "center", direction: "row", children: [
906
+ /* @__PURE__ */ e(v, { sx: { flexGrow: 1 } }),
907
+ /* @__PURE__ */ e(
908
+ k,
909
+ {
910
+ onClick: () => S(!0),
911
+ startIcon: /* @__PURE__ */ e(H, { name: "add", size: 20 }),
912
+ children: t.add_income
913
+ }
914
+ )
915
+ ] })
916
+ ] }),
917
+ Ue && /* @__PURE__ */ e(
918
+ ot,
919
+ {
920
+ bgcolor: "background.paper",
921
+ onSearch: (x) => u({
922
+ ...a,
923
+ custom: (E) => x ? it(E, x) : Se(E)
924
+ }),
925
+ onSelected: (x) => {
926
+ se(x), S(!1);
927
+ }
928
+ }
929
+ ),
930
+ !ze && g && /* @__PURE__ */ e(O, { color: "error", mt: 16, children: t.confirm_error }),
931
+ W && /* @__PURE__ */ o(B, { children: [
932
+ /* @__PURE__ */ e(
933
+ at,
934
+ {
935
+ bgcolor: "background.paper",
936
+ firstDay: I,
937
+ frequency: y,
938
+ onFirstDayChange: A,
939
+ onFrequencyChange: h,
940
+ onSecondDayChange: P,
941
+ secondDay: F,
942
+ transaction: W
943
+ }
944
+ ),
945
+ /* @__PURE__ */ o(r, { direction: "row", gap: 16, ml: 24, mt: 32, children: [
946
+ /* @__PURE__ */ e(
947
+ k,
948
+ {
949
+ "aria-disabled": !W,
950
+ onClick: () => {
951
+ const x = [...N];
952
+ x.push({
953
+ ...W,
954
+ nextDate: De(y, ye(W.date)),
955
+ frequency: y
956
+ }), je(x), se("");
957
+ },
958
+ variant: "contained",
959
+ children: s.confirm_button
960
+ }
961
+ ),
962
+ /* @__PURE__ */ e(
963
+ k,
964
+ {
965
+ onClick: () => {
966
+ se(""), S(!0), ge().finally();
967
+ },
968
+ variant: "outlined",
969
+ children: s.cancel_button
970
+ }
971
+ )
972
+ ] })
973
+ ] }),
974
+ N.length > 0 && !W && /* @__PURE__ */ o(r, { direction: "row", gap: 16, ml: 24, mt: 32, children: [
975
+ /* @__PURE__ */ e(
976
+ k,
977
+ {
978
+ "aria-disabled": N.length < 1 || $,
979
+ onClick: Be,
980
+ startIcon: $ ? /* @__PURE__ */ e(
981
+ H,
982
+ {
983
+ name: "progress_activity",
984
+ sx: {
985
+ animation: `${Nt} 2s linear infinite`
986
+ }
987
+ }
988
+ ) : null,
989
+ variant: "contained",
990
+ children: t.confirm_income_button
991
+ }
992
+ ),
993
+ /* @__PURE__ */ e(k, { onClick: d, variant: "outlined", children: t.skip_button })
994
+ ] })
995
+ ]
996
+ }
997
+ )
998
+ ]
999
+ }
1000
+ ) : /* @__PURE__ */ e(re, {});
1001
+ }, Ht = T(kt), Ft = ({ onBackClick: i, sx: n = {} }) => {
1002
+ const {
1003
+ selectedAccounts: t,
1004
+ selectedAccountGuids: s,
1005
+ setSelectedAccounts: d,
1006
+ shouldDisableNextDate: g,
1007
+ shouldDisablePrevDate: m
1008
+ } = X(), { onEvent: c } = Ne(), { visibleCashAccounts: C } = Oe(), { setFilter: a } = ke(), { userProfile: u } = de(), { dateRange: l, setSelectedCashAccounts: b } = V(), { loadRepeatingTransactions: _, setDateRange: S } = U(), { cashflow: y } = L(), { isCopyLoaded: h, isInitialized: I } = X(), [A, F] = f.useState(!1);
1009
+ return f.useEffect(() => {
1010
+ I && (S(l), _().finally());
1011
+ }, [I]), f.useEffect(() => {
1012
+ d(C);
1013
+ }, [C]), f.useEffect(() => {
1014
+ const P = C.map((w) => w.guid), $ = t.filter(
1015
+ (w) => s.includes(w.guid) && P.includes(w.guid)
1016
+ );
1017
+ b($), a({
1018
+ dateRange: { start: Ge(z(), 90), end: ut() },
1019
+ accounts: $.map((w) => w.guid)
1020
+ });
1021
+ }, [C, t]), !h || !I ? /* @__PURE__ */ e(re, {}) : u?.has_completed_cash_flow_onboarding ? /* @__PURE__ */ o(
1022
+ ve,
1023
+ {
1024
+ accountOptions: C,
1025
+ actions: [
1026
+ {
1027
+ label: y.cashflow_settings,
1028
+ iconName: "settings",
1029
+ onClick: () => {
1030
+ F(!0), c(Ae.CASH_FLOW_CLICK_SETTINGS);
1031
+ }
1032
+ }
1033
+ ],
1034
+ calendarActions: {
1035
+ shouldDisableNext: g,
1036
+ shouldDisablePrevious: m,
1037
+ shouldDisablePicker: !0,
1038
+ onRangeChanged: () => {
1039
+ }
1040
+ },
1041
+ dateRange: l,
1042
+ dateRangeVariant: "readonly",
1043
+ onAccountsFilterClick: () => c(Ae.CASH_FLOW_CLICK_FILTER),
1044
+ onBackClick: i,
1045
+ sx: n,
1046
+ title: y.title,
1047
+ children: [
1048
+ /* @__PURE__ */ e(Et, {}),
1049
+ /* @__PURE__ */ e(vt, {}),
1050
+ /* @__PURE__ */ e(
1051
+ $e,
1052
+ {
1053
+ ariaLabelClose: y.close_settings_aria,
1054
+ isOpen: A,
1055
+ onClose: () => F(!1),
1056
+ shouldShowHeaderBorders: !1,
1057
+ title: y.cashflow_settings,
1058
+ children: /* @__PURE__ */ e(Qe, {})
1059
+ }
1060
+ )
1061
+ ]
1062
+ }
1063
+ ) : /* @__PURE__ */ e(
1064
+ ve,
1065
+ {
1066
+ onBackClick: i,
1067
+ sx: { height: "100%", overflow: "auto" },
1068
+ title: y.title,
1069
+ children: /* @__PURE__ */ e(Ht, {})
1070
+ }
1071
+ );
1072
+ }, Ln = T(Ft);
1073
+ class On {
1074
+ fetchInstance;
1075
+ constructor(n, t) {
1076
+ this.fetchInstance = new ht(n, t);
1077
+ }
1078
+ addCashflowEvent = async (n) => this.fetchInstance.post(M.CASHFLOW_EVENTS, { ...n }).then((t) => t);
1079
+ addCashflowSequence = async (n) => this.fetchInstance.post(M.CASHFLOW_SEQUENCES, { ...n }).then((t) => t.cashflow_sequence);
1080
+ getCashflowSequences = async () => this.fetchInstance.get(M.CASHFLOW_SEQUENCES).then((n) => n.cashflow_sequences);
1081
+ getCashflowEventsByDateRange = async (n, t) => this.fetchInstance.get(
1082
+ `${M.CASHFLOW_EVENTS}/from/${j(n)}/to/${j(t)}`
1083
+ ).then((s) => s.cashflow_events);
1084
+ deleteCashflowSequence = async (n) => this.fetchInstance.delete(`${M.CASHFLOW_SEQUENCES}/${n}`).then((t) => t);
1085
+ getProjectedCashflowEvents = async (n, t) => this.fetchInstance.get(
1086
+ `${M.CASHFLOW_SEQUENCES}/projected_events/from/${j(
1087
+ n
1088
+ )}/to/${j(t)}`
1089
+ ).then((s) => s.cashflow_events);
1090
+ updateCashflowSequence = async (n) => this.fetchInstance.put(`${M.CASHFLOW_SEQUENCES}/${n.guid}`, n).then((t) => t.cashflow_sequence);
1091
+ }
1092
+ export {
1093
+ On as CashflowApi,
1094
+ Rn as CashflowMiniWidget,
1095
+ Ht as CashflowOnboarding,
1096
+ Hn as CashflowStore,
1097
+ Ln as CashflowWidget
1098
+ };