@mx-cartographer/experiences 9.7.159 → 9.7.160

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 (49) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/common/components/ErrorBoundary.d.ts +1 -0
  3. package/dist/common/components/ErrorBoundary.es.js +1 -1
  4. package/dist/common/components/ErrorBoundary.es.js.map +1 -1
  5. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +2 -0
  6. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +39 -39
  7. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/AccountListBlock/index.d.ts +1 -1
  9. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +40 -35
  10. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
  11. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.d.ts +2 -0
  12. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +73 -74
  13. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/index.d.ts +1 -1
  15. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.d.ts +2 -0
  16. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +20 -21
  17. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -1
  18. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/index.d.ts +1 -1
  19. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.d.ts +2 -0
  20. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +36 -38
  21. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/index.d.ts +1 -1
  23. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.d.ts +2 -0
  24. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +29 -30
  25. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
  26. package/dist/insights-v2/actionBlocks/OverdraftBlock/index.d.ts +1 -1
  27. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.d.ts +2 -0
  28. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +60 -59
  29. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
  30. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/index.d.ts +1 -1
  31. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.d.ts +2 -0
  32. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +20 -20
  33. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
  34. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/index.d.ts +1 -1
  35. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
  36. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +2 -0
  37. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +36 -36
  38. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  39. package/dist/insights-v2/actionBlocks/RemainingCashBlock/index.d.ts +1 -1
  40. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.d.ts +2 -1
  41. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +77 -76
  42. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  43. package/dist/insights-v2/actionBlocks/useRequiredCopy.d.ts +3 -0
  44. package/dist/insights-v2/actionBlocks/useRequiredCopy.es.js +11 -0
  45. package/dist/insights-v2/actionBlocks/useRequiredCopy.es.js.map +1 -0
  46. package/dist/insights-v2/mappings/blocks.d.ts +1 -0
  47. package/dist/insights-v2/mappings/blocks.es.js +190 -178
  48. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  49. package/package.json +1 -1
@@ -1,78 +1,78 @@
1
1
  import { CategoryGuids as f } from "../../../core/constants/Category.es.js";
2
2
  import { DEFAULT_INSTITUTION_LOGO_URL as h } from "../../../core/constants/InstitutionLogo.es.js";
3
3
  import _ from "../../../common/utils/AccountDisplayName.es.js";
