@mx-cartographer/experiences 9.7.154 → 9.7.156
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 +13 -0
- 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 +43 -48
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +30 -34
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +52 -52
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.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 +131 -135
- 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.es.js +19 -25
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.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/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js +12 -12
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.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/PayoffStrategiesBlock/PayoffStrategiesContent.es.js +18 -18
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js +23 -22
- 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/SubscriptionStatusModalBlock.es.js +44 -44
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +24 -24
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.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/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +20 -20
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.d.ts +1 -2
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js +3 -7
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.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 +102 -104
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +11 -11
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +58 -58
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.d.ts +7 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js +28 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js +14 -33
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +24 -41
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/useOpenedCta.d.ts +9 -0
- package/dist/insights-v2/actionBlocks/useOpenedCta.es.js +11 -0
- package/dist/insights-v2/actionBlocks/useOpenedCta.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/util.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/util.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,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,E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|
|
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,16 +1,16 @@
|
|
|
1
1
|
import { DEFAULT_INSTITUTION_LOGO_URL as T } from "../../../core/constants/InstitutionLogo.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import { SubTabs as
|
|
4
|
-
import { orderAccounts as
|
|
5
|
-
import { useRef as
|
|
2
|
+
import { CURRENCY_FORMAT as I, formatCurrency as C } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { SubTabs as R, subTabPanelProps as k } from "../../components/SubTabs.es.js";
|
|
4
|
+
import { orderAccounts as D } from "./layout.es.js";
|
|
5
|
+
import { useRef as w, useState as S } from "react";
|
|
6
6
|
import o from "@mui/material/Stack";
|
|
7
|
-
import { InstitutionLogo as
|
|
7
|
+
import { InstitutionLogo as A, Text as d } from "@mxenabled/mxui";
|
|
8
8
|
import { Icon as u } from "@mxenabled/mx-icons";
|
|
9
9
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
10
10
|
import x from "@mui/material/Box";
|
|
11
11
|
import f from "@mui/material/IconButton";
|
|
12
12
|
import L from "@mui/material/Divider";
|
|
13
|
-
import
|
|
13
|
+
import G from "@mui/material/ButtonBase";
|
|
14
14
|
var _ = {
|
|
15
15
|
bgcolor: "background.paper",
|
|
16
16
|
border: "1px solid",
|
|
@@ -66,8 +66,8 @@ var _ = {
|
|
|
66
66
|
})]
|
|
67
67
|
}, c))
|
|
68
68
|
})]
|
|
69
|
-
}),
|
|
70
|
-
const [t, s] = S(0), c =
|
|
69
|
+
}), P = 172, y = "—", U = ({ steps: l }) => {
|
|
70
|
+
const [t, s] = S(0), c = w(null), i = (a) => {
|
|
71
71
|
const r = Math.min(Math.max(a, 0), l.length - 1);
|
|
72
72
|
s(r), c.current?.scrollTo({
|
|
73
73
|
behavior: "smooth",
|
|
@@ -101,7 +101,7 @@ var _ = {
|
|
|
101
101
|
p: 16,
|
|
102
102
|
scrollSnapAlign: "start",
|
|
103
103
|
textAlign: "center",
|
|
104
|
-
width:
|
|
104
|
+
width: P
|
|
105
105
|
},
|
|
106
106
|
children: [/* @__PURE__ */ e(u, {
|
|
107
107
|
color: "action",
|
|
@@ -171,13 +171,13 @@ var _ = {
|
|
|
171
171
|
value: i.interestRate === null ? y : `${i.interestRate}%`
|
|
172
172
|
}, m = {
|
|
173
173
|
label: l,
|
|
174
|
-
value: i.balance === null ? y :
|
|
174
|
+
value: i.balance === null ? y : C(i.balance, I.cents)
|
|
175
175
|
}, p = a === "rate" ? [r, m] : [m, r];
|
|
176
176
|
return /* @__PURE__ */ n(x, {
|
|
177
177
|
component: "li",
|
|
178
178
|
sx: { position: "relative" },
|
|
179
179
|
children: [/* @__PURE__ */ n(o, {
|
|
180
|
-
component: s ?
|
|
180
|
+
component: s ? G : "div",
|
|
181
181
|
onClick: s,
|
|
182
182
|
sx: {
|
|
183
183
|
alignItems: "flex-start",
|
|
@@ -199,7 +199,7 @@ var _ = {
|
|
|
199
199
|
height: 32,
|
|
200
200
|
width: 32
|
|
201
201
|
},
|
|
202
|
-
children: /* @__PURE__ */ e(
|
|
202
|
+
children: /* @__PURE__ */ e(A, {
|
|
203
203
|
alt: "",
|
|
204
204
|
institutionGuid: i.institutionGuid,
|
|
205
205
|
logoUrl: i.institutionGuid ? void 0 : T,
|
|
@@ -242,23 +242,23 @@ var _ = {
|
|
|
242
242
|
right: 0
|
|
243
243
|
} })]
|
|
244
244
|
});
|
|
245
|
-
},
|
|
245
|
+
}, Y = ({ accounts: l, copy: t, onAccountClick: s, strategies: c }) => {
|
|
246
246
|
const [i, a] = S(0), r = c[i] ?? c[0];
|
|
247
247
|
if (!r) return null;
|
|
248
|
-
const m =
|
|
248
|
+
const m = D(l, r.sortKey);
|
|
249
249
|
return /* @__PURE__ */ n(o, {
|
|
250
250
|
sx: {
|
|
251
251
|
bgcolor: "background.default",
|
|
252
252
|
pb: 24
|
|
253
253
|
},
|
|
254
|
-
children: [/* @__PURE__ */ e(
|
|
254
|
+
children: [/* @__PURE__ */ e(R, {
|
|
255
255
|
id: "payoff-strategies",
|
|
256
256
|
isTypeFilter: !1,
|
|
257
257
|
onChange: a,
|
|
258
258
|
selectedIndex: i,
|
|
259
259
|
tabs: c.map(({ label: p }) => ({ label: p }))
|
|
260
260
|
}), /* @__PURE__ */ n(o, {
|
|
261
|
-
...
|
|
261
|
+
...k("payoff-strategies", i),
|
|
262
262
|
sx: { gap: 12 },
|
|
263
263
|
children: [
|
|
264
264
|
/* @__PURE__ */ n(o, {
|
|
@@ -298,7 +298,7 @@ var _ = {
|
|
|
298
298
|
px: 24,
|
|
299
299
|
py: 24
|
|
300
300
|
},
|
|
301
|
-
children: [t.how_to_get_started && /* @__PURE__ */ e(g, { children: t.how_to_get_started }), /* @__PURE__ */ e(
|
|
301
|
+
children: [t.how_to_get_started && /* @__PURE__ */ e(g, { children: t.how_to_get_started }), /* @__PURE__ */ e(U, { steps: r.steps }, r.key)]
|
|
302
302
|
}),
|
|
303
303
|
/* @__PURE__ */ n(o, {
|
|
304
304
|
component: "section",
|
|
@@ -333,7 +333,7 @@ var _ = {
|
|
|
333
333
|
});
|
|
334
334
|
};
|
|
335
335
|
export {
|
|
336
|
-
|
|
336
|
+
Y as default
|
|
337
337
|
};
|
|
338
338
|
|
|
339
339
|
//# sourceMappingURL=PayoffStrategiesContent.es.js.map
|
package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffStrategiesContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.tsx"],"sourcesContent":["import { useRef, useState } from 'react'\n\nimport Box from '@mui/material/Box'\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { GeneralInsightsFeedCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\n\nimport type { PayoffAccountRow, PayoffStep, PayoffStrategy } from './layout'\nimport { orderAccounts } from './layout'\n\nexport interface PayoffStrategiesContentProps {\n copy: GeneralInsightsFeedCopy\n strategies: PayoffStrategy[]\n /** The beat's debt accounts, unordered; each tab orders them its own way. */\n accounts: PayoffAccountRow[]\n /** Tapping an account row opens its Account Details; rows are static without it. */\n onAccountClick?: (accountGuid: string) => void\n}\n\nconst CARD_SX = {\n bgcolor: 'background.paper',\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: 1,\n} as const\n\n/** The small uppercase section label (STRATEGY, HOW TO GET STARTED, HIGHEST TO LOWEST RATE). */\nconst SectionLabel = ({ children }: { children: string }) => (\n <Text\n color=\"text.secondary\"\n component=\"h3\"\n sx={{ letterSpacing: 0.5, textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {children}\n </Text>\n)\n\nconst ProsConsCard = ({\n items,\n kind,\n title,\n}: {\n items: string[]\n kind: 'pros' | 'cons'\n title: string\n}) => (\n <Stack component=\"section\" sx={{ ...CARD_SX, flex: 1, gap: 12, p: 16 }}>\n <Text bold={true} component=\"h4\" variant=\"body1\">\n {title}\n </Text>\n <Stack component=\"ul\" sx={{ gap: 12, listStyle: 'none', m: 0, p: 0 }}>\n {items.map((item) => (\n <Stack component=\"li\" key={item} sx={{ flexDirection: 'row', gap: 6 }}>\n <Icon\n color={kind === 'pros' ? 'success' : 'error'}\n name={kind === 'pros' ? 'check_circle' : 'cancel'}\n size={16}\n sx={{ flexShrink: 0, mt: 2 }}\n />\n <Text variant=\"body2\">{item}</Text>\n </Stack>\n ))}\n </Stack>\n </Stack>\n)\n\nconst STEP_CARD_WIDTH = 172\nconst MISSING_VALUE = '—'\n\n/** The three step cards in a scroll-snap row, paged by the arrows and the dots under it. */\nconst StepsCarousel = ({ steps }: { steps: PayoffStep[] }) => {\n const [page, setPage] = useState(0)\n const rowRef = useRef<HTMLOListElement>(null)\n\n const goTo = (next: number) => {\n const index = Math.min(Math.max(next, 0), steps.length - 1)\n setPage(index)\n rowRef.current?.scrollTo({ behavior: 'smooth', left: index * (STEP_CARD_WIDTH + 12) })\n }\n\n if (!steps.length) return null\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n component=\"ol\"\n ref={rowRef}\n sx={{\n display: 'flex',\n flexDirection: 'row',\n gap: 12,\n listStyle: 'none',\n m: 0,\n overflowX: 'auto',\n p: 0,\n scrollSnapType: 'x mandatory',\n scrollbarWidth: 'none',\n '&::-webkit-scrollbar': { display: 'none' },\n }}\n >\n {steps.map((step) => (\n <Stack\n component=\"li\"\n key={step.caption + step.text}\n sx={{\n ...CARD_SX,\n alignItems: 'center',\n flexShrink: 0,\n gap: 16,\n p: 16,\n scrollSnapAlign: 'start',\n textAlign: 'center',\n width: STEP_CARD_WIDTH,\n }}\n >\n <Icon color=\"action\" name={step.icon} size={48} />\n <Stack sx={{ gap: 4 }}>\n <Text bold={true} sx={{ textTransform: 'uppercase' }} variant=\"caption\">\n {step.caption}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n {step.text}\n </Text>\n </Stack>\n </Stack>\n ))}\n </Box>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, justifyContent: 'center' }}>\n <IconButton aria-label=\"previous\" disabled={page === 0} onClick={() => goTo(page - 1)}>\n <Icon name=\"chevron_left\" size={20} />\n </IconButton>\n <Stack aria-hidden=\"true\" sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n {steps.map((step, index) => (\n <Box\n key={step.caption + step.text}\n sx={{\n bgcolor: index === page ? 'primary.main' : 'action.disabled',\n borderRadius: 3,\n height: 6,\n width: index === page ? 20 : 6,\n }}\n />\n ))}\n </Stack>\n <IconButton\n aria-label=\"next\"\n disabled={page === steps.length - 1}\n onClick={() => goTo(page + 1)}\n >\n <Icon color=\"primary\" name=\"chevron_right\" size={20} />\n </IconButton>\n </Stack>\n </Stack>\n )\n}\n\nconst AccountRow = ({\n balanceLabel,\n isLast,\n onClick,\n rateLabel,\n row,\n sortKey,\n}: {\n balanceLabel: string\n isLast: boolean\n onClick?: () => void\n rateLabel: string\n row: PayoffAccountRow\n sortKey: PayoffStrategy['sortKey']\n}) => {\n const rate = {\n label: rateLabel,\n value: row.interestRate === null ? MISSING_VALUE : `${row.interestRate}%`,\n }\n const balance = {\n label: balanceLabel,\n value: row.balance === null ? MISSING_VALUE : formatCurrency(row.balance, '0,0.00'),\n }\n const lines = sortKey === 'rate' ? [rate, balance] : [balance, rate]\n\n return (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack\n component={onClick ? ButtonBase : 'div'}\n onClick={onClick}\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 12,\n px: 24,\n py: 16,\n textAlign: 'left',\n width: '100%',\n ...(onClick && {\n '&:hover': { bgcolor: 'action.hover' },\n '&.Mui-focusVisible': { bgcolor: 'action.focus' },\n }),\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0, height: 32, width: 32 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={row.institutionGuid}\n logoUrl={row.institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={32}\n />\n </Box>\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {row.name}\n </Text>\n {lines.map((line, index) => (\n <Stack\n key={line.label}\n sx={{ flexDirection: 'row', gap: 12, justifyContent: 'space-between' }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {line.label}\n </Text>\n <Text\n bold={index === 0}\n color={index === 0 ? 'text.primary' : 'text.secondary'}\n sx={{ fontVariantNumeric: 'tabular-nums' }}\n variant=\"caption\"\n >\n {line.value}\n </Text>\n </Stack>\n ))}\n </Stack>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 68, position: 'absolute', right: 0 }} />\n </Box>\n )\n}\n\n/** Presentational body of the Debt Payoff Strategies drawer, minus the drawer header. */\nconst PayoffStrategiesContent = ({\n accounts,\n copy,\n onAccountClick,\n strategies,\n}: PayoffStrategiesContentProps) => {\n const [tab, setTab] = useState(0)\n const strategy = strategies[tab] ?? strategies[0]\n\n if (!strategy) return null\n\n const ordered = orderAccounts(accounts, strategy.sortKey)\n\n return (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <SubTabs\n id=\"payoff-strategies\"\n isTypeFilter={false}\n onChange={setTab}\n selectedIndex={tab}\n tabs={strategies.map(({ label }) => ({ label }))}\n />\n <Stack {...subTabPanelProps('payoff-strategies', tab)} sx={{ gap: 12 }}>\n <Stack component=\"section\" sx={{ bgcolor: 'background.paper', gap: 16, p: 24 }}>\n <Stack sx={{ gap: 4 }}>\n {copy.the_strategy && <SectionLabel>{copy.the_strategy}</SectionLabel>}\n <Text component=\"p\" variant=\"body1\">\n {strategy.description}\n </Text>\n </Stack>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n <ProsConsCard items={strategy.pros} kind=\"pros\" title={copy.pros ?? ''} />\n <ProsConsCard items={strategy.cons} kind=\"cons\" title={copy.cons ?? ''} />\n </Stack>\n </Stack>\n {strategy.steps.length > 0 && (\n <Stack component=\"section\" sx={{ gap: 16, px: 24, py: 24 }}>\n {copy.how_to_get_started && <SectionLabel>{copy.how_to_get_started}</SectionLabel>}\n <StepsCarousel key={strategy.key} steps={strategy.steps} />\n </Stack>\n )}\n <Stack component=\"section\" sx={{ gap: 16, pt: 12 }}>\n <Box sx={{ px: 24 }}>\n <SectionLabel>{strategy.orderHeader}</SectionLabel>\n </Box>\n <Stack\n aria-label={strategy.orderHeader}\n component=\"ul\"\n sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}\n >\n {ordered.map((row, index) => (\n <AccountRow\n balanceLabel={copy.balance ?? ''}\n isLast={index === ordered.length - 1}\n key={row.guid}\n onClick={onAccountClick ? () => onAccountClick(row.guid) : undefined}\n rateLabel={copy.interest_rate ?? ''}\n row={row}\n sortKey={strategy.sortKey}\n />\n ))}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default PayoffStrategiesContent\n"],"mappings":";;;;;;;;;;;;;AA4BA,IAAM,IAAU;AAAA,EACd,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAChB,GAGM,IAAA,CAAgB,EAAE,UAAA,EAAA,MACtB,gBAAA,EAAC,GAAD;AAAA,EACE,OAAM;AAAA,EACN,WAAU;AAAA,EACV,IAAI;AAAA,IAAE,eAAe;AAAA,IAAK,eAAe;AAAA,EAAY;AAAA,EACrD,SAAQ;AAAA,EAEP,UAAA;AACG,CAAA,GAGF,IAAA,CAAgB,EACpB,OAAA,GACA,MAAA,GACA,OAAA,EAAA,MAMA,gBAAA,EAAC,GAAD;AAAA,EAAO,WAAU;AAAA,EAAU,IAAI;AAAA,IAAE,GAAG;AAAA,IAAS,MAAM;AAAA,IAAG,KAAK;AAAA,IAAI,GAAG;AAAA,EAAG;AAAA,EAArE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,WAAU;AAAA,IAAK,SAAQ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AA,gBAAA,EAAC,GAAD,EAAA,UAAe,EAAS,YAA0B,CAAA;AAAA,UAC/C,CAAA,GACL,gBAAA,EAAC,GAAD;AAAA,YACE,cAAY,EAAS;AAAA,YACrB,WAAU;AAAA,YACV,IAAI;AAAA,cAAE,SAAS;AAAA,cAAoB,WAAW;AAAA,cAAQ,GAAG;AAAA,cAAG,GAAG;AAAA,YAAE;AAAA,YAEhE,UAAA,EAAQ,IAAA,CAAK,GAAK,MACjB,gBAAA,EAAC,GAAD;AAAA,cACE,cAAc,EAAK,WAAW;AAAA,cAC9B,QAAQ,MAAU,EAAQ,SAAS;AAAA,cAEnC,SAAS,IAAA,MAAuB,EAAe,EAAI,IAAI,IAAI;AAAA,cAC3D,WAAW,EAAK,iBAAiB;AAAA,cAC5B,KAAA;AAAA,cACL,SAAS,EAAS;AAAA,YACnB,GALM,EAAI,IAKV,CACF;AAAA,UACI,CAAA,CACF;AAAA;MACF;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"PayoffStrategiesContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.tsx"],"sourcesContent":["import { useRef, useState } from 'react'\n\nimport Box from '@mui/material/Box'\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { GeneralInsightsFeedCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\n\nimport type { PayoffAccountRow, PayoffStep, PayoffStrategy } from './layout'\nimport { orderAccounts } from './layout'\n\nexport interface PayoffStrategiesContentProps {\n copy: GeneralInsightsFeedCopy\n strategies: PayoffStrategy[]\n /** The beat's debt accounts, unordered; each tab orders them its own way. */\n accounts: PayoffAccountRow[]\n /** Tapping an account row opens its Account Details; rows are static without it. */\n onAccountClick?: (accountGuid: string) => void\n}\n\nconst CARD_SX = {\n bgcolor: 'background.paper',\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: 1,\n} as const\n\n/** The small uppercase section label (STRATEGY, HOW TO GET STARTED, HIGHEST TO LOWEST RATE). */\nconst SectionLabel = ({ children }: { children: string }) => (\n <Text\n color=\"text.secondary\"\n component=\"h3\"\n sx={{ letterSpacing: 0.5, textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {children}\n </Text>\n)\n\nconst ProsConsCard = ({\n items,\n kind,\n title,\n}: {\n items: string[]\n kind: 'pros' | 'cons'\n title: string\n}) => (\n <Stack component=\"section\" sx={{ ...CARD_SX, flex: 1, gap: 12, p: 16 }}>\n <Text bold={true} component=\"h4\" variant=\"body1\">\n {title}\n </Text>\n <Stack component=\"ul\" sx={{ gap: 12, listStyle: 'none', m: 0, p: 0 }}>\n {items.map((item) => (\n <Stack component=\"li\" key={item} sx={{ flexDirection: 'row', gap: 6 }}>\n <Icon\n color={kind === 'pros' ? 'success' : 'error'}\n name={kind === 'pros' ? 'check_circle' : 'cancel'}\n size={16}\n sx={{ flexShrink: 0, mt: 2 }}\n />\n <Text variant=\"body2\">{item}</Text>\n </Stack>\n ))}\n </Stack>\n </Stack>\n)\n\nconst STEP_CARD_WIDTH = 172\nconst MISSING_VALUE = '—'\n\n/** The three step cards in a scroll-snap row, paged by the arrows and the dots under it. */\nconst StepsCarousel = ({ steps }: { steps: PayoffStep[] }) => {\n const [page, setPage] = useState(0)\n const rowRef = useRef<HTMLOListElement>(null)\n\n const goTo = (next: number) => {\n const index = Math.min(Math.max(next, 0), steps.length - 1)\n setPage(index)\n rowRef.current?.scrollTo({ behavior: 'smooth', left: index * (STEP_CARD_WIDTH + 12) })\n }\n\n if (!steps.length) return null\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n component=\"ol\"\n ref={rowRef}\n sx={{\n display: 'flex',\n flexDirection: 'row',\n gap: 12,\n listStyle: 'none',\n m: 0,\n overflowX: 'auto',\n p: 0,\n scrollSnapType: 'x mandatory',\n scrollbarWidth: 'none',\n '&::-webkit-scrollbar': { display: 'none' },\n }}\n >\n {steps.map((step) => (\n <Stack\n component=\"li\"\n key={step.caption + step.text}\n sx={{\n ...CARD_SX,\n alignItems: 'center',\n flexShrink: 0,\n gap: 16,\n p: 16,\n scrollSnapAlign: 'start',\n textAlign: 'center',\n width: STEP_CARD_WIDTH,\n }}\n >\n <Icon color=\"action\" name={step.icon} size={48} />\n <Stack sx={{ gap: 4 }}>\n <Text bold={true} sx={{ textTransform: 'uppercase' }} variant=\"caption\">\n {step.caption}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n {step.text}\n </Text>\n </Stack>\n </Stack>\n ))}\n </Box>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, justifyContent: 'center' }}>\n <IconButton aria-label=\"previous\" disabled={page === 0} onClick={() => goTo(page - 1)}>\n <Icon name=\"chevron_left\" size={20} />\n </IconButton>\n <Stack aria-hidden=\"true\" sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n {steps.map((step, index) => (\n <Box\n key={step.caption + step.text}\n sx={{\n bgcolor: index === page ? 'primary.main' : 'action.disabled',\n borderRadius: 3,\n height: 6,\n width: index === page ? 20 : 6,\n }}\n />\n ))}\n </Stack>\n <IconButton\n aria-label=\"next\"\n disabled={page === steps.length - 1}\n onClick={() => goTo(page + 1)}\n >\n <Icon color=\"primary\" name=\"chevron_right\" size={20} />\n </IconButton>\n </Stack>\n </Stack>\n )\n}\n\nconst AccountRow = ({\n balanceLabel,\n isLast,\n onClick,\n rateLabel,\n row,\n sortKey,\n}: {\n balanceLabel: string\n isLast: boolean\n onClick?: () => void\n rateLabel: string\n row: PayoffAccountRow\n sortKey: PayoffStrategy['sortKey']\n}) => {\n const rate = {\n label: rateLabel,\n value: row.interestRate === null ? MISSING_VALUE : `${row.interestRate}%`,\n }\n const balance = {\n label: balanceLabel,\n value:\n row.balance === null ? MISSING_VALUE : formatCurrency(row.balance, CURRENCY_FORMAT.cents),\n }\n const lines = sortKey === 'rate' ? [rate, balance] : [balance, rate]\n\n return (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack\n component={onClick ? ButtonBase : 'div'}\n onClick={onClick}\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 12,\n px: 24,\n py: 16,\n textAlign: 'left',\n width: '100%',\n ...(onClick && {\n '&:hover': { bgcolor: 'action.hover' },\n '&.Mui-focusVisible': { bgcolor: 'action.focus' },\n }),\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0, height: 32, width: 32 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={row.institutionGuid}\n logoUrl={row.institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={32}\n />\n </Box>\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {row.name}\n </Text>\n {lines.map((line, index) => (\n <Stack\n key={line.label}\n sx={{ flexDirection: 'row', gap: 12, justifyContent: 'space-between' }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {line.label}\n </Text>\n <Text\n bold={index === 0}\n color={index === 0 ? 'text.primary' : 'text.secondary'}\n sx={{ fontVariantNumeric: 'tabular-nums' }}\n variant=\"caption\"\n >\n {line.value}\n </Text>\n </Stack>\n ))}\n </Stack>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 68, position: 'absolute', right: 0 }} />\n </Box>\n )\n}\n\n/** Presentational body of the Debt Payoff Strategies drawer, minus the drawer header. */\nconst PayoffStrategiesContent = ({\n accounts,\n copy,\n onAccountClick,\n strategies,\n}: PayoffStrategiesContentProps) => {\n const [tab, setTab] = useState(0)\n const strategy = strategies[tab] ?? strategies[0]\n\n if (!strategy) return null\n\n const ordered = orderAccounts(accounts, strategy.sortKey)\n\n return (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <SubTabs\n id=\"payoff-strategies\"\n isTypeFilter={false}\n onChange={setTab}\n selectedIndex={tab}\n tabs={strategies.map(({ label }) => ({ label }))}\n />\n <Stack {...subTabPanelProps('payoff-strategies', tab)} sx={{ gap: 12 }}>\n <Stack component=\"section\" sx={{ bgcolor: 'background.paper', gap: 16, p: 24 }}>\n <Stack sx={{ gap: 4 }}>\n {copy.the_strategy && <SectionLabel>{copy.the_strategy}</SectionLabel>}\n <Text component=\"p\" variant=\"body1\">\n {strategy.description}\n </Text>\n </Stack>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n <ProsConsCard items={strategy.pros} kind=\"pros\" title={copy.pros ?? ''} />\n <ProsConsCard items={strategy.cons} kind=\"cons\" title={copy.cons ?? ''} />\n </Stack>\n </Stack>\n {strategy.steps.length > 0 && (\n <Stack component=\"section\" sx={{ gap: 16, px: 24, py: 24 }}>\n {copy.how_to_get_started && <SectionLabel>{copy.how_to_get_started}</SectionLabel>}\n <StepsCarousel key={strategy.key} steps={strategy.steps} />\n </Stack>\n )}\n <Stack component=\"section\" sx={{ gap: 16, pt: 12 }}>\n <Box sx={{ px: 24 }}>\n <SectionLabel>{strategy.orderHeader}</SectionLabel>\n </Box>\n <Stack\n aria-label={strategy.orderHeader}\n component=\"ul\"\n sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}\n >\n {ordered.map((row, index) => (\n <AccountRow\n balanceLabel={copy.balance ?? ''}\n isLast={index === ordered.length - 1}\n key={row.guid}\n onClick={onAccountClick ? () => onAccountClick(row.guid) : undefined}\n rateLabel={copy.interest_rate ?? ''}\n row={row}\n sortKey={strategy.sortKey}\n />\n ))}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default PayoffStrategiesContent\n"],"mappings":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AAEX"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { useActionContext as
|
|
2
|
-
import { createVariantBlock as
|
|
1
|
+
import { useActionContext as m } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { createVariantBlock as s } from "../blocks/createVariantBlock.es.js";
|
|
3
|
+
import { useOpenedCta as p } from "./useOpenedCta.es.js";
|
|
3
4
|
import { observer as i } from "mobx-react-lite";
|
|
4
5
|
import l from "@mui/material/Stack";
|
|
5
|
-
import { H3 as
|
|
6
|
-
import { jsx as
|
|
7
|
-
var c = i(({ beat:
|
|
8
|
-
const { chartBarIndex:
|
|
9
|
-
return /* @__PURE__ */
|
|
6
|
+
import { H3 as d, Text as a } from "@mxenabled/mxui";
|
|
7
|
+
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
8
|
+
var c = i(({ beat: e }) => {
|
|
9
|
+
const { chartBarIndex: t = 0, tabIndex: n = 0 } = m() ?? {};
|
|
10
|
+
return /* @__PURE__ */ r(l, {
|
|
10
11
|
sx: {
|
|
11
12
|
alignItems: "center",
|
|
12
13
|
gap: 8,
|
|
@@ -14,37 +15,37 @@ var c = i(({ beat: t }) => {
|
|
|
14
15
|
textAlign: "center"
|
|
15
16
|
},
|
|
16
17
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ o(d, { children: "Action Block Layer Drilldown" }),
|
|
19
|
+
/* @__PURE__ */ o(a, { children: "This is a placeholder action block. Replace it with your own implementation by registering your block in src/insights-v2/mappings/blocks.ts." }),
|
|
20
|
+
/* @__PURE__ */ r(a, { children: ["Beat: ", e.guid] }),
|
|
21
|
+
/* @__PURE__ */ r(a, { children: [
|
|
21
22
|
"Drilldown: chartBarIndex ",
|
|
22
|
-
|
|
23
|
+
t,
|
|
23
24
|
", tabIndex ",
|
|
24
|
-
|
|
25
|
+
n
|
|
25
26
|
] })
|
|
26
27
|
]
|
|
27
28
|
});
|
|
28
|
-
}),
|
|
29
|
+
}), h = ({ beat: e }) => /* @__PURE__ */ r(l, {
|
|
29
30
|
sx: {
|
|
30
31
|
alignItems: "center",
|
|
31
32
|
gap: 8,
|
|
32
33
|
p: 24,
|
|
33
34
|
textAlign: "center"
|
|
34
35
|
},
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
}), x =
|
|
36
|
+
children: [/* @__PURE__ */ o(d, { children: "Action Block Layer Drilldown (compact)" }), /* @__PURE__ */ r(a, { children: ["Beat: ", e.guid] })]
|
|
37
|
+
}), x = s({
|
|
37
38
|
variants: {
|
|
38
39
|
default: c,
|
|
39
|
-
compact:
|
|
40
|
+
compact: h
|
|
40
41
|
},
|
|
41
42
|
fallback: c,
|
|
42
43
|
name: "Placeholder"
|
|
43
|
-
}), A = i(function({ beat:
|
|
44
|
-
const
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
beat:
|
|
47
|
-
variant:
|
|
44
|
+
}), A = i(function({ beat: t }) {
|
|
45
|
+
const n = p(t);
|
|
46
|
+
return /* @__PURE__ */ o(x, {
|
|
47
|
+
beat: t,
|
|
48
|
+
variant: n?.variant
|
|
48
49
|
});
|
|
49
50
|
});
|
|
50
51
|
export {
|