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