@mx-cartographer/experiences 9.7.35 → 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.
Files changed (24) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/core/types/localization/InsightsFeedCopy.d.ts +8 -0
  3. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.d.ts +4 -0
  4. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +192 -0
  5. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -0
  6. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.d.ts +13 -0
  7. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +94 -0
  8. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -0
  9. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/index.d.ts +1 -0
  10. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.d.ts +15 -0
  11. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +37 -0
  12. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -0
  13. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +4 -0
  14. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +54 -48
  15. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +5 -0
  17. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +17 -12
  18. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  19. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  20. package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
  21. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  22. package/dist/insights-v2/mappings/blocks.es.js +55 -49
  23. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  24. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
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
+
5
+ ## [9.7.36] - 10-23-2026
6
+
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)
8
+
1
9
  ## [9.7.35] - 10-23-2026
2
10
 
3
11
  - **ADDED** - `transparent_overdraft_block` action block for the Transparent Overdraft beat's "Learn more": the account, projected overdraft amount, 7-day line and a four-band confidence meter, with copy from the new `insights_feed.transparent_overdraft` namespace. "Transfer funds" posts op_1 with `projected_overdraft_amount`, `destination_account_ids` and `destination_account_id` through `ctaPostMessages`. Fixture, contract test, stories and `docs/action-blocks/overdraft-block.md` (MEW2-3355)
@@ -343,6 +343,13 @@ export interface PayoffCalculatorCopy {
343
343
  value_must_be_greater_than_or_equal_to: string;
344
344
  value_must_be_less_than_or_equal_to: string;
345
345
  }
