@mx-cartographer/experiences 9.7.126 → 9.7.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +101 -105
  3. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  4. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +44 -43
  5. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  6. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +66 -65
  7. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  8. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +24 -30
  9. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
  10. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +84 -101
  11. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  12. package/dist/insights-v2/components/CategoryTile.d.ts +14 -0
  13. package/dist/insights-v2/components/CategoryTile.es.js +28 -0
  14. package/dist/insights-v2/components/CategoryTile.es.js.map +1 -0
  15. package/dist/insights-v2/components/ComponentBlocks/DepositLogo.d.ts +5 -16
  16. package/dist/insights-v2/components/ComponentBlocks/DepositLogo.es.js +14 -17
  17. package/dist/insights-v2/components/ComponentBlocks/DepositLogo.es.js.map +1 -1
  18. package/dist/insights-v2/components/LogoFromGuid.d.ts +3 -13
  19. package/dist/insights-v2/components/LogoFromGuid.es.js +21 -46
  20. package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
  21. package/dist/insights-v2/components/LogoMark.d.ts +19 -0
  22. package/dist/insights-v2/components/LogoMark.es.js +33 -0
  23. package/dist/insights-v2/components/LogoMark.es.js.map +1 -0
  24. package/dist/insights-v2/components/SubHeader.es.js +13 -27
  25. package/dist/insights-v2/components/SubHeader.es.js.map +1 -1
  26. package/dist/insights-v2/components/shared/EntityLogo.d.ts +2 -2
  27. package/dist/insights-v2/components/shared/EntityLogo.es.js.map +1 -1
  28. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { CategoryIcon, InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useActionContext,\n useAppConfig,\n useCashflowStore,\n useCategoryStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport {\n type RecurringTransactionActionContext,\n useRecurringTransactionLoad,\n} from '../RecurringTransactionBlock'\n\nimport { getCaption, getOtherLabel, groupRows } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\nimport type { RemainingCashRow } from './RemainingCashContent'\n\n/** Top rows by amount, then one \"Other (#)\" row with the rest's count and total. */\nconst toSectionRows = (\n rows: RemainingCashRow[],\n otherLabel: { one: string; multi: string },\n otherLeading: ReactNode,\n): RemainingCashRow[] => {\n const { others, shown } = groupRows(rows)\n\n if (!others) return shown\n\n return [\n ...shown,\n {\n amount: others.total,\n key: 'other',\n leading: otherLeading,\n name: getOtherLabel(otherLabel.one, otherLabel.multi, others.count),\n },\n ]\n}\n\n/**\n * Remaining Cash drawer (WEC-1880) for the Payday Cash Left Over Status beat. Store-driven: the\n * figures are today's, from CashflowStore's UiStore, not the card's generation-time numbers\n * (accepted trade-off, see docs/action-blocks/remaining-cash-block.md).\n *\n * `observer` is required: everything rendered is read from MobX stores and computeds.\n */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const { accountsLoaded } = useAccountStore()\n const { transactionsLoaded, transactionsLoading } = useTransactionStore()\n const { isDataLoaded } = useRecurringTransactionsStore()\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const retryLoad = useRecurringTransactionLoad()\n\n // TransactionStore swallows a failed request, which would silently zero every expense (see the\n // States table in docs/action-blocks/remaining-cash-block.md). `transactionsLoading` excludes another\n // widget's request still in flight: loadTransactions returns early without awaiting it.\n const transactionsFailed = isDataLoaded && !transactionsLoaded && !transactionsLoading\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loaded but without this namespace (the copy service has not shipped it). Copy loads once at\n // app start, so a retry cannot clear it: a plain message like ActionBlockLayer's unknown-block\n // state, not ErrorCard's Try Again, and never an endless loader.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if ((loadFailed && !isDataLoaded) || transactionsFailed) {\n return <ErrorCard onRetry={() => void retryLoad()} />\n }\n\n // `accountsLoaded` / `transactionsLoaded` cover another widget's request still in flight.\n if (!isDataLoaded || !accountsLoaded || !transactionsLoaded || !copy) return <Loader />\n\n const accountRows = toSectionRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = toSectionRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: (\n <CategoryIcon categoryGuid={getTopLevelCategoryGuid(expense.categoryGuid)} size={32} />\n ),\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryIcon categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;AAkCA,IAAM,IAAA,CACJ,GACA,GACA,MACuB;AACvB,QAAM,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAU,CAAI;AAExC,SAAK,IAEE,CACL,GAAG,GACH;AAAA,IACE,QAAQ,EAAO;AAAA,IACf,KAAK;AAAA,IACL,SAAS;AAAA,IACT,MAAM,EAAc,EAAW,KAAK,EAAW,OAAO,EAAO,KAAK;AAAA,EACpE,CACF,IAVoB;AAWtB,GASa,KAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,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,IAAG,SAAS;AAAA,IAA8B,MAAM;AAAA,EAAK,CAAA,CAC/F,GACM,IAAc,EAClB,EAAQ,sBAAsB,IAAA,CAAK,OAAa;AAAA,IAC9C,QAAQ,EAAQ;AAAA,IAChB,KAAK,GAAG,EAAQ,wBAAA,IAA4B,EAAQ,aAAa,QAAQ,CAAA;AAAA,IACzE,SACE,gBAAA,EAAC,GAAD;AAAA,MAAc,cAAc,EAAwB,EAAQ,YAAY;AAAA,MAAG,MAAM;AAAA,IAAK,CAAA;AAAA,IAExF,MAAM,EAAQ;AAAA,EAChB,EAAE,GACF;AAAA,IAAE,OAAO,EAAK;AAAA,IAAgB,KAAK,EAAK;AAAA,EAAmB,GAC3D,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAc;AAAA,IAAe,MAAM;AAAA,EAAK,CAAA,CACtE;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useActionContext,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport {\n type RecurringTransactionActionContext,\n useRecurringTransactionLoad,\n} from '../RecurringTransactionBlock'\n\nimport { getCaption, getOtherLabel, groupRows } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\nimport type { RemainingCashRow } from './RemainingCashContent'\n\n/** Top rows by amount, then one \"Other (#)\" row with the rest's count and total. */\nconst toSectionRows = (\n rows: RemainingCashRow[],\n otherLabel: { one: string; multi: string },\n otherLeading: ReactNode,\n): RemainingCashRow[] => {\n const { others, shown } = groupRows(rows)\n\n if (!others) return shown\n\n return [\n ...shown,\n {\n amount: others.total,\n key: 'other',\n leading: otherLeading,\n name: getOtherLabel(otherLabel.one, otherLabel.multi, others.count),\n },\n ]\n}\n\n/**\n * Remaining Cash drawer (WEC-1880) for the Payday Cash Left Over Status beat. Store-driven: the\n * figures are today's, from CashflowStore's UiStore, not the card's generation-time numbers\n * (accepted trade-off, see docs/action-blocks/remaining-cash-block.md).\n *\n * `observer` is required: everything rendered is read from MobX stores and computeds.\n */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { transactionsLoaded, transactionsLoading } = useTransactionStore()\n const { isDataLoaded } = useRecurringTransactionsStore()\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const retryLoad = useRecurringTransactionLoad()\n\n // TransactionStore swallows a failed request, which would silently zero every expense (see the\n // States table in docs/action-blocks/remaining-cash-block.md). `transactionsLoading` excludes another\n // widget's request still in flight: loadTransactions returns early without awaiting it.\n const transactionsFailed = isDataLoaded && !transactionsLoaded && !transactionsLoading\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loaded but without this namespace (the copy service has not shipped it). Copy loads once at\n // app start, so a retry cannot clear it: a plain message like ActionBlockLayer's unknown-block\n // state, not ErrorCard's Try Again, and never an endless loader.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if ((loadFailed && !isDataLoaded) || transactionsFailed) {\n return <ErrorCard onRetry={() => void retryLoad()} />\n }\n\n // `accountsLoaded` / `transactionsLoaded` cover another widget's request still in flight.\n if (!isDataLoaded || !accountsLoaded || !transactionsLoaded || !copy) return <Loader />\n\n const accountRows = toSectionRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = toSectionRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,IAAM,IAAA,CACJ,GACA,GACA,MACuB;AACvB,QAAM,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAU,CAAI;AAExC,SAAK,IAEE,CACL,GAAG,GACH;AAAA,IACE,QAAQ,EAAO;AAAA,IACf,KAAK;AAAA,IACL,SAAS;AAAA,IACT,MAAM,EAAc,EAAW,KAAK,EAAW,OAAO,EAAO,KAAK;AAAA,EACpE,CACF,IAVoB;AAWtB,GASa,KAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB,GACrC,EAAE,oBAAA,GAAoB,qBAAA,EAAA,IAAwB,EAAoB,GAClE,EAAE,cAAA,EAAA,IAAiB,EAA8B,GACjD,IACJ,EAAoD,GAAG,wBAAwB,IAC3E,IAAY,EAA4B,GAKxC,IAAqB,KAAgB,CAAC,KAAsB,CAAC,GAC7D,IAAO,GAAkB;AAK/B,MAAI,GAAkB,WAAW,CAAC,EAChC,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,cAAoB,CAAA;AAAA,EAClC,CAAA;AAIX,MAAK,KAAc,CA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A,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
@@ -5,8 +5,8 @@ import { fromUnixUTC as A } from "../../../core/utils/DateUtil.es.js";
5
5
  import { getCategoryColor as P } from "../../../core/utils/CategoryUtil.es.js";
6
6
  import { buildDataSeries as M } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
7
7
  import { getLayoutConfig as I } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
8
- import { buildProjectedBillTransaction as w, calendarDateOf as H, finiteNumberOf as m, guidListOf as N, nonEmptyStringOf as b } from "./utils.es.js";
9
- import { MerchantLogo as Y } from "@mxenabled/mxui";
8
+ import w from "../../components/LogoMark.es.js";
9
+ import { buildProjectedBillTransaction as H, calendarDateOf as Y, finiteNumberOf as m, guidListOf as N, nonEmptyStringOf as b } from "./utils.es.js";
10
10
  import { Icon as F } from "@mxenabled/mx-icons";
11
11
  import { jsx as c } from "react/jsx-runtime";
12
12
  import { endOfMonth as C, fromUnixTime as x, isValid as L, parseISO as p, startOfMonth as B } from "date-fns";
@@ -28,24 +28,24 @@ var i = {
28
28
  start: B(T(t)),
29
29
  end: C(T(t))
30
30
  }), G = (t) => t?.length ? { accounts: t } : {}, V = ({ beat: t }) => {
31
- const { account_guid: e, from_date: a, to_date: r } = t.insights_payload?.drilldown_data ?? {};
32
- return typeof e != "string" || typeof a != "number" || typeof r != "number" || !Number.isFinite(a) || !Number.isFinite(r) || r <= a ? {
31
+ const { account_guid: e, from_date: a, to_date: o } = t.insights_payload?.drilldown_data ?? {};
32
+ return typeof e != "string" || typeof a != "number" || typeof o != "number" || !Number.isFinite(a) || !Number.isFinite(o) || o <= a ? {
33
33
  accounts: [],
34
34
  custom: () => !1
35
35
  } : {
36
36
  accounts: [e],
37
- custom: (o) => !o.is_hidden && o.feed_status !== U.PENDING,
37
+ custom: (r) => !r.is_hidden && r.feed_status !== U.PENDING,
38
38
  showSplits: !0,
39
39
  dateRange: {
40
40
  start: A(a),
41
- end: A(r - 1)
41
+ end: A(o - 1)
42
42
  }
43
43
  };
44
44
  }, W = (t) => {
45
45
  const e = t?.drilldown_data ?? {};
46
46
  return {
47
47
  transaction_guids: N(e.transaction_guids),
48
- date: H(e.due_date),
48
+ date: Y(e.due_date),
49
49
  amount: m(e.amount),
50
50
  category_guid: b(e.category_guid),
51
51
  average_amount: m(e.average_amount),
@@ -54,15 +54,15 @@ var i = {
54
54
  }, _ = (t) => {
55
55
  const e = t;
56
56
  return Array.isArray(e?.names) && Array.isArray(e?.data) ? e : void 0;
57
- }, j = (t) => {
57
+ }, k = (t) => {
58
58
  const e = t?.drilldown_data ?? {};
59
59
  return {
60
60
  account_guids: N(e.account_guids),
61
61
  data_series: _(e.data_series),
62
62
  average_amount: m(e.average_amount)
63
63
  };
64
- }, R = ["income", "other"], k = (t) => {
65
- const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data?.legends?.map(({ label: r }) => r);
64
+ }, R = ["income", "other"], j = (t) => {
65
+ const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data?.legends?.map(({ label: o }) => o);
66
66
  return {
67
67
  data_series: _(e.data_series),
68
68
  average_amount: m(e.average_amount),
@@ -70,57 +70,57 @@ var i = {
70
70
  sub_tab_labels: a?.length === R.length ? a : void 0
71
71
  };
72
72
  }, z = 2, K = (t, e) => {
73
- const a = e ?? {}, r = _(a.series), o = Array.isArray(a.labels) ? a.labels.map(b) : [];
74
- return !r || o.length !== z || !o.every((s) => !!s) ? {} : {
75
- data_series: r,
76
- legends: o.map((s) => ({
73
+ const a = e ?? {}, o = _(a.series), r = Array.isArray(a.labels) ? a.labels.map(b) : [];
74
+ return !o || r.length !== z || !r.every((s) => !!s) ? {} : {
75
+ data_series: o,
76
+ legends: r.map((s) => ({
77
77
  label: s,
78
78
  value: 0
79
79
  }))
80
80
  };
81
- }, $ = (t, e) => M(_(e?.series)).flatMap((a) => a.aggregated_guids ?? []), q = (t, e) => {
82
- const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, r = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
83
- if (!(!a || !r))
81
+ }, q = (t, e) => M(_(e?.series)).flatMap((a) => a.aggregated_guids ?? []), J = (t, e) => {
82
+ const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, o = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
83
+ if (!(!a || !o))
84
84
  return {
85
- message: h(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: r })),
85
+ message: h(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: o })),
86
86
  onDismiss: () => t(!0)
87
87
  };
88
- }, J = (t) => M(_(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), Q = (t, e) => {
89
- const a = w(t, e);
88
+ }, Q = (t) => M(_(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), X = (t, e) => {
89
+ const a = H(t, e);
90
90
  return a ? [...t, a] : t;
91
- }, X = (t, e, a, r) => {
92
- const o = r?.merchant_name, s = r?.date;
93
- if (!o || !s) return;
91
+ }, Z = (t, e, a, o) => {
92
+ const r = o?.merchant_name, s = o?.date;
93
+ if (!r || !s) return;
94
94
  const n = e.transaction_history_block?.upcoming_bill_tip_message;
95
95
  if (n)
96
96
  return {
97
- message: h(n, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), o, E(p(s), D.FULL_MONTH_DAY)),
97
+ message: h(n, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), r, E(p(s), D.FULL_MONTH_DAY)),
98
98
  onDismiss: () => t(!0)
99
99
  };
100
100
  }, v = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
101
- const r = e[a], o = r?.guid, s = t.find((n) => n.guid === o)?.has_been_split;
101
+ const o = e[a], r = o?.guid, s = t.find((n) => n.guid === r)?.has_been_split;
102
102
  return {
103
- custom: (n) => n.guid === o,
104
- dateRange: S(r?.date),
103
+ custom: (n) => n.guid === r,
104
+ dateRange: S(o?.date),
105
105
  showSplits: !s
106
106
  };
107
- }, Z = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
108
- const r = t[e], o = a.category_guid ?? r?.guid;
107
+ }, $ = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
108
+ const o = t[e], r = a.category_guid ?? o?.guid;
109
109
  return {
110
- custom: (s) => s.category_guid === o || s.top_level_category_guid === o,
111
- dateRange: S(r?.date)
110
+ custom: (s) => s.category_guid === r || s.top_level_category_guid === r,
111
+ dateRange: S(o?.date)
112
112
  };
113
- }, tt = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: r }) => {
114
- const o = t[e];
113
+ }, tt = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: o }) => {
114
+ const r = t[e];
115
115
  return {
116
116
  custom: (s) => !!s.top_level_category_guid && a.includes(s.top_level_category_guid),
117
- dateRange: S(o?.date),
118
- ...G(r.account_guids)
117
+ dateRange: S(r?.date),
118
+ ...G(o.account_guids)
119
119
  };
120
- }, et = (t) => typeof t == "number" ? x(t) : p(t ?? ""), at = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
121
- const s = e[a], { start: n, end: g } = S(s?.date), l = et(t.created_at), u = o.account_guids, O = {
120
+ }, et = (t) => typeof t == "number" ? x(t) : p(t ?? ""), at = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: o, instanceSlotData: r }) => {
121
+ const s = e[a], { start: n, end: g } = S(s?.date), l = et(t.created_at), u = r.account_guids, O = {
122
122
  start: n,
123
- end: r && L(l) && l < g ? l : g
123
+ end: o && L(l) && l < g ? l : g
124
124
  };
125
125
  return u?.length ? {
126
126
  dateRange: O,
@@ -131,23 +131,23 @@ var i = {
131
131
  custom: () => !1
132
132
  };
133
133
  }, f = (t, e, a) => {
134
- const r = new Set(t), o = p(e ?? "");
135
- return !r.size || !L(o) ? {
134
+ const o = new Set(t), r = p(e ?? "");
135
+ return !o.size || !L(r) ? {
136
136
  accounts: [],
137
137
  custom: () => !1
138
138
  } : {
139
- custom: (s) => r.has(s.guid),
139
+ custom: (s) => o.has(s.guid),
140
140
  dateRange: {
141
- start: B(o),
142
- end: C(o)
141
+ start: B(r),
142
+ end: C(r)
143
143
  },
144
144
  ...G(a)
145
145
  };
146
- }, rt = ({ beat: t, dataSeries: e, selectedIndex: a }) => f(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), y = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
147
- const o = e[a];
148
- return f(r === 1 ? o?.comparisonGuids : o?.mainGuids, o?.date, t.account_guids);
149
- }, ot = ({ beat: t, dataSeries: e, subIndex: a }) => f(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), st = (t) => {
150
- const { dataSeries: e, selectedIndex: a, subIndex: r, instanceSlotData: o } = t, s = e[a], n = new Set(o.income_transaction_guids), g = R[r] === "income", l = o.sub_tab_labels ? s?.aggregated_guids?.filter((u) => n.has(u) === g) : s?.aggregated_guids;
146
+ }, ot = ({ beat: t, dataSeries: e, selectedIndex: a }) => f(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), y = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: o }) => {
147
+ const r = e[a];
148
+ return f(o === 1 ? r?.comparisonGuids : r?.mainGuids, r?.date, t.account_guids);
149
+ }, rt = ({ beat: t, dataSeries: e, subIndex: a }) => f(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), st = (t) => {
150
+ const { dataSeries: e, selectedIndex: a, subIndex: o, instanceSlotData: r } = t, s = e[a], n = new Set(r.income_transaction_guids), g = R[o] === "income", l = r.sub_tab_labels ? s?.aggregated_guids?.filter((u) => n.has(u) === g) : s?.aggregated_guids;
151
151
  return f(l, s?.date);
152
152
  }, yt = {
153
153
  [i.TRANSACTION]: {
@@ -161,10 +161,11 @@ var i = {
161
161
  return {
162
162
  heading: e,
163
163
  subHeadingText: a?.text || void 0,
164
- icon: /* @__PURE__ */ c(Y, {
165
- alt: a?.text,
166
- categoryGuid: a?.logo?.category_guid || "",
167
- merchantGuid: a?.logo?.merchant_guid || "",
164
+ icon: /* @__PURE__ */ c(w, {
165
+ logo: {
166
+ ...a?.logo,
167
+ merchant_name: a?.text ?? a?.logo?.merchant_name
168
+ },
168
169
  size: 16
169
170
  })
170
171
  };
@@ -177,7 +178,7 @@ var i = {
177
178
  [i.CATEGORY_SPEND]: {
178
179
  top: "singleBar",
179
180
  averageFormat: "0,0",
180
- filterStrategy: Z,
181
+ filterStrategy: $,
181
182
  scope: "store",
182
183
  filterMode: "store",
183
184
  colors: (t, e) => [d(t, e)],
@@ -201,7 +202,7 @@ var i = {
201
202
  [i.ACCOUNT_BALANCE]: {
202
203
  top: "singleBar",
203
204
  filterStrategy: at,
204
- slotData: j,
205
+ slotData: k,
205
206
  scope: "store",
206
207
  filterMode: "store",
207
208
  colors: (t) => [t.palette.success.main]
@@ -213,9 +214,9 @@ var i = {
213
214
  filterMode: "local",
214
215
  colors: (t, e) => [d(t, e)],
215
216
  slotData: W,
216
- beatTransactions: Q,
217
+ beatTransactions: X,
217
218
  fetchMissingTransactions: (t) => t.insights_payload?.drilldown_data?.transaction_guids,
218
- tipSection: X
219
+ tipSection: Z
219
220
  },
220
221
  [i.DEPOSIT_SUMMARY]: {
221
222
  top: "singleBar",
@@ -223,8 +224,8 @@ var i = {
223
224
  scope: "store",
224
225
  filterMode: "store",
225
226
  colors: (t) => [t.palette.success.main],
226
- slotData: k,
227
- fetchMissingTransactions: J,
227
+ slotData: j,
228
+ fetchMissingTransactions: Q,
228
229
  subTabs: ({ instanceSlotData: t }) => t.sub_tab_labels ?? []
229
230
  },
230
231
  [i.LOW_BALANCE]: {
@@ -237,7 +238,7 @@ var i = {
237
238
  },
238
239
  [i.SUBSCRIPTION_AGGREGATE]: {
239
240
  top: "monthTabs",
240
- filterStrategy: rt,
241
+ filterStrategy: ot,
241
242
  scope: "store",
242
243
  filterMode: "store",
243
244
  colors: (t) => [t.palette.primary.main]
@@ -266,14 +267,14 @@ var i = {
266
267
  colors: (t) => I(t, "debt_to_income")?.color ?? [],
267
268
  subTabAriaLabels: (t) => [void 0, t.general.income_transactions],
268
269
  slotData: K,
269
- fetchMissingTransactions: $,
270
- tipSection: q,
270
+ fetchMissingTransactions: q,
271
+ tipSection: J,
271
272
  tipAboveSubTabs: !0,
272
273
  hideListHeader: !0
273
274
  },
274
275
  [i.NON_ESSENTIAL_CATEGORY]: {
275
276
  top: "tabsOnly",
276
- filterStrategy: ot,
277
+ filterStrategy: rt,
277
278
  scope: "store",
278
279
  filterMode: "store",
279
280
  colors: (t) => [t.palette.primary.main]
@@ -290,10 +291,10 @@ export {
290
291
  bt as FALLBACK,
291
292
  yt as layout,
292
293
  K as resolveDebtToIncomeSlotData,
293
- k as resolveDepositSummarySlotData,
294
- j as resolveSavingsContributionsSlotData,
294
+ j as resolveDepositSummarySlotData,
295
+ k as resolveSavingsContributionsSlotData,
295
296
  W as resolveUpcomingBillSlotData,
296
- Q as resolveUpcomingBillTransactions
297
+ X as resolveUpcomingBillTransactions
297
298
  };
298
299
 
299
300
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, fromUnixTime, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type DataSeries,\n type DrilldownData,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n TransactionStatus,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { MerchantLogo } from '@mxenabled/mxui'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport {\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport {\n type BeatTransactionsResolver,\n buildProjectedBillTransaction,\n calendarDateOf,\n type DrillDownSlotData,\n finiteNumberOf,\n guidListOf,\n nonEmptyStringOf,\n type SlotDataResolver,\n} from './utils'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n SUBSCRIPTION_AGGREGATE: 'monthly_subscription_aggregate',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/** One flattened data_series row a filterStrategy indexes; fields are optional because the backend keys rows dynamically. */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: DrillDownSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\n/** Sub-tabs under the chart (Income / Other Deposits); `subIndex` in `FilterContext` picks one. */\nexport type SubTabsKind = (ctx: {\n instanceSlotData: DrillDownSlotData\n copy: InsightsFeedCopy\n}) => string[]\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n // `monthTabs`: one tab per data_series month and no chart (a month's aggregated transactions).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'monthTabs' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n // A second tab row under the chart that `subIndex` picks from (Income / Other Deposits).\n subTabs?: SubTabsKind\n // Where the drawer reads its facts. Absent: the bar chart's `instance_slot.data`.\n slotData?: SlotDataResolver\n // Builds the drawer's transactions from the beat's own. Absent: the beat's own, as they are.\n beatTransactions?: BeatTransactionsResolver\n // On open, returns the guids of the drawer's transactions to fetch by guid when the store lacks\n // them (older than its 90-day window), as pulse's BeatShell loads a legacy beat's: each drawer\n // reads them from wherever its beat keeps them (the beat, or the CTA that opened the drawer).\n // Absent: nothing is fetched.\n fetchMissingTransactions?: (beat: Beat, ctaDrilldownData?: DrilldownData) => unknown\n // undefined when the facts the tip needs are missing: the drawer shows no tip.\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n slotData?: DrillDownSlotData,\n ) => TipSectionProps | undefined\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n // The list has no Transactions heading above it; the CSV export stays.\n hideListHeader?: boolean\n // The tip sits between the chart and the sub-tabs rather than under them.\n tipAboveSubTabs?: boolean\n // The average (Trend) legend's number format. Absent: cents ('0,0.00').\n averageFormat?: string\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive); only settled, visible rows, a split purchase as its parts, as the\n// pulse drawer listed them. Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n custom: (trn) => !trn.is_hidden && trn.feed_status !== TransactionStatus.PENDING,\n showSplits: true,\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// Upcoming Bill: each `drilldown_data` fact is narrowed (utils.ts) and a missing or mistyped one is\n// dropped. A bad due date, amount or guid list draws no chart and lists no rows.\n\nexport const resolveUpcomingBillSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n transaction_guids: guidListOf(data.transaction_guids),\n date: calendarDateOf(data.due_date),\n amount: finiteNumberOf(data.amount),\n category_guid: nonEmptyStringOf(data.category_guid),\n average_amount: finiteNumberOf(data.average_amount),\n merchant_name: nonEmptyStringOf(data.merchant_name),\n }\n}\n\n// Savings Account Balances Summary: the drawer's bars, trend and accounts come from the beat's\n// drilldown_data alone (tupac SavingsAccountBalancesSummary::Factory.drilldown_data), each narrowed:\n// a missing or malformed fact is dropped, so the drawer draws no bars and lists no rows.\nconst dataSeriesOf = (value: unknown): DataSeries | undefined => {\n const series = value as DataSeries | undefined\n return Array.isArray(series?.names) && Array.isArray(series?.data) ? series : undefined\n}\n\nexport const resolveSavingsContributionsSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n account_guids: guidListOf(data.account_guids),\n data_series: dataSeriesOf(data.data_series),\n average_amount: finiteNumberOf(data.average_amount),\n }\n}\n\n// Monthly Deposit Summary's sub-tabs, in the donut legend's order.\nconst DEPOSIT_SUB_TABS = ['income', 'other'] as const\n\n// Monthly Deposit Summary: tupac's drilldown_data carries the six months (data_series rows with\n// aggregated_guids), the income guids and the trend. The donut's legend rows are the card's, so they\n// only name the sub-tabs; with no `legends`, the chart legend falls back to Monthly Amount / Trend.\nexport const resolveDepositSummarySlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n const donutLegends = (payload?.instance_slot?.data as InsightsInstanceSlotData | undefined)\n ?.legends\n const subTabLabels = donutLegends?.map(({ label }) => label)\n\n return {\n data_series: dataSeriesOf(data.data_series),\n average_amount: finiteNumberOf(data.average_amount),\n income_transaction_guids: guidListOf(data.income_transaction_guids),\n sub_tab_labels: subTabLabels?.length === DEPOSIT_SUB_TABS.length ? subTabLabels : undefined,\n }\n}\n\n// Monthly Debt to Income Comparison: the 6 months and the Debt / Income legend labels come from the\n// drilldown_data of the CTA that opened the drawer (ditto primary_cta_drilldown_data), never the card's\n// slot or the beat. A malformed series, or labels that are not two non-blank strings, yield nothing,\n// so the drawer draws no bars and lists no rows.\nconst DEBT_TO_INCOME_SERIES_COUNT = 2\n\nexport const resolveDebtToIncomeSlotData: SlotDataResolver = (_payload, ctaDrilldownData) => {\n const data = ctaDrilldownData ?? {}\n const dataSeries = dataSeriesOf(data.series)\n const labels = Array.isArray(data.labels) ? data.labels.map(nonEmptyStringOf) : []\n if (\n !dataSeries ||\n labels.length !== DEBT_TO_INCOME_SERIES_COUNT ||\n !labels.every((label): label is string => !!label)\n ) {\n return {}\n }\n\n // The legend's amounts are the selected month's, which the drawer fills from the bars.\n return { data_series: dataSeries, legends: labels.map((label) => ({ label, value: 0 })) }\n}\n\n// Every month's debt and income guids from the opening CTA, so the drawer fetches the ones older\n// than the store's window.\nconst debtToIncomeGuidsOf = (_beat: Beat, ctaDrilldownData?: DrilldownData): string[] =>\n buildDataSeries(dataSeriesOf(ctaDrilldownData?.series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// The drawer's tip, as Figma words it: the bold tip title and the bold limit (\"less than 30%\") from\n// the copy service. No hard-coded English: no tip until the copy service carries both strings.\nconst debtToIncomeTipSection: DrillDownVariantConfig['tipSection'] = (setCloseTipSection, copy) => {\n const message = copy.transaction_history_block?.monthly_debt_to_income_tip_message\n const limit = copy.transaction_history_block?.monthly_debt_to_income_tip_limit\n if (!message || !limit) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{limit}</strong>,\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// Every month's deposit guids, so the drawer fetches the ones older than the store's window.\nconst depositGuidsOf = (beat: Beat): string[] =>\n buildDataSeries(dataSeriesOf(beat.insights_payload?.drilldown_data?.data_series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// Upcoming Bill: the paid bills plus the projected bill (due date, amount) appended last, so the\n// bars and the projected tab's \"Projected amount\" row read the one list.\nexport const resolveUpcomingBillTransactions: BeatTransactionsResolver = (\n transactions,\n slotData,\n) => {\n const projected = buildProjectedBillTransaction(transactions, slotData)\n\n return projected ? [...transactions, projected] : transactions\n}\n\nconst upcomingBillTipSection: DrillDownVariantConfig['tipSection'] = (\n setCloseTipSection,\n copy,\n _merchantName,\n slotData,\n) => {\n const merchantName = slotData?.merchant_name\n const dueDate = slotData?.date\n if (!merchantName || !dueDate) return undefined\n\n // No hard-coded English: no tip until the copy service carries the message.\n const message = copy.transaction_history_block?.upcoming_bill_tip_message\n if (!message) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n merchantName,\n formatDate(parseISO(dueDate), DATE_FORMATS_INTL.FULL_MONTH_DAY),\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// The beat's creation: tupac sends epoch seconds on the envelope and an ISO string on the wrapper.\nconst toCreatedAt = (createdAt: Beat['created_at']) =>\n typeof createdAt === 'number' ? fromUnixTime(createdAt) : parseISO(createdAt ?? '')\n\n// Savings Account Balances Summary: the beat's savings accounts within the month (the latest month\n// ends at the beat's creation). Fails closed: no drilldown_data accounts, no rows.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n const createdAt = toCreatedAt(beat.created_at)\n const accountGuids = instanceSlotData.account_guids\n const dateRange = {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n }\n\n if (!accountGuids?.length) return { dateRange, accounts: [], custom: () => false }\n\n return { dateRange, accounts: accountGuids }\n}\n\n// A row's stored guids within the row's month, scoped to the beat's accounts. parseISO reads the\n// 'yyyy-MM-dd' date as a local calendar day, so the month never shifts with the viewer's time zone.\n// Fails closed: a missing row, guid list or date matches nothing, never the store's displayed range.\nconst guidsWithinMonth = (\n guids: string[] | undefined,\n date: string | undefined,\n accountGuids?: string[],\n): TransactionFilter => {\n const guidSet = new Set(guids)\n const month = parseISO(date ?? '')\n if (!guidSet.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guidSet.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n ...accountScope(accountGuids),\n }\n}\n\n// Monthly Subscription Aggregate — one data_series row per month, each naming its own\n// aggregated_guids; the selected month tab lists exactly those.\nconst monthlyAggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, selectedIndex }) =>\n guidsWithinMonth(\n dataSeries[selectedIndex]?.aggregated_guids,\n dataSeries[selectedIndex]?.date,\n beat.account_guids,\n )\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) bar guids. The V2 payload carries no account_guids on instance_slot.data.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n\n return guidsWithinMonth(\n subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids,\n bar?.date,\n beat.account_guids,\n )\n}\n\n// ── Tabs-only strategies ───────────────────────────────────────────────────────────────────────\n\n// Monthly Non-Essential Category Summary — the series is the two sides of one month (non-essential /\n// essential), not a time series; the selected sub-tab picks the row.\nconst aggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, subIndex }) =>\n guidsWithinMonth(\n dataSeries[subIndex]?.aggregated_guids,\n dataSeries[subIndex]?.date,\n beat.account_guids,\n )\n\n// Monthly Deposit Summary: the selected month's guids, split into the Income / Other Deposits sub-tab.\n// Not scoped to beat.account_guids: those are the beat month's accounts only, and an older month's\n// deposits can sit in other accounts; the row's aggregated_guids are already exact.\nconst depositSummaryStrategy: FilterStrategy = (ctx) => {\n const { dataSeries, selectedIndex, subIndex, instanceSlotData } = ctx\n const month = dataSeries[selectedIndex]\n const income = new Set(instanceSlotData.income_transaction_guids)\n const isIncome = DEPOSIT_SUB_TABS[subIndex] === 'income'\n const guids = instanceSlotData.sub_tab_labels\n ? month?.aggregated_guids?.filter((guid) => income.has(guid) === isIncome)\n : month?.aggregated_guids\n\n return guidsWithinMonth(guids, month?.date)\n}\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <MerchantLogo\n alt={subHeader?.text}\n categoryGuid={subHeader?.logo?.category_guid || ''}\n merchantGuid={subHeader?.logo?.merchant_guid || ''}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n // As the card's Trend (Figma \"$x\"): whole dollars.\n averageFormat: '0,0',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n // Figma: the month's calendar icon in primary.main.\n icon: <Icon color=\"primary\" name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n slotData: resolveSavingsContributionsSlotData,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n // Upcoming Bill: one bar per paid bill plus the projected bill, all from `drilldown_data`; a bar's\n // tab lists that bill alone (filtered locally, as legacy pulse does).\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n slotData: resolveUpcomingBillSlotData,\n beatTransactions: resolveUpcomingBillTransactions,\n fetchMissingTransactions: (beat) => beat.insights_payload?.drilldown_data?.transaction_guids,\n tipSection: upcomingBillTipSection,\n },\n\n // Monthly Deposit Summary: six months of deposits from drilldown_data, then Income / Other Deposits\n // tabs named by the donut's legend rows; without both rows, no sub-tabs.\n [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: {\n top: 'singleBar',\n filterStrategy: depositSummaryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n slotData: resolveDepositSummarySlotData,\n fetchMissingTransactions: depositGuidsOf,\n subTabs: ({ instanceSlotData }) => instanceSlotData.sub_tab_labels ?? [],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n // Figma 438:27640 lists the rows straight under the drawer header.\n hideListHeader: true,\n },\n\n // Monthly Subscription Aggregate's \"View Transactions\": one tab per month, no chart, each month\n // listing its own aggregated_guids.\n [DRILLDOWN_VARIANTS.SUBSCRIPTION_AGGREGATE]: {\n top: 'monthTabs',\n filterStrategy: monthlyAggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // Monthly Debt to Income Comparison: 6 months of Debt vs Income from the opening CTA's\n // drilldown_data, in the card block's palette so both series keep their card colours, plus the tip.\n [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'debt_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n slotData: resolveDebtToIncomeSlotData,\n fetchMissingTransactions: debtToIncomeGuidsOf,\n tipSection: debtToIncomeTipSection,\n // Figma 1117:8599: the tip above the Debt / Income tabs, and no Transactions heading.\n tipAboveSubTabs: true,\n hideListHeader: true,\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n\n // Monthly Non-Essential Category Summary (tabs only): one side tab per series row, labelled by the\n // row's pre-localized label; a row without one gets no tab.\n [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: {\n top: 'tabsOnly',\n filterStrategy: aggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n}\n"],"mappings":";;;;;;;;;;;;AAqDA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,wBAAwB;AAC1B,GA6E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IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,CAAC,EAAM,QAAQ,QAAQ,IAAI;AAAA,EACvD;AACF,GAIa,KAAmC;AAAA,EAC9C,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, fromUnixTime, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type DataSeries,\n type DrilldownData,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n TransactionStatus,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport LogoMark from '../../components/LogoMark'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport {\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport {\n type BeatTransactionsResolver,\n buildProjectedBillTransaction,\n calendarDateOf,\n type DrillDownSlotData,\n finiteNumberOf,\n guidListOf,\n nonEmptyStringOf,\n type SlotDataResolver,\n} from './utils'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n SUBSCRIPTION_AGGREGATE: 'monthly_subscription_aggregate',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/** One flattened data_series row a filterStrategy indexes; fields are optional because the backend keys rows dynamically. */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: DrillDownSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\n/** Sub-tabs under the chart (Income / Other Deposits); `subIndex` in `FilterContext` picks one. */\nexport type SubTabsKind = (ctx: {\n instanceSlotData: DrillDownSlotData\n copy: InsightsFeedCopy\n}) => string[]\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n // `monthTabs`: one tab per data_series month and no chart (a month's aggregated transactions).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'monthTabs' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n // A second tab row under the chart that `subIndex` picks from (Income / Other Deposits).\n subTabs?: SubTabsKind\n // Where the drawer reads its facts. Absent: the bar chart's `instance_slot.data`.\n slotData?: SlotDataResolver\n // Builds the drawer's transactions from the beat's own. Absent: the beat's own, as they are.\n beatTransactions?: BeatTransactionsResolver\n // On open, returns the guids of the drawer's transactions to fetch by guid when the store lacks\n // them (older than its 90-day window), as pulse's BeatShell loads a legacy beat's: each drawer\n // reads them from wherever its beat keeps them (the beat, or the CTA that opened the drawer).\n // Absent: nothing is fetched.\n fetchMissingTransactions?: (beat: Beat, ctaDrilldownData?: DrilldownData) => unknown\n // undefined when the facts the tip needs are missing: the drawer shows no tip.\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n slotData?: DrillDownSlotData,\n ) => TipSectionProps | undefined\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n // The list has no Transactions heading above it; the CSV export stays.\n hideListHeader?: boolean\n // The tip sits between the chart and the sub-tabs rather than under them.\n tipAboveSubTabs?: boolean\n // The average (Trend) legend's number format. Absent: cents ('0,0.00').\n averageFormat?: string\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive); only settled, visible rows, a split purchase as its parts, as the\n// pulse drawer listed them. Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n custom: (trn) => !trn.is_hidden && trn.feed_status !== TransactionStatus.PENDING,\n showSplits: true,\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// Upcoming Bill: each `drilldown_data` fact is narrowed (utils.ts) and a missing or mistyped one is\n// dropped. A bad due date, amount or guid list draws no chart and lists no rows.\n\nexport const resolveUpcomingBillSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n transaction_guids: guidListOf(data.transaction_guids),\n date: calendarDateOf(data.due_date),\n amount: finiteNumberOf(data.amount),\n category_guid: nonEmptyStringOf(data.category_guid),\n average_amount: finiteNumberOf(data.average_amount),\n merchant_name: nonEmptyStringOf(data.merchant_name),\n }\n}\n\n// Savings Account Balances Summary: the drawer's bars, trend and accounts come from the beat's\n// drilldown_data alone (tupac SavingsAccountBalancesSummary::Factory.drilldown_data), each narrowed:\n// a missing or malformed fact is dropped, so the drawer draws no bars and lists no rows.\nconst dataSeriesOf = (value: unknown): DataSeries | undefined => {\n const series = value as DataSeries | undefined\n return Array.isArray(series?.names) && Array.isArray(series?.data) ? series : undefined\n}\n\nexport const resolveSavingsContributionsSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n account_guids: guidListOf(data.account_guids),\n data_series: dataSeriesOf(data.data_series),\n average_amount: finiteNumberOf(data.average_amount),\n }\n}\n\n// Monthly Deposit Summary's sub-tabs, in the donut legend's order.\nconst DEPOSIT_SUB_TABS = ['income', 'other'] as const\n\n// Monthly Deposit Summary: tupac's drilldown_data carries the six months (data_series rows with\n// aggregated_guids), the income guids and the trend. The donut's legend rows are the card's, so they\n// only name the sub-tabs; with no `legends`, the chart legend falls back to Monthly Amount / Trend.\nexport const resolveDepositSummarySlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n const donutLegends = (payload?.instance_slot?.data as InsightsInstanceSlotData | undefined)\n ?.legends\n const subTabLabels = donutLegends?.map(({ label }) => label)\n\n return {\n data_series: dataSeriesOf(data.data_series),\n average_amount: finiteNumberOf(data.average_amount),\n income_transaction_guids: guidListOf(data.income_transaction_guids),\n sub_tab_labels: subTabLabels?.length === DEPOSIT_SUB_TABS.length ? subTabLabels : undefined,\n }\n}\n\n// Monthly Debt to Income Comparison: the 6 months and the Debt / Income legend labels come from the\n// drilldown_data of the CTA that opened the drawer (ditto primary_cta_drilldown_data), never the card's\n// slot or the beat. A malformed series, or labels that are not two non-blank strings, yield nothing,\n// so the drawer draws no bars and lists no rows.\nconst DEBT_TO_INCOME_SERIES_COUNT = 2\n\nexport const resolveDebtToIncomeSlotData: SlotDataResolver = (_payload, ctaDrilldownData) => {\n const data = ctaDrilldownData ?? {}\n const dataSeries = dataSeriesOf(data.series)\n const labels = Array.isArray(data.labels) ? data.labels.map(nonEmptyStringOf) : []\n if (\n !dataSeries ||\n labels.length !== DEBT_TO_INCOME_SERIES_COUNT ||\n !labels.every((label): label is string => !!label)\n ) {\n return {}\n }\n\n // The legend's amounts are the selected month's, which the drawer fills from the bars.\n return { data_series: dataSeries, legends: labels.map((label) => ({ label, value: 0 })) }\n}\n\n// Every month's debt and income guids from the opening CTA, so the drawer fetches the ones older\n// than the store's window.\nconst debtToIncomeGuidsOf = (_beat: Beat, ctaDrilldownData?: DrilldownData): string[] =>\n buildDataSeries(dataSeriesOf(ctaDrilldownData?.series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// The drawer's tip, as Figma words it: the bold tip title and the bold limit (\"less than 30%\") from\n// the copy service. No hard-coded English: no tip until the copy service carries both strings.\nconst debtToIncomeTipSection: DrillDownVariantConfig['tipSection'] = (setCloseTipSection, copy) => {\n const message = copy.transaction_history_block?.monthly_debt_to_income_tip_message\n const limit = copy.transaction_history_block?.monthly_debt_to_income_tip_limit\n if (!message || !limit) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{limit}</strong>,\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// Every month's deposit guids, so the drawer fetches the ones older than the store's window.\nconst depositGuidsOf = (beat: Beat): string[] =>\n buildDataSeries(dataSeriesOf(beat.insights_payload?.drilldown_data?.data_series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// Upcoming Bill: the paid bills plus the projected bill (due date, amount) appended last, so the\n// bars and the projected tab's \"Projected amount\" row read the one list.\nexport const resolveUpcomingBillTransactions: BeatTransactionsResolver = (\n transactions,\n slotData,\n) => {\n const projected = buildProjectedBillTransaction(transactions, slotData)\n\n return projected ? [...transactions, projected] : transactions\n}\n\nconst upcomingBillTipSection: DrillDownVariantConfig['tipSection'] = (\n setCloseTipSection,\n copy,\n _merchantName,\n slotData,\n) => {\n const merchantName = slotData?.merchant_name\n const dueDate = slotData?.date\n if (!merchantName || !dueDate) return undefined\n\n // No hard-coded English: no tip until the copy service carries the message.\n const message = copy.transaction_history_block?.upcoming_bill_tip_message\n if (!message) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n merchantName,\n formatDate(parseISO(dueDate), DATE_FORMATS_INTL.FULL_MONTH_DAY),\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// The beat's creation: tupac sends epoch seconds on the envelope and an ISO string on the wrapper.\nconst toCreatedAt = (createdAt: Beat['created_at']) =>\n typeof createdAt === 'number' ? fromUnixTime(createdAt) : parseISO(createdAt ?? '')\n\n// Savings Account Balances Summary: the beat's savings accounts within the month (the latest month\n// ends at the beat's creation). Fails closed: no drilldown_data accounts, no rows.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n const createdAt = toCreatedAt(beat.created_at)\n const accountGuids = instanceSlotData.account_guids\n const dateRange = {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n }\n\n if (!accountGuids?.length) return { dateRange, accounts: [], custom: () => false }\n\n return { dateRange, accounts: accountGuids }\n}\n\n// A row's stored guids within the row's month, scoped to the beat's accounts. parseISO reads the\n// 'yyyy-MM-dd' date as a local calendar day, so the month never shifts with the viewer's time zone.\n// Fails closed: a missing row, guid list or date matches nothing, never the store's displayed range.\nconst guidsWithinMonth = (\n guids: string[] | undefined,\n date: string | undefined,\n accountGuids?: string[],\n): TransactionFilter => {\n const guidSet = new Set(guids)\n const month = parseISO(date ?? '')\n if (!guidSet.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guidSet.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n ...accountScope(accountGuids),\n }\n}\n\n// Monthly Subscription Aggregate — one data_series row per month, each naming its own\n// aggregated_guids; the selected month tab lists exactly those.\nconst monthlyAggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, selectedIndex }) =>\n guidsWithinMonth(\n dataSeries[selectedIndex]?.aggregated_guids,\n dataSeries[selectedIndex]?.date,\n beat.account_guids,\n )\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) bar guids. The V2 payload carries no account_guids on instance_slot.data.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n\n return guidsWithinMonth(\n subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids,\n bar?.date,\n beat.account_guids,\n )\n}\n\n// ── Tabs-only strategies ───────────────────────────────────────────────────────────────────────\n\n// Monthly Non-Essential Category Summary — the series is the two sides of one month (non-essential /\n// essential), not a time series; the selected sub-tab picks the row.\nconst aggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, subIndex }) =>\n guidsWithinMonth(\n dataSeries[subIndex]?.aggregated_guids,\n dataSeries[subIndex]?.date,\n beat.account_guids,\n )\n\n// Monthly Deposit Summary: the selected month's guids, split into the Income / Other Deposits sub-tab.\n// Not scoped to beat.account_guids: those are the beat month's accounts only, and an older month's\n// deposits can sit in other accounts; the row's aggregated_guids are already exact.\nconst depositSummaryStrategy: FilterStrategy = (ctx) => {\n const { dataSeries, selectedIndex, subIndex, instanceSlotData } = ctx\n const month = dataSeries[selectedIndex]\n const income = new Set(instanceSlotData.income_transaction_guids)\n const isIncome = DEPOSIT_SUB_TABS[subIndex] === 'income'\n const guids = instanceSlotData.sub_tab_labels\n ? month?.aggregated_guids?.filter((guid) => income.has(guid) === isIncome)\n : month?.aggregated_guids\n\n return guidsWithinMonth(guids, month?.date)\n}\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <LogoMark\n logo={{\n ...subHeader?.logo,\n merchant_name: subHeader?.text ?? subHeader?.logo?.merchant_name,\n }}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n // As the card's Trend (Figma \"$x\"): whole dollars.\n averageFormat: '0,0',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n // Figma: the month's calendar icon in primary.main.\n icon: <Icon color=\"primary\" name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n slotData: resolveSavingsContributionsSlotData,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n // Upcoming Bill: one bar per paid bill plus the projected bill, all from `drilldown_data`; a bar's\n // tab lists that bill alone (filtered locally, as legacy pulse does).\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n slotData: resolveUpcomingBillSlotData,\n beatTransactions: resolveUpcomingBillTransactions,\n fetchMissingTransactions: (beat) => beat.insights_payload?.drilldown_data?.transaction_guids,\n tipSection: upcomingBillTipSection,\n },\n\n // Monthly Deposit Summary: six months of deposits from drilldown_data, then Income / Other Deposits\n // tabs named by the donut's legend rows; without both rows, no sub-tabs.\n [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: {\n top: 'singleBar',\n filterStrategy: depositSummaryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n slotData: resolveDepositSummarySlotData,\n fetchMissingTransactions: depositGuidsOf,\n subTabs: ({ instanceSlotData }) => instanceSlotData.sub_tab_labels ?? [],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n // Figma 438:27640 lists the rows straight under the drawer header.\n hideListHeader: true,\n },\n\n // Monthly Subscription Aggregate's \"View Transactions\": one tab per month, no chart, each month\n // listing its own aggregated_guids.\n [DRILLDOWN_VARIANTS.SUBSCRIPTION_AGGREGATE]: {\n top: 'monthTabs',\n filterStrategy: monthlyAggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // Monthly Debt to Income Comparison: 6 months of Debt vs Income from the opening CTA's\n // drilldown_data, in the card block's palette so both series keep their card colours, plus the tip.\n [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'debt_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n slotData: resolveDebtToIncomeSlotData,\n fetchMissingTransactions: debtToIncomeGuidsOf,\n tipSection: debtToIncomeTipSection,\n // Figma 1117:8599: the tip above the Debt / Income tabs, and no Transactions heading.\n tipAboveSubTabs: true,\n hideListHeader: true,\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n\n // Monthly Non-Essential Category Summary (tabs only): one side tab per series row, labelled by the\n // row's pre-localized label; a row without one gets no tab.\n [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: {\n top: 'tabsOnly',\n filterStrategy: aggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: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A,IACZ,QAAA,CAAS,MAAiB,EAAyB,GAAO,gBAAgB,GAAG,SAAS,CAAC;AAAA,IACvF,kBAAA,CAAmB,MAAS,CAAC,QAAW,EAAK,QAAQ,mBAAmB;AAAA,IACxE,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,YAAY;AAAA,IAEZ,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,EAClB;AAAA,EAMC,CAAA,EAAmB,sBAAA,GAAyB;AAAA,IAC3C,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,CAAC,EAAM,QAAQ,QAAQ,IAAI;AAAA,EACvD;AACF,GAIa,KAAmC;AAAA,EAC9C,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
@@ -1,44 +1,38 @@
1
1
  import { buildDynamicCopy as a } from "../../../../core/utils/Localization.es.js";
2
- import { formatCurrency as r } from "../../../../core/utils/NumberFormatting.es.js";
3
- import { getCategoryColor as h } from "../../../../core/utils/CategoryUtil.es.js";
4
- import C from "../../../components/ComponentBlocks/StatusIndicator.es.js";
5
- import { getColorByBudgetTier as x } from "./util.es.js";
6
- import { CategoryIcon as B, MerchantLogo as T, Text as k } from "@mxenabled/mxui";
7
- import { jsx as e } from "react/jsx-runtime";
8
- import { alpha as v, useTheme as G } from "@mui/material/styles";
9
- var W = ({ payload: i }) => {
10
- const { budget_percent: c, amount: l, budget_tier: m, category_guid: o, merchant_guid: d, spent_amount: u, budgeted_amount: p, localized_payload: t } = i.instance_slot_data, s = x(m), g = G(), n = o ? h(o, g) : "", b = o && o !== null ? /* @__PURE__ */ e(B, {
11
- categoryGuid: o,
2
+ import { formatCurrency as e } from "../../../../core/utils/NumberFormatting.es.js";
3
+ import f from "../../../components/CategoryTile.es.js";
4
+ import y from "../../../components/LogoMark.es.js";
5
+ import x from "../../../components/ComponentBlocks/StatusIndicator.es.js";
6
+ import { getColorByBudgetTier as C } from "./util.es.js";
7
+ import { Text as h } from "@mxenabled/mxui";
8
+ import { jsx as r } from "react/jsx-runtime";
9
+ var G = ({ payload: i }) => {
10
+ const { budget_percent: n, amount: l, budget_tier: m, category_guid: t, merchant_guid: c, spent_amount: u, budgeted_amount: d, localized_payload: o } = i.instance_slot_data, p = C(m), s = t ? /* @__PURE__ */ r(f, {
11
+ categoryGuid: t,
12
12
  size: 44,
13
- sx: {
14
- color: "text.primary",
15
- bgcolor: v(n, 0.25),
16
- borderColor: n,
17
- borderWidth: 1,
18
- borderStyle: "solid"
19
- }
20
- }) : /* @__PURE__ */ e(T, {
21
- categoryGuid: o || "",
22
- merchantGuid: d || ""
23
- }), _ = a(t?.spent_label || "", r(u, "0,0.00")), f = a(t?.budgeted_label || "", r(p, "0,0.00")), y = /* @__PURE__ */ e(k, {
13
+ tint: 0.25
14
+ }) : /* @__PURE__ */ r(y, {
15
+ logo: { merchant_guid: c },
16
+ size: 44
17
+ }), _ = a(o?.spent_label || "", e(u, "0,0.00")), g = a(o?.budgeted_label || "", e(d, "0,0.00")), b = /* @__PURE__ */ r(h, {
24
18
  bold: !0,
25
19
  variant: "h2",
26
- children: o && o !== null ? a(t?.amount_left_label || "", r(l, "0,0.00")) : r(l, "0,0.00")
20
+ children: t && t !== null ? a(o?.amount_left_label || "", e(l, "0,0.00")) : e(l, "0,0.00")
27
21
  });
28
- return /* @__PURE__ */ e(C, {
29
- amount: y,
22
+ return /* @__PURE__ */ r(x, {
23
+ amount: b,
30
24
  borderRadius: "12px",
31
- completeColor: s,
32
- icon: b,
33
- label: t?.primary_text || "",
25
+ completeColor: p,
26
+ icon: s,
27
+ label: o?.primary_text || "",
34
28
  leftLabel: _,
35
- percentComplete: c,
36
- rightLabel: f,
29
+ percentComplete: n,
30
+ rightLabel: g,
37
31
  sx: { "& .details-container": { gap: 12 } }
38
32
  });
39
33
  };
40
34
  export {
41
- W as BudgetBlock
35
+ G as BudgetBlock
42
36
  };
43
37
 
44
38
  //# sourceMappingURL=BudgetBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { alpha, useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, formatCurrency } from '../../../../common'\nimport type { BudgetBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\n\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\n\nimport type { BlockProps } from '../../types'\n\nimport { getColorByBudgetTier } from './util'\n\nexport const BudgetBlock = ({ payload }: BlockProps<BudgetBlockData>) => {\n const {\n budget_percent,\n amount,\n budget_tier,\n category_guid,\n merchant_guid,\n spent_amount,\n budgeted_amount,\n localized_payload,\n } = payload.instance_slot_data\n\n const color = getColorByBudgetTier(budget_tier)\n\n const theme = useTheme()\n\n const avatarBgColor = category_guid ? getCategoryColor(category_guid, theme) : ''\n\n // Precomputed as a JSX element (not a component defined during render) so it\n // isn't remounted on every re-render.\n const icon =\n category_guid && category_guid !== null ? (\n <CategoryIcon\n categoryGuid={category_guid}\n size={44}\n sx={{\n color: 'text.primary',\n bgcolor: alpha(avatarBgColor, 0.25),\n borderColor: avatarBgColor,\n borderWidth: 1,\n borderStyle: 'solid',\n }}\n />\n ) : (\n <MerchantLogo categoryGuid={category_guid || ''} merchantGuid={merchant_guid || ''} />\n )\n\n const block_left_footer = buildDynamicCopy(\n localized_payload?.spent_label || '',\n formatCurrency(spent_amount, '0,0.00'),\n ) as string\n\n const block_right_footer = buildDynamicCopy(\n localized_payload?.budgeted_label || '',\n formatCurrency(budgeted_amount, '0,0.00'),\n ) as string\n\n const amountToDisplay = (\n <Text bold={true} variant=\"h2\">\n {category_guid && category_guid !== null\n ? (buildDynamicCopy(\n localized_payload?.amount_left_label || '',\n formatCurrency(amount, '0,0.00'),\n ) as string)\n : formatCurrency(amount, '0,0.00')}\n </Text>\n )\n\n return (\n <StatusIndicator\n amount={amountToDisplay}\n borderRadius=\"12px\"\n completeColor={color}\n icon={icon}\n label={localized_payload?.primary_text || ''}\n leftLabel={block_left_footer}\n percentComplete={budget_percent}\n rightLabel={block_right_footer}\n sx={{ '& .details-container': { gap: 12 } }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,IAAA,CAAe,EAAE,SAAA,EAAA,MAA2C;AACvE,QAAM,EACJ,gBAAA,GACA,QAAA,GACA,aAAA,GACA,eAAA,GACA,eAAA,GACA,cAAA,GACA,iBAAA,GACA,mBAAA,EAAA,IACE,EAAQ,oBAEN,IAAQ,EAAqB,CAAW,GAExC,IAAQ,EAAS,GAEjB,IAAgB,IAAgB,EAAiB,GAAe,CAAK,IAAI,IAIzE,IACJ,KAAiB,MAAkB,OACjC,gBAAA,EAAC,GAAD;AAAA,IACE,cAAc;AAAA,IACd,MAAM;AAAA,IACN,IAAI;AAAA,MACF,OAAO;AAAA,MACP,SAAS,EAAM,GAAe,IAAI;AAAA,MAClC,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,EACD,CAAA,IAED,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,KAAiB;AAAA,IAAI,cAAc,KAAiB;AAAA,EAAK,CAAA,GAGnF,IAAoB,EACxB,GAAmB,eAAe,IAClC,EAAe,GAAc,QAAQ,CACvC,GAEM,IAAqB,EACzB,GAAmB,kBAAkB,IACrC,EAAe,GAAiB,QAAQ,CAC1C,GAEM,IACJ,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,SAAQ;AAAA,IACvB,UAAA,KAAiB,MAAkB,OAC/B,EACC,GAAmB,qBAAqB,IACxC,EAAe,GAAQ,QAAQ,CACjC,IACA,EAAe,GAAQ,QAAQ;AAAA,EAC/B,CAAA;AAGR,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ;AAAA,IACR,cAAa;AAAA,IACb,eAAe;AAAA,IACT,MAAA;AAAA,IACN,OAAO,GAAmB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,IAAI,EAAE,wBAAwB,EAAE,KAAK,GAAG,EAAE;AAAA,EAC3C,CAAA;AAEL"}
1
+ {"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, formatCurrency } from '../../../../common'\nimport type { BudgetBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport CategoryTile from '../../../components/CategoryTile'\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\nimport LogoMark from '../../../components/LogoMark'\n\nimport type { BlockProps } from '../../types'\n\nimport { getColorByBudgetTier } from './util'\n\nexport const BudgetBlock = ({ payload }: BlockProps<BudgetBlockData>) => {\n const {\n budget_percent,\n amount,\n budget_tier,\n category_guid,\n merchant_guid,\n spent_amount,\n budgeted_amount,\n localized_payload,\n } = payload.instance_slot_data\n\n const color = getColorByBudgetTier(budget_tier)\n\n // Precomputed as a JSX element (not a component defined during render) so it\n // isn't remounted on every re-render.\n const icon = category_guid ? (\n <CategoryTile categoryGuid={category_guid} size={44} tint={0.25} />\n ) : (\n <LogoMark logo={{ merchant_guid }} size={44} />\n )\n\n const block_left_footer = buildDynamicCopy(\n localized_payload?.spent_label || '',\n formatCurrency(spent_amount, '0,0.00'),\n ) as string\n\n const block_right_footer = buildDynamicCopy(\n localized_payload?.budgeted_label || '',\n formatCurrency(budgeted_amount, '0,0.00'),\n ) as string\n\n const amountToDisplay = (\n <Text bold={true} variant=\"h2\">\n {category_guid && category_guid !== null\n ? (buildDynamicCopy(\n localized_payload?.amount_left_label || '',\n formatCurrency(amount, '0,0.00'),\n ) as string)\n : formatCurrency(amount, '0,0.00')}\n </Text>\n )\n\n return (\n <StatusIndicator\n amount={amountToDisplay}\n borderRadius=\"12px\"\n completeColor={color}\n icon={icon}\n label={localized_payload?.primary_text || ''}\n leftLabel={block_left_footer}\n percentComplete={budget_percent}\n rightLabel={block_right_footer}\n sx={{ '& .details-container': { gap: 12 } }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,IAAA,CAAe,EAAE,SAAA,EAAA,MAA2C;AACvE,QAAM,EACJ,gBAAA,GACA,QAAA,GACA,aAAA,GACA,eAAA,GACA,eAAA,GACA,cAAA,GACA,iBAAA,GACA,mBAAA,EAAA,IACE,EAAQ,oBAEN,IAAQ,EAAqB,CAAW,GAIxC,IAAO,IACX,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc;AAAA,IAAe,MAAM;AAAA,IAAI,MAAM;AAAA,EAAO,CAAA,IAElE,gBAAA,EAAC,GAAD;AAAA,IAAU,MAAM,EAAE,eAAA,EAAc;AAAA,IAAG,MAAM;AAAA,EAAK,CAAA,GAG1C,IAAoB,EACxB,GAAmB,eAAe,IAClC,EAAe,GAAc,QAAQ,CACvC,GAEM,IAAqB,EACzB,GAAmB,kBAAkB,IACrC,EAAe,GAAiB,QAAQ,CAC1C,GAEM,IACJ,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,SAAQ;AAAA,IACvB,UAAA,KAAiB,MAAkB,OAC/B,EACC,GAAmB,qBAAqB,IACxC,EAAe,GAAQ,QAAQ,CACjC,IACA,EAAe,GAAQ,QAAQ;AAAA,EAC/B,CAAA;AAGR,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ;AAAA,IACR,cAAa;AAAA,IACb,eAAe;AAAA,IACT,MAAA;AAAA,IACN,OAAO,GAAmB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,IAAI,EAAE,wBAAwB,EAAE,KAAK,GAAG,EAAE;AAAA,EAC3C,CAAA;AAEL"}