@mx-cartographer/experiences 9.7.155 → 9.7.157
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/CHANGELOG.md +14 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +6 -5
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js +19 -22
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +44 -49
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +37 -41
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BlockErrorMessage.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js +17 -0
- package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +116 -120
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +14 -18
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.d.ts +0 -6
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +34 -26
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.d.ts +4 -4
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +239 -220
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js +36 -32
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js +4 -8
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -28
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/HelpBlock.es.js +11 -14
- package/dist/insights-v2/actionBlocks/HelpBlock/HelpBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +28 -30
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +53 -55
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +26 -31
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +38 -41
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js +11 -16
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +39 -42
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +76 -78
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as
|
|
1
|
+
import C from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as P, useGlobalCopyStore as S } from "../../../common/context/hooks.es.js";
|
|
3
3
|
import A from "../../../common/components/Loader.es.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import G from "@
|
|
12
|
-
import
|
|
4
|
+
import { BlockErrorMessage as w } from "../BlockErrorMessage.es.js";
|
|
5
|
+
import { isPayoffPossible as k } from "./payoff.es.js";
|
|
6
|
+
import { buildPayoffRows as F, initialPayoffInputs as R, parsePayoffInputs as B, resolvePrimaryAccount as D, validatePayoffInputs as E } from "./layout.es.js";
|
|
7
|
+
import { CalculationFailed as L, PayoffResults as $ } from "./PayoffResults.es.js";
|
|
8
|
+
import c from "react";
|
|
9
|
+
import { observer as j } from "mobx-react-lite";
|
|
10
|
+
import u from "@mui/material/Stack";
|
|
11
|
+
import { InstitutionLogo as T, Text as x, TextField as G } from "@mxenabled/mxui";
|
|
12
|
+
import M from "@mui/material/Button";
|
|
13
|
+
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
13
14
|
import N from "@mui/material/InputAdornment";
|
|
14
|
-
var
|
|
15
|
-
const { accountsLoaded: t, loadAccounts:
|
|
16
|
-
|
|
17
|
-
!i.primary_account && !t &&
|
|
15
|
+
var et = ({ beat: i }) => {
|
|
16
|
+
const { accountsLoaded: t, loadAccounts: n } = P();
|
|
17
|
+
c.useEffect(() => {
|
|
18
|
+
!i.primary_account && !t && n();
|
|
18
19
|
}, []);
|
|
19
20
|
}, O = ({ account: i, copy: t }) => {
|
|
20
|
-
const
|
|
21
|
+
const n = c.useId(), [a, f] = c.useState(() => R(i)), [l, g] = c.useState({}), [d, v] = c.useState({ status: "idle" }), y = i ? C(i) : "", I = (e) => (s) => f((r) => ({
|
|
21
22
|
...r,
|
|
22
|
-
[e]:
|
|
23
|
-
})),
|
|
23
|
+
[e]: s.target.value
|
|
24
|
+
})), _ = (e) => {
|
|
24
25
|
e.preventDefault();
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
const { balance: r, interestRate:
|
|
28
|
-
v(
|
|
26
|
+
const s = E(a, t);
|
|
27
|
+
if (g(s), Object.keys(s).length > 0) return;
|
|
28
|
+
const { balance: r, interestRate: h, monthlyPayment: b } = B(a);
|
|
29
|
+
v(k(h, r, b) ? {
|
|
29
30
|
status: "calculated",
|
|
30
|
-
rows: F(
|
|
31
|
+
rows: F(h, r, b)
|
|
31
32
|
} : { status: "failed" });
|
|
32
|
-
},
|
|
33
|
-
error: !!
|
|
33
|
+
}, p = (e, s, r) => /* @__PURE__ */ o(G, {
|
|
34
|
+
error: !!l[e],
|
|
34
35
|
fullWidth: !0,
|
|
35
|
-
helperText:
|
|
36
|
-
id: `${
|
|
37
|
-
label:
|
|
38
|
-
onChange:
|
|
36
|
+
helperText: l[e],
|
|
37
|
+
id: `${n}-${e}`,
|
|
38
|
+
label: s,
|
|
39
|
+
onChange: I(e),
|
|
39
40
|
slotProps: {
|
|
40
41
|
htmlInput: { inputMode: "decimal" },
|
|
41
42
|
input: { [r.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */ o(N, {
|
|
@@ -46,59 +47,59 @@ var tt = ({ beat: i }) => {
|
|
|
46
47
|
},
|
|
47
48
|
value: a[e]
|
|
48
49
|
});
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
+
return /* @__PURE__ */ m(u, {
|
|
50
51
|
component: "form",
|
|
51
52
|
noValidate: !0,
|
|
52
|
-
onSubmit:
|
|
53
|
+
onSubmit: _,
|
|
53
54
|
sx: { p: 16 },
|
|
54
55
|
children: [
|
|
55
|
-
|
|
56
|
+
y && /* @__PURE__ */ m(u, {
|
|
56
57
|
sx: {
|
|
57
58
|
alignItems: "center",
|
|
58
59
|
flexDirection: "row",
|
|
59
60
|
gap: 8
|
|
60
61
|
},
|
|
61
|
-
children: [/* @__PURE__ */ o(
|
|
62
|
+
children: [/* @__PURE__ */ o(T, {
|
|
62
63
|
alt: "",
|
|
63
64
|
institutionGuid: i?.institution_guid ?? "",
|
|
64
65
|
size: 24
|
|
65
|
-
}), /* @__PURE__ */ o(
|
|
66
|
+
}), /* @__PURE__ */ o(x, {
|
|
66
67
|
component: "p",
|
|
67
68
|
variant: "body2",
|
|
68
|
-
children:
|
|
69
|
+
children: y
|
|
69
70
|
})]
|
|
70
71
|
}),
|
|
71
|
-
/* @__PURE__ */ o(
|
|
72
|
+
/* @__PURE__ */ o(x, {
|
|
72
73
|
color: "text.secondary",
|
|
73
74
|
component: "p",
|
|
74
75
|
sx: { mt: 16 },
|
|
75
76
|
variant: "body2",
|
|
76
77
|
children: t.description
|
|
77
78
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ m(u, {
|
|
79
80
|
sx: {
|
|
80
81
|
gap: 24,
|
|
81
82
|
pb: 24,
|
|
82
83
|
pt: 32
|
|
83
84
|
},
|
|
84
|
-
children: [
|
|
85
|
+
children: [p("balance", t.credit_card_balance, {
|
|
85
86
|
position: "start",
|
|
86
87
|
symbol: "$"
|
|
87
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ m(u, {
|
|
88
89
|
sx: {
|
|
89
90
|
flexDirection: "row",
|
|
90
91
|
gap: 16
|
|
91
92
|
},
|
|
92
|
-
children: [
|
|
93
|
+
children: [p("interestRate", t.interest_rate, {
|
|
93
94
|
position: "end",
|
|
94
95
|
symbol: "%"
|
|
95
|
-
}),
|
|
96
|
+
}), p("monthlyPayment", t.monthly_payment, {
|
|
96
97
|
position: "start",
|
|
97
98
|
symbol: "$"
|
|
98
99
|
})]
|
|
99
100
|
})]
|
|
100
101
|
}),
|
|
101
|
-
/* @__PURE__ */ o(
|
|
102
|
+
/* @__PURE__ */ o(M, {
|
|
102
103
|
fullWidth: !0,
|
|
103
104
|
sx: {
|
|
104
105
|
mb: 24,
|
|
@@ -108,25 +109,22 @@ var tt = ({ beat: i }) => {
|
|
|
108
109
|
variant: "contained",
|
|
109
110
|
children: t.calculate
|
|
110
111
|
}),
|
|
111
|
-
|
|
112
|
+
d.status === "failed" ? /* @__PURE__ */ o(L, { copy: t }) : /* @__PURE__ */ o($, {
|
|
112
113
|
copy: t,
|
|
113
|
-
rows:
|
|
114
|
+
rows: d.status === "calculated" ? d.rows : void 0
|
|
114
115
|
})
|
|
115
116
|
]
|
|
116
117
|
});
|
|
117
|
-
},
|
|
118
|
-
const {
|
|
119
|
-
return
|
|
120
|
-
account: D(t,
|
|
121
|
-
copy:
|
|
122
|
-
}, t.guid) : /* @__PURE__ */ o(
|
|
123
|
-
sx: { p: 24 },
|
|
124
|
-
children: /* @__PURE__ */ o(h, { children: s?.error_message })
|
|
125
|
-
});
|
|
118
|
+
}, rt = j(function({ beat: t }) {
|
|
119
|
+
const { insights_feed: n } = S(), { accounts: a, accountsLoaded: f } = P(), l = n?.payoff_calculator;
|
|
120
|
+
return l ? !t.primary_account && !f ? /* @__PURE__ */ o(A, {}) : /* @__PURE__ */ o(O, {
|
|
121
|
+
account: D(t, a),
|
|
122
|
+
copy: l
|
|
123
|
+
}, t.guid) : /* @__PURE__ */ o(w, {});
|
|
126
124
|
});
|
|
127
125
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
rt as PayoffCalculatorBlock,
|
|
127
|
+
et as usePayoffCalculatorPrepare
|
|
130
128
|
};
|
|
131
129
|
|
|
132
130
|
//# sourceMappingURL=PayoffCalculatorBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffCalculatorBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Button from '@mui/material/Button'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport {\n buildPayoffRows,\n initialPayoffInputs,\n parsePayoffInputs,\n resolvePrimaryAccount,\n validatePayoffInputs,\n type PayoffErrors,\n type PayoffField,\n type PayoffInputs,\n type PayoffRow,\n} from './layout'\nimport { isPayoffPossible } from './payoff'\nimport { CalculationFailed, PayoffResults } from './PayoffResults'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const usePayoffCalculatorPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\ntype Outcome =\n | { status: 'idle' }\n | { status: 'calculated'; rows: PayoffRow[] }\n | { status: 'failed' }\n\ninterface PayoffCalculatorFormProps {\n account?: Account\n copy: PayoffCalculatorCopy\n}\n\nconst PayoffCalculatorForm = ({ account, copy }: PayoffCalculatorFormProps) => {\n const id = React.useId()\n const [inputs, setInputs] = React.useState<PayoffInputs>(() => initialPayoffInputs(account))\n const [errors, setErrors] = React.useState<PayoffErrors>({})\n const [outcome, setOutcome] = React.useState<Outcome>({ status: 'idle' })\n\n const accountName = account ? getAccountDisplayName(account) : ''\n\n const setField = (field: PayoffField) => (event: React.ChangeEvent<HTMLInputElement>) =>\n setInputs((previous) => ({ ...previous, [field]: event.target.value }))\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n\n const nextErrors = validatePayoffInputs(inputs, copy)\n\n setErrors(nextErrors)\n if (Object.keys(nextErrors).length > 0) return\n\n const { balance, interestRate, monthlyPayment } = parsePayoffInputs(inputs)\n\n setOutcome(\n isPayoffPossible(interestRate, balance, monthlyPayment)\n ? { status: 'calculated', rows: buildPayoffRows(interestRate, balance, monthlyPayment) }\n : { status: 'failed' },\n )\n }\n\n const field = (\n name: PayoffField,\n label: string,\n adornment: { position: 'start' | 'end'; symbol: string },\n ) => (\n <TextField\n error={!!errors[name]}\n fullWidth={true}\n helperText={errors[name]}\n id={`${id}-${name}`}\n label={label}\n onChange={setField(name)}\n slotProps={{\n htmlInput: { inputMode: 'decimal' },\n input: {\n [adornment.position === 'start' ? 'startAdornment' : 'endAdornment']: (\n <InputAdornment aria-hidden=\"true\" position={adornment.position}>\n {adornment.symbol}\n </InputAdornment>\n ),\n },\n }}\n value={inputs[name]}\n />\n )\n\n return (\n <Stack component=\"form\" noValidate={true} onSubmit={handleSubmit} sx={{ p: 16 }}>\n {accountName && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <InstitutionLogo alt=\"\" institutionGuid={account?.institution_guid ?? ''} size={24} />\n <Text component=\"p\" variant=\"body2\">\n {accountName}\n </Text>\n </Stack>\n )}\n <Text color=\"text.secondary\" component=\"p\" sx={{ mt: 16 }} variant=\"body2\">\n {copy.description}\n </Text>\n <Stack sx={{ gap: 24, pb: 24, pt: 32 }}>\n {field('balance', copy.credit_card_balance, { position: 'start', symbol: '$' })}\n <Stack sx={{ flexDirection: 'row', gap: 16 }}>\n {field('interestRate', copy.interest_rate, { position: 'end', symbol: '%' })}\n {field('monthlyPayment', copy.monthly_payment, { position: 'start', symbol: '$' })}\n </Stack>\n </Stack>\n <Button fullWidth={true} sx={{ mb: 24, mt: 8 }} type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n {outcome.status === 'failed' ? (\n <CalculationFailed copy={copy} />\n ) : (\n <PayoffResults\n copy={copy}\n rows={outcome.status === 'calculated' ? outcome.rows : undefined}\n />\n )}\n </Stack>\n )\n}\n\n/**\n * Monthly Credit Card Interest Summary's \"Learn how to save\" drawer: the credit card payoff\n * calculator. The beat's account prefills the balance, interest rate and minimum payment; the\n * user edits them and compares the payoff at that payment, $10 more and $20 more.\n */\nexport const PayoffCalculatorBlock = observer(function PayoffCalculatorBlock({\n beat,\n}: ActionBlockProps) {\n const {
|
|
1
|
+
{"version":3,"file":"PayoffCalculatorBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Button from '@mui/material/Button'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport {\n buildPayoffRows,\n initialPayoffInputs,\n parsePayoffInputs,\n resolvePrimaryAccount,\n validatePayoffInputs,\n type PayoffErrors,\n type PayoffField,\n type PayoffInputs,\n type PayoffRow,\n} from './layout'\nimport { isPayoffPossible } from './payoff'\nimport { CalculationFailed, PayoffResults } from './PayoffResults'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const usePayoffCalculatorPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\ntype Outcome =\n | { status: 'idle' }\n | { status: 'calculated'; rows: PayoffRow[] }\n | { status: 'failed' }\n\ninterface PayoffCalculatorFormProps {\n account?: Account\n copy: PayoffCalculatorCopy\n}\n\nconst PayoffCalculatorForm = ({ account, copy }: PayoffCalculatorFormProps) => {\n const id = React.useId()\n const [inputs, setInputs] = React.useState<PayoffInputs>(() => initialPayoffInputs(account))\n const [errors, setErrors] = React.useState<PayoffErrors>({})\n const [outcome, setOutcome] = React.useState<Outcome>({ status: 'idle' })\n\n const accountName = account ? getAccountDisplayName(account) : ''\n\n const setField = (field: PayoffField) => (event: React.ChangeEvent<HTMLInputElement>) =>\n setInputs((previous) => ({ ...previous, [field]: event.target.value }))\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n\n const nextErrors = validatePayoffInputs(inputs, copy)\n\n setErrors(nextErrors)\n if (Object.keys(nextErrors).length > 0) return\n\n const { balance, interestRate, monthlyPayment } = parsePayoffInputs(inputs)\n\n setOutcome(\n isPayoffPossible(interestRate, balance, monthlyPayment)\n ? { status: 'calculated', rows: buildPayoffRows(interestRate, balance, monthlyPayment) }\n : { status: 'failed' },\n )\n }\n\n const field = (\n name: PayoffField,\n label: string,\n adornment: { position: 'start' | 'end'; symbol: string },\n ) => (\n <TextField\n error={!!errors[name]}\n fullWidth={true}\n helperText={errors[name]}\n id={`${id}-${name}`}\n label={label}\n onChange={setField(name)}\n slotProps={{\n htmlInput: { inputMode: 'decimal' },\n input: {\n [adornment.position === 'start' ? 'startAdornment' : 'endAdornment']: (\n <InputAdornment aria-hidden=\"true\" position={adornment.position}>\n {adornment.symbol}\n </InputAdornment>\n ),\n },\n }}\n value={inputs[name]}\n />\n )\n\n return (\n <Stack component=\"form\" noValidate={true} onSubmit={handleSubmit} sx={{ p: 16 }}>\n {accountName && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <InstitutionLogo alt=\"\" institutionGuid={account?.institution_guid ?? ''} size={24} />\n <Text component=\"p\" variant=\"body2\">\n {accountName}\n </Text>\n </Stack>\n )}\n <Text color=\"text.secondary\" component=\"p\" sx={{ mt: 16 }} variant=\"body2\">\n {copy.description}\n </Text>\n <Stack sx={{ gap: 24, pb: 24, pt: 32 }}>\n {field('balance', copy.credit_card_balance, { position: 'start', symbol: '$' })}\n <Stack sx={{ flexDirection: 'row', gap: 16 }}>\n {field('interestRate', copy.interest_rate, { position: 'end', symbol: '%' })}\n {field('monthlyPayment', copy.monthly_payment, { position: 'start', symbol: '$' })}\n </Stack>\n </Stack>\n <Button fullWidth={true} sx={{ mb: 24, mt: 8 }} type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n {outcome.status === 'failed' ? (\n <CalculationFailed copy={copy} />\n ) : (\n <PayoffResults\n copy={copy}\n rows={outcome.status === 'calculated' ? outcome.rows : undefined}\n />\n )}\n </Stack>\n )\n}\n\n/**\n * Monthly Credit Card Interest Summary's \"Learn how to save\" drawer: the credit card payoff\n * calculator. The beat's account prefills the balance, interest rate and minimum payment; the\n * user edits them and compares the payoff at that payment, $10 more and $20 more.\n */\nexport const PayoffCalculatorBlock = observer(function PayoffCalculatorBlock({\n beat,\n}: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accounts, accountsLoaded } = useAccountStore()\n const copy = insightsFeedCopy?.payoff_calculator\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n if (!beat.primary_account && !accountsLoaded) return <Loader />\n\n return (\n <PayoffCalculatorForm\n account={resolvePrimaryAccount(beat, accounts)}\n copy={copy}\n key={beat.guid}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAa,KAAA,CAA8B,EAAE,MAAA,EAAA,MAA6B;AACxE,QAAM,EAAE,gBAAA,GAAg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9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!m) return /* @__PURE__ */ o(i, {});
|
|
20
|
-
const p = C(r, u).map(h), f = () => c(null);
|
|
21
|
-
return /* @__PURE__ */ P(G, { children: [/* @__PURE__ */ o(b, {
|
|
22
|
-
accounts: p,
|
|
23
|
-
copy: e,
|
|
1
|
+
import { useAccountStore as m, useGlobalCopyStore as p } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import f from "../../../common/components/drawer/Drawer.es.js";
|
|
3
|
+
import d from "../../../common/components/Loader.es.js";
|
|
4
|
+
import { BlockErrorMessage as g } from "../BlockErrorMessage.es.js";
|
|
5
|
+
import { AccountDetailsBlock as y } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
|
|
6
|
+
import { buildStrategies as A, resolveStrategyAccounts as S, toPayoffAccountRow as _ } from "./layout.es.js";
|
|
7
|
+
import C from "./PayoffStrategiesContent.es.js";
|
|
8
|
+
import { useState as b } from "react";
|
|
9
|
+
import { observer as k } from "mobx-react-lite";
|
|
10
|
+
import { Fragment as v, jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
var O = k(function({ beat: e }) {
|
|
12
|
+
const [t, c] = b(null), { accounts: s, insights_feed: a } = p(), { accountsLoaded: n, visibleAccounts: i } = m(), r = a?.general;
|
|
13
|
+
if (!r) return /* @__PURE__ */ o(g, {});
|
|
14
|
+
if (!n) return /* @__PURE__ */ o(d, {});
|
|
15
|
+
const u = S(e, i).map(_), l = () => c(null);
|
|
16
|
+
return /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ o(C, {
|
|
17
|
+
accounts: u,
|
|
18
|
+
copy: r,
|
|
24
19
|
onAccountClick: c,
|
|
25
|
-
strategies:
|
|
26
|
-
}), /* @__PURE__ */ o(
|
|
27
|
-
ariaLabelClose:
|
|
20
|
+
strategies: A(r)
|
|
21
|
+
}), /* @__PURE__ */ o(f, {
|
|
22
|
+
ariaLabelClose: s?.close_account_details_aria,
|
|
28
23
|
isOpen: t !== null,
|
|
29
|
-
onClose:
|
|
30
|
-
title:
|
|
31
|
-
children: t && /* @__PURE__ */ o(
|
|
32
|
-
...
|
|
24
|
+
onClose: l,
|
|
25
|
+
title: s?.account_details,
|
|
26
|
+
children: t && /* @__PURE__ */ o(y, { beat: {
|
|
27
|
+
...e,
|
|
33
28
|
primary_account: void 0,
|
|
34
29
|
primary_account_guid: t
|
|
35
30
|
} })
|
|
36
31
|
})] });
|
|
37
32
|
});
|
|
38
33
|
export {
|
|
39
|
-
|
|
34
|
+
O as PayoffStrategiesBlock
|
|
40
35
|
};
|
|
41
36
|
|
|
42
37
|
//# sourceMappingURL=PayoffStrategiesBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport
|
|
1
|
+
{"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Drawer, Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\n/**\n * Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the\n * beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the\n * shared AccountDetailsBlock) in a nested drawer.\n */\nexport const PayoffStrategiesBlock = observer(function PayoffStrategiesBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { accounts: accountsCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accountsLoaded, visibleAccounts } = useAccountStore()\n const copy = insightsFeedCopy?.general\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n if (!accountsLoaded) return <Loader />\n\n const rows = resolveStrategyAccounts(beat, visibleAccounts).map(toPayoffAccountRow)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <PayoffStrategiesContent\n accounts={rows}\n copy={copy}\n onAccountClick={setTappedAccountGuid}\n strategies={buildStrategies(copy)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;AAiBA,IAAa,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,UAAU,GAAc,eAAe,EAAA,IAAqB,EAAmB,GACjF,EAAE,gBAAA,GAAgB,iBAAA,EAAA,IAAoB,EAAgB,GACtD,IAAO,GAAkB;AAE/B,MAAI,CAAC,EACH,QAAO,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAG7B,MAAI,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAErC,QAAM,IAAO,EAAwB,GAAM,CAAe,EAAE,IAAI,CAAkB,GAC5E,IAAA,MAA4B,EAAqB,IAAI;AAE3D,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,IACJ,MAAA;AAAA,IACN,gBAAgB;AAAA,IAChB,YAAY,EAAgB,CAAI;AAAA,EACjC,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,GAAc;AAAA,IAC9B,QAAQ,MAAsB;AAAA,IAC9B,SAAS;AAAA,IACT,OAAO,GAAc;AAAA,IAEpB,UAAA,KAEC,gBAAA,EAAC,GAAD,EACE,MAAM;AAAA,MAAE,GAAG;AAAA,MAAM,iBAAiB;AAAA,MAAW,sBAAsB;AAAA,IAAkB,EACtF,CAAA;AAAA,EAEG,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const cta = useOpenedCta(beat)\n\n return <PlaceholderVariants beat={beat} variant={cta?.variant} />\n})\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts. ActionBlockLayer mounts it once\n// copy has loaded; render `BlockErrorMessage` when its copy or data is missing.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const cta = useOpenedCta(beat)\n\n return <PlaceholderVariants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AA,IAA2B,MAAA;AAAA,IAAM,SAAS,GAAK;AAAA,EAAU,CAAA;AAClE,CAAC"}
|
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import { CategoryGuids as
|
|
2
|
-
import { DEFAULT_INSTITUTION_LOGO_URL as
|
|
3
|
-
import
|
|
4
|
-
import { useAccountStore as
|
|
1
|
+
import { CategoryGuids as f } from "../../../core/constants/Category.es.js";
|
|
2
|
+
import { DEFAULT_INSTITUTION_LOGO_URL as h } from "../../../core/constants/InstitutionLogo.es.js";
|
|
3
|
+
import _ from "../../../common/utils/AccountDisplayName.es.js";
|
|
4
|
+
import { useAccountStore as y, useAppConfig as C, useCashflowStore as x, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
|
|
5
5
|
import { getAccountStartingBalance as R } from "../../../core/utils/AccountUtils.es.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import A from "./
|
|
12
|
-
import
|
|
13
|
-
import O from "
|
|
14
|
-
import { InstitutionLogo as
|
|
15
|
-
import { jsx as
|
|
16
|
-
var
|
|
17
|
-
const {
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!d || !p || !e) return /* @__PURE__ */ n(L, {});
|
|
24
|
-
const l = a(t.selectedCashAccounts.map((o) => ({
|
|
25
|
-
amount: R(o, c.display_available_balance_in_accounts),
|
|
6
|
+
import T from "../../../common/components/Loader.es.js";
|
|
7
|
+
import { BlockErrorMessage as E } from "../BlockErrorMessage.es.js";
|
|
8
|
+
import i from "../../components/CategoryTile.es.js";
|
|
9
|
+
import { ErrorCard as L } from "../../components/ErrorCard.es.js";
|
|
10
|
+
import { useRecurringExpensesLoadState as U } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
|
|
11
|
+
import { foldOtherRows as r, getCaption as A } from "./layout.es.js";
|
|
12
|
+
import I from "./RemainingCashContent.es.js";
|
|
13
|
+
import { observer as O } from "mobx-react-lite";
|
|
14
|
+
import { InstitutionLogo as a } from "@mxenabled/mxui";
|
|
15
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
16
|
+
var J = O(function(b) {
|
|
17
|
+
const { insights_feed: s } = G(), { config: m } = C(), { uiStore: n } = x(), { accountsLoaded: c } = y(), { failed: u, ready: p, retry: d } = U(), e = s?.remaining_cash;
|
|
18
|
+
if (!e) return /* @__PURE__ */ t(E, {});
|
|
19
|
+
if (u) return /* @__PURE__ */ t(L, { onRetry: d });
|
|
20
|
+
if (!p || !c) return /* @__PURE__ */ t(T, {});
|
|
21
|
+
const g = r(n.selectedCashAccounts.map((o) => ({
|
|
22
|
+
amount: R(o, m.display_available_balance_in_accounts),
|
|
26
23
|
key: o.guid,
|
|
27
|
-
leading: /* @__PURE__ */
|
|
24
|
+
leading: /* @__PURE__ */ t(a, {
|
|
28
25
|
alt: "",
|
|
29
26
|
institutionGuid: o.institution_guid ?? "",
|
|
30
27
|
size: 32
|
|
31
28
|
}),
|
|
32
|
-
name:
|
|
29
|
+
name: _(o)
|
|
33
30
|
})), {
|
|
34
31
|
multi: e.other_accounts,
|
|
35
32
|
one: e.other_accounts_one
|
|
36
|
-
}, /* @__PURE__ */
|
|
33
|
+
}, /* @__PURE__ */ t(a, {
|
|
37
34
|
alt: "",
|
|
38
35
|
institutionGuid: "",
|
|
39
|
-
logoUrl:
|
|
36
|
+
logoUrl: h,
|
|
40
37
|
size: 32
|
|
41
|
-
})),
|
|
38
|
+
})), l = r(n.expensesTilNextIncome.map((o) => ({
|
|
42
39
|
amount: o.amount,
|
|
43
40
|
key: `${o.repeatingTransactionGuid}-${o.expectedDate.getTime()}`,
|
|
44
|
-
leading: /* @__PURE__ */
|
|
41
|
+
leading: /* @__PURE__ */ t(i, {
|
|
45
42
|
categoryGuid: o.categoryGuid,
|
|
46
43
|
size: 32
|
|
47
44
|
}),
|
|
@@ -49,33 +46,33 @@ var Q = I(function(N) {
|
|
|
49
46
|
})), {
|
|
50
47
|
multi: e.other_expenses,
|
|
51
48
|
one: e.other_expenses_one
|
|
52
|
-
}, /* @__PURE__ */
|
|
53
|
-
categoryGuid:
|
|
49
|
+
}, /* @__PURE__ */ t(i, {
|
|
50
|
+
categoryGuid: f.UNCATEGORIZED,
|
|
54
51
|
size: 32
|
|
55
52
|
}));
|
|
56
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ t(I, {
|
|
57
54
|
accounts: {
|
|
58
55
|
header: e.accounts_header,
|
|
59
|
-
rows:
|
|
56
|
+
rows: g
|
|
60
57
|
},
|
|
61
58
|
expenses: {
|
|
62
59
|
header: e.recurring_expenses_header,
|
|
63
|
-
rows:
|
|
60
|
+
rows: l
|
|
64
61
|
},
|
|
65
62
|
summary: {
|
|
66
|
-
remaining:
|
|
67
|
-
amount:
|
|
68
|
-
caption:
|
|
63
|
+
remaining: n.hasUpcomingPayday ? {
|
|
64
|
+
amount: n.remainingUntilPayday,
|
|
65
|
+
caption: A(e, n.daysUntilNextIncome)
|
|
69
66
|
} : void 0,
|
|
70
|
-
cashOnHand:
|
|
67
|
+
cashOnHand: n.selectedCashBalance,
|
|
71
68
|
cashOnHandLabel: e.cash_on_hand,
|
|
72
|
-
upcomingExpenses:
|
|
69
|
+
upcomingExpenses: n.upcomingExpensesTotal,
|
|
73
70
|
upcomingExpensesLabel: e.upcoming_expenses
|
|
74
71
|
}
|
|
75
72
|
});
|
|
76
73
|
});
|
|
77
74
|
export {
|
|
78
|
-
|
|
75
|
+
J as RemainingCashBlock
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
//# sourceMappingURL=RemainingCashBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import { InstitutionLogo } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n if (!copy) return <BlockErrorMessage />\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,eAAe,EAAA,IAAqB,EAAmB,GACzD,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB,GACrC,EAAE,QAAA,GAAQ,OAAA,GAAO,OAAA,EAAA,IAAU,EAA8B,GACzD,IAAO,GAAkB;AAE/B,MAAI,CAAC,EAAM,QAAO,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAEtC,MAAI,EAAQ,QAAO,gBAAA,EAAC,GAAD,EAAW,SAAS,EAAQ,CAAA;AAG/C,MAAI,CAAC,KAAS,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAE/C,QAAM,IAAc,EAClB,EAAQ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,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { useTransactionDetailsBlock as
|
|
4
|
-
import
|
|
1
|
+
import n from "../../../common/components/Loader.es.js";
|
|
2
|
+
import { BlockErrorMessage as e } from "../BlockErrorMessage.es.js";
|
|
3
|
+
import { useTransactionDetailsBlock as m } from "./useTransactionDetailsBlock.es.js";
|
|
4
|
+
import c from "../../../transactions/components/shared/TransactionDetails.es.js";
|
|
5
5
|
import { observer as f } from "mobx-react-lite";
|
|
6
|
-
import p from "@mui/material/Stack";
|
|
7
|
-
import { Text as d } from "@mxenabled/mxui";
|
|
8
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
-
var
|
|
10
|
-
const {
|
|
11
|
-
return
|
|
12
|
-
bottomActions:
|
|
7
|
+
var T = f(function({ beat: t }) {
|
|
8
|
+
const { bottomActions: i, isLoading: a, topActions: s, transaction: r } = m(t);
|
|
9
|
+
return a ? /* @__PURE__ */ o(n, {}) : r ? /* @__PURE__ */ o(c, {
|
|
10
|
+
bottomActions: i,
|
|
13
11
|
shouldShowEmbeddedCard: !1,
|
|
14
|
-
topActions:
|
|
12
|
+
topActions: s,
|
|
15
13
|
transaction: r
|
|
16
|
-
}) : /* @__PURE__ */ o(
|
|
17
|
-
sx: { p: 24 },
|
|
18
|
-
children: /* @__PURE__ */ o(d, { children: i.error_message })
|
|
19
|
-
});
|
|
14
|
+
}) : /* @__PURE__ */ o(e, {});
|
|
20
15
|
});
|
|
21
16
|
export {
|
|
22
|
-
|
|
17
|
+
T as TransactionDetailsBlock
|
|
23
18
|
};
|
|
24
19
|
|
|
25
20
|
//# sourceMappingURL=TransactionDetailsBlock.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { Loader } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Stale beat: its transaction was deleted or is out of window.\n if (!transaction) {\n return <BlockErrorMessage />\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n // Embedded insight card is a PFM-only concern (TransactionDetails defaults to true); this beat's own drawer must not show a redundant embedded card of itself.\n shouldShowEmbeddedCard={false}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;AAkBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAG1B,IAKH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,IAEf,wBAAwB;AAAA,IACZ,YAAA;AAAA,IACC,aAAA;AAAA,EACd,CAAA,IAVM,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAY/B,CAAC"}
|