@mx-cartographer/experiences 9.7.59 → 9.7.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [9.7.60] - 10-28-2026
2
+
3
+ - **CHANGED** - Simplified the Insights 2.0 Transaction List summary drawer (WEC-2138, follow-up to MEW2-3379): dropped the `useMemo` around `readSummary` in `TransactionListBlock` (now a plain call). The pill count comes from the CTA's `drilldown_data.count` (pluralized via `buildPluralCopy`), falling back to the named guid count; `transaction_count` / `transaction_count_one` stay optional with an English default until the localized-content service ships them. The summary card is now **Replenish Savings only** and its tile shows the `savings` icon
4
+ - **FIXED** - Weekly New Merchants (MEW2-3379) no longer opens the Replenish Savings summary card: its "View Transactions" CTA now opens the Transaction List drawer as a plain date-grouped list (CTA variant `standard`, not `summary_header`)
5
+
1
6
  ## [9.7.59] - 10-28-2026
2
7
 
3
8
  - **ADDED** - Deposit banner deep-link support (MEW-3904): `Banner` handles `deep_link_type` `DIRECT_DEPOSIT` (1) alongside `CONNECT`, rendering an in-app button that records the click and posts a new `atomicTransact` host message for the host to open the deposit flow. Adds `ACTIONABLE_INTEGRATION_TYPE` / `ACTIONABLE_INTEGRATION_SOURCES`; inert until longbow surfaces `deep_link_type` (MEW-3904)
