@mx-cartographer/experiences 9.7.131 → 9.7.133

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 (83) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/core/utils/NumberFormatting.d.ts +6 -0
  3. package/dist/core/utils/NumberFormatting.es.js +20 -16
  4. package/dist/core/utils/NumberFormatting.es.js.map +1 -1
  5. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js +17 -17
  6. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +38 -38
  8. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +14 -14
  10. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -1
  11. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -26
  12. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
  13. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js +22 -22
  14. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +47 -47
  16. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +18 -18
  18. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
  19. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +28 -28
  20. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
  21. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +57 -56
  22. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
  23. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +50 -50
  24. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
  26. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +52 -51
  27. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  28. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +17 -17
  29. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  30. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +20 -20
  31. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
  32. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +25 -25
  33. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
  34. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +17 -16
  35. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
  36. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +34 -34
  37. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
  38. package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js +7 -7
  39. package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js.map +1 -1
  40. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js +13 -13
  41. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js.map +1 -1
  42. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +39 -39
  43. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  44. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +20 -20
  45. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
  46. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +44 -44
  47. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
  48. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +14 -14
  49. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
  50. package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js +8 -8
  51. package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js.map +1 -1
  52. package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js +25 -25
  53. package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js.map +1 -1
  54. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +39 -46
  55. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  56. package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +18 -18
  57. package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -1
  58. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +19 -19
  59. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
  60. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +9 -9
  61. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
  62. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +12 -12
  63. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
  64. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +58 -57
  65. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  66. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +18 -18
  67. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
  68. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +10 -10
  69. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
  70. package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js +13 -13
  71. package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js.map +1 -1
  72. package/dist/insights-v2/blocks/slotReaders.d.ts +3 -1
  73. package/dist/insights-v2/blocks/slotReaders.es.js +17 -6
  74. package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
  75. package/dist/insights-v2/components/CompactInsightCard.es.js +44 -43
  76. package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
  77. package/dist/insights-v2/components/SaveAnExtraCard.es.js +6 -6
  78. package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
  79. package/dist/insights-v2/components/WithdrawalCard.es.js +20 -20
  80. package/dist/insights-v2/components/WithdrawalCard.es.js.map +1 -1
  81. package/dist/recurringtransactions/components/RecurrenceRow.es.js +102 -92
  82. package/dist/recurringtransactions/components/RecurrenceRow.es.js.map +1 -1
  83. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, formatCurrency } from '../../../../common'\nimport type { BudgetBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport CategoryTile from '../../../components/CategoryTile'\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\nimport LogoMark from '../../../components/LogoMark'\n\nimport type { BlockProps } from '../../types'\n\nimport { getColorByBudgetTier } from './util'\n\nexport const BudgetBlock = ({ payload }: BlockProps<BudgetBlockData>) => {\n const {\n budget_percent,\n amount,\n budget_tier,\n category_guid,\n merchant_guid,\n spent_amount,\n budgeted_amount,\n localized_payload,\n } = payload.instance_slot_data\n\n const color = getColorByBudgetTier(budget_tier)\n\n // Precomputed as a JSX element (not a component defined during render) so it\n // isn't remounted on every re-render.\n const icon = category_guid ? (\n <CategoryTile categoryGuid={category_guid} size={44} tint={0.25} />\n ) : (\n <LogoMark logo={{ merchant_guid }} size={44} />\n )\n\n const block_left_footer = buildDynamicCopy(\n localized_payload?.spent_label || '',\n formatCurrency(spent_amount, '0,0.00'),\n ) as string\n\n const block_right_footer = buildDynamicCopy(\n localized_payload?.budgeted_label || '',\n formatCurrency(budgeted_amount, '0,0.00'),\n ) as string\n\n const amountToDisplay = (\n <Text bold={true} variant=\"h2\">\n {category_guid && category_guid !== null\n ? (buildDynamicCopy(\n localized_payload?.amount_left_label || '',\n formatCurrency(amount, '0,0.00'),\n ) as string)\n : formatCurrency(amount, '0,0.00')}\n </Text>\n )\n\n return (\n <StatusIndicator\n amount={amountToDisplay}\n borderRadius=\"12px\"\n completeColor={color}\n icon={icon}\n label={localized_payload?.primary_text || ''}\n leftLabel={block_left_footer}\n percentComplete={budget_percent}\n rightLabel={block_right_footer}\n sx={{ '& .details-container': { gap: 12 } }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,IAAA,CAAe,EAAE,SAAA,EAAA,MAA2C;AACvE,QAAM,EACJ,gBAAA,GACA,QAAA,GACA,aAAA,GACA,eAAA,GACA,eAAA,GACA,cAAA,GACA,iBAAA,GACA,mBAAA,EAAA,IACE,EAAQ,oBAEN,IAAQ,EAAqB,CAAW,GAIxC,IAAO,IACX,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc;AAAA,IAAe,MAAM;AAAA,IAAI,MAAM;AAAA,EAAO,CAAA,IAElE,gBAAA,EAAC,GAAD;AAAA,IAAU,MAAM,EAAE,eAAA,EAAc;AAAA,IAAG,MAAM;AAAA,EAAK,CAAA,GAG1C,IAAoB,EACxB,GAAmB,eAAe,IAClC,EAAe,GAAc,QAAQ,CACvC,GAEM,IAAqB,EACzB,GAAmB,kBAAkB,IACrC,EAAe,GAAiB,QAAQ,CAC1C,GAEM,IACJ,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,SAAQ;AAAA,IACvB,UAAA,KAAiB,MAAkB,OAC/B,EACC,GAAmB,qBAAqB,IACxC,EAAe,GAAQ,QAAQ,CACjC,IACA,EAAe,GAAQ,QAAQ;AAAA,EAC/B,CAAA;AAGR,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ;AAAA,IACR,cAAa;AAAA,IACb,eAAe;AAAA,IACT,MAAA;AAAA,IACN,OAAO,GAAmB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,IAAI,EAAE,wBAAwB,EAAE,KAAK,GAAG,EAAE;AAAA,EAC3C,CAAA;AAEL"}
1
+ {"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy } from '../../../../common'\nimport type { BudgetBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport CategoryTile from '../../../components/CategoryTile'\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\nimport LogoMark from '../../../components/LogoMark'\n\nimport type { BlockProps } from '../../types'\n\nimport { getColorByBudgetTier } from './util'\n\nexport const BudgetBlock = ({ payload }: BlockProps<BudgetBlockData>) => {\n const {\n budget_percent,\n amount,\n budget_tier,\n category_guid,\n merchant_guid,\n spent_amount,\n budgeted_amount,\n localized_payload,\n } = payload.instance_slot_data\n\n const color = getColorByBudgetTier(budget_tier)\n\n // Precomputed as a JSX element (not a component defined during render) so it\n // isn't remounted on every re-render.\n const icon = category_guid ? (\n <CategoryTile categoryGuid={category_guid} size={44} tint={0.25} />\n ) : (\n <LogoMark logo={{ merchant_guid }} size={44} />\n )\n\n const block_left_footer = buildDynamicCopy(\n localized_payload?.spent_label || '',\n formatCurrency(spent_amount, CURRENCY_FORMAT.cents),\n ) as string\n\n const block_right_footer = buildDynamicCopy(\n localized_payload?.budgeted_label || '',\n formatCurrency(budgeted_amount, CURRENCY_FORMAT.cents),\n ) as string\n\n const amountToDisplay = (\n <Text bold={true} variant=\"h2\">\n {category_guid && category_guid !== null\n ? (buildDynamicCopy(\n localized_payload?.amount_left_label || '',\n formatCurrency(amount, CURRENCY_FORMAT.cents),\n ) as string)\n : formatCurrency(amount, CURRENCY_FORMAT.cents)}\n </Text>\n )\n\n return (\n <StatusIndicator\n amount={amountToDisplay}\n borderRadius=\"12px\"\n completeColor={color}\n icon={icon}\n label={localized_payload?.primary_text || ''}\n leftLabel={block_left_footer}\n percentComplete={budget_percent}\n rightLabel={block_right_footer}\n sx={{ '& .details-container': { gap: 12 } }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,IAAA,CAAe,EAAE,SAAA,EAAA,MAA2C;AACvE,QAAM,EACJ,gBAAA,GACA,QAAA,GACA,aAAA,GACA,eAAA,GACA,eAAA,GACA,cAAA,GACA,iBAAA,GACA,mBAAA,EAAA,IACE,EAAQ,oBAEN,IAAQ,EAAqB,CAAW,GAIxC,IAAO,IACX,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc;AAAA,IAAe,MAAM;AAAA,IAAI,MAAM;AAAA,EAAO,CAAA,IAElE,gBAAA,EAAC,GAAD;AAAA,IAAU,MAAM,EAAE,eAAA,EAAc;AAAA,IAAG,MAAM;AAAA,EAAK,CAAA,GAG1C,IAAoB,EACxB,GAAmB,eAAe,IAClC,EAAe,GAAc,EAAgB,KAAK,CACpD,GAEM,IAAqB,EACzB,GAAmB,kBAAkB,IACrC,EAAe,GAAiB,EAAgB,KAAK,CACvD,GAEM,IACJ,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,SAAQ;AAAA,IACvB,UAAA,KAAiB,MAAkB,OAC/B,EACC,GAAmB,qBAAqB,IACxC,EAAe,GAAQ,EAAgB,KAAK,CAC9C,IACA,EAAe,GAAQ,EAAgB,KAAK;AAAA,EAC5C,CAAA;AAGR,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ;AAAA,IACR,cAAa;AAAA,IACb,eAAe;AAAA,IACT,MAAA;AAAA,IACN,OAAO,GAAmB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,IAAI,EAAE,wBAAwB,EAAE,KAAK,GAAG,EAAE;AAAA,EAC3C,CAAA;AAEL"}
@@ -1,77 +1,77 @@
1
- import { DATE_FORMATS_INTL as R, formatDate as k } from "../../../../core/constants/DateFormats.es.js";
2
- import { useGlobalCopyStore as F } from "../../../../common/context/hooks.es.js";
3
- import { slot as f } from "../../../../core/types/Insights.es.js";
4
- import { formatCurrency as i, formatPercentage as N } from "../../../../core/utils/NumberFormatting.es.js";
5
- import { resolveVariantConfig as P } from "../../resolveVariantConfig.es.js";
1
+ import { DATE_FORMATS_INTL as F, formatDate as N } from "../../../../core/constants/DateFormats.es.js";
2
+ import { useGlobalCopyStore as k } from "../../../../common/context/hooks.es.js";
3
+ import { slot as u } from "../../../../core/types/Insights.es.js";
4
+ import { CURRENCY_FORMAT as i, formatCurrency as s, formatPercentage as P } from "../../../../core/utils/NumberFormatting.es.js";
5
+ import { resolveVariantConfig as Y } from "../../resolveVariantConfig.es.js";
6
6
  import B from "../../../components/LogoFromGuid.es.js";
7
- import { DepositLogo as Y } from "../../../components/ComponentBlocks/DepositLogo.es.js";
8
- import G from "../../../components/DebtPayoffCard.es.js";
9
- import j from "../../../components/TransactionListCard.es.js";
10
- import { parseDueDate as I } from "../RepeatingTransactionBlock/weekStrip.es.js";
11
- import { DEBTS_LAYOUT as H, debtsBlockVariant as M } from "./layout.es.js";
7
+ import { DepositLogo as G } from "../../../components/ComponentBlocks/DepositLogo.es.js";
8
+ import j from "../../../components/DebtPayoffCard.es.js";
9
+ import I from "../../../components/TransactionListCard.es.js";
10
+ import { parseDueDate as M } from "../RepeatingTransactionBlock/weekStrip.es.js";
11
+ import { DEBTS_LAYOUT as H, debtsBlockVariant as U } from "./layout.es.js";
12
12
  import V from "react";
13
13
  import { jsx as l } from "react/jsx-runtime";
14
14
  import { useTheme as z } from "@mui/material/styles";
15
- var U = 32, W = /* @__PURE__ */ new Set([
15
+ var W = 32, Z = /* @__PURE__ */ new Set([
16
16
  "credit card",
17
17
  "credit_card",
18
18
  "creditcard"
19
- ]), Z = (t) => W.has((t ?? "").trim().toLowerCase()) ? "credit_card" : "account_balance", $ = (t) => typeof t == "object" && t !== null && typeof t.primary_text == "string", q = (t) => !!t?.balance_label && !!t.payoff_date_label && !!t.monthly_payment_label && !!t.interest_rate_label, ct = ({ payload: t }) => {
20
- const T = z(), o = F().insights_feed?.debts_block, { instance_slot: u } = t, { data: s, variant: A } = u, _ = P(H, A, M.ProjectedPayoff, "DebtsBlock"), p = _.card === "summary", e = q(o) ? o : void 0, m = o?.total_balance_label, b = p ? !!m : !!e;
19
+ ]), $ = (t) => Z.has((t ?? "").trim().toLowerCase()) ? "credit_card" : "account_balance", q = (t) => typeof t == "object" && t !== null && typeof t.primary_text == "string", J = (t) => !!t?.balance_label && !!t.payoff_date_label && !!t.monthly_payment_label && !!t.interest_rate_label, ft = ({ payload: t }) => {
20
+ const C = z(), o = k().insights_feed?.debts_block, { instance_slot: _ } = t, { data: m, variant: R } = _, p = Y(H, R, U.ProjectedPayoff, "DebtsBlock"), b = p.card === "summary", e = J(o) ? o : void 0, c = o?.total_balance_label, d = b ? !!c : !!e;
21
21
  if (V.useEffect(() => {
22
- b || console.warn(`debts_block: ${o ? "copy incomplete" : "copy namespace missing"}; rendering without its labelled figures`);
23
- }, [o, b]), p) {
24
- const r = f(s, "series"), O = (Array.isArray(r) ? r : []).filter($).map((a) => ({
25
- amount: typeof a.amount == "number" ? i(a.amount, "0,0.00") : "",
22
+ d || console.warn(`debts_block: ${o ? "copy incomplete" : "copy namespace missing"}; rendering without its labelled figures`);
23
+ }, [o, d]), b) {
24
+ const r = u(m, "series"), x = (Array.isArray(r) ? r : []).filter(q).map((a) => ({
25
+ amount: typeof a.amount == "number" ? s(a.amount, i.cents) : "",
26
26
  leading: /* @__PURE__ */ l(B, {
27
27
  logo: a.logo,
28
- size: U
28
+ size: W
29
29
  }),
30
30
  subtitle: typeof a.secondary_text == "string" ? a.secondary_text : "",
31
31
  title: a.primary_text
32
- })), L = f(s, "header_text"), c = f(s, "amount");
33
- return /* @__PURE__ */ l(j, {
34
- background: T.palette.primary.lighter,
35
- footer: m && typeof c == "number" && Number.isFinite(c) ? {
36
- amount: i(c, "0,0.00"),
37
- label: m
32
+ })), L = u(m, "header_text"), f = u(m, "amount");
33
+ return /* @__PURE__ */ l(I, {
34
+ background: C.palette.primary.lighter,
35
+ footer: c && typeof f == "number" && Number.isFinite(f) ? {
36
+ amount: s(f, i.cents),
37
+ label: c
38
38
  } : void 0,
39
39
  header: typeof L == "string" ? L : void 0,
40
- rows: O
40
+ rows: x
41
41
  });
42
42
  }
43
- const { account_name: C, account_type: d, amount: y, institution_guid: S, institution_name: x, interest_rate: g, monthly_payment: h, payoff_date: v, status_text: E } = u, n = [];
43
+ const { account_name: A, account_type: y, amount: g, institution_guid: E, institution_name: O, interest_rate: h, monthly_payment: v, payoff_date: T, status_text: S } = _, n = [];
44
44
  if (e) {
45
- const r = v ? I(v) : null;
45
+ const r = T ? M(T) : null;
46
46
  r && n.push({
47
47
  label: e.payoff_date_label,
48
- value: k(r, R.MONTH_SHORT_YEAR)
49
- }), h != null && n.push({
48
+ value: N(r, F.MONTH_SHORT_YEAR)
49
+ }), v != null && n.push({
50
50
  label: e.monthly_payment_label,
51
- value: i(h, "0,0.00")
52
- }), g != null && n.push({
51
+ value: s(v, i.cents)
52
+ }), h != null && n.push({
53
53
  label: e.interest_rate_label,
54
- value: N(g / 100)
54
+ value: P(h / 100)
55
55
  });
56
56
  }
57
- const D = e !== void 0 && y != null;
58
- return /* @__PURE__ */ l(G, {
59
- ..._.style,
60
- balance: D ? i(y, "0,0.00") : void 0,
57
+ const D = e !== void 0 && g != null;
58
+ return /* @__PURE__ */ l(j, {
59
+ ...p.style,
60
+ balance: D ? s(g, i.cents) : void 0,
61
61
  balanceLabel: D ? e.balance_label : void 0,
62
- logo: /* @__PURE__ */ l(Y, {
63
- iconName: Z(d),
64
- institutionGuid: S ?? "",
65
- institutionName: x ?? ""
62
+ logo: /* @__PURE__ */ l(G, {
63
+ iconName: $(y),
64
+ institutionGuid: E ?? "",
65
+ institutionName: O ?? ""
66
66
  }),
67
- name: C,
67
+ name: A,
68
68
  stats: n,
69
- statusLabel: E,
70
- subtitle: d
69
+ statusLabel: S,
70
+ subtitle: y
71
71
  });
72
72
  };
73
73
  export {
74
- ct as default
74
+ ft as default
75
75
  };
76
76
 
77
77
  //# sourceMappingURL=DebtsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DebtsBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { slot, type InsightsPayload, type InstanceSlotRow } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DebtsBlockCopy } from '../../../../core/types/localization/InsightsFeedCopy'\nimport { formatCurrency, formatPercentage } from '../../../../core/utils/NumberFormatting'\n\nimport DepositLogo from '../../../components/ComponentBlocks/DepositLogo'\nimport DebtPayoffCard, { type DebtPayoffStat } from '../../../components/DebtPayoffCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { parseDueDate } from '../RepeatingTransactionBlock/weekStrip'\n\nimport { DEBTS_LAYOUT, debtsBlockVariant } from './layout'\n\n// The card story reads the block's look from here.\nexport { PAYOFF_STYLE } from './layout'\n\ninterface DebtsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n\n/** Account types drawn with the card glyph when there is no institution logo; the rest get the bank. */\nconst CREDIT_CARD_TYPES = new Set(['credit card', 'credit_card', 'creditcard'])\n\nconst iconFor = (accountType?: string) =>\n CREDIT_CARD_TYPES.has((accountType ?? '').trim().toLowerCase())\n ? 'credit_card'\n : 'account_balance'\n\n/** A summary row ditto can draw: an object with a name. Anything else in `series` is skipped. */\nconst isNamedRow = (row: unknown): row is InstanceSlotRow & { primary_text: string } =>\n typeof row === 'object' &&\n row !== null &&\n typeof (row as InstanceSlotRow).primary_text === 'string'\n\n/** Every label the payoff card renders; a partial namespace counts as missing. */\nconst hasAllLabels = (copy?: DebtsBlockCopy): copy is DebtsBlockCopy =>\n !!copy?.balance_label &&\n !!copy.payoff_date_label &&\n !!copy.monthly_payment_label &&\n !!copy.interest_rate_label\n\n/**\n * Debts component block — the content card for the Debt Payoff Strategies beat.\n * `instance_slot.variant` picks the card from `./layout.ts` through `resolveVariantConfig`, as\n * `AccountBlock` does:\n *\n * - `projected_payoff` — one account on the `DebtPayoffCard`. Its facts arrive flat on\n * `instance_slot` (the shape it shipped with): the balance (`amount`), `payoff_date`,\n * `monthly_payment`, `interest_rate`, plus the shared account/institution fields.\n * - `debt_summary` — the beat's several debt accounts on a `TransactionListCard`, read from\n * `instance_slot.data`: one row per account from `series` (pre-localized `logo`, `primary_text`\n * name, `secondary_text` rate, `amount` balance, in the order sent), an optional `header_text`,\n * and the total owed (`amount`) as the footer. With no rows there is nothing to summarize and the\n * block renders nothing.\n *\n * Captions and payoff row labels come from `insights_feed.debts_block` copy, which ships\n * separately. Each variant needs only its own keys: until they have shipped, the card shows what\n * needs no copy (the account row, the summary rows) but never an unlabelled figure, and warns once\n * per mount so the rollout gap is traceable. A row with no value (or an unparseable date) is\n * dropped rather than rendered blank.\n */\nconst DebtsBlock = ({ payload }: DebtsBlockProps) => {\n const theme = useTheme()\n const copy = useGlobalCopyStore().insights_feed?.debts_block\n const { instance_slot } = payload\n const { data, variant } = instance_slot\n\n const layout = resolveVariantConfig(\n DEBTS_LAYOUT,\n variant,\n debtsBlockVariant.ProjectedPayoff,\n 'DebtsBlock',\n )\n const isSummary = layout.card === 'summary'\n\n const labels = hasAllLabels(copy) ? copy : undefined\n const totalLabel = copy?.total_balance_label\n const hasCopy = isSummary ? !!totalLabel : !!labels\n\n React.useEffect(() => {\n if (hasCopy) return\n console.warn(\n `debts_block: ${copy ? 'copy incomplete' : 'copy namespace missing'}; rendering without its labelled figures`,\n )\n }, [copy, hasCopy])\n\n if (isSummary) {\n // `slot()` is an unchecked cast over backend data, so every value is narrowed before use.\n const series = slot<unknown[]>(data, 'series')\n const rows = (Array.isArray(series) ? series : []).filter(isNamedRow).map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n leading: <LogoFromGuid logo={row.logo} size={ROW_LOGO_SIZE} />,\n subtitle: typeof row.secondary_text === 'string' ? row.secondary_text : '',\n title: row.primary_text,\n }))\n const header = slot<unknown>(data, 'header_text')\n const total = slot<unknown>(data, 'amount')\n\n return (\n <TransactionListCard\n background={theme.palette.primary.lighter}\n footer={\n totalLabel && typeof total === 'number' && Number.isFinite(total)\n ? { amount: formatCurrency(total, '0,0.00'), label: totalLabel }\n : undefined\n }\n header={typeof header === 'string' ? header : undefined}\n rows={rows}\n />\n )\n }\n\n const {\n account_name,\n account_type,\n amount,\n institution_guid,\n institution_name,\n interest_rate,\n monthly_payment,\n payoff_date,\n status_text,\n } = instance_slot\n\n const stats: DebtPayoffStat[] = []\n if (labels) {\n const payoffDate = payoff_date ? parseDueDate(payoff_date) : null\n if (payoffDate) {\n stats.push({\n label: labels.payoff_date_label,\n value: formatDate(payoffDate, DATE_FORMATS_INTL.MONTH_SHORT_YEAR),\n })\n }\n if (monthly_payment != null) {\n stats.push({\n label: labels.monthly_payment_label,\n value: formatCurrency(monthly_payment, '0,0.00'),\n })\n }\n if (interest_rate != null) {\n // `interest_rate` arrives as a percentage (19.99); Intl's percent style expects a fraction.\n stats.push({\n label: labels.interest_rate_label,\n value: formatPercentage(interest_rate / 100),\n })\n }\n }\n\n const hasBalance = labels !== undefined && amount != null\n\n return (\n <DebtPayoffCard\n {...layout.style}\n balance={hasBalance ? formatCurrency(amount, '0,0.00') : undefined}\n balanceLabel={hasBalance ? labels.balance_label : undefined}\n logo={\n <DepositLogo\n iconName={iconFor(account_type)}\n institutionGuid={institution_guid ?? ''}\n institutionName={institution_name ?? ''}\n />\n }\n name={account_name}\n stats={stats}\n statusLabel={status_text}\n subtitle={account_type}\n />\n )\n}\n\nexport default DebtsBlock\n"],"mappings":";;;;;;;;;;;;;;AA2BA,I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AoB;AAAA,MACrC,iBAAiB,KAAoB;AAAA,IACtC,CAAA;AAAA,IAEH,MAAM;AAAA,IACC,OAAA;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACX,CAAA;AAEL"}
1
+ {"version":3,"file":"DebtsBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { slot, type InsightsPayload, type InstanceSlotRow } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DebtsBlockCopy } from '../../../../core/types/localization/InsightsFeedCopy'\nimport {\n CURRENCY_FORMAT,\n formatCurrency,\n formatPercentage,\n} from '../../../../core/utils/NumberFormatting'\n\nimport DepositLogo from '../../../components/ComponentBlocks/DepositLogo'\nimport DebtPayoffCard, { type DebtPayoffStat } from '../../../components/DebtPayoffCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { parseDueDate } from '../RepeatingTransactionBlock/weekStrip'\n\nimport { DEBTS_LAYOUT, debtsBlockVariant } from './layout'\n\n// The card story reads the block's look from here.\nexport { PAYOFF_STYLE } from './layout'\n\ninterface DebtsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n\n/** Account types drawn with the card glyph when there is no institution logo; the rest get the bank. */\nconst CREDIT_CARD_TYPES = new Set(['credit card', 'credit_card', 'creditcard'])\n\nconst iconFor = (accountType?: string) =>\n CREDIT_CARD_TYPES.has((accountType ?? '').trim().toLowerCase())\n ? 'credit_card'\n : 'account_balance'\n\n/** A summary row ditto can draw: an object with a name. Anything else in `series` is skipped. */\nconst isNamedRow = (row: unknown): row is InstanceSlotRow & { primary_text: string } =>\n typeof row === 'object' &&\n row !== null &&\n typeof (row as InstanceSlotRow).primary_text === 'string'\n\n/** Every label the payoff card renders; a partial namespace counts as missing. */\nconst hasAllLabels = (copy?: DebtsBlockCopy): copy is DebtsBlockCopy =>\n !!copy?.balance_label &&\n !!copy.payoff_date_label &&\n !!copy.monthly_payment_label &&\n !!copy.interest_rate_label\n\n/**\n * Debts component block — the content card for the Debt Payoff Strategies beat.\n * `instance_slot.variant` picks the card from `./layout.ts` through `resolveVariantConfig`, as\n * `AccountBlock` does:\n *\n * - `projected_payoff` — one account on the `DebtPayoffCard`. Its facts arrive flat on\n * `instance_slot` (the shape it shipped with): the balance (`amount`), `payoff_date`,\n * `monthly_payment`, `interest_rate`, plus the shared account/institution fields.\n * - `debt_summary` — the beat's several debt accounts on a `TransactionListCard`, read from\n * `instance_slot.data`: one row per account from `series` (pre-localized `logo`, `primary_text`\n * name, `secondary_text` rate, `amount` balance, in the order sent), an optional `header_text`,\n * and the total owed (`amount`) as the footer. With no rows there is nothing to summarize and the\n * block renders nothing.\n *\n * Captions and payoff row labels come from `insights_feed.debts_block` copy, which ships\n * separately. Each variant needs only its own keys: until they have shipped, the card shows what\n * needs no copy (the account row, the summary rows) but never an unlabelled figure, and warns once\n * per mount so the rollout gap is traceable. A row with no value (or an unparseable date) is\n * dropped rather than rendered blank.\n */\nconst DebtsBlock = ({ payload }: DebtsBlockProps) => {\n const theme = useTheme()\n const copy = useGlobalCopyStore().insights_feed?.debts_block\n const { instance_slot } = payload\n const { data, variant } = instance_slot\n\n const layout = resolveVariantConfig(\n DEBTS_LAYOUT,\n variant,\n debtsBlockVariant.ProjectedPayoff,\n 'DebtsBlock',\n )\n const isSummary = layout.card === 'summary'\n\n const labels = hasAllLabels(copy) ? copy : undefined\n const totalLabel = copy?.total_balance_label\n const hasCopy = isSummary ? !!totalLabel : !!labels\n\n React.useEffect(() => {\n if (hasCopy) return\n console.warn(\n `debts_block: ${copy ? 'copy incomplete' : 'copy namespace missing'}; rendering without its labelled figures`,\n )\n }, [copy, hasCopy])\n\n if (isSummary) {\n // `slot()` is an unchecked cast over backend data, so every value is narrowed before use.\n const series = slot<unknown[]>(data, 'series')\n const rows = (Array.isArray(series) ? series : []).filter(isNamedRow).map((row) => ({\n amount:\n typeof row.amount === 'number' ? formatCurrency(row.amount, CURRENCY_FORMAT.cents) : '',\n leading: <LogoFromGuid logo={row.logo} size={ROW_LOGO_SIZE} />,\n subtitle: typeof row.secondary_text === 'string' ? row.secondary_text : '',\n title: row.primary_text,\n }))\n const header = slot<unknown>(data, 'header_text')\n const total = slot<unknown>(data, 'amount')\n\n return (\n <TransactionListCard\n background={theme.palette.primary.lighter}\n footer={\n totalLabel && typeof total === 'number' && Number.isFinite(total)\n ? { amount: formatCurrency(total, CURRENCY_FORMAT.cents), label: totalLabel }\n : undefined\n }\n header={typeof header === 'string' ? header : undefined}\n rows={rows}\n />\n )\n }\n\n const {\n account_name,\n account_type,\n amount,\n institution_guid,\n institution_name,\n interest_rate,\n monthly_payment,\n payoff_date,\n status_text,\n } = instance_slot\n\n const stats: DebtPayoffStat[] = []\n if (labels) {\n const payoffDate = payoff_date ? parseDueDate(payoff_date) : null\n if (payoffDate) {\n stats.push({\n label: labels.payoff_date_label,\n value: formatDate(payoffDate, DATE_FORMATS_INTL.MONTH_SHORT_YEAR),\n })\n }\n if (monthly_payment != null) {\n stats.push({\n label: labels.monthly_payment_label,\n value: formatCurrency(monthly_payment, CURRENCY_FORMAT.cents),\n })\n }\n if (interest_rate != null) {\n // `interest_rate` arrives as a percentage (19.99); Intl's percent style expects a fraction.\n stats.push({\n label: labels.interest_rate_label,\n value: formatPercentage(interest_rate / 100),\n })\n }\n }\n\n const hasBalance = labels !== undefined && amount != null\n\n return (\n <DebtPayoffCard\n {...layout.style}\n balance={hasBalance ? formatCurrency(amount, CURRENCY_FORMAT.cents) : undefined}\n balanceLabel={hasBalance ? labels.balance_label : undefined}\n logo={\n <DepositLogo\n iconName={iconFor(account_type)}\n institutionGuid={institution_guid ?? ''}\n institutionName={institution_name ?? ''}\n />\n }\n name={account_name}\n stats={stats}\n statusLabel={status_text}\n subtitle={account_type}\n />\n )\n}\n\nexport default DebtsBlock\n"],"mappings":";;;;;;;;;;;;;;AA+BA,IAAM,IAAgB,IAGhB,IAAoB,oBAAI,IAAI;AAAA,EAAC;AAAA,EAAe;AAAA,EAAe;AAAY,CAAC,GAExE,IAAA,CAAW,MACf,EAAkB,KAAK,KAAe,IAAI,KAAK,EAAE,YAAY,CAAC,IAC1D,gBACA,mBAGA,IAAA,CAAc,MAClB,OAAO,KAAQ,YACf,MAAQ,QACR,OAAQ,EAAwB,gBAAiB,UAG7C,IAAA,CAAgB,MACpB,CAAC,CAAC,GAAM,iBACR,CAAC,CAAC,EAAK,qBACP,CAAC,CAAC,EAAK,yBACP,CAAC,CAAC,EAAK,qBAsBH,KAAA,CAAc,EAAE,SAAA,EAAA,MAA+B;AACnD,QAAM,IAAQ,EAAS,GACjB,IAAO,EAAmB,EAAE,eAAe,aAC3C,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,MAAA,GAAM,SAAA,EAAA,IAAY,GAEpB,IAAS,EACb,GACA,GACA,EAAkB,iBAClB,YACF,GACM,IAAY,EAAO,SAAS,WAE5B,IAAS,EAAa,CAAI,IAAI,IAAO,QACrC,IAAa,GAAM,qBACnB,IAAU,IAAY,CAAC,CAAC,IAAa,CAAC,CAAC;AAS7C,MAPA,EAAM,UAAA,MAAgB;AACpB,IAAI,KACJ,QAAQ,KACN,gBAAgB,IAAO,oBAAoB,wBAAA,0CAC7C;AAAA,EACF,GAAG,CAAC,GAAM,CAAO,CAAC,GAEd,GAAW;AAEb,UAAM,IAAS,EAAgB,GAAM,QAAQ,GACvC,KAAQ,MAAM,QAAQ,CAAM,IAAI,IAAS,CAAC,GAAG,OAAO,CAAU,EAAE,IAAA,CAAK,OAAS;AAAA,MAClF,QACE,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,EAAgB,KAAK,IAAI;AAAA,MACvF,SAAS,g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Q,EAAgB,KAAK,IAAI;AAAA,IACtE,cAAc,IAAa,EAAO,gBAAgB;AAAA,IAClD,MACE,gBAAA,EAAC,GAAD;AAAA,MACE,UAAU,EAAQ,CAAY;AAAA,MAC9B,iBAAiB,KAAoB;AAAA,MACrC,iBAAiB,KAAoB;AAAA,IACtC,CAAA;AAAA,IAEH,MAAM;AAAA,IACC,OAAA;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACX,CAAA;AAEL"}
@@ -1,28 +1,28 @@
1
- import { buildDynamicCopy as s } from "../../../../core/utils/Localization.es.js";
1
+ import { buildDynamicCopy as m } from "../../../../core/utils/Localization.es.js";
2
2
  import { GlobalDataContext as l } from "../../../../common/context/GlobalDataProvider.es.js";
3
3
  import { slot as u } from "../../../../core/types/Insights.es.js";
4
4
  import { resolveVariantConfig as c } from "../../resolveVariantConfig.es.js";
5
- import { asText as g, slotOrFlat as p } from "../../slotReaders.es.js";
5
+ import { asLogoRef as g, asText as f, slotOrFlat as p } from "../../slotReaders.es.js";
6
6
  import d from "../../../components/LogoFromGuid.es.js";
7
- import f from "../../../components/DirectDepositCard.es.js";
8
- import { detailedAccountVariant as _, getLayoutConfig as v } from "./layout.es.js";
9
- import { useContext as y } from "react";
10
- import { jsx as m } from "react/jsx-runtime";
7
+ import _ from "../../../components/DirectDepositCard.es.js";
8
+ import { detailedAccountVariant as v, getLayoutConfig as y } from "./layout.es.js";
9
+ import { useContext as L } from "react";
10
+ import { jsx as s } from "react/jsx-runtime";
11
11
  import { useTheme as x } from "@mui/material/styles";
12
- var n = (t, a) => g(p(t, a)), C = (t, a) => {
13
- const o = u(t.data, "logo"), e = n(t, "institution_guid"), r = o?.alt ?? n(t, "institution_name"), i = o ?? (e ? {
12
+ var n = (t, a) => f(p(t, a)), C = (t, a) => {
13
+ const o = g(u(t.data, "logo")), e = n(t, "institution_guid"), r = o?.alt ?? n(t, "institution_name"), i = o ?? (e ? {
14
14
  guid: e,
15
15
  alt: r ?? e
16
16
  } : void 0);
17
17
  return !i || !r ? i : {
18
18
  ...i,
19
- alt: a ? s(a, r) : r
19
+ alt: a ? m(a, r) : r
20
20
  };
21
- }, j = ({ payload: t }) => {
22
- const a = x(), { instance_slot: o } = t, e = y(l)?.globalStore.copyStore.copy.insights_feed?.general?.institution_Logo, r = C(o, e), i = c(v(a), o.variant, _.Neutral, "DetailedAccountBlock");
23
- return /* @__PURE__ */ m(f, {
21
+ }, z = ({ payload: t }) => {
22
+ const a = x(), { instance_slot: o } = t, e = L(l)?.globalStore.copyStore.copy.insights_feed?.general?.institution_Logo, r = C(o, e), i = c(y(a), o.variant, v.Neutral, "DetailedAccountBlock");
23
+ return /* @__PURE__ */ s(_, {
24
24
  ...i,
25
- logo: r?.guid ? /* @__PURE__ */ m(d, {
25
+ logo: r?.guid ? /* @__PURE__ */ s(d, {
26
26
  logo: r,
27
27
  size: 48
28
28
  }) : null,
@@ -32,7 +32,7 @@ var n = (t, a) => g(p(t, a)), C = (t, a) => {
32
32
  });
33
33
  };
34
34
  export {
35
- j as default
35
+ z as default
36
36
  };
37
37
 
38
38
  //# sourceMappingURL=DetailedAccountBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DetailedAccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.tsx"],"sourcesContent":["import { useContext } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { GlobalDataContext } from '../../../../common/context/GlobalDataProvider'\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport DirectDepositCard from '../../../components/DirectDepositCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asText, slotOrFlat, type FlatSlotKey } from '../../slotReaders'\n\nimport { detailedAccountVariant, getLayoutConfig } from './layout'\n\ninterface DetailedAccountBlockProps {\n payload: InsightsPayload\n}\n\ntype InstanceSlot = InsightsPayload['instance_slot']\n\nconst readFact = (instanceSlot: InstanceSlot, name: FlatSlotKey): string | undefined =>\n asText(slotOrFlat(instanceSlot, name))\n\n/** The slot's logo, else one built from the guid; the alt is worded as legacy (\"{institution} Institution Logo\"). */\nconst resolveLogo = (instanceSlot: InstanceSlot, altCopy?: string): LogoRef | undefined => {\n const dataLogo = slot<LogoRef>(instanceSlot.data, 'logo')\n const guid = readFact(instanceSlot, 'institution_guid')\n const name = dataLogo?.alt ?? readFact(instanceSlot, 'institution_name')\n\n const logo = dataLogo ?? (guid ? { guid, alt: name ?? guid } : undefined)\n if (!logo || !name) return logo\n\n return { ...logo, alt: altCopy ? (buildDynamicCopy(altCopy, name) as string) : name }\n}\n\nconst DetailedAccountBlock = ({ payload }: DetailedAccountBlockProps) => {\n const theme = useTheme()\n const { instance_slot } = payload\n // Optional: the micro widget renders this block without a GlobalDataProvider.\n const altCopy =\n useContext(GlobalDataContext)?.globalStore.copyStore.copy.insights_feed?.general\n ?.institution_Logo\n const logo = resolveLogo(instance_slot, altCopy)\n const layout = resolveVariantConfig(\n getLayoutConfig(theme),\n instance_slot.variant,\n detailedAccountVariant.Neutral,\n 'DetailedAccountBlock',\n )\n\n return (\n <DirectDepositCard\n {...layout}\n logo={logo?.guid ? <LogoFromGuid logo={logo} size={48} /> : null}\n name={readFact(instance_slot, 'account_name')}\n statusLabel={readFact(instance_slot, 'status_text')}\n subtitle={readFact(instance_slot, 'account_type')}\n />\n )\n}\n\nexport default DetailedAccountBlock\n"],"mappings":";;;;;;;;;;;AAqBA,IAAM,IAAA,CAAY,GAA4B,MAC5C,EAAO,EAAW,GAAc,CAAI,CAAC,GAGjC,IAAA,CAAe,GAA4B,MAA0C;AACzF,QAAM,IAAW,EAAc,EAAa,MAAM,MAAM,GAClD,IAAO,EAAS,GAAc,kBAAkB,GAChD,IAAO,GAAU,OAAO,EAAS,GAAc,kBAAkB,GAEjE,IAAO,MAAa,IAAO;AAAA,IAAE,MAAA;AAAA,IAAM,KAAK,KAAQ;AAAA,EAAK,IAAI;AAC/D,SAAI,CAAC,KAAQ,CAAC,IAAa,IAEpB;AAAA,IAAE,GAAG;AAAA,IAAM,KAAK,IAAW,EAAiB,GAAS,CAAI,IAAe;AAAA,EAAK;AACtF,GAEM,IAAA,CAAwB,EAAE,SAAA,EAAA,MAAyC;AACvE,QAAM,IAAQ,EAAS,GACjB,EAAE,eAAA,EAAA,IAAkB,GAEpB,IACJ,EAAW,CAAiB,GAAG,YAAY,UAAU,KAAK,eAAe,SACrE,kBACA,IAAO,EAAY,GAAe,CAAO,GACzC,IAAS,EACb,EAAgB,CAAK,GACrB,EAAc,SACd,EAAuB,SACvB,sBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MAAM,GAAM,OAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAK,CAAA,IAAI;AAAA,IAC5D,MAAM,EAAS,GAAe,cAAc;AAAA,IAC5C,aAAa,EAAS,GAAe,aAAa;AAAA,IAClD,UAAU,EAAS,GAAe,cAAc;AAAA,EACjD,CAAA;AAEL"}
1
+ {"version":3,"file":"DetailedAccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.tsx"],"sourcesContent":["import { useContext } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { GlobalDataContext } from '../../../../common/context/GlobalDataProvider'\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport DirectDepositCard from '../../../components/DirectDepositCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asText, slotOrFlat, type FlatSlotKey } from '../../slotReaders'\n\nimport { detailedAccountVariant, getLayoutConfig } from './layout'\n\ninterface DetailedAccountBlockProps {\n payload: InsightsPayload\n}\n\ntype InstanceSlot = InsightsPayload['instance_slot']\n\nconst readFact = (instanceSlot: InstanceSlot, name: FlatSlotKey): string | undefined =>\n asText(slotOrFlat(instanceSlot, name))\n\n/** The slot's logo, else one built from the guid; the alt is worded as legacy (\"{institution} Institution Logo\"). */\nconst resolveLogo = (instanceSlot: InstanceSlot, altCopy?: string): LogoRef | undefined => {\n const dataLogo = asLogoRef(slot(instanceSlot.data, 'logo'))\n const guid = readFact(instanceSlot, 'institution_guid')\n const name = dataLogo?.alt ?? readFact(instanceSlot, 'institution_name')\n\n const logo = dataLogo ?? (guid ? { guid, alt: name ?? guid } : undefined)\n if (!logo || !name) return logo\n\n return { ...logo, alt: altCopy ? (buildDynamicCopy(altCopy, name) as string) : name }\n}\n\nconst DetailedAccountBlock = ({ payload }: DetailedAccountBlockProps) => {\n const theme = useTheme()\n const { instance_slot } = payload\n // Optional: the micro widget renders this block without a GlobalDataProvider.\n const altCopy =\n useContext(GlobalDataContext)?.globalStore.copyStore.copy.insights_feed?.general\n ?.institution_Logo\n const logo = resolveLogo(instance_slot, altCopy)\n const layout = resolveVariantConfig(\n getLayoutConfig(theme),\n instance_slot.variant,\n detailedAccountVariant.Neutral,\n 'DetailedAccountBlock',\n )\n\n return (\n <DirectDepositCard\n {...layout}\n logo={logo?.guid ? <LogoFromGuid logo={logo} size={48} /> : null}\n name={readFact(instance_slot, 'account_name')}\n statusLabel={readFact(instance_slot, 'status_text')}\n subtitle={readFact(instance_slot, 'account_type')}\n />\n )\n}\n\nexport default DetailedAccountBlock\n"],"mappings":";;;;;;;;;;;AAqBA,IAAM,IAAA,CAAY,GAA4B,MAC5C,EAAO,EAAW,GAAc,CAAI,CAAC,GAGjC,IAAA,CAAe,GAA4B,MAA0C;AACzF,QAAM,IAAW,EAAU,EAAK,EAAa,MAAM,MAAM,CAAC,GACpD,IAAO,EAAS,GAAc,kBAAkB,GAChD,IAAO,GAAU,OAAO,EAAS,GAAc,kBAAkB,GAEjE,IAAO,MAAa,IAAO;AAAA,IAAE,MAAA;AAAA,IAAM,KAAK,KAAQ;AAAA,EAAK,IAAI;AAC/D,SAAI,CAAC,KAAQ,CAAC,IAAa,IAEpB;AAAA,IAAE,GAAG;AAAA,IAAM,KAAK,IAAW,EAAiB,GAAS,CAAI,IAAe;AAAA,EAAK;AACtF,GAEM,IAAA,CAAwB,EAAE,SAAA,EAAA,MAAyC;AACvE,QAAM,IAAQ,EAAS,GACjB,EAAE,eAAA,EAAA,IAAkB,GAEpB,IACJ,EAAW,CAAiB,GAAG,YAAY,UAAU,KAAK,eAAe,SACrE,kBACA,IAAO,EAAY,GAAe,CAAO,GACzC,IAAS,EACb,EAAgB,CAAK,GACrB,EAAc,SACd,EAAuB,SACvB,sBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MAAM,GAAM,OAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAK,CAAA,IAAI;AAAA,IAC5D,MAAM,EAAS,GAAe,cAAc;AAAA,IAC5C,aAAa,EAAS,GAAe,aAAa;AAAA,IAClD,UAAU,EAAS,GAAe,cAAc;AAAA,EACjD,CAAA;AAEL"}
@@ -1,12 +1,12 @@
1
1
  import { buildPluralCopy as m } from "../../../../core/utils/Localization.es.js";
2
2
  import { useGlobalCopyStore as u } from "../../../../common/context/hooks.es.js";
3
- import { formatCurrency as f } from "../../../../core/utils/NumberFormatting.es.js";
3
+ import { CURRENCY_FORMAT as f, formatCurrency as g } from "../../../../core/utils/NumberFormatting.es.js";
4
4
  import { asNumber as _, slotOrFlat as s } from "../../slotReaders.es.js";
5
- import g from "./GasGraphic.es.js";
5
+ import h from "./GasGraphic.es.js";
6
6
  import o from "@mui/material/Stack";
7
7
  import { Text as a } from "@mxenabled/mxui";
8
8
  import { jsx as r, jsxs as l } from "react/jsx-runtime";
9
- var h = "_1{count} Fill-ups", x = "_1{count} Fill-up", v = "spent on gas", P = ({ payload: c }) => {
9
+ var x = "_1{count} Fill-ups", v = "_1{count} Fill-up", b = "spent on gas", A = ({ payload: c }) => {
10
10
  const t = u().insights_feed?.general, { instance_slot: i = {}, widget_type: d } = c, n = d === "mini", e = _(s(i, "total_fill_up_visits")), p = _(s(i, "total_spend") ?? s(i, "total_debt_for_fill_up_visits_in_prev_month"));
11
11
  return e === void 0 || p === void 0 ? null : /* @__PURE__ */ l(o, {
12
12
  direction: "row",
@@ -17,7 +17,7 @@ var h = "_1{count} Fill-ups", x = "_1{count} Fill-up", v = "spent on gas", P = (
17
17
  py: n ? 12 : 16,
18
18
  width: "100%"
19
19
  },
20
- children: [/* @__PURE__ */ r(g, {
20
+ children: [/* @__PURE__ */ r(h, {
21
21
  height: n ? 94 : 130,
22
22
  label: t?.gas_pump
23
23
  }), /* @__PURE__ */ l(o, {
@@ -38,7 +38,7 @@ var h = "_1{count} Fill-ups", x = "_1{count} Fill-up", v = "spent on gas", P = (
38
38
  color: "primary.dark",
39
39
  sx: { fontWeight: 700 },
40
40
  variant: "caption",
41
- children: m(t?.gas_fill_ups_count_one ?? x, t?.gas_fill_ups_count ?? h, e, String(e))
41
+ children: m(t?.gas_fill_ups_count_one ?? v, t?.gas_fill_ups_count ?? x, e, String(e))
42
42
  })
43
43
  }), /* @__PURE__ */ l(o, {
44
44
  sx: {
@@ -50,18 +50,18 @@ var h = "_1{count} Fill-ups", x = "_1{count} Fill-up", v = "spent on gas", P = (
50
50
  children: [/* @__PURE__ */ r(a, {
51
51
  component: "span",
52
52
  variant: "h3",
53
- children: f(p, "0,0")
53
+ children: g(p, f.whole)
54
54
  }), /* @__PURE__ */ r(a, {
55
55
  color: "text.secondary",
56
56
  variant: "caption",
57
- children: t?.gas_spent_on_gas ?? v
57
+ children: t?.gas_spent_on_gas ?? b
58
58
  })]
59
59
  })]
60
60
  })]
61
61
  });
62
62
  };
63
63
  export {
64
- P as default
64
+ A as default
65
65
  };
66
66
 
67
67
  //# sourceMappingURL=GasPurchaseBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GasPurchaseBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy, useGlobalCopyStore } from '../../../../common'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { asNumber, slotOrFlat } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\n\nimport GasGraphic from './GasGraphic'\n\nconst DEFAULT_FILL_UPS = '_1{count} Fill-ups'\nconst DEFAULT_FILL_UPS_ONE = '_1{count} Fill-up'\nconst DEFAULT_SPENT_ON_GAS = 'spent on gas'\n\nconst GasPurchaseBlock = ({ payload }: BlockProps) => {\n const generalCopy = useGlobalCopyStore().insights_feed?.general\n\n const { instance_slot = {}, widget_type } = payload\n const isMini = widget_type === 'mini'\n const visits = asNumber(slotOrFlat(instance_slot, 'total_fill_up_visits'))\n const spend = asNumber(\n slotOrFlat(instance_slot, 'total_spend') ??\n slotOrFlat(instance_slot, 'total_debt_for_fill_up_visits_in_prev_month'),\n )\n\n if (visits === undefined || spend === undefined) return null\n\n return (\n <Stack\n direction=\"row\"\n sx={{\n alignItems: 'center',\n gap: isMini ? 12 : 16,\n px: 16,\n py: isMini ? 12 : 16,\n width: '100%',\n }}\n >\n <GasGraphic height={isMini ? 94 : 130} label={generalCopy?.gas_pump} />\n <Stack sx={{ flex: 1, justifyContent: 'center', minWidth: 0, pb: 12 }}>\n <Stack sx={{ bgcolor: 'primary.lighter', borderRadius: '4px 4px 0 0', px: 10, py: 4 }}>\n <Text color=\"primary.dark\" sx={{ fontWeight: 700 }} variant=\"caption\">\n {\n buildPluralCopy(\n generalCopy?.gas_fill_ups_count_one ?? DEFAULT_FILL_UPS_ONE,\n generalCopy?.gas_fill_ups_count ?? DEFAULT_FILL_UPS,\n visits,\n String(visits),\n ) as string\n }\n </Text>\n </Stack>\n <Stack sx={{ bgcolor: 'background.default', borderRadius: '0 0 4px 4px', gap: 2, p: 8 }}>\n <Text component=\"span\" variant=\"h3\">\n {formatCurrency(spend, '0,0')}\n </Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {generalCopy?.gas_spent_on_gas ?? DEFAULT_SPENT_ON_GAS}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default GasPurchaseBlock\n"],"mappings":";;;;;;;;AAWA,IAAM,IAAmB,sBACnB,IAAuB,qBACvB,IAAuB,gBAEvB,IAAA,CAAoB,EAAE,SAAA,EAAA,MAA0B;AACpD,QAAM,IAAc,EAAmB,EAAE,eAAe,SAElD,EAAE,eAAA,IAAgB,CAAC,GAAG,aAAA,EAAA,IAAgB,GACtC,IAAS,MAAgB,QACzB,IAAS,EAAS,EAAW,GAAe,sBAAsB,CAAC,GACnE,IAAQ,EACZ,EAAW,GAAe,aAAa,KACrC,EAAW,GAAe,6CAA6C,CAC3E;AAEA,SAAI,MAAW,UAAa,MAAU,SAAkB,OAGtD,gBAAA,EAAC,GAAD;AAAA,IACE,WAAU;AAAA,IACV,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,KAAK,IAAS,KAAK;AAAA,MACnB,IAAI;AAAA,MACJ,IAAI,IAAS,KAAK;AAAA,MAClB,OAAO;AAAA,IACT;AAAA,IARF,UAAA,CAUE,gBAAA,EAAC,GAAD;AAAA,MAAY,QAAQ,IAAS,KAAK;AAAA,MAAK,OAAO,GAAa;AAAA,IAAW,CAAA,GACtE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,MAAM;AAAA,QAAG,gBAAgB;AAAA,QAAU,UAAU;AAAA,QAAG,IAAI;AAAA,MAAG;AAAA,MAApE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,SAAS;AAAA,UAAmB,cAAc;AAAA,UAAe,IAAI;AAAA,UAAI,IAAI;AAAA,QAAE;AAAA,QAClF,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,IAAI,EAAE,YAAY,IAAI;AAAA,UAAG,SAAQ;AAAA,UAExD,UAAA,EACE,GAAa,0BAA0B,GACvC,GAAa,sBAAsB,GACnC,GACA,OAAO,CAAM,CACf;AAAA,QAEE,CAAA;AAAA,MACD,CAAA,GACP,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,SAAS;AAAA,UAAsB,cAAc;AAAA,UAAe,KAAK;AAAA,UAAG,GAAG;AAAA,QAAE;AAAA,QAAtF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,WAAU;AAAA,UAAO,SAAQ;AAAA,UAC5B,UAAA,EAAe,GAAO,KAAK;AAAA,QACxB,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA,GAAa,oBAAoB;AAAA,QAC9B,CAAA,CACD;AAAA,MACF,CAAA,CAAA;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
1
+ {"version":3,"file":"GasPurchaseBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy, useGlobalCopyStore } from '../../../../common'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { asNumber, slotOrFlat } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\n\nimport GasGraphic from './GasGraphic'\n\nconst DEFAULT_FILL_UPS = '_1{count} Fill-ups'\nconst DEFAULT_FILL_UPS_ONE = '_1{count} Fill-up'\nconst DEFAULT_SPENT_ON_GAS = 'spent on gas'\n\nconst GasPurchaseBlock = ({ payload }: BlockProps) => {\n const generalCopy = useGlobalCopyStore().insights_feed?.general\n\n const { instance_slot = {}, widget_type } = payload\n const isMini = widget_type === 'mini'\n const visits = asNumber(slotOrFlat(instance_slot, 'total_fill_up_visits'))\n const spend = asNumber(\n slotOrFlat(instance_slot, 'total_spend') ??\n slotOrFlat(instance_slot, 'total_debt_for_fill_up_visits_in_prev_month'),\n )\n\n if (visits === undefined || spend === undefined) return null\n\n return (\n <Stack\n direction=\"row\"\n sx={{\n alignItems: 'center',\n gap: isMini ? 12 : 16,\n px: 16,\n py: isMini ? 12 : 16,\n width: '100%',\n }}\n >\n <GasGraphic height={isMini ? 94 : 130} label={generalCopy?.gas_pump} />\n <Stack sx={{ flex: 1, justifyContent: 'center', minWidth: 0, pb: 12 }}>\n <Stack sx={{ bgcolor: 'primary.lighter', borderRadius: '4px 4px 0 0', px: 10, py: 4 }}>\n <Text color=\"primary.dark\" sx={{ fontWeight: 700 }} variant=\"caption\">\n {\n buildPluralCopy(\n generalCopy?.gas_fill_ups_count_one ?? DEFAULT_FILL_UPS_ONE,\n generalCopy?.gas_fill_ups_count ?? DEFAULT_FILL_UPS,\n visits,\n String(visits),\n ) as string\n }\n </Text>\n </Stack>\n <Stack sx={{ bgcolor: 'background.default', borderRadius: '0 0 4px 4px', gap: 2, p: 8 }}>\n <Text component=\"span\" variant=\"h3\">\n {formatCurrency(spend, CURRENCY_FORMAT.whole)}\n </Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {generalCopy?.gas_spent_on_gas ?? DEFAULT_SPENT_ON_GAS}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default GasPurchaseBlock\n"],"mappings":";;;;;;;;AAWA,IAAM,IAAmB,sBACnB,IAAuB,qBACvB,IAAuB,gBAEvB,IAAA,CAAoB,EAAE,SAAA,EAAA,MAA0B;AACpD,QAAM,IAAc,EAAmB,EAAE,eAAe,SAElD,EAAE,eAAA,IAAgB,CAAC,GAAG,aAAA,EAAA,IAAgB,GACtC,IAAS,MAAgB,QACzB,IAAS,EAAS,EAAW,GAAe,sBAAsB,CAAC,GACnE,IAAQ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Q;AAAA,UAClC,UAAA,GAAa,oBAAoB;AAAA,QAC9B,CAAA,CACD;AAAA,MACF,CAAA,CAAA;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
@@ -1,15 +1,15 @@
1
- import { buildDynamicCopy as P } from "../../../../core/utils/Localization.es.js";
2
- import { DATE_FORMATS_INTL as A, formatDate as N } from "../../../../core/constants/DateFormats.es.js";
1
+ import { buildDynamicCopy as A } from "../../../../core/utils/Localization.es.js";
2
+ import { DATE_FORMATS_INTL as N, formatDate as P } from "../../../../core/constants/DateFormats.es.js";
3
3
  import { useGlobalCopyStore as M } from "../../../../common/context/hooks.es.js";
4
4
  import { slot as O } from "../../../../core/types/Insights.es.js";
5
- import { formatCurrency as f, formatPercentage as R } from "../../../../core/utils/NumberFormatting.es.js";
5
+ import { CURRENCY_FORMAT as f, formatCurrency as v, formatPercentage as j } from "../../../../core/utils/NumberFormatting.es.js";
6
6
  import { STATUS_SUCCESS_TOKENS as p } from "../../../components/statusTokens.es.js";
7
- import { asNumber as j, asText as u } from "../../slotReaders.es.js";
8
- import { parseDueDate as k } from "../RepeatingTransactionBlock/weekStrip.es.js";
9
- import G, { clampPercent as w } from "../../../components/GoalProgressCard.es.js";
10
- import F from "react";
11
- import { jsx as U } from "react/jsx-runtime";
12
- var v = {
7
+ import { asNumber as k, asText as u } from "../../slotReaders.es.js";
8
+ import { parseDueDate as F } from "../RepeatingTransactionBlock/weekStrip.es.js";
9
+ import G, { clampPercent as U } from "../../../components/GoalProgressCard.es.js";
10
+ import w from "react";
11
+ import { jsx as Y } from "react/jsx-runtime";
12
+ var y = {
13
13
  bgcolor: "primary.main",
14
14
  barColor: "primary.main",
15
15
  trackColor: "grey.200",
@@ -21,7 +21,7 @@ var v = {
21
21
  labelColor: "text.primary"
22
22
  }
23
23
  }, H = {
24
- ...v,
24
+ ...y,
25
25
  bgcolor: "success.main",
26
26
  barColor: "success.main",
27
27
  tileColor: "success.lighter",
@@ -32,42 +32,42 @@ var v = {
32
32
  labelColor: p.textColor,
33
33
  icon: "check_circle"
34
34
  }
35
- }, I = (e) => !!e?.percent_complete && !!e.projected_completion_label && !!e.contribution_label && !!e.total_saved_label && !!e.complete_label, Z = ({ payload: e }) => {
36
- const r = M().insights_feed?.goals_block, o = I(r) ? r : void 0, { data: y } = e.instance_slot, t = (m) => O(y, m), l = (m) => j(t(m)), h = u(t("goal_name")), S = l("goal_percentage"), a = l("amount"), s = l("target_amount"), b = l("contributed_last_month"), _ = u(t("projected_completion_date")), i = t("is_complete"), d = i === !0 || i === "true" || i === 1, T = u(t("status_text"))?.trim() || void 0;
37
- F.useEffect(() => {
35
+ }, I = (e) => !!e?.percent_complete && !!e.projected_completion_label && !!e.contribution_label && !!e.total_saved_label && !!e.complete_label, oo = ({ payload: e }) => {
36
+ const r = M().insights_feed?.goals_block, o = I(r) ? r : void 0, { data: h } = e.instance_slot, t = (m) => O(h, m), l = (m) => k(t(m)), T = u(t("goal_name")), S = l("goal_percentage"), a = l("amount"), s = l("target_amount"), b = l("contributed_last_month"), _ = u(t("projected_completion_date")), i = t("is_complete"), d = i === !0 || i === "true" || i === 1, D = u(t("status_text"))?.trim() || void 0;
37
+ w.useEffect(() => {
38
38
  o || console.warn(`goals_block: ${r ? "copy incomplete" : "copy namespace missing"}; rendering the progress bar only`);
39
39
  }, [r, o]);
40
- const D = d ? H : v, E = a != null && s != null && s > 0 ? a / s * 100 : void 0, g = S ?? E, n = g != null ? Math.round(w(g)) : void 0, L = n == null ? void 0 : o ? P(o.percent_complete, `${n}`) : R(n / 100, {
40
+ const E = d ? H : y, L = a != null && s != null && s > 0 ? a / s * 100 : void 0, g = S ?? L, n = g != null ? Math.round(U(g)) : void 0, R = n == null ? void 0 : o ? A(o.percent_complete, `${n}`) : j(n / 100, {
41
41
  style: "percent",
42
42
  maximumFractionDigits: 0
43
- }), c = [], C = _ ? k(_) : null;
43
+ }), c = [], C = _ ? F(_) : null;
44
44
  o && C && c.push({
45
45
  icon: "today",
46
46
  label: o.projected_completion_label,
47
- value: N(C, A.MED_MONTH_SHORT_DAY_FULL_YEAR)
47
+ value: P(C, N.MED_MONTH_SHORT_DAY_FULL_YEAR)
48
48
  }), o && b != null && c.push({
49
49
  icon: "paid",
50
50
  label: o.contribution_label,
51
- value: f(b, "0,0.00")
51
+ value: v(b, f.cents)
52
52
  }), o && a != null && c.push({
53
53
  icon: "savings",
54
54
  label: o.total_saved_label,
55
- value: f(a, "0,0.00")
55
+ value: v(a, f.cents)
56
56
  });
57
- const x = d ? T ?? o?.complete_label : void 0;
58
- return /* @__PURE__ */ U(G, {
59
- ...D,
60
- barLabel: h,
57
+ const x = d ? D ?? o?.complete_label : void 0;
58
+ return /* @__PURE__ */ Y(G, {
59
+ ...E,
60
+ barLabel: T,
61
61
  percent: n ?? 0,
62
- percentLabel: L,
62
+ percentLabel: R,
63
63
  rows: c,
64
64
  statusLabel: x
65
65
  });
66
66
  };
67
67
  export {
68
68
  H as COMPLETE,
69
- v as IN_PROGRESS,
70
- Z as default
69
+ y as IN_PROGRESS,
70
+ oo as default
71
71
  };
72
72
 
73
73
  //# sourceMappingURL=GoalsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GoalsBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { GoalsBlockCopy } from '../../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency, formatPercentage } from '../../../../core/utils/NumberFormatting'\n\nimport GoalProgressCard, {\n clampPercent,\n type GoalProgressCardStyleProps,\n type GoalProgressRow,\n} from '../../../components/GoalProgressCard'\nimport { STATUS_SUCCESS_TOKENS } from '../../../components/statusTokens'\nimport { asNumber, asText } from '../../slotReaders'\nimport { parseDueDate } from '../RepeatingTransactionBlock/weekStrip'\n\ninterface GoalsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nexport const IN_PROGRESS: GoalProgressCardStyleProps = {\n bgcolor: 'primary.main',\n barColor: 'primary.main',\n trackColor: 'grey.200',\n tileColor: 'primary.lighter',\n iconColor: 'primary.main',\n pill: { bgcolor: 'primary.lighter', borderColor: 'primary.lighter', labelColor: 'text.primary' },\n}\n\nexport const COMPLETE: GoalProgressCardStyleProps = {\n ...IN_PROGRESS,\n bgcolor: 'success.main',\n barColor: 'success.main',\n tileColor: 'success.lighter',\n iconColor: 'success.main',\n pill: {\n bgcolor: STATUS_SUCCESS_TOKENS.bgcolor,\n borderColor: STATUS_SUCCESS_TOKENS.borderColor,\n labelColor: STATUS_SUCCESS_TOKENS.textColor,\n icon: 'check_circle',\n },\n}\n\nconst hasAllLabels = (copy?: GoalsBlockCopy): copy is GoalsBlockCopy =>\n !!copy?.percent_complete &&\n !!copy.projected_completion_label &&\n !!copy.contribution_label &&\n !!copy.total_saved_label &&\n !!copy.complete_label\n\nconst GoalsBlock = ({ payload }: GoalsBlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.goals_block\n const labels = hasAllLabels(copy) ? copy : undefined\n const { data } = payload.instance_slot\n\n const read = (name: string) => slot(data, name)\n const readNumber = (name: string) => asNumber(read(name))\n\n const goalName = asText(read('goal_name'))\n const goalPercentage = readNumber('goal_percentage')\n const amount = readNumber('amount')\n const targetAmount = readNumber('target_amount')\n const contributedLastMonth = readNumber('contributed_last_month')\n const projectedCompletionDate = asText(read('projected_completion_date'))\n const rawComplete = read('is_complete')\n const isComplete = rawComplete === true || rawComplete === 'true' || rawComplete === 1\n const statusText = asText(read('status_text'))?.trim() || undefined\n\n React.useEffect(() => {\n if (labels) return\n console.warn(\n `goals_block: ${copy ? 'copy incomplete' : 'copy namespace missing'}; rendering the progress bar only`,\n )\n }, [copy, labels])\n\n const style = isComplete ? COMPLETE : IN_PROGRESS\n\n const derivedPercent =\n amount != null && targetAmount != null && targetAmount > 0\n ? (amount / targetAmount) * 100\n : undefined\n const percent = goalPercentage ?? derivedPercent\n const roundedPercent = percent != null ? Math.round(clampPercent(percent)) : undefined\n\n const percentLabel =\n roundedPercent == null\n ? undefined\n : labels\n ? (buildDynamicCopy(labels.percent_complete, `${roundedPercent}`) as string)\n : formatPercentage(roundedPercent / 100, {\n style: 'percent',\n maximumFractionDigits: 0,\n })\n\n const rows: GoalProgressRow[] = []\n const completionDate = projectedCompletionDate ? parseDueDate(projectedCompletionDate) : null\n if (labels && completionDate) {\n rows.push({\n icon: 'today',\n label: labels.projected_completion_label,\n value: formatDate(completionDate, DATE_FORMATS_INTL.MED_MONTH_SHORT_DAY_FULL_YEAR),\n })\n }\n if (labels && contributedLastMonth != null) {\n rows.push({\n icon: 'paid',\n label: labels.contribution_label,\n value: formatCurrency(contributedLastMonth, '0,0.00'),\n })\n }\n if (labels && amount != null) {\n rows.push({\n icon: 'savings',\n label: labels.total_saved_label,\n value: formatCurrency(amount, '0,0.00'),\n })\n }\n\n const statusLabel = isComplete ? (statusText ?? labels?.complete_label) : undefined\n\n return (\n <GoalProgressCard\n {...style}\n barLabel={goalName}\n percent={roundedPercent ?? 0}\n percentLabel={percentLabel}\n rows={rows}\n statusLabel={statusLabel}\n />\n )\n}\n\nexport default GoalsBlock\n"],"mappings":";;;;;;;;;;;AAuBA,IAAa,IAA0C;AAAA,EACrD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,IAAE,SAAS;AAAA,IAAmB,aAAa;AAAA,IAAmB,YAAY;AAAA,EAAe;AACjG,GAEa,IAAuC;AAAA,EAClD,GAAG;AAAA,EACH,SAAS;AAAA,EACT,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,IACJ,SAAS,EAAsB;AAAA,IAC/B,aAAa,EAAsB;AAAA,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zB,CAAC,GAEH,IAA0B,CAAC,GAC3B,IAAiB,IAA0B,EAAa,CAAuB,IAAI;AACzF,EAAI,KAAU,KACZ,EAAK,KAAK;AAAA,IACR,MAAM;AAAA,IACN,OAAO,EAAO;AAAA,IACd,OAAO,EAAW,GAAgB,EAAkB,6BAA6B;AAAA,EACnF,CAAC,GAEC,KAAU,KAAwB,QACpC,EAAK,KAAK;AAAA,IACR,MAAM;AAAA,IACN,OAAO,EAAO;AAAA,IACd,OAAO,EAAe,GAAsB,QAAQ;AAAA,EACtD,CAAC,GAEC,KAAU,KAAU,QACtB,EAAK,KAAK;AAAA,IACR,MAAM;AAAA,IACN,OAAO,EAAO;AAAA,IACd,OAAO,EAAe,GAAQ,QAAQ;AAAA,EACxC,CAAC;AAGH,QAAM,IAAc,IAAc,KAAc,GAAQ,iBAAkB;AAE1E,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,UAAU;AAAA,IACV,SAAS,KAAkB;AAAA,IACb,cAAA;AAAA,IACR,MAAA;AAAA,IACO,aAAA;AAAA,EACd,CAAA;AAEL"}
1
+ {"version":3,"file":"GoalsBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { GoalsBlockCopy } from '../../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport {\n CURRENCY_FORMAT,\n formatCurrency,\n formatPercentage,\n} from '../../../../core/utils/NumberFormatting'\n\nimport GoalProgressCard, {\n clampPercent,\n type GoalProgressCardStyleProps,\n type GoalProgressRow,\n} from '../../../components/GoalProgressCard'\nimport { STATUS_SUCCESS_TOKENS } from '../../../components/statusTokens'\nimport { asNumber, asText } from '../../slotReaders'\nimport { parseDueDate } from '../RepeatingTransactionBlock/weekStrip'\n\ninterface GoalsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nexport const IN_PROGRESS: GoalProgressCardStyleProps = {\n bgcolor: 'primary.main',\n barColor: 'primary.main',\n trackColor: 'grey.200',\n tileColor: 'primary.lighter',\n iconColor: 'primary.main',\n pill: { bgcolor: 'primary.lighter', borderColor: 'primary.lighter', labelColor: 'text.primary' },\n}\n\nexport const COMPLETE: GoalProgressCardStyleProps = {\n ...IN_PROGRESS,\n bgcolor: 'success.main',\n barColor: 'success.main',\n tileColor: 'success.lighter',\n iconColor: 'success.main',\n pill: {\n bgcolor: STATUS_SUCCESS_TOKENS.bgcolor,\n borderColor: STATUS_SUCCESS_TOKENS.borderColor,\n labelColor: STATUS_SUCCESS_TOKENS.textColor,\n icon: 'check_circle',\n },\n}\n\nconst hasAllLabels = (copy?: GoalsBlockCopy): copy is GoalsBlockCopy =>\n !!copy?.percent_complete &&\n !!copy.projected_completion_label &&\n !!copy.contribution_label &&\n !!copy.total_saved_label &&\n !!copy.complete_label\n\nconst GoalsBlock = ({ payload }: GoalsBlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.goals_block\n const labels = hasAllLabels(copy) ? copy : undefined\n const { data } = payload.instance_slot\n\n const read = (name: string) => slot(data, name)\n const readNumber = (name: string) => asNumber(read(name))\n\n const goalName = asText(read('goal_name'))\n const goalPercentage = readNumber('goal_percentage')\n const amount = readNumber('amount')\n const targetAmount = readNumber('target_amount')\n const contributedLastMonth = readNumber('contributed_last_month')\n const projectedCompletionDate = asText(read('projected_completion_date'))\n const rawComplete = read('is_complete')\n const isComplete = rawComplete === true || rawComplete === 'true' || rawComplete === 1\n const statusText = asText(read('status_text'))?.trim() || undefined\n\n React.useEffect(() => {\n if (labels) return\n console.warn(\n `goals_block: ${copy ? 'copy incomplete' : 'copy namespace missing'}; rendering the progress bar only`,\n )\n }, [copy, labels])\n\n const style = isComplete ? COMPLETE : IN_PROGRESS\n\n const derivedPercent =\n amount != null && targetAmount != null && targetAmount > 0\n ? (amount / targetAmount) * 100\n : undefined\n const percent = goalPercentage ?? derivedPercent\n const roundedPercent = percent != null ? Math.round(clampPercent(percent)) : undefined\n\n const percentLabel =\n roundedPercent == null\n ? undefined\n : labels\n ? (buildDynamicCopy(labels.percent_complete, `${roundedPercent}`) as string)\n : formatPercentage(roundedPercent / 100, {\n style: 'percent',\n maximumFractionDigits: 0,\n })\n\n const rows: GoalProgressRow[] = []\n const completionDate = projectedCompletionDate ? parseDueDate(projectedCompletionDate) : null\n if (labels && completionDate) {\n rows.push({\n icon: 'today',\n label: labels.projected_completion_label,\n value: formatDate(completionDate, DATE_FORMATS_INTL.MED_MONTH_SHORT_DAY_FULL_YEAR),\n })\n }\n if (labels && contributedLastMonth != null) {\n rows.push({\n icon: 'paid',\n label: labels.contribution_label,\n value: formatCurrency(contributedLastMonth, CURRENCY_FORMAT.cents),\n })\n }\n if (labels && amount != null) {\n rows.push({\n icon: 'savings',\n label: labels.total_saved_label,\n value: formatCurrency(amount, CURRENCY_FORMAT.cents),\n })\n }\n\n const statusLabel = isComplete ? (statusText ?? labels?.complete_label) : undefined\n\n return (\n <GoalProgressCard\n {...style}\n barLabel={goalName}\n percent={roundedPercent ?? 0}\n percentLabel={percentLabel}\n rows={rows}\n statusLabel={statusLabel}\n />\n )\n}\n\nexport default GoalsBlock\n"],"mappings":";;;;;;;;;;;AA2BA,IAAa,IAA0C;AAAA,EACrD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,IAAE,SAAS;AAAA,IAAmB,aAAa;AAAA,IAAmB,YAAY;AAAA,EAAe;AACjG,GAEa,IAAuC;AAAA,EAClD,GAAG;AAAA,EACH,SAAS;AAAA,EACT,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,IACJ,SAAS,EAAsB;AAAA,IAC/B,aAAa,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