@mx-cartographer/experiences 9.7.153 → 9.7.155

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 (59) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +42 -42
  3. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
  4. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +37 -37
  5. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
  6. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +52 -52
  7. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +87 -87
  9. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js +12 -12
  11. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js +18 -18
  13. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js +23 -22
  15. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
  16. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +44 -44
  17. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
  18. package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +24 -24
  19. package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +20 -20
  21. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.d.ts +1 -2
  23. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js +3 -7
  24. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +75 -75
  26. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  27. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +11 -11
  28. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map +1 -1
  29. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +58 -58
  30. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  31. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.d.ts +7 -0
  32. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js +28 -0
  33. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js.map +1 -0
  34. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js +14 -33
  35. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js.map +1 -1
  36. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +24 -41
  37. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  38. package/dist/insights-v2/actionBlocks/useOpenedCta.d.ts +9 -0
  39. package/dist/insights-v2/actionBlocks/useOpenedCta.es.js +11 -0
  40. package/dist/insights-v2/actionBlocks/useOpenedCta.es.js.map +1 -0
  41. package/dist/insights-v2/actionBlocks/util.d.ts +2 -1
  42. package/dist/insights-v2/actionBlocks/util.es.js.map +1 -1
  43. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +18 -15
  44. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  45. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +7 -0
  46. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +21 -11
  47. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
  48. package/dist/insights-v2/components/AmountPill.d.ts +4 -2
  49. package/dist/insights-v2/components/AmountPill.es.js +6 -5
  50. package/dist/insights-v2/components/AmountPill.es.js.map +1 -1
  51. package/dist/insights-v2/components/MerchantHighlightCard.d.ts +6 -1
  52. package/dist/insights-v2/components/MerchantHighlightCard.es.js +26 -22
  53. package/dist/insights-v2/components/MerchantHighlightCard.es.js.map +1 -1
  54. package/dist/transactions/components/shared/TransactionList.d.ts +1 -1
  55. package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
  56. package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +1 -1
  57. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +49 -44
  58. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
  59. package/package.json +1 -1
@@ -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 { 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"}
1
+ {"version":3,"file":"useTransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.ts"],"sourcesContent":["import React from 'react'\n\nimport { useActionContext, useGlobalStore, useTransactionStore } from '../../../common'\nimport type { Beat, Transaction, DrilldownPayload } from '../../../core'\nimport type { BottomActions, TopActions } from '../../../transactions/constants/Actions'\nimport { useOpenedCta } from '../useOpenedCta'\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 cta = useOpenedCta(beat)\n\n const { transaction_guid } = useActionContext<DrilldownPayload>() ?? {}\n const payload = beat.insights_payload\n\n const ctaDrilldown = cta?.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(cta?.variant)\n return {\n bottomActions,\n isLoading: !isTransactionDataLoaded,\n topActions: resolveTopActions(),\n transaction,\n }\n}\n"],"mappings":";;;;;AA4CA,IAAa,IAAA,CAA8B,MAA6C;AACtF,QAAM,EAAE,sBAAA,GAAsB,yBAAA,GAAyB,cAAA,EAAA,IAAiB,EAAoB,GACtF,EAAE,YAAA,EAAA,IAAe,EAAe,GAEhC,IAAM,EAAa,CAAI,GAEvB,EAAE,kBAAA,EAAA,IAAqB,EAAmC,KAAK,CAAC,GAChE,IAAU,EAAK,kBAEf,IAAe,GAAK,gBACpB,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,GAGnC;AAAA,IACL,eAFoB,EAA0B,GAAK,OAEnD;AAAA,IACA,WAAW,CAAC;AAAA,IACZ,YAAY,EAAkB;AAAA,IAC9B,aAAA;AAAA,EACF;AACF"}
@@ -1,7 +1,6 @@
1
- import { ActionDrawerState, InDescriptionCTA, PrimaryCTA, SecondaryCTA } from '../../../core';
2
1
  import { BottomActions } from '../../../transactions/constants/Actions';
3
2
  /**
4
3
  * Bottom actions for the drawer, driven by the triggering CTA's `variant` via the per-variant
5
4
  * config table in `./layout.ts`. Add variant-specific behavior (or styles) there, not here.
6
5
  */
7
- export declare const getBottomActionsByVariant: (actionDrawer: ActionDrawerState, primary_cta: PrimaryCTA | undefined, secondary_cta: SecondaryCTA | undefined, in_description_cta?: InDescriptionCTA) => BottomActions[];
6
+ export declare const getBottomActionsByVariant: (variant?: string | null) => BottomActions[];
@@ -1,11 +1,7 @@
1
- import { getDynamicCtaBasedOnTriggers as n } from "../util.es.js";
2
- import { resolveLayoutConfig as e } from "./layout.es.js";
3
- var c = (t, o, r, a) => {
4
- const i = n(t, o, r, a);
5
- return e(i?.variant).bottomActions;
6
- };
1
+ import { resolveLayoutConfig as t } from "./layout.es.js";
2
+ var i = (o) => t(o).bottomActions;
7
3
  export {
8
- c as getBottomActionsByVariant
4
+ i as getBottomActionsByVariant
9
5
  };
10
6
 
11
7
  //# sourceMappingURL=util.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/util.ts"],"sourcesContent":["import type { ActionDrawerState, InDescriptionCTA, PrimaryCTA, SecondaryCTA } from '../../../core'\nimport type { BottomActions } from '../../../transactions/constants/Actions'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { resolveLayoutConfig } from './layout'\n\n/**\n * Bottom actions for the drawer, driven by the triggering CTA's `variant` via the per-variant\n * config table in `./layout.ts`. Add variant-specific behavior (or styles) there, not here.\n */\nexport const getBottomActionsByVariant = (\n actionDrawer: ActionDrawerState,\n primary_cta: PrimaryCTA | undefined,\n secondary_cta: SecondaryCTA | undefined,\n in_description_cta?: InDescriptionCTA,\n): BottomActions[] => {\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )\n\n return resolveLayoutConfig(cta?.variant).bottomActions\n}\n"],"mappings":";;AASA,IAAa,IAAA,CACX,GACA,GACA,GACA,MACoB;AACpB,QAAM,IAAM,EACV,GACA,GACA,GACA,CACF;AAEA,SAAO,EAAoB,GAAK,OAAO,EAAE;AAC3C"}
1
+ {"version":3,"file":"util.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/util.ts"],"sourcesContent":["import type { BottomActions } from '../../../transactions/constants/Actions'\nimport { resolveLayoutConfig } from './layout'\n\n/**\n * Bottom actions for the drawer, driven by the triggering CTA's `variant` via the per-variant\n * config table in `./layout.ts`. Add variant-specific behavior (or styles) there, not here.\n */\nexport const getBottomActionsByVariant = (variant?: string | null): BottomActions[] =>\n resolveLayoutConfig(variant).bottomActions\n"],"mappings":";AAOA,IAAa,IAAA,CAA6B,MACxC,EAAoB,CAAO,EAAE"}
@@ -1,118 +1,118 @@
1
- import { useGlobalCopyStore as At, useGlobalUiStore as Dt, useInsightsV2Store as Bt } from "../../../common/context/hooks.es.js";
2
- import { CURRENCY_FORMAT as St, formatCurrency as vt } from "../../../core/utils/NumberFormatting.es.js";
1
+ import { useGlobalCopyStore as At, useGlobalUiStore as Dt, useInsightsV2Store as St } from "../../../common/context/hooks.es.js";
2
+ import { CURRENCY_FORMAT as vt, formatCurrency as Bt } from "../../../core/utils/NumberFormatting.es.js";
3
3
  import Lt from "../../../common/components/drawer/Drawer.es.js";
4
4
  import It from "../../../common/components/Loader.es.js";
5
5
  import { BAR_ARIA_LABEL as Et } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
6
6
  import { BarChartV2 as Rt } from "../../components/chartblocks/BarchartV2.es.js";
7
7
  import { EmptyBarChart as xt } from "../../components/chartblocks/EmptyBarChart.es.js";
8
- import { ANALYTICS_EVENTS_CONFIG as V } from "../../analytics/analyticsEventsConfig.es.js";
8
+ import { ANALYTICS_EVENTS_CONFIG as P } from "../../analytics/analyticsEventsConfig.es.js";
9
9
  import { useAnalyticsEvent as Ft } from "../../analytics/useAnalyticsEvent.es.js";
10
10
  import { DoubleBarChart as Ot } from "../../components/chartblocks/DoubleBarChart.es.js";
11
11
  import { toLegendItems as jt } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
12
12
  import { getDefaultSelection as Gt, getDrillDownConfig as Ht, getFlattenedDataSeries as wt, resolveDrillDownSubHeader as Nt, splitProjectedTransaction as kt, toStoreFilter as Mt } from "./utils.es.js";
