@mx-cartographer/experiences 9.7.127 → 9.7.129

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 (72) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/core/types/localization/InsightsFeedCopy.d.ts +11 -15
  3. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +5 -1
  4. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +77 -30
  5. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
  6. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +26 -13
  7. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +107 -136
  8. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +21 -7
  10. package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +34 -17
  11. package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.d.ts +3 -1
  13. package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js +10 -8
  14. package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +101 -105
  16. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.d.ts +10 -12
  18. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js +20 -19
  19. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/index.d.ts +1 -1
  21. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.d.ts +3 -12
  22. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js +8 -8
  23. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js.map +1 -1
  24. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.d.ts +9 -0
  25. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js +27 -10
  26. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js.map +1 -1
  27. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +1 -7
  28. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +54 -63
  29. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  30. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +29 -75
  31. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
  32. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +12 -0
  33. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +18 -9
  34. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
  35. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +66 -65
  36. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  37. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +24 -30
  38. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
  39. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +84 -101
  40. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  41. package/dist/insights-v2/components/AmountBreakdownCard.es.js +9 -8
  42. package/dist/insights-v2/components/AmountBreakdownCard.es.js.map +1 -1
  43. package/dist/insights-v2/components/CategoryTile.d.ts +14 -0
  44. package/dist/insights-v2/components/CategoryTile.es.js +28 -0
  45. package/dist/insights-v2/components/CategoryTile.es.js.map +1 -0
  46. package/dist/insights-v2/components/InsightListRow.d.ts +31 -0
  47. package/dist/insights-v2/components/InsightListRow.es.js +111 -0
  48. package/dist/insights-v2/components/InsightListRow.es.js.map +1 -0
  49. package/dist/insights-v2/components/LogoMark.d.ts +3 -3
  50. package/dist/insights-v2/components/LogoMark.es.js +11 -10
  51. package/dist/insights-v2/components/LogoMark.es.js.map +1 -1
  52. package/dist/insights-v2/components/SubTabs.d.ts +2 -1
  53. package/dist/insights-v2/components/SubTabs.es.js +10 -10
  54. package/dist/insights-v2/components/SubTabs.es.js.map +1 -1
  55. package/dist/insights-v2/index.es.js +12 -12
  56. package/dist/insights-v2/mappings/blocks.es.js +21 -21
  57. package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -1
  58. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +169 -120
  59. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
  60. package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +3 -1
  61. package/dist/recurringtransactions/components/RecurringTransactionList.es.js +151 -118
  62. package/dist/recurringtransactions/components/RecurringTransactionList.es.js.map +1 -1
  63. package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -6
  64. package/dist/transactions/components/shared/TransactionDetails.es.js +149 -199
  65. package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
  66. package/dist/transactions/components/shared/transactiondetails/Description.d.ts +2 -0
  67. package/dist/transactions/components/shared/transactiondetails/Description.es.js +59 -50
  68. package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
  69. package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.d.ts +10 -0
  70. package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js +68 -0
  71. package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js.map +1 -0
  72. package/package.json +1 -1
@@ -1,39 +1,56 @@
1
- import { formatSignedCurrency as r } from "../../../core/utils/NumberFormatting.es.js";
2
- import { resolveVariantConfig as u } from "../../blocks/resolveVariantConfig.es.js";
3
- import { finiteNumberOf as t } from "../TransactionHistoryBlock/utils.es.js";
4
- var s = (a) => a.balance ?? 0, _ = (a, e, l) => {
5
- const i = new Set(a.account_guids?.length ? a.account_guids : l.map(({ guid: n }) => n));
6
- return e.filter((n) => i.has(n.guid)).sort((n, o) => s(o) - s(n));
7
- }, b = (a) => a.reduce((e, l) => e + s(l), 0), f = (a) => a?.replace(/\D/g, "").slice(-4) ?? "", d = (a, e) => {
8
- const l = t(a?.available_funds), i = t(a?.planned_expenses), n = t(a?.total_remaining);
9
- if (!(l === void 0 || i === void 0 || n === void 0))
1
+ import { AccountType as u } from "../../../core/types/Account.es.js";
2
+ import m from "../../../common/utils/AccountDisplayName.es.js";
3
+ import { formatSignedCurrency as l } from "../../../core/utils/NumberFormatting.es.js";
4
+ import { getAccountStartingBalance as d } from "../../../core/utils/AccountUtils.es.js";
5
+ import { resolveVariantConfig as g } from "../../blocks/resolveVariantConfig.es.js";
6
+ import { finiteNumberOf as s } from "../TransactionHistoryBlock/utils.es.js";
7
+ var c = (a) => a.balance ?? 0, E = (a, e, i) => {
8
+ const o = new Set(a.account_guids?.length ? a.account_guids : i.map(({ guid: n }) => n));
9
+ return e.filter((n) => o.has(n.guid)).sort((n, t) => c(t) - c(n));
10
+ }, v = /* @__PURE__ */ new Set([u.CHECKING, u.CHECKING_LINE_OF_CREDIT]), I = (a) => v.has(a.account_type), _ = (a, e) => ({
11
+ balance: d(a, e),
12
+ guid: a.guid,
13
+ institutionGuid: a.institution_guid ?? "",
14
+ name: m(a)
15
+ }), N = (a, e, i, o) => {
16
+ const n = i.map((t) => _(t, o)).sort((t, r) => r.balance - t.balance);
17
+ return {
18
+ header: e,
19
+ key: a,
20
+ rows: n,
21
+ total: n.reduce((t, r) => t + r.balance, 0)
22
+ };
23
+ }, b = (a, e) => {
24
+ const i = s(a?.available_funds), o = s(a?.planned_expenses), n = s(a?.total_remaining);
25
+ if (!(i === void 0 || o === void 0 || n === void 0))
10
26
  return {
11
27
  heading: e.how_is_this_calculated,
12
28
  rows: [
13
29
  {
14
30
  key: "available_funds",
15
31
  label: e.available_funds,
16
- value: r(l)
32
+ value: l(i)
17
33
  },
18
34
  {
19
35
  key: "planned_expenses",
20
36
  label: e.planned_expenses,
21
- value: r(-i)
37
+ value: l(-o)
22
38
  },
23
39
  {
24
40
  bold: !0,
25
41
  key: "remaining",
26
42
  label: e.remaining,
27
- value: r(n)
43
+ value: l(n)
28
44
  }
29
45
  ]
30
46
  };
31
- }, m = { monthly_obligations: d }, p = (a, e) => u(m, a?.variant, "monthly_obligations", "AccountListBlock")(a?.drilldown_data, e);
47
+ }, p = { monthly_obligations: b }, k = (a, e) => g(p, a?.variant, "monthly_obligations", "AccountListBlock")(a?.drilldown_data, e);
32
48
  export {
33
- p as buildSummary,
34
- f as lastFour,
35
- _ as resolveBeatAccounts,
36
- b as sumBalances
49
+ k as buildSummary,
50
+ I as isCheckingAccount,
51
+ E as resolveBeatAccounts,
52
+ _ as toAccountRow,
53
+ N as toAccountSection
37
54
  };
38
55
 
