@mx-cartographer/experiences 9.7.131 → 9.7.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/core/utils/NumberFormatting.d.ts +6 -0
- package/dist/core/utils/NumberFormatting.es.js +20 -16
- package/dist/core/utils/NumberFormatting.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js +17 -17
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +38 -38
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +14 -14
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -26
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js +22 -22
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +47 -47
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +18 -18
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +28 -28
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +57 -56
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +50 -50
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +52 -51
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +17 -17
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +20 -20
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +25 -25
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +17 -16
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +34 -34
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js +7 -7
- package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js +13 -13
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +39 -39
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +20 -20
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +44 -44
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js +25 -25
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +39 -46
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +18 -18
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +19 -19
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +9 -9
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +12 -12
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +58 -57
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +18 -18
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +10 -10
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js +13 -13
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +3 -1
- package/dist/insights-v2/blocks/slotReaders.es.js +17 -6
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +44 -43
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/SaveAnExtraCard.es.js +6 -6
- package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
- package/dist/insights-v2/components/WithdrawalCard.es.js +20 -20
- package/dist/insights-v2/components/WithdrawalCard.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as g, formatDate as
|
|
3
|
-
import {
|
|
4
|
-
import { buildDataSeries as
|
|
1
|
+
import { buildDynamicCopy as c } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as g, formatDate as p } from "../../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { CURRENCY_FORMAT as m, formatCurrency as l } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { buildDataSeries as y } from "../BarchartBlock/utils.es.js";
|
|
5
5
|
import { parseISO as d } from "date-fns/parseISO";
|
|
6
|
-
import { isValid as
|
|
7
|
-
var
|
|
6
|
+
import { isValid as L } from "date-fns/isValid";
|
|
7
|
+
var h = "income", C = (e) => String(e?.label ?? "").toLowerCase() === h, N = (e) => typeof e?.date == "string" && L(d(e.date)), v = "_1{month}, _2{category}: _3{amount}", b = (e) => String(e?.localized_label ?? e?.label ?? "").toLocaleLowerCase(), A = (e) => Array.isArray(e) ? e.filter((r) => typeof r == "string") : [], _ = (e) => {
|
|
8
8
|
const r = typeof e == "number" ? e : Number(e);
|
|
9
9
|
return Number.isFinite(r) ? r : 0;
|
|
10
|
-
}, D = (e, r =
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
10
|
+
}, D = (e, r = v) => {
|
|
11
|
+
const i = y(e).filter(N);
|
|
12
|
+
if (i.length === 0) return [];
|
|
13
13
|
const s = /* @__PURE__ */ new Map();
|
|
14
|
-
for (const t of
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
for (const t of i) {
|
|
15
|
+
const o = String(t.date).slice(0, 7), a = s.get(o);
|
|
16
|
+
a ? a.push(t) : s.set(o, [t]);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
const
|
|
18
|
+
const n = [...s.values()].filter((t) => t.length === 2);
|
|
19
|
+
return n.length === 0 ? [] : n.map((t) => {
|
|
20
|
+
const o = t.find(C) ?? t[t.length - 1];
|
|
21
21
|
return {
|
|
22
|
-
mainRow: t.find((
|
|
23
|
-
comparisonRow:
|
|
22
|
+
mainRow: t.find((a) => a !== o) ?? t[0],
|
|
23
|
+
comparisonRow: o
|
|
24
24
|
};
|
|
25
|
-
}).sort(({ mainRow: t }, { mainRow:
|
|
26
|
-
const
|
|
25
|
+
}).sort(({ mainRow: t }, { mainRow: o }) => d(t.date).getTime() - d(o.date).getTime()).map(({ mainRow: t, comparisonRow: o }) => {
|
|
26
|
+
const a = _(t.amount), f = _(o.amount), u = p(d(t.date), g.MONTH_LONG);
|
|
27
27
|
return {
|
|
28
|
-
ariaLabelMain:
|
|
29
|
-
ariaLabelComparison:
|
|
30
|
-
comparison:
|
|
31
|
-
comparisonGuids:
|
|
28
|
+
ariaLabelMain: c(r, u, b(t), l(a, m.cents)),
|
|
29
|
+
ariaLabelComparison: c(r, u, b(o), l(f, m.cents)),
|
|
30
|
+
comparison: f,
|
|
31
|
+
comparisonGuids: A(o.aggregated_guids),
|
|
32
32
|
date: t.date,
|
|
33
|
-
formattedComparison:
|
|
34
|
-
formattedMain:
|
|
35
|
-
label:
|
|
36
|
-
main:
|
|
37
|
-
mainGuids:
|
|
33
|
+
formattedComparison: l(f, m.whole),
|
|
34
|
+
formattedMain: l(a, m.whole),
|
|
35
|
+
label: p(d(t.date), g.MONTH_SHORT),
|
|
36
|
+
main: a,
|
|
37
|
+
mainGuids: A(t.aggregated_guids)
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
40
|
}, E = (e) => {
|
|
41
41
|
if (Array.isArray(e))
|
|
42
|
-
return e.filter((r) => typeof r?.label == "string" && r.label !== "").map(({ label: r, value:
|
|
43
|
-
const
|
|
42
|
+
return e.filter((r) => typeof r?.label == "string" && r.label !== "").map(({ label: r, value: i, value_type: s }) => {
|
|
43
|
+
const n = Number.isFinite(i) ? i : void 0;
|
|
44
44
|
return {
|
|
45
45
|
label: r,
|
|
46
46
|
value_type: s,
|
|
47
|
-
value:
|
|
48
|
-
amount:
|
|
49
|
-
formattedAmount:
|
|
47
|
+
value: n ?? 0,
|
|
48
|
+
amount: n ?? 0,
|
|
49
|
+
formattedAmount: n === void 0 ? "" : l(n, m.cents)
|
|
50
50
|
};
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
v as COMPARISON_BAR_ARIA_LABEL,
|
|
55
55
|
D as buildComparisonSeries,
|
|
56
56
|
E as toLegendItems
|
|
57
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparisonUtils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.ts"],"sourcesContent":["import { isValid } from 'date-fns/isValid'\nimport { parseISO } from 'date-fns/parseISO'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DataSeries } from '../../../../core'\nimport type { Legends } from '../../../../core'\nimport type { DataSet, LegendProps } from '../../../../core/types/InsightsInstanceSlotData'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { buildDataSeries } from '../BarchartBlock/utils'\n\n// The comparison (second) series across every double-bar variant is Income (spend/savings/debt/\n// cost-of-living are all \"X to Income\"). `label` is the stable, non-localized category key, so we\n// key off it rather than row position — the wire lists income first within some months.\nconst INCOME_LABEL = 'income'\nconst isIncomeRow = (row: { label?: string }): boolean =>\n String(row?.label ?? '').toLowerCase() === INCOME_LABEL\n\n// A date-only wire string ('2026-03-01') is a valid ISO date; anything the backend sends that\n// parseISO can't turn into a real Date is dropped before it can poison the ascending sort with a\n// NaN comparator (which would scramble column order — and the chartBarIndex the card forwards to the\n// drilldown on click).\nconst hasValidDate = (row: { date?: string }): boolean =>\n typeof row?.date === 'string' && isValid(parseISO(row.date))\n\n// Fallback for insights_feed.general.in_month_you_had_a_category_of_amount (same slot order:\n// _1 month, _2 category, _3 amount). Used when the copy store hasn't loaded that key yet.\nexport const COMPARISON_BAR_ARIA_LABEL = '_1{month}, _2{category}: _3{amount}'\n\n// The series name shown to screen readers, lower-cased to match legacy pulse copy (\"...a spend of\").\n// `localized_label` is the backend's already-localized display name; `label` ('income'/'spend') is\n// an English-only fallback for dev/error scenarios.\nconst seriesName = (row: { localized_label?: string; label?: string }): string =>\n String(row?.localized_label ?? row?.label ?? '').toLocaleLowerCase()\n\n// `amount` is wire data and only loosely typed. `?? 0` guards a missing value but not a non-numeric\n// one (a stray string/null would render as NaN in the bar and the aria label), so coerce and fall\n// back to 0 unless the result is a finite number.\n// `aggregated_guids` is the row's transactions (wire data, loosely typed): keep the string guids only.\nconst toGuids = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((guid): guid is string => typeof guid === 'string') : []\n\nconst toAmount = (value: unknown): number => {\n const parsed = typeof value === 'number' ? value : Number(value)\n return Number.isFinite(parsed) ? parsed : 0\n}\n\n/**\n * Reshapes a flat comparison data_series into one shaped bar per month, sorted ascending by date —\n * the double-bar equivalent of buildChartData. Each month has exactly two contiguous rows; the\n * Income row becomes the comparison series and the other becomes main, regardless of wire order.\n * Months are then sorted ascending so the chart's bar index and the axis line up.\n */\nexport const buildComparisonSeries = (\n data: DataSeries | undefined,\n ariaLabel = COMPARISON_BAR_ARIA_LABEL,\n): DataSet[] => {\n // Guard the wire data before shaping it: `data_series` is type-asserted upstream, not validated, so\n // drop any row without a parseable date rather than let it flow into the sort/group logic.\n const flat = buildDataSeries(data).filter(hasValidDate)\n if (flat.length === 0) {\n return []\n }\n\n // Bucket rows by calendar month (YYYY-MM), not the exact date string, so a month whose rows carry\n // different day-of-month values (e.g. 2026-01-01 vs 2026-01-15) still groups into one bar rather\n // than two size-1 groups that are then dropped as malformed. First-seen order is preserved so the\n // ascending date sort below is stable.\n const byDate = new Map<string, any[]>()\n for (const row of flat) {\n const monthKey = String(row.date).slice(0, 7)\n const group = byDate.get(monthKey)\n if (group) group.push(row)\n else byDate.set(monthKey, [row])\n }\n\n // Keep only well-formed months (exactly one main + one comparison row). A month that lost a row to\n // the date guard above, or arrived malformed, is dropped on its own instead of blanking the whole\n // chart; return [] only when no valid month remains.\n const groups = [...byDate.values()].filter((group) => group.length === 2)\n if (groups.length === 0) {\n return []\n }\n\n return groups\n .map((group) => {\n // Income is always the comparison series; the remaining row is the main category. Fall back to\n // wire order (first = main, last = comparison) if no row is labeled income.\n const comparisonRow = group.find(isIncomeRow) ?? group[group.length - 1]\n const mainRow = group.find((row) => row !== comparisonRow) ?? group[0]\n return { mainRow, comparisonRow }\n })\n .sort(\n ({ mainRow: a }, { mainRow: b }) => parseISO(a.date).getTime() - parseISO(b.date).getTime(),\n )\n .map(({ mainRow, comparisonRow }) => {\n const main = toAmount(mainRow.amount)\n const comparison = toAmount(comparisonRow.amount)\n const monthLong = formatDate(parseISO(mainRow.date), DATE_FORMATS_INTL.MONTH_LONG)\n\n return {\n // Slots: _1 month, _2 series name, _3 amount (legacy in_month_you_had_a_category_of_amount).\n ariaLabelMain: buildDynamicCopy(\n ariaLabel,\n monthLong,\n seriesName(mainRow),\n formatCurrency(main,
|
|
1
|
+
{"version":3,"file":"comparisonUtils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.ts"],"sourcesContent":["import { isValid } from 'date-fns/isValid'\nimport { parseISO } from 'date-fns/parseISO'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DataSeries } from '../../../../core'\nimport type { Legends } from '../../../../core'\nimport type { DataSet, LegendProps } from '../../../../core/types/InsightsInstanceSlotData'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { buildDataSeries } from '../BarchartBlock/utils'\n\n// The comparison (second) series across every double-bar variant is Income (spend/savings/debt/\n// cost-of-living are all \"X to Income\"). `label` is the stable, non-localized category key, so we\n// key off it rather than row position — the wire lists income first within some months.\nconst INCOME_LABEL = 'income'\nconst isIncomeRow = (row: { label?: string }): boolean =>\n String(row?.label ?? '').toLowerCase() === INCOME_LABEL\n\n// A date-only wire string ('2026-03-01') is a valid ISO date; anything the backend sends that\n// parseISO can't turn into a real Date is dropped before it can poison the ascending sort with a\n// NaN comparator (which would scramble column order — and the chartBarIndex the card forwards to the\n// drilldown on click).\nconst hasValidDate = (row: { date?: string }): boolean =>\n typeof row?.date === 'string' && isValid(parseISO(row.date))\n\n// Fallback for insights_feed.general.in_month_you_had_a_category_of_amount (same slot order:\n// _1 month, _2 category, _3 amount). Used when the copy store hasn't loaded that key yet.\nexport const COMPARISON_BAR_ARIA_LABEL = '_1{month}, _2{category}: _3{amount}'\n\n// The series name shown to screen readers, lower-cased to match legacy pulse copy (\"...a spend of\").\n// `localized_label` is the backend's already-localized display name; `label` ('income'/'spend') is\n// an English-only fallback for dev/error scenarios.\nconst seriesName = (row: { localized_label?: string; label?: string }): string =>\n String(row?.localized_label ?? row?.label ?? '').toLocaleLowerCase()\n\n// `amount` is wire data and only loosely typed. `?? 0` guards a missing value but not a non-numeric\n// one (a stray string/null would render as NaN in the bar and the aria label), so coerce and fall\n// back to 0 unless the result is a finite number.\n// `aggregated_guids` is the row's transactions (wire data, loosely typed): keep the string guids only.\nconst toGuids = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((guid): guid is string => typeof guid === 'string') : []\n\nconst toAmount = (value: unknown): number => {\n const parsed = typeof value === 'number' ? value : Number(value)\n return Number.isFinite(parsed) ? parsed : 0\n}\n\n/**\n * Reshapes a flat comparison data_series into one shaped bar per month, sorted ascending by date —\n * the double-bar equivalent of buildChartData. Each month has exactly two contiguous rows; the\n * Income row becomes the comparison series and the other becomes main, regardless of wire order.\n * Months are then sorted ascending so the chart's bar index and the axis line up.\n */\nexport const buildComparisonSeries = (\n data: DataSeries | undefined,\n ariaLabel = COMPARISON_BAR_ARIA_LABEL,\n): DataSet[] => {\n // Guard the wire data before shaping it: `data_series` is type-asserted upstream, not validated, so\n // drop any row without a parseable date rather than let it flow into the sort/group logic.\n const flat = buildDataSeries(data).filter(hasValidDate)\n if (flat.length === 0) {\n return []\n }\n\n // Bucket rows by calendar month (YYYY-MM), not the exact date string, so a month whose rows carry\n // different day-of-month values (e.g. 2026-01-01 vs 2026-01-15) still groups into one bar rather\n // than two size-1 groups that are then dropped as malformed. First-seen order is preserved so the\n // ascending date sort below is stable.\n const byDate = new Map<string, any[]>()\n for (const row of flat) {\n const monthKey = String(row.date).slice(0, 7)\n const group = byDate.get(monthKey)\n if (group) group.push(row)\n else byDate.set(monthKey, [row])\n }\n\n // Keep only well-formed months (exactly one main + one comparison row). A month that lost a row to\n // the date guard above, or arrived malformed, is dropped on its own instead of blanking the whole\n // chart; return [] only when no valid month remains.\n const groups = [...byDate.values()].filter((group) => group.length === 2)\n if (groups.length === 0) {\n return []\n }\n\n return groups\n .map((group) => {\n // Income is always the comparison series; the remaining row is the main category. Fall back to\n // wire order (first = main, last = comparison) if no row is labeled income.\n const comparisonRow = group.find(isIncomeRow) ?? group[group.length - 1]\n const mainRow = group.find((row) => row !== comparisonRow) ?? group[0]\n return { mainRow, comparisonRow }\n })\n .sort(\n ({ mainRow: a }, { mainRow: b }) => parseISO(a.date).getTime() - parseISO(b.date).getTime(),\n )\n .map(({ mainRow, comparisonRow }) => {\n const main = toAmount(mainRow.amount)\n const comparison = toAmount(comparisonRow.amount)\n const monthLong = formatDate(parseISO(mainRow.date), DATE_FORMATS_INTL.MONTH_LONG)\n\n return {\n // Slots: _1 month, _2 series name, _3 amount (legacy in_month_you_had_a_category_of_amount).\n ariaLabelMain: buildDynamicCopy(\n ariaLabel,\n monthLong,\n seriesName(mainRow),\n formatCurrency(main, CURRENCY_FORMAT.cents),\n ) as string,\n ariaLabelComparison: buildDynamicCopy(\n ariaLabel,\n monthLong,\n seriesName(comparisonRow),\n formatCurrency(comparison, CURRENCY_FORMAT.cents),\n ) as string,\n comparison,\n // The bars' transactions, for the drawer's month x Spend / Income membership filter.\n comparisonGuids: toGuids(comparisonRow.aggregated_guids),\n date: mainRow.date,\n formattedComparison: formatCurrency(comparison, CURRENCY_FORMAT.whole),\n formattedMain: formatCurrency(main, CURRENCY_FORMAT.whole),\n label: formatDate(parseISO(mainRow.date), DATE_FORMATS_INTL.MONTH_SHORT),\n main,\n mainGuids: toGuids(mainRow.aggregated_guids),\n }\n })\n}\n\n/**\n * The legend items from ditto's `additional_data` (`{ label, value, value_type }`, Insights 2.0): the\n * amount formatted as currency. An item with no finite `value` (a beat stored before the totals were\n * written, until its sample loads) keeps its label and shows no amount — never $0.00 or NaN.\n */\nexport const toLegendItems = (additionalData: unknown): LegendProps[] | undefined => {\n if (!Array.isArray(additionalData)) return undefined\n\n return additionalData\n .filter((item): item is Legends => typeof item?.label === 'string' && item.label !== '')\n .map(({ label, value, value_type }): LegendProps => {\n // Number.isFinite also rejects a non-number value.\n const amount = Number.isFinite(value) ? value : undefined\n\n return {\n label,\n value_type,\n value: amount ?? 0,\n amount: amount ?? 0,\n formattedAmount: amount === undefined ? '' : formatCurrency(amount, CURRENCY_FORMAT.cents),\n }\n })\n}\n"],"mappings":";;;;;;AAcA,IAAM,IAAe,UACf,IAAA,CAAe,MACnB,OAAO,GAAK,SAAS,EAAE,EAAE,YAAY,MAAM,GAMvC,IAAA,CAAgB,MACpB,OAAO,GAAK,QAAS,YAAY,EAAQ,EAAS,EAAI,IAAI,CAAC,GAIhD,IAA4B,uCAKnC,IAAA,CAAc,MAClB,OAAO,GAAK,mBAAmB,GAAK,SAAS,EAAE,EAAE,kBAAkB,GAM/D,IAAA,CAAW,MACf,MAAM,QAAQ,CAAK,IAAI,EAAM,OAAA,CAAQ,MAAyB,OAAO,KAAS,QAAQ,IAAI,CAAC,GAEvF,IAAA,CAAY,MAA2B;AAC3C,QAAM,IAAS,OAAO,KAAU,WAAW,IAAQ,OAAO,CAAK;AAC/D,SAAO,OAAO,SAAS,CAAM,IAAI,IAAS;AAC5C,GAQa,IAAA,CACX,GACA,IAAY,MACE;AAGd,QAAM,IAAO,EAAgB,CAAI,EAAE,OAAO,CAAY;AACtD,MAAI,EAAK,WAAW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Y,EAAgB,KAAK;AAAA,MACrE,eAAe,EAAe,GAAM,EAAgB,KAAK;AAAA,MACzD,OAAO,EAAW,EAAS,EAAQ,IAAI,GAAG,EAAkB,WAAW;AAAA,MACvE,MAAA;AAAA,MACA,WAAW,EAAQ,EAAQ,gBAAgB;AAAA,IAC7C;AAAA,EACF,CAAC;AACL,GAOa,IAAA,CAAiB,MAAuD;AACnF,MAAK,MAAM,QAAQ,CAAc;AAEjC,WAAO,EACJ,OAAA,CAAQ,MAA0B,OAAO,GAAM,SAAU,YAAY,EAAK,UAAU,EAAE,EACtF,IAAA,CAAK,EAAE,OAAA,GAAO,OAAA,GAAO,YAAA,EAAA,MAA8B;AAElD,YAAM,IAAS,OAAO,SAAS,CAAK,IAAI,IAAQ;AAEhD,aAAO;AAAA,QACL,OAAA;AAAA,QACA,YAAA;AAAA,QACA,OAAO,KAAU;AAAA,QACjB,QAAQ,KAAU;AAAA,QAClB,iBAAiB,MAAW,SAAY,KAAK,EAAe,GAAQ,EAAgB,KAAK;AAAA,MAC3F;AAAA,IACF,CAAC;AACL"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CURRENCY_FORMAT as c, formatCurrency as d } from "../../../../core/utils/NumberFormatting.es.js";
|
|
2
2
|
import e from "@mui/material/Stack";
|
|
3
3
|
import { Text as n } from "@mxenabled/mxui";
|
|
4
4
|
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
5
|
-
import { useTheme as
|
|
6
|
-
import
|
|
7
|
-
var
|
|
8
|
-
const o =
|
|
5
|
+
import { useTheme as h } from "@mui/material/styles";
|
|
6
|
+
import p from "@mui/material/Box";
|
|
7
|
+
var w = ({ label: t, amount: s, percentage: a, isBold: l }) => {
|
|
8
|
+
const o = h(), i = d(s, c.cents);
|
|
9
9
|
return /* @__PURE__ */ m(e, {
|
|
10
10
|
sx: { gap: 4 },
|
|
11
11
|
children: [/* @__PURE__ */ m(e, {
|
|
@@ -33,7 +33,7 @@ var v = ({ label: t, amount: s, percentage: a, isBold: l }) => {
|
|
|
33
33
|
height: 12,
|
|
34
34
|
borderRadius: 6
|
|
35
35
|
},
|
|
36
|
-
children: /* @__PURE__ */ r(
|
|
36
|
+
children: /* @__PURE__ */ r(p, { sx: {
|
|
37
37
|
bgcolor: o.palette.warning.main,
|
|
38
38
|
height: 12,
|
|
39
39
|
borderRadius: 6,
|
|
@@ -43,7 +43,7 @@ var v = ({ label: t, amount: s, percentage: a, isBold: l }) => {
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
w as default
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
//# sourceMappingURL=ProgressBar.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface ProgressBarProps {\n label: string\n amount: number\n percentage: number\n isBold?: boolean\n}\n\n/**\n * One labelled bar. The track is a `progressbar` whose value is the fill percentage and whose name is\n * the label plus the amount, so the comparison the block draws is readable by assistive tech (and\n * assertable in tests) rather than existing only as a CSS width.\n */\nconst ProgressBar = ({ label, amount, percentage, isBold }: ProgressBarProps) => {\n const theme = useTheme()\n const formattedAmount = formatCurrency(amount,
|
|
1
|
+
{"version":3,"file":"ProgressBar.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\nimport { Text } from '@mxenabled/mxui'\n\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface ProgressBarProps {\n label: string\n amount: number\n percentage: number\n isBold?: boolean\n}\n\n/**\n * One labelled bar. The track is a `progressbar` whose value is the fill percentage and whose name is\n * the label plus the amount, so the comparison the block draws is readable by assistive tech (and\n * assertable in tests) rather than existing only as a CSS width.\n */\nconst ProgressBar = ({ label, amount, percentage, isBold }: ProgressBarProps) => {\n const theme = useTheme()\n const formattedAmount = formatCurrency(amount, CURRENCY_FORMAT.cents)\n\n return (\n <Stack sx={{ gap: 4 }}>\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n }}\n >\n <Text variant=\"caption\">{label}</Text>\n <Text bold={isBold} variant=\"caption\">\n {formattedAmount}\n </Text>\n </Stack>\n <Stack\n aria-label={`${label} ${formattedAmount}`}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={percentage}\n role=\"progressbar\"\n sx={{\n bgcolor: theme.palette.warning.lighter,\n height: 12,\n borderRadius: 6,\n }}\n >\n <Box\n sx={{\n bgcolor: theme.palette.warning.main,\n height: 12,\n borderRadius: 6,\n width: `${percentage}%`,\n }}\n />\n </Stack>\n </Stack>\n )\n}\n\nexport default ProgressBar\n"],"mappings":";;;;;;AAmBA,IAAM,IAAA,CAAe,EAAE,OAAA,GAAO,QAAA,GAAQ,YAAA,GAAY,QAAA,EAAA,MAA+B;AAC/E,QAAM,IAAQ,EAAS,GACjB,IAAkB,EAAe,GAAQ,EAAgB,KAAK;AAEpE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,KAAK,EAAE;AAAA,IAApB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,gBAAgB;AAAA,MAClB;AAAA,MALF,UAAA,CAOE,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAW,UAAA;AAAA,MAAY,CAAA,GACrC,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAQ,SAAQ;AAAA,QACzB,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MACE,cAAY,GAAG,CAAA,IAAS,CAAA;AAAA,MACxB,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,MAAK;AAAA,MACL,IAAI;AAAA,QACF,SAAS,EAAM,QAAQ,QAAQ;AAAA,QAC/B,QAAQ;AAAA,QACR,cAAc;AAAA,MAChB;AAAA,MAEA,UAAA,gBAAA,EAAC,GAAD,EACE,IAAI;AAAA,QACF,SAAS,EAAM,QAAQ,QAAQ;AAAA,QAC/B,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,OAAO,GAAG,CAAA;AAAA,MACZ,EACD,CAAA;AAAA,IACI,CAAA,CACF;AAAA;AAEX"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getStepColor as
|
|
1
|
+
import { CURRENCY_FORMAT as g, formatCurrency as C } from "../../../../../core/utils/NumberFormatting.es.js";
|
|
2
|
+
import { getStepColor as i } from "../utils.es.js";
|
|
3
3
|
import u from "react";
|
|
4
4
|
import o from "@mui/material/Stack";
|
|
5
5
|
import { H3 as b, Text as m } from "@mxenabled/mxui";
|
|
6
|
-
import { CheckCircle as
|
|
6
|
+
import { CheckCircle as I, CircleIcon as S } from "@mxenabled/mx-icons";
|
|
7
7
|
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
8
8
|
import n from "@mui/material/Box";
|
|
9
9
|
var a = [
|
|
10
10
|
100,
|
|
11
11
|
500,
|
|
12
12
|
1e3
|
|
13
|
-
],
|
|
13
|
+
], y = [
|
|
14
14
|
0,
|
|
15
15
|
1,
|
|
16
16
|
2
|
|
17
|
-
],
|
|
17
|
+
], M = ({ slotData: d }) => {
|
|
18
18
|
const { completed_steps: s, label_1: p, label_2: h } = d, x = a.length === s;
|
|
19
19
|
return /* @__PURE__ */ t(o, {
|
|
20
20
|
sx: {
|
|
@@ -39,10 +39,10 @@ var a = [
|
|
|
39
39
|
sx: { height: 40 },
|
|
40
40
|
children: /* @__PURE__ */ t(o, {
|
|
41
41
|
sx: { flexDirection: "row" },
|
|
42
|
-
children: [
|
|
43
|
-
const c = e < s, f = c ?
|
|
44
|
-
return /* @__PURE__ */ t(u.Fragment, { children: [/* @__PURE__ */ r(n, { sx: (
|
|
45
|
-
bgcolor: l
|
|
42
|
+
children: [y.map((e) => {
|
|
43
|
+
const c = e < s, f = c ? I : S;
|
|
44
|
+
return /* @__PURE__ */ t(u.Fragment, { children: [/* @__PURE__ */ r(n, { sx: (l) => ({
|
|
45
|
+
bgcolor: i(l, c),
|
|
46
46
|
height: 2,
|
|
47
47
|
mt: 12,
|
|
48
48
|
width: 54
|
|
@@ -54,15 +54,15 @@ var a = [
|
|
|
54
54
|
children: [/* @__PURE__ */ r(f, {
|
|
55
55
|
filled: !0,
|
|
56
56
|
size: 24,
|
|
57
|
-
sx: (
|
|
57
|
+
sx: (l) => ({ color: i(l, c) })
|
|
58
58
|
}), /* @__PURE__ */ r(m, {
|
|
59
59
|
color: c ? "text.primary" : "text.secondary",
|
|
60
60
|
variant: "caption",
|
|
61
|
-
children:
|
|
61
|
+
children: C(a[e], g.whole)
|
|
62
62
|
})]
|
|
63
63
|
})] }, e);
|
|
64
64
|
}), /* @__PURE__ */ r(n, { sx: (e) => ({
|
|
65
|
-
bgcolor:
|
|
65
|
+
bgcolor: i(e, x),
|
|
66
66
|
height: 2,
|
|
67
67
|
mt: 12,
|
|
68
68
|
width: 54
|
|
@@ -72,7 +72,7 @@ var a = [
|
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
export {
|
|
75
|
-
|
|
75
|
+
M as default
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
//# sourceMappingURL=WithText.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithText.es.js","names":[],"sources":["../../../../../../src/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { CheckCircle, CircleIcon } from '@mxenabled/mx-icons'\n\nimport {
|
|
1
|
+
{"version":3,"file":"WithText.es.js","names":[],"sources":["../../../../../../src/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { CheckCircle, CircleIcon } from '@mxenabled/mx-icons'\n\nimport type { StepChartBlockData } from '../../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../../core/utils/NumberFormatting'\n\nimport { getStepColor } from '../utils'\n\nconst MILESTONES = [100, 500, 1000] as const\nconst MILESTONE_INDICES = [0, 1, 2] as const\n\n// TODO: Update bgColor, borderColor, and color based on the variants.\n\nconst WithText = ({ slotData }: { slotData: StepChartBlockData }) => {\n const { completed_steps: completedSteps, label_1, label_2 } = slotData\n const allCompleted = MILESTONES.length === completedSteps\n\n return (\n <Stack\n sx={{\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n gap: 16,\n py: 16,\n }}\n >\n <Stack sx={{ px: 16 }}>\n <Text color=\"text.secondary\" variant=\"tiny\">\n {label_1}\n </Text>\n <H3 color=\"success.dark\">{label_2}</H3>\n </Stack>\n <Stack sx={{ height: 40 }}>\n <Stack sx={{ flexDirection: 'row' }}>\n {MILESTONE_INDICES.map((index) => {\n const completed = index < completedSteps\n const Icon = completed ? CheckCircle : CircleIcon\n\n return (\n <React.Fragment key={index}>\n <Box\n sx={(theme) => ({\n bgcolor: getStepColor(theme, completed),\n height: 2,\n mt: 12,\n width: 54,\n })}\n />\n <Stack sx={{ alignItems: 'center', width: 24 }}>\n <Icon\n filled={true}\n size={24}\n sx={(theme) => ({ color: getStepColor(theme, completed) })}\n />\n <Text color={completed ? 'text.primary' : 'text.secondary'} variant=\"caption\">\n {formatCurrency(MILESTONES[index], CURRENCY_FORMAT.whole)}\n </Text>\n </Stack>\n </React.Fragment>\n )\n })}\n <Box\n sx={(theme) => ({\n bgcolor: getStepColor(theme, allCompleted),\n height: 2,\n mt: 12,\n width: 54,\n })}\n />\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default WithText\n"],"mappings":";;;;;;;;AAaA,IAAM,IAAa;AAAA,EAAC;AAAA,EAAK;AAAA,EAAK;AAAI,GAC5B,IAAoB;AAAA,EAAC;AAAA,EAAG;AAAA,EAAG;AAAC,GAI5B,IAAA,CAAY,EAAE,UAAA,EAAA,MAAiD;AACnE,QAAM,EAAE,iBAAiB,GAAgB,SAAA,GAAS,SAAA,EAAA,IAAY,GACxD,IAAe,EAAW,WAAW;AAE3C,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MACd,KAAK;AAAA,MACL,IAAI;AAAA,IACN;AAAA,IARF,UAAA,CAUE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI,EAAE,IAAI,GAAG;AAAA,MAApB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,SAAQ;AAAA,QAClC,UAAA;AAAA,MACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,QAAI,OAAM;AAAA,QAAgB,UAAA;AAAA,MAAY,CAAA,CACjC;AAAA,IACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI,EAAE,QAAQ,GAAG;AAAA,MACtB,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI,EAAE,eAAe,MAAM;AAAA,QAAlC,UAAA,CACG,EAAkB,IAAA,CAAK,MAAU;AAChC,gBAAM,IAAY,IAAQ,GACpB,IAAO,IAAY,IAAc;AAEvC,iBACE,gBAAA,EAAC,EAAM,UAAP,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD,EACE,IAAA,CAAK,OAAW;AAAA,YACd,SAAS,EAAa,GAAO,CAAS;AAAA,YACtC,QAAQ;AAAA,YACR,IAAI;AAAA,YACJ,OAAO;AAAA,UACT,GACD,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,YAAO,IAAI;AAAA,cAAE,YAAY;AAAA,cAAU,OAAO;AAAA,YAAG;AAAA,YAA7C,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,cACE,QAAQ;AAAA,cACR,MAAM;AAAA,cACN,IAAA,CAAK,OAAW,EAAE,OAAO,EAAa,GAAO,CAAS,EAAE;AAAA,YACzD,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,cAAM,OAAO,IAAY,iBAAiB;AAAA,cAAkB,SAAQ;AAAA,cACjE,UAAA,EAAe,EAAW,CAAA,GAAQ,EAAgB,KAAK;AAAA,YACpD,CAAA,CACD;AAAA,UACO,CAAA,CAAA,EAAA,GAnBK,CAmBL;AAAA,QAEpB,CAAC,GACD,gBAAA,EAAC,GAAD,EACE,IAAA,CAAK,OAAW;AAAA,UACd,SAAS,EAAa,GAAO,CAAY;AAAA,UACzC,QAAQ;AAAA,UACR,IAAI;AAAA,UACJ,OAAO;AAAA,QACT,GACD,CAAA,CACI;AAAA;IACF,CAAA,CACF;AAAA;AAEX"}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { slot as d } from "../../../../core/types/Insights.es.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CURRENCY_FORMAT as T, formatCurrency as k } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
3
|
import { resolveVariantConfig as $ } from "../../resolveVariantConfig.es.js";
|
|
4
|
-
import {
|
|
5
|
-
import { useContainerDimensions as
|
|
6
|
-
import
|
|
7
|
-
import { Confetti as
|
|
8
|
-
import { ReactComponent as
|
|
9
|
-
import { ReactComponent as
|
|
10
|
-
import { statusIconName as
|
|
11
|
-
import { isDetailedAccountVariant as
|
|
4
|
+
import { asLogoRef as j, asNumber as N, asText as x } from "../../slotReaders.es.js";
|
|
5
|
+
import { useContainerDimensions as P } from "../../../hooks/useContainerDimensions.es.js";
|
|
6
|
+
import E from "../../../components/LogoFromGuid.es.js";
|
|
7
|
+
import { Confetti as O } from "../../../components/shared/Confetti.es.js";
|
|
8
|
+
import { ReactComponent as G } from "../../../components/shared/images/PaidOffCard.es.js";
|
|
9
|
+
import { ReactComponent as H } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
|
|
10
|
+
import { statusIconName as M } from "../../../components/statusIcon.es.js";
|
|
11
|
+
import { isDetailedAccountVariant as U } from "../DetailedAccountBlock/layout.es.js";
|
|
12
12
|
import W from "../DetailedAccountBlock/DetailedAccountBlock.es.js";
|
|
13
|
-
import { HeaderComponent as
|
|
14
|
-
import { getLayoutConfig as
|
|
15
|
-
import { IconComponent as
|
|
16
|
-
import { useRef as
|
|
13
|
+
import { HeaderComponent as Y } from "./HeaderComponent.es.js";
|
|
14
|
+
import { getLayoutConfig as q } from "./layout.es.js";
|
|
15
|
+
import { IconComponent as J } from "./IconComponent.es.js";
|
|
16
|
+
import { useRef as K } from "react";
|
|
17
17
|
import r from "@mui/material/Stack";
|
|
18
18
|
import { Text as l } from "@mxenabled/mxui";
|
|
19
|
-
import { Icon as
|
|
19
|
+
import { Icon as I } from "@mxenabled/mx-icons";
|
|
20
20
|
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
21
21
|
import { useTheme as Q } from "@mui/material/styles";
|
|
22
22
|
import s from "@mui/material/Box";
|
|
23
|
-
var
|
|
24
|
-
const h = Q(), b =
|
|
25
|
-
if (
|
|
26
|
-
const { data: i } = n, m = i !== void 0, u = m ?
|
|
23
|
+
var vo = ({ payload: g }) => {
|
|
24
|
+
const h = Q(), b = K(null), { height: w, width: R } = P(b), { instance_slot: n } = g, { variant: p, institution_guid: S, institution_name: z, icon_name: D, merchant_name: A } = n;
|
|
25
|
+
if (U(p)) return /* @__PURE__ */ o(W, { payload: g });
|
|
26
|
+
const { data: i } = n, m = i !== void 0, u = m ? N(d(i, "amount")) : n.amount, v = x(d(i, "sub_text")), y = m ? v : n.sub_text, L = m ? v : n.label, a = m ? x(d(i, "header_text")) : n.header_text, c = j(d(i, "logo")), e = $(q(h), p, "default", "AccountBlock");
|
|
27
27
|
if (e?.isConfetti) {
|
|
28
|
-
const f =
|
|
28
|
+
const f = M(c?.guid), B = {
|
|
29
29
|
paidOffCard: /* @__PURE__ */ o(s, {
|
|
30
30
|
sx: {
|
|
31
31
|
flexShrink: 0,
|
|
@@ -33,7 +33,7 @@ var wo = ({ payload: g }) => {
|
|
|
33
33
|
position: "relative",
|
|
34
34
|
width: 48
|
|
35
35
|
},
|
|
36
|
-
children: /* @__PURE__ */ o(
|
|
36
|
+
children: /* @__PURE__ */ o(G, {
|
|
37
37
|
"aria-hidden": !0,
|
|
38
38
|
role: "presentation",
|
|
39
39
|
style: {
|
|
@@ -43,7 +43,7 @@ var wo = ({ payload: g }) => {
|
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
45
|
}),
|
|
46
|
-
savings: /* @__PURE__ */ o(
|
|
46
|
+
savings: /* @__PURE__ */ o(H, {
|
|
47
47
|
"aria-hidden": !0,
|
|
48
48
|
height: 55,
|
|
49
49
|
role: "presentation",
|
|
@@ -66,26 +66,26 @@ var wo = ({ payload: g }) => {
|
|
|
66
66
|
justifyContent: "center",
|
|
67
67
|
width: "100%"
|
|
68
68
|
},
|
|
69
|
-
children: /* @__PURE__ */ o(
|
|
69
|
+
children: /* @__PURE__ */ o(I, {
|
|
70
70
|
"aria-hidden": !0,
|
|
71
71
|
name: f,
|
|
72
72
|
size: e.logo_icon_size ?? 24,
|
|
73
73
|
sx: { color: "success.contrastText" }
|
|
74
74
|
})
|
|
75
|
-
}) : c?.guid ? /* @__PURE__ */ o(
|
|
75
|
+
}) : c?.guid ? /* @__PURE__ */ o(E, {
|
|
76
76
|
logo: c,
|
|
77
77
|
size: 48
|
|
78
78
|
}) : null
|
|
79
79
|
})
|
|
80
|
-
}[e.graphic ?? "logo"],
|
|
80
|
+
}[e.graphic ?? "logo"], F = x(d(i, "secondary_text")) || (A ?? z), C = e.secondarySource === "merchant" ? F : L, _ = C ? /* @__PURE__ */ o(l, {
|
|
81
81
|
color: e.secondaryColor,
|
|
82
82
|
variant: e.secondaryVariant,
|
|
83
|
-
children:
|
|
83
|
+
children: C
|
|
84
84
|
}) : null, V = u != null ? /* @__PURE__ */ o(l, {
|
|
85
85
|
bold: !0,
|
|
86
86
|
color: "success.dark",
|
|
87
87
|
variant: e.amountVariant,
|
|
88
|
-
children: `${e.amountPrefix ?? ""}${
|
|
88
|
+
children: `${e.amountPrefix ?? ""}${k(u, T.cents)}`
|
|
89
89
|
}) : null;
|
|
90
90
|
return /* @__PURE__ */ t(s, {
|
|
91
91
|
ref: b,
|
|
@@ -104,10 +104,10 @@ var wo = ({ payload: g }) => {
|
|
|
104
104
|
position: "absolute",
|
|
105
105
|
zIndex: 1
|
|
106
106
|
},
|
|
107
|
-
children: /* @__PURE__ */ o(
|
|
107
|
+
children: /* @__PURE__ */ o(O, {
|
|
108
108
|
height: w,
|
|
109
|
-
shouldRun: w > 0 &&
|
|
110
|
-
width:
|
|
109
|
+
shouldRun: w > 0 && R > 0,
|
|
110
|
+
width: R
|
|
111
111
|
})
|
|
112
112
|
}), /* @__PURE__ */ t(r, {
|
|
113
113
|
sx: {
|
|
@@ -156,9 +156,9 @@ var wo = ({ payload: g }) => {
|
|
|
156
156
|
minWidth: 0
|
|
157
157
|
},
|
|
158
158
|
children: [
|
|
159
|
-
e.secondaryPosition === "above" &&
|
|
159
|
+
e.secondaryPosition === "above" && _,
|
|
160
160
|
V,
|
|
161
|
-
e.secondaryPosition === "below" &&
|
|
161
|
+
e.secondaryPosition === "below" && _
|
|
162
162
|
]
|
|
163
163
|
})]
|
|
164
164
|
})]
|
|
@@ -176,7 +176,7 @@ var wo = ({ payload: g }) => {
|
|
|
176
176
|
boxShadow: h.shadows[1],
|
|
177
177
|
width: "100%"
|
|
178
178
|
},
|
|
179
|
-
children: [a && /* @__PURE__ */ o(
|
|
179
|
+
children: [a && /* @__PURE__ */ o(Y, { headerText: a }), /* @__PURE__ */ t(r, {
|
|
180
180
|
sx: {
|
|
181
181
|
alignItems: "center",
|
|
182
182
|
bgcolor: "background.paper",
|
|
@@ -188,30 +188,30 @@ var wo = ({ payload: g }) => {
|
|
|
188
188
|
borderTopLeftRadius: "0",
|
|
189
189
|
borderTopRightRadius: "0"
|
|
190
190
|
},
|
|
191
|
-
...(
|
|
191
|
+
...(S || D || c?.guid) && { flexDirection: "row" }
|
|
192
192
|
},
|
|
193
|
-
children: [/* @__PURE__ */ o(
|
|
193
|
+
children: [/* @__PURE__ */ o(J, {
|
|
194
194
|
logo: c,
|
|
195
195
|
slot: n,
|
|
196
196
|
variant: p
|
|
197
197
|
}), /* @__PURE__ */ t(r, { children: [u != null && /* @__PURE__ */ o(l, {
|
|
198
198
|
variant: "h2",
|
|
199
|
-
children:
|
|
199
|
+
children: k(u, T.cents)
|
|
200
200
|
}), /* @__PURE__ */ t(r, {
|
|
201
201
|
sx: {
|
|
202
202
|
gap: 8,
|
|
203
203
|
flexDirection: "row",
|
|
204
204
|
alignItems: "center"
|
|
205
205
|
},
|
|
206
|
-
children: [e.sub_logo && /* @__PURE__ */ o(
|
|
206
|
+
children: [e.sub_logo && /* @__PURE__ */ o(I, {
|
|
207
207
|
color: "warning",
|
|
208
208
|
fill: !0,
|
|
209
209
|
name: e.sub_logo,
|
|
210
210
|
size: 20
|
|
211
|
-
}),
|
|
211
|
+
}), y && /* @__PURE__ */ o(l, {
|
|
212
212
|
color: "text.secondary",
|
|
213
213
|
variant: "caption",
|
|
214
|
-
children:
|
|
214
|
+
children: y
|
|
215
215
|
})]
|
|
216
216
|
})] })]
|
|
217
217
|
})]
|
|
@@ -219,7 +219,7 @@ var wo = ({ payload: g }) => {
|
|
|
219
219
|
});
|
|
220
220
|
};
|
|
221
221
|
export {
|
|
222
|
-
|
|
222
|
+
vo as default
|
|
223
223
|
};
|
|
224
224
|
|
|
225
225
|
//# sourceMappingURL=AccountBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,G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,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n const logo = asLogoRef(slot(data, 'logo'))\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, CURRENCY_FORMAT.cents)}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && (\n <Text variant=\"h2\">{formatCurrency(amount, CURRENCY_FORMAT.cents)}</Text>\n )}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAGvF,QAAM,EAAE,MAAA,EAAA,IAAS,GAC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AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { buildDynamicCopy as l } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as e, formatCurrency as r } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import y from "../../../components/CategoryTile.es.js";
|
|
4
|
+
import C from "../../../components/LogoMark.es.js";
|
|
5
5
|
import x from "../../../components/ComponentBlocks/StatusIndicator.es.js";
|
|
6
|
-
import { getColorByBudgetTier as
|
|
7
|
-
import { Text as
|
|
8
|
-
import { jsx as
|
|
9
|
-
var
|
|
10
|
-
const { budget_percent:
|
|
6
|
+
import { getColorByBudgetTier as h } from "./util.es.js";
|
|
7
|
+
import { Text as T } from "@mxenabled/mxui";
|
|
8
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
9
|
+
var j = ({ payload: i }) => {
|
|
10
|
+
const { budget_percent: c, amount: n, budget_tier: m, category_guid: t, merchant_guid: s, spent_amount: u, budgeted_amount: d, localized_payload: o } = i.instance_slot_data, p = h(m), _ = t ? /* @__PURE__ */ a(y, {
|
|
11
11
|
categoryGuid: t,
|
|
12
12
|
size: 44,
|
|
13
13
|
tint: 0.25
|
|
14
|
-
}) : /* @__PURE__ */
|
|
15
|
-
logo: { merchant_guid:
|
|
14
|
+
}) : /* @__PURE__ */ a(C, {
|
|
15
|
+
logo: { merchant_guid: s },
|
|
16
16
|
size: 44
|
|
17
|
-
}),
|
|
17
|
+
}), g = l(o?.spent_label || "", r(u, e.cents)), b = l(o?.budgeted_label || "", r(d, e.cents)), f = /* @__PURE__ */ a(T, {
|
|
18
18
|
bold: !0,
|
|
19
19
|
variant: "h2",
|
|
20
|
-
children: t && t !== null ?
|
|
20
|
+
children: t && t !== null ? l(o?.amount_left_label || "", r(n, e.cents)) : r(n, e.cents)
|
|
21
21
|
});
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
amount:
|
|
22
|
+
return /* @__PURE__ */ a(x, {
|
|
23
|
+
amount: f,
|
|
24
24
|
borderRadius: "12px",
|
|
25
25
|
completeColor: p,
|
|
26
|
-
icon:
|
|
26
|
+
icon: _,
|
|
27
27
|
label: o?.primary_text || "",
|
|
28
|
-
leftLabel:
|
|
29
|
-
percentComplete:
|
|
30
|
-
rightLabel:
|
|
28
|
+
leftLabel: g,
|
|
29
|
+
percentComplete: c,
|
|
30
|
+
rightLabel: b,
|
|
31
31
|
sx: { "& .details-container": { gap: 12 } }
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
j as BudgetBlock
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
//# sourceMappingURL=BudgetBlock.es.js.map
|