@mx-cartographer/experiences 9.7.149 → 9.7.151

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 (29) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/core/types/Insights.d.ts +0 -6
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/core/types/localization/InsightsFeedCopy.d.ts +10 -7
  5. package/dist/core/utils/NumberFormatting.d.ts +2 -0
  6. package/dist/core/utils/NumberFormatting.es.js +18 -17
  7. package/dist/core/utils/NumberFormatting.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +57 -57
  9. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
  10. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.d.ts +4 -23
  11. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +95 -72
  12. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
  13. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +6 -6
  14. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +24 -25
  15. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +4 -4
  17. package/dist/insights-v2/index.d.ts +0 -1
  18. package/dist/insights-v2/index.es.js +104 -106
  19. package/dist/insights-v2/mappings/blocks.es.js +1 -0
  20. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  21. package/package.json +1 -1
  22. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.d.ts +0 -17
  23. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.es.js +0 -24
  24. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.es.js.map +0 -1
  25. package/dist/insights-v2/components/ComponentBlocks/DepositLogo.es.js +0 -30
  26. package/dist/insights-v2/components/ComponentBlocks/DepositLogo.es.js.map +0 -1
  27. package/dist/insights-v2/components/DebtPayoffCard.d.ts +0 -48
  28. package/dist/insights-v2/components/DebtPayoffCard.es.js +0 -132
  29. package/dist/insights-v2/components/DebtPayoffCard.es.js.map +0 -1
