@mx-cartographer/experiences 9.7.155 → 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 +10 -1
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js +19 -22
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +44 -49
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +37 -41
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BlockErrorMessage.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js +17 -0
- package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +116 -120
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +14 -18
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.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/OverdraftBlock/OverdraftBlock.es.js +28 -30
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +53 -55
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +26 -31
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +38 -41
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js +11 -16
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +39 -42
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +76 -78
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
1
|
+
import { buildDynamicCopy as f } from "../../../core/utils/Localization.es.js";
|
|
2
2
|
import { useGlobalCopyStore as v } from "../../../common/context/hooks.es.js";
|
|
3
|
-
import { CURRENCY_FORMAT as s, formatCurrency as
|
|
3
|
+
import { CURRENCY_FORMAT as s, formatCurrency as p } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { BlockErrorMessage as x } from "../BlockErrorMessage.es.js";
|
|
4
5
|
import { asNumber as _ } from "../../blocks/slotReaders.es.js";
|
|
5
6
|
import { variants as h } from "../../blocks/ChartBlocks/StepChartBlock/index.es.js";
|
|
6
7
|
import { stepForBalance as y } from "./layout.es.js";
|
|
7
8
|
import { SavingsCalculator as C } from "./SavingsCalculator.es.js";
|
|
8
|
-
import { observer as
|
|
9
|
-
import
|
|
10
|
-
import { Text as
|
|
11
|
-
import { jsx as o, jsxs as
|
|
12
|
-
var m = ({ label: i, value:
|
|
9
|
+
import { observer as k } from "mobx-react-lite";
|
|
10
|
+
import a from "@mui/material/Stack";
|
|
11
|
+
import { Text as c } from "@mxenabled/mxui";
|
|
12
|
+
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
13
|
+
var m = ({ label: i, value: e }) => /* @__PURE__ */ t(a, {
|
|
13
14
|
"aria-label": i,
|
|
14
15
|
role: "group",
|
|
15
16
|
sx: {
|
|
@@ -20,58 +21,55 @@ var m = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
|
20
21
|
gap: 4,
|
|
21
22
|
p: 12
|
|
22
23
|
},
|
|
23
|
-
children: [/* @__PURE__ */ o(
|
|
24
|
+
children: [/* @__PURE__ */ o(c, {
|
|
24
25
|
color: "text.secondary",
|
|
25
26
|
variant: "caption",
|
|
26
27
|
children: i
|
|
27
|
-
}), /* @__PURE__ */ o(
|
|
28
|
+
}), /* @__PURE__ */ o(c, {
|
|
28
29
|
bold: !0,
|
|
29
30
|
component: "p",
|
|
30
31
|
variant: "h3",
|
|
31
|
-
children:
|
|
32
|
+
children: e
|
|
32
33
|
})]
|
|
33
|
-
}), U =
|
|
34
|
-
const {
|
|
35
|
-
if (!r) return /* @__PURE__ */ o(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
const t = _(a.insights_payload?.drilldown_data?.savings_account_balance) ?? 0, { goal: l, index: u, labelKey: b } = y(t), { WithText: f } = h;
|
|
40
|
-
return /* @__PURE__ */ n(e, {
|
|
34
|
+
}), U = k(function({ beat: e }) {
|
|
35
|
+
const { insights_feed: d } = v(), r = d?.emergency_savings;
|
|
36
|
+
if (!r) return /* @__PURE__ */ o(x, {});
|
|
37
|
+
const n = _(e.insights_payload?.drilldown_data?.savings_account_balance) ?? 0, { goal: l, index: g, labelKey: u } = y(n), { WithText: b } = h;
|
|
38
|
+
return /* @__PURE__ */ t(a, {
|
|
41
39
|
sx: {
|
|
42
40
|
bgcolor: "background.default",
|
|
43
41
|
gap: 24,
|
|
44
42
|
p: 24
|
|
45
43
|
},
|
|
46
|
-
children: [/* @__PURE__ */
|
|
44
|
+
children: [/* @__PURE__ */ t(a, {
|
|
47
45
|
sx: {
|
|
48
46
|
bgcolor: "background.paper",
|
|
49
47
|
borderRadius: "8px",
|
|
50
48
|
gap: 16,
|
|
51
49
|
p: 16
|
|
52
50
|
},
|
|
53
|
-
children: [/* @__PURE__ */ o(
|
|
54
|
-
completed_steps:
|
|
55
|
-
label_1: r[
|
|
56
|
-
label_2:
|
|
57
|
-
} }), /* @__PURE__ */
|
|
51
|
+
children: [/* @__PURE__ */ o(b, { slotData: {
|
|
52
|
+
completed_steps: g,
|
|
53
|
+
label_1: r[u].toUpperCase(),
|
|
54
|
+
label_2: f(r.amount_in_savings, p(l, s.whole))
|
|
55
|
+
} }), /* @__PURE__ */ t(a, {
|
|
58
56
|
sx: {
|
|
59
57
|
flexDirection: "row",
|
|
60
58
|
gap: 12
|
|
61
59
|
},
|
|
62
60
|
children: [/* @__PURE__ */ o(m, {
|
|
63
61
|
label: r.total_savings_balance,
|
|
64
|
-
value:
|
|
62
|
+
value: p(n, s.cents)
|
|
65
63
|
}), /* @__PURE__ */ o(m, {
|
|
66
64
|
label: r.savings_goal,
|
|
67
|
-
value:
|
|
65
|
+
value: p(l, s.whole)
|
|
68
66
|
})]
|
|
69
67
|
})]
|
|
70
68
|
}), /* @__PURE__ */ o(C, {
|
|
71
|
-
balance:
|
|
69
|
+
balance: n,
|
|
72
70
|
copy: r,
|
|
73
71
|
goal: l
|
|
74
|
-
},
|
|
72
|
+
}, e.guid)]
|
|
75
73
|
});
|
|
76
74
|
});
|
|
77
75
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmergencySavingsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore } from '../../../common'\nimport { buildDynamicCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { variants as stepChartVariants } from '../../blocks/ChartBlocks/StepChartBlock'\nimport { asNumber } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { SavingsCalculator } from './SavingsCalculator'\nimport { stepForBalance } from './layout'\n\nconst AmountBox = ({ label, value }: { label: string; value: string }) => (\n <Stack\n aria-label={label}\n role=\"group\"\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n flex: 1,\n gap: 4,\n p: 12,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h3\">\n {value}\n </Text>\n </Stack>\n)\n\nexport const EmergencySavingsBlock = observer(function EmergencySavingsBlock({\n beat,\n}: ActionBlockProps) {\n const {
|
|
1
|
+
{"version":3,"file":"EmergencySavingsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore } from '../../../common'\nimport { buildDynamicCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { variants as stepChartVariants } from '../../blocks/ChartBlocks/StepChartBlock'\nimport { asNumber } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport { SavingsCalculator } from './SavingsCalculator'\nimport { stepForBalance } from './layout'\n\nconst AmountBox = ({ label, value }: { label: string; value: string }) => (\n <Stack\n aria-label={label}\n role=\"group\"\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n flex: 1,\n gap: 4,\n p: 12,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h3\">\n {value}\n </Text>\n </Stack>\n)\n\nexport const EmergencySavingsBlock = observer(function EmergencySavingsBlock({\n beat,\n}: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const copy = insightsFeedCopy?.emergency_savings\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n const balance = asNumber(beat.insights_payload?.drilldown_data?.savings_account_balance) ?? 0\n const { goal, index, labelKey } = stepForBalance(balance)\n const { WithText: Stepper } = stepChartVariants\n\n return (\n <Stack sx={{ bgcolor: 'background.default', gap: 24, p: 24 }}>\n <Stack sx={{ bgcolor: 'background.paper', borderRadius: '8px', gap: 16, p: 16 }}>\n <Stepper\n slotData={{\n completed_steps: index,\n label_1: copy[labelKey].toUpperCase(),\n label_2: buildDynamicCopy(\n copy.amount_in_savings,\n formatCurrency(goal, CURRENCY_FORMAT.whole),\n ) as string,\n }}\n />\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n <AmountBox\n label={copy.total_savings_balance}\n value={formatCurrency(balance, CURRENCY_FORMAT.cents)}\n />\n <AmountBox\n label={copy.savings_goal}\n value={formatCurrency(goal, CURRENCY_FORMAT.whole)}\n />\n </Stack>\n </Stack>\n <SavingsCalculator balance={balance} copy={copy} goal={goal} key={beat.guid} />\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAgBA,IAAM,IAAA,CAAa,EAAE,O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;AAAA,MACF,EACD,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,eAAe;AAAA,UAAO,KAAK;AAAA,QAAG;AAAA,QAA3C,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UACE,OAAO,EAAK;AAAA,UACZ,OAAO,EAAe,GAAS,EAAgB,KAAK;AAAA,QACrD,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,UACE,OAAO,EAAK;AAAA,UACZ,OAAO,EAAe,GAAM,EAAgB,KAAK;AAAA,QAClD,CAAA,CACI;AAAA,MACF,CAAA,CAAA;AAAA,IACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAA4B,SAAA;AAAA,MAAe,MAAA;AAAA,MAAY,MAAA;AAAA,IAAuB,GAAZ,EAAK,IAAO,CACzE;AAAA;AAEX,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { sanitizeHtml as
|
|
2
|
-
import {
|
|
1
|
+
import { sanitizeHtml as l } from "../../../core/utils/SanitizeHtml.es.js";
|
|
2
|
+
import { BlockErrorMessage as m } from "../BlockErrorMessage.es.js";
|
|
3
3
|
import { readHelp as i } from "./layout.es.js";
|
|
4
|
-
import { observer as
|
|
5
|
-
import
|
|
4
|
+
import { observer as n } from "mobx-react-lite";
|
|
5
|
+
import p from "@mui/material/Stack";
|
|
6
6
|
import { Text as t } from "@mxenabled/mxui";
|
|
7
|
-
import { jsx as o, jsxs as
|
|
7
|
+
import { jsx as o, jsxs as a } from "react/jsx-runtime";
|
|
8
8
|
var s = {
|
|
9
9
|
"& > *": { m: 0 },
|
|
10
10
|
"& > * + *": { mt: 24 },
|
|
11
11
|
"& ul, & ol": { pl: 24 }
|
|
12
|
-
},
|
|
13
|
-
const
|
|
14
|
-
return r ? /* @__PURE__ */
|
|
12
|
+
}, x = n(function({ beat: e }) {
|
|
13
|
+
const r = i(e.insights_payload?.drilldown_data);
|
|
14
|
+
return r ? /* @__PURE__ */ a(p, {
|
|
15
15
|
sx: {
|
|
16
16
|
bgcolor: "background.paper",
|
|
17
17
|
gap: 8,
|
|
@@ -24,17 +24,14 @@ var s = {
|
|
|
24
24
|
children: r.title
|
|
25
25
|
}), /* @__PURE__ */ o(t, {
|
|
26
26
|
component: "div",
|
|
27
|
-
dangerouslySetInnerHTML: { __html:
|
|
27
|
+
dangerouslySetInnerHTML: { __html: l(r.html) },
|
|
28
28
|
sx: s,
|
|
29
29
|
variant: "body1"
|
|
30
30
|
})]
|
|
31
|
-
}) : /* @__PURE__ */ o(
|
|
32
|
-
sx: { p: 24 },
|
|
33
|
-
children: /* @__PURE__ */ o(t, { children: l.error_message })
|
|
34
|
-
});
|
|
31
|
+
}) : /* @__PURE__ */ o(m, {});
|
|
35
32
|
});
|
|
36
33
|
export {
|
|
37
|
-
|
|
34
|
+
x as HelpBlock
|
|
38
35
|
};
|
|
39
36
|
|
|
40
37
|
//# sourceMappingURL=HelpBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/HelpBlock/HelpBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {
|
|
1
|
+
{"version":3,"file":"HelpBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/HelpBlock/HelpBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat } from '../../../core'\nimport { sanitizeHtml } from '../../../core/utils/SanitizeHtml'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\nimport { readHelp } from './layout'\n\nconst HELP_HTML_SX = {\n '& > *': { m: 0 },\n '& > * + *': { mt: 24 },\n '& ul, & ol': { pl: 24 },\n} as const\n\nexport interface HelpBlockProps {\n beat: Beat\n}\n\n/**\n * The \"How was this calculated?\" drawer: the beat's pre-localized help title and body, read from\n * the payload's `drilldown_data` (`help_title`, `help_html`). Opened by a CTA naming `help_block`\n * and by the Transaction List drawer's \"Learn More\" link.\n */\nexport const HelpBlock = observer(function HelpBlock({ beat }: HelpBlockProps) {\n const help = readHelp(beat.insights_payload?.drilldown_data)\n\n if (!help) {\n return <BlockErrorMessage />\n }\n\n return (\n <Stack sx={{ bgcolor: 'background.paper', gap: 8, p: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"h3\">\n {help.title}\n </Text>\n <Text\n component=\"div\"\n dangerouslySetInnerHTML={{ __html: sanitizeHtml(help.html) }}\n sx={HELP_HTML_SX}\n variant=\"body1\"\n />\n </Stack>\n )\n})\n"],"mappings":";;;;;;;AAUA,IAAM,IAAe;AAAA,EACnB,SAAS,EAAE,GAAG,EAAE;AAAA,EAChB,aAAa,EAAE,IAAI,GAAG;AAAA,EACtB,cAAc,EAAE,IAAI,GAAG;AACzB,GAWa,IAAY,EAAS,SAAmB,EAAE,MAAA,EAAA,GAAwB;AAC7E,QAAM,IAAO,EAAS,EAAK,kBAAkB,cAAc;AAE3D,SAAK,IAKH,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,SAAS;AAAA,MAAoB,KAAK;AAAA,MAAG,GAAG;AAAA,IAAG;AAAA,IAAxD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,WAAU;AAAA,MAAK,SAAQ;AAAA,MACtC,UAAA,EAAK;AAAA,IACF,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,MACE,WAAU;AAAA,MACV,yBAAyB,EAAE,QAAQ,EAAa,EAAK,IAAI,EAAE;AAAA,MAC3D,IAAI;AAAA,MACJ,SAAQ;AAAA,IACT,CAAA,CACI;AAAA,OAdA,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAgB/B,CAAC"}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as l, useGlobalCopyStore as
|
|
3
|
-
import { CURRENCY_FORMAT as
|
|
1
|
+
import u from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as l, useGlobalCopyStore as v } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { CURRENCY_FORMAT as g, formatCurrency as x } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { BlockErrorMessage as h } from "../BlockErrorMessage.es.js";
|
|
4
5
|
import { resolveOverdraftFacts as y, resolvePrimaryAccount as _ } from "./layout.es.js";
|
|
5
6
|
import { ConfidenceMeter as b } from "./ConfidenceMeter.es.js";
|
|
6
7
|
import { useEffect as C } from "react";
|
|
7
8
|
import { observer as I } from "mobx-react-lite";
|
|
8
|
-
import
|
|
9
|
-
import { InstitutionLogo as
|
|
10
|
-
import { Icon as
|
|
11
|
-
import { Fragment as
|
|
9
|
+
import n from "@mui/material/Stack";
|
|
10
|
+
import { InstitutionLogo as k, Text as c } from "@mxenabled/mxui";
|
|
11
|
+
import { Icon as A } from "@mxenabled/mx-icons";
|
|
12
|
+
import { Fragment as F, jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
12
13
|
var G = ({ beat: s }) => {
|
|
13
|
-
const { accountsLoaded:
|
|
14
|
+
const { accountsLoaded: e, loadAccounts: i } = l();
|
|
14
15
|
C(() => {
|
|
15
|
-
!s.primary_account && !
|
|
16
|
+
!s.primary_account && !e && i();
|
|
16
17
|
}, []);
|
|
17
|
-
}, L = I(function({ beat:
|
|
18
|
-
const {
|
|
19
|
-
if (!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const a = _(n, f), m = a ? v(a) : "", { amount: p, confidence: d } = y(n);
|
|
24
|
-
return /* @__PURE__ */ t(o, {
|
|
18
|
+
}, L = I(function({ beat: e }) {
|
|
19
|
+
const { insights_feed: i } = v(), { accounts: f } = l(), t = i?.transparent_overdraft;
|
|
20
|
+
if (!t) return /* @__PURE__ */ r(h, {});
|
|
21
|
+
const a = _(e, f), m = a ? u(a) : "", { amount: p, confidence: d } = y(e);
|
|
22
|
+
return /* @__PURE__ */ o(n, {
|
|
25
23
|
sx: {
|
|
26
24
|
bgcolor: "background.paper",
|
|
27
25
|
pb: 24
|
|
28
26
|
},
|
|
29
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ o(n, {
|
|
30
28
|
sx: {
|
|
31
29
|
alignItems: "center",
|
|
32
30
|
gap: 4,
|
|
@@ -34,49 +32,49 @@ var G = ({ beat: s }) => {
|
|
|
34
32
|
py: 16
|
|
35
33
|
},
|
|
36
34
|
children: [
|
|
37
|
-
m && /* @__PURE__ */
|
|
35
|
+
m && /* @__PURE__ */ o(n, {
|
|
38
36
|
sx: {
|
|
39
37
|
alignItems: "center",
|
|
40
38
|
flexDirection: "row",
|
|
41
39
|
gap: 12
|
|
42
40
|
},
|
|
43
|
-
children: [/* @__PURE__ */ r(
|
|
41
|
+
children: [/* @__PURE__ */ r(k, {
|
|
44
42
|
alt: "",
|
|
45
43
|
institutionGuid: a?.institution_guid ?? "",
|
|
46
44
|
size: 20
|
|
47
|
-
}), /* @__PURE__ */ r(
|
|
45
|
+
}), /* @__PURE__ */ r(c, {
|
|
48
46
|
bold: !0,
|
|
49
47
|
component: "p",
|
|
50
48
|
variant: "body1",
|
|
51
49
|
children: m
|
|
52
50
|
})]
|
|
53
51
|
}),
|
|
54
|
-
p !== void 0 && /* @__PURE__ */ r(
|
|
52
|
+
p !== void 0 && /* @__PURE__ */ r(c, {
|
|
55
53
|
bold: !0,
|
|
56
54
|
component: "p",
|
|
57
55
|
variant: "h1",
|
|
58
|
-
children:
|
|
56
|
+
children: x(p, g.cents)
|
|
59
57
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ o(n, {
|
|
61
59
|
sx: {
|
|
62
60
|
alignItems: "center",
|
|
63
61
|
flexDirection: "row",
|
|
64
62
|
gap: 4
|
|
65
63
|
},
|
|
66
|
-
children: [/* @__PURE__ */ r(
|
|
64
|
+
children: [/* @__PURE__ */ r(A, {
|
|
67
65
|
"aria-hidden": "true",
|
|
68
66
|
fill: !0,
|
|
69
67
|
name: "error",
|
|
70
68
|
size: 16,
|
|
71
69
|
sx: { color: "warning.main" }
|
|
72
|
-
}), /* @__PURE__ */ r(
|
|
70
|
+
}), /* @__PURE__ */ r(c, {
|
|
73
71
|
color: "text.secondary",
|
|
74
72
|
variant: "body2",
|
|
75
|
-
children:
|
|
73
|
+
children: t.to_occur_within_the_next_seven_days
|
|
76
74
|
})]
|
|
77
75
|
})
|
|
78
76
|
]
|
|
79
|
-
}), d !== void 0 && /* @__PURE__ */
|
|
77
|
+
}), d !== void 0 && /* @__PURE__ */ o(F, { children: [/* @__PURE__ */ r(c, {
|
|
80
78
|
bold: !0,
|
|
81
79
|
component: "h3",
|
|
82
80
|
sx: {
|
|
@@ -85,9 +83,9 @@ var G = ({ beat: s }) => {
|
|
|
85
83
|
textTransform: "uppercase"
|
|
86
84
|
},
|
|
87
85
|
variant: "caption",
|
|
88
|
-
children:
|
|
86
|
+
children: t.confidence_level
|
|
89
87
|
}), /* @__PURE__ */ r(b, {
|
|
90
|
-
copy:
|
|
88
|
+
copy: t,
|
|
91
89
|
level: d
|
|
92
90
|
})] })]
|
|
93
91
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverdraftBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { ConfidenceMeter } from './ConfidenceMeter'\nimport { resolvePrimaryAccount, resolveOverdraftFacts } from './layout'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const useOverdraftPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n/**\n * Transparent Overdraft's \"Learn more\" drawer (MEW2-3355): the account at risk, the projected\n * overdraft amount, when it is expected, and the confidence meter. Everything is on the beat; the\n * account store is read only to name the account when the host did not attach it.\n */\nexport const OverdraftBlock = observer(function OverdraftBlock({ beat }: ActionBlockProps) {\n const {
|
|
1
|
+
{"version":3,"file":"OverdraftBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport { ConfidenceMeter } from './ConfidenceMeter'\nimport { resolvePrimaryAccount, resolveOverdraftFacts } from './layout'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const useOverdraftPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n/**\n * Transparent Overdraft's \"Learn more\" drawer (MEW2-3355): the account at risk, the projected\n * overdraft amount, when it is expected, and the confidence meter. Everything is on the beat; the\n * account store is read only to name the account when the host did not attach it.\n */\nexport const OverdraftBlock = observer(function OverdraftBlock({ beat }: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accounts } = useAccountStore()\n const copy = insightsFeedCopy?.transparent_overdraft\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n const account = resolvePrimaryAccount(beat, accounts)\n const accountName = account ? getAccountDisplayName(account) : ''\n const { amount, confidence } = resolveOverdraftFacts(beat)\n\n return (\n <Stack sx={{ bgcolor: 'background.paper', pb: 24 }}>\n <Stack sx={{ alignItems: 'center', gap: 4, px: 24, py: 16 }}>\n {accountName && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <InstitutionLogo alt=\"\" institutionGuid={account?.institution_guid ?? ''} size={20} />\n <Text bold={true} component=\"p\" variant=\"body1\">\n {accountName}\n </Text>\n </Stack>\n )}\n {amount !== undefined && (\n <Text bold={true} component=\"p\" variant=\"h1\">\n {formatCurrency(amount, CURRENCY_FORMAT.cents)}\n </Text>\n )}\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n <Icon\n aria-hidden=\"true\"\n fill={true}\n name=\"error\"\n size={16}\n sx={{ color: 'warning.main' }}\n />\n <Text color=\"text.secondary\" variant=\"body2\">\n {copy.to_occur_within_the_next_seven_days}\n </Text>\n </Stack>\n </Stack>\n {confidence !== undefined && (\n <>\n <Text\n bold={true}\n component=\"h3\"\n sx={{ px: 24, py: 12, textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {copy.confidence_level}\n </Text>\n <ConfidenceMeter copy={copy} level={confidence} />\n </>\n )}\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAa,IAAA,CAAuB,EAAE,MAAA,EAAA,MAA6B;AACjE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,E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;AAAA,QACzC,CAAA;AAAA,QAER,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,YAAY;AAAA,YAAU,eAAe;AAAA,YAAO,KAAK;AAAA,UAAE;AAAA,UAAhE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YACE,eAAY;AAAA,YACZ,MAAM;AAAA,YACN,MAAK;AAAA,YACL,MAAM;AAAA,YACN,IAAI,EAAE,OAAO,eAAe;AAAA,UAC7B,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA,EAAK;AAAA,UACF,CAAA,CACD;AAAA;MACF;AAAA,IACN,CAAA,GAAA,MAAe,UACd,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,WAAU;AAAA,MACV,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,QAAI,eAAe;AAAA,MAAY;AAAA,MACjD,SAAQ;AAAA,MAEP,UAAA,EAAK;AAAA,IACF,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,MAAuB,MAAA;AAAA,MAAM,OAAO;AAAA,IAAa,CAAA,CACjD,EAAA,CAAA,CAEC;AAAA;AAEX,CAAC"}
|
|
@@ -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,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GAAG,CAAC,CAAC;AACP,GAYM,IAAA,CAAwB,EAAE,SAAA,GAAS,MAAA,EAAA,MAAsC;AAC7E,QAAM,IAAK,EAAM,MAAM,GACjB,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAA,MAA6B,EAAoB,CAAO,CAAC,GACrF,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAuB,CAAC,CAAC,GACrD,CAAC,GAAS,CAAA,IAAc,EAAM,SAAkB,EAAE,QAAQ,OAAO,CAAC,GAElE,IAAc,IAAU,EAAsB,CAAO,IAAI,IAEzD,IAAA,CAAY,MAAA,CAAwB,MACxC,EAAA,CAAW,OAAc;AAAA,IAAE,GAAG;AAAA,IAAW,CAAA,CAAA,GAAQ,EAAM,OAAO;AAAA,EAAM,EAAE,GAElE,IAAA,CAAgB,MAA4C;AAChE,IAAA,EAAM,eAAe;AAErB,UAAM,IAAa,EAAqB,GAAQ,CAAI;AAGpD,QAD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