@mx-cartographer/experiences 9.7.151 → 9.7.152

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 (27) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/core/types/Insights.d.ts +7 -4
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/core/types/localization/InsightsFeedCopy.d.ts +6 -0
  5. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +33 -36
  6. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +91 -54
  8. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.d.ts +12 -0
  10. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js +76 -0
  11. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js.map +1 -0
  12. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +14 -0
  13. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +76 -37
  14. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
  15. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +3 -1
  16. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +5 -4
  17. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -1
  18. package/dist/insights-v2/components/drawerTip.d.ts +2 -0
  19. package/dist/insights-v2/components/drawerTip.es.js +10 -0
  20. package/dist/insights-v2/components/drawerTip.es.js.map +1 -0
  21. package/dist/transactions/components/shared/TransactionList.d.ts +2 -0
  22. package/dist/transactions/components/shared/TransactionList.es.js +48 -47
  23. package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
  24. package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +2 -0
  25. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +50 -45
  26. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
  27. package/package.json +1 -1
@@ -0,0 +1,76 @@
1
+ import { buildDynamicCopy as m } from "../../../core/utils/Localization.es.js";
2
+ import { DATE_FORMATS_INTL as l, formatDate as d } from "../../../core/constants/DateFormats.es.js";
3
+ import { getLogoElevation as u } from "../../components/logoShadow.es.js";
4
+ import { TipSection as f } from "../../../insights/components/shared/ChartDrawerTemplate/TipSection.es.js";
5
+ import { DRAWER_TIP_ICON as g } from "../../components/drawerTip.es.js";
6
+ import n from "@mui/material/Stack";
7
+ import { Text as p } from "@mxenabled/mxui";
8
+ import { Icon as h } from "@mxenabled/mx-icons";
9
+ import { jsx as r, jsxs as e } from "react/jsx-runtime";
10
+ import { alpha as x } from "@mui/material/styles";
11
+ import b from "@mui/material/Box";
12
+ var j = ({ header: o, copy: i, tipTitle: a }) => {
13
+ const s = a && i.subscriptions_tip_message ? i.subscriptions_tip_message : void 0, t = o.month && i.subscriptions_in_month ? m(i.subscriptions_in_month, d(o.month, l.MONTH_LONG)) : void 0;
14
+ return /* @__PURE__ */ e(n, {
15
+ sx: {
16
+ gap: 16,
17
+ px: 24,
18
+ pt: 24,
19
+ pb: 12
20
+ },
21
+ children: [/* @__PURE__ */ e(n, {
22
+ sx: {
23
+ alignItems: "center",
24
+ bgcolor: "background.paper",
25
+ borderRadius: "8px",
26
+ boxShadow: u,
27
+ flexDirection: "row",
28
+ gap: 12,
29
+ p: 16
30
+ },
31
+ children: [/* @__PURE__ */ r(b, {
32
+ sx: {
33
+ alignItems: "center",
34
+ bgcolor: (c) => x(c.palette.primary.main, 0.15),
35
+ borderRadius: "4px",
36
+ color: "primary.main",
37
+ display: "flex",
38
+ height: 56,
39
+ justifyContent: "center",
40
+ width: 56
41
+ },
42
+ children: /* @__PURE__ */ r(h, {
43
+ "aria-hidden": !0,
44
+ fill: !0,
45
+ name: "currency_exchange",
46
+ size: 32
47
+ })
48
+ }), /* @__PURE__ */ e(n, {
49
+ "aria-label": t ? `${o.count} ${t}` : String(o.count),
50
+ role: "group",
51
+ children: [/* @__PURE__ */ r(p, {
52
+ "aria-hidden": !0,
53
+ bold: !0,
54
+ component: "p",
55
+ variant: "h1",
56
+ children: o.count
57
+ }), t && /* @__PURE__ */ r(p, {
58
+ "aria-hidden": !0,
59
+ color: "text.secondary",
60
+ variant: "caption",
61
+ children: t
62
+ })]
63
+ })]
64
+ }), s && /* @__PURE__ */ r(f, {
65
+ icon: g,
66
+ message: m(s, /* @__PURE__ */ r("strong", { children: a })),
67
+ sx: { m: 0 }
68
+ })]
69
+ });
70
+ };
71
+ export {
72
+ j as TransactionListSubscriptionHeader,
73
+ j as default
74
+ };
75
+
76
+ //# sourceMappingURL=TransactionListSubscriptionHeader.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionListSubscriptionHeader.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { TipSection } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { getLogoElevation } from '../../components/logoShadow'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\n\nimport type { SubscriptionListHeader } from './layout'\n\nexport interface TransactionListSubscriptionHeaderProps {\n header: SubscriptionListHeader\n /** The caption and tip strings the header reads. */\n copy: Pick<\n NonNullable<InsightsFeedCopy['transaction_list_block']>,\n 'subscriptions_in_month' | 'subscriptions_tip_message'\n >\n /** The bold tip label (\"Tip\"), `insights_feed.general.tip_section_title`. */\n tipTitle: string\n}\n\n/** The Subscriptions drawer's header: the count tile and the tip (Figma 1268:54330). */\nexport const TransactionListSubscriptionHeader = ({\n header,\n copy,\n tipTitle,\n}: TransactionListSubscriptionHeaderProps) => {\n // Both halves or neither: a tip without its bold label would read \": Review…\".\n const tip =\n tipTitle && copy.subscriptions_tip_message ? copy.subscriptions_tip_message : undefined\n const caption =\n header.month && copy.subscriptions_in_month\n ? (buildDynamicCopy(\n copy.subscriptions_in_month,\n formatDate(header.month, DATE_FORMATS_INTL.MONTH_LONG),\n ) as string)\n : undefined\n\n return (\n <Stack sx={{ gap: 16, px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n flexDirection: 'row',\n gap: 12,\n p: 16,\n }}\n >\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '4px',\n color: 'primary.main',\n display: 'flex',\n height: 56,\n justifyContent: 'center',\n width: 56,\n }}\n >\n <Icon aria-hidden={true} fill={true} name=\"currency_exchange\" size={32} />\n </Box>\n {/* Read as one label: \"3 Subscriptions in October\", never a bare \"3\" read twice. */}\n <Stack\n aria-label={caption ? `${header.count} ${caption}` : String(header.count)}\n role=\"group\"\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h1\">\n {header.count}\n </Text>\n {caption && (\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"caption\">\n {caption}\n </Text>\n )}\n </Stack>\n </Stack>\n\n {tip && (\n <TipSection\n icon={DRAWER_TIP_ICON}\n message={buildDynamicCopy(tip, <strong>{tipTitle}</strong>) as ReactNode}\n sx={{ m: 0 }}\n />\n )}\n </Stack>\n )\n}\n\nexport default TransactionListSubscriptionHeader\n"],"mapp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O;AAAA,QACJ,CAAA,GACL,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,eAAa;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UACrD,UAAA;AAAA,QACG,CAAA,CAEH;AAAA,MACF,CAAA,CAAA;AAAA,IAEN,CAAA,GAAA,KACC,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,SAAS,EAAiB,GAAK,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAiB,CAAA,CAAC;AAAA,MAC1D,IAAI,EAAE,GAAG,EAAE;AAAA,IACZ,CAAA,CAEE;AAAA;AAEX"}
@@ -9,7 +9,11 @@ export declare const TRANSACTION_LIST_VARIANTS: {
9
9
  readonly HELP_HEADER: "help_header";
10
10
  /** Opens Micro Deposits' Deposit History list. */
11
11
  readonly DEPOSIT_HISTORY: "deposit_history";
12
+ /** Opens Monthly Subscription Aggregate's Subscriptions list under a count tile and a tip. */
13
+ readonly SUBSCRIPTION_LIST: "subscription_list";
12
14
  };
