@mx-cartographer/experiences 9.7.31 → 9.7.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/core/constants/InstitutionLogo.d.ts +2 -0
  3. package/dist/core/constants/InstitutionLogo.es.js +6 -0
  4. package/dist/core/constants/InstitutionLogo.es.js.map +1 -0
  5. package/dist/core/constants/index.d.ts +1 -0
  6. package/dist/core/index.es.js +137 -135
  7. package/dist/core/types/InsightsInstanceSlotData.d.ts +6 -1
  8. package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
  9. package/dist/core/types/localization/InsightsFeedCopy.d.ts +20 -0
  10. package/dist/core/types/localization/index.d.ts +1 -1
  11. package/dist/core/utils/SanitizeHtml.d.ts +2 -0
  12. package/dist/core/utils/SanitizeHtml.es.js +44 -0
  13. package/dist/core/utils/SanitizeHtml.es.js.map +1 -0
  14. package/dist/core/utils/index.d.ts +1 -0
  15. package/dist/dashboard/WelcomeDialog.es.js +78 -115
  16. package/dist/dashboard/WelcomeDialog.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.d.ts +10 -0
  18. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +32 -0
  19. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -0
  20. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.d.ts +16 -0
  21. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +287 -0
  22. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -0
  23. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/index.d.ts +2 -0
  24. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.d.ts +32 -0
  25. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js +66 -0
  26. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js.map +1 -0
  27. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.d.ts +1 -0
  28. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js +13 -0
  29. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js.map +1 -0
  30. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +31 -30
  31. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  32. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +0 -6
  33. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +13 -14
  34. package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
  35. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.d.ts +1 -1
  36. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js +3 -3
  37. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js.map +1 -1
  38. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  39. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  40. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  41. package/dist/insights-v2/mappings/blocks.es.js +76 -69
  42. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  43. package/package.json +1 -1
