@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.
- package/CHANGELOG.md +4 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +11 -15
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +5 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +77 -30
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +26 -13
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +107 -136
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +21 -7
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +34 -17
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.d.ts +3 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js +10 -8
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.d.ts +10 -12
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js +20 -19
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.d.ts +3 -12
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js +8 -8
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.d.ts +9 -0
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js +27 -10
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +1 -7
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +49 -59
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +29 -75
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +12 -0
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +18 -9
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/AmountBreakdownCard.es.js +9 -8
- package/dist/insights-v2/components/AmountBreakdownCard.es.js.map +1 -1
- package/dist/insights-v2/components/InsightListRow.d.ts +31 -0
- package/dist/insights-v2/components/InsightListRow.es.js +111 -0
- package/dist/insights-v2/components/InsightListRow.es.js.map +1 -0
- package/dist/insights-v2/components/SubTabs.d.ts +2 -1
- package/dist/insights-v2/components/SubTabs.es.js +10 -10
- package/dist/insights-v2/components/SubTabs.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +12 -12
- package/dist/insights-v2/mappings/blocks.es.js +21 -21
- package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -1
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +169 -120
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +3 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js +151 -118
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -6
- package/dist/transactions/components/shared/TransactionDetails.es.js +149 -199
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/Description.d.ts +2 -0
- package/dist/transactions/components/shared/transactiondetails/Description.es.js +59 -50
- package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.d.ts +10 -0
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js +68 -0
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,39 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
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:
|
|
32
|
+
value: l(i)
|
|
17
33
|
},
|
|
18
34
|
{
|
|
19
35
|
key: "planned_expenses",
|
|
20
36
|
label: e.planned_expenses,
|
|
21
|
-
value:
|
|
37
|
+
value: l(-o)
|
|
22
38
|
},
|
|
23
39
|
{
|
|
24
40
|
bold: !0,
|
|
25
41
|
key: "remaining",
|
|
26
42
|
label: e.remaining,
|
|
27
|
-
value:
|
|
43
|
+
value: l(n)
|
|
28
44
|
}
|
|
29
45
|
]
|
|
30
46
|
};
|
|
31
|
-
},
|
|
47
|
+
}, p = { monthly_obligations: b }, k = (a, e) => g(p, a?.variant, "monthly_obligations", "AccountListBlock")(a?.drilldown_data, e);
|
|
32
48
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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":"
|
|
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"}
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
+
import { Recurrence } from '../../../core';
|
|
1
2
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
2
3
|
/**
|
|
3
|
-
* Expense Details drawer
|
|
4
|
-
*
|
|
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
|
|
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
|
};
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import
|
|
3
|
-
import { RecurringTransactionDetails as
|
|
4
|
-
import { ErrorCard as
|
|
5
|
-
import { useRecurringTransactionBlock as
|
|
6
|
-
import { useRecurringTransactionLoad as
|
|
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
|
|
9
|
-
import { Text as
|
|
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
|
|
12
|
-
const { closeActionDrawer:
|
|
13
|
-
e.current === null && (e.current = { ...
|
|
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(
|
|
20
|
-
|
|
21
|
-
} }) : o ? /* @__PURE__ */ t(
|
|
22
|
-
|
|
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:
|
|
25
|
-
}) : /* @__PURE__ */ t(
|
|
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:
|
|
33
|
+
children: g.no_activities
|
|
33
34
|
});
|
|
34
35
|
});
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
z as RecurringTransactionBlock
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
//# sourceMappingURL=RecurringTransactionBlock.es.js.map
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js.map
CHANGED
|
@@ -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
|
|
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';
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.d.ts
CHANGED
|
@@ -8,16 +8,7 @@ export interface RecurringTransactionBlockState {
|
|
|
8
8
|
repeatingTransaction?: RepeatingTransaction;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Resolves
|
|
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;
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { useActionContext as
|
|
2
|
-
import { resolveSubscriptionGuid as
|
|
3
|
-
var
|
|
4
|
-
const { detailedRepeatingTransactions:
|
|
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:
|
|
7
|
-
}), a = (
|
|
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:
|
|
14
|
+
repeatingTransaction: u
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
|
-
|
|
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
|
|
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"}
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.d.ts
CHANGED
|
@@ -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
|
+
};
|
package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useInsightsV2Store as
|
|
2
|
-
import
|
|
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 =
|
|
5
|
-
return
|
|
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 = (
|
|
14
|
-
const { isDataLoaded:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
|
2
|
-
import { DEFAULT_INSTITUTION_LOGO_URL as
|
|
3
|
-
import
|
|
4
|
-
import { useAccountStore as
|
|
5
|
-
import { getAccountStartingBalance as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { ErrorCard as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { observer as
|
|
13
|
-
import
|
|
14
|
-
import { InstitutionLogo as
|
|
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
|
|
17
|
-
const {
|
|
18
|
-
return
|
|
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(
|
|
20
|
+
children: /* @__PURE__ */ n(b, { children: m?.error_message })
|
|
29
21
|
});
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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:
|
|
29
|
+
institutionGuid: o.institution_guid ?? "",
|
|
40
30
|
size: 32
|
|
41
31
|
}),
|
|
42
|
-
name:
|
|
32
|
+
name: y(o)
|
|
43
33
|
})), {
|
|
44
|
-
multi:
|
|
45
|
-
one:
|
|
46
|
-
}, /* @__PURE__ */ n(
|
|
34
|
+
multi: e.other_accounts,
|
|
35
|
+
one: e.other_accounts_one
|
|
36
|
+
}, /* @__PURE__ */ n(s, {
|
|
47
37
|
alt: "",
|
|
48
38
|
institutionGuid: "",
|
|
49
|
-
logoUrl:
|
|
39
|
+
logoUrl: _,
|
|
50
40
|
size: 32
|
|
51
|
-
})),
|
|
52
|
-
amount:
|
|
53
|
-
key: `${
|
|
54
|
-
leading: /* @__PURE__ */ n(
|
|
55
|
-
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:
|
|
48
|
+
name: o.name
|
|
59
49
|
})), {
|
|
60
|
-
multi:
|
|
61
|
-
one:
|
|
62
|
-
}, /* @__PURE__ */ n(
|
|
63
|
-
categoryGuid:
|
|
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(
|
|
56
|
+
return /* @__PURE__ */ n(A, {
|
|
67
57
|
accounts: {
|
|
68
|
-
header:
|
|
69
|
-
rows:
|
|
58
|
+
header: e.accounts_header,
|
|
59
|
+
rows: l
|
|
70
60
|
},
|
|
71
61
|
expenses: {
|
|
72
|
-
header:
|
|
73
|
-
rows:
|
|
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:
|
|
68
|
+
caption: U(e, t.daysUntilNextIncome)
|
|
79
69
|
} : void 0,
|
|
80
70
|
cashOnHand: t.selectedCashBalance,
|
|
81
|
-
cashOnHandLabel:
|
|
71
|
+
cashOnHandLabel: e.cash_on_hand,
|
|
82
72
|
upcomingExpenses: t.upcomingExpensesTotal,
|
|
83
|
-
upcomingExpensesLabel:
|
|
73
|
+
upcomingExpensesLabel: e.upcoming_expenses
|
|
84
74
|
}
|
|
85
75
|
});
|
|
86
76
|
});
|
|
87
77
|
export {
|
|
88
|
-
|
|
78
|
+
Q as RemainingCashBlock
|
|
89
79
|
};
|
|
90
80
|
|
|
91
81
|
//# sourceMappingURL=RemainingCashBlock.es.js.map
|