@mx-cartographer/experiences 9.7.198 → 9.7.199-alpha-moratorium

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 (83) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/core/types/Insights.d.ts +1 -1
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/core/types/localization/InsightsFeedCopy.d.ts +2 -0
  5. package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandard.es.js +4 -4
  6. package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandardMUI.es.js +4 -4
  7. package/dist/insights/components/insights/MonthlySpendingComparisonV2/MonthlySpendingComparisonV2.es.js +4 -4
  8. package/dist/insights/components/insights/WeeklyNoSpendDays/WeeklyNoSpendDays.es.js +8 -8
  9. package/dist/insights/components/shared/Charts/EmptyBarChart.es.js +4 -4
  10. package/dist/insights/components/shared/ZeroState/LinedCardZeroState.es.js +4 -4
  11. package/dist/insights/index.es.js +84 -84
  12. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js +17 -17
  13. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.d.ts +1 -5
  15. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +37 -36
  16. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.d.ts +9 -11
  18. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js +12 -6
  19. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.d.ts +3 -1
  21. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js +12 -11
  22. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js.map +1 -1
  23. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.d.ts +2 -2
  24. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +13 -13
  25. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  26. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +10 -4
  27. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +78 -71
  28. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
  29. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.d.ts +2 -4
  30. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js +78 -82
  31. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js.map +1 -1
  32. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +30 -24
  33. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  34. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.d.ts +7 -0
  35. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.es.js +46 -0
  36. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.es.js.map +1 -0
  37. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/index.d.ts +3 -0
  38. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.d.ts +10 -0
  39. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.es.js +17 -0
  40. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.es.js.map +1 -0
  41. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +25 -25
  42. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
  43. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.d.ts +0 -2
  44. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js +17 -21
  45. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js.map +1 -1
  46. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +46 -63
  47. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  48. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +3 -3
  49. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +44 -53
  50. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
  51. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.d.ts +1 -1
  52. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +30 -31
  53. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js.map +1 -1
  54. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +54 -53
  55. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  56. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +5 -3
  57. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +11 -9
  58. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  59. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +28 -27
  60. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
  61. package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
  62. package/dist/insights-v2/components/AccountHeroCard.d.ts +3 -1
  63. package/dist/insights-v2/components/AccountHeroCard.es.js.map +1 -1
  64. package/dist/insights-v2/components/CompactDirectDepositCard.d.ts +26 -0
  65. package/dist/insights-v2/components/CompactDirectDepositCard.es.js +73 -0
  66. package/dist/insights-v2/components/CompactDirectDepositCard.es.js.map +1 -0
  67. package/dist/insights-v2/components/DirectDepositCard.d.ts +6 -1
  68. package/dist/insights-v2/components/DirectDepositCard.es.js +22 -20
  69. package/dist/insights-v2/components/DirectDepositCard.es.js.map +1 -1
  70. package/dist/insights-v2/components/LogoFromGuid.d.ts +1 -1
  71. package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
  72. package/dist/insights-v2/components/MerchantHighlightCard.es.js +4 -4
  73. package/dist/insights-v2/components/TransactionListCard.d.ts +3 -1
  74. package/dist/insights-v2/components/TransactionListCard.es.js +25 -25
  75. package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
  76. package/dist/insights-v2/components/TransferLogoCard.es.js +1 -0
  77. package/dist/insights-v2/components/TransferLogoCard.es.js.map +1 -1
  78. package/dist/insights-v2/index.es.js +120 -116
  79. package/dist/insights-v2/mappings/blocks.es.js +118 -116
  80. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  81. package/dist/microinsights/cards/InsightCard.es.js +53 -53
  82. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  83. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
1
  import { buildPluralCopy as l } from "../../../core/utils/Localization.es.js";
