@mx-cartographer/experiences 9.7.73 → 9.7.75

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 (38) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/core/types/Insights.d.ts +2 -7
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/insights/components/shared/ChartDrawerTemplate/TipSection.d.ts +7 -1
  5. package/dist/insights/components/shared/ChartDrawerTemplate/TipSection.es.js +23 -19
  6. package/dist/insights/components/shared/ChartDrawerTemplate/TipSection.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +37 -37
  8. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +10 -0
  10. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +12 -7
  11. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +2 -1
  13. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +72 -56
  14. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +56 -55
  16. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +1 -0
  18. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +16 -15
  19. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  20. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +1 -1
  21. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
  22. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +11 -12
  23. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  24. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.d.ts +7 -14
  25. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +11 -27
  26. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
  27. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +4 -4
  28. package/dist/insights-v2/components/SavingsOpportunityCard.es.js +6 -4
  29. package/dist/insights-v2/components/SavingsOpportunityCard.es.js.map +1 -1
  30. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  31. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  32. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  33. package/dist/insights-v2/mappings/blocks.es.js +69 -64
  34. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.d.ts +0 -18
  37. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js +0 -13
  38. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js.map +0 -1
@@ -23,7 +23,7 @@ var n = {
23
23
  DEPOSIT_SUMMARY: "monthly_deposit_summary",
24
24
  LOW_BALANCE: "low_balance",
25
25
  SUBSCRIPTION_AGGREGATE: "monthly_subscription_aggregate"
26
- }, g = (t, e) => e && b(e, t) || t.palette.primary.main, u = (t) => typeof t == "string" ? l(t) : new Date(t ?? NaN), _ = (t) => ({
26
+ }, g = (t, e) => e && b(e, t) || t.palette.primary.main, u = (t) => typeof t == "string" ? l(t) : new Date(t ?? NaN), d = (t) => ({
27
27
  start: I(u(t)),
28
28
  end: C(u(t))
29
29
  }), p = (t) => t?.length ? { accounts: t } : {}, w = ({ beat: t }) => {
@@ -40,7 +40,7 @@ var n = {
40
40
  end: S(a - 1)
41
41
  }
42
42
  };
43
- }, Y = (t) => {
43
+ }, H = (t) => {
44
44
  const e = t?.drilldown_data ?? {};
45
45
  return {
46
46
  transaction_guids: B(e.transaction_guids),
@@ -50,10 +50,10 @@ var n = {
50
50
  average_amount: N(e.average_amount),
51
51
  merchant_name: T(e.merchant_name)
52
52
  };
53
- }, F = (t, e) => {
53
+ }, Y = (t, e) => {
54
54
  const o = D(t, e);
55
55
  return o ? [...t, o] : t;
56
- }, H = (t, e, o, a) => {
56
+ }, F = (t, e, o, a) => {
57
57
  const r = a?.merchant_name, i = a?.date;
58
58
  if (!r || !i) return;
59
59
  const s = e.transaction_history_block?.upcoming_bill_tip_message;
@@ -66,28 +66,28 @@ var n = {
66
66
  const a = e[o], r = a?.guid, i = t.find((s) => s.guid === r)?.has_been_split;
67
67
  return {
68
68
  custom: (s) => s.guid === r,
69
- dateRange: _(a?.date),
69
+ dateRange: d(a?.date),
70
70
  showSplits: !i
71
71
  };
72
72
  }, V = ({ dataSeries: t, selectedIndex: e, instanceSlotData: o }) => {
73
73
  const a = t[e], r = o.category_guid ?? a?.guid;
74
74
  return {
75
75
  custom: (i) => i.category_guid === r || i.top_level_category_guid === r,
76
- dateRange: _(a?.date)
76
+ dateRange: d(a?.date)
77
77
  };
78
78
  }, W = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: o, instanceSlotData: a }) => {
79
79
  const r = t[e];
80
80
  return {
81
81
  custom: (i) => !!i.top_level_category_guid && o.includes(i.top_level_category_guid),
82
- dateRange: _(r?.date),
82
+ dateRange: d(r?.date),
83
83
  ...p(a.account_guids)
84
84
  };
85
85
  }, x = (t) => typeof t == "number" ? U(t) : l(t ?? ""), j = ({ beat: t, dataSeries: e, selectedIndex: o, isLastTab: a, instanceSlotData: r }) => {
86
- const i = e[o], { start: s, end: f } = _(i?.date), d = x(t.created_at);
86
+ const i = e[o], { start: s, end: f } = d(i?.date), _ = x(t.created_at);
87
87
  return {
88
88
  dateRange: {
89
89
  start: s,
90
- end: a && E(d) && d < f ? d : f
90
+ end: a && E(_) && _ < f ? _ : f
91
91
  },
92
92
  ...p(t.account_guids?.length ? t.account_guids : r.account_guids)
93
93
  };
@@ -167,17 +167,18 @@ var n = {
167
167
  scope: "beat",
168
168
  filterMode: "local",
169
169
  colors: (t, e) => [g(t, e)],
170
- slotData: Y,
171
- beatTransactions: F,
170
+ slotData: H,
171
+ beatTransactions: Y,
172
172
  fetchMissingTransactions: (t) => t.insights_payload?.drilldown_data?.transaction_guids,
173
- tipSection: H
173
+ tipSection: F
174
174
  },
175
175
  [n.LOW_BALANCE]: {
176
176
  top: "list",
177
177
  filterStrategy: w,
178
178
  scope: "store",
179
179
  filterMode: "store",
180
- colors: (t) => [t.palette.primary.main]
180
+ colors: (t) => [t.palette.primary.main],
181
+ hideListHeader: !0
181
182
  },
182
183
  [n.SUBSCRIPTION_AGGREGATE]: {
183
184
  top: "monthTabs",
@@ -220,8 +221,8 @@ export {
220
221
  n as DRILLDOWN_VARIANTS,
221
222
  it as FALLBACK,
222
223
  at as layout,
223
- Y as resolveUpcomingBillSlotData,
224
- F as resolveUpcomingBillTransactions
224
+ H as resolveUpcomingBillSlotData,
225
+ Y as resolveUpcomingBillTransactions
225
226
  };
226
227
 
227
228
  //# 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 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 type { ChartDataSeriesItem } 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: 'monthly_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/**\n * One row of the flattened data_series a filterStrategy indexes into: a single-bar monthly total or a\n * synthesized upcoming-bill bar. Fields are optional because the backend keys each row dynamically\n * from data_series.names and not every variant carries a guid/category. Double-bar comparison rows\n * will extend this in the next MR.\n */\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: InsightsInstanceSlotData\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\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 // 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. Absent: nothing is fetched.\n fetchMissingTransactions?: (beat: Beat) => 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}\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// 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// SavingsAccountBalancesSummary — balances, not categorized spend: the beat's account within the\n// month. Bars are snapshots, so the most recent month ends at the beat's creation (the partial month\n// its balance was taken in); an older month, or a beat created after its last month ended, keeps the\n// whole month.\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\n return {\n dateRange: {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n },\n ...accountScope(\n beat.account_guids?.length ? beat.account_guids : instanceSlotData.account_guids,\n ),\n }\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\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 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 icon: <Icon 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 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 // 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 },\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 // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n // [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: comparison('debtVsIncome'),\n\n // ── Tabs-only beats (no chart; one side tab per series row) ─────────────────────────────────\n // Monthly Non-Essential Category Summary: the donut card's \"View more\" lists one month's spend by\n // side, Non-essential / Essential, each side its own aggregated_guids. The tabs are labelled by\n // the rows' pre-localized labels, in wire order; 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 // NEXT MR — [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY] (WEC-2097, MR !1756).\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":";;;;;;;;;;;AAgDA,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,GAmEM,I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gB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,CAAC,EAAM,QAAQ,QAAQ,IAAI;AAAA,EACvD;AAAA,EAIC,CAAA,EAAmB,eAAA,GAAkB;AAAA,IACpC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,EAAyB,GAAO,iBAAiB,GAAG,SAAS,CAAC;AAAA,IACxF,kBAAA,CAAmB,MAAS,CAAC,EAAK,QAAQ,oBAAoB,EAAK,QAAQ,mBAAmB;AAAA,EAChG;AAAA,EAGC,CAAA,EAAmB,cAAA,GAAiB;AAAA,IACnC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,GAAc,MAA0B,CAC/C,EAAc,GAAO,CAAY,GACjC,EAAM,QAAQ,MAAM,UAAU,EAAM,QAAQ,QAAQ,IACtD;AAAA,IACA,kBAAA,CAAmB,MAAS,CAAC,QAAW,EAAK,QAAQ,mBAAmB;AAAA,EAC1E;AAAA,EASC,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;AAEF,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 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 type { ChartDataSeriesItem } 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: 'monthly_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/**\n * One row of the flattened data_series a filterStrategy indexes into: a single-bar monthly total or a\n * synthesized upcoming-bill bar. Fields are optional because the backend keys each row dynamically\n * from data_series.names and not every variant carries a guid/category. Double-bar comparison rows\n * will extend this in the next MR.\n */\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: InsightsInstanceSlotData\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\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 // 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. Absent: nothing is fetched.\n fetchMissingTransactions?: (beat: Beat) => 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}\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// 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// SavingsAccountBalancesSummary — balances, not categorized spend: the beat's account within the\n// month. Bars are snapshots, so the most recent month ends at the beat's creation (the partial month\n// its balance was taken in); an older month, or a beat created after its last month ended, keeps the\n// whole month.\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\n return {\n dateRange: {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n },\n ...accountScope(\n beat.account_guids?.length ? beat.account_guids : instanceSlotData.account_guids,\n ),\n }\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\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 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 icon: <Icon 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 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 // 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 // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n // [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: comparison('debtVsIncome'),\n\n // ── Tabs-only beats (no chart; one side tab per series row) ─────────────────────────────────\n // Monthly Non-Essential Category Summary: the donut card's \"View more\" lists one month's spend by\n // side, Non-essential / Essential, each side its own aggregated_guids. The tabs are labelled by\n // the rows' pre-localized labels, in wire order; 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 // NEXT MR — [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY] (WEC-2097, MR !1756).\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":";;;;;;;;;;;AAgDA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB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P = O(({ payload: a, beatGuid: n = "" }) => {
25
25
  bottom: 8,
26
26
  left: 16,
27
27
  right: 16,
28
- top: 16
28
+ top: 24
29
29
  },
30
30
  onBarClick: (g) => {
31
31
  if (c !== "full") return !1;
@@ -1 +1 @@
1
- {"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport { formatCurrency, Loader, useGlobalUiStore, useInsightsV2Store } from '../../../../common'\nimport type { DrilldownPayload, InsightsPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../../analytics'\n\nimport { BAR_ARIA_LABEL, barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\ninterface BarchartBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nexport const BarchartBlock = observer(({ payload, beatGuid = '' }: BarchartBlockProps) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, widget_type } = payload\n const {\n series,\n category_guid,\n average_amount = 0,\n additional_data = [],\n } = (instance_slot.data ?? {}) as BarChartBlockData\n const [monthlyAmount, trend] = additional_data\n const chartData = buildChartData(buildDataSeries(series), BAR_ARIA_LABEL)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, category_guid, theme)\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmount?.label ?? ''}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n top: 16,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.CHART_BAR_CLICKED)\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trend?.label ?? ''}\n />\n ) : (\n <EmptyBarChart />\n )\n})\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAa,IAAgB,EAAA,CAAU,EAAE,SAAA,GAAS,UAAA,IAAW,GAAA,MAA6B;AACxF,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,eAAA,GAAe,aAAA,EAAA,IAAgB,GACjC,EACJ,QAAA,GACA,eAAA,GACA,gBAAA,IAAiB,GACjB,iBAAA,IAAkB,CAAC,EAAA,IAChB,EAAc,QAAQ,CAAC,GACtB,CAAC,GAAe,CAAA,IAAS,GACzB,IAAY,EAAe,EAAgB,CAAM,GAAG,CAAc,GAClE,CAAC,CAAA,IAAoB,EAAM,SAAS,EAAU,SAAS,CAAC,GACxD,EAAE,OAAA,EAAA,IAAU,EAAgB,GAAe,GAAe,CAAK,GAC/D,IAAqB,EAAkB;AAE7C,SAAK,IAIE,EAAU,SACf,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBAAkB,EAAe,GAAgB,KAAK;AAAA,IACxD;AAAA,IACO,OAAA;AAAA,IACP,MAAM;AAAA,IACN,oBAAoB,GAAe,SAAS;AAAA,IAC5C,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,IACA,YAAA,CAAa,MAAU;AACrB,UAAI,MAAgB,OAAQ,QAAO;AAEnC,MAAA,EAAmB,EAAwB,iBAAiB,GAE5D,EAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,eAAe;AAAA,UACf,OAAO,EAAgB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACkB,kBAAA;AAAA,IAClB,kBAAkB,GAAO,SAAS;AAAA,EACnC,CAAA,IAED,gBAAA,EAAC,GAAD,CAAgB,CAAA,IApCT,gBAAA,EAAC,GAAD,CAAS,CAAA;AAsCpB,CAAC"}
1
+ {"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport { formatCurrency, Loader, useGlobalUiStore, useInsightsV2Store } from '../../../../common'\nimport type { DrilldownPayload, InsightsPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../../analytics'\n\nimport { BAR_ARIA_LABEL, barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\ninterface BarchartBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nexport const BarchartBlock = observer(({ payload, beatGuid = '' }: BarchartBlockProps) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, widget_type } = payload\n const {\n series,\n category_guid,\n average_amount = 0,\n additional_data = [],\n } = (instance_slot.data ?? {}) as BarChartBlockData\n const [monthlyAmount, trend] = additional_data\n const chartData = buildChartData(buildDataSeries(series), BAR_ARIA_LABEL)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, category_guid, theme)\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmount?.label ?? ''}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n // Room for the tallest bar's value label, drawn 8px above the bar and about 14px tall.\n top: 24,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.CHART_BAR_CLICKED)\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trend?.label ?? ''}\n />\n ) : (\n <EmptyBarChart />\n )\n})\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAa,IAAgB,EAAA,CAAU,EAAE,SAAA,GAAS,UAAA,IAAW,GAAA,MAA6B;AACxF,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,eAAA,GAAe,aAAA,EAAA,IAAgB,GACjC,EACJ,QAAA,GACA,eAAA,GACA,gBAAA,IAAiB,GACjB,iBAAA,IAAkB,CAAC,EAAA,IAChB,EAAc,QAAQ,CAAC,GACtB,CAAC,GAAe,CAAA,IAAS,GACzB,IAAY,EAAe,EAAgB,CAAM,GAAG,CAAc,GAClE,CAAC,CAAA,IAAoB,EAAM,SAAS,EAAU,SAAS,CAAC,GACxD,EAAE,OAAA,EAAA,IAAU,EAAgB,GAAe,GAAe,CAAK,GAC/D,IAAqB,EAAkB;AAE7C,SAAK,IAIE,EAAU,SACf,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBAAkB,EAAe,GAAgB,KAAK;AAAA,IACxD;AAAA,IACO,OAAA;AAAA,IACP,MAAM;AAAA,IACN,oBAAoB,GAAe,SAAS;AAAA,IAC5C,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MAEP,KAAK;AAAA,IACP;AAAA,IACA,YAAA,CAAa,MAAU;AACrB,UAAI,MAAgB,OAAQ,QAAO;AAEnC,MAAA,EAAmB,EAAwB,iBAAiB,GAE5D,EAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,eAAe;AAAA,UACf,OAAO,EAAgB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACkB,kBAAA;AAAA,IAClB,kBAAkB,GAAO,SAAS;AAAA,EACnC,CAAA,IAED,gBAAA,EAAC,GAAD,CAAgB,CAAA,IArCT,gBAAA,EAAC,GAAD,CAAS,CAAA;AAuCpB,CAAC"}
@@ -19,10 +19,10 @@ import { Icon as z } from "@mxenabled/mx-icons";
19
19
  import { jsx as o, jsxs as r } from "react/jsx-runtime";
20
20
  import { useTheme as X } from "@mui/material/styles";
21
21
  import a from "@mui/material/Box";
22
- var yo = ({ payload: g }) => {
23
- const p = X(), b = U(null), { height: w, width: y } = P(b), { instance_slot: n } = g, { variant: h, institution_guid: D, institution_name: A, icon_name: B, merchant_name: F } = n;
24
- if (q(h)) return /* @__PURE__ */ o(J, { payload: g });
25
- const { data: i } = n, m = i !== void 0, f = d(i, "amount"), u = m ? typeof f == "number" && Number.isFinite(f) ? f : void 0 : n.amount, v = d(i, "sub_text"), R = typeof v == "string" ? v : void 0, T = m ? R : n.sub_text, L = m ? R : n.label, _ = d(i, "header_text"), s = m ? typeof _ == "string" ? _ : void 0 : n.header_text, c = d(i, "logo"), t = W(M(p), h, "default", "AccountBlock");
22
+ var vo = ({ payload: g }) => {
23
+ const h = X(), b = U(null), { height: w, width: v } = P(b), { instance_slot: n } = g, { variant: p, institution_guid: D, institution_name: A, icon_name: B, merchant_name: F } = n;
24
+ if (q(p)) return /* @__PURE__ */ o(J, { payload: g });
25
+ const { data: i } = n, m = i !== void 0, f = d(i, "amount"), u = m ? typeof f == "number" && Number.isFinite(f) ? f : void 0 : n.amount, y = d(i, "sub_text"), R = typeof y == "string" ? y : void 0, T = m ? R : n.sub_text, L = m ? R : n.label, _ = d(i, "header_text"), s = m ? typeof _ == "string" ? _ : void 0 : n.header_text, c = d(i, "logo"), t = W(M(h), p, "default", "AccountBlock");
26
26
  if (t?.isConfetti) {
27
27
  const x = O(c?.guid), V = {
28
28
  paidOffCard: /* @__PURE__ */ o(a, {
@@ -105,13 +105,13 @@ var yo = ({ payload: g }) => {
105
105
  },
106
106
  children: /* @__PURE__ */ o(N, {
107
107
  height: w,
108
- shouldRun: w > 0 && y > 0,
109
- width: y
108
+ shouldRun: w > 0 && v > 0,
109
+ width: v
110
110
  })
111
111
  }), /* @__PURE__ */ r(e, {
112
112
  sx: {
113
113
  borderRadius: "8px",
114
- ...t.cardShadow && { boxShadow: p.shadows[1] },
114
+ ...t.cardShadow && { boxShadow: h.shadows[1] },
115
115
  overflow: "hidden",
116
116
  position: "relative",
117
117
  width: "100%",
@@ -172,7 +172,7 @@ var yo = ({ payload: g }) => {
172
172
  children: /* @__PURE__ */ r(e, {
173
173
  sx: {
174
174
  borderRadius: "8px",
175
- boxShadow: p.shadows[1],
175
+ boxShadow: h.shadows[1],
176
176
  width: "100%"
177
177
  },
178
178
  children: [s && /* @__PURE__ */ o(K, { headerText: s }), /* @__PURE__ */ r(e, {
@@ -181,8 +181,7 @@ var yo = ({ payload: g }) => {
181
181
  bgcolor: "background.paper",
182
182
  borderRadius: "8px",
183
183
  gap: 16,
184
- px: 16,
185
- py: 12,
184
+ p: 16,
186
185
  width: "100%",
187
186
  ...s && {
188
187
  borderTopLeftRadius: "0",
@@ -193,7 +192,7 @@ var yo = ({ payload: g }) => {
193
192
  children: [/* @__PURE__ */ o(Q, {
194
193
  logo: c,
195
194
  slot: n,
196
- variant: h
195
+ variant: p
197
196
  }), /* @__PURE__ */ r(e, { children: [u != null && /* @__PURE__ */ o(l, {
198
197
  variant: "h2",
199
198
  children: I(u, "0,0.00")
@@ -219,7 +218,7 @@ var yo = ({ payload: g }) => {
219
218
  });
220
219
  };
221
220
  export {
222
- yo as default
221
+ vo as default
223
222
  };
224
223
 
225
224
  //# sourceMappingURL=AccountBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V2 variants fill `instance_slot.data` (ditto's account_block slots) and it is then the whole\n // truth: a slot it leaves empty, or sends with the wrong kind, draws nothing rather than falling\n // back to the stale flat field it supersedes. Beats not yet migrated send no `data` and keep the\n // flat fields.\n const { data } = instance_slot\n const v2 = data !== undefined\n const dataAmount = slot<unknown>(data, 'amount')\n const amount = v2\n ? typeof dataAmount === 'number' && Number.isFinite(dataAmount)\n ? dataAmount\n : undefined\n : instance_slot.amount\n // One V2 slot feeds the line under the amount on both tiles. V1 called it `sub_text` on the\n // standard tile and `label` on the confetti tile, so each keeps its own flat field.\n const dataSubText = slot<unknown>(data, 'sub_text')\n const v2SubText = typeof dataSubText === 'string' ? dataSubText : undefined\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const dataHeaderText = slot<unknown>(data, 'header_text')\n const header_text = v2\n ? typeof dataHeaderText === 'string'\n ? dataHeaderText\n : undefined\n : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n // Confetti-backed celebration variants (deposits, payoff, savings) — a success-tinted card\n // on a gradient + confetti wash. Everything variant-specific is flat on `layoutConfig`.\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // SVG is 58x46 but the card sits at (0,14) with the check badge overflowing top-right.\n // Box it to the card's real 44x32 footprint and shift the SVG up so it aligns with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 44 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // Deposit cards show the payer name — a merchant when we have one, otherwise the institution.\n // V2 sends it resolved as `data.secondary_text`; the flat fields remain the fallback.\n const dataSecondaryText = slot<unknown>(data, 'secondary_text')\n const payer =\n (typeof dataSecondaryText === 'string' && dataSecondaryText) ||\n (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n px: 16,\n py: 12,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAMvF,QAAM,EAAE,MAAA,EAAA,IAAS,GACX,IAAK,MAAS,QACd,IAAa,EAAc,GAAM,QAAQ,GACzC,IAAS,IACX,OAAO,KAAe,YAAY,OAAO,SAAS,CAAU,IAC1D,IACA,SACF,EAAc,QAGZ,IAAc,EAAc,GAAM,UAAU,GAC5C,IAAY,OAAO,KAAgB,WAAW,IAAc,QAC5D,IAAW,IAAK,IAAY,EAAc,UAC1C,IAAQ,IAAK,IAAY,EAAc,OACvC,IAAiB,EAAc,GAAM,aAAa,GAClD,IAAc,IAChB,OAAO,KAAmB,WACxB,IACA,SACF,EAAc,aACZ,IAAO,EAAc,GAAM,MAAM,GACjC,IAAe,EACnB,EAAgB,CAAK,GACrB,GACA,WACA,cACF;AAIA,MAAI,GAAc,YAAY;AAC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d,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,OAAO;AAAA,UACP,GAAI,KAAe;AAAA,YACjB,qBAAqB;AAAA,YACrB,sBAAsB;AAAA,UACxB;AAAA,UACA,IAAK,KAAoB,KAAa,GAAM,SAAS,EACnD,eAAe,MACjB;AAAA,QACF;AAAA,QAhBF,UAAA,CAkBE,gBAAA,EAAC,GAAD;AAAA,UAAqB,MAAA;AAAA,UAAM,MAAM;AAAA,UAAwB,SAAA;AAAA,QAAU,CAAA,GAEnE,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KAAU,QAAQ,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAM,UAAA,EAAe,GAAQ,QAAQ;AAAA,QAAQ,CAAA,GAC9E,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,eAAe;AAAA,YAAO,YAAY;AAAA,UAAS;AAAA,UAAhE,UAAA,CACG,EAAa,YACZ,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
1
+ {"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V2 variants fill `instance_slot.data` (ditto's account_block slots) and it is then the whole\n // truth: a slot it leaves empty, or sends with the wrong kind, draws nothing rather than falling\n // back to the stale flat field it supersedes. Beats not yet migrated send no `data` and keep the\n // flat fields.\n const { data } = instance_slot\n const v2 = data !== undefined\n const dataAmount = slot<unknown>(data, 'amount')\n const amount = v2\n ? typeof dataAmount === 'number' && Number.isFinite(dataAmount)\n ? dataAmount\n : undefined\n : instance_slot.amount\n // One V2 slot feeds the line under the amount on both tiles. V1 called it `sub_text` on the\n // standard tile and `label` on the confetti tile, so each keeps its own flat field.\n const dataSubText = slot<unknown>(data, 'sub_text')\n const v2SubText = typeof dataSubText === 'string' ? dataSubText : undefined\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const dataHeaderText = slot<unknown>(data, 'header_text')\n const header_text = v2\n ? typeof dataHeaderText === 'string'\n ? dataHeaderText\n : undefined\n : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n // Confetti-backed celebration variants (deposits, payoff, savings) — a success-tinted card\n // on a gradient + confetti wash. Everything variant-specific is flat on `layoutConfig`.\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // SVG is 58x46 but the card sits at (0,14) with the check badge overflowing top-right.\n // Box it to the card's real 44x32 footprint and shift the SVG up so it aligns with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 44 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // Deposit cards show the payer name — a merchant when we have one, otherwise the institution.\n // V2 sends it resolved as `data.secondary_text`; the flat fields remain the fallback.\n const dataSecondaryText = slot<unknown>(data, 'secondary_text')\n const payer =\n (typeof dataSecondaryText === 'string' && dataSecondaryText) ||\n (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAMvF,QAAM,EAAE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YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
@@ -1,18 +1,11 @@
1
1
  import { InsightsPayload } from '../../../../core';
2
- interface SavingsOpportunityBlockProps {
3
- payload: InsightsPayload;
4
- beatGuid?: string;
5
- }
6
2
  /**
7
- * Savings Opportunity component block (Figma frame 1276-45997). Reads `amount`, `label`, and
8
- * `slot` off `instance_slot` (V2 flat shape — no `instance_slot_data`), and renders the shared
9
- * `SavingsOpportunityCard` wrapped in the standard content-section padding.
10
- *
11
- * Wrapped in `createVariantBlock` so an added design branch is a new registry entry rather than a
12
- * rewrite of dispatch logic. Six variants are defined today, formed by
13
- * `{generic, savings, specific} × {safety_net_not_set, safety_net_set}`; copy/CTA differences
14
- * live in the payload, not here. An unknown variant degrades to the default
15
- * (`generic_safety_net_not_set`).
3
+ * Savings Opportunity V2 coupon (ditto `savings_amount_block`, single `save_amount` variant): reads
4
+ * `primary_text` and `amount` off `instance_slot.data`. `slot()` is an unchecked cast, so a payload
5
+ * that omits the amount or sends a non-number / non-string renders nothing rather than a fabricated
6
+ * `$0.00` card (same guard as `SaveExtraBlock`).
16
7
  */
17
- declare const SavingsOpportunityBlock: ({ payload, beatGuid }: SavingsOpportunityBlockProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const SavingsOpportunityBlock: ({ payload }: {
9
+ payload: InsightsPayload;
10
+ }) => import("react/jsx-runtime").JSX.Element | null;
18
11
  export default SavingsOpportunityBlock;
@@ -1,31 +1,15 @@
1
- import { formatCurrency as m } from "../../../../core/utils/NumberFormatting.es.js";
2
- import p from "../../../components/SavingsOpportunityCard.es.js";
3
- import { createVariantBlock as l } from "../../createVariantBlock.es.js";
4
- import { savingsOpportunityVariant as c } from "./layout.es.js";
5
- import v from "@mui/material/Stack";
6
- import { jsx as o } from "react/jsx-runtime";
7
- var u = (r) => {
8
- const { instance_slot: t } = r, { amount: a, label: i, slot: s } = t, e = s ?? !0;
9
- return /* @__PURE__ */ o(v, {
10
- sx: { px: 16 },
11
- children: /* @__PURE__ */ o(p, {
12
- amount: m(a ?? 0, "0,0.00"),
13
- label: i ?? "",
14
- slot: e
15
- })
1
+ import { slot as i } from "../../../../core/types/Insights.es.js";
2
+ import { formatCurrency as a } from "../../../../core/utils/NumberFormatting.es.js";
3
+ import m from "../../../components/SavingsOpportunityCard.es.js";
4
+ import { jsx as e } from "react/jsx-runtime";
5
+ var s = (t) => typeof t == "number" && Number.isFinite(t), y = ({ payload: t }) => {
6
+ const r = t.instance_slot?.data, o = i(r, "amount"), n = i(r, "primary_text");
7
+ return !s(o) || typeof n != "string" ? null : /* @__PURE__ */ e(m, {
8
+ amount: a(o, "0,0.00"),
9
+ label: n,
10
+ slot: !0
16
11
  });
17
- }, n = ({ payload: r }) => u(r), y = ({ payload: r, beatGuid: t }) => {
18
- const a = r.instance_slot.variant ?? void 0;
19
- return /* @__PURE__ */ o(f, {
20
- beatGuid: t,
21
- payload: r,
22
- variant: a
23
- });
24
- }, f = l({
25
- variants: Object.fromEntries(Object.values(c).map((r) => [r, n])),
26
- fallback: n,
27
- name: "SavingsOpportunityBlock"
28
- });
12
+ };
29
13
  export {
30
14
  y as default
31
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SavingsOpportunityBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport type { InsightsPayload } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport SavingsOpportunityCard from '../../../components/SavingsOpportunityCard'\nimport { createVariantBlock } from '../../createVariantBlock'\n\nimport { savingsOpportunityVariant, type SavingsOpportunityVariant } from './layout'\n\ninterface SavingsOpportunityBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst renderCard = (payload: InsightsPayload) => {\n const { instance_slot } = payload\n const { amount, label, slot } = instance_slot\n\n // Backend-sent `slot` wins; defaults to true so a payload that omits it still shows the gradient.\n const resolvedSlot = slot ?? true\n\n return (\n <Stack sx={{ px: 16 }}>\n <SavingsOpportunityCard\n amount={formatCurrency(amount ?? 0, '0,0.00')}\n label={label ?? ''}\n slot={resolvedSlot}\n />\n </Stack>\n )\n}\n\n// All six variants ({generic, savings, specific} × {safety_net_not_set, safety_net_set}) share\n// identical card visuals — copy/CTA differences live in the payload. We register the same\n// renderer under every key so the dispatcher still fires on each known variant (and a non-\n// registered backend variant hits the fallback with the standard dev warning from createVariantBlock).\nconst SavingsOpportunityVariantCard = ({ payload }: SavingsOpportunityBlockProps) =>\n renderCard(payload)\n\n/**\n * Savings Opportunity component block (Figma frame 1276-45997). Reads `amount`, `label`, and\n * `slot` off `instance_slot` (V2 flat shape — no `instance_slot_data`), and renders the shared\n * `SavingsOpportunityCard` wrapped in the standard content-section padding.\n *\n * Wrapped in `createVariantBlock` so an added design branch is a new registry entry rather than a\n * rewrite of dispatch logic. Six variants are defined today, formed by\n * `{generic, savings, specific} × {safety_net_not_set, safety_net_set}`; copy/CTA differences\n * live in the payload, not here. An unknown variant degrades to the default\n * (`generic_safety_net_not_set`).\n */\nconst SavingsOpportunityBlock = ({ payload, beatGuid }: SavingsOpportunityBlockProps) => {\n const variant = payload.instance_slot.variant ?? undefined\n return <Variants beatGuid={beatGuid} payload={payload} variant={variant} />\n}\n\nconst Variants = createVariantBlock<SavingsOpportunityBlockProps>({\n variants: Object.fromEntries(\n Object.values(savingsOpportunityVariant).map((v) => [v, SavingsOpportunityVariantCard]),\n ) as Record<SavingsOpportunityVariant, typeof SavingsOpportunityVariantCard>,\n fallback: SavingsOpportunityVariantCard,\n name: 'SavingsOpportunityBlock',\n})\n\nexport default SavingsOpportunityBlock\n"],"mappings":";;;;;;AAeA,IAAM,IAAA,CAAc,MAA6B;AAC/C,QAAM,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,QAAA,GAAQ,OAAA,GAAO,MAAA,EAAA,IAAS,GAG1B,IAAe,KAAQ;AAE7B,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,IAAI,GAAG;AAAA,IAClB,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,QAAQ,EAAe,KAAU,GAAG,QAAQ;AAAA,MAC5C,OAAO,KAAS;AAAA,MAChB,MAAM;AAAA,IACP,CAAA;AAAA,EACI,CAAA;AAEX,GAMM,IAAA,CAAiC,EAAE,SAAA,EAAA,MACvC,EAAW,CAAO,GAad,IAAA,CAA2B,EAAE,SAAA,GAAS,UAAA,EAAA,MAA6C;AACvF,QAAM,IAAU,EAAQ,cAAc,WAAW;AACjD,SAAO,gBAAA,EAAC,GAAD;AAAA,IAAoB,UAAA;AAAA,IAAmB,SAAA;AAAA,IAAkB,SAAA;AAAA,EAAU,CAAA;AAC5E,GAEM,IAAW,EAAiD;AAAA,EAChE,UAAU,OAAO,YACf,OAAO,OAAO,CAAyB,EAAE,IAAA,CAAK,MAAM,CAAC,GAAG,CAA6B,CAAC,CACxF;AAAA,EACA,UAAU;AAAA,EACV,MAAM;AACR,CAAC"}
1
+ {"version":3,"file":"SavingsOpportunityBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.tsx"],"sourcesContent":["import { slot as readSlot, type InsightsPayload } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport SavingsOpportunityCard from '../../../components/SavingsOpportunityCard'\n\nconst isFiniteNumber = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value)\n\n/**\n * Savings Opportunity V2 coupon (ditto `savings_amount_block`, single `save_amount` variant): reads\n * `primary_text` and `amount` off `instance_slot.data`. `slot()` is an unchecked cast, so a payload\n * that omits the amount or sends a non-number / non-string renders nothing rather than a fabricated\n * `$0.00` card (same guard as `SaveExtraBlock`).\n */\nconst SavingsOpportunityBlock = ({ payload }: { payload: InsightsPayload }) => {\n const data = payload.instance_slot?.data\n const amount = readSlot<unknown>(data, 'amount')\n const primaryText = readSlot<unknown>(data, 'primary_text')\n\n if (!isFiniteNumber(amount) || typeof primaryText !== 'string') return null\n\n return <SavingsOpportunityCard amount={formatCurrency(amount, '0,0.00')} label={primaryText} slot />\n}\n\nexport default SavingsOpportunityBlock\n"],"mappings":";;;;AAKA,IAAM,IAAA,CAAkB,MACtB,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,GAQ9C,IAAA,CAA2B,EAAE,SAAA,EAAA,MAA4C;AAC7E,QAAM,IAAO,EAAQ,eAAe,MAC9B,IAAS,EAAkB,GAAM,QAAQ,GACzC,IAAc,EAAkB,GAAM,cAAc;AAE1D,SAAI,CAAC,EAAe,CAAM,KAAK,OAAO,KAAgB,WAAiB,OAEhE,gBAAA,EAAC,GAAD;AAAA,IAAwB,QAAQ,EAAe,GAAQ,QAAQ;AAAA,IAAG,OAAO;AAAA,IAAa,MAAA;AAAA,EAAM,CAAA;AACrG"}
@@ -2,8 +2,8 @@ import { useGlobalCopyStore as S } from "../../../../common/context/hooks.es.js"
2
2
  import { slot as c } from "../../../../core/types/Insights.es.js";
3
3
  import { formatCurrency as C } from "../../../../core/utils/NumberFormatting.es.js";
4
4
  import v from "../../../components/LogoFromGuid.es.js";
5
- import { createVariantBlock as $ } from "../../createVariantBlock.es.js";
6
- import B from "../../../components/SubscriptionHeroCard.es.js";
5
+ import $ from "../../../components/SubscriptionHeroCard.es.js";
6
+ import { createVariantBlock as B } from "../../createVariantBlock.es.js";
7
7
  import { CADENCE as V, upcomingSubscriptionVariant as j } from "./layout.es.js";
8
8
  import w from "@mui/material/Stack";
9
9
  import { jsx as o, jsxs as A } from "react/jsx-runtime";
@@ -125,7 +125,7 @@ var E = [
125
125
  }) : null;
126
126
  return /* @__PURE__ */ o(w, {
127
127
  sx: { px: 16 },
128
- children: /* @__PURE__ */ o(B, {
128
+ children: /* @__PURE__ */ o($, {
129
129
  backdrop: k,
130
130
  compact: l,
131
131
  logo: n ? /* @__PURE__ */ o(v, {
@@ -144,7 +144,7 @@ var E = [
144
144
  payload: i,
145
145
  variant: a
146
146
  });
147
- }, G = $({
147
+ }, G = B({
148
148
  variants: { [j.Hero]: x },
149
149
  fallback: x,
150
150
  name: "UpcomingSubscriptionBlock"
@@ -6,7 +6,7 @@ import { Text as i } from "@mxenabled/mxui";
6
6
  import { jsx as r, jsxs as n } from "react/jsx-runtime";
7
7
  import { alpha as o, useTheme as f } from "@mui/material/styles";
8
8
  import g from "@mui/material/Box";
9
- var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
9
+ var p = 0.75, y = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
10
10
  const e = f(), l = `linear-gradient(90deg, ${o(e.palette.success.main, p)}, ${o(e.palette.success.light, p)})`;
11
11
  return /* @__PURE__ */ r(g, {
12
12
  sx: {
@@ -44,8 +44,8 @@ var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
44
44
  /* @__PURE__ */ n(t, {
45
45
  sx: {
46
46
  bgcolor: "background.paper",
47
- borderBottomRightRadius: "12px",
48
- borderTopRightRadius: "12px",
47
+ borderBottomRightRadius: "8px",
48
+ borderTopRightRadius: "8px",
49
49
  height: 74,
50
50
  justifyContent: "center",
51
51
  px: 12,
@@ -53,9 +53,11 @@ var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
53
53
  },
54
54
  children: [/* @__PURE__ */ r(i, {
55
55
  color: "text.secondary",
56
+ sx: { fontWeight: 400 },
56
57
  variant: "caption",
57
58
  children: c
58
59
  }), /* @__PURE__ */ r(i, {
60
+ color: "text.primary",
59
61
  variant: "h1",
60
62
  children: d
61
63
  })]
@@ -65,7 +67,7 @@ var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
65
67
  });
66
68
  };
67
69
  export {
68
- j as default
70
+ y as default
69
71
  };
70
72
 
71
73
  //# sourceMappingURL=SavingsOpportunityCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SavingsOpportunityCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SavingsOpportunityCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha, type SxProps, type Theme, useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { ReactComponent as Left } from './shared/images/SavingsOpportunityLeft.svg'\nimport { ReactComponent as LeftDark } from './shared/images/SavingsOpportunityLeftDark.svg'\nimport { ReactComponent as Perforation } from './shared/images/SavingsOpportunityPerforation.svg'\n\n/**\n * Figma slot: a white base layered with a `success.main → success.light` linear\n * gradient at 75% opacity (a green wash left-to-right). Both tokens are\n * theme-aware so the tint flips for dark mode. Matches the \"backgroundImage over\n * bgcolor\" pattern used across the insights-v2 Content components.\n */\nconst SLOT_GRADIENT_OPACITY = 0.75\n\ninterface SavingsOpportunityCardProps {\n amount: string\n label: string\n /** Whether to render the green gradient slot behind the coupon. Default true. */\n slot?: boolean\n sx?: SxProps<Theme>\n}\n\n/**\n * Savings Opportunity V2 content: a coupon (green wallet tile + perforation +\n * amount) on a green gradient slot. Ported from the v1 `Coupon` component\n * (`src/insights/components/shared/Coupon.tsx`) and adapted to the v2 theme.\n *\n * Figma: Savings Opportunity V2 Content (Full variant, coupon-style).\n * Scope is the Content section only.\n */\nconst SavingsOpportunityCard = ({\n amount,\n label,\n slot = true,\n sx,\n}: SavingsOpportunityCardProps) => {\n const theme = useTheme()\n const slotBackground = `linear-gradient(90deg, ${alpha(\n theme.palette.success.main,\n SLOT_GRADIENT_OPACITY,\n )}, ${alpha(theme.palette.success.light, SLOT_GRADIENT_OPACITY)})`\n\n return (\n <Box\n sx={{\n backgroundImage: slot ? slotBackground : undefined,\n bgcolor: slot ? 'background.paper' : 'transparent',\n p: 16,\n ...sx,\n }}\n >\n <Stack sx={{ flexDirection: 'row', justifyContent: 'center' }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomLeftRadius: '8px',\n borderTopLeftRadius: '8px',\n p: 4,\n pr: 2,\n }}\n >\n {theme.palette.mode === 'dark' ? (\n <LeftDark aria-hidden={true} />\n ) : (\n <Left aria-hidden={true} />\n )}\n </Stack>\n <Stack\n sx={{\n svg: {\n path: {\n '&:not([stroke])': {\n fill: theme.palette.background.paper,\n },\n '&[stroke]': {\n stroke: alpha(theme.palette.divider, 0.24),\n },\n },\n rect: {\n fill: theme.palette.background.paper,\n },\n },\n }}\n >\n <Perforation aria-hidden={true} />\n </Stack>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomRightRadius: '12px',\n borderTopRightRadius: '12px',\n height: 74,\n justifyContent: 'center',\n px: 12,\n width: 216,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text variant=\"h1\">{amount}</Text>\n </Stack>\n </Stack>\n </Box>\n )\n}\n\nexport default SavingsOpportunityCard\n"],"mappings":";;;;;;;;AAgBA,IAAM,IAAwB,MAkBxB,IAAA,CAA0B,EAC9B,QAAA,GACA,OAAA,GACA,MAAA,IAAO,IACP,IAAA,EAAA,MACiC;AACjC,QAAM,IAAQ,EAAS,GACjB,IAAiB,0BAA0B,EAC/C,EAAM,QAAQ,QAAQ,MACtB,CACF,CAAA,KAAM,EAAM,EAAM,QAAQ,QAAQ,OAAO,CAAqB,CAAA;AAE9D,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,iBAAiB,IAAO,IAAiB;AAAA,MACzC,SAAS,IAAO,qBAAqB;AAAA,MACrC,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,eAAe;AAAA,QAAO,gBAAgB;AAAA,MAAS;AAAA,MAA5D,UAAA;AAAA,QACE,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,SAAS;AAAA,YACT,wBAAwB;AAAA,YACxB,qBAAqB;AAAA,YACrB,GAAG;AAAA,YACH,IAAI;AAAA,UACN;AAAA,UAEC,UAAA,EAAM,QAAQ,SAAS,SACtB,gBAAA,EAAC,GAAD,EAAU,eAAa,GAAO,CAAA,IAE9B,gBAAA,EAAC,GAAD,EAAM,eAAa,GAAO,CAAA;AAAA,QAEvB,CAAA;AAAA,QACP,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI,EACF,KAAK;AAAA,YACH,MAAM;AAAA,cACJ,mBAAmB,EACjB,MAAM,EAAM,QAAQ,WAAW,MACjC;AAAA,cACA,aAAa,EACX,QAAQ,EAAM,EAAM,QAAQ,SAAS,IAAI,EAC3C;AAAA,YACF;AAAA,YACA,MAAM,EACJ,MAAM,EAAM,QAAQ,WAAW,MACjC;AAAA,UACF,EACF;AAAA,UAEA,UAAA,gBAAA,EAAC,GAAD,EAAa,eAAa,GAAO,CAAA;AAAA,QAC5B,CAAA;AAAA,QACP,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,SAAS;AAAA,YACT,yBAAyB;AAAA,YACzB,sBAAsB;AAAA,YACtB,QAAQ;AAAA,YACR,gBAAgB;AAAA,YAChB,IAAI;AAAA,YACJ,OAAO;AAAA,UACT;AAAA,UATF,UAAA,CAWE,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,YAAM,SAAQ;AAAA,YAAM,UAAA;AAAA,UAAa,CAAA,CAC5B;AAAA;MACF;AAAA;EACJ,CAAA;AAET"}
1
+ {"version":3,"file":"SavingsOpportunityCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SavingsOpportunityCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha, type SxProps, type Theme, useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { ReactComponent as Left } from './shared/images/SavingsOpportunityLeft.svg'\nimport { ReactComponent as LeftDark } from './shared/images/SavingsOpportunityLeftDark.svg'\nimport { ReactComponent as Perforation } from './shared/images/SavingsOpportunityPerforation.svg'\n\n/**\n * Figma slot: a white base layered with a `success.main → success.light` linear\n * gradient at 75% opacity (a green wash left-to-right). Both tokens are\n * theme-aware so the tint flips for dark mode. Matches the \"backgroundImage over\n * bgcolor\" pattern used across the insights-v2 Content components.\n */\nconst SLOT_GRADIENT_OPACITY = 0.75\n\ninterface SavingsOpportunityCardProps {\n amount: string\n label: string\n /** Whether to render the green gradient slot behind the coupon. Default true. */\n slot?: boolean\n sx?: SxProps<Theme>\n}\n\n/**\n * Savings Opportunity V2 content: a coupon (green wallet tile + perforation +\n * amount) on a green gradient slot. Ported from the v1 `Coupon` component\n * (`src/insights/components/shared/Coupon.tsx`) and adapted to the v2 theme.\n *\n * Figma: Savings Opportunity V2 Content (Full variant, coupon-style).\n * Scope is the Content section only.\n */\nconst SavingsOpportunityCard = ({\n amount,\n label,\n slot = true,\n sx,\n}: SavingsOpportunityCardProps) => {\n const theme = useTheme()\n const slotBackground = `linear-gradient(90deg, ${alpha(\n theme.palette.success.main,\n SLOT_GRADIENT_OPACITY,\n )}, ${alpha(theme.palette.success.light, SLOT_GRADIENT_OPACITY)})`\n\n return (\n <Box\n sx={{\n backgroundImage: slot ? slotBackground : undefined,\n bgcolor: slot ? 'background.paper' : 'transparent',\n p: 16,\n ...sx,\n }}\n >\n <Stack sx={{ flexDirection: 'row', justifyContent: 'center' }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomLeftRadius: '8px',\n borderTopLeftRadius: '8px',\n p: 4,\n pr: 2,\n }}\n >\n {theme.palette.mode === 'dark' ? (\n <LeftDark aria-hidden={true} />\n ) : (\n <Left aria-hidden={true} />\n )}\n </Stack>\n <Stack\n sx={{\n svg: {\n path: {\n '&:not([stroke])': {\n fill: theme.palette.background.paper,\n },\n '&[stroke]': {\n stroke: alpha(theme.palette.divider, 0.24),\n },\n },\n rect: {\n fill: theme.palette.background.paper,\n },\n },\n }}\n >\n <Perforation aria-hidden={true} />\n </Stack>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomRightRadius: '8px',\n borderTopRightRadius: '8px',\n height: 74,\n justifyContent: 'center',\n px: 12,\n width: 216,\n }}\n >\n {/* Figma: \"Save an extra\" caption is 11px/400 at text.secondary (black\n @0.6). MXUI's `caption` variant renders 700, so set fontWeight\n explicitly (same pattern as AccountHeroCard/AmountBreakdownCard). */}\n <Text color=\"text.secondary\" sx={{ fontWeight: 400 }} variant=\"caption\">\n {label}\n </Text>\n {/* Figma: amount is 31px/700 at text.primary (black @0.87). */}\n <Text color=\"text.primary\" variant=\"h1\">\n {amount}\n </Text>\n </Stack>\n </Stack>\n </Box>\n )\n}\n\nexport default SavingsOpportunityCard\n"],"mappings":";;;;;;;;AAgBA,IAAM,IAAwB,MAkBxB,IAAA,CAA0B,EAC9B,QAAA,GACA,OAAA,GACA,MAAA,IAAO,IACP,IAAA,EAAA,MACiC;AACjC,QAAM,IAAQ,EAAS,GACjB,IAAiB,0BAA0B,EAC/C,EAAM,QAAQ,QAAQ,MACtB,CACF,CAAA,KAAM,EAAM,EAAM,QAAQ,QAAQ,OAAO,CAAqB,CAAA;AAE9D,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,iBAAiB,IAAO,IAAiB;AAAA,MACzC,SAAS,IAAO,qBAAqB;AAAA,MACrC,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,eAAe;AAAA,QAAO,gBAAgB;AAAA,MAAS;AAAA,MAA5D,UAAA;AAAA,QACE,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,SAAS;AAAA,YACT,wBAAwB;AAAA,YACxB,qBAAqB;AAA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