39
56
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import type { Account, Beat, DrilldownData } from '../../../core'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { finiteNumberOf } from '../TransactionHistoryBlock/utils'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n/** The beat's `account_guids` among visible accounts (or every cash account when it names none), largest first. */\nexport const resolveBeatAccounts = (\n beat: Beat,\n visibleAccounts: Account[],\n cashAccounts: Account[],\n): Account[] => {\n const guids = new Set<string>(\n beat.account_guids?.length ? beat.account_guids : cashAccounts.map(({ guid }) => guid),\n )\n\n return visibleAccounts\n .filter((account) => guids.has(account.guid))\n .sort((a, b) => balanceOf(b) - balanceOf(a))\n}\n\nexport const sumBalances = (accounts: Account[]): number =>\n accounts.reduce((total, account) => total + balanceOf(account), 0)\n\n/** The last four digits of an account number; empty when the account has none. */\nexport const lastFour = (accountNumber?: string): string =>\n accountNumber?.replace(/\\D/g, '').slice(-4) ?? ''\n\n/** A generic breakdown row: a label and its already-formatted display value. */\nexport interface SummaryRow {\n key: string\n label: string\n value: string\n /** The emphasised total row. */\n bold?: boolean\n}\n\n/** The \"How is this calculated?\" breakdown, built per insight so AccountListContent stays generic. */\nexport interface AccountListSummary {\n heading: string\n rows: SummaryRow[]\n}\n\ntype SummaryBuilder = (\n drilldown: DrilldownData | undefined,\n copy: AccountListCopy,\n) => AccountListSummary | undefined\n\n/** Monthly Obligations breakdown; undefined unless all three figures are finite, so the drawer falls back to the list. */\nconst buildMonthlyObligationsSummary: SummaryBuilder = (drilldown, copy) => {\n const availableFunds = finiteNumberOf(drilldown?.available_funds)\n const plannedExpenses = finiteNumberOf(drilldown?.planned_expenses)\n const totalRemaining = finiteNumberOf(drilldown?.total_remaining)\n\n if (\n availableFunds === undefined ||\n plannedExpenses === undefined ||\n totalRemaining === undefined\n ) {\n return undefined\n }\n\n return {\n heading: copy.how_is_this_calculated,\n rows: [\n {\n key: 'available_funds',\n label: copy.available_funds,\n value: formatSignedCurrency(availableFunds),\n },\n // Shown as a deduction (-$1,200.00), per Figma; the figure is stored positive.\n {\n key: 'planned_expenses',\n label: copy.planned_expenses,\n value: formatSignedCurrency(-plannedExpenses),\n },\n {\n bold: true,\n key: 'remaining',\n label: copy.remaining,\n value: formatSignedCurrency(totalRemaining),\n },\n ],\n }\n}\n\nconst SUMMARY_BUILDERS = {\n monthly_obligations: buildMonthlyObligationsSummary,\n} satisfies Record<string, SummaryBuilder>\n\n/**\n * Builds the drawer breakdown from whichever CTA opened it, keyed by the CTA's `variant` (ditto's\n * `*_cta_variant`). Unknown/absent variants fall back to Monthly Obligations and warn.\n */\nexport const buildSummary = (\n cta: { variant?: string | null; drilldown_data?: DrilldownData } | undefined,\n copy: AccountListCopy,\n): AccountListSummary | undefined =>\n resolveVariantConfig(\n SUMMARY_BUILDERS,\n cta?.variant,\n 'monthly_obligations',\n 'AccountListBlock',\n )(cta?.drilldown_data, copy)\n"],"mappings":";;;AAMA,IAAM,IAAA,CAAa,MAAqB,EAAQ,WAAW,GAG9C,IAAA,CACX,GACA,GACA,MACc;AACd,QAAM,IAAQ,IAAI,IAChB,EAAK,eAAe,SAAS,EAAK,gBAAgB,EAAa,IAAA,CAAK,EAAE,MAAA,EAAA,MAAW,CAAI,CACvF;AAEA,SAAO,EACJ,OAAA,CAAQ,MAAY,EAAM,IAAI,EAAQ,IAAI,CAAC,EAC3C,KAAA,CAAM,GAAG,MAAM,EAAU,CAAC,IAAI,EAAU,CAAC,CAAC;AAC/C,GAEa,IAAA,CAAe,MAC1B,EAAS,OAAA,CAAQ,GAAO,MAAY,IAAQ,EAAU,CAAO,GAAG,CAAC,GAGtD,IAAA,CAAY,MACvB,GAAe,QAAQ,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,IAuB3C,IAAA,CAAkD,GAAW,MAAS;AAC1E,QAAM,IAAiB,EAAe,GAAW,eAAe,GAC1D,IAAkB,EAAe,GAAW,gBAAgB,GAC5D,IAAiB,EAAe,GAAW,eAAe;AAEhE,MACE,EAAA,MAAmB,UACnB,MAAoB,UACpB,MAAmB;AAKrB,WAAO;AAAA,MACL,SAAS,EAAK;AAAA,MACd,MAAM;AAAA,QACJ;AAAA,UACE,KAAK;AAAA,UACL,OAAO,EAAK;AAAA,UACZ,OAAO,EAAqB,CAAc;AAAA,QAC5C;AAAA,QAEA;AAAA,UACE,KAAK;AAAA,UACL,OAAO,EAAK;AAAA,UACZ,OAAO,EAAqB,CAAC,CAAe;AAAA,QAC9C;AAAA,QACA;AAAA,UACE,MAAM;AAAA,UACN,KAAK;AAAA,UACL,OAAO,EAAK;AAAA,UACZ,OAAO,EAAqB,CAAc;AAAA,QAC5C;AAAA,MACF;AAAA,IACF;AACF,GAEM,IAAmB,EACvB,qBAAqB,EACvB,GAMa,IAAA,CACX,GACA,MAEA,EACE,GACA,GAAK,SACL,uBACA,kBACF,EAAE,GAAK,gBAAgB,CAAI"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { AccountType, type Account, type Beat, type DrilldownData } from '../../../core'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { finiteNumberOf } from '../TransactionHistoryBlock/utils'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n/** The beat's `account_guids` among visible accounts (or every cash account when it names none), largest first. */\nexport const resolveBeatAccounts = (\n beat: Beat,\n visibleAccounts: Account[],\n cashAccounts: Account[],\n): Account[] => {\n const guids = new Set<string>(\n beat.account_guids?.length ? beat.account_guids : cashAccounts.map(({ guid }) => guid),\n )\n\n return visibleAccounts\n .filter((account) => guids.has(account.guid))\n .sort((a, b) => balanceOf(b) - balanceOf(a))\n}\n\n/** Checking-family types; every other cash account goes under Savings (Figma has just the two). */\nconst CHECKING_TYPES: ReadonlySet<AccountType> = new Set([\n AccountType.CHECKING,\n AccountType.CHECKING_LINE_OF_CREDIT,\n])\n\nexport const isCheckingAccount = (account: Account): boolean =>\n CHECKING_TYPES.has(account.account_type)\n\nexport interface AccountListRow {\n guid: string\n name: string\n /** Empty when no institution is known: the default logo is shown. */\n institutionGuid: string\n balance: number\n}\n\n/** A group of accounts (Checking or Savings) with its own balance subtotal. */\nexport interface AccountSection {\n key: string\n header: string\n total: number\n /** Already ordered, largest balance first. */\n rows: AccountListRow[]\n}\n\n/** One account as a row, its balance by the host's available-vs-current rule (as RemainingCashBlock). */\nexport const toAccountRow = (account: Account, showAvailable: boolean): AccountListRow => ({\n balance: getAccountStartingBalance(account, showAvailable),\n guid: account.guid,\n institutionGuid: account.institution_guid ?? '',\n name: getAccountDisplayName(account),\n})\n\n/** Rows largest displayed balance first, with the section subtotal. */\nexport const toAccountSection = (\n key: string,\n header: string,\n accounts: Account[],\n showAvailable: boolean,\n): AccountSection => {\n const rows = accounts\n .map((account) => toAccountRow(account, showAvailable))\n .sort((a, b) => b.balance - a.balance)\n\n return { header, key, rows, total: rows.reduce((total, row) => total + row.balance, 0) }\n}\n\n/** A generic breakdown row: a label and its already-formatted display value. */\nexport interface SummaryRow {\n key: string\n label: string\n value: string\n /** The emphasised total row. */\n bold?: boolean\n}\n\n/** The \"How is this calculated?\" breakdown, built per insight so AccountListContent stays generic. */\nexport interface AccountListSummary {\n heading: string\n rows: SummaryRow[]\n}\n\ntype SummaryBuilder = (\n drilldown: DrilldownData | undefined,\n copy: AccountListCopy,\n) => AccountListSummary | undefined\n\n/** Monthly Obligations breakdown; undefined unless all three figures are finite, so the drawer falls back to the list. */\nconst buildMonthlyObligationsSummary: SummaryBuilder = (drilldown, copy) => {\n const availableFunds = finiteNumberOf(drilldown?.available_funds)\n const plannedExpenses = finiteNumberOf(drilldown?.planned_expenses)\n const totalRemaining = finiteNumberOf(drilldown?.total_remaining)\n\n if (\n availableFunds === undefined ||\n plannedExpenses === undefined ||\n totalRemaining === undefined\n ) {\n return undefined\n }\n\n return {\n heading: copy.how_is_this_calculated,\n rows: [\n {\n key: 'available_funds',\n label: copy.available_funds,\n value: formatSignedCurrency(availableFunds),\n },\n // Shown as a deduction (-$1,200.00), per Figma; the figure is stored positive.\n {\n key: 'planned_expenses',\n label: copy.planned_expenses,\n value: formatSignedCurrency(-plannedExpenses),\n },\n {\n bold: true,\n key: 'remaining',\n label: copy.remaining,\n value: formatSignedCurrency(totalRemaining),\n },\n ],\n }\n}\n\nconst SUMMARY_BUILDERS = {\n monthly_obligations: buildMonthlyObligationsSummary,\n} satisfies Record<string, SummaryBuilder>\n\n/** The drawer breakdown for the opening CTA's `variant`; unknown variants warn and fall back. */\nexport const buildSummary = (\n cta: { variant?: string | null; drilldown_data?: DrilldownData } | undefined,\n copy: AccountListCopy,\n): AccountListSummary | undefined =>\n resolveVariantConfig(\n SUMMARY_BUILDERS,\n cta?.variant,\n 'monthly_obligations',\n 'AccountListBlock',\n )(cta?.drilldown_data, copy)\n"],"mappings":";;;;;;AAQA,IAAM,IAAA,CAAa,MAAqB,EAAQ,WAAW,GAG9C,IAAA,CACX,GACA,GACA,MACc;AACd,QAAM,IAAQ,IAAI,IAChB,EAAK,eAAe,SAAS,EAAK,gBAAgB,EAAa,IAAA,CAAK,EAAE,MAAA,EAAA,MAAW,CAAI,CACvF;AAEA,SAAO,EACJ,OAAA,CAAQ,MAAY,EAAM,IAAI,EAAQ,IAAI,CAAC,EAC3C,KAAA,CAAM,GAAG,MAAM,EAAU,CAAC,IAAI,EAAU,CAAC,CAAC;AAC/C,GAGM,IAA2C,oBAAI,IAAI,CACvD,EAAY,UACZ,EAAY,uBACd,CAAC,GAEY,IAAA,CAAqB,MAChC,EAAe,IAAI,EAAQ,YAAY,GAoB5B,IAAA,CAAgB,GAAkB,OAA4C;AAAA,EACzF,SAAS,EAA0B,GAAS,CAAa;AAAA,EACzD,MAAM,EAAQ;AAAA,EACd,iBAAiB,EAAQ,oBAAoB;AAAA,EAC7C,MAAM,EAAsB,CAAO;AACrC,IAGa,IAAA,CACX,GACA,GACA,GACA,MACmB;AACnB,QAAM,IAAO,EACV,IAAA,CAAK,MAAY,EAAa,GAAS,CAAa,CAAC,EACrD,KAAA,CAAM,GAAG,MAAM,EAAE,UAAU,EAAE,OAAO;AAEvC,SAAO;AAAA,IAAE,QAAA;AAAA,IAAQ,KAAA;AAAA,IAAK,MAAA;AAAA,IAAM,OAAO,EAAK,OAAA,CAAQ,GAAO,MAAQ,IAAQ,EAAI,SAAS,CAAC;AAAA,EAAE;AACzF,GAuBM,IAAA,CAAkD,GAAW,MAAS;AAC1E,QAAM,IAAiB,EAAe,GAAW,eAAe,GAC1D,IAAkB,EAAe,GAAW,gBAAgB,GAC5D,IAAiB,EAAe,GAAW,eAAe;AAEhE,MACE,EAAA,MAAmB,UACnB,MAAoB,UACpB,MAAmB;AAKrB,WAAO;AAAA,MACL,SAAS,EAAK;AAAA,MACd,MAAM;AAAA,QACJ;AAAA,UACE,KAAK;AAAA,UACL,OAAO,EAAK;AAAA,UACZ,OAAO,EAAqB,CAAc;AAAA,QAC5C;AAAA,QAEA;AAAA,UACE,KAAK;AAAA,UACL,OAAO,EAAK;AAAA,UACZ,OAAO,EAAqB,CAAC,CAAe;AAAA,QAC9C;AAAA,QACA;AAAA,UACE,MAAM;AAAA,UACN,KAAK;AAAA,UACL,OAAO,EAAK;AAAA,UACZ,OAAO,EAAqB,CAAc;AAAA,QAC5C;AAAA,MACF;AAAA,IACF;AACF,GAEM,IAAmB,EACvB,qBAAqB,EACvB,GAGa,IAAA,CACX,GACA,MAEA,EACE,GACA,GAAK,SACL,uBACA,kBACF,EAAE,GAAK,gBAAgB,CAAI"}
@@ -1 +1,3 @@
1
- export declare const useAccountListPrepare: () => void;
1
+ import { ActionBlockProps } from '../../mappings/blocks';
2
+ /** Loads the accounts, the recurring transactions behind the Recurring Expenses tab, and what a tapped account's Account Details needs. */
3
+ export declare const useAccountListPrepare: (props: ActionBlockProps) => void;
@@ -1,13 +1,15 @@
1
- import { useAccountStore as c } from "../../../common/context/hooks.es.js";
2
- import e from "react";
3
- var u = () => {
4
- const { accountsLoaded: o, loadAccounts: t } = c();
5
- e.useEffect(() => {
6
- o || t();
7
- }, [o, t]);
1
+ import { useAccountStore as t } from "../../../common/context/hooks.es.js";
2
+ import { useRecurringTransactionPrepare as c } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
3
+ import { useAccountDetailsPrepare as a } from "../AccountDetailsBlock/useAccountDetailsPrepare.es.js";
4
+ import s from "react";
5
+ var p = (e) => {
6
+ const { accountsLoaded: r, loadAccounts: o } = t();
7
+ s.useEffect(() => {
8
+ r || o();
9
+ }, [r, o]), c(e), a();
8
10
  };
9
11
  export {
10
- u as useAccountListPrepare
12
+ p as useAccountListPrepare
11
13
  };
12
14
 
13
15
  //# sourceMappingURL=useAccountListPrepare.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAccountListPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useAccountStore } from '../../../common'\n\nexport const useAccountListPrepare = () => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!accountsLoaded) void loadAccounts()\n }, [accountsLoaded, loadAccounts])\n}\n"],"mappings":";;AAIA,IAAa,IAAA,MAA8B;AACzC,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KAAgB,EAAkB;AAAA,EACzC,GAAG,CAAC,GAAgB,CAAY,CAAC;AACnC"}
1
+ {"version":3,"file":"useAccountListPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useAccountStore } from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useAccountDetailsPrepare } from '../AccountDetailsBlock'\nimport { useRecurringTransactionPrepare } from '../RecurringTransactionBlock'\n\n/** Loads the accounts, the recurring transactions behind the Recurring Expenses tab, and what a tapped account's Account Details needs. */\nexport const useAccountListPrepare = (props: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!accountsLoaded) void loadAccounts()\n }, [accountsLoaded, loadAccounts])\n\n useRecurringTransactionPrepare(props)\n // Members and institutions for the nested Account Details (also loads accounts, once).\n useAccountDetailsPrepare()\n}\n"],"mappings":";;;;AAQA,IAAa,IAAA,CAAyB,MAA4B;AAChE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KAAgB,EAAkB;AAAA,EACzC,GAAG,CAAC,GAAgB,CAAY,CAAC,GAEjC,EAA+B,CAAK,GAEpC,EAAyB;AAC3B"}
@@ -1,57 +1,53 @@
1
- import { buildDynamicCopy as $ } from "../../../core/utils/Localization.es.js";
2
- import { DATE_FORMATS_INTL as ue, formatDate as me } from "../../../core/constants/DateFormats.es.js";
3
- import { useBudgetsStore as ge, useCategoryStore as pe, useGlobalCopyStore as _e, useGlobalStore as ye, useInsightsV2Store as fe, useTransactionStore as he } from "../../../common/context/hooks.es.js";
4
- import be from "../../../common/components/drawer/Drawer.es.js";
5
- import { getCategoryColor as H, getLocalizedCategoryName as Ce } from "../../../core/utils/CategoryUtil.es.js";
6
- import { exportTransactionsToCSV as Te } from "../../../core/utils/TransactionUtils.es.js";
7
- import ve from "../../../common/components/Loader.es.js";
8
- import xe from "../../../common/components/CurrencyDialog.es.js";
9
- import De from "../../../transactions/components/shared/TransactionList.es.js";
10
- import { budgetMonthRange as Be, daysLeftInBudgetMonth as Se, isPositiveAmount as Ae, recordedActiveAtOf as Ge, resolveBudgetDetailsLayout as Ee, resolveBudgetFacts as ke } from "./layout.es.js";
11
- import { ANALYTICS_EVENTS_CONFIG as C } from "../../analytics/analyticsEventsConfig.es.js";
12
- import { useAnalyticsEvent as Le } from "../../analytics/useAnalyticsEvent.es.js";
13
- import Ie from "../../components/shared/StatusSnackbar.es.js";
14
- import { getDynamicCtaBasedOnTriggers as we } from "../util.es.js";
1
+ import { buildDynamicCopy as P } from "../../../core/utils/Localization.es.js";
2
+ import { DATE_FORMATS_INTL as de, formatDate as le } from "../../../core/constants/DateFormats.es.js";
3
+ import { useBudgetsStore as ue, useCategoryStore as me, useGlobalCopyStore as ge, useGlobalStore as _e, useInsightsV2Store as pe, useTransactionStore as fe } from "../../../common/context/hooks.es.js";
4
+ import ye from "../../../common/components/drawer/Drawer.es.js";
5
+ import { getLocalizedCategoryName as he } from "../../../core/utils/CategoryUtil.es.js";
6
+ import { exportTransactionsToCSV as be } from "../../../core/utils/TransactionUtils.es.js";
7
+ import Te from "../../../common/components/Loader.es.js";
8
+ import Ce from "../../../common/components/CurrencyDialog.es.js";
9
+ import ve from "../../../transactions/components/shared/TransactionList.es.js";
10
+ import { budgetMonthRange as De, daysLeftInBudgetMonth as xe, isPositiveAmount as Be, recordedActiveAtOf as Se, resolveBudgetDetailsLayout as Ae, resolveBudgetFacts as Ee } from "./layout.es.js";
11
+ import { ANALYTICS_EVENTS_CONFIG as T } from "../../analytics/analyticsEventsConfig.es.js";
12
+ import { useAnalyticsEvent as ke } from "../../analytics/useAnalyticsEvent.es.js";
13
+ import Ge from "../../components/CategoryTile.es.js";
14
+ import Le from "../../components/LogoMark.es.js";
15
+ import we from "../../components/shared/StatusSnackbar.es.js";
16
+ import { getDynamicCtaBasedOnTriggers as Ie } from "../util.es.js";
15
17
  import { TransactionDetailsBlock as Me } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
16
18
  import { BudgetSummary as Ne } from "./BudgetSummary.es.js";
17
- import { useRef as Oe, useState as T } from "react";
19
+ import { useRef as Oe, useState as C } from "react";
18
20
  import { observer as Re } from "mobx-react-lite";
19
- import y from "@mui/material/Stack";
20
- import { CategoryIcon as Ve, MerchantLogo as je, Text as k } from "@mxenabled/mxui";
21
+ import f from "@mui/material/Stack";
22
+ import { Text as G } from "@mxenabled/mxui";
21
23
  import L from "@mui/material/Button";
22
- import { Icon as Fe } from "@mxenabled/mx-icons";
24
+ import { Icon as Ve } from "@mxenabled/mx-icons";
23
25
  import { jsx as t, jsxs as v } from "react/jsx-runtime";
24
- import { alpha as Ue, useTheme as ze } from "@mui/material/styles";
25
- import Pe from "@mui/material/Box";
26
- var yt = Re(function({ beat: n }) {
27
- const I = ze(), { copyStore: Y, emitUpdate: W } = ye(), { budgets: o, categories: q, common: l, insights_feed: x, transactions: J } = _e(), u = ge(), K = pe(), w = he(), m = fe(), f = Le(), [i, D] = T(null), [g, h] = T(""), [a, p] = T(null), [Q, M] = T(!1), B = Oe(!1), N = x?.budget_details, { categories: X } = K, r = ke(n), O = Ge(m, n), Z = Be(n, O), { primary_cta: ee, secondary_cta: te, in_description_cta: oe } = n.insights_payload ?? {}, re = we(m.actionDrawer, ee, te, oe)?.variant, { showPeriodLine: ie } = Ee(re);
28
- if (!Y.isInitialized) return /* @__PURE__ */ t(ve, {});
29
- if (!N) return /* @__PURE__ */ t(y, {
26
+ import je from "@mui/material/Box";
27
+ var gt = Re(function({ beat: n }) {
28
+ const { copyStore: H, emitUpdate: Y } = _e(), { budgets: o, categories: $, common: l, insights_feed: D, transactions: W } = ge(), u = ue(), q = me(), w = fe(), m = pe(), y = ke(), [r, x] = C(null), [g, h] = C(""), [a, _] = C(null), [J, I] = C(!1), B = Oe(!1), M = D?.budget_details, { categories: K } = q, i = Ee(n), N = Se(m, n), Q = De(n, N), { primary_cta: X, secondary_cta: Z, in_description_cta: ee } = n.insights_payload ?? {}, te = Ie(m.actionDrawer, X, Z, ee)?.variant, { showPeriodLine: oe } = Ae(te);
29
+ if (!H.isInitialized) return /* @__PURE__ */ t(Te, {});
30
+ if (!M) return /* @__PURE__ */ t(f, {
30
31
  sx: { p: 24 },
31
- children: /* @__PURE__ */ t(k, { children: l?.error_message })
32
+ children: /* @__PURE__ */ t(G, { children: l?.error_message })
32
33
  });
33
- const R = r.categoryGuid ? X.find(({ guid: e }) => e === r.categoryGuid) : void 0, s = r.categoryGuid ? u.budgets.find(({ category_guid: e }) => e === r.categoryGuid) : void 0, c = !r.categoryGuid && r.merchantGuid ? u.getMerchantBudgetByMerchantGuid(r.merchantGuid) : void 0, V = (R && Ce(R, q)) ?? c?.merchant_name ?? n.payload?.merchant_name ?? "", j = s?.amount ?? c?.amount ?? r.budgeted ?? 0, ne = r.spent ?? s?.transaction_total ?? c?.transaction_total ?? 0, ae = r.categoryGuid ? /* @__PURE__ */ t(Ve, {
34
- categoryGuid: r.categoryGuid,
34
+ const O = i.categoryGuid ? K.find(({ guid: e }) => e === i.categoryGuid) : void 0, s = i.categoryGuid ? u.budgets.find(({ category_guid: e }) => e === i.categoryGuid) : void 0, c = !i.categoryGuid && i.merchantGuid ? u.getMerchantBudgetByMerchantGuid(i.merchantGuid) : void 0, R = (O && he(O, $)) ?? c?.merchant_name ?? n.payload?.merchant_name ?? "", V = s?.amount ?? c?.amount ?? i.budgeted ?? 0, re = i.spent ?? s?.transaction_total ?? c?.transaction_total ?? 0, ie = i.categoryGuid ? /* @__PURE__ */ t(Ge, {
35
+ categoryGuid: i.categoryGuid,
35
36
  size: 44,
36
- sx: {
37
- bgcolor: Ue(H(r.categoryGuid, I), 0.15),
38
- border: `1px solid ${H(r.categoryGuid, I)}`,
39
- color: "text.primary"
40
- }
41
- }) : /* @__PURE__ */ t(je, {
42
- categoryGuid: "",
43
- merchantGuid: r.merchantGuid ?? "",
37
+ tint: 0.15
38
+ }) : /* @__PURE__ */ t(Le, {
39
+ logo: { merchant_guid: i.merchantGuid },
44
40
  size: 44
45
- }), F = w.sortedTransactionsWithSplits, U = (e) => {
46
- e === "delete" && f(C.BUDGET_DELETE_START), h(e === "edit" ? String(j) : ""), D(e);
41
+ }), j = w.sortedTransactionsWithSplits, F = (e) => {
42
+ e === "delete" && y(T.BUDGET_DELETE_START), h(e === "edit" ? String(V) : ""), x(e);
43
+ }, U = () => {
44
+ x(null), h("");
47
45
  }, z = () => {
48
- D(null), h("");
49
- }, P = () => {
50
- i === "delete" && f(C.BUDGET_DELETE_CANCEL), z();
51
- }, d = (e) => $(e, V), S = (e) => d({
46
+ r === "delete" && y(T.BUDGET_DELETE_CANCEL), U();
47
+ }, d = (e) => P(e, R), S = (e) => d({
52
48
  edit: o.error_alert_edit_merchant_budget,
53
49
  delete: o.error_alert_delete_merchant_budget
54
- }[e]), se = async (e, _) => {
50
+ }[e]), ne = async (e, p) => {
55
51
  if (c) {
56
52
  if (e === "delete") {
57
53
  const { isSuccess: b } = await u.deleteMerchantBudget(c.guid);
@@ -61,12 +57,12 @@ var yt = Re(function({ beat: n }) {
61
57
  failure: d(o.error_alert_delete_merchant_budget)
62
58
  };
63
59
  }
64
- const { isSuccess: E } = await u.updateMerchantBudget({
60
+ const { isSuccess: k } = await u.updateMerchantBudget({
65
61
  ...c,
66
- amount: _
62
+ amount: p
67
63
  });
68
64
  return {
69
- ok: E,
65
+ ok: k,
70
66
  success: d(o.success_alert_edit_merchant_budget),
71
67
  failure: d(o.error_alert_edit_merchant_budget)
72
68
  };
@@ -78,7 +74,7 @@ var yt = Re(function({ beat: n }) {
78
74
  } : e === "edit" && s ? {
79
75
  ok: await u.updateBudget({
80
76
  ...s,
81
- amount: _
77
+ amount: p
82
78
  }),
83
79
  success: d(o.alert_budget_updated),
84
80
  failure: S(e)
@@ -86,47 +82,47 @@ var yt = Re(function({ beat: n }) {
86
82
  ok: !1,
87
83
  success: ""
88
84
  };
89
- }, ce = async () => {
90
- if (B.current || !i) return;
85
+ }, ae = async () => {
86
+ if (B.current || !r) return;
91
87
  const e = Number(g);
92
- if (i !== "delete" && !Ae(g)) return;
88
+ if (r !== "delete" && !Be(g)) return;
93
89
  B.current = !0;
94
- const _ = {
95
- action: i,
90
+ const p = {
91
+ action: r,
96
92
  amount: g
97
93
  };
98
94
  try {
99
- const { ok: E, success: b, failure: le } = await se(i, e);
100
- if (E) {
101
- if (W({ staleBeatGuid: n.guid }), i === "edit" && f({
102
- ...C.BUDGET_EDIT_SAVE,
95
+ const { ok: k, success: b, failure: ce } = await ne(r, e);
96
+ if (k) {
97
+ if (Y({ staleBeatGuid: n.guid }), r === "edit" && y({
98
+ ...T.BUDGET_EDIT_SAVE,
103
99
  value: g
104
- }), i === "delete") {
105
- f(C.BUDGET_DELETE_END), m.setActionNotice(n.guid, {
100
+ }), r === "delete") {
101
+ y(T.BUDGET_DELETE_END), m.setActionNotice(n.guid, {
106
102
  message: b,
107
103
  severity: "success"
108
104
  }), m.closeActionDrawer();
109
105
  return;
110
106
  }
111
- p({
107
+ _({
112
108
  message: b,
113
109
  severity: "success"
114
110
  });
115
- } else p({
116
- message: le ?? l.error_message,
111
+ } else _({
112
+ message: ce ?? l.error_message,
117
113
  severity: "error",
118
- retry: _
114
+ retry: p
119
115
  });
120
116
  } catch {
121
- p({
122
- message: S(i),
117
+ _({
118
+ message: S(r),
123
119
  severity: "error",
124
- retry: _
120
+ retry: p
125
121
  });
126
122
  } finally {
127
- B.current = !1, z();
123
+ B.current = !1, U();
128
124
  }
129
- }, de = !!(s ?? c) && /* @__PURE__ */ v(y, {
125
+ }, se = !!(s ?? c) && /* @__PURE__ */ v(f, {
130
126
  sx: {
131
127
  bgcolor: "background.paper",
132
128
  borderTop: 1,
@@ -142,15 +138,15 @@ var yt = Re(function({ beat: n }) {
142
138
  },
143
139
  children: [/* @__PURE__ */ t(L, {
144
140
  color: "error",
145
- onClick: () => U("delete"),
141
+ onClick: () => F("delete"),
146
142
  variant: "outlined",
147
143
  children: o.details_delete_button
148
144
  }), /* @__PURE__ */ t(L, {
149
- onClick: () => U("edit"),
145
+ onClick: () => F("edit"),
150
146
  variant: "contained",
151
147
  children: o.details_edit_button
152
148
  })]
153
- }), A = i === "delete", G = {
149
+ }), A = r === "delete", E = {
154
150
  edit: {
155
151
  content: o.edit_budget_content,
156
152
  primaryText: o.add_save_button,
@@ -162,90 +158,90 @@ var yt = Re(function({ beat: n }) {
162
158
  title: o.delete_title
163
159
  }
164
160
  };
165
- return /* @__PURE__ */ v(y, {
161
+ return /* @__PURE__ */ v(f, {
166
162
  sx: { minHeight: "100%" },
167
163
  children: [
168
- /* @__PURE__ */ v(y, {
164
+ /* @__PURE__ */ v(f, {
169
165
  sx: {
170
166
  bgcolor: "background.paper",
171
167
  gap: 16,
172
168
  p: 24
173
169
  },
174
- children: [/* @__PURE__ */ v(y, {
170
+ children: [/* @__PURE__ */ v(f, {
175
171
  sx: {
176
172
  alignItems: "center",
177
173
  flexDirection: "row",
178
174
  justifyContent: "space-between"
179
175
  },
180
- children: [/* @__PURE__ */ t(k, {
176
+ children: [/* @__PURE__ */ t(G, {
181
177
  bold: !0,
182
178
  variant: "body1",
183
- children: me(Z.start, ue.MONTH_YEAR)
184
- }), F.length > 0 && /* @__PURE__ */ t(L, {
185
- onClick: () => Te(F, w.tags),
186
- startIcon: /* @__PURE__ */ t(Fe, { name: "ios_share" }),
179
+ children: le(Q.start, de.MONTH_YEAR)
180
+ }), j.length > 0 && /* @__PURE__ */ t(L, {
181
+ onClick: () => be(j, w.tags),
182
+ startIcon: /* @__PURE__ */ t(Ve, { name: "ios_share" }),
187
183
  sx: { height: 28 },
188
- children: /* @__PURE__ */ t(k, {
184
+ children: /* @__PURE__ */ t(G, {
189
185
  bold: !0,
190
186
  variant: "body2",
191
- children: J.export_csv_btn
187
+ children: W.export_csv_btn
192
188
  })
193
189
  })]
194
190
  }), /* @__PURE__ */ t(Ne, {
195
191
  budgetsCopy: o,
196
- copy: N,
197
- daysLeft: Se(n, void 0, O),
198
- icon: ae,
199
- limit: j,
200
- showPeriodLine: ie,
201
- spent: ne
192
+ copy: M,
193
+ daysLeft: xe(n, void 0, N),
194
+ icon: ie,
195
+ limit: V,
196
+ showPeriodLine: oe,
197
+ spent: re
202
198
  })]
203
199
  }),
204
- /* @__PURE__ */ t(Pe, {
200
+ /* @__PURE__ */ t(je, {
205
201
  sx: {
206
202
  bgcolor: "background.default",
207
203
  flexGrow: 1
208
204
  },
209
- children: /* @__PURE__ */ t(De, { onClick: (e) => {
210
- m.setActionContext({ transaction_guid: e }), M(!0);
205
+ children: /* @__PURE__ */ t(ve, { onClick: (e) => {
206
+ m.setActionContext({ transaction_guid: e }), I(!0);
211
207
  } })
212
208
  }),
213
- de,
214
- i && /* @__PURE__ */ t(xe, {
209
+ se,
210
+ r && /* @__PURE__ */ t(Ce, {
215
211
  closeAriaLabel: l.close_aria,
216
- content: $(G[i].content, /* @__PURE__ */ t("b", { children: V })),
212
+ content: P(E[r].content, /* @__PURE__ */ t("b", { children: R })),
217
213
  handleInputChange: h,
218
- handleModalClose: P,
214
+ handleModalClose: z,
219
215
  handlePrimaryAction: () => {
220
- ce();
216
+ ae();
221
217
  },
222
- handleSecondaryAction: P,
218
+ handleSecondaryAction: z,
223
219
  inputLabel: A ? void 0 : o.add_label,
224
220
  inputValue: g,
225
221
  isOpen: !0,
226
222
  primaryColor: A ? "error" : "primary",
227
- primaryText: G[i].primaryText,
223
+ primaryText: E[r].primaryText,
228
224
  secondaryColor: A ? "inherit" : "primary",
229
225
  secondaryText: l.cancel_button,
230
- title: G[i].title
226
+ title: E[r].title
231
227
  }),
232
- /* @__PURE__ */ t(be, {
228
+ /* @__PURE__ */ t(ye, {
233
229
  ariaLabelClose: l.close_aria,
234
- isOpen: Q,
230
+ isOpen: J,
235
231
  onClose: () => {
236
- M(!1), m.setActionContext({ transaction_guid: void 0 });
232
+ I(!1), m.setActionContext({ transaction_guid: void 0 });
237
233
  },
238
- title: x.general.transaction_details_title,
234
+ title: D.general.transaction_details_title,
239
235
  children: /* @__PURE__ */ t(Me, { beat: n })
240
236
  }),
241
- /* @__PURE__ */ t(Ie, {
242
- actionText: a?.retry ? x?.general?.try_again : void 0,
237
+ /* @__PURE__ */ t(we, {
238
+ actionText: a?.retry ? D?.general?.try_again : void 0,
243
239
  closeAriaLabel: l.close_aria,
244
240
  message: a?.message ?? "",
245
241
  onActionClick: () => {
246
- a?.retry && (h(a.retry.amount), D(a.retry.action), p(null));
242
+ a?.retry && (h(a.retry.amount), x(a.retry.action), _(null));
247
243
  },
248
- onClose: () => p(null),
244
+ onClose: () => _(null),
249
245
  open: !!a,
250
246
  severity: a?.severity
251
247
  })
@@ -253,7 +249,7 @@ var yt = Re(function({ beat: n }) {
253
249
  });
254
250
  });
255
251
  export {
256
- yt as BudgetDetailsBlock
252
+ gt as BudgetDetailsBlock
257
253
  };
258
254
 
259
255
  //# sourceMappingURL=BudgetDetailsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BudgetDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.tsx"],"sourcesContent":["import { useRef, useState, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { CategoryIcon, MerchantLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { CurrencyDialog, Drawer } from '../../../common/components'\nimport {\n Loader,\n useBudgetsStore,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport { getCategoryColor, getLocalizedCategoryName } from '../../../core/utils/CategoryUtil'\nimport type { Budget, MerchantBudget } from '../../../core'\nimport { TransactionList } from '../../../transactions'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport StatusSnackbar from '../../components/shared/StatusSnackbar'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { BudgetSummary } from './BudgetSummary'\nimport {\n budgetMonthRange,\n daysLeftInBudgetMonth,\n isPositiveAmount,\n recordedActiveAtOf,\n resolveBudgetDetailsLayout,\n resolveBudgetFacts,\n} from './layout'\n\n// Figma's Budget Details offers Edit and Delete only: the drawer opens on an existing budget.\ntype DialogAction = 'edit' | 'delete'\n\ninterface Toast {\n message: string\n severity: 'success' | 'error'\n /** A failed write's dialog and amount, reopened by the snackbar's Try Again. */\n retry?: { action: DialogAction; amount: string }\n}\n\nexport const BudgetDetailsBlock = observer(function BudgetDetailsBlock({ beat }: ActionBlockProps) {\n const theme = useTheme()\n const { copyStore, emitUpdate } = useGlobalStore()\n const {\n budgets: budgetsCopy,\n categories: categoriesCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n transactions: transactionsCopy,\n } = useGlobalCopyStore()\n const budgetsStore = useBudgetsStore()\n const categoryStore = useCategoryStore()\n const transactionStore = useTransactionStore()\n const insightsV2Store = useInsightsV2Store()\n const fireAnalyticsEvent = useAnalyticsEvent()\n const [dialog, setDialog] = useState<DialogAction | null>(null)\n const [amount, setAmount] = useState('')\n const [toast, setToast] = useState<Toast | null>(null)\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n const inProgress = useRef(false)\n const copy = insightsFeedCopy?.budget_details\n const { categories } = categoryStore\n\n const facts = resolveBudgetFacts(beat)\n const recordedActiveAt = recordedActiveAtOf(insightsV2Store, beat)\n const dateRange = budgetMonthRange(beat, recordedActiveAt)\n const { primary_cta, secondary_cta, in_description_cta } = beat.insights_payload ?? {}\n const variant = getDynamicCtaBasedOnTriggers(\n insightsV2Store.actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )?.variant\n const { showPeriodLine } = resolveBudgetDetailsLayout(variant)\n\n if (!copyStore.isInitialized) return <Loader />\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n const category = facts.categoryGuid\n ? categories.find(({ guid }) => guid === facts.categoryGuid)\n : undefined\n const budget: Budget | undefined = facts.categoryGuid\n ? budgetsStore.budgets.find(({ category_guid }) => category_guid === facts.categoryGuid)\n : undefined\n const merchantBudget: MerchantBudget | undefined =\n !facts.categoryGuid && facts.merchantGuid\n ? budgetsStore.getMerchantBudgetByMerchantGuid(facts.merchantGuid)\n : undefined\n const subject =\n (category && getLocalizedCategoryName(category, categoriesCopy)) ??\n merchantBudget?.merchant_name ??\n (beat.payload?.merchant_name as string | undefined) ??\n ''\n const limit = budget?.amount ?? merchantBudget?.amount ?? facts.budgeted ?? 0\n const spent = facts.spent ?? budget?.transaction_total ?? merchantBudget?.transaction_total ?? 0\n\n const icon = facts.categoryGuid ? (\n <CategoryIcon\n categoryGuid={facts.categoryGuid}\n size={44}\n sx={{\n bgcolor: alpha(getCategoryColor(facts.categoryGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(facts.categoryGuid, theme)}`,\n color: 'text.primary',\n }}\n />\n ) : (\n <MerchantLogo categoryGuid=\"\" merchantGuid={facts.merchantGuid ?? ''} size={44} />\n )\n\n const monthTransactions = transactionStore.sortedTransactionsWithSplits\n\n const openDialog = (action: DialogAction) => {\n if (action === 'delete') fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.BUDGET_DELETE_START)\n setAmount(action === 'edit' ? String(limit) : '')\n setDialog(action)\n }\n\n const closeDialog = () => {\n setDialog(null)\n setAmount('')\n }\n\n // Cancel, close icon or backdrop.\n const cancelDialog = () => {\n if (dialog === 'delete') fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.BUDGET_DELETE_CANCEL)\n closeDialog()\n }\n\n const dynamic = (key: string) => buildDynamicCopy(key, subject) as string\n\n // \"Your {subject} budget could not be …\": the subject is the copy's one variable.\n const failureFor = (action: DialogAction) =>\n dynamic(\n {\n edit: budgetsCopy.error_alert_edit_merchant_budget,\n delete: budgetsCopy.error_alert_delete_merchant_budget,\n }[action],\n )\n\n const perform = async (\n action: DialogAction,\n value: number,\n ): Promise<{ ok: boolean; success: string; failure?: string }> => {\n if (merchantBudget) {\n if (action === 'delete') {\n const { isSuccess } = await budgetsStore.deleteMerchantBudget(merchantBudget.guid)\n return {\n ok: isSuccess,\n success: dynamic(budgetsCopy.success_alert_delete_merchant_budget),\n failure: dynamic(budgetsCopy.error_alert_delete_merchant_budget),\n }\n }\n const { isSuccess } = await budgetsStore.updateMerchantBudget({\n ...merchantBudget,\n amount: value,\n })\n return {\n ok: isSuccess,\n success: dynamic(budgetsCopy.success_alert_edit_merchant_budget),\n failure: dynamic(budgetsCopy.error_alert_edit_merchant_budget),\n }\n }\n if (action === 'delete' && budget) {\n return {\n ok: await budgetsStore.deleteBudget(budget.guid),\n success: dynamic(budgetsCopy.alert_budget_deleted),\n failure: failureFor(action),\n }\n }\n if (action === 'edit' && budget) {\n return {\n ok: await budgetsStore.updateBudget({ ...budget, amount: value }),\n success: dynamic(budgetsCopy.alert_budget_updated),\n failure: failureFor(action),\n }\n }\n return { ok: false, success: '' }\n }\n\n const submit = async () => {\n if (inProgress.current || !dialog) return\n const value = Number(amount)\n if (dialog !== 'delete' && !isPositiveAmount(amount)) return\n\n inProgress.current = true\n const retry = { action: dialog, amount }\n try {\n const { ok, success, failure } = await perform(dialog, value)\n if (ok) {\n // The host re-reads the beat, so a sampled card follows the budget.\n emitUpdate({ staleBeatGuid: beat.guid })\n if (dialog === 'edit') {\n fireAnalyticsEvent({ ...ANALYTICS_EVENTS_CONFIG.BUDGET_EDIT_SAVE, value: amount })\n }\n if (dialog === 'delete') {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.BUDGET_DELETE_END)\n // No budget left: close the drawer, as pulse did; the message outlives it.\n insightsV2Store.setActionNotice(beat.guid, { message: success, severity: 'success' })\n insightsV2Store.closeActionDrawer()\n return\n }\n setToast({ message: success, severity: 'success' })\n } else {\n setToast({ message: failure ?? commonCopy.error_message, severity: 'error', retry })\n }\n } catch {\n setToast({ message: failureFor(dialog), severity: 'error', retry })\n } finally {\n inProgress.current = false\n closeDialog()\n }\n }\n\n const hasBudget = Boolean(budget ?? merchantBudget)\n\n // Figma's footer, once the budget has loaded.\n const footer = hasBudget && (\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderTop: 1,\n borderTopColor: 'divider',\n bottom: 0,\n flexDirection: 'row',\n gap: 16,\n justifyContent: 'flex-end',\n mt: 'auto',\n position: 'sticky',\n px: 24,\n py: 16,\n }}\n >\n <Button color=\"error\" onClick={() => openDialog('delete')} variant=\"outlined\">\n {budgetsCopy.details_delete_button}\n </Button>\n <Button onClick={() => openDialog('edit')} variant=\"contained\">\n {budgetsCopy.details_edit_button}\n </Button>\n </Stack>\n )\n\n const isDelete = dialog === 'delete'\n const dialogCopy = {\n edit: {\n content: budgetsCopy.edit_budget_content,\n primaryText: budgetsCopy.add_save_button,\n title: budgetsCopy.details_edit_title,\n },\n delete: {\n content: budgetsCopy.delete_description,\n primaryText: budgetsCopy.details_delete_button,\n title: budgetsCopy.delete_title,\n },\n }\n\n return (\n <Stack sx={{ minHeight: '100%' }}>\n <Stack sx={{ bgcolor: 'background.paper', gap: 16, p: 24 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text bold={true} variant=\"body1\">\n {formatDate(dateRange.start, DATE_FORMATS_INTL.MONTH_YEAR)}\n </Text>\n {monthTransactions.length > 0 && (\n <Button\n onClick={() => exportTransactionsToCSV(monthTransactions, transactionStore.tags)}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n <BudgetSummary\n budgetsCopy={budgetsCopy}\n copy={copy}\n daysLeft={daysLeftInBudgetMonth(beat, undefined, recordedActiveAt)}\n icon={icon}\n limit={limit}\n showPeriodLine={showPeriodLine}\n spent={spent}\n />\n </Stack>\n {/* The month's transactions, always: the list shows its own zero state when there are none. */}\n <Box sx={{ bgcolor: 'background.default', flexGrow: 1 }}>\n {/* As legacy: a tapped row opens its Transaction Details over the budget. */}\n <TransactionList\n onClick={(guid) => {\n insightsV2Store.setActionContext({ transaction_guid: guid })\n setIsTransactionDetailsOpen(true)\n }}\n />\n </Box>\n {footer}\n {dialog && (\n <CurrencyDialog\n closeAriaLabel={commonCopy.close_aria}\n content={buildDynamicCopy(dialogCopy[dialog].content, <b>{subject}</b>) as ReactNode}\n handleInputChange={setAmount}\n handleModalClose={cancelDialog}\n handlePrimaryAction={() => void submit()}\n handleSecondaryAction={cancelDialog}\n inputLabel={isDelete ? undefined : budgetsCopy.add_label}\n inputValue={amount}\n isOpen={true}\n primaryColor={isDelete ? 'error' : 'primary'}\n primaryText={dialogCopy[dialog].primaryText}\n secondaryColor={isDelete ? 'inherit' : 'primary'}\n secondaryText={commonCopy.cancel_button}\n title={dialogCopy[dialog].title}\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: the outer drawer's context must survive.\n insightsV2Store.setActionContext({ transaction_guid: undefined })\n }}\n title={insightsFeedCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n <StatusSnackbar\n actionText={toast?.retry ? insightsFeedCopy?.general?.try_again : undefined}\n closeAriaLabel={commonCopy.close_aria}\n message={toast?.message ?? ''}\n onActionClick={() => {\n if (!toast?.retry) return\n setAmount(toast.retry.amount)\n setDialog(toast.retry.action)\n setToast(null)\n }}\n onClose={() => setToast(null)}\n open={Boolean(toast)}\n severity={toast?.severity}\n />\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAa,KAAqB,GAAS,SAA4B,EAAE,MAAA,EAAA,GAA0B;AACjG,QAAM,IAAQ,GAAS,GACjB,EAAE,WAAA,GAAW,YAAA,EAAA,IAAe,GAAe,GAC3C,EACJ,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,eAAe,GAC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B,EAAS,IAAI;AAAA,QACf;AAAA,QACA,SAAA,MAAe,EAAS,IAAI;AAAA,QAC5B,MAAM,EAAQ;AAAA,QACd,UAAU,GAAO;AAAA,MAClB,CAAA;AAAA,IACI;AAAA;AAEX,CAAC"}
1
+ {"version":3,"file":"BudgetDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.tsx"],"sourcesContent":["import { useRef, useState, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { CurrencyDialog, Drawer } from '../../../common/components'\nimport {\n Loader,\n useBudgetsStore,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport { getLocalizedCategoryName } from '../../../core/utils/CategoryUtil'\nimport type { Budget, MerchantBudget } from '../../../core'\nimport { TransactionList } from '../../../transactions'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport CategoryTile from '../../components/CategoryTile'\nimport LogoMark from '../../components/LogoMark'\nimport StatusSnackbar from '../../components/shared/StatusSnackbar'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { BudgetSummary } from './BudgetSummary'\nimport {\n budgetMonthRange,\n daysLeftInBudgetMonth,\n isPositiveAmount,\n recordedActiveAtOf,\n resolveBudgetDetailsLayout,\n resolveBudgetFacts,\n} from './layout'\n\n// Figma's Budget Details offers Edit and Delete only: the drawer opens on an existing budget.\ntype DialogAction = 'edit' | 'delete'\n\ninterface Toast {\n message: string\n severity: 'success' | 'error'\n /** A failed write's dialog and amount, reopened by the snackbar's Try Again. */\n retry?: { action: DialogAction; amount: string }\n}\n\nexport const BudgetDetailsBlock = observer(function BudgetDetailsBlock({ beat }: ActionBlockProps) {\n const { copyStore, emitUpdate } = useGlobalStore()\n const {\n budgets: budgetsCopy,\n categories: categoriesCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n transactions: transactionsCopy,\n } = useGlobalCopyStore()\n const budgetsStore = useBudgetsStore()\n const categoryStore = useCategoryStore()\n const transactionStore = useTransactionStore()\n const insightsV2Store = useInsightsV2Store()\n const fireAnalyticsEvent = useAnalyticsEvent()\n const [dialog, setDialog] = useState<DialogAction | null>(null)\n const [amount, setAmount] = useState('')\n const [toast, setToast] = useState<Toast | null>(null)\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n const inProgress = useRef(false)\n const copy = insightsFeedCopy?.budget_details\n const { categories } = categoryStore\n\n const facts = resolveBudgetFacts(beat)\n const recordedActiveAt = recordedActiveAtOf(insightsV2Store, beat)\n const dateRange = budgetMonthRange(beat, recordedActiveAt)\n const { primary_cta, secondary_cta, in_description_cta } = beat.insights_payload ?? {}\n const variant = getDynamicCtaBasedOnTriggers(\n insightsV2Store.actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )?.variant\n const { showPeriodLine } = resolveBudgetDetailsLayout(variant)\n\n if (!copyStore.isInitialized) return <Loader />\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n const category = facts.categoryGuid\n ? categories.find(({ guid }) => guid === facts.categoryGuid)\n : undefined\n const budget: Budget | undefined = facts.categoryGuid\n ? budgetsStore.budgets.find(({ category_guid }) => category_guid === facts.categoryGuid)\n : undefined\n const merchantBudget: MerchantBudget | undefined =\n !facts.categoryGuid && facts.merchantGuid\n ? budgetsStore.getMerchantBudgetByMerchantGuid(facts.merchantGuid)\n : undefined\n const subject =\n (category && getLocalizedCategoryName(category, categoriesCopy)) ??\n merchantBudget?.merchant_name ??\n (beat.payload?.merchant_name as string | undefined) ??\n ''\n const limit = budget?.amount ?? merchantBudget?.amount ?? facts.budgeted ?? 0\n const spent = facts.spent ?? budget?.transaction_total ?? merchantBudget?.transaction_total ?? 0\n\n const icon = facts.categoryGuid ? (\n <CategoryTile categoryGuid={facts.categoryGuid} size={44} tint={0.15} />\n ) : (\n <LogoMark logo={{ merchant_guid: facts.merchantGuid }} size={44} />\n )\n\n const monthTransactions = transactionStore.sortedTransactionsWithSplits\n\n const openDialog = (action: DialogAction) => {\n if (action === 'delete') fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.BUDGET_DELETE_START)\n setAmount(action === 'edit' ? String(limit) : '')\n setDialog(action)\n }\n\n const closeDialog = () => {\n setDialog(null)\n setAmount('')\n }\n\n // Cancel, close icon or backdrop.\n const cancelDialog = () => {\n if (dialog === 'delete') fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.BUDGET_DELETE_CANCEL)\n closeDialog()\n }\n\n const dynamic = (key: string) => buildDynamicCopy(key, subject) as string\n\n // \"Your {subject} budget could not be …\": the subject is the copy's one variable.\n const failureFor = (action: DialogAction) =>\n dynamic(\n {\n edit: budgetsCopy.error_alert_edit_merchant_budget,\n delete: budgetsCopy.error_alert_delete_merchant_budget,\n }[action],\n )\n\n const perform = async (\n action: DialogAction,\n value: number,\n ): Promise<{ ok: boolean; success: string; failure?: string }> => {\n if (merchantBudget) {\n if (action === 'delete') {\n const { isSuccess } = await budgetsStore.deleteMerchantBudget(merchantBudget.guid)\n return {\n ok: isSuccess,\n success: dynamic(budgetsCopy.success_alert_delete_merchant_budget),\n failure: dynamic(budgetsCopy.error_alert_delete_merchant_budget),\n }\n }\n const { isSuccess } = await budgetsStore.updateMerchantBudget({\n ...merchantBudget,\n amount: value,\n })\n return {\n ok: isSuccess,\n success: dynamic(budgetsCopy.success_alert_edit_merchant_budget),\n failure: dynamic(budgetsCopy.error_alert_edit_merchant_budget),\n }\n }\n if (action === 'delete' && budget) {\n return {\n ok: await budgetsStore.deleteBudget(budget.guid),\n success: dynamic(budgetsCopy.alert_budget_deleted),\n failure: failureFor(action),\n }\n }\n if (action === 'edit' && budget) {\n return {\n ok: await budgetsStore.updateBudget({ ...budget, amount: value }),\n success: dynamic(budgetsCopy.alert_budget_updated),\n failure: failureFor(action),\n }\n }\n return { ok: false, success: '' }\n }\n\n const submit = async () => {\n if (inProgress.current || !dialog) return\n const value = Number(amount)\n if (dialog !== 'delete' && !isPositiveAmount(amount)) return\n\n inProgress.current = true\n const retry = { action: dialog, amount }\n try {\n const { ok, success, failure } = await perform(dialog, value)\n if (ok) {\n // The host re-reads the beat, so a sampled card follows the budget.\n emitUpdate({ staleBeatGuid: beat.guid })\n if (dialog === 'edit') {\n fireAnalyticsEvent({ ...ANALYTICS_EVENTS_CONFIG.BUDGET_EDIT_SAVE, value: amount })\n }\n if (dialog === 'delete') {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.BUDGET_DELETE_END)\n // No budget left: close the drawer, as pulse did; the message outlives it.\n insightsV2Store.setActionNotice(beat.guid, { message: success, severity: 'success' })\n insightsV2Store.closeActionDrawer()\n return\n }\n setToast({ message: success, severity: 'success' })\n } else {\n setToast({ message: failure ?? commonCopy.error_message, severity: 'error', retry })\n }\n } catch {\n setToast({ message: failureFor(dialog), severity: 'error', retry })\n } finally {\n inProgress.current = false\n closeDialog()\n }\n }\n\n const hasBudget = Boolean(budget ?? merchantBudget)\n\n // Figma's footer, once the budget has loaded.\n const footer = hasBudget && (\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderTop: 1,\n borderTopColor: 'divider',\n bottom: 0,\n flexDirection: 'row',\n gap: 16,\n justifyContent: 'flex-end',\n mt: 'auto',\n position: 'sticky',\n px: 24,\n py: 16,\n }}\n >\n <Button color=\"error\" onClick={() => openDialog('delete')} variant=\"outlined\">\n {budgetsCopy.details_delete_button}\n </Button>\n <Button onClick={() => openDialog('edit')} variant=\"contained\">\n {budgetsCopy.details_edit_button}\n </Button>\n </Stack>\n )\n\n const isDelete = dialog === 'delete'\n const dialogCopy = {\n edit: {\n content: budgetsCopy.edit_budget_content,\n primaryText: budgetsCopy.add_save_button,\n title: budgetsCopy.details_edit_title,\n },\n delete: {\n content: budgetsCopy.delete_description,\n primaryText: budgetsCopy.details_delete_button,\n title: budgetsCopy.delete_title,\n },\n }\n\n return (\n <Stack sx={{ minHeight: '100%' }}>\n <Stack sx={{ bgcolor: 'background.paper', gap: 16, p: 24 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text bold={true} variant=\"body1\">\n {formatDate(dateRange.start, DATE_FORMATS_INTL.MONTH_YEAR)}\n </Text>\n {monthTransactions.length > 0 && (\n <Button\n onClick={() => exportTransactionsToCSV(monthTransactions, transactionStore.tags)}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n <BudgetSummary\n budgetsCopy={budgetsCopy}\n copy={copy}\n daysLeft={daysLeftInBudgetMonth(beat, undefined, recordedActiveAt)}\n icon={icon}\n limit={limit}\n showPeriodLine={showPeriodLine}\n spent={spent}\n />\n </Stack>\n {/* The month's transactions, always: the list shows its own zero state when there are none. */}\n <Box sx={{ bgcolor: 'background.default', flexGrow: 1 }}>\n {/* As legacy: a tapped row opens its Transaction Details over the budget. */}\n <TransactionList\n onClick={(guid) => {\n insightsV2Store.setActionContext({ transaction_guid: guid })\n setIsTransactionDetailsOpen(true)\n }}\n />\n </Box>\n {footer}\n {dialog && (\n <CurrencyDialog\n closeAriaLabel={commonCopy.close_aria}\n content={buildDynamicCopy(dialogCopy[dialog].content, <b>{subject}</b>) as ReactNode}\n handleInputChange={setAmount}\n handleModalClose={cancelDialog}\n handlePrimaryAction={() => void submit()}\n handleSecondaryAction={cancelDialog}\n inputLabel={isDelete ? undefined : budgetsCopy.add_label}\n inputValue={amount}\n isOpen={true}\n primaryColor={isDelete ? 'error' : 'primary'}\n primaryText={dialogCopy[dialog].primaryText}\n secondaryColor={isDelete ? 'inherit' : 'primary'}\n secondaryText={commonCopy.cancel_button}\n title={dialogCopy[dialog].title}\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: the outer drawer's context must survive.\n insightsV2Store.setActionContext({ transaction_guid: undefined })\n }}\n title={insightsFeedCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n <StatusSnackbar\n actionText={toast?.retry ? insightsFeedCopy?.general?.try_again : undefined}\n closeAriaLabel={commonCopy.close_aria}\n message={toast?.message ?? ''}\n onActionClick={() => {\n if (!toast?.retry) return\n setAmount(toast.retry.amount)\n setDialog(toast.retry.action)\n setToast(null)\n }}\n onClose={() => setToast(null)}\n open={Boolean(toast)}\n severity={toast?.severity}\n />\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAa,KAAqB,GAAS,SAA4B,EAAE,MAAA,EAAA,GAA0B;AACjG,QAAM,EAAE,WAAA,GAAW,YAAA,EAAA,IAAe,GAAe,GAC3C,EACJ,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,eAAe,GACf,cAAc,EAAA,IACZ,GAAmB,GACjB,IAAe,GAAgB,GAC/B,IAAgB,GAAiB,GACjC,IAAmB,GAAoB,GACvC,IAAkB,GAAmB,GACrC,IAAqB,GAAkB,GACvC,CAAC,GAAQ,CAAA,IAAa,EAA8B,IAAI,GACxD,CAAC,GAAQ,CAAA,IAAa,EAAS,EAAE,GACjC,CAAC,GAAO,CAAA,IAAY,EAAuB,IAAI,GAC/C,CAAC,GAA0B,CAAA,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