@mx-cartographer/experiences 7.0.59-alpha.al1 → 7.0.60

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.
@@ -1,28 +1,28 @@
1
1
  import { jsxs as o, Fragment as U, jsx as e } from "react/jsx-runtime";
2
- import p, { useState as K } from "react";
2
+ import f, { useState as K } from "react";
3
3
  import { observer as T } from "mobx-react-lite";
4
4
  import { addMonths as qe } from "date-fns/addMonths";
5
5
  import { startOfToday as F } from "date-fns/startOfToday";
6
6
  import I from "@mui/material/Box";
7
7
  import D from "@mui/material/Divider";
8
8
  import s from "@mui/material/Stack";
9
- import ae from "@mui/material/styles/useTheme";
10
- import { Text as m, P as N, Icon as G, InstitutionLogo as be, H1 as ce, H2 as Xe } from "@mxenabled/mxui";
11
- import { G as Ye, t as le, u as L, p as ie, d as Le, b as X, j as P, g as Ne, o as Oe, h as ke } from "../hooks-CE2TKk4a.mjs";
9
+ import ie from "@mui/material/styles/useTheme";
10
+ import { Text as u, P as N, Icon as G, InstitutionLogo as be, H1 as ce, H2 as Xe } from "@mxenabled/mxui";
11
+ import { G as Ye, t as le, u as L, p as re, d as Le, b as X, j as P, g as Ne, o as Oe, h as ke } from "../hooks-CE2TKk4a.mjs";
12
12
  import { C as R } from "../CurrencyText-YUhH2caW.mjs";
13
13
  import { u as de } from "../useScreenSize-B6JyS_Lj.mjs";
14
- import { L as re } from "../Loader-DUaFpDGv.mjs";
14
+ import { L as ee } from "../Loader-DUaFpDGv.mjs";
15
15
  import { I as me } from "../CashflowStore-D9Dpuz7X.mjs";
16
16
  import { C as Mn } from "../CashflowStore-D9Dpuz7X.mjs";
17
17
  import { b as q } from "../Localization-2MODESHW.mjs";
18
18
  import { M as Qe } from "../MiniWidgetContainer-DTQdRK-3.mjs";
19
- import { E as Ve } from "../EmptyState-w2yYDuKG.mjs";
19
+ import { E as Ve } from "../EmptyState-DsXpMcro.mjs";
20
20
  import { R as Ke } from "../RecurringSettings-B486z99o.mjs";
21
21
  import Je from "@mui/material/Tabs";
22
22
  import xe from "@mui/material/Tab";
23
23
  import { getUnixTime as B } from "date-fns/getUnixTime";
24
24
  import Z from "@mui/material/List";
25
- import ee from "@mui/material/ListItem";
25
+ import te from "@mui/material/ListItem";
26
26
  import { A as Ze } from "../AccountListItem-BAdwVscV.mjs";
27
27
  import { f as Y, D as Q } from "../Dialog-CWW597AF.mjs";
28
28
  import et from "@mui/material/ListSubheader";
@@ -48,7 +48,7 @@ import { endOfToday as pt } from "date-fns/endOfToday";
48
48
  import { W as De, A as ve } from "../WidgetContainer-B8MRJ5Y1.mjs";
49
49
  import { F as ft, A as z } from "../Fetch-87LIQbEA.mjs";
50
50
  const V = () => {
51
- if (!p.useContext(Ye))
51
+ if (!f.useContext(Ye))
52
52
  throw new Error("useCashflowUiStore() must be used within the GlobalDataContext");
53
53
  return le().uiStore;
54
54
  }, gt = ({ remaining: a }) => {
@@ -65,34 +65,34 @@ const V = () => {
65
65
  }
66
66
  }
67
67
  ),
68
- /* @__PURE__ */ e(m, { bold: !0, sx: { flexGrow: 1, fontSize: 12 }, children: n.remaining_cash }),
68
+ /* @__PURE__ */ e(u, { bold: !0, sx: { flexGrow: 1, fontSize: 12 }, children: n.remaining_cash }),
69
69
  /* @__PURE__ */ e(R, { amount: a, bold: !0, sx: { fontSize: 12 } })
70
70
  ] });
