@mx-cartographer/experiences 9.7.114 → 9.7.116

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 (18) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.d.ts +4 -3
  3. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +21 -20
  4. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
  5. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.d.ts +12 -0
  6. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.es.js +34 -0
  7. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.es.js.map +1 -0
  8. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +51 -46
  9. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +15 -13
  11. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  12. package/dist/transactions/components/shared/TransactionList.d.ts +2 -0
  13. package/dist/transactions/components/shared/TransactionList.es.js +47 -46
  14. package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
  15. package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +5 -0
  16. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +37 -37
  17. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
  18. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [9.7.116] - 11-06-2026
2
+
3
+ - **FIXED** - Replenish Savings' Savings Withdrawal drawer (`transaction_list_block` / `summary_header`): the `{count} transactions` pill is 20px high with its caption centered, as Figma (WEC-2240)
4
+ - **FIXED** - The same drawer's rows show the account's 16px institution logo and name under the headline instead of the category; every other transaction list keeps the category (WEC-2240)
5
+
6
+ ## [9.7.115] - 11-06-2026
7
+
8
+ - **CHANGED** - Insights 2.0 drawers read their data from the CTA that opened them: the Transaction List drawer lists the clicked CTA's `drilldown_data.transaction_guids`, and Transaction Details opens the clicked CTA's `drilldown_data.transaction_guid`, before falling back to the card-level `drilldown_data` / `primary_transaction_guid`, so existing beats are unchanged (Peer-To-Peer Categorization V2, WEC-2238)
9
+
1
10
  ## [9.7.114] - 11-06-2026
2
11
 
3
12
  - **FIXED** - The Weekly New Merchants "Others" row icon tile has the 4px corner radius of the row's other logo tiles (was 8px)
