@mx-cartographer/experiences 9.7.129 → 9.7.130
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/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +44 -43
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +46 -45
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js +23 -22
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -25
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.d.ts +0 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.es.js +6 -6
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +8 -7
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js +11 -13
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +14 -13
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +10 -9
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +0 -3
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +30 -33
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +31 -30
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +11 -10
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +5 -5
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +5 -0
- package/dist/insights-v2/blocks/slotReaders.es.js +7 -5
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [9.7.130] - 11-10-2026
|
|
2
|
+
|
|
3
|
+
- **CHANGED** - Insights V2 drops a blank (whitespace-only) payload text value or guid as it already drops an empty one, in the drawers, the Create Budget dialog and the budget analytics event; payload values are read through one shared set of readers (WEC-2259)
|
|
4
|
+
|
|
1
5
|
## [9.7.129] - 11-10-2026
|
|
2
6
|
|
|
3
7
|
- **BREAKING** - Monthly Obligations Status drawer and the insights Expense Details match Figma: every recurring expense is its own row (no "Other" fold), a tapped account opens Account Details (the shared account details block) in a nested drawer, and list dividers start under the text; needs the new Account List copy first (publish mrs_content !500 and !505 (Accounts tab label), bump firefly, then release); the exported `AmountBreakdownCard` now has the grey `action.hover` total box and the soft logo elevation shadow (WEC-2115)
|
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as
|
|
3
|
-
import { getFrequencyLabel as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (!
|
|
1
|
+
import H from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as J, useAppConfig as K, useCashflowStore as M, useGlobalCopyStore as P, useGlobalStore as Q, useInsightsV2Store as U, useRecurringTransactionsStore as W } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { getFrequencyLabel as X } from "../../../core/utils/RecurringTransactionsUtil.es.js";
|
|
4
|
+
import A from "../../../common/components/drawer/Drawer.es.js";
|
|
5
|
+
import C from "../../../common/components/Loader.es.js";
|
|
6
|
+
import Y from "../../components/CategoryTile.es.js";
|
|
7
|
+
import { getDynamicCtaBasedOnTriggers as Z } from "../util.es.js";
|
|
8
|
+
import { useRecurringExpensesLoadState as tt } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
|
|
9
|
+
import { RecurringTransactionBlock as ot } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
|
|
10
|
+
import { AccountDetailsBlock as et } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
|
|
11
|
+
import nt from "./AccountListContent.es.js";
|
|
12
|
+
import { buildSummary as it, isCheckingAccount as S, resolveBeatAccounts as ct, toAccountSection as T } from "./layout.es.js";
|
|
13
|
+
import { useState as G } from "react";
|
|
14
|
+
import { observer as rt } from "mobx-react-lite";
|
|
15
|
+
import st from "@mui/material/Stack";
|
|
16
|
+
import { Text as at } from "@mxenabled/mxui";
|
|
17
|
+
import { Fragment as ut, jsx as o, jsxs as lt } from "react/jsx-runtime";
|
|
18
|
+
var Dt = rt(function({ beat: n }) {
|
|
19
|
+
const [i, l] = G(null), [r, m] = G(null), { copyStore: k } = Q(), { accounts: p, common: v, insights_feed: L, recurring: s } = P(), { accountsLoaded: b, cashAccounts: x, visibleAccounts: d } = J(), { actionDrawer: D } = U(), { uiStore: w } = M(), { detailedRepeatingTransactions: R } = W(), { config: B } = K(), { failed: g, ready: f, retry: E } = tt(), e = L?.account_list;
|
|
20
|
+
if (!k.isInitialized) return /* @__PURE__ */ o(C, {});
|
|
21
|
+
if (!e) return /* @__PURE__ */ o(st, {
|
|
21
22
|
sx: { p: 24 },
|
|
22
|
-
children: /* @__PURE__ */ o(
|
|
23
|
+
children: /* @__PURE__ */ o(at, { children: v?.error_message ?? "Something went wrong." })
|
|
23
24
|
});
|
|
24
|
-
if (!b) return /* @__PURE__ */ o(
|
|
25
|
-
const { primary_cta:
|
|
26
|
-
const c =
|
|
25
|
+
if (!b) return /* @__PURE__ */ o(C, {});
|
|
26
|
+
const { primary_cta: F, secondary_cta: $, in_description_cta: I } = n.insights_payload ?? {}, N = Z(D, F, $, I), y = ct(n, d, x), O = y.filter(S), j = y.filter((t) => !S(t)), a = B.display_available_balance_in_accounts, q = [T("checking", e.checking, O, a), T("savings", e.savings, j, a)].filter((t) => t.rows.length > 0), z = f ? [...w.expensesTilNextIncome].sort((t, c) => c.amount - t.amount).map((t) => {
|
|
27
|
+
const c = d.find(({ guid: u }) => u === t.accountGuid), h = R.find(({ guid: u }) => u === t.repeatingTransactionGuid);
|
|
27
28
|
return {
|
|
28
29
|
account: {
|
|
29
30
|
institutionGuid: t.institutionGuid,
|
|
30
|
-
name: c ?
|
|
31
|
+
name: c ? H(c) : t.institutionName
|
|
31
32
|
},
|
|
32
33
|
amount: t.amount,
|
|
33
|
-
frequency: h &&
|
|
34
|
+
frequency: h && X(s, h, !1),
|
|
34
35
|
key: `${t.repeatingTransactionGuid}-${t.expectedDate.getTime()}`,
|
|
35
|
-
leading: /* @__PURE__ */ o(
|
|
36
|
-
categoryGuid:
|
|
36
|
+
leading: /* @__PURE__ */ o(Y, {
|
|
37
|
+
categoryGuid: t.categoryGuid,
|
|
37
38
|
size: 32
|
|
38
39
|
}),
|
|
39
40
|
name: t.name,
|
|
40
41
|
onClick: () => l(t)
|
|
41
42
|
};
|
|
42
|
-
}) : [], _ = () => l(null),
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */ o(
|
|
43
|
+
}) : [], _ = () => l(null), V = () => m(null);
|
|
44
|
+
return /* @__PURE__ */ lt(ut, { children: [
|
|
45
|
+
/* @__PURE__ */ o(nt, {
|
|
45
46
|
copy: e,
|
|
46
|
-
expenses:
|
|
47
|
+
expenses: z,
|
|
47
48
|
expensesLoading: !f && !g,
|
|
48
49
|
onAccountClick: m,
|
|
49
|
-
onRetryExpenses: g ?
|
|
50
|
-
sections:
|
|
50
|
+
onRetryExpenses: g ? E : void 0,
|
|
51
|
+
sections: q,
|
|
51
52
|
showAvailable: a,
|
|
52
|
-
summary:
|
|
53
|
+
summary: it(N, e)
|
|
53
54
|
}),
|
|
54
|
-
/* @__PURE__ */ o(
|
|
55
|
+
/* @__PURE__ */ o(A, {
|
|
55
56
|
ariaLabelClose: s.close_drawer_aria,
|
|
56
57
|
isOpen: i !== null,
|
|
57
58
|
onClose: _,
|
|
58
59
|
title: s.expense_details,
|
|
59
|
-
children: i && /* @__PURE__ */ o(
|
|
60
|
+
children: i && /* @__PURE__ */ o(ot, {
|
|
60
61
|
beat: n,
|
|
61
62
|
layout: "insights",
|
|
62
63
|
onDeleted: _,
|
|
@@ -64,12 +65,12 @@ var wt = st(function({ beat: n }) {
|
|
|
64
65
|
selectedRecurrence: i
|
|
65
66
|
})
|
|
66
67
|
}),
|
|
67
|
-
/* @__PURE__ */ o(
|
|
68
|
-
ariaLabelClose:
|
|
68
|
+
/* @__PURE__ */ o(A, {
|
|
69
|
+
ariaLabelClose: p?.close_account_details_aria,
|
|
69
70
|
isOpen: r !== null,
|
|
70
|
-
onClose:
|
|
71
|
-
title:
|
|
72
|
-
children: r && /* @__PURE__ */ o(
|
|
71
|
+
onClose: V,
|
|
72
|
+
title: p?.account_details,
|
|
73
|
+
children: r && /* @__PURE__ */ o(et, { beat: {
|
|
73
74
|
...n,
|
|
74
75
|
primary_account: void 0,
|
|
75
76
|
primary_account_guid: r
|
|
@@ -78,7 +79,7 @@ var wt = st(function({ beat: n }) {
|
|
|
78
79
|
] });
|
|
79
80
|
});
|
|
80
81
|
export {
|
|
81
|
-
|
|
82
|
+
Dt as AccountListBlock
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
//# sourceMappingURL=AccountListBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport {
|
|
1
|
+
{"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n useGlobalStore,\n useInsightsV2Store,\n useRecurringTransactionsStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Recurrence } from '../../../core'\nimport { getFrequencyLabel } from '../../../core/utils/RecurringTransactionsUtil'\nimport CategoryTile from '../../components/CategoryTile'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringExpensesLoadState,\n} from '../RecurringTransactionBlock'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\nimport AccountListContent, { type ExpenseRow } from './AccountListContent'\nimport { buildSummary, isCheckingAccount, resolveBeatAccounts, toAccountSection } from './layout'\n\n/**\n * Account List drawer: the CTA's calculation, then Accounts and Recurring Expenses tabs.\n * A tapped expense opens its Expense Details, and a tapped account its Account Details (the shared\n * AccountDetailsBlock), each in a nested drawer.\n */\nexport const AccountListBlock = observer(function AccountListBlock({ beat }: ActionBlockProps) {\n const [tappedExpense, setTappedExpense] = useState<Recurrence | null>(null)\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { copyStore } = useGlobalStore()\n const {\n accounts: accountsCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n recurring: recurringCopy,\n } = useGlobalCopyStore()\n const { accountsLoaded, cashAccounts, visibleAccounts } = useAccountStore()\n const { actionDrawer } = useInsightsV2Store()\n const { uiStore } = useCashflowStore()\n const { detailedRepeatingTransactions } = useRecurringTransactionsStore()\n const { config } = useAppConfig()\n const { failed: expensesFailed, ready: expensesReady, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.account_list\n\n if (!copyStore.isInitialized) return <Loader />\n\n // Copy loads once at app start, so a retry cannot clear a missing namespace: a plain message.\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message ?? 'Something went wrong.'}</Text>\n </Stack>\n )\n }\n\n if (!accountsLoaded) return <Loader />\n\n const { primary_cta, secondary_cta, in_description_cta } = beat.insights_payload ?? {}\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )\n\n const listed = resolveBeatAccounts(beat, visibleAccounts, cashAccounts)\n const checking = listed.filter(isCheckingAccount)\n const savings = listed.filter((account) => !isCheckingAccount(account))\n const showAvailable = config.display_available_balance_in_accounts\n const sections = [\n toAccountSection('checking', copy.checking, checking, showAvailable),\n toAccountSection('savings', copy.savings, savings, showAvailable),\n ].filter((section) => section.rows.length > 0)\n\n // Every upcoming expense as its own row, largest first (Figma); no \"Other\" fold, so each opens its details.\n const expenses: ExpenseRow[] = expensesReady\n ? [...uiStore.expensesTilNextIncome]\n .sort((a, b) => b.amount - a.amount)\n .map((expense) => {\n const account = visibleAccounts.find(({ guid }) => guid === expense.accountGuid)\n const repeating = detailedRepeatingTransactions.find(\n ({ guid }) => guid === expense.repeatingTransactionGuid,\n )\n\n return {\n account: {\n institutionGuid: expense.institutionGuid,\n name: account ? getAccountDisplayName(account) : expense.institutionName,\n },\n amount: expense.amount,\n frequency: repeating && getFrequencyLabel(recurringCopy, repeating, false),\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n onClick: () => setTappedExpense(expense),\n }\n })\n : []\n\n const closeExpenseDetails = () => setTappedExpense(null)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <AccountListContent\n copy={copy}\n expenses={expenses}\n expensesLoading={!expensesReady && !expensesFailed}\n onAccountClick={setTappedAccountGuid}\n onRetryExpenses={expensesFailed ? retry : undefined}\n sections={sections}\n showAvailable={showAvailable}\n summary={buildSummary(cta, copy)}\n />\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={tappedExpense !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {tappedExpense && (\n <RecurringTransactionBlock\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={tappedExpense.repeatingTransactionGuid}\n selectedRecurrence={tappedExpense}\n />\n )}\n </Drawer>\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,IAAa,KAAmB,GAAS,SAA0B,EAAE,MAAA,EAAA,GAA0B;AAC7F,QAAM,CAAC,GAAe,CAAA,IAAoB,EAA4B,IAAI,GACpE,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,WAAA,EAAA,IAAc,EAAe,GAC/B,EACJ,UAAU,GACV,QAAQ,GACR,eAAe,GACf,WAAW,EAAA,IACT,EAAmB,GACjB,EAAE,gBAAA,GAAgB,cAAA,GAAc,iBAAA,EAAA,IAAoB,EAAgB,GACpE,EAAE,cAAA,EAAA,IAAiB,EAAmB,GACtC,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,+BAAA,EAAA,IAAkC,EAA8B,GAClE,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,QAAQ,GAAgB,OAAO,GAAe,OAAA,EAAA,IAAU,GAA8B,GACxF,IAAO,GAAkB;AAE/B,MAAI,CAAC,EAAU,cAAe,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAG9C,MAAI,CAAC,EACH,QACE,gBAAA,EAAC,IAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,IAAD,EAAA,UAAO,GAAY,iBAAiB,wBAA8B,CAAA;AAAA,EAC7D,CAAA;AAIX,MAAI,CAAC,EAAgB,QAAO,gBAAA,E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AI,GACjD,IAAA,MAA4B,EAAqB,IAAI;AAE3D,SACE,gBAAA,GAAA,IAAA,EAAA,UAAA;AAAA,IACE,gBAAA,EAAC,IAAD;AAAA,MACQ,MAAA;AAAA,MACI,UAAA;AAAA,MACV,iBAAiB,CAAC,KAAiB,CAAC;AAAA,MACpC,gBAAgB;AAAA,MAChB,iBAAiB,IAAiB,IAAQ;AAAA,MAChC,UAAA;AAAA,MACK,eAAA;AAAA,MACf,SAAS,GAAa,GAAK,CAAI;AAAA,IAChC,CAAA;AAAA,IACD,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAc;AAAA,MAC9B,QAAQ,MAAkB;AAAA,MAC1B,SAAS;AAAA,MACT,OAAO,EAAc;AAAA,MAEpB,UAAA,KACC,gBAAA,EAAC,IAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAO;AAAA,QACP,WAAW;AAAA,QACX,0BAA0B,EAAc;AAAA,QACxC,oBAAoB;AAAA,MACrB,CAAA;AAAA,IAEG,CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,GAAc;AAAA,MAC9B,QAAQ,MAAsB;AAAA,MAC9B,SAAS;AAAA,MACT,OAAO,GAAc;AAAA,MAEpB,UAAA,KAEC,gBAAA,EAAC,IAAD,EACE,MAAM;AAAA,QAAE,GAAG;AAAA,QAAM,iBAAiB;AAAA,QAAW,sBAAsB;AAAA,MAAkB,EACtF,CAAA;AAAA,IAEG,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
|
|
@@ -3,7 +3,7 @@ import m from "../../../common/utils/AccountDisplayName.es.js";
|
|
|
3
3
|
import { formatSignedCurrency as l } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
4
|
import { getAccountStartingBalance as d } from "../../../core/utils/AccountUtils.es.js";
|
|
5
5
|
import { resolveVariantConfig as g } from "../../blocks/resolveVariantConfig.es.js";
|
|
6
|
-
import {
|
|
6
|
+
import { asNumber as s } from "../../blocks/slotReaders.es.js";
|
|
7
7
|
var c = (a) => a.balance ?? 0, E = (a, e, i) => {
|
|
8
8
|
const o = new Set(a.account_guids?.length ? a.account_guids : i.map(({ guid: n }) => n));
|
|
9
9
|
return e.filter((n) => o.has(n.guid)).sort((n, t) => c(t) - c(n));
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 { asNumber } from '../../blocks/slotReaders'\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 = asNumber(drilldown?.available_funds)\n const plannedExpenses = asNumber(drilldown?.planned_expenses)\n const totalRemaining = asNumber(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,EAAS,GAAW,eAAe,GACpD,IAAkB,EAAS,GAAW,gBAAgB,GACtD,IAAiB,EAAS,GAAW,eAAe;AAE1D,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,29 +1,30 @@
|
|
|
1
1
|
import { BEAT_ACTIVE_AT_KEY as m } from "../../../core/stores/InsightsV2Store.es.js";
|
|
2
|
-
import { resolveVariantConfig as
|
|
2
|
+
import { resolveVariantConfig as c } from "../../blocks/resolveVariantConfig.es.js";
|
|
3
|
+
import { asNonEmptyText as n, asNumber as u } from "../../blocks/slotReaders.es.js";
|
|
3
4
|
import { endOfMonth as o } from "date-fns/endOfMonth";
|
|
4
|
-
import { startOfMonth as
|
|
5
|
+
import { startOfMonth as s } from "date-fns/startOfMonth";
|
|
5
6
|
import { differenceInCalendarDays as v } from "date-fns/differenceInCalendarDays";
|
|
6
7
|
var l = {
|
|
7
8
|
LOW: "success.light",
|
|
8
9
|
MEDIUM: "warning.light",
|
|
9
10
|
HIGH: "warning.main",
|
|
10
11
|
OFF_TRACK: "error.main"
|
|
11
|
-
}, T = "success.main",
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
},
|
|
17
|
-
const
|
|
12
|
+
}, T = "success.main", N = (e, t) => Math.ceil((t ? e / t : 0) * 100), L = (e) => {
|
|
13
|
+
if (e > 100) return "OFF_TRACK";
|
|
14
|
+
if (e >= 75) return "HIGH";
|
|
15
|
+
if (e >= 50) return "MEDIUM";
|
|
16
|
+
if (e >= 25) return "LOW";
|
|
17
|
+
}, M = (e) => e ? l[e] : T, E = (e) => {
|
|
18
|
+
const t = e.insights_payload, r = t?.instance_slot?.data ?? t?.instance_slot_data ?? {};
|
|
18
19
|
return {
|
|
19
|
-
categoryGuid:
|
|
20
|
-
merchantGuid:
|
|
21
|
-
spent:
|
|
22
|
-
budgeted:
|
|
20
|
+
categoryGuid: n(r.category_guid) ?? t?.primary_category_guid ?? e.primary_category_guid ?? void 0,
|
|
21
|
+
merchantGuid: n(r.merchant_guid) ?? t?.primary_merchant_guid ?? e.primary_merchant_guid ?? void 0,
|
|
22
|
+
spent: u(r.spent_amount),
|
|
23
|
+
budgeted: u(r.budgeted_amount)
|
|
23
24
|
};
|
|
24
|
-
}, i = (
|
|
25
|
-
const { categoryGuid: r } = E(
|
|
26
|
-
return (r ?
|
|
25
|
+
}, i = (e, t) => {
|
|
26
|
+
const { categoryGuid: r } = E(e);
|
|
27
|
+
return (r ? t.categories?.default_categories?.[r] : void 0)?.replace(/&/g, "&");
|
|
27
28
|
}, a = {
|
|
28
29
|
CATEGORY_SPEND: "category_spend",
|
|
29
30
|
CATEGORY_BUDGET: "category_budget",
|
|
@@ -32,52 +33,52 @@ var l = {
|
|
|
32
33
|
default: i,
|
|
33
34
|
[a.CATEGORY_SPEND]: i,
|
|
34
35
|
[a.CATEGORY_BUDGET]: i
|
|
35
|
-
},
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
return Number.isNaN(
|
|
39
|
-
},
|
|
40
|
-
const _ =
|
|
41
|
-
if (!(o(_) <
|
|
42
|
-
return v(o(
|
|
43
|
-
},
|
|
44
|
-
const r =
|
|
36
|
+
}, U = (e, t, r) => c(f, e, "default", "BudgetDetailsBlock")(t, r), d = (e) => {
|
|
37
|
+
if (e == null || e === "") return;
|
|
38
|
+
const t = new Date(typeof e == "number" ? e * 1e3 : e);
|
|
39
|
+
return Number.isNaN(t.getTime()) ? void 0 : t;
|
|
40
|
+
}, A = (e) => e.active_at ?? e.insights_payload?.active_at, b = (e, t) => e.beatContext[t.guid]?.[m], g = (e, t, r = /* @__PURE__ */ new Date()) => d(t) ?? d(A(e)) ?? r, I = (e, t = /* @__PURE__ */ new Date(), r) => {
|
|
41
|
+
const _ = g(e, r, t);
|
|
42
|
+
if (!(o(_) < s(t)))
|
|
43
|
+
return v(o(t), t) + 1;
|
|
44
|
+
}, P = (e, t) => {
|
|
45
|
+
const r = g(e, t);
|
|
45
46
|
return {
|
|
46
|
-
start:
|
|
47
|
+
start: s(r),
|
|
47
48
|
end: o(r)
|
|
48
49
|
};
|
|
49
|
-
},
|
|
50
|
-
const r =
|
|
50
|
+
}, h = (e) => (t) => t.category_guid === e || t.top_level_category_guid === e, y = (e) => (t) => t.merchant_guid === e, F = (e, t) => {
|
|
51
|
+
const r = e.categoryGuid ? h(e.categoryGuid) : e.merchantGuid ? y(e.merchantGuid) : void 0;
|
|
51
52
|
return r && {
|
|
52
53
|
custom: r,
|
|
53
|
-
dateRange:
|
|
54
|
+
dateRange: t
|
|
54
55
|
};
|
|
55
56
|
}, D = {
|
|
56
57
|
default: { showPeriodLine: !0 },
|
|
57
58
|
[a.CATEGORY_SPEND]: { showPeriodLine: !1 },
|
|
58
59
|
[a.CATEGORY_BUDGET]: { showPeriodLine: !1 },
|
|
59
60
|
[a.MERCHANT_BUDGET]: { showPeriodLine: !1 }
|
|
60
|
-
},
|
|
61
|
-
const
|
|
62
|
-
return
|
|
61
|
+
}, S = (e) => c(D, e, "default", "BudgetDetailsBlock"), Y = (e) => {
|
|
62
|
+
const t = Number(e);
|
|
63
|
+
return e.trim() !== "" && Number.isFinite(t) && t > 0;
|
|
63
64
|
};
|
|
64
65
|
export {
|
|
65
66
|
l as BUDGET_TIER_COLORS,
|
|
66
67
|
T as DEFAULT_TIER_COLOR,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
d as activeAtDate,
|
|
69
|
+
A as beatActiveAt,
|
|
70
|
+
g as budgetMonthOf,
|
|
71
|
+
P as budgetMonthRange,
|
|
71
72
|
F as budgetTransactionFilter,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
N as calculateBudgetPercent,
|
|
74
|
+
L as calculateBudgetTier,
|
|
75
|
+
I as daysLeftInBudgetMonth,
|
|
76
|
+
Y as isPositiveAmount,
|
|
77
|
+
b as recordedActiveAtOf,
|
|
78
|
+
S as resolveBudgetDetailsLayout,
|
|
78
79
|
E as resolveBudgetFacts,
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
U as resolveBudgetSubject,
|
|
81
|
+
M as tierColor
|
|
81
82
|
};
|
|
82
83
|
|
|
83
84
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat, GlobalCopy, Transaction } from '../../../core'\nimport { BEAT_ACTIVE_AT_KEY, type InsightsV2Store } from '../../../core/stores/InsightsV2Store'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat, GlobalCopy, Transaction } from '../../../core'\nimport { BEAT_ACTIVE_AT_KEY, type InsightsV2Store } from '../../../core/stores/InsightsV2Store'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\nexport const resolveBudgetFacts = (beat: Beat): BudgetFacts => {\n const payload = beat.insights_payload\n const data = (payload?.instance_slot?.data ?? payload?.instance_slot_data ?? {}) as Record<\n string,\n unknown\n >\n\n return {\n categoryGuid:\n asNonEmptyText(data.category_guid) ??\n payload?.primary_category_guid ??\n beat.primary_category_guid ??\n undefined,\n merchantGuid:\n asNonEmptyText(data.merchant_guid) ??\n payload?.primary_merchant_guid ??\n beat.primary_merchant_guid ??\n undefined,\n spent: asNumber(data.spent_amount),\n budgeted: asNumber(data.budgeted_amount),\n }\n}\n\ntype BudgetSubject = (beat: Beat, copy: GlobalCopy) => string | undefined\n\nconst categoryName: BudgetSubject = (beat, copy) => {\n const { categoryGuid } = resolveBudgetFacts(beat)\n const name = categoryGuid ? copy.categories?.default_categories?.[categoryGuid] : undefined\n\n return name?.replace(/&/g, '&')\n}\n\n/** The CTA variants `budget_details_block` serves (ditto names one on each beat's CTA). */\nconst BUDGET_DETAILS_VARIANTS = {\n CATEGORY_SPEND: 'category_spend',\n CATEGORY_BUDGET: 'category_budget',\n MERCHANT_BUDGET: 'merchant_budget',\n} as const\n\n// The drawer's \"{subject} Budget\" title, keyed by the CTA variant; the card's subtitle never names it.\nconst BUDGET_SUBJECT: Record<string, BudgetSubject> = {\n default: categoryName,\n [BUDGET_DETAILS_VARIANTS.CATEGORY_SPEND]: categoryName,\n [BUDGET_DETAILS_VARIANTS.CATEGORY_BUDGET]: categoryName,\n // merchant_budget: the merchant name, when Merchant Budget moves to Insights 2.0.\n}\n\nexport const resolveBudgetSubject = (\n variant: string | null | undefined,\n beat: Beat,\n copy: GlobalCopy,\n): string | undefined =>\n resolveVariantConfig(BUDGET_SUBJECT, variant, 'default', 'BudgetDetailsBlock')(beat, copy)\n\ntype ActiveAt = Beat['active_at'] | number | null | undefined\n\n/** A beat's `active_at` (epoch seconds or ISO) as a date; undefined when absent or invalid. */\nexport const activeAtDate = (raw: ActiveAt): Date | undefined => {\n if (raw == null || raw === '') return undefined\n const at = new Date(typeof raw === 'number' ? raw * 1000 : raw)\n\n return Number.isNaN(at.getTime()) ? undefined : at\n}\n\n/** The beat's own `active_at`: on the beat, else on its envelope. */\nexport const beatActiveAt = (beat: Beat): ActiveAt =>\n beat.active_at ?? beat.insights_payload?.active_at\n\n/** The `active_at` the card recorded on render; a sampled beat is re-read without it after a CTA. */\nexport const recordedActiveAtOf = (\n store: Pick<InsightsV2Store, 'beatContext'>,\n beat: Beat,\n): ActiveAt => store.beatContext[beat.guid]?.[BEAT_ACTIVE_AT_KEY] as ActiveAt\n\n/** The budget month's anchor: the recorded `active_at`, else the beat's, else now. */\nexport const budgetMonthOf = (beat: Beat, recordedActiveAt?: ActiveAt, now = new Date()) =>\n activeAtDate(recordedActiveAt) ?? activeAtDate(beatActiveAt(beat)) ?? now\n\nexport const daysLeftInBudgetMonth = (\n beat: Beat,\n now = new Date(),\n recordedActiveAt?: ActiveAt,\n) => {\n const activeAt = budgetMonthOf(beat, recordedActiveAt, now)\n if (endOfMonth(activeAt) < startOfMonth(now)) return undefined\n\n return differenceInCalendarDays(endOfMonth(now), now) + 1\n}\n\n/** The month a budget drawer shows (see budgetMonthOf). */\nexport const budgetMonthRange = (beat: Beat, recordedActiveAt?: ActiveAt) => {\n const month = budgetMonthOf(beat, recordedActiveAt)\n\n return { start: startOfMonth(month), end: endOfMonth(month) }\n}\n\nconst inCategory = (categoryGuid: string) => (transaction: Transaction) =>\n transaction.category_guid === categoryGuid || transaction.top_level_category_guid === categoryGuid\n\nconst atMerchant = (merchantGuid: string) => (transaction: Transaction) =>\n transaction.merchant_guid === merchantGuid\n\n/** The budget month and category (own or top-level) or merchant; none without either, so no rows. */\nexport const budgetTransactionFilter = (\n facts: BudgetFacts,\n dateRange: { start: Date; end: Date },\n): TransactionFilter | undefined => {\n const custom = facts.categoryGuid\n ? inCategory(facts.categoryGuid)\n : facts.merchantGuid\n ? atMerchant(facts.merchantGuid)\n : undefined\n\n return custom && { custom, dateRange }\n}\n\nexport interface BudgetDetailsLayout {\n /** The \"N days until the end of the month\" / previous-month notice under the summary. */\n showPeriodLine: boolean\n}\n\n// Figma's Budget Details for these three insights has no period line; any other caller keeps it.\nconst LAYOUT: Record<string, BudgetDetailsLayout> = {\n default: { showPeriodLine: true },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_SPEND]: { showPeriodLine: false },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_BUDGET]: { showPeriodLine: false },\n [BUDGET_DETAILS_VARIANTS.MERCHANT_BUDGET]: { showPeriodLine: false },\n}\n\nexport const resolveBudgetDetailsLayout = (variant: string | null | undefined) =>\n resolveVariantConfig(LAYOUT, variant, 'default', 'BudgetDetailsBlock')\n\n/** A budget amount the dialogs accept: a finite number above zero. */\nexport const isPositiveAmount = (value: string): boolean => {\n const amount = Number(value)\n return value.trim() !== '' && Number.isFinite(amount) && amount > 0\n}\n"],"mappings":";;;;;;AAYA,IA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,CAAA,EAAwB,eAAA,GAAkB,EAAE,gBAAgB,GAAM;AACrE,GAEa,IAAA,CAA8B,MACzC,EAAqB,GAAQ,GAAS,WAAW,oBAAoB,GAG1D,IAAA,CAAoB,MAA2B;AAC1D,QAAM,IAAS,OAAO,CAAK;AAC3B,SAAO,EAAM,KAAK,MAAM,MAAM,OAAO,SAAS,CAAM,KAAK,IAAS;AACpE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { asNumber as r } from "../../blocks/slotReaders.es.js";
|
|
1
2
|
var l = {
|
|
2
3
|
band: "needs_work",
|
|
3
4
|
range: ">30%",
|
|
@@ -23,44 +24,44 @@ var l = {
|
|
|
23
24
|
color: (t) => t.palette.warning.light
|
|
24
25
|
},
|
|
25
26
|
l
|
|
26
|
-
], c = (t) => Math.min(100, Math.max(0, Math.round(t))),
|
|
27
|
-
const
|
|
28
|
-
if (!(
|
|
27
|
+
], c = (t) => Math.min(100, Math.max(0, Math.round(t))), p = (t) => g.find(({ maxPercent: e }) => c(t) <= e) ?? l, b = (t) => {
|
|
28
|
+
const e = r(t?.accounts_balance_sum), n = r(t?.accounts_credit_limit_sum), a = r(t?.credit_utilization_percentage);
|
|
29
|
+
if (!(e === void 0 || n === void 0 || a === void 0))
|
|
29
30
|
return {
|
|
30
|
-
balance:
|
|
31
|
+
balance: e,
|
|
31
32
|
limit: n,
|
|
32
|
-
percentage: c(
|
|
33
|
+
percentage: c(a)
|
|
33
34
|
};
|
|
34
|
-
},
|
|
35
|
+
}, f = (t) => {
|
|
35
36
|
if (!t || Array.isArray(t) || !t.names || !Array.isArray(t.data)) return [];
|
|
36
|
-
const { names:
|
|
37
|
+
const { names: e } = t;
|
|
37
38
|
return t.data.flatMap((n) => {
|
|
38
|
-
const
|
|
39
|
-
if (typeof
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
amount:
|
|
43
|
-
guid:
|
|
44
|
-
label:
|
|
39
|
+
const a = Object.fromEntries(e.map((m, d) => [m, n[d]]));
|
|
40
|
+
if (typeof a.guid != "string" || typeof a.label != "string") return [];
|
|
41
|
+
const i = r(a.amount) ?? 0, o = r(a.total_amount);
|
|
42
|
+
if (o === void 0 || o <= 0) return [{
|
|
43
|
+
amount: i,
|
|
44
|
+
guid: a.guid,
|
|
45
|
+
label: a.label,
|
|
45
46
|
limit: null,
|
|
46
47
|
percentage: null
|
|
47
48
|
}];
|
|
48
|
-
const u = r(
|
|
49
|
+
const u = r(a.percentage) ?? i / o * 100;
|
|
49
50
|
return [{
|
|
50
|
-
amount:
|
|
51
|
-
guid:
|
|
52
|
-
label:
|
|
53
|
-
limit:
|
|
51
|
+
amount: i,
|
|
52
|
+
guid: a.guid,
|
|
53
|
+
label: a.label,
|
|
54
|
+
limit: o,
|
|
54
55
|
percentage: c(u)
|
|
55
56
|
}];
|
|
56
57
|
});
|
|
57
58
|
};
|
|
58
59
|
export {
|
|
59
60
|
g as UTILIZATION_BANDS,
|
|
60
|
-
|
|
61
|
+
p as getUtilizationBand,
|
|
61
62
|
c as normalizePercent,
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
f as readCardRows,
|
|
64
|
+
b as readSummary
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport type { DataSeries } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\n\nexport type UtilizationBand = 'excellent' | 'good' | 'fair' | 'needs_work'\n\nexport interface UtilizationBandSpec {\n band: UtilizationBand\n range: string\n /** Highest whole percentage in the band. */\n maxPercent: number\n color: (theme: Theme) => string\n}\n\nconst NEEDS_WORK: UtilizationBandSpec = {\n band: 'needs_work',\n range: '>30%',\n maxPercent: Infinity,\n color: (theme) => theme.palette.error.light,\n}\n\n/** Ordered from best to worst, as the legend shows them. */\nexport const UTILIZATION_BANDS: UtilizationBandSpec[] = [\n {\n band: 'excellent',\n range: '0-10%',\n maxPercent: 10,\n color: (theme) => theme.palette.success.main,\n },\n { band: 'good', range: '11-20%', maxPercent: 20, color: (theme) => theme.palette.success.light },\n { band: 'fair', range: '21-30%', maxPercent: 30, color: (theme) => theme.palette.warning.light },\n NEEDS_WORK,\n]\n\n/** Whole percent within 0-100, the only form the drawer shows, bands or announces. */\nexport const normalizePercent = (percent: number): number =>\n Math.min(100, Math.max(0, Math.round(percent)))\n\nexport const getUtilizationBand = (percent: number): UtilizationBandSpec =>\n UTILIZATION_BANDS.find(({ maxPercent }) => normalizePercent(percent) <= maxPercent) ?? NEEDS_WORK\n\nexport interface CreditUtilizationSummary {\n balance: number\n limit: number\n percentage: number\n}\n\nexport interface CreditCardRow {\n guid: string\n label: string\n amount: number\n /** `null` when the institution did not share the card's limit. */\n limit: number | null\n percentage: number | null\n}\n\
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport type { DataSeries } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport { asNumber } from '../../blocks/slotReaders'\n\nexport type UtilizationBand = 'excellent' | 'good' | 'fair' | 'needs_work'\n\nexport interface UtilizationBandSpec {\n band: UtilizationBand\n range: string\n /** Highest whole percentage in the band. */\n maxPercent: number\n color: (theme: Theme) => string\n}\n\nconst NEEDS_WORK: UtilizationBandSpec = {\n band: 'needs_work',\n range: '>30%',\n maxPercent: Infinity,\n color: (theme) => theme.palette.error.light,\n}\n\n/** Ordered from best to worst, as the legend shows them. */\nexport const UTILIZATION_BANDS: UtilizationBandSpec[] = [\n {\n band: 'excellent',\n range: '0-10%',\n maxPercent: 10,\n color: (theme) => theme.palette.success.main,\n },\n { band: 'good', range: '11-20%', maxPercent: 20, color: (theme) => theme.palette.success.light },\n { band: 'fair', range: '21-30%', maxPercent: 30, color: (theme) => theme.palette.warning.light },\n NEEDS_WORK,\n]\n\n/** Whole percent within 0-100, the only form the drawer shows, bands or announces. */\nexport const normalizePercent = (percent: number): number =>\n Math.min(100, Math.max(0, Math.round(percent)))\n\nexport const getUtilizationBand = (percent: number): UtilizationBandSpec =>\n UTILIZATION_BANDS.find(({ maxPercent }) => normalizePercent(percent) <= maxPercent) ?? NEEDS_WORK\n\nexport interface CreditUtilizationSummary {\n balance: number\n limit: number\n percentage: number\n}\n\nexport interface CreditCardRow {\n guid: string\n label: string\n amount: number\n /** `null` when the institution did not share the card's limit. */\n limit: number | null\n percentage: number | null\n}\n\nexport const readSummary = (\n data?: InsightsInstanceSlotData,\n): CreditUtilizationSummary | undefined => {\n const balance = asNumber(data?.accounts_balance_sum)\n const limit = asNumber(data?.accounts_credit_limit_sum)\n const percentage = asNumber(data?.credit_utilization_percentage)\n\n if (balance === undefined || limit === undefined || percentage === undefined) return undefined\n\n return { balance, limit, percentage: normalizePercent(percentage) }\n}\n\n/** One object per `data` row, keyed by `names` (pulse's `buildDataSeries`). */\nexport const readCardRows = (series?: DataSeries | unknown[]): CreditCardRow[] => {\n if (!series || Array.isArray(series) || !series.names || !Array.isArray(series.data)) return []\n\n const { names } = series\n\n return series.data.flatMap((values: unknown[]): CreditCardRow[] => {\n const row = Object.fromEntries(names.map((name, index) => [name, values[index]]))\n\n if (typeof row.guid !== 'string' || typeof row.label !== 'string') return []\n\n const amount = asNumber(row.amount) ?? 0\n const limit = asNumber(row.total_amount)\n\n if (limit === undefined || limit <= 0) {\n return [{ amount, guid: row.guid, label: row.label, limit: null, percentage: null }]\n }\n\n const percentage = asNumber(row.percentage) ?? (amount / limit) * 100\n\n return [\n { amount, guid: row.guid, label: row.label, limit, percentage: normalizePercent(percentage) },\n ]\n })\n}\n"],"mappings":";AAgBA,IAAM,IAAkC;AAAA,EACtC,MAAM;AAAA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Y,EAAM,IAAA,CAAK,GAAM,MAAU,CAAC,GAAM,EAAO,CAAA,CAAM,CAAC,CAAC;AAEhF,QAAI,OAAO,EAAI,QAAS,YAAY,OAAO,EAAI,SAAU,SAAU,QAAO,CAAC;AAE3E,UAAM,IAAS,EAAS,EAAI,MAAM,KAAK,GACjC,IAAQ,EAAS,EAAI,YAAY;AAEvC,QAAI,MAAU,UAAa,KAAS,EAClC,QAAO,CAAC;AAAA,MAAE,QAAA;AAAA,MAAQ,MAAM,EAAI;AAAA,MAAM,OAAO,EAAI;AAAA,MAAO,OAAO;AAAA,MAAM,YAAY;AAAA,IAAK,CAAC;AAGrF,UAAM,IAAa,EAAS,EAAI,UAAU,KAAM,IAAS,IAAS;AAElE,WAAO,CACL;AAAA,MAAE,QAAA;AAAA,MAAQ,MAAM,EAAI;AAAA,MAAM,OAAO,EAAI;AAAA,MAAO,OAAA;AAAA,MAAO,YAAY,EAAiB,CAAU;AAAA,IAAE,CAC9F;AAAA,EACF,CAAC;AACH"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { useGlobalCopyStore as
|
|
3
|
-
import { formatCurrency as
|
|
1
|
+
import { buildDynamicCopy as f } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useGlobalCopyStore as x } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { formatCurrency as s } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { asNumber as v } from "../../blocks/slotReaders.es.js";
|
|
4
5
|
import { variants as _ } from "../../blocks/ChartBlocks/StepChartBlock/index.es.js";
|
|
5
|
-
import { stepForBalance as
|
|
6
|
-
import { SavingsCalculator as
|
|
6
|
+
import { stepForBalance as h } from "./layout.es.js";
|
|
7
|
+
import { SavingsCalculator as y } from "./SavingsCalculator.es.js";
|
|
7
8
|
import { observer as C } from "mobx-react-lite";
|
|
8
9
|
import e from "@mui/material/Stack";
|
|
9
|
-
import { Text as
|
|
10
|
+
import { Text as c } from "@mxenabled/mxui";
|
|
10
11
|
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
11
|
-
var
|
|
12
|
+
var p = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
12
13
|
"aria-label": i,
|
|
13
14
|
role: "group",
|
|
14
15
|
sx: {
|
|
@@ -19,23 +20,23 @@ var m = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
|
19
20
|
gap: 4,
|
|
20
21
|
p: 12
|
|
21
22
|
},
|
|
22
|
-
children: [/* @__PURE__ */ o(
|
|
23
|
+
children: [/* @__PURE__ */ o(c, {
|
|
23
24
|
color: "text.secondary",
|
|
24
25
|
variant: "caption",
|
|
25
26
|
children: i
|
|
26
|
-
}), /* @__PURE__ */ o(
|
|
27
|
+
}), /* @__PURE__ */ o(c, {
|
|
27
28
|
bold: !0,
|
|
28
29
|
component: "p",
|
|
29
30
|
variant: "h3",
|
|
30
31
|
children: a
|
|
31
32
|
})]
|
|
32
|
-
}),
|
|
33
|
-
const { common:
|
|
33
|
+
}), G = C(function({ beat: a }) {
|
|
34
|
+
const { common: m, insights_feed: d } = x(), r = d?.emergency_savings;
|
|
34
35
|
if (!r) return /* @__PURE__ */ o(e, {
|
|
35
36
|
sx: { p: 24 },
|
|
36
|
-
children: /* @__PURE__ */ o(
|
|
37
|
+
children: /* @__PURE__ */ o(c, { children: m?.error_message })
|
|
37
38
|
});
|
|
38
|
-
const t = a.insights_payload?.drilldown_data?.savings_account_balance
|
|
39
|
+
const t = v(a.insights_payload?.drilldown_data?.savings_account_balance) ?? 0, { goal: l, index: g, labelKey: u } = h(t), { WithText: b } = _;
|
|
39
40
|
return /* @__PURE__ */ n(e, {
|
|
40
41
|
sx: {
|
|
41
42
|
bgcolor: "background.default",
|
|
@@ -49,32 +50,32 @@ var m = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
|
49
50
|
gap: 16,
|
|
50
51
|
p: 16
|
|
51
52
|
},
|
|
52
|
-
children: [/* @__PURE__ */ o(
|
|
53
|
-
completed_steps:
|
|
54
|
-
label_1: r[
|
|
55
|
-
label_2:
|
|
53
|
+
children: [/* @__PURE__ */ o(b, { slotData: {
|
|
54
|
+
completed_steps: g,
|
|
55
|
+
label_1: r[u].toUpperCase(),
|
|
56
|
+
label_2: f(r.amount_in_savings, s(l, "0"))
|
|
56
57
|
} }), /* @__PURE__ */ n(e, {
|
|
57
58
|
sx: {
|
|
58
59
|
flexDirection: "row",
|
|
59
60
|
gap: 12
|
|
60
61
|
},
|
|
61
|
-
children: [/* @__PURE__ */ o(
|
|
62
|
+
children: [/* @__PURE__ */ o(p, {
|
|
62
63
|
label: r.total_savings_balance,
|
|
63
|
-
value:
|
|
64
|
-
}), /* @__PURE__ */ o(
|
|
64
|
+
value: s(t, "0,0.00")
|
|
65
|
+
}), /* @__PURE__ */ o(p, {
|
|
65
66
|
label: r.savings_goal,
|
|
66
|
-
value:
|
|
67
|
+
value: s(l, "0,0")
|
|
67
68
|
})]
|
|
68
69
|
})]
|
|
69
|
-
}), /* @__PURE__ */ o(
|
|
70
|
-
balance:
|
|
70
|
+
}), /* @__PURE__ */ o(y, {
|
|
71
|
+
balance: t,
|
|
71
72
|
copy: r,
|
|
72
|
-
goal:
|
|
73
|
+
goal: l
|
|
73
74
|
}, a.guid)]
|
|
74
75
|
});
|
|
75
76
|
});
|
|
76
77
|
export {
|
|
77
|
-
|
|
78
|
+
G as EmergencySavingsBlock
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
//# sourceMappingURL=EmergencySavingsBlock.es.js.map
|