71
71
  }, ue = T(gt), bt = () => {
72
- const a = ae(), { availableWidth: n } = ie(), { isMobile: t } = de(), { visibleCashAccounts: i, visibleCashBalance: u } = Le(), { selectedAccounts: g, selectedAccountGuids: l, setSelectedAccounts: y } = X(), { cashflow: c } = L(), {
72
+ const a = ie(), { availableWidth: n } = re(), { isMobile: t } = de(), { visibleCashAccounts: i, visibleCashBalance: h } = Le(), { selectedAccounts: g, selectedAccountGuids: l, setSelectedAccounts: y } = X(), { cashflow: c } = L(), {
73
73
  daysUntilNextIncome: r,
74
- expensesTilNextIncome: f,
74
+ expensesTilNextIncome: m,
75
75
  selectedCashAccounts: d,
76
76
  setNextIncome: b,
77
77
  setSelectedCashAccounts: C,
78
78
  setUpcomingExpenses: S
79
- } = V(), { isDataLoaded: v, nextIncomeRecurrence: h, upcomingExpenses: E } = P();
80
- p.useEffect(() => {
79
+ } = V(), { isDataLoaded: v, nextIncomeRecurrence: p, upcomingExpenses: E } = P();
80
+ f.useEffect(() => {
81
81
  y(i);
82
- }, [i]), p.useEffect(() => {
82
+ }, [i]), f.useEffect(() => {
83
83
  C(
84
84
  i.filter((w) => l.includes(w.guid))
85
85
  );
86
- }, [i, g]), p.useEffect(() => {
87
- h && b(h), S(E);
88
- }, [h, E]);
89
- const _ = p.useMemo(
86
+ }, [i, g]), f.useEffect(() => {
87
+ p && b(p), S(E);
88
+ }, [p, E]);
89
+ const _ = f.useMemo(
90
90
  () => i.filter((w) => l.includes(w.guid)).reduce((w, $) => w + ($?.balance || 0), 0),
91
91
  [l, E]
92
- ), W = p.useMemo(
93
- () => f.filter((w) => l.includes(w.accountGuid || "")).reduce((w, $) => w + $.amount, 0),
94
- [l, f]
95
- ), j = p.useMemo(
92
+ ), W = f.useMemo(
93
+ () => m.filter((w) => l.includes(w.accountGuid || "")).reduce((w, $) => w + $.amount, 0),
94
+ [l, m]
95
+ ), j = f.useMemo(
96
96
  () => _ - W,
97
97
  [_, W]
98
98
  );
@@ -115,7 +115,7 @@ const V = () => {
115
115
  /* @__PURE__ */ e(s, { pt: 18, children: /* @__PURE__ */ e(G, { name: "remove" }) }),
116
116
  /* @__PURE__ */ o(s, { pb: 14, pt: 12, children: [
117
117
  /* @__PURE__ */ e(R, { amount: W, variant: "H2" }),
118
- /* @__PURE__ */ e(N, { variant: "XSmall", whiteSpace: "nowrap", children: q(c.expenses_due, f.length) })
118
+ /* @__PURE__ */ e(N, { variant: "XSmall", whiteSpace: "nowrap", children: q(c.expenses_due, m.length) })
119
119
  ] }),
120
120
  /* @__PURE__ */ e(s, { pt: 18, children: /* @__PURE__ */ e(G, { name: "equal" }) }),
121
121
  /* @__PURE__ */ o(s, { pb: 14, pr: 24, pt: 12, children: [
@@ -126,22 +126,22 @@ const V = () => {
126
126
  ] })
127
127
  ] }),
128
128
  /* @__PURE__ */ e(s, { borderLeft: `1px solid ${a.palette.border.light}`, pb: 12, pl: 24, pt: 12, children: /* @__PURE__ */ o(U, { children: [
129
- /* @__PURE__ */ e(m, { variant: "H2", children: q(c.days, r) }),
129
+ /* @__PURE__ */ e(u, { variant: "H2", children: q(c.days, r) }),
130
130
  /* @__PURE__ */ e(N, { variant: "XSmall", whiteSpace: "nowrap", children: c.next_paycheck })
131
131
  ] }) })
132
132
  ]
133
133
  }
