@mx-cartographer/experiences 9.7.29 → 9.7.30

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/core/types/localization/InsightsFeedCopy.d.ts +25 -0
  3. package/dist/core/types/localization/index.d.ts +1 -1
  4. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.d.ts +11 -0
  5. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +132 -0
  6. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -0
  7. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.d.ts +12 -0
  8. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +124 -0
  9. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -0
  10. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/index.d.ts +1 -0
  11. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.d.ts +26 -0
  12. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.es.js +64 -0
  13. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.es.js.map +1 -0
  14. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.d.ts +8 -0
  15. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.es.js +26 -0
  16. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.es.js.map +1 -0
  17. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  18. package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
  19. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  20. package/dist/insights-v2/mappings/blocks.es.js +65 -59
  21. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  22. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [9.7.30] - 10-22-2026
2
+
3
+ - **ADDED** - `payoff_calculator_block` action block: the credit card payoff calculator drawer behind Monthly Credit Card Interest Summary's "Learn how to save", ported from pulse. Prefills the beat account's balance, interest rate and minimum payment, validates the inputs and compares the payoff at that payment, $10 more and $20 more, with a failure state. Copy under the new `insights_feed.payoff_calculator` namespace; fixture, stories, tests and `docs/action-blocks/payoff-calculator-block.md` (MEW2-3357)
4
+
1
5
  ## [9.7.29] - 10-22-2026
2
6
 
3
7
  - **ADDED** - Designate Emergency Savings Account on Insights 2.0. `ctaConfig` gains the two backend-named actions: `select_savings_account` ("Save") designates the account picked in the card through `updateUserInsightProfile`, stays disabled until a pick is made, refreshes the beat and fires `EMERGENCY_SAVINGS_ACCT_SAVED`; `open_savings_account` ("Open a Savings Account") fires `EMERGENCY_SAVINGS_ACCT_CREATED` while `ctaPostMessages.DesignateEmergencySavingsAccount` sends `beat/cta` op_1 — now keyed on the CTA's `action_key` (`open_savings_account`) instead of re-deriving pulse's data rule (no designation, no savings accounts), so it holds on every widget. The analytics catalogue gains `EMERGENCY_SAVINGS_ACCT_SELECTED` / `_SAVED` / `_CREATED` with pulse's strings (WEC-1859)
@@ -265,6 +265,29 @@ export interface GoalsBlockCopy {
265
265
  total_saved_label: string;
266
266
  complete_label: string;
267
267
  }
