@mx-cartographer/experiences 9.7.149 → 9.7.150
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 +3 -0
- package/dist/core/utils/NumberFormatting.d.ts +2 -0
- package/dist/core/utils/NumberFormatting.es.js +18 -17
- package/dist/core/utils/NumberFormatting.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +57 -57
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +24 -25
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +1 -0
- 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.150] - 11-13-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - `formatWholeCurrency` in core utils: whole-dollar currency that rounds first, so a small negative shows "" (WEC-2273)
|
|
4
|
+
- **CHANGED** - `MakeTransferCopy` requires `available_balance_text` and `avg_monthly_spend_text` (WEC-2273)
|
|
5
|
+
- **FIXED** - Save Enough to Live On and Save an Extra 00 drawers show a close button on the right, as in Figma (WEC-2273)
|
|
6
|
+
- **FIXED** - Save Enough to Live On and Save an Extra 00 drawers show whole-dollar amounts, and the months rows match the stepper amount shown (WEC-2273)
|
|
7
|
+
- **FIXED** - Save Enough to Live On card and drawer spacing match Figma: the card's table and c...
|
|
8
|
+
|
|
1
9
|
## [9.7.149] - 11-13-2026
|
|
2
10
|
|
|
3
11
|
- **FIXED** - `SVGImageBlock` keys the Upcoming Tax Deadline Alert illustration under `reminder` (was `remainder`), the variant ditto emits, so the card shows its own art instead of the savings illustration; this reverses the key named in 9.7.33 (WEC-2044, WEC-2067)
|
|
@@ -118,6 +118,9 @@ export interface MakeTransferCopy {
|
|
|
118
118
|
expenses_text: string;
|
|
119
119
|
available_balances_text: string;
|
|
120
120
|
average_monthly_spend_text: string;
|
|
121
|
+
/** Insights 2.0 table labels; V1 keeps the two above. */
|
|
122
|
+
available_balance_text: string;
|
|
123
|
+
avg_monthly_spend_text: string;
|
|
121
124
|
your_available_balances_text: string;
|
|
122
125
|
increment_aria_label: string;
|
|
123
126
|
decrement_aria_label: string;
|
|
@@ -9,6 +9,8 @@ export declare const CURRENCY_FORMAT: {
|
|
|
9
9
|
};
|
|
10
10
|
export type CurrencyFormat = (typeof CURRENCY_FORMAT)[keyof typeof CURRENCY_FORMAT];
|
|
11
11
|
export declare const formatCurrency: (amount: number | undefined, formatting: string, roundingFunction?: RoundingFunction) => string;
|
|
12
|
+
/** Whole dollars, rounded first so a small negative shows "$0", not numeral's "0$". */
|
|
13
|
+
export declare const formatWholeCurrency: (amount: number | undefined) => string;
|
|
12
14
|
export declare const getCurrencyCodes: () => CurrencyCodes;
|
|
13
15
|
export declare const isValidNumber: (value: any) => boolean;
|
|
14
16
|
export declare const formatPercentage: (amount: number | string | undefined, options?: Intl.NumberFormatOptions) => string | number | undefined;
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { getLocale as a } from "./Localization.es.js";
|
|
2
|
-
import { CurrencyCodes as
|
|
3
|
-
import
|
|
2
|
+
import { CurrencyCodes as c } from "../constants/Numbers.es.js";
|
|
3
|
+
import s from "numeral";
|
|
4
4
|
var w = (r, e, t) => {
|
|
5
|
-
const n = [],
|
|
5
|
+
const n = [], d = (e - r) / (t - 1);
|
|
6
6
|
for (let o = 0; o < t; o++) {
|
|
7
|
-
const
|
|
8
|
-
n.push(
|
|
7
|
+
const m = r + o * d;
|
|
8
|
+
n.push(m);
|
|
9
9
|
}
|
|
10
10
|
return n[t - 1] = e, n.map(Math.round);
|
|
11
|
-
}, y = (r) => r.length ? Math.round(r.reduce((e, t) => e + t, 0) / r.length) : 0,
|
|
11
|
+
}, y = (r) => r.length ? Math.round(r.reduce((e, t) => e + t, 0) / r.length) : 0, l = {
|
|
12
12
|
cents: "0,0.00",
|
|
13
13
|
whole: "0,0"
|
|
14
|
-
},
|
|
14
|
+
}, i = (r, e, t) => a() === "fr-ca" ? s(r).format(`${e} $`, t) : s(r).format(`$${e}`, t), C = (r) => i(Math.round(r ?? 0), l.whole), $ = () => a() === "fr-ca" ? c.CAD : c.USD, u = (r) => r != null && r !== "" && isFinite(r), f = {
|
|
15
15
|
style: "percent",
|
|
16
16
|
minimumFractionDigits: 2,
|
|
17
17
|
maximumFractionDigits: 2
|
|
18
|
-
},
|
|
18
|
+
}, M = (r, e = f) => u(r) ? new Intl.NumberFormat(a(), e).format(Number(r)) : r, h = (r) => new Intl.PluralRules(a(), r), R = (r, e = { type: "ordinal" }, t = {
|
|
19
19
|
one: "st",
|
|
20
20
|
two: "nd",
|
|
21
21
|
few: "rd",
|
|
22
22
|
other: "th"
|
|
23
|
-
}) => `${r}${t[h(e).select(r)]}`,
|
|
24
|
-
const e = Math.round(Math.abs(r) * 100), t =
|
|
23
|
+
}) => `${r}${t[h(e).select(r)]}`, D = (r) => {
|
|
24
|
+
const e = Math.round(Math.abs(r) * 100), t = i(e / 100, l.cents);
|
|
25
25
|
return r < 0 && e > 0 ? `-${t}` : t;
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
l as CURRENCY_FORMAT,
|
|
29
|
+
i as formatCurrency,
|
|
30
|
+
R as formatOrdinal,
|
|
31
|
+
M as formatPercentage,
|
|
32
|
+
D as formatSignedCurrency,
|
|
33
|
+
C as formatWholeCurrency,
|
|
33
34
|
w as generateEqualIntervals,
|
|
34
|
-
|
|
35
|
+
$ as getCurrencyCodes,
|
|
35
36
|
h as getPluralRules,
|
|
36
|
-
|
|
37
|
+
u as isValidNumber,
|
|
37
38
|
y as roundedAverage
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberFormatting.es.js","names":[],"sources":["../../../src/core/utils/NumberFormatting.ts"],"sourcesContent":["import numeral from 'numeral'\nimport type { RoundingFunction } from 'numeral'\n\nimport { CurrencyCodes } from '../constants/Numbers'\nimport { getLocale } from './Localization'\n\nexport const generateEqualIntervals = (\n minValue: number,\n maxValue: number,\n tickCount: number,\n): number[] => {\n const ticks: number[] = []\n const range = maxValue - minValue\n const step = range / (tickCount - 1) // The space between each tick\n\n for (let i = 0; i < tickCount; i++) {\n const tickValue = minValue + i * step\n ticks.push(tickValue)\n }\n\n ticks[tickCount - 1] = maxValue\n\n return ticks.map(Math.round)\n}\n\nexport const roundedAverage = (values: number[]) =>\n values.length ? Math.round(values.reduce((sum, value) => sum + value, 0) / values.length) : 0\n\n/** The shared currency formats: with cents, and whole dollars. */\nexport const CURRENCY_FORMAT = { cents: '0,0.00', whole: '0,0' } as const\nexport type CurrencyFormat = (typeof CURRENCY_FORMAT)[keyof typeof CURRENCY_FORMAT]\n\n// enhances numeral's localization functionality by puting the $ in the correct place\nexport const formatCurrency = (\n amount: number | undefined,\n formatting: string,\n roundingFunction?: RoundingFunction,\n) => {\n switch (getLocale()) {\n case 'fr-ca': {\n return numeral(amount).format(`${formatting} $`, roundingFunction)\n }\n default: {\n return numeral(amount).format(`$${formatting}`, roundingFunction)\n }\n }\n}\n\nexport const getCurrencyCodes = () => {\n switch (getLocale()) {\n case 'fr-ca':\n return CurrencyCodes.CAD\n default:\n return CurrencyCodes.USD\n }\n}\n\n// will return `true` if value is a string number, like '99', which matches Serenity logic\nexport const isValidNumber = (value: any) =>\n value !== undefined && value !== null && value !== '' && isFinite(value)\n\nconst defaultPercentStyle = {\n style: 'percent',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n} as Intl.NumberFormatOptions\n\nexport const formatPercentage = (\n amount: number | string | undefined,\n options: Intl.NumberFormatOptions = defaultPercentStyle,\n) =>\n isValidNumber(amount)\n ? new Intl.NumberFormat(getLocale(), options).format(Number(amount))\n : amount\n\nexport const getPluralRules = (options: Intl.PluralRulesOptions) =>\n new Intl.PluralRules(getLocale(), options)\n\nexport const formatOrdinal = (\n number: number,\n options: Intl.PluralRulesOptions = { type: 'ordinal' },\n copy = {\n one: 'st',\n two: 'nd',\n few: 'rd',\n other: 'th',\n } as const,\n) => {\n const rule = getPluralRules(options).select(number)\n\n return `${number}${copy[rule as keyof typeof copy]}`\n}\n\n/**\n * `-$220.00`, not `$-220.00`: the sign goes before the currency symbol. Rounded to cents first so a\n * sub-cent negative (or `-0`) reads `$0.00`, never `-$0.00`.\n */\nexport const formatSignedCurrency = (amount: number): string => {\n const cents = Math.round(Math.abs(amount) * 100)\n const formatted = formatCurrency(cents / 100, CURRENCY_FORMAT.cents)\n\n return amount < 0 && cents > 0 ? `-${formatted}` : formatted\n}\n"],"mappings":";;;AAMA,IAAa,IAAA,CACX,GACA,GACA,MACa;AACb,QAAM,IAAkB,CAAC,GAEnB,KADQ,IAAW,MACH,IAAY;AAElC,WAAS,IAAI,GAAG,IAAI,GAAW,KAAK;AAClC,UAAM,IAAY,IAAW,IAAI;AACjC,IAAA,EAAM,KAAK,CAAS;AAAA,EACtB;AAEA,SAAA,EAAM,IAAY,CAAA,IAAK,GAEhB,EAAM,IAAI,KAAK,KAAK;AAC7B,GAEa,IAAA,CAAkB,MAC7B,EAAO,SAAS,KAAK,MAAM,EAAO,OAAA,CAAQ,GAAK,MAAU,IAAM,GAAO,CAAC,IAAI,EAAO,MAAM,IAAI,GAGjF,IAAkB;AAAA,EAAE,OAAO;AAAA,EAAU,OAAO;AAAM,GAIlD,IAAA,CACX,GACA,GACA,MAEQ,EAAU,MACX,UACI,EAAQ,CAAM,EAAE,OAAO,GAAG,CAAA,MAAgB,CAAgB,IAG1D,EAAQ,CAAM,EAAE,OAAO,IAAI,CAAA,IAAc,CAAgB,
|
|
1
|
+
{"version":3,"file":"NumberFormatting.es.js","names":[],"sources":["../../../src/core/utils/NumberFormatting.ts"],"sourcesContent":["import numeral from 'numeral'\nimport type { RoundingFunction } from 'numeral'\n\nimport { CurrencyCodes } from '../constants/Numbers'\nimport { getLocale } from './Localization'\n\nexport const generateEqualIntervals = (\n minValue: number,\n maxValue: number,\n tickCount: number,\n): number[] => {\n const ticks: number[] = []\n const range = maxValue - minValue\n const step = range / (tickCount - 1) // The space between each tick\n\n for (let i = 0; i < tickCount; i++) {\n const tickValue = minValue + i * step\n ticks.push(tickValue)\n }\n\n ticks[tickCount - 1] = maxValue\n\n return ticks.map(Math.round)\n}\n\nexport const roundedAverage = (values: number[]) =>\n values.length ? Math.round(values.reduce((sum, value) => sum + value, 0) / values.length) : 0\n\n/** The shared currency formats: with cents, and whole dollars. */\nexport const CURRENCY_FORMAT = { cents: '0,0.00', whole: '0,0' } as const\nexport type CurrencyFormat = (typeof CURRENCY_FORMAT)[keyof typeof CURRENCY_FORMAT]\n\n// enhances numeral's localization functionality by puting the $ in the correct place\nexport const formatCurrency = (\n amount: number | undefined,\n formatting: string,\n roundingFunction?: RoundingFunction,\n) => {\n switch (getLocale()) {\n case 'fr-ca': {\n return numeral(amount).format(`${formatting} $`, roundingFunction)\n }\n default: {\n return numeral(amount).format(`$${formatting}`, roundingFunction)\n }\n }\n}\n\n/** Whole dollars, rounded first so a small negative shows \"$0\", not numeral's \"0$\". */\nexport const formatWholeCurrency = (amount: number | undefined) =>\n formatCurrency(Math.round(amount ?? 0), CURRENCY_FORMAT.whole)\n\nexport const getCurrencyCodes = () => {\n switch (getLocale()) {\n case 'fr-ca':\n return CurrencyCodes.CAD\n default:\n return CurrencyCodes.USD\n }\n}\n\n// will return `true` if value is a string number, like '99', which matches Serenity logic\nexport const isValidNumber = (value: any) =>\n value !== undefined && value !== null && value !== '' && isFinite(value)\n\nconst defaultPercentStyle = {\n style: 'percent',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n} as Intl.NumberFormatOptions\n\nexport const formatPercentage = (\n amount: number | string | undefined,\n options: Intl.NumberFormatOptions = defaultPercentStyle,\n) =>\n isValidNumber(amount)\n ? new Intl.NumberFormat(getLocale(), options).format(Number(amount))\n : amount\n\nexport const getPluralRules = (options: Intl.PluralRulesOptions) =>\n new Intl.PluralRules(getLocale(), options)\n\nexport const formatOrdinal = (\n number: number,\n options: Intl.PluralRulesOptions = { type: 'ordinal' },\n copy = {\n one: 'st',\n two: 'nd',\n few: 'rd',\n other: 'th',\n } as const,\n) => {\n const rule = getPluralRules(options).select(number)\n\n return `${number}${copy[rule as keyof typeof copy]}`\n}\n\n/**\n * `-$220.00`, not `$-220.00`: the sign goes before the currency symbol. Rounded to cents first so a\n * sub-cent negative (or `-0`) reads `$0.00`, never `-$0.00`.\n */\nexport const formatSignedCurrency = (amount: number): string => {\n const cents = Math.round(Math.abs(amount) * 100)\n const formatted = formatCurrency(cents / 100, CURRENCY_FORMAT.cents)\n\n return amount < 0 && cents > 0 ? `-${formatted}` : formatted\n}\n"],"mappings":";;;AAMA,IAAa,IAAA,CACX,GACA,GACA,MACa;AACb,QAAM,IAAkB,CAAC,GAEnB,KADQ,IAAW,MACH,IAAY;AAElC,WAAS,IAAI,GAAG,IAAI,GAAW,KAAK;AAClC,UAAM,IAAY,IAAW,IAAI;AACjC,IAAA,EAAM,KAAK,CAAS;AAAA,EACtB;AAEA,SAAA,EAAM,IAAY,CAAA,IAAK,GAEhB,EAAM,IAAI,KAAK,KAAK;AAC7B,GAEa,IAAA,CAAkB,MAC7B,EAAO,SAAS,KAAK,MAAM,EAAO,OAAA,CAAQ,GAAK,MAAU,IAAM,GAAO,CAAC,IAAI,EAAO,MAAM,IAAI,GAGjF,IAAkB;AAAA,EAAE,OAAO;AAAA,EAAU,OAAO;AAAM,GAIlD,IAAA,CACX,GACA,GACA,MAEQ,EAAU,MACX,UACI,EAAQ,CAAM,EAAE,OAAO,GAAG,CAAA,MAAgB,CAAgB,IAG1D,EAAQ,CAAM,EAAE,OAAO,IAAI,CAAA,IAAc,CAAgB,GAMzD,IAAA,CAAuB,MAClC,EAAe,KAAK,MAAM,KAAU,CAAC,GAAG,EAAgB,KAAK,GAElD,IAAA,MACH,EAAU,MACX,UACI,EAAc,MAEd,EAAc,KAKd,IAAA,CAAiB,MACL,KAAU,QAAQ,MAAU,MAAM,SAAS,CAAK,GAEnE,IAAsB;AAAA,EAC1B,OAAO;AAAA,EACP,uBAAuB;AAAA,EACvB,uBAAuB;AACzB,GAEa,IAAA,CACX,GACA,IAAoC,MAEpC,EAAc,CAAM,IAChB,IAAI,KAAK,aAAa,EAAU,GAAG,CAAO,EAAE,OAAO,OAAO,CAAM,CAAC,IACjE,GAEO,IAAA,CAAkB,MAC7B,IAAI,KAAK,YAAY,EAAU,GAAG,CAAO,GAE9B,IAAA,CACX,GACA,IAAmC,EAAE,MAAM,UAAU,GACrD,IAAO;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,OAAO;AACT,MAIO,GAAG,CAAA,GAAS,EAFN,EAAe,CAAO,EAAE,OAAO,CAEpB,CAAA,CAAA,IAOb,IAAA,CAAwB,MAA2B;AAC9D,QAAM,IAAQ,KAAK,MAAM,KAAK,IAAI,CAAM,IAAI,GAAG,GACzC,IAAY,EAAe,IAAQ,KAAK,EAAgB,KAAK;AAEnE,SAAO,IAAS,KAAK,IAAQ,IAAI,IAAI,CAAA,KAAc;AACrD"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import {
|
|
3
|
-
import { BalanceStepper as
|
|
1
|
+
import { buildDynamicCopy as w } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { formatWholeCurrency as d } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { BalanceStepper as C } from "./BalanceStepper.es.js";
|
|
4
4
|
import I from "./SaveEnoughToLiveOnBottomSection.es.js";
|
|
5
|
-
import { PROJECTIONS as S, toNumber as
|
|
5
|
+
import { PROJECTIONS as S, toNumber as b, variants as A } from "./layout.es.js";
|
|
6
6
|
import f from "react";
|
|
7
7
|
import { Text as i } from "@mxenabled/mxui";
|
|
8
|
-
import { Icon as
|
|
8
|
+
import { Icon as W } from "@mxenabled/mx-icons";
|
|
9
9
|
import { Fragment as _, jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
10
|
-
import { Card as
|
|
11
|
-
var
|
|
10
|
+
import { Card as j, Divider as E, List as k, ListItem as L, Stack as a } from "@mui/material";
|
|
11
|
+
var O = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
12
12
|
sx: {
|
|
13
13
|
bgcolor: "background.paper",
|
|
14
14
|
p: 24,
|
|
@@ -27,12 +27,12 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
27
27
|
children: o.description
|
|
28
28
|
})]
|
|
29
29
|
})]
|
|
30
|
-
}),
|
|
30
|
+
}), R = ({ availableBalances: o, expenses: t, totalRemaining: n, copy: l }) => /* @__PURE__ */ e(a, {
|
|
31
31
|
sx: {
|
|
32
32
|
pt: 24,
|
|
33
33
|
px: 24
|
|
34
34
|
},
|
|
35
|
-
children: /* @__PURE__ */ r(
|
|
35
|
+
children: /* @__PURE__ */ r(j, {
|
|
36
36
|
sx: {
|
|
37
37
|
px: 16,
|
|
38
38
|
pt: 16,
|
|
@@ -59,14 +59,14 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
59
59
|
children: [/* @__PURE__ */ e(i, {
|
|
60
60
|
sx: { fontWeight: 600 },
|
|
61
61
|
variant: "body1",
|
|
62
|
-
children:
|
|
62
|
+
children: d(o)
|
|
63
63
|
}), /* @__PURE__ */ e(i, {
|
|
64
64
|
sx: { color: "text.secondary" },
|
|
65
65
|
variant: "caption",
|
|
66
|
-
children:
|
|
66
|
+
children: l.available_text
|
|
67
67
|
})]
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */ e(
|
|
69
|
+
/* @__PURE__ */ e(W, {
|
|
70
70
|
name: "remove",
|
|
71
71
|
size: 20
|
|
72
72
|
}),
|
|
@@ -78,11 +78,11 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
78
78
|
children: [/* @__PURE__ */ e(i, {
|
|
79
79
|
sx: { fontWeight: 600 },
|
|
80
80
|
variant: "body1",
|
|
81
|
-
children:
|
|
81
|
+
children: d(t)
|
|
82
82
|
}), /* @__PURE__ */ e(i, {
|
|
83
83
|
sx: { color: "text.secondary" },
|
|
84
84
|
variant: "caption",
|
|
85
|
-
children:
|
|
85
|
+
children: l.expenses_text
|
|
86
86
|
})]
|
|
87
87
|
})
|
|
88
88
|
]
|
|
@@ -97,15 +97,15 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
97
97
|
children: [/* @__PURE__ */ r(i, {
|
|
98
98
|
sx: { color: "text.secondary" },
|
|
99
99
|
variant: "body2",
|
|
100
|
-
children: [
|
|
100
|
+
children: [l.total_remaining_text, ":"]
|
|
101
101
|
}), /* @__PURE__ */ e(i, {
|
|
102
102
|
sx: { fontWeight: 600 },
|
|
103
103
|
variant: "body2",
|
|
104
|
-
children:
|
|
104
|
+
children: d(n)
|
|
105
105
|
})]
|
|
106
106
|
})]
|
|
107
107
|
})
|
|
108
|
-
}),
|
|
108
|
+
}), T = ({ availableBalances: o, date: t, copy: n }) => /* @__PURE__ */ r(a, {
|
|
109
109
|
sx: {
|
|
110
110
|
px: 24,
|
|
111
111
|
py: 14,
|
|
@@ -115,7 +115,7 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
115
115
|
children: [/* @__PURE__ */ e(i, {
|
|
116
116
|
truncate: !1,
|
|
117
117
|
variant: "h3",
|
|
118
|
-
children:
|
|
118
|
+
children: d(o)
|
|
119
119
|
}), t && /* @__PURE__ */ e(i, {
|
|
120
120
|
sx: {
|
|
121
121
|
color: "text.secondary",
|
|
@@ -123,14 +123,14 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
123
123
|
},
|
|
124
124
|
truncate: !1,
|
|
125
125
|
variant: "subtitle2",
|
|
126
|
-
children:
|
|
126
|
+
children: w(n.your_available_balances_text, t)
|
|
127
127
|
})]
|
|
128
|
-
}), B = ({ bodyContent: o, bodyDescription: t, monthsTable: n, deltaAmount:
|
|
129
|
-
const [
|
|
128
|
+
}), B = ({ bodyContent: o, bodyDescription: t, monthsTable: n, deltaAmount: l, initialAmount: c, seedAmount: s, copy: m }) => {
|
|
129
|
+
const h = s == null ? void 0 : Math.round(s), [p, x] = f.useState(c ?? h ?? 0);
|
|
130
130
|
f.useEffect(() => {
|
|
131
|
-
|
|
132
|
-
}, [
|
|
133
|
-
const
|
|
131
|
+
c == null && h != null && x(h);
|
|
132
|
+
}, [c, h]);
|
|
133
|
+
const u = n.length - 1;
|
|
134
134
|
return /* @__PURE__ */ r(_, { children: [/* @__PURE__ */ r(a, {
|
|
135
135
|
sx: {
|
|
136
136
|
p: 24,
|
|
@@ -141,11 +141,11 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
141
141
|
truncate: !1,
|
|
142
142
|
variant: "body1",
|
|
143
143
|
children: o
|
|
144
|
-
}), /* @__PURE__ */ e(
|
|
145
|
-
amount:
|
|
144
|
+
}), /* @__PURE__ */ e(C, {
|
|
145
|
+
amount: d(p),
|
|
146
146
|
copy: m,
|
|
147
|
-
onDecrement: () =>
|
|
148
|
-
onIncrement: () =>
|
|
147
|
+
onDecrement: () => x((g) => Math.max(0, g - l)),
|
|
148
|
+
onIncrement: () => x((g) => g + l)
|
|
149
149
|
})]
|
|
150
150
|
}), /* @__PURE__ */ r(a, {
|
|
151
151
|
sx: { gap: 8 },
|
|
@@ -157,16 +157,16 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
157
157
|
truncate: !1,
|
|
158
158
|
variant: "body1",
|
|
159
159
|
children: t
|
|
160
|
-
}), /* @__PURE__ */ e(
|
|
160
|
+
}), /* @__PURE__ */ e(k, {
|
|
161
161
|
sx: {
|
|
162
162
|
bgcolor: "background.paper",
|
|
163
163
|
width: "100%"
|
|
164
164
|
},
|
|
165
|
-
children: n.map(({ label:
|
|
165
|
+
children: n.map(({ label: g, value: v }, y) => /* @__PURE__ */ r(f.Fragment, { children: [/* @__PURE__ */ e(L, {
|
|
166
166
|
disableGutters: !0,
|
|
167
167
|
disablePadding: !0,
|
|
168
168
|
sx: {
|
|
169
|
-
minHeight:
|
|
169
|
+
minHeight: 51,
|
|
170
170
|
bgcolor: "background.paper"
|
|
171
171
|
},
|
|
172
172
|
children: /* @__PURE__ */ e(a, {
|
|
@@ -183,62 +183,62 @@ var W = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
|
|
|
183
183
|
children: [/* @__PURE__ */ e(i, {
|
|
184
184
|
truncate: !1,
|
|
185
185
|
variant: "body1",
|
|
186
|
-
children:
|
|
186
|
+
children: g
|
|
187
187
|
}), /* @__PURE__ */ e(i, {
|
|
188
188
|
sx: { fontWeight: 600 },
|
|
189
189
|
truncate: !1,
|
|
190
190
|
variant: "body1",
|
|
191
|
-
children:
|
|
191
|
+
children: d(v * p)
|
|
192
192
|
})]
|
|
193
193
|
})
|
|
194
194
|
})
|
|
195
|
-
}), /* @__PURE__ */ e(
|
|
195
|
+
}), /* @__PURE__ */ e(E, {
|
|
196
196
|
component: "li",
|
|
197
|
-
sx: { ml: y ===
|
|
197
|
+
sx: { ml: y === u ? 0 : 24 }
|
|
198
198
|
})] }, v))
|
|
199
199
|
})]
|
|
200
200
|
})] });
|
|
201
|
-
},
|
|
202
|
-
const
|
|
201
|
+
}, z = ({ variant: o, slotData: t, copy: n }) => {
|
|
202
|
+
const l = o === A.SAVE_ENOUGH_TO_LIVE_ON, c = S[o], s = t?.available_balance, m = b(t?.avg_monthly_spend), h = b(t?.upcoming_expenses), p = b(t?.total_remaining), x = t?.time_period, u = t?.date;
|
|
203
203
|
return /* @__PURE__ */ r(_, { children: [
|
|
204
|
-
/* @__PURE__ */ e(
|
|
204
|
+
/* @__PURE__ */ e(O, {
|
|
205
205
|
copy: n,
|
|
206
|
-
leading:
|
|
207
|
-
content:
|
|
208
|
-
leftLabel: n.
|
|
209
|
-
leftValue:
|
|
210
|
-
rightLabel: n.
|
|
211
|
-
rightValue:
|
|
206
|
+
leading: l && s != null && m != null && x ? /* @__PURE__ */ e(I, {
|
|
207
|
+
content: x,
|
|
208
|
+
leftLabel: n.available_balance_text,
|
|
209
|
+
leftValue: d(s),
|
|
210
|
+
rightLabel: n.avg_monthly_spend_text,
|
|
211
|
+
rightValue: d(m),
|
|
212
212
|
sx: {
|
|
213
213
|
width: "100%",
|
|
214
214
|
mb: 24
|
|
215
215
|
}
|
|
216
216
|
}) : null
|
|
217
217
|
}),
|
|
218
|
-
!
|
|
219
|
-
availableBalances:
|
|
218
|
+
!l && s != null && h != null && /* @__PURE__ */ e(R, {
|
|
219
|
+
availableBalances: s,
|
|
220
220
|
copy: n,
|
|
221
|
-
expenses:
|
|
221
|
+
expenses: h,
|
|
222
222
|
totalRemaining: p
|
|
223
223
|
}),
|
|
224
224
|
/* @__PURE__ */ e(B, {
|
|
225
|
-
bodyContent: n[
|
|
226
|
-
bodyDescription: n[
|
|
225
|
+
bodyContent: n[c.contentKey],
|
|
226
|
+
bodyDescription: n[c.descriptionKey],
|
|
227
227
|
copy: n,
|
|
228
|
-
deltaAmount:
|
|
229
|
-
initialAmount:
|
|
230
|
-
monthsTable:
|
|
231
|
-
seedAmount:
|
|
228
|
+
deltaAmount: c.deltaAmount,
|
|
229
|
+
initialAmount: c.initialAmount,
|
|
230
|
+
monthsTable: c.months,
|
|
231
|
+
seedAmount: c.initialAmount == null ? m : void 0
|
|
232
232
|
}),
|
|
233
|
-
|
|
234
|
-
availableBalances:
|
|
233
|
+
l && s != null && /* @__PURE__ */ e(T, {
|
|
234
|
+
availableBalances: s,
|
|
235
235
|
copy: n,
|
|
236
|
-
date:
|
|
236
|
+
date: u
|
|
237
237
|
})
|
|
238
238
|
] });
|
|
239
239
|
};
|
|
240
240
|
export {
|
|
241
|
-
|
|
241
|
+
z as MakeTransferActionBlock
|
|
242
242
|
};
|
|
243
243
|
|
|
244
244
|
//# sourceMappingURL=MakeTransferActionBlock.es.js.map
|
package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MakeTransferActionBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.tsx"],"sourcesContent":["import React, { type ReactNode } from 'react'\nimport { Card, Divider, List, ListItem, Stack } from '@mui/material'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, type MakeTransferCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { BalanceStepper } from './BalanceStepper'\nimport SaveEnoughToLiveOnBottomSection from './SaveEnoughToLiveOnBottomSection'\nimport {\n PROJECTIONS,\n toNumber,\n variants,\n type MakeTransferVariant,\n type MakeTransferVariantProps,\n type MonthRow,\n} from './layout'\n\n// ============================================================================\n// Section building blocks (block-local)\n// ============================================================================\n\n/** Bordered title + description, with an optional `leading` slot. */\nconst Header = ({ copy, leading }: { copy: MakeTransferCopy; leading?: ReactNode }) => (\n <Stack\n sx={{ bgcolor: 'background.paper', p: 24, borderBottom: '1px solid', borderColor: 'divider' }}\n >\n {leading}\n <Stack sx={{ gap: 8 }}>\n <Text variant=\"h3\">{copy.header_content}</Text>\n <Text sx={{ lineHeight: '24px' }} truncate={false} variant=\"body1\">\n {copy.description}\n </Text>\n </Stack>\n </Stack>\n)\n\n/** Save-extra only: available − expenses = total remaining. */\nconst RemainingCard = ({\n availableBalances,\n expenses,\n totalRemaining,\n copy,\n}: {\n availableBalances: number\n expenses: number\n totalRemaining?: number\n copy: MakeTransferCopy\n}) => (\n <Stack sx={{ pt: 24, px: 24 }}>\n <Card sx={{ px: 16, pt: 16, pb: 12 }}>\n <Stack\n sx={{\n border: 1,\n borderColor: 'divider',\n borderRadius: '4px',\n gap: 12,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n p: 8,\n mb: 12,\n }}\n >\n <Stack sx={{ width: 155, textAlign: 'center' }}>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {formatCurrency(availableBalances, CURRENCY_FORMAT.cents)}\n </Text>\n <Text sx={{ color: 'text.secondary' }} variant=\"caption\">\n {copy.available_text}\n </Text>\n </Stack>\n <Icon name=\"remove\" size={20} />\n <Stack sx={{ width: 155, textAlign: 'center' }}>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {formatCurrency(expenses, CURRENCY_FORMAT.cents)}\n </Text>\n <Text sx={{ color: 'text.secondary' }} variant=\"caption\">\n {copy.expenses_text}\n </Text>\n </Stack>\n </Stack>\n <Stack\n sx={{\n textAlign: 'center',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 4,\n }}\n >\n <Text sx={{ color: 'text.secondary' }} variant=\"body2\">\n {copy.total_remaining_text}:\n </Text>\n <Text sx={{ fontWeight: 600 }} variant=\"body2\">\n {formatCurrency(totalRemaining, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Card>\n </Stack>\n)\n\n/** Save-enough only: total available balances as of a date. */\nconst TotalsFooter = ({\n availableBalances,\n date,\n copy,\n}: {\n availableBalances: number\n date?: string\n copy: MakeTransferCopy\n}) => (\n <Stack sx={{ px: 24, py: 14, textAlign: 'right', gap: 4 }}>\n <Text truncate={false} variant=\"h3\">\n {formatCurrency(availableBalances, CURRENCY_FORMAT.cents)}\n </Text>\n {date && (\n <Text sx={{ color: 'text.secondary', fontWeight: 400 }} truncate={false} variant=\"subtitle2\">\n {buildDynamicCopy(copy.your_available_balances_text, date) as string}\n </Text>\n )}\n </Stack>\n)\n\n/** Stepper + projected-savings table. Owns the amount state so both stay in sync. */\nconst SavingsProjection = ({\n bodyContent,\n bodyDescription,\n monthsTable,\n deltaAmount,\n initialAmount,\n seedAmount,\n copy,\n}: {\n bodyContent: string\n bodyDescription: string\n monthsTable: readonly MonthRow[]\n deltaAmount: number\n /** Fixed starting amount; when null, seeds from `seedAmount` once it resolves. */\n initialAmount: number | null\n seedAmount?: number\n copy: MakeTransferCopy\n}) => {\n const [amount, setAmount] = React.useState(initialAmount ?? seedAmount ?? 0)\n\n React.useEffect(() => {\n if (initialAmount == null && seedAmount != null) {\n setAmount(seedAmount)\n }\n }, [initialAmount, seedAmount])\n\n const lastRowIndex = monthsTable.length - 1\n\n return (\n <>\n <Stack sx={{ p: 24, gap: 8 }}>\n <Text sx={{ fontWeight: 600 }} truncate={false} variant=\"body1\">\n {bodyContent}\n </Text>\n <BalanceStepper\n amount={formatCurrency(amount, CURRENCY_FORMAT.cents)}\n copy={copy}\n onDecrement={() => setAmount((prev) => Math.max(0, prev - deltaAmount))}\n onIncrement={() => setAmount((prev) => prev + deltaAmount)}\n />\n </Stack>\n <Stack sx={{ gap: 8 }}>\n <Text sx={{ fontWeight: 600, mx: 24 }} truncate={false} variant=\"body1\">\n {bodyDescription}\n </Text>\n <List sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {monthsTable.map(({ label, value }, index) => (\n <React.Fragment key={value}>\n <ListItem\n disableGutters={true}\n disablePadding={true}\n sx={{ minHeight: 52, bgcolor: 'background.paper' }}\n >\n <Stack sx={{ width: '100%' }}>\n <Stack\n sx={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n width: '100%',\n px: 24,\n py: 8,\n }}\n >\n <Text truncate={false} variant=\"body1\">\n {label}\n </Text>\n <Text sx={{ fontWeight: 600 }} truncate={false} variant=\"body1\">\n {formatCurrency(value * amount, CURRENCY_FORMAT.whole)}\n </Text>\n </Stack>\n </Stack>\n </ListItem>\n <Divider component=\"li\" sx={{ ml: index === lastRowIndex ? 0 : 24 }} />\n </React.Fragment>\n ))}\n </List>\n </Stack>\n </>\n )\n}\n\n// ============================================================================\n// Block — both variants share the header and the stepper/table (settings from\n// PROJECTIONS in layout.ts); only the sections around them differ.\n// ============================================================================\n\nexport const MakeTransferActionBlock = ({\n variant,\n slotData,\n copy,\n}: MakeTransferVariantProps & { variant: MakeTransferVariant }) => {\n const isSaveEnough = variant === variants.SAVE_ENOUGH_TO_LIVE_ON\n const projection = PROJECTIONS[variant]\n\n const availableBalances = slotData?.available_balance\n const averageMonthlySpend = toNumber(slotData?.avg_monthly_spend)\n const expenses = toNumber(slotData?.upcoming_expenses)\n const totalRemaining = toNumber(slotData?.total_remaining)\n const svgDateContent = slotData?.time_period\n const date = slotData?.date\n\n return (\n <>\n <Header\n copy={copy}\n leading={\n isSaveEnough &&\n availableBalances != null &&\n averageMonthlySpend != null &&\n svgDateContent ? (\n <SaveEnoughToLiveOnBottomSection\n content={svgDateContent}\n leftLabel={copy.available_balances_text}\n leftValue={formatCurrency(availableBalances, CURRENCY_FORMAT.cents)}\n rightLabel={copy.average_monthly_spend_text}\n rightValue={formatCurrency(averageMonthlySpend, CURRENCY_FORMAT.cents)}\n sx={{ width: '100%', mb: 24 }}\n />\n ) : null\n }\n />\n\n {!isSaveEnough && availableBalances != null && expenses != null && (\n <RemainingCard\n availableBalances={availableBalances}\n copy={copy}\n expenses={expenses}\n totalRemaining={totalRemaining}\n />\n )}\n\n <SavingsProjection\n bodyContent={copy[projection.contentKey]}\n bodyDescription={copy[projection.descriptionKey]}\n copy={copy}\n deltaAmount={projection.deltaAmount}\n initialAmount={projection.initialAmount}\n monthsTable={projection.months}\n seedAmount={projection.initialAmount == null ? averageMonthlySpend : undefined}\n />\n\n {isSaveEnough && availableBalances != null && (\n <TotalsFooter availableBalances={availableBalances} copy={copy} date={date} />\n )}\n </>\n )\n}\n"],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a,EAAK,EAAW,UAAA;AAAA,MAC7B,iBAAiB,EAAK,EAAW,cAAA;AAAA,MAC3B,MAAA;AAAA,MACN,aAAa,EAAW;AAAA,MACxB,eAAe,EAAW;AAAA,MAC1B,aAAa,EAAW;AAAA,MACxB,YAAY,EAAW,iBAAiB,OAAO,IAAsB;AAAA,IACtE,CAAA;AAAA,IAEA,KAAgB,KAAqB,QACpC,gBAAA,EAAC,GAAD;AAAA,MAAiC,mBAAA;AAAA,MAAyB,MAAA;AAAA,MAAY,MAAA;AAAA,IAAO,CAAA;AAAA,EAE/E,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"MakeTransferActionBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.tsx"],"sourcesContent":["import React, { type ReactNode } from 'react'\nimport { Card, Divider, List, ListItem, Stack } from '@mui/material'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, type MakeTransferCopy } from '../../../core'\nimport { formatWholeCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { BalanceStepper } from './BalanceStepper'\nimport SaveEnoughToLiveOnBottomSection from './SaveEnoughToLiveOnBottomSection'\nimport {\n PROJECTIONS,\n toNumber,\n variants,\n type MakeTransferVariant,\n type MakeTransferVariantProps,\n type MonthRow,\n} from './layout'\n\n// ============================================================================\n// Section building blocks (block-local)\n// ============================================================================\n\n/** Bordered title + description, with an optional `leading` slot. */\nconst Header = ({ copy, leading }: { copy: MakeTransferCopy; leading?: ReactNode }) => (\n <Stack\n sx={{ bgcolor: 'background.paper', p: 24, borderBottom: '1px solid', borderColor: 'divider' }}\n >\n {leading}\n <Stack sx={{ gap: 8 }}>\n <Text variant=\"h3\">{copy.header_content}</Text>\n <Text sx={{ lineHeight: '24px' }} truncate={false} variant=\"body1\">\n {copy.description}\n </Text>\n </Stack>\n </Stack>\n)\n\n/** Save-extra only: available − expenses = total remaining. */\nconst RemainingCard = ({\n availableBalances,\n expenses,\n totalRemaining,\n copy,\n}: {\n availableBalances: number\n expenses: number\n totalRemaining?: number\n copy: MakeTransferCopy\n}) => (\n <Stack sx={{ pt: 24, px: 24 }}>\n <Card sx={{ px: 16, pt: 16, pb: 12 }}>\n <Stack\n sx={{\n border: 1,\n borderColor: 'divider',\n borderRadius: '4px',\n gap: 12,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n p: 8,\n mb: 12,\n }}\n >\n <Stack sx={{ width: 155, textAlign: 'center' }}>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {formatWholeCurrency(availableBalances)}\n </Text>\n <Text sx={{ color: 'text.secondary' }} variant=\"caption\">\n {copy.available_text}\n </Text>\n </Stack>\n <Icon name=\"remove\" size={20} />\n <Stack sx={{ width: 155, textAlign: 'center' }}>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {formatWholeCurrency(expenses)}\n </Text>\n <Text sx={{ color: 'text.secondary' }} variant=\"caption\">\n {copy.expenses_text}\n </Text>\n </Stack>\n </Stack>\n <Stack\n sx={{\n textAlign: 'center',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 4,\n }}\n >\n <Text sx={{ color: 'text.secondary' }} variant=\"body2\">\n {copy.total_remaining_text}:\n </Text>\n <Text sx={{ fontWeight: 600 }} variant=\"body2\">\n {formatWholeCurrency(totalRemaining)}\n </Text>\n </Stack>\n </Card>\n </Stack>\n)\n\n/** Save-enough only: total available balances as of a date. */\nconst TotalsFooter = ({\n availableBalances,\n date,\n copy,\n}: {\n availableBalances: number\n date?: string\n copy: MakeTransferCopy\n}) => (\n <Stack sx={{ px: 24, py: 14, textAlign: 'right', gap: 4 }}>\n <Text truncate={false} variant=\"h3\">\n {formatWholeCurrency(availableBalances)}\n </Text>\n {date && (\n <Text sx={{ color: 'text.secondary', fontWeight: 400 }} truncate={false} variant=\"subtitle2\">\n {buildDynamicCopy(copy.your_available_balances_text, date) as string}\n </Text>\n )}\n </Stack>\n)\n\n/** Stepper + projected-savings table. Owns the amount state so both stay in sync. */\nconst SavingsProjection = ({\n bodyContent,\n bodyDescription,\n monthsTable,\n deltaAmount,\n initialAmount,\n seedAmount,\n copy,\n}: {\n bodyContent: string\n bodyDescription: string\n monthsTable: readonly MonthRow[]\n deltaAmount: number\n /** Fixed starting amount; when null, seeds from `seedAmount` once it resolves. */\n initialAmount: number | null\n seedAmount?: number\n copy: MakeTransferCopy\n}) => {\n // Whole dollars, so the stepper times each month equals that row's amount.\n const seed = seedAmount == null ? undefined : Math.round(seedAmount)\n const [amount, setAmount] = React.useState(initialAmount ?? seed ?? 0)\n\n React.useEffect(() => {\n if (initialAmount == null && seed != null) {\n setAmount(seed)\n }\n }, [initialAmount, seed])\n\n const lastRowIndex = monthsTable.length - 1\n\n return (\n <>\n <Stack sx={{ p: 24, gap: 8 }}>\n <Text sx={{ fontWeight: 600 }} truncate={false} variant=\"body1\">\n {bodyContent}\n </Text>\n <BalanceStepper\n amount={formatWholeCurrency(amount)}\n copy={copy}\n onDecrement={() => setAmount((prev) => Math.max(0, prev - deltaAmount))}\n onIncrement={() => setAmount((prev) => prev + deltaAmount)}\n />\n </Stack>\n <Stack sx={{ gap: 8 }}>\n <Text sx={{ fontWeight: 600, mx: 24 }} truncate={false} variant=\"body1\">\n {bodyDescription}\n </Text>\n <List sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {monthsTable.map(({ label, value }, index) => (\n <React.Fragment key={value}>\n <ListItem\n disableGutters={true}\n disablePadding={true}\n // With its 1px divider, each row is Figma's 52px.\n sx={{ minHeight: 51, bgcolor: 'background.paper' }}\n >\n <Stack sx={{ width: '100%' }}>\n <Stack\n sx={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n width: '100%',\n px: 24,\n py: 8,\n }}\n >\n <Text truncate={false} variant=\"body1\">\n {label}\n </Text>\n <Text sx={{ fontWeight: 600 }} truncate={false} variant=\"body1\">\n {formatWholeCurrency(value * amount)}\n </Text>\n </Stack>\n </Stack>\n </ListItem>\n <Divider component=\"li\" sx={{ ml: index === lastRowIndex ? 0 : 24 }} />\n </React.Fragment>\n ))}\n </List>\n </Stack>\n </>\n )\n}\n\n// ============================================================================\n// Block — both variants share the header and the stepper/table (settings from\n// PROJECTIONS in layout.ts); only the sections around them differ.\n// ============================================================================\n\nexport const MakeTransferActionBlock = ({\n variant,\n slotData,\n copy,\n}: MakeTransferVariantProps & { variant: MakeTransferVariant }) => {\n const isSaveEnough = variant === variants.SAVE_ENOUGH_TO_LIVE_ON\n const projection = PROJECTIONS[variant]\n\n const availableBalances = slotData?.available_balance\n const averageMonthlySpend = toNumber(slotData?.avg_monthly_spend)\n const expenses = toNumber(slotData?.upcoming_expenses)\n const totalRemaining = toNumber(slotData?.total_remaining)\n const svgDateContent = slotData?.time_period\n const date = slotData?.date\n\n return (\n <>\n <Header\n copy={copy}\n leading={\n isSaveEnough &&\n availableBalances != null &&\n averageMonthlySpend != null &&\n svgDateContent ? (\n <SaveEnoughToLiveOnBottomSection\n content={svgDateContent}\n leftLabel={copy.available_balance_text}\n leftValue={formatWholeCurrency(availableBalances)}\n rightLabel={copy.avg_monthly_spend_text}\n rightValue={formatWholeCurrency(averageMonthlySpend)}\n sx={{ width: '100%', mb: 24 }}\n />\n ) : null\n }\n />\n\n {!isSaveEnough && availableBalances != null && expenses != null && (\n <RemainingCard\n availableBalances={availableBalances}\n copy={copy}\n expenses={expenses}\n totalRemaining={totalRemaining}\n />\n )}\n\n <SavingsProjection\n bodyContent={copy[projection.contentKey]}\n bodyDescription={copy[projection.descriptionKey]}\n copy={copy}\n deltaAmount={projection.deltaAmount}\n initialAmount={projection.initialAmount}\n monthsTable={projection.months}\n seedAmount={projection.initialAmount == null ? averageMonthlySpend : undefined}\n />\n\n {isSaveEnough && availableBalances != null && (\n <TotalsFooter availableBalances={availableBalances} copy={copy} date={date} />\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;AAyB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C3B,MAAA;AAAA,MACN,aAAa,EAAW;AAAA,MACxB,eAAe,EAAW;AAAA,MAC1B,aAAa,EAAW;AAAA,MACxB,YAAY,EAAW,iBAAiB,OAAO,IAAsB;AAAA,IACtE,CAAA;AAAA,IAEA,KAAgB,KAAqB,QACpC,gBAAA,EAAC,GAAD;AAAA,MAAiC,mBAAA;AAAA,MAAyB,MAAA;AAAA,MAAY,MAAA;AAAA,IAAO,CAAA;AAAA,EAE/E,EAAA,CAAA;AAEN"}
|
package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import {
|
|
1
|
+
import { useGlobalCopyStore as u } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { formatWholeCurrency as y } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
3
|
import { ThemedSVGImage as h } from "../../../components/chartblocks/ThemedSVGImage.es.js";
|
|
4
4
|
import { resolveVariantConfig as _ } from "../../resolveVariantConfig.es.js";
|
|
5
|
-
import { asNumber as f, asText as
|
|
6
|
-
import { ReactComponent as
|
|
7
|
-
import { ReactComponent as
|
|
8
|
-
import { SAVINGS_SUMMARY_LAYOUT as
|
|
5
|
+
import { asNumber as f, asText as S, slotOrFlat as m } from "../../slotReaders.es.js";
|
|
6
|
+
import { ReactComponent as w } from "../../../components/shared/images/SaveEnoughToLiveOnBottom.es.js";
|
|
7
|
+
import { ReactComponent as C } from "../../../components/shared/images/SaveEnoughToLiveOnTop.es.js";
|
|
8
|
+
import { SAVINGS_SUMMARY_LAYOUT as I, savingsSummaryBlockVariant as R } from "./layout.es.js";
|
|
9
9
|
import n from "@mui/material/Stack";
|
|
10
|
-
import { H2 as
|
|
11
|
-
import { jsx as e, jsxs as
|
|
12
|
-
import
|
|
13
|
-
var v = ({ label: i, amount: o }) => /* @__PURE__ */
|
|
10
|
+
import { H2 as T, Text as g } from "@mxenabled/mxui";
|
|
11
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
12
|
+
import A from "@mui/material/Box";
|
|
13
|
+
var v = ({ label: i, amount: o }) => /* @__PURE__ */ t(n, {
|
|
14
14
|
direction: "row",
|
|
15
15
|
sx: {
|
|
16
16
|
alignItems: "center",
|
|
@@ -30,29 +30,29 @@ var v = ({ label: i, amount: o }) => /* @__PURE__ */ r(n, {
|
|
|
30
30
|
component: "dd",
|
|
31
31
|
sx: { m: 0 },
|
|
32
32
|
variant: "body2",
|
|
33
|
-
children: y(o
|
|
33
|
+
children: y(o)
|
|
34
34
|
})]
|
|
35
|
-
}),
|
|
36
|
-
const o =
|
|
37
|
-
return !s || !l || d === void 0 || c === void 0 ? null : /* @__PURE__ */
|
|
35
|
+
}), O = ({ payload: i }) => {
|
|
36
|
+
const o = u().insights_feed?.make_transfer, s = o?.available_balance_text, l = o?.avg_monthly_spend_text, { instance_slot: r = {} } = i, { showCalendar: a } = _(I, r.variant, R.NoIllustration, "SavingsSummaryBlock"), d = f(m(r, "available_balance")), c = f(m(r, "avg_monthly_spend")), p = S(m(r, "time_period")), x = !!p;
|
|
37
|
+
return !s || !l || d === void 0 || c === void 0 ? null : /* @__PURE__ */ t(n, {
|
|
38
38
|
sx: {
|
|
39
39
|
alignItems: "center",
|
|
40
|
-
gap: a ?
|
|
40
|
+
gap: a ? 20 : 12,
|
|
41
41
|
px: 16,
|
|
42
42
|
width: "100%"
|
|
43
43
|
},
|
|
44
|
-
children: [(a || x) && /* @__PURE__ */
|
|
44
|
+
children: [(a || x) && /* @__PURE__ */ t(n, {
|
|
45
45
|
sx: { alignItems: "center" },
|
|
46
46
|
children: [a && /* @__PURE__ */ e(h, {
|
|
47
47
|
divProps: { style: {
|
|
48
48
|
maxWidth: "100%",
|
|
49
49
|
width: 264
|
|
50
50
|
} },
|
|
51
|
-
image:
|
|
52
|
-
}), x && /* @__PURE__ */
|
|
51
|
+
image: C
|
|
52
|
+
}), x && /* @__PURE__ */ t(A, {
|
|
53
53
|
sx: {
|
|
54
54
|
display: "grid",
|
|
55
|
-
mt: a ? -
|
|
55
|
+
mt: a ? -58 : 0,
|
|
56
56
|
placeItems: "center"
|
|
57
57
|
},
|
|
58
58
|
children: [/* @__PURE__ */ e(h, {
|
|
@@ -62,8 +62,8 @@ var v = ({ label: i, amount: o }) => /* @__PURE__ */ r(n, {
|
|
|
62
62
|
maxWidth: "none",
|
|
63
63
|
width: 262
|
|
64
64
|
} },
|
|
65
|
-
image:
|
|
66
|
-
}), /* @__PURE__ */ e(
|
|
65
|
+
image: w
|
|
66
|
+
}), /* @__PURE__ */ e(T, {
|
|
67
67
|
sx: {
|
|
68
68
|
color: "neutral.contrastText",
|
|
69
69
|
gridArea: "1 / 1",
|
|
@@ -72,15 +72,14 @@ var v = ({ label: i, amount: o }) => /* @__PURE__ */ r(n, {
|
|
|
72
72
|
children: p
|
|
73
73
|
})]
|
|
74
74
|
})]
|
|
75
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ t(n, {
|
|
76
76
|
component: "dl",
|
|
77
77
|
sx: {
|
|
78
78
|
"& > div + div": {
|
|
79
79
|
borderTop: 1,
|
|
80
80
|
borderColor: "divider"
|
|
81
81
|
},
|
|
82
|
-
|
|
83
|
-
borderColor: "divider",
|
|
82
|
+
boxShadow: (b) => `inset 0 0 0 1px ${b.palette.divider}`,
|
|
84
83
|
borderRadius: "4px",
|
|
85
84
|
m: 0,
|
|
86
85
|
width: "100%"
|
|
@@ -96,7 +95,7 @@ var v = ({ label: i, amount: o }) => /* @__PURE__ */ r(n, {
|
|
|
96
95
|
});
|
|
97
96
|
};
|
|
98
97
|
export {
|
|
99
|
-
|
|
98
|
+
O as default
|
|
100
99
|
};
|
|
101
100
|
|
|
102
101
|
//# sourceMappingURL=SavingsSummaryBlock.es.js.map
|
package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavingsSummaryBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport {
|
|
1
|
+
{"version":3,"file":"SavingsSummaryBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { formatWholeCurrency } from '../../../../core/utils/NumberFormatting'\nimport { ThemedSVGImage } from '../../../components/chartblocks/ThemedSVGImage'\nimport { ReactComponent as BrushStroke } from '../../../components/shared/images/SaveEnoughToLiveOnBottom.svg'\nimport { ReactComponent as CalendarGraphic } from '../../../components/shared/images/SaveEnoughToLiveOnTop.svg'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asNumber, asText, slotOrFlat } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\nimport { SAVINGS_SUMMARY_LAYOUT, savingsSummaryBlockVariant } from './layout'\n\nconst Row = ({ label, amount }: { label: string; amount: number }) => (\n <Stack\n direction=\"row\"\n sx={{ alignItems: 'center', gap: 16, justifyContent: 'space-between', minHeight: 40, px: 16 }}\n >\n <Text color=\"text.secondary\" component=\"dt\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} color=\"text.primary\" component=\"dd\" sx={{ m: 0 }} variant=\"body2\">\n {formatWholeCurrency(amount)}\n </Text>\n </Stack>\n)\n\nconst SavingsSummaryBlock = ({ payload }: BlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.make_transfer\n const balanceLabel = copy?.available_balance_text\n const spendLabel = copy?.avg_monthly_spend_text\n\n const { instance_slot = {} } = payload\n const { showCalendar } = resolveVariantConfig(\n SAVINGS_SUMMARY_LAYOUT,\n instance_slot.variant,\n savingsSummaryBlockVariant.NoIllustration,\n 'SavingsSummaryBlock',\n )\n const balance = asNumber(slotOrFlat(instance_slot, 'available_balance'))\n const spend = asNumber(slotOrFlat(instance_slot, 'avg_monthly_spend'))\n const timePeriod = asText(slotOrFlat(instance_slot, 'time_period'))\n const hasTimePeriod = !!timePeriod\n\n // Both figures need a label and a real number; never show a made-up $0.\n if (!balanceLabel || !spendLabel || balance === undefined || spend === undefined) {\n return null\n }\n\n return (\n <Stack sx={{ alignItems: 'center', gap: showCalendar ? 20 : 12, px: 16, width: '100%' }}>\n {(showCalendar || hasTimePeriod) && (\n <Stack sx={{ alignItems: 'center' }}>\n {showCalendar && (\n <ThemedSVGImage\n divProps={{ style: { maxWidth: '100%', width: 264 } }}\n image={CalendarGraphic}\n />\n )}\n {hasTimePeriod && (\n <Box sx={{ display: 'grid', mt: showCalendar ? -58 : 0, placeItems: 'center' }}>\n <ThemedSVGImage\n divProps={{\n style: { gridArea: '1 / 1', lineHeight: 0, maxWidth: 'none', width: 262 },\n }}\n image={BrushStroke}\n />\n <H2 sx={{ color: 'neutral.contrastText', gridArea: '1 / 1', textAlign: 'center' }}>\n {timePeriod}\n </H2>\n </Box>\n )}\n </Stack>\n )}\n <Stack\n component=\"dl\"\n sx={{\n '& > div + div': { borderTop: 1, borderColor: 'divider' },\n // Drawn inside, so the two 40px rows make Figma's 80px table.\n boxShadow: (theme) => `inset 0 0 0 1px ${theme.palette.divider}`,\n borderRadius: '4px',\n m: 0,\n width: '100%',\n }}\n >\n <Row amount={balance} label={balanceLabel} />\n <Row amount={spend} label={spendLabel} />\n </Stack>\n </Stack>\n )\n}\n\nexport default SavingsSummaryBlock\n"],"mappings":";;;;;;;;;;;;AAeA,IAAM,IAAA,CAAO,EAAE,OAAA,GAAO,QAAA,EAAA,MACpB,gBAAA,EAAC,GAAD;AAAA,E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A,UAAE,UAAU;AAAA,UAAQ,OAAO;AAAA,QAAI,EAAE;AAAA,QACpD,OAAO;AAAA,MACR,CAAA,GAEF,KACC,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,SAAS;AAAA,UAAQ,IAAI,IAAe,MAAM;AAAA,UAAG,YAAY;AAAA,QAAS;AAAA,QAA7E,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UACE,UAAU,EACR,OAAO;AAAA,YAAE,UAAU;AAAA,YAAS,YAAY;AAAA,YAAG,UAAU;AAAA,YAAQ,OAAO;AAAA,UAAI,EAC1E;AAAA,UACA,OAAO;AAAA,QACR,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,UAAI,IAAI;AAAA,YAAE,OAAO;AAAA,YAAwB,UAAU;AAAA,YAAS,WAAW;AAAA,UAAS;AAAA,UAC7E,UAAA;AAAA,QACC,CAAA,CACD;AAAA,MAEF,CAAA,CAAA;AAAA,IAET,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MACE,WAAU;AAAA,MACV,IAAI;AAAA,QACF,iBAAiB;AAAA,UAAE,WAAW;AAAA,UAAG,aAAa;AAAA,QAAU;AAAA,QAExD,WAAA,CAAY,MAAU,mBAAmB,EAAM,QAAQ,OAAA;AAAA,QACvD,cAAc;AAAA,QACd,GAAG;AAAA,QACH,OAAO;AAAA,MACT;AAAA,MATF,UAAA,CAWE,gBAAA,EAAC,GAAD;AAAA,QAAK,QAAQ;AAAA,QAAS,OAAO;AAAA,MAAe,CAAA,GAC5C,gBAAA,EAAC,GAAD;AAAA,QAAK,QAAQ;AAAA,QAAO,OAAO;AAAA,MAAa,CAAA,CACnC;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|
|
@@ -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 GasPurchaseBlock,\n GoalsBlock,\n MerchantBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n QuizBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SavingsSummaryBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WeeklySmallPurchasesBlock,\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 { buildDynamicCopy } from '../../core/utils/Localization'\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 { SubscriptionStatusModalBlock } from '../actionBlocks/SubscriptionStatusModalBlock'\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 { useTransactionHistoryPrepare } from '../actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { getTransactionListDrawerTitle } from '../actionBlocks/TransactionListBlock/layout'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport { OverdraftBlock, useOverdraftPrepare } from '../actionBlocks/OverdraftBlock'\nimport { AccountListBlock, useAccountListPrepare } from '../actionBlocks/AccountListBlock'\nimport { EmergencySavingsBlock } from '../actionBlocks/EmergencySavingsBlock'\nimport {\n CreditUtilizationBlock,\n useCreditUtilizationPrepare,\n} from '../actionBlocks/CreditUtilizationBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\nimport { BudgetDetailsBlock } from '../actionBlocks/BudgetDetailsBlock'\nimport { useBudgetDetailsPrepare } from '../actionBlocks/BudgetDetailsBlock/useBudgetDetailsPrepare'\nimport { resolveBudgetSubject } from '../actionBlocks/BudgetDetailsBlock/layout'\nimport { AccountDetailsBlock, useAccountDetailsPrepare } from '../actionBlocks/AccountDetailsBlock'\nimport { HelpBlock } from '../actionBlocks/HelpBlock'\nimport {\n PayoffStrategiesBlock,\n usePayoffStrategiesPrepare,\n} from '../actionBlocks/PayoffStrategiesBlock'\nimport { QuizMerchantBlock } from '../actionBlocks/QuizMerchantBlock'\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 // Drawer title from the CTA's variant and copy; falls back to the CTA label when empty.\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 // The drawer header's close control: 'back' (default, arrow on the left) or 'close' (X on the right).\n headerAction?: 'back' | 'close'\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 * Reads its imports on access, not at load: some blocks import this registry back through\n * `ActionBlockLayer`, so a value copied at load would still be `undefined`.\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 get headerAction() {\n return resolve().headerAction\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: useTransactionHistoryPrepare,\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 // Unexpected Subscription Payment's Subscription Status modal.\n [actionBlocksKey.SUBSCRIPTION_STATUS_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SubscriptionStatusModalBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: getTransactionListDrawerTitle,\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 // Savings Opportunity's safety net: `safety_net_block` opens the amount-input modal.\n [actionBlocksKey.SAFETY_NET_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n usePrepare: noop,\n })),\n // Transparent Overdraft's \"Learn more\": the projected overdraft, its account and the confidence\n // meter. Titled from the beat, as the pulse drawer was.\n [actionBlocksKey.OVERDRAFT_ACTION_BLOCK]: liveEntry(() => ({\n Component: OverdraftBlock,\n usePrepare: useOverdraftPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Credit Utilization's \"Learn more\": donut summary, legend and the per-card list. Loads accounts\n // for the institution logos; the rows themselves ride on the beat.\n [actionBlocksKey.CREDIT_UTILIZATION_ACTION_BLOCK]: liveEntry(() => ({\n Component: CreditUtilizationBlock,\n usePrepare: useCreditUtilizationPrepare,\n title: (_variant, copy) => copy.insights_feed?.credit_utilization?.title ?? '',\n })),\n [actionBlocksKey.EMERGENCY_SAVINGS_ACTION_BLOCK]: liveEntry(() => ({\n Component: EmergencySavingsBlock,\n usePrepare: noop,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\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 [actionBlocksKey.BUDGET_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: BudgetDetailsBlock,\n // Figma's Budget Details: a close X on the right, not the back arrow.\n headerAction: 'close',\n // Loads the budget data and points the transaction store at the budget month, as pulse did.\n usePrepare: useBudgetDetailsPrepare,\n // \"{subject} Budget\" (subject by the CTA variant), else the card's title.\n title: (variant, copy, beat) => {\n const subject = beat ? resolveBudgetSubject(variant, beat, copy) : undefined\n if (subject && copy.budgets?.details_type_title) {\n return buildDynamicCopy(copy.budgets.details_type_title, subject) as string\n }\n\n return beat?.insights_payload?.title || copy.budgets?.details_title || ''\n },\n })),\n // The accounts widget's account details (header, trend chart, tabs, connection, actions) for the\n // beat's primary account. Shared by every beat that opens an account.\n [actionBlocksKey.ACCOUNT_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountDetailsBlock,\n usePrepare: useAccountDetailsPrepare,\n title: (_variant, copy) => copy.accounts?.account_details ?? '',\n })),\n // Monthly Obligations Status's account list: the beat's calculation and the accounts behind it.\n [actionBlocksKey.ACCOUNT_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountListBlock,\n usePrepare: useAccountListPrepare,\n title: (_variant, copy) => copy.insights_feed?.account_list?.title ?? '',\n })),\n // A beat's \"Learn More\": its pre-localized help title and body from the payload's\n // `drilldown_data`. The drawer title is the CTA label.\n [actionBlocksKey.HELP_ACTION_BLOCK]: liveEntry(() => ({\n Component: HelpBlock,\n usePrepare: noop,\n })),\n // Debt Payoff Strategies' \"Learn more\": Avalanche / Snowball tabs over the beat's debt accounts.\n [actionBlocksKey.PAYOFF_STRATEGIES_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffStrategiesBlock,\n usePrepare: usePayoffStrategiesPrepare,\n title: (_variant, copy) => copy.insights_feed?.general?.debt_payoff_strategies ?? '',\n })),\n // A Monthly Top Transacted Merchant result row: that merchant's rank, totals and transactions.\n [actionBlocksKey.QUIZ_MERCHANT_ACTION_BLOCK]: liveEntry(() => ({\n Component: QuizMerchantBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: (_variant, copy) => copy.insights_feed?.quiz_block?.drawer_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 gas_purchase_block: GasPurchaseBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n merchant_block: MerchantBlock,\n no_spend_days_block: NoSpendDaysBlock,\n quiz_block: QuizBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_amount_block: SavingsOpportunityBlock,\n savings_summary_block: SavingsSummaryBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n weekly_small_purchases_block: WeeklySmallPurchasesBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GAuBjC,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;AAAA,EACA,IAAI,eAAe;AACjB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,EACpF,EAAE;AAAA,EAED,CAAA,EAAgB,0BAAA,GAA6B,EAAA,OAAiB;AAAA,IAC7D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,eAAe,YAAY,gBAAgB;AAAA,EAC7E,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,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,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 GasPurchaseBlock,\n GoalsBlock,\n MerchantBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n QuizBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SavingsSummaryBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WeeklySmallPurchasesBlock,\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 { buildDynamicCopy } from '../../core/utils/Localization'\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 { SubscriptionStatusModalBlock } from '../actionBlocks/SubscriptionStatusModalBlock'\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 { useTransactionHistoryPrepare } from '../actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { getTransactionListDrawerTitle } from '../actionBlocks/TransactionListBlock/layout'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport { OverdraftBlock, useOverdraftPrepare } from '../actionBlocks/OverdraftBlock'\nimport { AccountListBlock, useAccountListPrepare } from '../actionBlocks/AccountListBlock'\nimport { EmergencySavingsBlock } from '../actionBlocks/EmergencySavingsBlock'\nimport {\n CreditUtilizationBlock,\n useCreditUtilizationPrepare,\n} from '../actionBlocks/CreditUtilizationBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\nimport { BudgetDetailsBlock } from '../actionBlocks/BudgetDetailsBlock'\nimport { useBudgetDetailsPrepare } from '../actionBlocks/BudgetDetailsBlock/useBudgetDetailsPrepare'\nimport { resolveBudgetSubject } from '../actionBlocks/BudgetDetailsBlock/layout'\nimport { AccountDetailsBlock, useAccountDetailsPrepare } from '../actionBlocks/AccountDetailsBlock'\nimport { HelpBlock } from '../actionBlocks/HelpBlock'\nimport {\n PayoffStrategiesBlock,\n usePayoffStrategiesPrepare,\n} from '../actionBlocks/PayoffStrategiesBlock'\nimport { QuizMerchantBlock } from '../actionBlocks/QuizMerchantBlock'\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 // Drawer title from the CTA's variant and copy; falls back to the CTA label when empty.\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 // The drawer header's close control: 'back' (default, arrow on the left) or 'close' (X on the right).\n headerAction?: 'back' | 'close'\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 * Reads its imports on access, not at load: some blocks import this registry back through\n * `ActionBlockLayer`, so a value copied at load would still be `undefined`.\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 get headerAction() {\n return resolve().headerAction\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 headerAction: 'close',\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: useTransactionHistoryPrepare,\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 // Unexpected Subscription Payment's Subscription Status modal.\n [actionBlocksKey.SUBSCRIPTION_STATUS_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SubscriptionStatusModalBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: getTransactionListDrawerTitle,\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 // Savings Opportunity's safety net: `safety_net_block` opens the amount-input modal.\n [actionBlocksKey.SAFETY_NET_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n usePrepare: noop,\n })),\n // Transparent Overdraft's \"Learn more\": the projected overdraft, its account and the confidence\n // meter. Titled from the beat, as the pulse drawer was.\n [actionBlocksKey.OVERDRAFT_ACTION_BLOCK]: liveEntry(() => ({\n Component: OverdraftBlock,\n usePrepare: useOverdraftPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Credit Utilization's \"Learn more\": donut summary, legend and the per-card list. Loads accounts\n // for the institution logos; the rows themselves ride on the beat.\n [actionBlocksKey.CREDIT_UTILIZATION_ACTION_BLOCK]: liveEntry(() => ({\n Component: CreditUtilizationBlock,\n usePrepare: useCreditUtilizationPrepare,\n title: (_variant, copy) => copy.insights_feed?.credit_utilization?.title ?? '',\n })),\n [actionBlocksKey.EMERGENCY_SAVINGS_ACTION_BLOCK]: liveEntry(() => ({\n Component: EmergencySavingsBlock,\n usePrepare: noop,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\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 [actionBlocksKey.BUDGET_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: BudgetDetailsBlock,\n // Figma's Budget Details: a close X on the right, not the back arrow.\n headerAction: 'close',\n // Loads the budget data and points the transaction store at the budget month, as pulse did.\n usePrepare: useBudgetDetailsPrepare,\n // \"{subject} Budget\" (subject by the CTA variant), else the card's title.\n title: (variant, copy, beat) => {\n const subject = beat ? resolveBudgetSubject(variant, beat, copy) : undefined\n if (subject && copy.budgets?.details_type_title) {\n return buildDynamicCopy(copy.budgets.details_type_title, subject) as string\n }\n\n return beat?.insights_payload?.title || copy.budgets?.details_title || ''\n },\n })),\n // The accounts widget's account details (header, trend chart, tabs, connection, actions) for the\n // beat's primary account. Shared by every beat that opens an account.\n [actionBlocksKey.ACCOUNT_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountDetailsBlock,\n usePrepare: useAccountDetailsPrepare,\n title: (_variant, copy) => copy.accounts?.account_details ?? '',\n })),\n // Monthly Obligations Status's account list: the beat's calculation and the accounts behind it.\n [actionBlocksKey.ACCOUNT_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountListBlock,\n usePrepare: useAccountListPrepare,\n title: (_variant, copy) => copy.insights_feed?.account_list?.title ?? '',\n })),\n // A beat's \"Learn More\": its pre-localized help title and body from the payload's\n // `drilldown_data`. The drawer title is the CTA label.\n [actionBlocksKey.HELP_ACTION_BLOCK]: liveEntry(() => ({\n Component: HelpBlock,\n usePrepare: noop,\n })),\n // Debt Payoff Strategies' \"Learn more\": Avalanche / Snowball tabs over the beat's debt accounts.\n [actionBlocksKey.PAYOFF_STRATEGIES_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffStrategiesBlock,\n usePrepare: usePayoffStrategiesPrepare,\n title: (_variant, copy) => copy.insights_feed?.general?.debt_payoff_strategies ?? '',\n })),\n // A Monthly Top Transacted Merchant result row: that merchant's rank, totals and transactions.\n [actionBlocksKey.QUIZ_MERCHANT_ACTION_BLOCK]: liveEntry(() => ({\n Component: QuizMerchantBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: (_variant, copy) => copy.insights_feed?.quiz_block?.drawer_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 gas_purchase_block: GasPurchaseBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n merchant_block: MerchantBlock,\n no_spend_days_block: NoSpendDaysBlock,\n quiz_block: QuizBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_amount_block: SavingsOpportunityBlock,\n savings_summary_block: SavingsSummaryBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n weekly_small_purchases_block: WeeklySmallPurchasesBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GAuBjC,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;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,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,OAAO;AAAA,EACT,EAAE;AAAA,EACD,CAAA,EAAgB,gCAAA,GAA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