@mx-cartographer/experiences 9.7.128 → 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 (58) hide show
  1. package/CHANGELOG.md +4 -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/RecurringTransactionBlock/RecurringTransactionBlock.d.ts +10 -12
  16. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js +20 -19
  17. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js.map +1 -1
  18. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/index.d.ts +1 -1
  19. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.d.ts +3 -12
  20. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js +8 -8
  21. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.d.ts +9 -0
  23. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js +27 -10
  24. package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +1 -7
  26. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +49 -59
  27. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  28. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +29 -75
  29. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
  30. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +12 -0
  31. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +18 -9
  32. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
  33. package/dist/insights-v2/components/AmountBreakdownCard.es.js +9 -8
  34. package/dist/insights-v2/components/AmountBreakdownCard.es.js.map +1 -1
  35. package/dist/insights-v2/components/InsightListRow.d.ts +31 -0
  36. package/dist/insights-v2/components/InsightListRow.es.js +111 -0
  37. package/dist/insights-v2/components/InsightListRow.es.js.map +1 -0
  38. package/dist/insights-v2/components/SubTabs.d.ts +2 -1
  39. package/dist/insights-v2/components/SubTabs.es.js +10 -10
  40. package/dist/insights-v2/components/SubTabs.es.js.map +1 -1
  41. package/dist/insights-v2/index.es.js +12 -12
  42. package/dist/insights-v2/mappings/blocks.es.js +21 -21
  43. package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -1
  44. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +169 -120
  45. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
  46. package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +3 -1
  47. package/dist/recurringtransactions/components/RecurringTransactionList.es.js +151 -118
  48. package/dist/recurringtransactions/components/RecurringTransactionList.es.js.map +1 -1
  49. package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -6
  50. package/dist/transactions/components/shared/TransactionDetails.es.js +149 -199
  51. package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
  52. package/dist/transactions/components/shared/transactiondetails/Description.d.ts +2 -0
  53. package/dist/transactions/components/shared/transactiondetails/Description.es.js +59 -50
  54. package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
  55. package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.d.ts +10 -0
  56. package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js +68 -0
  57. package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js.map +1 -0
  58. 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,17 +1,15 @@
1
+ import { Recurrence } from '../../../core';
1
2
  import { ActionBlockProps } from '../../mappings/blocks';
2
3
  /**
3
- * Expense Details drawer content for one recurring subscription (WEC-1428), shared by the Upcoming
4
- * Subscription (WEC-1469) and Subscription Price Increase (WEC-1470) beats.
5
- *
6
- * The detail rendering (merchant header, next-due card, account/category/schedule rows, past
7
- * activity, mark-as-paid/unpaid, delete) all lives in the recurring module's
8
- * `RecurringTransactionDetails`, the same component behind the recurring widget's Expense Details
9
- * drawer. This block's job is only to resolve *which* subscription (`subscriptionBeats.ts`) and hand
10
- * off, exactly as `TransactionDetailsBlock` does with `TransactionDetails`.
11
- *
12
- * `observer` is required: the resolved subscription comes from RecurringTransactionsStore, and
13
- * `usePrepare` may still be loading it when this first renders.
4
+ * Expense Details drawer: resolves which recurring transaction, then renders `RecurringTransactionDetails`.
5
+ * A nested opener (a tapped row) passes the guid, occurrence and its own close; a CTA passes none.
14
6
  */
