@mx-cartographer/experiences 9.7.36 → 9.7.37
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 +4 -0
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +4 -0
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +54 -48
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +5 -0
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +17 -12
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [9.7.37] - 10-23-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - `with_header_footer` variant for the insights-v2 `TransactionBlock`: a date header above the rows plus a footer/summary row (`data.footer_text` + `data.footer_amount`, formatted as currency) rendered through `TransactionListCard` — used by Replenish Savings' "Remaining Balance". Adds `showFooter` to the layout config, with mock payload/beats, a Storybook story and tests (WEC-2106)
|
|
4
|
+
|
|
1
5
|
## [9.7.36] - 10-23-2026
|
|
2
6
|
|
|
3
7
|
- **ADDED** - `budget_details_block` action block: the "View Budget" drawer for the Category Budget, Merchant Budget and Category Spending V2 beats, with spent against the limit, the tier bar and Edit / Delete / Create Budget. Copy from the new `insights_feed.budget_details` namespace (MEW2-3362)
|
|
@@ -19,6 +19,10 @@ interface TransactionBlockProps {
|
|
|
19
19
|
* transaction date, or "{count} transactions"). It deliberately does *not* come from the first
|
|
20
20
|
* row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here
|
|
21
21
|
* rendered the category twice and dropped the date entirely.
|
|
22
|
+
*
|
|
23
|
+
* A footer/summary row (Replenish Savings' "Remaining Balance") renders under the
|
|
24
|
+
* `with_header_footer` variant, from `data.footer_text` with `data.footer_amount` beside it,
|
|
25
|
+
* formatted like the row amounts (the contract sends it as a number).
|
|
22
26
|
*/
|
|
23
27
|
export declare const TransactionBlock: (({ payload }: TransactionBlockProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
24
28
|
displayName: string;
|
|
@@ -1,89 +1,95 @@
|
|
|
1
|
-
import { useCategoryStore as
|
|
2
|
-
import { slot as
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import { logoFromRef as
|
|
5
|
-
import
|
|
6
|
-
import { resolveVariantConfig as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { getLayoutConfig as
|
|
10
|
-
import { observer as
|
|
11
|
-
import { CategoryIcon as
|
|
12
|
-
import { Icon as
|
|
1
|
+
import { useCategoryStore as I } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { slot as i } from "../../../../core/types/Insights.es.js";
|
|
3
|
+
import { formatCurrency as g } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { logoFromRef as T } from "../../../components/shared/EntityLogo.es.js";
|
|
5
|
+
import G from "../../../components/LogoFromGuid.es.js";
|
|
6
|
+
import { resolveVariantConfig as L } from "../../resolveVariantConfig.es.js";
|
|
7
|
+
import S from "../../../components/TransactionListCard.es.js";
|
|
8
|
+
import O from "../../../components/StatusMessageCard.es.js";
|
|
9
|
+
import { getLayoutConfig as b, transactionBlockVariant as k } from "./layout.es.js";
|
|
10
|
+
import { observer as z } from "mobx-react-lite";
|
|
11
|
+
import { CategoryIcon as B, InstitutionLogo as A, MerchantLogo as M } from "@mxenabled/mxui";
|
|
12
|
+
import { Icon as R } from "@mxenabled/mx-icons";
|
|
13
13
|
import { jsx as o } from "react/jsx-runtime";
|
|
14
|
-
import { useTheme as
|
|
14
|
+
import { useTheme as E } from "@mui/material/styles";
|
|
15
15
|
import c from "@mui/material/Box";
|
|
16
|
-
var
|
|
17
|
-
const t =
|
|
16
|
+
var n = 32, F = Math.round(n * 0.625), N = 20, V = (a, s) => {
|
|
17
|
+
const t = T(a.logo, a.primary_text);
|
|
18
18
|
if (t) {
|
|
19
19
|
if (t.logo_name) return /* @__PURE__ */ o(c, {
|
|
20
20
|
sx: {
|
|
21
21
|
alignItems: "center",
|
|
22
22
|
display: "flex",
|
|
23
|
-
height:
|
|
23
|
+
height: n,
|
|
24
24
|
justifyContent: "center",
|
|
25
|
-
width:
|
|
25
|
+
width: n
|
|
26
26
|
},
|
|
27
|
-
children: /* @__PURE__ */ o(
|
|
27
|
+
children: /* @__PURE__ */ o(R, {
|
|
28
28
|
name: t.logo_name,
|
|
29
|
-
size:
|
|
29
|
+
size: F,
|
|
30
30
|
sx: { color: t.logo_color }
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
|
-
if (t.merchant_guid) return /* @__PURE__ */ o(
|
|
33
|
+
if (t.merchant_guid) return /* @__PURE__ */ o(M, {
|
|
34
34
|
alt: t.merchant_name ?? "",
|
|
35
|
-
categoryGuid: t.category_guid ?
|
|
35
|
+
categoryGuid: t.category_guid ? s(t.category_guid) : "",
|
|
36
36
|
merchantGuid: t.merchant_guid,
|
|
37
|
-
size:
|
|
37
|
+
size: n
|
|
38
38
|
});
|
|
39
|
-
if (t.institution_guid) return /* @__PURE__ */ o(
|
|
39
|
+
if (t.institution_guid) return /* @__PURE__ */ o(A, {
|
|
40
40
|
alt: t.institution_name ?? "",
|
|
41
41
|
institutionGuid: t.institution_guid,
|
|
42
|
-
size:
|
|
42
|
+
size: n
|
|
43
43
|
});
|
|
44
44
|
if (t.category_guid) {
|
|
45
|
-
const
|
|
45
|
+
const r = s(t.category_guid);
|
|
46
46
|
return /* @__PURE__ */ o(c, {
|
|
47
|
-
"data-testid": `category-icon-${
|
|
47
|
+
"data-testid": `category-icon-${r}`,
|
|
48
48
|
sx: { display: "flex" },
|
|
49
|
-
children: /* @__PURE__ */ o(
|
|
50
|
-
categoryGuid:
|
|
51
|
-
size:
|
|
49
|
+
children: /* @__PURE__ */ o(B, {
|
|
50
|
+
categoryGuid: r,
|
|
51
|
+
size: n
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
return typeof
|
|
56
|
+
}, tt = z(({ payload: a }) => {
|
|
57
|
+
const s = E(), { getTopLevelCategoryGuid: t } = I(), { data: r, variant: d } = a.instance_slot, { background: f, cardVariant: l, showFooter: _, showHeader: p, statusMessage: h } = L(b(s), d, k.NoHeader, "TransactionBlock");
|
|
58
|
+
if (h) {
|
|
59
|
+
const e = i(r, "message");
|
|
60
|
+
return typeof e != "string" || !e.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ o(O, {
|
|
61
61
|
icon: /* @__PURE__ */ o(c, {
|
|
62
62
|
"aria-hidden": "true",
|
|
63
63
|
sx: { display: "flex" },
|
|
64
|
-
children: /* @__PURE__ */ o(
|
|
65
|
-
logo:
|
|
66
|
-
size:
|
|
64
|
+
children: /* @__PURE__ */ o(G, {
|
|
65
|
+
logo: i(r, "icon"),
|
|
66
|
+
size: N
|
|
67
67
|
})
|
|
68
68
|
}),
|
|
69
|
-
message:
|
|
69
|
+
message: e
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
const m =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
const m = i(r, "series"), u = i(r, "header_text");
|
|
73
|
+
if (!Array.isArray(m) || !m.length) return null;
|
|
74
|
+
const y = p && typeof u == "string" ? u : void 0, x = i(r, "footer_text"), v = i(r, "footer_amount"), C = _ ? {
|
|
75
|
+
label: x,
|
|
76
|
+
amount: g(v, "0,0.00")
|
|
77
|
+
} : void 0;
|
|
78
|
+
return /* @__PURE__ */ o(S, {
|
|
79
|
+
background: f,
|
|
80
|
+
footer: C,
|
|
81
|
+
header: y,
|
|
76
82
|
variant: l,
|
|
77
|
-
rows: m.map((
|
|
78
|
-
amount: typeof
|
|
79
|
-
leading:
|
|
80
|
-
subtitle:
|
|
81
|
-
title:
|
|
83
|
+
rows: m.map((e) => ({
|
|
84
|
+
amount: typeof e.amount == "number" ? g(e.amount, "0,0.00") : "",
|
|
85
|
+
leading: V(e, t),
|
|
86
|
+
subtitle: e.secondary_text ?? "",
|
|
87
|
+
title: e.primary_text ?? ""
|
|
82
88
|
}))
|
|
83
89
|
});
|
|
84
90
|
});
|
|
85
91
|
export {
|
|
86
|
-
|
|
92
|
+
tt as TransactionBlock
|
|
87
93
|
};
|
|
88
94
|
|
|
89
95
|
//# sourceMappingURL=TransactionBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 20\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That applies both to a `CAT-`\n * row logo and to a merchant's `fallback_guid`, which `MerchantLogo` draws through the same\n * `CategoryIcon` when the merchant image fails to load.\n */\nconst renderRowLogo = (row: InstanceSlotRow, resolveTopLevelCategory: (guid: string) => string) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A fixed box the size of the other logos keeps the row's text column aligned.\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n }}\n >\n <Icon name={logo.logo_name} size={ROW_ICON_SIZE} sx={{ color: logo.logo_color }} />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const { background, cardVariant, showHeader, statusMessage } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n return (\n <TransactionListCard\n background={background}\n header={header}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n leading: renderRowLogo(row, getTopLevelCategoryGuid),\n sub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"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 20\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That applies both to a `CAT-`\n * row logo and to a merchant's `fallback_guid`, which `MerchantLogo` draws through the same\n * `CategoryIcon` when the merchant image fails to load.\n */\nconst renderRowLogo = (row: InstanceSlotRow, resolveTopLevelCategory: (guid: string) => string) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A fixed box the size of the other logos keeps the row's text column aligned.\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n }}\n >\n <Icon name={logo.logo_name} size={ROW_ICON_SIZE} sx={{ color: logo.logo_color }} />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\") renders under the\n * `with_header_footer` variant, from `data.footer_text` with `data.footer_amount` beside it,\n * formatted like the row amounts (the contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const { background, cardVariant, showFooter, showHeader, statusMessage } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer = showFooter\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n return (\n <TransactionListCard\n background={background}\n footer={footer}\n header={header}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n leading: renderRowLogo(row, getTopLevelCategoryGuid),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAM,IAAgB,IAEhB,IAAgB,KAAK,MAAM,IAAgB,KAAK,GAChD,IAAmB,IAanB,IAAA,CAAiB,GAAsB,MAAsD;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
|
|
@@ -4,6 +4,8 @@ import { Theme } from '@mui/material/styles';
|
|
|
4
4
|
* pre-localized rows through `TransactionListCard`; only the header and the slot differ.
|
|
5
5
|
*
|
|
6
6
|
* - `WithHeader` — row under a date header (Fee Detected, Large Transaction).
|
|
7
|
+
* - `WithHeaderFooter` — date header above the rows plus the footer/summary row from
|
|
8
|
+
* `data.footer_text` / `data.footer_amount` (Replenish Savings' "Remaining Balance").
|
|
7
9
|
* - `NoHeader` — the row alone (Large Transaction without a merchant).
|
|
8
10
|
* - `UncategorizedTransaction` — filled primary header ("{count} transactions").
|
|
9
11
|
* - `InfoWash` — borderless row on the blue slot wash (e.g. Subscription Detected).
|
|
@@ -14,6 +16,7 @@ import { Theme } from '@mui/material/styles';
|
|
|
14
16
|
*/
|
|
15
17
|
export declare const transactionBlockVariant: {
|
|
16
18
|
readonly WithHeader: "with_header";
|
|
19
|
+
readonly WithHeaderFooter: "with_header_footer";
|
|
17
20
|
readonly NoHeader: "no_header";
|
|
18
21
|
readonly UncategorizedTransaction: "uncategorized_transaction";
|
|
19
22
|
readonly InfoWash: "info_wash";
|
|
@@ -24,6 +27,8 @@ export type TransactionBlockVariant = (typeof transactionBlockVariant)[keyof typ
|
|
|
24
27
|
export interface TransactionLayoutConfig {
|
|
25
28
|
/** Show `instance_slot.data.header_text` above the rows. */
|
|
26
29
|
showHeader: boolean;
|
|
30
|
+
/** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */
|
|
31
|
+
showFooter?: boolean;
|
|
27
32
|
/** `TransactionListCard` style: grey utility header, or filled primary header. */
|
|
28
33
|
cardVariant?: 'default' | 'primary';
|
|
29
34
|
/** CSS background for the slot behind the card; the card then renders borderless on paper. */
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import { WARNING_WASH_GRADIENT as r, getPrimaryWashGradient as
|
|
2
|
-
var
|
|
1
|
+
import { WARNING_WASH_GRADIENT as r, getPrimaryWashGradient as t } from "../../../components/celebrationGradients.es.js";
|
|
2
|
+
var e = {
|
|
3
3
|
WithHeader: "with_header",
|
|
4
|
+
WithHeaderFooter: "with_header_footer",
|
|
4
5
|
NoHeader: "no_header",
|
|
5
6
|
UncategorizedTransaction: "uncategorized_transaction",
|
|
6
7
|
InfoWash: "info_wash",
|
|
7
8
|
WarningWash: "warning_wash",
|
|
8
9
|
StatusMessage: "status_message"
|
|
9
|
-
},
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
|
|
10
|
+
}, s = (a) => ({
|
|
11
|
+
[e.WithHeader]: { showHeader: !0 },
|
|
12
|
+
[e.WithHeaderFooter]: {
|
|
13
|
+
showHeader: !0,
|
|
14
|
+
showFooter: !0
|
|
15
|
+
},
|
|
16
|
+
[e.NoHeader]: { showHeader: !1 },
|
|
17
|
+
[e.UncategorizedTransaction]: {
|
|
13
18
|
showHeader: !0,
|
|
14
19
|
cardVariant: "primary"
|
|
15
20
|
},
|
|
16
|
-
[
|
|
21
|
+
[e.InfoWash]: {
|
|
17
22
|
showHeader: !1,
|
|
18
|
-
background:
|
|
23
|
+
background: t(a)
|
|
19
24
|
},
|
|
20
|
-
[
|
|
25
|
+
[e.WarningWash]: {
|
|
21
26
|
showHeader: !1,
|
|
22
27
|
background: r
|
|
23
28
|
},
|
|
24
|
-
[
|
|
29
|
+
[e.StatusMessage]: {
|
|
25
30
|
showHeader: !1,
|
|
26
31
|
statusMessage: !0
|
|
27
32
|
}
|
|
28
33
|
});
|
|
29
34
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
s as getLayoutConfig,
|
|
36
|
+
e as transactionBlockVariant
|
|
32
37
|
};
|
|
33
38
|
|
|
34
39
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport {\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — borderless row on the blue slot wash (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n NoHeader: 'no_header',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card then renders borderless on paper. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n [transactionBlockVariant.WithHeader]: { showHeader: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n },\n [transactionBlockVariant.StatusMessage]: { showHeader: false, statusMessage: true },\n})\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport {\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — borderless row on the blue slot wash (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n WithHeaderFooter: 'with_header_footer',\n NoHeader: 'no_header',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */\n showFooter?: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card then renders borderless on paper. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n [transactionBlockVariant.WithHeader]: { showHeader: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n },\n [transactionBlockVariant.StatusMessage]: { showHeader: false, statusMessage: true },\n})\n"],"mappings":";AAsBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAmBa,IAAA,CACX,OAC8D;AAAA,EAC7D,CAAA,EAAwB,UAAA,GAAa,EAAE,YAAY,GAAK;AAAA,EACxD,CAAA,EAAwB,gBAAA,GAAmB;AAAA,IAAE,YAAY;AAAA,IAAM,YAAY;AAAA,EAAK;AAAA,EAChF,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,EAC1C;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IAAE,YAAY;AAAA,IAAO,eAAe;AAAA,EAAK;AACpF"}
|