@mx-cartographer/experiences 9.7.37 → 9.7.39

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 (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/core/types/localization/InsightsFeedCopy.d.ts +30 -0
  3. package/dist/core/types/localization/index.d.ts +1 -1
  4. package/dist/core/utils/NumberFormatting.d.ts +5 -0
  5. package/dist/core/utils/NumberFormatting.es.js +19 -15
  6. package/dist/core/utils/NumberFormatting.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +10 -0
  8. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +36 -0
  9. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -0
  10. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +22 -0
  11. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +176 -0
  12. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -0
  13. package/dist/insights-v2/actionBlocks/AccountListBlock/index.d.ts +2 -0
  14. package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +20 -0
  15. package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +24 -0
  16. package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -0
  17. package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.d.ts +1 -0
  18. package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js +13 -0
  19. package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js.map +1 -0
  20. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +1 -1
  21. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +0 -5
  23. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +5 -10
  24. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
  25. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.d.ts +3 -4
  26. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +49 -35
  27. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
  28. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/layout.d.ts +12 -0
  29. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/layout.es.js +37 -2
  30. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/layout.es.js.map +1 -1
  31. package/dist/insights-v2/components/SubscriptionHeroCard.d.ts +5 -1
  32. package/dist/insights-v2/components/SubscriptionHeroCard.es.js +22 -21
  33. package/dist/insights-v2/components/SubscriptionHeroCard.es.js.map +1 -1
  34. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  35. package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
  36. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  37. package/dist/insights-v2/mappings/blocks.es.js +54 -47
  38. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  39. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +105 -105
  40. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [9.7.39] - 10-23-2026
2
+
3
+ - **ADDED** - `account_list_block` action block for Monthly Obligations Status: the beat's calculation (current cash, estimated income, recurring expenses, remaining) from `drilldown_data`, then the accounts behind it from the account store with their total, behind "View accounts" on track and "View details" off track. Copy from the new `insights_feed.account_list` namespace; `formatSignedCurrency` moves from the Remaining Cash block to `core/utils/NumberFormatting`. Fixture, stories, tests and `docs/action-blocks/account-list-block.md` (MEW2-3363)
4
+
5
+ ## [9.7.38] - 10-23-2026
6
+
7
+ - **CHANGED** - `upcoming_subscription_block` reads the merchant name, merchant guid, amount and recurrence type from `instance_slot.data`. `data` is the only source, because the beat is already flagged `is_insights_v2` by firefly: a missing or wrongly typed slot draws nothing — no `$0.00` — and the flat `instance_slot` fields of the old shape are no longer read. The card draws when the envelope names no layout variant (WEC-1970)
8
+ - **ADDED** - `insights_feed.upcoming_subscription_block` copy (optional): the cadence word that ends the price pill, picked by `instance_slot.data.recurrence_type` (`cadence_every_week`, `cadence_every_other_week`, `cadence_every_month`, `cadence_every_other_month`, `cadence_every_quarter`, `cadence_every_other_quarter`, `cadence_every_year`, `cadence_twice_a_month`). A host that has not shipped a word gets the English default (week, 2 weeks, month, 2 months, quarter, 2 quarters, year, twice a month); an unknown recurrence type shows the price alone (WEC-1970)
9
+ - **CHANGED** - The Upcoming Subscription price pill sets the amount in bold and the cadence ("/ month") in regular weight, as in the design (WEC-1970)
10
+ - **CHANGED** - `SubscriptionHeroCard` draws no price pill when `price` is empty, instead of an empty pill (WEC-1970)
11
+ - **CHANGED** - `RecurringTransactionDetails` (the Expense Details drawer, shared by the recurring widget, the cashflow and finstrong onboarding and the Upcoming Subscription "View Details" drawer) shows the Category row on open. It used to appear only after a past-activity row was clicked; now it takes the category of the newest charge linked to the recurring transaction, with the name resolved from the category store, and a category with no known name still shows no row. The merchant logo uses the same category as its fallback (WEC-1970)
12
+ - **ADDED** - `SubscriptionHeroCard` takes an optional `compact` prop (10px padding, 8px gap), and `upcoming_subscription_block` draws a compact hero on the mini widget (`widget_type` `mini`): 40px logo, 10px vertical padding, 8px gap, down from 64px, 24px and 12px. Pulse clips a mini card at 312px; the full-size hero made the card's content 362px tall (`scrollHeight`) and pushed the action label ("Does this look right?") below the cut. The full and micro cards keep the 64px hero (WEC-1970)
13
+ - **CHANGED** - The Upcoming Subscription fixtures (`UpcomingSubscriptionBlockPayload.json`) are the full, mini and micro envelopes tupac sends for a monthly subscription; the primary CTA "Does this look right?" opens `survey_modal_block`, and the footer is `{ timestamp, account }` (WEC-1970)
14
+
1
15
  ## [9.7.37] - 10-23-2026
2
16
 
3
17
  - **ADDED** - `with_header_footer` variant for the insights-v2 `TransactionBlock`: a date header above the rows plus a footer/summary row (`data.footer_text` + `data.footer_amount`, formatted as currency) rendered through `TransactionListCard` — used by Replenish Savings' "Remaining Balance". Adds `showFooter` to the layout config, with mock payload/beats, a Storybook story and tests (WEC-2106)
@@ -350,6 +350,34 @@ export interface BudgetDetailsCopy {
350
350
  remaining: string;
351
351
  total_out_of_limit_aria: string;
352
352
  }
353
+ /**
354
+ * The cadence words that end the Upcoming Subscription price pill ("$16.06 / month"), keyed by
355
+ * the stored recurrence type. Each is optional until the localized-content service ships it: a
356
+ * missing word shows the price alone.
357
+ */
358
+ export interface UpcomingSubscriptionBlockCopy {
359
+ cadence_every_week?: string;
360
+ cadence_every_other_week?: string;
361
+ cadence_every_month?: string;
362
+ cadence_every_other_month?: string;
363
+ cadence_every_quarter?: string;
364
+ cadence_every_other_quarter?: string;
365
+ cadence_every_year?: string;
366
+ cadence_twice_a_month?: string;
367
+ }
368
+ /** The Account List drawer (`account_list_block`). */
369
+ export interface AccountListCopy {
370
+ /** Drawer title. */
371
+ title: string;
372
+ how_is_this_calculated: string;
373
+ current_cash: string;
374
+ estimated_income: string;
375
+ recurring_expenses: string;
376
+ remaining: string;
377
+ accounts_header: string;
378
+ total_balance: string;
379
+ no_accounts: string;
380
+ }
353
381
  export interface InsightsFeedCopy {
354
382
  general: GeneralInsightsFeedCopy;
355
383
  settings_menu: SettingsMenuCopy;
@@ -379,7 +407,9 @@ export interface InsightsFeedCopy {
379
407
  /** Optional until the localized-content service ships the namespace. */
380
408
  transparent_overdraft?: OverdraftCopy;
381
409
  credit_utilization?: CreditUtilizationCopy;
410
+ account_list?: AccountListCopy;
382
411
  payoff_calculator?: PayoffCalculatorCopy;
383
412
  budget_details?: BudgetDetailsCopy;
413
+ upcoming_subscription_block?: UpcomingSubscriptionBlockCopy;
384
414
  }
385
415
  export {};
@@ -13,7 +13,7 @@ export type { DebtsCopy } from './DebtsCopy';
13
13
  export type { FinstrongCopy } from './FinstrongCopy';
14
14
  export type { GoalsCopy } from './GoalsCopy';
15
15
  export type { HelpCopy, HelpByCategoryList } from './HelpCopy';
16
- export type { AmountInputModalCopy, AmountInputModalVariantCopy, EmergencySavingsCopy, InsightsFeedCopy, MakeTransferCopy, PayoffCalculatorCopy, RemainingCashCopy, OverdraftCopy, CreditUtilizationCopy, OverflowMenuCopy, DismissInsightCopy, DismissInsightOptionCopy, HiddenConfirmationCopy, HideFeedbackCopy, FeedbackCopy, FeedbackBarCopy, } from './InsightsFeedCopy';
16
+ export type { AmountInputModalCopy, AmountInputModalVariantCopy, EmergencySavingsCopy, InsightsFeedCopy, MakeTransferCopy, PayoffCalculatorCopy, RemainingCashCopy, OverdraftCopy, CreditUtilizationCopy, AccountListCopy, OverflowMenuCopy, DismissInsightCopy, DismissInsightOptionCopy, HiddenConfirmationCopy, HideFeedbackCopy, FeedbackCopy, FeedbackBarCopy, } from './InsightsFeedCopy';
17
17
  export type { InvestmentsCopy } from './InvestmentsCopy';
18
18
  export type { MicroInsightsCopy } from './MicroInsightsCopy';
19
19
  export type { NetWorthCopy } from './NetWorthCopy';
@@ -13,3 +13,8 @@ export declare const formatOrdinal: (number: number, options?: Intl.PluralRulesO
13
13
  readonly few: "rd";
14
14
  readonly other: "th";
15
15
  }) => string;
16
+ /**
17
+ * `-$220.00`, not `$-220.00`: the sign goes before the currency symbol. Rounded to cents first so a
18
+ * sub-cent negative (or `-0`) reads `$0.00`, never `-$0.00`.
19
+ */
20
+ export declare const formatSignedCurrency: (amount: number) => string;
@@ -1,32 +1,36 @@
1
1
  import { getLocale as a } from "./Localization.es.js";
2
- import { CurrencyCodes as l } from "../constants/Numbers.es.js";
3
- import s from "numeral";
4
- var g = (r, e, t) => {
5
- const n = [], c = (e - r) / (t - 1);
2
+ import { CurrencyCodes as s } from "../constants/Numbers.es.js";
3
+ import c from "numeral";
4
+ var v = (r, e, t) => {
5
+ const n = [], i = (e - r) / (t - 1);
6
6
  for (let o = 0; o < t; o++) {
7
- const i = r + o * c;
8
- n.push(i);
7
+ const l = r + o * i;
8
+ n.push(l);
9
9
  }
10
10
  return n[t - 1] = e, n.map(Math.round);
11
- }, v = (r) => r.length ? Math.round(r.reduce((e, t) => e + t, 0) / r.length) : 0, w = (r, e, t) => a() === "fr-ca" ? s(r).format(`${e} $`, t) : s(r).format(`$${e}`, t), y = () => a() === "fr-ca" ? l.CAD : l.USD, m = (r) => r != null && r !== "" && isFinite(r), d = {
11
+ }, y = (r) => r.length ? Math.round(r.reduce((e, t) => e + t, 0) / r.length) : 0, d = (r, e, t) => a() === "fr-ca" ? c(r).format(`${e} $`, t) : c(r).format(`$${e}`, t), $ = () => a() === "fr-ca" ? s.CAD : s.USD, m = (r) => r != null && r !== "" && isFinite(r), f = {
12
12
  style: "percent",
13
13
  minimumFractionDigits: 2,
14
14
  maximumFractionDigits: 2
15
- }, $ = (r, e = d) => m(r) ? new Intl.NumberFormat(a(), e).format(Number(r)) : r, f = (r) => new Intl.PluralRules(a(), r), C = (r, e = { type: "ordinal" }, t = {
15
+ }, w = (r, e = f) => m(r) ? new Intl.NumberFormat(a(), e).format(Number(r)) : r, u = (r) => new Intl.PluralRules(a(), r), C = (r, e = { type: "ordinal" }, t = {
16
16
  one: "st",
17
17
  two: "nd",
18
18
  few: "rd",
19
19
  other: "th"
20
- }) => `${r}${t[f(e).select(r)]}`;
20
+ }) => `${r}${t[u(e).select(r)]}`, D = (r) => {
21
+ const e = Math.round(Math.abs(r) * 100), t = d(e / 100, "0,0.00");
22
+ return r < 0 && e > 0 ? `-${t}` : t;
23
+ };
21
24
  export {
22
- w as formatCurrency,
25
+ d as formatCurrency,
23
26
  C as formatOrdinal,
24
- $ as formatPercentage,
25
- g as generateEqualIntervals,
26
- y as getCurrencyCodes,
27
- f as getPluralRules,
27
+ w as formatPercentage,
28
+ D as formatSignedCurrency,
29
+ v as generateEqualIntervals,
30
+ $ as getCurrencyCodes,
31
+ u as getPluralRules,
28
32
  m as isValidNumber,
29
- v as roundedAverage
33
+ y as roundedAverage
30
34
  };
31
35
 
32
36
  //# sourceMappingURL=NumberFormatting.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberFormatting.es.js","names":[],"sources":["../../../src/core/utils/NumberFormatting.ts"],"sourcesContent":["import numeral from 'numeral'\nimport type { RoundingFunction } from 'numeral'\n\nimport { CurrencyCodes } from '../constants/Numbers'\nimport { getLocale } from './Localization'\n\nexport const generateEqualIntervals = (\n minValue: number,\n maxValue: number,\n tickCount: number,\n): number[] => {\n const ticks: number[] = []\n const range = maxValue - minValue\n const step = range / (tickCount - 1) // The space between each tick\n\n for (let i = 0; i < tickCount; i++) {\n const tickValue = minValue + i * step\n ticks.push(tickValue)\n }\n\n ticks[tickCount - 1] = maxValue\n\n return ticks.map(Math.round)\n}\n\nexport const roundedAverage = (values: number[]) =>\n values.length ? Math.round(values.reduce((sum, value) => sum + value, 0) / values.length) : 0\n\n// enhances numeral's localization functionality by puting the $ in the correct place\nexport const formatCurrency = (\n amount: number | undefined,\n formatting: string,\n roundingFunction?: RoundingFunction,\n) => {\n switch (getLocale()) {\n case 'fr-ca': {\n return numeral(amount).format(`${formatting} $`, roundingFunction)\n }\n default: {\n return numeral(amount).format(`$${formatting}`, roundingFunction)\n }\n }\n}\n\nexport const getCurrencyCodes = () => {\n switch (getLocale()) {\n case 'fr-ca':\n return CurrencyCodes.CAD\n default:\n return CurrencyCodes.USD\n }\n}\n\n// will return `true` if value is a string number, like '99', which matches Serenity logic\nexport const isValidNumber = (value: any) =>\n value !== undefined && value !== null && value !== '' && isFinite(value)\n\nconst defaultPercentStyle = {\n style: 'percent',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n} as Intl.NumberFormatOptions\n\nexport const formatPercentage = (\n amount: number | string | undefined,\n options: Intl.NumberFormatOptions = defaultPercentStyle,\n) =>\n isValidNumber(amount)\n ? new Intl.NumberFormat(getLocale(), options).format(Number(amount))\n : amount\n\nexport const getPluralRules = (options: Intl.PluralRulesOptions) =>\n new Intl.PluralRules(getLocale(), options)\n\nexport const formatOrdinal = (\n number: number,\n options: Intl.PluralRulesOptions = { type: 'ordinal' },\n copy = {\n one: 'st',\n two: 'nd',\n few: 'rd',\n other: 'th',\n } as const,\n) => {\n const rule = getPluralRules(options).select(number)\n\n return `${number}${copy[rule as keyof typeof copy]}`\n}\n"],"mappings":";;;AAMA,IAAa,IAAA,CACX,GACA,GACA,MACa;AACb,QAAM,IAAkB,CAAC,GAEnB,KADQ,IAAW,MACH,IAAY;AAElC,WAAS,IAAI,GAAG,IAAI,GAAW,KAAK;AAClC,UAAM,IAAY,IAAW,IAAI;AACjC,IAAA,EAAM,KAAK,CAAS;AAAA,EACtB;AAEA,SAAA,EAAM,IAAY,CAAA,IAAK,GAEhB,EAAM,IAAI,KAAK,KAAK;AAC7B,GAEa,IAAA,CAAkB,MAC7B,EAAO,SAAS,KAAK,MAAM,EAAO,OAAA,CAAQ,GAAK,MAAU,IAAM,GAAO,CAAC,IAAI,EAAO,MAAM,IAAI,GAGjF,IAAA,CACX,GACA,GACA,MAEQ,EAAU,MACX,UACI,EAAQ,CAAM,EAAE,OAAO,GAAG,CAAA,MAAgB,CAAgB,IAG1D,EAAQ,CAAM,EAAE,OAAO,IAAI,CAAA,IAAc,CAAgB,GAKzD,IAAA,MACH,EAAU,MACX,UACI,EAAc,MAEd,EAAc,KAKd,IAAA,CAAiB,MACL,KAAU,QAAQ,MAAU,MAAM,SAAS,CAAK,GAEnE,IAAsB;AAAA,EAC1B,OAAO;AAAA,EACP,uBAAuB;AAAA,EACvB,uBAAuB;AACzB,GAEa,IAAA,CACX,GACA,IAAoC,MAEpC,EAAc,CAAM,IAChB,IAAI,KAAK,aAAa,EAAU,GAAG,CAAO,EAAE,OAAO,OAAO,CAAM,CAAC,IACjE,GAEO,IAAA,CAAkB,MAC7B,IAAI,KAAK,YAAY,EAAU,GAAG,CAAO,GAE9B,IAAA,CACX,GACA,IAAmC,EAAE,MAAM,UAAU,GACrD,IAAO;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,OAAO;AACT,MAIO,GAAG,CAAA,GAAS,EAFN,EAAe,CAAO,EAAE,OAAO,CAEpB,CAAA,CAAA"}
1
+ {"version":3,"file":"NumberFormatting.es.js","names":[],"sources":["../../../src/core/utils/NumberFormatting.ts"],"sourcesContent":["import numeral from 'numeral'\nimport type { RoundingFunction } from 'numeral'\n\nimport { CurrencyCodes } from '../constants/Numbers'\nimport { getLocale } from './Localization'\n\nexport const generateEqualIntervals = (\n minValue: number,\n maxValue: number,\n tickCount: number,\n): number[] => {\n const ticks: number[] = []\n const range = maxValue - minValue\n const step = range / (tickCount - 1) // The space between each tick\n\n for (let i = 0; i < tickCount; i++) {\n const tickValue = minValue + i * step\n ticks.push(tickValue)\n }\n\n ticks[tickCount - 1] = maxValue\n\n return ticks.map(Math.round)\n}\n\nexport const roundedAverage = (values: number[]) =>\n values.length ? Math.round(values.reduce((sum, value) => sum + value, 0) / values.length) : 0\n\n// enhances numeral's localization functionality by puting the $ in the correct place\nexport const formatCurrency = (\n amount: number | undefined,\n formatting: string,\n roundingFunction?: RoundingFunction,\n) => {\n switch (getLocale()) {\n case 'fr-ca': {\n return numeral(amount).format(`${formatting} $`, roundingFunction)\n }\n default: {\n return numeral(amount).format(`$${formatting}`, roundingFunction)\n }\n }\n}\n\nexport const getCurrencyCodes = () => {\n switch (getLocale()) {\n case 'fr-ca':\n return CurrencyCodes.CAD\n default:\n return CurrencyCodes.USD\n }\n}\n\n// will return `true` if value is a string number, like '99', which matches Serenity logic\nexport const isValidNumber = (value: any) =>\n value !== undefined && value !== null && value !== '' && isFinite(value)\n\nconst defaultPercentStyle = {\n style: 'percent',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n} as Intl.NumberFormatOptions\n\nexport const formatPercentage = (\n amount: number | string | undefined,\n options: Intl.NumberFormatOptions = defaultPercentStyle,\n) =>\n isValidNumber(amount)\n ? new Intl.NumberFormat(getLocale(), options).format(Number(amount))\n : amount\n\nexport const getPluralRules = (options: Intl.PluralRulesOptions) =>\n new Intl.PluralRules(getLocale(), options)\n\nexport const formatOrdinal = (\n number: number,\n options: Intl.PluralRulesOptions = { type: 'ordinal' },\n copy = {\n one: 'st',\n two: 'nd',\n few: 'rd',\n other: 'th',\n } as const,\n) => {\n const rule = getPluralRules(options).select(number)\n\n return `${number}${copy[rule as keyof typeof copy]}`\n}\n\n/**\n * `-$220.00`, not `$-220.00`: the sign goes before the currency symbol. Rounded to cents first so a\n * sub-cent negative (or `-0`) reads `$0.00`, never `-$0.00`.\n */\nexport const formatSignedCurrency = (amount: number): string => {\n const cents = Math.round(Math.abs(amount) * 100)\n const formatted = formatCurrency(cents / 100, '0,0.00')\n\n return amount < 0 && cents > 0 ? `-${formatted}` : formatted\n}\n"],"mappings":";;;AAMA,IAAa,IAAA,CACX,GACA,GACA,MACa;AACb,QAAM,IAAkB,CAAC,GAEnB,KADQ,IAAW,MACH,IAAY;AAElC,WAAS,IAAI,GAAG,IAAI,GAAW,KAAK;AAClC,UAAM,IAAY,IAAW,IAAI;AACjC,IAAA,EAAM,KAAK,CAAS;AAAA,EACtB;AAEA,SAAA,EAAM,IAAY,CAAA,IAAK,GAEhB,EAAM,IAAI,KAAK,KAAK;AAC7B,GAEa,IAAA,CAAkB,MAC7B,EAAO,SAAS,KAAK,MAAM,EAAO,OAAA,CAAQ,GAAK,MAAU,IAAM,GAAO,CAAC,IAAI,EAAO,MAAM,IAAI,GAGjF,IAAA,CACX,GACA,GACA,MAEQ,EAAU,MACX,UACI,EAAQ,CAAM,EAAE,OAAO,GAAG,CAAA,MAAgB,CAAgB,IAG1D,EAAQ,CAAM,EAAE,OAAO,IAAI,CAAA,IAAc,CAAgB,GAKzD,IAAA,MACH,EAAU,MACX,UACI,EAAc,MAEd,EAAc,KAKd,IAAA,CAAiB,MACL,KAAU,QAAQ,MAAU,MAAM,SAAS,CAAK,GAEnE,IAAsB;AAAA,EAC1B,OAAO;AAAA,EACP,uBAAuB;AAAA,EACvB,uBAAuB;AACzB,GAEa,IAAA,CACX,GACA,IAAoC,MAEpC,EAAc,CAAM,IAChB,IAAI,KAAK,aAAa,EAAU,GAAG,CAAO,EAAE,OAAO,OAAO,CAAM,CAAC,IACjE,GAEO,IAAA,CAAkB,MAC7B,IAAI,KAAK,YAAY,EAAU,GAAG,CAAO,GAE9B,IAAA,CACX,GACA,IAAmC,EAAE,MAAM,UAAU,GACrD,IAAO;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,OAAO;AACT,MAIO,GAAG,CAAA,GAAS,EAFN,EAAe,CAAO,EAAE,OAAO,CAEpB,CAAA,CAAA,IAOb,IAAA,CAAwB,MAA2B;AAC9D,QAAM,IAAQ,KAAK,MAAM,KAAK,IAAI,CAAM,IAAI,GAAG,GACzC,IAAY,EAAe,IAAQ,KAAK,QAAQ;AAEtD,SAAO,IAAS,KAAK,IAAQ,IAAI,IAAI,CAAA,KAAc;AACrD"}
@@ -0,0 +1,10 @@
1
+ import { ActionBlockProps } from '../../mappings/blocks';
2
+ /**
3
+ * Account List drawer (MEW2-3363): the beat's calculation from `drilldown_data`, then the accounts
4
+ * behind it from the account store, largest balance first, with their total. Opened by Monthly
5
+ * Obligations Status's "View accounts" (on track) and "View details" (off track). `observer`: reads
6
+ * copy and accounts from MobX stores.
7
+ */
8
+ export declare const AccountListBlock: (({ beat }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
9
+ displayName: string;
10
+ };
@@ -0,0 +1,36 @@
1
+ import p from "../../../common/utils/AccountDisplayName.es.js";
2
+ import { useAccountStore as d, useGlobalCopyStore as f, useGlobalStore as g } from "../../../common/context/hooks.es.js";
3
+ import n from "../../../common/components/Loader.es.js";
4
+ import y from "./AccountListContent.es.js";
5
+ import { lastFour as A, readSummary as S, resolveBeatAccounts as b, sumBalances as h } from "./layout.es.js";
6
+ import { observer as v } from "mobx-react-lite";
7
+ import B from "@mui/material/Stack";
8
+ import { Text as L } from "@mxenabled/mxui";
9
+ import { jsx as t } from "react/jsx-runtime";
10
+ var _ = (o) => ({
11
+ balance: o.balance ?? 0,
12
+ guid: o.guid,
13
+ institutionGuid: o.institution_guid ?? "",
14
+ lastFour: A(o.account_number),
15
+ name: p(o)
16
+ }), I = v(function({ beat: r }) {
17
+ const { copyStore: s } = g(), { common: c, insights_feed: m } = f(), { accountsLoaded: a, cashAccounts: u, visibleAccounts: l } = d(), e = m?.account_list;
18
+ if (!s.isInitialized) return /* @__PURE__ */ t(n, {});
19
+ if (!e) return /* @__PURE__ */ t(B, {
20
+ sx: { p: 24 },
21
+ children: /* @__PURE__ */ t(L, { children: c?.error_message ?? "Something went wrong." })
22
+ });
23
+ if (!a) return /* @__PURE__ */ t(n, {});
24
+ const i = b(r, l, u);
25
+ return /* @__PURE__ */ t(y, {
26
+ accounts: i.map(_),
27
+ copy: e,
28
+ summary: S(r),
29
+ totalBalance: h(i)
30
+ });
31
+ });
32
+ export {
33
+ I as AccountListBlock
34
+ };
35
+
36
+ //# sourceMappingURL=AccountListBlock.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useAccountStore, useGlobalCopyStore, useGlobalStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport AccountListContent, { type AccountListRow } from './AccountListContent'\nimport { lastFour, readSummary, resolveBeatAccounts, sumBalances } from './layout'\n\nconst toRow = (account: Account): AccountListRow => ({\n balance: account.balance ?? 0,\n guid: account.guid,\n institutionGuid: account.institution_guid ?? '',\n lastFour: lastFour(account.account_number),\n name: getAccountDisplayName(account),\n})\n\n/**\n * Account List drawer (MEW2-3363): the beat's calculation from `drilldown_data`, then the accounts\n * behind it from the account store, largest balance first, with their total. Opened by Monthly\n * Obligations Status's \"View accounts\" (on track) and \"View details\" (off track). `observer`: reads\n * copy and accounts from MobX stores.\n */\nexport const AccountListBlock = observer(function AccountListBlock({ beat }: ActionBlockProps) {\n const { copyStore } = useGlobalStore()\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accountsLoaded, cashAccounts, visibleAccounts } = useAccountStore()\n const copy = insightsFeedCopy?.account_list\n\n if (!copyStore.isInitialized) return <Loader />\n\n // Copy loads once at app start, so a retry cannot clear a missing namespace: a plain message.\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message ?? 'Something went wrong.'}</Text>\n </Stack>\n )\n }\n\n if (!accountsLoaded) return <Loader />\n\n const listed = resolveBeatAccounts(beat, visibleAccounts, cashAccounts)\n\n return (\n <AccountListContent\n accounts={listed.map(toRow)}\n copy={copy}\n summary={readSummary(beat)}\n totalBalance={sumBalances(listed)}\n />\n )\n})\n"],"mappings":";;;;;;;;;AAaA,IAAM,IAAA,CAAS,OAAsC;AAAA,EACnD,SAAS,EAAQ,WAAW;AAAA,EAC5B,MAAM,EAAQ;AAAA,EACd,iBAAiB,EAAQ,oBAAoB;AAAA,EAC7C,UAAU,EAAS,EAAQ,cAAc;AAAA,EACzC,MAAM,EAAsB,CAAO;AACrC,IAQa,IAAmB,EAAS,SAA0B,EAAE,MAAA,EAAA,GAA0B;AAC7F,QAAM,EAAE,WAAA,EAAA,IAAc,EAAe,GAC/B,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,gBAAA,GAAgB,cAAA,GAAc,iBAAA,EAAA,IAAoB,EAAgB,GACpE,IAAO,GAAkB;AAE/B,MAAI,CAAC,EAAU,cAAe,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAG9C,MAAI,CAAC,EACH,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,iBAAiB,wBAA8B,CAAA;AAAA,EAC7D,CAAA;AAIX,MAAI,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAErC,QAAM,IAAS,EAAoB,GAAM,GAAiB,CAAY;AAEtE,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU,EAAO,IAAI,CAAK;AAAA,IACpB,MAAA;AAAA,IACN,SAAS,EAAY,CAAI;AAAA,IACzB,cAAc,EAAY,CAAM;AAAA,EACjC,CAAA;AAEL,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy';
2
+ import { ObligationsSummary } from './layout';
3
+ export interface AccountListRow {
4
+ guid: string;
5
+ name: string;
6
+ /** The last digits of the account number, shown masked; empty when unknown. */
7
+ lastFour: string;
8
+ /** Empty when no institution is known: the default logo is shown. */
9
+ institutionGuid: string;
10
+ balance: number;
11
+ }
12
+ export interface AccountListContentProps {
13
+ copy: AccountListCopy;
14
+ /** Omitted when the beat carries no calculation: the drawer is just the list. */
15
+ summary?: ObligationsSummary;
16
+ /** Already ordered. */
17
+ accounts: AccountListRow[];
18
+ totalBalance: number;
19
+ }
20
+ /** Presentational body of the Account List drawer, minus the drawer header. */
21
+ declare const AccountListContent: ({ accounts, copy, summary, totalBalance }: AccountListContentProps) => import("react/jsx-runtime").JSX.Element;
22
+ export default AccountListContent;
@@ -0,0 +1,176 @@
1
+ import { DEFAULT_INSTITUTION_LOGO_URL as g } from "../../../core/constants/InstitutionLogo.es.js";
2
+ import { formatSignedCurrency as l } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { createElement as f } from "react";
4
+ import n from "@mui/material/Stack";
5
+ import { InstitutionLogo as u, Text as i } from "@mxenabled/mxui";
6
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
7
+ import h from "@mui/material/Box";
8
+ import p from "@mui/material/Divider";
9
+ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__ */ e(i, {
10
+ bold: !0,
11
+ sx: {
12
+ flexShrink: 0,
13
+ fontVariantNumeric: "tabular-nums"
14
+ },
15
+ variant: "body1",
16
+ children: r
17
+ }), c = ({ bold: r = !1, label: o, value: a }) => /* @__PURE__ */ t(n, {
18
+ sx: {
19
+ alignItems: "center",
20
+ flexDirection: "row",
21
+ gap: 16,
22
+ minHeight: 44,
23
+ px: 16
24
+ },
25
+ children: [/* @__PURE__ */ e(i, {
26
+ bold: r,
27
+ sx: { flexGrow: 1 },
28
+ variant: "body1",
29
+ children: o
30
+ }), /* @__PURE__ */ e(x, { children: a })]
31
+ }), _ = ({ copy: r, summary: o }) => /* @__PURE__ */ t(n, {
32
+ sx: {
33
+ gap: 12,
34
+ pt: 24,
35
+ px: 24
36
+ },
37
+ children: [/* @__PURE__ */ e(i, {
38
+ bold: !0,
39
+ component: "h3",
40
+ variant: "body1",
41
+ children: r.how_is_this_calculated
42
+ }), /* @__PURE__ */ t(n, {
43
+ sx: {
44
+ bgcolor: "background.paper",
45
+ border: "1px solid",
46
+ borderColor: "divider",
47
+ borderRadius: "8px",
48
+ overflow: "hidden"
49
+ },
50
+ children: [
51
+ /* @__PURE__ */ e(c, {
52
+ label: r.current_cash,
53
+ value: l(o.cashOnHand)
54
+ }),
55
+ /* @__PURE__ */ e(p, {}),
56
+ /* @__PURE__ */ e(c, {
57
+ label: r.estimated_income,
58
+ value: v(o.estimatedIncome)
59
+ }),
60
+ /* @__PURE__ */ e(p, {}),
61
+ /* @__PURE__ */ e(c, {
62
+ label: r.recurring_expenses,
63
+ value: l(-o.upcomingExpenses)
64
+ }),
65
+ /* @__PURE__ */ e(p, {}),
66
+ /* @__PURE__ */ e(c, {
67
+ bold: !0,
68
+ label: r.remaining,
69
+ value: l(o.totalRemaining)
70
+ })
71
+ ]
72
+ })]
73
+ }), w = ({ balance: r, institutionGuid: o, isLast: a, lastFour: d, name: s }) => /* @__PURE__ */ t(h, {
74
+ component: "li",
75
+ sx: { position: "relative" },
76
+ children: [/* @__PURE__ */ t(n, {
77
+ sx: {
78
+ alignItems: "center",
79
+ flexDirection: "row",
80
+ gap: 12,
81
+ px: 24,
82
+ py: 12
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ e(u, {
86
+ alt: "",
87
+ institutionGuid: o,
88
+ logoUrl: o ? void 0 : g,
89
+ size: 32
90
+ }),
91
+ /* @__PURE__ */ t(n, {
92
+ sx: {
93
+ flexGrow: 1,
94
+ minWidth: 0
95
+ },
96
+ children: [/* @__PURE__ */ e(i, {
97
+ truncate: !0,
98
+ variant: "body1",
99
+ children: s
100
+ }), d && /* @__PURE__ */ e(i, {
101
+ color: "text.secondary",
102
+ variant: "caption",
103
+ children: `•••• ${d}`
104
+ })]
105
+ }),
106
+ /* @__PURE__ */ e(x, { children: l(r) })
107
+ ]
108
+ }), /* @__PURE__ */ e(p, { sx: {
109
+ bottom: 0,
110
+ left: a ? 0 : 24,
111
+ position: "absolute",
112
+ right: 0
113
+ } })]
114
+ }), O = ({ accounts: r, copy: o, summary: a, totalBalance: d }) => /* @__PURE__ */ t(n, {
115
+ sx: {
116
+ bgcolor: "background.default",
117
+ pb: 24
118
+ },
119
+ children: [a && /* @__PURE__ */ e(_, {
120
+ copy: o,
121
+ summary: a
122
+ }), r.length === 0 ? /* @__PURE__ */ e(i, {
123
+ component: "p",
124
+ sx: { p: 24 },
125
+ children: o.no_accounts
126
+ }) : /* @__PURE__ */ t(n, { children: [
127
+ /* @__PURE__ */ e(h, {
128
+ sx: {
129
+ pb: 4,
130
+ pt: 16,
131
+ px: 24
132
+ },
133
+ children: /* @__PURE__ */ e(i, {
134
+ bold: !0,
135
+ component: "h3",
136
+ variant: "body1",
137
+ children: o.accounts_header
138
+ })
139
+ }),
140
+ /* @__PURE__ */ e(n, {
141
+ component: "ul",
142
+ sx: {
143
+ bgcolor: "background.paper",
144
+ listStyle: "none",
145
+ m: 0,
146
+ p: 0
147
+ },
148
+ children: r.map(({ guid: s, ...m }, b) => /* @__PURE__ */ f(w, {
149
+ ...m,
150
+ isLast: b === r.length - 1,
151
+ key: s
152
+ }))
153
+ }),
154
+ /* @__PURE__ */ t(n, {
155
+ sx: {
156
+ alignItems: "center",
157
+ bgcolor: "background.paper",
158
+ flexDirection: "row",
159
+ gap: 16,
160
+ px: 24,
161
+ py: 14
162
+ },
163
+ children: [/* @__PURE__ */ e(i, {
164
+ bold: !0,
165
+ sx: { flexGrow: 1 },
166
+ variant: "body1",
167
+ children: o.total_balance
168
+ }), /* @__PURE__ */ e(x, { children: l(d) })]
169
+ })
170
+ ] })]
171
+ });
172
+ export {
173
+ O as default
174
+ };
175
+
176
+ //# sourceMappingURL=AccountListContent.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountListContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListContent.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\n\nimport type { ObligationsSummary } from './layout'\n\nexport interface AccountListRow {\n guid: string\n name: string\n /** The last digits of the account number, shown masked; empty when unknown. */\n lastFour: string\n /** Empty when no institution is known: the default logo is shown. */\n institutionGuid: string\n balance: number\n}\n\nexport interface AccountListContentProps {\n copy: AccountListCopy\n /** Omitted when the beat carries no calculation: the drawer is just the list. */\n summary?: ObligationsSummary\n /** Already ordered. */\n accounts: AccountListRow[]\n totalBalance: number\n}\n\nconst formatAddend = (amount: number) =>\n amount > 0 ? `+${formatSignedCurrency(amount)}` : formatSignedCurrency(amount)\n\nconst Amount = ({ children }: { children: string }) => (\n <Text bold={true} sx={{ flexShrink: 0, fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {children}\n </Text>\n)\n\nconst BreakdownRow = ({\n bold = false,\n label,\n value,\n}: {\n bold?: boolean\n label: string\n value: string\n}) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 16 }}>\n <Text bold={bold} sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Amount>{value}</Amount>\n </Stack>\n)\n\n/** Current cash + estimated income - recurring expenses = remaining, as the pulse drawer tabled it. */\nconst Summary = ({ copy, summary }: { copy: AccountListCopy; summary: ObligationsSummary }) => (\n <Stack sx={{ gap: 12, pt: 24, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {copy.how_is_this_calculated}\n </Text>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={copy.current_cash} value={formatSignedCurrency(summary.cashOnHand)} />\n <Divider />\n <BreakdownRow label={copy.estimated_income} value={formatAddend(summary.estimatedIncome)} />\n <Divider />\n <BreakdownRow\n label={copy.recurring_expenses}\n value={formatSignedCurrency(-summary.upcomingExpenses)}\n />\n <Divider />\n <BreakdownRow\n bold={true}\n label={copy.remaining}\n value={formatSignedCurrency(summary.totalRemaining)}\n />\n </Stack>\n </Stack>\n)\n\n/** One row. The last row's divider runs full width; the rest are inset to the text. */\nconst RowItem = ({\n balance,\n institutionGuid,\n isLast,\n lastFour,\n name,\n}: Omit<AccountListRow, 'guid'> & { isLast: boolean }) => (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12, px: 24, py: 12 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={institutionGuid}\n logoUrl={institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={32}\n />\n <Stack sx={{ flexGrow: 1, minWidth: 0 }}>\n <Text truncate={true} variant=\"body1\">\n {name}\n </Text>\n {lastFour && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {`•••• ${lastFour}`}\n </Text>\n )}\n </Stack>\n <Amount>{formatSignedCurrency(balance)}</Amount>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 24, position: 'absolute', right: 0 }} />\n </Box>\n)\n\n/** Presentational body of the Account List drawer, minus the drawer header. */\nconst AccountListContent = ({ accounts, copy, summary, totalBalance }: AccountListContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n {summary && <Summary copy={copy} summary={summary} />}\n {accounts.length === 0 ? (\n <Text component=\"p\" sx={{ p: 24 }}>\n {copy.no_accounts}\n </Text>\n ) : (\n <Stack>\n <Box sx={{ pb: 4, pt: 16, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {copy.accounts_header}\n </Text>\n </Box>\n <Stack component=\"ul\" sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}>\n {accounts.map(({ guid, ...row }, index) => (\n <RowItem {...row} isLast={index === accounts.length - 1} key={guid} />\n ))}\n </Stack>\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n flexDirection: 'row',\n gap: 16,\n px: 24,\n py: 14,\n }}\n >\n <Text bold={true} sx={{ flexGrow: 1 }} variant=\"body1\">\n {copy.total_balance}\n </Text>\n <Amount>{formatSignedCurrency(totalBalance)}</Amount>\n </Stack>\n </Stack>\n )}\n </Stack>\n)\n\nexport default AccountListContent\n"],"mappings":";;;;;;;;AA+BA,IAAM,IAAA,CAAgB,MACpB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AAS,IAAA,CAAK,EAAE,MAAA,GAAM,GAAG,EAAA,GAAO,MAC/B,gBAAA,EAAC,GAAD;AAAA,QAAS,GAAI;AAAA,QAAK,QAAQ,MAAU,EAAS,SAAS;AAAA,QAAG,KAAK;AAAA,MAAO,CAAA,CACtE;AAAA,IACI,CAAA;AAAA,IACP,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,MARF,UAAA,CAUE,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,IAAI,EAAE,UAAU,EAAE;AAAA,QAAG,SAAQ;AAAA,QAC5C,UAAA,EAAK;AAAA,MACF,CAAA,GACN,gBAAA,EAAC,GAAD,EAAA,UAAS,EAAqB,CAAY,EAAU,CAAA,CAC/C;AAAA;EACF,EAAA,CAAA,CAEJ"}
@@ -0,0 +1,2 @@
1
+ export { AccountListBlock } from './AccountListBlock';
2
+ export { useAccountListPrepare } from './useAccountListPrepare';
@@ -0,0 +1,20 @@
1
+ import { Account, Beat } from '../../../core';
2
+ /**
3
+ * The accounts the drawer lists, largest balance first: the beat's `account_guids` among the store's
4
+ * visible accounts, or every visible account the store counts as cash when the beat names none
5
+ * (tupac's Monthly Obligations factory sums the cash accounts without recording their guids). Both
6
+ * rules are the store's: `visibleAccounts` applies the widget's hidden, closed and external/held
7
+ * settings, `cashAccounts` says which types are cash.
8
+ */
9
+ export declare const resolveBeatAccounts: (beat: Beat, visibleAccounts: Account[], cashAccounts: Account[]) => Account[];
10
+ export declare const sumBalances: (accounts: Account[]) => number;
11
+ /** The last four digits of an account number; empty when the account has none. */
12
+ export declare const lastFour: (accountNumber?: string) => string;
13
+ export interface ObligationsSummary {
14
+ cashOnHand: number;
15
+ estimatedIncome: number;
16
+ upcomingExpenses: number;
17
+ totalRemaining: number;
18
+ }
19
+ /** The beat's calculation from `drilldown_data`; undefined unless every figure is a finite number. */
20
+ export declare const readSummary: (beat: Beat) => ObligationsSummary | undefined;
@@ -0,0 +1,24 @@
1
+ var r = (e) => e.balance ?? 0, d = (e, t, a) => {
2
+ const o = new Set(e.account_guids?.length ? e.account_guids : a.map(({ guid: n }) => n));
3
+ return t.filter((n) => o.has(n.guid)).sort((n, s) => r(s) - r(n));
4
+ }, l = (e) => e.reduce((t, a) => t + r(a), 0), m = (e) => e?.replace(/\D/g, "").slice(-4) ?? "", v = (e) => {
5
+ const t = e.insights_payload?.drilldown_data, a = (u) => {
6
+ const i = t?.[u];
7
+ return typeof i == "number" && Number.isFinite(i) ? i : void 0;
8
+ }, o = a("available_cash_on_hand"), n = a("estimated_income"), s = a("upcoming_expenses"), c = a("total_remaining");
9
+ if (!(o === void 0 || n === void 0 || s === void 0 || c === void 0))
10
+ return {
11
+ cashOnHand: o,
12
+ estimatedIncome: n,
13
+ upcomingExpenses: s,
14
+ totalRemaining: c
15
+ };
16
+ };
17
+ export {
18
+ m as lastFour,
19
+ v as readSummary,
20
+ d as resolveBeatAccounts,
21
+ l as sumBalances
22
+ };
23
+
24
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import type { Account, Beat } from '../../../core'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n/**\n * The accounts the drawer lists, largest balance first: the beat's `account_guids` among the store's\n * visible accounts, or every visible account the store counts as cash when the beat names none\n * (tupac's Monthly Obligations factory sums the cash accounts without recording their guids). Both\n * rules are the store's: `visibleAccounts` applies the widget's hidden, closed and external/held\n * settings, `cashAccounts` says which types are cash.\n */\nexport const resolveBeatAccounts = (\n beat: Beat,\n visibleAccounts: Account[],\n cashAccounts: Account[],\n): Account[] => {\n const guids = new Set<string>(\n beat.account_guids?.length ? beat.account_guids : cashAccounts.map(({ guid }) => guid),\n )\n\n return visibleAccounts\n .filter((account) => guids.has(account.guid))\n .sort((a, b) => balanceOf(b) - balanceOf(a))\n}\n\nexport const sumBalances = (accounts: Account[]): number =>\n accounts.reduce((total, account) => total + balanceOf(account), 0)\n\n/** The last four digits of an account number; empty when the account has none. */\nexport const lastFour = (accountNumber?: string): string =>\n accountNumber?.replace(/\\D/g, '').slice(-4) ?? ''\n\nexport interface ObligationsSummary {\n cashOnHand: number\n estimatedIncome: number\n upcomingExpenses: number\n totalRemaining: number\n}\n\n/** The beat's calculation from `drilldown_data`; undefined unless every figure is a finite number. */\nexport const readSummary = (beat: Beat): ObligationsSummary | undefined => {\n const data = beat.insights_payload?.drilldown_data\n const numberAt = (key: string) => {\n const value = data?.[key]\n\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n }\n const cashOnHand = numberAt('available_cash_on_hand')\n const estimatedIncome = numberAt('estimated_income')\n const upcomingExpenses = numberAt('upcoming_expenses')\n const totalRemaining = numberAt('total_remaining')\n\n if (\n cashOnHand === undefined ||\n estimatedIncome === undefined ||\n upcomingExpenses === undefined ||\n totalRemaining === undefined\n ) {\n return undefined\n }\n\n return { cashOnHand, estimatedIncome, upcomingExpenses, totalRemaining }\n}\n"],"mappings":"AAEA,IAAM,IAAA,CAAa,MAAqB,EAAQ,WAAW,GAS9C,IAAA,CACX,GACA,GACA,MACc;AACd,QAAM,IAAQ,IAAI,IAChB,EAAK,eAAe,SAAS,EAAK,gBAAgB,EAAa,IAAA,CAAK,EAAE,MAAA,EAAA,MAAW,CAAI,CACvF;AAEA,SAAO,EACJ,OAAA,CAAQ,MAAY,EAAM,IAAI,EAAQ,IAAI,CAAC,EAC3C,KAAA,CAAM,GAAG,MAAM,EAAU,CAAC,IAAI,EAAU,CAAC,CAAC;AAC/C,GAEa,IAAA,CAAe,MAC1B,EAAS,OAAA,CAAQ,GAAO,MAAY,IAAQ,EAAU,CAAO,GAAG,CAAC,GAGtD,IAAA,CAAY,MACvB,GAAe,QAAQ,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,IAUpC,IAAA,CAAe,MAA+C;AACzE,QAAM,IAAO,EAAK,kBAAkB,gBAC9B,IAAA,CAAY,MAAgB;AAChC,UAAM,IAAQ,IAAO,CAAA;AAErB,WAAO,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ;AAAA,EACvE,GACM,IAAa,EAAS,wBAAwB,GAC9C,IAAkB,EAAS,kBAAkB,GAC7C,IAAmB,EAAS,mBAAmB,GAC/C,IAAiB,EAAS,iBAAiB;AAEjD,MACE,EAAA,MAAe,UACf,MAAoB,UACpB,MAAqB,UACrB,MAAmB;AAKrB,WAAO;AAAA,MAAE,YAAA;AAAA,MAAY,iBAAA;AAAA,MAAiB,kBAAA;AAAA,MAAkB,gBAAA;AAAA,IAAe;AACzE"}
@@ -0,0 +1 @@
1
+ export declare const useAccountListPrepare: () => void;
@@ -0,0 +1,13 @@
1
+ import { useAccountStore as c } from "../../../common/context/hooks.es.js";
2
+ import e from "react";
3
+ var u = () => {
4
+ const { accountsLoaded: o, loadAccounts: t } = c();
5
+ e.useEffect(() => {
6
+ o || t();
7
+ }, [o, t]);
8
+ };
9
+ export {
10
+ u as useAccountListPrepare
11
+ };
12
+
13
+ //# sourceMappingURL=useAccountListPrepare.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAccountListPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useAccountStore } from '../../../common'\n\nexport const useAccountListPrepare = () => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!accountsLoaded) void loadAccounts()\n }, [accountsLoaded, loadAccounts])\n}\n"],"mappings":";;AAIA,IAAa,IAAA,MAA8B;AACzC,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KAAgB,EAAkB;AAAA,EACzC,GAAG,CAAC,GAAgB,CAAY,CAAC;AACnC"}
@@ -1,5 +1,5 @@
1
+ import { formatSignedCurrency as d } from "../../../core/utils/NumberFormatting.es.js";
1
2
  import { getLogoElevation as x } from "../../components/logoShadow.es.js";
2
- import { formatSignedCurrency as d } from "./layout.es.js";
3
3
  import { createElement as b } from "react";
4
4
  import i from "@mui/material/Stack";
5
5
  import { Text as a } from "@mxenabled/mxui";
@@ -1 +1 @@
1
- {"version":3,"file":"RemainingCashContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { getLogoElevation } from '../../components/logoShadow'\nimport { formatSignedCurrency } from './layout'\n\nexport interface RemainingCashRow {\n key: string\n name: string\n amount: number\n /** The row's 32px logo: an account's institution or an expense's category. */\n leading: ReactNode\n}\n\ninterface RemainingCashSectionProps {\n header: string\n /** Already grouped and ordered, including any \"Other (#)\" row. */\n rows: RemainingCashRow[]\n}\n\ninterface RemainingCashSummaryProps {\n /** Omitted when there is no upcoming payday: a \"remaining until payday\" figure has no meaning. */\n remaining?: { amount: number; caption: string }\n cashOnHand: number\n upcomingExpenses: number\n cashOnHandLabel: string\n upcomingExpensesLabel: string\n}\n\nexport interface RemainingCashContentProps {\n summary: RemainingCashSummaryProps\n accounts: RemainingCashSectionProps\n expenses: RemainingCashSectionProps\n}\n\nconst BreakdownRow = ({ label, value }: { label: string; value: string }) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 24 }}>\n <Text sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} sx={{ fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\nconst Summary = ({\n cashOnHand,\n cashOnHandLabel,\n remaining,\n upcomingExpenses,\n upcomingExpensesLabel,\n}: RemainingCashSummaryProps) => (\n <Stack sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n }}\n >\n {remaining && (\n // One announcement (\"$2,350.00, Remaining until payday (7 days)\") instead of two loose text\n // nodes. The amount keeps the h2 look but is a paragraph: it is a value, not a heading.\n <Stack\n aria-label={`${formatSignedCurrency(remaining.amount)}, ${remaining.caption}`}\n role=\"group\"\n sx={{ alignItems: 'center', justifyContent: 'center', minHeight: 72, p: 12 }}\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h2\">\n {formatSignedCurrency(remaining.amount)}\n </Text>\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"subtitle2\">\n {remaining.caption}\n </Text>\n </Stack>\n )}\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={cashOnHandLabel} value={formatSignedCurrency(cashOnHand)} />\n <Divider />\n {/* Shown as a deduction (-$1,200.00) per Figma; the expense rows below show positive amounts. */}\n <BreakdownRow\n label={upcomingExpensesLabel}\n value={formatSignedCurrency(-upcomingExpenses)}\n />\n </Stack>\n </Stack>\n </Stack>\n)\n\n/** One 64px row. The last row's divider runs full width; the rest are inset 24px (Figma). */\nconst RowItem = ({\n amount,\n isLast,\n leading,\n name,\n}: Omit<RemainingCashRow, 'key'> & { isLast: boolean }) => (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, px: 24, py: 14 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n <Box sx={{ display: 'flex', flexShrink: 0, height: 32, width: 32 }}>{leading}</Box>\n <Text truncate={true} variant=\"body1\">\n {name}\n </Text>\n </Stack>\n <Text bold={true} sx={{ flexShrink: 0, fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {formatSignedCurrency(amount)}\n </Text>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 24, position: 'absolute', right: 0 }} />\n </Box>\n)\n\n// The drawer title is the h2, so section headers are h3 and each section is a real list.\nconst Section = ({ header, rows }: RemainingCashSectionProps) => (\n <Stack>\n <Box sx={{ pb: 4, pt: 16, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {header}\n </Text>\n </Box>\n <Stack component=\"ul\" sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}>\n {rows.map(({ key, ...row }, index) => (\n <RowItem {...row} isLast={index === rows.length - 1} key={key} />\n ))}\n </Stack>\n </Stack>\n)\n\n/** Presentational body of the Remaining Cash drawer (Figma 9936:39163, minus the drawer header). */\nconst RemainingCashContent = ({ accounts, expenses, summary }: RemainingCashContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <Summary {...summary} />\n {accounts.rows.length > 0 && <Section {...accounts} />}\n {expenses.rows.length > 0 && <Section {...expenses} />}\n </Stack>\n)\n\nexport default RemainingCashContent\n"],"mappings":";;;;;;;;AAwCA,IAAM,IAAA,CAAgB,EAAE,OAAA,GAAO,OAAA,EAAA,MAC7B,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,eAAe;AAAA,IAAO,KAAK;AAAA,IAAI,WAAW;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAAxF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,IAAI,EAAE,UAAU,EAAE;AAAA,IAAG,SAAQ;AAAA,IAChC,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,IAAI,EAAE,oBAAoB,eAAe;AAAA,IAAG,SAAQ;AAAA,IACnE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ourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nexport interface RemainingCashRow {\n key: string\n name: string\n amount: number\n /** The row's 32px logo: an account's institution or an expense's category. */\n leading: ReactNode\n}\n\ninterface RemainingCashSectionProps {\n header: string\n /** Already grouped and ordered, including any \"Other (#)\" row. */\n rows: RemainingCashRow[]\n}\n\ninterface RemainingCashSummaryProps {\n /** Omitted when there is no upcoming payday: a \"remaining until payday\" figure has no meaning. */\n remaining?: { amount: number; caption: string }\n cashOnHand: number\n upcomingExpenses: number\n cashOnHandLabel: string\n upcomingExpensesLabel: string\n}\n\nexport interface RemainingCashContentProps {\n summary: RemainingCashSummaryProps\n accounts: RemainingCashSectionProps\n expenses: RemainingCashSectionProps\n}\n\nconst BreakdownRow = ({ label, value }: { label: string; value: string }) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 24 }}>\n <Text sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} sx={{ fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\nconst Summary = ({\n cashOnHand,\n cashOnHandLabel,\n remaining,\n upcomingExpenses,\n upcomingExpensesLabel,\n}: RemainingCashSummaryProps) => (\n <Stack sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n }}\n >\n {remaining && (\n // One announcement (\"$2,350.00, Remaining until payday (7 days)\") instead of two loose text\n // nodes. The amount keeps the h2 look but is a paragraph: it is a value, not a heading.\n <Stack\n aria-label={`${formatSignedCurrency(remaining.amount)}, ${remaining.caption}`}\n role=\"group\"\n sx={{ alignItems: 'center', justifyContent: 'center', minHeight: 72, p: 12 }}\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h2\">\n {formatSignedCurrency(remaining.amount)}\n </Text>\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"subtitle2\">\n {remaining.caption}\n </Text>\n </Stack>\n )}\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={cashOnHandLabel} value={formatSignedCurrency(cashOnHand)} />\n <Divider />\n {/* Shown as a deduction (-$1,200.00) per Figma; the expense rows below show positive amounts. */}\n <BreakdownRow\n label={upcomingExpensesLabel}\n value={formatSignedCurrency(-upcomingExpenses)}\n />\n </Stack>\n </Stack>\n </Stack>\n)\n\n/** One 64px row. The last row's divider runs full width; the rest are inset 24px (Figma). */\nconst RowItem = ({\n amount,\n isLast,\n leading,\n name,\n}: Omit<RemainingCashRow, 'key'> & { isLast: boolean }) => (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, px: 24, py: 14 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n <Box sx={{ display: 'flex', flexShrink: 0, height: 32, width: 32 }}>{leading}</Box>\n <Text truncate={true} variant=\"body1\">\n {name}\n </Text>\n </Stack>\n <Text bold={true} sx={{ flexShrink: 0, fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {formatSignedCurrency(amount)}\n </Text>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 24, position: 'absolute', right: 0 }} />\n </Box>\n)\n\n// The drawer title is the h2, so section headers are h3 and each section is a real list.\nconst Section = ({ header, rows }: RemainingCashSectionProps) => (\n <Stack>\n <Box sx={{ pb: 4, pt: 16, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {header}\n </Text>\n </Box>\n <Stack component=\"ul\" sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}>\n {rows.map(({ key, ...row }, index) => (\n <RowItem {...row} isLast={index === rows.length - 1} key={key} />\n ))}\n </Stack>\n </Stack>\n)\n\n/** Presentational body of the Remaining Cash drawer (Figma 9936:39163, minus the drawer header). */\nconst RemainingCashContent = ({ accounts, expenses, summary }: RemainingCashContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <Summary {...summary} />\n {accounts.rows.length > 0 && <Section {...accounts} />}\n {expenses.rows.length > 0 && <Section {...expenses} />}\n </Stack>\n)\n\nexport default RemainingCashContent\n"],"mappings":";;;;;;;;AAwCA,IAAM,IAAA,CAAgB,EAAE,OAAA,GAAO,OAAA,EAAA,MAC7B,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,eAAe;AAAA,IAAO,KAAK;AAAA,IAAI,WAAW;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAAxF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,IAAI,EAAE,UAAU,EAAE;AAAA,IAAG,SAAQ;AAAA,IAChC,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,IAAI,EAAE,oBAAoB,eAAe;AAAA,IAAG,SAAQ;AAAA,IACnE,UAAA;AAAA,EACG,CAAA,CACD;IAGH,IAAA,CAAW,EACf,YAAA,GACA,iBAAA,GACA,WAAA,GACA,kBAAA,GACA,uBAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,IAAI;AAAA,IAAG,IAAI;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EACjC,UAAA,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,SAAS;AAAA,MACT,cAAc;AAAA,MACd,WAAW;AAAA,MACX,KAAK;AAAA,MACL,GAAG;AAAA,IACL;AAAA,IA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C,GAAD;AAAA,EAAO,WAAU;AAAA,EAAK,IAAI;AAAA,IAAE,SAAS;AAAA,IAAoB,WAAW;AAAA,IAAQ,GAAG;AAAA,IAAG,GAAG;AAAA,EAAE;AAAA,EACpF,UAAA,EAAK,IAAA,CAAK,EAAE,KAAA,GAAK,GAAG,EAAA,GAAO,MAC1B,gBAAA,EAAC,GAAD;AAAA,IAAS,GAAI;AAAA,IAAK,QAAQ,MAAU,EAAK,SAAS;AAAA,IAAQ,KAAA;AAAA,EAAM,CAAA,CACjE;AACI,CAAA,CACF,EAAA,CAAA,GAIH,IAAA,CAAwB,EAAE,UAAA,GAAU,UAAA,GAAU,SAAA,EAAA,MAClD,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,SAAS;AAAA,IAAsB,IAAI;AAAA,EAAG;AAAA,EAAnD,UAAA;AAAA,IACE,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAU,CAAA;AAAA,IACtB,EAAS,KAAK,SAAS,KAAK,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAW,CAAA;AAAA,IACpD,EAAS,KAAK,SAAS,KAAK,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAW,CAAA;AAAA,EAChD"}
@@ -12,10 +12,5 @@ export interface GroupedRows<T> {
12
12
  export declare const groupRows: <T extends {
13
13
  amount: number;
14
14
  }>(rows: T[]) => GroupedRows<T>;
15
- /**
16
- * `-$220.00`, not `$-220.00`: the sign goes before the currency symbol. Rounded to cents first so a
17
- * sub-cent negative (or `-0`) reads `$0.00`, never `-$0.00`.
18
- */
19
- export declare const formatSignedCurrency: (amount: number) => string;
20
15
  export declare const getCaption: (copy: RemainingCashCopy, days: number) => string;
21
16
  export declare const getOtherLabel: (templateOne: string, templateMulti: string, count: number) => string;
@@ -1,6 +1,5 @@
1
1
  import { buildDynamicCopy as a, buildPluralCopy as i } from "../../../core/utils/Localization.es.js";
2
- import { formatCurrency as u } from "../../../core/utils/NumberFormatting.es.js";
3
- var m = (t) => {
2
+ var l = (t) => {
4
3
  const r = [...t].sort((e, o) => o.amount - e.amount);
5
4
  if (r.length <= 2) return { shown: r };
6
5
  const n = r.slice(2);
@@ -11,15 +10,11 @@ var m = (t) => {
11
10
  total: n.reduce((e, o) => e + o.amount, 0)
12
11
  }
13
12
  };
14
- }, c = (t) => {
15
- const r = Math.round(Math.abs(t) * 100), n = u(r / 100, "0,0.00");
16
- return t < 0 && r > 0 ? `-${n}` : n;
17
- }, g = (t, r) => r === 1 ? t.remaining_until_payday_one : a(t.remaining_until_payday, String(r)), d = (t, r, n) => i(t, r, n, String(n));
13
+ }, s = (t, r) => r === 1 ? t.remaining_until_payday_one : a(t.remaining_until_payday, String(r)), g = (t, r, n) => i(t, r, n, String(n));
18
14
  export {
19
- c as formatSignedCurrency,
20
- g as getCaption,
21
- d as getOtherLabel,
22
- m as groupRows
15
+ s as getCaption,
16
+ g as getOtherLabel,
17
+ l as groupRows
23
18
  };
24
19
 
25
20
  //# sourceMappingURL=layout.es.js.map