@mx-cartographer/experiences 9.7.168 → 9.7.169
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 +4 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +10 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +118 -102
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.d.ts +8 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +140 -73
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/components/Header.es.js +4 -4
- package/dist/insights-v2/components/shared/elevation.es.js +2 -3
- package/dist/insights-v2/components/shared/elevation.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [9.7.169] - 11-17-2026
|
|
2
|
+
|
|
3
|
+
- **CHANGED** - Monthly Credit Card Interest Summary drilldown matches Figma: tabbed Standard / +0 / +0 payoff scenarios (WEC-2332)
|
|
4
|
+
|
|
1
5
|
## [9.7.168] - 11-16-2026
|
|
2
6
|
|
|
3
7
|
- **ADDED** - `clientConfig.transactions.hide_export_csv` client setting to hide Export CSV in the spending, budgets, and trends widgets (WELL-131)
|
|
@@ -438,8 +438,10 @@ export interface CreditUtilizationCopy {
|
|
|
438
438
|
}
|
|
439
439
|
/** The credit card payoff calculator drawer (`payoff_calculator_block`). */
|
|
440
440
|
export interface PayoffCalculatorCopy {
|
|
441
|
-
/** Drawer title, e.g. "
|
|
441
|
+
/** Drawer title, e.g. "Interest Charges". */
|
|
442
442
|
title: string;
|
|
443
|
+
/** Form heading above the account line, e.g. "See Where You Can Save". */
|
|
444
|
+
heading?: string;
|
|
443
445
|
description: string;
|
|
444
446
|
credit_card_balance: string;
|
|
445
447
|
interest_rate: string;
|
|
@@ -448,9 +450,16 @@ export interface PayoffCalculatorCopy {
|
|
|
448
450
|
your_results: string;
|
|
449
451
|
time_to_payoff: string;
|
|
450
452
|
total_interest_paid: string;
|
|
453
|
+
/** Scenario tabs and figures; each falls back to an older key until mrs_content sends it. */
|
|
454
|
+
standard?: string;
|
|
455
|
+
extra_payment?: string;
|
|
456
|
+
payoff?: string;
|
|
457
|
+
interest_paid?: string;
|
|
451
458
|
/** Time to payoff, `_1{number}` months: singular and plural. */
|
|
452
459
|
month: string;
|
|
453
460
|
months: string;
|
|
461
|
+
/** Short time to payoff, e.g. "_1{number} mo"; falls back to `month` / `months`. */
|
|
462
|
+
months_short?: string;
|
|
454
463
|
calculation_failed: string;
|
|
455
464
|
calculation_failed_description: string;
|
|
456
465
|
/** Validation messages; `_1{value}` is the field label and `_2{amount}` the bound. */
|
|
@@ -1,134 +1,150 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as
|
|
3
|
-
import { useRequiredCopy as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import S from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as m } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { useRequiredCopy as w } from "../useRequiredCopy.es.js";
|
|
4
|
+
import A from "../../components/SubHeader.es.js";
|
|
5
|
+
import { isPayoffPossible as I } from "./payoff.es.js";
|
|
6
|
+
import { buildPayoffRows as k, initialPayoffInputs as R, parsePayoffInputs as B, resolvePrimaryAccount as D, validatePayoffInputs as F } from "./layout.es.js";
|
|
7
|
+
import { CalculationFailed as $, PayoffResults as j } from "./PayoffResults.es.js";
|
|
8
|
+
import c from "react";
|
|
9
|
+
import { observer as E } from "mobx-react-lite";
|
|
10
|
+
import l from "@mui/material/Stack";
|
|
11
|
+
import { Text as g, TextField as L } from "@mxenabled/mxui";
|
|
11
12
|
import T from "@mui/material/Button";
|
|
12
|
-
import { jsx as
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
14
|
+
import G from "@mui/material/Box";
|
|
15
|
+
import N from "@mui/material/Divider";
|
|
16
|
+
import O from "@mui/material/InputAdornment";
|
|
17
|
+
var it = ({ beat: o }) => {
|
|
18
|
+
const { accountsLoaded: t, loadAccounts: s } = m();
|
|
19
|
+
c.useEffect(() => {
|
|
20
|
+
!o.primary_account && !t && s();
|
|
18
21
|
}, []);
|
|
19
|
-
},
|
|
20
|
-
const { accountsLoaded: t } =
|
|
22
|
+
}, st = ({ beat: o }) => {
|
|
23
|
+
const { accountsLoaded: t } = m();
|
|
21
24
|
return { ready: !!o.primary_account || t };
|
|
22
|
-
},
|
|
23
|
-
const
|
|
25
|
+
}, W = ({ account: o, copy: t }) => {
|
|
26
|
+
const s = c.useId(), [n, x] = c.useState(() => R(o)), [p, P] = c.useState({}), [d, v] = c.useState({ status: "idle" }), h = o ? S(o) : "", _ = (r) => (i) => x((a) => ({
|
|
24
27
|
...a,
|
|
25
|
-
[
|
|
26
|
-
})),
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const { balance: a, interestRate:
|
|
31
|
-
|
|
28
|
+
[r]: i.target.value
|
|
29
|
+
})), C = (r) => {
|
|
30
|
+
r.preventDefault();
|
|
31
|
+
const i = F(n, t);
|
|
32
|
+
if (P(i), Object.keys(i).length > 0) return;
|
|
33
|
+
const { balance: a, interestRate: y, monthlyPayment: b } = B(n);
|
|
34
|
+
v(I(y, a, b) ? {
|
|
32
35
|
status: "calculated",
|
|
33
|
-
rows:
|
|
36
|
+
rows: k(y, a, b)
|
|
34
37
|
} : { status: "failed" });
|
|
35
|
-
},
|
|
36
|
-
error: !!p[
|
|
38
|
+
}, f = (r, i, a) => /* @__PURE__ */ e(L, {
|
|
39
|
+
error: !!p[r],
|
|
37
40
|
fullWidth: !0,
|
|
38
|
-
helperText: p[
|
|
39
|
-
id: `${
|
|
40
|
-
label:
|
|
41
|
-
onChange:
|
|
41
|
+
helperText: p[r],
|
|
42
|
+
id: `${s}-${r}`,
|
|
43
|
+
label: i,
|
|
44
|
+
onChange: _(r),
|
|
42
45
|
slotProps: {
|
|
43
46
|
htmlInput: { inputMode: "decimal" },
|
|
44
|
-
input: { [a.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */
|
|
47
|
+
input: { [a.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */ e(O, {
|
|
45
48
|
"aria-hidden": "true",
|
|
46
49
|
position: a.position,
|
|
47
50
|
children: a.symbol
|
|
48
51
|
}) }
|
|
49
52
|
},
|
|
50
|
-
value: n[
|
|
53
|
+
value: n[r]
|
|
51
54
|
});
|
|
52
|
-
return /* @__PURE__ */ u(
|
|
53
|
-
|
|
54
|
-
noValidate: !0,
|
|
55
|
-
onSubmit: I,
|
|
56
|
-
sx: { p: 16 },
|
|
55
|
+
return /* @__PURE__ */ u(l, {
|
|
56
|
+
sx: { flexGrow: 1 },
|
|
57
57
|
children: [
|
|
58
|
-
|
|
58
|
+
/* @__PURE__ */ u(l, {
|
|
59
|
+
component: "form",
|
|
60
|
+
noValidate: !0,
|
|
61
|
+
onSubmit: C,
|
|
59
62
|
sx: {
|
|
60
|
-
|
|
61
|
-
flexDirection: "row",
|
|
62
|
-
gap: 8
|
|
63
|
-
},
|
|
64
|
-
children: [/* @__PURE__ */ r(B, {
|
|
65
|
-
alt: "",
|
|
66
|
-
institutionGuid: o?.institution_guid ?? "",
|
|
67
|
-
size: 24
|
|
68
|
-
}), /* @__PURE__ */ r(b, {
|
|
69
|
-
component: "p",
|
|
70
|
-
variant: "body2",
|
|
71
|
-
children: y
|
|
72
|
-
})]
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ r(b, {
|
|
75
|
-
color: "text.secondary",
|
|
76
|
-
component: "p",
|
|
77
|
-
sx: { mt: 16 },
|
|
78
|
-
variant: "body2",
|
|
79
|
-
children: t.description
|
|
80
|
-
}),
|
|
81
|
-
/* @__PURE__ */ u(c, {
|
|
82
|
-
sx: {
|
|
83
|
-
gap: 24,
|
|
63
|
+
bgcolor: "background.paper",
|
|
84
64
|
pb: 24,
|
|
85
|
-
|
|
65
|
+
px: 24
|
|
86
66
|
},
|
|
87
|
-
children: [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ u(l, {
|
|
69
|
+
sx: {
|
|
70
|
+
gap: 4,
|
|
71
|
+
pb: 12,
|
|
72
|
+
pt: 16
|
|
73
|
+
},
|
|
74
|
+
children: [t.heading && /* @__PURE__ */ e(g, {
|
|
75
|
+
bold: !0,
|
|
76
|
+
component: "h3",
|
|
77
|
+
variant: "h3",
|
|
78
|
+
children: t.heading
|
|
79
|
+
}), h && /* @__PURE__ */ e(A, { subtitle: {
|
|
80
|
+
logo: o?.institution_guid ? { institution_guid: o.institution_guid } : void 0,
|
|
81
|
+
text: h
|
|
82
|
+
} })]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ e(g, {
|
|
85
|
+
color: "text.secondary",
|
|
86
|
+
component: "p",
|
|
87
|
+
variant: "body2",
|
|
88
|
+
children: t.description
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ u(l, {
|
|
91
|
+
sx: {
|
|
92
|
+
gap: 24,
|
|
93
|
+
pb: 24,
|
|
94
|
+
pt: 36
|
|
95
|
+
},
|
|
96
|
+
children: [f("balance", t.credit_card_balance, {
|
|
97
|
+
position: "start",
|
|
98
|
+
symbol: "$"
|
|
99
|
+
}), /* @__PURE__ */ u(l, {
|
|
100
|
+
sx: {
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
gap: 16
|
|
103
|
+
},
|
|
104
|
+
children: [f("interestRate", t.interest_rate, {
|
|
105
|
+
position: "end",
|
|
106
|
+
symbol: "%"
|
|
107
|
+
}), f("monthlyPayment", t.monthly_payment, {
|
|
108
|
+
position: "start",
|
|
109
|
+
symbol: "$"
|
|
110
|
+
})]
|
|
111
|
+
})]
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ e(T, {
|
|
114
|
+
fullWidth: !0,
|
|
115
|
+
size: "large",
|
|
116
|
+
type: "submit",
|
|
117
|
+
variant: "contained",
|
|
118
|
+
children: t.calculate
|
|
119
|
+
})
|
|
120
|
+
]
|
|
103
121
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
122
|
+
/* @__PURE__ */ e(N, {}),
|
|
123
|
+
/* @__PURE__ */ e(G, {
|
|
106
124
|
sx: {
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
bgcolor: "background.default",
|
|
126
|
+
flexGrow: 1,
|
|
127
|
+
p: 24
|
|
109
128
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
f.status === "failed" ? /* @__PURE__ */ r(L, { copy: t }) : /* @__PURE__ */ r($, {
|
|
115
|
-
copy: t,
|
|
116
|
-
rows: f.status === "calculated" ? f.rows : void 0
|
|
129
|
+
children: d.status === "failed" ? /* @__PURE__ */ e($, { copy: t }) : /* @__PURE__ */ e(j, {
|
|
130
|
+
copy: t,
|
|
131
|
+
rows: d.status === "calculated" ? d.rows : void 0
|
|
132
|
+
})
|
|
117
133
|
})
|
|
118
134
|
]
|
|
119
135
|
});
|
|
120
|
-
},
|
|
121
|
-
const { accounts:
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
account: D(t,
|
|
136
|
+
}, q = (o) => o.insights_feed?.payoff_calculator, nt = E(function({ beat: t }) {
|
|
137
|
+
const { accounts: s } = m(), n = w(q);
|
|
138
|
+
return /* @__PURE__ */ e(W, {
|
|
139
|
+
account: D(t, s),
|
|
124
140
|
copy: n
|
|
125
141
|
}, t.guid);
|
|
126
142
|
});
|
|
127
143
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
nt as PayoffCalculatorBlock,
|
|
145
|
+
q as selectPayoffCalculatorCopy,
|
|
146
|
+
st as usePayoffCalculatorLoadState,
|
|
147
|
+
it as usePayoffCalculatorPrepare
|
|
132
148
|
};
|
|
133
149
|
|
|
134
150
|
//# 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 { useAccountStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, GlobalCopy, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps, BlockLoadState } from '../../mappings/blocks'\nimport { useRequiredCopy } from '../useRequiredCopy'\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\n/** Ready at once when the host attached the beat's account, else once the accounts load. */\nexport const usePayoffCalculatorLoadState = ({ beat }: ActionBlockProps): BlockLoadState => {\n const { accountsLoaded } = useAccountStore()\n\n return { ready: !!beat.primary_account || accountsLoaded }\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\nexport const selectPayoffCalculatorCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.payoff_calculator\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 { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffCalculatorCopy)\n\n return (\n <PayoffCalculatorForm\n account={resolvePrimaryAccount(beat, accounts)}\n copy={copy}\n key={beat.guid}\n />\n )\n})\n"],"mappings":";;;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Block.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Divider from '@mui/material/Divider'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useAccountStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, GlobalCopy, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps, BlockLoadState } from '../../mappings/blocks'\nimport SubHeader from '../../components/SubHeader'\nimport { useRequiredCopy } from '../useRequiredCopy'\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\n/** Ready at once when the host attached the beat's account, else once the accounts load. */\nexport const usePayoffCalculatorLoadState = ({ beat }: ActionBlockProps): BlockLoadState => {\n const { accountsLoaded } = useAccountStore()\n\n return { ready: !!beat.primary_account || accountsLoaded }\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 // Figma `Monthly CC Interest Summary/Drilldown`: the form on paper, a divider, then the scenario\n // card on the grey wash.\n return (\n <Stack sx={{ flexGrow: 1 }}>\n <Stack\n component=\"form\"\n noValidate={true}\n onSubmit={handleSubmit}\n sx={{ bgcolor: 'background.paper', pb: 24, px: 24 }}\n >\n <Stack sx={{ gap: 4, pb: 12, pt: 16 }}>\n {copy.heading && (\n <Text bold={true} component=\"h3\" variant=\"h3\">\n {copy.heading}\n </Text>\n )}\n {accountName && (\n <SubHeader\n subtitle={{\n logo: account?.institution_guid\n ? { institution_guid: account.institution_guid }\n : undefined,\n text: accountName,\n }}\n />\n )}\n </Stack>\n <Text color=\"text.secondary\" component=\"p\" variant=\"body2\">\n {copy.description}\n </Text>\n <Stack sx={{ gap: 24, pb: 24, pt: 36 }}>\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} size=\"large\" type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n </Stack>\n <Divider />\n <Box sx={{ bgcolor: 'background.default', flexGrow: 1, p: 24 }}>\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 </Box>\n </Stack>\n )\n}\n\nexport const selectPayoffCalculatorCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.payoff_calculator\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 { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffCalculatorCopy)\n\n return (\n <PayoffCalculatorForm\n account={resolvePrimaryAccount(beat, accounts)}\n copy={copy}\n key={beat.guid}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,IAAa,KAAA,CAA8B,EAAE,MAAA,EAAA,MAA6B;AACxE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GA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IACvC,MAAA;AAAA,EAEP,GADM,EAAK,IACX;AAEL,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { PayoffCalculatorCopy } from '../../../core';
|
|
2
2
|
import { PayoffRow } from './layout';
|
|
3
|
+
/** "_1{number} mo" when the copy has the short form, else the "month"/"months" plural. */
|
|
4
|
+
export declare const formatPayoffTime: (copy: PayoffCalculatorCopy, paymentCount: number) => string;
|
|
3
5
|
interface PayoffResultsProps {
|
|
4
6
|
copy: PayoffCalculatorCopy;
|
|
5
|
-
/** Undefined until the user has calculated: the
|
|
7
|
+
/** Undefined until the user has calculated: the figures then show placeholders. */
|
|
6
8
|
rows?: PayoffRow[];
|
|
7
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* The scenario card (Figma `Monthly CC Prediction Summary/Drilldown Content`): one tab per payment
|
|
12
|
+
* increment — Standard, +$10, +$20 — each showing the entered payment plus the extra, then the
|
|
13
|
+
* time to payoff and the interest paid at that payment.
|
|
14
|
+
*/
|
|
8
15
|
export declare const PayoffResults: ({ copy, rows }: PayoffResultsProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
16
|
export declare const CalculationFailed: ({ copy }: {
|
|
10
17
|
copy: PayoffCalculatorCopy;
|
|
@@ -1,106 +1,172 @@
|
|
|
1
|
-
import { buildPluralCopy as
|
|
2
|
-
import { CURRENCY_FORMAT as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import u from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { buildDynamicCopy as S, buildPluralCopy as w } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as c, formatCurrency as m } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { ELEVATION_SHADOW as v } from "../../components/shared/elevation.es.js";
|
|
4
|
+
import { SubTabs as T, subTabPanelProps as C } from "../../components/SubTabs.es.js";
|
|
5
|
+
import { PAYMENT_INCREMENTS as u } from "./layout.es.js";
|
|
6
|
+
import b from "react";
|
|
7
|
+
import s from "@mui/material/Stack";
|
|
8
|
+
import { Text as o } from "@mxenabled/mxui";
|
|
9
|
+
import { Icon as _ } from "@mxenabled/mx-icons";
|
|
10
|
+
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
11
|
+
import p from "@mui/material/Box";
|
|
12
|
+
import k from "@mui/material/Divider";
|
|
13
|
+
var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t < 1 ? "-" : e.months_short ? S(e.months_short, String(t)) : w(e.month, e.months, t, String(t)), y = ({ label: e, tone: t, value: a }) => /* @__PURE__ */ n(s, {
|
|
11
14
|
sx: {
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
flex: 1,
|
|
17
|
+
minWidth: 0
|
|
14
18
|
},
|
|
15
|
-
children: [/* @__PURE__ */ r(
|
|
16
|
-
color: "text.secondary",
|
|
17
|
-
component: "span",
|
|
18
|
-
variant: "caption",
|
|
19
|
-
children: o
|
|
20
|
-
}), /* @__PURE__ */ r(t, {
|
|
19
|
+
children: [/* @__PURE__ */ r(o, {
|
|
21
20
|
bold: !0,
|
|
22
|
-
color:
|
|
21
|
+
color: t,
|
|
23
22
|
component: "span",
|
|
24
23
|
sx: { transition: "color 0.5s" },
|
|
25
|
-
variant: "
|
|
24
|
+
variant: "h3",
|
|
25
|
+
children: a
|
|
26
|
+
}), /* @__PURE__ */ r(o, {
|
|
27
|
+
color: "text.secondary",
|
|
28
|
+
component: "span",
|
|
29
|
+
variant: "caption",
|
|
26
30
|
children: e
|
|
27
31
|
})]
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
}), g = ({ icon: e, label: t, tone: a, value: i }) => /* @__PURE__ */ n(s, {
|
|
33
|
+
direction: "row",
|
|
34
|
+
sx: {
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
gap: 16,
|
|
37
|
+
px: 24,
|
|
38
|
+
py: 14
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ r(p, {
|
|
42
|
+
"aria-hidden": !0,
|
|
43
|
+
sx: {
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
bgcolor: "secondary.lighter",
|
|
46
|
+
borderRadius: "4px",
|
|
47
|
+
color: "text.primary",
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
height: 32,
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
width: 32
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ r(_, {
|
|
55
|
+
name: e,
|
|
56
|
+
size: 20
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ r(o, {
|
|
60
|
+
component: "span",
|
|
61
|
+
sx: {
|
|
62
|
+
flexGrow: 1,
|
|
63
|
+
minWidth: 0
|
|
64
|
+
},
|
|
65
|
+
variant: "body1",
|
|
66
|
+
children: t
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ r(o, {
|
|
69
|
+
bold: !0,
|
|
70
|
+
color: a,
|
|
71
|
+
component: "span",
|
|
72
|
+
sx: { transition: "color 0.5s" },
|
|
73
|
+
variant: "body1",
|
|
74
|
+
children: i
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}), B = ({ copy: e, rows: t }) => {
|
|
78
|
+
const a = b.useId(), [i, I] = b.useState(0), d = t ? "text.primary" : "text.secondary", h = u[i], l = t?.[i], R = l ? l.monthlyPayment - l.increment : 0, P = u.map((x) => ({ label: x === 0 ? e.standard ?? e.monthly_payment : `+${m(x, c.whole)}` }));
|
|
79
|
+
return /* @__PURE__ */ n(p, {
|
|
32
80
|
sx: {
|
|
33
|
-
bgcolor:
|
|
34
|
-
borderRadius: "
|
|
35
|
-
boxShadow:
|
|
36
|
-
|
|
81
|
+
bgcolor: "background.paper",
|
|
82
|
+
borderRadius: "8px",
|
|
83
|
+
boxShadow: v[1],
|
|
84
|
+
overflow: "hidden"
|
|
37
85
|
},
|
|
38
|
-
children: [/* @__PURE__ */ r(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
86
|
+
children: [/* @__PURE__ */ r(T, {
|
|
87
|
+
ariaLabel: e.your_results,
|
|
88
|
+
id: a,
|
|
89
|
+
isTypeFilter: !1,
|
|
90
|
+
onChange: I,
|
|
91
|
+
selectedIndex: i,
|
|
92
|
+
tabs: P
|
|
93
|
+
}), /* @__PURE__ */ n(s, {
|
|
94
|
+
...C(a, i),
|
|
42
95
|
sx: {
|
|
43
|
-
|
|
44
|
-
borderColor: "divider",
|
|
96
|
+
gap: 16,
|
|
45
97
|
p: 16
|
|
46
98
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}), b.map((l, f) => {
|
|
50
|
-
const c = x[f], s = l?.result.paymentCount ?? 0, h = s >= 1 ? y(o.month, o.months, s, String(s)) : "-";
|
|
51
|
-
return /* @__PURE__ */ n(u, {
|
|
99
|
+
children: [/* @__PURE__ */ n(s, {
|
|
100
|
+
direction: "row",
|
|
52
101
|
sx: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
py: 24
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
bgcolor: "background.default",
|
|
104
|
+
borderRadius: "8px",
|
|
105
|
+
py: 8
|
|
58
106
|
},
|
|
59
107
|
children: [
|
|
60
|
-
/* @__PURE__ */ r(
|
|
61
|
-
label:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
108
|
+
/* @__PURE__ */ r(y, {
|
|
109
|
+
label: e.monthly_payment,
|
|
110
|
+
tone: d,
|
|
111
|
+
value: f(R)
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ r(o, {
|
|
114
|
+
"aria-hidden": !0,
|
|
115
|
+
color: "text.secondary",
|
|
116
|
+
component: "span",
|
|
117
|
+
variant: "h3",
|
|
118
|
+
children: "+"
|
|
70
119
|
}),
|
|
71
|
-
/* @__PURE__ */ r(
|
|
72
|
-
label:
|
|
73
|
-
tone:
|
|
74
|
-
value: h
|
|
120
|
+
/* @__PURE__ */ r(y, {
|
|
121
|
+
label: e.extra_payment ?? e.monthly_payment,
|
|
122
|
+
tone: h > 0 ? d : "text.secondary",
|
|
123
|
+
value: f(h)
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}), /* @__PURE__ */ n(p, {
|
|
127
|
+
sx: {
|
|
128
|
+
border: 1,
|
|
129
|
+
borderColor: "divider",
|
|
130
|
+
borderRadius: "8px"
|
|
131
|
+
},
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ r(g, {
|
|
134
|
+
icon: "calendar_clock",
|
|
135
|
+
label: e.payoff ?? e.time_to_payoff,
|
|
136
|
+
tone: d,
|
|
137
|
+
value: E(e, l?.result.paymentCount ?? 0)
|
|
75
138
|
}),
|
|
76
|
-
/* @__PURE__ */ r(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
139
|
+
/* @__PURE__ */ r(k, { sx: { ml: 72 } }),
|
|
140
|
+
/* @__PURE__ */ r(g, {
|
|
141
|
+
icon: "list_alt",
|
|
142
|
+
label: e.interest_paid ?? e.total_interest_paid,
|
|
143
|
+
tone: d,
|
|
144
|
+
value: m(l?.result.totalInterestPaid ?? 0, c.cents)
|
|
80
145
|
})
|
|
81
146
|
]
|
|
82
|
-
}
|
|
147
|
+
})]
|
|
83
148
|
})]
|
|
84
149
|
});
|
|
85
|
-
},
|
|
150
|
+
}, G = ({ copy: e }) => /* @__PURE__ */ n(s, {
|
|
86
151
|
role: "alert",
|
|
87
152
|
sx: {
|
|
88
153
|
alignItems: "center",
|
|
89
|
-
bgcolor: "background.
|
|
90
|
-
borderRadius: "
|
|
154
|
+
bgcolor: "background.paper",
|
|
155
|
+
borderRadius: "8px",
|
|
156
|
+
boxShadow: v[1],
|
|
91
157
|
px: 32,
|
|
92
158
|
py: 40,
|
|
93
159
|
textAlign: "center"
|
|
94
160
|
},
|
|
95
161
|
children: [
|
|
96
|
-
/* @__PURE__ */ r(
|
|
162
|
+
/* @__PURE__ */ r(_, {
|
|
97
163
|
"aria-hidden": "true",
|
|
98
164
|
fill: !0,
|
|
99
165
|
name: "error",
|
|
100
166
|
size: 24,
|
|
101
167
|
sx: { color: "primary.main" }
|
|
102
168
|
}),
|
|
103
|
-
/* @__PURE__ */ r(
|
|
169
|
+
/* @__PURE__ */ r(o, {
|
|
104
170
|
bold: !0,
|
|
105
171
|
component: "p",
|
|
106
172
|
sx: {
|
|
@@ -108,18 +174,19 @@ var p = ({ label: o, tone: a, value: e }) => /* @__PURE__ */ n(u, {
|
|
|
108
174
|
pt: 16
|
|
109
175
|
},
|
|
110
176
|
variant: "body1",
|
|
111
|
-
children:
|
|
177
|
+
children: e.calculation_failed
|
|
112
178
|
}),
|
|
113
|
-
/* @__PURE__ */ r(
|
|
179
|
+
/* @__PURE__ */ r(o, {
|
|
114
180
|
component: "p",
|
|
115
181
|
variant: "body2",
|
|
116
|
-
children:
|
|
182
|
+
children: e.calculation_failed_description
|
|
117
183
|
})
|
|
118
184
|
]
|
|
119
185
|
});
|
|
120
186
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
187
|
+
G as CalculationFailed,
|
|
188
|
+
B as PayoffResults,
|
|
189
|
+
E as formatPayoffTime
|
|
123
190
|
};
|
|
124
191
|
|
|
125
192
|
//# sourceMappingURL=PayoffResults.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffResults.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { RAISED_CARD_SHADOW } from '../../components/shared/elevation'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\ninterface ResultLineProps {\n label: React.ReactNode\n tone: 'text.primary' | 'text.secondary'\n value: string\n}\n\nconst ResultLine = ({ label, tone, value }: ResultLineProps) => (\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n <Text\n bold={true}\n color={tone}\n component=\"span\"\n sx={{ transition: 'color 0.5s' }}\n variant=\"body1\"\n >\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the rows then show placeholders. */\n rows?: PayoffRow[]\n}\n\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const isCalculated = !!rows\n const tone = isCalculated ? 'text.primary' : 'text.secondary'\n const shown: Array<PayoffRow | undefined> = rows ?? PAYMENT_INCREMENTS.map(() => undefined)\n\n return (\n <Box\n sx={{\n bgcolor: isCalculated ? 'background.paper' : 'background.default',\n borderRadius: '4px',\n boxShadow: isCalculated ? RAISED_CARD_SHADOW : 'none',\n transition: 'background-color 0.5s, box-shadow 0.5s',\n }}\n >\n <Text\n bold={true}\n color={tone}\n component=\"h3\"\n sx={{ borderBottom: 1, borderColor: 'divider', p: 16 }}\n variant=\"h3\"\n >\n {copy.your_results}\n </Text>\n {shown.map((row, index) => {\n const increment = PAYMENT_INCREMENTS[index]\n const paymentCount = row?.result.paymentCount ?? 0\n const timeToPayoff =\n paymentCount >= 1\n ? (buildPluralCopy(\n copy.month,\n copy.months,\n paymentCount,\n String(paymentCount),\n ) as string)\n : '-'\n\n return (\n <Stack\n key={increment}\n sx={{\n borderBottom: index === shown.length - 1 ? 0 : 1,\n borderColor: 'divider',\n gap: 16,\n px: 16,\n py: 24,\n }}\n >\n <ResultLine\n label={\n <>\n {copy.monthly_payment}\n {increment > 0 && (\n <Text bold={true} color=\"success.main\" component=\"span\" variant=\"caption\">\n {` +${formatCurrency(increment, CURRENCY_FORMAT.cents)}`}\n </Text>\n )}\n </>\n }\n tone={tone}\n value={formatCurrency(row?.monthlyPayment ?? 0, CURRENCY_FORMAT.cents)}\n />\n <ResultLine label={copy.time_to_payoff} tone={tone} value={timeToPayoff} />\n <ResultLine\n label={copy.total_interest_paid}\n tone={tone}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, CURRENCY_FORMAT.cents)}\n />\n </Stack>\n )\n })}\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.default',\n borderRadius: '4px',\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;;AAoBA,IAAM,IAAA,CAAc,EAAE,OAAA,GAAO,MAAA,GAAM,OAAA,EAAA,MACjC,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,eAAe;AAAA,IAAO,gBAAgB;AAAA,EAAgB;AAAA,EAAnE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAO,SAAQ;AAAA,IACnD,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAU;AAAA,IACV,IAAI,EAAE,YAAY,aAAa;AAAA,IAC/B,S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ionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\nimport { ELEVATION_SHADOW } from '../../components/shared/elevation'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\ntype Tone = 'text.primary' | 'text.secondary'\n\n/** Whole dollars without cents (Figma's \"$0\", \"$155\"), otherwise to the cent. */\nconst formatPayment = (amount: number) =>\n formatCurrency(amount, Number.isInteger(amount) ? CURRENCY_FORMAT.whole : CURRENCY_FORMAT.cents)\n\n/** \"_1{number} mo\" when the copy has the short form, else the \"month\"/\"months\" plural. */\nexport const formatPayoffTime = (copy: PayoffCalculatorCopy, paymentCount: number): string => {\n if (paymentCount < 1) return '-'\n if (copy.months_short) return buildDynamicCopy(copy.months_short, String(paymentCount)) as string\n\n return buildPluralCopy(copy.month, copy.months, paymentCount, String(paymentCount)) as string\n}\n\nconst PaymentFigure = ({ label, tone, value }: { label: string; tone: Tone; value: string }) => (\n <Stack sx={{ alignItems: 'center', flex: 1, minWidth: 0 }}>\n <Text bold={true} color={tone} component=\"span\" sx={{ transition: 'color 0.5s' }} variant=\"h3\">\n {value}\n </Text>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n </Stack>\n)\n\ninterface ResultRowProps {\n icon: string\n label: string\n tone: Tone\n value: string\n}\n\nconst ResultRow = ({ icon, label, tone, value }: ResultRowProps) => (\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 16, px: 24, py: 14 }}>\n {/* Figma `_components/avatar/background` (#ECECEC) → `secondary.lighter`, dark-mode safe. */}\n <Box\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n bgcolor: 'secondary.lighter',\n borderRadius: '4px',\n color: 'text.primary',\n display: 'flex',\n flexShrink: 0,\n height: 32,\n justifyContent: 'center',\n width: 32,\n }}\n >\n <Icon name={icon} size={20} />\n </Box>\n <Text component=\"span\" sx={{ flexGrow: 1, minWidth: 0 }} variant=\"body1\">\n {label}\n </Text>\n <Text\n bold={true}\n color={tone}\n component=\"span\"\n sx={{ transition: 'color 0.5s' }}\n variant=\"body1\"\n >\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the figures then show placeholders. */\n rows?: PayoffRow[]\n}\n\n/**\n * The scenario card (Figma `Monthly CC Prediction Summary/Drilldown Content`): one tab per payment\n * increment — Standard, +$10, +$20 — each showing the entered payment plus the extra, then the\n * time to payoff and the interest paid at that payment.\n */\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const id = React.useId()\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n\n const isCalculated = !!rows\n const tone: Tone = isCalculated ? 'text.primary' : 'text.secondary'\n const increment = PAYMENT_INCREMENTS[selectedIndex]\n const row = rows?.[selectedIndex]\n const basePayment = row ? row.monthlyPayment - row.increment : 0\n\n const tabs = PAYMENT_INCREMENTS.map((amount) => ({\n label:\n amount === 0\n ? (copy.standard ?? copy.monthly_payment)\n : `+${formatCurrency(amount, CURRENCY_FORMAT.whole)}`,\n }))\n\n return (\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n overflow: 'hidden',\n }}\n >\n {/* MUI Tabs draws its own divider under the row. */}\n <SubTabs\n ariaLabel={copy.your_results}\n id={id}\n isTypeFilter={false}\n onChange={setSelectedIndex}\n selectedIndex={selectedIndex}\n tabs={tabs}\n />\n <Stack {...subTabPanelProps(id, selectedIndex)} sx={{ gap: 16, p: 16 }}>\n <Stack\n direction=\"row\"\n sx={{ alignItems: 'center', bgcolor: 'background.default', borderRadius: '8px', py: 8 }}\n >\n <PaymentFigure\n label={copy.monthly_payment}\n tone={tone}\n value={formatPayment(basePayment)}\n />\n <Text aria-hidden={true} color=\"text.secondary\" component=\"span\" variant=\"h3\">\n +\n </Text>\n <PaymentFigure\n label={copy.extra_payment ?? copy.monthly_payment}\n tone={increment > 0 ? tone : 'text.secondary'}\n value={formatPayment(increment)}\n />\n </Stack>\n <Box sx={{ border: 1, borderColor: 'divider', borderRadius: '8px' }}>\n <ResultRow\n icon=\"calendar_clock\"\n label={copy.payoff ?? copy.time_to_payoff}\n tone={tone}\n value={formatPayoffTime(copy, row?.result.paymentCount ?? 0)}\n />\n <Divider sx={{ ml: 72 }} />\n <ResultRow\n icon=\"list_alt\"\n label={copy.interest_paid ?? copy.total_interest_paid}\n tone={tone}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, CURRENCY_FORMAT.cents)}\n />\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;;;;;AAqBA,IAAM,IAAA,CAAiB,MACrB,EAAe,GAAQ,OAAO,UAAU,CAAM,IAAI,EAAgB,QAAQ,EAAgB,KAAK,GAGpF,IAAA,CAAoB,GAA4B,MACvD,IAAe,IAAU,MACzB,EAAK,eAAqB,EA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AAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAW,EAAiB,CAAA;AAAA,IAC5B,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,WAAW;AAAA,EACb;AAAA,EAVF,UAAA;AAAA,IAYE,gBAAA,EAAC,GAAD;AAAA,MAAM,eAAY;AAAA,MAAO,MAAM;AAAA,MAAM,MAAK;AAAA,MAAQ,MAAM;AAAA,MAAI,IAAI,EAAE,OAAO,eAAe;AAAA,IAAI,CAAA;AAAA,IAC5F,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,WAAU;AAAA,MAAI,IAAI;AAAA,QAAE,IAAI;AAAA,QAAG,IAAI;AAAA,MAAG;AAAA,MAAG,SAAQ;AAAA,MAC5D,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MAAM,WAAU;AAAA,MAAI,SAAQ;AAAA,MACzB,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,EACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useBeatActions as s } from "../beatActions.es.js";
|
|
2
|
-
import
|
|
3
|
-
import a from "./
|
|
2
|
+
import m from "./SubHeader.es.js";
|
|
3
|
+
import { InsightOptionsMenu as a } from "./InsightOptionsMenu.es.js";
|
|
4
4
|
import e from "@mui/material/Stack";
|
|
5
5
|
import { H3 as c } from "@mxenabled/mxui";
|
|
6
6
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
@@ -23,8 +23,8 @@ var g = ({ isMini: n, subtitle: t, title: i }) => {
|
|
|
23
23
|
children: [/* @__PURE__ */ r(c, {
|
|
24
24
|
truncate: !0,
|
|
25
25
|
children: i
|
|
26
|
-
}), !n && p && /* @__PURE__ */ r(
|
|
27
|
-
}), t && /* @__PURE__ */ r(
|
|
26
|
+
}), !n && p && /* @__PURE__ */ r(a, {})]
|
|
27
|
+
}), t && /* @__PURE__ */ r(m, { subtitle: t })]
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
export {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var p = {
|
|
2
2
|
1: "0px 2px 8px rgba(0, 0, 0, 0.12)",
|
|
3
3
|
16: "0px 12px 20px rgba(0, 0, 0, 0.22)"
|
|
4
|
-
}, x = "0px
|
|
4
|
+
}, x = "0px 2px 4px rgba(0, 0, 0, 0.12)";
|
|
5
5
|
export {
|
|
6
6
|
p as ELEVATION_SHADOW,
|
|
7
|
-
x as
|
|
8
|
-
r as SMALL_CARD_SHADOW
|
|
7
|
+
x as SMALL_CARD_SHADOW
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=elevation.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevation.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/elevation.ts"],"sourcesContent":["/** Figma elevation shadows (single drop shadows, not MUI's `shadows[n]`). */\nexport const ELEVATION_SHADOW = {\n /** `elevation/1`: rows on a wash. */\n 1: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n /** `elevation/16`: dialogs, snackbars. */\n 16: '0px 12px 20px rgba(0, 0, 0, 0.22)',\n} as const\n\n/** Soft two-layer card shadow (Figma) for a raised result card; off the numbered scale above. */\nexport const RAISED_CARD_SHADOW =\n '0px 6px 12px rgba(106, 115, 129, 0.16), 0px 3px 8px rgba(87, 102, 117, 0.06)'\n\n/** Small card shadow (Figma 0 / 2 / blur 4, black @ 0.12): the quiz feedback card and merchant header. */\nexport const SMALL_CARD_SHADOW = '0px 2px 4px rgba(0, 0, 0, 0.12)'\n"],"mappings":"AACA,IAAa,IAAmB;AAAA,EAE9B,GAAG;AAAA,EAEH,IAAI;AACN,
|
|
1
|
+
{"version":3,"file":"elevation.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/elevation.ts"],"sourcesContent":["/** Figma elevation shadows (single drop shadows, not MUI's `shadows[n]`). */\nexport const ELEVATION_SHADOW = {\n /** `elevation/1`: rows on a wash. */\n 1: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n /** `elevation/16`: dialogs, snackbars. */\n 16: '0px 12px 20px rgba(0, 0, 0, 0.22)',\n} as const\n\n/** Soft two-layer card shadow (Figma) for a raised result card; off the numbered scale above. */\nexport const RAISED_CARD_SHADOW =\n '0px 6px 12px rgba(106, 115, 129, 0.16), 0px 3px 8px rgba(87, 102, 117, 0.06)'\n\n/** Small card shadow (Figma 0 / 2 / blur 4, black @ 0.12): the quiz feedback card and merchant header. */\nexport const SMALL_CARD_SHADOW = '0px 2px 4px rgba(0, 0, 0, 0.12)'\n"],"mappings":"AACA,IAAa,IAAmB;AAAA,EAE9B,GAAG;AAAA,EAEH,IAAI;AACN,GAOa,IAAoB"}
|