@@ -11,11 +11,12 @@ interface TransactionDetailsBlockState {
11
11
  /**
12
12
  * Resolves which transaction this drawer is about, and which inline actions it offers.
13
13
  *
14
- * The subject comes from one of two places:
14
+ * The subject comes from the first of:
15
15
  * 1. `actionContext.transaction_guid` — set by a parent drawer (e.g. a row tapped in
16
16
  * `TransactionHistoryBlock`) when this drawer is opened nested.
17
- * 2. `insights_payload.primary_transaction_guid` — the ditto contract for every beat whose
18
- * `primary_cta_block` is `transaction_details_block`.
17
+ * 2. the clicked CTA's `drilldown_data.transaction_guid` — each drawer's data rides on the CTA
18
+ * that opens it (ditto's `primary_cta.drilldown_data`).
19
+ * 3. `insights_payload.primary_transaction_guid` — for beats whose CTA carries no drilldown guid.
19
20
  *
20
21
  * The guid is then looked up in `transactionStore.detailedTransactions` rather than used directly,
21
22
  * because `TransactionDetails` needs the *detailed* shape (account + category + taggings joined in)
@@ -1,33 +1,34 @@
1
- import { useActionContext as _, useGlobalStore as y, useInsightsV2Store as h, useTransactionStore as v } from "../../../common/context/hooks.es.js";
2
- import { getBottomActionsByVariant as A } from "./util.es.js";
3
- import { resolveTopActions as T } from "./transactionDetailsActions.es.js";
4
- import e from "react";
5
- var E = (r) => {
6
- const { detailedTransactions: d, isTransactionDataLoaded: u, transactions: p } = v(), { emitUpdate: a } = y(), { actionDrawer: g } = h(), { transaction_guid: m } = _() ?? {}, i = r.insights_payload, t = m ?? i?.primary_transaction_guid, f = t ? d.find((n) => n.guid === t) : void 0, c = t ? p.find((n) => n.guid === t) : void 0, o = c ? JSON.stringify(c) : void 0, s = e.useRef({
1
+ import { useActionContext as v, useGlobalStore as h, useInsightsV2Store as T, useTransactionStore as A } from "../../../common/context/hooks.es.js";
2
+ import { getDynamicCtaBasedOnTriggers as B } from "../util.es.js";
3
+ import { getBottomActionsByVariant as D } from "./util.es.js";
4
+ import { resolveTopActions as S } from "./transactionDetailsActions.es.js";
5
+ import u from "react";
6
+ var L = (a) => {
7
+ const { detailedTransactions: g, isTransactionDataLoaded: p, transactions: m } = A(), { emitUpdate: r } = h(), { actionDrawer: c } = T(), { transaction_guid: _ } = v() ?? {}, o = a.insights_payload, e = B(c, o?.primary_cta, o?.secondary_cta, o?.in_description_cta)?.drilldown_data, f = typeof e?.transaction_guid == "string" ? e.transaction_guid : void 0, t = _ ?? f ?? o?.primary_transaction_guid, l = t ? g.find((n) => n.guid === t) : void 0, d = t ? m.find((n) => n.guid === t) : void 0, i = d ? JSON.stringify(d) : void 0, s = u.useRef({
7
8
  guid: t,
8
- snapshot: o
9
+ snapshot: i
9
10
  });
10
- return e.useEffect(() => {
11
- if (!o) return;
12
- const n = s.current.guid === t && s.current.snapshot !== void 0, l = s.current.snapshot !== o;
11
+ return u.useEffect(() => {
12
+ if (!i) return;
13
+ const n = s.current.guid === t && s.current.snapshot !== void 0, y = s.current.snapshot !== i;
13
14
  s.current = {
14
15
  guid: t,
15
- snapshot: o
16
- }, n && l && a({ staleBeatGuid: r.guid });
16
+ snapshot: i
17
+ }, n && y && r({ staleBeatGuid: a.guid });
17
18
  }, [
18
19
  t,
19
- o,
20
- r.guid,
21
- a
20
+ i,
21
+ a.guid,
22
+ r
22
23
  ]), {
23
- bottomActions: A(g, i?.primary_cta, i?.secondary_cta, i?.in_description_cta),
24
- isLoading: !u,
25
- topActions: T(),
26
- transaction: f
24
+ bottomActions: D(c, o?.primary_cta, o?.secondary_cta, o?.in_description_cta),
25
+ isLoading: !p,
26
+ topActions: S(),
27
+ transaction: l
27
28
  };
28
29
  };
29
30
  export {
30
- E as useTransactionDetailsBlock
31
+ L as useTransactionDetailsBlock
31
32
  };
32
33
 
33
34
  //# sourceMappingURL=useTransactionDetailsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.ts"],"sourcesContent":["import React from 'react'\n\nimport {\n useActionContext,\n useGlobalStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction, DrilldownPayload } from '../../../core'\nimport type { BottomActions, TopActions } from '../../../transactions/constants/Actions'\nimport { getBottomActionsByVariant } from './util'\nimport { resolveTopActions } from './transactionDetailsActions'\n\ninterface TransactionDetailsBlockState {\n bottomActions: BottomActions[]\n /** True while the store is still loading; the block shows a loader instead of an empty state. */\n isLoading: boolean\n topActions: TopActions[]\n /** `undefined` once loading finishes means the transaction could not be resolved. */\n transaction?: Transaction\n}\n\n/**\n * Resolves which transaction this drawer is about, and which inline actions it offers.\n *\n * The subject comes from one of two places:\n * 1. `actionContext.transaction_guid` — set by a parent drawer (e.g. a row tapped in\n * `TransactionHistoryBlock`) when this drawer is opened nested.\n * 2. `insights_payload.primary_transaction_guid` — the ditto contract for every beat whose\n * `primary_cta_block` is `transaction_details_block`.\n *\n * The guid is then looked up in `transactionStore.detailedTransactions` rather than used directly,\n * because `TransactionDetails` needs the *detailed* shape (account + category + taggings joined in)\n * and edits must write through to the same store object the rest of the app renders. `buildDetailed\n * Transactions` inside the store is this repo's equivalent of pulse's `buildTransactionDetails`.\n * A guid the store does not have resolves to `undefined` (the block's error state) rather than to\n * any beat-level snapshot, so inline edits can never be made against a stale copy.\n *\n * An edit made here (category, date, memo...) replaces the transaction in the store. The beat's card\n * is built from live data (a sampled beat's count), so the host is told the beat is stale, the same\n * signal a CTA's `refreshBeat` effect sends; pulse refetches the sample on it, as its legacy cards do\n * through `shouldUpdateOnTransactionChange`.\n *\n * Actions are not beat-configurable on the v2 contract: `instance_slot_data` is not part of it (the\n * LargeTransactionV2 payload omits the key entirely), so top actions are always the defaults and\n * bottom actions are derived from the triggering CTA's variant.\n */\nexport const useTransactionDetailsBlock = (beat: Beat): TransactionDetailsBlockState => {\n const { detailedTransactions, isTransactionDataLoaded, transactions } = useTransactionStore()\n const { emitUpdate } = useGlobalStore()\n\n const { actionDrawer } = useInsightsV2Store()\n\n const { transaction_guid } = useActionContext<DrilldownPayload>() ?? {}\n const payload = beat.insights_payload\n\n const guid = transaction_guid ?? payload?.primary_transaction_guid\n\n const transaction = guid\n ? detailedTransactions.find((transaction) => transaction.guid === guid)\n : undefined\n\n // Every store load swaps in new objects, so an edit is a change in the transaction's content, not\n // its identity. The snapshot is per guid: opening another transaction is not an edit of the last.\n const stored = guid ? transactions.find((transaction) => transaction.guid === guid) : undefined\n const snapshot = stored ? JSON.stringify(stored) : undefined\n const seen = React.useRef({ guid, snapshot })\n\n React.useEffect(() => {\n if (!snapshot) return\n\n const isEdit = seen.current.guid === guid && seen.current.snapshot !== undefined\n const changed = seen.current.snapshot !== snapshot\n seen.current = { guid, snapshot }\n if (isEdit && changed) emitUpdate({ staleBeatGuid: beat.guid })\n }, [guid, snapshot, beat.guid, emitUpdate])\n\n const bottomActions = getBottomActionsByVariant(\n actionDrawer,\n payload?.primary_cta,\n payload?.secondary_cta,\n payload?.in_description_cta,\n )\n return {\n bottomActions,\n isLoading: !isTransactionDataLoaded,\n topActions: resolveTopActions(),\n transaction,\n }\n}\n"],"mappings":";;;;AA+CA,IAAa,IAAA,CAA8B,MAA6C;AACtF,QAAM,EAAE,sBAAA,GAAsB,yBAAA,GAAyB,cAAA,EAAA,IAAiB,EAAoB,GACtF,EAAE,YAAA,EAAA,IAAe,EAAe,GAEhC,EAAE,cAAA,EAAA,IAAiB,EAAmB,GAEtC,EAAE,kBAAA,EAAA,IAAqB,EAAmC,KAAK,CAAC,GAChE,IAAU,EAAK,kBAEf,IAAO,KAAoB,GAAS,0BAEpC,IAAc,IAChB,EAAqB,KAAA,CAAM,MAAgB,EAAY,SAAS,CAAI,IACpE,QAIE,IAAS,IAAO,EAAa,KAAA,CAAM,MAAgB,EAAY,SAAS,CAAI,IAAI,QAChF,IAAW,IAAS,KAAK,UAAU,CAAM,IAAI,QAC7C,IAAO,EAAM,OAAO;AAAA,IAAE,MAAA;AAAA,IAAM,UAAA;AAAA,EAAS,CAAC;AAE5C,SAAA,EAAM,UAAA,MAAgB;AACpB,QAAI,CAAC,EAAU;AAEf,UAAM,IAAS,EAAK,QAAQ,SAAS,KAAQ,EAAK,QAAQ,aAAa,QACjE,IAAU,EAAK,QAAQ,aAAa;AAC1C,IAAA,EAAK,UAAU;AAAA,MAAE,MAAA;AAAA,MAAM,UAAA;AAAA,IAAS,GAC5B,KAAU,KAAS,EAAW,EAAE,eAAe,EAAK,KAAK,CAAC;AAAA,EAChE,GAAG;AAAA,IAAC;AAAA,IAAM;AAAA,IAAU,EAAK;AAAA,IAAM;AAAA,EAAU,CAAC,GAQnC;AAAA,IACL,eAPoB,EACpB,GACA,GAAS,aACT,GAAS,eACT,GAAS,kBAGT;AAAA,IACA,WAAW,CAAC;AAAA,IACZ,YAAY,EAAkB;AAAA,IAC9B,aAAA;AAAA,EACF;AACF"}
1
+ {"version":3,"file":"useTransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.ts"],"sourcesContent":["import React from 'react'\n\nimport {\n useActionContext,\n useGlobalStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction, DrilldownPayload } from '../../../core'\nimport type { BottomActions, TopActions } from '../../../transactions/constants/Actions'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { getBottomActionsByVariant } from './util'\nimport { resolveTopActions } from './transactionDetailsActions'\n\ninterface TransactionDetailsBlockState {\n bottomActions: BottomActions[]\n /** True while the store is still loading; the block shows a loader instead of an empty state. */\n isLoading: boolean\n topActions: TopActions[]\n /** `undefined` once loading finishes means the transaction could not be resolved. */\n transaction?: Transaction\n}\n\n/**\n * Resolves which transaction this drawer is about, and which inline actions it offers.\n *\n * The subject comes from the first of:\n * 1. `actionContext.transaction_guid` — set by a parent drawer (e.g. a row tapped in\n * `TransactionHistoryBlock`) when this drawer is opened nested.\n * 2. the clicked CTA's `drilldown_data.transaction_guid` — each drawer's data rides on the CTA\n * that opens it (ditto's `primary_cta.drilldown_data`).\n * 3. `insights_payload.primary_transaction_guid` — for beats whose CTA carries no drilldown guid.\n *\n * The guid is then looked up in `transactionStore.detailedTransactions` rather than used directly,\n * because `TransactionDetails` needs the *detailed* shape (account + category + taggings joined in)\n * and edits must write through to the same store object the rest of the app renders. `buildDetailed\n * Transactions` inside the store is this repo's equivalent of pulse's `buildTransactionDetails`.\n * A guid the store does not have resolves to `undefined` (the block's error state) rather than to\n * any beat-level snapshot, so inline edits can never be made against a stale copy.\n *\n * An edit made here (category, date, memo...) replaces the transaction in the store. The beat's card\n * is built from live data (a sampled beat's count), so the host is told the beat is stale, the same\n * signal a CTA's `refreshBeat` effect sends; pulse refetches the sample on it, as its legacy cards do\n * through `shouldUpdateOnTransactionChange`.\n *\n * Actions are not beat-configurable on the v2 contract: `instance_slot_data` is not part of it (the\n * LargeTransactionV2 payload omits the key entirely), so top actions are always the defaults and\n * bottom actions are derived from the triggering CTA's variant.\n */\nexport const useTransactionDetailsBlock = (beat: Beat): TransactionDetailsBlockState => {\n const { detailedTransactions, isTransactionDataLoaded, transactions } = useTransactionStore()\n const { emitUpdate } = useGlobalStore()\n\n const { actionDrawer } = useInsightsV2Store()\n\n const { transaction_guid } = useActionContext<DrilldownPayload>() ?? {}\n const payload = beat.insights_payload\n\n const ctaDrilldown = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload?.primary_cta,\n payload?.secondary_cta,\n payload?.in_description_cta,\n )?.drilldown_data\n const ctaGuid =\n typeof ctaDrilldown?.transaction_guid === 'string' ? ctaDrilldown.transaction_guid : undefined\n\n const guid = transaction_guid ?? ctaGuid ?? payload?.primary_transaction_guid\n\n const transaction = guid\n ? detailedTransactions.find((transaction) => transaction.guid === guid)\n : undefined\n\n // Every store load swaps in new objects, so an edit is a change in the transaction's content, not\n // its identity. The snapshot is per guid: opening another transaction is not an edit of the last.\n const stored = guid ? transactions.find((transaction) => transaction.guid === guid) : undefined\n const snapshot = stored ? JSON.stringify(stored) : undefined\n const seen = React.useRef({ guid, snapshot })\n\n React.useEffect(() => {\n if (!snapshot) return\n\n const isEdit = seen.current.guid === guid && seen.current.snapshot !== undefined\n const changed = seen.current.snapshot !== snapshot\n seen.current = { guid, snapshot }\n if (isEdit && changed) emitUpdate({ staleBeatGuid: beat.guid })\n }, [guid, snapshot, beat.guid, emitUpdate])\n\n const bottomActions = getBottomActionsByVariant(\n actionDrawer,\n payload?.primary_cta,\n payload?.secondary_cta,\n payload?.in_description_cta,\n )\n return {\n bottomActions,\n isLoading: !isTransactionDataLoaded,\n topActions: resolveTopActions(),\n transaction,\n }\n}\n"],"mappings":";;;;;AAiDA,IAAa,IAAA,CAA8B,MAA6C;AACtF,QAAM,EAAE,sBAAA,GAAsB,yBAAA,GAAyB,cAAA,EAAA,IAAiB,EAAoB,GACtF,EAAE,YAAA,EAAA,IAAe,EAAe,GAEhC,EAAE,cAAA,EAAA,IAAiB,EAAmB,GAEtC,EAAE,kBAAA,EAAA,IAAqB,EAAmC,KAAK,CAAC,GAChE,IAAU,EAAK,kBAEf,IAAe,EACnB,GACA,GAAS,aACT,GAAS,eACT,GAAS,kBACX,GAAG,gBACG,IACJ,OAAO,GAAc,oBAAqB,WAAW,EAAa,mBAAmB,QAEjF,IAAO,KAAoB,KAAW,GAAS,0BAE/C,IAAc,IAChB,EAAqB,KAAA,CAAM,MAAgB,EAAY,SAAS,CAAI,IACpE,QAIE,IAAS,IAAO,EAAa,KAAA,CAAM,MAAgB,EAAY,SAAS,CAAI,IAAI,QAChF,IAAW,IAAS,KAAK,UAAU,CAAM,IAAI,QAC7C,IAAO,EAAM,OAAO;AAAA,IAAE,MAAA;AAAA,IAAM,UAAA;AAAA,EAAS,CAAC;AAE5C,SAAA,EAAM,UAAA,MAAgB;AACpB,QAAI,CAAC,EAAU;AAEf,UAAM,IAAS,EAAK,QAAQ,SAAS,KAAQ,EAAK,QAAQ,aAAa,QACjE,IAAU,EAAK,QAAQ,aAAa;AAC1C,IAAA,EAAK,UAAU;AAAA,MAAE,MAAA;AAAA,MAAM,UAAA;AAAA,IAAS,GAC5B,KAAU,KAAS,EAAW,EAAE,eAAe,EAAK,KAAK,CAAC;AAAA,EAChE,GAAG;AAAA,IAAC;AAAA,IAAM;AAAA,IAAU,EAAK;AAAA,IAAM;AAAA,EAAU,CAAC,GAQnC;AAAA,IACL,eAPoB,EACpB,GACA,GAAS,aACT,GAAS,eACT,GAAS,kBAGT;AAAA,IACA,WAAW,CAAC;AAAA,IACZ,YAAY,EAAkB;AAAA,IAC9B,aAAA;AAAA,EACF;AACF"}
@@ -0,0 +1,12 @@
1
+ import { Transaction } from '../../../core';
2
+ export interface TransactionAccountSublineProps {
3
+ transaction: Transaction;
4
+ /** The account's institution guid (`INS-…`); omitted, the row shows the name alone. */
5
+ institutionGuid?: string | null;
6
+ }
7
+ /**
8
+ * A summary-header drawer row's subline (Figma: Drilldown | Replenish Savings): the account's 16px
9
+ * institution logo and its name in caption, 4px apart, instead of the category.
10
+ */
11
+ export declare const TransactionAccountSubline: ({ transaction, institutionGuid, }: TransactionAccountSublineProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default TransactionAccountSubline;
@@ -0,0 +1,34 @@
1
+ import r from "../../components/LogoFromGuid.es.js";
2
+ import i from "@mui/material/Stack";
3
+ import { Text as e } from "@mxenabled/mxui";
4
+ import { jsx as o, jsxs as n } from "react/jsx-runtime";
5
+ var u = ({ transaction: t, institutionGuid: a }) => /* @__PURE__ */ n(i, {
6
+ "data-testid": "transaction-account-subline",
7
+ sx: {
8
+ alignItems: "center",
9
+ flexDirection: "row",
10
+ gap: 4,
11
+ minWidth: 0
12
+ },
13
+ children: [a && /* @__PURE__ */ o(i, {
14
+ "data-testid": "transaction-account-logo",
15
+ sx: { flexShrink: 0 },
16
+ children: /* @__PURE__ */ o(r, {
17
+ logo: {
18
+ alt: t.institutionName ?? t.account,
19
+ guid: a
20
+ },
21
+ size: 16
22
+ })
23
+ }), /* @__PURE__ */ o(e, {
24
+ truncate: !0,
25
+ variant: "caption",
26
+ children: t.account
27
+ })]
28
+ });
29
+ export {
30
+ u as TransactionAccountSubline,
31
+ u as default
32
+ };
33
+
34
+ //# sourceMappingURL=TransactionAccountSubline.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionAccountSubline.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport type { Transaction } from '../../../core'\nimport LogoFromGuid from '../../components/LogoFromGuid'\n\nexport interface TransactionAccountSublineProps {\n transaction: Transaction\n /** The account's institution guid (`INS-…`); omitted, the row shows the name alone. */\n institutionGuid?: string | null\n}\n\n/**\n * A summary-header drawer row's subline (Figma: Drilldown | Replenish Savings): the account's 16px\n * institution logo and its name in caption, 4px apart, instead of the category.\n */\nexport const TransactionAccountSubline = ({\n transaction,\n institutionGuid,\n}: TransactionAccountSublineProps) => (\n <Stack\n data-testid=\"transaction-account-subline\"\n sx={{ alignItems: 'center', flexDirection: 'row', gap: 4, minWidth: 0 }}\n >\n {institutionGuid && (\n <Stack data-testid=\"transaction-account-logo\" sx={{ flexShrink: 0 }}>\n <LogoFromGuid\n logo={{ alt: transaction.institutionName ?? transaction.account, guid: institutionGuid }}\n size={16}\n />\n </Stack>\n )}\n <Text truncate={true} variant=\"caption\">\n {transaction.account}\n </Text>\n </Stack>\n)\n\nexport default TransactionAccountSubline\n"],"mappings":";;;;AAiBA,IAAa,IAAA,CAA6B,EACxC,aAAA,GACA,iBAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,eAAe;AAAA,IAAO,KAAK;AAAA,IAAG,UAAU;AAAA,EAAE;AAAA,EAFxE,UAAA,CAIG,KACC,gBAAA,EAAC,GAAD;AAAA,IAAO,eAAY;AAAA,IAA2B,IAAI,EAAE,YAAY,EAAE;AAAA,IAChE,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QAAE,KAAK,EAAY,mBAAmB,EAAY;AAAA,QAAS,MAAM;AAAA,MAAgB;AAAA,MACvF,MAAM;AAAA,IACP,CAAA;AAAA,EACI,CAAA,GAET,gBAAA,EAAC,GAAD;AAAA,IAAM,UAAU;AAAA,IAAM,SAAQ;AAAA,IAC3B,UAAA,EAAY;AAAA,EACT,CAAA,CACD"}
@@ -1,62 +1,67 @@
1
- import { useGlobalCopyStore as M, useInsightsV2Store as b, useTransactionStore as x } from "../../../common/context/hooks.es.js";
2
- import u from "../../../common/components/drawer/Drawer.es.js";
3
- import A from "../../../transactions/components/shared/TransactionList.es.js";
4
- import { selectTransactionsByGuids as j } from "../../CommonUtils.es.js";
5
- import { getDynamicCtaBasedOnTriggers as G } from "../util.es.js";
6
- import { TransactionDetailsBlock as I } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
7
- import { HelpBlock as F } from "../HelpBlock/HelpBlock.es.js";
8
- import { readHelpHeader as R, readSummary as $ } from "./layout.es.js";
9
- import { TransactionListHelpHeader as z } from "./TransactionListHelpHeader.es.js";
10
- import { TransactionListSummaryCard as V } from "./TransactionListSummaryCard.es.js";
11
- import _ from "react";
12
- import { observer as q } from "mobx-react-lite";
13
- import { Fragment as E, jsx as o, jsxs as J } from "react/jsx-runtime";
14
- var K = (a) => Array.isArray(a) && a.every((t) => typeof t == "string"), N = (a) => {
15
- const t = a.insights_payload?.drilldown_data, r = a.insights_payload?.instance_slot_data ?? {}, [i, n] = t && Object.hasOwn(t, "transaction_guids") ? ["drilldown_data", t.transaction_guids] : ["instance_slot_data", r.transaction_guids];
16
- if (n != null) {
17
- if (K(n)) return n;
18
- console.warn(`[TransactionListBlock] ${i}.transaction_guids is not a list of guids — listing no transactions.`);
1
+ import { useAccountStore as I, useGlobalCopyStore as R, useInsightsV2Store as x, useTransactionStore as j } from "../../../common/context/hooks.es.js";
2
+ import _ from "../../../common/components/drawer/Drawer.es.js";
3
+ import G from "../../../transactions/components/shared/TransactionList.es.js";
4
+ import { selectTransactionsByGuids as N } from "../../CommonUtils.es.js";
5
+ import { getDynamicCtaBasedOnTriggers as E } from "../util.es.js";
6
+ import { TransactionDetailsBlock as F } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
7
+ import { HelpBlock as V } from "../HelpBlock/HelpBlock.es.js";
8
+ import { TRANSACTION_LIST_VARIANTS as $, readHelpHeader as z, readSummary as U } from "./layout.es.js";
9
+ import { TransactionAccountSubline as Y } from "./TransactionAccountSubline.es.js";
10
+ import { TransactionListHelpHeader as q } from "./TransactionListHelpHeader.es.js";
11
+ import { TransactionListSummaryCard as J } from "./TransactionListSummaryCard.es.js";
12
+ import g from "react";
13
+ import { observer as K } from "mobx-react-lite";
14
+ import { Fragment as P, jsx as o, jsxs as Q } from "react/jsx-runtime";
15
+ var W = (n) => Array.isArray(n) && n.every((t) => typeof t == "string"), X = (n, t) => {
16
+ const a = n.insights_payload?.drilldown_data, i = n.insights_payload?.instance_slot_data ?? {}, [l, s] = t && Object.hasOwn(t, "transaction_guids") ? ["cta.drilldown_data", t.transaction_guids] : a && Object.hasOwn(a, "transaction_guids") ? ["drilldown_data", a.transaction_guids] : ["instance_slot_data", i.transaction_guids];
17
+ if (s != null) {
18
+ if (W(s)) return s;
19
+ console.warn(`[TransactionListBlock] ${l}.transaction_guids is not a list of guids — listing no transactions.`);
19
20
  }
20
- }, it = q(function({ beat: t }) {
21
- const { common: r, insights_feed: i } = M(), { actionDrawer: n, setActionContext: c } = b(), g = x(), [f, d] = _.useState(!1), [y, m] = _.useState(!1), e = N(t), h = j(g.detailedTransactions, e), { primary_cta: C, secondary_cta: T, in_description_cta: w, is_zero_state: H, drilldown_data: L, title: S } = t.insights_payload ?? {}, p = G(n, C, T, w), l = $(p), v = l?.count ?? e?.length ?? 0, O = l !== void 0 && !H && (e?.length ?? 0) > 0, s = R(p, L), D = (B) => {
22
- c({ transaction_guid: B }), d(!0);
23
- }, k = () => {
24
- d(!1), c({ transaction_guid: void 0 });
21
+ }, pt = K(function({ beat: t }) {
22
+ const { common: a, insights_feed: i } = R(), { actionDrawer: l, setActionContext: s } = x(), f = j(), y = I(), [S, u] = g.useState(!1), [T, p] = g.useState(!1), { primary_cta: h, secondary_cta: C, in_description_cta: A, is_zero_state: O, drilldown_data: v, title: w } = t.insights_payload ?? {}, e = E(l, h, C, A), d = X(t, e?.drilldown_data), H = N(f.detailedTransactions, d), m = U(e), L = m?.count ?? d?.length ?? 0, k = m !== void 0 && !O && (d?.length ?? 0) > 0, r = z(e, v), B = e?.variant === $.SUMMARY_HEADER ? (c) => /* @__PURE__ */ o(Y, {
23
+ institutionGuid: y.accounts.find(({ guid: b }) => b === c.account_guid)?.institution_guid,
24
+ transaction: c
25
+ }) : void 0, D = (c) => {
26
+ s({ transaction_guid: c }), u(!0);
27
+ }, M = () => {
28
+ u(!1), s({ transaction_guid: void 0 });
25
29
  };
26
- return /* @__PURE__ */ J(E, { children: [
27
- O && /* @__PURE__ */ o(V, {
30
+ return /* @__PURE__ */ Q(P, { children: [
31
+ k && /* @__PURE__ */ o(J, {
28
32
  copy: i.general,
29
- count: v,
30
- summary: l
33
+ count: L,
34
+ summary: m
31
35
  }),
32
- s && /* @__PURE__ */ o(z, {
33
- descriptionHtml: s.descriptionHtml,
34
- learnMoreLabel: s.learnMore?.label,
35
- onLearnMore: () => m(!0),
36
- title: S ?? ""
36
+ r && /* @__PURE__ */ o(q, {
37
+ descriptionHtml: r.descriptionHtml,
38
+ learnMoreLabel: r.learnMore?.label,
39
+ onLearnMore: () => p(!0),
40
+ title: w ?? ""
37
41
  }),
38
- /* @__PURE__ */ o(A, {
42
+ /* @__PURE__ */ o(G, {
39
43
  onClick: D,
40
- transaction: h
44
+ renderSecondaryText: B,
45
+ transaction: H
41
46
  }),
42
- s?.learnMore && /* @__PURE__ */ o(u, {
43
- ariaLabelClose: r.close_aria,
44
- isOpen: y,
45
- onClose: () => m(!1),
46
- title: s.learnMore.label,
47
- children: /* @__PURE__ */ o(F, { beat: t })
47
+ r?.learnMore && /* @__PURE__ */ o(_, {
48
+ ariaLabelClose: a.close_aria,
49
+ isOpen: T,
50
+ onClose: () => p(!1),
51
+ title: r.learnMore.label,
52
+ children: /* @__PURE__ */ o(V, { beat: t })
48
53
  }),
49
- /* @__PURE__ */ o(u, {
50
- ariaLabelClose: r.close_aria,
51
- isOpen: f,
52
- onClose: k,
54
+ /* @__PURE__ */ o(_, {
55
+ ariaLabelClose: a.close_aria,
56
+ isOpen: S,
57
+ onClose: M,
53
58
  title: i.general.transaction_details_title,
54
- children: /* @__PURE__ */ o(I, { beat: t })
59
+ children: /* @__PURE__ */ o(F, { beat: t })
55
60
  })
56
61
  ] });
57
62
  });
58
63
  export {
59
- it as TransactionListBlock
64
+ pt as TransactionListBlock
60
65
  };
61
66
 
62
67
  //# 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 { HelpBlock } from '../HelpBlock'\nimport { readHelpHeader, readSummary } from './layout'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\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 const [isHelpOpen, setIsHelpOpen] = 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, drilldown_data, title } =\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 const helpHeader = readHelpHeader(currentCta, drilldown_data)\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 {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList onClick={handleRowClick} transaction={transactions} />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\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":";;;;;;;;;;;;;AAqBA,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,KAAuB,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,GACxD,CAAC,GAAY,CAAA,IAAiB,EAAM,SAAS,EAAK,GAElD,IAAQ,EAAwB,CAAI,GACpC,IAAe,EAA0B,EAAiB,sBAAsB,CAAK,GAKrF,EAAE,aAAA,GAAa,eAAA,GAAe,oBAAA,GAAoB,eAAA,GAAe,gBAAA,GAAgB,OAAA,EAAA,IACrF,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,GAChF,IAAa,EAAe,GAAY,CAAc,GAEtD,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,IAE1F,KACC,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAiB,EAAW;AAAA,MAC5B,gBAAgB,EAAW,WAAW;AAAA,MACtC,aAAA,MAAmB,EAAc,EAAI;AAAA,MACrC,OAAO,KAAS;AAAA,IACjB,CAAA;AAAA,IAEH,gBAAA,EAAC,GAAD;AAAA,MAAiB,SAAS;AAAA,MAAgB,aAAa;AAAA,IAAe,CAAA;AAAA,IACrE,GAAY,aACX,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAA,MAAe,EAAc,EAAK;AAAA,MAClC,OAAO,EAAW,UAAU;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAAiB,MAAA,EAAO,CAAA;AAAA,IAClB,CAAA;AAAA,IAEV,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 useAccountStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction } 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 { HelpBlock } from '../HelpBlock'\nimport { readHelpHeader, readSummary, TRANSACTION_LIST_VARIANTS } from './layout'\nimport { TransactionAccountSubline } from './TransactionAccountSubline'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\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, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): 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 ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\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 const accountStore = useAccountStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so resolve\n // which CTA opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { primary_cta, secondary_cta, in_description_cta, is_zero_state, drilldown_data, title } =\n beat.insights_payload ?? {}\n const currentCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\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 const helpHeader = readHelpHeader(currentCta, drilldown_data)\n\n // Only the summary-header drawer (Replenish Savings' Savings Withdrawal) subtitles its rows with the\n // account's institution logo and name (Figma: Drilldown | Replenish Savings); every other list keeps\n // the category.\n const renderSecondaryText =\n currentCta?.variant === TRANSACTION_LIST_VARIANTS.SUMMARY_HEADER\n ? (transaction: Transaction) => (\n <TransactionAccountSubline\n institutionGuid={\n accountStore.accounts.find(({ guid }) => guid === transaction.account_guid)\n ?.institution_guid\n }\n transaction={transaction}\n />\n )\n : undefined\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 {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList\n onClick={handleRowClick}\n renderSecondaryText={renderSecondaryText}\n transaction={transactions}\n />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\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":";;;;;;;;;;;;;;AAuBA,IAAM,IAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,IAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAgB,OAAO,OAAO,GAAc,mBAAmB,IAC3D,CAAC,sBAAsB,EAAa,iBAAiB,IACrD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/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,IAE1F,KACC,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAiB,EAAW;AAAA,MAC5B,gBAAgB,EAAW,WAAW;AAAA,MACtC,aAAA,MAAmB,EAAc,EAAI;AAAA,MACrC,OAAO,KAAS;AAAA,IACjB,CAAA;AAAA,IAEH,gBAAA,EAAC,GAAD;AAAA,MACE,SAAS;AAAA,MACY,qBAAA;AAAA,MACrB,aAAa;AAAA,IACd,CAAA;AAAA,IACA,GAAY,aACX,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAA,MAAe,EAAc,EAAK;AAAA,MAClC,OAAO,EAAW,UAAU;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAAiB,MAAA,EAAO,CAAA;AAAA,IAClB,CAAA;AAAA,IAEV,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,15 +1,15 @@
1
1
  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
- import { getLogoElevation as h } from "../../components/logoShadow.es.js";
4
+ import { getLogoElevation as g } from "../../components/logoShadow.es.js";
5
5
  import n from "@mui/material/Stack";
6
6
  import { Text as e } from "@mxenabled/mxui";
7
- import { Icon as u } from "@mxenabled/mx-icons";
7
+ import { Icon as h } from "@mxenabled/mx-icons";
8
8
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
9
- import { alpha as l } from "@mui/material/styles";
9
+ import { alpha as m } from "@mui/material/styles";
10
10
  import c from "@mui/material/Box";
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);
11
+ var u = "_1{count} transactions", _ = "_1{count} transaction", b = (a, o) => [a, o].filter((t) => t !== void 0).map((t) => f(t, s.MONTH_DAY)).join(" – "), L = ({ summary: a, count: o, copy: t }) => {
12
+ const l = b(a.startDate, a.endDate);
13
13
  return /* @__PURE__ */ r(c, {
14
14
  sx: {
15
15
  px: 24,
@@ -20,7 +20,7 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t,
20
20
  sx: {
21
21
  bgcolor: "background.paper",
22
22
  borderRadius: "8px",
23
- boxShadow: h,
23
+ boxShadow: g,
24
24
  gap: 11,
25
25
  p: 16
26
26
  },
@@ -33,7 +33,7 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t,
33
33
  children: [/* @__PURE__ */ r(c, {
34
34
  sx: {
35
35
  alignItems: "center",
36
- bgcolor: (i) => l(i.palette.primary.main, 0.15),
36
+ bgcolor: (i) => m(i.palette.primary.main, 0.15),
37
37
  borderRadius: "4px",
38
38
  color: "primary.main",
39
39
  display: "flex",
@@ -41,33 +41,35 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t,
41
41
  justifyContent: "center",
42
42
  width: 56
43
43
  },
44
- children: /* @__PURE__ */ r(u, {
44
+ children: /* @__PURE__ */ r(h, {
45
45
  "aria-hidden": !0,
46
46
  fill: !0,
47
47
  name: "savings",
48
48
  size: 32
49
49
  })
50
- }), /* @__PURE__ */ p(n, { children: [m && /* @__PURE__ */ r(e, {
50
+ }), /* @__PURE__ */ p(n, { children: [l && /* @__PURE__ */ r(e, {
51
51
  color: "text.secondary",
52
52
  variant: "caption",
53
- children: m
53
+ children: l
54
54
  }), /* @__PURE__ */ r(e, {
55
55
  bold: !0,
56
56
  component: "p",
57
57
  variant: "h1",
58
- children: x(t.amount, "0,0.00")
58
+ children: x(a.amount, "0,0.00")
59
59
  })] })]
60
60
  }), /* @__PURE__ */ r(c, {
61
61
  sx: {
62
- bgcolor: (i) => l(i.palette.primary.main, 0.15),
62
+ alignItems: "center",
63
+ bgcolor: (i) => m(i.palette.primary.main, 0.15),
63
64
  borderRadius: "999px",
65
+ display: "flex",
64
66
  px: 12,
65
67
  py: 2
66
68
  },
67
69
  children: /* @__PURE__ */ r(e, {
68
70
  color: "primary.dark",
69
71
  variant: "caption",
70
- children: d(o.transaction_count_one ?? _, o.transaction_count ?? g, a, String(a))
72
+ children: d(t.transaction_count_one ?? _, t.transaction_count ?? u, o, String(o))
71
73
  })
72
74
  })]
73
75
  })
@@ -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 /** 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,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,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,YAAY;AAAA,UAAU,eAAe;AAAA,UAAO,KAAK;AAAA,QAAG;AAAA,QAAjE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,YAAY;AAAA,YACZ,SAAA,CAAU,MAAU,EAAM,EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,YAC1D,cAAc;AAAA,YACd,OAAO;AAAA,YACP,SAAS;AAAA,YACT,QAAQ;AAAA,YACR,gBAAgB;AAAA,YAChB,OAAO;AAAA,UACT;AAAA,UAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,YAAM,eAAa;AAAA,YAAM,MAAM;AAAA,YAAM,MAAK;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA;AAAA,QAC5D,CAAA,GACL,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,GAER,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,WAAU;AAAA,UAAI,SAAQ;AAAA,UACrC,UAAA,EAAe,EAAQ,QAAQ,QAAQ;AAAA,QACpC,CAAA,CACD,EAAA,CAAA,CACF;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,SAAA,CAAU,MAAU,EAAM,EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,UAC1D,cAAc;AAAA,UACd,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,SAAQ;AAAA,UAE/B,UAAA,EACE,EAAK,yBAAyB,GAC9B,EAAK,qBAAqB,GAC1B,GACA,OAAO,CAAK,CACd;AAAA,QAEE,CAAA;AAAA,MACH,CAAA,CACA;AAAA;EACJ,CAAA;AAET"}
1
+ {"version":3,"file":"TransactionListSummaryCard.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha } from '@mui/material/styles'\n\nimport { 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 {/* Figma Tag: a 20px pill. As a flex container the inline caption becomes a flex item, so its own\n 16px line box (not the pill's inherited line height) sets 2 + 16 + 2, centered. */}\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\n display: 'flex',\n px: 12,\n py: 2,\n }}\n >\n <Text color=\"primary.dark\" variant=\"caption\">\n {\n buildPluralCopy(\n copy.transaction_count_one ?? DEFAULT_COUNT_ONE_COPY,\n copy.transaction_count ?? DEFAULT_COUNT_COPY,\n count,\n String(count),\n ) as string\n }\n </Text>\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport default TransactionListSummaryCard\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,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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,CAAA;AAAA,MACH,CAAA,CACA;AAAA;EACJ,CAAA;AAET"}
@@ -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
+ /** Replaces each row's category subline (see TransactionRow); omitted, rows show the category. */
15
+ renderSecondaryText?: (transaction: Transaction) => React.ReactNode;
14
16
  /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */
15
17
  scrollsWithParent?: boolean;
16
18
  /** Rendered above the rows; stays at the top of the scroll area when used with scrollsWithParent. */
@@ -1,64 +1,64 @@
1
- import { useEvent as ee, useGlobalCopyStore as te, useTransactionStore as oe } from "../../../common/context/hooks.es.js";
2
- import { fromUnixUTCToDayOfWeekAndDate as ne } from "../../../core/utils/DateUtil.es.js";
3
- import { VISUALLY_HIDDEN_SX as re } from "../../../common/constants/Styles.es.js";
4
- import { ANALYTICS_EVENTS as se } from "../../../common/constants/Analytics.es.js";
5
- import ie from "../../../common/components/Loader.es.js";
6
- import ae from "../../../common/components/ZeroState.es.js";
7
- import { useTransactionsUiStore as ce } from "../../context/hooks.es.js";
8
- import le from "./transactionlist/TransactionRow.es.js";
9
- import ue from "../../../common/components/SubheaderRow.es.js";
10
- import { hasInsetBorder as de, shouldShowDate as D } from "../../utils/Transactions.es.js";
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";
11
11
  import o from "react";
12
- import { observer as fe } from "mobx-react-lite";
13
- import { Fragment as me, jsx as s, jsxs as b } from "react/jsx-runtime";
12
+ import { observer as me } from "mobx-react-lite";
13
+ import { Fragment as pe, jsx as s, jsxs as b } from "react/jsx-runtime";
14
14
  import u from "@mui/material/Box";
15
- import pe from "@mui/material/Divider";
16
- import ge from "@mui/material/List";
17
- import { useVirtualizer as he } from "@tanstack/react-virtual";
18
- var z = 65, y = 32, xe = (g) => {
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) => {
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
- }, Se = ({ bgcolor: g, filter: r, height: N = "calc(100dvh - 36px)", isRowDisabled: O, loader: B = /* @__PURE__ */ s(ie, {
21
+ }, ve = ({ bgcolor: g, filter: r, height: N = "calc(100dvh - 36px)", isRowDisabled: O, loader: B = /* @__PURE__ */ s(ae, {
22
22
  label: "Loading",
23
23
  size: 40
24
- }), onClick: E, scrollsWithParent: a = !1, showInsights: I = !1, showLoader: k = !1, showUnviewedIndicator: U = !1, stickyHeader: h, transaction: _, width: x = "100%", zeroState: V = /* @__PURE__ */ s(ae, {}) }) => {
25
- const { isLoading: $, sortedTransactions: S } = oe(), n = o.useMemo(() => {
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(() => {
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: F, setShowInsights: M, toggleSplit: Y } = ce(), { onEvent: G } = ee(), { common: j } = te(), [d, C] = o.useState(null), q = (e) => {
32
+ ]), { clearExpandedSplits: M, setShowInsights: Y, toggleSplit: G } = le(), { onEvent: j } = te(), { common: q } = oe(), [d, C] = o.useState(null), K = (e) => {
33
33
  const t = n.find((i) => i.guid === e);
34
34
  if (t?.has_been_split) {
35
- Y(t.guid);
35
+ G(t.guid);
36
36
  return;
37
37
  }
38
- G(se.ACCOUNT_DETAILS_CLICK_TRANSACTION, {
38
+ j(ie.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), K = !!h, [R, X] = o.useState(null), [L, Z] = o.useState(0), m = o.useRef(null), [w, J] = o.useState(0);
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);
43
43
  o.useLayoutEffect(() => {
44
44
  if (!a) return;
45
45
  const e = f.current;
46
46
  if (!e) return;
47
- const t = xe(e) ?? e, i = () => {
48
- Z(e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop), J(m.current?.offsetHeight ?? 0);
47
+ const t = Se(e) ?? e, i = () => {
48
+ J(e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop), P(m.current?.offsetHeight ?? 0);
49
49
  };
50
- X(t), i();
50
+ Z(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, K]);
54
- const p = he({
53
+ }, [a, X]);
54
+ const p = xe({
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 = !$ && !k, A = T && v.length > 0, P = p.getTotalSize() || "auto", Q = () => {
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 = () => {
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, xe = (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(() => M(I), [I]), o.useEffect(() => () => F(), []), /* @__PURE__ */ b(me, { children: [
72
+ }, [d, c]), o.useEffect(() => p.measure(), [n, R]), o.useEffect(() => Y(I), [I]), o.useEffect(() => () => M(), []), /* @__PURE__ */ b(pe, { children: [
73
73
  h && /* @__PURE__ */ s(u, {
74
74
  ref: m,
75
75
  sx: {
@@ -81,7 +81,7 @@ var z = 65, y = 32, xe = (g) => {
81
81
  },
82
82
  children: h
83
83
  }),
84
- /* @__PURE__ */ s(ge, {
84
+ /* @__PURE__ */ s(he, {
85
85
  component: "div",
86
86
  role: "list",
87
87
  sx: { width: x },
@@ -92,15 +92,15 @@ var z = 65, y = 32, xe = (g) => {
92
92
  role: "presentation",
93
93
  width: x,
94
94
  children: /* @__PURE__ */ b(u, {
95
- height: P,
95
+ height: Q,
96
96
  position: "relative",
97
97
  role: "presentation",
98
98
  width: "100%",
99
99
  children: [
100
100
  !T && B,
101
- T && n.length === 0 && V,
101
+ T && n.length === 0 && $,
102
102
  A && v.map((e) => {
103
- const t = n[e.index], i = D(e.index, n), l = de(e.index, n), W = z + (i ? y : 0);
103
+ const t = n[e.index], i = D(e.index, n), l = fe(e.index, n), ee = 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, xe = (g) => {
108
108
  role: "listitem",
109
109
  tabIndex: -1,
110
110
  sx: {
111
- height: W,
111
+ height: ee,
112
112
  position: "absolute",
113
113
  scrollMarginTop: w,
114
114
  transform: `translateY(${e.start - L}px)`,
@@ -116,18 +116,19 @@ var z = 65, y = 32, xe = (g) => {
116
116
  bgcolor: "background.paper"
117
117
  },
118
118
  children: [
119
- i && /* @__PURE__ */ s(ue, {
119
+ i && /* @__PURE__ */ s(de, {
120
120
  bgcolor: g,
121
- children: ne(t.date)
121
+ children: re(t.date)
122
122
  }),
123
- /* @__PURE__ */ s(le, {
123
+ /* @__PURE__ */ s(ue, {
124
124
  component: "div",
125
125
  disabled: O?.(t),
126
- ...E && { onClick: q },
127
- showUnviewedIndicator: U,
126
+ ...E && { onClick: K },
127
+ renderSecondaryText: k,
128
+ showUnviewedIndicator: V,
128
129
  transaction: t
129
130
  }),
130
- /* @__PURE__ */ s(pe, { sx: { ml: l ? 68 : 0 } })
131
+ /* @__PURE__ */ s(ge, { sx: { ml: l ? 68 : 0 } })
131
132
  ]
132
133
  }, t.guid);
133
134
  })
@@ -137,16 +138,16 @@ var z = 65, y = 32, xe = (g) => {
137
138
  }),
138
139
  A && H > 0 && /* @__PURE__ */ s(u, {
139
140
  component: "button",
140
- onClick: Q,
141
- sx: re,
141
+ onClick: W,
142
+ sx: se,
142
143
  tabIndex: -1,
143
144
  type: "button",
144
- children: `${j.view_more} (${H})`
145
+ children: `${q.view_more} (${H})`
145
146
  })
146
147
  ] });
147
- }, Be = fe(Se);
148
+ }, ke = me(ve);
148
149
  export {
149
- Be as default
150
+ ke as default
150
151
  };
151
152
 
152
153
  //# sourceMappingURL=TransactionList.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionList.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useEvent,\n useGlobalCopyStore,\n VISUALLY_HIDDEN_SX,\n ZeroState,\n} from '../../../common'\nimport { type Transaction } from '../../../core'\n\nimport { useTransactionsUiStore } from '../../context/hooks'\nimport { useTransactionStore } from '../../../common'\n\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport TransactionRow from './transactionlist/TransactionRow'\n\nimport { hasInsetBorder, shouldShowDate } from '../../utils/Transactions'\nimport { fromUnixUTCToDayOfWeekAndDate } from '../../../core/utils/DateUtil'\n\nconst ROW_HEIGHT = 65\nconst DATE_ROW_HEIGHT = 32\n\nconst findScrollParent = (node: HTMLElement | null): HTMLElement | null => {\n for (let el = node?.parentElement; el; el = el.parentElement) {\n if (/(auto|scroll)/.test(getComputedStyle(el).overflowY)) return el\n }\n return null\n}\n\nexport interface TransactionListProps {\n bgcolor?: string\n filter?: (t: Transaction) => boolean\n height?: number | string\n /**\n * Marks rows that stay in the list but cannot be acted on. Disabled rows are rendered greyed\n * out and inert instead of being removed, so list membership and ordering are unaffected.\n */\n isRowDisabled?: (t: Transaction) => boolean\n loader?: React.JSX.Element\n onClick?: (guid: string) => void\n /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */\n scrollsWithParent?: boolean\n /** Rendered above the rows; stays at the top of the scroll area when used with scrollsWithParent. */\n stickyHeader?: React.ReactNode\n showInsights?: boolean\n showLoader?: boolean\n showUnviewedIndicator?: boolean\n transaction?: Transaction[]\n width?: number | string\n zeroState?: React.JSX.Element\n}\n\nconst TransactionList: React.FC<TransactionListProps> = ({\n bgcolor,\n filter,\n height = 'calc(100dvh - 36px)',\n isRowDisabled,\n loader = <Loader label=\"Loading\" size={40} />,\n onClick,\n scrollsWithParent = false,\n showInsights = false,\n showLoader = false,\n showUnviewedIndicator = false,\n stickyHeader,\n transaction,\n width = '100%',\n zeroState = <ZeroState />,\n}) => {\n const { isLoading, sortedTransactions: allTransactions } = useTransactionStore()\n const transactions = React.useMemo(() => {\n const updatedTransactions = filter ? allTransactions.filter(filter) : allTransactions\n return transaction ?? updatedTransactions\n }, [allTransactions, filter, transaction])\n\n const { clearExpandedSplits, setShowInsights, toggleSplit } = useTransactionsUiStore()\n const { onEvent } = useEvent()\n const { common: commonCopy } = useGlobalCopyStore()\n const [pendingFocus, setPendingFocus] = React.useState<{ index: number; from: number } | null>(\n null,\n )\n\n const handleClick = (guid: string) => {\n const transaction = transactions.find((t) => t.guid === guid)\n\n if (transaction?.has_been_split) {\n toggleSplit(transaction.guid)\n return\n }\n\n onEvent(ANALYTICS_EVENTS.ACCOUNT_DETAILS_CLICK_TRANSACTION, {\n account_guid: transaction?.account_guid,\n transaction_guid: guid,\n })\n onClick?.(guid)\n }\n\n const parentRef = React.useRef<HTMLDivElement>(null)\n const hasStickyHeader = Boolean(stickyHeader)\n const [scrollParent, setScrollParent] = React.useState<HTMLElement | null>(null)\n const [scrollMargin, setScrollMargin] = React.useState(0)\n const headerRef = React.useRef<HTMLDivElement>(null)\n const [headerHeight, setHeaderHeight] = React.useState(0)\n\n React.useLayoutEffect(() => {\n if (!scrollsWithParent) return\n const list = parentRef.current\n if (!list) return\n // With no scrolling ancestor the list itself is the viewport, so every row renders.\n const scroller = findScrollParent(list) ?? list\n\n const measureOffset = () => {\n setScrollMargin(\n list.getBoundingClientRect().top -\n scroller.getBoundingClientRect().top +\n scroller.scrollTop,\n )\n setHeaderHeight(headerRef.current?.offsetHeight ?? 0)\n }\n\n setScrollParent(scroller)\n measureOffset()\n const observer = new ResizeObserver(measureOffset)\n observer.observe(scroller.firstElementChild ?? scroller)\n if (headerRef.current) observer.observe(headerRef.current)\n return () => observer.disconnect()\n }, [scrollsWithParent, hasStickyHeader])\n\n const rowVirtualizer = useVirtualizer({\n count: transactions.length,\n getScrollElement: () => (scrollsWithParent ? scrollParent : parentRef.current),\n estimateSize: (i) => ROW_HEIGHT + (shouldShowDate(i, transactions) ? DATE_ROW_HEIGHT : 0),\n overscan: 5,\n scrollMargin,\n scrollPaddingStart: headerHeight,\n })\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n const lastRenderedIndex = virtualItems.at(-1)?.index ?? -1\n const unrenderedCount = transactions.length - (lastRenderedIndex + 1)\n const isSettled = !isLoading && !showLoader\n const showRows = isSettled && virtualItems.length > 0\n // The total size comes from the row count, so a content-sized list has height before any row\n // is drawn. It is 0 only with no transactions, where the zero state needs 'auto'.\n const rowBoxHeight = rowVirtualizer.getTotalSize() || 'auto'\n\n // Screen reader reading modes do not scroll the list, so rows past the rendered window\n // are unreachable without this control.\n const showNextRows = () => {\n const nextIndex = lastRenderedIndex + 1\n rowVirtualizer.scrollToIndex(nextIndex, { align: 'start' })\n setPendingFocus({ index: nextIndex, from: lastRenderedIndex })\n }\n\n React.useEffect(() => {\n if (!pendingFocus) return\n const row = parentRef.current?.querySelector<HTMLElement>(\n `[data-index=\"${pendingFocus.index}\"]`,\n )\n row?.focus()\n // Give up once the window moves, so a missed row cannot take focus later.\n if (row || lastRenderedIndex !== pendingFocus.from) setPendingFocus(null)\n }, [pendingFocus, lastRenderedIndex])\n\n React.useEffect(() => rowVirtualizer.measure(), [transactions, scrollParent])\n React.useEffect(() => setShowInsights(showInsights), [showInsights])\n\n React.useEffect(() => {\n return () => clearExpandedSplits()\n }, [])\n\n return (\n <>\n {stickyHeader && (\n <Box\n ref={headerRef}\n sx={{\n bgcolor: 'background.paper',\n position: scrollsWithParent ? 'sticky' : undefined,\n top: 0,\n width,\n zIndex: 1,\n }}\n >\n {stickyHeader}\n </Box>\n )}\n <List component=\"div\" role=\"list\" sx={{ width: width }}>\n <Box\n height={scrollsWithParent ? undefined : height}\n overflow={scrollsWithParent ? undefined : 'auto'}\n ref={parentRef}\n role=\"presentation\"\n width={width}\n >\n <Box height={rowBoxHeight} position=\"relative\" role=\"presentation\" width=\"100%\">\n {!isSettled && loader}\n {isSettled && transactions.length === 0 && zeroState}\n {showRows &&\n virtualItems.map((row) => {\n const transaction = transactions[row.index]\n const showDate = shouldShowDate(row.index, transactions)\n const isInset = hasInsetBorder(row.index, transactions)\n const rowHeight = ROW_HEIGHT + (showDate ? DATE_ROW_HEIGHT : 0)\n\n return (\n <Box\n aria-posinset={row.index + 1}\n aria-setsize={transactions.length}\n data-index={row.index}\n key={transaction.guid}\n role=\"listitem\"\n tabIndex={-1}\n sx={{\n height: rowHeight,\n position: 'absolute',\n // Keeps a focused row from scrolling under the sticky header.\n scrollMarginTop: headerHeight,\n transform: `translateY(${row.start - scrollMargin}px)`,\n width: '100%',\n bgcolor: 'background.paper',\n }}\n >\n {showDate && (\n <SubheaderRow bgcolor={bgcolor}>\n {fromUnixUTCToDayOfWeekAndDate(transaction.date)}\n </SubheaderRow>\n )}\n <TransactionRow\n component=\"div\"\n disabled={isRowDisabled?.(transaction)}\n {...(onClick && { onClick: handleClick })}\n showUnviewedIndicator={showUnviewedIndicator}\n transaction={transaction}\n />\n <Divider sx={{ ml: isInset ? 68 : 0 }} />\n </Box>\n )\n })}\n </Box>\n </Box>\n </List>\n {showRows && unrenderedCount > 0 && (\n <Box\n component=\"button\"\n onClick={showNextRows}\n sx={VISUALLY_HIDDEN_SX}\n tabIndex={-1}\n type=\"button\"\n >\n {`${commonCopy.view_more} (${unrenderedCount})`}\n </Box>\n )}\n </>\n )\n}\n\nexport default observer(TransactionList)\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,IAAM,IAAa,IACb,IAAkB,IAElB,KAAA,CAAoB,MAAiD;AACzE,WAAS,IAAK,GAAM,eAAe,GAAI,IAAK,EAAG,cAC7C,KAAI,gBAAgB,KAAK,iBAAiB,CAAE,EAAE,SAAS,EAAG,QAAO;AAEnE,SAAO;AACT,GAyBM,KAAA,CAAmD,EACvD,SAAA,GACA,QAAA,GACA,QAAA,IAAS,uBACT,eAAA,GACA,QAAA,IAAS,gBAAA,EA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AAe,EAAI,QAAQ;AAAA,gBAC3B,gBAAc,EAAa;AAAA,gBAC3B,cAAY,EAAI;AAAA,gBAEhB,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,IAAI;AAAA,kBACF,QAAQ;AAAA,kBACR,UAAU;AAAA,kBAEV,iBAAiB;AAAA,kBACjB,WAAW,cAAc,EAAI,QAAQ,CAAA;AAAA,kBACrC,OAAO;AAAA,kBACP,SAAS;AAAA,gBACX;AAAA,gBAfF,UAAA;AAAA,kBAiBG,KACC,gBAAA,EAAC,IAAD;AAAA,oBAAuB,SAAA;AAAA,oBACpB,UAAA,GAA8B,EAAY,IAAI;AAAA,kBACnC,CAAA;AAAA,kBAEhB,gBAAA,EAAC,IAAD;AAAA,oBACE,WAAU;AAAA,oBACV,UAAU,IAAgB,CAAW;AAAA,oBACrC,GAAK,KAAW,EAAE,SAAS,EAAY;AAAA,oBAChB,uBAAA;AAAA,oBACV,aAAA;AAAA,kBACd,CAAA;AAAA,kBACD,gBAAA,EAAC,IAAD,EAAS,IAAI,EAAE,IAAI,IAAU,KAAK,EAAE,EAAI,CAAA;AAAA,gBACrC;AAAA,cA1BE,GAAA,EAAY,IA0Bd;AAAA,YAET,CAAC;AAAA,UACA;AAAA;MACF,CAAA;AAAA,IACD,CAAA;AAAA,IACL,KAAY,IAAkB,KAC7B,gBAAA,EAAC,GAAD;AAAA,MACE,WAAU;AAAA,MACV,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,MAAK;AAAA,MAEJ,UAAA,GAAG,EAAW,SAAA,KAAc,CAAA;AAAA,IAC1B,CAAA;AAAA,EAEP,EAAA,CAAA;AAEN,GAEA,KAAe,GAAS,EAAe"}
1
+ {"version":3,"file":"TransactionList.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useEvent,\n useGlobalCopyStore,\n VISUALLY_HIDDEN_SX,\n ZeroState,\n} from '../../../common'\nimport { type Transaction } from '../../../core'\n\nimport { useTransactionsUiStore } from '../../context/hooks'\nimport { useTransactionStore } from '../../../common'\n\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport TransactionRow from './transactionlist/TransactionRow'\n\nimport { hasInsetBorder, shouldShowDate } from '../../utils/Transactions'\nimport { fromUnixUTCToDayOfWeekAndDate } from '../../../core/utils/DateUtil'\n\nconst ROW_HEIGHT = 65\nconst DATE_ROW_HEIGHT = 32\n\nconst findScrollParent = (node: HTMLElement | null): HTMLElement | null => {\n for (let el = node?.parentElement; el; el = el.parentElement) {\n if (/(auto|scroll)/.test(getComputedStyle(el).overflowY)) return el\n }\n return null\n}\n\nexport interface TransactionListProps {\n bgcolor?: string\n filter?: (t: Transaction) => boolean\n height?: number | string\n /**\n * Marks rows that stay in the list but cannot be acted on. Disabled rows are rendered greyed\n * out and inert instead of being removed, so list membership and ordering are unaffected.\n */\n isRowDisabled?: (t: Transaction) => boolean\n loader?: React.JSX.Element\n onClick?: (guid: string) => void\n /** Replaces each row's category subline (see TransactionRow); omitted, rows show the category. */\n renderSecondaryText?: (transaction: Transaction) => React.ReactNode\n /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */\n scrollsWithParent?: boolean\n /** Rendered above the rows; stays at the top of the scroll area when used with scrollsWithParent. */\n stickyHeader?: React.ReactNode\n showInsights?: boolean\n showLoader?: boolean\n showUnviewedIndicator?: boolean\n transaction?: Transaction[]\n width?: number | string\n zeroState?: React.JSX.Element\n}\n\nconst TransactionList: React.FC<TransactionListProps> = ({\n bgcolor,\n filter,\n height = 'calc(100dvh - 36px)',\n isRowDisabled,\n loader = <Loader label=\"Loading\" size={40} />,\n onClick,\n renderSecondaryText,\n scrollsWithParent = false,\n showInsights = false,\n showLoader = false,\n showUnviewedIndicator = false,\n stickyHeader,\n transaction,\n width = '100%',\n zeroState = <ZeroState />,\n}) => {\n const { isLoading, sortedTransactions: allTransactions } = useTransactionStore()\n const transactions = React.useMemo(() => {\n const updatedTransactions = filter ? allTransactions.filter(filter) : allTransactions\n return transaction ?? updatedTransactions\n }, [allTransactions, filter, transaction])\n\n const { clearExpandedSplits, setShowInsights, toggleSplit } = useTransactionsUiStore()\n const { onEvent } = useEvent()\n const { common: commonCopy } = useGlobalCopyStore()\n const [pendingFocus, setPendingFocus] = React.useState<{ index: number; from: number } | null>(\n null,\n )\n\n const handleClick = (guid: string) => {\n const transaction = transactions.find((t) => t.guid === guid)\n\n if (transaction?.has_been_split) {\n toggleSplit(transaction.guid)\n return\n }\n\n onEvent(ANALYTICS_EVENTS.ACCOUNT_DETAILS_CLICK_TRANSACTION, {\n account_guid: transaction?.account_guid,\n transaction_guid: guid,\n })\n onClick?.(guid)\n }\n\n const parentRef = React.useRef<HTMLDivElement>(null)\n const hasStickyHeader = Boolean(stickyHeader)\n const [scrollParent, setScrollParent] = React.useState<HTMLElement | null>(null)\n const [scrollMargin, setScrollMargin] = React.useState(0)\n const headerRef = React.useRef<HTMLDivElement>(null)\n const [headerHeight, setHeaderHeight] = React.useState(0)\n\n React.useLayoutEffect(() => {\n if (!scrollsWithParent) return\n const list = parentRef.current\n if (!list) return\n // With no scrolling ancestor the list itself is the viewport, so every row renders.\n const scroller = findScrollParent(list) ?? list\n\n const measureOffset = () => {\n setScrollMargin(\n list.getBoundingClientRect().top -\n scroller.getBoundingClientRect().top +\n scroller.scrollTop,\n )\n setHeaderHeight(headerRef.current?.offsetHeight ?? 0)\n }\n\n setScrollParent(scroller)\n measureOffset()\n const observer = new ResizeObserver(measureOffset)\n observer.observe(scroller.firstElementChild ?? scroller)\n if (headerRef.current) observer.observe(headerRef.current)\n return () => observer.disconnect()\n }, [scrollsWithParent, hasStickyHeader])\n\n const rowVirtualizer = useVirtualizer({\n count: transactions.length,\n getScrollElement: () => (scrollsWithParent ? scrollParent : parentRef.current),\n estimateSize: (i) => ROW_HEIGHT + (shouldShowDate(i, transactions) ? DATE_ROW_HEIGHT : 0),\n overscan: 5,\n scrollMargin,\n scrollPaddingStart: headerHeight,\n })\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n const lastRenderedIndex = virtualItems.at(-1)?.index ?? -1\n const unrenderedCount = transactions.length - (lastRenderedIndex + 1)\n const isSettled = !isLoading && !showLoader\n const showRows = isSettled && virtualItems.length > 0\n // The total size comes from the row count, so a content-sized list has height before any row\n // is drawn. It is 0 only with no transactions, where the zero state needs 'auto'.\n const rowBoxHeight = rowVirtualizer.getTotalSize() || 'auto'\n\n // Screen reader reading modes do not scroll the list, so rows past the rendered window\n // are unreachable without this control.\n const showNextRows = () => {\n const nextIndex = lastRenderedIndex + 1\n rowVirtualizer.scrollToIndex(nextIndex, { align: 'start' })\n setPendingFocus({ index: nextIndex, from: lastRenderedIndex })\n }\n\n React.useEffect(() => {\n if (!pendingFocus) return\n const row = parentRef.current?.querySelector<HTMLElement>(\n `[data-index=\"${pendingFocus.index}\"]`,\n )\n row?.focus()\n // Give up once the window moves, so a missed row cannot take focus later.\n if (row || lastRenderedIndex !== pendingFocus.from) setPendingFocus(null)\n }, [pendingFocus, lastRenderedIndex])\n\n React.useEffect(() => rowVirtualizer.measure(), [transactions, scrollParent])\n React.useEffect(() => setShowInsights(showInsights), [showInsights])\n\n React.useEffect(() => {\n return () => clearExpandedSplits()\n }, [])\n\n return (\n <>\n {stickyHeader && (\n <Box\n ref={headerRef}\n sx={{\n bgcolor: 'background.paper',\n position: scrollsWithParent ? 'sticky' : undefined,\n top: 0,\n width,\n zIndex: 1,\n }}\n >\n {stickyHeader}\n </Box>\n )}\n <List component=\"div\" role=\"list\" sx={{ width: width }}>\n <Box\n height={scrollsWithParent ? undefined : height}\n overflow={scrollsWithParent ? undefined : 'auto'}\n ref={parentRef}\n role=\"presentation\"\n width={width}\n >\n <Box height={rowBoxHeight} position=\"relative\" role=\"presentation\" width=\"100%\">\n {!isSettled && loader}\n {isSettled && transactions.length === 0 && zeroState}\n {showRows &&\n virtualItems.map((row) => {\n const transaction = transactions[row.index]\n const showDate = shouldShowDate(row.index, transactions)\n const isInset = hasInsetBorder(row.index, transactions)\n const rowHeight = ROW_HEIGHT + (showDate ? DATE_ROW_HEIGHT : 0)\n\n return (\n <Box\n aria-posinset={row.index + 1}\n aria-setsize={transactions.length}\n data-index={row.index}\n key={transaction.guid}\n role=\"listitem\"\n tabIndex={-1}\n sx={{\n height: rowHeight,\n position: 'absolute',\n // Keeps a focused row from scrolling under the sticky header.\n scrollMarginTop: headerHeight,\n transform: `translateY(${row.start - scrollMargin}px)`,\n width: '100%',\n bgcolor: 'background.paper',\n }}\n >\n {showDate && (\n <SubheaderRow bgcolor={bgcolor}>\n {fromUnixUTCToDayOfWeekAndDate(transaction.date)}\n </SubheaderRow>\n )}\n <TransactionRow\n component=\"div\"\n disabled={isRowDisabled?.(transaction)}\n {...(onClick && { onClick: handleClick })}\n renderSecondaryText={renderSecondaryText}\n showUnviewedIndicator={showUnviewedIndicator}\n transaction={transaction}\n />\n <Divider sx={{ ml: isInset ? 68 : 0 }} />\n </Box>\n )\n })}\n </Box>\n </Box>\n </List>\n {showRows && unrenderedCount > 0 && (\n <Box\n component=\"button\"\n onClick={showNextRows}\n sx={VISUALLY_HIDDEN_SX}\n tabIndex={-1}\n type=\"button\"\n >\n {`${commonCopy.view_more} (${unrenderedCount})`}\n </Box>\n )}\n </>\n )\n}\n\nexport default observer(TransactionList)\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,IAAM,IAAa,IACb,IAAkB,IAElB,KAAA,CAAoB,MAAiD;AACzE,WAAS,IAAK,GAAM,eAAe,GAAI,IAAK,EAAG,cAC7C,KAAI,gBAAgB,KAAK,iBAAiB,CAAE,EAAE,SAAS,EAAG,QAAO;AAEnE,SAAO;AACT,GA2BM,KAAA,CAAmD,EACvD,SAAA,GACA,QAAA,GACA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
7
7
  onClick?: (guid: string) => void;
8
+ /**
9
+ * Replaces the category subline (the status icons and insight tag stay). Opt-in for one drawer's
10
+ * rows, e.g. the Insights 2.0 summary-header drawer's account subline; every other list keeps the category.
11
+ */
12
+ renderSecondaryText?: (transaction: Transaction) => React.ReactNode;
8
13
  /** Only the Transactions widget marks a transaction viewed, so other widgets leave this off. */
9
14
  showUnviewedIndicator?: boolean;
10
15
  transaction: Transaction;
@@ -1,49 +1,49 @@
1
- import { useGlobalCopyStore as C, useTransactionStore as S } from "../../../../common/context/hooks.es.js";
2
- import { TransactionType as N } from "../../../../core/types/Transaction.es.js";
3
- import { formatCurrency as k } from "../../../../core/utils/NumberFormatting.es.js";
4
- import { isTransferTransaction as L, isUnviewedTransaction as E } from "../../../../core/utils/TransactionUtils.es.js";
5
- import { ListItemWrapper as R } from "../../../../common/components/ListItemWrapper.es.js";
6
- import { useTransactionsUiStore as f } from "../../../context/hooks.es.js";
7
- import { ON_CLICK_EVENTS as j } from "../../../constants/OnClickEvents.es.js";
8
- import M from "../TransactionInsightTag.es.js";
9
- import z from "../UnviewedIndicator.es.js";
10
- import _ from "react";
11
- import { observer as A } from "mobx-react-lite";
1
+ import { useGlobalCopyStore as S, useTransactionStore as N } from "../../../../common/context/hooks.es.js";
2
+ import { TransactionType as k } from "../../../../core/types/Transaction.es.js";
3
+ import { formatCurrency as L } from "../../../../core/utils/NumberFormatting.es.js";
4
+ import { isTransferTransaction as E, isUnviewedTransaction as R } from "../../../../core/utils/TransactionUtils.es.js";
5
+ import { ListItemWrapper as j } from "../../../../common/components/ListItemWrapper.es.js";
6
+ import { useTransactionsUiStore as _ } from "../../../context/hooks.es.js";
7
+ import { ON_CLICK_EVENTS as M } from "../../../constants/OnClickEvents.es.js";
8
+ import z from "../TransactionInsightTag.es.js";
9
+ import A from "../UnviewedIndicator.es.js";
10
+ import g from "react";
11
+ import { observer as G } from "mobx-react-lite";
12
12
  import n from "@mui/material/Stack";
13
- import { Icon as a, MerchantLogo as G, Text as d } from "@mxenabled/mxui";
14
- import { jsx as r, jsxs as o } from "react/jsx-runtime";
15
- import { useTheme as O } from "@mui/material/styles";
16
- import U from "@mui/material/ListItemAvatar";
17
- import B from "@mui/material/ListItemText";
18
- var D = ({ transaction: e, disabled: g = !1, onClick: m, component: c, showUnviewedIndicator: h = !1 }) => {
19
- const T = O().palette.mode === "dark", { associatedBeats: p } = S(), { expandedSplits: y } = f(), { transactions: I } = C(), { showInsights: b } = f(), l = e.transaction_type === N.CREDIT, v = L(e) && !!e.institutionName, u = _.useMemo(() => p.find((i) => i.associated_transaction_guid === e.guid), [p, e]), x = (i, s) => {
13
+ import { Icon as a, MerchantLogo as O, Text as d } from "@mxenabled/mxui";
14
+ import { jsx as i, jsxs as o } from "react/jsx-runtime";
15
+ import { useTheme as U } from "@mui/material/styles";
16
+ import B from "@mui/material/ListItemAvatar";
17
+ import D from "@mui/material/ListItemText";
18
+ var K = ({ transaction: e, disabled: h = !1, onClick: m, component: c, renderSecondaryText: p, showUnviewedIndicator: T = !1 }) => {
19
+ const y = U().palette.mode === "dark", { associatedBeats: l } = N(), { expandedSplits: I } = _(), { transactions: b } = S(), { showInsights: v } = _(), u = e.transaction_type === k.CREDIT, x = E(e) && !!e.institutionName, f = g.useMemo(() => l.find((r) => r.associated_transaction_guid === e.guid), [l, e]), w = (r, s) => {
20
20
  const t = [];
21
- return i.is_flagged && t.push(/* @__PURE__ */ r(a, {
21
+ return r.is_flagged && t.push(/* @__PURE__ */ i(a, {
22
22
  fill: !0,
23
23
  name: "flag",
24
24
  size: 16,
25
25
  sx: { color: s ? "primary.main" : "warning.dark" }
26
- }, "flag")), i.is_hidden && t.push(/* @__PURE__ */ r(a, {
26
+ }, "flag")), r.is_hidden && t.push(/* @__PURE__ */ i(a, {
27
27
  name: "visibility_off",
28
28
  size: 16
29
- }, "hidden")), i.has_been_split && t.push(/* @__PURE__ */ r(a, {
29
+ }, "hidden")), r.has_been_split && t.push(/* @__PURE__ */ i(a, {
30
30
  name: "call_split",
31
31
  size: 16
32
- }, "split")), h && E(i) && t.push(/* @__PURE__ */ r(z, {}, "unviewed")), t;
33
- }, w = (i, s) => i.is_hidden ? s.is_excluded : i.has_been_split ? s.split_transaction_category_label : i.category || "";
34
- return /* @__PURE__ */ o(R, {
35
- clickEventName: j.ON_TRANSACTION_LIST_ITEM_CLICK,
32
+ }, "split")), T && R(r) && t.push(/* @__PURE__ */ i(A, {}, "unviewed")), t;
33
+ }, C = (r, s) => r.is_hidden ? s.is_excluded : r.has_been_split ? s.split_transaction_category_label : r.category || "";
34
+ return /* @__PURE__ */ o(j, {
35
+ clickEventName: M.ON_TRANSACTION_LIST_ITEM_CLICK,
36
36
  ...c && { component: c },
37
- disabled: g,
37
+ disabled: h,
38
38
  onClick: m ? () => m(e.guid) : void 0,
39
39
  sx: e.is_hidden ? {
40
40
  backgroundColor: "grey.50",
41
41
  color: "text.secondary"
42
42
  } : void 0,
43
- children: [/* @__PURE__ */ r(U, { children: e.parent_guid && y.includes(e.parent_guid) ? /* @__PURE__ */ r(_.Fragment, {}) : /* @__PURE__ */ r(G, {
43
+ children: [/* @__PURE__ */ i(B, { children: e.parent_guid && I.includes(e.parent_guid) ? /* @__PURE__ */ i(g.Fragment, {}) : /* @__PURE__ */ i(O, {
44
44
  categoryGuid: e.top_level_category_guid || "",
45
45
  merchantGuid: e.merchant_guid || ""
46
- }) }), /* @__PURE__ */ r(B, {
46
+ }) }), /* @__PURE__ */ i(D, {
47
47
  disableTypography: !0,
48
48
  secondary: /* @__PURE__ */ o(n, {
49
49
  direction: "row",
@@ -52,35 +52,35 @@ var D = ({ transaction: e, disabled: g = !1, onClick: m, component: c, showUnvie
52
52
  alignItems: "center",
53
53
  direction: "row",
54
54
  gap: 4,
55
- children: [x(e, T), /* @__PURE__ */ r(d, {
55
+ children: [w(e, y), p ? p(e) : /* @__PURE__ */ i(d, {
56
56
  truncate: !0,
57
57
  variant: "caption",
58
- children: w(e, I)
58
+ children: C(e, b)
59
59
  })]
60
- }), u && b && /* @__PURE__ */ r(M, { beat: u })]
60
+ }), f && v && /* @__PURE__ */ i(z, { beat: f })]
61
61
  }),
62
62
  children: /* @__PURE__ */ o(n, {
63
63
  direction: "row",
64
64
  justifyContent: "space-between",
65
65
  sx: { gap: 8 },
66
- children: [/* @__PURE__ */ r(d, {
66
+ children: [/* @__PURE__ */ i(d, {
67
67
  bold: !0,
68
68
  truncate: !0,
69
69
  variant: "body1",
70
- children: v ? e.institutionName : e.payee || e.description || e.feed_description
70
+ children: x ? e.institutionName : e.payee || e.description || e.feed_description
71
71
  }), /* @__PURE__ */ o(d, {
72
72
  bold: !0,
73
- color: l ? "success.main" : "text.primary",
73
+ color: u ? "success.main" : "text.primary",
74
74
  sx: { flexShrink: 0 },
75
75
  variant: "body1",
76
- children: [l ? "+" : "", k(e.amount, "0,0.00")]
76
+ children: [u ? "+" : "", L(e.amount, "0,0.00")]
77
77
  })]
78
78
  })
79
79
  })]
80
80
  });
81
- }, oe = A(D);
81
+ }, se = G(K);
82
82
  export {
83
- oe as default
83
+ se as default
84
84
  };
85
85
 
86
86
  //# sourceMappingURL=TransactionRow.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionRow.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactionlist/TransactionRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { ListItemWrapper, useGlobalCopyStore, useTransactionStore } from '../../../../common'\nimport { Transaction, TransactionType } from '../../../../core'\nimport {\n isTransferTransaction,\n isUnviewedTransaction,\n} from '../../../../core/utils/TransactionUtils'\n\nimport TransactionInsightTag from '../TransactionInsightTag'\nimport UnviewedIndicator from '../UnviewedIndicator'\n\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../context/hooks'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionRowProps {\n component?: React.ElementType\n /** Shows the row greyed out and inert (see {@link ListItemWrapper}). */\n disabled?: boolean\n onClick?: (guid: string) => void\n /** Only the Transactions widget marks a transaction viewed, so other widgets leave this off. */\n showUnviewedIndicator?: boolean\n transaction: Transaction\n}\n\nconst TransactionRow: React.FC<TransactionRowProps> = ({\n transaction,\n disabled = false,\n onClick,\n component,\n showUnviewedIndicator = false,\n}) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const { associatedBeats } = useTransactionStore()\n const { expandedSplits } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n const { showInsights } = useTransactionsUiStore()\n\n const isCredit = transaction.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const getTransactionStatusIcons = (\n transaction: Transaction,\n isDarkMode: boolean,\n ): React.ReactNode[] => {\n const icons: React.ReactNode[] = []\n\n if (transaction.is_flagged) {\n icons.push(\n <Icon\n fill={true}\n key=\"flag\"\n name=\"flag\"\n size={16}\n sx={{ color: isDarkMode ? 'primary.main' : 'warning.dark' }}\n />,\n )\n }\n\n if (transaction.is_hidden) {\n icons.push(<Icon key=\"hidden\" name=\"visibility_off\" size={16} />)\n }\n\n if (transaction.has_been_split) {\n icons.push(<Icon key=\"split\" name=\"call_split\" size={16} />)\n }\n\n if (showUnviewedIndicator && isUnviewedTransaction(transaction)) {\n icons.push(<UnviewedIndicator key=\"unviewed\" />)\n }\n\n return icons\n }\n\n const getTransactionCategoryText = (transaction: Transaction, copy: any): string => {\n if (transaction.is_hidden) {\n return copy.is_excluded\n }\n\n if (transaction.has_been_split) {\n return copy.split_transaction_category_label\n }\n\n return transaction.category || ''\n }\n\n return (\n //TODO: implement common/components/ListItemRow.tsx\n <ListItemWrapper\n clickEventName={ON_CLICK_EVENTS.ON_TRANSACTION_LIST_ITEM_CLICK}\n {...(component && { component })}\n disabled={disabled}\n onClick={onClick ? () => onClick(transaction.guid) : undefined}\n sx={\n transaction.is_hidden ? { backgroundColor: 'grey.50', color: 'text.secondary' } : undefined\n }\n >\n <ListItemAvatar>\n {transaction.parent_guid && expandedSplits.includes(transaction.parent_guid) ? (\n <React.Fragment />\n ) : (\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n />\n )}\n </ListItemAvatar>\n <ListItemText\n disableTypography={true}\n secondary={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n {getTransactionStatusIcons(transaction, isDarkMode)}\n <Text truncate={true} variant=\"caption\">\n {getTransactionCategoryText(transaction, copy)}\n </Text>\n </Stack>\n {beat && showInsights && <TransactionInsightTag beat={beat} />}\n </Stack>\n }\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ gap: 8 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {showInstitution\n ? transaction.institutionName\n : transaction.payee || transaction.description || transaction.feed_description}\n </Text>\n <Text\n bold={true}\n color={isCredit ? 'success.main' : 'text.primary'}\n sx={{ flexShrink: 0 }}\n variant=\"body1\"\n >\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </Text>\n </Stack>\n </ListItemText>\n </ListItemWrapper>\n )\n}\n\nexport default observer(TransactionRow)\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,IAAM,IAAA,CAAiD,EACrD,aAAA,GACA,UAAA,IAAW,IACX,SAAA,GACA,WAAA,GACA,uBAAA,IAAwB,GAAA,MACpB;AAEJ,QAAM,IADQ,EACK,EAAM,QAAQ,SAAS,QAEpC,EAAE,iBAAA,EAAA,IAAoB,EAA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Y,QAAQ,QAAQ,CACxC;AAAA,QACD,CAAA,CAAA;AAAA;IACK,CAAA,CACC;AAAA;AAErB,GAEA,KAAe,EAAS,CAAc"}
1
+ {"version":3,"file":"TransactionRow.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactionlist/TransactionRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { ListItemWrapper, useGlobalCopyStore, useTransactionStore } from '../../../../common'\nimport { Transaction, TransactionType } from '../../../../core'\nimport {\n isTransferTransaction,\n isUnviewedTransaction,\n} from '../../../../core/utils/TransactionUtils'\n\nimport TransactionInsightTag from '../TransactionInsightTag'\nimport UnviewedIndicator from '../UnviewedIndicator'\n\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../context/hooks'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionRowProps {\n component?: React.ElementType\n /** Shows the row greyed out and inert (see {@link ListItemWrapper}). */\n disabled?: boolean\n onClick?: (guid: string) => void\n /**\n * Replaces the category subline (the status icons and insight tag stay). Opt-in for one drawer's\n * rows, e.g. the Insights 2.0 summary-header drawer's account subline; every other list keeps the category.\n */\n renderSecondaryText?: (transaction: Transaction) => React.ReactNode\n /** Only the Transactions widget marks a transaction viewed, so other widgets leave this off. */\n showUnviewedIndicator?: boolean\n transaction: Transaction\n}\n\nconst TransactionRow: React.FC<TransactionRowProps> = ({\n transaction,\n disabled = false,\n onClick,\n component,\n renderSecondaryText,\n showUnviewedIndicator = false,\n}) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const { associatedBeats } = useTransactionStore()\n const { expandedSplits } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n const { showInsights } = useTransactionsUiStore()\n\n const isCredit = transaction.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const getTransactionStatusIcons = (\n transaction: Transaction,\n isDarkMode: boolean,\n ): React.ReactNode[] => {\n const icons: React.ReactNode[] = []\n\n if (transaction.is_flagged) {\n icons.push(\n <Icon\n fill={true}\n key=\"flag\"\n name=\"flag\"\n size={16}\n sx={{ color: isDarkMode ? 'primary.main' : 'warning.dark' }}\n />,\n )\n }\n\n if (transaction.is_hidden) {\n icons.push(<Icon key=\"hidden\" name=\"visibility_off\" size={16} />)\n }\n\n if (transaction.has_been_split) {\n icons.push(<Icon key=\"split\" name=\"call_split\" size={16} />)\n }\n\n if (showUnviewedIndicator && isUnviewedTransaction(transaction)) {\n icons.push(<UnviewedIndicator key=\"unviewed\" />)\n }\n\n return icons\n }\n\n const getTransactionCategoryText = (transaction: Transaction, copy: any): string => {\n if (transaction.is_hidden) {\n return copy.is_excluded\n }\n\n if (transaction.has_been_split) {\n return copy.split_transaction_category_label\n }\n\n return transaction.category || ''\n }\n\n return (\n //TODO: implement common/components/ListItemRow.tsx\n <ListItemWrapper\n clickEventName={ON_CLICK_EVENTS.ON_TRANSACTION_LIST_ITEM_CLICK}\n {...(component && { component })}\n disabled={disabled}\n onClick={onClick ? () => onClick(transaction.guid) : undefined}\n sx={\n transaction.is_hidden ? { backgroundColor: 'grey.50', color: 'text.secondary' } : undefined\n }\n >\n <ListItemAvatar>\n {transaction.parent_guid && expandedSplits.includes(transaction.parent_guid) ? (\n <React.Fragment />\n ) : (\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n />\n )}\n </ListItemAvatar>\n <ListItemText\n disableTypography={true}\n secondary={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n {getTransactionStatusIcons(transaction, isDarkMode)}\n {renderSecondaryText ? (\n renderSecondaryText(transaction)\n ) : (\n <Text truncate={true} variant=\"caption\">\n {getTransactionCategoryText(transaction, copy)}\n </Text>\n )}\n </Stack>\n {beat && showInsights && <TransactionInsightTag beat={beat} />}\n </Stack>\n }\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ gap: 8 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {showInstitution\n ? transaction.institutionName\n : transaction.payee || transaction.description || transaction.feed_description}\n </Text>\n <Text\n bold={true}\n color={isCredit ? 'success.main' : 'text.primary'}\n sx={{ flexShrink: 0 }}\n variant=\"body1\"\n >\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </Text>\n </Stack>\n </ListItemText>\n </ListItemWrapper>\n )\n}\n\nexport default observer(TransactionRow)\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAA,CAAiD,EACrD,aAAA,GACA,UAAA,IAAW,IACX,SAAA,GACA,WAAA,GACA,qBAAA,GACA,uBAAA,IAAwB,GAAA,MACpB;AAEJ,QAAM,IADQ,EACK,EAAM,QAAQ,SAAS,QAEpC,EAAE,iBAAA,EAAA,IAAoB,EAAoB,GAC1C,EAAE,gBAAA,EAAA,IAAmB,EAAuB,GAC5C,EAAE,cAAc,EAAA,IAAS,EAAmB,GAC5C,EAAE,cAAA,EAAA,IAAiB,EAAuB,GAE1C,IAAW,EAAY,qBAAqB,EAAgB,QAE5D,IAAkB,EAAsB,CAAW,KAAK,EAAQ,EAAY,iBAE5E,IAAO,EAAM,QAAA,MACV,EAAgB,KAAA,CAAM,MAAS,EAAK,gCAAgC,EAAY,IAAI,GAC1F,CAAC,GAAiB,CAAW,CAAC,GAE3B,IAAA,CACJ,GACA,MACsB;AACtB,UAAM,IAA2B,CAAC;AAElC,WAAI,EAAY,cACd,EAAM,KACJ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A,QAAtC,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAO,YAAW;AAAA,UAAS,WAAU;AAAA,UAAM,KAAK;AAAA,UAAhD,UAAA,CACG,EAA0B,GAAa,CAAU,GACjD,IACC,EAAoB,CAAW,IAE/B,gBAAA,EAAC,GAAD;AAAA,YAAM,UAAU;AAAA,YAAM,SAAQ;AAAA,YAC3B,UAAA,EAA2B,GAAa,CAAI;AAAA,UACzC,CAAA,CAEH;AAAA,QACN,CAAA,GAAA,KAAQ,KAAgB,gBAAA,EAAC,GAAD,EAA6B,MAAA,EAAO,CAAA,CACxD;AAAA;MAGT,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QAAgB,IAAI,EAAE,KAAK,EAAE;AAAA,QAAnE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,UAAU;AAAA,UAAM,SAAQ;AAAA,UACvC,UAAA,IACG,EAAY,kBACZ,EAAY,SAAS,EAAY,eAAe,EAAY;AAAA,QAC5D,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UACE,MAAM;AAAA,UACN,OAAO,IAAW,iBAAiB;AAAA,UACnC,IAAI,EAAE,YAAY,EAAE;AAAA,UACpB,SAAQ;AAAA,UAJV,UAAA,CAMG,IAAW,MAAM,IACjB,EAAe,EAAY,QAAQ,QAAQ,CACxC;AAAA,QACD,CAAA,CAAA;AAAA;IACK,CAAA,CACC;AAAA;AAErB,GAEA,KAAe,EAAS,CAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.114",
3
+ "version": "9.7.116",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",