@mx-cartographer/experiences 9.7.158 → 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 (62) hide show
  1. package/CHANGELOG.md +11 -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/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +13 -12
  47. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
  48. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +6 -3
  49. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +8 -3
  50. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
  51. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +33 -33
  52. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  53. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +2 -0
  54. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +1 -0
  55. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  56. package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +8 -1
  57. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +56 -42
  58. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
  59. package/dist/insights-v2/mappings/blocks.d.ts +1 -0
  60. package/dist/insights-v2/mappings/blocks.es.js +190 -178
  61. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  62. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [9.7.160] - 11-16-2026
2
+
3
+ - **ADDED** - `ErrorBoundary` (`./common`) accepts an optional `fallback`; without it the default message is unchanged (WEC-2262)
4
+ - **CHANGED** - Insights 2.0 action block registry entries declare their copy section; `ActionBlockLayer` shows the shared error message when it is missing instead of each block checking its own copy (WEC-2262)
5
+ - **CHANGED** - An action block that throws while rendering shows the shared error message inside its drawer and is reported, instead of crashing the feed (WEC-2262)
6
+ - **CHANGED** - A drawer whose block copy is missing is titled with `common.error_heading`, like the unknown-block drawer (WEC-2262)
7
+
8
+ ## [9.7.159] - 11-16-2026
9
+
10
+ - **FIXED** - Monthly Obligations Status: the On Track and Off Track amounts use the same H2 weight; Monthly Savings to Income Comparison: the card chart matches the Figma height and spacing (WEC-2115)
11
+
1
12
  ## [9.7.158] - 11-16-2026
2
13
 
3
14
  - **CHANGED** - Debt Payment Reminder card labels come only from the backend (WEC-2312)
@@ -2,6 +2,7 @@ import { default as React } from 'react';
2
2
  import { GlobalCaptureException } from '../../core';
3
3
  export interface ErrorProps {
4
4
  children?: React.ReactNode;
5
+ fallback?: React.ReactNode;
5
6
  onCaptureException?: GlobalCaptureException;
6
7
  }