268
+ /** The credit card payoff calculator drawer (`payoff_calculator_block`). */
269
+ export interface PayoffCalculatorCopy {
270
+ /** Drawer title, e.g. "Credit card payoff calculator". */
271
+ title: string;
272
+ description: string;
273
+ credit_card_balance: string;
274
+ interest_rate: string;
275
+ monthly_payment: string;
276
+ calculate: string;
277
+ your_results: string;
278
+ time_to_payoff: string;
279
+ total_interest_paid: string;
280
+ /** Time to payoff, `_1{number}` months: singular and plural. */
281
+ month: string;
282
+ months: string;
283
+ calculation_failed: string;
284
+ calculation_failed_description: string;
285
+ /** Validation messages; `_1{value}` is the field label and `_2{amount}` the bound. */
286
+ value_is_required: string;
287
+ value_must_be_a_number: string;
288
+ value_must_be_greater_than_or_equal_to: string;
289
+ value_must_be_less_than_or_equal_to: string;
290
+ }
268
291
  export interface InsightsFeedCopy {
269
292
  general: GeneralInsightsFeedCopy;
270
293
  settings_menu: SettingsMenuCopy;
@@ -290,5 +313,7 @@ export interface InsightsFeedCopy {
290
313
  debts_block?: DebtsBlockCopy;
291
314
  /** Optional until the localized-content service ships the namespace. */
292
315
  goals_block?: GoalsBlockCopy;
316
+ /** Optional until the localized-content service ships the namespace. */
317
+ payoff_calculator?: PayoffCalculatorCopy;
293
318
  }
294
319
  export {};
@@ -13,7 +13,7 @@ export type { DebtsCopy } from './DebtsCopy';
13
13
  export type { FinstrongCopy } from './FinstrongCopy';
14
14
  export type { GoalsCopy } from './GoalsCopy';
15
15
  export type { HelpCopy, HelpByCategoryList } from './HelpCopy';
16
- export type { AmountInputModalCopy, AmountInputModalVariantCopy, InsightsFeedCopy, MakeTransferCopy, RemainingCashCopy, OverflowMenuCopy, DismissInsightCopy, DismissInsightOptionCopy, HiddenConfirmationCopy, HideFeedbackCopy, FeedbackCopy, FeedbackBarCopy, } from './InsightsFeedCopy';
16
+ export type { AmountInputModalCopy, AmountInputModalVariantCopy, InsightsFeedCopy, MakeTransferCopy, PayoffCalculatorCopy, RemainingCashCopy, OverflowMenuCopy, DismissInsightCopy, DismissInsightOptionCopy, HiddenConfirmationCopy, HideFeedbackCopy, FeedbackCopy, FeedbackBarCopy, } from './InsightsFeedCopy';
17
17
  export type { InvestmentsCopy } from './InvestmentsCopy';
18
18
  export type { MicroInsightsCopy } from './MicroInsightsCopy';
19
19
  export type { NetWorthCopy } from './NetWorthCopy';
@@ -0,0 +1,11 @@
1
+ import { ActionBlockProps } from '../../mappings/blocks';
2
+ /** Loads accounts once per open when the host did not attach the beat's primary account. */
3
+ export declare const usePayoffCalculatorPrepare: ({ beat }: ActionBlockProps) => void;
4
+ /**
5
+ * Monthly Credit Card Interest Summary's "Learn how to save" drawer: the credit card payoff
6
+ * calculator. The beat's account prefills the balance, interest rate and minimum payment; the
7
+ * user edits them and compares the payoff at that payment, $10 more and $20 more.
8
+ */
9
+ export declare const PayoffCalculatorBlock: (({ beat, }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
10
+ displayName: string;
11
+ };
@@ -0,0 +1,132 @@
1
+ import I from "../../../common/utils/AccountDisplayName.es.js";
2
+ import { useAccountStore as g, useGlobalCopyStore as S } from "../../../common/context/hooks.es.js";
3
+ import A from "../../../common/components/Loader.es.js";
4
+ import { isPayoffPossible as w } from "./payoff.es.js";
5
+ import { buildPayoffRows as F, initialPayoffInputs as R, parsePayoffInputs as k, resolvePrimaryAccount as D, validatePayoffInputs as L } from "./layout.es.js";
6
+ import { CalculationFailed as $, PayoffResults as j } from "./PayoffResults.es.js";
7
+ import l from "react";
8
+ import { observer as B } from "mobx-react-lite";
9
+ import c from "@mui/material/Stack";
10
+ import { InstitutionLogo as E, Text as h, TextField as T } from "@mxenabled/mxui";
11
+ import G from "@mui/material/Button";
12
+ import { jsx as o, jsxs as d } from "react/jsx-runtime";
13
+ import N from "@mui/material/InputAdornment";
14
+ var tt = ({ beat: i }) => {
15
+ const { accountsLoaded: t, loadAccounts: s } = g();
16
+ l.useEffect(() => {
17
+ !i.primary_account && !t && s();
18
+ }, []);
19
+ }, O = ({ account: i, copy: t }) => {
20
+ const s = l.useId(), [a, f] = l.useState(() => R(i)), [u, m] = l.useState({}), [p, v] = l.useState({ status: "idle" }), b = i ? I(i) : "", _ = (e) => (n) => f((r) => ({
21
+ ...r,
22
+ [e]: n.target.value
23
+ })), C = (e) => {
24
+ e.preventDefault();
25
+ const n = L(a, t);
26
+ if (m(n), Object.keys(n).length > 0) return;
27
+ const { balance: r, interestRate: x, monthlyPayment: P } = k(a);
28
+ v(w(x, r, P) ? {
29
+ status: "calculated",
30
+ rows: F(x, r, P)
31
+ } : { status: "failed" });
32
+ }, y = (e, n, r) => /* @__PURE__ */ o(T, {
33
+ error: !!u[e],
34
+ fullWidth: !0,
35
+ helperText: u[e],
36
+ id: `${s}-${e}`,
37
+ label: n,
38
+ onChange: _(e),
39
+ slotProps: {
40
+ htmlInput: { inputMode: "decimal" },
41
+ input: { [r.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */ o(N, {
42
+ "aria-hidden": "true",
43
+ position: r.position,
44
+ children: r.symbol
45
+ }) }
46
+ },
47
+ value: a[e]
48
+ });
49
+ return /* @__PURE__ */ d(c, {
50
+ component: "form",
51
+ noValidate: !0,
52
+ onSubmit: C,
53
+ sx: { p: 16 },
54
+ children: [
55
+ b && /* @__PURE__ */ d(c, {
56
+ sx: {
57
+ alignItems: "center",
58
+ flexDirection: "row",
59
+ gap: 8
60
+ },
61
+ children: [/* @__PURE__ */ o(E, {
62
+ alt: "",
63
+ institutionGuid: i?.institution_guid ?? "",
64
+ size: 24
65
+ }), /* @__PURE__ */ o(h, {
66
+ component: "p",
67
+ variant: "body2",
68
+ children: b
69
+ })]
70
+ }),
71
+ /* @__PURE__ */ o(h, {
72
+ color: "text.secondary",
73
+ component: "p",
74
+ sx: { mt: 16 },
75
+ variant: "body2",
76
+ children: t.description
77
+ }),
78
+ /* @__PURE__ */ d(c, {
79
+ sx: {
80
+ gap: 24,
81
+ pb: 24,
82
+ pt: 32
83
+ },
84
+ children: [y("balance", t.credit_card_balance, {
85
+ position: "start",
86
+ symbol: "$"
87
+ }), /* @__PURE__ */ d(c, {
88
+ sx: {
89
+ flexDirection: "row",
90
+ gap: 16
91
+ },
92
+ children: [y("interestRate", t.interest_rate, {
93
+ position: "end",
94
+ symbol: "%"
95
+ }), y("monthlyPayment", t.monthly_payment, {
96
+ position: "start",
97
+ symbol: "$"
98
+ })]
99
+ })]
100
+ }),
101
+ /* @__PURE__ */ o(G, {
102
+ fullWidth: !0,
103
+ sx: {
104
+ mb: 24,
105
+ mt: 8
106
+ },
107
+ type: "submit",
108
+ variant: "contained",
109
+ children: t.calculate
110
+ }),
111
+ p.status === "failed" ? /* @__PURE__ */ o($, { copy: t }) : /* @__PURE__ */ o(j, {
112
+ copy: t,
113
+ rows: p.status === "calculated" ? p.rows : void 0
114
+ })
115
+ ]
116
+ });
117
+ }, ot = B(function({ beat: t }) {
118
+ const { common: s, insights_feed: a } = S(), { accounts: f, accountsLoaded: u } = g(), m = a?.payoff_calculator;
119
+ return m ? !t.primary_account && !u ? /* @__PURE__ */ o(A, {}) : /* @__PURE__ */ o(O, {
120
+ account: D(t, f),
121
+ copy: m
122
+ }, t.guid) : /* @__PURE__ */ o(c, {
123
+ sx: { p: 24 },
124
+ children: /* @__PURE__ */ o(h, { children: s?.error_message })
125
+ });
126
+ });
127
+ export {
128
+ ot as PayoffCalculatorBlock,
129
+ tt as usePayoffCalculatorPrepare
130
+ };
131
+
132
+ //# sourceMappingURL=PayoffCalculatorBlock.es.js.map
@@ -0,0 +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 { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accounts, accountsLoaded } = useAccountStore()\n const copy = insightsFeedCopy?.payoff_calculator\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\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":";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A,UAAO,GAAY,cAAoB,CAAA;AAAA,EAClC,CAAA;AAab,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { PayoffCalculatorCopy } from '../../../core';
2
+ import { PayoffRow } from './layout';
3
+ interface PayoffResultsProps {
4
+ copy: PayoffCalculatorCopy;
5
+ /** Undefined until the user has calculated: the rows then show placeholders. */
6
+ rows?: PayoffRow[];
7
+ }
8
+ export declare const PayoffResults: ({ copy, rows }: PayoffResultsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const CalculationFailed: ({ copy }: {
10
+ copy: PayoffCalculatorCopy;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,124 @@
1
+ import { buildPluralCopy as h } from "../../../core/utils/Localization.es.js";
2
+ import { formatCurrency as s } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { PAYMENT_INCREMENTS as x } from "./layout.es.js";
4
+ import m from "@mui/material/Stack";
5
+ import { Text as t } from "@mxenabled/mxui";
6
+ import { Icon as v } from "@mxenabled/mx-icons";
7
+ import { Fragment as y, jsx as r, jsxs as n } from "react/jsx-runtime";
8
+ import g from "@mui/material/Box";
9
+ var C = "0px 6px 12px rgba(106, 115, 129, 0.16), 0px 3px 8px rgba(87, 102, 117, 0.06)", p = ({ label: o, tone: a, value: e }) => /* @__PURE__ */ n(m, {
10
+ sx: {
11
+ flexDirection: "row",
12
+ justifyContent: "space-between"
13
+ },
14
+ children: [/* @__PURE__ */ r(t, {
15
+ color: "text.secondary",
16
+ component: "span",
17
+ variant: "caption",
18
+ children: o
19
+ }), /* @__PURE__ */ r(t, {
20
+ bold: !0,
21
+ color: a,
22
+ component: "span",
23
+ sx: { transition: "color 0.5s" },
24
+ variant: "body1",
25
+ children: e
26
+ })]
27
+ }), E = ({ copy: o, rows: a }) => {
28
+ const e = !!a, i = e ? "text.primary" : "text.secondary", u = a ?? x.map(() => {
29
+ });
30
+ return /* @__PURE__ */ n(g, {
31
+ sx: {
32
+ bgcolor: e ? "background.paper" : "background.default",
33
+ borderRadius: "4px",
34
+ boxShadow: e ? C : "none",
35
+ transition: "background-color 0.5s, box-shadow 0.5s"
36
+ },
37
+ children: [/* @__PURE__ */ r(t, {
38
+ bold: !0,
39
+ color: i,
40
+ component: "h3",
41
+ sx: {
42
+ borderBottom: 1,
43
+ borderColor: "divider",
44
+ p: 16
45
+ },
46
+ variant: "h3",
47
+ children: o.your_results
48
+ }), u.map((l, b) => {
49
+ const c = x[b], d = l?.result.paymentCount ?? 0, f = d >= 1 ? h(o.month, o.months, d, String(d)) : "-";
50
+ return /* @__PURE__ */ n(m, {
51
+ sx: {
52
+ borderBottom: b === u.length - 1 ? 0 : 1,
53
+ borderColor: "divider",
54
+ gap: 16,
55
+ px: 16,
56
+ py: 24
57
+ },
58
+ children: [
59
+ /* @__PURE__ */ r(p, {
60
+ label: /* @__PURE__ */ n(y, { children: [o.monthly_payment, c > 0 && /* @__PURE__ */ r(t, {
61
+ bold: !0,
62
+ color: "success.main",
63
+ component: "span",
64
+ variant: "caption",
65
+ children: ` +${s(c, "0,0.00")}`
66
+ })] }),
67
+ tone: i,
68
+ value: s(l?.monthlyPayment ?? 0, "0,0.00")
69
+ }),
70
+ /* @__PURE__ */ r(p, {
71
+ label: o.time_to_payoff,
72
+ tone: i,
73
+ value: f
74
+ }),
75
+ /* @__PURE__ */ r(p, {
76
+ label: o.total_interest_paid,
77
+ tone: i,
78
+ value: s(l?.result.totalInterestPaid ?? 0, "0,0.00")
79
+ })
80
+ ]
81
+ }, c);
82
+ })]
83
+ });
84
+ }, j = ({ copy: o }) => /* @__PURE__ */ n(m, {
85
+ role: "alert",
86
+ sx: {
87
+ alignItems: "center",
88
+ bgcolor: "background.default",
89
+ borderRadius: "4px",
90
+ px: 32,
91
+ py: 40,
92
+ textAlign: "center"
93
+ },
94
+ children: [
95
+ /* @__PURE__ */ r(v, {
96
+ "aria-hidden": "true",
97
+ fill: !0,
98
+ name: "error",
99
+ size: 24,
100
+ sx: { color: "primary.main" }
101
+ }),
102
+ /* @__PURE__ */ r(t, {
103
+ bold: !0,
104
+ component: "p",
105
+ sx: {
106
+ pb: 8,
107
+ pt: 16
108
+ },
109
+ variant: "body1",
110
+ children: o.calculation_failed
111
+ }),
112
+ /* @__PURE__ */ r(t, {
113
+ component: "p",
114
+ variant: "body2",
115
+ children: o.calculation_failed_description
116
+ })
117
+ ]
118
+ });
119
+ export {
120
+ j as CalculationFailed,
121
+ E as PayoffResults
122
+ };
123
+
124
+ //# sourceMappingURL=PayoffResults.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayoffResults.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\nconst CALCULATED_SHADOW =\n '0px 6px 12px rgba(106, 115, 129, 0.16), 0px 3px 8px rgba(87, 102, 117, 0.06)'\n\ninterface ResultLineProps {\n label: React.ReactNode\n tone: 'text.primary' | 'text.secondary'\n value: string\n}\n\nconst ResultLine = ({ label, tone, value }: ResultLineProps) => (\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n <Text\n bold={true}\n color={tone}\n component=\"span\"\n sx={{ transition: 'color 0.5s' }}\n variant=\"body1\"\n >\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the rows then show placeholders. */\n rows?: PayoffRow[]\n}\n\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const isCalculated = !!rows\n const tone = isCalculated ? 'text.primary' : 'text.secondary'\n const shown: Array<PayoffRow | undefined> = rows ?? PAYMENT_INCREMENTS.map(() => undefined)\n\n return (\n <Box\n sx={{\n bgcolor: isCalculated ? 'background.paper' : 'background.default',\n borderRadius: '4px',\n boxShadow: isCalculated ? CALCULATED_SHADOW : 'none',\n transition: 'background-color 0.5s, box-shadow 0.5s',\n }}\n >\n <Text\n bold={true}\n color={tone}\n component=\"h3\"\n sx={{ borderBottom: 1, borderColor: 'divider', p: 16 }}\n variant=\"h3\"\n >\n {copy.your_results}\n </Text>\n {shown.map((row, index) => {\n const increment = PAYMENT_INCREMENTS[index]\n const paymentCount = row?.result.paymentCount ?? 0\n const timeToPayoff =\n paymentCount >= 1\n ? (buildPluralCopy(\n copy.month,\n copy.months,\n paymentCount,\n String(paymentCount),\n ) as string)\n : '-'\n\n return (\n <Stack\n key={increment}\n sx={{\n borderBottom: index === shown.length - 1 ? 0 : 1,\n borderColor: 'divider',\n gap: 16,\n px: 16,\n py: 24,\n }}\n >\n <ResultLine\n label={\n <>\n {copy.monthly_payment}\n {increment > 0 && (\n <Text bold={true} color=\"success.main\" component=\"span\" variant=\"caption\">\n {` +${formatCurrency(increment, '0,0.00')}`}\n </Text>\n )}\n </>\n }\n tone={tone}\n value={formatCurrency(row?.monthlyPayment ?? 0, '0,0.00')}\n />\n <ResultLine label={copy.time_to_payoff} tone={tone} value={timeToPayoff} />\n <ResultLine\n label={copy.total_interest_paid}\n tone={tone}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, '0,0.00')}\n />\n </Stack>\n )\n })}\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.default',\n borderRadius: '4px',\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;AAYA,IAAM,IACJ,gFAQI,IAAA,CAAc,EAAE,OAAA,GAAO,MAAA,GAAM,OAAA,EAAA,MACjC,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,eAAe;AAAA,IAAO,gBAAgB;AAAA,EAAgB;AAAA,EAAnE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAO,SAAQ;AAAA,IACnD,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAU;AAAA,IACV,IAAI,EAAE,YAAY,aAAa;AAAA,IAC/B,SAAQ;AAAA,IAEP,UAAA;AAAA,EACG,CAAA,CACD;IASI,IAAA,CAAiB,EAAE,MAAA,GAAM,MAAA,EAAA,MAA+B;AACnE,QAAM,IAAe,CAAC,CAAC,GACjB,IAAO,IAAe,iBAAiB,kBACvC,IAAsC,KAAQ,EAAmB,IAAA,MAAA;AAAA,GAAmB;AAE1F,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,SAAS,IAAe,qBAAqB;AAAA,MAC7C,cAAc;AAAA,MACd,WAAW,IAAe,IAAoB;AAAA,MAC9C,YAAY;AAAA,IACd;AAAA,IANF,UAAA,CAQE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,WAAU;AAAA,MACV,IAAI;AAAA,QAAE,cAAc;AAAA,QAAG,aAAa;AAAA,QAAW,GAAG;AAAA,MAAG;AAAA,MACrD,SAAQ;AAAA,MAEP,UAAA,EAAK;AAAA,IACF,CAAA,GACL,EAAM,IAAA,CAAK,GAAK,MAAU;AACzB,YAAM,IAAY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AAA,EATF,UAAA;AAAA,IAWE,gBAAA,EAAC,GAAD;AAAA,MAAM,eAAY;AAAA,MAAO,MAAM;AAAA,MAAM,MAAK;AAAA,MAAQ,MAAM;AAAA,MAAI,IAAI,EAAE,OAAO,eAAe;AAAA,IAAI,CAAA;AAAA,IAC5F,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,WAAU;AAAA,MAAI,IAAI;AAAA,QAAE,IAAI;AAAA,QAAG,IAAI;AAAA,MAAG;AAAA,MAAG,SAAQ;AAAA,MAC5D,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MAAM,WAAU;AAAA,MAAI,SAAQ;AAAA,MACzB,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,EACD"}
@@ -0,0 +1 @@
1
+ export { PayoffCalculatorBlock, usePayoffCalculatorPrepare } from './PayoffCalculatorBlock';
@@ -0,0 +1,26 @@
1
+ import { Account, Beat, PayoffCalculatorCopy } from '../../../core';
2
+ import { PayoffResult } from './payoff';
3
+ /** The three monthly payments the results compare: the entered one and two small increases. */
4
+ export declare const PAYMENT_INCREMENTS: readonly [0, 10, 20];
5
+ export type PayoffField = 'balance' | 'interestRate' | 'monthlyPayment';
6
+ export type PayoffInputs = Record<PayoffField, string>;
7
+ export type PayoffErrors = Partial<Record<PayoffField, string>>;
8
+ export declare const PAYOFF_FIELDS: readonly PayoffField[];
9
+ export declare const validatePayoffInputs: (inputs: PayoffInputs, copy: PayoffCalculatorCopy) => PayoffErrors;
10
+ export interface PayoffRow {
11
+ /** How much more than the entered payment this row pays each month. */
12
+ increment: number;
13
+ monthlyPayment: number;
14
+ result: PayoffResult;
15
+ }
16
+ export declare const buildPayoffRows: (annualRatePercent: number, balance: number, payment: number) => PayoffRow[];
17
+ export declare const parsePayoffInputs: (inputs: PayoffInputs) => {
18
+ balance: number;
19
+ interestRate: number;
20
+ monthlyPayment: number;
21
+ };
22
+ /** Manual accounts carry their rate as `interest_rate`; aggregated ones as APR, else APY. */
23
+ export declare const interestRateOf: (account: Account) => number | undefined;
24
+ export declare const initialPayoffInputs: (account?: Account) => PayoffInputs;
25
+ /** The beat's primary account: from the beat when the host attached it, else the loaded accounts. */
26
+ export declare const resolvePrimaryAccount: (beat: Beat, accounts: Account[]) => Account | undefined;
@@ -0,0 +1,64 @@
1
+ import { buildDynamicCopy as i } from "../../../core/utils/Localization.es.js";
2
+ import { calculatePayoff as o } from "./payoff.es.js";
3
+ var s = [
4
+ 0,
5
+ 10,
6
+ 20
7
+ ], u = [
8
+ "balance",
9
+ "interestRate",
10
+ "monthlyPayment"
11
+ ], f = {
12
+ balance: {
13
+ label: "credit_card_balance",
14
+ min: 0.01
15
+ },
16
+ interestRate: {
17
+ label: "interest_rate",
18
+ min: 0,
19
+ max: 100
20
+ },
21
+ monthlyPayment: {
22
+ label: "monthly_payment",
23
+ min: 0.01,
24
+ max: 1e6
25
+ }
26
+ }, b = /^(\d+\.?\d*|\.\d+)$/, y = (e, t, a) => {
27
+ const r = f[e], n = a[r.label], m = t.trim();
28
+ if (!m) return i(a.value_is_required, n);
29
+ if (!b.test(m)) return i(a.value_must_be_a_number, n);
30
+ const _ = Number(m);
31
+ if (_ < r.min) return i(a.value_must_be_greater_than_or_equal_to, n, String(r.min));
32
+ if (r.max !== void 0 && _ > r.max) return i(a.value_must_be_less_than_or_equal_to, n, String(r.max));
33
+ }, R = (e, t) => {
34
+ const a = {};
35
+ for (const r of u) {
36
+ const n = y(r, e[r], t);
37
+ n && (a[r] = n);
38
+ }
39
+ return a;
40
+ }, h = (e, t, a) => s.map((r) => ({
41
+ increment: r,
42
+ monthlyPayment: a + r,
43
+ result: o(e, t, a + r)
44
+ })), p = (e) => ({
45
+ balance: Number(e.balance),
46
+ interestRate: Number(e.interestRate),
47
+ monthlyPayment: Number(e.monthlyPayment)
48
+ }), v = (e) => e.is_manual ? e.interest_rate ?? void 0 : e.apr ?? e.apy ?? e.interest_rate ?? void 0, l = (e) => e ? String(e) : "", N = (e) => ({
49
+ balance: l(e?.balance),
50
+ interestRate: l(e && v(e)),
51
+ monthlyPayment: l(e?.minimum_payment)
52
+ }), E = (e, t) => e.primary_account ?? t.find((a) => a.guid === e.primary_account_guid);
53
+ export {
54
+ s as PAYMENT_INCREMENTS,
55
+ u as PAYOFF_FIELDS,
56
+ h as buildPayoffRows,
57
+ N as initialPayoffInputs,
58
+ v as interestRateOf,
59
+ p as parsePayoffInputs,
60
+ E as resolvePrimaryAccount,
61
+ R as validatePayoffInputs
62
+ };
63
+
64
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.ts"],"sourcesContent":["import { buildDynamicCopy } from '../../../common'\nimport type { Account, Beat, PayoffCalculatorCopy } from '../../../core'\n\nimport { calculatePayoff, type PayoffResult } from './payoff'\n\n/** The three monthly payments the results compare: the entered one and two small increases. */\nexport const PAYMENT_INCREMENTS = [0, 10, 20] as const\n\nexport type PayoffField = 'balance' | 'interestRate' | 'monthlyPayment'\n\nexport type PayoffInputs = Record<PayoffField, string>\n\nexport type PayoffErrors = Partial<Record<PayoffField, string>>\n\nexport const PAYOFF_FIELDS: readonly PayoffField[] = ['balance', 'interestRate', 'monthlyPayment']\n\ninterface FieldRule {\n label: 'credit_card_balance' | 'interest_rate' | 'monthly_payment'\n min: number\n max?: number\n}\n\nconst RULES: Record<PayoffField, FieldRule> = {\n balance: { label: 'credit_card_balance', min: 0.01 },\n interestRate: { label: 'interest_rate', min: 0, max: 100 },\n monthlyPayment: { label: 'monthly_payment', min: 0.01, max: 1_000_000 },\n}\n\nconst NUMBER_PATTERN = /^(\\d+\\.?\\d*|\\.\\d+)$/\n\nconst fieldError = (\n field: PayoffField,\n value: string,\n copy: PayoffCalculatorCopy,\n): string | undefined => {\n const rule = RULES[field]\n const label = copy[rule.label]\n const trimmed = value.trim()\n\n if (!trimmed) return buildDynamicCopy(copy.value_is_required, label) as string\n if (!NUMBER_PATTERN.test(trimmed))\n return buildDynamicCopy(copy.value_must_be_a_number, label) as string\n\n const amount = Number(trimmed)\n\n if (amount < rule.min) {\n return buildDynamicCopy(\n copy.value_must_be_greater_than_or_equal_to,\n label,\n String(rule.min),\n ) as string\n }\n if (rule.max !== undefined && amount > rule.max) {\n return buildDynamicCopy(\n copy.value_must_be_less_than_or_equal_to,\n label,\n String(rule.max),\n ) as string\n }\n\n return undefined\n}\n\nexport const validatePayoffInputs = (\n inputs: PayoffInputs,\n copy: PayoffCalculatorCopy,\n): PayoffErrors => {\n const errors: PayoffErrors = {}\n\n for (const field of PAYOFF_FIELDS) {\n const error = fieldError(field, inputs[field], copy)\n\n if (error) errors[field] = error\n }\n\n return errors\n}\n\nexport interface PayoffRow {\n /** How much more than the entered payment this row pays each month. */\n increment: number\n monthlyPayment: number\n result: PayoffResult\n}\n\nexport const buildPayoffRows = (\n annualRatePercent: number,\n balance: number,\n payment: number,\n): PayoffRow[] =>\n PAYMENT_INCREMENTS.map((increment) => ({\n increment,\n monthlyPayment: payment + increment,\n result: calculatePayoff(annualRatePercent, balance, payment + increment),\n }))\n\nexport const parsePayoffInputs = (inputs: PayoffInputs) => ({\n balance: Number(inputs.balance),\n interestRate: Number(inputs.interestRate),\n monthlyPayment: Number(inputs.monthlyPayment),\n})\n\n/** Manual accounts carry their rate as `interest_rate`; aggregated ones as APR, else APY. */\nexport const interestRateOf = (account: Account): number | undefined => {\n if (account.is_manual) return account.interest_rate ?? undefined\n\n return account.apr ?? account.apy ?? account.interest_rate ?? undefined\n}\n\n/** A known, non-zero figure as the field's starting text; anything else starts empty. */\nconst toInputValue = (value?: number | null): string => (value ? String(value) : '')\n\nexport const initialPayoffInputs = (account?: Account): PayoffInputs => ({\n balance: toInputValue(account?.balance),\n interestRate: toInputValue(account && interestRateOf(account)),\n monthlyPayment: toInputValue(account?.minimum_payment),\n})\n\n/** The beat's primary account: from the beat when the host attached it, else the loaded accounts. */\nexport const resolvePrimaryAccount = (beat: Beat, accounts: Account[]): Account | undefined =>\n beat.primary_account ?? accounts.find((account) => account.guid === beat.primary_account_guid)\n"],"mappings":";;AAMA,IAAa,IAAqB;AAAA,EAAC;AAAA,EAAG;AAAA,EAAI;AAAE,GAQ/B,IAAwC;AAAA,EAAC;AAAA,EAAW;AAAA,EAAgB;AAAgB,GAQ3F,IAAwC;AAAA,EAC5C,SAAS;AAAA,IAAE,OAAO;AAAA,IAAuB,KAAK;AAAA,EAAK;AAAA,EACnD,cAAc;AAAA,IAAE,OAAO;AAAA,IAAiB,KAAK;AAAA,IAAG,KAAK;AAAA,EAAI;AAAA,EACzD,gBAAgB;AAAA,IAAE,OAAO;AAAA,IAAmB,KAAK;AAAA,IAAM,KAAK;AAAA,EAAU;AACxE,GAEM,IAAiB,uBAEjB,IAAA,CACJ,GACA,GACA,MACuB;AACvB,QAAM,IAAO,EAAM,CAAA,GACb,IAAQ,EAAK,EAAK,KAAA,GAClB,IAAU,EAAM,KAAK;AAE3B,MAAI,CAAC,EAAS,QAAO,EAAiB,EAAK,mBAAmB,CAAK;AACnE,MAAI,CAAC,EAAe,KAAK,CAAO,EAC9B,QAAO,EAAiB,EAAK,wBAAwB,CAAK;AAE5D,QAAM,IAAS,OAAO,CAAO;AAE7B,MAAI,IAAS,EAAK,IAChB,QAAO,EACL,EAAK,wCACL,GACA,OAAO,EAAK,GAAG,CACjB;AAEF,MAAI,EAAK,QAAQ,UAAa,IAAS,EAAK,IAC1C,QAAO,EACL,EAAK,qCACL,GACA,OAAO,EAAK,GAAG,CACjB;AAIJ,GAEa,IAAA,CACX,GACA,MACiB;AACjB,QAAM,IAAuB,CAAC;AAE9B,aAAW,KAAS,GAAe;AACjC,UAAM,IAAQ,EAAW,GAAO,EAAO,CAAA,GAAQ,CAAI;AAEnD,IAAI,MAAO,EAAO,CAAA,IAAS;AAAA,EAC7B;AAEA,SAAO;AACT,GASa,IAAA,CACX,GACA,GACA,MAEA,EAAmB,IAAA,CAAK,OAAe;AAAA,EACrC,WAAA;AAAA,EACA,gBAAgB,IAAU;AAAA,EAC1B,QAAQ,EAAgB,GAAmB,GAAS,IAAU,CAAS;AACzE,EAAE,GAES,IAAA,CAAqB,OAA0B;AAAA,EAC1D,SAAS,OAAO,EAAO,OAAO;AAAA,EAC9B,cAAc,OAAO,EAAO,YAAY;AAAA,EACxC,gBAAgB,OAAO,EAAO,cAAc;AAC9C,IAGa,IAAA,CAAkB,MACzB,EAAQ,YAAkB,EAAQ,iBAAiB,SAEhD,EAAQ,OAAO,EAAQ,OAAO,EAAQ,iBAAiB,QAI1D,IAAA,CAAgB,MAAmC,IAAQ,OAAO,CAAK,IAAI,IAEpE,IAAA,CAAuB,OAAqC;AAAA,EACvE,SAAS,EAAa,GAAS,OAAO;AAAA,EACtC,cAAc,EAAa,KAAW,EAAe,CAAO,CAAC;AAAA,EAC7D,gBAAgB,EAAa,GAAS,eAAe;AACvD,IAGa,IAAA,CAAyB,GAAY,MAChD,EAAK,mBAAmB,EAAS,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAK,oBAAoB"}
@@ -0,0 +1,8 @@
1
+ export interface PayoffResult {
2
+ /** Monthly payments until the balance reaches zero. */
3
+ paymentCount: number;
4
+ totalInterestPaid: number;
5
+ }
6
+ export declare const paymentCountFor: (balance: number, monthlyRate: number, payment: number) => number;
7
+ export declare const isPayoffPossible: (annualRatePercent: number, balance: number, payment: number) => boolean;
8
+ export declare const calculatePayoff: (annualRatePercent: number, balance: number, payment: number) => PayoffResult;
@@ -0,0 +1,26 @@
1
+ var l = 1200, u = (r) => r / 1200, a = (r, o, t) => Math.ceil(o === 0 ? r / t : -Math.log(1 - o * r / t) / Math.log(1 + o)), v = (r, o, t, i) => {
2
+ if (t === 0) return 0;
3
+ let e = 0;
4
+ for (let s = 0; s < r; s += 1) {
5
+ const n = Math.pow(1 + t, s), f = o * n - i * ((n - 1) / t);
6
+ e += f * t;
7
+ }
8
+ return e;
9
+ }, M = (r, o, t) => {
10
+ if (!Number.isFinite(r) || !Number.isFinite(o) || !(t > 0)) return !1;
11
+ const i = a(o, u(r), t);
12
+ return Number.isFinite(i) && i <= l;
13
+ }, c = (r, o, t) => {
14
+ const i = u(r), e = a(o, i, t);
15
+ return {
16
+ paymentCount: e,
17
+ totalInterestPaid: v(e, o, i, t)
18
+ };
19
+ };
20
+ export {
21
+ c as calculatePayoff,
22
+ M as isPayoffPossible,
23
+ a as paymentCountFor
24
+ };
25
+
26
+ //# sourceMappingURL=payoff.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payoff.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.ts"],"sourcesContent":["const MONTHS_PER_YEAR = 12\n\n/** A payoff further out than this is treated as unreachable (pulse `src/utils/Debt.js`). */\nconst MAX_MONTHS = 100 * MONTHS_PER_YEAR\n\nexport interface PayoffResult {\n /** Monthly payments until the balance reaches zero. */\n paymentCount: number\n totalInterestPaid: number\n}\n\nconst monthlyRateOf = (annualRatePercent: number) => annualRatePercent / (MONTHS_PER_YEAR * 100)\n\n// http://financeformulas.net/Solve-for-Number-of-Periods-PV-and-FV.html\nexport const paymentCountFor = (balance: number, monthlyRate: number, payment: number): number =>\n Math.ceil(\n monthlyRate === 0\n ? balance / payment\n : -Math.log(1 - (monthlyRate * balance) / payment) / Math.log(1 + monthlyRate),\n )\n\nconst totalInterestFor = (\n paymentCount: number,\n balance: number,\n monthlyRate: number,\n payment: number,\n): number => {\n if (monthlyRate === 0) return 0\n\n let total = 0\n\n for (let month = 0; month < paymentCount; month += 1) {\n const growth = Math.pow(1 + monthlyRate, month)\n const openingBalance = balance * growth - payment * ((growth - 1) / monthlyRate)\n\n total += openingBalance * monthlyRate\n }\n\n return total\n}\n\nexport const isPayoffPossible = (\n annualRatePercent: number,\n balance: number,\n payment: number,\n): boolean => {\n if (!Number.isFinite(annualRatePercent) || !Number.isFinite(balance) || !(payment > 0)) {\n return false\n }\n\n const paymentCount = paymentCountFor(balance, monthlyRateOf(annualRatePercent), payment)\n\n return Number.isFinite(paymentCount) && paymentCount <= MAX_MONTHS\n}\n\nexport const calculatePayoff = (\n annualRatePercent: number,\n balance: number,\n payment: number,\n): PayoffResult => {\n const monthlyRate = monthlyRateOf(annualRatePercent)\n const paymentCount = paymentCountFor(balance, monthlyRate, payment)\n\n return {\n paymentCount,\n totalInterestPaid: totalInterestFor(paymentCount, balance, monthlyRate, payment),\n }\n}\n"],"mappings":"AAGA,IAAM,IAAa,MAQb,IAAA,CAAiB,MAA8B,IAAqB,MAG7D,IAAA,CAAmB,GAAiB,GAAqB,MACpE,KAAK,KACH,MAAgB,IACZ,IAAU,IACV,CAAC,KAAK,IAAI,IAAK,IAAc,IAAW,CAAO,IAAI,KAAK,IAAI,IAAI,CAAW,CACjF,GAEI,IAAA,CACJ,GACA,GACA,GACA,MACW;AACX,MAAI,MAAgB,EAAG,QAAO;AAE9B,MAAI,IAAQ;AAEZ,WAAS,IAAQ,GAAG,IAAQ,GAAc,KAAS,GAAG;AACpD,UAAM,IAAS,KAAK,IAAI,IAAI,GAAa,CAAK,GACxC,IAAiB,IAAU,IAAS,MAAY,IAAS,KAAK;AAEpE,IAAA,KAAS,IAAiB;AAAA,EAC5B;AAEA,SAAO;AACT,GAEa,IAAA,CACX,GACA,GACA,MACY;AACZ,MAAI,CAAC,OAAO,SAAS,CAAiB,KAAK,CAAC,OAAO,SAAS,CAAO,KAAK,EAAE,IAAU,GAClF,QAAO;AAGT,QAAM,IAAe,EAAgB,GAAS,EAAc,CAAiB,GAAG,CAAO;AAEvF,SAAO,OAAO,SAAS,CAAY,KAAK,KAAgB;AAC1D,GAEa,IAAA,CACX,GACA,GACA,MACiB;AACjB,QAAM,IAAc,EAAc,CAAiB,GAC7C,IAAe,EAAgB,GAAS,GAAa,CAAO;AAElE,SAAO;AAAA,IACL,cAAA;AAAA,IACA,mBAAmB,EAAiB,GAAc,GAAS,GAAa,CAAO;AAAA,EACjF;AACF"}
@@ -12,4 +12,5 @@ export declare const actionBlocksKey: {
12
12
  TRANSACTION_LIST_ACTION_BLOCK: string;
13
13
  REMAINING_CASH_ACTION_BLOCK: string;
14
14
  AMOUNT_INPUT_MODAL_ACTION_BLOCK: string;
15
+ PAYOFF_CALCULATOR_ACTION_BLOCK: string;
15
16
  };
@@ -11,7 +11,8 @@ var _ = {
11
11
  RECURRING_TRANSACTION_ACTION_BLOCK: "recurring_transaction_block",
12
12
  TRANSACTION_LIST_ACTION_BLOCK: "transaction_list_block",
13
13
  REMAINING_CASH_ACTION_BLOCK: "remaining_cash_block",
14
- AMOUNT_INPUT_MODAL_ACTION_BLOCK: "amount_input_modal_block"
14
+ AMOUNT_INPUT_MODAL_ACTION_BLOCK: "amount_input_modal_block",
15
+ PAYOFF_CALCULATOR_ACTION_BLOCK: "payoff_calculator_block"
15
16
  };
16
17
  export {
17
18
  _ as actionBlocksKey
@@ -1 +1 @@
1
- {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AACnC"}
1
+ {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,gCAAgC;AAClC"}
@@ -1,43 +1,44 @@
1
- import { ContactSupportActionBlock as p } from "../actionBlocks/ContactSupportActionBlock.es.js";
2
- import { hasDrawerBlock as Y } from "./hasDrawerBlock.es.js";
1
+ import { ContactSupportActionBlock as m } from "../actionBlocks/ContactSupportActionBlock.es.js";
2
+ import { hasDrawerBlock as j } from "./hasDrawerBlock.es.js";
3
3
  import { actionBlocksKey as o } from "./actionBlocksKey.es.js";
4
- import { BarchartBlock as l } from "../blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
4
+ import { BarchartBlock as p } from "../blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
5
5
  import { DoubleBarChartBlock as _ } from "../blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
6
6
  import s from "../blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js";
7
- import k from "../blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
8
- import C from "../blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
7
+ import C from "../blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
8
+ import k from "../blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
9
9
  import B from "../blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js";
10
10
  import u from "../blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
11
- import T from "../blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js";
11
+ import f from "../blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js";
12
12
  import { BudgetBlock as A } from "../blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
13
- import f from "../blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js";
13
+ import T from "../blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js";
14
14
  import O from "../blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js";
15
15
  import b from "../blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js";
16
- import n from "../blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js";
16
+ import i from "../blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js";
17
17
  import N from "../blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
18
18
  import d from "../blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js";
19
19
  import { TransactionBlock as g } from "../blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
20
20
  import I from "../blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js";
21
- import L from "../blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js";
22
- import P from "../blocks/ImageBlocks/ImageBlock.es.js";
21
+ import P from "../blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js";
22
+ import L from "../blocks/ImageBlocks/ImageBlock.es.js";
23
23
  import { SVGImageBlock as D } from "../blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
24
24
  import { FeedbackModalActionBlock as h } from "../actionBlocks/FeedbackModalActionBlock.es.js";
25
25
  import { ConnectionDetailActionBlock as S } from "../actionBlocks/ConnectionDetailActionBlock.es.js";
26
26
  import { ConnectWidgetActionBlock as R } from "../actionBlocks/ConnectWidgetActionBlock.es.js";
27
- import { SurveyModalActionBlock as E } from "../actionBlocks/SurveyModalActionBlock.es.js";
28
- import { PlaceholderActionBlock as K } from "../actionBlocks/PlaceholderActionBlock.es.js";
29
- import { getMakeTransferDrawerTitle as v } from "../actionBlocks/MakeTransferActionBlock/layout.es.js";
30
- import { MakeTransferActionBlockLayer as y } from "../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js";
27
+ import { SurveyModalActionBlock as K } from "../actionBlocks/SurveyModalActionBlock.es.js";
28
+ import { PlaceholderActionBlock as E } from "../actionBlocks/PlaceholderActionBlock.es.js";
29
+ import { getMakeTransferDrawerTitle as y } from "../actionBlocks/MakeTransferActionBlock/layout.es.js";
30
+ import { MakeTransferActionBlockLayer as v } from "../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js";
31
31
  import { getDrawerHeaderTitle as M } from "../actionBlocks/TransactionHistoryBlock/utils.es.js";
32
32
  import { TransactionDetailsBlock as w } from "../actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js";
33
- import { useTransactionDetailsPrepare as a } from "../actionBlocks/TransactionDetailsBlock/useTransactionDetailsPrepare.es.js";
33
+ import { useTransactionDetailsPrepare as n } from "../actionBlocks/TransactionDetailsBlock/useTransactionDetailsPrepare.es.js";
34
34
  import { TransactionHistoryBlock as U } from "../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js";
35
35
  import { useRecurringTransactionPrepare as c } from "../actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
36
- import { RecurringTransactionBlock as G } from "../actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js";
37
- import { TransactionListBlock as H } from "../actionBlocks/TransactionListBlock/TransactionListBlock.es.js";
38
- import { RemainingCashBlock as x } from "../actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js";
39
- import { AmountInputModalBlock as F } from "../actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js";
40
- var e = (t) => {
36
+ import { RecurringTransactionBlock as F } from "../actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js";
37
+ import { TransactionListBlock as G } from "../actionBlocks/TransactionListBlock/TransactionListBlock.es.js";
38
+ import { RemainingCashBlock as H } from "../actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js";
39
+ import { AmountInputModalBlock as x } from "../actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js";
40
+ import { PayoffCalculatorBlock as W, usePayoffCalculatorPrepare as Y } from "../actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js";
41
+ var a = (t) => {
41
42
  }, r = (t) => ({
42
43
  get Component() {
43
44
  return t().Component;
@@ -51,98 +52,103 @@ var e = (t) => {
51
52
  get presentation() {
52
53
  return t().presentation;
53
54
  }
54
- }), So = {
55
+ }), Eo = {
55
56
  [o.PLACEHOLDER_ACTION_BLOCK]: r(() => ({
56
- Component: K,
57
- usePrepare: e,
57
+ Component: E,
58
+ usePrepare: a,
58
59
  title: () => "Action Block Layer Drilldown"
59
60
  })),
60
61
  [o.MAKE_TRANSFER_ACTION_BLOCK]: r(() => ({
61
- Component: y,
62
- usePrepare: e,
63
- title: v
62
+ Component: v,
63
+ usePrepare: a,
64
+ title: y
64
65
  })),
65
66
  [o.TRANSCATION_HISTORY_ACTION_BLOCK]: r(() => ({
66
67
  Component: U,
67
- usePrepare: e,
68
+ usePrepare: a,
68
69
  title: M
69
70
  })),
70
71
  [o.TRANSACTION_DETAILS_ACTION_BLOCK]: r(() => ({
71
72
  Component: w,
72
- usePrepare: a,
73
+ usePrepare: n,
73
74
  title: () => "Transaction Details"
74
75
  })),
75
76
  [o.RECURRING_TRANSACTION_ACTION_BLOCK]: r(() => ({
76
- Component: G,
77
+ Component: F,
77
78
  usePrepare: c,
78
- title: (t, i) => i.recurring?.expense_details ?? ""
79
+ title: (t, e) => e.recurring?.expense_details ?? ""
79
80
  })),
80
81
  [o.REMAINING_CASH_ACTION_BLOCK]: r(() => ({
81
- Component: x,
82
+ Component: H,
82
83
  usePrepare: c,
83
- title: (t, i) => i.insights_feed?.remaining_cash?.title ?? ""
84
+ title: (t, e) => e.insights_feed?.remaining_cash?.title ?? ""
84
85
  })),
85
86
  [o.CONTACT_SUPPORT_ACTION_BLOCK]: r(() => ({
86
- Component: p,
87
- usePrepare: e,
88
- title: (t, i) => i.help?.request_support ?? ""
87
+ Component: m,
88
+ usePrepare: a,
89
+ title: (t, e) => e.help?.request_support ?? ""
89
90
  })),
90
91
  [o.FEEDBACK_MODAL_ACTION_BLOCK]: r(() => ({
91
92
  Component: h,
92
- usePrepare: e,
93
+ usePrepare: a,
93
94
  presentation: "modal"
94
95
  })),
95
96
  [o.CONNECTION_DETAIL_ACTION_BLOCK]: r(() => ({
96
97
  Component: S,
97
- usePrepare: e,
98
- title: (t, i) => i.insights_feed?.connection_details?.connection_details_drawer_title ?? ""
98
+ usePrepare: a,
99
+ title: (t, e) => e.insights_feed?.connection_details?.connection_details_drawer_title ?? ""
99
100
  })),
100
101
  [o.CONNECT_WIDGET_ACTION_BLOCK]: r(() => ({
101
102
  Component: R,
102
- usePrepare: e
103
+ usePrepare: a
103
104
  })),
104
105
  [o.SURVEY_MODAL_ACTION_BLOCK]: r(() => ({
105
- Component: E,
106
- usePrepare: e,
106
+ Component: K,
107
+ usePrepare: a,
107
108
  presentation: "modal"
108
109
  })),
109
110
  [o.TRANSACTION_LIST_ACTION_BLOCK]: r(() => ({
110
- Component: H,
111
- usePrepare: a,
112
- title: (t, i, m) => m?.insights_payload?.title ?? ""
111
+ Component: G,
112
+ usePrepare: n,
113
+ title: (t, e, l) => l?.insights_payload?.title ?? ""
113
114
  })),
114
115
  [o.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: r(() => ({
115
- Component: F,
116
+ Component: x,
116
117
  presentation: "modal",
117
- usePrepare: e
118
+ usePrepare: a
119
+ })),
120
+ [o.PAYOFF_CALCULATOR_ACTION_BLOCK]: r(() => ({
121
+ Component: W,
122
+ usePrepare: Y,
123
+ title: (t, e) => e.insights_feed?.payoff_calculator?.title ?? ""
118
124
  }))
119
- }, Ro = {
125
+ }, yo = {
120
126
  account_block: u,
121
- account_switch_block: T,
127
+ account_switch_block: f,
122
128
  direct_deposit_block: B,
123
- bar_chart_block: l,
129
+ bar_chart_block: p,
124
130
  budget_block: A,
125
- debts_block: f,
126
- donut_chart_block: k,
131
+ debts_block: T,
132
+ donut_chart_block: C,
127
133
  double_bar_chart_block: _,
128
- double_progress_bar_block: C,
134
+ double_progress_bar_block: k,
129
135
  goals_block: O,
130
- image_block: P,
136
+ image_block: L,
131
137
  no_spend_days_block: b,
132
- repeating_transaction_block: n,
138
+ repeating_transaction_block: i,
133
139
  save_extra_block: N,
134
140
  savings_opportunity_block: d,
135
141
  step_chart_block: s,
136
142
  svg_image_block: D,
137
- upcoming_bill_block: n,
143
+ upcoming_bill_block: i,
138
144
  upcoming_subscription_block: I,
139
- withdrawal_block: L,
145
+ withdrawal_block: P,
140
146
  transaction_block: g
141
147
  };
142
148
  export {
143
- So as actionBlocks,
144
- Ro as blocks,
145
- Y as hasDrawerBlock
149
+ Eo as actionBlocks,
150
+ yo as blocks,
151
+ j as hasDrawerBlock
146
152
  };
147
153
 
148
154
  //# sourceMappingURL=blocks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n AccountSwitchBlock,\n BarchartBlock,\n BudgetBlock,\n DebtsBlock,\n DetailedAccountBlock,\n DonutChartBlock,\n GoalsBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WithdrawalBlock,\n TransactionBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, GlobalCopy, InsightsPayload } from '../../core'\nimport { ContactSupportActionBlock } from '../actionBlocks/ContactSupportActionBlock'\nimport { FeedbackModalActionBlock } from '../actionBlocks/FeedbackModalActionBlock'\nimport { ConnectionDetailActionBlock } from '../actionBlocks/ConnectionDetailActionBlock'\nimport { ConnectWidgetActionBlock } from '../actionBlocks/ConnectWidgetActionBlock'\nimport { SurveyModalActionBlock } from '../actionBlocks/SurveyModalActionBlock'\nimport { PlaceholderActionBlock } from '../actionBlocks/PlaceholderActionBlock'\nimport { MakeTransferActionBlockLayer } from '../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer'\nimport { getMakeTransferDrawerTitle } from '../actionBlocks/MakeTransferActionBlock/layout'\nimport { TransactionHistoryBlock } from '../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock'\nimport { getDrawerHeaderTitle } from '../actionBlocks/TransactionHistoryBlock/utils'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\n// Keys live in ./actionBlocksKey (imported directly by chart blocks/tests too) to avoid a\n// circular import between this module and the chart blocks — see that file for details.\nimport { actionBlocksKey } from './actionBlocksKey'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\n\n// Re-exported so existing `hasDrawerBlock` imports from this module keep working.\nexport { hasDrawerBlock } from './hasDrawerBlock'\n\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n // Resolves the drawer title from the clicked CTA's variant + copy, with the beat available\n // for blocks that title from beat fields (e.g. transaction-list reads insights_payload.title).\n // Falls back to the CTA label when the resolver returns an empty string / is absent.\n title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string\n // 'drawer' (default) or 'modal' (component renders its own dialog, no Drawer wrapper).\n presentation?: 'drawer' | 'modal'\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends Add\n// `usePrepare` when the block needs to load data before rendering.\n\n/**\n * A registry entry whose fields read their imports when used, not when this module loads. Some\n * registered blocks render `TransactionDetails`, whose embedded card mounts `ActionBlockLayer`,\n * which imports this registry: when one of those blocks loads first, its own import is not\n * initialised yet while this module evaluates, so a value copied at load would be `undefined`\n * (or throw under native ES modules). Reading on access sees the finished import.\n */\nconst liveEntry = (resolve: () => ActionBlockEntry): ActionBlockEntry => ({\n get Component() {\n return resolve().Component\n },\n get usePrepare() {\n return resolve().usePrepare\n },\n get title() {\n return resolve().title\n },\n get presentation() {\n return resolve().presentation\n },\n})\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: liveEntry(() => ({\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n })),\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: liveEntry(() => ({\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: noop,\n title: getDrawerHeaderTitle,\n })),\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n })),\n // Expense Details for one recurring subscription. Which subscription a beat names is resolved in\n // `RecurringTransactionBlock/subscriptionBeats.ts`, not through this registry.\n [actionBlocksKey.RECURRING_TRANSACTION_ACTION_BLOCK]: liveEntry(() => ({\n Component: RecurringTransactionBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.recurring?.expense_details ?? '',\n })),\n // Remaining Cash for the Payday Cash Left Over Status beat. Store-driven: reuses the recurring\n // loader, which also loads accounts and categories, so CashflowStore's computeds are ready.\n [actionBlocksKey.REMAINING_CASH_ACTION_BLOCK]: liveEntry(() => ({\n Component: RemainingCashBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.insights_feed?.remaining_cash?.title ?? '',\n })),\n // The block renders its own drawer (the help module's RequestSupport) on top of the action\n // drawer, so the action drawer's title is the CTA label.\n [actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK]: liveEntry(() => ({\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n })),\n [actionBlocksKey.FEEDBACK_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: FeedbackModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.CONNECTION_DETAIL_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectionDetailActionBlock,\n usePrepare: noop,\n title: (_variant, copy) =>\n copy.insights_feed?.connection_details?.connection_details_drawer_title ?? '',\n })),\n // Boots MX's Connect widget (web-widget-sdk iframe) inside the action\n // drawer; the drawer title falls back to the CTA label.\n [actionBlocksKey.CONNECT_WIDGET_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectWidgetActionBlock,\n usePrepare: noop,\n })),\n [actionBlocksKey.SURVEY_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SurveyModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // One whole-dollar setting in a dialog; the CTA variant picks which (low-balance threshold or\n // safety net). A modal: no drawer, so no drawer title.\n [actionBlocksKey.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n // Loads inside the block: it mounts only while open, so mounting is the open-time load.\n usePrepare: noop,\n })),\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n direct_deposit_block: DetailedAccountBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n debts_block: DebtsBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n no_spend_days_block: NoSpendDaysBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_opportunity_block: SavingsOpportunityBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GA0BjC,IAAA,CAAa,OAAuD;AAAA,EACxE,IAAI,YAAY;AACd,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,aAAa;AACf,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,QAAQ;AACV,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,eAAe;AACjB,WAAO,EAAQ,EAAE;AAAA,EACnB;AACF,IAEa,KAAe;AAAA,EACzB,CAAA,EAAgB,wBAAA,GAA2B,EAAA,OAAiB;AAAA,IAC3D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,MAAa;AAAA,EACf,EAAE;AAAA,EACD,CAAA,EAAgB,0BAAA,GAA6B,EAAA,OAAiB;AAAA,IAC7D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAAA,EACT,EAAE;AAAA,EACD,CAAA,EAAgB,gCAAA,GAAmC,EAAA,OAAiB;AAAA,IACnE,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAA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WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,GAAO,MAAS,GAAM,kBAAkB,SAAS;AAAA,EACrE,EAAE;AAAA,EAGD,CAAA,EAAgB,+BAAA,GAAkC,EAAA,OAAiB;AAAA,IAClE,WAAW;AAAA,IACX,cAAc;AAAA,IAEd,YAAY;AAAA,EACd,EAAE;AACJ,GAEa,KAAS;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AACrB"}
1
+ {"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n AccountSwitchBlock,\n BarchartBlock,\n BudgetBlock,\n DebtsBlock,\n DetailedAccountBlock,\n DonutChartBlock,\n GoalsBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WithdrawalBlock,\n TransactionBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, GlobalCopy, InsightsPayload } from '../../core'\nimport { ContactSupportActionBlock } from '../actionBlocks/ContactSupportActionBlock'\nimport { FeedbackModalActionBlock } from '../actionBlocks/FeedbackModalActionBlock'\nimport { ConnectionDetailActionBlock } from '../actionBlocks/ConnectionDetailActionBlock'\nimport { ConnectWidgetActionBlock } from '../actionBlocks/ConnectWidgetActionBlock'\nimport { SurveyModalActionBlock } from '../actionBlocks/SurveyModalActionBlock'\nimport { PlaceholderActionBlock } from '../actionBlocks/PlaceholderActionBlock'\nimport { MakeTransferActionBlockLayer } from '../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer'\nimport { getMakeTransferDrawerTitle } from '../actionBlocks/MakeTransferActionBlock/layout'\nimport { TransactionHistoryBlock } from '../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock'\nimport { getDrawerHeaderTitle } from '../actionBlocks/TransactionHistoryBlock/utils'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\n// Keys live in ./actionBlocksKey (imported directly by chart blocks/tests too) to avoid a\n// circular import between this module and the chart blocks — see that file for details.\nimport { actionBlocksKey } from './actionBlocksKey'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\n\n// Re-exported so existing `hasDrawerBlock` imports from this module keep working.\nexport { hasDrawerBlock } from './hasDrawerBlock'\n\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n // Resolves the drawer title from the clicked CTA's variant + copy, with the beat available\n // for blocks that title from beat fields (e.g. transaction-list reads insights_payload.title).\n // Falls back to the CTA label when the resolver returns an empty string / is absent.\n title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string\n // 'drawer' (default) or 'modal' (component renders its own dialog, no Drawer wrapper).\n presentation?: 'drawer' | 'modal'\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends Add\n// `usePrepare` when the block needs to load data before rendering.\n\n/**\n * A registry entry whose fields read their imports when used, not when this module loads. Some\n * registered blocks render `TransactionDetails`, whose embedded card mounts `ActionBlockLayer`,\n * which imports this registry: when one of those blocks loads first, its own import is not\n * initialised yet while this module evaluates, so a value copied at load would be `undefined`\n * (or throw under native ES modules). Reading on access sees the finished import.\n */\nconst liveEntry = (resolve: () => ActionBlockEntry): ActionBlockEntry => ({\n get Component() {\n return resolve().Component\n },\n get usePrepare() {\n return resolve().usePrepare\n },\n get title() {\n return resolve().title\n },\n get presentation() {\n return resolve().presentation\n },\n})\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: liveEntry(() => ({\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n })),\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: liveEntry(() => ({\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: noop,\n title: getDrawerHeaderTitle,\n })),\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n })),\n // Expense Details for one recurring subscription. Which subscription a beat names is resolved in\n // `RecurringTransactionBlock/subscriptionBeats.ts`, not through this registry.\n [actionBlocksKey.RECURRING_TRANSACTION_ACTION_BLOCK]: liveEntry(() => ({\n Component: RecurringTransactionBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.recurring?.expense_details ?? '',\n })),\n // Remaining Cash for the Payday Cash Left Over Status beat. Store-driven: reuses the recurring\n // loader, which also loads accounts and categories, so CashflowStore's computeds are ready.\n [actionBlocksKey.REMAINING_CASH_ACTION_BLOCK]: liveEntry(() => ({\n Component: RemainingCashBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.insights_feed?.remaining_cash?.title ?? '',\n })),\n // The block renders its own drawer (the help module's RequestSupport) on top of the action\n // drawer, so the action drawer's title is the CTA label.\n [actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK]: liveEntry(() => ({\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n })),\n [actionBlocksKey.FEEDBACK_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: FeedbackModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.CONNECTION_DETAIL_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectionDetailActionBlock,\n usePrepare: noop,\n title: (_variant, copy) =>\n copy.insights_feed?.connection_details?.connection_details_drawer_title ?? '',\n })),\n // Boots MX's Connect widget (web-widget-sdk iframe) inside the action\n // drawer; the drawer title falls back to the CTA label.\n [actionBlocksKey.CONNECT_WIDGET_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectWidgetActionBlock,\n usePrepare: noop,\n })),\n [actionBlocksKey.SURVEY_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SurveyModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // One whole-dollar setting in a dialog; the CTA variant picks which (low-balance threshold or\n // safety net). A modal: no drawer, so no drawer title.\n [actionBlocksKey.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n // Loads inside the block: it mounts only while open, so mounting is the open-time load.\n usePrepare: noop,\n })),\n // Monthly Credit Card Interest Summary's \"Learn how to save\": the credit card payoff calculator.\n [actionBlocksKey.PAYOFF_CALCULATOR_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffCalculatorBlock,\n usePrepare: usePayoffCalculatorPrepare,\n title: (_variant, copy) => copy.insights_feed?.payoff_calculator?.title ?? '',\n })),\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n direct_deposit_block: DetailedAccountBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n debts_block: DebtsBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n no_spend_days_block: NoSpendDaysBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_opportunity_block: SavingsOpportunityBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GA0BjC,IAAA,CAAa,OAAuD;AAAA,EACxE,IAAI,YAAY;AACd,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,aAAa;AACf,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,QAAQ;AACV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BAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.29",
3
+ "version": "9.7.30",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",