4
- import { useAccountStore as y, useAppConfig as C, useCashflowStore as x, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
4
+ import { useAccountStore as y, useAppConfig as C, useCashflowStore as x } from "../../../common/context/hooks.es.js";
5
5
  import { getAccountStartingBalance as R } from "../../../core/utils/AccountUtils.es.js";
6
6
  import T from "../../../common/components/Loader.es.js";
7
- import { BlockErrorMessage as E } from "../BlockErrorMessage.es.js";
8
- import i from "../../components/CategoryTile.es.js";
7
+ import a from "../../components/CategoryTile.es.js";
8
+ import { useRequiredCopy as G } from "../useRequiredCopy.es.js";
9
9
  import { ErrorCard as L } from "../../components/ErrorCard.es.js";
10
- import { useRecurringExpensesLoadState as U } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
11
- import { foldOtherRows as r, getCaption as A } from "./layout.es.js";
12
- import I from "./RemainingCashContent.es.js";
13
- import { observer as O } from "mobx-react-lite";
14
- import { InstitutionLogo as a } from "@mxenabled/mxui";
10
+ import { useRecurringExpensesLoadState as E } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
11
+ import { foldOtherRows as r, getCaption as U } from "./layout.es.js";
12
+ import A from "./RemainingCashContent.es.js";
13
+ import { observer as I } from "mobx-react-lite";
14
+ import { InstitutionLogo as s } from "@mxenabled/mxui";
15
15
  import { jsx as t } from "react/jsx-runtime";
16
- var J = O(function(b) {
17
- const { insights_feed: s } = G(), { config: m } = C(), { uiStore: n } = x(), { accountsLoaded: c } = y(), { failed: u, ready: p, retry: d } = U(), e = s?.remaining_cash;
18
- if (!e) return /* @__PURE__ */ t(E, {});
16
+ var O = (i) => i.insights_feed?.remaining_cash, J = I(function(w) {
17
+ const { config: m } = C(), { uiStore: n } = x(), { accountsLoaded: c } = y(), { failed: u, ready: p, retry: d } = E(), o = G(O);
19
18
  if (u) return /* @__PURE__ */ t(L, { onRetry: d });
20
19
  if (!p || !c) return /* @__PURE__ */ t(T, {});
21
- const g = r(n.selectedCashAccounts.map((o) => ({
22
- amount: R(o, m.display_available_balance_in_accounts),
23
- key: o.guid,
24
- leading: /* @__PURE__ */ t(a, {
20
+ const g = r(n.selectedCashAccounts.map((e) => ({
21
+ amount: R(e, m.display_available_balance_in_accounts),
22
+ key: e.guid,
23
+ leading: /* @__PURE__ */ t(s, {
25
24
  alt: "",
26
- institutionGuid: o.institution_guid ?? "",
25
+ institutionGuid: e.institution_guid ?? "",
27
26
  size: 32
28
27
  }),
29
- name: _(o)
28
+ name: _(e)
30
29
  })), {
31
- multi: e.other_accounts,
32
- one: e.other_accounts_one
33
- }, /* @__PURE__ */ t(a, {
30
+ multi: o.other_accounts,
31
+ one: o.other_accounts_one
32
+ }, /* @__PURE__ */ t(s, {
34
33
  alt: "",
35
34
  institutionGuid: "",
36
35
  logoUrl: h,
37
36
  size: 32
38
- })), l = r(n.expensesTilNextIncome.map((o) => ({
39
- amount: o.amount,
40
- key: `${o.repeatingTransactionGuid}-${o.expectedDate.getTime()}`,
41
- leading: /* @__PURE__ */ t(i, {
42
- categoryGuid: o.categoryGuid,
37
+ })), l = r(n.expensesTilNextIncome.map((e) => ({
38
+ amount: e.amount,
39
+ key: `${e.repeatingTransactionGuid}-${e.expectedDate.getTime()}`,
40
+ leading: /* @__PURE__ */ t(a, {
41
+ categoryGuid: e.categoryGuid,
43
42
  size: 32
44
43
  }),
45
- name: o.name
44
+ name: e.name
46
45
  })), {
47
- multi: e.other_expenses,
48
- one: e.other_expenses_one
49
- }, /* @__PURE__ */ t(i, {
46
+ multi: o.other_expenses,
47
+ one: o.other_expenses_one
48
+ }, /* @__PURE__ */ t(a, {
50
49
  categoryGuid: f.UNCATEGORIZED,
51
50
  size: 32
52
51
  }));
53
- return /* @__PURE__ */ t(I, {
52
+ return /* @__PURE__ */ t(A, {
54
53
  accounts: {
55
- header: e.accounts_header,
54
+ header: o.accounts_header,
56
55
  rows: g
57
56
  },
58
57
  expenses: {
59
- header: e.recurring_expenses_header,
58
+ header: o.recurring_expenses_header,
60
59
  rows: l
61
60
  },
62
61
  summary: {
63
62
  remaining: n.hasUpcomingPayday ? {
64
63
  amount: n.remainingUntilPayday,
65
- caption: A(e, n.daysUntilNextIncome)
64
+ caption: U(o, n.daysUntilNextIncome)
66
65
  } : void 0,
67
66
  cashOnHand: n.selectedCashBalance,
68
- cashOnHandLabel: e.cash_on_hand,
67
+ cashOnHandLabel: o.cash_on_hand,
69
68
  upcomingExpenses: n.upcomingExpensesTotal,
70
- upcomingExpensesLabel: e.upcoming_expenses
69
+ upcomingExpensesLabel: o.upcoming_expenses
71
70
  }
72
71
  });
73
72
  });
74
73
  export {
75
- J as RemainingCashBlock
74
+ J as RemainingCashBlock,
75
+ O as selectRemainingCashCopy
76
76
  };
77
77
 
78
78
  //# sourceMappingURL=RemainingCashBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import { InstitutionLogo } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n if (!copy) return <BlockErrorMessage />\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,eAAe,EAAA,IAAqB,EAAmB,GACzD,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB,GACrC,EAAE,QAAA,GAAQ,OAAA,GAAO,OAAA,EAAA,IAAU,EAA8B,GACzD,IAAO,GAAkB;AAE/B,MAAI,CAAC,EAAM,QAAO,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAEtC,MAAI,EAAQ,QAAO,gBAAA,EAAC,GAAD,EAAW,SAAS,EAAQ,CAAA;AAG/C,MAAI,CAAC,KAAS,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAE/C,QAAM,IAAc,EAClB,EAAQ,qBAAqB,IAAA,CAAK,OAAa;AAAA,IAC7C,QAAQ,EAA0B,GAAS,EAAO,qCAAqC;AAAA,IACvF,KAAK,EAAQ;AAAA,IAEb,SACE,gBAAA,EAAC,GAAD;AAAA,MA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A;AAEL,CAAC"}
1
+ {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import { InstitutionLogo } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useAccountStore, useAppConfig, useCashflowStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport type { GlobalCopy } from '../../../core'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\nexport const selectRemainingCashCopy = (copy: GlobalCopy) => copy.insights_feed?.remaining_cash\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = useRequiredCopy(selectRemainingCashCopy)\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,IAAa,IAAA,CAA2B,MAAqB,EAAK,eAAe,gBAGpE,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB,GACrC,EAAE,QAAA,GAAQ,OAAA,GAAO,OAAA,EAAA,IAAU,EAA8B,GACzD,IAAO,EAAgB,CAAuB;AAEpD,MAAI,EAAQ,QAAO,gBAAA,EAAC,GAAD,EAAW,SAAS,EAAQ,CAAA;AAG/C,MAAI,CAAC,KAAS,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAE/C,QAAM,IAAc,EAClB,EAAQ,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ACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
@@ -1 +1 @@
1
- export { RemainingCashBlock } from './RemainingCashBlock';
1
+ export { RemainingCashBlock, selectRemainingCashCopy } from './RemainingCashBlock';
@@ -1,7 +1,8 @@
1
- import { Beat } from '../../../core';
1
+ import { Beat, GlobalCopy } from '../../../core';
2
2
  interface TransactionHistoryProp {
3
3
  beat: Beat;
4
4
  }
5
+ export declare const selectTransactionHistoryCopy: (copy: GlobalCopy) => import('../../../core').InsightsFeedCopy;
5
6
  export declare const TransactionHistoryBlock: (({ beat }: TransactionHistoryProp) => import("react/jsx-runtime").JSX.Element) & {
6
7
  displayName: string;
7
8
  };
@@ -1,116 +1,116 @@
1
1
  import { useGlobalCopyStore as yt, useInsightsV2Store as At } from "../../../common/context/hooks.es.js";
2
- import { CURRENCY_FORMAT as Dt, formatCurrency as Bt } from "../../../core/utils/NumberFormatting.es.js";
3
- import vt from "../../../common/components/drawer/Drawer.es.js";
4
- import { BlockErrorMessage as St } from "../BlockErrorMessage.es.js";
5
- import { BAR_ARIA_LABEL as Lt } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
6
- import { BarChartV2 as It } from "../../components/chartblocks/BarchartV2.es.js";
7
- import { EmptyBarChart as Et } from "../../components/chartblocks/EmptyBarChart.es.js";
2
+ import { CURRENCY_FORMAT as Dt, formatCurrency as vt } from "../../../core/utils/NumberFormatting.es.js";
3
+ import Bt from "../../../common/components/drawer/Drawer.es.js";
4
+ import { BAR_ARIA_LABEL as St } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
5
+ import { BarChartV2 as Lt } from "../../components/chartblocks/BarchartV2.es.js";
6
+ import { EmptyBarChart as It } from "../../components/chartblocks/EmptyBarChart.es.js";
8
7
  import { ANALYTICS_EVENTS_CONFIG as P } from "../../analytics/analyticsEventsConfig.es.js";
9
8
  import { useAnalyticsEvent as Rt } from "../../analytics/useAnalyticsEvent.es.js";
10
- import { DoubleBarChart as xt } from "../../components/chartblocks/DoubleBarChart.es.js";
11
- import { toLegendItems as Ft } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
12
- import { getDefaultSelection as Ot, getDrillDownConfig as jt, getFlattenedDataSeries as Gt, resolveDrillDownSubHeader as Ht, splitProjectedTransaction as wt, toStoreFilter as kt } from "./utils.es.js";
13
- import { useOpenedCta as Mt } from "../useOpenedCta.es.js";
14
- import { TransactionDrillDown as Nt } from "./TransactionDrillDown.es.js";
15
- import { useTransactionHistory as Kt } from "./useTransactionHistory.es.js";
16
- import { TransactionDetailsBlock as Pt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
9
+ import { DoubleBarChart as Et } from "../../components/chartblocks/DoubleBarChart.es.js";
10
+ import { toLegendItems as xt } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
11
+ import { getDefaultSelection as Ft, getDrillDownConfig as Ot, getFlattenedDataSeries as jt, resolveDrillDownSubHeader as Ht, splitProjectedTransaction as Gt, toStoreFilter as wt } from "./utils.es.js";
12
+ import { useOpenedCta as Nt } from "../useOpenedCta.es.js";
13
+ import { TransactionDrillDown as kt } from "./TransactionDrillDown.es.js";
14
+ import { useTransactionHistory as Mt } from "./useTransactionHistory.es.js";
15
+ import { TransactionDetailsBlock as Kt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
16
+ import { useRequiredCopy as Pt } from "../useRequiredCopy.es.js";
17
17
  import { useLayoutEffect as Vt, useState as d } from "react";
18
18
  import { observer as zt } from "mobx-react-lite";
19
- import { Fragment as Yt, jsx as s, jsxs as Ut } from "react/jsx-runtime";
20
- import { useTheme as Wt } from "@mui/material/styles";
21
- var fe = zt(({ beat: r }) => {
22
- const A = Wt(), { actionDrawer: V, setActionContext: D } = At(), { insights_payload: B } = r, v = Mt(r), z = v?.variant, { top: e, filterMode: m, header: Y, colors: U, filterStrategy: W, tipSection: S, subTabAriaLabels: $, slotData: q, beatTransactions: J, averageFormat: Q, subTabs: X, boldLabel: Z } = jt(z ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: L, allAccountGuids: I, categoryName: tt, displayedDateRange: f, transactionStore: et } = Kt(r, {
23
- slotData: q,
19
+ import { Fragment as Yt, jsx as l, jsxs as qt } from "react/jsx-runtime";
20
+ import { useTheme as Ut } from "@mui/material/styles";
21
+ var Wt = (a) => a.insights_feed, he = zt(({ beat: a }) => {
22
+ const A = Ut(), { actionDrawer: V, setActionContext: D } = At(), { insights_payload: v } = a, B = Nt(a), z = B?.variant, { top: e, filterMode: m, header: Y, colors: q, filterStrategy: U, tipSection: S, subTabAriaLabels: W, slotData: $, beatTransactions: J, averageFormat: Q, subTabs: X, boldLabel: Z } = Ot(z ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: L, allAccountGuids: I, categoryName: tt, displayedDateRange: f, transactionStore: et } = Mt(a, {
23
+ slotData: $,
24
24
  beatTransactions: J
25
- }, v?.drilldown_data), { common: ot, insights_feed: a } = yt(), [at, E] = d(!1), [nt, rt] = d(!1), R = Rt(), { dataSeries: g, chartData: p, comparisonBars: i } = Gt({
25
+ }, B?.drilldown_data), { common: ot } = yt(), s = Pt(Wt), [at, R] = d(!1), [nt, st] = d(!1), E = Rt(), { dataSeries: p, chartData: g, comparisonBars: r } = jt({
26
26
  data: o?.data_series,
27
- ariaLabel: e === "doubleBar" ? a?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : Lt,
27
+ ariaLabel: e === "doubleBar" ? s?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : St,
28
28
  top: e,
29
29
  beatTransactions: u
30
- }), c = e === "doubleBar", st = e === "tabsOnly", l = c ? i : p, { chartBarIndex: x, subTabIndex: it } = Ot({
31
- chartTabCount: p.length,
32
- comparisonTabCount: i.length,
30
+ }), c = e === "doubleBar", rt = e === "tabsOnly", i = c ? r : g, { chartBarIndex: x, subTabIndex: it } = Ft({
31
+ chartTabCount: g.length,
32
+ comparisonTabCount: r.length,
33
33
  actionDrawer: V,
34
- beatGuid: r.guid
35
- }), [n, h] = d(x), [C, F] = d(it), [lt, ct] = d(l.length);
36
- l.length !== lt && (ct(l.length), h(x));
37
- const T = (t) => W({
38
- beat: r,
34
+ beatGuid: a.guid
35
+ }), [n, h] = d(x), [C, F] = d(it), [lt, ct] = d(i.length);
36
+ i.length !== lt && (ct(i.length), h(x));
37
+ const T = (t) => U({
38
+ beat: a,
39
39
  beatTransactions: u,
40
- dataSeries: g,
41
- comparisonBars: i,
40
+ dataSeries: p,
41
+ comparisonBars: r,
42
42
  selectedIndex: t,
43
43
  subIndex: C,
44
- isLastTab: t === l.length - 1,
44
+ isLastTab: t === i.length - 1,
45
45
  instanceSlotData: o,
46
46
  spendCategoryGuids: L,
47
47
  displayedDateRange: f
48
- }), dt = u.map((t) => t.guid).join(","), mt = L.join(","), ut = I.join(","), gt = e === "list" || e === "tabsOnly" || e === "monthTabs" || g.length > 0, O = () => {
48
+ }), dt = u.map((t) => t.guid).join(","), mt = L.join(","), ut = I.join(","), pt = e === "list" || e === "tabsOnly" || e === "monthTabs" || p.length > 0, O = () => {
49
49
  if (m !== "store") return;
50
- const t = gt ? T(n) : {
50
+ const t = pt ? T(n) : {
51
51
  accounts: [],
52
52
  custom: () => !1
53
53
  };
54
- et.setFilter(kt(t, {
54
+ et.setFilter(wt(t, {
55
55
  allAccountGuids: I,
56
56
  displayedDateRange: f
57
57
  }));
58
58
  };
59
- if (Vt(() => {
59
+ Vt(() => {
60
60
  O();
61
61
  }, [
62
- r.guid,
62
+ a.guid,
63
63
  n,
64
64
  C,
65
65
  m,
66
- g.length,
66
+ p.length,
67
67
  o,
68
68
  f,
69
69
  mt,
70
70
  ut,
71
71
  dt,
72
72
  e
73
- ]), !a) return /* @__PURE__ */ s(St, {});
74
- const j = Ht(B), _ = Y?.({
75
- title: B?.title,
73
+ ]);
74
+ const j = Ht(v), _ = Y?.({
75
+ title: v?.title,
76
76
  subHeader: j,
77
77
  categoryName: tt,
78
- selectedDate: p[n]?.date ?? void 0,
78
+ selectedDate: g[n]?.date ?? void 0,
79
79
  slotData: o
80
- }), G = U(A, o?.category_guid), [H, w] = o?.legends ?? [], pt = m === "local" ? (t) => T(t).custom ?? (() => !0) : void 0, { transactions: bt, projectedTransaction: y } = wt(u), ft = m === "local" ? bt : void 0, k = a.general.projected_amount, ht = y && k && T(n).custom?.(y) ? {
81
- heading: k,
80
+ }), H = q(A, o?.category_guid), [G, w] = o?.legends ?? [], gt = m === "local" ? (t) => T(t).custom ?? (() => !0) : void 0, { transactions: bt, projectedTransaction: y } = Gt(u), ft = m === "local" ? bt : void 0, N = s.general.projected_amount, ht = y && N && T(n).custom?.(y) ? {
81
+ heading: N,
82
82
  transaction: y
83
- } : void 0, M = (t, b) => {
84
- R(P.DRAWER_CHART_BAR_CLICKED), h(t), b !== void 0 && F(b);
83
+ } : void 0, k = (t, b) => {
84
+ E(P.DRAWER_CHART_BAR_CLICKED), h(t), b !== void 0 && F(b);
85
85
  }, Ct = (t) => {
86
- R(P.TAB_SELECTED), h(t);
87
- }, N = c ? Ft([{
88
- ...H,
89
- value: i[n]?.main
86
+ E(P.TAB_SELECTED), h(t);
87
+ }, M = c ? xt([{
88
+ ...G,
89
+ value: r[n]?.main
90
90
  }, {
91
91
  ...w,
92
- value: i[n]?.comparison
93
- }]) : void 0, Tt = $?.(a) ?? [], K = c ? (N ?? []).map((t, b) => ({
92
+ value: r[n]?.comparison
93
+ }]) : void 0, Tt = W?.(s) ?? [], K = c ? (M ?? []).map((t, b) => ({
94
94
  label: t.label,
95
95
  ariaLabel: Tt[b]
96
- })) : st ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : X?.({
96
+ })) : rt ? p.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : X?.({
97
97
  instanceSlotData: o,
98
- copy: a
99
- }).map((t) => ({ label: t })) ?? [], _t = c || e === "singleBar" || e === "upcomingBill" ? l.length ? c ? /* @__PURE__ */ s(xt, {
100
- bars: i,
98
+ copy: s
99
+ }).map((t) => ({ label: t })) ?? [], _t = c || e === "singleBar" || e === "upcomingBill" ? i.length ? c ? /* @__PURE__ */ l(Et, {
100
+ bars: r,
101
101
  boldLabel: Z,
102
- colors: G,
102
+ colors: H,
103
103
  legendPosition: "top",
104
- legends: N,
105
- onBarClick: M,
104
+ legends: M,
105
+ onBarClick: k,
106
106
  selectedIndex: n
107
- }) : /* @__PURE__ */ s(It, {
107
+ }) : /* @__PURE__ */ l(Lt, {
108
108
  amounts: {
109
109
  average: o?.average_amount,
110
- formattedAverage: Bt(o?.average_amount ?? 0, Q ?? Dt.cents)
110
+ formattedAverage: vt(o?.average_amount ?? 0, Q ?? Dt.cents)
111
111
  },
112
- color: G[0] ?? A.palette.primary.main,
113
- data: p,
112
+ color: H[0] ?? A.palette.primary.main,
113
+ data: g,
114
114
  legendPosition: "top",
115
115
  heightOverride: 172,
116
116
  margin: {
@@ -119,12 +119,12 @@ var fe = zt(({ beat: r }) => {
119
119
  left: 24,
120
120
  right: 24
121
121
  },
122
- monthlyAmountLabel: H?.label ?? a.general.monthly_amount,
123
- onBarClick: M,
122
+ monthlyAmountLabel: G?.label ?? s.general.monthly_amount,
123
+ onBarClick: k,
124
124
  selectedTabIndex: n,
125
- trendAmountLabel: w?.label ?? a.general.trend
126
- }) : /* @__PURE__ */ s(Et, {}) : null;
127
- return /* @__PURE__ */ Ut(Yt, { children: [/* @__PURE__ */ s(Nt, {
125
+ trendAmountLabel: w?.label ?? s.general.trend
126
+ }) : /* @__PURE__ */ l(It, {}) : null;
127
+ return /* @__PURE__ */ qt(Yt, { children: [/* @__PURE__ */ l(kt, {
128
128
  baseTransactions: ft,
129
129
  projectedRow: ht,
130
130
  heading: _?.heading,
@@ -132,30 +132,31 @@ var fe = zt(({ beat: r }) => {
132
132
  onSelectionChange: Ct,
133
133
  selectedIndex: n,
134
134
  subHeadingText: _?.subHeadingText,
135
- tabs: l,
135
+ tabs: i,
136
136
  top: _t,
137
137
  ...K.length > 0 && { subTabs: {
138
138
  tabs: K,
139
139
  selectedIndex: C,
140
140
  onChange: F
141
141
  } },
142
- ...S && { tipSection: !nt && (S(rt, a, j?.text, o) ?? !1) },
143
- transactionFilter: pt,
142
+ ...S && { tipSection: !nt && (S(st, s, j?.text, o) ?? !1) },
143
+ transactionFilter: gt,
144
144
  onEachRowClick: (t) => {
145
- D({ transaction_guid: t }), E(!0);
145
+ D({ transaction_guid: t }), R(!0);
146
146
  }
147
- }), /* @__PURE__ */ s(vt, {
147
+ }), /* @__PURE__ */ l(Bt, {
148
148
  ariaLabelClose: ot.close_aria,
149
149
  isOpen: at,
150
150
  onClose: () => {
151
- E(!1), D({ transaction_guid: void 0 }), O();
151
+ R(!1), D({ transaction_guid: void 0 }), O();
152
152
  },
153
- title: a.general.transaction_details_title,
154
- children: /* @__PURE__ */ s(Pt, { beat: r })
153
+ title: s.general.transaction_details_title,
154
+ children: /* @__PURE__ */ l(Kt, { beat: a })
155
155
  })] });
156
156
  });
157
157
  export {
158
- fe as TransactionHistoryBlock
158
+ he as TransactionHistoryBlock,
159
+ Wt as selectTransactionHistoryCopy
159
160
  };
160
161
 
161
162
  //# 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 { Drawer, useInsightsV2Store, useGlobalCopyStore } from '../../../common'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\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 [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\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 // After the hooks: a failed copy request leaves no `insights_feed`.\n if (!insightsCopy) return <BlockErrorMessage />\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 // `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":";;;;;;;;;;;;;;;;;;;;AAoCA,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,CAAC,IAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,IAAiB,EAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAEvC,EAAE,YAAA,GAAY,WAAA,GAAW,gBAAA,EAAA,IAAmB,GAAuB;AAAA,IACvE,MAAM,GAAkB;AAAA,IACxB,WACE,MAAQ,cACH,GAAc,SAAS,yCAAA,wCAExB;AAAA,IACN,KAAA;AAAA,IACA,kBAAA;AAAA,EACF,CAAC,GAEK,IA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,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, GlobalCopy, 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 { Drawer, useInsightsV2Store, useGlobalCopyStore } from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\ninterface TransactionHistoryProp {\n beat: Beat\n}\n\nexport const selectTransactionHistoryCopy = (copy: GlobalCopy) => copy.insights_feed\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 } = useGlobalCopyStore()\n const insightsCopy = useRequiredCopy(selectTransactionHistoryCopy)\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\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 // `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":";;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,KAAA,CAAgC,MAAqB,EAAK,eAE1D,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,GAAA,IAAe,GAAmB,GAC5C,IAAe,GAAgB,EAA4B,GAE3D,CAAC,IAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,IAAiB,EAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAEvC,EAAE,YAAA,GAAY,WAAA,GAAW,gBAAA,EAAA,IAAmB,GAAuB;AAAA,IACvE,MAAM,GAAkB;AAAA,IACxB,WACE,MAAQ,cACH,GAAc,SAAS,yCAAA,wCAExB;AAAA,IACN,KAAA;AAAA,IACA,kBAAA;AAAA,EACF,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,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"}
@@ -0,0 +1,3 @@
1
+ import { GlobalCopy } from '../../core';
2
+ /** A block's copy section. ActionBlockLayer mounts the block only when it is present. */
3
+ export declare const useRequiredCopy: <T>(select: (copy: GlobalCopy) => T | null | undefined) => T;
@@ -0,0 +1,11 @@
1
+ import { useGlobalCopyStore as t } from "../../common/context/hooks.es.js";
2
+ var i = (r) => {
3
+ const o = r(t());
4
+ if (o == null) throw new Error("Action block copy is missing: mount the block through ActionBlockLayer.");
5
+ return o;
6
+ };
7
+ export {
8
+ i as useRequiredCopy
9
+ };
10
+
11
+ //# sourceMappingURL=useRequiredCopy.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRequiredCopy.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/useRequiredCopy.ts"],"sourcesContent":["import { useGlobalCopyStore } from '../../common'\nimport type { GlobalCopy } from '../../core'\n\n/** A block's copy section. ActionBlockLayer mounts the block only when it is present. */\nexport const useRequiredCopy = <T>(select: (copy: GlobalCopy) => T | null | undefined): T => {\n const section = select(useGlobalCopyStore())\n if (section == null) {\n throw new Error('Action block copy is missing: mount the block through ActionBlockLayer.')\n }\n return section\n}\n"],"mappings":";AAIA,IAAa,IAAA,CAAsB,MAA0D;AAC3F,QAAM,IAAU,EAAO,EAAmB,CAAC;AAC3C,MAAI,KAAW,KACb,OAAM,IAAI,MAAM,yEAAyE;AAE3F,SAAO;AACT"}
@@ -7,6 +7,7 @@ export interface ActionBlockEntry {
7
7
  Component: React.ComponentType<ActionBlockProps>;
8
8
  usePrepare: (props: ActionBlockProps) => void;
9
9
  title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string;
10
+ copy?: (copy: GlobalCopy) => unknown;
10
11
  presentation?: 'drawer' | 'modal';
11
12
  headerAction?: 'back' | 'close';
12
13
  }