@@ -0,0 +1,287 @@
1
+ import { buildDynamicCopy as v } from "../../../core/utils/Localization.es.js";
2
+ import { sanitizeHtml as f } from "../../../core/utils/SanitizeHtml.es.js";
3
+ import { DEFAULT_INSTITUTION_LOGO_URL as _ } from "../../../core/constants/InstitutionLogo.es.js";
4
+ import { formatCurrency as w } from "../../../core/utils/NumberFormatting.es.js";
5
+ import I from "../../blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js";
6
+ import { UTILIZATION_BANDS as b, getUtilizationBand as g } from "./layout.es.js";
7
+ import d from "@mui/material/Stack";
8
+ import { Icon as C, InstitutionLogo as D, Text as l } from "@mxenabled/mxui";
9
+ import { Fragment as S, jsx as e, jsxs as o } from "react/jsx-runtime";
10
+ import { useTheme as x } from "@mui/material/styles";
11
+ import m from "@mui/material/Box";
12
+ var h = (t) => w(t, "0,0.00"), u = ({ children: t }) => /* @__PURE__ */ e(d, {
13
+ sx: {
14
+ bgcolor: "background.paper",
15
+ p: 24
16
+ },
17
+ children: t
18
+ }), p = ({ children: t, mb: r = 16 }) => /* @__PURE__ */ e(l, {
19
+ bold: !0,
20
+ component: "h3",
21
+ sx: { mb: r },
22
+ variant: "body1",
23
+ children: t
24
+ }), z = ({ copy: t, summary: { balance: r, limit: n, percentage: i } }) => {
25
+ const a = x(), c = v(t.total_credit_utilized_aria, h(r), h(n), String(i));
26
+ return /* @__PURE__ */ e(m, {
27
+ "aria-label": c,
28
+ role: "img",
29
+ children: /* @__PURE__ */ e(I, {
30
+ centerValue: `${i}%`,
31
+ data: [{
32
+ color: g(i).color(a),
33
+ label: t.total_credit_utilized,
34
+ labelValue: `${h(r)} / ${h(n)}`,
35
+ value: i
36
+ }, {
37
+ color: a.palette.divider,
38
+ value: 100 - i
39
+ }]
40
+ })
41
+ });
42
+ }, y = ({ copy: t }) => {
43
+ const r = x(), n = b.length - 1;
44
+ return /* @__PURE__ */ o(u, { children: [
45
+ /* @__PURE__ */ e(p, {
46
+ mb: 24,
47
+ children: t.what_does_this_mean
48
+ }),
49
+ /* @__PURE__ */ e(d, {
50
+ "aria-label": t.what_does_this_mean,
51
+ component: "ul",
52
+ role: "list",
53
+ sx: {
54
+ flexDirection: "row",
55
+ gap: 2,
56
+ listStyle: "none",
57
+ m: 0,
58
+ mb: 24,
59
+ p: 0
60
+ },
61
+ children: b.map(({ band: i, color: a, range: c }, s) => /* @__PURE__ */ o(m, {
62
+ component: "li",
63
+ sx: {
64
+ flex: 1,
65
+ minWidth: 0,
66
+ overflowWrap: "anywhere"
67
+ },
68
+ children: [
69
+ /* @__PURE__ */ e(m, {
70
+ "aria-hidden": !0,
71
+ sx: {
72
+ bgcolor: a(r),
73
+ borderRadius: s === 0 ? "8px 0 0 8px" : s === n ? "0 8px 8px 0" : void 0,
74
+ height: 12,
75
+ mb: 8
76
+ }
77
+ }),
78
+ /* @__PURE__ */ e(l, {
79
+ bold: !0,
80
+ component: "p",
81
+ variant: "caption",
82
+ children: c
83
+ }),
84
+ /* @__PURE__ */ e(l, {
85
+ component: "p",
86
+ variant: "caption",
87
+ children: t[i]
88
+ })
89
+ ]
90
+ }, i))
91
+ }),
92
+ /* @__PURE__ */ e(l, {
93
+ component: "p",
94
+ variant: "body2",
95
+ children: t.ratio_explanation
96
+ }),
97
+ /* @__PURE__ */ e(l, {
98
+ component: "p",
99
+ sx: { mt: 16 },
100
+ variant: "body2",
101
+ children: t.recommendation
102
+ })
103
+ ] });
104
+ }, T = ({ card: t, copy: r }) => {
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
+ return /* @__PURE__ */ o(m, {
107
+ component: "li",
108
+ sx: {
109
+ border: "1px solid",
110
+ borderColor: "divider",
111
+ borderRadius: "8px",
112
+ p: 16
113
+ },
114
+ children: [/* @__PURE__ */ o(d, {
115
+ sx: {
116
+ alignItems: "center",
117
+ flexDirection: "row",
118
+ gap: 12
119
+ },
120
+ children: [/* @__PURE__ */ e(D, {
121
+ alt: "",
122
+ institutionGuid: t.institutionGuid,
123
+ logoUrl: t.institutionGuid ? void 0 : _,
124
+ size: 40
125
+ }), /* @__PURE__ */ o(d, {
126
+ sx: {
127
+ flexGrow: 1,
128
+ gap: 4,
129
+ minWidth: 0
130
+ },
131
+ children: [/* @__PURE__ */ e(l, {
132
+ bold: !0,
133
+ truncate: !0,
134
+ variant: "body2",
135
+ children: t.label
136
+ }), c ? /* @__PURE__ */ e(m, {
137
+ "aria-label": t.label,
138
+ "aria-valuemax": 100,
139
+ "aria-valuemin": 0,
140
+ "aria-valuenow": a,
141
+ "aria-valuetext": `${a}%`,
142
+ role: "meter",
143
+ sx: {
144
+ bgcolor: "neutral.light",
145
+ borderRadius: 999,
146
+ height: 8,
147
+ overflow: "hidden"
148
+ },
149
+ children: /* @__PURE__ */ e(m, { sx: {
150
+ bgcolor: s,
151
+ borderRadius: 999,
152
+ height: "100%",
153
+ width: `${a}%`
154
+ } })
155
+ }) : /* @__PURE__ */ o(d, {
156
+ sx: {
157
+ alignItems: "center",
158
+ flexDirection: "row",
159
+ gap: 4
160
+ },
161
+ children: [/* @__PURE__ */ e(C, {
162
+ name: "info",
163
+ size: 14,
164
+ sx: { color: "text.secondary" }
165
+ }), /* @__PURE__ */ e(l, {
166
+ color: "text.secondary",
167
+ variant: "caption",
168
+ children: r.credit_limit_not_shared
169
+ })]
170
+ })]
171
+ })]
172
+ }), /* @__PURE__ */ o(d, {
173
+ sx: {
174
+ gap: 12,
175
+ mt: 24,
176
+ pl: 52
177
+ },
178
+ children: [/* @__PURE__ */ o(d, {
179
+ sx: {
180
+ alignItems: "center",
181
+ borderBottom: "1px solid",
182
+ borderColor: "divider",
183
+ flexDirection: "row",
184
+ justifyContent: "space-between",
185
+ pb: 10
186
+ },
187
+ children: [/* @__PURE__ */ o(d, {
188
+ sx: {
189
+ alignItems: "center",
190
+ flexDirection: "row",
191
+ gap: 8
192
+ },
193
+ children: [/* @__PURE__ */ e(m, { sx: {
194
+ bgcolor: s,
195
+ borderRadius: "1px",
196
+ flexShrink: 0,
197
+ height: 8,
198
+ width: 8
199
+ } }), /* @__PURE__ */ e(l, {
200
+ variant: "caption",
201
+ children: r.credit_utilized
202
+ })]
203
+ }), /* @__PURE__ */ o(d, {
204
+ sx: {
205
+ flexDirection: "row",
206
+ fontVariantNumeric: "tabular-nums",
207
+ gap: 4
208
+ },
209
+ children: [/* @__PURE__ */ e(l, {
210
+ bold: !0,
211
+ variant: "caption",
212
+ children: h(t.amount)
213
+ }), c && /* @__PURE__ */ o(S, { children: [/* @__PURE__ */ e(l, {
214
+ variant: "caption",
215
+ children: "/"
216
+ }), /* @__PURE__ */ e(l, {
217
+ variant: "caption",
218
+ children: h(i)
219
+ })] })]
220
+ })]
221
+ }), c && /* @__PURE__ */ o(d, {
222
+ sx: {
223
+ flexDirection: "row",
224
+ justifyContent: "space-between"
225
+ },
226
+ children: [/* @__PURE__ */ e(l, {
227
+ variant: "caption",
228
+ children: r.credit_utilization_ratio
229
+ }), /* @__PURE__ */ o(l, {
230
+ bold: !0,
231
+ variant: "caption",
232
+ children: [a, "%"]
233
+ })]
234
+ })]
235
+ })]
236
+ });
237
+ }, L = (t) => {
238
+ const r = /* @__PURE__ */ new Map();
239
+ return t.map((n) => {
240
+ const i = (r.get(n.guid) ?? 0) + 1;
241
+ return r.set(n.guid, i), {
242
+ card: n,
243
+ key: i === 1 ? n.guid : `${n.guid}-${i}`
244
+ };
245
+ });
246
+ }, M = ({ cards: t, copy: r, descriptionHtml: n, summary: i, title: a }) => /* @__PURE__ */ o(d, {
247
+ sx: {
248
+ bgcolor: "background.default",
249
+ gap: 8,
250
+ pb: 24
251
+ },
252
+ children: [
253
+ (a || i || n) && /* @__PURE__ */ o(u, { children: [
254
+ a && /* @__PURE__ */ e(p, { children: a }),
255
+ i && /* @__PURE__ */ e(z, {
256
+ copy: r,
257
+ summary: i
258
+ }),
259
+ n && /* @__PURE__ */ e(l, {
260
+ component: "p",
261
+ dangerouslySetInnerHTML: { __html: f(n) },
262
+ sx: { mt: 16 },
263
+ variant: "body2"
264
+ })
265
+ ] }),
266
+ /* @__PURE__ */ e(y, { copy: r }),
267
+ t.length > 0 && /* @__PURE__ */ o(u, { children: [/* @__PURE__ */ e(p, { children: r.per_card_header }), /* @__PURE__ */ e(d, {
268
+ component: "ul",
269
+ role: "list",
270
+ sx: {
271
+ gap: 16,
272
+ listStyle: "none",
273
+ m: 0,
274
+ p: 0
275
+ },
276
+ children: L(t).map(({ card: c, key: s }) => /* @__PURE__ */ e(T, {
277
+ card: c,
278
+ copy: r
279
+ }, s))
280
+ })] })
281
+ ]
282
+ });
283
+ export {
284
+ M as default
285
+ };
286
+
287
+ //# sourceMappingURL=CreditUtilizationContent.es.js.map
@@ -0,0 +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,EAA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';
2
+ export { useCreditUtilizationPrepare } from './useCreditUtilizationPrepare';
@@ -0,0 +1,32 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ import { DataSeries } from '../../../core';
3
+ import { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData';
4
+ export type UtilizationBand = 'excellent' | 'good' | 'fair' | 'needs_work';
5
+ export interface UtilizationBandSpec {
6
+ band: UtilizationBand;
7
+ range: string;
8
+ /** Highest whole percentage in the band. */
9
+ maxPercent: number;
10
+ color: (theme: Theme) => string;
11
+ }
12
+ /** Ordered from best to worst, as the legend shows them. */
13
+ export declare const UTILIZATION_BANDS: UtilizationBandSpec[];
14
+ /** Whole percent within 0-100, the only form the drawer shows, bands or announces. */
15
+ export declare const normalizePercent: (percent: number) => number;
16
+ export declare const getUtilizationBand: (percent: number) => UtilizationBandSpec;
17
+ export interface CreditUtilizationSummary {
18
+ balance: number;
19
+ limit: number;
20
+ percentage: number;
21
+ }
22
+ export interface CreditCardRow {
23
+ guid: string;
24
+ label: string;
25
+ amount: number;
26
+ /** `null` when the institution did not share the card's limit. */
27
+ limit: number | null;
28
+ percentage: number | null;
29
+ }
30
+ export declare const readSummary: (data?: InsightsInstanceSlotData) => CreditUtilizationSummary | undefined;
31
+ /** One object per `data` row, keyed by `names` (pulse's `buildDataSeries`). */
32
+ export declare const readCardRows: (series?: DataSeries | unknown[]) => CreditCardRow[];
@@ -0,0 +1,66 @@
1
+ var l = {
2
+ band: "needs_work",
3
+ range: ">30%",
4
+ maxPercent: 1 / 0,
5
+ color: (t) => t.palette.error.light
6
+ }, g = [
7
+ {
8
+ band: "excellent",
9
+ range: "0-10%",
10
+ maxPercent: 10,
11
+ color: (t) => t.palette.success.main
12
+ },
13
+ {
14
+ band: "good",
15
+ range: "11-20%",
16
+ maxPercent: 20,
17
+ color: (t) => t.palette.success.light
18
+ },
19
+ {
20
+ band: "fair",
21
+ range: "21-30%",
22
+ maxPercent: 30,
23
+ color: (t) => t.palette.warning.light
24
+ },
25
+ l
26
+ ], c = (t) => Math.min(100, Math.max(0, Math.round(t))), s = (t) => g.find(({ maxPercent: a }) => c(t) <= a) ?? l, r = (t) => typeof t == "number" && Number.isFinite(t) ? t : void 0, p = (t) => {
27
+ const a = r(t?.accounts_balance_sum), n = r(t?.accounts_credit_limit_sum), e = r(t?.credit_utilization_percentage);
28
+ if (!(a === void 0 || n === void 0 || e === void 0))
29
+ return {
30
+ balance: a,
31
+ limit: n,
32
+ percentage: c(e)
33
+ };
34
+ }, b = (t) => {
35
+ if (!t || Array.isArray(t) || !t.names || !Array.isArray(t.data)) return [];
36
+ const { names: a } = t;
37
+ return t.data.flatMap((n) => {
38
+ const e = Object.fromEntries(a.map((m, d) => [m, n[d]]));
39
+ if (typeof e.guid != "string" || typeof e.label != "string") return [];
40
+ const o = r(e.amount) ?? 0, i = r(e.total_amount);
41
+ if (i === void 0 || i <= 0) return [{
42
+ amount: o,
43
+ guid: e.guid,
44
+ label: e.label,
45
+ limit: null,
46
+ percentage: null
47
+ }];
48
+ const u = r(e.percentage) ?? o / i * 100;
49
+ return [{
50
+ amount: o,
51
+ guid: e.guid,
52
+ label: e.label,
53
+ limit: i,
54
+ percentage: c(u)
55
+ }];
56
+ });
57
+ };
58
+ export {
59
+ g as UTILIZATION_BANDS,
60
+ s as getUtilizationBand,
61
+ c as normalizePercent,
62
+ b as readCardRows,
63
+ p as readSummary
64
+ };
65
+
66
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +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\nconst toFiniteNumber = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined\n\nexport const readSummary = (\n data?: InsightsInstanceSlotData,\n): CreditUtilizationSummary | undefined => {\n const balance = toFiniteNumber(data?.accounts_balance_sum)\n const limit = toFiniteNumber(data?.accounts_credit_limit_sum)\n const percentage = toFiniteNumber(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 = toFiniteNumber(row.amount) ?? 0\n const limit = toFiniteNumber(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 = toFiniteNumber(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":"AAeA,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,EAC1C;AAAA,EACA;AAAA,IAAE,MAAM;AAAA,IAAQ,OAAO;AAAA,IAAU,YAAY;AAAA,IAAI,OAAA,CAAQ,MAAU,EAAM,QAAQ,QAAQ;AAAA,EAAM;AAAA,EAC/F;AAAA,IAAE,MAAM;AAAA,IAAQ,OAAO;AAAA,IAAU,YAAY;AAAA,IAAI,OAAA,CAAQ,MAAU,EAAM,QAAQ,QAAQ;AAAA,EAAM;AAAA,EAC/F;AACF,GAGa,IAAA,CAAoB,MAC/B,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,MAAM,CAAO,CAAC,CAAC,GAEnC,IAAA,CAAsB,MACjC,EAAkB,KAAA,CAAM,EAAE,YAAA,EAAA,MAAiB,EAAiB,CAAO,KAAK,CAAU,KAAK,GAiBnF,IAAA,CAAkB,MACtB,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ,QAEnD,IAAA,CACX,MACyC;AACzC,QAAM,IAAU,EAAe,GAAM,oBAAoB,GACnD,IAAQ,EAAe,GAAM,yBAAyB,GACtD,IAAa,EAAe,GAAM,6BAA6B;AAErE,MAAI,EAAA,MAAY,UAAa,MAAU,UAAa,MAAe;AAEnE,WAAO;AAAA,MAAE,SAAA;AAAA,MAAS,OAAA;AAAA,MAAO,YAAY,EAAiB,CAAU;AAAA,IAAE;AACpE,GAGa,IAAA,CAAgB,MAAqD;AAChF,MAAI,CAAC,KAAU,MAAM,QAAQ,CAAM,KAAK,CAAC,EAAO,SAAS,CAAC,MAAM,QAAQ,EAAO,IAAI,EAAG,QAAO,CAAC;AAE9F,QAAM,EAAE,OAAA,EAAA,IAAU;AAElB,SAAO,EAAO,KAAK,QAAA,CAAS,MAAuC;AACjE,UAAM,IAAM,OAAO,YAAY,EAAM,IAAA,CAAK,GAAM,MAAU,CAAC,GAAM,EAAO,CAAA,CAAM,CAAC,CAAC;AAEhF,QAAI,OAAO,EAAI,QAAS,YAAY,OAAO,EAAI,SAAU,SAAU,QAAO,CAAC;AAE3E,UAAM,IAAS,EAAe,EAAI,MAAM,KAAK,GACvC,IAAQ,EAAe,EAAI,YAAY;AAE7C,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,EAAe,EAAI,UAAU,KAAM,IAAS,IAAS;AAExE,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"}
@@ -0,0 +1 @@
1
+ export declare const useCreditUtilizationPrepare: () => void;
@@ -0,0 +1,13 @@
1
+ import { useAccountStore as e } from "../../../common/context/hooks.es.js";
2
+ import r from "react";
3
+ var i = () => {
4
+ const { accountsLoaded: o, loadAccounts: t } = e();
5
+ r.useEffect(() => {
6
+ o || t();
7
+ }, [o, t]);
8
+ };
9
+ export {
10
+ i as useCreditUtilizationPrepare
11
+ };
12
+
13
+ //# sourceMappingURL=useCreditUtilizationPrepare.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreditUtilizationPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useAccountStore } from '../../../common'\n\nexport const useCreditUtilizationPrepare = () => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!accountsLoaded) void loadAccounts()\n }, [accountsLoaded, loadAccounts])\n}\n"],"mappings":";;AAIA,IAAa,IAAA,MAAoC;AAC/C,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KAAgB,EAAkB;AAAA,EACzC,GAAG,CAAC,GAAgB,CAAY,CAAC;AACnC"}
@@ -1,16 +1,17 @@
1
1
  import { CategoryGuids as T } from "../../../core/constants/Category.es.js";
2
- import R from "../../../common/utils/AccountDisplayName.es.js";
3
- import { useAccountStore as G, useActionContext as S, useAppConfig as w, useCashflowStore as A, useCategoryStore as I, useGlobalCopyStore as U, useRecurringTransactionsStore as v, useTransactionStore as E } from "../../../common/context/hooks.es.js";
4
- import { getAccountStartingBalance as O } from "../../../core/utils/AccountUtils.es.js";
5
- import b from "../../../common/components/Loader.es.js";
6
- import { ErrorCard as k } from "../../components/ErrorCard.es.js";
7
- import { useRecurringTransactionLoad as N } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
8
- import { DEFAULT_INSTITUTION_LOGO_URL as D, getCaption as F, getOtherLabel as z, groupRows as B } from "./layout.es.js";
2
+ import { DEFAULT_INSTITUTION_LOGO_URL as R } from "../../../core/constants/InstitutionLogo.es.js";
3
+ import G from "../../../common/utils/AccountDisplayName.es.js";
4
+ import { useAccountStore as S, useActionContext as w, useAppConfig as A, useCashflowStore as I, useCategoryStore as U, useGlobalCopyStore as v, useRecurringTransactionsStore as E, useTransactionStore as O } from "../../../common/context/hooks.es.js";
5
+ import { getAccountStartingBalance as b } from "../../../core/utils/AccountUtils.es.js";
6
+ import k from "../../../common/components/Loader.es.js";
7
+ import { ErrorCard as N } from "../../components/ErrorCard.es.js";
8
+ import { useRecurringTransactionLoad as D } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
9
+ import { getCaption as F, getOtherLabel as z, groupRows as B } from "./layout.es.js";
9
10
  import H from "./RemainingCashContent.es.js";
10
11
  import { observer as P } from "mobx-react-lite";
11
12
  import $ from "@mui/material/Stack";
12
13
  import { CategoryIcon as d, InstitutionLogo as g, Text as j } from "@mxenabled/mxui";
13
- import { jsx as n } from "react/jsx-runtime";
14
+ import { jsx as t } from "react/jsx-runtime";
14
15
  var p = (m, i, s) => {
15
16
  const { others: a, shown: r } = B(m);
16
17
  return a ? [...r, {
@@ -19,37 +20,37 @@ var p = (m, i, s) => {
19
20
  leading: s,
20
21
  name: z(i.one, i.multi, a.count)
21
22
  }] : r;
22
- }, to = P(function(i) {
23
- const { common: s, insights_feed: a } = U(), { config: r } = w(), { uiStore: t } = A(), { getTopLevelCategoryGuid: l } = I(), { accountsLoaded: h } = G(), { transactionsLoaded: u, transactionsLoading: y } = E(), { isDataLoaded: c } = v(), _ = S()?.recurringLoadFailed === !0, f = N(), C = c && !u && !y, o = a?.remaining_cash;
24
- if (a?.general && !o) return /* @__PURE__ */ n($, {
23
+ }, ao = P(function(i) {
24
+ const { common: s, insights_feed: a } = v(), { config: r } = A(), { uiStore: n } = I(), { getTopLevelCategoryGuid: l } = U(), { accountsLoaded: h } = S(), { transactionsLoaded: u, transactionsLoading: y } = O(), { isDataLoaded: c } = E(), _ = w()?.recurringLoadFailed === !0, f = D(), C = c && !u && !y, o = a?.remaining_cash;
25
+ if (a?.general && !o) return /* @__PURE__ */ t($, {
25
26
  sx: { p: 24 },
26
- children: /* @__PURE__ */ n(j, { children: s?.error_message })
27
+ children: /* @__PURE__ */ t(j, { children: s?.error_message })
27
28
  });
28
- if (_ && !c || C) return /* @__PURE__ */ n(k, { onRetry: () => {
29
+ if (_ && !c || C) return /* @__PURE__ */ t(N, { onRetry: () => {
29
30
  f();
30
31
  } });
31
- if (!c || !h || !u || !o) return /* @__PURE__ */ n(b, {});
32
- const L = p(t.selectedCashAccounts.map((e) => ({
33
- amount: O(e, r.display_available_balance_in_accounts),
32
+ if (!c || !h || !u || !o) return /* @__PURE__ */ t(k, {});
33
+ const L = p(n.selectedCashAccounts.map((e) => ({
34
+ amount: b(e, r.display_available_balance_in_accounts),
34
35
  key: e.guid,
35
- leading: /* @__PURE__ */ n(g, {
36
+ leading: /* @__PURE__ */ t(g, {
36
37
  alt: "",
37
38
  institutionGuid: e.institution_guid ?? "",
38
39
  size: 32
39
40
  }),
40
- name: R(e)
41
+ name: G(e)
41
42
  })), {
42
43
  multi: o.other_accounts,
43
44
  one: o.other_accounts_one
44
- }, /* @__PURE__ */ n(g, {
45
+ }, /* @__PURE__ */ t(g, {
45
46
  alt: "",
46
47
  institutionGuid: "",
47
- logoUrl: D,
48
+ logoUrl: R,
48
49
  size: 32
49
- })), x = p(t.expensesTilNextIncome.map((e) => ({
50
+ })), x = p(n.expensesTilNextIncome.map((e) => ({
50
51
  amount: e.amount,
51
52
  key: `${e.repeatingTransactionGuid}-${e.expectedDate.getTime()}`,
52
- leading: /* @__PURE__ */ n(d, {
53
+ leading: /* @__PURE__ */ t(d, {
53
54
  categoryGuid: l(e.categoryGuid),
54
55
  size: 32
55
56
  }),
@@ -57,11 +58,11 @@ var p = (m, i, s) => {
57
58
  })), {
58
59
  multi: o.other_expenses,
59
60
  one: o.other_expenses_one
60
- }, /* @__PURE__ */ n(d, {
61
+ }, /* @__PURE__ */ t(d, {
61
62
  categoryGuid: T.UNCATEGORIZED,
62
63
  size: 32
63
64
  }));
64
- return /* @__PURE__ */ n(H, {
65
+ return /* @__PURE__ */ t(H, {
65
66
  accounts: {
66
67
  header: o.accounts_header,
67
68
  rows: L
@@ -71,19 +72,19 @@ var p = (m, i, s) => {
71
72
  rows: x
72
73
  },
73
74
  summary: {
74
- remaining: t.hasUpcomingPayday ? {
75
- amount: t.remainingUntilPayday,
76
- caption: F(o, t.daysUntilNextIncome)
75
+ remaining: n.hasUpcomingPayday ? {
76
+ amount: n.remainingUntilPayday,
77
+ caption: F(o, n.daysUntilNextIncome)
77
78
  } : void 0,
78
- cashOnHand: t.selectedCashBalance,
79
+ cashOnHand: n.selectedCashBalance,
79
80
  cashOnHandLabel: o.cash_on_hand,
80
- upcomingExpenses: t.upcomingExpensesTotal,
81
+ upcomingExpenses: n.upcomingExpensesTotal,
81
82
  upcomingExpensesLabel: o.upcoming_expenses
82
83
  }
83
84
  });
84
85
  });
85
86
  export {
86
- to as RemainingCashBlock
87
+ ao as RemainingCashBlock
87
88
  };
88
89
 
89
90
  //# sourceMappingURL=RemainingCashBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { CategoryIcon, InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useActionContext,\n useAppConfig,\n useCashflowStore,\n useCategoryStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport {\n type RecurringTransactionActionContext,\n useRecurringTransactionLoad,\n} from '../RecurringTransactionBlock'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL, getCaption, getOtherLabel, groupRows } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\nimport type { RemainingCashRow } from './RemainingCashContent'\n\n/** Top rows by amount, then one \"Other (#)\" row with the rest's count and total. */\nconst toSectionRows = (\n rows: RemainingCashRow[],\n otherLabel: { one: string; multi: string },\n otherLeading: ReactNode,\n): RemainingCashRow[] => {\n const { others, shown } = groupRows(rows)\n\n if (!others) return shown\n\n return [\n ...shown,\n {\n amount: others.total,\n key: 'other',\n leading: otherLeading,\n name: getOtherLabel(otherLabel.one, otherLabel.multi, others.count),\n },\n ]\n}\n\n/**\n * Remaining Cash drawer (WEC-1880) for the Payday Cash Left Over Status beat. Store-driven: the\n * figures are today's, from CashflowStore's UiStore, not the card's generation-time numbers\n * (accepted trade-off, see docs/action-blocks/remaining-cash-block.md).\n *\n * `observer` is required: everything rendered is read from MobX stores and computeds.\n */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const { accountsLoaded } = useAccountStore()\n const { transactionsLoaded, transactionsLoading } = useTransactionStore()\n const { isDataLoaded } = useRecurringTransactionsStore()\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const retryLoad = useRecurringTransactionLoad()\n\n // TransactionStore swallows a failed request, which would silently zero every expense (see the\n // States table in docs/action-blocks/remaining-cash-block.md). `transactionsLoading` excludes another\n // widget's request still in flight: loadTransactions returns early without awaiting it.\n const transactionsFailed = isDataLoaded && !transactionsLoaded && !transactionsLoading\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loaded but without this namespace (the copy service has not shipped it). Copy loads once at\n // app start, so a retry cannot clear it: a plain message like ActionBlockLayer's unknown-block\n // state, not ErrorCard's Try Again, and never an endless loader.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if ((loadFailed && !isDataLoaded) || transactionsFailed) {\n return <ErrorCard onRetry={() => void retryLoad()} />\n }\n\n // `accountsLoaded` / `transactionsLoaded` cover another widget's request still in flight.\n if (!isDataLoaded || !accountsLoaded || !transactionsLoaded || !copy) return <Loader />\n\n const accountRows = toSectionRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = toSectionRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: (\n <CategoryIcon categoryGuid={getTopLevelCategoryGuid(expense.categoryGuid)} size={32} />\n ),\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryIcon categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":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EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { CategoryIcon, InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useActionContext,\n useAppConfig,\n useCashflowStore,\n useCategoryStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n useTransactionStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport {\n type RecurringTransactionActionContext,\n useRecurringTransactionLoad,\n} from '../RecurringTransactionBlock'\n\nimport { getCaption, getOtherLabel, groupRows } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\nimport type { RemainingCashRow } from './RemainingCashContent'\n\n/** Top rows by amount, then one \"Other (#)\" row with the rest's count and total. */\nconst toSectionRows = (\n rows: RemainingCashRow[],\n otherLabel: { one: string; multi: string },\n otherLeading: ReactNode,\n): RemainingCashRow[] => {\n const { others, shown } = groupRows(rows)\n\n if (!others) return shown\n\n return [\n ...shown,\n {\n amount: others.total,\n key: 'other',\n leading: otherLeading,\n name: getOtherLabel(otherLabel.one, otherLabel.multi, others.count),\n },\n ]\n}\n\n/**\n * Remaining Cash drawer (WEC-1880) for the Payday Cash Left Over Status beat. Store-driven: the\n * figures are today's, from CashflowStore's UiStore, not the card's generation-time numbers\n * (accepted trade-off, see docs/action-blocks/remaining-cash-block.md).\n *\n * `observer` is required: everything rendered is read from MobX stores and computeds.\n */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const { accountsLoaded } = useAccountStore()\n const { transactionsLoaded, transactionsLoading } = useTransactionStore()\n const { isDataLoaded } = useRecurringTransactionsStore()\n const loadFailed =\n useActionContext<RecurringTransactionActionContext>()?.recurringLoadFailed === true\n const retryLoad = useRecurringTransactionLoad()\n\n // TransactionStore swallows a failed request, which would silently zero every expense (see the\n // States table in docs/action-blocks/remaining-cash-block.md). `transactionsLoading` excludes another\n // widget's request still in flight: loadTransactions returns early without awaiting it.\n const transactionsFailed = isDataLoaded && !transactionsLoaded && !transactionsLoading\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loaded but without this namespace (the copy service has not shipped it). Copy loads once at\n // app start, so a retry cannot clear it: a plain message like ActionBlockLayer's unknown-block\n // state, not ErrorCard's Try Again, and never an endless loader.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if ((loadFailed && !isDataLoaded) || transactionsFailed) {\n return <ErrorCard onRetry={() => void retryLoad()} />\n }\n\n // `accountsLoaded` / `transactionsLoaded` cover another widget's request still in flight.\n if (!isDataLoaded || !accountsLoaded || !transactionsLoaded || !copy) return <Loader />\n\n const accountRows = toSectionRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = toSectionRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: (\n <CategoryIcon categoryGuid={getTopLevelCategoryGuid(expense.categoryGuid)} size={32} />\n ),\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryIcon categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;AAkCA,IAAM,IAAA,CACJ,GACA,GACA,MACuB;AACvB,QAAM,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAU,CAAI;AAExC,SAAK,IAEE,CACL,GAAG,GACH;AAAA,IACE,QAAQ,EAAO;AAAA,IACf,KAAK;AAAA,IACL,SAAS;AAAA,IACT,MAAM,EAAc,EAAW,KAAK,EAAW,OAAO,EAAO,KAAK;AAAA,EACpE,CACF,IAVoB;AAWtB,GASa,KAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,yBAAA,EAAA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AC9C,QAAQ,EAAQ;AAAA,IAChB,KAAK,GAAG,EAAQ,wBAAA,IAA4B,EAAQ,aAAa,QAAQ,CAAA;AAAA,IACzE,SACE,gBAAA,EAAC,GAAD;AAAA,MAAc,cAAc,EAAwB,EAAQ,YAAY;AAAA,MAAG,MAAM;AAAA,IAAK,CAAA;AAAA,IAExF,MAAM,EAAQ;AAAA,EAChB,EAAE,GACF;AAAA,IAAE,OAAO,EAAK;AAAA,IAAgB,KAAK,EAAK;AAAA,EAAmB,GAC3D,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAc;AAAA,IAAe,MAAM;AAAA,EAAK,CAAA,CACtE;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
@@ -1,12 +1,6 @@
1
1
  import { RemainingCashCopy } from '../../../core';
2
2
  /** Rows shown per section before the rest fold into an "Other (#)" row (Figma shows two). */
3
3
  export declare const ROW_LIMIT = 2;
4
- /**
5
- * The grey bank tile on the "Other Accounts" row (Figma). It is MXUI's own `InstitutionLogo` fallback
6
- * image; passing it as `logoUrl` shows it straight away, instead of after a failed request for an
7
- * empty institution guid.
8
- */
9
- export declare const DEFAULT_INSTITUTION_LOGO_URL = "https://content.moneydesktop.com/storage/MD_Assets/serenity/default_institution_logo.png";
10
4
  export interface GroupedRows<T> {
11
5
  shown: T[];
12
6
  others?: {