@mx-cartographer/experiences 9.7.203 → 9.7.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [9.7.205] - 11-24-2026
2
+
3
+ - **ADDED** - Monthly Non-Essential Category Summary V2 drilldown support and guidance tip for essential vs flexible categories (WEC-2448)
4
+
5
+ ## [9.7.204] - 11-24-2026
6
+
7
+ - **FIXED** - Debt Payment Reminder, P2P and Category Budget beats match Figma design QA (WEC-2440)
8
+
1
9
  ## [9.7.203] - 11-23-2026
2
10
 
3
11
  - **ADDED** - User Feedback survey block (WELL-224)
@@ -172,6 +172,10 @@ export interface TransactionHistoryBlock {
172
172
  */
173
173
  monthly_debt_to_income_tip_message?: string;
174
174
  monthly_debt_to_income_tip_limit?: string;
175
+ /**
176
+ * The Essentials vs. Flexible drawer's tip: `_1{tip}` the bold tip title. Optional: without it, no tip.
177
+ */
178
+ non_essential_tip_message?: string;
175
179
  /**
176
180
  * The Savings vs. Income drawer's tip: `_1{tip}` the bold tip title and `_2{percentage}` the bold
177
181
  * percentage (`savings_to_income_tip_percentage`, "20%"). Optional: without both, no tip.
@@ -13,7 +13,7 @@ export type { DebtsCopy } from './DebtsCopy';
13
13
  export type { FinstrongCopy } from './FinstrongCopy';
14
14
  export type { GoalsCopy } from './GoalsCopy';
15
15
  export type { HelpCopy, HelpByCategoryList } from './HelpCopy';
16
- export type { AmountInputModalCopy, AmountInputModalVariantCopy, EmergencySavingsCopy, InsightsFeedCopy, MakeTransferCopy, PayoffCalculatorCopy, TopMerchantsCopy, RemainingCashCopy, OverdraftCopy, CreditUtilizationCopy, AccountListCopy, OverflowMenuCopy, DismissInsightCopy, DismissInsightOptionCopy, HiddenConfirmationCopy, HideFeedbackCopy, FeedbackCopy, FeedbackBarCopy, } from './InsightsFeedCopy';
16
+ export type { AmountInputModalCopy, AmountInputModalVariantCopy, EmergencySavingsCopy, InsightsFeedCopy, MakeTransferCopy, PayoffCalculatorCopy, RemainingCashCopy, OverdraftCopy, CreditUtilizationCopy, AccountListCopy, OverflowMenuCopy, DismissInsightCopy, DismissInsightOptionCopy, HiddenConfirmationCopy, HideFeedbackCopy, FeedbackCopy, FeedbackBarCopy, TopMerchantsCopy, TransactionHistoryBlock, } from './InsightsFeedCopy';
17
17
  export type { InvestmentsCopy } from './InvestmentsCopy';
18
18
  export type { MicroInsightsCopy } from './MicroInsightsCopy';
19
19
  export type { NetWorthCopy } from './NetWorthCopy';
@@ -1,75 +1,75 @@
1
- import { buildDynamicCopy as p, buildPluralCopy as g } from "../../../core/utils/Localization.es.js";
1
+ import { buildDynamicCopy as s, buildPluralCopy as g } from "../../../core/utils/Localization.es.js";
2
2
  import { CURRENCY_FORMAT as e, formatCurrency as t } from "../../../core/utils/NumberFormatting.es.js";
3
3
  import { calculateBudgetPercent as v, calculateBudgetTier as y, tierColor as C } from "./layout.es.js";
4
4
  import S from "../../components/ComponentBlocks/StatusIndicator.es.js";
5
- import i from "@mui/material/Stack";
6
- import { Text as o } from "@mxenabled/mxui";
7
- import { jsx as r, jsxs as n } from "react/jsx-runtime";
5
+ import l from "@mui/material/Stack";
6
+ import { P as B, Text as i } from "@mxenabled/mxui";
7
+ import { jsx as r, jsxs as o } from "react/jsx-runtime";
8
8
  import x from "@mui/material/Box";
9
- import B from "@mui/material/Alert";
10
- var E = ({ budgetsCopy: c, copy: d, daysLeft: m, icon: _, limit: a, showPeriodLine: h = !0, spent: l }) => {
11
- const s = v(l, a), f = y(s), b = C(f), u = m === void 0 ? /* @__PURE__ */ r(B, {
9
+ import D from "@mui/material/Alert";
10
+ var E = ({ budgetsCopy: c, copy: m, daysLeft: d, icon: _, limit: n, showPeriodLine: h = !0, spent: a }) => {
11
+ const p = v(a, n), f = y(p), b = C(f), u = d === void 0 ? /* @__PURE__ */ r(D, {
12
12
  severity: "info",
13
- children: d.previous_month_notice
14
- }) : /* @__PURE__ */ r(o, {
13
+ children: m.previous_month_notice
14
+ }) : /* @__PURE__ */ r(i, {
15
15
  color: "text.secondary",
16
16
  variant: "body2",
17
- children: g(d.days_left_until_end_of_month_one, d.days_left_until_end_of_month, m, String(m))
17
+ children: g(m.days_left_until_end_of_month_one, m.days_left_until_end_of_month, d, String(d))
18
18
  });
19
- return a <= 0 ? /* @__PURE__ */ n(i, {
19
+ return n <= 0 ? /* @__PURE__ */ o(l, {
20
20
  sx: { gap: 16 },
21
- children: [/* @__PURE__ */ n(i, {
21
+ children: [/* @__PURE__ */ o(l, {
22
22
  sx: {
23
23
  alignItems: "center",
24
24
  flexDirection: "row",
25
25
  gap: 12
26
26
  },
27
- children: [/* @__PURE__ */ r(x, { children: _ }), /* @__PURE__ */ n(i, { children: [/* @__PURE__ */ r(o, {
27
+ children: [/* @__PURE__ */ r(x, { children: _ }), /* @__PURE__ */ o(l, { children: [/* @__PURE__ */ r(i, {
28
28
  color: "text.secondary",
29
29
  variant: "body2",
30
30
  children: c.spent_label
31
- }), /* @__PURE__ */ r(o, {
31
+ }), /* @__PURE__ */ r(i, {
32
32
  bold: !0,
33
33
  component: "p",
34
34
  variant: "h2",
35
- children: t(l, e.cents)
35
+ children: t(a, e.cents)
36
36
  })] })]
37
37
  }), h && u]
38
- }) : /* @__PURE__ */ n(i, {
38
+ }) : /* @__PURE__ */ o(l, {
39
39
  sx: { gap: 16 },
40
40
  children: [/* @__PURE__ */ r(x, {
41
- "aria-label": p(d.total_out_of_limit_aria, t(l, e.cents), t(a, e.cents)),
41
+ "aria-label": s(m.total_out_of_limit_aria, t(a, e.cents), t(n, e.cents)),
42
42
  "data-tier": f ?? "none",
43
43
  role: "group",
44
44
  children: /* @__PURE__ */ r(S, {
45
- amount: /* @__PURE__ */ n(i, {
45
+ amount: /* @__PURE__ */ o(l, {
46
46
  sx: {
47
47
  alignItems: "baseline",
48
48
  flexDirection: "row",
49
49
  gap: 4
50
50
  },
51
- children: [/* @__PURE__ */ r(o, {
51
+ children: [/* @__PURE__ */ r(B, {
52
52
  bold: !0,
53
- component: "p",
53
+ color: "text.primary",
54
54
  variant: "h2",
55
- children: t(l, e.cents)
56
- }), /* @__PURE__ */ n(o, {
55
+ children: t(a, e.cents)
56
+ }), /* @__PURE__ */ o(i, {
57
57
  color: "text.secondary",
58
58
  variant: "body2",
59
- children: ["/ ", t(a, e.cents)]
59
+ children: ["/ ", t(n, e.cents)]
60
60
  })]
61
61
  }),
62
62
  completeColor: b,
63
63
  icon: _,
64
- label: /* @__PURE__ */ r(o, {
65
- color: "text.secondary",
64
+ label: /* @__PURE__ */ r(i, {
65
+ color: "text.primary",
66
66
  variant: "body2",
67
67
  children: c.spent_label
68
68
  }),
69
69
  labelVariant: "body2",
70
- leftLabel: p(c.percent_spent, String(s)),
71
- percentComplete: Math.min(100, s),
72
- rightLabel: p(c.balance_left, t(Math.max(0, a - l), e.cents)),
70
+ leftLabel: s(c.percent_spent, String(p)),
71
+ percentComplete: Math.min(100, p),
72
+ rightLabel: s(c.balance_left, t(Math.max(0, n - a), e.cents)),
73
73
  sx: { p: 0 }
74
74
  })
75
75
  }), h && u]
@@ -1 +1 @@
1
- {"version":3,"file":"BudgetSummary.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { BudgetsCopy } from '../../../core/types/localization'\nimport type { BudgetDetailsCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport StatusIndicator from '../../components/ComponentBlocks/StatusIndicator'\n\nimport { calculateBudgetPercent, calculateBudgetTier, tierColor } from './layout'\n\ninterface BudgetSummaryProps {\n budgetsCopy: BudgetsCopy\n copy: BudgetDetailsCopy\n daysLeft?: number\n icon: ReactNode\n limit: number\n /** The days-left / previous-month line under the bar (off for Figma's Budget Details insights). */\n showPeriodLine?: boolean\n spent: number\n}\n\nexport const BudgetSummary = ({\n budgetsCopy,\n copy,\n daysLeft,\n icon,\n limit,\n showPeriodLine = true,\n spent,\n}: BudgetSummaryProps) => {\n const percent = calculateBudgetPercent(spent, limit)\n const tier = calculateBudgetTier(percent)\n const color = tierColor(tier)\n const periodLine =\n daysLeft === undefined ? (\n <Alert severity=\"info\">{copy.previous_month_notice}</Alert>\n ) : (\n <Text color=\"text.secondary\" variant=\"body2\">\n {\n buildPluralCopy(\n copy.days_left_until_end_of_month_one,\n copy.days_left_until_end_of_month,\n daysLeft,\n String(daysLeft),\n ) as string\n }\n </Text>\n )\n\n if (limit <= 0) {\n return (\n <Stack sx={{ gap: 16 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n {showPeriodLine && periodLine}\n </Stack>\n )\n }\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n aria-label={\n buildDynamicCopy(\n copy.total_out_of_limit_aria,\n formatCurrency(spent, CURRENCY_FORMAT.cents),\n formatCurrency(limit, CURRENCY_FORMAT.cents),\n ) as string\n }\n data-tier={tier ?? 'none'}\n role=\"group\"\n >\n <StatusIndicator\n amount={\n <Stack sx={{ alignItems: 'baseline', flexDirection: 'row', gap: 4 }}>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, CURRENCY_FORMAT.cents)}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n / {formatCurrency(limit, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n }\n completeColor={color}\n icon={icon}\n label={\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n }\n labelVariant=\"body2\"\n leftLabel={buildDynamicCopy(budgetsCopy.percent_spent, String(percent)) as string}\n percentComplete={Math.min(100, percent)}\n rightLabel={\n buildDynamicCopy(\n // Figma's \"$amount Left\"; $0.00 once over, as the Budgets drawer shows it.\n budgetsCopy.balance_left,\n formatCurrency(Math.max(0, limit - spent), CURRENCY_FORMAT.cents),\n ) as string\n }\n sx={{ p: 0 }}\n />\n </Box>\n {showPeriodLine && periodLine}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAa,IAAA,CAAiB,EAC5B,aAAA,GACA,MAAA,GACA,UAAA,GACA,MAAA,GACA,OAAA,GACA,gBAAA,IAAiB,IACjB,OAAA,EAAA,MACwB;AACxB,QAAM,IAAU,EAAuB,GAAO,CAAK,GAC7C,IAAO,EAAoB,CAAO,GAClC,IAAQ,EAAU,CAAI,GACtB,IACJ,MAAa,SACX,gBAAA,EAAC,GAAD;AAAA,IAAO,UAAS;AAAA,IAAQ,UAAA,EAAK;AAAA,EAA6B,CAAA,IAE1D,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,SAAQ;AAAA,IAEjC,UAAA,EACE,EAAK,kCACL,EAAK,8BACL,GACA,OAAO,CAAQ,CACjB;AAAA,EAEE,CAAA;AAGV,SAAI,KAAS,IAET,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,KAAK,GAAG;AAAA,IAArB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAU,eAAe;AAAA,QAAO,KAAK;AAAA,MAAG;AAAA,MAAjE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAM,EAAU,CAAA,GAChB,gBAAA,EAAC,GAAD,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,SAAQ;AA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EAEE,EAAY,cACZ,EAAe,KAAK,IAAI,GAAG,IAAQ,CAAK,GAAG,EAAgB,KAAK,CAClE;AAAA,QAEF,IAAI,EAAE,GAAG,EAAE;AAAA,MACZ,CAAA;AAAA,IACE,CAAA,GACJ,KAAkB,CACd;AAAA;AAEX"}
1
+ {"version":3,"file":"BudgetSummary.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { BudgetsCopy } from '../../../core/types/localization'\nimport type { BudgetDetailsCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport StatusIndicator from '../../components/ComponentBlocks/StatusIndicator'\n\nimport { calculateBudgetPercent, calculateBudgetTier, tierColor } from './layout'\n\ninterface BudgetSummaryProps {\n budgetsCopy: BudgetsCopy\n copy: BudgetDetailsCopy\n daysLeft?: number\n icon: ReactNode\n limit: number\n /** The days-left / previous-month line under the bar (off for Figma's Budget Details insights). */\n showPeriodLine?: boolean\n spent: number\n}\n\nexport const BudgetSummary = ({\n budgetsCopy,\n copy,\n daysLeft,\n icon,\n limit,\n showPeriodLine = true,\n spent,\n}: BudgetSummaryProps) => {\n const percent = calculateBudgetPercent(spent, limit)\n const tier = calculateBudgetTier(percent)\n const color = tierColor(tier)\n const periodLine =\n daysLeft === undefined ? (\n <Alert severity=\"info\">{copy.previous_month_notice}</Alert>\n ) : (\n <Text color=\"text.secondary\" variant=\"body2\">\n {\n buildPluralCopy(\n copy.days_left_until_end_of_month_one,\n copy.days_left_until_end_of_month,\n daysLeft,\n String(daysLeft),\n ) as string\n }\n </Text>\n )\n\n if (limit <= 0) {\n return (\n <Stack sx={{ gap: 16 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n {showPeriodLine && periodLine}\n </Stack>\n )\n }\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n aria-label={\n buildDynamicCopy(\n copy.total_out_of_limit_aria,\n formatCurrency(spent, CURRENCY_FORMAT.cents),\n formatCurrency(limit, CURRENCY_FORMAT.cents),\n ) as string\n }\n data-tier={tier ?? 'none'}\n role=\"group\"\n >\n <StatusIndicator\n amount={\n <Stack sx={{ alignItems: 'baseline', flexDirection: 'row', gap: 4 }}>\n <P bold={true} color=\"text.primary\" variant=\"h2\">\n {formatCurrency(spent, CURRENCY_FORMAT.cents)}\n </P>\n <Text color=\"text.secondary\" variant=\"body2\">\n / {formatCurrency(limit, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n }\n completeColor={color}\n icon={icon}\n label={\n <Text color=\"text.primary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n }\n labelVariant=\"body2\"\n leftLabel={buildDynamicCopy(budgetsCopy.percent_spent, String(percent)) as string}\n percentComplete={Math.min(100, percent)}\n rightLabel={\n buildDynamicCopy(\n // Figma's \"$amount Left\"; $0.00 once over, as the Budgets drawer shows it.\n budgetsCopy.balance_left,\n formatCurrency(Math.max(0, limit - spent), CURRENCY_FORMAT.cents),\n ) as string\n }\n sx={{ p: 0 }}\n />\n </Box>\n {showPeriodLine && periodLine}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAa,IAAA,CAAiB,EAC5B,aAAA,GACA,MAAA,GACA,UAAA,GACA,MAAA,GACA,OAAA,GACA,gBAAA,IAAiB,IACjB,OAAA,EAAA,MACwB;AACx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AAC,GAAD;AAAA,QACE,QACE,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,YAAY;AAAA,YAAY,eAAe;AAAA,YAAO,KAAK;AAAA,UAAE;AAAA,UAAlE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YAAG,MAAM;AAAA,YAAM,OAAM;AAAA,YAAe,SAAQ;AAAA,YACzC,UAAA,EAAe,GAAO,EAAgB,KAAK;AAAA,UAC3C,CAAA,GACH,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAArC,UAAA,CAA6C,MACxC,EAAe,GAAO,EAAgB,KAAK,CAC1C;AAAA,UACD,CAAA,CAAA;AAAA;QAET,eAAe;AAAA,QACT,MAAA;AAAA,QACN,OACE,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,SAAQ;AAAA,UAChC,UAAA,EAAY;AAAA,QACT,CAAA;AAAA,QAER,cAAa;AAAA,QACb,WAAW,EAAiB,EAAY,eAAe,OAAO,CAAO,CAAC;AAAA,QACtE,iBAAiB,KAAK,IAAI,KAAK,CAAO;AAAA,QACtC,YACE,EAEE,EAAY,cACZ,EAAe,KAAK,IAAI,GAAG,IAAQ,CAAK,GAAG,EAAgB,KAAK,CAClE;AAAA,QAEF,IAAI,EAAE,GAAG,EAAE;AAAA,MACZ,CAAA;AAAA,IACE,CAAA,GACJ,KAAkB,CACd;AAAA;AAEX"}
@@ -16,11 +16,11 @@ export interface BudgetFacts {
16
16
  export declare const resolveBudgetFacts: (beat: Beat) => BudgetFacts;
17
17
  type BudgetSubject = (beat: Beat, copy: GlobalCopy) => string | undefined;
18
18
  type ActiveAt = Beat['active_at'] | number | null | undefined;
19
- /** A beat's `active_at` (epoch seconds or ISO) as a date; undefined when absent or invalid. */
19
+ /** A beat's `active_at` (epoch seconds or ISO) as a date undefined when absent or invalid. */
20
20
  export declare const activeAtDate: (raw: ActiveAt) => Date | undefined;
21
21
  /** The beat's own `active_at`: on the beat, else on its envelope. */
22
22
  export declare const beatActiveAt: (beat: Beat) => ActiveAt;
23
- /** The `active_at` the card recorded on render; a sampled beat is re-read without it after a CTA. */
23
+ /** The `active_at` the card recorded on render a sampled beat is re-read without it after a CTA. */
24
24
  export declare const recordedActiveAtOf: (store: Pick<InsightsV2Store, "beatContext">, beat: Beat) => ActiveAt;
25
25
  /** The budget month's anchor: the recorded `active_at`, else the beat's, else now. */
26
26
  export declare const budgetMonthOf: (beat: Beat, recordedActiveAt?: ActiveAt, now?: Date) => Date;
@@ -30,7 +30,7 @@ export declare const budgetMonthRange: (beat: Beat, recordedActiveAt?: ActiveAt)
30
30
  start: Date;
31
31
  end: Date;
32
32
  };
33
- /** The budget month and category (own or top-level) or merchant; none without either, so no rows. */
33
+ /** The budget month and category (own or top-level) or merchant none without either, so no rows. */
34
34
  export declare const budgetTransactionFilter: (facts: BudgetFacts, dateRange: {
35
35
  start: Date;
36
36
  end: Date;
@@ -38,7 +38,7 @@ export declare const budgetTransactionFilter: (facts: BudgetFacts, dateRange: {
38
38
  export interface BudgetDetailsLayout {
39
39
  /** The "N days until the end of the month" / previous-month notice under the summary. */
40
40
  showPeriodLine: boolean;
41
- /** The subject of the drawer's "{subject} Budget" title; the card's subtitle never names it. */
41
+ /** The subject of the drawer's "{subject} Budget" title the card's subtitle never names it. */
42
42
  subject: BudgetSubject;
43
43
  }
44
44
  export declare const resolveBudgetDetailsLayout: (variant: string | null | undefined) => BudgetDetailsLayout;
@@ -2,12 +2,12 @@ import { buildDynamicCopy as _ } from "../../../core/utils/Localization.es.js";
2
2
  import { BEAT_ACTIVE_AT_KEY as m } from "../../../core/stores/InsightsV2Store.es.js";
3
3
  import { resolveVariantConfig as l } from "../../blocks/resolveVariantConfig.es.js";
4
4
  import { asNonEmptyText as u, asNumber as d } from "../../blocks/slotReaders.es.js";
5
- import { endOfMonth as n } from "date-fns/endOfMonth";
5
+ import { endOfMonth as o } from "date-fns/endOfMonth";
6
6
  import { startOfMonth as c } from "date-fns/startOfMonth";
7
7
  import { differenceInCalendarDays as v } from "date-fns/differenceInCalendarDays";
8
8
  var T = {
9
- LOW: "success.light",
10
- MEDIUM: "warning.light",
9
+ LOW: "success.main",
10
+ MEDIUM: "warning.main",
11
11
  HIGH: "warning.main",
12
12
  OFF_TRACK: "error.main"
13
13
  }, f = "success.main", M = (t, e) => Math.ceil((e ? t / e : 0) * 100), N = (t) => {
@@ -26,7 +26,7 @@ var T = {
26
26
  }, i = (t, e) => {
27
27
  const { categoryGuid: r } = y(t);
28
28
  return (r ? e.categories?.default_categories?.[r] : void 0)?.replace(/&amp;/g, "&");
29
- }, o = {
29
+ }, n = {
30
30
  CATEGORY_SPEND: "category_spend",
31
31
  CATEGORY_BUDGET: "category_budget",
32
32
  MERCHANT_BUDGET: "merchant_budget"
@@ -34,18 +34,18 @@ var T = {
34
34
  if (t == null || t === "") return;
35
35
  const e = new Date(typeof t == "number" ? t * 1e3 : t);
36
36
  return Number.isNaN(e.getTime()) ? void 0 : e;
37
- }, h = (t) => t.active_at ?? t.insights_payload?.active_at, U = (t, e) => t.beatContext[e.guid]?.[m], g = (t, e, r = /* @__PURE__ */ new Date()) => s(e) ?? s(h(t)) ?? r, F = (t, e = /* @__PURE__ */ new Date(), r) => {
37
+ }, E = (t) => t.active_at ?? t.insights_payload?.active_at, U = (t, e) => t.beatContext[e.guid]?.[m], g = (t, e, r = /* @__PURE__ */ new Date()) => s(e) ?? s(E(t)) ?? r, F = (t, e = /* @__PURE__ */ new Date(), r) => {
38
38
  const a = g(t, r, e);
39
- if (!(n(a) < c(e)))
40
- return v(n(e), e) + 1;
39
+ if (!(o(a) < c(e)))
40
+ return v(o(e), e) + 1;
41
41
  }, P = (t, e) => {
42
42
  const r = g(t, e);
43
43
  return {
44
44
  start: c(r),
45
- end: n(r)
45
+ end: o(r)
46
46
  };
47
- }, E = (t) => (e) => e.category_guid === t || e.top_level_category_guid === t, A = (t) => (e) => e.merchant_guid === t, j = (t, e) => {
48
- const r = t.categoryGuid ? E(t.categoryGuid) : t.merchantGuid ? A(t.merchantGuid) : void 0;
47
+ }, h = (t) => (e) => e.category_guid === t || e.top_level_category_guid === t, A = (t) => (e) => e.merchant_guid === t, j = (t, e) => {
48
+ const r = t.categoryGuid ? h(t.categoryGuid) : t.merchantGuid ? A(t.merchantGuid) : void 0;
49
49
  return r && {
50
50
  custom: r,
51
51
  dateRange: e
@@ -55,15 +55,15 @@ var T = {
55
55
  showPeriodLine: !0,
56
56
  subject: i
57
57
  },
58
- [o.CATEGORY_SPEND]: {
58
+ [n.CATEGORY_SPEND]: {
59
59
  showPeriodLine: !1,
60
60
  subject: i
61
61
  },
62
- [o.CATEGORY_BUDGET]: {
62
+ [n.CATEGORY_BUDGET]: {
63
63
  showPeriodLine: !1,
64
64
  subject: i
65
65
  },
66
- [o.MERCHANT_BUDGET]: {
66
+ [n.MERCHANT_BUDGET]: {
67
67
  showPeriodLine: !1,
68
68
  subject: i
69
69
  }
@@ -78,7 +78,7 @@ export {
78
78
  T as BUDGET_TIER_COLORS,
79
79
  f as DEFAULT_TIER_COLOR,
80
80
  s as activeAtDate,
81
- h as beatActiveAt,
81
+ E as beatActiveAt,
82
82
  g as budgetMonthOf,
83
83
  P as budgetMonthRange,
84
84
  j as budgetTransactionFilter,
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat, GlobalCopy, Transaction } from '../../../core'\nimport { BEAT_ACTIVE_AT_KEY, type InsightsV2Store } from '../../../core/stores/InsightsV2Store'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\nexport const resolveBudgetFacts = (beat: Beat): BudgetFacts => {\n const payload = beat.insights_payload\n const data = (payload?.instance_slot?.data ?? payload?.instance_slot_data ?? {}) as Record<\n string,\n unknown\n >\n\n return {\n categoryGuid:\n asNonEmptyText(data.category_guid) ??\n payload?.primary_category_guid ??\n beat.primary_category_guid ??\n undefined,\n merchantGuid:\n asNonEmptyText(data.merchant_guid) ??\n payload?.primary_merchant_guid ??\n beat.primary_merchant_guid ??\n undefined,\n spent: asNumber(data.spent_amount),\n budgeted: asNumber(data.budgeted_amount),\n }\n}\n\ntype BudgetSubject = (beat: Beat, copy: GlobalCopy) => string | undefined\n\nconst categoryName: BudgetSubject = (beat, copy) => {\n const { categoryGuid } = resolveBudgetFacts(beat)\n const name = categoryGuid ? copy.categories?.default_categories?.[categoryGuid] : undefined\n\n return name?.replace(/&amp;/g, '&')\n}\n\n/** The CTA variants `budget_details_block` serves (ditto names one on each beat's CTA). */\nconst BUDGET_DETAILS_VARIANTS = {\n CATEGORY_SPEND: 'category_spend',\n CATEGORY_BUDGET: 'category_budget',\n MERCHANT_BUDGET: 'merchant_budget',\n} as const\n\ntype ActiveAt = Beat['active_at'] | number | null | undefined\n\n/** A beat's `active_at` (epoch seconds or ISO) as a date; undefined when absent or invalid. */\nexport const activeAtDate = (raw: ActiveAt): Date | undefined => {\n if (raw == null || raw === '') return undefined\n const at = new Date(typeof raw === 'number' ? raw * 1000 : raw)\n\n return Number.isNaN(at.getTime()) ? undefined : at\n}\n\n/** The beat's own `active_at`: on the beat, else on its envelope. */\nexport const beatActiveAt = (beat: Beat): ActiveAt =>\n beat.active_at ?? beat.insights_payload?.active_at\n\n/** The `active_at` the card recorded on render; a sampled beat is re-read without it after a CTA. */\nexport const recordedActiveAtOf = (\n store: Pick<InsightsV2Store, 'beatContext'>,\n beat: Beat,\n): ActiveAt => store.beatContext[beat.guid]?.[BEAT_ACTIVE_AT_KEY] as ActiveAt\n\n/** The budget month's anchor: the recorded `active_at`, else the beat's, else now. */\nexport const budgetMonthOf = (beat: Beat, recordedActiveAt?: ActiveAt, now = new Date()) =>\n activeAtDate(recordedActiveAt) ?? activeAtDate(beatActiveAt(beat)) ?? now\n\nexport const daysLeftInBudgetMonth = (\n beat: Beat,\n now = new Date(),\n recordedActiveAt?: ActiveAt,\n) => {\n const activeAt = budgetMonthOf(beat, recordedActiveAt, now)\n if (endOfMonth(activeAt) < startOfMonth(now)) return undefined\n\n return differenceInCalendarDays(endOfMonth(now), now) + 1\n}\n\n/** The month a budget drawer shows (see budgetMonthOf). */\nexport const budgetMonthRange = (beat: Beat, recordedActiveAt?: ActiveAt) => {\n const month = budgetMonthOf(beat, recordedActiveAt)\n\n return { start: startOfMonth(month), end: endOfMonth(month) }\n}\n\nconst inCategory = (categoryGuid: string) => (transaction: Transaction) =>\n transaction.category_guid === categoryGuid || transaction.top_level_category_guid === categoryGuid\n\nconst atMerchant = (merchantGuid: string) => (transaction: Transaction) =>\n transaction.merchant_guid === merchantGuid\n\n/** The budget month and category (own or top-level) or merchant; none without either, so no rows. */\nexport const budgetTransactionFilter = (\n facts: BudgetFacts,\n dateRange: { start: Date; end: Date },\n): TransactionFilter | undefined => {\n const custom = facts.categoryGuid\n ? inCategory(facts.categoryGuid)\n : facts.merchantGuid\n ? atMerchant(facts.merchantGuid)\n : undefined\n\n return custom && { custom, dateRange }\n}\n\nexport interface BudgetDetailsLayout {\n /** The \"N days until the end of the month\" / previous-month notice under the summary. */\n showPeriodLine: boolean\n /** The subject of the drawer's \"{subject} Budget\" title; the card's subtitle never names it. */\n subject: BudgetSubject\n}\n\n// Figma's Budget Details for these three insights has no period line; any other caller keeps it.\n// merchant_budget will name the merchant once Merchant Budget moves to Insights 2.0.\nconst LAYOUT: Record<string, BudgetDetailsLayout> = {\n default: { showPeriodLine: true, subject: categoryName },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_SPEND]: { showPeriodLine: false, subject: categoryName },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_BUDGET]: { showPeriodLine: false, subject: categoryName },\n [BUDGET_DETAILS_VARIANTS.MERCHANT_BUDGET]: { showPeriodLine: false, subject: categoryName },\n}\n\nexport const resolveBudgetDetailsLayout = (variant: string | null | undefined) =>\n resolveVariantConfig(LAYOUT, variant, 'default', 'BudgetDetailsBlock')\n\n/** \"{subject} Budget\" when the variant names a subject, else the card's title. */\nexport const getBudgetDetailsDrawerTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n beat?: Beat,\n): string => {\n const subject = beat && resolveBudgetDetailsLayout(variant).subject(beat, copy)\n if (subject && copy.budgets?.details_type_title) {\n return buildDynamicCopy(copy.budgets.details_type_title, subject) as string\n }\n\n return beat?.insights_payload?.title || copy.budgets?.details_title || ''\n}\n\n/** A budget amount the dialogs accept: a finite number above zero. */\nexport const isPositiveAmount = (value: string): boolean => {\n const amount = Number(value)\n return value.trim() !== '' && Number.isFinite(amount) && amount > 0\n}\n"],"mappings":";;;;;;;AAaA,IAAa,IAAiD;AAAA,EAC5D,KAA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AAoB,GAG1D,IAAA,CACX,GACA,GACA,MACW;AACX,QAAM,IAAU,KAAQ,EAA2B,CAAO,EAAE,QAAQ,GAAM,CAAI;AAC9E,SAAI,KAAW,EAAK,SAAS,qBACpB,EAAiB,EAAK,QAAQ,oBAAoB,CAAO,IAG3D,GAAM,kBAAkB,SAAS,EAAK,SAAS,iBAAiB;AACzE,GAGa,IAAA,CAAoB,MAA2B;AAC1D,QAAM,IAAS,OAAO,CAAK;AAC3B,SAAO,EAAM,KAAK,MAAM,MAAM,OAAO,SAAS,CAAM,KAAK,IAAS;AACpE"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat, GlobalCopy, Transaction } from '../../../core'\nimport { BEAT_ACTIVE_AT_KEY, type InsightsV2Store } from '../../../core/stores/InsightsV2Store'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.main',\n MEDIUM: 'warning.main',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\nexport const resolveBudgetFacts = (beat: Beat): BudgetFacts => {\n const payload = beat.insights_payload\n const data = (payload?.instance_slot?.data ?? payload?.instance_slot_data ?? {}) as Record<\n string,\n unknown\n >\n\n return {\n categoryGuid:\n asNonEmptyText(data.category_guid) ??\n payload?.primary_category_guid ??\n beat.primary_category_guid ??\n undefined,\n merchantGuid:\n asNonEmptyText(data.merchant_guid) ??\n payload?.primary_merchant_guid ??\n beat.primary_merchant_guid ??\n undefined,\n spent: asNumber(data.spent_amount),\n budgeted: asNumber(data.budgeted_amount),\n }\n}\n\ntype BudgetSubject = (beat: Beat, copy: GlobalCopy) => string | undefined\n\nconst categoryName: BudgetSubject = (beat, copy) => {\n const { categoryGuid } = resolveBudgetFacts(beat)\n const name = categoryGuid ? copy.categories?.default_categories?.[categoryGuid] : undefined\n\n return name?.replace(/&amp;/g, '&')\n}\n\n/** The CTA variants `budget_details_block` serves (ditto names one on each beat's CTA). */\nconst BUDGET_DETAILS_VARIANTS = {\n CATEGORY_SPEND: 'category_spend',\n CATEGORY_BUDGET: 'category_budget',\n MERCHANT_BUDGET: 'merchant_budget',\n} as const\n\ntype ActiveAt = Beat['active_at'] | number | null | undefined\n\n/** A beat's `active_at` (epoch seconds or ISO) as a date undefined when absent or invalid. */\nexport const activeAtDate = (raw: ActiveAt): Date | undefined => {\n if (raw == null || raw === '') return undefined\n const at = new Date(typeof raw === 'number' ? raw * 1000 : raw)\n\n return Number.isNaN(at.getTime()) ? undefined : at\n}\n\n/** The beat's own `active_at`: on the beat, else on its envelope. */\nexport const beatActiveAt = (beat: Beat): ActiveAt =>\n beat.active_at ?? beat.insights_payload?.active_at\n\n/** The `active_at` the card recorded on render a sampled beat is re-read without it after a CTA. */\nexport const recordedActiveAtOf = (\n store: Pick<InsightsV2Store, 'beatContext'>,\n beat: Beat,\n): ActiveAt => store.beatContext[beat.guid]?.[BEAT_ACTIVE_AT_KEY] as ActiveAt\n\n/** The budget month's anchor: the recorded `active_at`, else the beat's, else now. */\nexport const budgetMonthOf = (beat: Beat, recordedActiveAt?: ActiveAt, now = new Date()) =>\n activeAtDate(recordedActiveAt) ?? activeAtDate(beatActiveAt(beat)) ?? now\n\nexport const daysLeftInBudgetMonth = (\n beat: Beat,\n now = new Date(),\n recordedActiveAt?: ActiveAt,\n) => {\n const activeAt = budgetMonthOf(beat, recordedActiveAt, now)\n if (endOfMonth(activeAt) < startOfMonth(now)) return undefined\n\n return differenceInCalendarDays(endOfMonth(now), now) + 1\n}\n\n/** The month a budget drawer shows (see budgetMonthOf). */\nexport const budgetMonthRange = (beat: Beat, recordedActiveAt?: ActiveAt) => {\n const month = budgetMonthOf(beat, recordedActiveAt)\n\n return { start: startOfMonth(month), end: endOfMonth(month) }\n}\n\nconst inCategory = (categoryGuid: string) => (transaction: Transaction) =>\n transaction.category_guid === categoryGuid || transaction.top_level_category_guid === categoryGuid\n\nconst atMerchant = (merchantGuid: string) => (transaction: Transaction) =>\n transaction.merchant_guid === merchantGuid\n\n/** The budget month and category (own or top-level) or merchant none without either, so no rows. */\nexport const budgetTransactionFilter = (\n facts: BudgetFacts,\n dateRange: { start: Date; end: Date },\n): TransactionFilter | undefined => {\n const custom = facts.categoryGuid\n ? inCategory(facts.categoryGuid)\n : facts.merchantGuid\n ? atMerchant(facts.merchantGuid)\n : undefined\n\n return custom && { custom, dateRange }\n}\n\nexport interface BudgetDetailsLayout {\n /** The \"N days until the end of the month\" / previous-month notice under the summary. */\n showPeriodLine: boolean\n /** The subject of the drawer's \"{subject} Budget\" title the card's subtitle never names it. */\n subject: BudgetSubject\n}\n\n// Figma's Budget Details for these three insights has no period line any other caller keeps it.\n// merchant_budget will name the merchant once Merchant Budget moves to Insights 2.0.\nconst LAYOUT: Record<string, BudgetDetailsLayout> = {\n default: { showPeriodLine: true, subject: categoryName },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_SPEND]: {\n showPeriodLine: false,\n subject: categoryName,\n },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_BUDGET]: {\n showPeriodLine: false,\n subject: categoryName,\n },\n [BUDGET_DETAILS_VARIANTS.MERCHANT_BUDGET]: {\n showPeriodLine: false,\n subject: categoryName,\n },\n}\n\nexport const resolveBudgetDetailsLayout = (variant: string | null | undefined) =>\n resolveVariantConfig(LAYOUT, variant, 'default', 'BudgetDetailsBlock')\n\n/** \"{subject} Budget\" when the variant names a subject, else the card's title. */\nexport const getBudgetDetailsDrawerTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n beat?: Beat,\n): string => {\n const subject = beat && resolveBudgetDetailsLayout(variant).subject(beat, copy)\n if (subject && copy.budgets?.details_type_title) {\n return buildDynamicCopy(copy.budgets.details_type_title, subject) as string\n }\n\n return beat?.insights_payload?.title || copy.budgets?.details_title || ''\n}\n\n/** A budget amount the dialogs accept: a finite number above zero. */\nexport const isPositiveAmount = (value: string): boolean => {\n const amount = Number(value)\n return value.trim() !== '' && Number.isFinite(amount) && amount > 0\n}\n"],"mappings":";;;;;;;AAaA,IAAa,IAAiD;AAAA,EAC5D,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AACb,GAEa,IAAqB,gBAErB,IAAA,CAA0B,GAAe,MACpD,KAAK,MAAM,IAAQ,IAAQ,IAAQ,KAAK,GAAG,GAEhC,IAAA,CAAuB,MAA4C;AAC9E,MAAI,IAAU,IAAK,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAG5B,GAEa,IAAA,CAAa,MACxB,IAAO,EAAmB,CAAA,IAAQ,GASvB,IAAA,CAAsB,MAA4B;AAC7D,QAAM,IAAU,EAAK,kBACf,IAAQ,GAAS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} from "../../../core/utils/DateUtil.es.js";
6
6
  import { CURRENCY_FORMAT as z } from "../../../core/utils/NumberFormatting.es.js";
7
7
  import { getCategoryColor as W } from "../../../core/utils/CategoryUtil.es.js";
8
- import { buildDataSeries as D } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
9
- import { asGuidList as E, asNonEmptyText as _, asNumber as l } from "../../blocks/slotReaders.es.js";
8
+ import { buildDataSeries as E } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
9
+ import { asGuidList as D, asNonEmptyText as _, asNumber as l } from "../../blocks/slotReaders.es.js";
10
10
  import { getLayoutConfig as O } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
11
11
  import H from "../../components/LogoMark.es.js";
12
12
  import { calendarDateOf as j, toDrillDownSlotData as M } from "./utils.es.js";
@@ -53,7 +53,7 @@ var i = {
53
53
  }, X = (t) => {
54
54
  const e = t?.drilldown_data ?? {};
55
55
  return {
56
- transaction_guids: E(e.transaction_guids),
56
+ transaction_guids: D(e.transaction_guids),
57
57
  date: j(e.due_date),
58
58
  category_guid: _(e.category_guid),
59
59
  average_amount: l(e.average_amount),
@@ -65,7 +65,7 @@ var i = {
65
65
  }, Z = (t) => {
66
66
  const e = t?.drilldown_data ?? {};
67
67
  return {
68
- account_guids: E(e.account_guids),
68
+ account_guids: D(e.account_guids),
69
69
  data_series: g(e.data_series),
70
70
  average_amount: l(e.average_amount)
71
71
  };
@@ -93,13 +93,13 @@ var i = {
93
93
  return {
94
94
  data_series: g(e.data_series),
95
95
  average_amount: l(e.average_amount),
96
- income_transaction_guids: E(e.income_transaction_guids),
96
+ income_transaction_guids: D(e.income_transaction_guids),
97
97
  sub_tab_labels: a?.length === K.length ? a : void 0
98
98
  };
99
99
  }, at = (t, e) => {
100
100
  const a = e ?? {}, r = g(a.series);
101
101
  if (!r) return M(t?.instance_slot?.data ?? {});
102
- const o = D(r).map((s) => l(s.amount)).filter((s) => s !== void 0), n = o.length ? o.reduce((s, m) => s + m, 0) / o.length : void 0;
102
+ const o = E(r).map((s) => l(s.amount)).filter((s) => s !== void 0), n = o.length ? o.reduce((s, m) => s + m, 0) / o.length : void 0;
103
103
  return M({
104
104
  category_guid: _(a.category_guid),
105
105
  series: r,
@@ -121,7 +121,7 @@ var i = {
121
121
  value: 0
122
122
  }))
123
123
  };
124
- }, A = (t, e) => D(g(e?.series)).flatMap((a) => a.aggregated_guids ?? []), nt = (t, e) => {
124
+ }, A = (t, e) => E(g(e?.series)).flatMap((a) => a.aggregated_guids ?? []), nt = (t, e) => {
125
125
  const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, r = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
126
126
  if (!(!a || !r))
127
127
  return {
@@ -135,7 +135,11 @@ var i = {
135
135
  const a = e.transaction_history_block?.savings_to_income_tip_message, r = e.transaction_history_block?.savings_to_income_tip_percentage;
136
136
  if (!(!a || !r))
137
137
  return { message: d(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: r })) };
138
- }, ct = (t) => D(g(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), _t = (t, e, a, r) => {
138
+ }, ct = (t, e) => {
139
+ const a = e.transaction_history_block?.non_essential_tip_message;
140
+ if (a)
141
+ return { message: d(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title })) };
142
+ }, _t = (t) => E(g(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), dt = (t, e, a, r) => {
139
143
  const o = r?.merchant_name, n = r?.date;
140
144
  if (!o || !n) return;
141
145
  const s = e.transaction_history_block?.upcoming_bill_tip_message;
@@ -148,13 +152,13 @@ var i = {
148
152
  dateRange: b(r?.date),
149
153
  showSplits: !n
150
154
  };
151
- }, dt = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
155
+ }, lt = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
152
156
  const r = t[e], o = a.category_guid ?? r?.guid;
153
157
  return {
154
158
  custom: (n) => n.category_guid === o || n.top_level_category_guid === o,
155
159
  dateRange: b(r?.date)
156
160
  };
157
- }, lt = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: r }) => {
161
+ }, gt = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: r }) => {
158
162
  const o = t[e];
159
163
  return {
160
164
  custom: (n) => !!n.top_level_category_guid && a.includes(n.top_level_category_guid),
@@ -173,8 +177,8 @@ var i = {
173
177
  end: I(o)
174
178
  }
175
179
  };
176
- }, gt = (t) => typeof t == "number" ? q(t) : S(t ?? ""), mt = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
177
- const n = e[a], { start: s, end: m } = b(n?.date), p = gt(t.created_at), y = o.account_guids, G = {
180
+ }, mt = (t) => typeof t == "number" ? q(t) : S(t ?? ""), ut = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
181
+ const n = e[a], { start: s, end: m } = b(n?.date), p = mt(t.created_at), y = o.account_guids, G = {
178
182
  start: s,
179
183
  end: r && L(p) && p < m ? p : m
180
184
  };
@@ -199,13 +203,13 @@ var i = {
199
203
  },
200
204
  ...F(a)
201
205
  };
202
- }, ut = ({ beat: t, dataSeries: e, selectedIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), f = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
206
+ }, pt = ({ beat: t, dataSeries: e, selectedIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), f = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
203
207
  const o = e[a];
204
208
  return N(r === 1 ? o?.comparisonGuids : o?.mainGuids, o?.date, t.account_guids);
205
- }, pt = ({ beat: t, dataSeries: e, subIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), ht = (t) => {
209
+ }, ht = ({ beat: t, dataSeries: e, subIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), St = (t) => {
206
210
  const { dataSeries: e, selectedIndex: a, subIndex: r, instanceSlotData: o } = t, n = e[a], s = new Set(o.income_transaction_guids), m = K[r] === "income", p = o.sub_tab_labels ? n?.aggregated_guids?.filter((y) => s.has(y) === m) : n?.aggregated_guids;
207
211
  return N(p, n?.date);
208
- }, Rt = {
212
+ }, Bt = {
209
213
  [i.TRANSACTION]: {
210
214
  title: k,
211
215
  top: "singleBar",
@@ -238,7 +242,7 @@ var i = {
238
242
  slotData: at,
239
243
  fetchMissingTransactions: A,
240
244
  tipSection: rt,
241
- filterStrategy: dt,
245
+ filterStrategy: lt,
242
246
  scope: "store",
243
247
  filterMode: "store",
244
248
  colors: (t, e) => [J(t, e)],
@@ -260,7 +264,7 @@ var i = {
260
264
  },
261
265
  [i.MONTHLY_SPEND]: {
262
266
  top: "singleBar",
263
- filterStrategy: lt,
267
+ filterStrategy: gt,
264
268
  scope: "store",
265
269
  filterMode: "store",
266
270
  colors: (t) => [t.palette.chart.chart2 ?? t.palette.primary.main]
@@ -268,7 +272,7 @@ var i = {
268
272
  [i.ACCOUNT_BALANCE]: {
269
273
  title: (t, e) => e?.insights_payload?.title || void 0,
270
274
  top: "singleBar",
271
- filterStrategy: mt,
275
+ filterStrategy: ut,
272
276
  slotData: Z,
273
277
  scope: "store",
274
278
  filterMode: "store",
@@ -282,16 +286,16 @@ var i = {
282
286
  colors: (t, e) => [u(t, e)],
283
287
  slotData: X,
284
288
  fetchMissingTransactions: (t) => t.insights_payload?.drilldown_data?.transaction_guids,
285
- tipSection: _t
289
+ tipSection: dt
286
290
  },
287
291
  [i.DEPOSIT_SUMMARY]: {
288
292
  top: "singleBar",
289
- filterStrategy: ht,
293
+ filterStrategy: St,
290
294
  scope: "store",
291
295
  filterMode: "store",
292
296
  colors: (t) => [t.palette.success.main],
293
297
  slotData: et,
294
- fetchMissingTransactions: ct,
298
+ fetchMissingTransactions: _t,
295
299
  subTabs: ({ instanceSlotData: t }) => t.sub_tab_labels ?? [],
296
300
  barLegendLabel: (t) => t.general.deposit,
297
301
  showMonthlyAmount: !1
@@ -305,7 +309,7 @@ var i = {
305
309
  },
306
310
  [i.SUBSCRIPTION_AGGREGATE]: {
307
311
  top: "monthTabs",
308
- filterStrategy: ut,
312
+ filterStrategy: pt,
309
313
  scope: "store",
310
314
  filterMode: "store",
311
315
  colors: (t) => [t.palette.primary.main]
@@ -396,12 +400,13 @@ var i = {
396
400
  },
397
401
  [i.NON_ESSENTIAL_CATEGORY]: {
398
402
  top: "tabsOnly",
399
- filterStrategy: pt,
403
+ filterStrategy: ht,
404
+ tipSection: ct,
400
405
  scope: "store",
401
406
  filterMode: "store",
402
407
  colors: (t) => [t.palette.primary.main]
403
408
  }
404
- }, Bt = {
409
+ }, Gt = {
405
410
  top: "singleBar",
406
411
  filterStrategy: C,
407
412
  scope: "store",
@@ -410,8 +415,8 @@ var i = {
410
415
  };
411
416
  export {
412
417
  i as DRILLDOWN_VARIANTS,
413
- Bt as FALLBACK,
414
- Rt as layout,
418
+ Gt as FALLBACK,
419
+ Bt as layout,
415
420
  at as resolveCategorySpendSlotData,
416
421
  V as resolveDebtToIncomeSlotData,
417
422
  et as resolveDepositSummarySlotData,