15
- export declare const RecurringTransactionBlock: (({ beat, }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
7
+ export declare const RecurringTransactionBlock: (({ beat, layout, onDeleted, repeatingTransactionGuid, selectedRecurrence, }: ActionBlockProps & {
8
+ /** `insights` is the Monthly Obligations Expense Details layout; other beats keep `default`. */
9
+ layout?: "default" | "insights";
10
+ onDeleted?: () => void;
11
+ repeatingTransactionGuid?: string;
12
+ selectedRecurrence?: Recurrence | null;
13
+ }) => import("react/jsx-runtime").JSX.Element) & {
16
14
  displayName: string;
17
15
  };
@@ -1,39 +1,40 @@
1
- import { useGlobalCopyStore as R, useInsightsV2Store as g, useTransactionStore as T } from "../../../common/context/hooks.es.js";
2
- import v from "../../../common/components/Loader.es.js";
3
- import { RecurringTransactionDetails as x } from "../../../recurringtransactions/components/RecurringTransactionDetails.es.js";
4
- import { ErrorCard as y } from "../../components/ErrorCard.es.js";
5
- import { useRecurringTransactionBlock as D } from "./useRecurringTransactionBlock.es.js";
6
- import { useRecurringTransactionLoad as L } from "./useRecurringTransactionPrepare.es.js";
1
+ import { useGlobalCopyStore as x, useInsightsV2Store as y, useTransactionStore as D } from "../../../common/context/hooks.es.js";
2
+ import L from "../../../common/components/Loader.es.js";
3
+ import { RecurringTransactionDetails as B } from "../../../recurringtransactions/components/RecurringTransactionDetails.es.js";
4
+ import { ErrorCard as E } from "../../components/ErrorCard.es.js";
5
+ import { useRecurringTransactionBlock as b } from "./useRecurringTransactionBlock.es.js";
6
+ import { useRecurringTransactionLoad as h } from "./useRecurringTransactionPrepare.es.js";
7
7
  import r from "react";
8
- import { observer as B } from "mobx-react-lite";
9
- import { Text as E } from "@mxenabled/mxui";
8
+ import { observer as k } from "mobx-react-lite";
9
+ import { Text as S } from "@mxenabled/mxui";
10
10
  import { jsx as t } from "react/jsx-runtime";
11
- var O = B(function({ beat: f }) {
12
- const { closeActionDrawer: l } = g(), { recurring: m } = R(), { filter: d, setFilter: n } = T(), { hasLoadError: i, isLoading: c, repeatingTransaction: o } = D(f), p = L(), e = r.useRef(null);
13
- e.current === null && (e.current = { ...d });
11
+ var z = k(function({ beat: f, layout: l = "default", onDeleted: m, repeatingTransactionGuid: d, selectedRecurrence: p = null }) {
12
+ const { closeActionDrawer: R } = y(), { recurring: g } = x(), { filter: T, setFilter: n } = D(), { hasLoadError: i, isLoading: c, repeatingTransaction: o } = b(f, d), v = h(), e = r.useRef(null);
13
+ e.current === null && (e.current = { ...T });
14
14
  const s = r.useRef(n), a = r.useRef(!1), u = !c && !i && o !== void 0;
15
15
  return s.current = n, r.useEffect(() => {
16
16
  u && (a.current = !0);
17
17
  }, [u]), r.useEffect(() => () => {
18
18
  a.current && e.current && s.current(e.current);
19
- }, []), c ? /* @__PURE__ */ t(v, {}) : i ? /* @__PURE__ */ t(y, { onRetry: () => {
20
- p();
21
- } }) : o ? /* @__PURE__ */ t(x, {
22
- onDeleted: l,
19
+ }, []), c ? /* @__PURE__ */ t(L, {}) : i ? /* @__PURE__ */ t(E, { onRetry: () => {
20
+ v();
21
+ } }) : o ? /* @__PURE__ */ t(B, {
22
+ layout: l,
23
+ onDeleted: m ?? R,
23
24
  recurringTransaction: o,
24
- selectedRecurrence: null
25
- }) : /* @__PURE__ */ t(E, {
25
+ selectedRecurrence: p
26
+ }) : /* @__PURE__ */ t(S, {
26
27
  color: "text.secondary",
27
28
  sx: {
28
29
  m: 24,
29
30
  textAlign: "center"
30
31
  },
31
32
  variant: "body1",
32
- children: m.no_activities
33
+ children: g.no_activities
33
34
  });
34
35
  });
35
36
  export {
36
- O as RecurringTransactionBlock
37
+ z as RecurringTransactionBlock
37
38
  };
38
39
 
39
40
  //# sourceMappingURL=RecurringTransactionBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecurringTransactionBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { RecurringTransactionDetails } from '../../../recurringtransactions/components/RecurringTransactionDetails'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { useRecurringTransactionBlock } from './useRecurringTransactionBlock'\nimport { useRecurringTransactionLoad } from './useRecurringTransactionPrepare'\n\n/**\n * Expense Details drawer content for one recurring subscription (WEC-1428), shared by the Upcoming\n * Subscription (WEC-1469) and Subscription Price Increase (WEC-1470) beats.\n *\n * The detail rendering (merchant header, next-due card, account/category/schedule rows, past\n * activity, mark-as-paid/unpaid, delete) all lives in the recurring module's\n * `RecurringTransactionDetails`, the same component behind the recurring widget's Expense Details\n * drawer. This block's job is only to resolve *which* subscription (`subscriptionBeats.ts`) and hand\n * off, exactly as `TransactionDetailsBlock` does with `TransactionDetails`.\n *\n * `observer` is required: the resolved subscription comes from RecurringTransactionsStore, and\n * `usePrepare` may still be loading it when this first renders.\n */\nexport const RecurringTransactionBlock = observer(function RecurringTransactionBlock({\n beat,\n}: ActionBlockProps) {\n const { closeActionDrawer } = useInsightsV2Store()\n const { recurring: copy } = useGlobalCopyStore()\n const { filter, setFilter } = useTransactionStore()\n const { hasLoadError, isLoading, repeatingTransaction } = useRecurringTransactionBlock(beat)\n const retryLoad = useRecurringTransactionLoad()\n\n // `RecurringTransactionDetails` narrows the shared `TransactionStore.filter` to this one\n // subscription (90-day window + guid predicate) and never restores it. Inside the recurring widget\n // that is fine, but a Transactions widget on the same page would be left showing only this\n // subscription's charges after the drawer closes. The runner mounts this block on open and\n // unmounts it on close, so the filter is put back on unmount, with two guards:\n // - the snapshot is taken BY VALUE on the first render (the store's `filter` is a live observable\n // object, so holding the reference would hold whatever it was later changed to);\n // - the restore only runs if the details view actually mounted. While loading, on a failed load\n // or when nothing resolved, this block changed nothing and must not overwrite a filter some\n // other widget may have set in the meantime.\n const filterBeforeOpen = React.useRef<TransactionFilter | null>(null)\n\n if (filterBeforeOpen.current === null) filterBeforeOpen.current = { ...filter }\n\n const setFilterRef = React.useRef(setFilter)\n const didRenderDetails = React.useRef(false)\n const isDetailsRendered = !isLoading && !hasLoadError && repeatingTransaction !== undefined\n\n setFilterRef.current = setFilter\n\n React.useEffect(() => {\n if (isDetailsRendered) didRenderDetails.current = true\n }, [isDetailsRendered])\n\n React.useEffect(\n () => () => {\n if (didRenderDetails.current && filterBeforeOpen.current) {\n setFilterRef.current(filterBeforeOpen.current)\n }\n },\n [],\n )\n\n if (isLoading) return <Loader />\n\n // The open-time load finished without data (API failure, reported through the store). Offer the\n // feed's standard error card with a retry rather than leaving the loader up forever.\n if (hasLoadError) return <ErrorCard onRetry={() => void retryLoad()} />\n\n // Loading finished and the beat still resolves to nothing (deleted, never detected, or a beat that\n // names none). Say so in the recurring module's own words rather than the generic error drawer.\n if (!repeatingTransaction) {\n return (\n <Text color=\"text.secondary\" sx={{ m: 24, textAlign: 'center' }} variant=\"body1\">\n {copy.no_activities}\n </Text>\n )\n }\n\n return (\n <RecurringTransactionDetails\n // Deleting the subscription from inside the drawer leaves nothing to show; close it, as the\n // recurring widget's own drawer does.\n onDeleted={closeActionDrawer}\n recurringTransaction={repeatingTransaction}\n // No specific occurrence was tapped (the CTA opens the subscription itself), so the next-due\n // card falls back to the subscription's next upcoming date.\n selectedRecurrence={null}\n />\n )\n})\n"],"mappings":";;;;;;;;;;AAgCA,IAAa,IAA4B,EAAS,SAAmC,EACnF,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,mBAAA,EAAA,IAAsB,EAAmB,GAC3C,EAAE,WAAW,EAAA,IAAS,EAAmB,GACzC,EAAE,QAAA,GAAQ,WAAA,EAAA,IAAc,EAAoB,GAC5C,EAAE,cAAA,GAAc,WAAA,GAAW,sBAAA,EAAA,IAAyB,EAA6B,CAAI,GACrF,IAAY,EAA4B,GAYxC,IAAmB,EAAM,OAAiC,IAAI;AAEpE,EAAI,EAAiB,YAAY,SAAM,EAAiB,UAAU,EAAE,GAAG,EAAO;AAE9E,QAAM,IAAe,EAAM,OAAO,CAAS,GACrC,IAAmB,EAAM,OAAO,EAAK,GACrC,IAAoB,CAAC,KAAa,CAAC,KAAgB,MAAyB;AAiBlF,SAfA,EAAa,UAAU,GAEvB,EAAM,UAAA,MAAgB;AACpB,IAAI,MAAmB,EAAiB,UAAU;AAAA,EACpD,GAAG,CAAC,CAAiB,CAAC,GAEtB,EAAM,UAAA,MAAA,MACQ;AACV,IAAI,EAAiB,WAAW,EAAiB,WAC/C,EAAa,QAAQ,EAAiB,OAAO;AAAA,EAEjD,GACA,CAAC,CACH,GAEI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAI3B,IAAqB,gBAAA,EAAC,GAAD,EAAW,SAAA,MAAA;AAAe,IAAK,EAAU;AAAA,IAAI,CAAA,IAIjE,IASH,gBAAA,EAAC,GAAD;AAAA,IAGE,WAAW;AAAA,IACX,sBAAsB;AAAA,IAGtB,oBAAoB;AAAA,EACrB,CAAA,IAfC,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,IAAI;AAAA,MAAE,GAAG;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAAG,SAAQ;AAAA,IACtE,UAAA,EAAK;AAAA,EACF,CAAA;AAeZ,CAAC"}
1
+ {"version":3,"file":"RecurringTransactionBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Recurrence } from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { RecurringTransactionDetails } from '../../../recurringtransactions/components/RecurringTransactionDetails'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { useRecurringTransactionBlock } from './useRecurringTransactionBlock'\nimport { useRecurringTransactionLoad } from './useRecurringTransactionPrepare'\n\n/**\n * Expense Details drawer: resolves which recurring transaction, then renders `RecurringTransactionDetails`.\n * A nested opener (a tapped row) passes the guid, occurrence and its own close; a CTA passes none.\n */\nexport const RecurringTransactionBlock = observer(function RecurringTransactionBlock({\n beat,\n layout = 'default',\n onDeleted,\n repeatingTransactionGuid,\n selectedRecurrence = null,\n}: ActionBlockProps & {\n /** `insights` is the Monthly Obligations Expense Details layout; other beats keep `default`. */\n layout?: 'default' | 'insights'\n onDeleted?: () => void\n repeatingTransactionGuid?: string\n selectedRecurrence?: Recurrence | null\n}) {\n const { closeActionDrawer } = useInsightsV2Store()\n const { recurring: copy } = useGlobalCopyStore()\n const { filter, setFilter } = useTransactionStore()\n const { hasLoadError, isLoading, repeatingTransaction } = useRecurringTransactionBlock(\n beat,\n repeatingTransactionGuid,\n )\n const retryLoad = useRecurringTransactionLoad()\n\n // The details view narrows the shared TransactionStore filter and never restores it: snapshot it by\n // value now, and put it back on unmount only if the details actually rendered.\n const filterBeforeOpen = React.useRef<TransactionFilter | null>(null)\n\n if (filterBeforeOpen.current === null) filterBeforeOpen.current = { ...filter }\n\n const setFilterRef = React.useRef(setFilter)\n const didRenderDetails = React.useRef(false)\n const isDetailsRendered = !isLoading && !hasLoadError && repeatingTransaction !== undefined\n\n setFilterRef.current = setFilter\n\n React.useEffect(() => {\n if (isDetailsRendered) didRenderDetails.current = true\n }, [isDetailsRendered])\n\n React.useEffect(\n () => () => {\n if (didRenderDetails.current && filterBeforeOpen.current) {\n setFilterRef.current(filterBeforeOpen.current)\n }\n },\n [],\n )\n\n if (isLoading) return <Loader />\n\n if (hasLoadError) return <ErrorCard onRetry={() => void retryLoad()} />\n\n // Deleted, never detected, or the beat names none.\n if (!repeatingTransaction) {\n return (\n <Text color=\"text.secondary\" sx={{ m: 24, textAlign: 'center' }} variant=\"body1\">\n {copy.no_activities}\n </Text>\n )\n }\n\n return (\n <RecurringTransactionDetails\n layout={layout}\n onDeleted={onDeleted ?? closeActionDrawer}\n recurringTransaction={repeatingTransaction}\n selectedRecurrence={selectedRecurrence}\n />\n )\n})\n"],"mappings":";;;;;;;;;;AAwBA,IAAa,IAA4B,EAAS,SAAmC,EACnF,MAAA,GACA,QAAA,IAAS,WACT,WAAA,GACA,0BAAA,GACA,oBAAA,IAAqB,KAAA,GAOpB;AACD,QAAM,EAAE,mBAAA,EAAA,IAAsB,EAAmB,GAC3C,EAAE,WAAW,EAAA,IAAS,EAAmB,GACzC,EAAE,QAAA,GAAQ,WAAA,EAAA,IAAc,EAAoB,GAC5C,EAAE,cAAA,GAAc,WAAA,GAAW,sBAAA,EAAA,IAAyB,EACxD,GACA,CACF,GACM,IAAY,EAA4B,GAIxC,IAAmB,EAAM,OAAiC,IAAI;AAEpE,EAAI,EAAiB,YAAY,SAAM,EAAiB,UAAU,EAAE,GAAG,EAAO;AAE9E,QAAM,IAAe,EAAM,OAAO,CAAS,GACrC,IAAmB,EAAM,OAAO,EAAK,GACrC,IAAoB,CAAC,KAAa,CAAC,KAAgB,MAAyB;AAiBlF,SAfA,EAAa,UAAU,GAEvB,EAAM,UAAA,MAAgB;AACpB,IAAI,MAAmB,EAAiB,UAAU;AAAA,EACpD,GAAG,CAAC,CAAiB,CAAC,GAEtB,EAAM,UAAA,MAAA,MACQ;AACV,IAAI,EAAiB,WAAW,EAAiB,WAC/C,EAAa,QAAQ,EAAiB,OAAO;AAAA,EAEjD,GACA,CAAC,CACH,GAEI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAE3B,IAAqB,gBAAA,EAAC,GAAD,EAAW,SAAA,MAAA;AAAe,IAAK,EAAU;AAAA,IAAI,CAAA,IAGjE,IASH,gBAAA,EAAC,GAAD;AAAA,IACU,QAAA;AAAA,IACR,WAAW,KAAa;AAAA,IACxB,sBAAsB;AAAA,IACF,oBAAA;AAAA,EACrB,CAAA,IAZC,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,IAAI;AAAA,MAAE,GAAG;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAAG,SAAQ;AAAA,IACtE,UAAA,EAAK;AAAA,EACF,CAAA;AAYZ,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export { RecurringTransactionBlock } from './RecurringTransactionBlock';
2
- export { type RecurringTransactionActionContext, useRecurringTransactionLoad, useRecurringTransactionPrepare, } from './useRecurringTransactionPrepare';
2
+ export { type RecurringTransactionActionContext, useRecurringExpensesLoadState, useRecurringTransactionLoad, useRecurringTransactionPrepare, } from './useRecurringTransactionPrepare';
@@ -8,16 +8,7 @@ export interface RecurringTransactionBlockState {
8
8
  repeatingTransaction?: RepeatingTransaction;
9
9
  }
10
10
  /**
11
- * Resolves which repeating transaction this drawer is about.
12
- *
13
- * The guid comes from the beat (`resolveSubscriptionGuid`), then is looked up in
14
- * `RecurringTransactionsStore` rather than rebuilt from the beat, because the Expense Details view
15
- * edits (payment schedule, mark as paid, delete) must write through to the same store object the
16
- * recurring widget renders.
17
- *
18
- * `detailedRepeatingTransactions` joins the account and linked transactions in, but it is empty until
19
- * the transaction store has loaded (see `augmentRepeatingTransactions`). The raw record is the
20
- * fallback so a subscription the store has is never reported missing just because transactions are
21
- * still on their way.
11
+ * Resolves the drawer's repeating transaction from the store (so edits write through), falling back to the
12
+ * raw record until transactions load. `guidOverride` (a nested opener's tapped row) wins over the beat.
22
13
  */
23
- export declare const useRecurringTransactionBlock: (beat: Beat) => RecurringTransactionBlockState;
14
+ export declare const useRecurringTransactionBlock: (beat: Beat, guidOverride?: string) => RecurringTransactionBlockState;
@@ -1,21 +1,21 @@
1
- import { useActionContext as p, useRecurringTransactionsStore as T, useTransactionStore as f } from "../../../common/context/hooks.es.js";
2
- import { resolveSubscriptionGuid as l } from "./subscriptionBeats.es.js";
3
- var L = (s) => {
4
- const { detailedRepeatingTransactions: e, isDataLoaded: o, repeatingTransactions: r } = T(), { transactions: c } = f(), t = p()?.recurringLoadFailed === !0 && !o, i = l(s, {
1
+ import { useActionContext as T, useRecurringTransactionsStore as f, useTransactionStore as l } from "../../../common/context/hooks.es.js";
2
+ import { resolveSubscriptionGuid as m } from "./subscriptionBeats.es.js";
3
+ var R = (s, e) => {
4
+ const { detailedRepeatingTransactions: c, isDataLoaded: o, repeatingTransactions: r } = f(), { transactions: d } = l(), t = T()?.recurringLoadFailed === !0 && !o, i = e ?? m(s, {
5
5
  repeatingTransactions: r,
6
- transactions: c
7
- }), a = (u) => u.find((g) => g.guid === i), n = i ? a(r) : void 0, d = n ? a(e) ?? {
6
+ transactions: d
7
+ }), a = (g) => g.find((p) => p.guid === i), n = i ? a(r) : void 0, u = n ? a(c) ?? {
8
8
  ...n,
9
9
  transactions: n.transactions ?? []
10
10
  } : void 0;
11
11
  return {
12
12
  hasLoadError: t,
13
13
  isLoading: !o && !t,
14
- repeatingTransaction: d
14
+ repeatingTransaction: u
15
15
  };
16
16
  };
17
17
  export {
18
- L as useRecurringTransactionBlock
18
+ R as useRecurringTransactionBlock
19
19
  };
20
20
 
21
21
  //# sourceMappingURL=useRecurringTransactionBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRecurringTransactionBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.ts"],"sourcesContent":["import {\n useActionContext,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, RepeatingTransaction } from '../../../core'\n\nimport { resolveSubscriptionGuid } from './subscriptionBeats'\nimport type { RecurringTransactionActionContext } from './useRecurringTransactionPrepare'\n\nexport interface RecurringTransactionBlockState {\n /** True when the open-time load finished without leaving the store loaded; the block offers a retry. */\n hasLoadError: boolean\n /** True until the recurring store has loaded; the block shows a loader instead of an empty state. */\n isLoading: boolean\n /** `undefined` once loading finishes means the subscription could not be resolved. */\n repeatingTransaction?: RepeatingTransaction\n}\n\n/**\n * Resolves which repeating transaction this drawer is about.\n *\n * The guid comes from the beat (`resolveSubscriptionGuid`), then is looked up in\n * `RecurringTransactionsStore` rather than rebuilt from the beat, because the Expense Details view\n * edits (payment schedule, mark as paid, delete) must write through to the same store object the\n * recurring widget renders.\n *\n * `detailedRepeatingTransactions` joins the account and linked transactions in, but it is empty until\n * the transaction store has loaded (see `augmentRepeatingTransactions`). The raw record is the\n * fallback so a subscription the store has is never reported missing just because transactions are\n * still on their way.\n */\nexport const useRecurringTransactionBlock = (beat: Beat): RecurringTransactionBlockState => {\n const { detailedRepeatingTransactions, isDataLoaded, repeatingTransactions } =\n useRecurringTransactionsStore()\n const { transactions } = useTransactionStore()\n // The failure flag is per drawer session and only cleared by an explicit retry, but the store is\n // shared: another widget on the page (e.g. Recurring Transactions on a dashboard) may load it\n // successfully while this drawer is still open. Data that has since arrived wins over the flag.\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const hasLoadError = loadFailed && !isDataLoaded\n\n const guid = resolveSubscriptionGuid(beat, { repeatingTransactions, transactions })\n\n const findByGuid = (list: RepeatingTransaction[]) =>\n list.find((repeating) => repeating.guid === guid)\n\n const raw = guid ? findByGuid(repeatingTransactions) : undefined\n const repeatingTransaction = raw\n ? (findByGuid(detailedRepeatingTransactions) ?? {\n ...raw,\n transactions: raw.transactions ?? [],\n })\n : undefined\n\n return { hasLoadError, isLoading: !isDataLoaded && !hasLoadError, repeatingTransaction }\n}\n"],"mappings":";;AAgCA,IAAa,IAAA,CAAgC,MAA+C;AAC1F,QAAM,EAAE,+BAAA,GAA+B,cAAA,GAAc,uBAAA,EAAA,IACnD,EAA8B,GAC1B,EAAE,cAAA,EAAA,IAAiB,EAAoB,GAMvC,IADJ,EAAoD,GAAG,wBAAwB,MAC9C,CAAC,GAE9B,IAAO,EAAwB,GAAM;AAAA,IAAE,uBAAA;AAAA,IAAuB,cAAA;AAAA,EAAa,CAAC,GAE5E,IAAA,CAAc,MAClB,EAAK,KAAA,CAAM,MAAc,EAAU,SAAS,CAAI,GAE5C,IAAM,IAAO,EAAW,CAAqB,IAAI,QACjD,IAAuB,IACxB,EAAW,CAA6B,KAAK;AAAA,IAC5C,GAAG;AAAA,IACH,cAAc,EAAI,gBAAgB,CAAC;AAAA,EACrC,IACA;AAEJ,SAAO;AAAA,IAAE,cAAA;AAAA,IAAc,WAAW,CAAC,KAAgB,CAAC;AAAA,IAAc,sBAAA;AAAA,EAAqB;AACzF"}
1
+ {"version":3,"file":"useRecurringTransactionBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.ts"],"sourcesContent":["import {\n useActionContext,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, RepeatingTransaction } from '../../../core'\n\nimport { resolveSubscriptionGuid } from './subscriptionBeats'\nimport type { RecurringTransactionActionContext } from './useRecurringTransactionPrepare'\n\nexport interface RecurringTransactionBlockState {\n /** True when the open-time load finished without leaving the store loaded; the block offers a retry. */\n hasLoadError: boolean\n /** True until the recurring store has loaded; the block shows a loader instead of an empty state. */\n isLoading: boolean\n /** `undefined` once loading finishes means the subscription could not be resolved. */\n repeatingTransaction?: RepeatingTransaction\n}\n\n/**\n * Resolves the drawer's repeating transaction from the store (so edits write through), falling back to the\n * raw record until transactions load. `guidOverride` (a nested opener's tapped row) wins over the beat.\n */\nexport const useRecurringTransactionBlock = (\n beat: Beat,\n guidOverride?: string,\n): RecurringTransactionBlockState => {\n const { detailedRepeatingTransactions, isDataLoaded, repeatingTransactions } =\n useRecurringTransactionsStore()\n const { transactions } = useTransactionStore()\n // The store is shared: data another widget loaded since wins over this drawer's failure flag.\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const hasLoadError = loadFailed && !isDataLoaded\n\n const guid =\n guidOverride ?? resolveSubscriptionGuid(beat, { repeatingTransactions, transactions })\n\n const findByGuid = (list: RepeatingTransaction[]) =>\n list.find((repeating) => repeating.guid === guid)\n\n const raw = guid ? findByGuid(repeatingTransactions) : undefined\n const repeatingTransaction = raw\n ? (findByGuid(detailedRepeatingTransactions) ?? {\n ...raw,\n transactions: raw.transactions ?? [],\n })\n : undefined\n\n return { hasLoadError, isLoading: !isDataLoaded && !hasLoadError, repeatingTransaction }\n}\n"],"mappings":";;AAuBA,IAAa,IAAA,CACX,GACA,MACmC;AACnC,QAAM,EAAE,+BAAA,GAA+B,cAAA,GAAc,uBAAA,EAAA,IACnD,EAA8B,GAC1B,EAAE,cAAA,EAAA,IAAiB,EAAoB,GAIvC,IADJ,EAAoD,GAAG,wBAAwB,MAC9C,CAAC,GAE9B,IACJ,KAAgB,EAAwB,GAAM;AAAA,IAAE,uBAAA;AAAA,IAAuB,cAAA;AAAA,EAAa,CAAC,GAEjF,IAAA,CAAc,MAClB,EAAK,KAAA,CAAM,MAAc,EAAU,SAAS,CAAI,GAE5C,IAAM,IAAO,EAAW,CAAqB,IAAI,QACjD,IAAuB,IACxB,EAAW,CAA6B,KAAK;AAAA,IAC5C,GAAG;AAAA,IACH,cAAc,EAAI,gBAAgB,CAAC;AAAA,EACrC,IACA;AAEJ,SAAO;AAAA,IAAE,cAAA;AAAA,IAAc,WAAW,CAAC,KAAgB,CAAC;AAAA,IAAc,sBAAA;AAAA,EAAqB;AACzF"}
@@ -23,3 +23,12 @@ export declare const useRecurringTransactionLoad: () => () => Promise<void>;
23
23
  * not refetch, and on a ref so a failed load does not refire on every render (retry is explicit).
24
24
  */
25
25
  export declare const useRecurringTransactionPrepare: (_props: ActionBlockProps) => void;
26
+ /**
27
+ * The recurring expenses' load state for a drawer: `failed` also covers TransactionStore swallowing a
28
+ * failed request (`transactionsLoading` excludes another widget's request in flight).
29
+ */
30
+ export declare const useRecurringExpensesLoadState: () => {
31
+ failed: boolean;
32
+ ready: boolean;
33
+ retry: () => undefined;
34
+ };
@@ -1,8 +1,8 @@
1
- import { useInsightsV2Store as o, useRecurringTransactionsStore as s } from "../../../common/context/hooks.es.js";
2
- import e from "react";
1
+ import { useActionContext as u, useInsightsV2Store as l, useRecurringTransactionsStore as i, useTransactionStore as g } from "../../../common/context/hooks.es.js";
2
+ import s from "react";
3
3
  var c = () => {
4
- const a = s(), { setActionContext: r } = o();
5
- return e.useCallback(async () => {
4
+ const a = i(), { setActionContext: r } = l();
5
+ return s.useCallback(async () => {
6
6
  r({ recurringLoadFailed: !1 });
7
7
  try {
8
8
  await a.loadRepeatingTransactionData();
@@ -10,15 +10,32 @@ var c = () => {
10
10
  }
11
11
  a.isDataLoaded || r({ recurringLoadFailed: !0 });
12
12
  }, [a, r]);
13
- }, d = (a) => {
14
- const { isDataLoaded: r } = s(), t = c(), n = e.useRef(!1);
15
- e.useEffect(() => {
16
- n.current || r || (n.current = !0, t());
17
- }, [r, t]);
13
+ }, d = () => {
14
+ const { isDataLoaded: a } = i(), { transactionsLoaded: r, transactionsLoading: e } = g();
15
+ return {
16
+ isDataLoaded: a,
17
+ ready: a && r,
18
+ transactionsFailed: a && !r && !e
19
+ };
20
+ }, p = (a) => {
21
+ const { isDataLoaded: r, transactionsFailed: e } = d(), t = c(), n = s.useRef(!1), o = r && !e;
22
+ s.useEffect(() => {
23
+ n.current || o || (n.current = !0, t());
24
+ }, [o, t]);
25
+ }, F = () => {
26
+ const { isDataLoaded: a, ready: r, transactionsFailed: e } = d(), t = u()?.recurringLoadFailed === !0, n = c();
27
+ return {
28
+ failed: t && !a || e,
29
+ ready: r,
30
+ retry: () => {
31
+ n();
32
+ }
33
+ };
18
34
  };
19
35
  export {
36
+ F as useRecurringExpensesLoadState,
20
37
  c as useRecurringTransactionLoad,
21
- d as useRecurringTransactionPrepare
38
+ p as useRecurringTransactionPrepare
22
39
  };
23
40
 
24
41
  //# sourceMappingURL=useRecurringTransactionPrepare.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRecurringTransactionPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useInsightsV2Store, useRecurringTransactionsStore } from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\n/** The key this block layers onto the drawer's action context when its open-time load fails. */\nexport interface RecurringTransactionActionContext {\n recurringLoadFailed?: boolean\n}\n\n/**\n * Runs the recurring widget's loader and records whether it left the store loaded.\n *\n * `RecurringTransactionsStore` swallows API failures into `captureError`, so on a failed request\n * `isDataLoaded` simply stays false and nothing else changes. Left alone, that would keep the block\n * on its loader forever. This is the one place that turns the outcome into a flag the block can\n * render an error state (with retry) from. The flag lives on the drawer's action context, which is\n * per drawer session: a new open starts clean.\n */\nexport const useRecurringTransactionLoad = () => {\n const recurringTransactionsStore = useRecurringTransactionsStore()\n const { setActionContext } = useInsightsV2Store()\n\n return React.useCallback(async () => {\n setActionContext({ recurringLoadFailed: false })\n\n try {\n await recurringTransactionsStore.loadRepeatingTransactionData()\n } catch {\n // Already reported through the store's captureError; the flag below is the UI signal.\n }\n\n if (!recurringTransactionsStore.isDataLoaded) setActionContext({ recurringLoadFailed: true })\n }, [recurringTransactionsStore, setActionContext])\n}\n\n/**\n * Open-time data guarantee for the Expense Details drawer. Wired as the block's `usePrepare`, so\n * `ActionBlockLayer` runs it once each time a CTA opens the drawer.\n *\n * A beat is rendered in the feed long before the recurring module has loaded, so the store is\n * usually cold at open time. The loader is the recurring widget's own (accounts, categories and\n * transactions first, then repeating transactions). Guarded on `isDataLoaded` so re-opening does\n * not refetch, and on a ref so a failed load does not refire on every render (retry is explicit).\n */\nexport const useRecurringTransactionPrepare = (_props: ActionBlockProps) => {\n const { isDataLoaded } = useRecurringTransactionsStore()\n const load = useRecurringTransactionLoad()\n const hasStarted = React.useRef(false)\n\n React.useEffect(() => {\n if (hasStarted.current || isDataLoaded) return\n\n hasStarted.current = true\n void load()\n }, [isDataLoaded, load])\n}\n"],"mappings":";;AAmBA,IAAa,IAAA,MAAoC;AAC/C,QAAM,IAA6B,EAA8B,GAC3D,EAAE,kBAAA,EAAA,IAAqB,EAAmB;AAEhD,SAAO,EAAM,YAAY,YAAY;AACnC,IAAA,EAAiB,EAAE,qBAAqB,GAAM,CAAC;AAE/C,QAAI;AACF,YAAM,EAA2B,6BAA6B;AAAA,IAChE,QAAQ;AAAA,IAER;AAEA,IAAK,EAA2B,gBAAc,EAAiB,EAAE,qBAAqB,GAAK,CAAC;AAAA,EAC9F,GAAG,CAAC,GAA4B,CAAgB,CAAC;AACnD,GAWa,IAAA,CAAkC,MAA6B;AAC1E,QAAM,EAAE,cAAA,EAAA,IAAiB,EAA8B,GACjD,IAAO,EAA4B,GACnC,IAAa,EAAM,OAAO,EAAK;AAErC,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,EAAW,WAAW,MAE1B,EAAW,UAAU,IACrB,EAAU;AAAA,EACZ,GAAG,CAAC,GAAc,CAAI,CAAC;AACzB"}
1
+ {"version":3,"file":"useRecurringTransactionPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport {\n useActionContext,\n useInsightsV2Store,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\n/** The key this block layers onto the drawer's action context when its open-time load fails. */\nexport interface RecurringTransactionActionContext {\n recurringLoadFailed?: boolean\n}\n\n/**\n * Runs the recurring widget's loader and records whether it left the store loaded.\n *\n * `RecurringTransactionsStore` swallows API failures into `captureError`, so on a failed request\n * `isDataLoaded` simply stays false and nothing else changes. Left alone, that would keep the block\n * on its loader forever. This is the one place that turns the outcome into a flag the block can\n * render an error state (with retry) from. The flag lives on the drawer's action context, which is\n * per drawer session: a new open starts clean.\n */\nexport const useRecurringTransactionLoad = () => {\n const recurringTransactionsStore = useRecurringTransactionsStore()\n const { setActionContext } = useInsightsV2Store()\n\n return React.useCallback(async () => {\n setActionContext({ recurringLoadFailed: false })\n\n try {\n await recurringTransactionsStore.loadRepeatingTransactionData()\n } catch {\n // Already reported through the store's captureError; the flag below is the UI signal.\n }\n\n if (!recurringTransactionsStore.isDataLoaded) setActionContext({ recurringLoadFailed: true })\n }, [recurringTransactionsStore, setActionContext])\n}\n\n/**\n * The flags both hooks below read, derived once so they cannot drift: `transactionsFailed` is\n * TransactionStore swallowing a failed request (`transactionsLoading` excludes another widget's\n * request in flight).\n */\nconst useRecurringLoadFlags = () => {\n const { isDataLoaded } = useRecurringTransactionsStore()\n const { transactionsLoaded, transactionsLoading } = useTransactionStore()\n const transactionsFailed = isDataLoaded && !transactionsLoaded && !transactionsLoading\n\n return { isDataLoaded, ready: isDataLoaded && transactionsLoaded, transactionsFailed }\n}\n\n/**\n * Open-time data guarantee for the Expense Details drawer. Wired as the block's `usePrepare`, so\n * `ActionBlockLayer` runs it once each time a CTA opens the drawer.\n *\n * A beat is rendered in the feed long before the recurring module has loaded, so the store is\n * usually cold at open time. The loader is the recurring widget's own (accounts, categories and\n * transactions first, then repeating transactions). Guarded on `isDataLoaded` so re-opening does\n * not refetch, and on a ref so a failed load does not refire on every render (retry is explicit).\n */\nexport const useRecurringTransactionPrepare = (_props: ActionBlockProps) => {\n const { isDataLoaded, transactionsFailed } = useRecurringLoadFlags()\n const load = useRecurringTransactionLoad()\n const hasStarted = React.useRef(false)\n // A card can load the repeating transactions alone; the drawer still needs the transactions.\n const isComplete = isDataLoaded && !transactionsFailed\n\n React.useEffect(() => {\n if (hasStarted.current || isComplete) return\n\n hasStarted.current = true\n void load()\n }, [isComplete, load])\n}\n\n/**\n * The recurring expenses' load state for a drawer: `failed` also covers TransactionStore swallowing a\n * failed request (`transactionsLoading` excludes another widget's request in flight).\n */\nexport const useRecurringExpensesLoadState = () => {\n const { isDataLoaded, ready, transactionsFailed } = useRecurringLoadFlags()\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const retry = useRecurringTransactionLoad()\n\n return {\n failed: (loadFailed && !isDataLoaded) || transactionsFailed,\n ready,\n retry: () => void retry(),\n }\n}\n"],"mappings":";;AAwBA,IAAa,IAAA,MAAoC;AAC/C,QAAM,IAA6B,EAA8B,GAC3D,EAAE,kBAAA,EAAA,IAAqB,EAAmB;AAEhD,SAAO,EAAM,YAAY,YAAY;AACnC,IAAA,EAAiB,EAAE,qBAAqB,GAAM,CAAC;AAE/C,QAAI;AACF,YAAM,EAA2B,6BAA6B;AAAA,IAChE,QAAQ;AAAA,IAER;AAEA,IAAK,EAA2B,gBAAc,EAAiB,EAAE,qBAAqB,GAAK,CAAC;AAAA,EAC9F,GAAG,CAAC,GAA4B,CAAgB,CAAC;AACnD,GAOM,IAAA,MAA8B;AAClC,QAAM,EAAE,cAAA,EAAA,IAAiB,EAA8B,GACjD,EAAE,oBAAA,GAAoB,qBAAA,EAAA,IAAwB,EAAoB;AAGxE,SAAO;AAAA,IAAE,cAAA;AAAA,IAAc,OAAO,KAAgB;AAAA,IAAoB,oBAFvC,KAAgB,CAAC,KAAsB,CAAC;AAAA,EAEkB;AACvF,GAWa,IAAA,CAAkC,MAA6B;AAC1E,QAAM,EAAE,cAAA,GAAc,oBAAA,EAAA,IAAuB,EAAsB,GAC7D,IAAO,EAA4B,GACnC,IAAa,EAAM,OAAO,EAAK,GAE/B,IAAa,KAAgB,CAAC;AAEpC,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,EAAW,WAAW,MAE1B,EAAW,UAAU,IACrB,EAAU;AAAA,EACZ,GAAG,CAAC,GAAY,CAAI,CAAC;AACvB,GAMa,IAAA,MAAsC;AACjD,QAAM,EAAE,cAAA,GAAc,OAAA,GAAO,oBAAA,EAAA,IAAuB,EAAsB,GACpE,IACJ,EAAoD,GAAG,wBAAwB,IAC3E,IAAQ,EAA4B;AAE1C,SAAO;AAAA,IACL,QAAS,KAAc,CAAC,KAAiB;AAAA,IACzC,OAAA;AAAA,IACA,OAAA,MAAA;AAAa,MAAK,EAAM;AAAA;AAAA,EAC1B;AACF"}
@@ -1,11 +1,5 @@
1
1
  import { ActionBlockProps } from '../../mappings/blocks';
2
- /**
3
- * Remaining Cash drawer (WEC-1880) for the Payday Cash Left Over Status beat. Store-driven: the
4
- * figures are today's, from CashflowStore's UiStore, not the card's generation-time numbers
5
- * (accepted trade-off, see docs/action-blocks/remaining-cash-block.md).
6
- *
7
- * `observer` is required: everything rendered is read from MobX stores and computeds.
8
- */
2
+ /** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */
9
3
  export declare const RemainingCashBlock: ((_props: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
10
4
  displayName: string;
11
5
  };
@@ -1,91 +1,81 @@
1
- import { CategoryGuids as L } from "../../../core/constants/Category.es.js";
2
- import { DEFAULT_INSTITUTION_LOGO_URL as T } from "../../../core/constants/InstitutionLogo.es.js";
3
- import R from "../../../common/utils/AccountDisplayName.es.js";
4
- import { useAccountStore as G, useActionContext as S, useAppConfig as w, useCashflowStore as A, useGlobalCopyStore as U, useRecurringTransactionsStore as E, useTransactionStore as I } from "../../../common/context/hooks.es.js";
5
- import { getAccountStartingBalance as O } from "../../../core/utils/AccountUtils.es.js";
6
- import b from "../../../common/components/Loader.es.js";
7
- import d from "../../components/CategoryTile.es.js";
8
- import { ErrorCard as k } from "../../components/ErrorCard.es.js";
9
- import { useRecurringTransactionLoad as v } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
10
- import { getCaption as N, getOtherLabel as D, groupRows as F } from "./layout.es.js";
11
- import z from "./RemainingCashContent.es.js";
12
- import { observer as B } from "mobx-react-lite";
13
- import H from "@mui/material/Stack";
14
- import { InstitutionLogo as p, Text as P } from "@mxenabled/mxui";
1
+ import { CategoryGuids as h } from "../../../core/constants/Category.es.js";
2
+ import { DEFAULT_INSTITUTION_LOGO_URL as _ } from "../../../core/constants/InstitutionLogo.es.js";
3
+ import y from "../../../common/utils/AccountDisplayName.es.js";
4
+ import { useAccountStore as C, useAppConfig as x, useCashflowStore as T, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
5
+ import { getAccountStartingBalance as R } from "../../../core/utils/AccountUtils.es.js";
6
+ import L from "../../../common/components/Loader.es.js";
7
+ import r from "../../components/CategoryTile.es.js";
8
+ import { ErrorCard as E } from "../../components/ErrorCard.es.js";
9
+ import { useRecurringExpensesLoadState as S } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
10
+ import { foldOtherRows as a, getCaption as U } from "./layout.es.js";
11
+ import A from "./RemainingCashContent.es.js";
12
+ import { observer as I } from "mobx-react-lite";
13
+ import O from "@mui/material/Stack";
14
+ import { InstitutionLogo as s, Text as b } from "@mxenabled/mxui";
15
15
  import { jsx as n } from "react/jsx-runtime";
16
- var g = (m, i, s) => {
17
- const { others: a, shown: r } = F(m);
18
- return a ? [...r, {
19
- amount: a.total,
20
- key: "other",
21
- leading: s,
22
- name: D(i.one, i.multi, a.count)
23
- }] : r;
24
- }, to = B(function(i) {
25
- const { common: s, insights_feed: a } = U(), { config: r } = w(), { uiStore: t } = A(), { accountsLoaded: l } = G(), { transactionsLoaded: u, transactionsLoading: h } = I(), { isDataLoaded: c } = E(), f = S()?.recurringLoadFailed === !0, _ = v(), y = c && !u && !h, o = a?.remaining_cash;
26
- if (a?.general && !o) return /* @__PURE__ */ n(H, {
16
+ var Q = I(function(N) {
17
+ const { common: m, insights_feed: i } = G(), { config: c } = x(), { uiStore: t } = T(), { accountsLoaded: p } = C(), { failed: u, ready: d, retry: g } = S(), e = i?.remaining_cash;
18
+ if (i?.general && !e) return /* @__PURE__ */ n(O, {
27
19
  sx: { p: 24 },
28
- children: /* @__PURE__ */ n(P, { children: s?.error_message })
20
+ children: /* @__PURE__ */ n(b, { children: m?.error_message })
29
21
  });
30
- if (f && !c || y) return /* @__PURE__ */ n(k, { onRetry: () => {
31
- _();
32
- } });
33
- if (!c || !l || !u || !o) return /* @__PURE__ */ n(b, {});
34
- const C = g(t.selectedCashAccounts.map((e) => ({
35
- amount: O(e, r.display_available_balance_in_accounts),
36
- key: e.guid,
37
- leading: /* @__PURE__ */ n(p, {
22
+ if (u) return /* @__PURE__ */ n(E, { onRetry: g });
23
+ if (!d || !p || !e) return /* @__PURE__ */ n(L, {});
24
+ const l = a(t.selectedCashAccounts.map((o) => ({
25
+ amount: R(o, c.display_available_balance_in_accounts),
26
+ key: o.guid,
27
+ leading: /* @__PURE__ */ n(s, {
38
28
  alt: "",
39
- institutionGuid: e.institution_guid ?? "",
29
+ institutionGuid: o.institution_guid ?? "",
40
30
  size: 32
41
31
  }),
42
- name: R(e)
32
+ name: y(o)
43
33
  })), {
44
- multi: o.other_accounts,
45
- one: o.other_accounts_one
46
- }, /* @__PURE__ */ n(p, {
34
+ multi: e.other_accounts,
35
+ one: e.other_accounts_one
36
+ }, /* @__PURE__ */ n(s, {
47
37
  alt: "",
48
38
  institutionGuid: "",
49
- logoUrl: T,
39
+ logoUrl: _,
50
40
  size: 32
51
- })), x = g(t.expensesTilNextIncome.map((e) => ({
52
- amount: e.amount,
53
- key: `${e.repeatingTransactionGuid}-${e.expectedDate.getTime()}`,
54
- leading: /* @__PURE__ */ n(d, {
55
- categoryGuid: e.categoryGuid,
41
+ })), f = a(t.expensesTilNextIncome.map((o) => ({
42
+ amount: o.amount,
43
+ key: `${o.repeatingTransactionGuid}-${o.expectedDate.getTime()}`,
44
+ leading: /* @__PURE__ */ n(r, {
45
+ categoryGuid: o.categoryGuid,
56
46
  size: 32
57
47
  }),
58
- name: e.name
48
+ name: o.name
59
49
  })), {
60
- multi: o.other_expenses,
61
- one: o.other_expenses_one
62
- }, /* @__PURE__ */ n(d, {
63
- categoryGuid: L.UNCATEGORIZED,
50
+ multi: e.other_expenses,
51
+ one: e.other_expenses_one
52
+ }, /* @__PURE__ */ n(r, {
53
+ categoryGuid: h.UNCATEGORIZED,
64
54
  size: 32
65
55
  }));
66
- return /* @__PURE__ */ n(z, {
56
+ return /* @__PURE__ */ n(A, {
67
57
  accounts: {
68
- header: o.accounts_header,
69
- rows: C
58
+ header: e.accounts_header,
59
+ rows: l
70
60
  },
71
61
  expenses: {
72
- header: o.recurring_expenses_header,
73
- rows: x
62
+ header: e.recurring_expenses_header,
63
+ rows: f
74
64
  },
75
65
  summary: {
76
66
  remaining: t.hasUpcomingPayday ? {
77
67
  amount: t.remainingUntilPayday,
78
- caption: N(o, t.daysUntilNextIncome)
68
+ caption: U(e, t.daysUntilNextIncome)
79
69
  } : void 0,
80
70
  cashOnHand: t.selectedCashBalance,
81
- cashOnHandLabel: o.cash_on_hand,
71
+ cashOnHandLabel: e.cash_on_hand,
82
72
  upcomingExpenses: t.upcomingExpensesTotal,
83
- upcomingExpensesLabel: o.upcoming_expenses
73
+ upcomingExpensesLabel: e.upcoming_expenses
84
74
  }
85
75
  });
86
76
  });
87
77
  export {
88
- to as RemainingCashBlock
78
+ Q as RemainingCashBlock
89
79
  };
90
80
 
91
81
  //# sourceMappingURL=RemainingCashBlock.es.js.map