2
- import { DATE_FORMATS_INTL as s, formatDate as d } from "../../../core/constants/DateFormats.es.js";
2
+ import { DATE_FORMATS_INTL as d, formatDate as s } from "../../../core/constants/DateFormats.es.js";
3
3
  import { CURRENCY_FORMAT as f, formatCurrency as x } from "../../../core/utils/NumberFormatting.es.js";
4
4
  import { getLogoElevation as _ } from "../../components/logoShadow.es.js";
5
5
  import { TransactionListHeaderIconTile as g } from "./TransactionListHeaderIconTile.es.js";
6
6
  import n from "@mui/material/Stack";
7
7
  import { Text as i } from "@mxenabled/mxui";
8
- import { jsx as o, jsxs as e } from "react/jsx-runtime";
8
+ import { jsx as t, jsxs as e } from "react/jsx-runtime";
9
9
  import { alpha as T } from "@mui/material/styles";
10
10
  import p from "@mui/material/Box";
11
- var u = "_1{count} transactions", h = "_1{count} transaction", v = (t, a) => [t, a].filter((r) => r !== void 0).map((r) => d(r, s.MONTH_DAY)).join(" – "), S = ({ summary: t, count: a, copy: r }) => {
12
- const c = v(t.startDate, t.endDate);
13
- return /* @__PURE__ */ o(p, {
11
+ var h = "_1{count} transactions", u = "_1{count} transaction", v = (r, a) => [r, a].filter((o) => o !== void 0).map((o) => s(o, d.MONTH_DAY)).join(" – "), U = ({ summary: r, count: a, copy: o }) => {
12
+ const c = v(r.startDate, r.endDate);
13
+ return /* @__PURE__ */ t(p, {
14
14
  sx: {
15
15
  px: 24,
16
16
  pt: 24,
@@ -30,17 +30,17 @@ var u = "_1{count} transactions", h = "_1{count} transaction", v = (t, a) => [t,
30
30
  flexDirection: "row",
31
31
  gap: 12
32
32
  },
33
- children: [/* @__PURE__ */ o(g, { name: "savings" }), /* @__PURE__ */ e(n, { children: [c && /* @__PURE__ */ o(i, {
33
+ children: [/* @__PURE__ */ t(g, { name: r.icon ?? "savings" }), /* @__PURE__ */ e(n, { children: [c && /* @__PURE__ */ t(i, {
34
34
  color: "text.secondary",
35
35
  variant: "caption",
36
36
  children: c
37
- }), /* @__PURE__ */ o(i, {
37
+ }), /* @__PURE__ */ t(i, {
38
38
  bold: !0,
39
39
  component: "p",
40
40
  variant: "h1",
41
- children: x(t.amount, f.cents)
41
+ children: x(r.amount, f.cents)
42
42
  })] })]
43
- }), /* @__PURE__ */ o(p, {
43
+ }), /* @__PURE__ */ t(p, {
44
44
  sx: {
45
45
  alignItems: "center",
46
46
  bgcolor: (m) => T(m.palette.primary.main, 0.15),
@@ -49,18 +49,18 @@ var u = "_1{count} transactions", h = "_1{count} transaction", v = (t, a) => [t,
49
49
  px: 12,
50
50
  py: 2
51
51
  },
52
- children: /* @__PURE__ */ o(i, {
52
+ children: /* @__PURE__ */ t(i, {
53
53
  color: "primary.dark",
54
54
  variant: "caption",
55
- children: l(r.transaction_count_one ?? h, r.transaction_count ?? u, a, String(a))
55
+ children: l(o.transaction_count_one ?? u, o.transaction_count ?? h, a, String(a))
56
56
  })
57
57
  })]
58
58
  })
59
59
  });
60
60
  };
61
61
  export {
62
- S as TransactionListSummaryCard,
63
- S as default
62
+ U as TransactionListSummaryCard,
63
+ U as default
64
64
  };
65
65
 
66
66
  //# sourceMappingURL=TransactionListSummaryCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListSummaryCard.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildPluralCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nimport { TransactionListHeaderIconTile } from './TransactionListHeaderIconTile'\nimport type { TransactionListSummary } from './layout'\n\nexport interface TransactionListSummaryCardProps {\n summary: TransactionListSummary\n /** Pill count: the CTA's `drilldown_data.count`, else the number of guids the beat names. */\n count: number\n /** Only the two pill-copy keys the card reads. */\n copy: Pick<InsightsFeedCopy['general'], 'transaction_count' | 'transaction_count_one'>\n}\n\n// English default until the localized-content service ships the pill copy in every locale.\nconst DEFAULT_COUNT_COPY = '_1{count} transactions'\nconst DEFAULT_COUNT_ONE_COPY = '_1{count} transaction'\n\n// Endpoints are already validated `Date`s from `readSummary` (invalid/junk omitted there).\nconst formatRange = (start?: Date, end?: Date): string =>\n [start, end]\n .filter((d): d is Date => d !== undefined)\n .map((d) => formatDate(d, DATE_FORMATS_INTL.MONTH_DAY))\n .join(' – ')\n\n/**\n * Summary header for the Transaction List drawer: a white card with a themed icon tile, the date\n * range, the headline amount, and a `{count} transactions` pill. Driven by the beat's summary\n * figures (see `readSummary` in layout.ts). Theme-aware tokens keep it correct in dark mode.\n *\n * Figma: Drilldown | Replenish Savings (\"Savings Withdrawal\"). Currently only Replenish Savings\n * declares the `summary_header` variant, so the tile carries its `savings` icon.\n */\nexport const TransactionListSummaryCard = ({\n summary,\n count,\n copy,\n}: TransactionListSummaryCardProps) => {\n const dateRange = formatRange(summary.startDate, summary.endDate)\n\n return (\n <Box sx={{ px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 11,\n p: 16,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <TransactionListHeaderIconTile name=\"savings\" />\n <Stack>\n {dateRange && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateRange}\n </Text>\n )}\n <Text bold={true} component=\"p\" variant=\"h1\">\n {formatCurrency(summary.amount, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n\n {/* Figma Tag: a 20px pill. As a flex container the inline caption becomes a flex item, so its own\n 16px line box (not the pill's inherited line height) sets 2 + 16 + 2, centered. */}\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\n display: 'flex',\n px: 12,\n py: 2,\n }}\n >\n <Text color=\"primary.dark\" variant=\"caption\">\n {\n buildPluralCopy(\n copy.transaction_count_one ?? DEFAULT_COUNT_ONE_COPY,\n copy.transaction_count ?? DEFAULT_COUNT_COPY,\n count,\n String(count),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AI;AAAA,UACF,YAAY;AAAA,UACZ,SAAA,CAAU,MAAU,EAAM,EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,UAC1D,cAAc;AAAA,UACd,SAAS;AAAA,UACT,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,SAAQ;AAAA,UAE/B,UAAA,EACE,EAAK,yBAAyB,GAC9B,EAAK,qBAAqB,GAC1B,GACA,OAAO,CAAK,CACd;AAAA,QAEE,CAAA;AAAA,MACH,CAAA,CACA;AAAA;EACJ,CAAA;AAET"}
1
+ {"version":3,"file":"TransactionListSummaryCard.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildPluralCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nimport { TransactionListHeaderIconTile } from './TransactionListHeaderIconTile'\nimport type { TransactionListSummary } from './layout'\n\nexport interface TransactionListSummaryCardProps {\n summary: TransactionListSummary\n /** Pill count: the CTA's `drilldown_data.count`, else the number of guids the beat names. */\n count: number\n /** Only the two pill-copy keys the card reads. */\n copy: Pick<InsightsFeedCopy['general'], 'transaction_count' | 'transaction_count_one'>\n}\n\n// English default until the localized-content service ships the pill copy in every locale.\nconst DEFAULT_COUNT_COPY = '_1{count} transactions'\nconst DEFAULT_COUNT_ONE_COPY = '_1{count} transaction'\n\n// Endpoints are already validated `Date`s from `readSummary` (invalid/junk omitted there).\nconst formatRange = (start?: Date, end?: Date): string =>\n [start, end]\n .filter((d): d is Date => d !== undefined)\n .map((d) => formatDate(d, DATE_FORMATS_INTL.MONTH_DAY))\n .join(' – ')\n\n/**\n * Summary header for the Transaction List drawer: a white card with a themed icon tile, the date\n * range, the headline amount, and a `{count} transactions` pill. Driven by the beat's summary\n * figures (see `readSummary` in layout.ts). Theme-aware tokens keep it correct in dark mode.\n *\n * Figma: Drilldown | Replenish Savings (\"Savings Withdrawal\"), Weekly Small Purchases Summary. The\n * tile is the summary's own icon (`drilldown_data.logo`), else Replenish Savings' `savings`.\n */\nexport const TransactionListSummaryCard = ({\n summary,\n count,\n copy,\n}: TransactionListSummaryCardProps) => {\n const dateRange = formatRange(summary.startDate, summary.endDate)\n\n return (\n <Box sx={{ px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 11,\n p: 16,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <TransactionListHeaderIconTile name={summary.icon ?? 'savings'} />\n <Stack>\n {dateRange && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateRange}\n </Text>\n )}\n <Text bold={true} component=\"p\" variant=\"h1\">\n {formatCurrency(summary.amount, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n\n {/* Figma Tag: a 20px pill. As a flex container the inline caption becomes a flex item, so its own\n 16px line box (not the pill's inherited line height) sets 2 + 16 + 2, centered. */}\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\n display: 'flex',\n px: 12,\n py: 2,\n }}\n >\n <Text color=\"primary.dark\" variant=\"caption\">\n {\n buildPluralCopy(\n copy.transaction_count_one ?? DEFAULT_COUNT_ONE_COPY,\n copy.transaction_count ?? DEFAULT_COUNT_COPY,\n count,\n String(count),\n ) as string\n }\n </Text>\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport default TransactionListSummaryCard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EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,UAC1D,cAAc;AAAA,UACd,SAAS;AAAA,UACT,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,SAAQ;AAAA,UAE/B,UAAA,EACE,EAAK,yBAAyB,GAC9B,EAAK,qBAAqB,GAC1B,GACA,OAAO,CAAK,CACd;AAAA,QAEE,CAAA;AAAA,MACH,CAAA,CACA;AAAA;EACJ,CAAA;AAET"}
@@ -13,6 +13,8 @@ export declare const TRANSACTION_LIST_VARIANTS: {
13
13
  readonly CREDIT_LIMIT_HEADER: "credit_limit_header";
14
14
  /** Opens Monthly Subscription Aggregate's Subscriptions list under a count tile and a tip. */
15
15
  readonly SUBSCRIPTION_LIST: "subscription_list";
16
+ /** The summary_header card over plain rows that keep the category subline (Weekly Small Purchases Summary). */
17
+ readonly SUMMARY_LIST: "summary_list";
16
18
  };
17
19
  export declare const HELP_HEADER_VARIANT: "help_header";
18
20
  interface TransactionListLayout {
@@ -20,6 +22,8 @@ interface TransactionListLayout {
20
22
  title?: (copy: GlobalCopy) => string | undefined;
21
23
  /** Rows are subtitled with the account (institution logo and name), not the category. */
22
24
  accountSubline?: boolean;
25
+ /** The list opens under the summary card (total, date range, count pill). */
26
+ summary?: boolean;
23
27
  }
24
28
  export declare const transactionListLayout: (variant: string | null | undefined) => TransactionListLayout;
25
29
  /** Drawer title: the variant's title when it has one, otherwise the beat's own title. */
@@ -47,17 +51,19 @@ export interface TransactionListSummary {
47
51
  endDate?: Date;
48
52
  /** Number of transactions for the pill, from the CTA's `drilldown_data.count`. */
49
53
  count?: number;
54
+ /** The tile's mx-icons name, from `drilldown_data.logo` (`ICO-<name>`); absent: the card's default. */
55
+ icon?: string;
50
56
  }
51
57
  /**
52
58
  * Summary-header figures for the drawer, read from the clicked CTA's `drilldown_data` (the backend
53
- * hangs a drilldown's own data off the CTA that opens it). Fails closed throughout: only the
54
- * `summary_header` variant renders a header (so figures from a different CTA that `getDynamicCta…`
55
- * fell back to can't be misattributed), then without a finite `amount` there is still no header, and
59
+ * hangs a drilldown's own data off the CTA that opens it). Fails closed throughout: only a summary
60
+ * variant renders a header (so figures from a different CTA that `getDynamicCta…` fell back to can't
61
+ * be misattributed), then without a finite `amount` there is still no header, and
56
62
  * each date is validated to a real `Date` or dropped — an unparseable value never reaches
57
63
  * `formatDate` (which throws on an Invalid Date).
58
64
  *
59
65
  * `drilldown_data` fields: `amount` (number), `start_date`/`end_date` (unix seconds|ms or ISO),
60
- * `count` (number of transactions).
66
+ * `count` (number of transactions), `logo` (the tile, `{ guid: 'ICO-<name>' }`).
61
67
  */
62
68
  export declare const readSummary: (cta: DrilldownCta | undefined) => TransactionListSummary | undefined;
63
69
  export interface CreditLimitHeader {
@@ -1,54 +1,60 @@
1
- import { asNonEmptyText as s, asNumber as _ } from "../../blocks/slotReaders.es.js";
2
- import { readHelp as E } from "../HelpBlock/layout.es.js";
3
- import { parseISO as I } from "date-fns/parseISO";
4
- var a = {
1
+ import { asLogoRef as E, asNonEmptyText as s, asNumber as _ } from "../../blocks/slotReaders.es.js";
2
+ import { logoFromEntityGuid as S } from "../../components/shared/EntityLogo.es.js";
3
+ import { readHelp as v } from "../HelpBlock/layout.es.js";
4
+ import { parseISO as y } from "date-fns/parseISO";
5
+ var o = {
5
6
  SUMMARY_HEADER: "summary_header",
6
7
  GENERIC_LIST: "generic_list",
7
8
  HELP_HEADER: "help_header",
8
9
  DEPOSIT_HISTORY: "deposit_history",
9
10
  CREDIT_LIMIT_HEADER: "credit_limit_header",
10
- SUBSCRIPTION_LIST: "subscription_list"
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]: {
11
+ SUBSCRIPTION_LIST: "subscription_list",
12
+ SUMMARY_LIST: "summary_list"
13
+ }, h = o.HELP_HEADER, m = (t) => t.transactions?.transactions_title, f = {
14
+ [o.SUMMARY_HEADER]: {
15
+ accountSubline: !0,
16
+ summary: !0
17
+ },
18
+ [o.GENERIC_LIST]: { title: m },
19
+ [o.HELP_HEADER]: { title: m },
20
+ [o.DEPOSIT_HISTORY]: { title: (t) => t.insights_feed?.transaction_list_block?.deposit_history_drawer_title },
21
+ [o.CREDIT_LIMIT_HEADER]: { title: (t) => t.insights_feed?.transaction_list_block?.credit_limit_header_drawer_title },
22
+ [o.SUBSCRIPTION_LIST]: {
18
23
  title: (t) => t.insights_feed?.transaction_list_block?.subscriptions_drawer_title,
19
24
  accountSubline: !0
20
- }
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);
25
+ },
26
+ [o.SUMMARY_LIST]: { summary: !0 }
27
+ }, p = (t) => t != null && Object.hasOwn(f, t) ? f[t] : {}, w = (t, e, r) => {
28
+ const { title: i } = p(t);
29
+ return (i ? i(e) : r?.insights_payload?.title) ?? "";
30
+ }, M = (t, e) => {
31
+ if (t?.variant !== h) return;
32
+ const r = s(e?.help_label), i = v(e);
27
33
  return {
28
34
  descriptionHtml: s(e?.description_html),
29
- ...r && n && { learnMore: {
30
- ...n,
35
+ ...r && i && { learnMore: {
36
+ ...i,
31
37
  label: r
32
38
  } }
33
39
  };
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) => {
40
+ }, I = (t) => typeof t == "number" && Number.isInteger(t) && t > 0 ? t : void 0, b = Date.UTC(2e3, 0, 1), L = Date.UTC(2100, 0, 1), T = /* @__PURE__ */ new WeakMap(), c = (t, e) => {
41
+ const r = T.get(t) ?? /* @__PURE__ */ new Set();
42
+ r.has(e) || (T.set(t, r.add(e)), console.warn(e));
43
+ }, u = (t, e, r) => {
38
44
  if (t == null || t === "") return;
39
- let n;
40
- if (typeof t == "number" && Number.isFinite(t)) n = t < 1e12 ? t * 1e3 : t;
45
+ let i;
46
+ if (typeof t == "number" && Number.isFinite(t)) i = t < 1e12 ? t * 1e3 : t;
41
47
  else if (typeof t == "string") {
42
- const i = I(t).getTime();
43
- n = Number.isNaN(i) ? void 0 : i;
48
+ const n = y(t).getTime();
49
+ i = Number.isNaN(n) ? void 0 : n;
44
50
  }
45
- if (n === void 0 || n < h || n > b) {
51
+ if (i === void 0 || i < b || i > L) {
46
52
  c(r, `[TransactionListBlock] drilldown_data.${e} is unparseable or out of range (${typeof t})`);
47
53
  return;
48
54
  }
49
- return new Date(n);
50
- }, w = (t) => {
51
- if (t?.variant !== a.SUMMARY_HEADER) return;
55
+ return new Date(i);
56
+ }, O = (t) => {
57
+ if (!p(t?.variant).summary) return;
52
58
  const e = t?.drilldown_data;
53
59
  if (!e) return;
54
60
  const r = _(e.amount);
@@ -58,66 +64,67 @@ var a = {
58
64
  }
59
65
  return {
60
66
  amount: r,
61
- startDate: l(e.start_date, "start_date", e),
62
- endDate: l(e.end_date, "end_date", e),
63
- count: p(e.count)
67
+ startDate: u(e.start_date, "start_date", e),
68
+ endDate: u(e.end_date, "end_date", e),
69
+ count: I(e.count),
70
+ icon: S(E(e.logo)?.guid)?.logo_name
64
71
  };
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);
68
- if (r === void 0 || n === void 0 || n <= 0) return;
69
- const i = s(e?.institution_guid), o = s(e?.institution_name), d = s(e?.account_name);
72
+ }, C = (t) => {
73
+ if (t?.variant !== o.CREDIT_LIMIT_HEADER) return;
74
+ const e = t.drilldown_data, r = _(e?.current_balance), i = _(e?.credit_limit);
75
+ if (r === void 0 || i === void 0 || i <= 0) return;
76
+ const n = s(e?.institution_guid), a = s(e?.institution_name), d = s(e?.account_name);
70
77
  return {
71
78
  balance: r,
72
- limit: n,
73
- utilization: Math.max(0, Math.round(r / n * 100)),
74
- ...i && { institutionGuid: i },
75
- ...o && { institutionName: o },
79
+ limit: i,
80
+ utilization: Math.max(0, Math.round(r / i * 100)),
81
+ ...n && { institutionGuid: n },
82
+ ...a && { institutionName: a },
76
83
  ...d && { accountName: d }
77
84
  };
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;
80
- if (r && n >= 1 && n <= 12) return new Date(Number(r[1]), n - 1, 1);
81
- const i = l(t, "date", e);
82
- return i && new Date(i.getUTCFullYear(), i.getUTCMonth(), 1);
83
- }, g = (t) => {
84
- if (t?.variant !== a.SUBSCRIPTION_LIST) return;
85
+ }, R = /^(\d{4})-(\d{2})-\d{2}$/, g = (t, e) => {
86
+ const r = typeof t == "string" ? R.exec(t) : null, i = r ? Number(r[2]) : 0;
87
+ if (r && i >= 1 && i <= 12) return new Date(Number(r[1]), i - 1, 1);
88
+ const n = u(t, "date", e);
89
+ return n && new Date(n.getUTCFullYear(), n.getUTCMonth(), 1);
90
+ }, P = (t) => {
91
+ if (t?.variant !== o.SUBSCRIPTION_LIST) return;
85
92
  const e = t.drilldown_data, r = e?.transaction_frequencies;
86
93
  if (r == null) return;
87
94
  if (!Array.isArray(r)) {
88
95
  c(e, "[TransactionListBlock] drilldown_data.transaction_frequencies is not a list — captioning no rows.");
89
96
  return;
90
97
  }
91
- const n = /* @__PURE__ */ new Map();
92
- let i = 0;
93
- return r.forEach((o) => {
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;
98
+ const i = /* @__PURE__ */ new Map();
99
+ let n = 0;
100
+ return r.forEach((a) => {
101
+ const d = typeof a == "object" && a !== null ? s(a.transaction_guid) : void 0, l = typeof a == "object" && a !== null ? _(a.recurrence_type) : void 0;
102
+ d && l !== void 0 ? i.set(d, l) : n += 1;
103
+ }), n > 0 && c(e, `[TransactionListBlock] dropped ${n} malformed drilldown_data.transaction_frequencies row(s).`), i.size > 0 ? i : void 0;
104
+ }, U = (t) => {
105
+ if (t?.variant !== o.SUBSCRIPTION_LIST) return;
99
106
  const e = t.drilldown_data;
100
107
  if (!e) return;
101
- const r = p(e.count);
108
+ const r = I(e.count);
102
109
  if (r === void 0) {
103
110
  Object.keys(e).length > 0 && c(e, "[TransactionListBlock] drilldown_data has no positive integer `count` — no subscription header.");
104
111
  return;
105
112
  }
106
113
  return {
107
114
  count: r,
108
- month: y(e.date, e)
115
+ month: g(e.date, e)
109
116
  };
110
117
  };
111
118
  export {
112
- v as HELP_HEADER_VARIANT,
113
- a as TRANSACTION_LIST_VARIANTS,
114
- H as getTransactionListDrawerTitle,
115
- O as readCreditLimitHeader,
116
- N as readHelpHeader,
117
- C as readSubscriptionHeader,
118
- w as readSummary,
119
- g as readTransactionFrequencies,
120
- S as transactionListLayout
119
+ h as HELP_HEADER_VARIANT,
120
+ o as TRANSACTION_LIST_VARIANTS,
121
+ w as getTransactionListDrawerTitle,
122
+ C as readCreditLimitHeader,
123
+ M as readHelpHeader,
124
+ U as readSubscriptionHeader,
125
+ O as readSummary,
126
+ P as readTransactionFrequencies,
127
+ p as transactionListLayout
121
128
  };
122
129
 
123
130
  //# 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\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;AAAA,EAChB,cAAc;AAAA,EAEd,aAAa;AAAA,EAEb,iBAAiB;AAAA,EAEjB,qBAAqB;AAAA,EAErB,mBAAmB;AACrB,GAEa,IAAsB,EAA0B,aASvD,IAAA,CAAqB,MAAqB,EAAK,cAAc,oBAG7D,IAAgD;AAAA,EACnD,CAAA,EAA0B,cAAA,GAAiB,EAAE,gBAAgB,GAAK;AAAA,EAClE,CAAA,EAA0B,YAAA,GAAe,EAAE,OAAO,EAAkB;AAAA,EACpE,CAAA,EAA0B,WAAA,GAAc,EAAE,OAAO,EAAkB;AAAA,EACnE,CAAA,EAA0B,eAAA,GAAkB,EAC3C,OAAA,CAAQ,MAAS,EAAK,eAAe,wBAAwB,6BAC/D;AAAA,EACC,CAAA,EAA0B,mBAAA,GAAsB,EAC/C,OAAA,CAAQ,MAAS,EAAK,eAAe,wBAAwB,iCAC/D;AAAA,EACC,CAAA,EAA0B,iB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AO,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 { asLogoRef, asNonEmptyText, asNumber } from '../../blocks/slotReaders'\nimport { logoFromEntityGuid } from '../../components/shared/EntityLogo'\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 /** The summary_header card over plain rows that keep the category subline (Weekly Small Purchases Summary). */\n SUMMARY_LIST: 'summary_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 /** The list opens under the summary card (total, date range, count pill). */\n summary?: 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, summary: 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 [TRANSACTION_LIST_VARIANTS.SUMMARY_LIST]: { summary: true },\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 /** The tile's mx-icons name, from `drilldown_data.logo` (`ICO-<name>`); absent: the card's default. */\n icon?: string\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 a summary\n * variant renders a header (so figures from a different CTA that `getDynamicCta…` fell back to can't\n * 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), `logo` (the tile, `{ guid: 'ICO-<name>' }`).\n */\nexport const readSummary = (cta: DrilldownCta | undefined): TransactionListSummary | undefined => {\n // Defense-in-depth on financial figures: only the summary variants show the card.\n if (!transactionListLayout(cta?.variant).summary) 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 icon: logoFromEntityGuid(asLogoRef(source.logo)?.guid)?.logo_name,\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":";;;;AAiBA,IAAa,IAA4B;AAAA,EACvC,gBAAgB;AAAA,EAChB,cAAc;AAAA,EAEd,aAAa;AAAA,EAEb,iBAAiB;AAAA,EAEjB,qBAAqB;AAAA,EAErB,mBAAmB;AAAA,EAEnB,cAAc;AAChB,GAEa,IAAsB,EAA0B,aAWvD,IAAA,CAAqB,MAAqB,EAAK,cAAc,oBAG7D,IAAgD;AAAA,EACnD,CAAA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,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,12 +8,10 @@ interface MilestoneProgressProps {
8
8
  label?: string;
9
9
  /** Full's headline ("$500 in Savings"). */
10
10
  headline?: string;
11
- /** Mini's one-line headline ("Nice Work!"), shown instead of the eyebrow and headline. */
12
- miniHeadline?: string;
13
11
  isMini: boolean;
14
12
  }
15
13
  /** The $100 / $500 / $1,000 goal stepper (Figma 1132:26517): checks before the current goal, a ring on it. */
16
- declare const MilestoneProgress: ({ currentStep, headline, isMini, label, miniHeadline, }: MilestoneProgressProps) => import("react/jsx-runtime").JSX.Element;
14
+ declare const MilestoneProgress: ({ currentStep, headline, isMini, label }: MilestoneProgressProps) => import("react/jsx-runtime").JSX.Element;
17
15
  export default MilestoneProgress;
18
- /** step_chart_block / milestone_progress: full shows the eyebrow and headline, mini the short headline. */
16
+ /** step_chart_block / milestone_progress: full shows the eyebrow and headline, mini the headline only. */
19
17
  export declare const MilestoneProgressBlock: ({ beatGuid, payload }: BlockProps<StepChartBlockData>) => import("react/jsx-runtime").JSX.Element | null;