346
+ export interface BudgetDetailsCopy {
347
+ days_left_until_end_of_month: string;
348
+ days_left_until_end_of_month_one: string;
349
+ previous_month_notice: string;
350
+ remaining: string;
351
+ total_out_of_limit_aria: string;
352
+ }
346
353
  export interface InsightsFeedCopy {
347
354
  general: GeneralInsightsFeedCopy;
348
355
  settings_menu: SettingsMenuCopy;
@@ -373,5 +380,6 @@ export interface InsightsFeedCopy {
373
380
  transparent_overdraft?: OverdraftCopy;
374
381
  credit_utilization?: CreditUtilizationCopy;
375
382
  payoff_calculator?: PayoffCalculatorCopy;
383
+ budget_details?: BudgetDetailsCopy;
376
384
  }
377
385
  export {};
@@ -0,0 +1,4 @@
1
+ import { ActionBlockProps } from '../../mappings/blocks';
2
+ export declare const BudgetDetailsBlock: (({ beat }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
3
+ displayName: string;
4
+ };
@@ -0,0 +1,192 @@
1
+ import { buildDynamicCopy as I } from "../../../core/utils/Localization.es.js";
2
+ import { useBudgetsStore as Q, useCategoryStore as U, useGlobalCopyStore as X, useGlobalStore as Y } from "../../../common/context/hooks.es.js";
3
+ import { getCategoryColor as j } from "../../../core/utils/CategoryUtil.es.js";
4
+ import Z from "../../../common/components/Loader.es.js";
5
+ import ee from "../../../common/components/CurrencyDialog.es.js";
6
+ import te from "../../components/shared/StatusSnackbar.es.js";
7
+ import { daysLeftInBudgetMonth as oe, resolveBudgetFacts as re } from "./layout.es.js";
8
+ import { BudgetSummary as ae } from "./BudgetSummary.es.js";
9
+ import { useEffect as ie, useRef as se, useState as g } from "react";
10
+ import { observer as ne } from "mobx-react-lite";
11
+ import v from "@mui/material/Stack";
12
+ import { CategoryIcon as de, MerchantLogo as ce, Text as z } from "@mxenabled/mxui";
13
+ import k from "@mui/material/Button";
14
+ import { jsx as r, jsxs as P } from "react/jsx-runtime";
15
+ import { alpha as le, useTheme as ue } from "@mui/material/styles";
16
+ import me from "@mui/material/Skeleton";
17
+ var we = ne(function({ beat: _ }) {
18
+ const L = ue(), { copyStore: W } = Y(), { budgets: e, common: s, insights_feed: N } = X(), a = Q(), l = U(), [E, O] = g(!1), [i, D] = g(null), [T, p] = g(""), [y, f] = g(null), h = se(!1), w = N?.budget_details, { categories: R } = l, V = a.isDataLoaded && l.categoriesLoaded;
19
+ if (ie(() => {
20
+ Promise.allSettled([a.isDataLoaded || a.loadBudgets(), l.categoriesLoaded || l.loadCategories()]).then(() => O(!(a.isDataLoaded && l.categoriesLoaded)));
21
+ }, [a, l]), !W.isInitialized) return /* @__PURE__ */ r(Z, {});
22
+ if (!w) return /* @__PURE__ */ r(v, {
23
+ sx: { p: 24 },
24
+ children: /* @__PURE__ */ r(z, { children: s?.error_message })
25
+ });
26
+ const o = re(_), m = o.categoryGuid ? R.find(({ guid: t }) => t === o.categoryGuid) : void 0, n = o.categoryGuid ? a.budgets.find(({ category_guid: t }) => t === o.categoryGuid) : void 0, d = !o.categoryGuid && o.merchantGuid ? a.getMerchantBudgetByMerchantGuid(o.merchantGuid) : void 0, M = m?.name ?? d?.merchant_name ?? _.payload?.merchant_name ?? "", A = n?.amount ?? d?.amount ?? o.budgeted ?? 0, $ = o.spent ?? n?.transaction_total ?? d?.transaction_total ?? 0, q = o.categoryGuid ? /* @__PURE__ */ r(de, {
27
+ categoryGuid: o.categoryGuid,
28
+ size: 44,
29
+ sx: {
30
+ bgcolor: le(j(o.categoryGuid, L), 0.15),
31
+ border: `1px solid ${j(o.categoryGuid, L)}`,
32
+ color: "text.primary"
33
+ }
34
+ }) : /* @__PURE__ */ r(ce, {
35
+ categoryGuid: "",
36
+ merchantGuid: o.merchantGuid ?? "",
37
+ size: 44
38
+ }), b = (t) => {
39
+ p(t === "edit" ? String(A) : ""), D(t);
40
+ }, B = () => {
41
+ D(null), p("");
42
+ }, c = (t) => I(t, M), H = async (t, u) => {
43
+ if (d) {
44
+ if (t === "delete") {
45
+ const { isSuccess: S } = await a.deleteMerchantBudget(d.guid);
46
+ return {
47
+ ok: S,
48
+ success: c(e.success_alert_delete_merchant_budget),
49
+ failure: c(e.error_alert_delete_merchant_budget)
50
+ };
51
+ }
52
+ const { isSuccess: G } = await a.updateMerchantBudget({
53
+ ...d,
54
+ amount: u
55
+ });
56
+ return {
57
+ ok: G,
58
+ success: c(e.success_alert_edit_merchant_budget),
59
+ failure: c(e.error_alert_edit_merchant_budget)
60
+ };
61
+ }
62
+ return t === "delete" && n ? {
63
+ ok: await a.deleteBudget(n.guid),
64
+ success: c(e.alert_budget_deleted)
65
+ } : t === "edit" && n ? {
66
+ ok: await a.updateBudget({
67
+ ...n,
68
+ amount: u
69
+ }),
70
+ success: c(e.alert_budget_updated)
71
+ } : t === "create" && m ? {
72
+ ok: await a.addBudget(m, u),
73
+ success: c(e.alert_budget_created)
74
+ } : {
75
+ ok: !1,
76
+ success: ""
77
+ };
78
+ }, J = async () => {
79
+ if (h.current || !i) return;
80
+ const t = Number(T);
81
+ if (!(i !== "delete" && !(Number.isFinite(t) && t > 0))) {
82
+ h.current = !0;
83
+ try {
84
+ const { ok: u, success: G, failure: S } = await H(i, t);
85
+ f({
86
+ message: u ? G : S ?? s.error_message,
87
+ severity: u ? "success" : "error"
88
+ });
89
+ } catch {
90
+ f({
91
+ message: s.error_message,
92
+ severity: "error"
93
+ });
94
+ } finally {
95
+ h.current = !1, B();
96
+ }
97
+ }
98
+ }, F = !!(n ?? d), K = E ? /* @__PURE__ */ r(z, {
99
+ color: "text.secondary",
100
+ variant: "body2",
101
+ children: s.error_message
102
+ }) : V ? F ? /* @__PURE__ */ P(v, {
103
+ sx: {
104
+ flexDirection: "row",
105
+ gap: 12
106
+ },
107
+ children: [/* @__PURE__ */ r(k, {
108
+ fullWidth: !0,
109
+ onClick: () => b("edit"),
110
+ variant: "outlined",
111
+ children: e.details_edit_button
112
+ }), /* @__PURE__ */ r(k, {
113
+ color: "error",
114
+ fullWidth: !0,
115
+ onClick: () => b("delete"),
116
+ variant: "outlined",
117
+ children: e.details_delete_button
118
+ })]
119
+ }) : !F && m ? /* @__PURE__ */ r(k, {
120
+ fullWidth: !0,
121
+ onClick: () => b("create"),
122
+ variant: "contained",
123
+ children: e.dialog_primary_button_text
124
+ }) : null : /* @__PURE__ */ r(me, {
125
+ height: 40,
126
+ variant: "rounded"
127
+ }), x = i === "delete", C = {
128
+ create: {
129
+ content: e.add_description_bottom,
130
+ primaryText: e.dialog_primary_button_text,
131
+ title: e.dialog_create_budget_title
132
+ },
133
+ edit: {
134
+ content: e.edit_budget_content,
135
+ primaryText: e.add_save_button,
136
+ title: e.details_edit_title
137
+ },
138
+ delete: {
139
+ content: e.delete_description,
140
+ primaryText: e.details_delete_button,
141
+ title: e.delete_title
142
+ }
143
+ };
144
+ return /* @__PURE__ */ P(v, {
145
+ sx: {
146
+ bgcolor: "background.paper",
147
+ gap: 24,
148
+ p: 24
149
+ },
150
+ children: [
151
+ /* @__PURE__ */ r(ae, {
152
+ budgetsCopy: e,
153
+ copy: w,
154
+ daysLeft: oe(_),
155
+ icon: q,
156
+ limit: A,
157
+ spent: $
158
+ }),
159
+ K,
160
+ i && /* @__PURE__ */ r(ee, {
161
+ closeAriaLabel: s.close_aria,
162
+ content: I(C[i].content, /* @__PURE__ */ r("b", { children: M })),
163
+ handleInputChange: p,
164
+ handleModalClose: B,
165
+ handlePrimaryAction: () => {
166
+ J();
167
+ },
168
+ handleSecondaryAction: B,
169
+ inputLabel: x ? void 0 : e.add_label,
170
+ inputValue: T,
171
+ isOpen: !0,
172
+ primaryColor: x ? "error" : "primary",
173
+ primaryText: C[i].primaryText,
174
+ secondaryColor: x ? "inherit" : "primary",
175
+ secondaryText: s.cancel_button,
176
+ title: C[i].title
177
+ }),
178
+ /* @__PURE__ */ r(te, {
179
+ closeAriaLabel: s.close_aria,
180
+ message: y?.message ?? "",
181
+ onClose: () => f(null),
182
+ open: !!y,
183
+ severity: y?.severity
184
+ })
185
+ ]
186
+ });
187
+ });
188
+ export {
189
+ we as BudgetDetailsBlock
190
+ };
191
+
192
+ //# sourceMappingURL=BudgetDetailsBlock.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BudgetDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from 'react'\n\nimport Button from '@mui/material/Button'\nimport Skeleton from '@mui/material/Skeleton'\nimport Stack from '@mui/material/Stack'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, MerchantLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { CurrencyDialog } from '../../../common/components'\nimport {\n Loader,\n useBudgetsStore,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalStore,\n} from '../../../common'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport type { Budget, MerchantBudget } from '../../../core'\nimport StatusSnackbar from '../../components/shared/StatusSnackbar'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { BudgetSummary } from './BudgetSummary'\nimport { daysLeftInBudgetMonth, resolveBudgetFacts } from './layout'\n\ntype DialogAction = 'create' | 'edit' | 'delete'\n\ninterface Toast {\n message: string\n severity: 'success' | 'error'\n}\n\nexport const BudgetDetailsBlock = observer(function BudgetDetailsBlock({ beat }: ActionBlockProps) {\n const theme = useTheme()\n const { copyStore } = useGlobalStore()\n const {\n budgets: budgetsCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n } = useGlobalCopyStore()\n const budgetsStore = useBudgetsStore()\n const categoryStore = useCategoryStore()\n const [loadFailed, setLoadFailed] = useState(false)\n const [dialog, setDialog] = useState<DialogAction | null>(null)\n const [amount, setAmount] = useState('')\n const [toast, setToast] = useState<Toast | null>(null)\n const inProgress = useRef(false)\n const copy = insightsFeedCopy?.budget_details\n const { categories } = categoryStore\n const ready = budgetsStore.isDataLoaded && categoryStore.categoriesLoaded\n\n useEffect(() => {\n void Promise.allSettled([\n budgetsStore.isDataLoaded || budgetsStore.loadBudgets(),\n categoryStore.categoriesLoaded || categoryStore.loadCategories(),\n ]).then(() => setLoadFailed(!(budgetsStore.isDataLoaded && categoryStore.categoriesLoaded)))\n }, [budgetsStore, categoryStore])\n\n if (!copyStore.isInitialized) return <Loader />\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n const facts = resolveBudgetFacts(beat)\n const category = facts.categoryGuid\n ? categories.find(({ guid }) => guid === facts.categoryGuid)\n : undefined\n const budget: Budget | undefined = facts.categoryGuid\n ? budgetsStore.budgets.find(({ category_guid }) => category_guid === facts.categoryGuid)\n : undefined\n const merchantBudget: MerchantBudget | undefined =\n !facts.categoryGuid && facts.merchantGuid\n ? budgetsStore.getMerchantBudgetByMerchantGuid(facts.merchantGuid)\n : undefined\n const subject =\n category?.name ??\n merchantBudget?.merchant_name ??\n (beat.payload?.merchant_name as string | undefined) ??\n ''\n const limit = budget?.amount ?? merchantBudget?.amount ?? facts.budgeted ?? 0\n const spent = facts.spent ?? budget?.transaction_total ?? merchantBudget?.transaction_total ?? 0\n\n const icon = facts.categoryGuid ? (\n <CategoryIcon\n categoryGuid={facts.categoryGuid}\n size={44}\n sx={{\n bgcolor: alpha(getCategoryColor(facts.categoryGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(facts.categoryGuid, theme)}`,\n color: 'text.primary',\n }}\n />\n ) : (\n <MerchantLogo categoryGuid=\"\" merchantGuid={facts.merchantGuid ?? ''} size={44} />\n )\n\n const openDialog = (action: DialogAction) => {\n setAmount(action === 'edit' ? String(limit) : '')\n setDialog(action)\n }\n\n const closeDialog = () => {\n setDialog(null)\n setAmount('')\n }\n\n const dynamic = (key: string) => buildDynamicCopy(key, subject) as string\n\n const perform = async (\n action: DialogAction,\n value: number,\n ): Promise<{ ok: boolean; success: string; failure?: string }> => {\n if (merchantBudget) {\n if (action === 'delete') {\n const { isSuccess } = await budgetsStore.deleteMerchantBudget(merchantBudget.guid)\n return {\n ok: isSuccess,\n success: dynamic(budgetsCopy.success_alert_delete_merchant_budget),\n failure: dynamic(budgetsCopy.error_alert_delete_merchant_budget),\n }\n }\n const { isSuccess } = await budgetsStore.updateMerchantBudget({\n ...merchantBudget,\n amount: value,\n })\n return {\n ok: isSuccess,\n success: dynamic(budgetsCopy.success_alert_edit_merchant_budget),\n failure: dynamic(budgetsCopy.error_alert_edit_merchant_budget),\n }\n }\n if (action === 'delete' && budget) {\n return {\n ok: await budgetsStore.deleteBudget(budget.guid),\n success: dynamic(budgetsCopy.alert_budget_deleted),\n }\n }\n if (action === 'edit' && budget) {\n return {\n ok: await budgetsStore.updateBudget({ ...budget, amount: value }),\n success: dynamic(budgetsCopy.alert_budget_updated),\n }\n }\n if (action === 'create' && category) {\n return {\n ok: await budgetsStore.addBudget(category, value),\n success: dynamic(budgetsCopy.alert_budget_created),\n }\n }\n return { ok: false, success: '' }\n }\n\n const submit = async () => {\n if (inProgress.current || !dialog) return\n const value = Number(amount)\n if (dialog !== 'delete' && !(Number.isFinite(value) && value > 0)) return\n\n inProgress.current = true\n try {\n const { ok, success, failure } = await perform(dialog, value)\n setToast({\n message: ok ? success : (failure ?? commonCopy.error_message),\n severity: ok ? 'success' : 'error',\n })\n } catch {\n setToast({ message: commonCopy.error_message, severity: 'error' })\n } finally {\n inProgress.current = false\n closeDialog()\n }\n }\n\n const hasBudget = Boolean(budget ?? merchantBudget)\n const canCreate = !hasBudget && Boolean(category)\n\n const actions = loadFailed ? (\n <Text color=\"text.secondary\" variant=\"body2\">\n {commonCopy.error_message}\n </Text>\n ) : !ready ? (\n <Skeleton height={40} variant=\"rounded\" />\n ) : hasBudget ? (\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n <Button fullWidth={true} onClick={() => openDialog('edit')} variant=\"outlined\">\n {budgetsCopy.details_edit_button}\n </Button>\n <Button\n color=\"error\"\n fullWidth={true}\n onClick={() => openDialog('delete')}\n variant=\"outlined\"\n >\n {budgetsCopy.details_delete_button}\n </Button>\n </Stack>\n ) : canCreate ? (\n <Button fullWidth={true} onClick={() => openDialog('create')} variant=\"contained\">\n {budgetsCopy.dialog_primary_button_text}\n </Button>\n ) : null\n\n const isDelete = dialog === 'delete'\n const dialogCopy = {\n create: {\n content: budgetsCopy.add_description_bottom,\n primaryText: budgetsCopy.dialog_primary_button_text,\n title: budgetsCopy.dialog_create_budget_title,\n },\n edit: {\n content: budgetsCopy.edit_budget_content,\n primaryText: budgetsCopy.add_save_button,\n title: budgetsCopy.details_edit_title,\n },\n delete: {\n content: budgetsCopy.delete_description,\n primaryText: budgetsCopy.details_delete_button,\n title: budgetsCopy.delete_title,\n },\n }\n\n return (\n <Stack sx={{ bgcolor: 'background.paper', gap: 24, p: 24 }}>\n <BudgetSummary\n budgetsCopy={budgetsCopy}\n copy={copy}\n daysLeft={daysLeftInBudgetMonth(beat)}\n icon={icon}\n limit={limit}\n spent={spent}\n />\n {actions}\n {dialog && (\n <CurrencyDialog\n closeAriaLabel={commonCopy.close_aria}\n content={buildDynamicCopy(dialogCopy[dialog].content, <b>{subject}</b>) as ReactNode}\n handleInputChange={setAmount}\n handleModalClose={closeDialog}\n handlePrimaryAction={() => void submit()}\n handleSecondaryAction={closeDialog}\n inputLabel={isDelete ? undefined : budgetsCopy.add_label}\n inputValue={amount}\n isOpen={true}\n primaryColor={isDelete ? 'error' : 'primary'}\n primaryText={dialogCopy[dialog].primaryText}\n secondaryColor={isDelete ? 'inherit' : 'primary'}\n secondaryText={commonCopy.cancel_button}\n title={dialogCopy[dialog].title}\n />\n )}\n <StatusSnackbar\n closeAriaLabel={commonCopy.close_aria}\n message={toast?.message ?? ''}\n onClose={() => setToast(null)}\n open={Boolean(toast)}\n severity={toast?.severity}\n />\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,IAAa,KAAqB,GAAS,SAA4B,EAAE,MAAA,EAAA,GAA0B;AACjG,QAAM,IAAQ,GAAS,GACjB,EAAE,WAAA,EAAA,IAAc,EAAe,GAC/B,EACJ,SAAS,GACT,QAAQ,GACR,eAAe,EAAA,IACb,EAAmB,GACjB,IAAe,EAAgB,GAC/B,IAAgB,EAAiB,GACjC,CAAC,GAAY,CAAA,IAAiB,EAAS,EAAK,GAC5C,CAAC,GAAQ,CAAA,IAAa,EAA8B,IAAI,GACxD,CAAC,GAAQ,CAAA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AAmB;AAAA,QACnB,kBAAkB;AAAA,QAClB,qBAAA,MAAA;AAA2B,UAAK,EAAO;AAAA;AAAA,QACvC,uBAAuB;AAAA,QACvB,YAAY,IAAW,SAAY,EAAY;AAAA,QAC/C,YAAY;AAAA,QACZ,QAAQ;AAAA,QACR,cAAc,IAAW,UAAU;AAAA,QACnC,aAAa,EAAW,CAAA,EAAQ;AAAA,QAChC,gBAAgB,IAAW,YAAY;AAAA,QACvC,eAAe,EAAW;AAAA,QAC1B,OAAO,EAAW,CAAA,EAAQ;AAAA,MAC3B,CAAA;AAAA,MAEH,gBAAA,EAAC,IAAD;AAAA,QACE,gBAAgB,EAAW;AAAA,QAC3B,SAAS,GAAO,WAAW;AAAA,QAC3B,SAAA,MAAe,EAAS,IAAI;AAAA,QAC5B,MAAM,EAAQ;AAAA,QACd,UAAU,GAAO;AAAA,MAClB,CAAA;AAAA,IACI;AAAA;AAEX,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { BudgetsCopy } from '../../../core/types/localization';
3
+ import { BudgetDetailsCopy } from '../../../core/types/localization/InsightsFeedCopy';
4
+ interface BudgetSummaryProps {
5
+ budgetsCopy: BudgetsCopy;
6
+ copy: BudgetDetailsCopy;
7
+ daysLeft?: number;
8
+ icon: ReactNode;
9
+ limit: number;
10
+ spent: number;
11
+ }
12
+ export declare const BudgetSummary: ({ budgetsCopy, copy, daysLeft, icon, limit, spent, }: BudgetSummaryProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,94 @@
1
+ import { buildDynamicCopy as h, buildPluralCopy as f } from "../../../core/utils/Localization.es.js";
2
+ import { formatCurrency as n } from "../../../core/utils/NumberFormatting.es.js";
3
+ import b from "../../components/ComponentBlocks/StatusIndicator.es.js";
4
+ import { calculateBudgetPercent as g, calculateBudgetTier as v, tierColor as y } from "./layout.es.js";
5
+ import i from "@mui/material/Stack";
6
+ import { Text as l } from "@mxenabled/mxui";
7
+ import { jsx as r, jsxs as e } from "react/jsx-runtime";
8
+ import p from "@mui/material/Box";
9
+ import S from "@mui/material/Alert";
10
+ var k = ({ budgetsCopy: c, copy: a, daysLeft: d, icon: s, limit: o, spent: t }) => {
11
+ const m = g(t, o), u = v(m), x = y(u), _ = d === void 0 ? /* @__PURE__ */ r(S, {
12
+ severity: "info",
13
+ children: a.previous_month_notice
14
+ }) : /* @__PURE__ */ r(l, {
15
+ color: "text.secondary",
16
+ variant: "body2",
17
+ children: f(a.days_left_until_end_of_month_one, a.days_left_until_end_of_month, d, String(d))
18
+ });
19
+ return o <= 0 ? /* @__PURE__ */ e(i, {
20
+ sx: { gap: 16 },
21
+ children: [/* @__PURE__ */ e(i, {
22
+ sx: {
23
+ alignItems: "center",
24
+ flexDirection: "row",
25
+ gap: 12
26
+ },
27
+ children: [/* @__PURE__ */ r(p, { children: s }), /* @__PURE__ */ e(i, { children: [/* @__PURE__ */ r(l, {
28
+ color: "text.secondary",
29
+ variant: "body2",
30
+ children: c.spent_label
31
+ }), /* @__PURE__ */ r(l, {
32
+ bold: !0,
33
+ component: "p",
34
+ variant: "h2",
35
+ children: n(t, "0,0.00")
36
+ })] })]
37
+ }), _]
38
+ }) : /* @__PURE__ */ e(i, {
39
+ sx: { gap: 16 },
40
+ children: [/* @__PURE__ */ r(p, {
41
+ "aria-label": h(a.total_out_of_limit_aria, n(t, "0,0.00"), n(o, "0,0.00")),
42
+ "data-tier": u ?? "none",
43
+ role: "group",
44
+ children: /* @__PURE__ */ r(b, {
45
+ amount: /* @__PURE__ */ e(i, {
46
+ sx: {
47
+ alignItems: "baseline",
48
+ flexDirection: "row",
49
+ gap: 4
50
+ },
51
+ children: [/* @__PURE__ */ r(l, {
52
+ bold: !0,
53
+ component: "p",
54
+ variant: "h2",
55
+ children: n(t, "0,0.00")
56
+ }), /* @__PURE__ */ e(l, {
57
+ color: "text.secondary",
58
+ variant: "body2",
59
+ children: ["/ ", n(o, "0,0.00")]
60
+ })]
61
+ }),
62
+ borderRadius: "8px",
63
+ completeColor: x,
64
+ icon: s,
65
+ label: /* @__PURE__ */ e(i, {
66
+ sx: {
67
+ alignItems: "center",
68
+ flexDirection: "row",
69
+ gap: 6
70
+ },
71
+ children: [/* @__PURE__ */ r(p, { sx: {
72
+ bgcolor: x,
73
+ borderRadius: "50%",
74
+ height: 8,
75
+ width: 8
76
+ } }), /* @__PURE__ */ r(l, {
77
+ color: "text.secondary",
78
+ variant: "body2",
79
+ children: c.spent_label
80
+ })]
81
+ }),
82
+ leftLabel: h(c.percent_spent, String(m)),
83
+ percentComplete: Math.min(100, m),
84
+ rightLabel: o > t ? h(a.remaining, n(o - t, "0,0.00")) : "",
85
+ sx: { p: 0 }
86
+ })
87
+ }), _]
88
+ });
89
+ };
90
+ export {
91
+ k as BudgetSummary
92
+ };
93
+
94
+ //# sourceMappingURL=BudgetSummary.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BudgetSummary.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { BudgetsCopy } from '../../../core/types/localization'\nimport type { BudgetDetailsCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport StatusIndicator from '../../components/ComponentBlocks/StatusIndicator'\n\nimport { calculateBudgetPercent, calculateBudgetTier, tierColor } from './layout'\n\ninterface BudgetSummaryProps {\n budgetsCopy: BudgetsCopy\n copy: BudgetDetailsCopy\n daysLeft?: number\n icon: ReactNode\n limit: number\n spent: number\n}\n\nexport const BudgetSummary = ({\n budgetsCopy,\n copy,\n daysLeft,\n icon,\n limit,\n spent,\n}: BudgetSummaryProps) => {\n const percent = calculateBudgetPercent(spent, limit)\n const tier = calculateBudgetTier(percent)\n const color = tierColor(tier)\n const periodLine =\n daysLeft === undefined ? (\n <Alert severity=\"info\">{copy.previous_month_notice}</Alert>\n ) : (\n <Text color=\"text.secondary\" variant=\"body2\">\n {\n buildPluralCopy(\n copy.days_left_until_end_of_month_one,\n copy.days_left_until_end_of_month,\n daysLeft,\n String(daysLeft),\n ) as string\n }\n </Text>\n )\n\n if (limit <= 0) {\n return (\n <Stack sx={{ gap: 16 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n {periodLine}\n </Stack>\n )\n }\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n aria-label={\n buildDynamicCopy(\n copy.total_out_of_limit_aria,\n formatCurrency(spent, '0,0.00'),\n formatCurrency(limit, '0,0.00'),\n ) as string\n }\n data-tier={tier ?? 'none'}\n role=\"group\"\n >\n <StatusIndicator\n amount={\n <Stack sx={{ alignItems: 'baseline', flexDirection: 'row', gap: 4 }}>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, '0,0.00')}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n / {formatCurrency(limit, '0,0.00')}\n </Text>\n </Stack>\n }\n borderRadius=\"8px\"\n completeColor={color}\n icon={icon}\n label={\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 6 }}>\n <Box sx={{ bgcolor: color, borderRadius: '50%', height: 8, width: 8 }} />\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n </Stack>\n }\n leftLabel={buildDynamicCopy(budgetsCopy.percent_spent, String(percent)) as string}\n percentComplete={Math.min(100, percent)}\n rightLabel={\n limit > spent\n ? (buildDynamicCopy(\n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AO,QAAQ,CACxC,IACA;AAAA,QAEN,IAAI,EAAE,GAAG,EAAE;AAAA,MACZ,CAAA;AAAA,IACE,CAAA,GACJ,CACI;AAAA;AAEX"}
@@ -0,0 +1 @@
1
+ export { BudgetDetailsBlock } from './BudgetDetailsBlock';
@@ -0,0 +1,15 @@
1
+ import { Beat } from '../../../core';
2
+ export type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK';
3
+ export declare const BUDGET_TIER_COLORS: Record<BudgetTier, string>;
4
+ export declare const DEFAULT_TIER_COLOR = "success.main";
5
+ export declare const calculateBudgetPercent: (total: number, limit: number) => number;
6
+ export declare const calculateBudgetTier: (percent: number) => BudgetTier | undefined;
7
+ export declare const tierColor: (tier: BudgetTier | undefined) => string;
8
+ export interface BudgetFacts {
9
+ categoryGuid?: string;
10
+ merchantGuid?: string;
11
+ spent?: number;
12
+ budgeted?: number;
13
+ }
14
+ export declare const resolveBudgetFacts: (beat: Beat) => BudgetFacts;
15
+ export declare const daysLeftInBudgetMonth: (beat: Beat, now?: Date) => number | undefined;
@@ -0,0 +1,37 @@
1
+ import { endOfMonth as i } from "date-fns/endOfMonth";
2
+ import { startOfMonth as s } from "date-fns/startOfMonth";
3
+ import { differenceInCalendarDays as u } from "date-fns/differenceInCalendarDays";
4
+ var c = {
5
+ LOW: "success.light",
6
+ MEDIUM: "warning.light",
7
+ HIGH: "warning.main",
8
+ OFF_TRACK: "error.main"
9
+ }, g = "success.main", y = (t, r) => Math.ceil((r ? t / r : 0) * 100), p = (t) => {
10
+ if (t > 100) return "OFF_TRACK";
11
+ if (t >= 75) return "HIGH";
12
+ if (t >= 50) return "MEDIUM";
13
+ if (t >= 25) return "LOW";
14
+ }, v = (t) => t ? c[t] : g, n = (t) => typeof t == "number" && Number.isFinite(t) ? t : void 0, o = (t) => typeof t == "string" && t ? t : void 0, h = (t) => {
15
+ const r = t.insights_payload, a = r?.instance_slot?.data ?? r?.instance_slot_data ?? {};
16
+ return {
17
+ categoryGuid: o(a.category_guid) ?? r?.primary_category_guid ?? t.primary_category_guid ?? void 0,
18
+ merchantGuid: o(a.merchant_guid) ?? r?.primary_merchant_guid ?? t.primary_merchant_guid ?? void 0,
19
+ spent: n(a.spent_amount),
20
+ budgeted: n(a.budgeted_amount)
21
+ };
22
+ }, l = (t, r = /* @__PURE__ */ new Date()) => {
23
+ const a = t.active_at ?? t.insights_payload?.active_at, e = a == null ? r : new Date(typeof a == "number" ? a * 1e3 : a), d = Number.isNaN(e.getTime()) ? r : e;
24
+ if (!(i(d) < s(r)))
25
+ return u(i(r), r) + 1;
26
+ };
27
+ export {
28
+ c as BUDGET_TIER_COLORS,
29
+ g as DEFAULT_TIER_COLOR,
30
+ y as calculateBudgetPercent,
31
+ p as calculateBudgetTier,
32
+ l as daysLeftInBudgetMonth,
33
+ h as resolveBudgetFacts,
34
+ v as tierColor
35
+ };
36
+
37
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat } from '../../../core'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\nconst finiteNumber = (value: unknown) =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined\n\nconst nonEmptyString = (value: unknown) => (typeof value === 'string' && value ? value : undefined)\n\nexport const resolveBudgetFacts = (beat: Beat): BudgetFacts => {\n const payload = beat.insights_payload\n const data = (payload?.instance_slot?.data ?? payload?.instance_slot_data ?? {}) as Record<\n string,\n unknown\n >\n\n return {\n categoryGuid:\n nonEmptyString(data.category_guid) ??\n payload?.primary_category_guid ??\n beat.primary_category_guid ??\n undefined,\n merchantGuid:\n nonEmptyString(data.merchant_guid) ??\n payload?.primary_merchant_guid ??\n beat.primary_merchant_guid ??\n undefined,\n spent: finiteNumber(data.spent_amount),\n budgeted: finiteNumber(data.budgeted_amount),\n }\n}\n\nexport const daysLeftInBudgetMonth = (beat: Beat, now = new Date()) => {\n const raw = beat.active_at ?? beat.insights_payload?.active_at\n const at = raw == null ? now : new Date(typeof raw === 'number' ? raw * 1000 : raw)\n const activeAt = Number.isNaN(at.getTime()) ? now : at\n if (endOfMonth(activeAt) < startOfMonth(now)) return undefined\n\n return differenceInCalendarDays(endOfMonth(now), now) + 1\n}\n"],"mappings":";;;AAQA,IAAa,IAAiD;AAAA,EAC5D,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AACb,GAEa,IAAqB,gBAErB,IAAA,CAA0B,GAAe,MACpD,KAAK,MAAM,IAAQ,IAAQ,IAAQ,KAAK,GAAG,GAEhC,IAAA,CAAuB,MAA4C;AAC9E,MAAI,IAAU,IAAK,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAG5B,GAEa,IAAA,CAAa,MACxB,IAAO,EAAmB,CAAA,IAAQ,GAS9B,IAAA,CAAgB,MACpB,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ,QAE1D,IAAA,CAAkB,MAAoB,OAAO,KAAU,YAAY,IAAQ,IAAQ,QAE5E,IAAA,CAAsB,MAA4B;AAC7D,QAAM,IAAU,EAAK,kBACf,IAAQ,GAAS,eAAe,QAAQ,GAAS,sBAAsB,CAAC;AAK9E,SAAO;AAAA,IACL,cACE,EAAe,EAAK,aAAa,KACjC,GAAS,yBACT,EAAK,yBACL;AAAA,IACF,cACE,EAAe,EAAK,aAAa,KACjC,GAAS,yBACT,EAAK,yBACL;AAAA,IACF,OAAO,EAAa,EAAK,YAAY;AAAA,IACrC,UAAU,EAAa,EAAK,eAAe;AAAA,EAC7C;AACF,GAEa,IAAA,CAAyB,GAAY,IAAM,oBAAI,KAAK,MAAM;AACrE,QAAM,IAAM,EAAK,aAAa,EAAK,kBAAkB,WAC/C,IAAK,KAAO,OAAO,IAAM,IAAI,KAAK,OAAO,KAAQ,WAAW,IAAM,MAAO,CAAG,GAC5E,IAAW,OAAO,MAAM,EAAG,QAAQ,CAAC,IAAI,IAAM;AACpD,MAAI,EAAA,EAAW,CAAQ,IAAI,EAAa,CAAG;AAE3C,WAAO,EAAyB,EAAW,CAAG,GAAG,CAAG,IAAI;AAC1D"}
@@ -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 _ } from "../../../../common/context/hooks.es.js";
2
- import { slot as s } from "../../../../core/types/Insights.es.js";
3
- import { formatCurrency as y } from "../../../../core/utils/NumberFormatting.es.js";
4
- import { logoFromRef as h } from "../../../components/shared/EntityLogo.es.js";
5
- import x from "../../../components/LogoFromGuid.es.js";
6
- import { resolveVariantConfig as v } from "../../resolveVariantConfig.es.js";
7
- import C from "../../../components/TransactionListCard.es.js";
8
- import I from "../../../components/StatusMessageCard.es.js";
9
- import { getLayoutConfig as G, transactionBlockVariant as L } from "./layout.es.js";
10
- import { observer as T } from "mobx-react-lite";
11
- import { CategoryIcon as S, InstitutionLogo as O, MerchantLogo as k } from "@mxenabled/mxui";
12
- import { Icon as z } from "@mxenabled/mx-icons";
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 B } from "@mui/material/styles";
14
+ import { useTheme as E } from "@mui/material/styles";
15
15
  import c from "@mui/material/Box";
