@mx-cartographer/experiences 9.7.129 → 9.7.131
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 +8 -0
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +44 -43
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +38 -38
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +13 -12
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +46 -45
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js +23 -22
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -25
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.d.ts +0 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.es.js +6 -6
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +74 -104
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +14 -0
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +58 -11
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js +11 -13
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +19 -18
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +14 -13
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +10 -9
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +0 -3
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +30 -33
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +31 -30
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +6 -6
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js +22 -28
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +11 -10
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +5 -5
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +5 -0
- package/dist/insights-v2/blocks/slotReaders.es.js +7 -5
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
- package/dist/insights-v2/components/celebrationGradients.d.ts +15 -1
- package/dist/insights-v2/components/celebrationGradients.es.js +16 -7
- package/dist/insights-v2/components/celebrationGradients.es.js.map +1 -1
- package/dist/insights-v2/components/shared/elevation.d.ts +2 -0
- package/dist/insights-v2/components/shared/elevation.es.js +3 -2
- package/dist/insights-v2/components/shared/elevation.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { BEAT_ACTIVE_AT_KEY as m } from "../../../core/stores/InsightsV2Store.es.js";
|
|
2
|
-
import { resolveVariantConfig as
|
|
2
|
+
import { resolveVariantConfig as c } from "../../blocks/resolveVariantConfig.es.js";
|
|
3
|
+
import { asNonEmptyText as n, asNumber as u } from "../../blocks/slotReaders.es.js";
|
|
3
4
|
import { endOfMonth as o } from "date-fns/endOfMonth";
|
|
4
|
-
import { startOfMonth as
|
|
5
|
+
import { startOfMonth as s } from "date-fns/startOfMonth";
|
|
5
6
|
import { differenceInCalendarDays as v } from "date-fns/differenceInCalendarDays";
|
|
6
7
|
var l = {
|
|
7
8
|
LOW: "success.light",
|
|
8
9
|
MEDIUM: "warning.light",
|
|
9
10
|
HIGH: "warning.main",
|
|
10
11
|
OFF_TRACK: "error.main"
|
|
11
|
-
}, T = "success.main",
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
},
|
|
17
|
-
const
|
|
12
|
+
}, T = "success.main", N = (e, t) => Math.ceil((t ? e / t : 0) * 100), L = (e) => {
|
|
13
|
+
if (e > 100) return "OFF_TRACK";
|
|
14
|
+
if (e >= 75) return "HIGH";
|
|
15
|
+
if (e >= 50) return "MEDIUM";
|
|
16
|
+
if (e >= 25) return "LOW";
|
|
17
|
+
}, M = (e) => e ? l[e] : T, E = (e) => {
|
|
18
|
+
const t = e.insights_payload, r = t?.instance_slot?.data ?? t?.instance_slot_data ?? {};
|
|
18
19
|
return {
|
|
19
|
-
categoryGuid:
|
|
20
|
-
merchantGuid:
|
|
21
|
-
spent:
|
|
22
|
-
budgeted:
|
|
20
|
+
categoryGuid: n(r.category_guid) ?? t?.primary_category_guid ?? e.primary_category_guid ?? void 0,
|
|
21
|
+
merchantGuid: n(r.merchant_guid) ?? t?.primary_merchant_guid ?? e.primary_merchant_guid ?? void 0,
|
|
22
|
+
spent: u(r.spent_amount),
|
|
23
|
+
budgeted: u(r.budgeted_amount)
|
|
23
24
|
};
|
|
24
|
-
}, i = (
|
|
25
|
-
const { categoryGuid: r } = E(
|
|
26
|
-
return (r ?
|
|
25
|
+
}, i = (e, t) => {
|
|
26
|
+
const { categoryGuid: r } = E(e);
|
|
27
|
+
return (r ? t.categories?.default_categories?.[r] : void 0)?.replace(/&/g, "&");
|
|
27
28
|
}, a = {
|
|
28
29
|
CATEGORY_SPEND: "category_spend",
|
|
29
30
|
CATEGORY_BUDGET: "category_budget",
|
|
@@ -32,52 +33,52 @@ var l = {
|
|
|
32
33
|
default: i,
|
|
33
34
|
[a.CATEGORY_SPEND]: i,
|
|
34
35
|
[a.CATEGORY_BUDGET]: i
|
|
35
|
-
},
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
return Number.isNaN(
|
|
39
|
-
},
|
|
40
|
-
const _ =
|
|
41
|
-
if (!(o(_) <
|
|
42
|
-
return v(o(
|
|
43
|
-
},
|
|
44
|
-
const r =
|
|
36
|
+
}, U = (e, t, r) => c(f, e, "default", "BudgetDetailsBlock")(t, r), d = (e) => {
|
|
37
|
+
if (e == null || e === "") return;
|
|
38
|
+
const t = new Date(typeof e == "number" ? e * 1e3 : e);
|
|
39
|
+
return Number.isNaN(t.getTime()) ? void 0 : t;
|
|
40
|
+
}, A = (e) => e.active_at ?? e.insights_payload?.active_at, b = (e, t) => e.beatContext[t.guid]?.[m], g = (e, t, r = /* @__PURE__ */ new Date()) => d(t) ?? d(A(e)) ?? r, I = (e, t = /* @__PURE__ */ new Date(), r) => {
|
|
41
|
+
const _ = g(e, r, t);
|
|
42
|
+
if (!(o(_) < s(t)))
|
|
43
|
+
return v(o(t), t) + 1;
|
|
44
|
+
}, P = (e, t) => {
|
|
45
|
+
const r = g(e, t);
|
|
45
46
|
return {
|
|
46
|
-
start:
|
|
47
|
+
start: s(r),
|
|
47
48
|
end: o(r)
|
|
48
49
|
};
|
|
49
|
-
},
|
|
50
|
-
const r =
|
|
50
|
+
}, h = (e) => (t) => t.category_guid === e || t.top_level_category_guid === e, y = (e) => (t) => t.merchant_guid === e, F = (e, t) => {
|
|
51
|
+
const r = e.categoryGuid ? h(e.categoryGuid) : e.merchantGuid ? y(e.merchantGuid) : void 0;
|
|
51
52
|
return r && {
|
|
52
53
|
custom: r,
|
|
53
|
-
dateRange:
|
|
54
|
+
dateRange: t
|
|
54
55
|
};
|
|
55
56
|
}, D = {
|
|
56
57
|
default: { showPeriodLine: !0 },
|
|
57
58
|
[a.CATEGORY_SPEND]: { showPeriodLine: !1 },
|
|
58
59
|
[a.CATEGORY_BUDGET]: { showPeriodLine: !1 },
|
|
59
60
|
[a.MERCHANT_BUDGET]: { showPeriodLine: !1 }
|
|
60
|
-
},
|
|
61
|
-
const
|
|
62
|
-
return
|
|
61
|
+
}, S = (e) => c(D, e, "default", "BudgetDetailsBlock"), Y = (e) => {
|
|
62
|
+
const t = Number(e);
|
|
63
|
+
return e.trim() !== "" && Number.isFinite(t) && t > 0;
|
|
63
64
|
};
|
|
64
65
|
export {
|
|
65
66
|
l as BUDGET_TIER_COLORS,
|
|
66
67
|
T as DEFAULT_TIER_COLOR,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
d as activeAtDate,
|
|
69
|
+
A as beatActiveAt,
|
|
70
|
+
g as budgetMonthOf,
|
|
71
|
+
P as budgetMonthRange,
|
|
71
72
|
F as budgetTransactionFilter,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
N as calculateBudgetPercent,
|
|
74
|
+
L as calculateBudgetTier,
|
|
75
|
+
I as daysLeftInBudgetMonth,
|
|
76
|
+
Y as isPositiveAmount,
|
|
77
|
+
b as recordedActiveAtOf,
|
|
78
|
+
S as resolveBudgetDetailsLayout,
|
|
78
79
|
E as resolveBudgetFacts,
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
U as resolveBudgetSubject,
|
|
81
|
+
M as tierColor
|
|
81
82
|
};
|
|
82
83
|
|
|
83
84
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat, GlobalCopy, Transaction } from '../../../core'\nimport { BEAT_ACTIVE_AT_KEY, type InsightsV2Store } from '../../../core/stores/InsightsV2Store'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat, GlobalCopy, Transaction } from '../../../core'\nimport { BEAT_ACTIVE_AT_KEY, type InsightsV2Store } from '../../../core/stores/InsightsV2Store'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\nexport const resolveBudgetFacts = (beat: Beat): BudgetFacts => {\n const payload = beat.insights_payload\n const data = (payload?.instance_slot?.data ?? payload?.instance_slot_data ?? {}) as Record<\n string,\n unknown\n >\n\n return {\n categoryGuid:\n asNonEmptyText(data.category_guid) ??\n payload?.primary_category_guid ??\n beat.primary_category_guid ??\n undefined,\n merchantGuid:\n asNonEmptyText(data.merchant_guid) ??\n payload?.primary_merchant_guid ??\n beat.primary_merchant_guid ??\n undefined,\n spent: asNumber(data.spent_amount),\n budgeted: asNumber(data.budgeted_amount),\n }\n}\n\ntype BudgetSubject = (beat: Beat, copy: GlobalCopy) => string | undefined\n\nconst categoryName: BudgetSubject = (beat, copy) => {\n const { categoryGuid } = resolveBudgetFacts(beat)\n const name = categoryGuid ? copy.categories?.default_categories?.[categoryGuid] : undefined\n\n return name?.replace(/&/g, '&')\n}\n\n/** The CTA variants `budget_details_block` serves (ditto names one on each beat's CTA). */\nconst BUDGET_DETAILS_VARIANTS = {\n CATEGORY_SPEND: 'category_spend',\n CATEGORY_BUDGET: 'category_budget',\n MERCHANT_BUDGET: 'merchant_budget',\n} as const\n\n// The drawer's \"{subject} Budget\" title, keyed by the CTA variant; the card's subtitle never names it.\nconst BUDGET_SUBJECT: Record<string, BudgetSubject> = {\n default: categoryName,\n [BUDGET_DETAILS_VARIANTS.CATEGORY_SPEND]: categoryName,\n [BUDGET_DETAILS_VARIANTS.CATEGORY_BUDGET]: categoryName,\n // merchant_budget: the merchant name, when Merchant Budget moves to Insights 2.0.\n}\n\nexport const resolveBudgetSubject = (\n variant: string | null | undefined,\n beat: Beat,\n copy: GlobalCopy,\n): string | undefined =>\n resolveVariantConfig(BUDGET_SUBJECT, variant, 'default', 'BudgetDetailsBlock')(beat, copy)\n\ntype ActiveAt = Beat['active_at'] | number | null | undefined\n\n/** A beat's `active_at` (epoch seconds or ISO) as a date; undefined when absent or invalid. */\nexport const activeAtDate = (raw: ActiveAt): Date | undefined => {\n if (raw == null || raw === '') return undefined\n const at = new Date(typeof raw === 'number' ? raw * 1000 : raw)\n\n return Number.isNaN(at.getTime()) ? undefined : at\n}\n\n/** The beat's own `active_at`: on the beat, else on its envelope. */\nexport const beatActiveAt = (beat: Beat): ActiveAt =>\n beat.active_at ?? beat.insights_payload?.active_at\n\n/** The `active_at` the card recorded on render; a sampled beat is re-read without it after a CTA. */\nexport const recordedActiveAtOf = (\n store: Pick<InsightsV2Store, 'beatContext'>,\n beat: Beat,\n): ActiveAt => store.beatContext[beat.guid]?.[BEAT_ACTIVE_AT_KEY] as ActiveAt\n\n/** The budget month's anchor: the recorded `active_at`, else the beat's, else now. */\nexport const budgetMonthOf = (beat: Beat, recordedActiveAt?: ActiveAt, now = new Date()) =>\n activeAtDate(recordedActiveAt) ?? activeAtDate(beatActiveAt(beat)) ?? now\n\nexport const daysLeftInBudgetMonth = (\n beat: Beat,\n now = new Date(),\n recordedActiveAt?: ActiveAt,\n) => {\n const activeAt = budgetMonthOf(beat, recordedActiveAt, now)\n if (endOfMonth(activeAt) < startOfMonth(now)) return undefined\n\n return differenceInCalendarDays(endOfMonth(now), now) + 1\n}\n\n/** The month a budget drawer shows (see budgetMonthOf). */\nexport const budgetMonthRange = (beat: Beat, recordedActiveAt?: ActiveAt) => {\n const month = budgetMonthOf(beat, recordedActiveAt)\n\n return { start: startOfMonth(month), end: endOfMonth(month) }\n}\n\nconst inCategory = (categoryGuid: string) => (transaction: Transaction) =>\n transaction.category_guid === categoryGuid || transaction.top_level_category_guid === categoryGuid\n\nconst atMerchant = (merchantGuid: string) => (transaction: Transaction) =>\n transaction.merchant_guid === merchantGuid\n\n/** The budget month and category (own or top-level) or merchant; none without either, so no rows. */\nexport const budgetTransactionFilter = (\n facts: BudgetFacts,\n dateRange: { start: Date; end: Date },\n): TransactionFilter | undefined => {\n const custom = facts.categoryGuid\n ? inCategory(facts.categoryGuid)\n : facts.merchantGuid\n ? atMerchant(facts.merchantGuid)\n : undefined\n\n return custom && { custom, dateRange }\n}\n\nexport interface BudgetDetailsLayout {\n /** The \"N days until the end of the month\" / previous-month notice under the summary. */\n showPeriodLine: boolean\n}\n\n// Figma's Budget Details for these three insights has no period line; any other caller keeps it.\nconst LAYOUT: Record<string, BudgetDetailsLayout> = {\n default: { showPeriodLine: true },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_SPEND]: { showPeriodLine: false },\n [BUDGET_DETAILS_VARIANTS.CATEGORY_BUDGET]: { showPeriodLine: false },\n [BUDGET_DETAILS_VARIANTS.MERCHANT_BUDGET]: { showPeriodLine: false },\n}\n\nexport const resolveBudgetDetailsLayout = (variant: string | null | undefined) =>\n resolveVariantConfig(LAYOUT, variant, 'default', 'BudgetDetailsBlock')\n\n/** A budget amount the dialogs accept: a finite number above zero. */\nexport const isPositiveAmount = (value: string): boolean => {\n const amount = Number(value)\n return value.trim() !== '' && Number.isFinite(amount) && amount > 0\n}\n"],"mappings":";;;;;;AAYA,IAAa,IAAiD;AAAA,EAC5D,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AACb,GAEa,IAAqB,gBAErB,IAAA,CAA0B,GAAe,MACpD,KAAK,MAAM,IAAQ,IAAQ,IAAQ,KAAK,GAAG,GAEhC,IAAA,CAAuB,MAA4C;AAC9E,MAAI,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AS,CAAM,KAAK,IAAS;AACpE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { asNumber as r } from "../../blocks/slotReaders.es.js";
|
|
1
2
|
var l = {
|
|
2
3
|
band: "needs_work",
|
|
3
4
|
range: ">30%",
|
|
@@ -23,44 +24,44 @@ var l = {
|
|
|
23
24
|
color: (t) => t.palette.warning.light
|
|
24
25
|
},
|
|
25
26
|
l
|
|
26
|
-
], c = (t) => Math.min(100, Math.max(0, Math.round(t))),
|
|
27
|
-
const
|
|
28
|
-
if (!(
|
|
27
|
+
], c = (t) => Math.min(100, Math.max(0, Math.round(t))), p = (t) => g.find(({ maxPercent: e }) => c(t) <= e) ?? l, b = (t) => {
|
|
28
|
+
const e = r(t?.accounts_balance_sum), n = r(t?.accounts_credit_limit_sum), a = r(t?.credit_utilization_percentage);
|
|
29
|
+
if (!(e === void 0 || n === void 0 || a === void 0))
|
|
29
30
|
return {
|
|
30
|
-
balance:
|
|
31
|
+
balance: e,
|
|
31
32
|
limit: n,
|
|
32
|
-
percentage: c(
|
|
33
|
+
percentage: c(a)
|
|
33
34
|
};
|
|
34
|
-
},
|
|
35
|
+
}, f = (t) => {
|
|
35
36
|
if (!t || Array.isArray(t) || !t.names || !Array.isArray(t.data)) return [];
|
|
36
|
-
const { names:
|
|
37
|
+
const { names: e } = t;
|
|
37
38
|
return t.data.flatMap((n) => {
|
|
38
|
-
const
|
|
39
|
-
if (typeof
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
amount:
|
|
43
|
-
guid:
|
|
44
|
-
label:
|
|
39
|
+
const a = Object.fromEntries(e.map((m, d) => [m, n[d]]));
|
|
40
|
+
if (typeof a.guid != "string" || typeof a.label != "string") return [];
|
|
41
|
+
const i = r(a.amount) ?? 0, o = r(a.total_amount);
|
|
42
|
+
if (o === void 0 || o <= 0) return [{
|
|
43
|
+
amount: i,
|
|
44
|
+
guid: a.guid,
|
|
45
|
+
label: a.label,
|
|
45
46
|
limit: null,
|
|
46
47
|
percentage: null
|
|
47
48
|
}];
|
|
48
|
-
const u = r(
|
|
49
|
+
const u = r(a.percentage) ?? i / o * 100;
|
|
49
50
|
return [{
|
|
50
|
-
amount:
|
|
51
|
-
guid:
|
|
52
|
-
label:
|
|
53
|
-
limit:
|
|
51
|
+
amount: i,
|
|
52
|
+
guid: a.guid,
|
|
53
|
+
label: a.label,
|
|
54
|
+
limit: o,
|
|
54
55
|
percentage: c(u)
|
|
55
56
|
}];
|
|
56
57
|
});
|
|
57
58
|
};
|
|
58
59
|
export {
|
|
59
60
|
g as UTILIZATION_BANDS,
|
|
60
|
-
|
|
61
|
+
p as getUtilizationBand,
|
|
61
62
|
c as normalizePercent,
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
f as readCardRows,
|
|
64
|
+
b as readSummary
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport type { DataSeries } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\n\nexport type UtilizationBand = 'excellent' | 'good' | 'fair' | 'needs_work'\n\nexport interface UtilizationBandSpec {\n band: UtilizationBand\n range: string\n /** Highest whole percentage in the band. */\n maxPercent: number\n color: (theme: Theme) => string\n}\n\nconst NEEDS_WORK: UtilizationBandSpec = {\n band: 'needs_work',\n range: '>30%',\n maxPercent: Infinity,\n color: (theme) => theme.palette.error.light,\n}\n\n/** Ordered from best to worst, as the legend shows them. */\nexport const UTILIZATION_BANDS: UtilizationBandSpec[] = [\n {\n band: 'excellent',\n range: '0-10%',\n maxPercent: 10,\n color: (theme) => theme.palette.success.main,\n },\n { band: 'good', range: '11-20%', maxPercent: 20, color: (theme) => theme.palette.success.light },\n { band: 'fair', range: '21-30%', maxPercent: 30, color: (theme) => theme.palette.warning.light },\n NEEDS_WORK,\n]\n\n/** Whole percent within 0-100, the only form the drawer shows, bands or announces. */\nexport const normalizePercent = (percent: number): number =>\n Math.min(100, Math.max(0, Math.round(percent)))\n\nexport const getUtilizationBand = (percent: number): UtilizationBandSpec =>\n UTILIZATION_BANDS.find(({ maxPercent }) => normalizePercent(percent) <= maxPercent) ?? NEEDS_WORK\n\nexport interface CreditUtilizationSummary {\n balance: number\n limit: number\n percentage: number\n}\n\nexport interface CreditCardRow {\n guid: string\n label: string\n amount: number\n /** `null` when the institution did not share the card's limit. */\n limit: number | null\n percentage: number | null\n}\n\
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport type { DataSeries } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport { asNumber } from '../../blocks/slotReaders'\n\nexport type UtilizationBand = 'excellent' | 'good' | 'fair' | 'needs_work'\n\nexport interface UtilizationBandSpec {\n band: UtilizationBand\n range: string\n /** Highest whole percentage in the band. */\n maxPercent: number\n color: (theme: Theme) => string\n}\n\nconst NEEDS_WORK: UtilizationBandSpec = {\n band: 'needs_work',\n range: '>30%',\n maxPercent: Infinity,\n color: (theme) => theme.palette.error.light,\n}\n\n/** Ordered from best to worst, as the legend shows them. */\nexport const UTILIZATION_BANDS: UtilizationBandSpec[] = [\n {\n band: 'excellent',\n range: '0-10%',\n maxPercent: 10,\n color: (theme) => theme.palette.success.main,\n },\n { band: 'good', range: '11-20%', maxPercent: 20, color: (theme) => theme.palette.success.light },\n { band: 'fair', range: '21-30%', maxPercent: 30, color: (theme) => theme.palette.warning.light },\n NEEDS_WORK,\n]\n\n/** Whole percent within 0-100, the only form the drawer shows, bands or announces. */\nexport const normalizePercent = (percent: number): number =>\n Math.min(100, Math.max(0, Math.round(percent)))\n\nexport const getUtilizationBand = (percent: number): UtilizationBandSpec =>\n UTILIZATION_BANDS.find(({ maxPercent }) => normalizePercent(percent) <= maxPercent) ?? NEEDS_WORK\n\nexport interface CreditUtilizationSummary {\n balance: number\n limit: number\n percentage: number\n}\n\nexport interface CreditCardRow {\n guid: string\n label: string\n amount: number\n /** `null` when the institution did not share the card's limit. */\n limit: number | null\n percentage: number | null\n}\n\nexport const readSummary = (\n data?: InsightsInstanceSlotData,\n): CreditUtilizationSummary | undefined => {\n const balance = asNumber(data?.accounts_balance_sum)\n const limit = asNumber(data?.accounts_credit_limit_sum)\n const percentage = asNumber(data?.credit_utilization_percentage)\n\n if (balance === undefined || limit === undefined || percentage === undefined) return undefined\n\n return { balance, limit, percentage: normalizePercent(percentage) }\n}\n\n/** One object per `data` row, keyed by `names` (pulse's `buildDataSeries`). */\nexport const readCardRows = (series?: DataSeries | unknown[]): CreditCardRow[] => {\n if (!series || Array.isArray(series) || !series.names || !Array.isArray(series.data)) return []\n\n const { names } = series\n\n return series.data.flatMap((values: unknown[]): CreditCardRow[] => {\n const row = Object.fromEntries(names.map((name, index) => [name, values[index]]))\n\n if (typeof row.guid !== 'string' || typeof row.label !== 'string') return []\n\n const amount = asNumber(row.amount) ?? 0\n const limit = asNumber(row.total_amount)\n\n if (limit === undefined || limit <= 0) {\n return [{ amount, guid: row.guid, label: row.label, limit: null, percentage: null }]\n }\n\n const percentage = asNumber(row.percentage) ?? (amount / limit) * 100\n\n return [\n { amount, guid: row.guid, label: row.label, limit, percentage: normalizePercent(percentage) },\n ]\n })\n}\n"],"mappings":";AAgBA,IAAM,IAAkC;AAAA,EACtC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAA,CAAQ,MAAU,EAAM,QAAQ,MAAM;AACxC,GAGa,IAA2C;AAAA,EACtD;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,OAAA,CAAQ,MAAU,EAAM,QAAQ,QAAQ;AAAA,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AY;AAEvC,QAAI,MAAU,UAAa,KAAS,EAClC,QAAO,CAAC;AAAA,MAAE,QAAA;AAAA,MAAQ,MAAM,EAAI;AAAA,MAAM,OAAO,EAAI;AAAA,MAAO,OAAO;AAAA,MAAM,YAAY;AAAA,IAAK,CAAC;AAGrF,UAAM,IAAa,EAAS,EAAI,UAAU,KAAM,IAAS,IAAS;AAElE,WAAO,CACL;AAAA,MAAE,QAAA;AAAA,MAAQ,MAAM,EAAI;AAAA,MAAM,OAAO,EAAI;AAAA,MAAO,OAAA;AAAA,MAAO,YAAY,EAAiB,CAAU;AAAA,IAAE,CAC9F;AAAA,EACF,CAAC;AACH"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { useGlobalCopyStore as
|
|
3
|
-
import { formatCurrency as
|
|
1
|
+
import { buildDynamicCopy as f } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useGlobalCopyStore as x } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { formatCurrency as s } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { asNumber as v } from "../../blocks/slotReaders.es.js";
|
|
4
5
|
import { variants as _ } from "../../blocks/ChartBlocks/StepChartBlock/index.es.js";
|
|
5
|
-
import { stepForBalance as
|
|
6
|
-
import { SavingsCalculator as
|
|
6
|
+
import { stepForBalance as h } from "./layout.es.js";
|
|
7
|
+
import { SavingsCalculator as y } from "./SavingsCalculator.es.js";
|
|
7
8
|
import { observer as C } from "mobx-react-lite";
|
|
8
9
|
import e from "@mui/material/Stack";
|
|
9
|
-
import { Text as
|
|
10
|
+
import { Text as c } from "@mxenabled/mxui";
|
|
10
11
|
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
11
|
-
var
|
|
12
|
+
var p = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
12
13
|
"aria-label": i,
|
|
13
14
|
role: "group",
|
|
14
15
|
sx: {
|
|
@@ -19,23 +20,23 @@ var m = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
|
19
20
|
gap: 4,
|
|
20
21
|
p: 12
|
|
21
22
|
},
|
|
22
|
-
children: [/* @__PURE__ */ o(
|
|
23
|
+
children: [/* @__PURE__ */ o(c, {
|
|
23
24
|
color: "text.secondary",
|
|
24
25
|
variant: "caption",
|
|
25
26
|
children: i
|
|
26
|
-
}), /* @__PURE__ */ o(
|
|
27
|
+
}), /* @__PURE__ */ o(c, {
|
|
27
28
|
bold: !0,
|
|
28
29
|
component: "p",
|
|
29
30
|
variant: "h3",
|
|
30
31
|
children: a
|
|
31
32
|
})]
|
|
32
|
-
}),
|
|
33
|
-
const { common:
|
|
33
|
+
}), G = C(function({ beat: a }) {
|
|
34
|
+
const { common: m, insights_feed: d } = x(), r = d?.emergency_savings;
|
|
34
35
|
if (!r) return /* @__PURE__ */ o(e, {
|
|
35
36
|
sx: { p: 24 },
|
|
36
|
-
children: /* @__PURE__ */ o(
|
|
37
|
+
children: /* @__PURE__ */ o(c, { children: m?.error_message })
|
|
37
38
|
});
|
|
38
|
-
const t = a.insights_payload?.drilldown_data?.savings_account_balance
|
|
39
|
+
const t = v(a.insights_payload?.drilldown_data?.savings_account_balance) ?? 0, { goal: l, index: g, labelKey: u } = h(t), { WithText: b } = _;
|
|
39
40
|
return /* @__PURE__ */ n(e, {
|
|
40
41
|
sx: {
|
|
41
42
|
bgcolor: "background.default",
|
|
@@ -49,32 +50,32 @@ var m = ({ label: i, value: a }) => /* @__PURE__ */ n(e, {
|
|
|
49
50
|
gap: 16,
|
|
50
51
|
p: 16
|
|
51
52
|
},
|
|
52
|
-
children: [/* @__PURE__ */ o(
|
|
53
|
-
completed_steps:
|
|
54
|
-
label_1: r[
|
|
55
|
-
label_2:
|
|
53
|
+
children: [/* @__PURE__ */ o(b, { slotData: {
|
|
54
|
+
completed_steps: g,
|
|
55
|
+
label_1: r[u].toUpperCase(),
|
|
56
|
+
label_2: f(r.amount_in_savings, s(l, "0"))
|
|
56
57
|
} }), /* @__PURE__ */ n(e, {
|
|
57
58
|
sx: {
|
|
58
59
|
flexDirection: "row",
|
|
59
60
|
gap: 12
|
|
60
61
|
},
|
|
61
|
-
children: [/* @__PURE__ */ o(
|
|
62
|
+
children: [/* @__PURE__ */ o(p, {
|
|
62
63
|
label: r.total_savings_balance,
|
|
63
|
-
value:
|
|
64
|
-
}), /* @__PURE__ */ o(
|
|
64
|
+
value: s(t, "0,0.00")
|
|
65
|
+
}), /* @__PURE__ */ o(p, {
|
|
65
66
|
label: r.savings_goal,
|
|
66
|
-
value:
|
|
67
|
+
value: s(l, "0,0")
|
|
67
68
|
})]
|
|
68
69
|
})]
|
|
69
|
-
}), /* @__PURE__ */ o(
|
|
70
|
-
balance:
|
|
70
|
+
}), /* @__PURE__ */ o(y, {
|
|
71
|
+
balance: t,
|
|
71
72
|
copy: r,
|
|
72
|
-
goal:
|
|
73
|
+
goal: l
|
|
73
74
|
}, a.guid)]
|
|
74
75
|
});
|
|
75
76
|
});
|
|
76
77
|
export {
|
|
77
|
-
|
|
78
|
+
G as EmergencySavingsBlock
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
//# sourceMappingURL=EmergencySavingsBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmergencySavingsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore } from '../../../common'\nimport { buildDynamicCopy } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { variants as stepChartVariants } from '../../blocks/ChartBlocks/StepChartBlock'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { SavingsCalculator } from './SavingsCalculator'\nimport { stepForBalance } from './layout'\n\nconst AmountBox = ({ label, value }: { label: string; value: string }) => (\n <Stack\n aria-label={label}\n role=\"group\"\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n flex: 1,\n gap: 4,\n p: 12,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h3\">\n {value}\n </Text>\n </Stack>\n)\n\nexport const EmergencySavingsBlock = observer(function EmergencySavingsBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const copy = insightsFeedCopy?.emergency_savings\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n const
|
|
1
|
+
{"version":3,"file":"EmergencySavingsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore } from '../../../common'\nimport { buildDynamicCopy } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { variants as stepChartVariants } from '../../blocks/ChartBlocks/StepChartBlock'\nimport { asNumber } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { SavingsCalculator } from './SavingsCalculator'\nimport { stepForBalance } from './layout'\n\nconst AmountBox = ({ label, value }: { label: string; value: string }) => (\n <Stack\n aria-label={label}\n role=\"group\"\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n flex: 1,\n gap: 4,\n p: 12,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} component=\"p\" variant=\"h3\">\n {value}\n </Text>\n </Stack>\n)\n\nexport const EmergencySavingsBlock = observer(function EmergencySavingsBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const copy = insightsFeedCopy?.emergency_savings\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n const balance = asNumber(beat.insights_payload?.drilldown_data?.savings_account_balance) ?? 0\n const { goal, index, labelKey } = stepForBalance(balance)\n const { WithText: Stepper } = stepChartVariants\n\n return (\n <Stack sx={{ bgcolor: 'background.default', gap: 24, p: 24 }}>\n <Stack sx={{ bgcolor: 'background.paper', borderRadius: '8px', gap: 16, p: 16 }}>\n <Stepper\n slotData={{\n completed_steps: index,\n label_1: copy[labelKey].toUpperCase(),\n label_2: buildDynamicCopy(copy.amount_in_savings, formatCurrency(goal, '0')) as string,\n }}\n />\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n <AmountBox label={copy.total_savings_balance} value={formatCurrency(balance, '0,0.00')} />\n <AmountBox label={copy.savings_goal} value={formatCurrency(goal, '0,0')} />\n </Stack>\n </Stack>\n <SavingsCalculator balance={balance} copy={copy} goal={goal} key={beat.guid} />\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;AAeA,IAAM,IAAA,CAAa,EAAE,OAAA,GAAO,OAAA,EAAA,MAC1B,gBAAA,EAAC,GAAD;AAAA,EACE,cAAY;AAAA,EACZ,MAAK;AAAA,EACL,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,cAAc;AAAA,IACd,MAAM;AAAA,IACN,KAAK;AAAA,IACL,GAAG;AAAA,EACL;AAAA,EAVF,UAAA,CAYE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,SAAQ;AAAA,IAClC,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,WAAU;AAAA,IAAI,SAAQ;AAAA,IACrC,UAAA;AAAA,EACG,CAAA,CACD;IAGI,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACm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,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAA4B,SAAA;AAAA,MAAe,MAAA;AAAA,MAAY,MAAA;AAAA,IAAuB,GAAZ,EAAK,IAAO,CACzE;AAAA;AAEX,CAAC"}
|
|
@@ -3,7 +3,6 @@ export interface HelpContent {
|
|
|
3
3
|
title: string;
|
|
4
4
|
html: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const toText: (value: unknown) => string | undefined;
|
|
7
6
|
/**
|
|
8
7
|
* A beat's "How was this calculated?" content: pre-localized `help_title` and `help_html` on the
|
|
9
8
|
* payload's `drilldown_data`, shared by every CTA of the card. Absent either, there is nothing to
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { asNonEmptyText as p } from "../../blocks/slotReaders.es.js";
|
|
2
|
+
var l = (t) => {
|
|
3
|
+
const e = p(t?.help_title), o = p(t?.help_html);
|
|
4
|
+
return e && o ? {
|
|
4
5
|
title: e,
|
|
5
|
-
html:
|
|
6
|
+
html: o
|
|
6
7
|
} : void 0;
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
-
o as toText
|
|
10
|
+
l as readHelp
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/HelpBlock/layout.ts"],"sourcesContent":["import type { DrilldownData } from '../../../core'\n\nexport interface HelpContent {\n title: string\n html: string\n}\n\
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/HelpBlock/layout.ts"],"sourcesContent":["import type { DrilldownData } from '../../../core'\nimport { asNonEmptyText } from '../../blocks/slotReaders'\n\nexport interface HelpContent {\n title: string\n html: string\n}\n\n/**\n * A beat's \"How was this calculated?\" content: pre-localized `help_title` and `help_html` on the\n * payload's `drilldown_data`, shared by every CTA of the card. Absent either, there is nothing to\n * open.\n */\nexport const readHelp = (drilldown: DrilldownData | undefined): HelpContent | undefined => {\n const title = asNonEmptyText(drilldown?.help_title)\n const html = asNonEmptyText(drilldown?.help_html)\n return title && html ? { title, html } : undefined\n}\n"],"mappings":";AAaA,IAAa,IAAA,CAAY,MAAkE;AACzF,QAAM,IAAQ,EAAe,GAAW,UAAU,GAC5C,IAAO,EAAe,GAAW,SAAS;AAChD,SAAO,KAAS,IAAO;AAAA,IAAE,OAAA;AAAA,IAAO,MAAA;AAAA,EAAK,IAAI;AAC3C"}
|