@mx-cartographer/experiences 9.7.131 → 9.7.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/core/utils/NumberFormatting.d.ts +6 -0
- package/dist/core/utils/NumberFormatting.es.js +20 -16
- package/dist/core/utils/NumberFormatting.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js +17 -17
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +38 -38
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +14 -14
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -26
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js +22 -22
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +47 -47
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +18 -18
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +28 -28
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +57 -56
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +50 -50
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +52 -51
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +17 -17
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +20 -20
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +25 -25
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +17 -16
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +34 -34
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js +7 -7
- package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js +13 -13
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +39 -39
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +20 -20
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +44 -44
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js +25 -25
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +39 -46
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +18 -18
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +19 -19
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +9 -9
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +12 -12
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +58 -57
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +18 -18
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +10 -10
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js +13 -13
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +3 -1
- package/dist/insights-v2/blocks/slotReaders.es.js +17 -6
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +44 -43
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/SaveAnExtraCard.es.js +6 -6
- package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
- package/dist/insights-v2/components/WithdrawalCard.es.js +20 -20
- package/dist/insights-v2/components/WithdrawalCard.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [9.7.132] - 11-11-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - The step chart's milestones and the emergency savings drawer's goal label use a thousands separator ($1,000), as the goal box beside them does, and a bar's screen-reader amount matches its visible one; every Insights V2 amount uses one of two named currency formats (WEC-2259)
|
|
4
|
+
- **FIXED** - An Insights V2 card whose data logo is unusable (a blank, null or malformed guid, or on a bill card an icon or non-logo guid) shows its merchant or institution logo instead of an empty tile or the receipt icon (WEC-2259)
|
|
5
|
+
|
|
1
6
|
## [9.7.131] - 11-11-2026
|
|
2
7
|
|
|
3
8
|
- **CHANGED** - Insights V2 code follows its own patterns: the Make Transfer drawer's per-variant settings live in its layout, and a stray shadow, a wash and two tile gradients move into the shared elevation and gradient files; no visual or behaviour change (WEC-2259)
|
|
@@ -2,6 +2,12 @@ import { RoundingFunction } from 'numeral';
|
|
|
2
2
|
import { CurrencyCodes } from '../constants/Numbers';
|
|
3
3
|
export declare const generateEqualIntervals: (minValue: number, maxValue: number, tickCount: number) => number[];
|
|
4
4
|
export declare const roundedAverage: (values: number[]) => number;
|
|
5
|
+
/** The shared currency formats: with cents, and whole dollars. */
|
|
6
|
+
export declare const CURRENCY_FORMAT: {
|
|
7
|
+
readonly cents: "0,0.00";
|
|
8
|
+
readonly whole: "0,0";
|
|
9
|
+
};
|
|
10
|
+
export type CurrencyFormat = (typeof CURRENCY_FORMAT)[keyof typeof CURRENCY_FORMAT];
|
|
5
11
|
export declare const formatCurrency: (amount: number | undefined, formatting: string, roundingFunction?: RoundingFunction) => string;
|
|
6
12
|
export declare const getCurrencyCodes: () => CurrencyCodes;
|
|
7
13
|
export declare const isValidNumber: (value: any) => boolean;
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
import { getLocale as a } from "./Localization.es.js";
|
|
2
2
|
import { CurrencyCodes as s } from "../constants/Numbers.es.js";
|
|
3
3
|
import c from "numeral";
|
|
4
|
-
var
|
|
5
|
-
const n = [],
|
|
4
|
+
var w = (r, e, t) => {
|
|
5
|
+
const n = [], l = (e - r) / (t - 1);
|
|
6
6
|
for (let o = 0; o < t; o++) {
|
|
7
|
-
const
|
|
8
|
-
n.push(
|
|
7
|
+
const i = r + o * l;
|
|
8
|
+
n.push(i);
|
|
9
9
|
}
|
|
10
10
|
return n[t - 1] = e, n.map(Math.round);
|
|
11
|
-
}, y = (r) => r.length ? Math.round(r.reduce((e, t) => e + t, 0) / r.length) : 0, d =
|
|
11
|
+
}, y = (r) => r.length ? Math.round(r.reduce((e, t) => e + t, 0) / r.length) : 0, d = {
|
|
12
|
+
cents: "0,0.00",
|
|
13
|
+
whole: "0,0"
|
|
14
|
+
}, m = (r, e, t) => a() === "fr-ca" ? c(r).format(`${e} $`, t) : c(r).format(`$${e}`, t), C = () => a() === "fr-ca" ? s.CAD : s.USD, f = (r) => r != null && r !== "" && isFinite(r), u = {
|
|
12
15
|
style: "percent",
|
|
13
16
|
minimumFractionDigits: 2,
|
|
14
17
|
maximumFractionDigits: 2
|
|
15
|
-
},
|
|
18
|
+
}, $ = (r, e = u) => f(r) ? new Intl.NumberFormat(a(), e).format(Number(r)) : r, h = (r) => new Intl.PluralRules(a(), r), M = (r, e = { type: "ordinal" }, t = {
|
|
16
19
|
one: "st",
|
|
17
20
|
two: "nd",
|
|
18
21
|
few: "rd",
|
|
19
22
|
other: "th"
|
|
20
|
-
}) => `${r}${t[
|
|
21
|
-
const e = Math.round(Math.abs(r) * 100), t =
|
|
23
|
+
}) => `${r}${t[h(e).select(r)]}`, R = (r) => {
|
|
24
|
+
const e = Math.round(Math.abs(r) * 100), t = m(e / 100, d.cents);
|
|
22
25
|
return r < 0 && e > 0 ? `-${t}` : t;
|
|
23
26
|
};
|
|
24
27
|
export {
|
|
25
|
-
d as
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
d as CURRENCY_FORMAT,
|
|
29
|
+
m as formatCurrency,
|
|
30
|
+
M as formatOrdinal,
|
|
31
|
+
$ as formatPercentage,
|
|
32
|
+
R as formatSignedCurrency,
|
|
33
|
+
w as generateEqualIntervals,
|
|
34
|
+
C as getCurrencyCodes,
|
|
35
|
+
h as getPluralRules,
|
|
36
|
+
f as isValidNumber,
|
|
33
37
|
y as roundedAverage
|
|
34
38
|
};
|
|
35
39
|
|
|
@@ -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\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,
|
|
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/** The shared currency formats: with cents, and whole dollars. */\nexport const CURRENCY_FORMAT = { cents: '0,0.00', whole: '0,0' } as const\nexport type CurrencyFormat = (typeof CURRENCY_FORMAT)[keyof typeof CURRENCY_FORMAT]\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, CURRENCY_FORMAT.cents)\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,SA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{ buildDynamicCopy as C } from "../../../core/utils/Localization.es.js";
|
|
2
|
-
import { useCategoryStore as
|
|
3
|
-
import { slot as
|
|
4
|
-
import { formatCurrency as
|
|
5
|
-
import { getLocalizedCategoryName as
|
|
6
|
-
import
|
|
7
|
-
import { useBeatActions as
|
|
8
|
-
import { isPositiveAmount as
|
|
9
|
-
import { useCtaHandler as
|
|
10
|
-
import
|
|
2
|
+
import { useCategoryStore as F, useGlobalCopyStore as I, useInsightsV2Store as L } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { slot as T } from "../../../core/types/Insights.es.js";
|
|
4
|
+
import { CURRENCY_FORMAT as k, formatCurrency as w } from "../../../core/utils/NumberFormatting.es.js";
|
|
5
|
+
import { getLocalizedCategoryName as M } from "../../../core/utils/CategoryUtil.es.js";
|
|
6
|
+
import O from "../../../common/components/CurrencyDialog.es.js";
|
|
7
|
+
import { useBeatActions as P } from "../../beatActions.es.js";
|
|
8
|
+
import { isPositiveAmount as j, resolveBudgetFacts as E } from "../BudgetDetailsBlock/layout.es.js";
|
|
9
|
+
import { useCtaHandler as G } from "../../ctaActions/useCtaAction.es.js";
|
|
10
|
+
import H from "../../components/shared/StatusSnackbar.es.js";
|
|
11
11
|
import e from "react";
|
|
12
12
|
import { observer as V } from "mobx-react-lite";
|
|
13
13
|
import { jsx as l, jsxs as z } from "react/jsx-runtime";
|
|
14
|
-
var
|
|
15
|
-
const { budgets: t, categories: b, common: r, insights_feed: h } =
|
|
14
|
+
var ae = V(function({ beat: n }) {
|
|
15
|
+
const { budgets: t, categories: b, common: r, insights_feed: h } = I(), S = F(), { closeActionDrawer: s } = L(), v = G(n, P()), A = n.insights_payload, { categoryGuid: m = "" } = E(n), x = T(A?.instance_slot?.data, "average_amount") ?? 0, d = S.categories.find(({ guid: o }) => o === m), g = d ? M(d, b) : "", [c, B] = e.useState(""), [D, p] = e.useState(!0), [N, f] = e.useState(!1), [a, i] = e.useState(null), u = e.useRef(!0);
|
|
16
16
|
e.useEffect(() => (u.current = !0, () => {
|
|
17
17
|
u.current = !1;
|
|
18
18
|
}), []);
|
|
19
|
-
const y = (o) => C(o, g), _ =
|
|
19
|
+
const y = (o) => C(o, g), _ = j(c) && !N, R = async () => {
|
|
20
20
|
if (!_) return;
|
|
21
21
|
f(!0);
|
|
22
22
|
const o = await v("createBudget", {
|
|
@@ -25,13 +25,13 @@ var re = V(function({ beat: n }) {
|
|
|
25
25
|
}, { onSuccess: ["refreshBeat"] });
|
|
26
26
|
u.current && (f(!1), p(!1), i(o ? "created" : "failed"));
|
|
27
27
|
};
|
|
28
|
-
return /* @__PURE__ */ z(e.Fragment, { children: [/* @__PURE__ */ l(
|
|
28
|
+
return /* @__PURE__ */ z(e.Fragment, { children: [/* @__PURE__ */ l(O, {
|
|
29
29
|
closeAriaLabel: r.close_aria,
|
|
30
|
-
content: C(t.create_budget_content, /* @__PURE__ */ l("strong", { children: g }, "category"),
|
|
30
|
+
content: C(t.create_budget_content, /* @__PURE__ */ l("strong", { children: g }, "category"), w(x, k.whole)),
|
|
31
31
|
handleInputChange: B,
|
|
32
32
|
handleModalClose: s,
|
|
33
33
|
handlePrimaryAction: () => {
|
|
34
|
-
|
|
34
|
+
R();
|
|
35
35
|
},
|
|
36
36
|
handleSecondaryAction: s,
|
|
37
37
|
inputLabel: r.amount_text,
|
|
@@ -41,7 +41,7 @@ var re = V(function({ beat: n }) {
|
|
|
41
41
|
primaryText: t.dialog_primary_button_text,
|
|
42
42
|
secondaryText: r.cancel_button,
|
|
43
43
|
title: t.dialog_create_budget_title
|
|
44
|
-
}), /* @__PURE__ */ l(
|
|
44
|
+
}), /* @__PURE__ */ l(H, {
|
|
45
45
|
actionText: a === "failed" ? h?.general?.try_again : void 0,
|
|
46
46
|
closeAriaLabel: r.close_aria,
|
|
47
47
|
message: y(a === "created" ? t.alert_budget_created : t.alert_merchant_budget_not_created),
|
|
@@ -56,7 +56,7 @@ var re = V(function({ beat: n }) {
|
|
|
56
56
|
})] });
|
|
57
57
|
});
|
|
58
58
|
export {
|
|
59
|
-
|
|
59
|
+
ae as CreateBudgetDialog
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
//# sourceMappingURL=CreateBudgetDialog.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateBudgetDialog.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n CurrencyDialog,\n buildDynamicCopy,\n
|
|
1
|
+
{"version":3,"file":"CreateBudgetDialog.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n CurrencyDialog,\n buildDynamicCopy,\n useCategoryStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n} from '../../../common'\nimport { slot } from '../../../core/types/Insights'\nimport { getLocalizedCategoryName } from '../../../core/utils/CategoryUtil'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport StatusSnackbar from '../../components/shared/StatusSnackbar'\nimport { useBeatActions } from '../../beatActions'\nimport { useCtaHandler } from '../../ctaActions'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { isPositiveAmount, resolveBudgetFacts } from '../BudgetDetailsBlock/layout'\n\ntype Notice = 'created' | 'failed'\n\n/** The \"Create a Budget\" dialog (mounted once categories load): creates the budget, refreshes the beat, shows the result. */\nexport const CreateBudgetDialog = observer(function CreateBudgetDialog({ beat }: ActionBlockProps) {\n const {\n budgets: budgetsCopy,\n categories: categoriesCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n } = useGlobalCopyStore()\n const categoryStore = useCategoryStore()\n const { closeActionDrawer } = useInsightsV2Store()\n const runHandler = useCtaHandler(beat, useBeatActions())\n\n const payload = beat.insights_payload\n const { categoryGuid = '' } = resolveBudgetFacts(beat)\n const averageAmount = slot<number>(payload?.instance_slot?.data, 'average_amount') ?? 0\n const category = categoryStore.categories.find(({ guid }) => guid === categoryGuid)\n const categoryName = category ? getLocalizedCategoryName(category, categoriesCopy) : ''\n\n const [amount, setAmount] = React.useState('')\n const [isOpen, setIsOpen] = React.useState(true)\n const [isSaving, setIsSaving] = React.useState(false)\n const [notice, setNotice] = React.useState<Notice | null>(null)\n const isMounted = React.useRef(true)\n\n React.useEffect(() => {\n isMounted.current = true\n\n return () => {\n isMounted.current = false\n }\n }, [])\n\n const named = (copy: string) => buildDynamicCopy(copy, categoryName) as string\n\n const canCreate = isPositiveAmount(amount) && !isSaving\n\n const handleCreate = async () => {\n if (!canCreate) return\n\n setIsSaving(true)\n const ok = await runHandler(\n 'createBudget',\n { categoryGuid, amount: Number(amount) },\n { onSuccess: ['refreshBeat'] },\n )\n if (!isMounted.current) return\n\n setIsSaving(false)\n setIsOpen(false)\n setNotice(ok ? 'created' : 'failed')\n }\n\n return (\n <React.Fragment>\n <CurrencyDialog\n closeAriaLabel={commonCopy.close_aria}\n content={\n buildDynamicCopy(\n budgetsCopy.create_budget_content,\n <strong key=\"category\">{categoryName}</strong>,\n formatCurrency(averageAmount, CURRENCY_FORMAT.whole),\n ) as React.ReactNode\n }\n handleInputChange={setAmount}\n handleModalClose={closeActionDrawer}\n handlePrimaryAction={() => void handleCreate()}\n handleSecondaryAction={closeActionDrawer}\n inputLabel={commonCopy.amount_text}\n inputValue={amount}\n isOpen={isOpen}\n isPrimaryDisabled={!canCreate}\n primaryText={budgetsCopy.dialog_primary_button_text}\n secondaryText={commonCopy.cancel_button}\n title={budgetsCopy.dialog_create_budget_title}\n />\n <StatusSnackbar\n actionText={notice === 'failed' ? insightsFeedCopy?.general?.try_again : undefined}\n closeAriaLabel={commonCopy.close_aria}\n message={\n notice === 'created'\n ? named(budgetsCopy.alert_budget_created)\n : named(budgetsCopy.alert_merchant_budget_not_created)\n }\n onActionClick={() => {\n setNotice(null)\n setIsOpen(true)\n }}\n onClose={() => {\n setNotice(null)\n closeActionDrawer()\n }}\n open={Boolean(notice)}\n severity={notice === 'created' ? 'success' : 'error'}\n />\n </React.Fragment>\n )\n})\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAa,KAAqB,EAAS,SAA4B,EAAE,MAAA,EAAA,GAA0B;AACjG,QAAM,EACJ,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,eAAe,EAAA,IACb,EAAmB,GACjB,IAAgB,EAAiB,GACjC,EAAE,mBAAA,EAAA,IAAsB,EAAmB,GAC3C,IAAa,EAAc,GAAM,EAAe,CAAC,GAEjD,IAAU,EAAK,kBACf,EAAE,cAAA,IAAe,GAAA,IAAO,EAAmB,CAAI,GAC/C,IAAgB,EAAa,GAAS,eAAe,MAAM,gBAAgB,KAAK,GAChF,IAAW,EAAc,WAAW,KAAA,CAAM,EAAE,MAAA,EAAA,MAAW,MAAS,CAAY,GAC5E,IAAe,IAAW,EAAyB,GAAU,CAAc,IAAI,IAE/E,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAS,EAAE,GACvC,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAS,EAAI,GACzC,CAAC,GAAU,CAAA,IAAe,EAAM,SAAS,EAAK,GAC9C,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAwB,IAAI,GACxD,IAAY,EAAM,OAAO,EAAI;AAEnC,EAAA,EAAM,UAAA,OACJ,EAAU,UAAU,IAEpB,MAAa;AACX,IAAA,EAAU,UAAU;AAAA,EACtB,IACC,CAAC,CAAC;AAEL,QAAM,IAAA,CAAS,MAAiB,EAAiB,GAAM,CAAY,GAE7D,IAAY,EAAiB,CAAM,KAAK,CAAC,GAEzC,IAAe,YAAY;AAC/B,QAAI,CAAC,EAAW;AAEhB,IAAA,EAAY,EAAI;AAChB,UAAM,IAAK,MAAM,EACf,gBACA;AAAA,MAAE,cAAA;AAAA,MAAc,QAAQ,OAAO,CAAM;AAAA,IAAE,GACvC,EAAE,WAAW,CAAC,aAAa,EAAE,CAC/B;AACA,IAAK,EAAU,YAEf,EAAY,EAAK,GACjB,EAAU,EAAK,GACf,EAAU,IAAK,YAAY,QAAQ;AAAA,EACrC;AAEA,SACE,gBAAA,EAAC,EAAM,UAAP,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,EAAW;AAAA,IAC3B,SACE,EACE,EAAY,uBACZ,gBAAA,EAAC,UAAD,EAAA,UAAwB,EAAqB,GAAjC,UAAiC,GAC7C,EAAe,GAAe,EAAgB,KAAK,CACrD;AAAA,IAEF,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,qBAAA,MAAA;AAA2B,MAAK,EAAa;AAAA;AAAA,IAC7C,uBAAuB;AAAA,IACvB,YAAY,EAAW;AAAA,IACvB,YAAY;AAAA,IACJ,QAAA;AAAA,IACR,mBAAmB,CAAC;AAAA,IACpB,aAAa,EAAY;AAAA,IACzB,eAAe,EAAW;AAAA,IAC1B,OAAO,EAAY;AAAA,EACpB,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,YAAY,MAAW,WAAW,GAAkB,SAAS,YAAY;AAAA,IACzE,gBAAgB,EAAW;AAAA,IAC3B,SAEM,EADJ,MAAW,YACD,EAAY,uBACZ,EAAY,iCADoB;AAAA,IAG5C,eAAA,MAAqB;AACnB,MAAA,EAAU,IAAI,GACd,EAAU,EAAI;AAAA,IAChB;AAAA,IACA,SAAA,MAAe;AACb,MAAA,EAAU,IAAI,GACd,EAAkB;AAAA,IACpB;AAAA,IACA,MAAM,EAAQ;AAAA,IACd,UAAU,MAAW,YAAY,YAAY;AAAA,EAC9C,CAAA,CACa,EAAA,CAAA;AAEpB,CAAC"}
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import { buildDynamicCopy as h, buildPluralCopy as
|
|
2
|
-
import {
|
|
3
|
-
import { calculateBudgetPercent as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Text as
|
|
1
|
+
import { buildDynamicCopy as h, buildPluralCopy as g } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as t, formatCurrency as o } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { calculateBudgetPercent as v, calculateBudgetTier as y, tierColor as C } from "./layout.es.js";
|
|
4
|
+
import R from "../../components/ComponentBlocks/StatusIndicator.es.js";
|
|
5
|
+
import n from "@mui/material/Stack";
|
|
6
|
+
import { Text as i } from "@mxenabled/mxui";
|
|
7
7
|
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
8
8
|
import p from "@mui/material/Box";
|
|
9
|
-
import
|
|
10
|
-
var
|
|
11
|
-
const
|
|
9
|
+
import S from "@mui/material/Alert";
|
|
10
|
+
var E = ({ budgetsCopy: c, copy: d, daysLeft: m, icon: _, limit: l, showPeriodLine: u = !0, spent: a }) => {
|
|
11
|
+
const s = v(a, l), x = y(s), f = C(x), b = m === void 0 ? /* @__PURE__ */ r(S, {
|
|
12
12
|
severity: "info",
|
|
13
|
-
children:
|
|
14
|
-
}) : /* @__PURE__ */ r(
|
|
13
|
+
children: d.previous_month_notice
|
|
14
|
+
}) : /* @__PURE__ */ r(i, {
|
|
15
15
|
color: "text.secondary",
|
|
16
16
|
variant: "body2",
|
|
17
|
-
children:
|
|
17
|
+
children: g(d.days_left_until_end_of_month_one, d.days_left_until_end_of_month, m, String(m))
|
|
18
18
|
});
|
|
19
|
-
return
|
|
19
|
+
return l <= 0 ? /* @__PURE__ */ e(n, {
|
|
20
20
|
sx: { gap: 16 },
|
|
21
|
-
children: [/* @__PURE__ */ e(
|
|
21
|
+
children: [/* @__PURE__ */ e(n, {
|
|
22
22
|
sx: {
|
|
23
23
|
alignItems: "center",
|
|
24
24
|
flexDirection: "row",
|
|
25
25
|
gap: 12
|
|
26
26
|
},
|
|
27
|
-
children: [/* @__PURE__ */ r(p, { children:
|
|
27
|
+
children: [/* @__PURE__ */ r(p, { children: _ }), /* @__PURE__ */ e(n, { children: [/* @__PURE__ */ r(i, {
|
|
28
28
|
color: "text.secondary",
|
|
29
29
|
variant: "body2",
|
|
30
|
-
children:
|
|
31
|
-
}), /* @__PURE__ */ r(
|
|
30
|
+
children: c.spent_label
|
|
31
|
+
}), /* @__PURE__ */ r(i, {
|
|
32
32
|
bold: !0,
|
|
33
33
|
component: "p",
|
|
34
34
|
variant: "h2",
|
|
35
|
-
children:
|
|
35
|
+
children: o(a, t.cents)
|
|
36
36
|
})] })]
|
|
37
|
-
}), u &&
|
|
38
|
-
}) : /* @__PURE__ */ e(
|
|
37
|
+
}), u && b]
|
|
38
|
+
}) : /* @__PURE__ */ e(n, {
|
|
39
39
|
sx: { gap: 16 },
|
|
40
40
|
children: [/* @__PURE__ */ r(p, {
|
|
41
|
-
"aria-label": h(
|
|
41
|
+
"aria-label": h(d.total_out_of_limit_aria, o(a, t.cents), o(l, t.cents)),
|
|
42
42
|
"data-tier": x ?? "none",
|
|
43
43
|
role: "group",
|
|
44
|
-
children: /* @__PURE__ */ r(
|
|
45
|
-
amount: /* @__PURE__ */ e(
|
|
44
|
+
children: /* @__PURE__ */ r(R, {
|
|
45
|
+
amount: /* @__PURE__ */ e(n, {
|
|
46
46
|
sx: {
|
|
47
47
|
alignItems: "baseline",
|
|
48
48
|
flexDirection: "row",
|
|
49
49
|
gap: 4
|
|
50
50
|
},
|
|
51
|
-
children: [/* @__PURE__ */ r(
|
|
51
|
+
children: [/* @__PURE__ */ r(i, {
|
|
52
52
|
bold: !0,
|
|
53
53
|
component: "p",
|
|
54
54
|
variant: "h2",
|
|
55
|
-
children:
|
|
56
|
-
}), /* @__PURE__ */ e(
|
|
55
|
+
children: o(a, t.cents)
|
|
56
|
+
}), /* @__PURE__ */ e(i, {
|
|
57
57
|
color: "text.secondary",
|
|
58
58
|
variant: "body2",
|
|
59
|
-
children: ["/ ",
|
|
59
|
+
children: ["/ ", o(l, t.cents)]
|
|
60
60
|
})]
|
|
61
61
|
}),
|
|
62
62
|
borderRadius: "8px",
|
|
63
|
-
completeColor:
|
|
64
|
-
icon:
|
|
65
|
-
label: /* @__PURE__ */ e(
|
|
63
|
+
completeColor: f,
|
|
64
|
+
icon: _,
|
|
65
|
+
label: /* @__PURE__ */ e(n, {
|
|
66
66
|
sx: {
|
|
67
67
|
alignItems: "center",
|
|
68
68
|
flexDirection: "row",
|
|
69
69
|
gap: 6
|
|
70
70
|
},
|
|
71
71
|
children: [/* @__PURE__ */ r(p, { sx: {
|
|
72
|
-
bgcolor:
|
|
72
|
+
bgcolor: f,
|
|
73
73
|
borderRadius: "50%",
|
|
74
74
|
height: 8,
|
|
75
75
|
width: 8
|
|
76
|
-
} }), /* @__PURE__ */ r(
|
|
76
|
+
} }), /* @__PURE__ */ r(i, {
|
|
77
77
|
color: "text.secondary",
|
|
78
78
|
variant: "body2",
|
|
79
|
-
children:
|
|
79
|
+
children: c.spent_label
|
|
80
80
|
})]
|
|
81
81
|
}),
|
|
82
|
-
leftLabel: h(
|
|
83
|
-
percentComplete: Math.min(100,
|
|
84
|
-
rightLabel: h(
|
|
82
|
+
leftLabel: h(c.percent_spent, String(s)),
|
|
83
|
+
percentComplete: Math.min(100, s),
|
|
84
|
+
rightLabel: h(c.balance_left, o(Math.max(0, l - a), t.cents)),
|
|
85
85
|
sx: { p: 0 }
|
|
86
86
|
})
|
|
87
|
-
}), u &&
|
|
87
|
+
}), u && b]
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
90
|
export {
|
|
91
|
-
|
|
91
|
+
E as BudgetSummary
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
//# sourceMappingURL=BudgetSummary.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetSummary.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { BudgetsCopy } from '../../../core/types/localization'\nimport type { BudgetDetailsCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport StatusIndicator from '../../components/ComponentBlocks/StatusIndicator'\n\nimport { calculateBudgetPercent, calculateBudgetTier, tierColor } from './layout'\n\ninterface BudgetSummaryProps {\n budgetsCopy: BudgetsCopy\n copy: BudgetDetailsCopy\n daysLeft?: number\n icon: ReactNode\n limit: number\n /** The days-left / previous-month line under the bar (off for Figma's Budget Details insights). */\n showPeriodLine?: boolean\n spent: number\n}\n\nexport const BudgetSummary = ({\n budgetsCopy,\n copy,\n daysLeft,\n icon,\n limit,\n showPeriodLine = true,\n spent,\n}: BudgetSummaryProps) => {\n const percent = calculateBudgetPercent(spent, limit)\n const tier = calculateBudgetTier(percent)\n const color = tierColor(tier)\n const periodLine =\n daysLeft === undefined ? (\n <Alert severity=\"info\">{copy.previous_month_notice}</Alert>\n ) : (\n <Text color=\"text.secondary\" variant=\"body2\">\n {\n buildPluralCopy(\n copy.days_left_until_end_of_month_one,\n copy.days_left_until_end_of_month,\n daysLeft,\n String(daysLeft),\n ) as string\n }\n </Text>\n )\n\n if (limit <= 0) {\n return (\n <Stack sx={{ gap: 16 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent,
|
|
1
|
+
{"version":3,"file":"BudgetSummary.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { BudgetsCopy } from '../../../core/types/localization'\nimport type { BudgetDetailsCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport StatusIndicator from '../../components/ComponentBlocks/StatusIndicator'\n\nimport { calculateBudgetPercent, calculateBudgetTier, tierColor } from './layout'\n\ninterface BudgetSummaryProps {\n budgetsCopy: BudgetsCopy\n copy: BudgetDetailsCopy\n daysLeft?: number\n icon: ReactNode\n limit: number\n /** The days-left / previous-month line under the bar (off for Figma's Budget Details insights). */\n showPeriodLine?: boolean\n spent: number\n}\n\nexport const BudgetSummary = ({\n budgetsCopy,\n copy,\n daysLeft,\n icon,\n limit,\n showPeriodLine = true,\n spent,\n}: BudgetSummaryProps) => {\n const percent = calculateBudgetPercent(spent, limit)\n const tier = calculateBudgetTier(percent)\n const color = tierColor(tier)\n const periodLine =\n daysLeft === undefined ? (\n <Alert severity=\"info\">{copy.previous_month_notice}</Alert>\n ) : (\n <Text color=\"text.secondary\" variant=\"body2\">\n {\n buildPluralCopy(\n copy.days_left_until_end_of_month_one,\n copy.days_left_until_end_of_month,\n daysLeft,\n String(daysLeft),\n ) as string\n }\n </Text>\n )\n\n if (limit <= 0) {\n return (\n <Stack sx={{ gap: 16 }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n {showPeriodLine && periodLine}\n </Stack>\n )\n }\n\n return (\n <Stack sx={{ gap: 16 }}>\n <Box\n aria-label={\n buildDynamicCopy(\n copy.total_out_of_limit_aria,\n formatCurrency(spent, CURRENCY_FORMAT.cents),\n formatCurrency(limit, CURRENCY_FORMAT.cents),\n ) as string\n }\n data-tier={tier ?? 'none'}\n role=\"group\"\n >\n <StatusIndicator\n amount={\n <Stack sx={{ alignItems: 'baseline', flexDirection: 'row', gap: 4 }}>\n <Text bold={true} component=\"p\" variant=\"h2\">\n {formatCurrency(spent, CURRENCY_FORMAT.cents)}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n / {formatCurrency(limit, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n }\n borderRadius=\"8px\"\n completeColor={color}\n icon={icon}\n label={\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 6 }}>\n <Box sx={{ bgcolor: color, borderRadius: '50%', height: 8, width: 8 }} />\n <Text color=\"text.secondary\" variant=\"body2\">\n {budgetsCopy.spent_label}\n </Text>\n </Stack>\n }\n leftLabel={buildDynamicCopy(budgetsCopy.percent_spent, String(percent)) as string}\n percentComplete={Math.min(100, percent)}\n rightLabel={\n buildDynamicCopy(\n // Figma's \"$amount Left\"; $0.00 once over, as the Budgets drawer shows it.\n budgetsCopy.balance_left,\n formatCurrency(Math.max(0, limit - spent), CURRENCY_FORMAT.cents),\n ) as string\n }\n sx={{ p: 0 }}\n />\n </Box>\n {showPeriodLine && periodLine}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAa,IAAA,CAAiB,EAC5B,aAAA,GACA,MAAA,GACA,UAAA,GACA,MAAA,GACA,OAAA,GACA,gBAAA,IAAiB,IACjB,OAAA,EAAA,MACwB;AACxB,QAAM,IAAU,EAAuB,GAAO,CAAK,GAC7C,IAAO,EAAoB,CAAO,GAClC,IAAQ,EAAU,CAAI,GACtB,IACJ,MAAa,SACX,gBAAA,EAAC,GAAD;AAAA,IAAO,UAAS;AAAA,IAAQ,UAAA,EAAK;AAAA,EAA6B,CAAA,IAE1D,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,SAAQ;AAAA,IAEjC,UAAA,EACE,EAAK,kCAC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,GACN,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAArC,UAAA,CAA6C,MACxC,EAAe,GAAO,EAAgB,KAAK,CAC1C;AAAA,UACD,CAAA,CAAA;AAAA;QAET,cAAa;AAAA,QACb,eAAe;AAAA,QACT,MAAA;AAAA,QACN,OACE,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,YAAY;AAAA,YAAU,eAAe;AAAA,YAAO,KAAK;AAAA,UAAE;AAAA,UAAhE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAK,IAAI;AAAA,YAAE,SAAS;AAAA,YAAO,cAAc;AAAA,YAAO,QAAQ;AAAA,YAAG,OAAO;AAAA,UAAE,EAAI,CAAA,GACxE,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA,EAAY;AAAA,UACT,CAAA,CACD;AAAA;QAET,WAAW,EAAiB,EAAY,eAAe,OAAO,CAAO,CAAC;AAAA,QACtE,iBAAiB,KAAK,IAAI,KAAK,CAAO;AAAA,QACtC,YACE,EAEE,EAAY,cACZ,EAAe,KAAK,IAAI,GAAG,IAAQ,CAAK,GAAG,EAAgB,KAAK,CAClE;AAAA,QAEF,IAAI,EAAE,GAAG,EAAE;AAAA,MACZ,CAAA;AAAA,IACE,CAAA,GACJ,KAAkB,CACd;AAAA;AAEX"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { buildDynamicCopy as v } from "../../../core/utils/Localization.es.js";
|
|
2
2
|
import { sanitizeHtml as f } from "../../../core/utils/SanitizeHtml.es.js";
|
|
3
3
|
import { DEFAULT_INSTITUTION_LOGO_URL as _ } from "../../../core/constants/InstitutionLogo.es.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CURRENCY_FORMAT as w, formatCurrency as C } from "../../../core/utils/NumberFormatting.es.js";
|
|
5
5
|
import I from "../../blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js";
|
|
6
6
|
import { UTILIZATION_BANDS as b, getUtilizationBand as g } from "./layout.es.js";
|
|
7
7
|
import d from "@mui/material/Stack";
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Fragment as
|
|
8
|
+
import { Icon as D, InstitutionLogo as S, Text as l } from "@mxenabled/mxui";
|
|
9
|
+
import { Fragment as z, jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
10
10
|
import { useTheme as x } from "@mui/material/styles";
|
|
11
11
|
import m from "@mui/material/Box";
|
|
12
|
-
var h = (t) =>
|
|
12
|
+
var h = (t) => C(t, w.cents), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
13
13
|
sx: {
|
|
14
14
|
bgcolor: "background.paper",
|
|
15
15
|
p: 24
|
|
@@ -21,7 +21,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
21
21
|
sx: { mb: r },
|
|
22
22
|
variant: "body1",
|
|
23
23
|
children: t
|
|
24
|
-
}),
|
|
24
|
+
}), T = ({ copy: t, summary: { balance: r, limit: n, percentage: i } }) => {
|
|
25
25
|
const a = x(), c = v(t.total_credit_utilized_aria, h(r), h(n), String(i));
|
|
26
26
|
return /* @__PURE__ */ e(m, {
|
|
27
27
|
"aria-label": c,
|
|
@@ -101,7 +101,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
101
101
|
children: t.recommendation
|
|
102
102
|
})
|
|
103
103
|
] });
|
|
104
|
-
},
|
|
104
|
+
}, R = ({ card: t, copy: r }) => {
|
|
105
105
|
const n = x(), { limit: i, percentage: a } = t, c = i !== null && a !== null, s = c ? g(a).color(n) : n.palette.text.disabled;
|
|
106
106
|
return /* @__PURE__ */ o(m, {
|
|
107
107
|
component: "li",
|
|
@@ -117,7 +117,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
117
117
|
flexDirection: "row",
|
|
118
118
|
gap: 12
|
|
119
119
|
},
|
|
120
|
-
children: [/* @__PURE__ */ e(
|
|
120
|
+
children: [/* @__PURE__ */ e(S, {
|
|
121
121
|
alt: "",
|
|
122
122
|
institutionGuid: t.institutionGuid,
|
|
123
123
|
logoUrl: t.institutionGuid ? void 0 : _,
|
|
@@ -158,7 +158,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
158
158
|
flexDirection: "row",
|
|
159
159
|
gap: 4
|
|
160
160
|
},
|
|
161
|
-
children: [/* @__PURE__ */ e(
|
|
161
|
+
children: [/* @__PURE__ */ e(D, {
|
|
162
162
|
name: "info",
|
|
163
163
|
size: 14,
|
|
164
164
|
sx: { color: "text.secondary" }
|
|
@@ -210,7 +210,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
210
210
|
bold: !0,
|
|
211
211
|
variant: "caption",
|
|
212
212
|
children: h(t.amount)
|
|
213
|
-
}), c && /* @__PURE__ */ o(
|
|
213
|
+
}), c && /* @__PURE__ */ o(z, { children: [/* @__PURE__ */ e(l, {
|
|
214
214
|
variant: "caption",
|
|
215
215
|
children: "/"
|
|
216
216
|
}), /* @__PURE__ */ e(l, {
|
|
@@ -234,7 +234,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
234
234
|
})]
|
|
235
235
|
})]
|
|
236
236
|
});
|
|
237
|
-
},
|
|
237
|
+
}, U = (t) => {
|
|
238
238
|
const r = /* @__PURE__ */ new Map();
|
|
239
239
|
return t.map((n) => {
|
|
240
240
|
const i = (r.get(n.guid) ?? 0) + 1;
|
|
@@ -243,7 +243,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
243
243
|
key: i === 1 ? n.guid : `${n.guid}-${i}`
|
|
244
244
|
};
|
|
245
245
|
});
|
|
246
|
-
},
|
|
246
|
+
}, F = ({ cards: t, copy: r, descriptionHtml: n, summary: i, title: a }) => /* @__PURE__ */ o(d, {
|
|
247
247
|
sx: {
|
|
248
248
|
bgcolor: "background.default",
|
|
249
249
|
gap: 8,
|
|
@@ -252,7 +252,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
252
252
|
children: [
|
|
253
253
|
(a || i || n) && /* @__PURE__ */ o(u, { children: [
|
|
254
254
|
a && /* @__PURE__ */ e(p, { children: a }),
|
|
255
|
-
i && /* @__PURE__ */ e(
|
|
255
|
+
i && /* @__PURE__ */ e(T, {
|
|
256
256
|
copy: r,
|
|
257
257
|
summary: i
|
|
258
258
|
}),
|
|
@@ -273,7 +273,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
273
273
|
m: 0,
|
|
274
274
|
p: 0
|
|
275
275
|
},
|
|
276
|
-
children:
|
|
276
|
+
children: U(t).map(({ card: c, key: s }) => /* @__PURE__ */ e(R, {
|
|
277
277
|
card: c,
|
|
278
278
|
copy: r
|
|
279
279
|
}, s))
|
|
@@ -281,7 +281,7 @@ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
|
|
|
281
281
|
]
|
|
282
282
|
});
|
|
283
283
|
export {
|
|
284
|
-
|
|
284
|
+
F as default
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
//# sourceMappingURL=CreditUtilizationContent.es.js.map
|
package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditUtilizationContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { CreditUtilizationCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { sanitizeHtml } from '../../../core/utils/SanitizeHtml'\nimport DonutChartV2 from '../../blocks/ChartBlocks/DonutChartBlock/DonutChart'\n\nimport {\n getUtilizationBand,\n UTILIZATION_BANDS,\n type CreditCardRow,\n type CreditUtilizationSummary,\n} from './layout'\n\nexport interface CreditUtilizationCard extends CreditCardRow {\n /** Empty when no loaded account matches the row's guid. */\n institutionGuid: string\n}\n\nexport interface CreditUtilizationContentProps {\n title?: string\n descriptionHtml?: string\n summary?: CreditUtilizationSummary\n cards: CreditUtilizationCard[]\n copy: CreditUtilizationCopy\n}\n\nconst formatMoney = (amount: number) => formatCurrency(amount, '0,0.00')\n\nconst Section = ({ children }: { children: React.ReactNode }) => (\n <Stack sx={{ bgcolor: 'background.paper', p: 24 }}>{children}</Stack>\n)\n\nconst SectionHeading = ({ children, mb = 16 }: { children: string; mb?: number }) => (\n <Text bold={true} component=\"h3\" sx={{ mb }} variant=\"body1\">\n {children}\n </Text>\n)\n\nconst Summary = ({\n copy,\n summary: { balance, limit, percentage },\n}: {\n copy: CreditUtilizationCopy\n summary: CreditUtilizationSummary\n}) => {\n const theme = useTheme()\n const label = buildDynamicCopy(\n copy.total_credit_utilized_aria,\n formatMoney(balance),\n formatMoney(limit),\n String(percentage),\n ) as string\n\n return (\n <Box aria-label={label} role=\"img\">\n <DonutChartV2\n centerValue={`${percentage}%`}\n data={[\n {\n color: getUtilizationBand(percentage).color(theme),\n label: copy.total_credit_utilized,\n labelValue: `${formatMoney(balance)} / ${formatMoney(limit)}`,\n value: percentage,\n },\n { color: theme.palette.divider, value: 100 - percentage },\n ]}\n />\n </Box>\n )\n}\n\nconst Legend = ({ copy }: { copy: CreditUtilizationCopy }) => {\n const theme = useTheme()\n const last = UTILIZATION_BANDS.length - 1\n\n return (\n <Section>\n <SectionHeading mb={24}>{copy.what_does_this_mean}</SectionHeading>\n <Stack\n aria-label={copy.what_does_this_mean}\n component=\"ul\"\n role=\"list\"\n sx={{ flexDirection: 'row', gap: 2, listStyle: 'none', m: 0, mb: 24, p: 0 }}\n >\n {UTILIZATION_BANDS.map(({ band, color, range }, index) => (\n <Box component=\"li\" key={band} sx={{ flex: 1, minWidth: 0, overflowWrap: 'anywhere' }}>\n <Box\n aria-hidden={true}\n sx={{\n bgcolor: color(theme),\n borderRadius:\n index === 0 ? '8px 0 0 8px' : index === last ? '0 8px 8px 0' : undefined,\n height: 12,\n mb: 8,\n }}\n />\n <Text bold={true} component=\"p\" variant=\"caption\">\n {range}\n </Text>\n <Text component=\"p\" variant=\"caption\">\n {copy[band]}\n </Text>\n </Box>\n ))}\n </Stack>\n <Text component=\"p\" variant=\"body2\">\n {copy.ratio_explanation}\n </Text>\n <Text component=\"p\" sx={{ mt: 16 }} variant=\"body2\">\n {copy.recommendation}\n </Text>\n </Section>\n )\n}\n\nconst CardUtilization = ({\n card,\n copy,\n}: {\n card: CreditUtilizationCard\n copy: CreditUtilizationCopy\n}) => {\n const theme = useTheme()\n const { limit, percentage } = card\n const hasLimit = limit !== null && percentage !== null\n const color = hasLimit ? getUtilizationBand(percentage).color(theme) : theme.palette.text.disabled\n\n return (\n <Box\n component=\"li\"\n sx={{ border: '1px solid', borderColor: 'divider', borderRadius: '8px', p: 16 }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={card.institutionGuid}\n logoUrl={card.institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={40}\n />\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body2\">\n {card.label}\n </Text>\n {hasLimit ? (\n <Box\n aria-label={card.label}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={percentage}\n aria-valuetext={`${percentage}%`}\n role=\"meter\"\n sx={{ bgcolor: 'neutral.light', borderRadius: 999, height: 8, overflow: 'hidden' }}\n >\n <Box\n sx={{ bgcolor: color, borderRadius: 999, height: '100%', width: `${percentage}%` }}\n />\n </Box>\n ) : (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n <Icon name=\"info\" size={14} sx={{ color: 'text.secondary' }} />\n <Text color=\"text.secondary\" variant=\"caption\">\n {copy.credit_limit_not_shared}\n </Text>\n </Stack>\n )}\n </Stack>\n </Stack>\n <Stack sx={{ gap: 12, mt: 24, pl: 52 }}>\n <Stack\n sx={{\n alignItems: 'center',\n borderBottom: '1px solid',\n borderColor: 'divider',\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 10,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <Box sx={{ bgcolor: color, borderRadius: '1px', flexShrink: 0, height: 8, width: 8 }} />\n <Text variant=\"caption\">{copy.credit_utilized}</Text>\n </Stack>\n <Stack sx={{ flexDirection: 'row', fontVariantNumeric: 'tabular-nums', gap: 4 }}>\n <Text bold={true} variant=\"caption\">\n {formatMoney(card.amount)}\n </Text>\n {hasLimit && (\n <>\n <Text variant=\"caption\">/</Text>\n <Text variant=\"caption\">{formatMoney(limit)}</Text>\n </>\n )}\n </Stack>\n </Stack>\n {hasLimit && (\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text variant=\"caption\">{copy.credit_utilization_ratio}</Text>\n <Text bold={true} variant=\"caption\">\n {percentage}%\n </Text>\n </Stack>\n )}\n </Stack>\n </Box>\n )\n}\n\n/** `data_series` makes no uniqueness promise for `guid`, so a repeat gets a numbered key. */\nconst keyedCards = (cards: CreditUtilizationCard[]) => {\n const seen = new Map<string, number>()\n\n return cards.map((card) => {\n const count = (seen.get(card.guid) ?? 0) + 1\n\n seen.set(card.guid, count)\n\n return { card, key: count === 1 ? card.guid : `${card.guid}-${count}` }\n })\n}\n\n/** Presentational body of the Credit Utilization drawer, minus the drawer header. */\nconst CreditUtilizationContent = ({\n cards,\n copy,\n descriptionHtml,\n summary,\n title,\n}: CreditUtilizationContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', gap: 8, pb: 24 }}>\n {(title || summary || descriptionHtml) && (\n <Section>\n {title && <SectionHeading>{title}</SectionHeading>}\n {summary && <Summary copy={copy} summary={summary} />}\n {descriptionHtml && (\n <Text\n component=\"p\"\n dangerouslySetInnerHTML={{ __html: sanitizeHtml(descriptionHtml) }}\n sx={{ mt: 16 }}\n variant=\"body2\"\n />\n )}\n </Section>\n )}\n <Legend copy={copy} />\n {cards.length > 0 && (\n <Section>\n <SectionHeading>{copy.per_card_header}</SectionHeading>\n <Stack component=\"ul\" role=\"list\" sx={{ gap: 16, listStyle: 'none', m: 0, p: 0 }}>\n {keyedCards(cards).map(({ card, key }) => (\n <CardUtilization card={card} copy={copy} key={key} />\n ))}\n </Stack>\n </Section>\n )}\n </Stack>\n)\n\nexport default CreditUtilizationContent\n"],"mappings":";;;;;;;;;;;AAiCA,IAAM,IAAA,CAAe,MAAmB,EAAe,GAAQ,QAAQ,GAEjE,IAAA,CAAW,EAAE,UAAA,EAAA,MACjB,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,SAAS;AAAA,IAAoB,GAAG;AAAA,EAAG;AAAA,EAAI,UAAA;AAAgB,CAAA,GAGhE,IAAA,CAAkB,EAAE,UAAA,GAAU,IAAA,IAAK,GAAA,MACvC,gBAAA,EAAC,GAAD;AAAA,EAAM,MAAM;AAAA,EAAM,WAAU;AAAA,EAAK,IAAI,EAAE,IAAA,EAAG;AAAA,EAAG,SAAQ;AAAA,EAClD,UAAA;AACG,CAAA,GAGF,IAAA,CAAW,EACf,MAAA,GACA,SAAS,EAAE,SAAA,GAAS,OAAA,GAAO,YAAA,EAAA,EAAA,MAIvB;AACJ,QAAM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;AAAA,MACnD,KACC,gBAAA,EAAC,GAAD;AAAA,QACE,WAAU;AAAA,QACV,yBAAyB,EAAE,QAAQ,EAAa,CAAe,EAAE;AAAA,QACjE,IAAI,EAAE,IAAI,GAAG;AAAA,QACb,SAAQ;AAAA,MACT,CAAA;AAAA,IAEI,EAAA,CAAA;AAAA,IAEX,gBAAA,EAAC,GAAD,EAAc,MAAA,EAAO,CAAA;AAAA,IACpB,EAAM,SAAS,KACd,gBAAA,EAAC,GAAD,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAiB,EAAK,gBAAgC,CAAA,GACtD,gBAAA,EAAC,GAAD;AAAA,MAAO,WAAU;AAAA,MAAK,MAAK;AAAA,MAAO,IAAI;AAAA,QAAE,KAAK;AAAA,QAAI,WAAW;AAAA,QAAQ,GAAG;AAAA,QAAG,GAAG;AAAA,MAAE;AAAA,MAC5E,UAAA,EAAW,CAAK,EAAE,IAAA,CAAK,EAAE,MAAA,GAAM,KAAA,EAAA,MAC9B,gBAAA,EAAC,GAAD;AAAA,QAAuB,MAAA;AAAA,QAAY,MAAA;AAAA,MAAiB,GAAN,CAAM,CACrD;AAAA,IACI,CAAA,CACA,EAAA,CAAA;AAAA,EAEN"}
|
|
1
|
+
{"version":3,"file":"CreditUtilizationContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { CreditUtilizationCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { sanitizeHtml } from '../../../core/utils/SanitizeHtml'\nimport DonutChartV2 from '../../blocks/ChartBlocks/DonutChartBlock/DonutChart'\n\nimport {\n getUtilizationBand,\n UTILIZATION_BANDS,\n type CreditCardRow,\n type CreditUtilizationSummary,\n} from './layout'\n\nexport interface CreditUtilizationCard extends CreditCardRow {\n /** Empty when no loaded account matches the row's guid. */\n institutionGuid: string\n}\n\nexport interface CreditUtilizationContentProps {\n title?: string\n descriptionHtml?: string\n summary?: CreditUtilizationSummary\n cards: CreditUtilizationCard[]\n copy: CreditUtilizationCopy\n}\n\nconst formatMoney = (amount: number) => formatCurrency(amount, CURRENCY_FORMAT.cents)\n\nconst Section = ({ children }: { children: React.ReactNode }) => (\n <Stack sx={{ bgcolor: 'background.paper', p: 24 }}>{children}</Stack>\n)\n\nconst SectionHeading = ({ children, mb = 16 }: { children: string; mb?: number }) => (\n <Text bold={true} component=\"h3\" sx={{ mb }} variant=\"body1\">\n {children}\n </Text>\n)\n\nconst Summary = ({\n copy,\n summary: { balance, limit, percentage },\n}: {\n copy: CreditUtilizationCopy\n summary: CreditUtilizationSummary\n}) => {\n const theme = useTheme()\n const label = buildDynamicCopy(\n copy.total_credit_utilized_aria,\n formatMoney(balance),\n formatMoney(limit),\n String(percentage),\n ) as string\n\n return (\n <Box aria-label={label} role=\"img\">\n <DonutChartV2\n centerValue={`${percentage}%`}\n data={[\n {\n color: getUtilizationBand(percentage).color(theme),\n label: copy.total_credit_utilized,\n labelValue: `${formatMoney(balance)} / ${formatMoney(limit)}`,\n value: percentage,\n },\n { color: theme.palette.divider, value: 100 - percentage },\n ]}\n />\n </Box>\n )\n}\n\nconst Legend = ({ copy }: { copy: CreditUtilizationCopy }) => {\n const theme = useTheme()\n const last = UTILIZATION_BANDS.length - 1\n\n return (\n <Section>\n <SectionHeading mb={24}>{copy.what_does_this_mean}</SectionHeading>\n <Stack\n aria-label={copy.what_does_this_mean}\n component=\"ul\"\n role=\"list\"\n sx={{ flexDirection: 'row', gap: 2, listStyle: 'none', m: 0, mb: 24, p: 0 }}\n >\n {UTILIZATION_BANDS.map(({ band, color, range }, index) => (\n <Box component=\"li\" key={band} sx={{ flex: 1, minWidth: 0, overflowWrap: 'anywhere' }}>\n <Box\n aria-hidden={true}\n sx={{\n bgcolor: color(theme),\n borderRadius:\n index === 0 ? '8px 0 0 8px' : index === last ? '0 8px 8px 0' : undefined,\n height: 12,\n mb: 8,\n }}\n />\n <Text bold={true} component=\"p\" variant=\"caption\">\n {range}\n </Text>\n <Text component=\"p\" variant=\"caption\">\n {copy[band]}\n </Text>\n </Box>\n ))}\n </Stack>\n <Text component=\"p\" variant=\"body2\">\n {copy.ratio_explanation}\n </Text>\n <Text component=\"p\" sx={{ mt: 16 }} variant=\"body2\">\n {copy.recommendation}\n </Text>\n </Section>\n )\n}\n\nconst CardUtilization = ({\n card,\n copy,\n}: {\n card: CreditUtilizationCard\n copy: CreditUtilizationCopy\n}) => {\n const theme = useTheme()\n const { limit, percentage } = card\n const hasLimit = limit !== null && percentage !== null\n const color = hasLimit ? getUtilizationBand(percentage).color(theme) : theme.palette.text.disabled\n\n return (\n <Box\n component=\"li\"\n sx={{ border: '1px solid', borderColor: 'divider', borderRadius: '8px', p: 16 }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={card.institutionGuid}\n logoUrl={card.institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={40}\n />\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body2\">\n {card.label}\n </Text>\n {hasLimit ? (\n <Box\n aria-label={card.label}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={percentage}\n aria-valuetext={`${percentage}%`}\n role=\"meter\"\n sx={{ bgcolor: 'neutral.light', borderRadius: 999, height: 8, overflow: 'hidden' }}\n >\n <Box\n sx={{ bgcolor: color, borderRadius: 999, height: '100%', width: `${percentage}%` }}\n />\n </Box>\n ) : (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n <Icon name=\"info\" size={14} sx={{ color: 'text.secondary' }} />\n <Text color=\"text.secondary\" variant=\"caption\">\n {copy.credit_limit_not_shared}\n </Text>\n </Stack>\n )}\n </Stack>\n </Stack>\n <Stack sx={{ gap: 12, mt: 24, pl: 52 }}>\n <Stack\n sx={{\n alignItems: 'center',\n borderBottom: '1px solid',\n borderColor: 'divider',\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 10,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <Box sx={{ bgcolor: color, borderRadius: '1px', flexShrink: 0, height: 8, width: 8 }} />\n <Text variant=\"caption\">{copy.credit_utilized}</Text>\n </Stack>\n <Stack sx={{ flexDirection: 'row', fontVariantNumeric: 'tabular-nums', gap: 4 }}>\n <Text bold={true} variant=\"caption\">\n {formatMoney(card.amount)}\n </Text>\n {hasLimit && (\n <>\n <Text variant=\"caption\">/</Text>\n <Text variant=\"caption\">{formatMoney(limit)}</Text>\n </>\n )}\n </Stack>\n </Stack>\n {hasLimit && (\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text variant=\"caption\">{copy.credit_utilization_ratio}</Text>\n <Text bold={true} variant=\"caption\">\n {percentage}%\n </Text>\n </Stack>\n )}\n </Stack>\n </Box>\n )\n}\n\n/** `data_series` makes no uniqueness promise for `guid`, so a repeat gets a numbered key. */\nconst keyedCards = (cards: CreditUtilizationCard[]) => {\n const seen = new Map<string, number>()\n\n return cards.map((card) => {\n const count = (seen.get(card.guid) ?? 0) + 1\n\n seen.set(card.guid, count)\n\n return { card, key: count === 1 ? card.guid : `${card.guid}-${count}` }\n })\n}\n\n/** Presentational body of the Credit Utilization drawer, minus the drawer header. */\nconst CreditUtilizationContent = ({\n cards,\n copy,\n descriptionHtml,\n summary,\n title,\n}: CreditUtilizationContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', gap: 8, pb: 24 }}>\n {(title || summary || descriptionHtml) && (\n <Section>\n {title && <SectionHeading>{title}</SectionHeading>}\n {summary && <Summary copy={copy} summary={summary} />}\n {descriptionHtml && (\n <Text\n component=\"p\"\n dangerouslySetInnerHTML={{ __html: sanitizeHtml(descriptionHtml) }}\n sx={{ mt: 16 }}\n variant=\"body2\"\n />\n )}\n </Section>\n )}\n <Legend copy={copy} />\n {cards.length > 0 && (\n <Section>\n <SectionHeading>{copy.per_card_header}</SectionHeading>\n <Stack component=\"ul\" role=\"list\" sx={{ gap: 16, listStyle: 'none', m: 0, p: 0 }}>\n {keyedCards(cards).map(({ card, key }) => (\n <CardUtilization card={card} copy={copy} key={key} />\n ))}\n </Stack>\n </Section>\n )}\n </Stack>\n)\n\nexport default CreditUtilizationContent\n"],"mappings":";;;;;;;;;;;AAiCA,IAAM,IAAA,CAAe,MAAmB,EAAe,GAAQ,EAAgB,KAAK,GAE9E,IAAA,CAAW,EAAE,UAAA,EAAA,MACjB,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,SAAS;AAAA,IAAoB,GAAG;AAAA,EAAG;AAAA,EAAI,UAAA;AAAgB,CAAA,GAGhE,IAAA,CAAkB,EAAE,UAAA,GAAU,IAAA,IAAK,GAAA,MACvC,gBAAA,EAAC,GAAD;AAAA,EAAM,MAAM;AAAA,EAAM,WAAU;AAAA,EAAK,IAAI,EAAE,IAAA,EAAG;AAAA,EAAG,SAAQ;AAAA,EAClD,UAAA;AACG,CAAA,GAGF,IAAA,CAAW,EACf,MAAA,GACA,SAAS,EAAE,SAAA,GAAS,OAAA,GAAO,YAAA,EAAA,EAAA,MAIvB;AACJ,QAAM,IAAQ,EAAS,GACjB,IAAQ,EACZ,EAAK,4BACL,EAAY,CAAO,GACnB,EAAY,CAAK,GACjB,OAAO,CAAU,CACnB;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,cAAY;AAAA,IAAO,MAAK;AAAA,IAC3B,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,aAAa,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