16
- var i = 32, b = Math.round(i * 0.625), M = 20, R = (n, a) => {
17
- const t = h(n.logo, n.primary_text);
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: i,
23
+ height: n,
24
24
  justifyContent: "center",
25
- width: i
25
+ width: n
26
26
  },
27
- children: /* @__PURE__ */ o(z, {
27
+ children: /* @__PURE__ */ o(R, {
28
28
  name: t.logo_name,
29
- size: b,
29
+ size: F,
30
30
  sx: { color: t.logo_color }
31
31
  })
32
32
  });
33
- if (t.merchant_guid) return /* @__PURE__ */ o(k, {
33
+ if (t.merchant_guid) return /* @__PURE__ */ o(M, {
34
34
  alt: t.merchant_name ?? "",
35
- categoryGuid: t.category_guid ? a(t.category_guid) : "",
35
+ categoryGuid: t.category_guid ? s(t.category_guid) : "",
36
36
  merchantGuid: t.merchant_guid,
37
- size: i
37
+ size: n
38
38
  });
39
- if (t.institution_guid) return /* @__PURE__ */ o(O, {
39
+ if (t.institution_guid) return /* @__PURE__ */ o(A, {
40
40
  alt: t.institution_name ?? "",
41
41
  institutionGuid: t.institution_guid,
42
- size: i
42
+ size: n
43
43
  });
44
44
  if (t.category_guid) {
45
- const e = a(t.category_guid);
45
+ const r = s(t.category_guid);
46
46
  return /* @__PURE__ */ o(c, {
47
- "data-testid": `category-icon-${e}`,
47
+ "data-testid": `category-icon-${r}`,
48
48
  sx: { display: "flex" },
49
- children: /* @__PURE__ */ o(S, {
50
- categoryGuid: e,
51
- size: i
49
+ children: /* @__PURE__ */ o(B, {
50
+ categoryGuid: r,
51
+ size: n
52
52
  })
53
53
  });
54
54
  }
55
55
  }
56
- }, K = T(({ payload: n }) => {
57
- const a = B(), { getTopLevelCategoryGuid: t } = _(), { data: e, variant: u } = n.instance_slot, { background: d, cardVariant: l, showHeader: f, statusMessage: p } = v(G(a), u, L.NoHeader, "TransactionBlock");
58
- if (p) {
59
- const r = s(e, "message");
60
- return typeof r != "string" || !r.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ o(I, {
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(x, {
65
- logo: s(e, "icon"),
66
- size: M
64
+ children: /* @__PURE__ */ o(G, {
65
+ logo: i(r, "icon"),
66
+ size: N
67
67
  })
68
68
  }),
69
- message: r
69
+ message: e
70
70
  });
71
71
  }
72
- const m = s(e, "series"), g = s(e, "header_text");
73
- return !Array.isArray(m) || !m.length ? null : /* @__PURE__ */ o(C, {
74
- background: d,
75
- header: f && typeof g == "string" ? g : void 0,
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((r) => ({
78
- amount: typeof r.amount == "number" ? y(r.amount, "0,0.00") : "",
79
- leading: R(r, t),
80
- subtitle: r.secondary_text ?? "",
81
- title: r.primary_text ?? ""
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
- K as TransactionBlock
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 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;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;A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K,uEAAuE,GAC7E,QAKP,gBAAA,EAAC,GAAD;AAAA,MACE,MACE,gBAAA,EAAC,GAAD;AAAA,QAAK,eAAY;AAAA,QAAO,IAAI,EAAE,SAAS,OAAO;AAAA,QAC5C,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAc,MAAM,EAAc,GAAM,MAAM;AAAA,UAAG,MAAM;AAAA,QAAmB,CAAA;AAAA,MACvE,CAAA;AAAA,MAEE,SAAA;AAAA,IACV,CAAA;AAAA,EAEL;AAEA,QAAM,IAAS,EAAwB,GAAM,QAAQ,GAC/C,IAAa,EAAa,GAAM,aAAa;AAEnD,SAAI,CAAC,MAAM,QAAQ,CAAM,KAAK,CAAC,EAAO,SAAe,OAKnD,gBAAA,EAAC,GAAD;AAAA,IACc,YAAA;AAAA,IACJ,QALG,KAAc,OAAO,KAAe,WAAW,IAAa;AAAA,IAMvE,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,SAAS,EAAc,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 { 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;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,OAAO,EAAK,WAAW;AAAA,MAAI,CAAA;AAAA,IAC/E,CAAA;AAIT,QAAI,E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EAAc,GAAM,MAAM;AAAA,UAAG,MAAM;AAAA,QAAmB,CAAA;AAAA,MACvE,CAAA;AAAA,MAEE,SAAA;AAAA,IACV,CAAA;AAAA,EAEL;AAEA,QAAM,IAAS,EAAwB,GAAM,QAAQ,GAC/C,IAAa,EAAa,GAAM,aAAa;AAEnD,MAAI,CAAC,MAAM,QAAQ,CAAM,KAAK,CAAC,EAAO,OAAQ,QAAO;AAErD,QAAM,IAAS,KAAc,OAAO,KAAe,WAAW,IAAa,QAErE,IAAa,EAAa,GAAM,aAAa,GAC7C,IAAe,EAAa,GAAM,eAAe,GACjD,IAAS,IACX;AAAA,IACE,OAAO;AAAA,IACP,QAAQ,EAAe,GAAc,QAAQ;AAAA,EAC/C,IACA;AAEJ,SACE,gBAAA,EAAC,GAAD;AAAA,IACc,YAAA;AAAA,IACJ,QAAA;AAAA,IACA,QAAA;AAAA,IACR,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,SAAS,EAAc,GAAK,CAAuB;AAAA,MACnD,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
@@ -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 s } from "../../../components/celebrationGradients.es.js";
2
- var a = {
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
- }, n = (e) => ({
10
- [a.WithHeader]: { showHeader: !0 },
11
- [a.NoHeader]: { showHeader: !1 },
12
- [a.UncategorizedTransaction]: {
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
- [a.InfoWash]: {
21
+ [e.InfoWash]: {
17
22
  showHeader: !1,
18
- background: s(e)
23
+ background: t(a)
19
24
  },
20
- [a.WarningWash]: {
25
+ [e.WarningWash]: {
21
26
  showHeader: !1,
22
27
  background: r
23
28
  },
24
- [a.StatusMessage]: {
29
+ [e.StatusMessage]: {
25
30
  showHeader: !1,
26
31
  statusMessage: !0
27
32
  }
28
33
  });
29
34
  export {
30
- n as getLayoutConfig,
31
- a as transactionBlockVariant
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":";AAoBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAiBa,IAAA,CACX,OAC8D;AAAA,EAC7D,CAAA,EAAwB,UAAA,GAAa,EAAE,YAAY,GAAK;AAAA,EACxD,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"}
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"}
@@ -16,4 +16,5 @@ export declare const actionBlocksKey: {
16
16
  CREDIT_UTILIZATION_ACTION_BLOCK: string;
17
17
  EMERGENCY_SAVINGS_ACTION_BLOCK: string;
18
18
  PAYOFF_CALCULATOR_ACTION_BLOCK: string;
19
+ BUDGET_DETAILS_ACTION_BLOCK: string;
19
20
  };
@@ -15,7 +15,8 @@ var _ = {
15
15
  OVERDRAFT_ACTION_BLOCK: "transparent_overdraft_block",
16
16
  CREDIT_UTILIZATION_ACTION_BLOCK: "credit_utilization_block",
17
17
  EMERGENCY_SAVINGS_ACTION_BLOCK: "emergency_savings_block",
18
- PAYOFF_CALCULATOR_ACTION_BLOCK: "payoff_calculator_block"
18
+ PAYOFF_CALCULATOR_ACTION_BLOCK: "payoff_calculator_block",
19
+ BUDGET_DETAILS_ACTION_BLOCK: "budget_details_block"
19
20
  };
20
21
  export {
21
22
  _ as actionBlocksKey
@@ -1 +1 @@
1
- {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAClC"}
1
+ {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n BUDGET_DETAILS_ACTION_BLOCK: 'budget_details_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,6BAA6B;AAC/B"}
@@ -1,5 +1,5 @@
1
1
  import { ContactSupportActionBlock as p } from "../actionBlocks/ContactSupportActionBlock.es.js";
2
- import { hasDrawerBlock as X } from "./hasDrawerBlock.es.js";
2
+ import { hasDrawerBlock as $ } from "./hasDrawerBlock.es.js";
3
3
  import { actionBlocksKey as o } from "./actionBlocksKey.es.js";
4
4
  import { BarchartBlock as m } from "../blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
5
5
  import { DoubleBarChartBlock as _ } from "../blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
@@ -9,30 +9,30 @@ import k from "../blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlo
9
9
  import B from "../blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js";
10
10
  import u from "../blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
11
11
  import f from "../blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js";
12
- import { BudgetBlock as A } from "../blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
13
- import O from "../blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js";
14
- import T from "../blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js";
12
+ import { BudgetBlock as T } from "../blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
13
+ import A from "../blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js";
14
+ import O from "../blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js";
15
15
  import d from "../blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js";
16
16
  import n from "../blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js";
17
17
  import N from "../blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
18
- import I from "../blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js";
19
- import { TransactionBlock as g } from "../blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
18
+ import g from "../blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js";
19
+ import { TransactionBlock as I } from "../blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
20
20
  import b from "../blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js";
21
21
  import P from "../blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js";
22
22
  import L from "../blocks/ImageBlocks/ImageBlock.es.js";
23
- import { SVGImageBlock as h } from "../blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
24
- import { FeedbackModalActionBlock as D } from "../actionBlocks/FeedbackModalActionBlock.es.js";
25
- import { ConnectionDetailActionBlock as R } from "../actionBlocks/ConnectionDetailActionBlock.es.js";
23
+ import { SVGImageBlock as D } from "../blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
24
+ import { FeedbackModalActionBlock as h } from "../actionBlocks/FeedbackModalActionBlock.es.js";
25
+ import { ConnectionDetailActionBlock as E } from "../actionBlocks/ConnectionDetailActionBlock.es.js";
26
26
  import { ConnectWidgetActionBlock as S } from "../actionBlocks/ConnectWidgetActionBlock.es.js";
27
- import { SurveyModalActionBlock as E } from "../actionBlocks/SurveyModalActionBlock.es.js";
27
+ import { SurveyModalActionBlock as R } from "../actionBlocks/SurveyModalActionBlock.es.js";
28
28
  import { PlaceholderActionBlock as v } from "../actionBlocks/PlaceholderActionBlock.es.js";
29
29
  import { getMakeTransferDrawerTitle as y } from "../actionBlocks/MakeTransferActionBlock/layout.es.js";
30
30
  import { MakeTransferActionBlockLayer as K } from "../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js";
31
31
  import { getDrawerHeaderTitle as M } from "../actionBlocks/TransactionHistoryBlock/utils.es.js";
32
- import { TransactionDetailsBlock as w } from "../actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js";
33
- import { useTransactionDetailsPrepare as c } from "../actionBlocks/TransactionDetailsBlock/useTransactionDetailsPrepare.es.js";
34
- import { TransactionHistoryBlock as U } from "../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js";
35
- import { useRecurringTransactionPrepare as l } from "../actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
32
+ import { TransactionDetailsBlock as U } from "../actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js";
33
+ import { useTransactionDetailsPrepare as l } from "../actionBlocks/TransactionDetailsBlock/useTransactionDetailsPrepare.es.js";
34
+ import { TransactionHistoryBlock as w } from "../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js";
35
+ import { useRecurringTransactionPrepare as c } from "../actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
36
36
  import { RecurringTransactionBlock as G } from "../actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js";
37
37
  import { TransactionListBlock as F } from "../actionBlocks/TransactionListBlock/TransactionListBlock.es.js";
38
38
  import { RemainingCashBlock as H } from "../actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js";
@@ -42,21 +42,22 @@ import { EmergencySavingsBlock as z } from "../actionBlocks/EmergencySavingsBloc
42
42
  import { CreditUtilizationBlock as W } from "../actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js";
43
43
  import { useCreditUtilizationPrepare as q } from "../actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js";
44
44
  import { PayoffCalculatorBlock as Z, usePayoffCalculatorPrepare as j } from "../actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js";
45
- var i = (r) => {
46
- }, t = (r) => ({
45
+ import { BudgetDetailsBlock as J } from "../actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js";
46
+ var i = (e) => {
47
+ }, t = (e) => ({
47
48
  get Component() {
48
- return r().Component;
49
+ return e().Component;
49
50
  },
50
51
  get usePrepare() {
51
- return r().usePrepare;
52
+ return e().usePrepare;
52
53
  },
53
54
  get title() {
54
- return r().title;
55
+ return e().title;
55
56
  },
56
57
  get presentation() {
57
- return r().presentation;
58
+ return e().presentation;
58
59
  }
59
- }), xo = {
60
+ }), Yo = {
60
61
  [o.PLACEHOLDER_ACTION_BLOCK]: t(() => ({
61
62
  Component: v,
62
63
  usePrepare: i,
@@ -68,53 +69,53 @@ var i = (r) => {
68
69
  title: y
69
70
  })),
70
71
  [o.TRANSCATION_HISTORY_ACTION_BLOCK]: t(() => ({
71
- Component: U,
72
+ Component: w,
72
73
  usePrepare: i,
73
74
  title: M
74
75
  })),
75
76
  [o.TRANSACTION_DETAILS_ACTION_BLOCK]: t(() => ({
76
- Component: w,
77
- usePrepare: c,
77
+ Component: U,
78
+ usePrepare: l,
78
79
  title: () => "Transaction Details"
79
80
  })),
80
81
  [o.RECURRING_TRANSACTION_ACTION_BLOCK]: t(() => ({
81
82
  Component: G,
82
- usePrepare: l,
83
- title: (r, e) => e.recurring?.expense_details ?? ""
83
+ usePrepare: c,
84
+ title: (e, r) => r.recurring?.expense_details ?? ""
84
85
  })),
85
86
  [o.REMAINING_CASH_ACTION_BLOCK]: t(() => ({
86
87
  Component: H,
87
- usePrepare: l,
88
- title: (r, e) => e.insights_feed?.remaining_cash?.title ?? ""
88
+ usePrepare: c,
89
+ title: (e, r) => r.insights_feed?.remaining_cash?.title ?? ""
89
90
  })),
90
91
  [o.CONTACT_SUPPORT_ACTION_BLOCK]: t(() => ({
91
92
  Component: p,
92
93
  usePrepare: i,
93
- title: (r, e) => e.help?.request_support ?? ""
94
+ title: (e, r) => r.help?.request_support ?? ""
94
95
  })),
95
96
  [o.FEEDBACK_MODAL_ACTION_BLOCK]: t(() => ({
96
- Component: D,
97
+ Component: h,
97
98
  usePrepare: i,
98
99
  presentation: "modal"
99
100
  })),
100
101
  [o.CONNECTION_DETAIL_ACTION_BLOCK]: t(() => ({
101
- Component: R,
102
+ Component: E,
102
103
  usePrepare: i,
103
- title: (r, e) => e.insights_feed?.connection_details?.connection_details_drawer_title ?? ""
104
+ title: (e, r) => r.insights_feed?.connection_details?.connection_details_drawer_title ?? ""
104
105
  })),
105
106
  [o.CONNECT_WIDGET_ACTION_BLOCK]: t(() => ({
106
107
  Component: S,
107
108
  usePrepare: i
108
109
  })),
109
110
  [o.SURVEY_MODAL_ACTION_BLOCK]: t(() => ({
110
- Component: E,
111
+ Component: R,
111
112
  usePrepare: i,
112
113
  presentation: "modal"
113
114
  })),
114
115
  [o.TRANSACTION_LIST_ACTION_BLOCK]: t(() => ({
115
116
  Component: F,
116
- usePrepare: c,
117
- title: (r, e, a) => a?.insights_payload?.title ?? ""
117
+ usePrepare: l,
118
+ title: (e, r, a) => a?.insights_payload?.title ?? ""
118
119
  })),
119
120
  [o.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: t(() => ({
120
121
  Component: x,
@@ -124,50 +125,55 @@ var i = (r) => {
124
125
  [o.OVERDRAFT_ACTION_BLOCK]: t(() => ({
125
126
  Component: V,
126
127
  usePrepare: Y,
127
- title: (r, e, a) => a?.insights_payload?.title ?? ""
128
+ title: (e, r, a) => a?.insights_payload?.title ?? ""
128
129
  })),
129
130
  [o.CREDIT_UTILIZATION_ACTION_BLOCK]: t(() => ({
130
131
  Component: W,
131
132
  usePrepare: q,
132
- title: (r, e) => e.insights_feed?.credit_utilization?.title ?? ""
133
+ title: (e, r) => r.insights_feed?.credit_utilization?.title ?? ""
133
134
  })),
134
135
  [o.EMERGENCY_SAVINGS_ACTION_BLOCK]: t(() => ({
135
136
  Component: z,
136
137
  usePrepare: i,
137
- title: (r, e, a) => a?.insights_payload?.title ?? ""
138
+ title: (e, r, a) => a?.insights_payload?.title ?? ""
138
139
  })),
139
140
  [o.PAYOFF_CALCULATOR_ACTION_BLOCK]: t(() => ({
140
141
  Component: Z,
141
142
  usePrepare: j,
142
- title: (r, e) => e.insights_feed?.payoff_calculator?.title ?? ""
143
+ title: (e, r) => r.insights_feed?.payoff_calculator?.title ?? ""
144
+ })),
145
+ [o.BUDGET_DETAILS_ACTION_BLOCK]: t(() => ({
146
+ Component: J,
147
+ usePrepare: i,
148
+ title: (e, r, a) => a?.insights_payload?.title || r.budgets?.details_title || ""
143
149
  }))
144
- }, Vo = {
150
+ }, zo = {
145
151
  account_block: u,
146
152
  account_switch_block: f,
147
153
  direct_deposit_block: B,
148
154
  bar_chart_block: m,
149
- budget_block: A,
150
- debts_block: O,
155
+ budget_block: T,
156
+ debts_block: A,
151
157
  donut_chart_block: C,
152
158
  double_bar_chart_block: _,
153
159
  double_progress_bar_block: k,
154
- goals_block: T,
160
+ goals_block: O,
155
161
  image_block: L,
156
162
  no_spend_days_block: d,
157
163
  repeating_transaction_block: n,
158
164
  save_extra_block: N,
159
- savings_opportunity_block: I,
165
+ savings_opportunity_block: g,
160
166
  step_chart_block: s,
161
- svg_image_block: h,
167
+ svg_image_block: D,
162
168
  upcoming_bill_block: n,
163
169
  upcoming_subscription_block: b,
164
170
  withdrawal_block: P,
165
- transaction_block: g
171
+ transaction_block: I
166
172
  };
167
173
  export {
168
- xo as actionBlocks,
169
- Vo as blocks,
170
- X as hasDrawerBlock
174
+ Yo as actionBlocks,
175
+ zo as blocks,
176
+ $ as hasDrawerBlock
171
177
  };
172
178
 
173
179
  //# sourceMappingURL=blocks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n AccountSwitchBlock,\n BarchartBlock,\n BudgetBlock,\n DebtsBlock,\n DetailedAccountBlock,\n DonutChartBlock,\n GoalsBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WithdrawalBlock,\n TransactionBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, GlobalCopy, InsightsPayload } from '../../core'\nimport { ContactSupportActionBlock } from '../actionBlocks/ContactSupportActionBlock'\nimport { FeedbackModalActionBlock } from '../actionBlocks/FeedbackModalActionBlock'\nimport { ConnectionDetailActionBlock } from '../actionBlocks/ConnectionDetailActionBlock'\nimport { ConnectWidgetActionBlock } from '../actionBlocks/ConnectWidgetActionBlock'\nimport { SurveyModalActionBlock } from '../actionBlocks/SurveyModalActionBlock'\nimport { PlaceholderActionBlock } from '../actionBlocks/PlaceholderActionBlock'\nimport { MakeTransferActionBlockLayer } from '../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer'\nimport { getMakeTransferDrawerTitle } from '../actionBlocks/MakeTransferActionBlock/layout'\nimport { TransactionHistoryBlock } from '../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock'\nimport { getDrawerHeaderTitle } from '../actionBlocks/TransactionHistoryBlock/utils'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport { OverdraftBlock, useOverdraftPrepare } from '../actionBlocks/OverdraftBlock'\nimport { EmergencySavingsBlock } from '../actionBlocks/EmergencySavingsBlock'\nimport {\n CreditUtilizationBlock,\n useCreditUtilizationPrepare,\n} from '../actionBlocks/CreditUtilizationBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\n// Keys live in ./actionBlocksKey (imported directly by chart blocks/tests too) to avoid a\n// circular import between this module and the chart blocks — see that file for details.\nimport { actionBlocksKey } from './actionBlocksKey'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\n\n// Re-exported so existing `hasDrawerBlock` imports from this module keep working.\nexport { hasDrawerBlock } from './hasDrawerBlock'\n\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n // Resolves the drawer title from the clicked CTA's variant + copy, with the beat available\n // for blocks that title from beat fields (e.g. transaction-list reads insights_payload.title).\n // Falls back to the CTA label when the resolver returns an empty string / is absent.\n title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string\n // 'drawer' (default) or 'modal' (component renders its own dialog, no Drawer wrapper).\n presentation?: 'drawer' | 'modal'\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends Add\n// `usePrepare` when the block needs to load data before rendering.\n\n/**\n * A registry entry whose fields read their imports when used, not when this module loads. Some\n * registered blocks render `TransactionDetails`, whose embedded card mounts `ActionBlockLayer`,\n * which imports this registry: when one of those blocks loads first, its own import is not\n * initialised yet while this module evaluates, so a value copied at load would be `undefined`\n * (or throw under native ES modules). Reading on access sees the finished import.\n */\nconst liveEntry = (resolve: () => ActionBlockEntry): ActionBlockEntry => ({\n get Component() {\n return resolve().Component\n },\n get usePrepare() {\n return resolve().usePrepare\n },\n get title() {\n return resolve().title\n },\n get presentation() {\n return resolve().presentation\n },\n})\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: liveEntry(() => ({\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n })),\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: liveEntry(() => ({\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: noop,\n title: getDrawerHeaderTitle,\n })),\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n })),\n // Expense Details for one recurring subscription. Which subscription a beat names is resolved in\n // `RecurringTransactionBlock/subscriptionBeats.ts`, not through this registry.\n [actionBlocksKey.RECURRING_TRANSACTION_ACTION_BLOCK]: liveEntry(() => ({\n Component: RecurringTransactionBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.recurring?.expense_details ?? '',\n })),\n // Remaining Cash for the Payday Cash Left Over Status beat. Store-driven: reuses the recurring\n // loader, which also loads accounts and categories, so CashflowStore's computeds are ready.\n [actionBlocksKey.REMAINING_CASH_ACTION_BLOCK]: liveEntry(() => ({\n Component: RemainingCashBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.insights_feed?.remaining_cash?.title ?? '',\n })),\n // The block renders its own drawer (the help module's RequestSupport) on top of the action\n // drawer, so the action drawer's title is the CTA label.\n [actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK]: liveEntry(() => ({\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n })),\n [actionBlocksKey.FEEDBACK_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: FeedbackModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.CONNECTION_DETAIL_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectionDetailActionBlock,\n usePrepare: noop,\n title: (_variant, copy) =>\n copy.insights_feed?.connection_details?.connection_details_drawer_title ?? '',\n })),\n // Boots MX's Connect widget (web-widget-sdk iframe) inside the action\n // drawer; the drawer title falls back to the CTA label.\n [actionBlocksKey.CONNECT_WIDGET_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectWidgetActionBlock,\n usePrepare: noop,\n })),\n [actionBlocksKey.SURVEY_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SurveyModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // One whole-dollar setting in a dialog; the CTA variant picks which (low-balance threshold or\n // safety net). A modal: no drawer, so no drawer title.\n [actionBlocksKey.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n // Loads inside the block: it mounts only while open, so mounting is the open-time load.\n usePrepare: noop,\n })),\n // Transparent Overdraft's \"Learn more\": the projected overdraft, its account and the confidence\n // meter. Titled from the beat, as the pulse drawer was.\n [actionBlocksKey.OVERDRAFT_ACTION_BLOCK]: liveEntry(() => ({\n Component: OverdraftBlock,\n usePrepare: useOverdraftPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Credit Utilization's \"Learn more\": donut summary, legend and the per-card list. Loads accounts\n // for the institution logos; the rows themselves ride on the beat.\n [actionBlocksKey.CREDIT_UTILIZATION_ACTION_BLOCK]: liveEntry(() => ({\n Component: CreditUtilizationBlock,\n usePrepare: useCreditUtilizationPrepare,\n title: (_variant, copy) => copy.insights_feed?.credit_utilization?.title ?? '',\n })),\n [actionBlocksKey.EMERGENCY_SAVINGS_ACTION_BLOCK]: liveEntry(() => ({\n Component: EmergencySavingsBlock,\n usePrepare: noop,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Monthly Credit Card Interest Summary's \"Learn how to save\": the credit card payoff calculator.\n [actionBlocksKey.PAYOFF_CALCULATOR_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffCalculatorBlock,\n usePrepare: usePayoffCalculatorPrepare,\n title: (_variant, copy) => copy.insights_feed?.payoff_calculator?.title ?? '',\n })),\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n direct_deposit_block: DetailedAccountBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n debts_block: DebtsBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n no_spend_days_block: NoSpendDaysBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_opportunity_block: SavingsOpportunityBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GA0BjC,IAAA,CAAa,OAAuD;AAAA,EACxE,IAAI,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AAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,GAAO,MAAS,GAAM,kBAAkB,SAAS;AAAA,EACrE,EAAE;AAAA,EAED,CAAA,EAAgB,8BAAA,GAAiC,EAAA,OAAiB;AAAA,IACjE,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,eAAe,mBAAmB,SAAS;AAAA,EAC7E,EAAE;AACJ,GAEa,KAAS;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AACrB"}
1
+ {"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n AccountSwitchBlock,\n BarchartBlock,\n BudgetBlock,\n DebtsBlock,\n DetailedAccountBlock,\n DonutChartBlock,\n GoalsBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WithdrawalBlock,\n TransactionBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, GlobalCopy, InsightsPayload } from '../../core'\nimport { ContactSupportActionBlock } from '../actionBlocks/ContactSupportActionBlock'\nimport { FeedbackModalActionBlock } from '../actionBlocks/FeedbackModalActionBlock'\nimport { ConnectionDetailActionBlock } from '../actionBlocks/ConnectionDetailActionBlock'\nimport { ConnectWidgetActionBlock } from '../actionBlocks/ConnectWidgetActionBlock'\nimport { SurveyModalActionBlock } from '../actionBlocks/SurveyModalActionBlock'\nimport { PlaceholderActionBlock } from '../actionBlocks/PlaceholderActionBlock'\nimport { MakeTransferActionBlockLayer } from '../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer'\nimport { getMakeTransferDrawerTitle } from '../actionBlocks/MakeTransferActionBlock/layout'\nimport { TransactionHistoryBlock } from '../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock'\nimport { getDrawerHeaderTitle } from '../actionBlocks/TransactionHistoryBlock/utils'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport { OverdraftBlock, useOverdraftPrepare } from '../actionBlocks/OverdraftBlock'\nimport { EmergencySavingsBlock } from '../actionBlocks/EmergencySavingsBlock'\nimport {\n CreditUtilizationBlock,\n useCreditUtilizationPrepare,\n} from '../actionBlocks/CreditUtilizationBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\nimport { BudgetDetailsBlock } from '../actionBlocks/BudgetDetailsBlock'\n// Keys live in ./actionBlocksKey (imported directly by chart blocks/tests too) to avoid a\n// circular import between this module and the chart blocks — see that file for details.\nimport { actionBlocksKey } from './actionBlocksKey'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\n\n// Re-exported so existing `hasDrawerBlock` imports from this module keep working.\nexport { hasDrawerBlock } from './hasDrawerBlock'\n\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n // Resolves the drawer title from the clicked CTA's variant + copy, with the beat available\n // for blocks that title from beat fields (e.g. transaction-list reads insights_payload.title).\n // Falls back to the CTA label when the resolver returns an empty string / is absent.\n title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string\n // 'drawer' (default) or 'modal' (component renders its own dialog, no Drawer wrapper).\n presentation?: 'drawer' | 'modal'\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends Add\n// `usePrepare` when the block needs to load data before rendering.\n\n/**\n * A registry entry whose fields read their imports when used, not when this module loads. Some\n * registered blocks render `TransactionDetails`, whose embedded card mounts `ActionBlockLayer`,\n * which imports this registry: when one of those blocks loads first, its own import is not\n * initialised yet while this module evaluates, so a value copied at load would be `undefined`\n * (or throw under native ES modules). Reading on access sees the finished import.\n */\nconst liveEntry = (resolve: () => ActionBlockEntry): ActionBlockEntry => ({\n get Component() {\n return resolve().Component\n },\n get usePrepare() {\n return resolve().usePrepare\n },\n get title() {\n return resolve().title\n },\n get presentation() {\n return resolve().presentation\n },\n})\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: liveEntry(() => ({\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n })),\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: liveEntry(() => ({\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: noop,\n title: getDrawerHeaderTitle,\n })),\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n })),\n // Expense Details for one recurring subscription. Which subscription a beat names is resolved in\n // `RecurringTransactionBlock/subscriptionBeats.ts`, not through this registry.\n [actionBlocksKey.RECURRING_TRANSACTION_ACTION_BLOCK]: liveEntry(() => ({\n Component: RecurringTransactionBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.recurring?.expense_details ?? '',\n })),\n // Remaining Cash for the Payday Cash Left Over Status beat. Store-driven: reuses the recurring\n // loader, which also loads accounts and categories, so CashflowStore's computeds are ready.\n [actionBlocksKey.REMAINING_CASH_ACTION_BLOCK]: liveEntry(() => ({\n Component: RemainingCashBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.insights_feed?.remaining_cash?.title ?? '',\n })),\n // The block renders its own drawer (the help module's RequestSupport) on top of the action\n // drawer, so the action drawer's title is the CTA label.\n [actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK]: liveEntry(() => ({\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n })),\n [actionBlocksKey.FEEDBACK_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: FeedbackModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.CONNECTION_DETAIL_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectionDetailActionBlock,\n usePrepare: noop,\n title: (_variant, copy) =>\n copy.insights_feed?.connection_details?.connection_details_drawer_title ?? '',\n })),\n // Boots MX's Connect widget (web-widget-sdk iframe) inside the action\n // drawer; the drawer title falls back to the CTA label.\n [actionBlocksKey.CONNECT_WIDGET_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectWidgetActionBlock,\n usePrepare: noop,\n })),\n [actionBlocksKey.SURVEY_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SurveyModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // One whole-dollar setting in a dialog; the CTA variant picks which (low-balance threshold or\n // safety net). A modal: no drawer, so no drawer title.\n [actionBlocksKey.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n // Loads inside the block: it mounts only while open, so mounting is the open-time load.\n usePrepare: noop,\n })),\n // Transparent Overdraft's \"Learn more\": the projected overdraft, its account and the confidence\n // meter. Titled from the beat, as the pulse drawer was.\n [actionBlocksKey.OVERDRAFT_ACTION_BLOCK]: liveEntry(() => ({\n Component: OverdraftBlock,\n usePrepare: useOverdraftPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Credit Utilization's \"Learn more\": donut summary, legend and the per-card list. Loads accounts\n // for the institution logos; the rows themselves ride on the beat.\n [actionBlocksKey.CREDIT_UTILIZATION_ACTION_BLOCK]: liveEntry(() => ({\n Component: CreditUtilizationBlock,\n usePrepare: useCreditUtilizationPrepare,\n title: (_variant, copy) => copy.insights_feed?.credit_utilization?.title ?? '',\n })),\n [actionBlocksKey.EMERGENCY_SAVINGS_ACTION_BLOCK]: liveEntry(() => ({\n Component: EmergencySavingsBlock,\n usePrepare: noop,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Monthly Credit Card Interest Summary's \"Learn how to save\": the credit card payoff calculator.\n [actionBlocksKey.PAYOFF_CALCULATOR_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffCalculatorBlock,\n usePrepare: usePayoffCalculatorPrepare,\n title: (_variant, copy) => copy.insights_feed?.payoff_calculator?.title ?? '',\n })),\n [actionBlocksKey.BUDGET_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: BudgetDetailsBlock,\n usePrepare: noop,\n title: (_variant, copy, beat) =>\n beat?.insights_payload?.title || copy.budgets?.details_title || '',\n })),\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n direct_deposit_block: DetailedAccountBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n debts_block: DebtsBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n no_spend_days_block: NoSpendDaysBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_opportunity_block: SavingsOpportunityBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GA0BjC,IAAA,CAAa,OAAuD;AAAA,EACxE,IAAI,YAAY;AACd,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,aAAa;AACf,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,QAAQ;AACV,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,eAAe;AACjB,WAAO,EAAQ,EAAE;AAAA,EACnB;AACF,IAEa,KAAe;AAAA,EACzB,CAAA,EAAgB,wBAAA,GAA2B,EAAA,OAAiB;AAAA,IAC3D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,MAAa;AAAA,EACf,EA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A,IACZ,OAAA,CAAQ,GAAU,GAAM,MACtB,GAAM,kBAAkB,SAAS,EAAK,SAAS,iBAAiB;AAAA,EACpE,EAAE;AACJ,GAEa,KAAS;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.35",
3
+ "version": "9.7.37",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",