@@ -1,77 +1,100 @@
1
- import { DATE_FORMATS_INTL as F, formatDate as N } from "../../../../core/constants/DateFormats.es.js";
2
- import { useGlobalCopyStore as k } from "../../../../common/context/hooks.es.js";
3
- import { slot as u } from "../../../../core/types/Insights.es.js";
4
- import { CURRENCY_FORMAT as i, formatCurrency as s, formatPercentage as P } from "../../../../core/utils/NumberFormatting.es.js";
5
- import { resolveVariantConfig as Y } from "../../resolveVariantConfig.es.js";
6
- import B from "../../../components/LogoFromGuid.es.js";
7
- import { DepositLogo as G } from "../../../components/ComponentBlocks/DepositLogo.es.js";
8
- import j from "../../../components/DebtPayoffCard.es.js";
9
- import I from "../../../components/TransactionListCard.es.js";
10
- import { parseDueDate as M } from "../RepeatingTransactionBlock/weekStrip.es.js";
11
- import { DEBTS_LAYOUT as H, debtsBlockVariant as U } from "./layout.es.js";
12
- import V from "react";
13
- import { jsx as l } from "react/jsx-runtime";
14
- import { useTheme as z } from "@mui/material/styles";
15
- var W = 32, Z = /* @__PURE__ */ new Set([
16
- "credit card",
17
- "credit_card",
18
- "creditcard"
19
- ]), $ = (t) => Z.has((t ?? "").trim().toLowerCase()) ? "credit_card" : "account_balance", q = (t) => typeof t == "object" && t !== null && typeof t.primary_text == "string", J = (t) => !!t?.balance_label && !!t.payoff_date_label && !!t.monthly_payment_label && !!t.interest_rate_label, ft = ({ payload: t }) => {
20
- const C = z(), o = k().insights_feed?.debts_block, { instance_slot: _ } = t, { data: m, variant: R } = _, p = Y(H, R, U.ProjectedPayoff, "DebtsBlock"), b = p.card === "summary", e = J(o) ? o : void 0, c = o?.total_balance_label, d = b ? !!c : !!e;
21
- if (V.useEffect(() => {
22
- d || console.warn(`debts_block: ${o ? "copy incomplete" : "copy namespace missing"}; rendering without its labelled figures`);
23
- }, [o, d]), b) {
24
- const r = u(m, "series"), x = (Array.isArray(r) ? r : []).filter(q).map((a) => ({
25
- amount: typeof a.amount == "number" ? s(a.amount, i.cents) : "",
26
- leading: /* @__PURE__ */ l(B, {
27
- logo: a.logo,
28
- size: W
29
- }),
30
- subtitle: typeof a.secondary_text == "string" ? a.secondary_text : "",
31
- title: a.primary_text
32
- })), L = u(m, "header_text"), f = u(m, "amount");
33
- return /* @__PURE__ */ l(I, {
34
- background: C.palette.primary.lighter,
35
- footer: c && typeof f == "number" && Number.isFinite(f) ? {
36
- amount: s(f, i.cents),
37
- label: c
38
- } : void 0,
39
- header: typeof L == "string" ? L : void 0,
40
- rows: x
41
- });
42
- }
43
- const { account_name: A, account_type: y, amount: g, institution_guid: E, institution_name: O, interest_rate: h, monthly_payment: v, payoff_date: T, status_text: S } = _, n = [];
44
- if (e) {
45
- const r = T ? M(T) : null;
46
- r && n.push({
47
- label: e.payoff_date_label,
48
- value: N(r, F.MONTH_SHORT_YEAR)
49
- }), v != null && n.push({
50
- label: e.monthly_payment_label,
51
- value: s(v, i.cents)
52
- }), h != null && n.push({
53
- label: e.interest_rate_label,
54
- value: P(h / 100)
55
- });
56
- }
57
- const D = e !== void 0 && g != null;
58
- return /* @__PURE__ */ l(j, {
59
- ...p.style,
60
- balance: D ? s(g, i.cents) : void 0,
61
- balanceLabel: D ? e.balance_label : void 0,
62
- logo: /* @__PURE__ */ l(G, {
63
- iconName: $(y),
64
- institutionGuid: E ?? "",
65
- institutionName: O ?? ""
66
- }),
67
- name: A,
68
- stats: n,
69
- statusLabel: S,
70
- subtitle: y
1
+ import { DATE_FORMATS_INTL as R, formatDate as k } from "../../../../core/constants/DateFormats.es.js";
2
+ import { useGlobalCopyStore as w } from "../../../../common/context/hooks.es.js";
3
+ import { slot as s } from "../../../../core/types/Insights.es.js";
4
+ import { CURRENCY_FORMAT as b, formatCurrency as f } from "../../../../core/utils/NumberFormatting.es.js";
5
+ import { asLogoRef as A, asNonEmptyText as C, asNumber as _, asText as L } from "../../slotReaders.es.js";
6
+ import F from "../../../components/LogoFromGuid.es.js";
7
+ import O from "../../../components/InsightTransactionRow.es.js";
8
+ import { parseDueDate as j } from "../RepeatingTransactionBlock/weekStrip.es.js";
9
+ import { useEffect as E } from "react";
10
+ import { observer as I } from "mobx-react-lite";
11
+ import y from "@mui/material/Stack";
12
+ import { Text as D } from "@mxenabled/mxui";
13
+ import { Fragment as N, jsx as a, jsxs as v } from "react/jsx-runtime";
14
+ import S from "@mui/material/Divider";
15
+ var B = 32, G = (r) => {
16
+ if (Array.isArray(r))
17
+ for (const o of r) {
18
+ if (typeof o != "object" || o === null) continue;
19
+ const { amount: t, logo: l, primary_text: i, secondary_text: n } = o, e = C(i);
20
+ if (e) return {
21
+ name: e,
22
+ account: L(n),
23
+ amount: _(t),
24
+ logo: A(l)
25
+ };
26
+ }
27
+ }, M = ({ grey: r, label: o, value: t }) => /* @__PURE__ */ v(N, { children: [/* @__PURE__ */ a(S, {}), /* @__PURE__ */ v(y, {
28
+ sx: {
29
+ alignItems: "center",
30
+ bgcolor: r ? "background.default" : "background.paper",
31
+ flexDirection: "row",
32
+ justifyContent: "space-between",
33
+ minHeight: 40,
34
+ px: 16,
35
+ py: 2
36
+ },
37
+ children: [/* @__PURE__ */ a(D, {
38
+ color: "text.primary",
39
+ variant: "subtitle2",
40
+ children: o
41
+ }), /* @__PURE__ */ a(D, {
42
+ bold: !0,
43
+ color: "text.primary",
44
+ variant: "caption",
45
+ children: t
46
+ })]
47
+ })] }), H = ({ payload: r }) => {
48
+ const o = w().insights_feed?.debts_block, t = o?.payment_due_label, l = o?.minimum_payment_label, i = o?.balance_label, n = r.instance_slot?.data, e = G(s(n, "series")), g = L(s(n, "due_date")), c = g ? j(g) : null, u = _(s(n, "minimum_payment")), d = _(s(n, "amount")), x = e !== void 0, p = [
49
+ c && !t && "payment_due_label",
50
+ u !== void 0 && !l && "minimum_payment_label",
51
+ d !== void 0 && !i && "balance_label"
52
+ ].filter(Boolean).join(", ");
53
+ if (E(() => {
54
+ x && p && console.warn(`debts_block: copy missing ${p}; hiding those lines`);
55
+ }, [x, p]), !e) return null;
56
+ const h = [
57
+ t && c ? {
58
+ label: t,
59
+ value: k(c, R.FULL_MONTH_DAY)
60
+ } : null,
61
+ l && u !== void 0 ? {
62
+ label: l,
63
+ value: f(u, b.cents)
64
+ } : null,
65
+ i && d !== void 0 ? {
66
+ label: i,
67
+ value: f(d, b.cents)
68
+ } : null
69
+ ].filter((m) => m !== null);
70
+ return /* @__PURE__ */ a(y, {
71
+ sx: { px: 16 },
72
+ children: /* @__PURE__ */ v(y, {
73
+ sx: {
74
+ border: "1px solid",
75
+ borderColor: "divider",
76
+ borderRadius: "8px",
77
+ overflow: "hidden",
78
+ width: "100%"
79
+ },
80
+ children: [/* @__PURE__ */ a(O, {
81
+ amount: e.amount === void 0 ? "" : f(e.amount, b.cents),
82
+ leading: /* @__PURE__ */ a(F, {
83
+ logo: e.logo,
84
+ size: B
85
+ }),
86
+ subtitle: e.account ?? "",
87
+ title: e.name
88
+ }), h.map((m, T) => /* @__PURE__ */ a(M, {
89
+ grey: T === h.length - 1,
90
+ label: m.label,
91
+ value: m.value
92
+ }, m.label))]
93
+ })
71
94
  });
72
- };
95
+ }, oe = I(H);
73
96
  export {
74
- ft as default
97
+ oe as default
75
98
  };
76
99
 
77
100
  //# sourceMappingURL=DebtsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DebtsBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { slot, type InsightsPayload, type InstanceSlotRow } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DebtsBlockCopy } from '../../../../core/types/localization/InsightsFeedCopy'\nimport {\n CURRENCY_FORMAT,\n formatCurrency,\n formatPercentage,\n} from '../../../../core/utils/NumberFormatting'\n\nimport DepositLogo from '../../../components/ComponentBlocks/DepositLogo'\nimport DebtPayoffCard, { type DebtPayoffStat } from '../../../components/DebtPayoffCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { parseDueDate } from '../RepeatingTransactionBlock/weekStrip'\n\nimport { DEBTS_LAYOUT, debtsBlockVariant } from './layout'\n\n// The card story reads the block's look from here.\nexport { PAYOFF_STYLE } from './layout'\n\ninterface DebtsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n\n/** Account types drawn with the card glyph when there is no institution logo; the rest get the bank. */\nconst CREDIT_CARD_TYPES = new Set(['credit card', 'credit_card', 'creditcard'])\n\nconst iconFor = (accountType?: string) =>\n CREDIT_CARD_TYPES.has((accountType ?? '').trim().toLowerCase())\n ? 'credit_card'\n : 'account_balance'\n\n/** A summary row ditto can draw: an object with a name. Anything else in `series` is skipped. */\nconst isNamedRow = (row: unknown): row is InstanceSlotRow & { primary_text: string } =>\n typeof row === 'object' &&\n row !== null &&\n typeof (row as InstanceSlotRow).primary_text === 'string'\n\n/** Every label the payoff card renders; a partial namespace counts as missing. */\nconst hasAllLabels = (copy?: DebtsBlockCopy): copy is DebtsBlockCopy =>\n !!copy?.balance_label &&\n !!copy.payoff_date_label &&\n !!copy.monthly_payment_label &&\n !!copy.interest_rate_label\n\n/**\n * Debts component block — the content card for the Debt Payoff Strategies beat.\n * `instance_slot.variant` picks the card from `./layout.ts` through `resolveVariantConfig`, as\n * `AccountBlock` does:\n *\n * - `projected_payoff` — one account on the `DebtPayoffCard`. Its facts arrive flat on\n * `instance_slot` (the shape it shipped with): the balance (`amount`), `payoff_date`,\n * `monthly_payment`, `interest_rate`, plus the shared account/institution fields.\n * - `debt_summary` — the beat's several debt accounts on a `TransactionListCard`, read from\n * `instance_slot.data`: one row per account from `series` (pre-localized `logo`, `primary_text`\n * name, `secondary_text` rate, `amount` balance, in the order sent), an optional `header_text`,\n * and the total owed (`amount`) as the footer. With no rows there is nothing to summarize and the\n * block renders nothing.\n *\n * Captions and payoff row labels come from `insights_feed.debts_block` copy, which ships\n * separately. Each variant needs only its own keys: until they have shipped, the card shows what\n * needs no copy (the account row, the summary rows) but never an unlabelled figure, and warns once\n * per mount so the rollout gap is traceable. A row with no value (or an unparseable date) is\n * dropped rather than rendered blank.\n */\nconst DebtsBlock = ({ payload }: DebtsBlockProps) => {\n const theme = useTheme()\n const copy = useGlobalCopyStore().insights_feed?.debts_block\n const { instance_slot } = payload\n const { data, variant } = instance_slot\n\n const layout = resolveVariantConfig(\n DEBTS_LAYOUT,\n variant,\n debtsBlockVariant.ProjectedPayoff,\n 'DebtsBlock',\n )\n const isSummary = layout.card === 'summary'\n\n const labels = hasAllLabels(copy) ? copy : undefined\n const totalLabel = copy?.total_balance_label\n const hasCopy = isSummary ? !!totalLabel : !!labels\n\n React.useEffect(() => {\n if (hasCopy) return\n console.warn(\n `debts_block: ${copy ? 'copy incomplete' : 'copy namespace missing'}; rendering without its labelled figures`,\n )\n }, [copy, hasCopy])\n\n if (isSummary) {\n // `slot()` is an unchecked cast over backend data, so every value is narrowed before use.\n const series = slot<unknown[]>(data, 'series')\n const rows = (Array.isArray(series) ? series : []).filter(isNamedRow).map((row) => ({\n amount:\n typeof row.amount === 'number' ? formatCurrency(row.amount, CURRENCY_FORMAT.cents) : '',\n leading: <LogoFromGuid logo={row.logo} size={ROW_LOGO_SIZE} />,\n subtitle: typeof row.secondary_text === 'string' ? row.secondary_text : '',\n title: row.primary_text,\n }))\n const header = slot<unknown>(data, 'header_text')\n const total = slot<unknown>(data, 'amount')\n\n return (\n <TransactionListCard\n background={theme.palette.primary.lighter}\n footer={\n totalLabel && typeof total === 'number' && Number.isFinite(total)\n ? { amount: formatCurrency(total, CURRENCY_FORMAT.cents), label: totalLabel }\n : undefined\n }\n header={typeof header === 'string' ? header : undefined}\n rows={rows}\n />\n )\n }\n\n const {\n account_name,\n account_type,\n amount,\n institution_guid,\n institution_name,\n interest_rate,\n monthly_payment,\n payoff_date,\n status_text,\n } = instance_slot\n\n const stats: DebtPayoffStat[] = []\n if (labels) {\n const payoffDate = payoff_date ? parseDueDate(payoff_date) : null\n if (payoffDate) {\n stats.push({\n label: labels.payoff_date_label,\n value: formatDate(payoffDate, DATE_FORMATS_INTL.MONTH_SHORT_YEAR),\n })\n }\n if (monthly_payment != null) {\n stats.push({\n label: labels.monthly_payment_label,\n value: formatCurrency(monthly_payment, CURRENCY_FORMAT.cents),\n })\n }\n if (interest_rate != null) {\n // `interest_rate` arrives as a percentage (19.99); Intl's percent style expects a fraction.\n stats.push({\n label: labels.interest_rate_label,\n value: formatPercentage(interest_rate / 100),\n })\n }\n }\n\n const hasBalance = labels !== undefined && amount != null\n\n return (\n <DebtPayoffCard\n {...layout.style}\n balance={hasBalance ? formatCurrency(amount, CURRENCY_FORMAT.cents) : undefined}\n balanceLabel={hasBalance ? labels.balance_label : undefined}\n logo={\n <DepositLogo\n iconName={iconFor(account_type)}\n institutionGuid={institution_guid ?? ''}\n institutionName={institution_name ?? ''}\n />\n }\n name={account_name}\n stats={stats}\n statusLabel={status_text}\n subtitle={account_type}\n />\n )\n}\n\nexport default DebtsBlock\n"],"mappings":";;;;;;;;;;;;;;AA+BA,IAAM,IAAgB,IAGhB,IAAoB,oBAAI,IAAI;AAAA,EAAC;AAAA,EAAe;AAAA,EAAe;AAAY,CAAC,GAExE,IAAA,CAAW,MACf,EAAkB,KAAK,KAAe,IAAI,KAAK,EAAE,YAAY,CAAC,IAC1D,gBACA,mBAGA,IAAA,CAAc,MAClB,OAAO,KAAQ,YACf,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/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport InsightTransactionRow from '../../../components/InsightTransactionRow'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { asLogoRef, asNonEmptyText, asNumber, asText } from '../../slotReaders'\nimport { parseDueDate } from '../RepeatingTransactionBlock/weekStrip'\n\ninterface DebtsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n\ninterface PaymentRow {\n name: string\n account?: string\n amount?: number\n logo?: LogoRef\n}\n\n/** The first `series` row with a name, read through the shared slot readers; else undefined. */\nconst readPayment = (series: unknown): PaymentRow | undefined => {\n if (!Array.isArray(series)) return undefined\n for (const row of series) {\n if (typeof row !== 'object' || row === null) continue\n const { amount, logo, primary_text, secondary_text } = row as Record<string, unknown>\n const name = asNonEmptyText(primary_text)\n if (name) {\n return {\n name,\n account: asText(secondary_text),\n amount: asNumber(amount),\n logo: asLogoRef(logo),\n }\n }\n }\n return undefined\n}\n\n/** A label / value line under the payment row; the card's last line sits on the grey surface. */\nconst SummaryLine = ({ grey, label, value }: { grey?: boolean; label: string; value: string }) => (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: grey ? 'background.default' : 'background.paper',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.primary\" variant=\"subtitle2\">\n {label}\n </Text>\n <Text bold={true} color=\"text.primary\" variant=\"caption\">\n {value}\n </Text>\n </Stack>\n </>\n)\n\n/**\n * Debts component block: the Debt Payment Reminder card (Figma 1943:219556). One bordered card:\n *\n * - the upcoming payment, from `data.series[0]`: `logo`, `primary_text` (payment name),\n * `secondary_text` (account name) and `amount` (the payment);\n * - \"Payment due on\" with `data.due_date` (ISO day, shown as \"September 15\");\n * - \"Minimum payment\" with `data.minimum_payment`, only when ditto sends one (Figma \"Has Minimum\n * Payment\"; \"No Minimum Payment\" omits the line);\n * - the account balance, `data.amount`.\n *\n * The last line drawn sits on the grey surface: the balance on full, the due date on mini (whose\n * Figma draws the due date alone).\n *\n * The captions come from `insights_feed.debts_block` (`payment_due_label`, `minimum_payment_label`,\n * `balance_label`). A line whose caption has not shipped, or whose value is missing or invalid, is\n * left out rather than drawn unlabelled or blank; a missing caption for a line that has a value\n * also warns once, naming the key. With no payment row there is no card.\n */\nconst DebtsBlock = ({ payload }: DebtsBlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.debts_block\n const dueLabel = copy?.payment_due_label\n const minimumLabel = copy?.minimum_payment_label\n const balanceLabel = copy?.balance_label\n\n // Backend data is untrusted: every value goes through the shared slot readers before use.\n const data = payload.instance_slot?.data\n const payment = readPayment(slot(data, 'series'))\n const dueDateIso = asText(slot(data, 'due_date'))\n const dueDate = dueDateIso ? parseDueDate(dueDateIso) : null\n const minimum = asNumber(slot(data, 'minimum_payment'))\n const balance = asNumber(slot(data, 'amount'))\n const hasPayment = payment !== undefined\n\n // Only the captions for lines this card has a value to draw (mini sends no balance).\n const missingKeys = [\n dueDate && !dueLabel && 'payment_due_label',\n minimum !== undefined && !minimumLabel && 'minimum_payment_label',\n balance !== undefined && !balanceLabel && 'balance_label',\n ]\n .filter(Boolean)\n .join(', ')\n\n useEffect(() => {\n if (hasPayment && missingKeys) {\n console.warn(`debts_block: copy missing ${missingKeys}; hiding those lines`)\n }\n }, [hasPayment, missingKeys])\n\n if (!payment) return null\n\n // Figma's order; the last line drawn sits on the grey surface.\n const lines = [\n dueLabel && dueDate\n ? { label: dueLabel, value: formatDate(dueDate, DATE_FORMATS_INTL.FULL_MONTH_DAY) }\n : null,\n minimumLabel && minimum !== undefined\n ? { label: minimumLabel, value: formatCurrency(minimum, CURRENCY_FORMAT.cents) }\n : null,\n balanceLabel && balance !== undefined\n ? { label: balanceLabel, value: formatCurrency(balance, CURRENCY_FORMAT.cents) }\n : null,\n ].filter((line): line is { label: string; value: string } => line !== null)\n\n return (\n <Stack sx={{ px: 16 }}>\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n width: '100%',\n }}\n >\n <InsightTransactionRow\n amount={\n payment.amount === undefined\n ? ''\n : formatCurrency(payment.amount, CURRENCY_FORMAT.cents)\n }\n leading={<LogoFromGuid logo={payment.logo} size={ROW_LOGO_SIZE} />}\n subtitle={payment.account ?? ''}\n title={payment.name}\n />\n {lines.map((line, index) => (\n <SummaryLine\n grey={index === lines.length - 1}\n key={line.label}\n label={line.label}\n value={line.value}\n />\n ))}\n </Stack>\n </Stack>\n )\n}\n\n// observer: the captions come from the copy store, which can load or change after the first render.\nexport default observer(DebtsBlock)\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAM,IAAgB,IAUhB,IAAA,CAAe,MAA4C;AAC/D,MAAK,MAAM,QAAQ,CAAM;AACzB,eAAW,KAAO,GAAQ;AACxB,UAAI,OAAO,KAAQ,YAAY,MAAQ,KAAM;AAC7C,YAAM,EAAE,QAAA,GAAQ,MAAA,GAAM,cAAA,GAAc,gBAAA,EAAA,IAAmB,GACjD,IAAO,EAAe,CAAY;AACxC,UAAI,EACF,QAAO;AAAA,QACL,MAAA;AAAA,QACA,SAAS,EAAO,CAAc;AAAA,QAC9B,QAAQ,EAAS,CAAM;AAAA,QACvB,MAAM,EAAU,CAAI;AAAA,MACtB;AAAA,IAEJ;AAEF,GAGM,IAAA,CAAe,EAAE,MAAA,GAAM,OAAA,GAAO,OAAA,EAAA,MAClC,gBAAA,EAAA,GA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BlocksKey.es.js";
5
5
  import Z from "../../../components/LogoFromGuid.es.js";
6
6
  import { ConfettiOverlay as N } from "../../../components/shared/ConfettiOverlay.es.js";
7
- import { SMALL_CARD_SHADOW as U } from "../../../components/shared/elevation.es.js";
8
- import V from "../../../components/LogoTile.es.js";
9
- import { LinedCardZeroState as j } from "../../../../insights/components/shared/ZeroState/LinedCardZeroState.es.js";
7
+ import U from "../../../components/LogoTile.es.js";
8
+ import { LinedCardZeroState as V } from "../../../../insights/components/shared/ZeroState/LinedCardZeroState.es.js";
9
+ import { SMALL_CARD_SHADOW as j } from "../../../components/shared/elevation.es.js";
10
10
  import { useEffect as E, useState as H } from "react";
11
11
  import { observer as A } from "mobx-react-lite";
12
12
  import a from "@mui/material/Stack";
@@ -33,7 +33,7 @@ var X = 3e3, z = 32, T = {
33
33
  ...q(o, e),
34
34
  alt: ""
35
35
  };
36
- return /* @__PURE__ */ r(V, {
36
+ return /* @__PURE__ */ r(U, {
37
37
  borderColor: null,
38
38
  borderRadius: 4,
39
39
  size: z,
@@ -53,7 +53,7 @@ var X = 3e3, z = 32, T = {
53
53
  backdropFilter: o ? void 0 : "blur(6px)",
54
54
  bgcolor: (t) => o ? "success.main" : _(t.palette.common.black, 0.5),
55
55
  borderRadius: "8px",
56
- boxShadow: o ? U : void 0,
56
+ boxShadow: o ? j : void 0,
57
57
  color: o ? "success.contrastText" : "common.white",
58
58
  gap: 18,
59
59
  inset: 16,
@@ -130,7 +130,7 @@ var X = 3e3, z = 32, T = {
130
130
  s
131
131
  ]), E(() => {
132
132
  t || console.warn("quiz_block: copy namespace missing; rendering without its labels");
133
- }, [t]), !m.length) return /* @__PURE__ */ r(j, {});
133
+ }, [t]), !m.length) return /* @__PURE__ */ r(V, {});
134
134
  if (k) {
135
135
  const n = (i) => f({
136
136
  guid: o,
@@ -1,16 +1,16 @@
1
- import { useGlobalCopyStore as b } from "../../../../common/context/hooks.es.js";
2
- import { CURRENCY_FORMAT as u, formatCurrency as y } from "../../../../core/utils/NumberFormatting.es.js";
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 w, slotOrFlat as m } from "../../slotReaders.es.js";
6
- import { ReactComponent as C } from "../../../components/shared/images/SaveEnoughToLiveOnBottom.es.js";
7
- import { ReactComponent as S } from "../../../components/shared/images/SaveEnoughToLiveOnTop.es.js";
8
- import { SAVINGS_SUMMARY_LAYOUT as R, savingsSummaryBlockVariant as T } from "./layout.es.js";
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 A, Text as g } from "@mxenabled/mxui";
11
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
12
- import I from "@mui/material/Box";
13
- var v = ({ label: i, amount: o }) => /* @__PURE__ */ r(n, {
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, u.whole)
33
+ children: y(o)
34
34
  })]
35
- }), U = ({ payload: i }) => {
36
- const o = b().insights_feed?.make_transfer, s = o?.available_balances_text, l = o?.average_monthly_spend_text, { instance_slot: t = {} } = i, { showCalendar: a } = _(R, t.variant, T.NoIllustration, "SavingsSummaryBlock"), d = f(m(t, "available_balance")), c = f(m(t, "avg_monthly_spend")), p = w(m(t, "time_period")), x = !!p;
37
- return !s || !l || d === void 0 || c === void 0 ? null : /* @__PURE__ */ r(n, {
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 ? 24 : 12,
40
+ gap: a ? 20 : 12,
41
41
  px: 16,
42
42
  width: "100%"
43
43
  },
44
- children: [(a || x) && /* @__PURE__ */ r(n, {
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: S
52
- }), x && /* @__PURE__ */ r(I, {
51
+ image: C
52
+ }), x && /* @__PURE__ */ t(A, {
53
53
  sx: {
54
54
  display: "grid",
55
- mt: a ? -60 : 0,
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: C
66
- }), /* @__PURE__ */ e(A, {
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__ */ r(n, {
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
- border: 1,
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
- U as default
98
+ O as default
100
99
  };
101
100
 
102
101
  //# sourceMappingURL=SavingsSummaryBlock.es.js.map
@@ -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 { CURRENCY_FORMAT, formatCurrency } 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 {formatCurrency(amount, CURRENCY_FORMAT.whole)}\n </Text>\n </Stack>\n)\n\nconst SavingsSummaryBlock = ({ payload }: BlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.make_transfer\n const balanceLabel = copy?.available_balances_text\n const spendLabel = copy?.average_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 ? 24 : 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 ? -60 : 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 border: 1,\n borderColor: '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,EACE,WAAU;AAAA,EACV,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAI,gBAAgB;AAAA,IAAiB,WAAW;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAF9F,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAK,SAAQ;AAAA,IACjD,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,OAAM;AAAA,IAAe,WAAU;AAAA,IAAK,IAAI,EAAE,GAAG,EAAE;AAAA,IAAG,SAAQ;AAAA,IACzE,UAAA,EAAe,GAAQ,EAAgB,KAAK;AAAA,EACzC,CAAA,CACD;IAGH,IAAA,CAAuB,EAAE,SAAA,EAAA,MAA0B;AACvD,QAAM,IAAO,EAAmB,EAAE,eAAe,eAC3C,IAAe,GAAM,yBACrB,IAAa,GAAM,4BAEnB,EAAE,eAAA,IAAgB,CAAC,EAAA,IAAM,GACzB,EAAE,cAAA,EAAA,IAAiB,EACvB,GACA,EAAc,SACd,EAA2B,gBAC3B,qBACF,GACM,IAAU,EAAS,EAAW,GAAe,mBAAmB,CAAC,GACjE,IAAQ,EAAS,EAAW,GAAe,mBAAmB,CAAC,GAC/D,IAAa,EAAO,EAAW,GAAe,aAAa,CAAC,GAC5D,IAAgB,CAAC,CAAC;AAGxB,SAAI,CAAC,KAAgB,CAAC,KAAc,MAAY,UAAa,MAAU,SAC9D,OAIP,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,M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AAAA,MAAa,CAAA,CACnC;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
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,EACE,WAAU;AAAA,EACV,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAI,gBAAgB;AAAA,IAAiB,WAAW;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAF9F,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,IAAM,O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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"}
@@ -10,8 +10,8 @@ import K, { isKnownIcon as J } from "../../../components/LogoMark.es.js";
10
10
  import { logoFromRef as Q } from "../../../components/shared/EntityLogo.es.js";
11
11
  import X from "../../../components/LogoFromGuid.es.js";
12
12
  import { statusIconName as oo, statusIconPalette as S } from "../../../components/statusIcon.es.js";
13
- import ro from "../../../components/TransactionListCard.es.js";
14
- import to from "../../../components/StatusMessageCard.es.js";
13
+ import ro from "../../../components/StatusMessageCard.es.js";
14
+ import to from "../../../components/TransactionListCard.es.js";
15
15
  import { subscriptionFrequency as eo } from "../../../components/SubscriptionStatus/subscriptionFrequency.es.js";
16
16
  import { getLayoutConfig as no, transactionBlockVariant as io } from "./layout.es.js";
17
17
  import { observer as ao } from "mobx-react-lite";
@@ -83,7 +83,7 @@ var c = 32, mo = Math.round(c * 0.625), uo = 24, T = 32, lo = 20, go = ({ icon:
83
83
  }) : void 0, y = !!l && _?.user_response === V.CONFIRMED;
84
84
  if (M) {
85
85
  const r = a(n, "message");
86
- return typeof r != "string" || !r.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ t(to, {
86
+ return typeof r != "string" || !r.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ t(ro, {
87
87
  icon: /* @__PURE__ */ t(g, {
88
88
  "aria-hidden": "true",
89
89
  sx: { display: "flex" },
@@ -105,7 +105,7 @@ var c = 32, mo = Math.round(c * 0.625), uo = 24, T = 32, lo = 20, go = ({ icon:
105
105
  label: b,
106
106
  amount: C(Z, x.cents)
107
107
  } : void 0, j = p ? eo(o, _) : void 0, q = l ? /* @__PURE__ */ t(go, { icon: I(a(n, y ? "reviewed_icon" : "icon")) }) : void 0, v = (r) => !!O && typeof r == "number" && r > 0;
108
- return /* @__PURE__ */ t(ro, {
108
+ return /* @__PURE__ */ t(to, {
109
109
  background: y && f ? f : u,
110
110
  badge: q,
111
111
  elevated: A,
@@ -2,7 +2,6 @@ export * from './blocks';
2
2
  export { default as AccountHeroCard } from './components/AccountHeroCard';
3
3
  export { default as ConnectionDetailDrillDown, type ConnectionDetailContent, } from './components/ConnectionDetailDrillDown';
4
4
  export { default as DirectDepositCard, type DirectDepositCardStyleProps, type DirectDepositPillConfig, } from './components/DirectDepositCard';
5
- export { default as DebtPayoffCard, type DebtPayoffCardStyleProps, type DebtPayoffPillConfig, type DebtPayoffStat, } from './components/DebtPayoffCard';
6
5
  export { default as GoalProgressCard, type GoalProgressCardStyleProps, type GoalProgressPillConfig, type GoalProgressRow, } from './components/GoalProgressCard';
7
6
  export { default as AmountPill } from './components/AmountPill';
8
7
  export { default as AmountBreakdownCard, type AmountBreakdownCardProps, type AmountBreakdownRow, type AmountBreakdownTotal, } from './components/AmountBreakdownCard';