@mx-cartographer/experiences 9.7.167 → 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 +8 -0
- package/dist/budgets/components/budgetdetails/BudgetDetails.es.js +35 -35
- package/dist/budgets/components/budgetdetails/BudgetDetails.es.js.map +1 -1
- package/dist/core/types/AppData.d.ts +1 -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/dist/spending/components/Spending.es.js +52 -52
- package/dist/spending/components/Spending.es.js.map +1 -1
- package/dist/trends/components/CategoryDetails.es.js +36 -36
- package/dist/trends/components/CategoryDetails.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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
|
+
|
|
5
|
+
## [9.7.168] - 11-16-2026
|
|
6
|
+
|
|
7
|
+
- **ADDED** - `clientConfig.transactions.hide_export_csv` client setting to hide Export CSV in the spending, budgets, and trends widgets (WELL-131)
|
|
8
|
+
|
|
1
9
|
## [9.7.167] - 11-16-2026
|
|
2
10
|
|
|
3
11
|
- **FIXED** - Shared dialog titles are read by screen readers and wrap instead of being cut off, and dialogs use the paper background (WELL-202)
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import { useScreenSize as
|
|
3
|
-
import
|
|
4
|
-
import { exportTransactionsToCSV as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Header as
|
|
8
|
-
import { SubBudgetList as
|
|
1
|
+
import { useAppConfig as D, useBudgetsStore as j, useGlobalCopyStore as G, useTransactionStore as I } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { useScreenSize as L } from "../../../common/hooks/useScreenSize.es.js";
|
|
3
|
+
import z from "../../../common/components/drawer/Drawer.es.js";
|
|
4
|
+
import { exportTransactionsToCSV as A } from "../../../core/utils/TransactionUtils.es.js";
|
|
5
|
+
import E from "../../../transactions/components/shared/TransactionList.es.js";
|
|
6
|
+
import W from "../../../transactions/components/shared/TransactionDetails.es.js";
|
|
7
|
+
import { Header as H } from "./Header.es.js";
|
|
8
|
+
import { SubBudgetList as M } from "./SubBudgetList.es.js";
|
|
9
9
|
import c from "react";
|
|
10
|
-
import { observer as
|
|
10
|
+
import { observer as O } from "mobx-react-lite";
|
|
11
11
|
import e from "@mui/material/Stack";
|
|
12
|
-
import { Icon as
|
|
13
|
-
import
|
|
12
|
+
import { Icon as R } from "@mxenabled/mxui";
|
|
13
|
+
import V from "@mui/material/Button";
|
|
14
14
|
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
15
15
|
import p from "@mui/material/Tab";
|
|
16
|
-
import
|
|
17
|
-
var
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
16
|
+
import $ from "@mui/material/Tabs";
|
|
17
|
+
var nt = O(({ budget: l }) => {
|
|
18
|
+
const { clientConfig: u, is_mobile_webview: f } = D(), { setAlert: h } = j(), { budgets: o, common: b, transactions: _ } = G(), { isDesktop: T, isSmallTablet: C, isTablet: g } = L(), { sortedTransactions: s, sortedTransactionsWithSplits: S, tags: v } = I(), [n, x] = c.useState(0), [m, a] = c.useState(""), i = c.useMemo(() => s.find((d) => d.guid === m), [m, s]), w = (d, k) => {
|
|
19
|
+
x(k);
|
|
20
|
+
}, y = () => {
|
|
21
|
+
A(S, v), h({
|
|
22
22
|
msg: o.alert_csv_downloaded,
|
|
23
23
|
severity: "success"
|
|
24
24
|
});
|
|
25
|
-
},
|
|
25
|
+
}, B = s.length > 0 && !f && !u?.transactions?.hide_export_csv && (T || g && !C);
|
|
26
26
|
return /* @__PURE__ */ r(e, {
|
|
27
27
|
gap: 24,
|
|
28
|
-
children: [/* @__PURE__ */ t(
|
|
29
|
-
/* @__PURE__ */ r(
|
|
30
|
-
onChange:
|
|
28
|
+
children: [/* @__PURE__ */ t(H, { budget: l }), /* @__PURE__ */ r(e, { children: [
|
|
29
|
+
/* @__PURE__ */ r($, {
|
|
30
|
+
onChange: w,
|
|
31
31
|
sx: { width: "100%" },
|
|
32
32
|
textColor: "primary",
|
|
33
|
-
value:
|
|
33
|
+
value: n,
|
|
34
34
|
variant: "fullWidth",
|
|
35
35
|
children: [/* @__PURE__ */ t(p, { label: o.details_transactions_tab }), /* @__PURE__ */ t(p, { label: o.details_subbudgets_tab })]
|
|
36
36
|
}),
|
|
37
|
-
|
|
37
|
+
n === 0 && /* @__PURE__ */ r(e, { children: [B && /* @__PURE__ */ t(e, {
|
|
38
38
|
direction: "row",
|
|
39
39
|
justifyContent: "right",
|
|
40
40
|
mb: -24,
|
|
41
41
|
mr: 8,
|
|
42
42
|
mt: 8,
|
|
43
43
|
zIndex: 1,
|
|
44
|
-
children: /* @__PURE__ */ t(
|
|
45
|
-
onClick:
|
|
46
|
-
startIcon: /* @__PURE__ */ t(
|
|
44
|
+
children: /* @__PURE__ */ t(V, {
|
|
45
|
+
onClick: y,
|
|
46
|
+
startIcon: /* @__PURE__ */ t(R, { name: "ios_share" }),
|
|
47
47
|
variant: "text",
|
|
48
|
-
children:
|
|
48
|
+
children: _.export_csv_btn
|
|
49
49
|
})
|
|
50
|
-
}), /* @__PURE__ */ t(
|
|
50
|
+
}), /* @__PURE__ */ t(E, {
|
|
51
51
|
height: "100%",
|
|
52
|
-
onClick:
|
|
52
|
+
onClick: a
|
|
53
53
|
})] }),
|
|
54
|
-
|
|
54
|
+
n === 1 && /* @__PURE__ */ t(M, {
|
|
55
55
|
budget: l,
|
|
56
|
-
onTransactionClick:
|
|
56
|
+
onTransactionClick: a
|
|
57
57
|
}),
|
|
58
|
-
/* @__PURE__ */ t(
|
|
58
|
+
/* @__PURE__ */ t(z, {
|
|
59
59
|
ariaLabelClose: b.close_aria,
|
|
60
60
|
isOpen: !!i,
|
|
61
|
-
onClose: () =>
|
|
61
|
+
onClose: () => a(""),
|
|
62
62
|
title: o.details_transaction_drawer,
|
|
63
|
-
children: i && /* @__PURE__ */ t(
|
|
63
|
+
children: i && /* @__PURE__ */ t(W, { transaction: i })
|
|
64
64
|
})
|
|
65
65
|
] })]
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
export {
|
|
69
|
-
|
|
69
|
+
nt as BudgetDetails
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
//# sourceMappingURL=BudgetDetails.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetDetails.es.js","names":[],"sources":["../../../../src/budgets/components/budgetdetails/BudgetDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { Icon } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useBudgetsStore,\n useGlobalCopyStore,\n useScreenSize,\n useTransactionStore,\n} from '../../../common'\nimport { type DetailedBudget } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\n\nimport { TransactionDetails, TransactionList } from '../../../transactions'\n\nimport { Header } from './Header'\nimport { SubBudgetList } from './SubBudgetList'\n\ninterface BudgetDetailsProps {\n budget: DetailedBudget\n}\n\nexport const BudgetDetails: React.FC<BudgetDetailsProps> = observer(({ budget }) => {\n const { is_mobile_webview } = useAppConfig()\n const { setAlert } = useBudgetsStore()\n const { budgets: copy, common: commonCopy, transactions: transactionCopy } = useGlobalCopyStore()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const {\n sortedTransactions: transactions,\n sortedTransactionsWithSplits,\n tags,\n } = useTransactionStore()\n\n const [selectedTab, setSelectedTab] = React.useState(0)\n const [transactionGuid, setTransactionGuid] = React.useState('')\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => {\n setSelectedTab(newValue)\n }\n\n const handleExportToCsv = () => {\n exportTransactionsToCSV(sortedTransactionsWithSplits, tags)\n setAlert({ msg: copy.alert_csv_downloaded, severity: 'success' })\n }\n\n const shouldShowExportButton =\n transactions.length > 0
|
|
1
|
+
{"version":3,"file":"BudgetDetails.es.js","names":[],"sources":["../../../../src/budgets/components/budgetdetails/BudgetDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { Icon } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useBudgetsStore,\n useGlobalCopyStore,\n useScreenSize,\n useTransactionStore,\n} from '../../../common'\nimport { type DetailedBudget } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\n\nimport { TransactionDetails, TransactionList } from '../../../transactions'\n\nimport { Header } from './Header'\nimport { SubBudgetList } from './SubBudgetList'\n\ninterface BudgetDetailsProps {\n budget: DetailedBudget\n}\n\nexport const BudgetDetails: React.FC<BudgetDetailsProps> = observer(({ budget }) => {\n const { clientConfig, is_mobile_webview } = useAppConfig()\n const { setAlert } = useBudgetsStore()\n const { budgets: copy, common: commonCopy, transactions: transactionCopy } = useGlobalCopyStore()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const {\n sortedTransactions: transactions,\n sortedTransactionsWithSplits,\n tags,\n } = useTransactionStore()\n\n const [selectedTab, setSelectedTab] = React.useState(0)\n const [transactionGuid, setTransactionGuid] = React.useState('')\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => {\n setSelectedTab(newValue)\n }\n\n const handleExportToCsv = () => {\n exportTransactionsToCSV(sortedTransactionsWithSplits, tags)\n setAlert({ msg: copy.alert_csv_downloaded, severity: 'success' })\n }\n\n const shouldShowExportButton =\n transactions.length > 0 &&\n !is_mobile_webview &&\n !clientConfig?.transactions?.hide_export_csv &&\n (isDesktop || (isTablet && !isSmallTablet))\n\n return (\n <Stack gap={24}>\n <Header budget={budget} />\n\n <Stack>\n <Tabs\n onChange={handleTabChange}\n sx={{ width: '100%' }}\n textColor=\"primary\"\n value={selectedTab}\n variant=\"fullWidth\"\n >\n <Tab label={copy.details_transactions_tab} />\n <Tab label={copy.details_subbudgets_tab} />\n </Tabs>\n {selectedTab === 0 && (\n <Stack>\n {shouldShowExportButton && (\n <Stack direction=\"row\" justifyContent=\"right\" mb={-24} mr={8} mt={8} zIndex={1}>\n <Button\n onClick={handleExportToCsv}\n startIcon={<Icon name=\"ios_share\" />}\n variant=\"text\"\n >\n {transactionCopy.export_csv_btn}\n </Button>\n </Stack>\n )}\n <TransactionList height=\"100%\" onClick={setTransactionGuid} />\n </Stack>\n )}\n {selectedTab === 1 && (\n <SubBudgetList budget={budget} onTransactionClick={setTransactionGuid} />\n )}\n\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={copy.details_transaction_drawer}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Stack>\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAa,KAA8C,EAAA,CAAU,EAAE,QAAA,EAAA,MAAa;AAClF,QAAM,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAa,GACnD,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/B,EAAE,SAAS,GAAM,QAAQ,GAAY,cAAc,EAAA,IAAoB,EAAmB,GAC1F,EAAE,WAAA,GAAW,eAAA,GAAe,UAAA,EAAA,IAAa,EAAc,GACvD,EACJ,oBAAoB,GACpB,8BAAA,GACA,MAAA,EAAA,IACE,EAAoB,GAElB,CAAC,GAAa,CAAA,IAAkB,EAAM,SAAS,CAAC,GAChD,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAS,EAAE,GAEzD,IAAc,EAAM,QAAA,MAClB,EAAa,KAAA,CAAM,MAAM,EAAE,SAAS,CAAe,GACzD,CAAC,GAAiB,CAAY,CAChC,GAEM,IAAA,CAAmB,GAA8B,MAAqB;AAC1E,IAAA,EAAe,CAAQ;AAAA,EACzB,GAEM,IAAA,MAA0B;AAC9B,IAAA,EAAwB,GAA8B,CAAI,GAC1D,EAAS;AAAA,MAAE,KAAK,EAAK;AAAA,MAAsB,UAAU;AAAA,IAAU,CAAC;AAAA,EAClE,GAEM,IACJ,EAAa,SAAS,KACtB,CAAC,KACD,CAAC,GAAc,cAAc,oBAC5B,KAAc,KAAY,CAAC;AAE9B,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,KAAK;AAAA,IAAZ,UAAA,CACE,gBAAA,EAAC,GAAD,EAAgB,QAAA,EAAS,CAAA,GAEzB,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD;AAAA,QACE,UAAU;AAAA,QACV,IAAI,EAAE,OAAO,OAAO;AAAA,QACpB,WAAU;AAAA,QACV,OAAO;AAAA,QACP,SAAQ;AAAA,QALV,UAAA,CAOE,gBAAA,EAAC,GAAD,EAAK,OAAO,EAAK,yBAA2B,CAAA,GAC5C,gBAAA,EAAC,GAAD,EAAK,OAAO,EAAK,uBAAyB,CAAA,CACtC;AAAA;MACL,MAAgB,KACf,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QAAQ,IAAI;AAAA,QAAK,IAAI;AAAA,QAAG,IAAI;AAAA,QAAG,QAAQ;AAAA,QAC3E,UAAA,gBAAA,EAAC,GAAD;AAAA,UACE,SAAS;AAAA,UACT,WAAW,gBAAA,EAAC,GAAD,EAAM,MAAK,YAAa,CAAA;AAAA,UACnC,SAAQ;AAAA,UAEP,UAAA,EAAgB;AAAA,QACX,CAAA;AAAA,MACH,CAAA,GAET,gBAAA,EAAC,GAAD;AAAA,QAAiB,QAAO;AAAA,QAAO,SAAS;AAAA,MAAqB,CAAA,CACxD,EAAA,CAAA;AAAA,MAER,MAAgB,KACf,gBAAA,EAAC,GAAD;AAAA,QAAuB,QAAA;AAAA,QAAQ,oBAAoB;AAAA,MAAqB,CAAA;AAAA,MAG1E,gBAAA,EAAC,GAAD;AAAA,QACE,gBAAgB,EAAW;AAAA,QAC3B,QAAQ,EAAQ;AAAA,QAChB,SAAA,MAAe,EAAmB,EAAE;AAAA,QACpC,OAAO,EAAK;AAAA,QAEX,UAAA,KAAe,gBAAA,EAAC,GAAD,EAAiC,aAAA,EAAc,CAAA;AAAA,MACzD,CAAA;AAAA,IACH,EAAA,CAAA,CACF;AAAA;AAEX,CAAC"}
|
|
@@ -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(selectPayoffCalculat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AM,CAAQ;AAAA,IACvC,MAAA;AAAA,EAEP,GADM,EAAK,IACX;AAEL,CAAC"}
|
|
1
|
+
{"version":3,"file":"PayoffCalculatorBlock.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,E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gB,GAC/B,IAAO,EAAgB,CAA0B;AAEvD,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAsB,GAAM,CAAQ;AAAA,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;
|