@mx-cartographer/experiences 9.7.88 → 9.7.89
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 +5 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +4 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +103 -90
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +8 -0
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +12 -4
- 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,8 @@
|
|
|
1
|
+
## [9.7.89] - 11-03-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Weekly New Merchants V3 on Insights 2.0 (WEC-2189): a flat-`series` `with_footer` variant on `transaction_block` (rows plus the `data.footer_text` / `data.footer_amount` "Total" summary, no in-card header — the week date range is the card subtitle) for the multiple case; the single case reuses the existing `no_header` variant, which renders the same. The block already renders N rows and the footer generically, so this is `layout.ts` config only; tupac fills the row array and the money-bag "Others" row via `$facts.transactions_series`. An `ICO-` row logo (the money-bag "Others" overflow) now renders as a rounded `chart.chart2` accent tile - background at 15% opacity with a full-colour glyph, per the MX accent-icon pattern and Figma - instead of a bare icon. Block tests for both variants, a `TransactionBlock` Storybook page, and a `WeeklyNewMerchantsV3` insight story (`no_header` single, `with_footer` multiple with the "Others" overflow row)
|
|
4
|
+
- **CHANGED** - `transaction_block` can tint a `CAT-` row logo as the Budget-style `CategoryIcon` tile (category colour at 15% opacity, a 1px category-colour border and a `text.primary` glyph), matching Figma. It is opt-in per layout variant (`tintedCategoryLogo`, set on `with_header` for Replenish Savings' multi-account Transfer row), so other beats' category logos are unchanged. Replenish Savings' multi-account gets a new `with_header` `TransactionBlock` Storybook story (WEC-2189)
|
|
5
|
+
|
|
1
6
|
## [9.7.88] - 11-03-2026
|
|
2
7
|
|
|
3
8
|
- **ADDED** - Insights 2.0 `runInDescriptionCta({ beat, stores, hostActions })` for a pinned beat's auto-open (the external flow): runs the micro card action's `action_key` step and opens its block per the runner's rules, with no press analytics, first click or post message. A presenter step acts only while unanswered (an answered subscription opens nothing; its card shows the status), and `atomic_flow` runs with no drawer. It never rejects (failures are reported) and leaves a pending press or an open drawer alone. pulse calls it from `useOpenPinnedInsightAction` (WEC-2017)
|
|
@@ -56,7 +61,6 @@
|
|
|
56
61
|
- **CHANGED** - `StatusMessageCard` now always draws the elevation/1 shadow, as in Figma (WEC-2155)
|
|
57
62
|
- **FIXED** - `StatusMessageCard` message is readable in dark mode: the banner uses `success.lighter` and `text.primary`, as in Figma (WEC-2155)
|
|
58
63
|
- **FIXED** - Payday Cash Left Over Status money icon is 24px on both the on-track and off-track tiles and the Remaining Cash drawer rows are 64px tall, matching Figma; the tiles and drawer are shared, so Monthly Obligations Status changes too (WEC-2156)
|
|
59
|
-
|
|
60
64
|
## [9.7.77] - 11-02-2026
|
|
61
65
|
|
|
62
66
|
- **FIXED** - The Net Worth monthly table now shows the full number of months for the 6M and 9M timeframe selections; it previously dropped one month in certain calendar months (MEW-4195)
|
|
@@ -20,9 +20,10 @@ interface TransactionBlockProps {
|
|
|
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
22
|
*
|
|
23
|
-
* A footer/summary row (Replenish Savings' "Remaining Balance"
|
|
24
|
-
*
|
|
25
|
-
* formatted like the row amounts (the
|
|
23
|
+
* A footer/summary row (Replenish Savings' "Remaining Balance", Weekly New Merchants' "Total")
|
|
24
|
+
* renders when the variant's `showFooter` config is set (`with_header_footer`, `with_footer`), from
|
|
25
|
+
* `data.footer_text` with `data.footer_amount` beside it, formatted like the row amounts (the
|
|
26
|
+
* contract sends it as a number).
|
|
26
27
|
*/
|
|
27
28
|
export declare const TransactionBlock: (({ payload }: TransactionBlockProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
28
29
|
displayName: string;
|
|
@@ -1,132 +1,145 @@
|
|
|
1
|
-
import { useCategoryStore as
|
|
2
|
-
import { slot as
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { useCategoryStore as $, useGlobalCopyStore as j, useGlobalStore as q } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { slot as s } from "../../../../core/types/Insights.es.js";
|
|
3
|
+
import { formatCurrency as v } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { getCategoryColor as C } from "../../../../core/utils/CategoryUtil.es.js";
|
|
5
|
+
import { useBeatActions as D } from "../../../beatActions.es.js";
|
|
6
|
+
import { USER_RESPONSE as H, repeatingTransactionOf as P } from "../../../ctaActions/subscriptionAnswer.es.js";
|
|
7
|
+
import { logoFromRef as V } from "../../../components/shared/EntityLogo.es.js";
|
|
8
|
+
import U from "../../../components/LogoFromGuid.es.js";
|
|
9
|
+
import { statusIconName as W, statusIconPalette as I } from "../../../components/statusIcon.es.js";
|
|
10
|
+
import { resolveVariantConfig as Y } from "../../resolveVariantConfig.es.js";
|
|
11
|
+
import J from "../../../components/TransactionListCard.es.js";
|
|
12
|
+
import K from "../../../components/StatusMessageCard.es.js";
|
|
13
|
+
import { subscriptionFrequency as Q } from "../../../components/SubscriptionStatus/subscriptionFrequency.es.js";
|
|
14
|
+
import { getLayoutConfig as X, transactionBlockVariant as oo } from "./layout.es.js";
|
|
15
|
+
import { observer as to } from "mobx-react-lite";
|
|
16
|
+
import { CategoryIcon as ro, InstitutionLogo as eo, MerchantLogo as io } from "@mxenabled/mxui";
|
|
17
|
+
import { Icon as T } from "@mxenabled/mx-icons";
|
|
17
18
|
import { jsx as t } from "react/jsx-runtime";
|
|
18
|
-
import { useTheme as
|
|
19
|
-
import
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
return
|
|
19
|
+
import { alpha as S, useTheme as no } from "@mui/material/styles";
|
|
20
|
+
import d from "@mui/material/Box";
|
|
21
|
+
var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon: a }) => {
|
|
22
|
+
const i = W(a?.guid);
|
|
23
|
+
return i ? /* @__PURE__ */ t(d, {
|
|
23
24
|
"aria-hidden": !0,
|
|
24
|
-
"data-icon":
|
|
25
|
+
"data-icon": i,
|
|
25
26
|
"data-testid": "subscription-badge",
|
|
26
27
|
sx: {
|
|
27
28
|
alignItems: "center",
|
|
28
|
-
bgcolor: `${
|
|
29
|
+
bgcolor: `${I(a?.color)}.main`,
|
|
29
30
|
borderRadius: "50%",
|
|
30
31
|
display: "flex",
|
|
31
|
-
height:
|
|
32
|
+
height: G,
|
|
32
33
|
justifyContent: "center",
|
|
33
|
-
width:
|
|
34
|
+
width: G
|
|
34
35
|
},
|
|
35
|
-
children: /* @__PURE__ */ t(
|
|
36
|
+
children: /* @__PURE__ */ t(T, {
|
|
36
37
|
fill: !0,
|
|
37
|
-
name:
|
|
38
|
-
size:
|
|
39
|
-
sx: { color: `${
|
|
38
|
+
name: i,
|
|
39
|
+
size: co,
|
|
40
|
+
sx: { color: `${I(a?.color)}.contrastText` }
|
|
40
41
|
})
|
|
41
42
|
}) : null;
|
|
42
|
-
},
|
|
43
|
-
const o =
|
|
43
|
+
}, lo = (a, i, c, l) => {
|
|
44
|
+
const o = V(a.logo, a.primary_text);
|
|
44
45
|
if (o) {
|
|
45
|
-
if (o.logo_name)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
if (o.logo_name) {
|
|
47
|
+
const e = !!o.logo_fill, r = o.logo_color ?? c.palette.chart.chart2 ?? c.palette.primary.main;
|
|
48
|
+
return /* @__PURE__ */ t(d, {
|
|
49
|
+
sx: {
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
display: "flex",
|
|
52
|
+
height: u,
|
|
53
|
+
justifyContent: "center",
|
|
54
|
+
width: u,
|
|
55
|
+
...e && {
|
|
56
|
+
bgcolor: S(r, 0.15),
|
|
57
|
+
borderRadius: "8px"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
children: /* @__PURE__ */ t(T, {
|
|
61
|
+
name: o.logo_name,
|
|
62
|
+
size: ao,
|
|
63
|
+
sx: { color: e ? r : o.logo_color }
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (o.merchant_guid) return /* @__PURE__ */ t(io, {
|
|
60
68
|
alt: o.merchant_name ?? "",
|
|
61
|
-
categoryGuid: o.category_guid ?
|
|
69
|
+
categoryGuid: o.category_guid ? i(o.category_guid) : "",
|
|
62
70
|
merchantGuid: o.merchant_guid,
|
|
63
|
-
size:
|
|
71
|
+
size: u
|
|
64
72
|
});
|
|
65
|
-
if (o.institution_guid) return /* @__PURE__ */ t(
|
|
73
|
+
if (o.institution_guid) return /* @__PURE__ */ t(eo, {
|
|
66
74
|
alt: o.institution_name ?? "",
|
|
67
75
|
institutionGuid: o.institution_guid,
|
|
68
|
-
size:
|
|
76
|
+
size: u
|
|
69
77
|
});
|
|
70
78
|
if (o.category_guid) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
const e = i(o.category_guid), r = l ? {
|
|
80
|
+
bgcolor: S(C(e, c), 0.15),
|
|
81
|
+
border: `1px solid ${C(e, c)}`,
|
|
82
|
+
color: "text.primary"
|
|
83
|
+
} : void 0;
|
|
84
|
+
return /* @__PURE__ */ t(d, {
|
|
85
|
+
"data-testid": `category-icon-${e}`,
|
|
74
86
|
sx: { display: "flex" },
|
|
75
|
-
children: /* @__PURE__ */ t(
|
|
76
|
-
categoryGuid:
|
|
77
|
-
size:
|
|
87
|
+
children: /* @__PURE__ */ t(ro, {
|
|
88
|
+
categoryGuid: e,
|
|
89
|
+
size: u,
|
|
90
|
+
sx: r
|
|
78
91
|
})
|
|
79
92
|
});
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
|
-
},
|
|
83
|
-
const
|
|
84
|
-
beat:
|
|
85
|
-
stores:
|
|
86
|
-
}) : void 0,
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
89
|
-
return typeof
|
|
90
|
-
icon: /* @__PURE__ */ t(
|
|
95
|
+
}, Ro = to(({ payload: a }) => {
|
|
96
|
+
const i = no(), { getTopLevelCategoryGuid: c } = $(), l = q(), { recurring: o } = j(), { beat: e } = D(), { data: r, variant: E } = a.instance_slot, { answeredBackground: p, background: m, cardVariant: B, followsSubscription: g, raised: L, showFooter: k, showFrequency: y, showHeader: O, statusMessage: R, sx: A, tintedCategoryLogo: w } = Y(X(i), E, oo.NoHeader, "TransactionBlock"), _ = (y || g) && e ? P({
|
|
97
|
+
beat: e,
|
|
98
|
+
stores: l
|
|
99
|
+
}) : void 0, h = !!g && _?.user_response === H.CONFIRMED;
|
|
100
|
+
if (R) {
|
|
101
|
+
const n = s(r, "message");
|
|
102
|
+
return typeof n != "string" || !n.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ t(K, {
|
|
103
|
+
icon: /* @__PURE__ */ t(d, {
|
|
91
104
|
"aria-hidden": "true",
|
|
92
105
|
sx: { display: "flex" },
|
|
93
|
-
children: /* @__PURE__ */ t(
|
|
94
|
-
logo:
|
|
95
|
-
size:
|
|
106
|
+
children: /* @__PURE__ */ t(U, {
|
|
107
|
+
logo: s(r, "icon"),
|
|
108
|
+
size: so
|
|
96
109
|
})
|
|
97
110
|
}),
|
|
98
|
-
message:
|
|
111
|
+
message: n,
|
|
99
112
|
sx: m ? {
|
|
100
113
|
backgroundImage: m,
|
|
101
114
|
bgcolor: "background.paper"
|
|
102
115
|
} : void 0
|
|
103
116
|
});
|
|
104
117
|
}
|
|
105
|
-
const
|
|
106
|
-
if (!Array.isArray(
|
|
107
|
-
const
|
|
108
|
-
label:
|
|
109
|
-
amount:
|
|
110
|
-
} : void 0,
|
|
111
|
-
return /* @__PURE__ */ t(
|
|
112
|
-
background:
|
|
113
|
-
badge:
|
|
114
|
-
footer:
|
|
115
|
-
header:
|
|
116
|
-
raised:
|
|
117
|
-
sx:
|
|
118
|
-
variant:
|
|
119
|
-
rows:
|
|
120
|
-
amount: typeof
|
|
121
|
-
amountCaption:
|
|
122
|
-
leading:
|
|
123
|
-
subtitle:
|
|
124
|
-
title:
|
|
118
|
+
const f = s(r, "series"), x = s(r, "header_text");
|
|
119
|
+
if (!Array.isArray(f) || !f.length) return null;
|
|
120
|
+
const z = O && typeof x == "string" ? x : void 0, b = s(r, "footer_text"), F = s(r, "footer_amount"), N = k && typeof b == "string" ? {
|
|
121
|
+
label: b,
|
|
122
|
+
amount: v(F, "0,0.00")
|
|
123
|
+
} : void 0, M = y ? Q(o, _) : void 0, Z = g ? /* @__PURE__ */ t(uo, { icon: s(r, h ? "reviewed_icon" : "icon") }) : void 0;
|
|
124
|
+
return /* @__PURE__ */ t(J, {
|
|
125
|
+
background: h && p ? p : m,
|
|
126
|
+
badge: Z,
|
|
127
|
+
footer: N,
|
|
128
|
+
header: z,
|
|
129
|
+
raised: L,
|
|
130
|
+
sx: A,
|
|
131
|
+
variant: B,
|
|
132
|
+
rows: f.map((n) => ({
|
|
133
|
+
amount: typeof n.amount == "number" ? v(n.amount, "0,0.00") : "",
|
|
134
|
+
amountCaption: M,
|
|
135
|
+
leading: lo(n, c, i, w ?? !1),
|
|
136
|
+
subtitle: n.secondary_text ?? "",
|
|
137
|
+
title: n.primary_text ?? ""
|
|
125
138
|
}))
|
|
126
139
|
});
|
|
127
140
|
});
|
|
128
141
|
export {
|
|
129
|
-
|
|
142
|
+
Ro as TransactionBlock
|
|
130
143
|
};
|
|
131
144
|
|
|
132
145
|
//# 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, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { statusIconName, statusIconPalette } from '../../../components/statusIcon'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf, USER_RESPONSE } from '../../../ctaActions/subscriptionAnswer'\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 = 24\n// Status badge: palette disc, contrastText glyph.\nconst BADGE_SIZE = 32\nconst BADGE_GLYPH_SIZE = 20\n\n/** Status disc from `data.icon` / `data.reviewed_icon`. */\nconst SubscriptionBadge = ({ icon }: { icon?: LogoRef }) => {\n const name = statusIconName(icon?.guid)\n\n if (!name) return null\n\n return (\n <Box\n aria-hidden={true}\n data-icon={name}\n data-testid=\"subscription-badge\"\n sx={{\n alignItems: 'center',\n bgcolor: `${statusIconPalette(icon?.color)}.main`,\n borderRadius: '50%',\n display: 'flex',\n height: BADGE_SIZE,\n justifyContent: 'center',\n width: BADGE_SIZE,\n }}\n >\n <Icon\n fill={true}\n name={name}\n size={BADGE_GLYPH_SIZE}\n sx={{ color: `${statusIconPalette(icon?.color)}.contrastText` }}\n />\n </Box>\n )\n}\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 stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\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 {\n answeredBackground,\n background,\n cardVariant,\n followsSubscription,\n raised,\n showFooter,\n showFrequency,\n showHeader,\n statusMessage,\n sx,\n } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n // The live repeating transaction (read-only), for the frequency and the badge / answered wash.\n const repeating =\n (showFrequency || followsSubscription) && beat\n ? repeatingTransactionOf({ beat, stores })\n : undefined\n const subscribed = !!followsSubscription && repeating?.user_response === USER_RESPONSE.CONFIRMED\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 // The 20% wash layers over paper, as Figma's slot does.\n sx={background ? { backgroundImage: background, bgcolor: 'background.paper' } : undefined}\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 // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency = showFrequency ? subscriptionFrequency(recurringCopy, repeating) : undefined\n const badge = followsSubscription ? (\n <SubscriptionBadge icon={slot<LogoRef>(data, subscribed ? 'reviewed_icon' : 'icon')} />\n ) : undefined\n\n return (\n <TransactionListCard\n background={subscribed && answeredBackground ? answeredBackground : background}\n badge={badge}\n footer={footer}\n header={header}\n raised={raised}\n sx={sx}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,IAAM,IAAgB,IAEhB,KAAgB,KAAK,MAAM,IAAgB,KAAK,GAChD,KAAmB,IAEnB,IAAa,IACb,KAAmB,IAGnB,KAAA,CAAqB,EAAE,MAAA,EAAA,MAA+B;AAC1D,QAAM,IAAO,EAAe,GAAM,IAAI;AAEtC,SAAK,IAGH,gBAAA,EAAC,GAAD;AAAA,IACE,eAAa;AAAA,IACb,aAAW;AAAA,IACX,eAAY;AAAA,IACZ,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,SAAS,GAAG,EAAkB,GAAM,KAAK,CAAA;AAAA,MACzC,cAAc;AAAA,MACd,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACA,MAAA;AAAA,MACN,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,GAAG,EAAkB,GAAM,KAAK,CAAA,gBAAiB;AAAA,IAC/D,CAAA;AAAA,EACE,CAAA,IAvBW;AAyBpB,GAaM,KAAA,CAAiB,GAAsB,MAAsD;AACjG,QAAM,IAAO,EAAY,EAAI,MAAM,EAAI,YAAY;AAEnD,MAAK,GAEL;AAAA,QAAI,EAAK,UAEP,QACE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB,OAAO;AAAA,MACT;AAAA,MAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM,EAAK;AAAA,QAAW,MAAM;AAAA,QAAe,IAAI,EAAE,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T,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,eAAe;AAAA,MACf,SAAS,GAAc,GAAK,CAAuB;AAAA,MACnD,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
|
|
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 { alpha, useTheme } from '@mui/material/styles'\nimport type { Theme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { statusIconName, statusIconPalette } from '../../../components/statusIcon'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf, USER_RESPONSE } from '../../../ctaActions/subscriptionAnswer'\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 = 24\n// Status badge: palette disc, contrastText glyph.\nconst BADGE_SIZE = 32\nconst BADGE_GLYPH_SIZE = 20\n\n/** Status disc from `data.icon` / `data.reviewed_icon`. */\nconst SubscriptionBadge = ({ icon }: { icon?: LogoRef }) => {\n const name = statusIconName(icon?.guid)\n\n if (!name) return null\n\n return (\n <Box\n aria-hidden={true}\n data-icon={name}\n data-testid=\"subscription-badge\"\n sx={{\n alignItems: 'center',\n bgcolor: `${statusIconPalette(icon?.color)}.main`,\n borderRadius: '50%',\n display: 'flex',\n height: BADGE_SIZE,\n justifyContent: 'center',\n width: BADGE_SIZE,\n }}\n >\n <Icon\n fill={true}\n name={name}\n size={BADGE_GLYPH_SIZE}\n sx={{ color: `${statusIconPalette(icon?.color)}.contrastText` }}\n />\n </Box>\n )\n}\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 resolution applies both to a\n * `CAT-` row logo and to a merchant's `fallback_guid`. The tinted/bordered tile is opt-in per variant\n * (`tintedCategoryLogo`) and only styles the `CAT-` row branch; a merchant's `fallback_guid` is drawn\n * by `MerchantLogo`'s own untinted `CategoryIcon` fallback when the merchant image fails to load.\n */\nconst renderRowLogo = (\n row: InstanceSlotRow,\n resolveTopLevelCategory: (guid: string) => string,\n theme: Theme,\n tintedCategoryLogo: boolean,\n) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A `{ icon, color }` status logo (e.g. an overdraft warning) renders as a bare coloured glyph.\n // An ICO- fill logo (the Weekly New Merchants \"Others\" row - `logo_fill` is set for ICO- refs\n // only, in EntityLogo) renders as an accent tile: per the MX accent-icon pattern the background is\n // the tile colour at 15% opacity and the glyph is the full tile colour (Figma). The tile colour is\n // the logo's own colour when it carries one, else chart-2 - so tile and glyph always match.\n const accentTile = !!logo.logo_fill\n const tileColor = logo.logo_color ?? theme.palette.chart.chart2 ?? theme.palette.primary.main\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 ...(accentTile && {\n bgcolor: alpha(tileColor, 0.15),\n borderRadius: '8px',\n }),\n }}\n >\n <Icon\n name={logo.logo_name}\n size={ROW_ICON_SIZE}\n sx={{ color: accentTile ? tileColor : logo.logo_color }}\n />\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 // When the variant opts in (`tintedCategoryLogo`), the tile is the Budget-style accent: the\n // category colour at 15% opacity, a 1px category-colour border, and a `text.primary` glyph\n // (Figma - Replenish Savings' multi-account Transfer row). Otherwise mxui's default tile, so other\n // beats' category logos are unchanged.\n const tintSx = tintedCategoryLogo\n ? {\n bgcolor: alpha(getCategoryColor(topLevelGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(topLevelGuid, theme)}`,\n color: 'text.primary',\n }\n : undefined\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} sx={tintSx} />\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\", Weekly New Merchants' \"Total\")\n * renders when the variant's `showFooter` config is set (`with_header_footer`, `with_footer`), from\n * `data.footer_text` with `data.footer_amount` beside it, formatted like the row amounts (the\n * contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\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 {\n answeredBackground,\n background,\n cardVariant,\n followsSubscription,\n raised,\n showFooter,\n showFrequency,\n showHeader,\n statusMessage,\n sx,\n tintedCategoryLogo,\n } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n // The live repeating transaction (read-only), for the frequency and the badge / answered wash.\n const repeating =\n (showFrequency || followsSubscription) && beat\n ? repeatingTransactionOf({ beat, stores })\n : undefined\n const subscribed = !!followsSubscription && repeating?.user_response === USER_RESPONSE.CONFIRMED\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 // The 20% wash layers over paper, as Figma's slot does.\n sx={background ? { backgroundImage: background, bgcolor: 'background.paper' } : undefined}\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 =\n showFooter && typeof footerText === 'string'\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency = showFrequency ? subscriptionFrequency(recurringCopy, repeating) : undefined\n const badge = followsSubscription ? (\n <SubscriptionBadge icon={slot<LogoRef>(data, subscribed ? 'reviewed_icon' : 'icon')} />\n ) : undefined\n\n return (\n <TransactionListCard\n background={subscribed && answeredBackground ? answeredBackground : background}\n badge={badge}\n footer={footer}\n header={header}\n raised={raised}\n sx={sx}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid, theme, tintedCategoryLogo ?? false),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,IAAgB,IAEhB,KAAgB,KA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A,IACpF;AAEJ,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,YAAY,KAAc,IAAqB,IAAqB;AAAA,IAC7D,OAAA;AAAA,IACC,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACJ,IAAA;AAAA,IACJ,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,eAAe;AAAA,MACf,SAAS,GAAc,GAAK,GAAyB,GAAO,KAAsB,EAAK;AAAA,MACvF,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
|
|
@@ -19,6 +19,7 @@ export declare const transactionBlockVariant: {
|
|
|
19
19
|
readonly WithHeader: "with_header";
|
|
20
20
|
readonly WithHeaderFooter: "with_header_footer";
|
|
21
21
|
readonly NoHeader: "no_header";
|
|
22
|
+
readonly WithFooter: "with_footer";
|
|
22
23
|
readonly UncategorizedTransaction: "uncategorized_transaction";
|
|
23
24
|
readonly InfoWash: "info_wash";
|
|
24
25
|
readonly WarningWash: "warning_wash";
|
|
@@ -46,6 +47,13 @@ export interface TransactionLayoutConfig {
|
|
|
46
47
|
sx?: SxProps;
|
|
47
48
|
/** Border and shadow on the row card. */
|
|
48
49
|
raised?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Tint a `CAT-` row logo as the Budget-style accent tile (category colour at 15% opacity, a 1px
|
|
52
|
+
* category-colour border, a `text.primary` glyph) instead of mxui's default. Opt-in per variant so
|
|
53
|
+
* it stays scoped to the beats that want it (Replenish Savings' multi-account Transfer row), not
|
|
54
|
+
* every `transaction_block` consumer.
|
|
55
|
+
*/
|
|
56
|
+
tintedCategoryLogo?: boolean;
|
|
49
57
|
}
|
|
50
58
|
/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */
|
|
51
59
|
export declare const getLayoutConfig: (theme: Theme) => Record<TransactionBlockVariant, TransactionLayoutConfig>;
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import { WARM_LIME_ACCENT_GRADIENT as a, WARNING_WASH_GRADIENT as
|
|
1
|
+
import { WARM_LIME_ACCENT_GRADIENT as a, WARNING_WASH_GRADIENT as o, getPrimaryWashGradient as t } from "../../../components/celebrationGradients.es.js";
|
|
2
2
|
var e = {
|
|
3
3
|
WithHeader: "with_header",
|
|
4
4
|
WithHeaderFooter: "with_header_footer",
|
|
5
5
|
NoHeader: "no_header",
|
|
6
|
+
WithFooter: "with_footer",
|
|
6
7
|
UncategorizedTransaction: "uncategorized_transaction",
|
|
7
8
|
InfoWash: "info_wash",
|
|
8
9
|
WarningWash: "warning_wash",
|
|
9
10
|
StatusMessage: "status_message"
|
|
10
11
|
}, n = (r) => ({
|
|
11
|
-
[e.WithHeader]: {
|
|
12
|
+
[e.WithHeader]: {
|
|
13
|
+
showHeader: !0,
|
|
14
|
+
tintedCategoryLogo: !0
|
|
15
|
+
},
|
|
12
16
|
[e.WithHeaderFooter]: {
|
|
13
17
|
showHeader: !0,
|
|
14
18
|
showFooter: !0
|
|
15
19
|
},
|
|
16
20
|
[e.NoHeader]: { showHeader: !1 },
|
|
21
|
+
[e.WithFooter]: {
|
|
22
|
+
showHeader: !1,
|
|
23
|
+
showFooter: !0
|
|
24
|
+
},
|
|
17
25
|
[e.UncategorizedTransaction]: {
|
|
18
26
|
showHeader: !0,
|
|
19
27
|
cardVariant: "primary"
|
|
20
28
|
},
|
|
21
29
|
[e.InfoWash]: {
|
|
22
30
|
showHeader: !1,
|
|
23
|
-
background:
|
|
31
|
+
background: t(r),
|
|
24
32
|
raised: !0,
|
|
25
33
|
showFrequency: !0
|
|
26
34
|
},
|
|
27
35
|
[e.WarningWash]: {
|
|
28
36
|
showHeader: !1,
|
|
29
|
-
background:
|
|
37
|
+
background: o,
|
|
30
38
|
showFrequency: !0,
|
|
31
39
|
followsSubscription: !0,
|
|
32
40
|
answeredBackground: a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport {\n WARM_LIME_ACCENT_GRADIENT,\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` — raised row (border + shadow) on the blue slot wash, with the\n * subscription's live frequency under the amount (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 renders borderless unless `raised`. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n /** Caption each amount with the beat's live repeating transaction frequency. */\n showFrequency?: boolean\n /** Status badge and answered wash from the live repeating transaction. */\n followsSubscription?: boolean\n /** Wash once subscribed. */\n answeredBackground?: string\n /** Slot padding override (CSS shorthand). */\n sx?: SxProps\n /** Border and shadow on the row card. */\n raised?: 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 raised: true,\n showFrequency: true,\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n showFrequency: true,\n followsSubscription: true,\n answeredBackground: WARM_LIME_ACCENT_GRADIENT,\n // Room for the badge.\n sx: { p: '28px 24px 24px 32px' },\n },\n // Figma 1941:207336: the banner sits on the warm-to-lime slot wash.\n [transactionBlockVariant.StatusMessage]: {\n showHeader: false,\n statusMessage: true,\n background: WARM_LIME_ACCENT_GRADIENT,\n },\n})\n"],"mappings":";AAwBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport {\n WARM_LIME_ACCENT_GRADIENT,\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` — raised row (border + shadow) on the blue slot wash, with the\n * subscription's live frequency under the amount (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 // A multi-row list with no in-card header plus a \"Total\" summary row (Weekly New Merchants; the\n // date range is the card subtitle). The plain no-footer list reuses `NoHeader`.\n WithFooter: 'with_footer',\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 renders borderless unless `raised`. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n /** Caption each amount with the beat's live repeating transaction frequency. */\n showFrequency?: boolean\n /** Status badge and answered wash from the live repeating transaction. */\n followsSubscription?: boolean\n /** Wash once subscribed. */\n answeredBackground?: string\n /** Slot padding override (CSS shorthand). */\n sx?: SxProps\n /** Border and shadow on the row card. */\n raised?: boolean\n /**\n * Tint a `CAT-` row logo as the Budget-style accent tile (category colour at 15% opacity, a 1px\n * category-colour border, a `text.primary` glyph) instead of mxui's default. Opt-in per variant so\n * it stays scoped to the beats that want it (Replenish Savings' multi-account Transfer row), not\n * every `transaction_block` consumer.\n */\n tintedCategoryLogo?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n // `with_header` is Replenish Savings' multi-account card: its one summary row is a `CAT-` Transfer\n // logo, which we tint. (Other `with_header` beats, e.g. Large Transaction, use a merchant logo, so\n // the `CAT-` tint path never runs for them.)\n [transactionBlockVariant.WithHeader]: { showHeader: true, tintedCategoryLogo: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.WithFooter]: { showHeader: false, showFooter: true },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n raised: true,\n showFrequency: true,\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n showFrequency: true,\n followsSubscription: true,\n answeredBackground: WARM_LIME_ACCENT_GRADIENT,\n // Room for the badge.\n sx: { p: '28px 24px 24px 32px' },\n },\n // Figma 1941:207336: the banner sits on the warm-to-lime slot wash.\n [transactionBlockVariant.StatusMessage]: {\n showHeader: false,\n statusMessage: true,\n background: WARM_LIME_ACCENT_GRADIENT,\n },\n})\n"],"mappings":";AAwBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EAGV,YAAY;AAAA,EACZ,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAoCa,IAAA,CACX,OAC8D;AAAA,EAI7D,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAM,oBAAoB;AAAA,EAAK;AAAA,EAClF,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,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAO,YAAY;AAAA,EAAK;AAAA,EAC3E,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,IACxC,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,qBAAqB;AAAA,IACrB,oBAAoB;AAAA,IAEpB,IAAI,EAAE,GAAG,sBAAsB;AAAA,EACjC;AAAA,EAEC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IACvC,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,YAAY;AAAA,EACd;AACF"}
|