13
- import { getDynamicCtaBasedOnTriggers as Kt } from "../util.es.js";
13
+ import { useOpenedCta as Kt } from "../useOpenedCta.es.js";
14
14
  import { TransactionDrillDown as Pt } from "./TransactionDrillDown.es.js";
15
15
  import { useTransactionHistory as Vt } from "./useTransactionHistory.es.js";
16
16
  import { TransactionDetailsBlock as zt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
17
- import { useLayoutEffect as Ut, useState as m } from "react";
17
+ import { useLayoutEffect as Ut, useState as d } from "react";
18
18
  import { observer as Yt } from "mobx-react-lite";
19
- import { Fragment as Wt, jsx as r, jsxs as $t } from "react/jsx-runtime";
19
+ import { Fragment as Wt, jsx as s, jsxs as $t } from "react/jsx-runtime";
20
20
  import { useTheme as qt } from "@mui/material/styles";
21
- var _e = Yt(({ beat: s }) => {
22
- const D = qt(), { actionDrawer: B, setActionContext: S } = Bt(), { insights_payload: c } = s, v = Kt(B, c?.primary_cta, c?.secondary_cta, c?.in_description_cta), z = v?.variant, { top: e, filterMode: u, header: U, colors: Y, filterStrategy: W, tipSection: L, subTabAriaLabels: $, slotData: q, beatTransactions: J, averageFormat: Q, subTabs: X, boldLabel: Z } = Ht(z ?? ""), { instanceSlotData: o, beatTransactions: g, spendCategoryGuids: I, allAccountGuids: E, categoryName: tt, displayedDateRange: h, transactionStore: et } = Vt(s, {
21
+ var Ce = Yt(({ beat: r }) => {
22
+ const A = qt(), { actionDrawer: V, setActionContext: D } = St(), { insights_payload: S } = r, v = Kt(r), z = v?.variant, { top: e, filterMode: m, header: U, colors: Y, filterStrategy: W, tipSection: B, subTabAriaLabels: $, slotData: q, beatTransactions: J, averageFormat: Q, subTabs: X, boldLabel: Z } = Ht(z ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: L, allAccountGuids: I, categoryName: tt, displayedDateRange: f, transactionStore: et } = Vt(r, {
23
23
  slotData: q,
24
24
  beatTransactions: J
25
- }, v?.drilldown_data), { common: ot, insights_feed: n } = At(), { isCopyLoaded: at } = Dt(), [nt, R] = m(!1), [rt, st] = m(!1), x = Ft(), { dataSeries: p, chartData: b, comparisonBars: i } = wt({
25
+ }, v?.drilldown_data), { common: ot, insights_feed: n } = At(), { isCopyLoaded: at } = Dt(), [nt, E] = d(!1), [rt, st] = d(!1), R = Ft(), { dataSeries: p, chartData: g, comparisonBars: i } = wt({
26
26
  data: o?.data_series,
27
27
  ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : Et,
28
28
  top: e,
29
- beatTransactions: g
30
- }), d = e === "doubleBar", it = e === "tabsOnly", l = d ? i : b, { chartBarIndex: F, subTabIndex: lt } = Gt({
31
- chartTabCount: b.length,
29
+ beatTransactions: u
30
+ }), c = e === "doubleBar", it = e === "tabsOnly", l = c ? i : g, { chartBarIndex: x, subTabIndex: lt } = Gt({
31
+ chartTabCount: g.length,
32
32
  comparisonTabCount: i.length,
33
- actionDrawer: B,
34
- beatGuid: s.guid
35
- }), [a, _] = m(F), [C, O] = m(lt), [ct, dt] = m(l.length);
36
- l.length !== ct && (dt(l.length), _(F));
33
+ actionDrawer: V,
34
+ beatGuid: r.guid
35
+ }), [a, h] = d(x), [C, F] = d(lt), [ct, dt] = d(l.length);
36
+ l.length !== ct && (dt(l.length), h(x));
37
37
  const T = (t) => W({
38
- beat: s,
39
- beatTransactions: g,
38
+ beat: r,
39
+ beatTransactions: u,
40
40
  dataSeries: p,
41
41
  comparisonBars: i,
42
42
  selectedIndex: t,
43
43
  subIndex: C,
44
44
  isLastTab: t === l.length - 1,
45
45
  instanceSlotData: o,
46
- spendCategoryGuids: I,
47
- displayedDateRange: h
48
- }), mt = g.map((t) => t.guid).join(","), ut = I.join(","), gt = E.join(","), pt = e === "list" || e === "tabsOnly" || e === "monthTabs" || p.length > 0, j = () => {
49
- if (u !== "store") return;
50
- const t = pt ? T(a) : {
46
+ spendCategoryGuids: L,
47
+ displayedDateRange: f
48
+ }), mt = u.map((t) => t.guid).join(","), ut = L.join(","), pt = I.join(","), gt = e === "list" || e === "tabsOnly" || e === "monthTabs" || p.length > 0, O = () => {
49
+ if (m !== "store") return;
50
+ const t = gt ? T(a) : {
51
51
  accounts: [],
52
52
  custom: () => !1
53
53
  };
54
54
  et.setFilter(Mt(t, {
55
- allAccountGuids: E,
56
- displayedDateRange: h
55
+ allAccountGuids: I,
56
+ displayedDateRange: f
57
57
  }));
58
58
  };
59
59
  Ut(() => {
60
- j();
60
+ O();
61
61
  }, [
62
- s.guid,
62
+ r.guid,
63
63
  a,
64
64
  C,
65
- u,
65
+ m,
66
66
  p.length,
67
67
  o,
68
- h,
68
+ f,
69
69
  ut,
70
- gt,
70
+ pt,
71
71
  mt,
72
72
  e
73
73
  ]);
74
- const G = Nt(c), y = U?.({
75
- title: c?.title,
76
- subHeader: G,
74
+ const j = Nt(S), _ = U?.({
75
+ title: S?.title,
76
+ subHeader: j,
77
77
  categoryName: tt,
78
- selectedDate: b[a]?.date ?? void 0,
78
+ selectedDate: g[a]?.date ?? void 0,
79
79
  slotData: o
80
- }), H = Y(D, o?.category_guid);
81
- if (!at) return /* @__PURE__ */ r(It, {});
82
- const [w, N] = o?.legends ?? [], bt = u === "local" ? (t) => T(t).custom ?? (() => !0) : void 0, { transactions: ft, projectedTransaction: A } = kt(g), ht = u === "local" ? ft : void 0, k = n.general.projected_amount, _t = A && k && T(a).custom?.(A) ? {
83
- heading: k,
84
- transaction: A
85
- } : void 0, M = (t, f) => {
86
- x(V.DRAWER_CHART_BAR_CLICKED), _(t), f !== void 0 && O(f);
87
- }, Ct = (t) => {
88
- x(V.TAB_SELECTED), _(t);
89
- }, K = d ? jt([{
90
- ...w,
80
+ }), G = Y(A, o?.category_guid);
81
+ if (!at) return /* @__PURE__ */ s(It, {});
82
+ const [H, w] = o?.legends ?? [], bt = m === "local" ? (t) => T(t).custom ?? (() => !0) : void 0, { transactions: ft, projectedTransaction: y } = kt(u), ht = m === "local" ? ft : void 0, N = n.general.projected_amount, Ct = y && N && T(a).custom?.(y) ? {
83
+ heading: N,
84
+ transaction: y
85
+ } : void 0, k = (t, b) => {
86
+ R(P.DRAWER_CHART_BAR_CLICKED), h(t), b !== void 0 && F(b);
87
+ }, Tt = (t) => {
88
+ R(P.TAB_SELECTED), h(t);
89
+ }, M = c ? jt([{
90
+ ...H,
91
91
  value: i[a]?.main
92
92
  }, {
93
- ...N,
93
+ ...w,
94
94
  value: i[a]?.comparison
95
- }]) : void 0, Tt = $?.(n) ?? [], P = d ? (K ?? []).map((t, f) => ({
95
+ }]) : void 0, _t = $?.(n) ?? [], K = c ? (M ?? []).map((t, b) => ({
96
96
  label: t.label,
97
- ariaLabel: Tt[f]
97
+ ariaLabel: _t[b]
98
98
  })) : it ? p.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : X?.({
99
99
  instanceSlotData: o,
100
100
  copy: n
101
- }).map((t) => ({ label: t })) ?? [], yt = d || e === "singleBar" || e === "upcomingBill" ? l.length ? d ? /* @__PURE__ */ r(Ot, {
101
+ }).map((t) => ({ label: t })) ?? [], yt = c || e === "singleBar" || e === "upcomingBill" ? l.length ? c ? /* @__PURE__ */ s(Ot, {
102
102
  bars: i,
103
103
  boldLabel: Z,
104
- colors: H,
104
+ colors: G,
105
105
  legendPosition: "top",
106
- legends: K,
107
- onBarClick: M,
106
+ legends: M,
107
+ onBarClick: k,
108
108
  selectedIndex: a
109
- }) : /* @__PURE__ */ r(Rt, {
109
+ }) : /* @__PURE__ */ s(Rt, {
110
110
  amounts: {
111
111
  average: o?.average_amount,
112
- formattedAverage: vt(o?.average_amount ?? 0, Q ?? St.cents)
112
+ formattedAverage: Bt(o?.average_amount ?? 0, Q ?? vt.cents)
113
113
  },
114
- color: H[0] ?? D.palette.primary.main,
115
- data: b,
114
+ color: G[0] ?? A.palette.primary.main,
115
+ data: g,
116
116
  legendPosition: "top",
117
117
  heightOverride: 172,
118
118
  margin: {
@@ -121,43 +121,43 @@ var _e = Yt(({ beat: s }) => {
121
121
  left: 24,
122
122
  right: 24
123
123
  },
124
- monthlyAmountLabel: w?.label ?? n.general.monthly_amount,
125
- onBarClick: M,
124
+ monthlyAmountLabel: H?.label ?? n.general.monthly_amount,
125
+ onBarClick: k,
126
126
  selectedTabIndex: a,
127
- trendAmountLabel: N?.label ?? n.general.trend
128
- }) : /* @__PURE__ */ r(xt, {}) : null;
129
- return /* @__PURE__ */ $t(Wt, { children: [/* @__PURE__ */ r(Pt, {
127
+ trendAmountLabel: w?.label ?? n.general.trend
128
+ }) : /* @__PURE__ */ s(xt, {}) : null;
129
+ return /* @__PURE__ */ $t(Wt, { children: [/* @__PURE__ */ s(Pt, {
130
130
  baseTransactions: ht,
131
- projectedRow: _t,
132
- heading: y?.heading,
133
- icon: y?.icon,
134
- onSelectionChange: Ct,
131
+ projectedRow: Ct,
132
+ heading: _?.heading,
133
+ icon: _?.icon,
134
+ onSelectionChange: Tt,
135
135
  selectedIndex: a,
136
- subHeadingText: y?.subHeadingText,
136
+ subHeadingText: _?.subHeadingText,
137
137
  tabs: l,
138
138
  top: yt,
139
- ...P.length > 0 && { subTabs: {
140
- tabs: P,
139
+ ...K.length > 0 && { subTabs: {
140
+ tabs: K,
141
141
  selectedIndex: C,
142
- onChange: O
142
+ onChange: F
143
143
  } },
144
- ...L && { tipSection: !rt && (L(st, n, G?.text, o) ?? !1) },
144
+ ...B && { tipSection: !rt && (B(st, n, j?.text, o) ?? !1) },
145
145
  transactionFilter: bt,
146
146
  onEachRowClick: (t) => {
147
- S({ transaction_guid: t }), R(!0);
147
+ D({ transaction_guid: t }), E(!0);
148
148
  }
149
- }), /* @__PURE__ */ r(Lt, {
149
+ }), /* @__PURE__ */ s(Lt, {
150
150
  ariaLabelClose: ot.close_aria,
151
151
  isOpen: nt,
152
152
  onClose: () => {
153
- R(!1), S({ transaction_guid: void 0 }), j();
153
+ E(!1), D({ transaction_guid: void 0 }), O();
154
154
  },
155
155
  title: n.general.transaction_details_title,
156
- children: /* @__PURE__ */ r(zt, { beat: s })
156
+ children: /* @__PURE__ */ s(zt, { beat: r })
157
157
  })] });
158
158
  });
159
159
  export {
160
- _e as TransactionHistoryBlock
160
+ Ce as TransactionHistoryBlock
161
161
  };
162
162
 
163
163
  //# sourceMappingURL=TransactionHistoryBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, Transaction } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { BarChartV2 } from '../../components/chartblocks/BarchartV2'\nimport { DoubleBarChart } from '../../components/chartblocks/DoubleBarChart'\nimport { EmptyBarChart } from '../../components/chartblocks/EmptyBarChart'\nimport { BAR_ARIA_LABEL } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport {\n COMPARISON_BAR_ARIA_LABEL,\n toLegendItems,\n} from '../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils'\n\nimport { TransactionDrillDown } from './TransactionDrillDown'\nimport { useTransactionHistory } from './useTransactionHistory'\nimport {\n getDefaultSelection,\n getDrillDownConfig,\n getFlattenedDataSeries,\n resolveDrillDownSubHeader,\n splitProjectedTransaction,\n toStoreFilter,\n} from './utils'\nimport {\n Drawer,\n useInsightsV2Store,\n useGlobalCopyStore,\n useGlobalUiStore,\n Loader,\n} from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\ninterface TransactionHistoryProp {\n beat: Beat\n}\n\nexport const TransactionHistoryBlock = observer(({ beat }: TransactionHistoryProp) => {\n const theme = useTheme()\n\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n\n const { insights_payload } = beat\n\n // The CTA that opened the drawer: its variant picks the view, and its drilldown_data feeds a\n // variant that reads its facts from the opener (Monthly Debt to Income). Only drilldown_data is passed\n // on: it is the payload's own object, stable across renders, while the opener may be rebuilt per call.\n const openedCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload?.primary_cta,\n insights_payload?.secondary_cta,\n insights_payload?.in_description_cta,\n )\n const dynamicCtaVariant = openedCta?.variant\n\n const {\n top,\n filterMode,\n header,\n colors,\n filterStrategy,\n tipSection,\n subTabAriaLabels,\n slotData,\n beatTransactions: resolveBeatTransactions,\n averageFormat,\n subTabs,\n boldLabel,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n\n const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(\n beat,\n { slotData, beatTransactions: resolveBeatTransactions },\n openedCta?.drilldown_data,\n )\n\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { isCopyLoaded } = useGlobalUiStore()\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n // `getFlattenedDataSeries` runs ahead of the copy-loaded guard below, hence the literal fallback.\n const { dataSeries, chartData, comparisonBars } = getFlattenedDataSeries({\n data: instanceSlotData?.data_series as DataSeries,\n ariaLabel:\n top === 'doubleBar'\n ? (insightsCopy?.general?.in_month_you_had_a_category_of_amount ??\n COMPARISON_BAR_ARIA_LABEL)\n : BAR_ARIA_LABEL,\n top,\n beatTransactions,\n })\n\n const isDoubleBar = top === 'doubleBar'\n const isTabsOnly = top === 'tabsOnly'\n // The drawer's columns (and tabs): the double bar's month pairs, or the single bar's bars.\n const bars = isDoubleBar ? comparisonBars : chartData\n\n const { chartBarIndex, subTabIndex } = getDefaultSelection({\n chartTabCount: chartData.length,\n comparisonTabCount: comparisonBars.length,\n actionDrawer,\n beatGuid: beat.guid,\n })\n\n const [selectedIndex, setSelectedIndex] = useState(chartBarIndex)\n // The double-bar drawer's series tab (0 = main, e.g. Spend; 1 = comparison, e.g. Income).\n const [subIndex, setSubIndex] = useState(subTabIndex)\n\n // Bars built from the transaction store (Upcoming Bill's paid bills) can arrive after the drawer\n // opens: re-select the default when the bar count changes. Payload-built bars never change count.\n const [defaultedTabCount, setDefaultedTabCount] = useState(bars.length)\n if (bars.length !== defaultedTabCount) {\n setDefaultedTabCount(bars.length)\n setSelectedIndex(chartBarIndex)\n }\n\n const resolveFilter = (index: number) =>\n filterStrategy({\n beat,\n beatTransactions,\n dataSeries,\n comparisonBars,\n selectedIndex: index,\n subIndex,\n isLastTab: index === bars.length - 1,\n instanceSlotData,\n spendCategoryGuids,\n displayedDateRange,\n })\n\n // Content keys for the effect deps: these arrays get a new identity every render (MEW-3732).\n const beatTransactionGuidsKey = beatTransactions.map((transaction) => transaction.guid).join(',')\n const spendCategoryGuidsKey = spendCategoryGuids.join(',')\n const allAccountGuidsKey = allAccountGuids.join(',')\n\n // Re-applied on selection change and when the nested details drawer closes: AddMerchantBudgetAction\n // overwrites transactionStore.filter and never restores it. Chartless tops filter with no bars.\n const canApplyFilter =\n top === 'list' || top === 'tabsOnly' || top === 'monthTabs' || dataSeries.length > 0\n const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store') return\n // A chart drawer with no bars can name no rows: fail closed rather than keep the store's default\n // (every account) or a previous drawer's filter.\n const filter = canApplyFilter\n ? resolveFilter(selectedIndex)\n : { accounts: [], custom: () => false }\n transactionStore.setFilter(toStoreFilter(filter, { allAccountGuids, displayedDateRange }))\n }\n\n // store variants route the selection through the shared store filter; local (upcomingBill) variants\n // filter beatTransactions directly, so there's nothing to push to the store for them.\n useLayoutEffect(() => {\n applyCurrentSelectionFilter()\n }, [\n beat.guid,\n selectedIndex,\n subIndex,\n filterMode,\n dataSeries.length,\n instanceSlotData,\n displayedDateRange,\n spendCategoryGuidsKey,\n allAccountGuidsKey,\n beatTransactionGuidsKey,\n top,\n ])\n\n const subHeader = resolveDrillDownSubHeader(insights_payload)\n\n const headerContent = header?.({\n title: insights_payload?.title,\n subHeader,\n categoryName,\n selectedDate: chartData[selectedIndex]?.date ?? undefined,\n slotData: instanceSlotData,\n })\n\n const barColors = colors(theme, instanceSlotData?.category_guid)\n\n if (!isCopyLoaded) return <Loader />\n\n // `legends` is the block's additional_data ([0] main, [1] second series), as BarchartBlock reads it.\n const [mainLegend, comparisonLegend] = instanceSlotData?.legends ?? []\n\n const transactionFilter =\n filterMode === 'local'\n ? (index: number) => resolveFilter(index).custom ?? (() => true)\n : undefined\n\n // Upcoming Bill appends a synthesized projected bill: it draws the last bar and its own labelled\n // row, but is never a plain list row or a CSV line.\n const { transactions: listTransactions, projectedTransaction } =\n splitProjectedTransaction(beatTransactions)\n\n const baseTransactions: Transaction[] | undefined =\n filterMode === 'local' ? listTransactions : undefined\n\n const projectedHeading = insightsCopy.general.projected_amount\n const projectedRow =\n projectedTransaction &&\n projectedHeading &&\n resolveFilter(selectedIndex).custom?.(projectedTransaction)\n ? { heading: projectedHeading, transaction: projectedTransaction }\n : undefined\n\n // A chart bar click selects its column (and, on the double bar, its series); a month tab change\n // selects the month. MUI Tabs only fires onChange on real user selection, not on mount. The\n // series (Spend / Income) tab fires its own analytics via the shared SubTabs component.\n const selectBar = (index: number, seriesIndex?: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.DRAWER_CHART_BAR_CLICKED)\n setSelectedIndex(index)\n if (seriesIndex !== undefined) setSubIndex(seriesIndex)\n }\n const selectMonth = (index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TAB_SELECTED)\n setSelectedIndex(index)\n }\n\n // Double bar: the Spend / Income labels come from copy (additional_data); the legend carries the\n // selected month's two totals, and its labels name the series tabs.\n const doubleBarLegends = isDoubleBar\n ? toLegendItems([\n { ...mainLegend, value: comparisonBars[selectedIndex]?.main },\n { ...comparisonLegend, value: comparisonBars[selectedIndex]?.comparison },\n ])\n : undefined\n\n // Legacy pulse named these tabs \"Spend transactions\" / \"Income transactions\" for screen readers.\n const seriesAriaLabels = subTabAriaLabels?.(insightsCopy) ?? []\n\n // The second tab row: the double bar's series, a tabs-only drawer's sides, or the variant's `subTabs`.\n const sideTabs = isDoubleBar\n ? (doubleBarLegends ?? []).map((legend, index) => ({\n label: legend.label,\n ariaLabel: seriesAriaLabels[index],\n }))\n : isTabsOnly\n ? dataSeries.flatMap((row) => (row.localized_label ? [{ label: row.localized_label }] : []))\n : (subTabs?.({ instanceSlotData, copy: insightsCopy }).map((label) => ({ label })) ?? [])\n\n const renderChart = () => {\n if (!bars.length) return <EmptyBarChart />\n\n return isDoubleBar ? (\n <DoubleBarChart\n bars={comparisonBars}\n boldLabel={boldLabel}\n colors={barColors}\n legendPosition=\"top\"\n legends={doubleBarLegends}\n onBarClick={selectBar}\n selectedIndex={selectedIndex}\n />\n ) : (\n <BarChartV2\n amounts={{\n average: instanceSlotData?.average_amount,\n formattedAverage: formatCurrency(\n instanceSlotData?.average_amount ?? 0,\n averageFormat ?? CURRENCY_FORMAT.cents,\n ),\n }}\n color={barColors[0] ?? theme.palette.primary.main}\n data={chartData}\n legendPosition=\"top\"\n // Figma's chart drawer: 172px of bars under the 24px legend, 200px in all.\n heightOverride={172}\n margin={{\n bottom: 8,\n top: 24,\n left: 24,\n right: 24,\n }}\n // TODO: Temporary fallback while the backend doesn't always send `legends` on every\n // beat/variant. Remove this once the backend guarantees `legends` on the payload.\n monthlyAmountLabel={mainLegend?.label ?? insightsCopy.general.monthly_amount}\n onBarClick={selectBar}\n selectedTabIndex={selectedIndex}\n trendAmountLabel={comparisonLegend?.label ?? insightsCopy.general.trend}\n />\n )\n }\n\n // `list` (Low Account Balance), `tabsOnly` (Non-Essential Category Summary) and `monthTabs`\n // (Monthly Subscription Aggregate) drawers have no chart above their transaction list.\n const chartTop =\n isDoubleBar || top === 'singleBar' || top === 'upcomingBill' ? renderChart() : null\n\n return (\n <>\n <TransactionDrillDown\n baseTransactions={baseTransactions}\n projectedRow={projectedRow}\n heading={headerContent?.heading}\n icon={headerContent?.icon}\n onSelectionChange={selectMonth}\n selectedIndex={selectedIndex}\n subHeadingText={headerContent?.subHeadingText}\n tabs={bars}\n top={chartTop}\n {...(sideTabs.length > 0 && {\n subTabs: { tabs: sideTabs, selectedIndex: subIndex, onChange: setSubIndex },\n })}\n {...(tipSection && {\n tipSection:\n !closeTipSection &&\n (tipSection(setCloseTipSection, insightsCopy, subHeader?.text, instanceSlotData) ??\n false),\n })}\n transactionFilter={transactionFilter}\n onEachRowClick={(guid) => {\n setActionContext({ transaction_guid: guid })\n setIsTransactionDetailsOpen(true)\n }}\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isTransactionDetailsOpen}\n onClose={() => {\n setIsTransactionDetailsOpen(false)\n // Clear only the key this nested drawer owns — setActionContext merges, so an\n // explicit `{}` would be a no-op and leave transaction_guid stuck in the shared\n // context, and the outer drawer's own context (e.g. chartBarIndex) must survive.\n setActionContext({ transaction_guid: undefined })\n // Re-apply this block's own filter: a further-nested AddMerchantBudgetAction drawer may\n // have overwritten transactionStore.filter (merchant_guid-only) without restoring it.\n applyCurrentSelectionFilter()\n }}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,KAA0B,GAAA,CAAU,EAAE,MAAA,EAAA,MAAmC;AACpF,QAAM,IAAQ,GAAS,GAEjB,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,GAAmB,GAExD,EAAE,kBAAA,EAAA,IAAqB,GAKvB,IAAY,GAChB,GACA,GAAkB,aAClB,GAAkB,eAClB,GAAkB,kBACpB,GACM,IAAoB,GAAW,SAE/B,EACJ,KAAA,GACA,YAAA,GACA,QAAA,GACA,QAAA,GACA,gBAAA,GACA,YAAA,GACA,kBAAA,GACA,UAAA,GACA,kBAAkB,GAClB,eAAA,GACA,SAAA,GACA,WAAA,EAAA,IACE,GAAmB,KAAqB,EAAE,GAExC,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,IACA,oBAAA,GACA,kBAAA,GAAA,IACE,GACF,GACA;AAAA,IAAE,UAAA;AAAA,IAAU,kBAAkB;AAAA,EAAwB,GACtD,GAAW,cACb,GAEM,EAAE,QAAQ,IAAY,eAAe,EAAA,IAAiB,GAAmB,GAEzE,EAAE,cAAA,GAAA,IAAiB,GAAiB,GAEpC,CAAC,IAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,IAAiB,EAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAGvC,EAAE,YAAA,GAAY,WAAA,GAAW,gBAAA,EAAA,IAA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AAAA,EACnE,CAAA,IAtCsB,gBAAA,EAAC,IAAD,CAAgB,CAAA,IA6CsC;AAEjF,SACE,gBAAA,GAAA,IAAA,EAAA,UAAA,CACE,gBAAA,EAAC,IAAD;AAAA,IACoB,kBAAA;AAAA,IACJ,cAAA;AAAA,IACd,SAAS,GAAe;AAAA,IACxB,MAAM,GAAe;AAAA,IACrB,mBAAmB;AAAA,IACJ,eAAA;AAAA,IACf,gBAAgB,GAAe;AAAA,IAC/B,MAAM;AAAA,IACN,KAAK;AAAA,IACL,GAAK,EAAS,SAAS,KAAK,EAC1B,SAAS;AAAA,MAAE,MAAM;AAAA,MAAU,eAAe;AAAA,MAAU,UAAU;AAAA,IAAY,EAC5E;AAAA,IACA,GAAK,KAAc,EACjB,YACE,CAAC,OACA,EAAW,IAAoB,GAAc,GAAW,MAAM,CAAgB,KAC7E,IACN;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,kBAAkB,EAAK,CAAC,GAC3C,EAA4B,EAAI;AAAA,IAClC;AAAA,EACD,CAAA,GACD,gBAAA,EAAC,IAAD;AAAA,IACE,gBAAgB,GAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAA4B,EAAK,GAIjC,EAAiB,EAAE,kBAAkB,OAAU,CAAC,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, Transaction } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { BarChartV2 } from '../../components/chartblocks/BarchartV2'\nimport { DoubleBarChart } from '../../components/chartblocks/DoubleBarChart'\nimport { EmptyBarChart } from '../../components/chartblocks/EmptyBarChart'\nimport { BAR_ARIA_LABEL } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport {\n COMPARISON_BAR_ARIA_LABEL,\n toLegendItems,\n} from '../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils'\n\nimport { TransactionDrillDown } from './TransactionDrillDown'\nimport { useTransactionHistory } from './useTransactionHistory'\nimport {\n getDefaultSelection,\n getDrillDownConfig,\n getFlattenedDataSeries,\n resolveDrillDownSubHeader,\n splitProjectedTransaction,\n toStoreFilter,\n} from './utils'\nimport {\n Drawer,\n useInsightsV2Store,\n useGlobalCopyStore,\n useGlobalUiStore,\n Loader,\n} from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { useOpenedCta } from '../useOpenedCta'\n\ninterface TransactionHistoryProp {\n beat: Beat\n}\n\nexport const TransactionHistoryBlock = observer(({ beat }: TransactionHistoryProp) => {\n const theme = useTheme()\n\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n\n const { insights_payload } = beat\n\n // The CTA that opened the drawer: its variant picks the view, and its drilldown_data feeds a\n // variant that reads its facts from the opener (Monthly Debt to Income). Only drilldown_data is passed\n // on: it is the payload's own object, stable across renders, while the opener may be rebuilt per render.\n const openedCta = useOpenedCta(beat)\n const dynamicCtaVariant = openedCta?.variant\n\n const {\n top,\n filterMode,\n header,\n colors,\n filterStrategy,\n tipSection,\n subTabAriaLabels,\n slotData,\n beatTransactions: resolveBeatTransactions,\n averageFormat,\n subTabs,\n boldLabel,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n\n const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(\n beat,\n { slotData, beatTransactions: resolveBeatTransactions },\n openedCta?.drilldown_data,\n )\n\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { isCopyLoaded } = useGlobalUiStore()\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n // `getFlattenedDataSeries` runs ahead of the copy-loaded guard below, hence the literal fallback.\n const { dataSeries, chartData, comparisonBars } = getFlattenedDataSeries({\n data: instanceSlotData?.data_series as DataSeries,\n ariaLabel:\n top === 'doubleBar'\n ? (insightsCopy?.general?.in_month_you_had_a_category_of_amount ??\n COMPARISON_BAR_ARIA_LABEL)\n : BAR_ARIA_LABEL,\n top,\n beatTransactions,\n })\n\n const isDoubleBar = top === 'doubleBar'\n const isTabsOnly = top === 'tabsOnly'\n // The drawer's columns (and tabs): the double bar's month pairs, or the single bar's bars.\n const bars = isDoubleBar ? comparisonBars : chartData\n\n const { chartBarIndex, subTabIndex } = getDefaultSelection({\n chartTabCount: chartData.length,\n comparisonTabCount: comparisonBars.length,\n actionDrawer,\n beatGuid: beat.guid,\n })\n\n const [selectedIndex, setSelectedIndex] = useState(chartBarIndex)\n // The double-bar drawer's series tab (0 = main, e.g. Spend; 1 = comparison, e.g. Income).\n const [subIndex, setSubIndex] = useState(subTabIndex)\n\n // Bars built from the transaction store (Upcoming Bill's paid bills) can arrive after the drawer\n // opens: re-select the default when the bar count changes. Payload-built bars never change count.\n const [defaultedTabCount, setDefaultedTabCount] = useState(bars.length)\n if (bars.length !== defaultedTabCount) {\n setDefaultedTabCount(bars.length)\n setSelectedIndex(chartBarIndex)\n }\n\n const resolveFilter = (index: number) =>\n filterStrategy({\n beat,\n beatTransactions,\n dataSeries,\n comparisonBars,\n selectedIndex: index,\n subIndex,\n isLastTab: index === bars.length - 1,\n instanceSlotData,\n spendCategoryGuids,\n displayedDateRange,\n })\n\n // Content keys for the effect deps: these arrays get a new identity every render (MEW-3732).\n const beatTransactionGuidsKey = beatTransactions.map((transaction) => transaction.guid).join(',')\n const spendCategoryGuidsKey = spendCategoryGuids.join(',')\n const allAccountGuidsKey = allAccountGuids.join(',')\n\n // Re-applied on selection change and when the nested details drawer closes: AddMerchantBudgetAction\n // overwrites transactionStore.filter and never restores it. Chartless tops filter with no bars.\n const canApplyFilter =\n top === 'list' || top === 'tabsOnly' || top === 'monthTabs' || dataSeries.length > 0\n const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store') return\n // A chart drawer with no bars can name no rows: fail closed rather than keep the store's default\n // (every account) or a previous drawer's filter.\n const filter = canApplyFilter\n ? resolveFilter(selectedIndex)\n : { accounts: [], custom: () => false }\n transactionStore.setFilter(toStoreFilter(filter, { allAccountGuids, displayedDateRange }))\n }\n\n // store variants route the selection through the shared store filter; local (upcomingBill) variants\n // filter beatTransactions directly, so there's nothing to push to the store for them.\n useLayoutEffect(() => {\n applyCurrentSelectionFilter()\n }, [\n beat.guid,\n selectedIndex,\n subIndex,\n filterMode,\n dataSeries.length,\n instanceSlotData,\n displayedDateRange,\n spendCategoryGuidsKey,\n allAccountGuidsKey,\n beatTransactionGuidsKey,\n top,\n ])\n\n const subHeader = resolveDrillDownSubHeader(insights_payload)\n\n const headerContent = header?.({\n title: insights_payload?.title,\n subHeader,\n categoryName,\n selectedDate: chartData[selectedIndex]?.date ?? undefined,\n slotData: instanceSlotData,\n })\n\n const barColors = colors(theme, instanceSlotData?.category_guid)\n\n if (!isCopyLoaded) return <Loader />\n\n // `legends` is the block's additional_data ([0] main, [1] second series), as BarchartBlock reads it.\n const [mainLegend, comparisonLegend] = instanceSlotData?.legends ?? []\n\n const transactionFilter =\n filterMode === 'local'\n ? (index: number) => resolveFilter(index).custom ?? (() => true)\n : undefined\n\n // Upcoming Bill appends a synthesized projected bill: it draws the last bar and its own labelled\n // row, but is never a plain list row or a CSV line.\n const { transactions: listTransactions, projectedTransaction } =\n splitProjectedTransaction(beatTransactions)\n\n const baseTransactions: Transaction[] | undefined =\n filterMode === 'local' ? listTransactions : undefined\n\n const projectedHeading = insightsCopy.general.projected_amount\n const projectedRow =\n projectedTransaction &&\n projectedHeading &&\n resolveFilter(selectedIndex).custom?.(projectedTransaction)\n ? { heading: projectedHeading, transaction: projectedTransaction }\n : undefined\n\n // A chart bar click selects its column (and, on the double bar, its series); a month tab change\n // selects the month. MUI Tabs only fires onChange on real user selection, not on mount. The\n // series (Spend / Income) tab fires its own analytics via the shared SubTabs component.\n const selectBar = (index: number, seriesIndex?: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.DRAWER_CHART_BAR_CLICKED)\n setSelectedIndex(index)\n if (seriesIndex !== undefined) setSubIndex(seriesIndex)\n }\n const selectMonth = (index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TAB_SELECTED)\n setSelectedIndex(index)\n }\n\n // Double bar: the Spend / Income labels come from copy (additional_data); the legend carries the\n // selected month's two totals, and its labels name the series tabs.\n const doubleBarLegends = isDoubleBar\n ? toLegendItems([\n { ...mainLegend, value: comparisonBars[selectedIndex]?.main },\n { ...comparisonLegend, value: comparisonBars[selectedIndex]?.comparison },\n ])\n : undefined\n\n // Legacy pulse named these tabs \"Spend transactions\" / \"Income transactions\" for screen readers.\n const seriesAriaLabels = subTabAriaLabels?.(insightsCopy) ?? []\n\n // The second tab row: the double bar's series, a tabs-only drawer's sides, or the variant's `subTabs`.\n const sideTabs = isDoubleBar\n ? (doubleBarLegends ?? []).map((legend, index) => ({\n label: legend.label,\n ariaLabel: seriesAriaLabels[index],\n }))\n : isTabsOnly\n ? dataSeries.flatMap((row) => (row.localized_label ? [{ label: row.localized_label }] : []))\n : (subTabs?.({ instanceSlotData, copy: insightsCopy }).map((label) => ({ label })) ?? [])\n\n const renderChart = () => {\n if (!bars.length) return <EmptyBarChart />\n\n return isDoubleBar ? (\n <DoubleBarChart\n bars={comparisonBars}\n boldLabel={boldLabel}\n colors={barColors}\n legendPosition=\"top\"\n legends={doubleBarLegends}\n onBarClick={selectBar}\n selectedIndex={selectedIndex}\n />\n ) : (\n <BarChartV2\n amounts={{\n average: instanceSlotData?.average_amount,\n formattedAverage: formatCurrency(\n instanceSlotData?.average_amount ?? 0,\n averageFormat ?? CURRENCY_FORMAT.cents,\n ),\n }}\n color={barColors[0] ?? theme.palette.primary.main}\n data={chartData}\n legendPosition=\"top\"\n // Figma's chart drawer: 172px of bars under the 24px legend, 200px in all.\n heightOverride={172}\n margin={{\n bottom: 8,\n top: 24,\n left: 24,\n right: 24,\n }}\n // TODO: Temporary fallback while the backend doesn't always send `legends` on every\n // beat/variant. Remove this once the backend guarantees `legends` on the payload.\n monthlyAmountLabel={mainLegend?.label ?? insightsCopy.general.monthly_amount}\n onBarClick={selectBar}\n selectedTabIndex={selectedIndex}\n trendAmountLabel={comparisonLegend?.label ?? insightsCopy.general.trend}\n />\n )\n }\n\n // `list` (Low Account Balance), `tabsOnly` (Non-Essential Category Summary) and `monthTabs`\n // (Monthly Subscription Aggregate) drawers have no chart above their transaction list.\n const chartTop =\n isDoubleBar || top === 'singleBar' || top === 'upcomingBill' ? renderChart() : null\n\n return (\n <>\n <TransactionDrillDown\n baseTransactions={baseTransactions}\n projectedRow={projectedRow}\n heading={headerContent?.heading}\n icon={headerContent?.icon}\n onSelectionChange={selectMonth}\n selectedIndex={selectedIndex}\n subHeadingText={headerContent?.subHeadingText}\n tabs={bars}\n top={chartTop}\n {...(sideTabs.length > 0 && {\n subTabs: { tabs: sideTabs, selectedIndex: subIndex, onChange: setSubIndex },\n })}\n {...(tipSection && {\n tipSection:\n !closeTipSection &&\n (tipSection(setCloseTipSection, insightsCopy, subHeader?.text, instanceSlotData) ??\n false),\n })}\n transactionFilter={transactionFilter}\n onEachRowClick={(guid) => {\n setActionContext({ transaction_guid: guid })\n setIsTransactionDetailsOpen(true)\n }}\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isTransactionDetailsOpen}\n onClose={() => {\n setIsTransactionDetailsOpen(false)\n // Clear only the key this nested drawer owns — setActionContext merges, so an\n // explicit `{}` would be a no-op and leave transaction_guid stuck in the shared\n // context, and the outer drawer's own context (e.g. chartBarIndex) must survive.\n setActionContext({ transaction_guid: undefined })\n // Re-apply this block's own filter: a further-nested AddMerchantBudgetAction drawer may\n // have overwritten transactionStore.filter (merchant_guid-only) without restoring it.\n applyCurrentSelectionFilter()\n }}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,KAA0B,GAAA,CAAU,EAAE,MAAA,EAAA,MAAmC;AACpF,QAAM,IAAQ,GAAS,GAEjB,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,GAAmB,GAExD,EAAE,kBAAA,EAAA,IAAqB,GAKvB,IAAY,GAAa,CAAI,GAC7B,IAAoB,GAAW,SAE/B,EACJ,KAAA,GACA,YAAA,GACA,QAAA,GACA,QAAA,GACA,gBAAA,GACA,YAAA,GACA,kBAAA,GACA,UAAA,GACA,kBAAkB,GAClB,eAAA,GACA,SAAA,GACA,WAAA,EAAA,IACE,GAAmB,KAAqB,EAAE,GAExC,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,IACA,oBAAA,GACA,kBAAA,GAAA,IACE,GACF,GACA;AAAA,IAAE,UAAA;AAAA,IAAU,kBAAkB;AAAA,EAAwB,GACtD,GAAW,cACb,GAEM,EAAE,QAAQ,IAAY,eAAe,EAAA,IAAiB,GAAmB,GAEzE,EAAE,cAAA,GAAA,IAAiB,GAAiB,GAEpC,CAAC,IAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,IAAiB,EAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAGvC,EAAE,YA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ClB,kBAAkB,GAAkB,SAAS,EAAa,QAAQ;AAAA,EACnE,CAAA,IAtCsB,gBAAA,EAAC,IAAD,CAAgB,CAAA,IA6CsC;AAEjF,SACE,gBAAA,GAAA,IAAA,EAAA,UAAA,CACE,gBAAA,EAAC,IAAD;AAAA,IACoB,kBAAA;AAAA,IACJ,cAAA;AAAA,IACd,SAAS,GAAe;AAAA,IACxB,MAAM,GAAe;AAAA,IACrB,mBAAmB;AAAA,IACJ,eAAA;AAAA,IACf,gBAAgB,GAAe;AAAA,IAC/B,MAAM;AAAA,IACN,KAAK;AAAA,IACL,GAAK,EAAS,SAAS,KAAK,EAC1B,SAAS;AAAA,MAAE,MAAM;AAAA,MAAU,eAAe;AAAA,MAAU,UAAU;AAAA,IAAY,EAC5E;AAAA,IACA,GAAK,KAAc,EACjB,YACE,CAAC,OACA,EAAW,IAAoB,GAAc,GAAW,MAAM,CAAgB,KAC7E,IACN;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,kBAAkB,EAAK,CAAC,GAC3C,EAA4B,EAAI;AAAA,IAClC;AAAA,EACD,CAAA,GACD,gBAAA,EAAC,IAAD;AAAA,IACE,gBAAgB,GAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAA4B,EAAK,GAIjC,EAAiB,EAAE,kBAAkB,OAAU,CAAC,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
@@ -1,17 +1,17 @@
1
- import { useInsightsV2Store as d, useTransactionStore as m } from "../../../common/context/hooks.es.js";
2
- import { asGuidList as p } from "../../blocks/slotReaders.es.js";
3
- import { getDrillDownConfig as f } from "./utils.es.js";
4
- import { getDynamicCtaBasedOnTriggers as g } from "../util.es.js";
5
- import l from "react";
6
- var h = ({ beat: t }) => {
7
- const { isTransactionDataLoaded: s, loadMissingTransactionData: n, loadTransactionsByGuids: r } = m(), { actionDrawer: c } = d();
8
- l.useEffect(() => {
9
- const a = t?.insights_payload, o = g(c, a?.primary_cta, a?.secondary_cta, a?.in_description_cta), { fetchMissingTransactions: e } = f(o?.variant ?? ""), i = p(e?.(t, o?.drilldown_data));
10
- (async () => (s || await n(), i && await r(i)))();
1
+ import { useTransactionStore as e } from "../../../common/context/hooks.es.js";
2
+ import { asGuidList as c } from "../../blocks/slotReaders.es.js";
3
+ import { getDrillDownConfig as d } from "./utils.es.js";
4
+ import { useOpenedCta as f } from "../useOpenedCta.es.js";
5
+ import m from "react";
6
+ var D = ({ beat: a }) => {
7
+ const { isTransactionDataLoaded: i, loadMissingTransactionData: s, loadTransactionsByGuids: n } = e(), o = f(a);
8
+ m.useEffect(() => {
9
+ const { fetchMissingTransactions: r } = d(o?.variant ?? ""), t = c(r?.(a, o?.drilldown_data));
10
+ (async () => (i || await s(), t && await n(t)))();
11
11
  }, []);
12
12
  };
13
13
  export {
14
- h as useTransactionHistoryPrepare
14
+ D as useTransactionHistoryPrepare
15
15
  };
16
16
 
17
17
  //# sourceMappingURL=useTransactionHistoryPrepare.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTransactionHistoryPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useInsightsV2Store, useTransactionStore } from '../../../common'\nimport { asGuidList } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { getDrillDownConfig } from './utils'\n\n/**\n * Open-time load for the Transaction History drawer. The list reads `detailedTransactions`, which\n * stays empty until beats, tags, taggings, rules and transactions are all loaded; a feed that never\n * mounted the transactions module has none of them. Loads only the missing pieces, so a host that\n * seeded any of them through `GlobalStore.loadData` keeps what it seeded.\n */\nexport const useTransactionHistoryPrepare = ({ beat }: ActionBlockProps) => {\n const { isTransactionDataLoaded, loadMissingTransactionData, loadTransactionsByGuids } =\n useTransactionStore()\n const { actionDrawer } = useInsightsV2Store()\n\n React.useEffect(() => {\n // A drawer whose registry entry names `fetchMissingTransactions` (Upcoming Bill) also fetches by\n // guid the transactions it returns that the store lacks, so each older paid bill gets its bar.\n const payload = beat?.insights_payload\n const openedCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload?.primary_cta,\n payload?.secondary_cta,\n payload?.in_description_cta,\n )\n const { fetchMissingTransactions } = getDrillDownConfig(openedCta?.variant ?? '')\n // The same narrowing the drawer applies, so the fetch and the chart agree on a valid guid list.\n const guids = asGuidList(fetchMissingTransactions?.(beat, openedCta?.drilldown_data))\n\n // The window load replaces the store's transactions, so it finishes before the by-guid fetch\n // adds the older ones; run together, it could wipe them out.\n const load = async () => {\n if (!isTransactionDataLoaded) await loadMissingTransactionData()\n if (guids) await loadTransactionsByGuids(guids)\n }\n void load()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n"],"mappings":";;;;;AAcA,IAAa,IAAA,CAAgC,EAAE,MAAA,EAAA,MAA6B;AAC1E,QAAM,EAAE,yBAAA,GAAyB,4BAAA,GAA4B,yBAAA,EAAA,IAC3D,EAAoB,GAChB,EAAE,cAAA,EAAA,IAAiB,EAAmB;AAE5C,EAAA,EAAM,UAAA,MAAgB;AAGpB,UAAM,IAAU,GAAM,kBAChB,IAAY,EAChB,GACA,GAAS,aACT,GAAS,eACT,GAAS,kBACX,GACM,EAAE,0BAAA,EAAA,IAA6B,EAAmB,GAAW,WAAW,EAAE,GAE1E,IAAQ,EAAW,IAA2B,GAAM,GAAW,cAAc,CAAC;AAQpF,KAJa,aACN,KAAyB,MAAM,EAA2B,GAC3D,KAAO,MAAM,EAAwB,CAAK;AAAA,EAIlD,GAAG,CAAC,CAAC;AACP"}
1
+ {"version":3,"file":"useTransactionHistoryPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useTransactionStore } from '../../../common'\nimport { asGuidList } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { getDrillDownConfig } from './utils'\n\n/**\n * Open-time load for the Transaction History drawer. The list reads `detailedTransactions`, which\n * stays empty until beats, tags, taggings, rules and transactions are all loaded; a feed that never\n * mounted the transactions module has none of them. Loads only the missing pieces, so a host that\n * seeded any of them through `GlobalStore.loadData` keeps what it seeded.\n */\nexport const useTransactionHistoryPrepare = ({ beat }: ActionBlockProps) => {\n const { isTransactionDataLoaded, loadMissingTransactionData, loadTransactionsByGuids } =\n useTransactionStore()\n const openedCta = useOpenedCta(beat)\n\n React.useEffect(() => {\n // A drawer whose registry entry names `fetchMissingTransactions` (Upcoming Bill) also fetches by\n // guid the transactions it returns that the store lacks, so each older paid bill gets its bar.\n const { fetchMissingTransactions } = getDrillDownConfig(openedCta?.variant ?? '')\n // The same narrowing the drawer applies, so the fetch and the chart agree on a valid guid list.\n const guids = asGuidList(fetchMissingTransactions?.(beat, openedCta?.drilldown_data))\n\n // The window load replaces the store's transactions, so it finishes before the by-guid fetch\n // adds the older ones; run together, it could wipe them out.\n const load = async () => {\n if (!isTransactionDataLoaded) await loadMissingTransactionData()\n if (guids) await loadTransactionsByGuids(guids)\n }\n void load()\n // Fetches once on open with the CTA the drawer opened with.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n"],"mappings":";;;;;AAcA,IAAa,IAAA,CAAgC,EAAE,MAAA,EAAA,MAA6B;AAC1E,QAAM,EAAE,yBAAA,GAAyB,4BAAA,GAA4B,yBAAA,EAAA,IAC3D,EAAoB,GAChB,IAAY,EAAa,CAAI;AAEnC,EAAA,EAAM,UAAA,MAAgB;AAGpB,UAAM,EAAE,0BAAA,EAAA,IAA6B,EAAmB,GAAW,WAAW,EAAE,GAE1E,IAAQ,EAAW,IAA2B,GAAM,GAAW,cAAc,CAAC;AAQpF,KAJa,aACN,KAAyB,MAAM,EAA2B,GAC3D,KAAO,MAAM,EAAwB,CAAK;AAAA,EAKlD,GAAG,CAAC,CAAC;AACP"}
@@ -1,104 +1,104 @@
1
- import { useAccountStore as V, useGlobalCopyStore as $, useInsightsV2Store as P, useTransactionStore as z } from "../../../common/context/hooks.es.js";
1
+ import { useAccountStore as E, useGlobalCopyStore as q, useInsightsV2Store as F, useTransactionStore as U } from "../../../common/context/hooks.es.js";
2
2
  import g from "../../../common/components/drawer/Drawer.es.js";
3
- import W from "../../../transactions/components/shared/TransactionList.es.js";
4
- import { selectTransactionsByGuids as J } from "../../CommonUtils.es.js";
5
- import { frequencyWord as K } from "../../components/SubscriptionStatus/subscriptionFrequency.es.js";
6
- import { getDynamicCtaBasedOnTriggers as Q } from "../util.es.js";
7
- import { TransactionDetailsBlock as X } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
8
- import { useRecurringTransactionPrepare as Y } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
9
- import { RecurringTransactionBlock as Z } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
10
- import { HelpBlock as tt } from "../HelpBlock/HelpBlock.es.js";
11
- import { ACCOUNT_SUBLINE_VARIANTS as nt, TRANSACTION_LIST_VARIANTS as ot, readHelpHeader as rt, readSubscriptionHeader as et, readSummary as it, readTransactionFrequencies as st } from "./layout.es.js";
12
- import { TransactionAccountSubline as at } from "./TransactionAccountSubline.es.js";
13
- import { TransactionListHelpHeader as ct } from "./TransactionListHelpHeader.es.js";
14
- import { TransactionListSubscriptionHeader as lt } from "./TransactionListSubscriptionHeader.es.js";
15
- import { TransactionListSummaryCard as dt } from "./TransactionListSummaryCard.es.js";
3
+ import V from "../../../transactions/components/shared/TransactionList.es.js";
4
+ import { selectTransactionsByGuids as $ } from "../../CommonUtils.es.js";
5
+ import { frequencyWord as P } from "../../components/SubscriptionStatus/subscriptionFrequency.es.js";
6
+ import { useOpenedCta as z } from "../useOpenedCta.es.js";
7
+ import { TransactionDetailsBlock as W } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
8
+ import { useRecurringTransactionPrepare as J } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
9
+ import { RecurringTransactionBlock as K } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
10
+ import { HelpBlock as Q } from "../HelpBlock/HelpBlock.es.js";
11
+ import { ACCOUNT_SUBLINE_VARIANTS as X, TRANSACTION_LIST_VARIANTS as Y, readHelpHeader as Z, readSubscriptionHeader as tt, readSummary as nt, readTransactionFrequencies as ot } from "./layout.es.js";
12
+ import { TransactionAccountSubline as et } from "./TransactionAccountSubline.es.js";
13
+ import { TransactionListHelpHeader as rt } from "./TransactionListHelpHeader.es.js";
14
+ import { TransactionListSubscriptionHeader as it } from "./TransactionListSubscriptionHeader.es.js";
15
+ import { TransactionListSummaryCard as st } from "./TransactionListSummaryCard.es.js";
16
16
  import f from "react";
17
- import { observer as ut } from "mobx-react-lite";
18
- import { Text as pt } from "@mxenabled/mxui";
19
- import { Fragment as mt, jsx as t, jsxs as _t } from "react/jsx-runtime";
20
- var gt = (o) => Array.isArray(o) && o.every((n) => typeof n == "string"), ft = (o, n) => {
21
- const s = o.insights_payload?.drilldown_data, a = o.insights_payload?.instance_slot_data ?? {}, [c, l] = n && Object.hasOwn(n, "transaction_guids") ? ["cta.drilldown_data", n.transaction_guids] : s && Object.hasOwn(s, "transaction_guids") ? ["drilldown_data", s.transaction_guids] : ["instance_slot_data", a.transaction_guids];
22
- if (l != null) {
23
- if (gt(l)) return l;
24
- console.warn(`[TransactionListBlock] ${c}.transaction_guids is not a list of guids — listing no transactions.`);
17
+ import { observer as at } from "mobx-react-lite";
18
+ import { Text as ct } from "@mxenabled/mxui";
19
+ import { Fragment as lt, jsx as t, jsxs as dt } from "react/jsx-runtime";
20
+ var ut = (o) => Array.isArray(o) && o.every((n) => typeof n == "string"), pt = (o, n) => {
21
+ const s = o.insights_payload?.drilldown_data, a = o.insights_payload?.instance_slot_data ?? {}, [l, c] = n && Object.hasOwn(n, "transaction_guids") ? ["cta.drilldown_data", n.transaction_guids] : s && Object.hasOwn(s, "transaction_guids") ? ["drilldown_data", s.transaction_guids] : ["instance_slot_data", a.transaction_guids];
22
+ if (c != null) {
23
+ if (ut(c)) return c;
24
+ console.warn(`[TransactionListBlock] ${l}.transaction_guids is not a list of guids — listing no transactions.`);
25
25
  }
26
- }, Tt = (o) => (Y(o), /* @__PURE__ */ t(Z, { ...o })), Mt = ut(function({ beat: n }) {
27
- const { common: s, insights_feed: a, recurring: c } = $(), { actionDrawer: l, setActionContext: T } = P(), w = z(), x = V(), [A, S] = f.useState(!1), [b, y] = f.useState(!1), { primary_cta: H, secondary_cta: I, in_description_cta: B, is_zero_state: k, drilldown_data: D, title: R } = n.insights_payload ?? {}, r = Q(l, H, I, B), u = ft(n, r?.drilldown_data), h = J(w.detailedTransactions, u), p = it(r), G = p?.count ?? u?.length ?? 0, m = !k && (u?.length ?? 0) > 0, N = p !== void 0 && m, d = rt(r, D), C = m ? et(r) : void 0, M = nt.has(r?.variant) ? (e) => /* @__PURE__ */ t(at, {
28
- institutionGuid: x.accounts.find(({ guid: i }) => i === e.account_guid)?.institution_guid,
29
- transaction: e
30
- }) : void 0, v = m ? st(r) : void 0, j = v ? (e) => {
31
- const i = K(c, v.get(e.guid));
32
- return i ? /* @__PURE__ */ t(pt, {
26
+ }, mt = (o) => (J(o), /* @__PURE__ */ t(K, { ...o })), Rt = at(function({ beat: n }) {
27
+ const { common: s, insights_feed: a, recurring: l } = q(), { setActionContext: c } = F(), O = U(), x = E(), [A, T] = f.useState(!1), [w, S] = f.useState(!1), { is_zero_state: H, drilldown_data: b, title: I } = n.insights_payload ?? {}, e = z(n), u = pt(n, e?.drilldown_data), h = $(O.detailedTransactions, u), p = nt(e), k = p?.count ?? u?.length ?? 0, m = !H && (u?.length ?? 0) > 0, B = p !== void 0 && m, d = Z(e, b), y = m ? tt(e) : void 0, R = X.has(e?.variant) ? (r) => /* @__PURE__ */ t(et, {
28
+ institutionGuid: x.accounts.find(({ guid: i }) => i === r.account_guid)?.institution_guid,
29
+ transaction: r
30
+ }) : void 0, C = m ? ot(e) : void 0, G = C ? (r) => {
31
+ const i = P(l, C.get(r.guid));
32
+ return i ? /* @__PURE__ */ t(ct, {
33
33
  bold: !0,
34
34
  color: "text.secondary",
35
35
  sx: { textTransform: "uppercase" },
36
36
  variant: "caption",
37
37
  children: i
38
38
  }) : null;
39
- } : void 0, [_, L] = f.useState(null), E = r?.variant === ot.SUBSCRIPTION_LIST, q = (e) => {
40
- const i = E ? h.find((U) => U.guid === e)?.repeating_transaction_guid : void 0;
39
+ } : void 0, [_, v] = f.useState(null), D = e?.variant === Y.SUBSCRIPTION_LIST, N = (r) => {
40
+ const i = D ? h.find((j) => j.guid === r)?.repeating_transaction_guid : void 0;
41
41
  if (i) {
42
- L(i);
42
+ v(i);
43
43
  return;
44
44
  }
45
- T({ transaction_guid: e }), S(!0);
46
- }, O = () => L(null), F = () => {
47
- S(!1), T({ transaction_guid: void 0 });
45
+ c({ transaction_guid: r }), T(!0);
46
+ }, L = () => v(null), M = () => {
47
+ T(!1), c({ transaction_guid: void 0 });
48
48
  };
49
- return /* @__PURE__ */ _t(mt, { children: [
50
- N && /* @__PURE__ */ t(dt, {
49
+ return /* @__PURE__ */ dt(lt, { children: [
50
+ B && /* @__PURE__ */ t(st, {
51
51
  copy: a.general,
52
- count: G,
52
+ count: k,
53
53
  summary: p
54
54
  }),
55
- C && /* @__PURE__ */ t(lt, {
55
+ y && /* @__PURE__ */ t(it, {
56
56
  copy: a.transaction_list_block ?? {},
57
- header: C,
57
+ header: y,
58
58
  tipTitle: a.general.tip_section_title
59
59
  }),
60
- d && /* @__PURE__ */ t(ct, {
60
+ d && /* @__PURE__ */ t(rt, {
61
61
  descriptionHtml: d.descriptionHtml,
62
62
  learnMoreLabel: d.learnMore?.label,
63
- onLearnMore: () => y(!0),
64
- title: R ?? ""
63
+ onLearnMore: () => S(!0),
64
+ title: I ?? ""
65
65
  }),
66
- /* @__PURE__ */ t(W, {
67
- onClick: q,
68
- renderAmountCaption: j,
69
- renderSecondaryText: M,
66
+ /* @__PURE__ */ t(V, {
67
+ onClick: N,
68
+ renderAmountCaption: G,
69
+ renderSecondaryText: R,
70
70
  transaction: h
71
71
  }),
72
72
  d?.learnMore && /* @__PURE__ */ t(g, {
73
73
  ariaLabelClose: s.close_aria,
74
- isOpen: b,
75
- onClose: () => y(!1),
74
+ isOpen: w,
75
+ onClose: () => S(!1),
76
76
  title: d.learnMore.label,
77
- children: /* @__PURE__ */ t(tt, { beat: n })
77
+ children: /* @__PURE__ */ t(Q, { beat: n })
78
78
  }),
79
79
  /* @__PURE__ */ t(g, {
80
80
  ariaLabelClose: s.close_aria,
81
81
  isOpen: A,
82
- onClose: F,
82
+ onClose: M,
83
83
  title: a.general.transaction_details_title,
84
- children: /* @__PURE__ */ t(X, { beat: n })
84
+ children: /* @__PURE__ */ t(W, { beat: n })
85
85
  }),
86
86
  /* @__PURE__ */ t(g, {
87
- ariaLabelClose: c.close_drawer_aria,
87
+ ariaLabelClose: l.close_drawer_aria,
88
88
  isOpen: _ !== null,
89
- onClose: O,
90
- title: c.expense_details,
91
- children: _ && /* @__PURE__ */ t(Tt, {
89
+ onClose: L,
90
+ title: l.expense_details,
91
+ children: _ && /* @__PURE__ */ t(mt, {
92
92
  beat: n,
93
93
  layout: "insights",
94
- onDeleted: O,
94
+ onDeleted: L,
95
95
  repeatingTransactionGuid: _
96
96
  })
97
97
  })
98
98
  ] });
99
99
  });
100
100
  export {
101
- Mt as TransactionListBlock
101
+ Rt as TransactionListBlock
102
102
  };
103
103
 
104
104
  //# sourceMappingURL=TransactionListBlock.es.js.map