134
134
  ) : /* @__PURE__ */ o(s, { border: `1px solid ${a.palette.border.light}`, borderRadius: 1, children: [
135
135
  /* @__PURE__ */ o(s, { direction: "row", justifyContent: "space-between", p: 16, children: [
136
- /* @__PURE__ */ e(m, { variant: "Small", children: q(
136
+ /* @__PURE__ */ e(u, { variant: "Small", children: q(
137
137
  c.total_cash_accounts,
138
138
  d.length
139
139
  ) }),
140
- /* @__PURE__ */ e(R, { amount: u, bold: !0, variant: "XSmall" })
140
+ /* @__PURE__ */ e(R, { amount: h, bold: !0, variant: "XSmall" })
141
141
  ] }),
142
142
  /* @__PURE__ */ e(D, {}),
143
143
  /* @__PURE__ */ o(s, { direction: "row", justifyContent: "space-between", p: 16, children: [
144
- /* @__PURE__ */ e(m, { variant: "Small", children: q(c.expenses_due, f.length) }),
144
+ /* @__PURE__ */ e(u, { variant: "Small", children: q(c.expenses_due, m.length) }),
145
145
  /* @__PURE__ */ e(R, { amount: W, bold: !0, symbol: "-", variant: "XSmall" })
146
146
  ] }),
147
147
  /* @__PURE__ */ e(D, {}),
@@ -161,46 +161,47 @@ const V = () => {
161
161
  ),
162
162
  /* @__PURE__ */ e(D, {}),
163
163
  /* @__PURE__ */ o(s, { direction: "row", justifyContent: "space-between", p: 16, children: [
164
- /* @__PURE__ */ e(m, { variant: "Small", children: c.next_paycheck }),
165
- /* @__PURE__ */ e(m, { bold: !0, variant: "XSmall", children: q(c.days, r) })
164
+ /* @__PURE__ */ e(u, { variant: "Small", children: c.next_paycheck }),
165
+ /* @__PURE__ */ e(u, { bold: !0, variant: "XSmall", children: q(c.days, r) })
166
166
  ] })
167
- ] }) }) : /* @__PURE__ */ e(re, { height: t ? 210 : 120 });
167
+ ] }) }) : /* @__PURE__ */ e(ee, { height: t ? 210 : 120 });
168
168
  }, xt = T(bt), yt = ({
169
169
  onPrimaryCtaClick: a,
170
170
  onSecondaryCtaClick: n,
171
171
  sx: t = {}
172
172
  }) => {
173
- const { cashflow: i } = L(), { isCopyLoaded: u, isInitialized: g } = X(), { loadRepeatingTransactions: l, income: y, setDateRange: c } = P();
174
- p.useEffect(() => {
175
- g && (c({ start: F(), end: qe(F(), 1) }), l().finally());
173
+ const { cashflow: i } = L(), { isCopyLoaded: h, isInitialized: g } = X(), { loadRepeatingTransactions: l, income: y, isDataLoaded: c, setDateRange: r } = P();
174
+ f.useEffect(() => {
175
+ g && (r({ start: F(), end: qe(F(), 1) }), l().finally());
176
176
  }, [g]);
177
- const r = g && !y.length;
178
- return u ? /* @__PURE__ */ o(
177
+ const m = c && !y.length;
178
+ return h ? /* @__PURE__ */ o(
179
179
  Qe,
180
180
  {
181
181
  className: "mx-exp-cashflow-miniwidget",
182
182
  onPrimaryCtaClick: a,
183
183
  primaryCtaLabel: i.primary_cta,
184
- subTitle: r ? void 0 : i.sub_title,
184
+ subTitle: m || !c ? void 0 : i.sub_title,
185
185
  sx: t,
186
186
  title: i.title,
187
187
  children: [
188
- r && /* @__PURE__ */ e(
188
+ !c && /* @__PURE__ */ e(ee, {}),
189
+ c && (m ? /* @__PURE__ */ e(
189
190
  Ve,
190
191
  {
191
192
  header: i.create,
192
193
  icon: "local_atm",
193
194
  onClick: n,
194
195
  primaryButton: i.add_income,
196
+ primaryButtonStartIcon: "add",
195
197
  subText: i.create_description
196
198
  }
197
- ),
198
- !r && /* @__PURE__ */ e(xt, {})
199
+ ) : /* @__PURE__ */ e(xt, {}))
199
200
  ]
200
201
  }
201
- ) : /* @__PURE__ */ e(re, {});
202
+ ) : /* @__PURE__ */ e(ee, {});
202
203
  }, kn = T(yt), Ct = ({ remaining: a }) => /* @__PURE__ */ e(
203
- ee,
204
+ te,
204
205
  {
205
206
  sx: {
206
207
  alignItems: "center",
@@ -215,14 +216,14 @@ const V = () => {
215
216
  children: /* @__PURE__ */ e(ue, { remaining: a })
216
217
  }
217
218
  );
218
- var te = /* @__PURE__ */ ((a) => (a.EXPENSE = "expense", a.INCOME = "income", a))(te || {});
219
+ var ne = /* @__PURE__ */ ((a) => (a.EXPENSE = "expense", a.INCOME = "income", a))(ne || {});
219
220
  const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
220
- /* @__PURE__ */ o(ee, { sx: { display: "flex", alignItems: "center", gap: 16, px: 24, py: 12 }, children: [
221
+ /* @__PURE__ */ o(te, { sx: { display: "flex", alignItems: "center", gap: 16, px: 24, py: 12 }, children: [
221
222
  /* @__PURE__ */ o(s, { alignItems: "center", height: 32, width: 32, children: [
222
- /* @__PURE__ */ e(m, { bold: !0, sx: { fontSize: 11 }, children: Y(a.expectedDate, Q.MONTH) }),
223
- /* @__PURE__ */ e(m, { bold: !0, sx: { fontSize: 11 }, children: Y(a.expectedDate, Q.DAY) })
223
+ /* @__PURE__ */ e(u, { bold: !0, sx: { fontSize: 11 }, children: Y(a.expectedDate, Q.MONTH) }),
224
+ /* @__PURE__ */ e(u, { bold: !0, sx: { fontSize: 11 }, children: Y(a.expectedDate, Q.DAY) })
224
225
  ] }),
225
- /* @__PURE__ */ e(m, { sx: { flexGrow: 1, fontSize: 13 }, children: a.name }),
226
+ /* @__PURE__ */ e(u, { sx: { flexGrow: 1, fontSize: 13 }, children: a.name }),
226
227
  /* @__PURE__ */ e(
227
228
  R,
228
229
  {
@@ -249,9 +250,9 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
249
250
  px: 24
250
251
  },
251
252
  children: [
252
- /* @__PURE__ */ e(m, { bold: !0, sx: { fontSize: 12 }, children: n === te.EXPENSE ? t.expenses : t.income }),
253
- /* @__PURE__ */ o(m, { bold: !0, sx: { fontSize: 13 }, children: [
254
- n === te.EXPENSE ? "-" : "+",
253
+ /* @__PURE__ */ e(u, { bold: !0, sx: { fontSize: 12 }, children: n === ne.EXPENSE ? t.expenses : t.income }),
254
+ /* @__PURE__ */ o(u, { bold: !0, sx: { fontSize: 13 }, children: [
255
+ n === ne.EXPENSE ? "-" : "+",
255
256
  J(a, "0,0.00")
256
257
  ] })
257
258
  ]
@@ -259,25 +260,25 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
259
260
  ),
260
261
  /* @__PURE__ */ e(D, {})
261
262
  ] });
262
- }, Ae = T(_t), oe = (a, n) => (t) => t.accountGuid === a.guid && (We(t.expectedDate) || He(t.expectedDate, n.start)) && Fe(t.expectedDate, n.end), wt = () => {
263
- const { availableWidth: a } = ie(), { cashflow: n } = L(), { upcomingExpenses: t, upcomingIncome: i } = P(), { dateRange: u, selectedCashAccounts: g } = V();
263
+ }, Ae = T(_t), ae = (a, n) => (t) => t.accountGuid === a.guid && (We(t.expectedDate) || He(t.expectedDate, n.start)) && Fe(t.expectedDate, n.end), wt = () => {
264
+ const { availableWidth: a } = re(), { cashflow: n } = L(), { upcomingExpenses: t, upcomingIncome: i } = P(), { dateRange: h, selectedCashAccounts: g } = V();
264
265
  return /* @__PURE__ */ o(s, { children: [
265
266
  /* @__PURE__ */ o(s, { direction: a < 400 ? "column" : "row", justifyContent: "space-between", children: [
266
- /* @__PURE__ */ e(m, { bold: !0, sx: { fontSize: 15, mb: 12, whiteSpace: "normal" }, children: n.accounts_breakdown }),
267
- /* @__PURE__ */ o(m, { bold: !0, sx: { fontSize: 15, mb: 12, whiteSpace: "normal" }, children: [
268
- Y(u.start, Q.FULL_MONTH_DAY),
267
+ /* @__PURE__ */ e(u, { bold: !0, sx: { fontSize: 15, mb: 12, whiteSpace: "normal" }, children: n.accounts_breakdown }),
268
+ /* @__PURE__ */ o(u, { bold: !0, sx: { fontSize: 15, mb: 12, whiteSpace: "normal" }, children: [
269
+ Y(h.start, Q.FULL_MONTH_DAY),
269
270
  " -",
270
271
  " ",
271
- Y(u.end, Q.FULL_MONTH_DAY)
272
+ Y(h.end, Q.FULL_MONTH_DAY)
272
273
  ] })
273
274
  ] }),
274
275
  /* @__PURE__ */ e(s, { children: g.map((l) => {
275
- const y = i.filter(oe(l, u)).sort((d, b) => B(d.expectedDate) - B(b.expectedDate)), c = t.filter(
276
- oe(l, u)
276
+ const y = i.filter(ae(l, h)).sort((d, b) => B(d.expectedDate) - B(b.expectedDate)), c = t.filter(
277
+ ae(l, h)
277
278
  ), r = y.reduce(
278
279
  (d, b) => d + b.amount,
279
280
  0
280
- ), f = c.reduce(
281
+ ), m = c.reduce(
281
282
  (d, b) => d + b.amount,
282
283
  0
283
284
  );
@@ -303,18 +304,18 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
303
304
  }
304
305
  ),
305
306
  /* @__PURE__ */ e(D, {}),
306
- y.length > 0 && /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(
307
+ y.length > 0 && /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(
307
308
  Z,
308
309
  {
309
- subheader: /* @__PURE__ */ e(Ae, { total: r, type: te.INCOME }),
310
+ subheader: /* @__PURE__ */ e(Ae, { total: r, type: ne.INCOME }),
310
311
  sx: { width: "100%" },
311
312
  children: y.map((d) => /* @__PURE__ */ e(Ee, { recurrence: d }, d.repeatingTransactionGuid))
312
313
  }
313
314
  ) }),
314
- c.length > 0 && /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(
315
+ c.length > 0 && /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(
315
316
  Z,
316
317
  {
317
- subheader: /* @__PURE__ */ e(Ae, { total: f, type: te.EXPENSE }),
318
+ subheader: /* @__PURE__ */ e(Ae, { total: m, type: ne.EXPENSE }),
318
319
  sx: { width: "100%" },
319
320
  children: c.map((d) => /* @__PURE__ */ e(Ee, { recurrence: d }, d.repeatingTransactionGuid))
320
321
  }
@@ -322,7 +323,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
322
323
  /* @__PURE__ */ e(
323
324
  Ct,
324
325
  {
325
- remaining: (l.available_balance || l.balance || 0) + r - f
326
+ remaining: (l.available_balance || l.balance || 0) + r - m
326
327
  }
327
328
  )
328
329
  ]
@@ -332,13 +333,13 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
332
333
  }) })
333
334
  ] });
334
335
  }, It = T(wt), Dt = () => {
335
- const { availableWidth: a } = ie(), n = ae(), { cashflow: t } = L(), { upcomingExpenses: i, upcomingIncome: u } = P(), { dateRange: g, selectedCashAccounts: l } = V(), y = [
336
+ const { availableWidth: a } = re(), n = ie(), { cashflow: t } = L(), { upcomingExpenses: i, upcomingIncome: h } = P(), { dateRange: g, selectedCashAccounts: l } = V(), y = [
336
337
  {
337
338
  field: "account",
338
339
  flex: 1.5,
339
340
  headerName: t.accounts,
340
- renderCell: ({ value: { name: r, nickname: f, institution_guid: d, account_number: b } }) => {
341
- const C = f || r;
341
+ renderCell: ({ value: { name: r, nickname: m, institution_guid: d, account_number: b } }) => {
342
+ const C = m || r;
342
343
  return /* @__PURE__ */ o(s, { alignItems: "center", flexDirection: "row", gap: 12, children: [
343
344
  /* @__PURE__ */ e(
344
345
  be,
@@ -348,7 +349,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
348
349
  size: 16
349
350
  }
350
351
  ),
351
- /* @__PURE__ */ e(m, { variant: "body2", children: `${C} ${b ? `*${b}` : ""}` })
352
+ /* @__PURE__ */ e(u, { variant: "body2", children: `${C} ${b ? `*${b}` : ""}` })
352
353
  ] });
353
354
  }
354
355
  },
@@ -357,21 +358,21 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
357
358
  flex: 1,
358
359
  headerName: t.balance,
359
360
  type: "number",
360
- renderCell: (r) => /* @__PURE__ */ e(m, { color: n.palette.text.primary, variant: "Small", children: J(r.value, "0,0.00") })
361
+ renderCell: (r) => /* @__PURE__ */ e(u, { color: n.palette.text.primary, variant: "Small", children: J(r.value, "0,0.00") })
361
362
  },
362
363
  {
363
364
  field: "income",
364
365
  flex: 1,
365
366
  headerName: t.projected_income,
366
367
  type: "number",
367
- renderCell: (r) => /* @__PURE__ */ e(m, { color: n.palette.text.primary, variant: "Small", children: `+${J(r.value, "0,0.00")}` })
368
+ renderCell: (r) => /* @__PURE__ */ e(u, { color: n.palette.text.primary, variant: "Small", children: `+${J(r.value, "0,0.00")}` })
368
369
  },
369
370
  {
370
371
  field: "expenses",
371
372
  flex: 1.1,
372
373
  headerName: t.projected_expenses,
373
374
  type: "number",
374
- renderCell: (r) => /* @__PURE__ */ e(m, { color: n.palette.text.primary, variant: "Small", children: `-${J(r.value, "0,0.00")}` })
375
+ renderCell: (r) => /* @__PURE__ */ e(u, { color: n.palette.text.primary, variant: "Small", children: `-${J(r.value, "0,0.00")}` })
375
376
  },
376
377
  {
377
378
  field: "remaining",
@@ -379,32 +380,32 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
379
380
  headerName: t.remaining,
380
381
  type: "number",
381
382
  renderCell: (r) => {
382
- const f = r.row.balance + r.row.income - r.row.expenses;
383
+ const m = r.row.balance + r.row.income - r.row.expenses;
383
384
  return /* @__PURE__ */ e(
384
- m,
385
+ u,
385
386
  {
386
- color: Math.sign(f) === -1 ? n.palette.error.main : n.palette.text.primary,
387
+ color: Math.sign(m) === -1 ? n.palette.error.main : n.palette.text.primary,
387
388
  variant: "Small",
388
- children: J(f, "0,0.00")
389
+ children: J(m, "0,0.00")
389
390
  }
390
391
  );
391
392
  }
392
393
  }
393
- ], c = p.useMemo(() => l.map((r) => {
394
- const f = i.filter(
395
- oe(r, { start: F(), end: ye(F(), 30) })
396
- ).reduce((C, S) => C + S.amount, 0), d = u.filter(
397
- oe(r, { start: F(), end: ye(F(), 30) })
398
- ).reduce((C, S) => C + S.amount, 0), b = (r.balance || 0) + d - f;
394
+ ], c = f.useMemo(() => l.map((r) => {
395
+ const m = i.filter(
396
+ ae(r, { start: F(), end: ye(F(), 30) })
397
+ ).reduce((C, S) => C + S.amount, 0), d = h.filter(
398
+ ae(r, { start: F(), end: ye(F(), 30) })
399
+ ).reduce((C, S) => C + S.amount, 0), b = (r.balance || 0) + d - m;
399
400
  return {
400
401
  account: r,
401
402
  balance: r.balance || 0,
402
403
  id: r.guid,
403
404
  income: d,
404
- expenses: f,
405
+ expenses: m,
405
406
  remaining: b
406
407
  };
407
- }), [l, i, u]);
408
+ }), [l, i, h]);
408
409
  return /* @__PURE__ */ o(
409
410
  I,
410
411
  {
@@ -421,7 +422,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
421
422
  children: [
422
423
  /* @__PURE__ */ o(s, { alignItems: "center", direction: "row", gap: 8, children: [
423
424
  /* @__PURE__ */ e(
424
- m,
425
+ u,
425
426
  {
426
427
  bold: !0,
427
428
  sx: {
@@ -439,7 +440,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
439
440
  }
440
441
  )
441
442
  ] }),
442
- /* @__PURE__ */ o(m, { bold: !0, sx: { fontSize: 15, whiteSpace: "normal" }, children: [
443
+ /* @__PURE__ */ o(u, { bold: !0, sx: { fontSize: 15, whiteSpace: "normal" }, children: [
443
444
  Y(g.start, Q.FULL_MONTH_DAY),
444
445
  " -",
445
446
  " ",
@@ -479,7 +480,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
479
480
  }
480
481
  }
481
482
  ) : c.map((r) => {
482
- const { name: f, nickname: d, institution_guid: b, account_number: C } = r.account, S = d || f;
483
+ const { name: m, nickname: d, institution_guid: b, account_number: C } = r.account, S = d || m;
483
484
  return /* @__PURE__ */ e(
484
485
  Z,
485
486
  {
@@ -489,7 +490,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
489
490
  borderRadius: 1,
490
491
  marginBottom: 24
491
492
  },
492
- children: /* @__PURE__ */ e(ee, { sx: { minHeight: "auto" }, children: /* @__PURE__ */ o(s, { width: "100%", children: [
493
+ children: /* @__PURE__ */ e(te, { sx: { minHeight: "auto" }, children: /* @__PURE__ */ o(s, { width: "100%", children: [
493
494
  /* @__PURE__ */ o(
494
495
  s,
495
496
  {
@@ -508,7 +509,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
508
509
  size: 16
509
510
  }
510
511
  ),
511
- /* @__PURE__ */ e(m, { variant: "Small", children: `${S} ${C ? `*${C}` : ""}` })
512
+ /* @__PURE__ */ e(u, { variant: "Small", children: `${S} ${C ? `*${C}` : ""}` })
512
513
  ] }),
513
514
  /* @__PURE__ */ e(R, { amount: r.balance, bold: !0, variant: "Small" })
514
515
  ]
@@ -524,7 +525,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
524
525
  px: 16,
525
526
  py: 12,
526
527
  children: [
527
- /* @__PURE__ */ e(m, { variant: "Small", children: t.projected_income }),
528
+ /* @__PURE__ */ e(u, { variant: "Small", children: t.projected_income }),
528
529
  /* @__PURE__ */ e(R, { amount: r.income, bold: !0, symbol: "+", variant: "Small" })
529
530
  ]
530
531
  }
@@ -539,7 +540,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
539
540
  px: 16,
540
541
  py: 12,
541
542
  children: [
542
- /* @__PURE__ */ e(m, { variant: "Small", children: t.projected_expenses }),
543
+ /* @__PURE__ */ e(u, { variant: "Small", children: t.projected_expenses }),
543
544
  /* @__PURE__ */ e(R, { amount: r.expenses, bold: !0, symbol: "-", variant: "Small" })
544
545
  ]
545
546
  }
@@ -568,10 +569,10 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
568
569
  }
569
570
  );
570
571
  }, vt = T(Dt), Et = () => {
571
- const { cashflow: a } = L(), { isDesktop: n } = de(), { onEvent: t } = Ne(), [i, u] = p.useState(0), g = (l, y) => {
572
- u(y);
572
+ const { cashflow: a } = L(), { isDesktop: n } = de(), { onEvent: t } = Ne(), [i, h] = f.useState(0), g = (l, y) => {
573
+ h(y);
573
574
  };
574
- return p.useEffect(() => {
575
+ return f.useEffect(() => {
575
576
  t(i === 0 ? "cash_flow_summary" : "cash_flow_details");
576
577
  }, [i]), /* @__PURE__ */ o(I, { children: [
577
578
  /* @__PURE__ */ o(
@@ -613,12 +614,12 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
613
614
  /* @__PURE__ */ e(Ce, { index: 0, name: "cashflow", value: i, children: /* @__PURE__ */ e(I, { sx: { m: n ? 48 : 16 }, children: /* @__PURE__ */ e(vt, {}) }) }),
614
615
  /* @__PURE__ */ e(Ce, { index: 1, name: "cashflow", value: i, children: /* @__PURE__ */ e(I, { sx: { m: n ? 48 : 16 }, children: /* @__PURE__ */ e(It, {}) }) })
615
616
  ] });
616
- }, At = T(Et), ne = ({
617
+ }, At = T(Et), oe = ({
617
618
  amount: a,
618
619
  isMobile: n = !1,
619
620
  isTotal: t = !1,
620
621
  label: i,
621
- symbol: u,
622
+ symbol: h,
622
623
  tooltip: g
623
624
  }) => /* @__PURE__ */ o(
624
625
  s,
@@ -631,52 +632,52 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
631
632
  children: [
632
633
  !n && /* @__PURE__ */ e(R, { amount: a, component: "h2", variant: "H2" }),
633
634
  /* @__PURE__ */ o(s, { alignItems: "center", component: "span", direction: "row", gap: 8, mt: 2, children: [
634
- /* @__PURE__ */ e(m, { bold: t, variant: "Small", children: i }),
635
+ /* @__PURE__ */ e(u, { bold: t, variant: "Small", children: i }),
635
636
  g
636
637
  ] }),
637
- n && /* @__PURE__ */ e(R, { amount: a, component: "h2", symbol: u, variant: "Small" })
638
+ n && /* @__PURE__ */ e(R, { amount: a, component: "h2", symbol: h, variant: "Small" })
638
639
  ]
639
640
  }
640
641
  ), Te = (a, n) => (t) => t.accountGuid && a.includes(t.accountGuid) && (We(t.expectedDate) || He(t.expectedDate, n.start)) && Fe(t.expectedDate, n.end), Tt = () => {
641
- const { availableWidth: a } = ie(), { cashflow: n } = L(), { upcomingExpenses: t, upcomingIncome: i } = P(), { selectedAccountGuids: u } = X(), { dateRange: g, selectedCashAccounts: l } = V(), { userProfile: y } = Oe(), [c, r] = p.useState(!1), f = p.useMemo(
642
- () => t.filter(Te(u, g)),
643
- [g, u, t]
644
- ), d = p.useMemo(
645
- () => i.filter(Te(u, g)),
646
- [g, u, i]
647
- ), b = p.useMemo(
642
+ const { availableWidth: a } = re(), { cashflow: n } = L(), { upcomingExpenses: t, upcomingIncome: i } = P(), { selectedAccountGuids: h } = X(), { dateRange: g, selectedCashAccounts: l } = V(), { userProfile: y } = Oe(), [c, r] = f.useState(!1), m = f.useMemo(
643
+ () => t.filter(Te(h, g)),
644
+ [g, h, t]
645
+ ), d = f.useMemo(
646
+ () => i.filter(Te(h, g)),
647
+ [g, h, i]
648
+ ), b = f.useMemo(
648
649
  () => l.reduce((E, _) => E + (_?.balance || 0), 0),
649
650
  [l]
650
- ), C = f.reduce((E, _) => E + _.amount, 0), S = d.reduce((E, _) => E + _.amount, 0), v = b - C + S, h = a < 725;
651
- return /* @__PURE__ */ o(s, { sx: { mx: h ? 16 : 0, my: h ? 24 : 42 }, children: [
651
+ ), C = m.reduce((E, _) => E + _.amount, 0), S = d.reduce((E, _) => E + _.amount, 0), v = b - C + S, p = a < 725;
652
+ return /* @__PURE__ */ o(s, { sx: { mx: p ? 16 : 0, my: p ? 24 : 42 }, children: [
652
653
  /* @__PURE__ */ o(
653
654
  s,
654
655
  {
655
- border: h ? "1px solid" : "none",
656
+ border: p ? "1px solid" : "none",
656
657
  borderColor: "border.light",
657
658
  borderRadius: 2,
658
- flexDirection: h ? "column" : "row",
659
- gap: h ? 0 : 24,
659
+ flexDirection: p ? "column" : "row",
660
+ gap: p ? 0 : 24,
660
661
  justifyContent: "center",
661
662
  children: [
662
663
  /* @__PURE__ */ e(
663
- ne,
664
+ oe,
664
665
  {
665
666
  amount: b,
666
- isMobile: h,
667
+ isMobile: p,
667
668
  label: n.cash_and_bank
668
669
  }
669
670
  ),
670
- h && /* @__PURE__ */ e(D, {}),
671
+ p && /* @__PURE__ */ e(D, {}),
671
672
  y?.has_completed_cash_flow_onboarding ? /* @__PURE__ */ o(U, { children: [
672
- !h && /* @__PURE__ */ e(m, { sx: { fontSize: 25, lineHeight: 1 }, children: "+" }),
673
+ !p && /* @__PURE__ */ e(u, { sx: { fontSize: 25, lineHeight: 1 }, children: "+" }),
673
674
  /* @__PURE__ */ e(
674
- ne,
675
+ oe,
675
676
  {
676
677
  amount: S,
677
- isMobile: h,
678
+ isMobile: p,
678
679
  label: n.to_be_received,
679
- symbol: h ? "+" : void 0
680
+ symbol: p ? "+" : void 0
680
681
  }
681
682
  )
682
683
  ] }) : /* @__PURE__ */ e(
@@ -688,23 +689,23 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
688
689
  children: n.add_income
689
690
  }
690
691
  ),
691
- h ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(m, { sx: { fontSize: 25, lineHeight: 1 }, children: "-" }),
692
+ p ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(u, { sx: { fontSize: 25, lineHeight: 1 }, children: "-" }),
692
693
  /* @__PURE__ */ e(
693
- ne,
694
+ oe,
694
695
  {
695
696
  amount: C,
696
- isMobile: h,
697
+ isMobile: p,
697
698
  label: n.to_be_paid_out,
698
- symbol: h ? "-" : void 0
699
+ symbol: p ? "-" : void 0
699
700
  }
700
701
  ),
701
- h ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(m, { sx: { fontSize: 25, lineHeight: 1 }, children: "=" }),
702
+ p ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(u, { sx: { fontSize: 25, lineHeight: 1 }, children: "=" }),
702
703
  /* @__PURE__ */ e(
703
- ne,
704
+ oe,
704
705
  {
705
706
  amount: v,
706
- isMobile: h,
707
- isTotal: h,
707
+ isMobile: p,
708
+ isTotal: p,
708
709
  label: n.remaining_cash,
709
710
  tooltip: /* @__PURE__ */ e(
710
711
  me,
@@ -731,7 +732,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
731
732
  )
732
733
  ] });
733
734
  }, Rt = T(Tt), Lt = ({ handleNextStep: a }) => {
734
- const { completeOnboarding: n } = le(), { cashflow: t } = L(), i = ae();
735
+ const { completeOnboarding: n } = le(), { cashflow: t } = L(), i = ie();
735
736
  return /* @__PURE__ */ o(s, { children: [
736
737
  /* @__PURE__ */ e(ce, { pb: 12, children: t.welcome_title }),
737
738
  /* @__PURE__ */ e(
@@ -805,7 +806,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
805
806
  CASHFLOW_LOADING_ANIMATION: `${Re}/loading-animation.gif`
806
807
  }, Ot = () => {
807
808
  const { cashflow: a } = L();
808
- return /* @__PURE__ */ o(p.Fragment, { children: [
809
+ return /* @__PURE__ */ o(f.Fragment, { children: [
809
810
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("img", { alt: "Loading", src: Ge.CASHFLOW_LOADING_ANIMATION }) }),
810
811
  /* @__PURE__ */ e(ce, { pb: 12, children: a.loading_title }),
811
812
  /* @__PURE__ */ e(N, { children: a.loading_description })
@@ -818,7 +819,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
818
819
  transform: rotate(360deg);
819
820
  }
820
821
  `, Ft = () => {
821
- const { addRepeatingTransaction: a, repeatingTransactions: n } = P(), { cashflow: t, common: i } = L(), { completeOnboarding: u } = le(), { isDirty: g } = V(), { isMobile: l } = de(), { isCopyLoaded: y, setDisplayedDate: c } = X(), { filter: r, setFilter: f, transactions: d } = ke(), b = ae(), [C, S] = K(!0), [v, h] = p.useState(ut.EveryMonth), [E, _] = p.useState(1), [W, j] = p.useState(15), [w, $] = K(!1), [O, he] = K(1), [k, je] = K([]), [pe, se] = K(""), H = p.useMemo(
822
+ const { addRepeatingTransaction: a, repeatingTransactions: n } = P(), { cashflow: t, common: i } = L(), { completeOnboarding: h } = le(), { isDirty: g } = V(), { isMobile: l } = de(), { isCopyLoaded: y, setDisplayedDate: c } = X(), { filter: r, setFilter: m, transactions: d } = ke(), b = ie(), [C, S] = K(!0), [v, p] = f.useState(ut.EveryMonth), [E, _] = f.useState(1), [W, j] = f.useState(15), [w, $] = K(!1), [O, he] = K(1), [k, je] = K([]), [pe, se] = K(""), H = f.useMemo(
822
823
  () => d.find((x) => x.guid === pe),
823
824
  [pe, d]
824
825
  ), ze = !!n.filter(
@@ -828,7 +829,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
828
829
  // Beginning of the month, 90 days before today
829
830
  lt(Me(F(), 90)),
830
831
  F()
831
- ), f({ ...r, custom: Se }), he(3);
832
+ ), m({ ...r, custom: Se }), he(3);
832
833
  }, Be = async () => {
833
834
  if (!(k.length < 1)) {
834
835
  $(!0);
@@ -846,7 +847,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
846
847
  };
847
848
  await a(Pe, A);
848
849
  }
849
- await u();
850
+ await h();
850
851
  }
851
852
  }, Ue = !H && C || !H && k.length < 1;
852
853
  return y ? /* @__PURE__ */ o(
@@ -891,7 +892,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
891
892
  /* @__PURE__ */ e(ce, { pb: 12, children: t.add_income_title }),
892
893
  /* @__PURE__ */ e(N, { mb: 24, children: t.add_income_description }),
893
894
  k.length > 0 && !H && /* @__PURE__ */ o(U, { children: [
894
- /* @__PURE__ */ e(Z, { children: k.map((x, A) => /* @__PURE__ */ o(p.Fragment, { children: [
895
+ /* @__PURE__ */ e(Z, { children: k.map((x, A) => /* @__PURE__ */ o(f.Fragment, { children: [
895
896
  /* @__PURE__ */ e(dt, { bgcolor: "background.paper", children: ht(
896
897
  B(x.nextDate || x.date)
897
898
  ) }),
@@ -914,7 +915,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
914
915
  it,
915
916
  {
916
917
  bgcolor: "background.paper",
917
- onSearch: (x) => f({
918
+ onSearch: (x) => m({
918
919
  ...r,
919
920
  custom: (A) => x ? rt(A, x) : Se(A)
920
921
  }),
@@ -932,7 +933,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
932
933
  firstDay: E,
933
934
  frequency: v,
934
935
  onFirstDayChange: _,
935
- onFrequencyChange: h,
936
+ onFrequencyChange: p,
936
937
  onSecondDayChange: j,
937
938
  secondDay: W,
938
939
  transaction: H
@@ -986,27 +987,27 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
986
987
  children: t.confirm_income_button
987
988
  }
988
989
  ),
989
- /* @__PURE__ */ e(M, { onClick: u, variant: "outlined", children: t.skip_button })
990
+ /* @__PURE__ */ e(M, { onClick: h, variant: "outlined", children: t.skip_button })
990
991
  ] })
991
992
  ]
992
993
  }
993
994
  )
994
995
  ]
995
996
  }
996
- ) : /* @__PURE__ */ e(re, {});
997
+ ) : /* @__PURE__ */ e(ee, {});
997
998
  }, Wt = T(Ft), $t = ({ onBackClick: a, sx: n = {} }) => {
998
999
  const {
999
1000
  selectedAccounts: t,
1000
1001
  selectedAccountGuids: i,
1001
- setSelectedAccounts: u,
1002
+ setSelectedAccounts: h,
1002
1003
  shouldDisableNextDate: g,
1003
1004
  shouldDisablePrevDate: l
1004
- } = X(), { onEvent: y } = Ne(), { visibleCashAccounts: c } = Le(), { setFilter: r } = ke(), { userProfile: f } = Oe(), { dateRange: d, setSelectedCashAccounts: b } = V(), { loadRepeatingTransactions: C, setDateRange: S } = P(), { cashflow: v, recurring: h } = L(), { isCopyLoaded: E, isInitialized: _ } = X(), [W, j] = p.useState(!1);
1005
- return p.useEffect(() => {
1005
+ } = X(), { onEvent: y } = Ne(), { visibleCashAccounts: c } = Le(), { setFilter: r } = ke(), { userProfile: m } = Oe(), { dateRange: d, setSelectedCashAccounts: b } = V(), { loadRepeatingTransactions: C, setDateRange: S } = P(), { cashflow: v, recurring: p } = L(), { isCopyLoaded: E, isInitialized: _ } = X(), [W, j] = f.useState(!1);
1006
+ return f.useEffect(() => {
1006
1007
  _ && (S(d), C().finally());
1007
- }, [_]), p.useEffect(() => {
1008
- u(c);
1009
- }, [c]), p.useEffect(() => {
1008
+ }, [_]), f.useEffect(() => {
1009
+ h(c);
1010
+ }, [c]), f.useEffect(() => {
1010
1011
  const w = c.map((O) => O.guid), $ = t.filter(
1011
1012
  (O) => i.includes(O.guid) && w.includes(O.guid)
1012
1013
  );
@@ -1014,13 +1015,13 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
1014
1015
  dateRange: { start: Me(F(), 90), end: pt() },
1015
1016
  accounts: $.map((O) => O.guid)
1016
1017
  });
1017
- }, [c, t]), !E || !_ ? /* @__PURE__ */ e(re, {}) : f?.has_completed_cash_flow_onboarding ? /* @__PURE__ */ o(
1018
+ }, [c, t]), !E || !_ ? /* @__PURE__ */ e(ee, {}) : m?.has_completed_cash_flow_onboarding ? /* @__PURE__ */ o(
1018
1019
  De,
1019
1020
  {
1020
1021
  accountOptions: c,
1021
1022
  actions: [
1022
1023
  {
1023
- label: h.action_title,
1024
+ label: p.action_title,
1024
1025
  iconName: "credit_card_gear",
1025
1026
  onClick: () => {
1026
1027
  j(!0), y(ve.CASH_FLOW_CLICK_SETTINGS);
@@ -1050,7 +1051,7 @@ const St = ({ recurrence: a }) => /* @__PURE__ */ o(U, { children: [
1050
1051
  isOpen: W,
1051
1052
  onClose: () => j(!1),
1052
1053
  shouldShowHeaderBorders: !1,
1053
- title: h.action_title,
1054
+ title: p.action_title,
1054
1055
  children: /* @__PURE__ */ e(Ke, {})
1055
1056
  }
1056
1057
  )