@mx-cartographer/experiences 9.7.169 → 9.7.171

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 (45) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/common/components/CurrencyDialog.es.js +40 -37
  3. package/dist/common/components/CurrencyDialog.es.js.map +1 -1
  4. package/dist/common/components/SubheaderRow.es.js +11 -8
  5. package/dist/common/components/SubheaderRow.es.js.map +1 -1
  6. package/dist/core/types/InsightsInstanceSlotData.d.ts +2 -0
  7. package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +35 -34
  9. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +1 -1
  11. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.d.ts +5 -1
  13. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +71 -59
  14. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +17 -17
  16. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +6 -2
  18. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +12 -10
  19. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
  21. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +74 -71
  22. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  23. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +4 -0
  24. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +47 -51
  25. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  26. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +35 -35
  27. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  28. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.d.ts +2 -4
  29. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js +43 -69
  30. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js.map +1 -1
  31. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +8 -3
  32. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +65 -66
  33. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
  34. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.d.ts +3 -1
  35. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js +15 -13
  36. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js.map +1 -1
  37. package/dist/insights-v2/components/CompactInsightCard.es.js +23 -17
  38. package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
  39. package/dist/insights-v2/mappings/blocks.es.js +179 -183
  40. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  41. package/dist/microinsights/MicroCardTemplate.es.js +1 -1
  42. package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
  43. package/dist/notifications/components/NotificationCard.es.js +18 -17
  44. package/dist/notifications/components/NotificationCard.es.js.map +1 -1
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListCreditLimitHeader.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useUserStore } from '../../../common'\n\nimport type { TransactionListBlockCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../components/LogoFromGuid'\nimport { resolveCreditLimitAlertPercent } from '../AmountInputModalBlock/layout'\n\nimport type { CreditLimitHeader } from './layout'\n\nexport interface TransactionListCreditLimitHeaderProps {\n header: CreditLimitHeader\n copy?: TransactionListBlockCopy\n}\n\n/** The Spending list's credit-limit header: card, balance, limit and utilization against the user's alert percentage. */\nexport const TransactionListCreditLimitHeader = observer(function TransactionListCreditLimitHeader({\n copy,\n header,\n}: TransactionListCreditLimitHeaderProps) {\n const { userInsightProfile } = useUserStore()\n const alertPercent = resolveCreditLimitAlertPercent(userInsightProfile)\n const { accountName, balance, institutionGuid, institutionName, limit, utilization } = header\n const fillPercent = Math.min(utilization, 100)\n const utilizationText = copy?.credit_limit_header_utilization\n ? (buildDynamicCopy(copy.credit_limit_header_utilization, `${utilization}%`) as string)\n : undefined\n\n return (\n <Stack\n data-testid=\"credit-limit-header\"\n sx={{\n bgcolor: 'background.paper',\n borderBottom: 1,\n borderColor: 'divider',\n gap: 16,\n pb: 16,\n pt: 24,\n px: 24,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <LogoFromGuid\n logo={institutionGuid ? { guid: institutionGuid, alt: institutionName } : null}\n size={40}\n />\n <Stack sx={{ flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n <Stack sx={{ flexGrow: 1, gap: 2, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {accountName ?? ''}\n </Text>\n {copy?.credit_limit_header_credit_limit && (\n <Text color=\"text.secondary\" variant=\"body2\">\n {copy.credit_limit_header_credit_limit}\n </Text>\n )}\n </Stack>\n <Stack sx={{ alignItems: 'flex-end', fontVariantNumeric: 'tabular-nums', gap: 2 }}>\n <Text bold={true} variant=\"body1\">\n {formatCurrency(balance, CURRENCY_FORMAT.cents)}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n {formatCurrency(limit, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n\n <Stack sx={{ gap: 2 }}>\n <Box\n aria-label={accountName ?? utilizationText}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={fillPercent}\n aria-valuetext={`${utilization}%`}\n role=\"meter\"\n sx={{ bgcolor: 'neutral.light', borderRadius: '4px', height: 12, overflow: 'hidden' }}\n >\n <Box\n sx={{\n bgcolor: 'warning.main',\n borderRadius: '4px',\n height: '100%',\n width: `${fillPercent}%`,\n }}\n />\n </Box>\n {/* Own row, so a low alert can't overlap the caption; tick and label shift to stay inside the bar. */}\n <Box sx={{ height: 24, position: 'relative' }}>\n <Box\n aria-hidden={true}\n sx={{\n bgcolor: 'divider',\n height: 8,\n left: `${alertPercent}%`,\n position: 'absolute',\n transform: `translateX(-${alertPercent}%)`,\n width: '1px',\n }}\n />\n <Text\n sx={{\n left: `${alertPercent}%`,\n position: 'absolute',\n top: 8,\n transform: `translateX(-${alertPercent}%)`,\n }}\n variant=\"caption\"\n >\n {`${alertPercent}%`}\n </Text>\n </Box>\n {utilizationText && <Text variant=\"caption\">{utilizationText}</Text>}\n </Stack>\n </Stack>\n )\n})\n\nexport default TransactionListCreditLimitHeader\n"],"mappings":";;;;;;;;;;AAsBA,IAAa,IAAmC,EAAS,SAA0C,EACjG,MAAA,GACA,QAAA,EAAA,GACwC;AACxC,QAAM,EAAE,oBAAA,EAAA,IAAuB,EAAa,GACtC,IAAe,EAA+B,CAAkB,GAChE,EA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cAC1B,OAAO;AAAA,YACT;AAAA,UACD,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,YACE,IAAI;AAAA,cACF,MAAM,GAAG,CAAA;AAAA,cACT,UAAU;AAAA,cACV,KAAK;AAAA,cACL,WAAW,eAAe,CAAA;AAAA,YAC5B;AAAA,YACA,SAAQ;AAAA,YAEP,UAAA,GAAG,CAAA;AAAA,UACA,CAAA,CACH;AAAA;QACJ,KAAmB,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAW,UAAA;AAAA,QAAsB,CAAA;AAAA,MAC9D;AAAA,IACF,CAAA,CAAA;AAAA;AAEX,CAAC"}
1
+ {"version":3,"file":"TransactionListCreditLimitHeader.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport type { TransactionListBlockCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../components/LogoFromGuid'\n\nimport type { CreditLimitHeader } from './layout'\n\nexport interface TransactionListCreditLimitHeaderProps {\n header: CreditLimitHeader\n copy?: TransactionListBlockCopy\n}\n\n/** The Spending list's credit-limit header: card, balance, limit and how much of the limit is used. */\nexport const TransactionListCreditLimitHeader = ({\n copy,\n header,\n}: TransactionListCreditLimitHeaderProps) => {\n const { accountName, balance, institutionGuid, institutionName, limit, utilization } = header\n const fillPercent = Math.min(utilization, 100)\n const utilizationText = copy?.credit_limit_header_utilization\n ? (buildDynamicCopy(copy.credit_limit_header_utilization, `${utilization}%`) as string)\n : undefined\n\n return (\n <Stack\n data-testid=\"credit-limit-header\"\n sx={{\n bgcolor: 'background.paper',\n borderBottom: 1,\n borderColor: 'divider',\n gap: 16,\n pb: 16,\n pt: 24,\n px: 24,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <LogoFromGuid\n logo={institutionGuid ? { guid: institutionGuid, alt: institutionName } : null}\n size={40}\n />\n <Stack sx={{ flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n <Stack sx={{ flexGrow: 1, gap: 2, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {accountName ?? ''}\n </Text>\n {copy?.credit_limit_header_credit_limit && (\n <Text color=\"text.secondary\" variant=\"body2\">\n {copy.credit_limit_header_credit_limit}\n </Text>\n )}\n </Stack>\n <Stack sx={{ alignItems: 'flex-end', fontVariantNumeric: 'tabular-nums', gap: 2 }}>\n <Text bold={true} variant=\"body1\">\n {formatCurrency(balance, CURRENCY_FORMAT.cents)}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n {formatCurrency(limit, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n\n <Stack sx={{ gap: 2 }}>\n <Box\n aria-label={accountName ?? utilizationText}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={fillPercent}\n aria-valuetext={`${utilization}%`}\n role=\"meter\"\n sx={{ bgcolor: 'neutral.light', borderRadius: '4px', height: 12, overflow: 'hidden' }}\n >\n <Box\n sx={{\n bgcolor: 'warning.main',\n borderRadius: '4px',\n height: '100%',\n width: `${fillPercent}%`,\n }}\n />\n </Box>\n {/* Figma's 24px row under the bar, the utilization text 4px down. The alert tick is out until design confirms its placement. */}\n <Box sx={{ height: 24, pt: 4 }}>\n {utilizationText && <Text variant=\"caption\">{utilizationText}</Text>}\n </Box>\n </Stack>\n </Stack>\n )\n}\n\nexport default TransactionListCreditLimitHeader\n"],"mappings":";;;;;;;AAkBA,IAAa,IAAA,CAAoC,EAC/C,MAAA,GACA,QAAA,EAAA,MAC2C;AAC3C,QAAM,EAAE,aAAA,GAAa,SAAA,GAAS,iBAAA,GAAiB,i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list under a count tile and a tip. */
15
15
  readonly SUBSCRIPTION_LIST: "subscription_list";
