@mx-cartographer/experiences 9.7.159 → 9.7.160
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 +7 -0
- package/dist/common/components/ErrorBoundary.d.ts +1 -0
- package/dist/common/components/ErrorBoundary.es.js +1 -1
- package/dist/common/components/ErrorBoundary.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +39 -39
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +40 -35
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +73 -74
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +20 -21
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +36 -38
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +29 -30
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +60 -59
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +20 -20
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +36 -36
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +77 -76
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/useRequiredCopy.d.ts +3 -0
- package/dist/insights-v2/actionBlocks/useRequiredCopy.es.js +11 -0
- package/dist/insights-v2/actionBlocks/useRequiredCopy.es.js.map +1 -0
- package/dist/insights-v2/mappings/blocks.d.ts +1 -0
- package/dist/insights-v2/mappings/blocks.es.js +190 -178
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 {
|
|
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 { buildDynamicCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { GlobalCopy } from '../../../core'\nimport { variants as stepChartVariants } from '../../blocks/ChartBlocks/StepChartBlock'\nimport { asNumber } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useRequiredCopy } from '../useRequiredCopy'\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 selectEmergencySavingsCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.emergency_savings\n\nexport const EmergencySavingsBlock = observer(function EmergencySavingsBlock({\n beat,\n}: ActionBlockProps) {\n const copy = useRequiredCopy(selectEmergencySavingsCopy)\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,OAAA,GAAO,OAAA,EAAA,MAC1B,gBAAA,EAAC,GAAD;AAAA,EACE,cAAY;AAAA,EACZ,MAAK;AAAA,EACL,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,cAAc;AAAA,IACd,MAAM;AAAA,IACN,KAAK;AAAA,IACL,GAAG;AAAA,EACL;AAAA,EAVF,UAAA,CAYE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,SAAQ;AAAA,IAClC,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,WAAU;AAAA,IAAI,SAAQ;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;AAAA,IAAuB,GAAZ,EAAK,IAAO,CACzE;AAAA;AAEX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { EmergencySavingsBlock } from './EmergencySavingsBlock';
|
|
1
|
+
export { EmergencySavingsBlock, selectEmergencySavingsCopy } from './EmergencySavingsBlock';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { GlobalCopy } from '../../../core';
|
|
1
2
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
2
3
|
/** Loads accounts once per open when the host did not attach the beat's primary account. */
|
|
3
4
|
export declare const useOverdraftPrepare: ({ beat }: ActionBlockProps) => void;
|
|
5
|
+
export declare const selectOverdraftCopy: (copy: GlobalCopy) => import('../../../core').OverdraftCopy | undefined;
|
|
4
6
|
/**
|
|
5
7
|
* Transparent Overdraft's "Learn more" drawer (MEW2-3355): the account at risk, the projected
|
|
6
8
|
* overdraft amount, when it is expected, and the confidence meter. Everything is on the beat; the
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as l
|
|
3
|
-
import { CURRENCY_FORMAT as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ConfidenceMeter as
|
|
7
|
-
import { useEffect as
|
|
8
|
-
import { observer as
|
|
1
|
+
import f from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as l } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { CURRENCY_FORMAT as u, formatCurrency as v } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { resolveOverdraftFacts as x, resolvePrimaryAccount as g } from "./layout.es.js";
|
|
5
|
+
import { useRequiredCopy as h } from "../useRequiredCopy.es.js";
|
|
6
|
+
import { ConfidenceMeter as y } from "./ConfidenceMeter.es.js";
|
|
7
|
+
import { useEffect as _ } from "react";
|
|
8
|
+
import { observer as b } from "mobx-react-lite";
|
|
9
9
|
import n from "@mui/material/Stack";
|
|
10
|
-
import { InstitutionLogo as
|
|
11
|
-
import { Icon as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
var
|
|
14
|
-
const { accountsLoaded:
|
|
15
|
-
|
|
16
|
-
!
|
|
10
|
+
import { InstitutionLogo as C, Text as c } from "@mxenabled/mxui";
|
|
11
|
+
import { Icon as I } from "@mxenabled/mx-icons";
|
|
12
|
+
import { Fragment as O, jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
13
|
+
var M = ({ beat: e }) => {
|
|
14
|
+
const { accountsLoaded: t, loadAccounts: i } = l();
|
|
15
|
+
_(() => {
|
|
16
|
+
!e.primary_account && !t && i();
|
|
17
17
|
}, []);
|
|
18
|
-
},
|
|
19
|
-
const {
|
|
20
|
-
if (!t) return /* @__PURE__ */ r(h, {});
|
|
21
|
-
const a = _(e, f), m = a ? u(a) : "", { amount: p, confidence: d } = y(e);
|
|
18
|
+
}, A = (e) => e.insights_feed?.transparent_overdraft, P = b(function({ beat: t }) {
|
|
19
|
+
const { accounts: i } = l(), a = h(A), s = g(t, i), m = s ? f(s) : "", { amount: p, confidence: d } = x(t);
|
|
22
20
|
return /* @__PURE__ */ o(n, {
|
|
23
21
|
sx: {
|
|
24
22
|
bgcolor: "background.paper",
|
|
@@ -38,9 +36,9 @@ var G = ({ beat: s }) => {
|
|
|
38
36
|
flexDirection: "row",
|
|
39
37
|
gap: 12
|
|
40
38
|
},
|
|
41
|
-
children: [/* @__PURE__ */ r(
|
|
39
|
+
children: [/* @__PURE__ */ r(C, {
|
|
42
40
|
alt: "",
|
|
43
|
-
institutionGuid:
|
|
41
|
+
institutionGuid: s?.institution_guid ?? "",
|
|
44
42
|
size: 20
|
|
45
43
|
}), /* @__PURE__ */ r(c, {
|
|
46
44
|
bold: !0,
|
|
@@ -53,7 +51,7 @@ var G = ({ beat: s }) => {
|
|
|
53
51
|
bold: !0,
|
|
54
52
|
component: "p",
|
|
55
53
|
variant: "h1",
|
|
56
|
-
children:
|
|
54
|
+
children: v(p, u.cents)
|
|
57
55
|
}),
|
|
58
56
|
/* @__PURE__ */ o(n, {
|
|
59
57
|
sx: {
|
|
@@ -61,7 +59,7 @@ var G = ({ beat: s }) => {
|
|
|
61
59
|
flexDirection: "row",
|
|
62
60
|
gap: 4
|
|
63
61
|
},
|
|
64
|
-
children: [/* @__PURE__ */ r(
|
|
62
|
+
children: [/* @__PURE__ */ r(I, {
|
|
65
63
|
"aria-hidden": "true",
|
|
66
64
|
fill: !0,
|
|
67
65
|
name: "error",
|
|
@@ -70,11 +68,11 @@ var G = ({ beat: s }) => {
|
|
|
70
68
|
}), /* @__PURE__ */ r(c, {
|
|
71
69
|
color: "text.secondary",
|
|
72
70
|
variant: "body2",
|
|
73
|
-
children:
|
|
71
|
+
children: a.to_occur_within_the_next_seven_days
|
|
74
72
|
})]
|
|
75
73
|
})
|
|
76
74
|
]
|
|
77
|
-
}), d !== void 0 && /* @__PURE__ */ o(
|
|
75
|
+
}), d !== void 0 && /* @__PURE__ */ o(O, { children: [/* @__PURE__ */ r(c, {
|
|
78
76
|
bold: !0,
|
|
79
77
|
component: "h3",
|
|
80
78
|
sx: {
|
|
@@ -83,16 +81,17 @@ var G = ({ beat: s }) => {
|
|
|
83
81
|
textTransform: "uppercase"
|
|
84
82
|
},
|
|
85
83
|
variant: "caption",
|
|
86
|
-
children:
|
|
87
|
-
}), /* @__PURE__ */ r(
|
|
88
|
-
copy:
|
|
84
|
+
children: a.confidence_level
|
|
85
|
+
}), /* @__PURE__ */ r(y, {
|
|
86
|
+
copy: a,
|
|
89
87
|
level: d
|
|
90
88
|
})] })]
|
|
91
89
|
});
|
|
92
90
|
});
|
|
93
91
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
P as OverdraftBlock,
|
|
93
|
+
A as selectOverdraftCopy,
|
|
94
|
+
M as useOverdraftPrepare
|
|
96
95
|
};
|
|
97
96
|
|
|
98
97
|
//# sourceMappingURL=OverdraftBlock.es.js.map
|
|
@@ -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
|
|
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 } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { GlobalCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useRequiredCopy } from '../useRequiredCopy'\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\nexport const selectOverdraftCopy = (copy: GlobalCopy) => copy.insights_feed?.transparent_overdraft\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 { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectOverdraftCopy)\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":";;;;;;;;;;;;AAmBA,IAAa,IAAA,CAAuB,EAAE,MAAA,EAAA,MAA6B;AACjE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAA,MAAgB;AACd,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GAAG,CAAC,CAAC;AACP,GAEa,IAAA,CAAuB,MAAqB,EAAK,eAAe,uBAOhE,IAAiB,EAAS,SAAwB,EAAE,MAAA,EAAA,GAA0B;AACzF,QAAM,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/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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 +1 @@
|
|
|
1
|
-
export { OverdraftBlock, useOverdraftPrepare } from './OverdraftBlock';
|
|
1
|
+
export { OverdraftBlock, useOverdraftPrepare, selectOverdraftCopy } from './OverdraftBlock';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { GlobalCopy, PayoffCalculatorCopy } from '../../../core';
|
|
1
2
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
2
3
|
/** Loads accounts once per open when the host did not attach the beat's primary account. */
|
|
3
4
|
export declare const usePayoffCalculatorPrepare: ({ beat }: ActionBlockProps) => void;
|
|
5
|
+
export declare const selectPayoffCalculatorCopy: (copy: GlobalCopy) => PayoffCalculatorCopy | undefined;
|
|
4
6
|
/**
|
|
5
7
|
* Monthly Credit Card Interest Summary's "Learn how to save" drawer: the credit card payoff
|
|
6
8
|
* calculator. The beat's account prefills the balance, interest rate and minimum payment; the
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as
|
|
1
|
+
import _ from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as x } from "../../../common/context/hooks.es.js";
|
|
3
3
|
import A from "../../../common/components/Loader.es.js";
|
|
4
|
-
import {
|
|
5
|
-
import { isPayoffPossible as
|
|
6
|
-
import { buildPayoffRows as
|
|
7
|
-
import { CalculationFailed as
|
|
8
|
-
import
|
|
9
|
-
import { observer as
|
|
10
|
-
import
|
|
11
|
-
import { InstitutionLogo as
|
|
12
|
-
import
|
|
13
|
-
import { jsx as o, jsxs as
|
|
14
|
-
import
|
|
15
|
-
var et = ({ beat:
|
|
16
|
-
const { accountsLoaded: t, loadAccounts:
|
|
17
|
-
|
|
18
|
-
!
|
|
4
|
+
import { useRequiredCopy as S } from "../useRequiredCopy.es.js";
|
|
5
|
+
import { isPayoffPossible as w } from "./payoff.es.js";
|
|
6
|
+
import { buildPayoffRows as R, initialPayoffInputs as k, parsePayoffInputs as D, resolvePrimaryAccount as F, validatePayoffInputs as L } from "./layout.es.js";
|
|
7
|
+
import { CalculationFailed as $, PayoffResults as j } from "./PayoffResults.es.js";
|
|
8
|
+
import l from "react";
|
|
9
|
+
import { observer as B } from "mobx-react-lite";
|
|
10
|
+
import c from "@mui/material/Stack";
|
|
11
|
+
import { InstitutionLogo as E, Text as b, TextField as T } from "@mxenabled/mxui";
|
|
12
|
+
import N from "@mui/material/Button";
|
|
13
|
+
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
14
|
+
import O from "@mui/material/InputAdornment";
|
|
15
|
+
var et = ({ beat: e }) => {
|
|
16
|
+
const { accountsLoaded: t, loadAccounts: s } = x();
|
|
17
|
+
l.useEffect(() => {
|
|
18
|
+
!e.primary_account && !t && s();
|
|
19
19
|
}, []);
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
...
|
|
23
|
-
[
|
|
24
|
-
})),
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const { balance:
|
|
29
|
-
|
|
20
|
+
}, W = ({ account: e, copy: t }) => {
|
|
21
|
+
const s = l.useId(), [n, m] = l.useState(() => k(e)), [p, v] = l.useState({}), [f, g] = l.useState({ status: "idle" }), y = e ? _(e) : "", C = (r) => (a) => m((i) => ({
|
|
22
|
+
...i,
|
|
23
|
+
[r]: a.target.value
|
|
24
|
+
})), I = (r) => {
|
|
25
|
+
r.preventDefault();
|
|
26
|
+
const a = L(n, t);
|
|
27
|
+
if (v(a), Object.keys(a).length > 0) return;
|
|
28
|
+
const { balance: i, interestRate: h, monthlyPayment: P } = D(n);
|
|
29
|
+
g(w(h, i, P) ? {
|
|
30
30
|
status: "calculated",
|
|
31
|
-
rows:
|
|
31
|
+
rows: R(h, i, P)
|
|
32
32
|
} : { status: "failed" });
|
|
33
|
-
},
|
|
34
|
-
error: !!
|
|
33
|
+
}, d = (r, a, i) => /* @__PURE__ */ o(T, {
|
|
34
|
+
error: !!p[r],
|
|
35
35
|
fullWidth: !0,
|
|
36
|
-
helperText:
|
|
37
|
-
id: `${
|
|
38
|
-
label:
|
|
39
|
-
onChange:
|
|
36
|
+
helperText: p[r],
|
|
37
|
+
id: `${s}-${r}`,
|
|
38
|
+
label: a,
|
|
39
|
+
onChange: C(r),
|
|
40
40
|
slotProps: {
|
|
41
41
|
htmlInput: { inputMode: "decimal" },
|
|
42
|
-
input: { [
|
|
42
|
+
input: { [i.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */ o(O, {
|
|
43
43
|
"aria-hidden": "true",
|
|
44
|
-
position:
|
|
45
|
-
children:
|
|
44
|
+
position: i.position,
|
|
45
|
+
children: i.symbol
|
|
46
46
|
}) }
|
|
47
47
|
},
|
|
48
|
-
value:
|
|
48
|
+
value: n[r]
|
|
49
49
|
});
|
|
50
|
-
return /* @__PURE__ */
|
|
50
|
+
return /* @__PURE__ */ u(c, {
|
|
51
51
|
component: "form",
|
|
52
52
|
noValidate: !0,
|
|
53
|
-
onSubmit:
|
|
53
|
+
onSubmit: I,
|
|
54
54
|
sx: { p: 16 },
|
|
55
55
|
children: [
|
|
56
|
-
y && /* @__PURE__ */
|
|
56
|
+
y && /* @__PURE__ */ u(c, {
|
|
57
57
|
sx: {
|
|
58
58
|
alignItems: "center",
|
|
59
59
|
flexDirection: "row",
|
|
60
60
|
gap: 8
|
|
61
61
|
},
|
|
62
|
-
children: [/* @__PURE__ */ o(
|
|
62
|
+
children: [/* @__PURE__ */ o(E, {
|
|
63
63
|
alt: "",
|
|
64
|
-
institutionGuid:
|
|
64
|
+
institutionGuid: e?.institution_guid ?? "",
|
|
65
65
|
size: 24
|
|
66
|
-
}), /* @__PURE__ */ o(
|
|
66
|
+
}), /* @__PURE__ */ o(b, {
|
|
67
67
|
component: "p",
|
|
68
68
|
variant: "body2",
|
|
69
69
|
children: y
|
|
70
70
|
})]
|
|
71
71
|
}),
|
|
72
|
-
/* @__PURE__ */ o(
|
|
72
|
+
/* @__PURE__ */ o(b, {
|
|
73
73
|
color: "text.secondary",
|
|
74
74
|
component: "p",
|
|
75
75
|
sx: { mt: 16 },
|
|
76
76
|
variant: "body2",
|
|
77
77
|
children: t.description
|
|
78
78
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ u(c, {
|
|
80
80
|
sx: {
|
|
81
81
|
gap: 24,
|
|
82
82
|
pb: 24,
|
|
83
83
|
pt: 32
|
|
84
84
|
},
|
|
85
|
-
children: [
|
|
85
|
+
children: [d("balance", t.credit_card_balance, {
|
|
86
86
|
position: "start",
|
|
87
87
|
symbol: "$"
|
|
88
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ u(c, {
|
|
89
89
|
sx: {
|
|
90
90
|
flexDirection: "row",
|
|
91
91
|
gap: 16
|
|
92
92
|
},
|
|
93
|
-
children: [
|
|
93
|
+
children: [d("interestRate", t.interest_rate, {
|
|
94
94
|
position: "end",
|
|
95
95
|
symbol: "%"
|
|
96
|
-
}),
|
|
96
|
+
}), d("monthlyPayment", t.monthly_payment, {
|
|
97
97
|
position: "start",
|
|
98
98
|
symbol: "$"
|
|
99
99
|
})]
|
|
100
100
|
})]
|
|
101
101
|
}),
|
|
102
|
-
/* @__PURE__ */ o(
|
|
102
|
+
/* @__PURE__ */ o(N, {
|
|
103
103
|
fullWidth: !0,
|
|
104
104
|
sx: {
|
|
105
105
|
mb: 24,
|
|
@@ -109,21 +109,22 @@ var et = ({ beat: i }) => {
|
|
|
109
109
|
variant: "contained",
|
|
110
110
|
children: t.calculate
|
|
111
111
|
}),
|
|
112
|
-
|
|
112
|
+
f.status === "failed" ? /* @__PURE__ */ o($, { copy: t }) : /* @__PURE__ */ o(j, {
|
|
113
113
|
copy: t,
|
|
114
|
-
rows:
|
|
114
|
+
rows: f.status === "calculated" ? f.rows : void 0
|
|
115
115
|
})
|
|
116
116
|
]
|
|
117
117
|
});
|
|
118
|
-
}, rt =
|
|
119
|
-
const {
|
|
120
|
-
return
|
|
121
|
-
account:
|
|
122
|
-
copy:
|
|
123
|
-
}, t.guid)
|
|
118
|
+
}, q = (e) => e.insights_feed?.payoff_calculator, rt = B(function({ beat: t }) {
|
|
119
|
+
const { accounts: s, accountsLoaded: n } = x(), m = S(q);
|
|
120
|
+
return !t.primary_account && !n ? /* @__PURE__ */ o(A, {}) : /* @__PURE__ */ o(W, {
|
|
121
|
+
account: F(t, s),
|
|
122
|
+
copy: m
|
|
123
|
+
}, t.guid);
|
|
124
124
|
});
|
|
125
125
|
export {
|
|
126
126
|
rt as PayoffCalculatorBlock,
|
|
127
|
+
q as selectPayoffCalculatorCopy,
|
|
127
128
|
et as usePayoffCalculatorPrepare
|
|
128
129
|
};
|
|
129
130
|
|
|
@@ -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
|
|
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 } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, GlobalCopy, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps } 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\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, accountsLoaded } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffCalculatorCopy)\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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,gBAAA,EAAC,GAAD,EAAyB,MAAA,EAAO,CAAA,IAEhC,gBAAA,EAAC,GAAD;AAAA,QACQ,MAAA;AAAA,QACN,MAAM,EAAQ,WAAW,eAAe,EAAQ,OAAO;AAAA,MACxD,CAAA;AAAA,IAEE;AAAA;AAEX,GAEa,IAAA,CAA8B,MACzC,EAAK,eAAe,mBAOT,KAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,UAAA,GAAU,gBAAA,EAAA,IAAmB,EAAgB,GAC/C,IAAO,EAAgB,CAA0B;AAEvD,SAAI,CAAC,EAAK,mBAAmB,CAAC,IAAuB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAG5D,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAsB,GAAM,CAAQ;AAAA,IACvC,MAAA;AAAA,EAEP,GADM,EAAK,IACX;AAEL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PayoffCalculatorBlock, usePayoffCalculatorPrepare } from './PayoffCalculatorBlock';
|
|
1
|
+
export { PayoffCalculatorBlock, usePayoffCalculatorPrepare, selectPayoffCalculatorCopy, } from './PayoffCalculatorBlock';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { GlobalCopy } from '../../../core';
|
|
1
2
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
3
|
+
export declare const selectPayoffStrategiesCopy: (copy: GlobalCopy) => import('../../../core/types/localization/InsightsFeedCopy').GeneralInsightsFeedCopy;
|
|
2
4
|
/**
|
|
3
5
|
* Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the
|
|
4
6
|
* beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { useAccountStore as m, useGlobalCopyStore as p } from "../../../common/context/hooks.es.js";
|
|
2
2
|
import f from "../../../common/components/drawer/Drawer.es.js";
|
|
3
3
|
import d from "../../../common/components/Loader.es.js";
|
|
4
|
-
import {
|
|
5
|
-
import { AccountDetailsBlock as
|
|
6
|
-
import { buildStrategies as A, resolveStrategyAccounts as S, toPayoffAccountRow as
|
|
7
|
-
import
|
|
8
|
-
import { useState as
|
|
9
|
-
import { observer as
|
|
10
|
-
import { Fragment as
|
|
11
|
-
var O =
|
|
12
|
-
const [t, c] =
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ o(C, {
|
|
4
|
+
import { useRequiredCopy as y } from "../useRequiredCopy.es.js";
|
|
5
|
+
import { AccountDetailsBlock as g } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
|
|
6
|
+
import { buildStrategies as A, resolveStrategyAccounts as S, toPayoffAccountRow as C } from "./layout.es.js";
|
|
7
|
+
import _ from "./PayoffStrategiesContent.es.js";
|
|
8
|
+
import { useState as v } from "react";
|
|
9
|
+
import { observer as b } from "mobx-react-lite";
|
|
10
|
+
import { Fragment as P, jsx as o, jsxs as k } from "react/jsx-runtime";
|
|
11
|
+
var h = (e) => e.insights_feed?.general, O = b(function({ beat: r }) {
|
|
12
|
+
const [t, c] = v(null), { accounts: a } = p(), { accountsLoaded: i, visibleAccounts: n } = m(), s = y(h);
|
|
13
|
+
if (!i) return /* @__PURE__ */ o(d, {});
|
|
14
|
+
const u = S(r, n).map(C), l = () => c(null);
|
|
15
|
+
return /* @__PURE__ */ k(P, { children: [/* @__PURE__ */ o(_, {
|
|
17
16
|
accounts: u,
|
|
18
|
-
copy:
|
|
17
|
+
copy: s,
|
|
19
18
|
onAccountClick: c,
|
|
20
|
-
strategies: A(
|
|
19
|
+
strategies: A(s)
|
|
21
20
|
}), /* @__PURE__ */ o(f, {
|
|
22
|
-
ariaLabelClose:
|
|
21
|
+
ariaLabelClose: a?.close_account_details_aria,
|
|
23
22
|
isOpen: t !== null,
|
|
24
23
|
onClose: l,
|
|
25
|
-
title:
|
|
26
|
-
children: t && /* @__PURE__ */ o(
|
|
27
|
-
...
|
|
24
|
+
title: a?.account_details,
|
|
25
|
+
children: t && /* @__PURE__ */ o(g, { beat: {
|
|
26
|
+
...r,
|
|
28
27
|
primary_account: void 0,
|
|
29
28
|
primary_account_guid: t
|
|
30
29
|
} })
|
|
31
30
|
})] });
|
|
32
31
|
});
|
|
33
32
|
export {
|
|
34
|
-
O as PayoffStrategiesBlock
|
|
33
|
+
O as PayoffStrategiesBlock,
|
|
34
|
+
h as selectPayoffStrategiesCopy
|
|
35
35
|
};
|
|
36
36
|
|
|
37
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 { observer } from 'mobx-react-lite'\n\nimport { Drawer, Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\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 { GlobalCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\nexport const selectPayoffStrategiesCopy = (copy: GlobalCopy) => copy.insights_feed?.general\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 } = useGlobalCopyStore()\n const { accountsLoaded, visibleAccounts } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffStrategiesCopy)\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":";;;;;;;;;;AAaA,IAAa,IAAA,CAA8B,MAAqB,EAAK,eAAe,SAOvE,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,UAAU,EAAA,IAAiB,EAAmB,GAChD,EAAE,gBAAA,GAAgB,iBAAA,EAAA,IAAoB,EAAgB,GACtD,IAAO,EAAgB,CAA0B;AAEvD,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,2 +1,2 @@
|
|
|
1
|
-
export { PayoffStrategiesBlock } from './PayoffStrategiesBlock';
|
|
1
|
+
export { PayoffStrategiesBlock, selectPayoffStrategiesCopy } from './PayoffStrategiesBlock';
|
|
2
2
|
export { usePayoffStrategiesPrepare } from './usePayoffStrategiesPrepare';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts.
|
|
1
|
+
{"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts. Declare its copy selector as the\n// entry's `copy` and read it with `useRequiredCopy`; render `BlockErrorMessage` when\n// its data is missing for good.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const cta = useOpenedCta(beat)\n\n return <PlaceholderVariants beat={beat} variant={cta?.variant} />\n})\n"],"mappings":";;;;;;;AA6BA,IAAM,IAAqB,EAAA,CAAU,EAAE,MAAA,EAAA,MAAoC;AAGzE,QAAM,EAAE,eAAA,IAAgB,GAAG,UAAA,IAAW,EAAA,IAAM,EAAmC,KAAK,CAAC;AAErF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,KAAK;AAAA,MAAG,GAAG;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAAtE,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD,EAAA,UAAI,+BAAgC,CAAA;AAAA,MACpC,gBAAA,EAAC,GAAD,EAAA,UAAM,+IAGA,CAAA;AAAA,MACN,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA;AAAA,MAC7B,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,QAAM;AAAA,QACsB;AAAA,QAAc;AAAA,QAAY;AAAA,MAChD,EAAA,CAAA;AAAA,IACD;AAAA;AAEX,CAAC,GAGK,IAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAG,GAAG;AAAA,IAAI,WAAW;AAAA,EAAS;AAAA,EAAtE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAI,yCAA0C,CAAA,GAC9C,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA,CACxB;IAKH,IAAsB,EAA4C;AAAA,EACtE,UAAU;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV,MAAM;AACR,CAAC,GAEY,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,IAAM,EAAa,CAAI;AAE7B,SAAO,gBAAA,EAAC,GAAD;AAAA,IAA2B,MAAA;AAAA,IAAM,SAAS,GAAK;AAAA,EAAU,CAAA;AAClE,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { GlobalCopy } from '../../../core';
|
|
1
2
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
3
|
+
export declare const selectRemainingCashCopy: (copy: GlobalCopy) => import('../../../core').RemainingCashCopy | undefined;
|
|
2
4
|
/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */
|
|
3
5
|
export declare const RemainingCashBlock: ((_props: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
6
|
displayName: string;
|