@@ -1,52 +1,47 @@
1
- import { useGlobalCopyStore as w, useInsightsV2Store as S, useTransactionStore as D } from "../../../common/context/hooks.es.js";
2
- import k from "../../../common/components/drawer/Drawer.es.js";
3
- import B from "../../../transactions/components/shared/TransactionList.es.js";
4
- import { selectTransactionsByGuids as L } from "../../CommonUtils.es.js";
5
- import { getDynamicCtaBasedOnTriggers as O } from "../util.es.js";
6
- import { TransactionDetailsBlock as x } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
7
- import { readSummary as A } from "./layout.es.js";
8
- import { TransactionListSummaryCard as j } from "./TransactionListSummaryCard.es.js";
9
- import g from "react";
10
- import { observer as G } from "mobx-react-lite";
11
- import { Fragment as F, jsx as a, jsxs as I } from "react/jsx-runtime";
12
- var R = (o) => Array.isArray(o) && o.every((t) => typeof t == "string"), $ = (o) => {
1
+ import { useGlobalCopyStore as S, useInsightsV2Store as D, useTransactionStore as k } from "../../../common/context/hooks.es.js";
2
+ import B from "../../../common/components/drawer/Drawer.es.js";
3
+ import L from "../../../transactions/components/shared/TransactionList.es.js";
4
+ import { selectTransactionsByGuids as O } from "../../CommonUtils.es.js";
5
+ import { getDynamicCtaBasedOnTriggers as x } from "../util.es.js";
6
+ import { TransactionDetailsBlock as A } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
7
+ import { readSummary as j } from "./layout.es.js";
8
+ import { TransactionListSummaryCard as G } from "./TransactionListSummaryCard.es.js";
9
+ import F from "react";
10
+ import { observer as I } from "mobx-react-lite";
11
+ import { Fragment as R, jsx as a, jsxs as $ } from "react/jsx-runtime";
12
+ var b = (o) => Array.isArray(o) && o.every((t) => typeof t == "string"), z = (o) => {
13
13
  const t = o.insights_payload?.drilldown_data, i = o.insights_payload?.instance_slot_data ?? {}, [n, s] = t && Object.hasOwn(t, "transaction_guids") ? ["drilldown_data", t.transaction_guids] : ["instance_slot_data", i.transaction_guids];
14
14
  if (s != null) {
15
- if (R(s)) return s;
15
+ if (b(s)) return s;
16
16
  console.warn(`[TransactionListBlock] ${n}.transaction_guids is not a list of guids — listing no transactions.`);
17
17
  }
18
- }, Q = G(function({ beat: t }) {
19
- const { common: i, insights_feed: n } = w(), { actionDrawer: s, setActionContext: c } = S(), _ = D(), [p, l] = g.useState(!1), r = $(t), f = L(_.detailedTransactions, r), { primary_cta: d, secondary_cta: m, in_description_cta: u, is_zero_state: y } = t.insights_payload ?? {}, e = g.useMemo(() => A(O(s, d, m, u)), [
20
- s,
21
- d,
22
- m,
23
- u
24
- ]), h = e !== void 0 && !y && (r?.length ?? 0) > 0, C = (v) => {
25
- c({ transaction_guid: v }), l(!0);
26
- }, T = () => {
18
+ }, W = I(function({ beat: t }) {
19
+ const { common: i, insights_feed: n } = S(), { actionDrawer: s, setActionContext: c } = D(), d = k(), [m, l] = F.useState(!1), r = z(t), u = O(d.detailedTransactions, r), { primary_cta: g, secondary_cta: _, in_description_cta: p, is_zero_state: f } = t.insights_payload ?? {}, y = x(s, g, _, p), e = j(y), h = e?.count ?? r?.length ?? 0, C = e !== void 0 && !f && (r?.length ?? 0) > 0, T = (w) => {
20
+ c({ transaction_guid: w }), l(!0);
21
+ }, v = () => {
27
22
  l(!1), c({ transaction_guid: void 0 });
28
23
  };
29
- return /* @__PURE__ */ I(F, { children: [
30
- h && /* @__PURE__ */ a(j, {
24
+ return /* @__PURE__ */ $(R, { children: [
25
+ C && /* @__PURE__ */ a(G, {
31
26
  copy: n.general,
32
- count: e.count ?? r?.length ?? 0,
27
+ count: h,
33
28
  summary: e
34
29
  }),
35
- /* @__PURE__ */ a(B, {
36
- onClick: C,
37
- transaction: f
30
+ /* @__PURE__ */ a(L, {
31
+ onClick: T,
32
+ transaction: u
38
33
  }),
39
- /* @__PURE__ */ a(k, {
34
+ /* @__PURE__ */ a(B, {
40
35
  ariaLabelClose: i.close_aria,
41
- isOpen: p,
42
- onClose: T,
36
+ isOpen: m,
37
+ onClose: v,
43
38
  title: n.general.transaction_details_title,
44
- children: /* @__PURE__ */ a(x, { beat: t })
39
+ children: /* @__PURE__ */ a(A, { beat: t })
45
40
  })
46
41
  ] });
47
42
  });
48
43
  export {
49
- Q as TransactionListBlock
44
+ W as TransactionListBlock
50
45
  };
51
46
 
52
47
  //# sourceMappingURL=TransactionListBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { readSummary } from './layout'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists. V2 envelopes send them on `drilldown_data`, V1 on\n * `instance_slot_data`, which is read only when the V2 key is absent. The payload is untrusted, so\n * a present but malformed list fails closed (no rows, and a warning) rather than showing the other\n * source's rows; a non-array would otherwise reach new Set() inside selectTransactionsByGuids and\n * match per-character.\n */\nconst resolveTransactionGuids = (beat: Beat): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n\n const guids = resolveTransactionGuids(beat)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n\n // Summary figures live on the clicked CTA's `drilldown_data`, so resolve which CTA opened this\n // drawer. `readSummary` fails closed (no finite `amount` -> undefined), so a plain list renders no\n // card; it is memoized so a bad payload warns once per opening, not per render. A zero-state\n // envelope, or one naming no transactions, has no figures to head.\n const { primary_cta, secondary_cta, in_description_cta, is_zero_state } =\n beat.insights_payload ?? {}\n const summary = React.useMemo(\n () =>\n readSummary(\n getDynamicCtaBasedOnTriggers(actionDrawer, primary_cta, secondary_cta, in_description_cta),\n ),\n [actionDrawer, primary_cta, secondary_cta, in_description_cta],\n )\n const showSummary = summary !== undefined && !is_zero_state && (guids?.length ?? 0) > 0\n\n const handleRowClick = (guid: string) => {\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard\n copy={insightsCopy.general}\n // Prefer the payload count, else the beat's guid list length (stable), avoiding a\n // \"0 transactions\" flash before the store resolves the rows.\n count={summary.count ?? guids?.length ?? 0}\n summary={summary}\n />\n )}\n <TransactionList onClick={handleRowClick} transaction={transactions} />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;AAmBA,IAAM,IAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,IAAA,CAA2B,MAAqC;AACpE,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,G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EH,gBAAA,EAAC,GAAD;AAAA,MAAiB,SAAS;AAAA,MAAgB,aAAa;AAAA,IAAe,CAAA;AAAA,IACtE,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,EAAa,QAAQ;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,IAChC,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { readSummary } from './layout'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists. V2 envelopes send them on `drilldown_data`, V1 on\n * `instance_slot_data`, which is read only when the V2 key is absent. The payload is untrusted, so\n * a present but malformed list fails closed (no rows, and a warning) rather than showing the other\n * source's rows; a non-array would otherwise reach new Set() inside selectTransactionsByGuids and\n * match per-character.\n */\nconst resolveTransactionGuids = (beat: Beat): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n\n const guids = resolveTransactionGuids(beat)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n\n // Summary figures live on the clicked CTA's `drilldown_data`, so resolve which CTA opened this\n // drawer. `readSummary` fails closed (no finite `amount` -> undefined), so a plain list renders no\n // card. A zero-state envelope, or one naming no transactions, has no figures to head.\n const { primary_cta, secondary_cta, in_description_cta, is_zero_state } =\n beat.insights_payload ?? {}\n const currentCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n const showSummary = summary !== undefined && !is_zero_state && (guids?.length ?? 0) > 0\n\n const handleRowClick = (guid: string) => {\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n <TransactionList onClick={handleRowClick} transaction={transactions} />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;AAmBA,IAAM,IAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,IAAA,CAA2B,MAAqC;AACpE,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAa,OAAO,OAAO,GAAW,mBAAmB,IACrD,CAAC,kBAAkB,EAAU,iBAAiB,IAC9C,CAAC,sBAAsB,EAAS,iBAAiB;AAEvD,MAAI,KAAS,MACb;AAAA,QAAI,EAAc,CAAK,EAAG,QAAO;AAEjC,YAAQ,KACN,0BAA0B,CAAA,sEAC5B;AAAA;AAEF,GAYa,IAAuB,EAAS,SAA8B,EACzE,MAAA,EAAA,GAC4B;AAC5B,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAiB,EAAmB,GACzE,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,EAAmB,GACxD,IAAmB,EAAoB,GAEvC,CAAC,GAAe,CAAA,IAAoB,EAAM,SAAS,EAAK,GAExD,IAAQ,EAAwB,CAAI,GACpC,IAAe,EAA0B,EAAiB,sBAAsB,CAAK,GAKrF,EAAE,aAAA,GAAa,eAAA,GAAe,oBAAA,GAAoB,eAAA,EAAA,IACtD,EAAK,oBAAoB,CAAC,GACtB,IAAa,EACjB,GACA,GACA,GACA,CACF,GACM,IAAU,EAAY,CAAU,GAGhC,IAAQ,GAAS,SAAS,GAAO,UAAU,GAC3C,IAAc,MAAY,UAAa,CAAC,MAAkB,GAAO,UAAU,KAAK,GAEhF,IAAA,CAAkB,MAAiB;AACvC,IAAA,EAAiB,EAAE,kBAAkB,EAAK,CAAC,GAC3C,EAAiB,EAAI;AAAA,EACvB,GAEM,IAAA,MAA2B;AAC/B,IAAA,EAAiB,EAAK,GAItB,EAAiB,EAAE,kBAAkB,OAAU,CAAC;AAAA,EAClD;AAEA,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA;AAAA,IACG,KACC,gBAAA,EAAC,GAAD;AAAA,MAA4B,MAAM,EAAa;AAAA,MAAgB,OAAA;AAAA,MAAgB,SAAA;AAAA,IAAU,CAAA;AAAA,IAE3F,gBAAA,EAAC,GAAD;AAAA,MAAiB,SAAS;AAAA,MAAgB,aAAa;AAAA,IAAe,CAAA;AAAA,IACtE,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,EAAa,QAAQ;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,IAChC,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
@@ -2,8 +2,9 @@ import { InsightsFeedCopy } from '../../../core/types/localization';
2
2
  import { TransactionListSummary } from './layout';
3
3
  export interface TransactionListSummaryCardProps {
4
4
  summary: TransactionListSummary;
5
- /** Rendered in the pill; the block passes the resolved row count. */
5
+ /** Pill count: the CTA's `drilldown_data.count`, else the number of guids the beat names. */
6
6
  count: number;
7
+ /** Only the two pill-copy keys the card reads. */
7
8
  copy: Pick<InsightsFeedCopy['general'], 'transaction_count' | 'transaction_count_one'>;
8
9
  }
9
10
  /**
@@ -11,8 +12,8 @@ export interface TransactionListSummaryCardProps {
11
12
  * range, the headline amount, and a `{count} transactions` pill. Driven by the beat's summary
12
13
  * figures (see `readSummary` in layout.ts). Theme-aware tokens keep it correct in dark mode.
13
14
  *
14
- * Figma: Drilldown | Replenish Savings ("Savings Withdrawal"). The card is shared by every beat on
15
- * the `summary_header` variant, so the tile carries a neutral receipt rather than that beat's icon.
15
+ * Figma: Drilldown | Replenish Savings ("Savings Withdrawal"). Currently only Replenish Savings
16
+ * declares the `summary_header` variant, so the tile carries its `savings` icon.
16
17
  */
17
18
  export declare const TransactionListSummaryCard: ({ summary, count, copy, }: TransactionListSummaryCardProps) => import("react/jsx-runtime").JSX.Element;
18
19
  export default TransactionListSummaryCard;
@@ -2,21 +2,21 @@ import { buildPluralCopy as d } from "../../../core/utils/Localization.es.js";
2
2
  import { DATE_FORMATS_INTL as s, formatDate as f } from "../../../core/constants/DateFormats.es.js";
3
3
  import { formatCurrency as x } from "../../../core/utils/NumberFormatting.es.js";
4
4
  import { getLogoElevation as h } from "../../components/logoShadow.es.js";
5
- import e from "@mui/material/Stack";
6
- import { Text as n } from "@mxenabled/mxui";
5
+ import n from "@mui/material/Stack";
6
+ import { Text as e } from "@mxenabled/mxui";
7
7
  import { Icon as u } from "@mxenabled/mx-icons";
8
8
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
9
9
  import { alpha as l } from "@mui/material/styles";
10
10
  import c from "@mui/material/Box";
11
- var g = "_1{count} transactions", _ = "_1{count} transaction", b = (o, a) => [o, a].filter((t) => t !== void 0).map((t) => f(t, s.MONTH_DAY)).join(" – "), L = ({ summary: o, count: a, copy: t }) => {
12
- const m = b(o.startDate, o.endDate);
11
+ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t, a].filter((o) => o !== void 0).map((o) => f(o, s.MONTH_DAY)).join(" – "), L = ({ summary: t, count: a, copy: o }) => {
12
+ const m = b(t.startDate, t.endDate);
13
13
  return /* @__PURE__ */ r(c, {
14
14
  sx: {
15
15
  px: 24,
16
16
  pt: 24,
17
17
  pb: 12
18
18
  },
19
- children: /* @__PURE__ */ p(e, {
19
+ children: /* @__PURE__ */ p(n, {
20
20
  sx: {
21
21
  bgcolor: "background.paper",
22
22
  borderRadius: "8px",
@@ -24,7 +24,7 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (o, a) => [o,
24
24
  gap: 11,
25
25
  p: 16
26
26
  },
27
- children: [/* @__PURE__ */ p(e, {
27
+ children: [/* @__PURE__ */ p(n, {
28
28
  sx: {
29
29
  alignItems: "center",
30
30
  flexDirection: "row",
@@ -44,18 +44,18 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (o, a) => [o,
44
44
  children: /* @__PURE__ */ r(u, {
45
45
  "aria-hidden": !0,
46
46
  fill: !0,
47
- name: "receipt",
47
+ name: "savings",
48
48
  size: 32
49
49
  })
50
- }), /* @__PURE__ */ p(e, { children: [m && /* @__PURE__ */ r(n, {
50
+ }), /* @__PURE__ */ p(n, { children: [m && /* @__PURE__ */ r(e, {
51
51
  color: "text.secondary",
52
52
  variant: "caption",
53
53
  children: m
54
- }), /* @__PURE__ */ r(n, {
54
+ }), /* @__PURE__ */ r(e, {
55
55
  bold: !0,
56
56
  component: "p",
57
57
  variant: "h1",
58
- children: x(o.amount, "0,0.00")
58
+ children: x(t.amount, "0,0.00")
59
59
  })] })]
60
60
  }), /* @__PURE__ */ r(c, {
61
61
  sx: {
@@ -64,10 +64,10 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (o, a) => [o,
64
64
  px: 12,
65
65
  py: 2
66
66
  },
67
- children: /* @__PURE__ */ r(n, {
67
+ children: /* @__PURE__ */ r(e, {
68
68
  color: "primary.dark",
69
69
  variant: "caption",
70
- children: d(t.transaction_count_one ?? _, t.transaction_count ?? g, a, String(a))
70
+ children: d(o.transaction_count_one ?? _, o.transaction_count ?? g, a, String(a))
71
71
  })
72
72
  })]
73
73
  })
@@ -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 { 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 { buildPluralCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nimport type { TransactionListSummary } from './layout'\n\nexport interface TransactionListSummaryCardProps {\n summary: TransactionListSummary\n /** Rendered in the pill; the block passes the resolved row count. */\n count: number\n copy: Pick<InsightsFeedCopy['general'], 'transaction_count' | 'transaction_count_one'>\n}\n\n// Until the localized-content service ships the pill copy.\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\"). The card is shared by every beat on\n * the `summary_header` variant, so the tile carries a neutral receipt rather than that beat's 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 <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=\"receipt\" size={32} />\n </Box>\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, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n\n <Box\n sx={{\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\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\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,IAAqB,0BACrB,IAAyB,yBAGzB,IAAA,CAAe,GAAc,MACjC,CAAC,GAAO,CAAG,EACR,OAAA,CAAQ,MAAiB,MAAM,MAAS,EACxC,IAAA,CAAK,MAAM,EAAW,GAAG,EAAkB,SAAS,CAAC,EACrD,KAAK,KAAK,GAUF,IAAA,CAA8B,EACzC,SAAA,GACA,OAAA,GACA,MAAA,EAAA,MACqC;AACrC,QAAM,IAAY,EAAY,EAAQ,WAAW,EAAQ,OAAO;AAEhE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE,IAAI;AAAA,MAAI,IAAI;AAAA,MAAI,IAAI;AAAA,IAAG;AAAA,IAChC,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,SAAS;AAAA,QACT,cAAc;AAAA,QACd,WAAW;AAAA,QACX,KAAK;AAAA,QACL,GAAG;AAAA,MACL;AAAA,MAPF,UAAA,CASE,gBAAA,EAA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 {"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 { 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 { buildPluralCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\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 <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=\"savings\" size={32} />\n </Box>\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, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n\n <Box\n sx={{\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\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\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,IAAqB,0BACrB,IAAyB,yBAGzB,IAAA,CAAe,GAAc,MACjC,CAAC,GAAO,CAAG,EACR,OAAA,CAAQ,MAAiB,MAAM,MAAS,EACxC,IAAA,CAAK,MAAM,EAAW,GAAG,EAAkB,SAAS,CAAC,EACrD,KAAK,KAAK,GAUF,IAAA,CAA8B,EACzC,SAAA,GACA,OAAA,GACA,MAAA,EAAA,MACqC;AACrC,QAAM,IAAY,EAAY,EAAQ,WAAW,EAAQ,OAAO;AAEhE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE,IAAI;AAAA,MAAI,IAAI;AAAA,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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"}
@@ -3,9 +3,9 @@ type DrilldownCta = PrimaryCTA | SecondaryCTA | InDescriptionCTA;
3
3
  /** The CTA variant that opens the summary-header drilldown. */
4
4
  export declare const SUMMARY_HEADER_VARIANT = "summary_header";
5
5
  /**
6
- * Drawer title: the beat's own localized title, whatever the variant. A variant names a layout the
7
- * drawer shares between beats (Replenish Savings' "Savings Withdrawal" and Weekly New Merchants'
8
- * "Purchases for review" both open `summary_header`), so no variant carries one beat's title.
6
+ * Drawer title: the beat's own localized title, whatever the variant. The drawer is shared across
7
+ * beats (Replenish Savings' "Savings Withdrawal" summary-header drawer, Weekly New Merchants' plain
8
+ * "Purchases for review" list), so the title comes from the beat, not the variant.
9
9
  */
10
10
  export declare const getTransactionListDrawerTitle: (_variant: string | null | undefined, _copy: GlobalCopy, beat?: Beat) => string;
11
11
  export interface TransactionListSummary {
@@ -15,7 +15,7 @@ export interface TransactionListSummary {
15
15
  * missing or unparseable (so the drawer never crashes on an Invalid Date). */
16
16
  startDate?: Date;
17
17
  endDate?: Date;
18
- /** Transaction count for the pill; the block falls back to the resolved rows' length. */
18
+ /** Number of transactions for the pill, from the CTA's `drilldown_data.count`. */
19
19
  count?: number;
20
20
  }
21
21
  /**
@@ -27,7 +27,7 @@ export interface TransactionListSummary {
27
27
  * `formatDate` (which throws on an Invalid Date).
28
28
  *
29
29
  * `drilldown_data` fields: `amount` (number), `start_date`/`end_date` (unix seconds|ms or ISO),
30
- * `count` (number).
30
+ * `count` (number of transactions).
31
31
  */
32
32
  export declare const readSummary: (cta: DrilldownCta | undefined) => TransactionListSummary | undefined;
33
33
  export {};
@@ -1,37 +1,39 @@
1
- import { parseISO as i } from "date-fns/parseISO";
2
- var _ = "summary_header", c = (t, e, r) => r?.insights_payload?.title || "", a = (t) => typeof t == "number" && Number.isFinite(t) ? t : void 0, s = Date.UTC(2e3, 0, 1), d = Date.UTC(2100, 0, 1), m = (t) => typeof t == "number" && Number.isInteger(t) && t >= 0 ? t : void 0, o = (t, e) => {
1
+ import { parseISO as s } from "date-fns/parseISO";
2
+ var c = "summary_header", p = (t, r, e) => e?.insights_payload?.title || "", m = (t) => typeof t == "number" && Number.isFinite(t) ? t : void 0, f = (t) => typeof t == "number" && Number.isInteger(t) && t > 0 ? t : void 0, _ = Date.UTC(2e3, 0, 1), u = Date.UTC(2100, 0, 1), i = /* @__PURE__ */ new WeakSet(), d = (t, r) => {
3
+ i.has(t) || (i.add(t), console.warn(r));
4
+ }, o = (t, r, e) => {
3
5
  if (t == null || t === "") return;
4
- let r;
5
- if (typeof t == "number" && Number.isFinite(t)) r = t < 1e12 ? t * 1e3 : t;
6
+ let a;
7
+ if (typeof t == "number" && Number.isFinite(t)) a = t < 1e12 ? t * 1e3 : t;
6
8
  else if (typeof t == "string") {
7
- const n = i(t).getTime();
8
- r = Number.isNaN(n) ? void 0 : n;
9
+ const n = s(t).getTime();
10
+ a = Number.isNaN(n) ? void 0 : n;
9
11
  }
10
- if (r === void 0 || r < s || r > d) {
11
- console.warn(`[TransactionListBlock] drilldown_data.${e} is unparseable or out of range (${typeof t})`);
12
+ if (a === void 0 || a < _ || a > u) {
13
+ d(e, `[TransactionListBlock] drilldown_data.${r} is unparseable or out of range (${typeof t})`);
12
14
  return;
13
15
  }
14
- return new Date(r);
15
- }, u = (t) => {
16
+ return new Date(a);
17
+ }, b = (t) => {
16
18
  if (t?.variant !== "summary_header") return;
17
- const e = t?.drilldown_data;
18
- if (!e) return;
19
- const r = a(e.amount);
20
- if (r === void 0) {
21
- Object.keys(e).length > 0 && console.warn("[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.");
19
+ const r = t?.drilldown_data;
20
+ if (!r) return;
21
+ const e = m(r.amount);
22
+ if (e === void 0) {
23
+ Object.keys(r).length > 0 && d(r, "[TransactionListBlock] drilldown_data has no finite `amount` — no summary header.");
22
24
  return;
23
25
  }
24
26
  return {
25
- amount: r,
26
- startDate: o(e.start_date, "start_date"),
27
- endDate: o(e.end_date, "end_date"),
28
- count: m(e.count)
27
+ amount: e,
28
+ startDate: o(r.start_date, "start_date", r),
29
+ endDate: o(r.end_date, "end_date", r),
30
+ count: f(r.count)
29
31
  };
30
32
  };
31
33
  export {
32
- _ as SUMMARY_HEADER_VARIANT,
33
- c as getTransactionListDrawerTitle,
34
- u as readSummary
34
+ c as SUMMARY_HEADER_VARIANT,
35
+ p as getTransactionListDrawerTitle,
36
+ b as readSummary
35
37
  };
36
38
 
37
39
  //# 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 { Beat, GlobalCopy, InDescriptionCTA, PrimaryCTA, SecondaryCTA } from '../../../core'\n\ntype DrilldownCta = PrimaryCTA | SecondaryCTA | InDescriptionCTA\n\n/** The CTA variant that opens the summary-header drilldown. */\nexport const SUMMARY_HEADER_VARIANT = 'summary_header'\n\n/**\n * Drawer title: the beat's own localized title, whatever the variant. A variant names a layout the\n * drawer shares between beats (Replenish Savings' \"Savings Withdrawal\" and Weekly New Merchants'\n * \"Purchases for review\" both open `summary_header`), so no variant carries one beat's title.\n */\nexport const getTransactionListDrawerTitle = (\n _variant: string | null | undefined,\n _copy: GlobalCopy,\n beat?: Beat,\n): string => beat?.insights_payload?.title || ''\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 /** Transaction count for the pill; the block falls back to the resolved rows' length. */\n count?: number\n}\n\nconst toFiniteNumber = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isFinite(value) ? 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/**\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 toCount = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isInteger(value) && value >= 0 ? value : undefined\n\nconst toDate = (value: unknown, field: string): 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 console.warn(\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).\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 !== SUMMARY_HEADER_VARIANT) return undefined\n\n const source = cta?.drilldown_data\n if (!source) return undefined\n\n const amount = toFiniteNumber(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 console.warn(\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'),\n endDate: toDate(source.end_date, 'end_date'),\n count: toCount(source.count),\n }\n}\n"],"mappings":";AAOA,IAAa,IAAyB,kBAOzB,IAAA,CACX,GACA,GACA,MACW,GAAM,kBAAkB,SAAS,IAaxC,IAAA,CAAkB,MACtB,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ,QAG1D,IAAY,KAAK,IAAI,KAAM,GAAG,CAAC,GAC/B,IAAY,KAAK,IAAI,MAAM,GAAG,CAAC,GAQ/B,IAAA,CAAW,MACf,OAAO,KAAU,YAAY,OAAO,UAAU,CAAK,KAAK,KAAS,IAAI,IAAQ,QAEzE,IAAA,CAAU,GAAgB,MAAoC;AAElE,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,YAAQ,KACN,yCAAyC,CAAA,oCAAyC,OAAO,CAAA,GAC3F;AACA;AAAA,EACF;AACA,SAAO,IAAI,KAAK,CAAE;AACpB,GAaa,IAAA,CAAe,MAAsE;AAEhG,MAAI,GAAK,YAAA,iBAAoC;AAE7C,QAAM,IAAS,GAAK;AACpB,MAAI,CAAC,EAAQ;AAEb,QAAM,IAAS,EAAe,EAAO,MAAM;AAC3C,MAAI,MAAW,QAAW;AAGxB,IAAI,OAAO,KAAK,CAAM,EAAE,SAAS,KAC/B,QAAQ,KACN,mFACF;AAEF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAA;AAAA,IACA,WAAW,EAAO,EAAO,YAAY,YAAY;AAAA,IACjD,SAAS,EAAO,EAAO,UAAU,UAAU;AAAA,IAC3C,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 { Beat, GlobalCopy, InDescriptionCTA, PrimaryCTA, SecondaryCTA } from '../../../core'\n\ntype DrilldownCta = PrimaryCTA | SecondaryCTA | InDescriptionCTA\n\n/** The CTA variant that opens the summary-header drilldown. */\nexport const SUMMARY_HEADER_VARIANT = 'summary_header'\n\n/**\n * Drawer title: the beat's own localized title, whatever the variant. The drawer is shared across\n * beats (Replenish Savings' \"Savings Withdrawal\" summary-header drawer, Weekly New Merchants' plain\n * \"Purchases for review\" list), so the title comes from the beat, not the variant.\n */\nexport const getTransactionListDrawerTitle = (\n _variant: string | null | undefined,\n _copy: GlobalCopy,\n beat?: Beat,\n): string => beat?.insights_payload?.title || ''\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\nconst toFiniteNumber = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined\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 !== SUMMARY_HEADER_VARIANT) return undefined\n\n const source = cta?.drilldown_data\n if (!source) return undefined\n\n const amount = toFiniteNumber(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":";AAOA,IAAa,IAAyB,kBAOzB,IAAA,CACX,GACA,GACA,MACW,GAAM,kBAAkB,SAAS,IAaxC,IAAA,CAAkB,MACtB,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ,QAI1D,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,YAAA,iBAAoC;AAE7C,QAAM,IAAS,GAAK;AACpB,MAAI,CAAC,EAAQ;AAEb,QAAM,IAAS,EAAe,EAAO,MAAM;AAC3C,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.59",
3
+ "version": "9.7.60",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",