16
16
  };
17
- /** Variants whose rows are subtitled with the account (institution logo and name), not the category. */
18
- export declare const ACCOUNT_SUBLINE_VARIANTS: ReadonlySet<string | null | undefined>;
19
17
  export declare const HELP_HEADER_VARIANT: "help_header";
20
- /** Drawer title: the variant's title when it has one, otherwise the beat's own title. Add new variants here. */
18
+ interface TransactionListLayout {
19
+ /** The drawer title; absent: the beat's own title. */
20
+ title?: (copy: GlobalCopy) => string | undefined;
21
+ /** Rows are subtitled with the account (institution logo and name), not the category. */
22
+ accountSubline?: boolean;
23
+ }
24
+ export declare const transactionListLayout: (variant: string | null | undefined) => TransactionListLayout;
25
+ /** Drawer title: the variant's title when it has one, otherwise the beat's own title. */
21
26
  export declare const getTransactionListDrawerTitle: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string;
22
27
  export interface HelpHeaderContent {
23
28
  /** Pre-localized HTML under the title, from the payload's `drilldown_data.description_html`. */
@@ -1,6 +1,6 @@
1
1
  import { asNonEmptyText as s, asNumber as _ } from "../../blocks/slotReaders.es.js";
2
- import { readHelp as I } from "../HelpBlock/layout.es.js";
3
- import { parseISO as m } from "date-fns/parseISO";
2
+ import { readHelp as E } from "../HelpBlock/layout.es.js";
3
+ import { parseISO as I } from "date-fns/parseISO";
4
4
  var a = {
5
5
  SUMMARY_HEADER: "summary_header",
6
6
  GENERIC_LIST: "generic_list",
@@ -8,66 +8,65 @@ var a = {
8
8
  DEPOSIT_HISTORY: "deposit_history",
9
9
  CREDIT_LIMIT_HEADER: "credit_limit_header",
10
10
  SUBSCRIPTION_LIST: "subscription_list"
11
- }, b = /* @__PURE__ */ new Set([a.SUMMARY_HEADER, a.SUBSCRIPTION_LIST]), E = a.HELP_HEADER, D = (e, t, r) => {
12
- switch (e) {
13
- case a.GENERIC_LIST:
14
- case a.HELP_HEADER:
15
- return t.transactions?.transactions_title ?? "";
16
- case a.DEPOSIT_HISTORY:
17
- return t.insights_feed?.transaction_list_block?.deposit_history_drawer_title ?? "";
18
- case a.CREDIT_LIMIT_HEADER:
19
- return t.insights_feed?.transaction_list_block?.credit_limit_header_drawer_title ?? "";
20
- case a.SUBSCRIPTION_LIST:
21
- return t.insights_feed?.transaction_list_block?.subscriptions_drawer_title ?? "";
22
- default:
23
- return r?.insights_payload?.title ?? "";
11
+ }, v = a.HELP_HEADER, f = (t) => t.transactions?.transactions_title, T = {
12
+ [a.SUMMARY_HEADER]: { accountSubline: !0 },
13
+ [a.GENERIC_LIST]: { title: f },
14
+ [a.HELP_HEADER]: { title: f },
15
+ [a.DEPOSIT_HISTORY]: { title: (t) => t.insights_feed?.transaction_list_block?.deposit_history_drawer_title },
16
+ [a.CREDIT_LIMIT_HEADER]: { title: (t) => t.insights_feed?.transaction_list_block?.credit_limit_header_drawer_title },
17
+ [a.SUBSCRIPTION_LIST]: {
18
+ title: (t) => t.insights_feed?.transaction_list_block?.subscriptions_drawer_title,
19
+ accountSubline: !0
24
20
  }
25
- }, H = (e, t) => {
26
- if (e?.variant !== E) return;
27
- const r = s(t?.help_label), n = I(t);
21
+ }, S = (t) => t != null && Object.hasOwn(T, t) ? T[t] : {}, H = (t, e, r) => {
22
+ const { title: n } = S(t);
23
+ return (n ? n(e) : r?.insights_payload?.title) ?? "";
24
+ }, N = (t, e) => {
25
+ if (t?.variant !== v) return;
26
+ const r = s(e?.help_label), n = E(e);
28
27
  return {
29
- descriptionHtml: s(t?.description_html),
28
+ descriptionHtml: s(e?.description_html),
30
29
  ...r && n && { learnMore: {
31
30
  ...n,
32
31
  label: r
33
32
  } }
34
33
  };
35
- }, f = (e) => typeof e == "number" && Number.isInteger(e) && e > 0 ? e : void 0, p = Date.UTC(2e3, 0, 1), S = Date.UTC(2100, 0, 1), T = /* @__PURE__ */ new WeakMap(), c = (e, t) => {
36
- const r = T.get(e) ?? /* @__PURE__ */ new Set();
37
- r.has(t) || (T.set(e, r.add(t)), console.warn(t));
38
- }, u = (e, t, r) => {
39
- if (e == null || e === "") return;
34
+ }, p = (t) => typeof t == "number" && Number.isInteger(t) && t > 0 ? t : void 0, h = Date.UTC(2e3, 0, 1), b = Date.UTC(2100, 0, 1), m = /* @__PURE__ */ new WeakMap(), c = (t, e) => {
35
+ const r = m.get(t) ?? /* @__PURE__ */ new Set();
36
+ r.has(e) || (m.set(t, r.add(e)), console.warn(e));
37
+ }, l = (t, e, r) => {
38
+ if (t == null || t === "") return;
40
39
  let n;
41
- if (typeof e == "number" && Number.isFinite(e)) n = e < 1e12 ? e * 1e3 : e;
42
- else if (typeof e == "string") {
43
- const i = m(e).getTime();
40
+ if (typeof t == "number" && Number.isFinite(t)) n = t < 1e12 ? t * 1e3 : t;
41
+ else if (typeof t == "string") {
42
+ const i = I(t).getTime();
44
43
  n = Number.isNaN(i) ? void 0 : i;
45
44
  }
46
- if (n === void 0 || n < p || n > S) {
47
- c(r, `[TransactionListBlock] drilldown_data.${t} is unparseable or out of range (${typeof e})`);
45
+ if (n === void 0 || n < h || n > b) {
46
+ c(r, `[TransactionListBlock] drilldown_data.${e} is unparseable or out of range (${typeof t})`);
48
47
  return;
49
48
  }
50
49
  return new Date(n);
51
- }, L = (e) => {
52
- if (e?.variant !== a.SUMMARY_HEADER) return;
53
- const t = e?.drilldown_data;
54
- if (!t) return;
55
- const r = _(t.amount);
50
+ }, w = (t) => {
51
+ if (t?.variant !== a.SUMMARY_HEADER) return;
52
+ const e = t?.drilldown_data;
53
+ if (!e) return;
54
+ const r = _(e.amount);
56
55
  if (r === void 0) {
57
- Object.keys(t).length > 0 && c(t, "[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.");
56
+ Object.keys(e).length > 0 && c(e, "[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.");
58
57
  return;
59
58
  }
60
59
  return {
61
60
  amount: r,
62
- startDate: u(t.start_date, "start_date", t),
63
- endDate: u(t.end_date, "end_date", t),
64
- count: f(t.count)
61
+ startDate: l(e.start_date, "start_date", e),
62
+ endDate: l(e.end_date, "end_date", e),
63
+ count: p(e.count)
65
64
  };
66
- }, w = (e) => {
67
- if (e?.variant !== a.CREDIT_LIMIT_HEADER) return;
68
- const t = e.drilldown_data, r = _(t?.current_balance), n = _(t?.credit_limit);
65
+ }, O = (t) => {
66
+ if (t?.variant !== a.CREDIT_LIMIT_HEADER) return;
67
+ const e = t.drilldown_data, r = _(e?.current_balance), n = _(e?.credit_limit);
69
68
  if (r === void 0 || n === void 0 || n <= 0) return;
70
- const i = s(t?.institution_guid), o = s(t?.institution_name), d = s(t?.account_name);
69
+ const i = s(e?.institution_guid), o = s(e?.institution_name), d = s(e?.account_name);
71
70
  return {
72
71
  balance: r,
73
72
  limit: n,
@@ -76,49 +75,49 @@ var a = {
76
75
  ...o && { institutionName: o },
77
76
  ...d && { accountName: d }
78
77
  };
79
- }, v = /^(\d{4})-(\d{2})-\d{2}$/, h = (e, t) => {
80
- const r = typeof e == "string" ? v.exec(e) : null, n = r ? Number(r[2]) : 0;
78
+ }, R = /^(\d{4})-(\d{2})-\d{2}$/, y = (t, e) => {
79
+ const r = typeof t == "string" ? R.exec(t) : null, n = r ? Number(r[2]) : 0;
81
80
  if (r && n >= 1 && n <= 12) return new Date(Number(r[1]), n - 1, 1);
82
- const i = u(e, "date", t);
81
+ const i = l(t, "date", e);
83
82
  return i && new Date(i.getUTCFullYear(), i.getUTCMonth(), 1);
84
- }, y = (e) => {
85
- if (e?.variant !== a.SUBSCRIPTION_LIST) return;
86
- const t = e.drilldown_data, r = t?.transaction_frequencies;
83
+ }, g = (t) => {
84
+ if (t?.variant !== a.SUBSCRIPTION_LIST) return;
85
+ const e = t.drilldown_data, r = e?.transaction_frequencies;
87
86
  if (r == null) return;
88
87
  if (!Array.isArray(r)) {
89
- c(t, "[TransactionListBlock] drilldown_data.transaction_frequencies is not a list — captioning no rows.");
88
+ c(e, "[TransactionListBlock] drilldown_data.transaction_frequencies is not a list — captioning no rows.");
90
89
  return;
91
90
  }
92
91
  const n = /* @__PURE__ */ new Map();
93
92
  let i = 0;
94
93
  return r.forEach((o) => {
95
- const d = typeof o == "object" && o !== null ? s(o.transaction_guid) : void 0, l = typeof o == "object" && o !== null ? _(o.recurrence_type) : void 0;
96
- d && l !== void 0 ? n.set(d, l) : i += 1;
97
- }), i > 0 && c(t, `[TransactionListBlock] dropped ${i} malformed drilldown_data.transaction_frequencies row(s).`), n.size > 0 ? n : void 0;
98
- }, C = (e) => {
99
- if (e?.variant !== a.SUBSCRIPTION_LIST) return;
100
- const t = e.drilldown_data;
101
- if (!t) return;
102
- const r = f(t.count);
94
+ const d = typeof o == "object" && o !== null ? s(o.transaction_guid) : void 0, u = typeof o == "object" && o !== null ? _(o.recurrence_type) : void 0;
95
+ d && u !== void 0 ? n.set(d, u) : i += 1;
96
+ }), i > 0 && c(e, `[TransactionListBlock] dropped ${i} malformed drilldown_data.transaction_frequencies row(s).`), n.size > 0 ? n : void 0;
97
+ }, C = (t) => {
98
+ if (t?.variant !== a.SUBSCRIPTION_LIST) return;
99
+ const e = t.drilldown_data;
100
+ if (!e) return;
101
+ const r = p(e.count);
103
102
  if (r === void 0) {
104
- Object.keys(t).length > 0 && c(t, "[TransactionListBlock] drilldown_data has no positive integer `count` — no subscription header.");
103
+ Object.keys(e).length > 0 && c(e, "[TransactionListBlock] drilldown_data has no positive integer `count` — no subscription header.");
105
104
  return;
106
105
  }
107
106
  return {
108
107
  count: r,
109
- month: h(t.date, t)
108
+ month: y(e.date, e)
110
109
  };
111
110
  };
112
111
  export {
113
- b as ACCOUNT_SUBLINE_VARIANTS,
114
- E as HELP_HEADER_VARIANT,
112
+ v as HELP_HEADER_VARIANT,
115
113
  a as TRANSACTION_LIST_VARIANTS,
116
- D as getTransactionListDrawerTitle,
117
- w as readCreditLimitHeader,
118
- H as readHelpHeader,
114
+ H as getTransactionListDrawerTitle,
115
+ O as readCreditLimitHeader,
116
+ N as readHelpHeader,
119
117
  C as readSubscriptionHeader,
120
- L as readSummary,
121
- y as readTransactionFrequencies
118
+ w as readSummary,
119
+ g as readTransactionFrequencies,
120
+ S as transactionListLayout
122
121
  };
123
122
 
124
123
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/layout.ts"],"sourcesContent":["import { parseISO } from 'date-fns/parseISO'\n\nimport type {\n Beat,\n DrilldownData,\n GlobalCopy,\n InDescriptionCTA,\n PrimaryCTA,\n SecondaryCTA,\n} from '../../../core'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\nimport { readHelp, type HelpContent } from '../HelpBlock/layout'\n\ntype DrilldownCta = PrimaryCTA | SecondaryCTA | InDescriptionCTA\n\n/** The transaction_list_block CTA variants. */\nexport const TRANSACTION_LIST_VARIANTS = {\n SUMMARY_HEADER: 'summary_header',\n GENERIC_LIST: 'generic_list',\n /** Opens the list under the beat's title, description and \"Learn More\". */\n HELP_HEADER: 'help_header',\n /** Opens Micro Deposits' Deposit History list. */\n DEPOSIT_HISTORY: 'deposit_history',\n /** Opens Credit Card Close to Limit's Spending list under the card's credit-limit header. */\n CREDIT_LIMIT_HEADER: 'credit_limit_header',\n /** Opens Monthly Subscription Aggregate's Subscriptions list under a count tile and a tip. */\n SUBSCRIPTION_LIST: 'subscription_list',\n} as const\n\n/** Variants whose rows are subtitled with the account (institution logo and name), not the category. */\nexport const ACCOUNT_SUBLINE_VARIANTS: ReadonlySet<string | null | undefined> = new Set([\n TRANSACTION_LIST_VARIANTS.SUMMARY_HEADER,\n TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST,\n])\n\nexport const HELP_HEADER_VARIANT = TRANSACTION_LIST_VARIANTS.HELP_HEADER\n\n/** Drawer title: the variant's title when it has one, otherwise the beat's own title. Add new variants here. */\nexport const getTransactionListDrawerTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n beat?: Beat,\n): string => {\n switch (variant) {\n case TRANSACTION_LIST_VARIANTS.GENERIC_LIST:\n case TRANSACTION_LIST_VARIANTS.HELP_HEADER:\n return copy.transactions?.transactions_title ?? ''\n case TRANSACTION_LIST_VARIANTS.DEPOSIT_HISTORY:\n return copy.insights_feed?.transaction_list_block?.deposit_history_drawer_title ?? ''\n case TRANSACTION_LIST_VARIANTS.CREDIT_LIMIT_HEADER:\n return copy.insights_feed?.transaction_list_block?.credit_limit_header_drawer_title ?? ''\n case TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST:\n return copy.insights_feed?.transaction_list_block?.subscriptions_drawer_title ?? ''\n default:\n return beat?.insights_payload?.title ?? ''\n }\n}\n\nexport interface HelpHeaderContent {\n /** Pre-localized HTML under the title, from the payload's `drilldown_data.description_html`. */\n descriptionHtml?: string\n /** The \"Learn More\" link and the help drawer it opens; absent when the beat carries no help. */\n learnMore?: HelpContent & { label: string }\n}\n\n/**\n * The help-header variant's text, read from the payload's `drilldown_data` (shared by every CTA\n * of the card): `description_html`, and `help_label` with the `help_title` / `help_html` that\n * `readHelp` reads. Only the `help_header` variant renders the block.\n */\nexport const readHelpHeader = (\n cta: DrilldownCta | undefined,\n drilldown: DrilldownData | undefined,\n): HelpHeaderContent | undefined => {\n if (cta?.variant !== HELP_HEADER_VARIANT) return undefined\n\n const label = asNonEmptyText(drilldown?.help_label)\n const help = readHelp(drilldown)\n\n return {\n descriptionHtml: asNonEmptyText(drilldown?.description_html),\n ...(label && help && { learnMore: { ...help, label } }),\n }\n}\n\nexport interface TransactionListSummary {\n /** Headline figure (e.g. total withdrawn). */\n amount: number\n /** Validated range endpoints; rendered as `{start} – {end}`. Omitted when the payload value is\n * missing or unparseable (so the drawer never crashes on an Invalid Date). */\n startDate?: Date\n endDate?: Date\n /** Number of transactions for the pill, from the CTA's `drilldown_data.count`. */\n count?: number\n}\n\n// `> 0`: the card only shows with >= 1 guid, so a `count` of 0 is dropped and falls back to the\n// guid count rather than rendering \"0 transactions\".\nconst toCount = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined\n\n// Sane epoch window so a bad/typo payload can't render a far-past/future date.\nconst EPOCH_MIN = Date.UTC(2000, 0, 1)\nconst EPOCH_MAX = Date.UTC(2100, 0, 1)\n\n// The readers run on every observer re-render, so each distinct warning fires once per payload object.\nconst warnedPayloads = new WeakMap<object, Set<string>>()\nconst warnOncePerPayload = (source: object, message: string): void => {\n const warned = warnedPayloads.get(source) ?? new Set<string>()\n if (warned.has(message)) return\n warnedPayloads.set(source, warned.add(message))\n console.warn(message)\n}\n\n/**\n * Parse a payload date value to a validated `Date`, or `undefined`. Accepts unix seconds or\n * milliseconds (auto-detected) and ISO strings. Fails closed (no throw): an unparseable or\n * out-of-range value returns undefined and warns, so `formatDate`/`intlFormat` never sees an Invalid\n * Date (which throws `RangeError` and takes down the whole drawer render).\n */\nconst toDate = (value: unknown, field: string, source: object): Date | undefined => {\n // Missing/empty is a normal \"no range\" case — return quietly, don't warn.\n if (value === undefined || value === null || value === '') return undefined\n\n let ms: number | undefined\n if (typeof value === 'number' && Number.isFinite(value)) {\n // < 1e12 is treated as seconds (1e12 ms is year 33658). Trade-off: genuine ms timestamps from\n // ~2000-2001 would be misread as seconds and fall outside the window below (dropped, not shown).\n ms = value < 1e12 ? value * 1000 : value\n } else if (typeof value === 'string') {\n const parsed = parseISO(value).getTime()\n ms = Number.isNaN(parsed) ? undefined : parsed\n }\n\n if (ms === undefined || ms < EPOCH_MIN || ms > EPOCH_MAX) {\n warnOncePerPayload(\n source,\n `[TransactionListBlock] drilldown_data.${field} is unparseable or out of range (${typeof value})`,\n )\n return undefined\n }\n return new Date(ms)\n}\n\n/**\n * Summary-header figures for the drawer, read from the clicked CTA's `drilldown_data` (the backend\n * hangs a drilldown's own data off the CTA that opens it). Fails closed throughout: only the\n * `summary_header` variant renders a header (so figures from a different CTA that `getDynamicCta…`\n * fell back to can't be misattributed), then without a finite `amount` there is still no header, and\n * each date is validated to a real `Date` or dropped — an unparseable value never reaches\n * `formatDate` (which throws on an Invalid Date).\n *\n * `drilldown_data` fields: `amount` (number), `start_date`/`end_date` (unix seconds|ms or ISO),\n * `count` (number of transactions).\n */\nexport const readSummary = (cta: DrilldownCta | undefined): TransactionListSummary | undefined => {\n // Defense-in-depth on financial figures: only the summary-header variant shows the card.\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.SUMMARY_HEADER) return undefined\n\n const source = cta?.drilldown_data\n if (!source) return undefined\n\n const amount = asNumber(source.amount)\n if (amount === undefined) {\n // `drilldown_data` present but no usable amount -> surface the likely contract drift (field\n // rename) instead of a silently missing header.\n if (Object.keys(source).length > 0) {\n warnOncePerPayload(\n source,\n '[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.',\n )\n }\n return undefined\n }\n\n return {\n amount,\n startDate: toDate(source.start_date, 'start_date', source),\n endDate: toDate(source.end_date, 'end_date', source),\n count: toCount(source.count),\n }\n}\n\nexport interface CreditLimitHeader {\n balance: number\n limit: number\n /** Whole percent of the limit used; over 100 when the card is over its limit. */\n utilization: number\n institutionGuid?: string\n institutionName?: string\n accountName?: string\n}\n\n/** The credit-limit header from the clicked CTA's `drilldown_data`; only `credit_limit_header`, with a positive limit. */\nexport const readCreditLimitHeader = (\n cta: DrilldownCta | undefined,\n): CreditLimitHeader | undefined => {\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.CREDIT_LIMIT_HEADER) return undefined\n\n const source = cta.drilldown_data\n const balance = asNumber(source?.current_balance)\n const limit = asNumber(source?.credit_limit)\n if (balance === undefined || limit === undefined || limit <= 0) return undefined\n\n const institutionGuid = asNonEmptyText(source?.institution_guid)\n const institutionName = asNonEmptyText(source?.institution_name)\n const accountName = asNonEmptyText(source?.account_name)\n\n return {\n balance,\n limit,\n utilization: Math.max(0, Math.round((balance / limit) * 100)),\n ...(institutionGuid && { institutionGuid }),\n ...(institutionName && { institutionName }),\n ...(accountName && { accountName }),\n }\n}\n\nconst DATE_ONLY = /^(\\d{4})-(\\d{2})-\\d{2}$/\n\n/** The month a drilldown date names, as local midnight on the 1st. A date-only string already names its month. */\nconst toMonthStart = (value: unknown, source: object): Date | undefined => {\n const dateOnly = typeof value === 'string' ? DATE_ONLY.exec(value) : null\n const month = dateOnly ? Number(dateOnly[2]) : 0\n if (dateOnly && month >= 1 && month <= 12) return new Date(Number(dateOnly[1]), month - 1, 1)\n\n // An epoch or a timestamp is an instant: its UTC month is the one tupac meant.\n const date = toDate(value, 'date', source)\n return date && new Date(date.getUTCFullYear(), date.getUTCMonth(), 1)\n}\n\n/** Each listed transaction's schedule, from `drilldown_data.transaction_frequencies`; malformed rows are dropped. */\nexport const readTransactionFrequencies = (\n cta: DrilldownCta | undefined,\n): Map<string, number> | undefined => {\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST) return undefined\n\n const source = cta.drilldown_data\n const rows = source?.transaction_frequencies\n if (rows === undefined || rows === null) return undefined\n\n if (!Array.isArray(rows)) {\n warnOncePerPayload(\n source as object,\n '[TransactionListBlock] drilldown_data.transaction_frequencies is not a list — captioning no rows.',\n )\n return undefined\n }\n\n const byGuid = new Map<string, number>()\n let dropped = 0\n rows.forEach((row) => {\n const guid =\n typeof row === 'object' && row !== null ? asNonEmptyText(row.transaction_guid) : undefined\n const type = typeof row === 'object' && row !== null ? asNumber(row.recurrence_type) : undefined\n\n if (guid && type !== undefined) byGuid.set(guid, type)\n else dropped += 1\n })\n\n if (dropped > 0) {\n warnOncePerPayload(\n source as object,\n `[TransactionListBlock] dropped ${dropped} malformed drilldown_data.transaction_frequencies row(s).`,\n )\n }\n\n return byGuid.size > 0 ? byGuid : undefined\n}\n\nexport interface SubscriptionListHeader {\n /** Subscriptions paid in the month, from the CTA's `drilldown_data.count`. */\n count: number\n /** The month paid in, as local midnight on the 1st; omitted when missing or unparseable. */\n month?: Date\n}\n\n/** The count tile's figures; only for `subscription_list` with a positive integer `count`. */\nexport const readSubscriptionHeader = (\n cta: DrilldownCta | undefined,\n): SubscriptionListHeader | undefined => {\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST) return undefined\n\n const source = cta.drilldown_data\n if (!source) return undefined\n\n const count = toCount(source.count)\n if (count === undefined) {\n if (Object.keys(source).length > 0) {\n warnOncePerPayload(\n source,\n '[TransactionListBlock] drilldown_data has no positive integer `count` — no subscription header.',\n )\n }\n return undefined\n }\n\n return {\n count,\n month: toMonthStart(source.date, source),\n }\n}\n"],"mappings":";;;AAgBA,IAAa,IAA4B;AAAA,EACvC,gBAAgB;AAAA,EAChB,cAAc;AAAA,EAEd,aAAa;AAAA,EAEb,iBAAiB;AAAA,EAEjB,qBAAqB;AAAA,EAErB,mBAAmB;AACrB,GAGa,IAAmE,oBAAI,IAAI,CACtF,EAA0B,gBAC1B,EAA0B,iBAC5B,CAAC,GAEY,IAAsB,EAA0B,aAGhD,IAAA,CACX,GACA,GACA,MACW;AACX,UAAQ,GAAR;AAAA,IACE,KAAK,EAA0B;AAAA,IAC/B,KAAK,EAA0B;AAC7B,aAAO,EAAK,cAAc,sBAAsB;AAAA,IAClD,KAAK,EAA0B;AAC7B,aAAO,EAAK,eAAe,wBAAwB,gCAAgC;AAAA,IACrF,KAAK,EAA0B;AAC7B,aAAO,EAAK,eAAe,wBAAwB,oCAAoC;AAAA,IACzF,KAAK,EAA0B;AAC7B,aAAO,EAAK,eAAe,wBAAwB,8BAA8B;AAAA,IACnF;AACE,aAAO,GAAM,kBAAkB,SAAS;AAAA,EAC5C;AACF,GAca,IAAA,CACX,GACA,MACkC;AAClC,MAAI,GAAK,YAAY,EAAqB;AAE1C,QAAM,IAAQ,EAAe,GAAW,UAAU,GAC5C,IAAO,EAAS,CAAS;AAE/B,SAAO;AAAA,IACL,iBAAiB,EAAe,GAAW,gBAAgB;AAAA,IAC3D,GAAI,KAAS,KAAQ,EAAE,WAAW;AAAA,MAAE,GAAG;AAAA,MAAM,OAAA;AAAA,IAAM,EAAE;AAAA,EACvD;AACF,GAeM,IAAA,CAAW,MACf,OAAO,KAAU,YAAY,OAAO,UAAU,CAAK,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AAM,IAAS,oBAAI,IAAoB;AACvC,MAAI,IAAU;AACd,SAAA,EAAK,QAAA,CAAS,MAAQ;AACpB,UAAM,IACJ,OAAO,KAAQ,YAAY,MAAQ,OAAO,EAAe,EAAI,gBAAgB,IAAI,QAC7E,IAAO,OAAO,KAAQ,YAAY,MAAQ,OAAO,EAAS,EAAI,eAAe,IAAI;AAEvF,IAAI,KAAQ,MAAS,SAAW,EAAO,IAAI,GAAM,CAAI,IAChD,KAAW;AAAA,EAClB,CAAC,GAEG,IAAU,KACZ,EACE,GACA,kCAAkC,CAAA,2DACpC,GAGK,EAAO,OAAO,IAAI,IAAS;AACpC,GAUa,IAAA,CACX,MACuC;AACvC,MAAI,GAAK,YAAY,EAA0B,kBAAmB;AAElE,QAAM,IAAS,EAAI;AACnB,MAAI,CAAC,EAAQ;AAEb,QAAM,IAAQ,EAAQ,EAAO,KAAK;AAClC,MAAI,MAAU,QAAW;AACvB,IAAI,OAAO,KAAK,CAAM,EAAE,SAAS,KAC/B,EACE,GACA,iGACF;AAEF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAA;AAAA,IACA,OAAO,EAAa,EAAO,MAAM,CAAM;AAAA,EACzC;AACF"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/layout.ts"],"sourcesContent":["import { parseISO } from 'date-fns/parseISO'\n\nimport type {\n Beat,\n DrilldownData,\n GlobalCopy,\n InDescriptionCTA,\n PrimaryCTA,\n SecondaryCTA,\n} from '../../../core'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\nimport { readHelp, type HelpContent } from '../HelpBlock/layout'\n\ntype DrilldownCta = PrimaryCTA | SecondaryCTA | InDescriptionCTA\n\n/** The transaction_list_block CTA variants. */\nexport const TRANSACTION_LIST_VARIANTS = {\n SUMMARY_HEADER: 'summary_header',\n GENERIC_LIST: 'generic_list',\n /** Opens the list under the beat's title, description and \"Learn More\". */\n HELP_HEADER: 'help_header',\n /** Opens Micro Deposits' Deposit History list. */\n DEPOSIT_HISTORY: 'deposit_history',\n /** Opens Credit Card Close to Limit's Spending list under the card's credit-limit header. */\n CREDIT_LIMIT_HEADER: 'credit_limit_header',\n /** Opens Monthly Subscription Aggregate's Subscriptions list under a count tile and a tip. */\n SUBSCRIPTION_LIST: 'subscription_list',\n} as const\n\nexport const HELP_HEADER_VARIANT = TRANSACTION_LIST_VARIANTS.HELP_HEADER\n\ninterface TransactionListLayout {\n /** The drawer title; absent: the beat's own title. */\n title?: (copy: GlobalCopy) => string | undefined\n /** Rows are subtitled with the account (institution logo and name), not the category. */\n accountSubline?: boolean\n}\n\nconst transactionsTitle = (copy: GlobalCopy) => copy.transactions?.transactions_title\n\n/** Per-variant drawer layout. Add new variants here. */\nconst LAYOUT: Record<string, TransactionListLayout> = {\n [TRANSACTION_LIST_VARIANTS.SUMMARY_HEADER]: { accountSubline: true },\n [TRANSACTION_LIST_VARIANTS.GENERIC_LIST]: { title: transactionsTitle },\n [TRANSACTION_LIST_VARIANTS.HELP_HEADER]: { title: transactionsTitle },\n [TRANSACTION_LIST_VARIANTS.DEPOSIT_HISTORY]: {\n title: (copy) => copy.insights_feed?.transaction_list_block?.deposit_history_drawer_title,\n },\n [TRANSACTION_LIST_VARIANTS.CREDIT_LIMIT_HEADER]: {\n title: (copy) => copy.insights_feed?.transaction_list_block?.credit_limit_header_drawer_title,\n },\n [TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST]: {\n title: (copy) => copy.insights_feed?.transaction_list_block?.subscriptions_drawer_title,\n accountSubline: true,\n },\n}\n\n// `Object.hasOwn`, as in resolveVariantConfig: the variant is backend-controlled.\nexport const transactionListLayout = (variant: string | null | undefined): TransactionListLayout =>\n variant != null && Object.hasOwn(LAYOUT, variant) ? LAYOUT[variant] : {}\n\n/** Drawer title: the variant's title when it has one, otherwise the beat's own title. */\nexport const getTransactionListDrawerTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n beat?: Beat,\n): string => {\n const { title } = transactionListLayout(variant)\n\n return (title ? title(copy) : beat?.insights_payload?.title) ?? ''\n}\n\nexport interface HelpHeaderContent {\n /** Pre-localized HTML under the title, from the payload's `drilldown_data.description_html`. */\n descriptionHtml?: string\n /** The \"Learn More\" link and the help drawer it opens; absent when the beat carries no help. */\n learnMore?: HelpContent & { label: string }\n}\n\n/**\n * The help-header variant's text, read from the payload's `drilldown_data` (shared by every CTA\n * of the card): `description_html`, and `help_label` with the `help_title` / `help_html` that\n * `readHelp` reads. Only the `help_header` variant renders the block.\n */\nexport const readHelpHeader = (\n cta: DrilldownCta | undefined,\n drilldown: DrilldownData | undefined,\n): HelpHeaderContent | undefined => {\n if (cta?.variant !== HELP_HEADER_VARIANT) return undefined\n\n const label = asNonEmptyText(drilldown?.help_label)\n const help = readHelp(drilldown)\n\n return {\n descriptionHtml: asNonEmptyText(drilldown?.description_html),\n ...(label && help && { learnMore: { ...help, label } }),\n }\n}\n\nexport interface TransactionListSummary {\n /** Headline figure (e.g. total withdrawn). */\n amount: number\n /** Validated range endpoints; rendered as `{start} – {end}`. Omitted when the payload value is\n * missing or unparseable (so the drawer never crashes on an Invalid Date). */\n startDate?: Date\n endDate?: Date\n /** Number of transactions for the pill, from the CTA's `drilldown_data.count`. */\n count?: number\n}\n\n// `> 0`: the card only shows with >= 1 guid, so a `count` of 0 is dropped and falls back to the\n// guid count rather than rendering \"0 transactions\".\nconst toCount = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined\n\n// Sane epoch window so a bad/typo payload can't render a far-past/future date.\nconst EPOCH_MIN = Date.UTC(2000, 0, 1)\nconst EPOCH_MAX = Date.UTC(2100, 0, 1)\n\n// The readers run on every observer re-render, so each distinct warning fires once per payload object.\nconst warnedPayloads = new WeakMap<object, Set<string>>()\nconst warnOncePerPayload = (source: object, message: string): void => {\n const warned = warnedPayloads.get(source) ?? new Set<string>()\n if (warned.has(message)) return\n warnedPayloads.set(source, warned.add(message))\n console.warn(message)\n}\n\n/**\n * Parse a payload date value to a validated `Date`, or `undefined`. Accepts unix seconds or\n * milliseconds (auto-detected) and ISO strings. Fails closed (no throw): an unparseable or\n * out-of-range value returns undefined and warns, so `formatDate`/`intlFormat` never sees an Invalid\n * Date (which throws `RangeError` and takes down the whole drawer render).\n */\nconst toDate = (value: unknown, field: string, source: object): Date | undefined => {\n // Missing/empty is a normal \"no range\" case — return quietly, don't warn.\n if (value === undefined || value === null || value === '') return undefined\n\n let ms: number | undefined\n if (typeof value === 'number' && Number.isFinite(value)) {\n // < 1e12 is treated as seconds (1e12 ms is year 33658). Trade-off: genuine ms timestamps from\n // ~2000-2001 would be misread as seconds and fall outside the window below (dropped, not shown).\n ms = value < 1e12 ? value * 1000 : value\n } else if (typeof value === 'string') {\n const parsed = parseISO(value).getTime()\n ms = Number.isNaN(parsed) ? undefined : parsed\n }\n\n if (ms === undefined || ms < EPOCH_MIN || ms > EPOCH_MAX) {\n warnOncePerPayload(\n source,\n `[TransactionListBlock] drilldown_data.${field} is unparseable or out of range (${typeof value})`,\n )\n return undefined\n }\n return new Date(ms)\n}\n\n/**\n * Summary-header figures for the drawer, read from the clicked CTA's `drilldown_data` (the backend\n * hangs a drilldown's own data off the CTA that opens it). Fails closed throughout: only the\n * `summary_header` variant renders a header (so figures from a different CTA that `getDynamicCta…`\n * fell back to can't be misattributed), then without a finite `amount` there is still no header, and\n * each date is validated to a real `Date` or dropped — an unparseable value never reaches\n * `formatDate` (which throws on an Invalid Date).\n *\n * `drilldown_data` fields: `amount` (number), `start_date`/`end_date` (unix seconds|ms or ISO),\n * `count` (number of transactions).\n */\nexport const readSummary = (cta: DrilldownCta | undefined): TransactionListSummary | undefined => {\n // Defense-in-depth on financial figures: only the summary-header variant shows the card.\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.SUMMARY_HEADER) return undefined\n\n const source = cta?.drilldown_data\n if (!source) return undefined\n\n const amount = asNumber(source.amount)\n if (amount === undefined) {\n // `drilldown_data` present but no usable amount -> surface the likely contract drift (field\n // rename) instead of a silently missing header.\n if (Object.keys(source).length > 0) {\n warnOncePerPayload(\n source,\n '[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.',\n )\n }\n return undefined\n }\n\n return {\n amount,\n startDate: toDate(source.start_date, 'start_date', source),\n endDate: toDate(source.end_date, 'end_date', source),\n count: toCount(source.count),\n }\n}\n\nexport interface CreditLimitHeader {\n balance: number\n limit: number\n /** Whole percent of the limit used; over 100 when the card is over its limit. */\n utilization: number\n institutionGuid?: string\n institutionName?: string\n accountName?: string\n}\n\n/** The credit-limit header from the clicked CTA's `drilldown_data`; only `credit_limit_header`, with a positive limit. */\nexport const readCreditLimitHeader = (\n cta: DrilldownCta | undefined,\n): CreditLimitHeader | undefined => {\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.CREDIT_LIMIT_HEADER) return undefined\n\n const source = cta.drilldown_data\n const balance = asNumber(source?.current_balance)\n const limit = asNumber(source?.credit_limit)\n if (balance === undefined || limit === undefined || limit <= 0) return undefined\n\n const institutionGuid = asNonEmptyText(source?.institution_guid)\n const institutionName = asNonEmptyText(source?.institution_name)\n const accountName = asNonEmptyText(source?.account_name)\n\n return {\n balance,\n limit,\n utilization: Math.max(0, Math.round((balance / limit) * 100)),\n ...(institutionGuid && { institutionGuid }),\n ...(institutionName && { institutionName }),\n ...(accountName && { accountName }),\n }\n}\n\nconst DATE_ONLY = /^(\\d{4})-(\\d{2})-\\d{2}$/\n\n/** The month a drilldown date names, as local midnight on the 1st. A date-only string already names its month. */\nconst toMonthStart = (value: unknown, source: object): Date | undefined => {\n const dateOnly = typeof value === 'string' ? DATE_ONLY.exec(value) : null\n const month = dateOnly ? Number(dateOnly[2]) : 0\n if (dateOnly && month >= 1 && month <= 12) return new Date(Number(dateOnly[1]), month - 1, 1)\n\n // An epoch or a timestamp is an instant: its UTC month is the one tupac meant.\n const date = toDate(value, 'date', source)\n return date && new Date(date.getUTCFullYear(), date.getUTCMonth(), 1)\n}\n\n/** Each listed transaction's schedule, from `drilldown_data.transaction_frequencies`; malformed rows are dropped. */\nexport const readTransactionFrequencies = (\n cta: DrilldownCta | undefined,\n): Map<string, number> | undefined => {\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST) return undefined\n\n const source = cta.drilldown_data\n const rows = source?.transaction_frequencies\n if (rows === undefined || rows === null) return undefined\n\n if (!Array.isArray(rows)) {\n warnOncePerPayload(\n source as object,\n '[TransactionListBlock] drilldown_data.transaction_frequencies is not a list — captioning no rows.',\n )\n return undefined\n }\n\n const byGuid = new Map<string, number>()\n let dropped = 0\n rows.forEach((row) => {\n const guid =\n typeof row === 'object' && row !== null ? asNonEmptyText(row.transaction_guid) : undefined\n const type = typeof row === 'object' && row !== null ? asNumber(row.recurrence_type) : undefined\n\n if (guid && type !== undefined) byGuid.set(guid, type)\n else dropped += 1\n })\n\n if (dropped > 0) {\n warnOncePerPayload(\n source as object,\n `[TransactionListBlock] dropped ${dropped} malformed drilldown_data.transaction_frequencies row(s).`,\n )\n }\n\n return byGuid.size > 0 ? byGuid : undefined\n}\n\nexport interface SubscriptionListHeader {\n /** Subscriptions paid in the month, from the CTA's `drilldown_data.count`. */\n count: number\n /** The month paid in, as local midnight on the 1st; omitted when missing or unparseable. */\n month?: Date\n}\n\n/** The count tile's figures; only for `subscription_list` with a positive integer `count`. */\nexport const readSubscriptionHeader = (\n cta: DrilldownCta | undefined,\n): SubscriptionListHeader | undefined => {\n if (cta?.variant !== TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST) return undefined\n\n const source = cta.drilldown_data\n if (!source) return undefined\n\n const count = toCount(source.count)\n if (count === undefined) {\n if (Object.keys(source).length > 0) {\n warnOncePerPayload(\n source,\n '[TransactionListBlock] drilldown_data has no positive integer `count` — no subscription header.',\n )\n }\n return undefined\n }\n\n return {\n count,\n month: toMonthStart(source.date, source),\n }\n}\n"],"mappings":";;;AAgBA,IAAa,IAA4B;AAAA,EACvC,gBAAgB;AAA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AACA;AAAA,EACF;AAEA,QAAM,IAAS,oBAAI,IAAoB;AACvC,MAAI,IAAU;AACd,SAAA,EAAK,QAAA,CAAS,MAAQ;AACpB,UAAM,IACJ,OAAO,KAAQ,YAAY,MAAQ,OAAO,EAAe,EAAI,gBAAgB,IAAI,QAC7E,IAAO,OAAO,KAAQ,YAAY,MAAQ,OAAO,EAAS,EAAI,eAAe,IAAI;AAEvF,IAAI,KAAQ,MAAS,SAAW,EAAO,IAAI,GAAM,CAAI,IAChD,KAAW;AAAA,EAClB,CAAC,GAEG,IAAU,KACZ,EACE,GACA,kCAAkC,CAAA,2DACpC,GAGK,EAAO,OAAO,IAAI,IAAS;AACpC,GAUa,IAAA,CACX,MACuC;AACvC,MAAI,GAAK,YAAY,EAA0B,kBAAmB;AAElE,QAAM,IAAS,EAAI;AACnB,MAAI,CAAC,EAAQ;AAEb,QAAM,IAAQ,EAAQ,EAAO,KAAK;AAClC,MAAI,MAAU,QAAW;AACvB,IAAI,OAAO,KAAK,CAAM,EAAE,SAAS,KAC/B,EACE,GACA,iGACF;AAEF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAA;AAAA,IACA,OAAO,EAAa,EAAO,MAAM,CAAM;AAAA,EACzC;AACF"}
@@ -8,6 +8,8 @@ interface DonutChartV2Props {
8
8
  data: DonutSegment[];
9
9
  centerLabel?: string;
10
10
  centerValue: string;
11
+ /** The embedded card's donut: exactly the chart's box, with no padding around it. */
12
+ compact?: boolean;
11
13
  }
12
- declare const DonutChartV2: ({ data, centerLabel, centerValue }: DonutChartV2Props) => import("react/jsx-runtime").JSX.Element;
14
+ declare const DonutChartV2: ({ data, centerLabel, centerValue, compact }: DonutChartV2Props) => import("react/jsx-runtime").JSX.Element;
13
15
  export default DonutChartV2;
@@ -2,19 +2,21 @@ import o from "@mui/material/Stack";
2
2
  import { Text as l } from "@mxenabled/mxui";
3
3
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
4
4
  import c from "@mui/material/Box";
5
- import { PieChart as m } from "@mui/x-charts/PieChart";
6
- var w = ({ data: a, centerLabel: n, centerValue: h }) => {
7
- const d = a.some((t) => t.label && t.labelValue), r = !d, u = a.map((t, s) => ({
5
+ import { PieChart as g } from "@mui/x-charts/PieChart";
6
+ var D = ({ data: a, centerLabel: n, centerValue: h, compact: u = !1 }) => {
7
+ const d = a.some((t) => t.label && t.labelValue), r = !d, x = a.map((t, s) => ({
8
8
  id: s,
9
9
  color: t.color,
10
10
  value: t.value
11
- })), x = r ? 30 : 53, p = r ? 35 : 63, f = 2, b = () => r ? "body1" : n ? "h3" : "h2";
11
+ })), p = r ? 30 : 53, f = r ? 35 : 63, b = 2, m = () => r ? "body1" : n ? "h3" : "h2";
12
12
  return /* @__PURE__ */ i(o, {
13
13
  sx: {
14
14
  alignItems: "center",
15
15
  flexDirection: "row",
16
- px: 16,
17
- py: 4
16
+ ...!u && {
17
+ px: 16,
18
+ py: 4
19
+ }
18
20
  },
19
21
  children: [/* @__PURE__ */ i(c, {
20
22
  sx: {
@@ -23,13 +25,13 @@ var w = ({ data: a, centerLabel: n, centerValue: h }) => {
23
25
  justifyContent: "center",
24
26
  position: "relative"
25
27
  },
26
- children: [/* @__PURE__ */ e(m, {
28
+ children: [/* @__PURE__ */ e(g, {
27
29
  height: r ? 72 : 125,
28
30
  series: [{
29
- cornerRadius: f,
30
- data: u,
31
- innerRadius: x,
32
- outerRadius: p
31
+ cornerRadius: b,
32
+ data: x,
33
+ innerRadius: p,
34
+ outerRadius: f
33
35
  }],
34
36
  slots: { tooltip: () => null },
35
37
  width: r ? 72 : 125
@@ -40,7 +42,7 @@ var w = ({ data: a, centerLabel: n, centerValue: h }) => {
40
42
  },
41
43
  children: [/* @__PURE__ */ e(l, {
42
44
  sx: { ...r && { fontWeight: 600 } },
43
- variant: b(),
45
+ variant: m(),
44
46
  children: h
45
47
  }), n && /* @__PURE__ */ e(l, {
46
48
  sx: { color: "text.secondary" },
@@ -81,7 +83,7 @@ var w = ({ data: a, centerLabel: n, centerValue: h }) => {
81
83
  });
82
84
  };
83
85
  export {
84
- w as default
86
+ D as default
85
87
  };
86
88
 
87
89
  //# sourceMappingURL=DonutChart.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { Text } from '@mxenabled/mxui'\nimport { PieChart } from '@mui/x-charts/PieChart'\ninterface DonutSegment {\n color: string\n label?: string\n labelValue?: React.ReactNode\n value: number\n}\n\ninterface DonutChartV2Props {\n data: DonutSegment[]\n centerLabel?: string\n centerValue: string\n}\n\nconst DonutChartV2 = ({ data, centerLabel, centerValue }: DonutChartV2Props) => {\n const hasLegend = data.some((segment) => segment.label && segment.labelValue)\n const isEmbedded = !hasLegend\n\n const chartData = data.map((item, index) => ({\n id: index,\n color: item.color,\n value: item.value,\n }))\n const innerRadius = isEmbedded ? 30 : 53\n const outerRadius = isEmbedded ? 35 : 63\n const cornerRadius = 2\n\n const getCenterValueVariant = () => {\n if (isEmbedded) return 'body1'\n if (centerLabel) return 'h3'\n return 'h2'\n }\n\n return (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', px: 16, py: 4 }}>\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <PieChart\n height={isEmbedded ? 72 : 125}\n series={[\n {\n cornerRadius,\n data: chartData,\n innerRadius,\n outerRadius,\n },\n ]}\n slots={{ tooltip: () => null }}\n width={isEmbedded ? 72 : 125}\n />\n\n <Box sx={{ position: 'absolute', textAlign: 'center' }}>\n <Text sx={{ ...(isEmbedded && { fontWeight: 600 }) }} variant={getCenterValueVariant()}>\n {centerValue}\n </Text>\n {centerLabel && (\n <Text sx={{ color: 'text.secondary' }} variant={isEmbedded ? 'caption' : 'body2'}>\n {centerLabel}\n </Text>\n )}\n </Box>\n </Box>\n\n {hasLegend && (\n <Stack sx={{ gap: 24, pl: 24 }}>\n {data.map(\n (segment, index) =>\n segment.label &&\n segment.labelValue && (\n <Stack key={segment.label ?? index}>\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n <Box\n sx={{\n backgroundColor: segment.color,\n borderRadius: '2px',\n height: 12,\n width: 12,\n }}\n />\n <Text sx={{ fontWeight: 400 }} variant=\"subtitle2\">\n {segment.label}\n </Text>\n </Stack>\n <Text sx={{ fontWeight: 400, pl: 20 }} variant=\"subtitle2\">\n {segment.labelValue}\n </Text>\n </Stack>\n ),\n )}\n </Stack>\n )}\n </Stack>\n )\n}\n\nexport default DonutChartV2\n"],"mappings":";;;;;AAiBA,IAAM,IAAA,CAAgB,EAAE,MAAA,GAAM,aAAA,GAAa,aAAA,EAAA,MAAqC;AAC9E,QAAM,IAAY,EAAK,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAQ,UAAU,GACtE,IAAa,CAAC,GAEd,IAAY,EAAK,IAAA,CAAK,GAAM,OAAW;AAAA,IAC3C,IAAI;AAAA,IACJ,OAAO,EAAK;AAAA,IACZ,OAAO,EAAK;AAAA,EACd,EAAE,GACI,IAAc,IAAa,KAAK,IAChC,IAAc,IAAa,KAAK,IAChC,IAAe,GAEf,IAAA,MACA,IAAmB,UACnB,IAAoB,OACjB;AAGT,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,IAAI;AAAA,MAAI,IAAI;AAAA,IAAE;AAAA,IAAvE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,gBAAgB;AAAA,QAChB,UAAU;AAAA,MACZ;AAAA,MANF,UAAA,CAQE,gBAAA,EAAC,GAAD;AAAA,QACE,QAAQ,IAAa,KAAK;AAAA,QAC1B,QAAQ,CACN;AAAA,UACE,cAAA;AAAA,UACA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AA,UAAE,YAAY;AAAA,UAAK,IAAI;AAAA,QAAG;AAAA,QAAG,SAAQ;AAAA,QAC5C,UAAA,EAAQ;AAAA,MACL,CAAA,CACD,EAAA,GAjBK,EAAQ,SAAS,CAiBtB,CAEb;AAAA,IACK,CAAA,CAEJ;AAAA;AAEX"}
1
+ {"version":3,"file":"DonutChart.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { Text } from '@mxenabled/mxui'\nimport { PieChart } from '@mui/x-charts/PieChart'\ninterface DonutSegment {\n color: string\n label?: string\n labelValue?: React.ReactNode\n value: number\n}\n\ninterface DonutChartV2Props {\n data: DonutSegment[]\n centerLabel?: string\n centerValue: string\n /** The embedded card's donut: exactly the chart's box, with no padding around it. */\n compact?: boolean\n}\n\nconst DonutChartV2 = ({ data, centerLabel, centerValue, compact = false }: DonutChartV2Props) => {\n const hasLegend = data.some((segment) => segment.label && segment.labelValue)\n const isEmbedded = !hasLegend\n\n const chartData = data.map((item, index) => ({\n id: index,\n color: item.color,\n value: item.value,\n }))\n const innerRadius = isEmbedded ? 30 : 53\n const outerRadius = isEmbedded ? 35 : 63\n const cornerRadius = 2\n\n const getCenterValueVariant = () => {\n if (isEmbedded) return 'body1'\n if (centerLabel) return 'h3'\n return 'h2'\n }\n\n return (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', ...(!compact && { px: 16, py: 4 }) }}>\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <PieChart\n height={isEmbedded ? 72 : 125}\n series={[\n {\n cornerRadius,\n data: chartData,\n innerRadius,\n outerRadius,\n },\n ]}\n slots={{ tooltip: () => null }}\n width={isEmbedded ? 72 : 125}\n />\n\n <Box sx={{ position: 'absolute', textAlign: 'center' }}>\n <Text sx={{ ...(isEmbedded && { fontWeight: 600 }) }} variant={getCenterValueVariant()}>\n {centerValue}\n </Text>\n {centerLabel && (\n <Text sx={{ color: 'text.secondary' }} variant={isEmbedded ? 'caption' : 'body2'}>\n {centerLabel}\n </Text>\n )}\n </Box>\n </Box>\n\n {hasLegend && (\n <Stack sx={{ gap: 24, pl: 24 }}>\n {data.map(\n (segment, index) =>\n segment.label &&\n segment.labelValue && (\n <Stack key={segment.label ?? index}>\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n <Box\n sx={{\n backgroundColor: segment.color,\n borderRadius: '2px',\n height: 12,\n width: 12,\n }}\n />\n <Text sx={{ fontWeight: 400 }} variant=\"subtitle2\">\n {segment.label}\n </Text>\n </Stack>\n <Text sx={{ fontWeight: 400, pl: 20 }} variant=\"subtitle2\">\n {segment.labelValue}\n </Text>\n </Stack>\n ),\n )}\n </Stack>\n )}\n </Stack>\n )\n}\n\nexport default DonutChartV2\n"],"mappings":";;;;;AAmBA,IAAM,IAAA,CAAgB,EAAE,MAAA,GAAM,aAAA,GAAa,aAAA,GAAa,SAAA,IAAU,GAAA,MAA+B;AAC/F,QAAM,IAAY,EAAK,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAQ,UAAU,GACtE,IAAa,CAAC,GAEd,IAAY,EAAK,IAAA,CAAK,GAAM,OAAW;AAAA,IAC3C,IAAI;AAAA,IACJ,OAAO,EAAK;AAAA,IACZ,OAAO,EAAK;AAAA,EACd,EAAE,GACI,IAAc,IAAa,KAAK,IAChC,IAAc,IAAa,KAAK,IAChC,IAAe,GAEf,IAAA,MACA,IAAmB,UACnB,IAAoB,OACjB;AAGT,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,GAAI,CAAC,KAAW;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,MAAE;AAAA,IAAG;AAAA,IAA5F,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,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D,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,UAAM,IAAI,EAAE,YAAY,IAAI;AAAA,UAAG,SAAQ;AAAA,UACpC,UAAA,EAAQ;AAAA,QACL,CAAA,CACD;AAAA,MACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QAAM,IAAI;AAAA,UAAE,YAAY;AAAA,UAAK,IAAI;AAAA,QAAG;AAAA,QAAG,SAAQ;AAAA,QAC5C,UAAA,EAAQ;AAAA,MACL,CAAA,CACD,EAAA,GAjBK,EAAQ,SAAS,CAiBtB,CAEb;AAAA,IACK,CAAA,CAEJ;AAAA;AAEX"}
@@ -1,9 +1,9 @@
1
- import { useGlobalStore as P, useInsightsV2Store as W } from "../../common/context/hooks.es.js";
1
+ import { useGlobalStore as G, useInsightsV2Store as P } from "../../common/context/hooks.es.js";
2
2
  import { slot as p } from "../../core/types/Insights.es.js";
3
- import { CURRENCY_FORMAT as B, formatCurrency as M } from "../../core/utils/NumberFormatting.es.js";
4
- import { getCategoryColor as K } from "../../core/utils/CategoryUtil.es.js";
3
+ import { CURRENCY_FORMAT as R, formatCurrency as M } from "../../core/utils/NumberFormatting.es.js";
4
+ import { getCategoryColor as F } from "../../core/utils/CategoryUtil.es.js";
5
5
  import { TinyBarChart as T } from "../../common/components/TinyBarChart.es.js";
6
- import { BAR_ARIA_LABEL as j, buildChartData as F, buildDataSeries as Z } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
6
+ import { BAR_ARIA_LABEL as K, buildChartData as j, buildDataSeries as Z } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
7
7
  import X from "../blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js";
8
8
  import { donutChartVariant as $ } from "../blocks/ChartBlocks/DonutChartBlock/layout.es.js";
9
9
  import { getDonutSegments as U } from "../blocks/ChartBlocks/DonutChartBlock/utils.es.js";
@@ -50,7 +50,7 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
50
50
  name: "lightbulb",
51
51
  size: 24
52
52
  })
53
- }), R = ({ logo: r }) => /* @__PURE__ */ t(D, {
53
+ }), B = ({ logo: r }) => /* @__PURE__ */ t(D, {
54
54
  center: /* @__PURE__ */ t(S, { logo: r }),
55
55
  size: m,
56
56
  sx: { flexShrink: 0 }
@@ -200,12 +200,12 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
200
200
  }, bt = ({ data: r }) => {
201
201
  const o = Z(p(r, "series"));
202
202
  if (!o.length) return null;
203
- const e = p(r, "category_guid"), i = F(o, j).slice(-3);
203
+ const e = p(r, "category_guid"), i = j(o, K).slice(-3);
204
204
  return /* @__PURE__ */ t(n, {
205
205
  "data-testid": "compact-insight-card-bar-chart",
206
206
  sx: { flexShrink: 0 },
207
207
  children: /* @__PURE__ */ t(T, {
208
- color: (a) => e ? K(e, a) : a.palette.primary.main,
208
+ color: (a) => e ? F(e, a) : a.palette.primary.main,
209
209
  data: i,
210
210
  height: pt,
211
211
  width: gt
@@ -219,8 +219,9 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
219
219
  "data-testid": "compact-insight-card-donut",
220
220
  sx: { flexShrink: 0 },
221
221
  children: /* @__PURE__ */ t(X, {
222
- centerLabel: L(e?.label),
223
- centerValue: Y(a, h, B.whole),
222
+ centerLabel: L(e?.compact_label),
223
+ centerValue: Y(a, h, R.whole),
224
+ compact: !0,
224
225
  data: _.map((s, v) => ({
225
226
  color: x[v],
226
227
  value: s
@@ -230,7 +231,7 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
230
231
  }, kt = 75, It = 50, Dt = (r) => {
231
232
  const o = L(r?.primary_text), e = I(r?.amount);
232
233
  if (o === void 0 || e === void 0) return;
233
- const i = M(e, B.cents);
234
+ const i = M(e, R.cents);
234
235
  return {
235
236
  ariaLabel: `${o}: ${i}`,
236
237
  formattedAmount: i,
@@ -254,13 +255,13 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
254
255
  category_color: bt,
255
256
  compact_comparison: wt,
256
257
  linked_logos: yt,
257
- minimal: R,
258
+ minimal: B,
258
259
  stacked_logos: ft,
259
260
  with_donut: Ct,
260
261
  with_illustration: xt,
261
262
  with_warning_badge: ht
262
263
  },
263
- fallback: R,
264
+ fallback: B,
264
265
  name: "InsightVisual"
265
266
  }), At = {
266
267
  BillAmountNotStandard: {
@@ -269,7 +270,8 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
269
270
  },
270
271
  CreditCardCloseToLimit: {
271
272
  key: "in_description_cta",
272
- trigger: "inDescriptionCta"
273
+ trigger: "inDescriptionCta",
274
+ boldCopy: !0
273
275
  },
274
276
  ConnectDiscoveredAccountsV2: {
275
277
  key: "in_description_cta",
@@ -281,7 +283,7 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
281
283
  },
282
284
  SwitchDirectDeposit: { key: "in_description_cta" }
283
285
  }, Et = (r) => r.stopPropagation(), ar = ({ beat: r, isCtaDisabled: o = !1, onCtaClick: e, onTap: i, payload: a }) => {
284
- const g = P(), { openActionDrawer: x } = W(), { description: _, instance_slot: h, primary_cta: s, title: v } = a, l = At[a.template ?? ""], y = l ? a[l.key] : s, b = a.in_description_cta?.post_message_metadata, O = !l || !!l.trigger || !!r && !!b, N = J(p(h.data, "logo")), z = (d) => {
286
+ const g = G(), { openActionDrawer: x } = P(), { description: _, instance_slot: h, primary_cta: s, title: v } = a, l = At[a.template ?? ""], y = l ? a[l.key] : s, b = a.in_description_cta?.post_message_metadata, O = !l || !!l.trigger || !!r && !!b, N = J(p(h.data, "logo")), z = (d) => {
285
287
  if (d.stopPropagation(), !(o || !y)) {
286
288
  if (l) {
287
289
  if (r && l.trigger) x({
@@ -289,13 +291,13 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
289
291
  trigger: l.trigger
290
292
  });
291
293
  else if (r && b) {
292
- const { action: H, ...G } = b;
294
+ const { action: H, ...W } = b;
293
295
  Q({
294
296
  beat: r,
295
297
  stores: g
296
298
  }, {
297
299
  action: H,
298
- payload: G
300
+ payload: W
299
301
  });
300
302
  }
301
303
  return;
@@ -363,7 +365,11 @@ var dt = 2, m = 44, E = 36, ct = 75, mt = 74, f = {
363
365
  overflow: "hidden",
364
366
  textOverflow: "ellipsis",
365
367
  WebkitBoxOrient: "vertical",
366
- WebkitLineClamp: dt
368
+ WebkitLineClamp: dt,
369
+ ...l?.boldCopy && { "& .bold-copy": {
370
+ fontFamily: "inherit",
371
+ fontWeight: "fontWeightBold"
372
+ } }
367
373
  },
368
374
  variant: "subtitle2"
369
375
  }), y?.label && O && /* @__PURE__ */ t(at, {