7
8
  export interface ErrorState {
@@ -13,7 +13,7 @@ var a = { text: "Oops! Something went wrong." }, i = class extends o.Component {
13
13
  return { hasError: !0 };
14
14
  }
15
15
  render() {
16
- return this.state.hasError ? /* @__PURE__ */ n(e, {
16
+ return this.state.hasError ? this.props.fallback ?? /* @__PURE__ */ n(e, {
17
17
  sx: { pt: 24 },
18
18
  children: a.text
19
19
  }) : this.props.children;
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.es.js","names":[],"sources":["../../../src/common/components/ErrorBoundary.tsx"],"sourcesContent":["import React from 'react'\n\nimport { H3 } from '@mxenabled/mxui'\n\nimport type { GlobalCaptureException } from '../../core'\n\nexport interface ErrorProps {\n children?: React.ReactNode\n onCaptureException?: GlobalCaptureException\n}\n\nexport interface ErrorState {\n hasError: boolean\n}\n\nconst copy = {\n text: 'Oops! Something went wrong.',\n}\n\nclass ErrorBoundary extends React.Component<ErrorProps, ErrorState> {\n state: ErrorState = {\n hasError: false,\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error('Uncaught error:', error, errorInfo)\n this.props.onCaptureException?.(error, {\n component: 'ErrorBoundary',\n componentStack: errorInfo.componentStack ?? '',\n })\n }\n\n static getDerivedStateFromError(): ErrorState {\n return { hasError: true }\n }\n\n render() {\n if (this.state.hasError) return <H3 sx={{ pt: 24 }}>{copy.text}</H3>\n\n return this.props.children\n }\n}\n\nexport default ErrorBoundary\n"],"mappings":";;;AAeA,IAAM,IAAO,EACX,MAAM,8BACR,GAEM,IAAN,cAA4B,EAAM,UAAkC;AAAA,EAClE,QAAoB,EAClB,UAAU,GACZ;AAAA,EAEA,kBAAkB,GAAc,GAA4B;AAC1D,YAAQ,MAAM,mBAAmB,GAAO,CAAS,GACjD,KAAK,MAAM,qBAAqB,GAAO;AAAA,MACrC,WAAW;AAAA,MACX,gBAAgB,EAAU,kBAAkB;AAAA,IAC9C,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,2BAAuC;AAC5C,WAAO,EAAE,UAAU,GAAK;AAAA,EAC1B;AAAA,EAEA,SAAS;AACP,WAAI,KAAK,MAAM,WAAiB,gBAAA,EAAC,GAAD;AAAA,MAAI,IAAI,EAAE,IAAI,GAAG;AAAA,MAAI,UAAA,EAAK;AAAA,IAAS,CAAA,IAE5D,KAAK,MAAM;AAAA,EACpB;AACF"}
1
+ {"version":3,"file":"ErrorBoundary.es.js","names":[],"sources":["../../../src/common/components/ErrorBoundary.tsx"],"sourcesContent":["import React from 'react'\n\nimport { H3 } from '@mxenabled/mxui'\n\nimport type { GlobalCaptureException } from '../../core'\n\nexport interface ErrorProps {\n children?: React.ReactNode\n // Rendered in place of the children after an error; defaults to a generic English message.\n fallback?: React.ReactNode\n onCaptureException?: GlobalCaptureException\n}\n\nexport interface ErrorState {\n hasError: boolean\n}\n\nconst copy = {\n text: 'Oops! Something went wrong.',\n}\n\nclass ErrorBoundary extends React.Component<ErrorProps, ErrorState> {\n state: ErrorState = {\n hasError: false,\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error('Uncaught error:', error, errorInfo)\n this.props.onCaptureException?.(error, {\n component: 'ErrorBoundary',\n componentStack: errorInfo.componentStack ?? '',\n })\n }\n\n static getDerivedStateFromError(): ErrorState {\n return { hasError: true }\n }\n\n render() {\n if (this.state.hasError) return this.props.fallback ?? <H3 sx={{ pt: 24 }}>{copy.text}</H3>\n\n return this.props.children\n }\n}\n\nexport default ErrorBoundary\n"],"mappings":";;;AAiBA,IAAM,IAAO,EACX,MAAM,8BACR,GAEM,IAAN,cAA4B,EAAM,UAAkC;AAAA,EAClE,QAAoB,EAClB,UAAU,GACZ;AAAA,EAEA,kBAAkB,GAAc,GAA4B;AAC1D,YAAQ,MAAM,mBAAmB,GAAO,CAAS,GACjD,KAAK,MAAM,qBAAqB,GAAO;AAAA,MACrC,WAAW;AAAA,MACX,gBAAgB,EAAU,kBAAkB;AAAA,IAC9C,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,2BAAuC;AAC5C,WAAO,EAAE,UAAU,GAAK;AAAA,EAC1B;AAAA,EAEA,SAAS;AACP,WAAI,KAAK,MAAM,WAAiB,KAAK,MAAM,YAAY,gBAAA,EAAC,GAAD;AAAA,MAAI,IAAI,EAAE,IAAI,GAAG;AAAA,MAAI,UAAA,EAAK;AAAA,IAAS,CAAA,IAEnF,KAAK,MAAM;AAAA,EACpB;AACF"}
@@ -1,4 +1,6 @@
1
+ import { GlobalCopy } from '../../../core';
1
2
  import { ActionBlockProps } from '../../mappings/blocks';
3
+ export declare const selectAccountListCopy: (copy: GlobalCopy) => import('../../../core').AccountListCopy | undefined;
2
4
  /**
3
5
  * Account List drawer: the CTA's calculation, then Accounts and Recurring Expenses tabs.
4
6
  * A tapped expense opens its Expense Details, and a tapped account its Account Details (the shared
@@ -1,72 +1,71 @@
1
- import O from "../../../common/utils/AccountDisplayName.es.js";
2
- import { useAccountStore as $, useAppConfig as j, useCashflowStore as q, useGlobalCopyStore as z, useRecurringTransactionsStore as I } from "../../../common/context/hooks.es.js";
3
- import { getFrequencyLabel as M } from "../../../core/utils/RecurringTransactionsUtil.es.js";
4
- import _ from "../../../common/components/drawer/Drawer.es.js";
5
- import H from "../../../common/components/Loader.es.js";
6
- import { BlockErrorMessage as J } from "../BlockErrorMessage.es.js";
1
+ import N from "../../../common/utils/AccountDisplayName.es.js";
2
+ import { useAccountStore as O, useAppConfig as $, useCashflowStore as j, useGlobalCopyStore as z, useRecurringTransactionsStore as I } from "../../../common/context/hooks.es.js";
3
+ import { getFrequencyLabel as H } from "../../../core/utils/RecurringTransactionsUtil.es.js";
4
+ import h from "../../../common/components/drawer/Drawer.es.js";
5
+ import J from "../../../common/components/Loader.es.js";
7
6
  import K from "../../components/CategoryTile.es.js";
8
- import { useOpenedCta as P } from "../useOpenedCta.es.js";
7
+ import { useOpenedCta as M } from "../useOpenedCta.es.js";
8
+ import { useRequiredCopy as P } from "../useRequiredCopy.es.js";
9
9
  import { useRecurringExpensesLoadState as Q } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
10
10
  import { RecurringTransactionBlock as U } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
11
11
  import { AccountDetailsBlock as V } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
12
12
  import W from "./AccountListContent.es.js";
13
- import { buildSummary as X, isCheckingAccount as h, resolveBeatAccounts as Y, toAccountSection as k } from "./layout.es.js";
14
- import { useState as G } from "react";
13
+ import { buildSummary as X, isCheckingAccount as v, resolveBeatAccounts as Y, toAccountSection as G } from "./layout.es.js";
14
+ import { useState as T } from "react";
15
15
  import { observer as Z } from "mobx-react-lite";
16
16
  import { Fragment as tt, jsx as o, jsxs as ot } from "react/jsx-runtime";
17
- var _t = Z(function({ beat: n }) {
18
- const [i, l] = G(null), [s, m] = G(null), { accounts: p, insights_feed: T, recurring: r } = z(), { accountsLoaded: v, cashAccounts: L, visibleAccounts: d } = $(), S = P(n), { uiStore: b } = q(), { detailedRepeatingTransactions: x } = I(), { config: D } = j(), { failed: g, ready: f, retry: R } = Q(), e = T?.account_list;
19
- if (!e) return /* @__PURE__ */ o(J, {});
20
- if (!v) return /* @__PURE__ */ o(H, {});
21
- const y = Y(n, d, L), B = y.filter(h), E = y.filter((t) => !h(t)), a = D.display_available_balance_in_accounts, w = [k("checking", e.checking, B, a), k("savings", e.savings, E, a)].filter((t) => t.rows.length > 0), F = f ? [...b.expensesTilNextIncome].sort((t, c) => c.amount - t.amount).map((t) => {
22
- const c = d.find(({ guid: u }) => u === t.accountGuid), C = x.find(({ guid: u }) => u === t.repeatingTransactionGuid);
17
+ var et = (l) => l.insights_feed?.account_list, _t = Z(function({ beat: e }) {
18
+ const [n, m] = T(null), [s, p] = T(null), { accounts: d, recurring: r } = z(), { accountsLoaded: k, cashAccounts: L, visibleAccounts: g } = O(), S = M(e), { uiStore: b } = j(), { detailedRepeatingTransactions: R } = I(), { config: x } = $(), { failed: f, ready: y, retry: D } = Q(), c = P(et);
19
+ if (!k) return /* @__PURE__ */ o(J, {});
20
+ const A = Y(e, g, L), w = A.filter(v), B = A.filter((t) => !v(t)), a = x.display_available_balance_in_accounts, E = [G("checking", c.checking, w, a), G("savings", c.savings, B, a)].filter((t) => t.rows.length > 0), F = y ? [...b.expensesTilNextIncome].sort((t, i) => i.amount - t.amount).map((t) => {
21
+ const i = g.find(({ guid: u }) => u === t.accountGuid), _ = R.find(({ guid: u }) => u === t.repeatingTransactionGuid);
23
22
  return {
24
23
  account: {
25
24
  institutionGuid: t.institutionGuid,
26
- name: c ? O(c) : t.institutionName
25
+ name: i ? N(i) : t.institutionName
27
26
  },
28
27
  amount: t.amount,
29
- frequency: C && M(r, C, !1),
28
+ frequency: _ && H(r, _, !1),
30
29
  key: `${t.repeatingTransactionGuid}-${t.expectedDate.getTime()}`,
31
30
  leading: /* @__PURE__ */ o(K, {
32
31
  categoryGuid: t.categoryGuid,
33
32
  size: 32
34
33
  }),
35
34
  name: t.name,
36
- onClick: () => l(t)
35
+ onClick: () => m(t)
37
36
  };
38
- }) : [], A = () => l(null), N = () => m(null);
37
+ }) : [], C = () => m(null), q = () => p(null);
39
38
  return /* @__PURE__ */ ot(tt, { children: [
40
39
  /* @__PURE__ */ o(W, {
41
- copy: e,
40
+ copy: c,
42
41
  expenses: F,
43
- expensesLoading: !f && !g,
44
- onAccountClick: m,
45
- onRetryExpenses: g ? R : void 0,
46
- sections: w,
42
+ expensesLoading: !y && !f,
43
+ onAccountClick: p,
44
+ onRetryExpenses: f ? D : void 0,
45
+ sections: E,
47
46
  showAvailable: a,
48
- summary: X(S, e)
47
+ summary: X(S, c)
49
48
  }),
50
- /* @__PURE__ */ o(_, {
49
+ /* @__PURE__ */ o(h, {
51
50
  ariaLabelClose: r.close_drawer_aria,
52
- isOpen: i !== null,
53
- onClose: A,
51
+ isOpen: n !== null,
52
+ onClose: C,
54
53
  title: r.expense_details,
55
- children: i && /* @__PURE__ */ o(U, {
56
- beat: n,
54
+ children: n && /* @__PURE__ */ o(U, {
55
+ beat: e,
57
56
  layout: "insights",
58
- onDeleted: A,
59
- repeatingTransactionGuid: i.repeatingTransactionGuid,
60
- selectedRecurrence: i
57
+ onDeleted: C,
58
+ repeatingTransactionGuid: n.repeatingTransactionGuid,
59
+ selectedRecurrence: n
61
60
  })
62
61
  }),
63
- /* @__PURE__ */ o(_, {
64
- ariaLabelClose: p?.close_account_details_aria,
62
+ /* @__PURE__ */ o(h, {
63
+ ariaLabelClose: d?.close_account_details_aria,
65
64
  isOpen: s !== null,
66
- onClose: N,
67
- title: p?.account_details,
65
+ onClose: q,
66
+ title: d?.account_details,
68
67
  children: s && /* @__PURE__ */ o(V, { beat: {
69
- ...n,
68
+ ...e,
70
69
  primary_account: void 0,
71
70
  primary_account_guid: s
72
71
  } })
@@ -74,7 +73,8 @@ var _t = Z(function({ beat: n }) {
74
73
  ] });
75
74
  });
76
75
  export {
77
- _t as AccountListBlock
76
+ _t as AccountListBlock,
77
+ et as selectAccountListCopy
78
78
  };
79
79
 
80
80
  //# sourceMappingURL=AccountListBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Recurrence } from '../../../core'\nimport { getFrequencyLabel } from '../../../core/utils/RecurringTransactionsUtil'\nimport CategoryTile from '../../components/CategoryTile'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\nimport {\n RecurringTransactionBlock,\n useRecurringExpensesLoadState,\n} from '../RecurringTransactionBlock'\nimport { useOpenedCta } from '../useOpenedCta'\n\nimport AccountListContent, { type ExpenseRow } from './AccountListContent'\nimport { buildSummary, isCheckingAccount, resolveBeatAccounts, toAccountSection } from './layout'\n\n/**\n * Account List drawer: the CTA's calculation, then Accounts and Recurring Expenses tabs.\n * A tapped expense opens its Expense Details, and a tapped account its Account Details (the shared\n * AccountDetailsBlock), each in a nested drawer.\n */\nexport const AccountListBlock = observer(function AccountListBlock({ beat }: ActionBlockProps) {\n const [tappedExpense, setTappedExpense] = useState<Recurrence | null>(null)\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const {\n accounts: accountsCopy,\n insights_feed: insightsFeedCopy,\n recurring: recurringCopy,\n } = useGlobalCopyStore()\n const { accountsLoaded, cashAccounts, visibleAccounts } = useAccountStore()\n const cta = useOpenedCta(beat)\n const { uiStore } = useCashflowStore()\n const { detailedRepeatingTransactions } = useRecurringTransactionsStore()\n const { config } = useAppConfig()\n const { failed: expensesFailed, ready: expensesReady, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.account_list\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n if (!accountsLoaded) return <Loader />\n\n const listed = resolveBeatAccounts(beat, visibleAccounts, cashAccounts)\n const checking = listed.filter(isCheckingAccount)\n const savings = listed.filter((account) => !isCheckingAccount(account))\n const showAvailable = config.display_available_balance_in_accounts\n const sections = [\n toAccountSection('checking', copy.checking, checking, showAvailable),\n toAccountSection('savings', copy.savings, savings, showAvailable),\n ].filter((section) => section.rows.length > 0)\n\n // Every upcoming expense as its own row, largest first (Figma); no \"Other\" fold, so each opens its details.\n const expenses: ExpenseRow[] = expensesReady\n ? [...uiStore.expensesTilNextIncome]\n .sort((a, b) => b.amount - a.amount)\n .map((expense) => {\n const account = visibleAccounts.find(({ guid }) => guid === expense.accountGuid)\n const repeating = detailedRepeatingTransactions.find(\n ({ guid }) => guid === expense.repeatingTransactionGuid,\n )\n\n return {\n account: {\n institutionGuid: expense.institutionGuid,\n name: account ? getAccountDisplayName(account) : expense.institutionName,\n },\n amount: expense.amount,\n frequency: repeating && getFrequencyLabel(recurringCopy, repeating, false),\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n onClick: () => setTappedExpense(expense),\n }\n })\n : []\n\n const closeExpenseDetails = () => setTappedExpense(null)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <AccountListContent\n copy={copy}\n expenses={expenses}\n expensesLoading={!expensesReady && !expensesFailed}\n onAccountClick={setTappedAccountGuid}\n onRetryExpenses={expensesFailed ? retry : undefined}\n sections={sections}\n showAvailable={showAvailable}\n summary={buildSummary(cta, copy)}\n />\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={tappedExpense !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {tappedExpense && (\n <RecurringTransactionBlock\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={tappedExpense.repeatingTransactionGuid}\n selectedRecurrence={tappedExpense}\n />\n )}\n </Drawer>\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,IAAa,KAAmB,EAAS,SAA0B,EAAE,MAAA,EAAA,GAA0B;AAC7F,QAAM,CAAC,GAAe,CAAA,IAAoB,EAA4B,IAAI,GACpE,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EACJ,UAAU,GACV,eAAe,GACf,WAAW,EAAA,IACT,EAAmB,GACjB,EAAE,gBAAA,GAAgB,cAAA,GAAc,iBAAA,EAAA,IAAoB,EAAgB,GACpE,IAAM,EAAa,CAAI,GACvB,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,+BAAA,EAAA,IAAkC,EAA8B,GAClE,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,QAAQ,GAAgB,OAAO,GAAe,OAAA,EAAA,IAAU,EAA8B,GACxF,IAAO,GAAkB;AAE/B,MAAI,CAAC,EACH,QAAO,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAG7B,MAAI,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAErC,QAAM,IAAS,EAAoB,GAAM,GAAiB,CAAY,GAChE,IAAW,EAAO,OAAO,CAAiB,GAC1C,IAAU,EAAO,OAAA,CAAQ,MAAY,CAAC,EAAkB,CAAO,CAAC,GAChE,IAAgB,EAAO,uCACvB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CAAI;AAAA,IAChC,CAAA;AAAA,IACD,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAc;AAAA,MAC9B,QAAQ,MAAkB;AAAA,MAC1B,SAAS;AAAA,MACT,OAAO,EAAc;AAAA,MAEpB,UAAA,KACC,gBAAA,EAAC,GAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAO;AAAA,QACP,WAAW;AAAA,QACX,0BAA0B,EAAc;AAAA,QACxC,oBAAoB;AAAA,MACrB,CAAA;AAAA,IAEG,CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,GAAc;AAAA,MAC9B,QAAQ,MAAsB;AAAA,MAC9B,SAAS;AAAA,MACT,OAAO,GAAc;AAAA,MAEpB,UAAA,KAEC,gBAAA,EAAC,GAAD,EACE,MAAM;AAAA,QAAE,GAAG;AAAA,QAAM,iBAAiB;AAAA,QAAW,sBAAsB;AAAA,MAAkB,EACtF,CAAA;AAAA,IAEG,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { GlobalCopy, Recurrence } from '../../../core'\nimport { getFrequencyLabel } from '../../../core/utils/RecurringTransactionsUtil'\nimport CategoryTile from '../../components/CategoryTile'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringExpensesLoadState,\n} from '../RecurringTransactionBlock'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport AccountListContent, { type ExpenseRow } from './AccountListContent'\nimport { buildSummary, isCheckingAccount, resolveBeatAccounts, toAccountSection } from './layout'\n\nexport const selectAccountListCopy = (copy: GlobalCopy) => copy.insights_feed?.account_list\n\n/**\n * Account List drawer: the CTA's calculation, then Accounts and Recurring Expenses tabs.\n * A tapped expense opens its Expense Details, and a tapped account its Account Details (the shared\n * AccountDetailsBlock), each in a nested drawer.\n */\nexport const AccountListBlock = observer(function AccountListBlock({ beat }: ActionBlockProps) {\n const [tappedExpense, setTappedExpense] = useState<Recurrence | null>(null)\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { accounts: accountsCopy, recurring: recurringCopy } = useGlobalCopyStore()\n const { accountsLoaded, cashAccounts, visibleAccounts } = useAccountStore()\n const cta = useOpenedCta(beat)\n const { uiStore } = useCashflowStore()\n const { detailedRepeatingTransactions } = useRecurringTransactionsStore()\n const { config } = useAppConfig()\n const { failed: expensesFailed, ready: expensesReady, retry } = useRecurringExpensesLoadState()\n const copy = useRequiredCopy(selectAccountListCopy)\n\n if (!accountsLoaded) return <Loader />\n\n const listed = resolveBeatAccounts(beat, visibleAccounts, cashAccounts)\n const checking = listed.filter(isCheckingAccount)\n const savings = listed.filter((account) => !isCheckingAccount(account))\n const showAvailable = config.display_available_balance_in_accounts\n const sections = [\n toAccountSection('checking', copy.checking, checking, showAvailable),\n toAccountSection('savings', copy.savings, savings, showAvailable),\n ].filter((section) => section.rows.length > 0)\n\n // Every upcoming expense as its own row, largest first (Figma); no \"Other\" fold, so each opens its details.\n const expenses: ExpenseRow[] = expensesReady\n ? [...uiStore.expensesTilNextIncome]\n .sort((a, b) => b.amount - a.amount)\n .map((expense) => {\n const account = visibleAccounts.find(({ guid }) => guid === expense.accountGuid)\n const repeating = detailedRepeatingTransactions.find(\n ({ guid }) => guid === expense.repeatingTransactionGuid,\n )\n\n return {\n account: {\n institutionGuid: expense.institutionGuid,\n name: account ? getAccountDisplayName(account) : expense.institutionName,\n },\n amount: expense.amount,\n frequency: repeating && getFrequencyLabel(recurringCopy, repeating, false),\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n onClick: () => setTappedExpense(expense),\n }\n })\n : []\n\n const closeExpenseDetails = () => setTappedExpense(null)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <AccountListContent\n copy={copy}\n expenses={expenses}\n expensesLoading={!expensesReady && !expensesFailed}\n onAccountClick={setTappedAccountGuid}\n onRetryExpenses={expensesFailed ? retry : undefined}\n sections={sections}\n showAvailable={showAvailable}\n summary={buildSummary(cta, copy)}\n />\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={tappedExpense !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {tappedExpense && (\n <RecurringTransactionBlock\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={tappedExpense.repeatingTransactionGuid}\n selectedRecurrence={tappedExpense}\n />\n )}\n </Drawer>\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,IAAa,KAAA,CAAyB,MAAqB,EAAK,eAAe,cAOlE,KAAmB,EAAS,SAA0B,EAAE,MAAA,EAAA,GAA0B;AAC7F,QAAM,CAAC,GAAe,CAAA,IAAoB,EAA4B,IAAI,GACpE,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,UAAU,GAAc,WAAW,EAAA,IAAkB,EAAmB,GAC1E,EAAE,gBAAA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ccountListBlock';
2
2
  export { useAccountListPrepare } from './useAccountListPrepare';
@@ -1,50 +1,55 @@
1
- import { useGlobalCopyStore as B, useGlobalUiStore as S, useInsightsV2Store as b } from "../../common/context/hooks.es.js";
2
- import w from "../../common/components/drawer/Drawer.es.js";
3
- import L from "../../common/components/Loader.es.js";
4
- import { BlockErrorMessage as D } from "./BlockErrorMessage.es.js";
5
- import { hasDrawerBlock as O } from "../mappings/hasDrawerBlock.es.js";
6
- import x from "../components/shared/StatusSnackbar.es.js";
7
- import { useOpenedCta as _ } from "./useOpenedCta.es.js";
8
- import { actionBlocks as j } from "../mappings/blocks.es.js";
9
- import { useRef as F } from "react";
10
- import { observer as G } from "mobx-react-lite";
11
- import { Fragment as d, jsx as t, jsxs as f } from "react/jsx-runtime";
12
- var N = (i, o) => {
13
- const r = F(void 0);
1
+ import { useGlobalCopyStore as w, useGlobalStore as L, useGlobalUiStore as x, useInsightsV2Store as D } from "../../common/context/hooks.es.js";
2
+ import O from "../../common/components/drawer/Drawer.es.js";
3
+ import E from "../../common/components/ErrorBoundary.es.js";
4
+ import G from "../../common/components/Loader.es.js";
5
+ import { BlockErrorMessage as k } from "./BlockErrorMessage.es.js";
6
+ import { hasDrawerBlock as _ } from "../mappings/hasDrawerBlock.es.js";
7
+ import j from "../components/shared/StatusSnackbar.es.js";
8
+ import { useOpenedCta as F } from "./useOpenedCta.es.js";
9
+ import { actionBlocks as M } from "../mappings/blocks.es.js";
10
+ import { useRef as N } from "react";
11
+ import { observer as R } from "mobx-react-lite";
12
+ import { Fragment as C, jsx as e, jsxs as g } from "react/jsx-runtime";
13
+ var T = (i, o) => {
14
+ const r = N(void 0);
14
15
  return i ? (r.current ??= o, r.current) : (r.current = void 0, o);
15
- }, k = ({ actionBlock: i, ...o }) => {
16
- const { Component: r, usePrepare: c } = i;
17
- return c(o), /* @__PURE__ */ t(r, { ...o });
18
- }, J = G(function({ beat: o }) {
19
- const r = B(), c = r.common, m = c?.close_aria ?? "Close", { isCopyLoaded: g } = S(), { actionDrawer: u, actionNotice: C, closeActionDrawer: v, setActionNotice: h } = b(), s = u.isDrawerOpen && u.guid === o.guid, e = N(s, _(o));
16
+ }, v = ({ actionBlock: i, ...o }) => {
17
+ const { Component: r, usePrepare: s } = i;
18
+ return s(o), /* @__PURE__ */ e(r, { ...o });
19
+ }, X = R(function({ beat: o }) {
20
+ const r = w(), { captureException: s } = L(), u = r.common, m = u?.close_aria ?? "Close", { isCopyLoaded: y } = x(), { actionDrawer: p, actionNotice: h, closeActionDrawer: B, setActionNotice: A } = D(), c = p.isDrawerOpen && p.guid === o.guid, t = T(c, F(o));
20
21
  if (!o.insights_payload) return null;
21
- if (!g) return s ? /* @__PURE__ */ t(L, {}) : null;
22
- const a = C[o.guid], p = /* @__PURE__ */ t(x, {
22
+ if (!y) return c ? /* @__PURE__ */ e(G, {}) : null;
23
+ const a = h[o.guid], d = /* @__PURE__ */ e(j, {
23
24
  closeAriaLabel: m,
24
25
  message: a?.message ?? "",
25
- onClose: () => h(o.guid, void 0),
26
+ onClose: () => A(o.guid, void 0),
26
27
  open: !!a,
27
28
  severity: a?.severity
28
- }), l = O(e?.block), n = l ? j[e?.block] : void 0;
29
- if (n?.presentation === "modal") return /* @__PURE__ */ f(d, { children: [s && /* @__PURE__ */ t(k, {
29
+ }), l = _(t?.block), n = l ? M[t?.block] : void 0;
30
+ if (n?.presentation === "modal") return /* @__PURE__ */ g(C, { children: [c && /* @__PURE__ */ e(v, {
30
31
  actionBlock: n,
31
32
  beat: o
32
- }, e?.block), p] });
33
- const y = n?.title?.(e?.variant, r, o), A = n ? y || e?.label || "" : l ? c?.error_heading ?? "Oops" : e?.label ?? "";
34
- return /* @__PURE__ */ f(d, { children: [/* @__PURE__ */ t(w, {
33
+ }, t?.block), d] });
34
+ const f = n && (n.copy === void 0 || n.copy(r) != null), b = n?.title?.(t?.variant, r, o), S = f ? b || t?.label || "" : l ? u?.error_heading ?? "Oops" : t?.label ?? "";
35
+ return /* @__PURE__ */ g(C, { children: [/* @__PURE__ */ e(O, {
35
36
  ariaLabelClose: m,
36
37
  headerAction: n?.headerAction,
37
- isOpen: s,
38
- onClose: v,
39
- title: A,
40
- children: n ? /* @__PURE__ */ t(k, {
41
- actionBlock: n,
42
- beat: o
43
- }, e?.block) : l ? /* @__PURE__ */ t(D, {}) : null
44
- }), p] });
38
+ isOpen: c,
39
+ onClose: B,
40
+ title: S,
41
+ children: f ? /* @__PURE__ */ e(E, {
42
+ fallback: /* @__PURE__ */ e(k, {}),
43
+ onCaptureException: s,
44
+ children: /* @__PURE__ */ e(v, {
45
+ actionBlock: n,
46
+ beat: o
47
+ })
48
+ }, t?.block) : l ? /* @__PURE__ */ e(k, {}) : null
49
+ }), d] });
45
50
  });
46
51
  export {
47
- J as ActionBlockLayer
52
+ X as ActionBlockLayer
48
53
  };
49
54
 
50
55
  //# sourceMappingURL=ActionBlockLayer.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBlockLayer.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/ActionBlockLayer.tsx"],"sourcesContent":["import { useRef } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../common'\nimport type { Beat } from '../../core'\nimport {\n actionBlocks,\n hasDrawerBlock,\n type ActionBlockEntry,\n type ActionBlockProps,\n} from '../mappings/blocks'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { BlockErrorMessage } from './BlockErrorMessage'\nimport { useOpenedCta } from './useOpenedCta'\nimport type { OpenedCta } from './util'\n\ninterface ActionBlockLayerProps {\n beat: Beat\n}\n\n/** Keeps the CTA the user pressed for the open session: a refreshed beat may name another CTA there. */\nconst useSessionCta = (isOpen: boolean, resolved: OpenedCta): OpenedCta => {\n const pinned = useRef<OpenedCta>(undefined)\n\n if (!isOpen) {\n pinned.current = undefined\n return resolved\n }\n pinned.current ??= resolved\n\n return pinned.current\n}\n\n/**\n * Renders a registered action block. Callers MUST key this per block name — a\n * block with `usePrepare` and one without run a different number of hooks, so\n * reusing the same fiber across a block switch violates the rules of hooks.\n */\nconst ActionBlockRunner = ({\n actionBlock,\n ...blockProps\n}: ActionBlockProps & { actionBlock: ActionBlockEntry }) => {\n const { Component, usePrepare } = actionBlock\n\n usePrepare(blockProps)\n\n return <Component {...blockProps} />\n}\n\n// `observer` is required: this reads `isCopyLoaded` off GlobalUiStore and the\n// action drawer off InsightsV2Store. Without it the component never re-renders\n// and stays stuck on <Loader /> forever.\nexport const ActionBlockLayer = observer(function ActionBlockLayer({\n beat,\n}: ActionBlockLayerProps) {\n const copy = useGlobalCopyStore()\n const commonCopy = copy.common\n const closeAria = commonCopy?.close_aria ?? 'Close'\n const { isCopyLoaded } = useGlobalUiStore()\n const { actionDrawer, actionNotice, closeActionDrawer, setActionNotice } = useInsightsV2Store()\n\n // Every card in the feed renders its own layer against the shared store, so\n // this card's drawer only opens when its beat is the one that triggered it.\n const isCurrentBeatOpen = actionDrawer.isDrawerOpen && actionDrawer.guid === beat.guid\n\n const currentCta = useSessionCta(isCurrentBeatOpen, useOpenedCta(beat))\n\n // Mirrors BaseLayout's guard — the layer is exported, so callers are not\n // guaranteed to have narrowed this already.\n if (!beat.insights_payload) return null\n\n if (!isCopyLoaded) return isCurrentBeatOpen ? <Loader /> : null\n\n // A block that closes its own drawer hands its message here, so it shows after the unmount.\n const notice = actionNotice[beat.guid]\n const noticeSnackbar = (\n <StatusSnackbar\n closeAriaLabel={closeAria}\n message={notice?.message ?? ''}\n onClose={() => setActionNotice(beat.guid, undefined)}\n open={Boolean(notice)}\n severity={notice?.severity}\n />\n )\n\n // A CTA without a real block never opens a drawer (BaseLayout won't trigger it);\n // a real-but-unknown block shows the error (\"oops\") content.\n const blockValid = hasDrawerBlock(currentCta?.block)\n const actionBlock = blockValid\n ? actionBlocks[currentCta?.block as keyof typeof actionBlocks]\n : undefined\n\n // A modal block owns its dialog: no drawer behind it, and nothing mounted until it is opened.\n if (actionBlock?.presentation === 'modal') {\n return (\n <>\n {isCurrentBeatOpen && (\n <ActionBlockRunner actionBlock={actionBlock} beat={beat} key={currentCta?.block} />\n )}\n {noticeSnackbar}\n </>\n )\n }\n\n const resolvedTitle = actionBlock?.title?.(currentCta?.variant, copy, beat)\n const drawerTitle = actionBlock\n ? resolvedTitle || currentCta?.label || ''\n : blockValid\n ? (commonCopy?.error_heading ?? 'Oops')\n : (currentCta?.label ?? '')\n\n return (\n <>\n <Drawer\n ariaLabelClose={closeAria}\n headerAction={actionBlock?.headerAction}\n isOpen={isCurrentBeatOpen}\n onClose={closeActionDrawer}\n title={drawerTitle}\n >\n {actionBlock ? (\n <ActionBlockRunner actionBlock={actionBlock} beat={beat} key={currentCta?.block} />\n ) : blockValid ? (\n <BlockErrorMessage />\n ) : null}\n </Drawer>\n {noticeSnackbar}\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;AA4BA,IAAM,IAAA,CAAiB,GAAiB,MAAmC;AACzE,QAAM,IAAS,EAAkB,MAAS;AAE1C,SAAK,KAIL,EAAO,YAAY,GAEZ,EAAO,YALZ,EAAO,UAAU,QACV;AAKX,GAOM,IAAA,CAAqB,EACzB,aAAA,GACA,GAAG,EAAA,MACuD;AAC1D,QAAM,EAAE,WAAA,GAAW,YAAA,EAAA,IAAe;AAElC,SAAA,EAAW,CAAU,GAEd,gBAAA,EAAC,GAAD,EAAW,GAAI,EAAa,CAAA;AACrC,GAKa,IAAmB,EAAS,SAA0B,EACjE,MAAA,EAAA,GACwB;AACxB,QAAM,IAAO,EAAmB,GAC1B,IAAa,EAAK,QAClB,IAAY,GAAY,cAAc,SACtC,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,cAAA,GAAc,cAAA,GAAc,mBAAA,GAAmB,iBAAA,EAAA,IAAoB,EAAmB,GAIxF,IAAoB,EAAa,gBAAgB,EAAa,SAAS,EAAK,MAE5E,IAAa,EAAc,GAAmB,EAAa,CAAI,CAAC;A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import { useRef } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n ErrorBoundary,\n Loader,\n useGlobalCopyStore,\n useGlobalStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../common'\nimport type { Beat } from '../../core'\nimport {\n actionBlocks,\n hasDrawerBlock,\n type ActionBlockEntry,\n type ActionBlockProps,\n} from '../mappings/blocks'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { BlockErrorMessage } from './BlockErrorMessage'\nimport { useOpenedCta } from './useOpenedCta'\nimport type { OpenedCta } from './util'\n\ninterface ActionBlockLayerProps {\n beat: Beat\n}\n\n/** Keeps the CTA the user pressed for the open session: a refreshed beat may name another CTA there. */\nconst useSessionCta = (isOpen: boolean, resolved: OpenedCta): OpenedCta => {\n const pinned = useRef<OpenedCta>(undefined)\n\n if (!isOpen) {\n pinned.current = undefined\n return resolved\n }\n pinned.current ??= resolved\n\n return pinned.current\n}\n\n/**\n * Renders a registered action block. Callers MUST key it (or its wrapper) per block name — a\n * block with `usePrepare` and one without run a different number of hooks, so\n * reusing the same fiber across a block switch violates the rules of hooks.\n */\nconst ActionBlockRunner = ({\n actionBlock,\n ...blockProps\n}: ActionBlockProps & { actionBlock: ActionBlockEntry }) => {\n const { Component, usePrepare } = actionBlock\n\n usePrepare(blockProps)\n\n return <Component {...blockProps} />\n}\n\n// `observer` is required: this reads `isCopyLoaded` off GlobalUiStore and the\n// action drawer off InsightsV2Store. Without it the component never re-renders\n// and stays stuck on <Loader /> forever.\nexport const ActionBlockLayer = observer(function ActionBlockLayer({\n beat,\n}: ActionBlockLayerProps) {\n const copy = useGlobalCopyStore()\n const { captureException } = useGlobalStore()\n const commonCopy = copy.common\n const closeAria = commonCopy?.close_aria ?? 'Close'\n const { isCopyLoaded } = useGlobalUiStore()\n const { actionDrawer, actionNotice, closeActionDrawer, setActionNotice } = useInsightsV2Store()\n\n // Every card in the feed renders its own layer against the shared store, so\n // this card's drawer only opens when its beat is the one that triggered it.\n const isCurrentBeatOpen = actionDrawer.isDrawerOpen && actionDrawer.guid === beat.guid\n\n const currentCta = useSessionCta(isCurrentBeatOpen, useOpenedCta(beat))\n\n // Mirrors BaseLayout's guard — the layer is exported, so callers are not\n // guaranteed to have narrowed this already.\n if (!beat.insights_payload) return null\n\n if (!isCopyLoaded) return isCurrentBeatOpen ? <Loader /> : null\n\n // A block that closes its own drawer hands its message here, so it shows after the unmount.\n const notice = actionNotice[beat.guid]\n const noticeSnackbar = (\n <StatusSnackbar\n closeAriaLabel={closeAria}\n message={notice?.message ?? ''}\n onClose={() => setActionNotice(beat.guid, undefined)}\n open={Boolean(notice)}\n severity={notice?.severity}\n />\n )\n\n // A CTA without a real block never opens a drawer (BaseLayout won't trigger it);\n // a real-but-unknown block shows the error (\"oops\") content.\n const blockValid = hasDrawerBlock(currentCta?.block)\n const actionBlock = blockValid\n ? actionBlocks[currentCta?.block as keyof typeof actionBlocks]\n : undefined\n\n // A modal block owns its dialog: no drawer behind it, and nothing mounted until it is opened.\n if (actionBlock?.presentation === 'modal') {\n return (\n <>\n {isCurrentBeatOpen && (\n <ActionBlockRunner actionBlock={actionBlock} beat={beat} key={currentCta?.block} />\n )}\n {noticeSnackbar}\n </>\n )\n }\n\n const canMount = actionBlock && (actionBlock.copy === undefined || actionBlock.copy(copy) != null)\n const resolvedTitle = actionBlock?.title?.(currentCta?.variant, copy, beat)\n const drawerTitle = canMount\n ? resolvedTitle || currentCta?.label || ''\n : blockValid\n ? (commonCopy?.error_heading ?? 'Oops')\n : (currentCta?.label ?? '')\n\n return (\n <>\n <Drawer\n ariaLabelClose={closeAria}\n headerAction={actionBlock?.headerAction}\n isOpen={isCurrentBeatOpen}\n onClose={closeActionDrawer}\n title={drawerTitle}\n >\n {canMount ? (\n // A block that throws (e.g. its entry declares no `copy`) fails inside the drawer.\n <ErrorBoundary\n fallback={<BlockErrorMessage />}\n key={currentCta?.block}\n onCaptureException={captureException}\n >\n <ActionBlockRunner actionBlock={actionBlock} be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AA,IACzB;AAGJ,MAAI,GAAa,iBAAiB,QAChC,QACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,IAAgC,aAAA;AAAA,IAAmB,MAAA;AAAA,EAA+B,GAApB,GAAY,KAAQ,GAEnF,CACD,EAAA,CAAA;AAIN,QAAM,IAAW,MAAgB,EAAY,SAAS,UAAa,EAAY,KAAK,CAAI,KAAK,OACvF,IAAgB,GAAa,QAAQ,GAAY,SAAS,GAAM,CAAI,GACpE,IAAc,IAChB,KAAiB,GAAY,SAAS,KACtC,IACG,GAAY,iBAAiB,SAC7B,GAAY,SAAS;AAE5B,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB;AAAA,IAChB,cAAc,GAAa;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IAEN,UAAA,IAEC,gBAAA,EAAC,GAAD;AAAA,MACE,UAAU,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAAA,MAE9B,oBAAoB;AAAA,MAEpB,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAgC,aAAA;AAAA,QAAmB,MAAA;AAAA,MAAO,CAAA;AAAA,IAC7C,GAJR,GAAY,KAIJ,IACb,IACF,gBAAA,EAAC,GAAD,CAAoB,CAAA,IAClB;AAAA,EACE,CAAA,GACP,CACD,EAAA,CAAA;AAEN,CAAC"}
@@ -1,4 +1,6 @@
1
+ import { GlobalCopy } from '../../../core';
1
2
  import { ActionBlockProps } from '../../mappings/blocks';
3
+ export declare const selectBudgetDetailsCopy: (copy: GlobalCopy) => import('../../../core/types/localization/InsightsFeedCopy').BudgetDetailsCopy | undefined;
2
4
  export declare const BudgetDetailsBlock: (({ beat }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
3
5
  displayName: string;
4
6
  };