15
+ /** Variants whose rows are subtitled with the account (institution logo and name), not the category. */
16
+ export declare const ACCOUNT_SUBLINE_VARIANTS: ReadonlySet<string | null | undefined>;
13
17
  export declare const HELP_HEADER_VARIANT: "help_header";
14
18
  /** Drawer title: the variant's title when it has one, otherwise the beat's own title. Add new variants here. */
15
19
  export declare const getTransactionListDrawerTitle: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string;
@@ -49,4 +53,14 @@ export interface TransactionListSummary {
49
53
  * `count` (number of transactions).
50
54
  */
51
55
  export declare const readSummary: (cta: DrilldownCta | undefined) => TransactionListSummary | undefined;
56
+ /** Each listed transaction's schedule, from `drilldown_data.transaction_frequencies`; malformed rows are dropped. */
57
+ export declare const readTransactionFrequencies: (cta: DrilldownCta | undefined) => Map<string, number> | undefined;
58
+ export interface SubscriptionListHeader {
59
+ /** Subscriptions paid in the month, from the CTA's `drilldown_data.count`. */
60
+ count: number;
61
+ /** The month paid in, as local midnight on the 1st; omitted when missing or unparseable. */
62
+ month?: Date;
63
+ }
64
+ /** The count tile's figures; only for `subscription_list` with a positive integer `count`. */
65
+ export declare const readSubscriptionHeader: (cta: DrilldownCta | undefined) => SubscriptionListHeader | undefined;
52
66
  export {};
@@ -1,68 +1,107 @@
1
- import { asNonEmptyText as o, asNumber as m } from "../../blocks/slotReaders.es.js";
2
- import { readHelp as E } from "../HelpBlock/layout.es.js";
3
- import { parseISO as c } from "date-fns/parseISO";
4
- var n = {
1
+ import { asNonEmptyText as d, asNumber as f } from "../../blocks/slotReaders.es.js";
2
+ import { readHelp as p } from "../HelpBlock/layout.es.js";
3
+ import { parseISO as S } from "date-fns/parseISO";
4
+ var a = {
5
5
  SUMMARY_HEADER: "summary_header",
6
6
  GENERIC_LIST: "generic_list",
7
7
  HELP_HEADER: "help_header",
8
- DEPOSIT_HISTORY: "deposit_history"
9
- }, f = n.HELP_HEADER, A = (t, r, e) => {
8
+ DEPOSIT_HISTORY: "deposit_history",
9
+ SUBSCRIPTION_LIST: "subscription_list"
10
+ }, b = /* @__PURE__ */ new Set([a.SUMMARY_HEADER, a.SUBSCRIPTION_LIST]), I = a.HELP_HEADER, y = (t, r, e) => {
10
11
  switch (t) {
11
- case n.GENERIC_LIST:
12
- case n.HELP_HEADER:
12
+ case a.GENERIC_LIST:
13
+ case a.HELP_HEADER:
13
14
  return r.transactions?.transactions_title ?? "";
14
- case n.DEPOSIT_HISTORY:
15
+ case a.DEPOSIT_HISTORY:
15
16
  return r.insights_feed?.transaction_list_block?.deposit_history_drawer_title ?? "";
17
+ case a.SUBSCRIPTION_LIST:
18
+ return r.insights_feed?.transaction_list_block?.subscriptions_drawer_title ?? "";
16
19
  default:
17
20
  return e?.insights_payload?.title ?? "";
18
21
  }
19
- }, D = (t, r) => {
20
- if (t?.variant !== f) return;
21
- const e = o(r?.help_label), a = E(r);
22
+ }, H = (t, r) => {
23
+ if (t?.variant !== I) return;
24
+ const e = d(r?.help_label), n = p(r);
22
25
  return {
23
- descriptionHtml: o(r?.description_html),
24
- ...e && a && { learnMore: {
25
- ...a,
26
+ descriptionHtml: d(r?.description_html),
27
+ ...e && n && { learnMore: {
28
+ ...n,
26
29
  label: e
27
30
  } }
28
31
  };
29
- }, l = (t) => typeof t == "number" && Number.isInteger(t) && t > 0 ? t : void 0, p = Date.UTC(2e3, 0, 1), u = Date.UTC(2100, 0, 1), s = /* @__PURE__ */ new WeakSet(), _ = (t, r) => {
30
- s.has(t) || (s.add(t), console.warn(r));
31
- }, d = (t, r, e) => {
32
+ }, T = (t) => typeof t == "number" && Number.isInteger(t) && t > 0 ? t : void 0, m = Date.UTC(2e3, 0, 1), E = Date.UTC(2100, 0, 1), u = /* @__PURE__ */ new WeakMap(), s = (t, r) => {
33
+ const e = u.get(t) ?? /* @__PURE__ */ new Set();
34
+ e.has(r) || (u.set(t, e.add(r)), console.warn(r));
35
+ }, c = (t, r, e) => {
32
36
  if (t == null || t === "") return;
33
- let a;
34
- if (typeof t == "number" && Number.isFinite(t)) a = t < 1e12 ? t * 1e3 : t;
37
+ let n;
38
+ if (typeof t == "number" && Number.isFinite(t)) n = t < 1e12 ? t * 1e3 : t;
35
39
  else if (typeof t == "string") {
36
- const i = c(t).getTime();
37
- a = Number.isNaN(i) ? void 0 : i;
40
+ const i = S(t).getTime();
41
+ n = Number.isNaN(i) ? void 0 : i;
38
42
  }
39
- if (a === void 0 || a < p || a > u) {
40
- _(e, `[TransactionListBlock] drilldown_data.${r} is unparseable or out of range (${typeof t})`);
43
+ if (n === void 0 || n < m || n > E) {
44
+ s(e, `[TransactionListBlock] drilldown_data.${r} is unparseable or out of range (${typeof t})`);
41
45
  return;
42
46
  }
43
- return new Date(a);
44
- }, I = (t) => {
45
- if (t?.variant !== n.SUMMARY_HEADER) return;
47
+ return new Date(n);
48
+ }, L = (t) => {
49
+ if (t?.variant !== a.SUMMARY_HEADER) return;
46
50
  const r = t?.drilldown_data;
47
51
  if (!r) return;
48
- const e = m(r.amount);
52
+ const e = f(r.amount);
49
53
  if (e === void 0) {
50
- Object.keys(r).length > 0 && _(r, "[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.");
54
+ Object.keys(r).length > 0 && s(r, "[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.");
51
55
  return;
52
56
  }
53
57
  return {
54
58
  amount: e,
55
- startDate: d(r.start_date, "start_date", r),
56
- endDate: d(r.end_date, "end_date", r),
57
- count: l(r.count)
59
+ startDate: c(r.start_date, "start_date", r),
60
+ endDate: c(r.end_date, "end_date", r),
61
+ count: T(r.count)
62
+ };
63
+ }, v = /^(\d{4})-(\d{2})-\d{2}$/, N = (t, r) => {
64
+ const e = typeof t == "string" ? v.exec(t) : null, n = e ? Number(e[2]) : 0;
65
+ if (e && n >= 1 && n <= 12) return new Date(Number(e[1]), n - 1, 1);
66
+ const i = c(t, "date", r);
67
+ return i && new Date(i.getUTCFullYear(), i.getUTCMonth(), 1);
68
+ }, w = (t) => {
69
+ if (t?.variant !== a.SUBSCRIPTION_LIST) return;
70
+ const r = t.drilldown_data, e = r?.transaction_frequencies;
71
+ if (e == null) return;
72
+ if (!Array.isArray(e)) {
73
+ s(r, "[TransactionListBlock] drilldown_data.transaction_frequencies is not a list — captioning no rows.");
74
+ return;
75
+ }
76
+ const n = /* @__PURE__ */ new Map();
77
+ let i = 0;
78
+ return e.forEach((o) => {
79
+ const _ = typeof o == "object" && o !== null ? d(o.transaction_guid) : void 0, l = typeof o == "object" && o !== null ? f(o.recurrence_type) : void 0;
80
+ _ && l !== void 0 ? n.set(_, l) : i += 1;
81
+ }), i > 0 && s(r, `[TransactionListBlock] dropped ${i} malformed drilldown_data.transaction_frequencies row(s).`), n.size > 0 ? n : void 0;
82
+ }, D = (t) => {
83
+ if (t?.variant !== a.SUBSCRIPTION_LIST) return;
84
+ const r = t.drilldown_data;
85
+ if (!r) return;
86
+ const e = T(r.count);
87
+ if (e === void 0) {
88
+ Object.keys(r).length > 0 && s(r, "[TransactionListBlock] drilldown_data has no positive integer `count` — no subscription header.");
89
+ return;
90
+ }
91
+ return {
92
+ count: e,
93
+ month: N(r.date, r)
58
94
  };
59
95
  };
60
96
  export {
61
- f as HELP_HEADER_VARIANT,
62
- n as TRANSACTION_LIST_VARIANTS,
63
- A as getTransactionListDrawerTitle,
64
- D as readHelpHeader,
65
- I as readSummary
97
+ b as ACCOUNT_SUBLINE_VARIANTS,
98
+ I as HELP_HEADER_VARIANT,
99
+ a as TRANSACTION_LIST_VARIANTS,
100
+ y as getTransactionListDrawerTitle,
101
+ H as readHelpHeader,
102
+ D as readSubscriptionHeader,
103
+ L as readSummary,
104
+ w as readTransactionFrequencies
66
105
  };
67
106
 
68
107
  //# 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} as const\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 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// `readSummary` runs on every observer re-render (no `useMemo` by design), so warn at most once per\n// distinct payload object instead of on every render. Keyed on the `drilldown_data` object, which is\n// a stable reference across re-renders of the same beat.\nconst warnedPayloads = new WeakSet<object>()\nconst warnOncePerPayload = (source: object, message: string): void => {\n if (warnedPayloads.has(source)) return\n warnedPayloads.add(source)\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"],"mappings":";;;AAgBA,IAAa,IAA4B;AAAA,EACvC,gBAAgB;AAAA,EAChB,cAAc;AAAA,EAEd,aAAa;AAAA,EAEb,iBAAiB;AACnB,GAEa,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;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,KAAK,IAAQ,IAAI,IAAQ,QAGxE,IAAY,KAAK,IAAI,KAAM,GAAG,CAAC,GAC/B,IAAY,KAAK,IAAI,MAAM,GAAG,CAAC,GAK/B,IAAiB,oBAAI,QAAgB,GACrC,IAAA,CAAsB,GAAgB,MAA0B;AACpE,EAAI,EAAe,IAAI,CAAM,MAC7B,EAAe,IAAI,CAAM,GACzB,QAAQ,KAAK,CAAO;AACtB,GAQM,IAAA,CAAU,GAAgB,GAAe,MAAqC;AAElF,MAA2B,KAAU,QAAQ,MAAU,GAAI;AAE3D,MAAI;AACJ,MAAI,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,EAGpD,CAAA,IAAK,IAAQ,OAAO,IAAQ,MAAO;AAAA,WAC1B,OAAO,KAAU,UAAU;AACpC,UAAM,IAAS,EAAS,CAAK,EAAE,QAAQ;AACvC,IAAA,IAAK,OAAO,MAAM,CAAM,IAAI,SAAY;AAAA,EAC1C;AAEA,MAAI,MAAO,UAAa,IAAK,KAAa,IAAK,GAAW;AACxD,IAAA,EACE,GACA,yCAAyC,CAAA,oCAAyC,OAAO,CAAA,GAC3F;AACA;AAAA,EACF;AACA,SAAO,IAAI,KAAK,CAAE;AACpB,GAaa,IAAA,CAAe,MAAsE;AAEhG,MAAI,GAAK,YAAY,EAA0B,eAAgB;AAE/D,QAAM,IAAS,GAAK;AACpB,MAAI,CAAC,EAAQ;AAEb,QAAM,IAAS,EAAS,EAAO,MAAM;AACrC,MAAI,MAAW,QAAW;AAGxB,IAAI,OAAO,KAAK,CAAM,EAAE,SAAS,KAC/B,EACE,GACA,mFACF;AAEF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAA;AAAA,IACA,WAAW,EAAO,EAAO,YAAY,cAAc,CAAM;AAAA,IACzD,SAAS,EAAO,EAAO,UAAU,YAAY,CAAM;AAAA,IACnD,OAAO,EAAQ,EAAO,KAAK;AAAA,EAC7B;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 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.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\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,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,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,OAA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;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,4 +1,6 @@
1
1
  import { RepeatingTransaction } from '../../../core/types/RepeatingTransaction';
2
2
  import { RecurringCopy } from '../../../core/types/localization/RecurringCopy';
3
- /** Frequency word from `recurrence_type` (e.g. "Yearly"); unknown or unmapped → undefined. */
3
+ /** Frequency word from a stored `recurrence_type` (e.g. "Yearly"); unknown or unmapped → undefined. */
4
+ export declare const frequencyWord: (copy: RecurringCopy | undefined, type: number | undefined) => string | undefined;
5
+ /** Frequency word for a live repeating transaction. */
4
6
  export declare const subscriptionFrequency: (copy: RecurringCopy | undefined, repeating: RepeatingTransaction | undefined) => string | undefined;
@@ -1,11 +1,12 @@
1
1
  import { RECURRENCE_COPY as n } from "../../../common/constants/ScheduledPayment.es.js";
2
- var p = (r, t) => {
3
- const e = t?.recurrence_type, o = e ? n.find(({ id: i }) => i === e)?.copy : void 0;
2
+ var c = (r, e) => {
3
+ const o = e ? n.find(({ id: i }) => i === e)?.copy : void 0;
4
4
  if (!(!r || !o))
5
5
  return r[o] || void 0;
6
- };
6
+ }, u = (r, e) => c(r, e?.recurrence_type);
7
7
  export {
8
- p as subscriptionFrequency
8
+ c as frequencyWord,
9
+ u as subscriptionFrequency
9
10
  };
10
11
 
11
12
  //# sourceMappingURL=subscriptionFrequency.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptionFrequency.es.js","names":[],"sources":["../../../../src/insights-v2/components/SubscriptionStatus/subscriptionFrequency.ts"],"sourcesContent":["import { RECURRENCE_COPY } from '../../../common/constants'\nimport type { RepeatingTransaction } from '../../../core/types/RepeatingTransaction'\nimport type { RecurringCopy } from '../../../core/types/localization/RecurringCopy'\n\n/** Frequency word from `recurrence_type` (e.g. \"Yearly\"); unknown or unmapped → undefined. */\nexport const subscriptionFrequency = (\n copy: RecurringCopy | undefined,\n repeating: RepeatingTransaction | undefined,\n): string | undefined => {\n const type: number | undefined = repeating?.recurrence_type\n // Same numbers as `Frequency`; 0 (unknown) has no word.\n const key = type ? RECURRENCE_COPY.find(({ id }) => id === type)?.copy : undefined\n\n if (!copy || !key) return undefined\n\n return copy[key as keyof RecurringCopy] || undefined\n}\n"],"mappings":";AAKA,IAAa,IAAA,CACX,GACA,MACuB;AACvB,QAAM,IAA2B,GAAW,iBAEtC,IAAM,IAAO,EAAgB,KAAA,CAAM,EAAE,IAAA,EAAA,MAAS,MAAO,CAAI,GAAG,OAAO;AAEzE,MAAI,GAAC,KAAQ,CAAC;AAEd,WAAO,EAAK,CAAA,KAA+B;AAC7C"}
1
+ {"version":3,"file":"subscriptionFrequency.es.js","names":[],"sources":["../../../../src/insights-v2/components/SubscriptionStatus/subscriptionFrequency.ts"],"sourcesContent":["import { RECURRENCE_COPY } from '../../../common/constants'\nimport type { RepeatingTransaction } from '../../../core/types/RepeatingTransaction'\nimport type { RecurringCopy } from '../../../core/types/localization/RecurringCopy'\n\n/** Frequency word from a stored `recurrence_type` (e.g. \"Yearly\"); unknown or unmapped → undefined. */\nexport const frequencyWord = (\n copy: RecurringCopy | undefined,\n type: number | undefined,\n): string | undefined => {\n // Same numbers as `Frequency`; 0 (unknown) has no word.\n const key = type ? RECURRENCE_COPY.find(({ id }) => id === type)?.copy : undefined\n\n if (!copy || !key) return undefined\n\n return copy[key as keyof RecurringCopy] || undefined\n}\n\n/** Frequency word for a live repeating transaction. */\nexport const subscriptionFrequency = (\n copy: RecurringCopy | undefined,\n repeating: RepeatingTransaction | undefined,\n): string | undefined => frequencyWord(copy, repeating?.recurrence_type)\n"],"mappings":";AAKA,IAAa,IAAA,CACX,GACA,MACuB;AAEvB,QAAM,IAAM,IAAO,EAAgB,KAAA,CAAM,EAAE,IAAA,EAAA,MAAS,MAAO,CAAI,GAAG,OAAO;AAEzE,MAAI,GAAC,KAAQ,CAAC;AAEd,WAAO,EAAK,CAAA,KAA+B;AAC7C,GAGa,IAAA,CACX,GACA,MACuB,EAAc,GAAM,GAAW,eAAe"}
@@ -0,0 +1,2 @@
1
+ import { TipSectionIcon } from '../../insights/components/shared/ChartDrawerTemplate/TipSection';
2
+ export declare const DRAWER_TIP_ICON: TipSectionIcon;
@@ -0,0 +1,10 @@
1
+ var a = {
2
+ color: "primary",
3
+ name: "tips_and_updates",
4
+ size: 20
5
+ };
6
+ export {
7
+ a as DRAWER_TIP_ICON
8
+ };
9
+
10
+ //# sourceMappingURL=drawerTip.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawerTip.es.js","names":[],"sources":["../../../src/insights-v2/components/drawerTip.ts"],"sourcesContent":["import type { TipSectionIcon } from '../../insights/components/shared/ChartDrawerTemplate/TipSection'\n\n// Every Figma drawer tip draws this icon; the shared TipSection keeps its lightbulb for V1 insights.\nexport const DRAWER_TIP_ICON: TipSectionIcon = {\n color: 'primary',\n name: 'tips_and_updates',\n size: 20,\n}\n"],"mappings":"AAGA,IAAa,IAAkC;AAAA,EAC7C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR"}
@@ -11,6 +11,8 @@ export interface TransactionListProps {
11
11
  isRowDisabled?: (t: Transaction) => boolean;
12
12
  loader?: React.JSX.Element;
13
13
  onClick?: (guid: string) => void;
14
+ /** A caption under each row's amount (see TransactionRow); omitted, the amount stands alone. */
15
+ renderAmountCaption?: (transaction: Transaction) => React.ReactNode;
14
16
  /** Replaces each row's category subline (see TransactionRow); omitted, rows show the category. */
15
17
  renderSecondaryText?: (transaction: Transaction) => React.ReactNode;
16
18
  /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */
@@ -1,64 +1,64 @@
1
- import { useEvent as te, useGlobalCopyStore as oe, useTransactionStore as ne } from "../../../common/context/hooks.es.js";
2
- import { fromUnixUTCToDayOfWeekAndDate as re } from "../../../core/utils/DateUtil.es.js";
3
- import { VISUALLY_HIDDEN_SX as se } from "../../../common/constants/Styles.es.js";
4
- import { ANALYTICS_EVENTS as ie } from "../../../common/constants/Analytics.es.js";
5
- import ae from "../../../common/components/Loader.es.js";
6
- import ce from "../../../common/components/ZeroState.es.js";
7
- import { useTransactionsUiStore as le } from "../../context/hooks.es.js";
8
- import ue from "./transactionlist/TransactionRow.es.js";
9
- import de from "../../../common/components/SubheaderRow.es.js";
10
- import { hasInsetBorder as fe, shouldShowDate as D } from "../../utils/Transactions.es.js";
1
+ import { useEvent as oe, useGlobalCopyStore as ne, useTransactionStore as re } from "../../../common/context/hooks.es.js";
2
+ import { fromUnixUTCToDayOfWeekAndDate as se } from "../../../core/utils/DateUtil.es.js";
3
+ import { VISUALLY_HIDDEN_SX as ie } from "../../../common/constants/Styles.es.js";
4
+ import { ANALYTICS_EVENTS as ae } from "../../../common/constants/Analytics.es.js";
5
+ import ce from "../../../common/components/Loader.es.js";
6
+ import le from "../../../common/components/ZeroState.es.js";
7
+ import { useTransactionsUiStore as ue } from "../../context/hooks.es.js";
8
+ import de from "./transactionlist/TransactionRow.es.js";
9
+ import fe from "../../../common/components/SubheaderRow.es.js";
10
+ import { hasInsetBorder as me, shouldShowDate as D } from "../../utils/Transactions.es.js";
11
11
  import o from "react";
12
- import { observer as me } from "mobx-react-lite";
13
- import { Fragment as pe, jsx as s, jsxs as b } from "react/jsx-runtime";
12
+ import { observer as pe } from "mobx-react-lite";
13
+ import { Fragment as ge, jsx as s, jsxs as b } from "react/jsx-runtime";
14
14
  import u from "@mui/material/Box";
15
- import ge from "@mui/material/Divider";
16
- import he from "@mui/material/List";
17
- import { useVirtualizer as xe } from "@tanstack/react-virtual";
18
- var z = 65, y = 32, Se = (g) => {
15
+ import he from "@mui/material/Divider";
16
+ import xe from "@mui/material/List";
17
+ import { useVirtualizer as Se } from "@tanstack/react-virtual";
18
+ var z = 65, y = 32, ve = (g) => {
19
19
  for (let r = g?.parentElement; r; r = r.parentElement) if (/(auto|scroll)/.test(getComputedStyle(r).overflowY)) return r;
20
20
  return null;
21
- }, ve = ({ bgcolor: g, filter: r, height: N = "calc(100dvh - 36px)", isRowDisabled: O, loader: B = /* @__PURE__ */ s(ae, {
21
+ }, Te = ({ bgcolor: g, filter: r, height: N = "calc(100dvh - 36px)", isRowDisabled: O, loader: B = /* @__PURE__ */ s(ce, {
22
22
  label: "Loading",
23
23
  size: 40
24
- }), onClick: E, renderSecondaryText: k, scrollsWithParent: a = !1, showInsights: I = !1, showLoader: U = !1, showUnviewedIndicator: V = !1, stickyHeader: h, transaction: _, width: x = "100%", zeroState: $ = /* @__PURE__ */ s(ce, {}) }) => {
25
- const { isLoading: F, sortedTransactions: S } = ne(), n = o.useMemo(() => {
24
+ }), onClick: E, renderAmountCaption: k, renderSecondaryText: U, scrollsWithParent: a = !1, showInsights: I = !1, showLoader: V = !1, showUnviewedIndicator: $ = !1, stickyHeader: h, transaction: _, width: x = "100%", zeroState: F = /* @__PURE__ */ s(le, {}) }) => {
25
+ const { isLoading: M, sortedTransactions: S } = re(), n = o.useMemo(() => {
26
26
  const e = r ? S.filter(r) : S;
27
27
  return _ ?? e;
28
28
  }, [
29
29
  S,
30
30
  r,
31
31
  _
32
- ]), { clearExpandedSplits: M, setShowInsights: Y, toggleSplit: G } = le(), { onEvent: j } = te(), { common: q } = oe(), [d, C] = o.useState(null), K = (e) => {
32
+ ]), { clearExpandedSplits: Y, setShowInsights: G, toggleSplit: j } = ue(), { onEvent: q } = oe(), { common: K } = ne(), [d, C] = o.useState(null), X = (e) => {
33
33
  const t = n.find((i) => i.guid === e);
34
34
  if (t?.has_been_split) {
35
- G(t.guid);
35
+ j(t.guid);
36
36
  return;
37
37
  }
38
- j(ie.ACCOUNT_DETAILS_CLICK_TRANSACTION, {
38
+ q(ae.ACCOUNT_DETAILS_CLICK_TRANSACTION, {
39
39
  account_guid: t?.account_guid,
40
40
  transaction_guid: e
41
41
  }), E?.(e);
42
- }, f = o.useRef(null), X = !!h, [R, Z] = o.useState(null), [L, J] = o.useState(0), m = o.useRef(null), [w, P] = o.useState(0);
42
+ }, f = o.useRef(null), Z = !!h, [R, J] = o.useState(null), [L, P] = o.useState(0), m = o.useRef(null), [w, Q] = o.useState(0);
43
43
  o.useLayoutEffect(() => {
44
44
  if (!a) return;
45
45
  const e = f.current;
46
46
  if (!e) return;
47
- const t = Se(e) ?? e, i = () => {
48
- J(e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop), P(m.current?.offsetHeight ?? 0);
47
+ const t = ve(e) ?? e, i = () => {
48
+ P(e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop), Q(m.current?.offsetHeight ?? 0);
49
49
  };
50
- Z(t), i();
50
+ J(t), i();
51
51
  const l = new ResizeObserver(i);
52
52
  return l.observe(t.firstElementChild ?? t), m.current && l.observe(m.current), () => l.disconnect();
53
- }, [a, X]);
54
- const p = xe({
53
+ }, [a, Z]);
54
+ const p = Se({
55
55
  count: n.length,
56
56
  getScrollElement: () => a ? R : f.current,
57
57
  estimateSize: (e) => z + (D(e, n) ? y : 0),
58
58
  overscan: 5,
59
59
  scrollMargin: L,
60
60
  scrollPaddingStart: w
61
- }), v = p.getVirtualItems(), c = v.at(-1)?.index ?? -1, H = n.length - (c + 1), T = !F && !U, A = T && v.length > 0, Q = p.getTotalSize() || "auto", W = () => {
61
+ }), v = p.getVirtualItems(), c = v.at(-1)?.index ?? -1, H = n.length - (c + 1), T = !M && !V, A = T && v.length > 0, W = p.getTotalSize() || "auto", ee = () => {
62
62
  const e = c + 1;
63
63
  p.scrollToIndex(e, { align: "start" }), C({
64
64
  index: e,
@@ -69,7 +69,7 @@ var z = 65, y = 32, Se = (g) => {
69
69
  if (!d) return;
70
70
  const e = f.current?.querySelector(`[data-index="${d.index}"]`);
71
71
  e?.focus(), (e || c !== d.from) && C(null);
72
- }, [d, c]), o.useEffect(() => p.measure(), [n, R]), o.useEffect(() => Y(I), [I]), o.useEffect(() => () => M(), []), /* @__PURE__ */ b(pe, { children: [
72
+ }, [d, c]), o.useEffect(() => p.measure(), [n, R]), o.useEffect(() => G(I), [I]), o.useEffect(() => () => Y(), []), /* @__PURE__ */ b(ge, { children: [
73
73
  h && /* @__PURE__ */ s(u, {
74
74
  ref: m,
75
75
  sx: {
@@ -81,7 +81,7 @@ var z = 65, y = 32, Se = (g) => {
81
81
  },
82
82
  children: h
83
83
  }),
84
- /* @__PURE__ */ s(he, {
84
+ /* @__PURE__ */ s(xe, {
85
85
  component: "div",
86
86
  role: "list",
87
87
  sx: { width: x },
@@ -92,15 +92,15 @@ var z = 65, y = 32, Se = (g) => {
92
92
  role: "presentation",
93
93
  width: x,
94
94
  children: /* @__PURE__ */ b(u, {
95
- height: Q,
95
+ height: W,
96
96
  position: "relative",
97
97
  role: "presentation",
98
98
  width: "100%",
99
99
  children: [
100
100
  !T && B,
101
- T && n.length === 0 && $,
101
+ T && n.length === 0 && F,
102
102
  A && v.map((e) => {
103
- const t = n[e.index], i = D(e.index, n), l = fe(e.index, n), ee = z + (i ? y : 0);
103
+ const t = n[e.index], i = D(e.index, n), l = me(e.index, n), te = z + (i ? y : 0);
104
104
  return /* @__PURE__ */ b(u, {
105
105
  "aria-posinset": e.index + 1,
106
106
  "aria-setsize": n.length,
@@ -108,7 +108,7 @@ var z = 65, y = 32, Se = (g) => {
108
108
  role: "listitem",
109
109
  tabIndex: -1,
110
110
  sx: {
111
- height: ee,
111
+ height: te,
112
112
  position: "absolute",
113
113
  scrollMarginTop: w,
114
114
  transform: `translateY(${e.start - L}px)`,
@@ -116,19 +116,20 @@ var z = 65, y = 32, Se = (g) => {
116
116
  bgcolor: "background.paper"
117
117
  },
118
118
  children: [
119
- i && /* @__PURE__ */ s(de, {
119
+ i && /* @__PURE__ */ s(fe, {
120
120
  bgcolor: g,
121
- children: re(t.date)
121
+ children: se(t.date)
122
122
  }),
123
- /* @__PURE__ */ s(ue, {
123
+ /* @__PURE__ */ s(de, {
124
124
  component: "div",
125
125
  disabled: O?.(t),
126
- ...E && { onClick: K },
127
- renderSecondaryText: k,
128
- showUnviewedIndicator: V,
126
+ ...E && { onClick: X },
127
+ renderAmountCaption: k,
128
+ renderSecondaryText: U,
129
+ showUnviewedIndicator: $,
129
130
  transaction: t
130
131
  }),
131
- /* @__PURE__ */ s(ge, { sx: { ml: l ? 68 : 0 } })
132
+ /* @__PURE__ */ s(he, { sx: { ml: l ? 68 : 0 } })
132
133
  ]
133
134
  }, t.guid);
134
135
  })
@@ -138,16 +139,16 @@ var z = 65, y = 32, Se = (g) => {
138
139
  }),
139
140
  A && H > 0 && /* @__PURE__ */ s(u, {
140
141
  component: "button",
141
- onClick: W,
142
- sx: se,
142
+ onClick: ee,
143
+ sx: ie,
143
144
  tabIndex: -1,
144
145
  type: "button",
145
- children: `${q.view_more} (${H})`
146
+ children: `${K.view_more} (${H})`
146
147
  })
147
148
  ] });
148
- }, ke = me(ve);
149
+ }, Ue = pe(Te);
149
150
  export {
150
- ke as default
151
+ Ue as default
151
152
  };
152
153
 
153
154
  //# sourceMappingURL=TransactionList.es.js.map