@mx-cartographer/experiences 9.7.142 → 9.7.144
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/core/types/localization/InsightsFeedCopy.d.ts +31 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.d.ts +9 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +42 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.d.ts +13 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js +339 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/index.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.d.ts +41 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.es.js +61 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/usePayoffStrategiesPrepare.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/usePayoffStrategiesPrepare.es.js +14 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/usePayoffStrategiesPrepare.es.js.map +1 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js +135 -111
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +47 -40
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [9.7.144] - 11-12-2026
|
|
2
|
+
|
|
3
|
+
- Debt Payoff Strategies action block (payoff_strategies_block) (WEC-2276)
|
|
4
|
+
|
|
5
|
+
## [9.7.143] - 11-12-2026
|
|
6
|
+
|
|
7
|
+
- **ADDED** - Subscription Price Increase V2 embedded card shows the previous and new amounts as two bars (WEC-2290)
|
|
8
|
+
|
|
1
9
|
## [9.7.142] - 11-12-2026
|
|
2
10
|
|
|
3
11
|
- **CHANGED** - Storybook: the standalone deposit QA pages move to their Insights 2.0 V+1 template names (bucket 2): `InsightsV2/Insights/PayrollDepositV2`, `GovernmentDepositV2`, `MerchantCreditReceivedV2`, `CheckDepositV2`, `TaxDepositV2`, `LargeDepositV2` and `PayrollAdvanceV2`; their mock beats carry the V2 template names (WEC-2296)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
interface DynamicKeyValue {
|
|
3
3
|
[key: string]: string;
|
|
4
4
|
}
|
|
5
|
-
interface GeneralInsightsFeedCopy {
|
|
5
|
+
export interface GeneralInsightsFeedCopy {
|
|
6
6
|
decreased_text: string;
|
|
7
7
|
dismiss: string;
|
|
8
8
|
embedded_description: string;
|
|
@@ -51,6 +51,36 @@ interface GeneralInsightsFeedCopy {
|
|
|
51
51
|
subscribed?: string;
|
|
52
52
|
not_subscribed?: string;
|
|
53
53
|
undo?: string;
|
|
54
|
+
/** Debt Payoff Strategies drawer words (the pulse drawer's keys); optional until mrs_content ships them to every host. */
|
|
55
|
+
avalanche?: string;
|
|
56
|
+
snowball?: string;
|
|
57
|
+
debt_payoff_strategies?: string;
|
|
58
|
+
the_strategy?: string;
|
|
59
|
+
pros?: string;
|
|
60
|
+
cons?: string;
|
|
61
|
+
pay_off_debts_with_high_interest_rates_first?: string;
|
|
62
|
+
pay_off_debts_with_low_balances_first?: string;
|
|
63
|
+
fastest_way_to_eliminate_debt?: string;
|
|
64
|
+
costs_less_in_interest?: string;
|
|
65
|
+
takes_time_to_see_results?: string;
|
|
66
|
+
requires_patience_and_discipline?: string;
|
|
67
|
+
provides_small_wins_quickly?: string;
|
|
68
|
+
builds_momentum_to_pay_off_debts?: string;
|
|
69
|
+
takes_longer_to_pay_off_all_debts?: string;
|
|
70
|
+
may_cost_more_in_interest?: string;
|
|
71
|
+
how_to_get_started?: string;
|
|
72
|
+
step_one?: string;
|
|
73
|
+
step_two?: string;
|
|
74
|
+
step_three?: string;
|
|
75
|
+
make_minimum_monthly_payments_on_all_debt_accounts?: string;
|
|
76
|
+
when_possible_pay_extra_on_the_account_with_the_highest_interest_rate?: string;
|
|
77
|
+
when_possible_pay_extra_on_the_account_with_the_lowest_balance?: string;
|
|
78
|
+
when_paid_off_move_to_the_next_debt_with_the_highest?: string;
|
|
79
|
+
when_paid_off_move_to_the_next_debt_with_the_lowest?: string;
|
|
80
|
+
highest_to_lowest_rate?: string;
|
|
81
|
+
lowest_to_highest_balance?: string;
|
|
82
|
+
balance?: string;
|
|
83
|
+
interest_rate?: string;
|
|
54
84
|
}
|
|
55
85
|
interface SettingsMenuCopy {
|
|
56
86
|
close: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionBlockProps } from '../../mappings/blocks';
|
|
2
|
+
/**
|
|
3
|
+
* Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the
|
|
4
|
+
* beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the
|
|
5
|
+
* shared AccountDetailsBlock) in a nested drawer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PayoffStrategiesBlock: (({ beat, }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useAccountStore as d, useGlobalCopyStore as g, useGlobalStore as y } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import S from "../../../common/components/drawer/Drawer.es.js";
|
|
3
|
+
import i from "../../../common/components/Loader.es.js";
|
|
4
|
+
import { AccountDetailsBlock as A } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
|
|
5
|
+
import { buildStrategies as _, resolveStrategyAccounts as C, toPayoffAccountRow as h } from "./layout.es.js";
|
|
6
|
+
import b from "./PayoffStrategiesContent.es.js";
|
|
7
|
+
import { useState as k } from "react";
|
|
8
|
+
import { observer as v } from "mobx-react-lite";
|
|
9
|
+
import w from "@mui/material/Stack";
|
|
10
|
+
import { Text as x } from "@mxenabled/mxui";
|
|
11
|
+
import { Fragment as G, jsx as o, jsxs as P } from "react/jsx-runtime";
|
|
12
|
+
var E = v(function({ beat: r }) {
|
|
13
|
+
const [t, c] = k(null), { copyStore: s } = y(), { accounts: n, common: a, insights_feed: l } = g(), { accountsLoaded: m, visibleAccounts: u } = d(), e = l?.general;
|
|
14
|
+
if (!s.isInitialized) return /* @__PURE__ */ o(i, {});
|
|
15
|
+
if (!e) return /* @__PURE__ */ o(w, {
|
|
16
|
+
sx: { p: 24 },
|
|
17
|
+
children: /* @__PURE__ */ o(x, { children: a?.error_message ?? "Something went wrong." })
|
|
18
|
+
});
|
|
19
|
+
if (!m) return /* @__PURE__ */ o(i, {});
|
|
20
|
+
const p = C(r, u).map(h), f = () => c(null);
|
|
21
|
+
return /* @__PURE__ */ P(G, { children: [/* @__PURE__ */ o(b, {
|
|
22
|
+
accounts: p,
|
|
23
|
+
copy: e,
|
|
24
|
+
onAccountClick: c,
|
|
25
|
+
strategies: _(e)
|
|
26
|
+
}), /* @__PURE__ */ o(S, {
|
|
27
|
+
ariaLabelClose: n?.close_account_details_aria,
|
|
28
|
+
isOpen: t !== null,
|
|
29
|
+
onClose: f,
|
|
30
|
+
title: n?.account_details,
|
|
31
|
+
children: t && /* @__PURE__ */ o(A, { beat: {
|
|
32
|
+
...r,
|
|
33
|
+
primary_account: void 0,
|
|
34
|
+
primary_account_guid: t
|
|
35
|
+
} })
|
|
36
|
+
})] });
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
E as PayoffStrategiesBlock
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=PayoffStrategiesBlock.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useAccountStore,\n useGlobalCopyStore,\n useGlobalStore,\n} from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\n/**\n * Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the\n * beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the\n * shared AccountDetailsBlock) in a nested drawer.\n */\nexport const PayoffStrategiesBlock = observer(function PayoffStrategiesBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { copyStore } = useGlobalStore()\n const {\n accounts: accountsCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n } = useGlobalCopyStore()\n const { accountsLoaded, visibleAccounts } = useAccountStore()\n const copy = insightsFeedCopy?.general\n\n if (!copyStore.isInitialized) return <Loader />\n\n // Copy loads once at app start, so a retry cannot clear a missing namespace: a plain message.\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message ?? 'Something went wrong.'}</Text>\n </Stack>\n )\n }\n\n if (!accountsLoaded) return <Loader />\n\n const rows = resolveStrategyAccounts(beat, visibleAccounts).map(toPayoffAccountRow)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <PayoffStrategiesContent\n accounts={rows}\n copy={copy}\n onAccountClick={setTappedAccountGuid}\n strategies={buildStrategies(copy)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;AAyBA,IAAa,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,WAAA,EAAA,IAAc,EAAe,GAC/B,EACJ,UAAU,GACV,QAAQ,GACR,eAAe,EAAA,IACb,EAAmB,GACjB,EAAE,gBAAA,GAAgB,iBAAA,EAAA,IAAoB,EAAgB,GACtD,IAAO,GAAkB;AAE/B,MAAI,CAAC,EAAU,cAAe,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAG9C,MAAI,CAAC,EACH,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,iBAAiB,wBAA8B,CAAA;AAAA,EAC7D,CAAA;AAIX,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeneralInsightsFeedCopy } from '../../../core/types/localization/InsightsFeedCopy';
|
|
2
|
+
import { PayoffAccountRow, PayoffStrategy } from './layout';
|
|
3
|
+
export interface PayoffStrategiesContentProps {
|
|
4
|
+
copy: GeneralInsightsFeedCopy;
|
|
5
|
+
strategies: PayoffStrategy[];
|
|
6
|
+
/** The beat's debt accounts, unordered; each tab orders them its own way. */
|
|
7
|
+
accounts: PayoffAccountRow[];
|
|
8
|
+
/** Tapping an account row opens its Account Details; rows are static without it. */
|
|
9
|
+
onAccountClick?: (accountGuid: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Presentational body of the Debt Payoff Strategies drawer, minus the drawer header. */
|
|
12
|
+
declare const PayoffStrategiesContent: ({ accounts, copy, onAccountClick, strategies, }: PayoffStrategiesContentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export default PayoffStrategiesContent;
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { DEFAULT_INSTITUTION_LOGO_URL as T } from "../../../core/constants/InstitutionLogo.es.js";
|
|
2
|
+
import { formatCurrency as I } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { SubTabs as k, subTabPanelProps as D } from "../../components/SubTabs.es.js";
|
|
4
|
+
import { orderAccounts as w } from "./layout.es.js";
|
|
5
|
+
import { useRef as C, useState as S } from "react";
|
|
6
|
+
import o from "@mui/material/Stack";
|
|
7
|
+
import { InstitutionLogo as R, Text as d } from "@mxenabled/mxui";
|
|
8
|
+
import { Icon as u } from "@mxenabled/mx-icons";
|
|
9
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
10
|
+
import x from "@mui/material/Box";
|
|
11
|
+
import f from "@mui/material/IconButton";
|
|
12
|
+
import L from "@mui/material/Divider";
|
|
13
|
+
import A from "@mui/material/ButtonBase";
|
|
14
|
+
var _ = {
|
|
15
|
+
bgcolor: "background.paper",
|
|
16
|
+
border: "1px solid",
|
|
17
|
+
borderColor: "divider",
|
|
18
|
+
borderRadius: 1
|
|
19
|
+
}, g = ({ children: l }) => /* @__PURE__ */ e(d, {
|
|
20
|
+
color: "text.secondary",
|
|
21
|
+
component: "h3",
|
|
22
|
+
sx: {
|
|
23
|
+
letterSpacing: 0.5,
|
|
24
|
+
textTransform: "uppercase"
|
|
25
|
+
},
|
|
26
|
+
variant: "caption",
|
|
27
|
+
children: l
|
|
28
|
+
}), v = ({ items: l, kind: t, title: s }) => /* @__PURE__ */ n(o, {
|
|
29
|
+
component: "section",
|
|
30
|
+
sx: {
|
|
31
|
+
..._,
|
|
32
|
+
flex: 1,
|
|
33
|
+
gap: 12,
|
|
34
|
+
p: 16
|
|
35
|
+
},
|
|
36
|
+
children: [/* @__PURE__ */ e(d, {
|
|
37
|
+
bold: !0,
|
|
38
|
+
component: "h4",
|
|
39
|
+
variant: "body1",
|
|
40
|
+
children: s
|
|
41
|
+
}), /* @__PURE__ */ e(o, {
|
|
42
|
+
component: "ul",
|
|
43
|
+
sx: {
|
|
44
|
+
gap: 12,
|
|
45
|
+
listStyle: "none",
|
|
46
|
+
m: 0,
|
|
47
|
+
p: 0
|
|
48
|
+
},
|
|
49
|
+
children: l.map((c) => /* @__PURE__ */ n(o, {
|
|
50
|
+
component: "li",
|
|
51
|
+
sx: {
|
|
52
|
+
flexDirection: "row",
|
|
53
|
+
gap: 6
|
|
54
|
+
},
|
|
55
|
+
children: [/* @__PURE__ */ e(u, {
|
|
56
|
+
color: t === "pros" ? "success" : "error",
|
|
57
|
+
name: t === "pros" ? "check_circle" : "cancel",
|
|
58
|
+
size: 16,
|
|
59
|
+
sx: {
|
|
60
|
+
flexShrink: 0,
|
|
61
|
+
mt: 2
|
|
62
|
+
}
|
|
63
|
+
}), /* @__PURE__ */ e(d, {
|
|
64
|
+
variant: "body2",
|
|
65
|
+
children: c
|
|
66
|
+
})]
|
|
67
|
+
}, c))
|
|
68
|
+
})]
|
|
69
|
+
}), G = 172, y = "—", P = ({ steps: l }) => {
|
|
70
|
+
const [t, s] = S(0), c = C(null), i = (a) => {
|
|
71
|
+
const r = Math.min(Math.max(a, 0), l.length - 1);
|
|
72
|
+
s(r), c.current?.scrollTo({
|
|
73
|
+
behavior: "smooth",
|
|
74
|
+
left: r * 184
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return l.length ? /* @__PURE__ */ n(o, {
|
|
78
|
+
sx: { gap: 16 },
|
|
79
|
+
children: [/* @__PURE__ */ e(x, {
|
|
80
|
+
component: "ol",
|
|
81
|
+
ref: c,
|
|
82
|
+
sx: {
|
|
83
|
+
display: "flex",
|
|
84
|
+
flexDirection: "row",
|
|
85
|
+
gap: 12,
|
|
86
|
+
listStyle: "none",
|
|
87
|
+
m: 0,
|
|
88
|
+
overflowX: "auto",
|
|
89
|
+
p: 0,
|
|
90
|
+
scrollSnapType: "x mandatory",
|
|
91
|
+
scrollbarWidth: "none",
|
|
92
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
93
|
+
},
|
|
94
|
+
children: l.map((a) => /* @__PURE__ */ n(o, {
|
|
95
|
+
component: "li",
|
|
96
|
+
sx: {
|
|
97
|
+
..._,
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
gap: 16,
|
|
101
|
+
p: 16,
|
|
102
|
+
scrollSnapAlign: "start",
|
|
103
|
+
textAlign: "center",
|
|
104
|
+
width: G
|
|
105
|
+
},
|
|
106
|
+
children: [/* @__PURE__ */ e(u, {
|
|
107
|
+
color: "action",
|
|
108
|
+
name: a.icon,
|
|
109
|
+
size: 48
|
|
110
|
+
}), /* @__PURE__ */ n(o, {
|
|
111
|
+
sx: { gap: 4 },
|
|
112
|
+
children: [/* @__PURE__ */ e(d, {
|
|
113
|
+
bold: !0,
|
|
114
|
+
sx: { textTransform: "uppercase" },
|
|
115
|
+
variant: "caption",
|
|
116
|
+
children: a.caption
|
|
117
|
+
}), /* @__PURE__ */ e(d, {
|
|
118
|
+
color: "text.secondary",
|
|
119
|
+
variant: "body2",
|
|
120
|
+
children: a.text
|
|
121
|
+
})]
|
|
122
|
+
})]
|
|
123
|
+
}, a.caption + a.text))
|
|
124
|
+
}), /* @__PURE__ */ n(o, {
|
|
125
|
+
sx: {
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
flexDirection: "row",
|
|
128
|
+
gap: 16,
|
|
129
|
+
justifyContent: "center"
|
|
130
|
+
},
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ e(f, {
|
|
133
|
+
"aria-label": "previous",
|
|
134
|
+
disabled: t === 0,
|
|
135
|
+
onClick: () => i(t - 1),
|
|
136
|
+
children: /* @__PURE__ */ e(u, {
|
|
137
|
+
name: "chevron_left",
|
|
138
|
+
size: 20
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ e(o, {
|
|
142
|
+
"aria-hidden": "true",
|
|
143
|
+
sx: {
|
|
144
|
+
alignItems: "center",
|
|
145
|
+
flexDirection: "row",
|
|
146
|
+
gap: 4
|
|
147
|
+
},
|
|
148
|
+
children: l.map((a, r) => /* @__PURE__ */ e(x, { sx: {
|
|
149
|
+
bgcolor: r === t ? "primary.main" : "action.disabled",
|
|
150
|
+
borderRadius: 3,
|
|
151
|
+
height: 6,
|
|
152
|
+
width: r === t ? 20 : 6
|
|
153
|
+
} }, a.caption + a.text))
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ e(f, {
|
|
156
|
+
"aria-label": "next",
|
|
157
|
+
disabled: t === l.length - 1,
|
|
158
|
+
onClick: () => i(t + 1),
|
|
159
|
+
children: /* @__PURE__ */ e(u, {
|
|
160
|
+
color: "primary",
|
|
161
|
+
name: "chevron_right",
|
|
162
|
+
size: 20
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
})]
|
|
167
|
+
}) : null;
|
|
168
|
+
}, z = ({ balanceLabel: l, isLast: t, onClick: s, rateLabel: c, row: i, sortKey: a }) => {
|
|
169
|
+
const r = {
|
|
170
|
+
label: c,
|
|
171
|
+
value: i.interestRate === null ? y : `${i.interestRate}%`
|
|
172
|
+
}, m = {
|
|
173
|
+
label: l,
|
|
174
|
+
value: i.balance === null ? y : I(i.balance, "0,0.00")
|
|
175
|
+
}, p = a === "rate" ? [r, m] : [m, r];
|
|
176
|
+
return /* @__PURE__ */ n(x, {
|
|
177
|
+
component: "li",
|
|
178
|
+
sx: { position: "relative" },
|
|
179
|
+
children: [/* @__PURE__ */ n(o, {
|
|
180
|
+
component: s ? A : "div",
|
|
181
|
+
onClick: s,
|
|
182
|
+
sx: {
|
|
183
|
+
alignItems: "flex-start",
|
|
184
|
+
flexDirection: "row",
|
|
185
|
+
gap: 12,
|
|
186
|
+
px: 24,
|
|
187
|
+
py: 16,
|
|
188
|
+
textAlign: "left",
|
|
189
|
+
width: "100%",
|
|
190
|
+
...s && {
|
|
191
|
+
"&:hover": { bgcolor: "action.hover" },
|
|
192
|
+
"&.Mui-focusVisible": { bgcolor: "action.focus" }
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
children: [/* @__PURE__ */ e(x, {
|
|
196
|
+
sx: {
|
|
197
|
+
display: "flex",
|
|
198
|
+
flexShrink: 0,
|
|
199
|
+
height: 32,
|
|
200
|
+
width: 32
|
|
201
|
+
},
|
|
202
|
+
children: /* @__PURE__ */ e(R, {
|
|
203
|
+
alt: "",
|
|
204
|
+
institutionGuid: i.institutionGuid,
|
|
205
|
+
logoUrl: i.institutionGuid ? void 0 : T,
|
|
206
|
+
size: 32
|
|
207
|
+
})
|
|
208
|
+
}), /* @__PURE__ */ n(o, {
|
|
209
|
+
sx: {
|
|
210
|
+
flexGrow: 1,
|
|
211
|
+
gap: 4,
|
|
212
|
+
minWidth: 0
|
|
213
|
+
},
|
|
214
|
+
children: [/* @__PURE__ */ e(d, {
|
|
215
|
+
bold: !0,
|
|
216
|
+
truncate: !0,
|
|
217
|
+
variant: "body1",
|
|
218
|
+
children: i.name
|
|
219
|
+
}), p.map((h, b) => /* @__PURE__ */ n(o, {
|
|
220
|
+
sx: {
|
|
221
|
+
flexDirection: "row",
|
|
222
|
+
gap: 12,
|
|
223
|
+
justifyContent: "space-between"
|
|
224
|
+
},
|
|
225
|
+
children: [/* @__PURE__ */ e(d, {
|
|
226
|
+
color: "text.secondary",
|
|
227
|
+
variant: "caption",
|
|
228
|
+
children: h.label
|
|
229
|
+
}), /* @__PURE__ */ e(d, {
|
|
230
|
+
bold: b === 0,
|
|
231
|
+
color: b === 0 ? "text.primary" : "text.secondary",
|
|
232
|
+
sx: { fontVariantNumeric: "tabular-nums" },
|
|
233
|
+
variant: "caption",
|
|
234
|
+
children: h.value
|
|
235
|
+
})]
|
|
236
|
+
}, h.label))]
|
|
237
|
+
})]
|
|
238
|
+
}), /* @__PURE__ */ e(L, { sx: {
|
|
239
|
+
bottom: 0,
|
|
240
|
+
left: t ? 0 : 68,
|
|
241
|
+
position: "absolute",
|
|
242
|
+
right: 0
|
|
243
|
+
} })]
|
|
244
|
+
});
|
|
245
|
+
}, $ = ({ accounts: l, copy: t, onAccountClick: s, strategies: c }) => {
|
|
246
|
+
const [i, a] = S(0), r = c[i] ?? c[0];
|
|
247
|
+
if (!r) return null;
|
|
248
|
+
const m = w(l, r.sortKey);
|
|
249
|
+
return /* @__PURE__ */ n(o, {
|
|
250
|
+
sx: {
|
|
251
|
+
bgcolor: "background.default",
|
|
252
|
+
pb: 24
|
|
253
|
+
},
|
|
254
|
+
children: [/* @__PURE__ */ e(k, {
|
|
255
|
+
id: "payoff-strategies",
|
|
256
|
+
isTypeFilter: !1,
|
|
257
|
+
onChange: a,
|
|
258
|
+
selectedIndex: i,
|
|
259
|
+
tabs: c.map(({ label: p }) => ({ label: p }))
|
|
260
|
+
}), /* @__PURE__ */ n(o, {
|
|
261
|
+
...D("payoff-strategies", i),
|
|
262
|
+
sx: { gap: 12 },
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ n(o, {
|
|
265
|
+
component: "section",
|
|
266
|
+
sx: {
|
|
267
|
+
bgcolor: "background.paper",
|
|
268
|
+
gap: 16,
|
|
269
|
+
p: 24
|
|
270
|
+
},
|
|
271
|
+
children: [/* @__PURE__ */ n(o, {
|
|
272
|
+
sx: { gap: 4 },
|
|
273
|
+
children: [t.the_strategy && /* @__PURE__ */ e(g, { children: t.the_strategy }), /* @__PURE__ */ e(d, {
|
|
274
|
+
component: "p",
|
|
275
|
+
variant: "body1",
|
|
276
|
+
children: r.description
|
|
277
|
+
})]
|
|
278
|
+
}), /* @__PURE__ */ n(o, {
|
|
279
|
+
sx: {
|
|
280
|
+
flexDirection: "row",
|
|
281
|
+
gap: 12
|
|
282
|
+
},
|
|
283
|
+
children: [/* @__PURE__ */ e(v, {
|
|
284
|
+
items: r.pros,
|
|
285
|
+
kind: "pros",
|
|
286
|
+
title: t.pros ?? ""
|
|
287
|
+
}), /* @__PURE__ */ e(v, {
|
|
288
|
+
items: r.cons,
|
|
289
|
+
kind: "cons",
|
|
290
|
+
title: t.cons ?? ""
|
|
291
|
+
})]
|
|
292
|
+
})]
|
|
293
|
+
}),
|
|
294
|
+
r.steps.length > 0 && /* @__PURE__ */ n(o, {
|
|
295
|
+
component: "section",
|
|
296
|
+
sx: {
|
|
297
|
+
gap: 16,
|
|
298
|
+
px: 24,
|
|
299
|
+
py: 24
|
|
300
|
+
},
|
|
301
|
+
children: [t.how_to_get_started && /* @__PURE__ */ e(g, { children: t.how_to_get_started }), /* @__PURE__ */ e(P, { steps: r.steps }, r.key)]
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ n(o, {
|
|
304
|
+
component: "section",
|
|
305
|
+
sx: {
|
|
306
|
+
gap: 16,
|
|
307
|
+
pt: 12
|
|
308
|
+
},
|
|
309
|
+
children: [/* @__PURE__ */ e(x, {
|
|
310
|
+
sx: { px: 24 },
|
|
311
|
+
children: /* @__PURE__ */ e(g, { children: r.orderHeader })
|
|
312
|
+
}), /* @__PURE__ */ e(o, {
|
|
313
|
+
"aria-label": r.orderHeader,
|
|
314
|
+
component: "ul",
|
|
315
|
+
sx: {
|
|
316
|
+
bgcolor: "background.paper",
|
|
317
|
+
listStyle: "none",
|
|
318
|
+
m: 0,
|
|
319
|
+
p: 0
|
|
320
|
+
},
|
|
321
|
+
children: m.map((p, h) => /* @__PURE__ */ e(z, {
|
|
322
|
+
balanceLabel: t.balance ?? "",
|
|
323
|
+
isLast: h === m.length - 1,
|
|
324
|
+
onClick: s ? () => s(p.guid) : void 0,
|
|
325
|
+
rateLabel: t.interest_rate ?? "",
|
|
326
|
+
row: p,
|
|
327
|
+
sortKey: r.sortKey
|
|
328
|
+
}, p.guid))
|
|
329
|
+
})]
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
})]
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
export {
|
|
336
|
+
$ as default
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
//# sourceMappingURL=PayoffStrategiesContent.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayoffStrategiesContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.tsx"],"sourcesContent":["import { useRef, useState } from 'react'\n\nimport Box from '@mui/material/Box'\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { GeneralInsightsFeedCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\n\nimport type { PayoffAccountRow, PayoffStep, PayoffStrategy } from './layout'\nimport { orderAccounts } from './layout'\n\nexport interface PayoffStrategiesContentProps {\n copy: GeneralInsightsFeedCopy\n strategies: PayoffStrategy[]\n /** The beat's debt accounts, unordered; each tab orders them its own way. */\n accounts: PayoffAccountRow[]\n /** Tapping an account row opens its Account Details; rows are static without it. */\n onAccountClick?: (accountGuid: string) => void\n}\n\nconst CARD_SX = {\n bgcolor: 'background.paper',\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: 1,\n} as const\n\n/** The small uppercase section label (STRATEGY, HOW TO GET STARTED, HIGHEST TO LOWEST RATE). */\nconst SectionLabel = ({ children }: { children: string }) => (\n <Text\n color=\"text.secondary\"\n component=\"h3\"\n sx={{ letterSpacing: 0.5, textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {children}\n </Text>\n)\n\nconst ProsConsCard = ({\n items,\n kind,\n title,\n}: {\n items: string[]\n kind: 'pros' | 'cons'\n title: string\n}) => (\n <Stack component=\"section\" sx={{ ...CARD_SX, flex: 1, gap: 12, p: 16 }}>\n <Text bold={true} component=\"h4\" variant=\"body1\">\n {title}\n </Text>\n <Stack component=\"ul\" sx={{ gap: 12, listStyle: 'none', m: 0, p: 0 }}>\n {items.map((item) => (\n <Stack component=\"li\" key={item} sx={{ flexDirection: 'row', gap: 6 }}>\n <Icon\n color={kind === 'pros' ? 'success' : 'error'}\n name={kind === 'pros' ? 'check_circle' : 'cancel'}\n size={16}\n sx={{ flexShrink: 0, mt: 2 }}\n />\n <Text variant=\"body2\">{item}</Text>\n </Stack>\n ))}\n </Stack>\n </Stack>\n)\n\nconst STEP_CARD_WIDTH = 172\nconst MISSING_VALUE = '—'\n\n/** The three step cards in a scroll-snap row, paged by the arrows and the dots under it. */\nconst StepsCarousel = ({ steps }: { steps: PayoffStep[] }) => {\n const [page, setPage] = useState(0)\n const rowRef = useRef<HTMLOListElement>(null)\n\n const goTo = (next: number) => {\n const index = Math.min(Math.max(next, 0), steps.length - 1)\n setPage(index)\n rowRef.current?.scrollTo({ behavior: 'smooth', left: index * (STEP_CARD_WIDTH + 12) })\n }\n\n if (!steps.length) return null\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n component=\"ol\"\n ref={rowRef}\n sx={{\n display: 'flex',\n flexDirection: 'row',\n gap: 12,\n listStyle: 'none',\n m: 0,\n overflowX: 'auto',\n p: 0,\n scrollSnapType: 'x mandatory',\n scrollbarWidth: 'none',\n '&::-webkit-scrollbar': { display: 'none' },\n }}\n >\n {steps.map((step) => (\n <Stack\n component=\"li\"\n key={step.caption + step.text}\n sx={{\n ...CARD_SX,\n alignItems: 'center',\n flexShrink: 0,\n gap: 16,\n p: 16,\n scrollSnapAlign: 'start',\n textAlign: 'center',\n width: STEP_CARD_WIDTH,\n }}\n >\n <Icon color=\"action\" name={step.icon} size={48} />\n <Stack sx={{ gap: 4 }}>\n <Text bold={true} sx={{ textTransform: 'uppercase' }} variant=\"caption\">\n {step.caption}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n {step.text}\n </Text>\n </Stack>\n </Stack>\n ))}\n </Box>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, justifyContent: 'center' }}>\n <IconButton aria-label=\"previous\" disabled={page === 0} onClick={() => goTo(page - 1)}>\n <Icon name=\"chevron_left\" size={20} />\n </IconButton>\n <Stack aria-hidden=\"true\" sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n {steps.map((step, index) => (\n <Box\n key={step.caption + step.text}\n sx={{\n bgcolor: index === page ? 'primary.main' : 'action.disabled',\n borderRadius: 3,\n height: 6,\n width: index === page ? 20 : 6,\n }}\n />\n ))}\n </Stack>\n <IconButton\n aria-label=\"next\"\n disabled={page === steps.length - 1}\n onClick={() => goTo(page + 1)}\n >\n <Icon color=\"primary\" name=\"chevron_right\" size={20} />\n </IconButton>\n </Stack>\n </Stack>\n )\n}\n\nconst AccountRow = ({\n balanceLabel,\n isLast,\n onClick,\n rateLabel,\n row,\n sortKey,\n}: {\n balanceLabel: string\n isLast: boolean\n onClick?: () => void\n rateLabel: string\n row: PayoffAccountRow\n sortKey: PayoffStrategy['sortKey']\n}) => {\n const rate = {\n label: rateLabel,\n value: row.interestRate === null ? MISSING_VALUE : `${row.interestRate}%`,\n }\n const balance = {\n label: balanceLabel,\n value: row.balance === null ? MISSING_VALUE : formatCurrency(row.balance, '0,0.00'),\n }\n const lines = sortKey === 'rate' ? [rate, balance] : [balance, rate]\n\n return (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack\n component={onClick ? ButtonBase : 'div'}\n onClick={onClick}\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 12,\n px: 24,\n py: 16,\n textAlign: 'left',\n width: '100%',\n ...(onClick && {\n '&:hover': { bgcolor: 'action.hover' },\n '&.Mui-focusVisible': { bgcolor: 'action.focus' },\n }),\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0, height: 32, width: 32 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={row.institutionGuid}\n logoUrl={row.institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={32}\n />\n </Box>\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {row.name}\n </Text>\n {lines.map((line, index) => (\n <Stack\n key={line.label}\n sx={{ flexDirection: 'row', gap: 12, justifyContent: 'space-between' }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {line.label}\n </Text>\n <Text\n bold={index === 0}\n color={index === 0 ? 'text.primary' : 'text.secondary'}\n sx={{ fontVariantNumeric: 'tabular-nums' }}\n variant=\"caption\"\n >\n {line.value}\n </Text>\n </Stack>\n ))}\n </Stack>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 68, position: 'absolute', right: 0 }} />\n </Box>\n )\n}\n\n/** Presentational body of the Debt Payoff Strategies drawer, minus the drawer header. */\nconst PayoffStrategiesContent = ({\n accounts,\n copy,\n onAccountClick,\n strategies,\n}: PayoffStrategiesContentProps) => {\n const [tab, setTab] = useState(0)\n const strategy = strategies[tab] ?? strategies[0]\n\n if (!strategy) return null\n\n const ordered = orderAccounts(accounts, strategy.sortKey)\n\n return (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <SubTabs\n id=\"payoff-strategies\"\n isTypeFilter={false}\n onChange={setTab}\n selectedIndex={tab}\n tabs={strategies.map(({ label }) => ({ label }))}\n />\n <Stack {...subTabPanelProps('payoff-strategies', tab)} sx={{ gap: 12 }}>\n <Stack component=\"section\" sx={{ bgcolor: 'background.paper', gap: 16, p: 24 }}>\n <Stack sx={{ gap: 4 }}>\n {copy.the_strategy && <SectionLabel>{copy.the_strategy}</SectionLabel>}\n <Text component=\"p\" variant=\"body1\">\n {strategy.description}\n </Text>\n </Stack>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n <ProsConsCard items={strategy.pros} kind=\"pros\" title={copy.pros ?? ''} />\n <ProsConsCard items={strategy.cons} kind=\"cons\" title={copy.cons ?? ''} />\n </Stack>\n </Stack>\n {strategy.steps.length > 0 && (\n <Stack component=\"section\" sx={{ gap: 16, px: 24, py: 24 }}>\n {copy.how_to_get_started && <SectionLabel>{copy.how_to_get_started}</SectionLabel>}\n <StepsCarousel key={strategy.key} steps={strategy.steps} />\n </Stack>\n )}\n <Stack component=\"section\" sx={{ gap: 16, pt: 12 }}>\n <Box sx={{ px: 24 }}>\n <SectionLabel>{strategy.orderHeader}</SectionLabel>\n </Box>\n <Stack\n aria-label={strategy.orderHeader}\n component=\"ul\"\n sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}\n >\n {ordered.map((row, index) => (\n <AccountRow\n balanceLabel={copy.balance ?? ''}\n isLast={index === ordered.length - 1}\n key={row.guid}\n onClick={onAccountClick ? () => onAccountClick(row.guid) : undefined}\n rateLabel={copy.interest_rate ?? ''}\n row={row}\n sortKey={strategy.sortKey}\n />\n ))}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default PayoffStrategiesContent\n"],"mappings":";;;;;;;;;;;;;AA4BA,IAAM,IAAU;AAAA,EACd,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAChB,GAGM,IAAA,CAAgB,EAAE,UAAA,EAAA,MACtB,gBAAA,EAAC,GAAD;AAAA,EACE,OAAM;AAAA,EACN,WAAU;AAAA,EACV,IAAI;AAAA,IAAE,eAAe;AAAA,IAAK,eAAe;AAAA,EAAY;AAAA,EACrD,SAAQ;AAAA,EAEP,UAAA;AACG,CAAA,GAGF,IAAA,CAAgB,EACpB,OAAA,GACA,MAAA,GACA,OAAA,EAAA,MAMA,gBAAA,EAAC,GAAD;AAAA,EAAO,WAAU;AAAA,EAAU,IAAI;AAAA,IAAE,GAAG;AAAA,IAAS,MAAM;AAAA,IAAG,KAAK;AAAA,IAAI,GAAG;AAAA,EAAG;AAAA,EAArE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,WAAU;AAAA,IAAK,SAAQ;AAAA,IACtC,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAO,WAAU;AAAA,IAAK,IAAI;AAAA,MAAE,KAAK;AAAA,MAAI,WAAW;AAAA,MAAQ,GAAG;AAAA,MAAG,GAAG;AAAA,IAAE;AAAA,IAChE,UAAA,EAAM,IAAA,CAAK,MACV,gBAAA,EAAC,GAAD;AAAA,MAAO,WAA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A,EAAQ,IAAA,CAAK,GAAK,MACjB,gBAAA,EAAC,GAAD;AAAA,cACE,cAAc,EAAK,WAAW;AAAA,cAC9B,QAAQ,MAAU,EAAQ,SAAS;AAAA,cAEnC,SAAS,IAAA,MAAuB,EAAe,EAAI,IAAI,IAAI;AAAA,cAC3D,WAAW,EAAK,iBAAiB;AAAA,cAC5B,KAAA;AAAA,cACL,SAAS,EAAS;AAAA,YACnB,GALM,EAAI,IAKV,CACF;AAAA,UACI,CAAA,CACF;AAAA;MACF;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Account, Beat } from '../../../core';
|
|
2
|
+
import { GeneralInsightsFeedCopy } from '../../../core/types/localization/InsightsFeedCopy';
|
|
3
|
+
export type PayoffStrategyKey = 'avalanche' | 'snowball';
|
|
4
|
+
/** Which figure a strategy orders by; it is also the row's first label / value line. */
|
|
5
|
+
export type PayoffSortKey = 'rate' | 'balance';
|
|
6
|
+
export interface PayoffStep {
|
|
7
|
+
caption: string;
|
|
8
|
+
text: string;
|
|
9
|
+
/** mx-icons ligature name. */
|
|
10
|
+
icon: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PayoffStrategy {
|
|
13
|
+
key: PayoffStrategyKey;
|
|
14
|
+
label: string;
|
|
15
|
+
description: string;
|
|
16
|
+
pros: string[];
|
|
17
|
+
cons: string[];
|
|
18
|
+
steps: PayoffStep[];
|
|
19
|
+
/** The header above the ordered accounts ("Highest to lowest rate"). */
|
|
20
|
+
orderHeader: string;
|
|
21
|
+
sortKey: PayoffSortKey;
|
|
22
|
+
}
|
|
23
|
+
/** The two strategies as the pulse drawer worded them, from `insights_feed.general`; a missing word is dropped. */
|
|
24
|
+
export declare const buildStrategies: (copy: GeneralInsightsFeedCopy) => PayoffStrategy[];
|
|
25
|
+
export interface PayoffAccountRow {
|
|
26
|
+
guid: string;
|
|
27
|
+
name: string;
|
|
28
|
+
/** Empty when no institution is known: the default logo is shown. */
|
|
29
|
+
institutionGuid: string;
|
|
30
|
+
/** `null` when the account carries no balance: shown as a dash and sorted last. */
|
|
31
|
+
balance: number | null;
|
|
32
|
+
/** `null` when the account carries no interest rate: shown as a dash and sorted last. */
|
|
33
|
+
interestRate: number | null;
|
|
34
|
+
}
|
|
35
|
+
/** The last four digits of the account number, or `0000` when the account has none (WEC-1471). */
|
|
36
|
+
export declare const maskedNumber: (account: Pick<Account, "account_number">) => string;
|
|
37
|
+
/** The beat's `account_guids` among the visible accounts, in the beat's order; an unknown, hidden or closed guid is skipped. */
|
|
38
|
+
export declare const resolveStrategyAccounts: (beat: Beat, visibleAccounts: Account[]) => Account[];
|
|
39
|
+
export declare const toPayoffAccountRow: (account: Account) => PayoffAccountRow;
|
|
40
|
+
/** Avalanche: interest rate, highest first. Snowball: balance, lowest first. A missing value sorts last. A new array; the input is untouched. */
|
|
41
|
+
export declare const orderAccounts: (rows: PayoffAccountRow[], sortKey: PayoffSortKey) => PayoffAccountRow[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import l from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
var o = [
|
|
3
|
+
"request_quote",
|
|
4
|
+
"payments",
|
|
5
|
+
"price_check"
|
|
6
|
+
], n = (...e) => e.filter((t) => !!t?.trim()), r = (e, t) => [
|
|
7
|
+
e.step_one,
|
|
8
|
+
e.step_two,
|
|
9
|
+
e.step_three
|
|
10
|
+
].map((_, a) => ({
|
|
11
|
+
caption: _ ?? "",
|
|
12
|
+
icon: o[a],
|
|
13
|
+
text: t[a] ?? ""
|
|
14
|
+
})).filter((_) => _.text.trim() !== ""), d = (e) => [{
|
|
15
|
+
cons: n(e.takes_time_to_see_results, e.requires_patience_and_discipline),
|
|
16
|
+
description: e.pay_off_debts_with_high_interest_rates_first ?? "",
|
|
17
|
+
key: "avalanche",
|
|
18
|
+
label: e.avalanche ?? "",
|
|
19
|
+
orderHeader: e.highest_to_lowest_rate ?? "",
|
|
20
|
+
pros: n(e.fastest_way_to_eliminate_debt, e.costs_less_in_interest),
|
|
21
|
+
sortKey: "rate",
|
|
22
|
+
steps: r(e, [
|
|
23
|
+
e.make_minimum_monthly_payments_on_all_debt_accounts,
|
|
24
|
+
e.when_possible_pay_extra_on_the_account_with_the_highest_interest_rate,
|
|
25
|
+
e.when_paid_off_move_to_the_next_debt_with_the_highest
|
|
26
|
+
])
|
|
27
|
+
}, {
|
|
28
|
+
cons: n(e.takes_longer_to_pay_off_all_debts, e.may_cost_more_in_interest),
|
|
29
|
+
description: e.pay_off_debts_with_low_balances_first ?? "",
|
|
30
|
+
key: "snowball",
|
|
31
|
+
label: e.snowball ?? "",
|
|
32
|
+
orderHeader: e.lowest_to_highest_balance ?? "",
|
|
33
|
+
pros: n(e.provides_small_wins_quickly, e.builds_momentum_to_pay_off_debts),
|
|
34
|
+
sortKey: "balance",
|
|
35
|
+
steps: r(e, [
|
|
36
|
+
e.make_minimum_monthly_payments_on_all_debt_accounts,
|
|
37
|
+
e.when_possible_pay_extra_on_the_account_with_the_lowest_balance,
|
|
38
|
+
e.when_paid_off_move_to_the_next_debt_with_the_lowest
|
|
39
|
+
])
|
|
40
|
+
}], m = "0000", h = (e) => {
|
|
41
|
+
const t = e.account_number?.trim();
|
|
42
|
+
return t ? t.slice(-4) : m;
|
|
43
|
+
}, b = (e, t) => (e.account_guids ?? []).map((_) => t.find((a) => a.guid === _)).filter((_) => _ !== void 0), f = (e) => ({
|
|
44
|
+
balance: e.balance ?? null,
|
|
45
|
+
guid: e.guid,
|
|
46
|
+
institutionGuid: e.institution_guid ?? "",
|
|
47
|
+
interestRate: e.interest_rate ?? null,
|
|
48
|
+
name: `${l(e)} *${h(e)}`
|
|
49
|
+
}), w = (e, t) => [...e].sort((_, a) => {
|
|
50
|
+
const [s, i] = t === "rate" ? [_.interestRate, a.interestRate] : [_.balance, a.balance];
|
|
51
|
+
return s === null || i === null ? s === null ? i === null ? 0 : 1 : -1 : t === "rate" ? i - s : s - i;
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
d as buildStrategies,
|
|
55
|
+
h as maskedNumber,
|
|
56
|
+
w as orderAccounts,
|
|
57
|
+
b as resolveStrategyAccounts,
|
|
58
|
+
f as toPayoffAccountRow
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=layout.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.ts"],"sourcesContent":["import getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, Beat } from '../../../core'\nimport type { GeneralInsightsFeedCopy } from '../../../core/types/localization/InsightsFeedCopy'\n\nexport type PayoffStrategyKey = 'avalanche' | 'snowball'\n\n/** Which figure a strategy orders by; it is also the row's first label / value line. */\nexport type PayoffSortKey = 'rate' | 'balance'\n\nexport interface PayoffStep {\n caption: string\n text: string\n /** mx-icons ligature name. */\n icon: string\n}\n\nexport interface PayoffStrategy {\n key: PayoffStrategyKey\n label: string\n description: string\n pros: string[]\n cons: string[]\n steps: PayoffStep[]\n /** The header above the ordered accounts (\"Highest to lowest rate\"). */\n orderHeader: string\n sortKey: PayoffSortKey\n}\n\nconst STEP_ICONS = ['request_quote', 'payments', 'price_check'] as const\n\nconst words = (...values: (string | undefined)[]) =>\n values.filter((value): value is string => Boolean(value?.trim()))\n\nconst steps = (copy: GeneralInsightsFeedCopy, texts: (string | undefined)[]): PayoffStep[] =>\n [copy.step_one, copy.step_two, copy.step_three]\n .map((caption, index) => ({\n caption: caption ?? '',\n icon: STEP_ICONS[index],\n text: texts[index] ?? '',\n }))\n .filter((step) => step.text.trim() !== '')\n\n/** The two strategies as the pulse drawer worded them, from `insights_feed.general`; a missing word is dropped. */\nexport const buildStrategies = (copy: GeneralInsightsFeedCopy): PayoffStrategy[] => [\n {\n cons: words(copy.takes_time_to_see_results, copy.requires_patience_and_discipline),\n description: copy.pay_off_debts_with_high_interest_rates_first ?? '',\n key: 'avalanche',\n label: copy.avalanche ?? '',\n orderHeader: copy.highest_to_lowest_rate ?? '',\n pros: words(copy.fastest_way_to_eliminate_debt, copy.costs_less_in_interest),\n sortKey: 'rate',\n steps: steps(copy, [\n copy.make_minimum_monthly_payments_on_all_debt_accounts,\n copy.when_possible_pay_extra_on_the_account_with_the_highest_interest_rate,\n copy.when_paid_off_move_to_the_next_debt_with_the_highest,\n ]),\n },\n {\n cons: words(copy.takes_longer_to_pay_off_all_debts, copy.may_cost_more_in_interest),\n description: copy.pay_off_debts_with_low_balances_first ?? '',\n key: 'snowball',\n label: copy.snowball ?? '',\n orderHeader: copy.lowest_to_highest_balance ?? '',\n pros: words(copy.provides_small_wins_quickly, copy.builds_momentum_to_pay_off_debts),\n sortKey: 'balance',\n steps: steps(copy, [\n copy.make_minimum_monthly_payments_on_all_debt_accounts,\n copy.when_possible_pay_extra_on_the_account_with_the_lowest_balance,\n copy.when_paid_off_move_to_the_next_debt_with_the_lowest,\n ]),\n },\n]\n\nexport interface PayoffAccountRow {\n guid: string\n name: string\n /** Empty when no institution is known: the default logo is shown. */\n institutionGuid: string\n /** `null` when the account carries no balance: shown as a dash and sorted last. */\n balance: number | null\n /** `null` when the account carries no interest rate: shown as a dash and sorted last. */\n interestRate: number | null\n}\n\nconst FALLBACK_NUMBER = '0000'\n\n/** The last four digits of the account number, or `0000` when the account has none (WEC-1471). */\nexport const maskedNumber = (account: Pick<Account, 'account_number'>): string => {\n const digits = account.account_number?.trim()\n\n return digits ? digits.slice(-4) : FALLBACK_NUMBER\n}\n\n/** The beat's `account_guids` among the visible accounts, in the beat's order; an unknown, hidden or closed guid is skipped. */\nexport const resolveStrategyAccounts = (beat: Beat, visibleAccounts: Account[]): Account[] =>\n (beat.account_guids ?? [])\n .map((guid) => visibleAccounts.find((account) => account.guid === guid))\n .filter((account): account is Account => account !== undefined)\n\nexport const toPayoffAccountRow = (account: Account): PayoffAccountRow => ({\n balance: account.balance ?? null,\n guid: account.guid,\n institutionGuid: account.institution_guid ?? '',\n interestRate: account.interest_rate ?? null,\n name: `${getAccountDisplayName(account)} *${maskedNumber(account)}`,\n})\n\n/** Avalanche: interest rate, highest first. Snowball: balance, lowest first. A missing value sorts last. A new array; the input is untouched. */\nexport const orderAccounts = (\n rows: PayoffAccountRow[],\n sortKey: PayoffSortKey,\n): PayoffAccountRow[] =>\n [...rows].sort((a, b) => {\n const [x, y] = sortKey === 'rate' ? [a.interestRate, b.interestRate] : [a.balance, b.balance]\n\n if (x === null || y === null) return x === null ? (y === null ? 0 : 1) : -1\n\n return sortKey === 'rate' ? y - x : x - y\n })\n"],"mappings":";AA4BA,IAAM,IAAa;AAAA,EAAC;AAAA,EAAiB;AAAA,EAAY;AAAa,GAExD,IAAA,IAAY,MAChB,EAAO,OAAA,CAAQ,MAA2B,EAAQ,GAAO,KAAK,CAAE,GAE5D,IAAA,CAAS,GAA+B,MAC5C;AAAA,EAAC,EAAK;AAAA,EAAU,EAAK;AAAA,EAAU,EAAK;AAAU,EAC3C,IAAA,CAAK,GAAS,OAAW;AAAA,EACxB,SAAS,KAAW;AAAA,EACpB,MAAM,EAAW,CAAA;AAAA,EACjB,MAAM,EAAM,CAAA,KAAU;AACxB,EAAE,EACD,OAAA,CAAQ,MAAS,EAAK,KAAK,KAAK,MAAM,EAAE,GAGhC,IAAA,CAAmB,MAAoD,CAClF;AAAA,EACE,MAAM,EAAM,EAAK,2BAA2B,EAAK,gCAAgC;AAAA,EACjF,aAAa,EAAK,gDAAgD;AAAA,EAClE,KAAK;AAAA,EACL,OAAO,EAAK,aAAa;AAAA,EACzB,aAAa,EAAK,0BAA0B;AAAA,EAC5C,MAAM,EAAM,EAAK,+BAA+B,EAAK,sBAAsB;AAAA,EAC3E,SAAS;AAAA,EACT,OAAO,EAAM,GAAM;AAAA,IACjB,EAAK;AAAA,IACL,EAAK;AAAA,IACL,EAAK;AAAA,EACP,CAAC;AACH,GACA;AAAA,EACE,MAAM,EAAM,EAAK,mCAA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+
import { useAccountDetailsPrepare as r } from "../AccountDetailsBlock/useAccountDetailsPrepare.es.js";
|
|
3
|
+
import c from "react";
|
|
4
|
+
var u = () => {
|
|
5
|
+
const { accountsLoaded: e, loadAccounts: o } = t();
|
|
6
|
+
c.useEffect(() => {
|
|
7
|
+
e || o();
|
|
8
|
+
}, [e, o]), r();
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
u as usePayoffStrategiesPrepare
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=usePayoffStrategiesPrepare.es.js.map
|