@mx-cartographer/experiences 9.7.192 → 9.7.194-alpha-ram-cu-1

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 CHANGED
@@ -1,3 +1,13 @@
1
+ ## [9.7.194] - 11-19-2026
2
+
3
+ - **FIXED** - Width of the cash flow and trends mini widgets in narrow layouts (WELL-218)
4
+
5
+ ## [9.7.193] - 11-19-2026
6
+
7
+ - **ADDED** - Credit Utilization Insights 2.0 donut (credit_utilization variant) coloured by the utilization band (WEC-2348)
8
+ - **CHANGED** - Credit Utilization drawer reads its sums and cards from the Learn More CTA's drilldown_data, falling back to the legacy instance_slot_data (WEC-2348)
9
+ - **ADDED** - Credit Utilization Storybook QA page with every state (including No longer relevant) and widget (WEC-2348)
10
+
1
11
  ## [9.7.192] - 11-19-2026
2
12
 
3
13
  - **FIXED** - Monthly Credit Card Interest Summary V2 card: the fees wash and the category tile's 1.5px border match Figma (WEC-2336)
@@ -8,7 +8,7 @@ import g from "./components/CashflowWidgetContent.es.js";
8
8
  import w from "react";
9
9
  import { observer as b } from "mobx-react-lite";
10
10
  import { jsx as e, jsxs as C } from "react/jsx-runtime";
11
- var S = ({ onPrimaryCtaClick: r, onSecondaryCtaClick: m, sx: s = {} }) => {
11
+ var S = ({ onPrimaryCtaClick: r, onSecondaryCtaClick: s, sx: m = {} }) => {
12
12
  const { cashflow: t } = f(), { isInitialized: n } = c(), { income: l } = y(), { loadRepeatingTransactionData: d, isDataLoaded: i } = p();
13
13
  w.useEffect(() => {
14
14
  i || d().finally();
@@ -36,8 +36,7 @@ var S = ({ onPrimaryCtaClick: r, onSecondaryCtaClick: m, sx: s = {} }) => {
36
36
  sx: {
37
37
  display: "flex",
38
38
  flexDirection: "column",
39
- minWidth: 288,
40
- ...s
39
+ ...m
41
40
  },
42
41
  title: t.title,
43
42
  wideHeightLimits: {
@@ -48,7 +47,7 @@ var S = ({ onPrimaryCtaClick: r, onSecondaryCtaClick: m, sx: s = {} }) => {
48
47
  children: [!i && /* @__PURE__ */ e(a, {}), i && (o ? /* @__PURE__ */ e(x, {
49
48
  header: t.create,
50
49
  icon: "local_atm",
51
- onClick: m,
50
+ onClick: s,
52
51
  primaryButton: t.add_income,
53
52
  primaryButtonStartIcon: "add",
54
53
  subText: t.create_description,
@@ -1 +1 @@
1
- {"version":3,"file":"CashflowMiniWidget.es.js","names":[],"sources":["../../src/cashflow/CashflowMiniWidget.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n EmptyState,\n Loader,\n MiniWidgetContainer,\n useGlobalCopyStore,\n useGlobalUiStore,\n useRecurringTransactionsStore,\n useWidgetLoadTimer,\n} from '../common'\nimport { MiniWidgetProps } from '../core'\n\nimport CashflowWidgetContent, { LARGE_LAYOUT_MIN_WIDTH } from './components/CashflowWidgetContent'\nimport { useCashflowUiStore } from './context/hooks'\n\nconst CashflowMiniWidget: React.FC<MiniWidgetProps> = ({\n onPrimaryCtaClick,\n onSecondaryCtaClick,\n sx = {},\n}) => {\n const { cashflow: copy } = useGlobalCopyStore()\n const { isInitialized } = useGlobalUiStore()\n const { income } = useCashflowUiStore()\n const { loadRepeatingTransactionData, isDataLoaded } = useRecurringTransactionsStore()\n\n React.useEffect(() => {\n if (!isDataLoaded) {\n loadRepeatingTransactionData().finally()\n }\n }, [])\n\n useWidgetLoadTimer({\n widgetName: 'CashflowMiniWidget',\n isLoaded: isDataLoaded,\n })\n\n const showEmptyState = isDataLoaded && !income.length\n\n if (!isInitialized) return <Loader />\n\n return (\n <MiniWidgetContainer\n className=\"mx-exp-cashflow-miniwidget\"\n onPrimaryCtaClick={onPrimaryCtaClick}\n primaryCtaLabel={copy.primary_cta}\n primaryCtaLabelAria={copy.primary_cta_aria}\n subTitle={showEmptyState || !isDataLoaded ? undefined : copy.sub_title}\n contentStyles={{\n display: 'flex',\n flex: 1,\n flexDirection: 'column',\n '&:last-child': { pb: 16 },\n }}\n heightLimits={{ min: 264, max: 324 }}\n sx={{ display: 'flex', flexDirection: 'column', minWidth: 288, ...sx }}\n title={copy.title}\n wideHeightLimits={{ min: 160, max: 200, fromWidth: LARGE_LAYOUT_MIN_WIDTH }}\n >\n {!isDataLoaded && <Loader />}\n {isDataLoaded &&\n (showEmptyState ? (\n <EmptyState\n header={copy.create}\n icon=\"local_atm\"\n onClick={onSecondaryCtaClick}\n primaryButton={copy.add_income}\n primaryButtonStartIcon=\"add\"\n subText={copy.create_description}\n sx={{\n pt: 16,\n pb: 8,\n '& > svg:first-of-type': { my: 6 },\n '& .empty-state-subtext': { maxWidth: 288, mt: 4, width: '100%' },\n '& .buttons-footer': { mt: 24 },\n '& .MuiButton-startIcon > svg': { fontSize: 22, height: 22, width: 22 },\n }}\n />\n ) : (\n <CashflowWidgetContent />\n ))}\n </MiniWidgetContainer>\n )\n}\n\nexport default observer(CashflowMiniWidget)\n"],"mappings":";;;;;;;;;;AAiBA,IAAM,IAAA,CAAiD,EACrD,mBAAA,GACA,qBAAA,GACA,IAAA,IAAK,CAAC,EAAA,MACF;AACJ,QAAM,EAAE,UAAU,EAAA,IAAS,EAAmB,GACxC,EAAE,eAAA,EAAA,IAAkB,EAAiB,GACrC,EAAE,QAAA,EAAA,IAAW,EAAmB,GAChC,EAAE,8BAAA,GAA8B,cAAA,EAAA,IAAiB,EAA8B;AAErF,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KACH,EAA6B,EAAE,QAAQ;AAAA,EAE3C,GAAG,CAAC,CAAC,GAEL,EAAmB;AAAA,IACjB,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC;AAED,QAAM,IAAiB,KAAgB,CAAC,EAAO;AAE/C,SAAK,IAGH,gBAAA,EAAC,GAAD;AAAA,IACE,WAAU;AAAA,IACS,mBAAA;AAAA,IACnB,iBAAiB,EAAK;AAAA,IACtB,qBAAqB,EAAK;AAAA,IAC1B,UAAU,KAAkB,CAAC,IAAe,SAAY,EAAK;AAAA,IAC7D,eAAe;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,MACN,eAAe;AAAA,MACf,gBAAgB,EAAE,IAAI,GAAG;AAAA,IAC3B;AAAA,IACA,cAAc;AAAA,MAAE,KAAK;AAAA,MAAK,KAAK;AAAA,IAAI;AAAA,IACnC,IAAI;AAAA,MAAE,SAAS;AAAA,MAAQ,eAAe;AAAA,MAAU,UAAU;AAAA,MAAK,GAAG;AAAA,IAAG;AAAA,IACrE,OAAO,EAAK;AAAA,IACZ,kBAAkB;AAAA,MAAE,KAAK;AAAA,MAAK,KAAK;AAAA,MAAK,WAAA;AAAA,IAAkC;AAAA,IAf5E,UAAA,CAiBG,CAAC,KAAgB,gBAAA,EAAC,GAAD,CAAS,CAAA,GAC1B,MACE,IACC,gBAAA,EAAC,GAAD;AAAA,MACE,QAAQ,EAAK;AAAA,MACb,MAAK;AAAA,MACL,SAAS;AAAA,MACT,eAAe,EAAK;AAAA,MACpB,wBAAuB;AAAA,MACvB,SAAS,EAAK;AAAA,MACd,IAAI;AAAA,QACF,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,yBAAyB,EAAE,IAAI,EAAE;AAAA,QACjC,0BAA0B;AAAA,UAAE,UAAU;AAAA,UAAK,IAAI;AAAA,UAAG,OAAO;AAAA,QAAO;AAAA,QAChE,qBAAqB,EAAE,IAAI,GAAG;AAAA,QAC9B,gCAAgC;AAAA,UAAE,UAAU;AAAA,UAAI,QAAQ;AAAA,UAAI,OAAO;AAAA,QAAG;AAAA,MACxE;AAAA,IACD,CAAA,IAED,gBAAA,EAAC,GAAD,CAAwB,CAAA,EAET;AAAA,OA1CI,gBAAA,EAAC,GAAD,CAAS,CAAA;AA4CtC,GAEA,IAAe,EAAS,CAAkB"}
1
+ {"version":3,"file":"CashflowMiniWidget.es.js","names":[],"sources":["../../src/cashflow/CashflowMiniWidget.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n EmptyState,\n Loader,\n MiniWidgetContainer,\n useGlobalCopyStore,\n useGlobalUiStore,\n useRecurringTransactionsStore,\n useWidgetLoadTimer,\n} from '../common'\nimport { MiniWidgetProps } from '../core'\n\nimport CashflowWidgetContent, { LARGE_LAYOUT_MIN_WIDTH } from './components/CashflowWidgetContent'\nimport { useCashflowUiStore } from './context/hooks'\n\nconst CashflowMiniWidget: React.FC<MiniWidgetProps> = ({\n onPrimaryCtaClick,\n onSecondaryCtaClick,\n sx = {},\n}) => {\n const { cashflow: copy } = useGlobalCopyStore()\n const { isInitialized } = useGlobalUiStore()\n const { income } = useCashflowUiStore()\n const { loadRepeatingTransactionData, isDataLoaded } = useRecurringTransactionsStore()\n\n React.useEffect(() => {\n if (!isDataLoaded) {\n loadRepeatingTransactionData().finally()\n }\n }, [])\n\n useWidgetLoadTimer({\n widgetName: 'CashflowMiniWidget',\n isLoaded: isDataLoaded,\n })\n\n const showEmptyState = isDataLoaded && !income.length\n\n if (!isInitialized) return <Loader />\n\n return (\n <MiniWidgetContainer\n className=\"mx-exp-cashflow-miniwidget\"\n onPrimaryCtaClick={onPrimaryCtaClick}\n primaryCtaLabel={copy.primary_cta}\n primaryCtaLabelAria={copy.primary_cta_aria}\n subTitle={showEmptyState || !isDataLoaded ? undefined : copy.sub_title}\n contentStyles={{\n display: 'flex',\n flex: 1,\n flexDirection: 'column',\n '&:last-child': { pb: 16 },\n }}\n heightLimits={{ min: 264, max: 324 }}\n sx={{ display: 'flex', flexDirection: 'column', ...sx }}\n title={copy.title}\n wideHeightLimits={{ min: 160, max: 200, fromWidth: LARGE_LAYOUT_MIN_WIDTH }}\n >\n {!isDataLoaded && <Loader />}\n {isDataLoaded &&\n (showEmptyState ? (\n <EmptyState\n header={copy.create}\n icon=\"local_atm\"\n onClick={onSecondaryCtaClick}\n primaryButton={copy.add_income}\n primaryButtonStartIcon=\"add\"\n subText={copy.create_description}\n sx={{\n pt: 16,\n pb: 8,\n '& > svg:first-of-type': { my: 6 },\n '& .empty-state-subtext': { maxWidth: 288, mt: 4, width: '100%' },\n '& .buttons-footer': { mt: 24 },\n '& .MuiButton-startIcon > svg': { fontSize: 22, height: 22, width: 22 },\n }}\n />\n ) : (\n <CashflowWidgetContent />\n ))}\n </MiniWidgetContainer>\n )\n}\n\nexport default observer(CashflowMiniWidget)\n"],"mappings":";;;;;;;;;;AAiBA,IAAM,IAAA,CAAiD,EACrD,mBAAA,GACA,qBAAA,GACA,IAAA,IAAK,CAAC,EAAA,MACF;AACJ,QAAM,EAAE,UAAU,EAAA,IAAS,EAAmB,GACxC,EAAE,eAAA,EAAA,IAAkB,EAAiB,GACrC,EAAE,QAAA,EAAA,IAAW,EAAmB,GAChC,EAAE,8BAAA,GAA8B,cAAA,EAAA,IAAiB,EAA8B;AAErF,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KACH,EAA6B,EAAE,QAAQ;AAAA,EAE3C,GAAG,CAAC,CAAC,GAEL,EAAmB;AAAA,IACjB,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC;AAED,QAAM,IAAiB,KAAgB,CAAC,EAAO;AAE/C,SAAK,IAGH,gBAAA,EAAC,GAAD;AAAA,IACE,WAAU;AAAA,IACS,mBAAA;AAAA,IACnB,iBAAiB,EAAK;AAAA,IACtB,qBAAqB,EAAK;AAAA,IAC1B,UAAU,KAAkB,CAAC,IAAe,SAAY,EAAK;AAAA,IAC7D,eAAe;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,MACN,eAAe;AAAA,MACf,gBAAgB,EAAE,IAAI,GAAG;AAAA,IAC3B;AAAA,IACA,cAAc;AAAA,MAAE,KAAK;AAAA,MAAK,KAAK;AAAA,IAAI;AAAA,IACnC,IAAI;AAAA,MAAE,SAAS;AAAA,MAAQ,eAAe;AAAA,MAAU,GAAG;AAAA,IAAG;AAAA,IACtD,OAAO,EAAK;AAAA,IACZ,kBAAkB;AAAA,MAAE,KAAK;AAAA,MAAK,KAAK;AAAA,MAAK,WAAA;AAAA,IAAkC;AAAA,IAf5E,UAAA,CAiBG,CAAC,KAAgB,gBAAA,EAAC,GAAD,CAAS,CAAA,GAC1B,MACE,IACC,gBAAA,EAAC,GAAD;AAAA,MACE,QAAQ,EAAK;AAAA,MACb,MAAK;AAAA,MACL,SAAS;AAAA,MACT,eAAe,EAAK;AAAA,MACpB,wBAAuB;AAAA,MACvB,SAAS,EAAK;AAAA,MACd,IAAI;AAAA,QACF,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,yBAAyB,EAAE,IAAI,EAAE;AAAA,QACjC,0BAA0B;AAAA,UAAE,UAAU;AAAA,UAAK,IAAI;AAAA,UAAG,OAAO;AAAA,QAAO;AAAA,QAChE,qBAAqB,EAAE,IAAI,GAAG;AAAA,QAC9B,gCAAgC;AAAA,UAAE,UAAU;AAAA,UAAI,QAAQ;AAAA,UAAI,OAAO;AAAA,QAAG;AAAA,MACxE;AAAA,IACD,CAAA,IAED,gBAAA,EAAC,GAAD,CAAwB,CAAA,EAET;AAAA,OA1CI,gBAAA,EAAC,GAAD,CAAS,CAAA;AA4CtC,GAEA,IAAe,EAAS,CAAkB"}
@@ -1,30 +1,31 @@
1
1
  import { useAccountStore as m, useGlobalCopyStore as p } from "../../../common/context/hooks.es.js";
2
2
  import C from "../../../common/components/drawer/Drawer.es.js";
3
- import { useRequiredCopy as _ } from "../useRequiredCopy.es.js";
4
- import { AccountDetailsBlock as f } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
5
- import { readCardRows as y, readSummary as g } from "./layout.es.js";
6
- import v from "./CreditUtilizationContent.es.js";
7
- import { useState as z } from "react";
8
- import { observer as G } from "mobx-react-lite";
9
- import { Fragment as b, jsx as e, jsxs as h } from "react/jsx-runtime";
10
- var k = (i, o) => ({
3
+ import { useOpenedCta as _ } from "../useOpenedCta.es.js";
4
+ import { useRequiredCopy as f } from "../useRequiredCopy.es.js";
5
+ import { AccountDetailsBlock as y } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
6
+ import { readCardRows as g, readDrawerFacts as v, readSummary as z } from "./layout.es.js";
7
+ import G from "./CreditUtilizationContent.es.js";
8
+ import { useState as h } from "react";
9
+ import { observer as k } from "mobx-react-lite";
10
+ import { Fragment as A, jsx as e, jsxs as B } from "react/jsx-runtime";
11
+ var D = (i, o) => ({
11
12
  ...i,
12
13
  accountLoaded: o !== void 0,
13
14
  institutionGuid: o?.institution_guid ?? ""
14
- }), A = (i) => i.insights_feed?.credit_utilization, R = G(function({ beat: o }) {
15
- const [a, n] = z(null), { accounts: r } = p(), { accounts: s } = m(), d = _(A), c = o.insights_payload?.instance_slot_data, u = new Map(s.map((t) => [t.guid, t])), l = y(c?.data_series).map((t) => k(t, u.get(t.guid)));
16
- return /* @__PURE__ */ h(b, { children: [/* @__PURE__ */ e(v, {
15
+ }), S = (i) => i.insights_feed?.credit_utilization, M = k(function({ beat: o }) {
16
+ const [a, n] = h(null), { accounts: r } = p(), { accounts: s } = m(), d = f(S), c = v(_(o), o.insights_payload?.instance_slot_data), u = new Map(s.map((t) => [t.guid, t])), l = g(c?.data_series).map((t) => D(t, u.get(t.guid)));
17
+ return /* @__PURE__ */ B(A, { children: [/* @__PURE__ */ e(G, {
17
18
  accountDetailsLabel: r?.account_details,
18
19
  cards: l,
19
20
  copy: d,
20
21
  onCardClick: ({ guid: t }) => n(t),
21
- summary: g(c)
22
+ summary: z(c)
22
23
  }), /* @__PURE__ */ e(C, {
23
24
  ariaLabelClose: r?.close_account_details_aria,
24
25
  isOpen: a !== null,
25
26
  onClose: () => n(null),
26
27
  title: r?.account_details,
27
- children: a && /* @__PURE__ */ e(f, { beat: {
28
+ children: a && /* @__PURE__ */ e(y, { beat: {
28
29
  ...o,
29
30
  primary_account: void 0,
30
31
  primary_account_guid: a
@@ -32,8 +33,8 @@ var k = (i, o) => ({
32
33
  })] });
33
34
  });
34
35
  export {
35
- R as CreditUtilizationBlock,
36
- A as selectCreditUtilizationCopy
36
+ M as CreditUtilizationBlock,
37
+ S as selectCreditUtilizationCopy
37
38
  };
38
39
 
39
40
  //# sourceMappingURL=CreditUtilizationBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreditUtilizationBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Drawer, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { Account, GlobalCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport CreditUtilizationContent, { type CreditUtilizationCard } from './CreditUtilizationContent'\nimport { readCardRows, readSummary, type CreditCardRow } from './layout'\n\nconst toCard = (row: CreditCardRow, account?: Account): CreditUtilizationCard => ({\n ...row,\n accountLoaded: account !== undefined,\n institutionGuid: account?.institution_guid ?? '',\n})\n\nexport const selectCreditUtilizationCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.credit_utilization\n\nexport const CreditUtilizationBlock = observer(function CreditUtilizationBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { accounts: accountsCopy } = useGlobalCopyStore()\n const { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectCreditUtilizationCopy)\n\n const data = beat.insights_payload?.instance_slot_data\n const accountByGuid = new Map(accounts.map((account) => [account.guid, account]))\n const cards = readCardRows(data?.data_series).map((row) =>\n toCard(row, accountByGuid.get(row.guid)),\n )\n\n return (\n <>\n <CreditUtilizationContent\n accountDetailsLabel={accountsCopy?.account_details}\n cards={cards}\n copy={copy}\n onCardClick={({ guid }) => setTappedAccountGuid(guid)}\n summary={readSummary(data)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={() => setTappedAccountGuid(null)}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n <Acc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R,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"CreditUtilizationBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Drawer, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { Account, GlobalCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport CreditUtilizationContent, { type CreditUtilizationCard } from './CreditUtilizationContent'\nimport { readCardRows, readDrawerFacts, readSummary, type CreditCardRow } from './layout'\n\nconst toCard = (row: CreditCardRow, account?: Account): CreditUtilizationCard => ({\n ...row,\n accountLoaded: account !== undefined,\n institutionGuid: account?.institution_guid ?? '',\n})\n\nexport const selectCreditUtilizationCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.credit_utilization\n\nexport const CreditUtilizationBlock = observer(function CreditUtilizationBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { accounts: accountsCopy } = useGlobalCopyStore()\n const { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectCreditUtilizationCopy)\n\n const data = readDrawerFacts(useOpenedCta(beat), beat.insights_payload?.instance_slot_data)\n const accountByGuid = new Map(accounts.map((account) => [account.guid, account]))\n const cards = readCardRows(data?.data_series).map((row) =>\n toCard(row, accountByGuid.get(row.guid)),\n )\n\n return (\n <>\n <CreditUtilizationContent\n accountDetailsLabel={accountsCopy?.account_details}\n cards={cards}\n copy={copy}\n onCardClick={({ guid }) => setTappedAccountGuid(guid)}\n summary={readSummary(data)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={() => setTappedAccountGuid(null)}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;AAcA,IAAM,IAAA,CAAU,GAAoB,OAA8C;AAAA,EAChF,GAAG;AAAA,EACH,eAAe,MAAY;AAAA,EAC3B,iBAAiB,GAAS,oBAAoB;AAChD,IAEa,IAAA,CAA+B,MAC1C,EAAK,eAAe,oBAET,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,UAAU,EAAA,IAAiB,EAAmB,GAChD,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/B,IAAO,EAAgB,CAA2B,GAElD,IAAO,EAAgB,EAAa,CAAI,GAAG,EAAK,kBAAkB,kBAAkB,GACpF,IAAgB,IAAI,IAAI,EAAS,IAAA,CAAK,MAAY,CAAC,EAAQ,MAAM,CAAO,CAAC,CAAC,GAC1E,IAAQ,EAAa,GAAM,WAAW,EAAE,IAAA,CAAK,MACjD,EAAO,GAAK,EAAc,IAAI,EAAI,IAAI,CAAC,CACzC;AAEA,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,qBAAqB,GAAc;AAAA,IAC5B,OAAA;AAAA,IACD,MAAA;AAAA,IACN,aAAA,CAAc,EAAE,MAAA,EAAA,MAAW,EAAqB,CAAI;AAAA,IACpD,SAAS,EAAY,CAAI;AAAA,EAC1B,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,GAAc;AAAA,IAC9B,QAAQ,MAAsB;AAAA,IAC9B,SAAA,MAAe,EAAqB,IAAI;AAAA,IACxC,OAAO,GAAc;AAAA,IAEpB,UAAA,KACC,gBAAA,EAAC,GAAD,EACE,MAAM;AAAA,MAAE,GAAG;AAAA,MAAM,iBAAiB;AAAA,MAAW,sBAAsB;AAAA,IAAkB,EACtF,CAAA;AAAA,EAEG,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
@@ -1,35 +1,39 @@
1
1
  import { sanitizeHtml as w } from "../../../core/utils/SanitizeHtml.es.js";
2
2
  import { DEFAULT_INSTITUTION_LOGO_URL as T } from "../../../core/constants/InstitutionLogo.es.js";
3
- import { CURRENCY_FORMAT as x, formatCurrency as g } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { CURRENCY_FORMAT as b, formatCurrency as g } from "../../../core/utils/NumberFormatting.es.js";
4
4
  import { ELEVATION_SHADOW as R } from "../../components/shared/elevation.es.js";
5
5
  import { TipSection as L } from "../../../insights/components/shared/ChartDrawerTemplate/TipSection.es.js";
6
6
  import { DRAWER_TIP_ICON as S } from "../../components/drawerTip.es.js";
7
7
  import { UTILIZATION_BANDS as h, getLegendPosition as $, getUtilizationBand as f } from "./layout.es.js";
8
8
  import l from "@mui/material/Stack";
9
9
  import { Icon as k, InstitutionLogo as z, Text as d } from "@mxenabled/mxui";
10
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
10
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
11
11
  import { useTheme as v } from "@mui/material/styles";
12
- import a from "@mui/material/Box";
12
+ import r from "@mui/material/Box";
13
13
  import A from "@mui/material/ButtonBase";
14
- var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ children: o }) => /* @__PURE__ */ e(d, {
14
+ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", x = ({ children: o }) => /* @__PURE__ */ t(d, {
15
15
  bold: !0,
16
16
  component: "h3",
17
17
  sx: { mb: 12 },
18
18
  variant: "body1",
19
19
  children: o
20
- }), O = ({ definition: o, term: i }) => /* @__PURE__ */ e(a, {
20
+ }), O = ({ definition: o, term: i }) => /* @__PURE__ */ t(r, {
21
21
  component: "li",
22
22
  sx: {
23
23
  backgroundImage: _,
24
24
  bgcolor: "background.default",
25
25
  borderRadius: "8px",
26
- px: 8,
27
- py: 6
26
+ p: 8
28
27
  },
29
28
  children: /* @__PURE__ */ n(d, {
29
+ color: "text.secondary",
30
30
  component: "p",
31
- variant: "body2",
32
- children: [i && /* @__PURE__ */ n("b", { children: [i, " "] }), o]
31
+ variant: "subtitle2",
32
+ children: [i && /* @__PURE__ */ n(r, {
33
+ component: "b",
34
+ sx: { color: "text.primary" },
35
+ children: [i, " "]
36
+ }), o]
33
37
  })
34
38
  }), U = ({ copy: o }) => {
35
39
  const i = o.ratio_definition && o.utilization_definition ? [{
@@ -39,7 +43,7 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
39
43
  definition: o.utilization_definition,
40
44
  term: o.utilization_term
41
45
  }] : [{ definition: o.ratio_explanation }];
42
- return /* @__PURE__ */ e(l, {
46
+ return /* @__PURE__ */ t(l, {
43
47
  component: "ul",
44
48
  role: "list",
45
49
  sx: {
@@ -48,22 +52,22 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
48
52
  m: 0,
49
53
  p: 0
50
54
  },
51
- children: i.map((t) => /* @__PURE__ */ e(O, { ...t }, t.definition))
55
+ children: i.map((e) => /* @__PURE__ */ t(O, { ...e }, e.definition))
52
56
  });
53
- }, B = ({ copy: o, percentage: i }) => {
54
- const t = v(), r = h.length - 1, m = i === void 0 ? void 0 : f(i);
55
- return /* @__PURE__ */ n(a, {
57
+ }, y = ({ copy: o, percentage: i }) => {
58
+ const e = v(), a = h.length - 1, m = i === void 0 ? void 0 : f(i);
59
+ return /* @__PURE__ */ n(r, {
56
60
  sx: {
57
61
  mt: 24,
58
62
  position: "relative"
59
63
  },
60
- children: [m && i !== void 0 && /* @__PURE__ */ e(a, {
64
+ children: [m && i !== void 0 && /* @__PURE__ */ t(r, {
61
65
  "aria-label": `${i}% ${o[m.band]}`,
62
66
  role: "img",
63
67
  sx: {
64
68
  bgcolor: "background.paper",
65
69
  border: "4px solid",
66
- borderColor: m.color(t),
70
+ borderColor: m.color(e),
67
71
  borderRadius: "50%",
68
72
  height: c,
69
73
  left: `clamp(0px, calc(${$(i)}% - ${c / 2}px), calc(100% - ${c}px))`,
@@ -71,7 +75,7 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
71
75
  top: -4,
72
76
  width: c
73
77
  }
74
- }), /* @__PURE__ */ e(l, {
78
+ }), /* @__PURE__ */ t(l, {
75
79
  "aria-label": o.what_does_this_mean,
76
80
  component: "ul",
77
81
  role: "list",
@@ -82,7 +86,7 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
82
86
  m: 0,
83
87
  p: 0
84
88
  },
85
- children: h.map(({ band: s, color: u, range: I }, p) => /* @__PURE__ */ n(a, {
89
+ children: h.map(({ band: s, color: p, range: I }, u) => /* @__PURE__ */ n(r, {
86
90
  component: "li",
87
91
  sx: {
88
92
  flex: 1,
@@ -90,35 +94,36 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
90
94
  overflowWrap: "anywhere"
91
95
  },
92
96
  children: [
93
- /* @__PURE__ */ e(a, {
97
+ /* @__PURE__ */ t(r, {
94
98
  "aria-hidden": !0,
95
99
  sx: {
96
- bgcolor: u(t),
97
- borderRadius: p === 0 ? "8px 0 0 8px" : p === r ? "0 8px 8px 0" : void 0,
100
+ bgcolor: p(e),
101
+ borderRadius: u === 0 ? "99px 0 0 99px" : u === a ? "0 99px 99px 0" : void 0,
98
102
  height: 12,
99
103
  mb: 8
100
104
  }
101
105
  }),
102
- /* @__PURE__ */ e(d, {
103
- bold: !0,
106
+ /* @__PURE__ */ t(d, {
104
107
  component: "p",
105
- variant: "caption",
108
+ sx: { fontWeight: 700 },
109
+ variant: "tiny",
106
110
  children: I
107
111
  }),
108
- /* @__PURE__ */ e(d, {
112
+ /* @__PURE__ */ t(d, {
113
+ color: "text.secondary",
109
114
  component: "p",
110
- variant: "caption",
115
+ variant: "tiny",
111
116
  children: o[s]
112
117
  })
113
118
  ]
114
119
  }, s))
115
120
  })]
116
121
  });
117
- }, E = ({ card: { label: o, percentage: i } }) => {
118
- const t = v();
119
- return i === null ? null : /* @__PURE__ */ n(a, {
122
+ }, B = ({ card: { label: o, percentage: i } }) => {
123
+ const e = v();
124
+ return i === null ? null : /* @__PURE__ */ n(r, {
120
125
  sx: { mt: 16 },
121
- children: [/* @__PURE__ */ e(a, {
126
+ children: [/* @__PURE__ */ t(r, {
122
127
  "aria-label": o,
123
128
  "aria-valuemax": 100,
124
129
  "aria-valuemin": 0,
@@ -127,13 +132,13 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
127
132
  role: "meter",
128
133
  sx: {
129
134
  bgcolor: "divider",
130
- borderRadius: 999,
131
- height: 8,
135
+ borderRadius: "4px",
136
+ height: 12,
132
137
  overflow: "hidden"
133
138
  },
134
- children: /* @__PURE__ */ e(a, { sx: {
135
- bgcolor: f(i).color(t),
136
- borderRadius: 999,
139
+ children: /* @__PURE__ */ t(r, { sx: {
140
+ bgcolor: f(i).color(e),
141
+ borderRadius: "4px",
137
142
  height: "100%",
138
143
  width: `${i}%`
139
144
  } })
@@ -145,29 +150,29 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
145
150
  transform: "translateX(-50%)",
146
151
  width: "max-content"
147
152
  },
148
- children: [/* @__PURE__ */ e(a, { sx: {
153
+ children: [/* @__PURE__ */ t(r, { sx: {
149
154
  bgcolor: "divider",
150
155
  height: 6,
151
156
  width: "1px"
152
- } }), /* @__PURE__ */ e(d, {
157
+ } }), /* @__PURE__ */ t(d, {
153
158
  variant: "caption",
154
159
  children: D
155
160
  })]
156
161
  })]
157
162
  });
158
- }, C = (o, i) => [
163
+ }, E = (o, i) => [
159
164
  o.label,
160
- g(o.amount, x.cents),
165
+ g(o.amount, b.cents),
161
166
  o.percentage === null ? void 0 : `${o.percentage}%`,
162
167
  i
163
- ].filter(Boolean).join(", "), H = ({ accountDetailsLabel: o, card: i, copy: t, onClick: r }) => /* @__PURE__ */ e(a, {
168
+ ].filter(Boolean).join(", "), W = ({ accountDetailsLabel: o, card: i, copy: e, onClick: a }) => /* @__PURE__ */ t(r, {
164
169
  component: "li",
165
- children: /* @__PURE__ */ n(a, {
166
- ...r && {
170
+ children: /* @__PURE__ */ n(r, {
171
+ ...a && {
167
172
  "aria-haspopup": "dialog",
168
- "aria-label": C(i, o),
173
+ "aria-label": E(i, o),
169
174
  component: A,
170
- onClick: r
175
+ onClick: a
171
176
  },
172
177
  sx: {
173
178
  backgroundImage: _,
@@ -175,10 +180,12 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
175
180
  borderRadius: "8px",
176
181
  boxShadow: R[1],
177
182
  display: "block",
178
- p: 16,
183
+ pb: 8,
184
+ pt: 16,
185
+ px: 16,
179
186
  textAlign: "left",
180
187
  width: "100%",
181
- ...r && {
188
+ ...a && {
182
189
  "&:hover": { bgcolor: "action.hover" },
183
190
  "&.Mui-focusVisible": { bgcolor: "action.focus" }
184
191
  }
@@ -191,7 +198,7 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
191
198
  gap: 12
192
199
  },
193
200
  children: [
194
- /* @__PURE__ */ e(z, {
201
+ /* @__PURE__ */ t(z, {
195
202
  alt: "",
196
203
  institutionGuid: i.institutionGuid,
197
204
  logoUrl: i.institutionGuid ? void 0 : T,
@@ -202,14 +209,14 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
202
209
  flexGrow: 1,
203
210
  minWidth: 0
204
211
  },
205
- children: [/* @__PURE__ */ e(d, {
212
+ children: [/* @__PURE__ */ t(d, {
206
213
  bold: !0,
207
214
  truncate: !0,
208
215
  variant: "body1",
209
216
  children: i.label
210
- }), /* @__PURE__ */ e(d, {
217
+ }), /* @__PURE__ */ t(d, {
211
218
  variant: "body2",
212
- children: g(i.amount, x.cents)
219
+ children: g(i.amount, b.cents)
213
220
  })]
214
221
  }),
215
222
  i.percentage !== null && /* @__PURE__ */ n(d, {
@@ -226,29 +233,29 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
226
233
  gap: 4,
227
234
  mt: 16
228
235
  },
229
- children: [/* @__PURE__ */ e(k, {
236
+ children: [/* @__PURE__ */ t(k, {
230
237
  name: "info",
231
238
  size: 14,
232
239
  sx: { color: "text.secondary" }
233
- }), /* @__PURE__ */ e(d, {
240
+ }), /* @__PURE__ */ t(d, {
234
241
  color: "text.secondary",
235
242
  variant: "caption",
236
- children: t.credit_limit_not_shared
243
+ children: e.credit_limit_not_shared
237
244
  })]
238
245
  }),
239
- /* @__PURE__ */ e(E, { card: i })
246
+ /* @__PURE__ */ t(B, { card: i })
240
247
  ]
241
248
  })
242
- }), N = (o) => {
249
+ }), C = (o) => {
243
250
  const i = /* @__PURE__ */ new Map();
244
- return o.map((t) => {
245
- const r = (i.get(t.guid) ?? 0) + 1;
246
- return i.set(t.guid, r), {
247
- card: t,
248
- key: r === 1 ? t.guid : `${t.guid}-${r}`
251
+ return o.map((e) => {
252
+ const a = (i.get(e.guid) ?? 0) + 1;
253
+ return i.set(e.guid, a), {
254
+ card: e,
255
+ key: a === 1 ? e.guid : `${e.guid}-${a}`
249
256
  };
250
257
  });
251
- }, J = ({ accountDetailsLabel: o, cards: i, copy: t, onCardClick: r, summary: m }) => /* @__PURE__ */ n(l, {
258
+ }, J = ({ accountDetailsLabel: o, cards: i, copy: e, onCardClick: a, summary: m }) => /* @__PURE__ */ n(l, {
252
259
  sx: {
253
260
  bgcolor: "background.default",
254
261
  minHeight: "100%"
@@ -259,15 +266,22 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
259
266
  p: 24
260
267
  },
261
268
  children: [
262
- /* @__PURE__ */ e(b, { children: t.what_does_this_mean }),
263
- /* @__PURE__ */ e(U, { copy: t }),
264
- /* @__PURE__ */ e(B, {
265
- copy: t,
269
+ /* @__PURE__ */ t(x, { children: e.what_does_this_mean }),
270
+ /* @__PURE__ */ t(U, { copy: e }),
271
+ /* @__PURE__ */ t(y, {
272
+ copy: e,
266
273
  percentage: m?.percentage
267
274
  }),
268
- /* @__PURE__ */ e(L, {
275
+ /* @__PURE__ */ t(L, {
269
276
  icon: S,
270
- message: /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: w(t.tip || t.recommendation) } }),
277
+ message: /* @__PURE__ */ t(r, {
278
+ component: "span",
279
+ dangerouslySetInnerHTML: { __html: w(e.tip || e.recommendation) },
280
+ sx: {
281
+ "& b": { fontWeight: 600 },
282
+ "& b:first-of-type": { fontWeight: 700 }
283
+ }
284
+ }),
271
285
  sx: {
272
286
  mb: 0,
273
287
  mt: 24,
@@ -281,21 +295,21 @@ var _ = (o) => o.vars?.overlays?.[1] ?? "none", c = 20, D = "30%", b = ({ childr
281
295
  borderTopColor: "divider",
282
296
  p: 24
283
297
  },
284
- children: [/* @__PURE__ */ e(b, { children: t.your_cards || t.per_card_header }), /* @__PURE__ */ e(l, {
298
+ children: [/* @__PURE__ */ t(x, { children: e.your_cards || e.per_card_header }), /* @__PURE__ */ t(l, {
285
299
  component: "ul",
286
300
  role: "list",
287
301
  sx: {
288
- gap: 16,
302
+ gap: 24,
289
303
  listStyle: "none",
290
304
  m: 0,
291
305
  p: 0
292
306
  },
293
- children: N(i).map(({ card: s, key: u }) => /* @__PURE__ */ e(H, {
307
+ children: C(i).map(({ card: s, key: p }) => /* @__PURE__ */ t(W, {
294
308
  accountDetailsLabel: o,
295
309
  card: s,
296
- copy: t,
297
- onClick: r && s.accountLoaded ? () => r(s) : void 0
298
- }, u))
310
+ copy: e,
311
+ onClick: a && s.accountLoaded ? () => a(s) : void 0
312
+ }, p))
299
313
  })]
300
314
  })]
301
315
  });
@@ -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 ButtonBase from '@mui/material/ButtonBase'\nimport Stack from '@mui/material/Stack'\nimport { useTheme, type Theme } 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 { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { sanitizeHtml } from '../../../core/utils/SanitizeHtml'\nimport { TipSection } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\nimport { ELEVATION_SHADOW } from '../../components/shared/elevation'\n\nimport {\n getLegendPosition,\n getUtilizationBand,\n RECOMMENDED_MAX_PERCENT,\n UTILIZATION_BANDS,\n type CreditCardRow,\n type CreditUtilizationSummary,\n} from './layout'\n\nexport interface CreditUtilizationCard extends CreditCardRow {\n accountLoaded: boolean\n institutionGuid: string\n}\n\nexport interface CreditUtilizationContentProps {\n summary?: CreditUtilizationSummary\n cards: CreditUtilizationCard[]\n copy: CreditUtilizationCopy\n onCardClick?: (card: CreditUtilizationCard) => void\n accountDetailsLabel?: string\n}\n\nconst darkOverlay = (theme: Theme) => theme.vars?.overlays?.[1] ?? 'none'\n\nconst MARKER_SIZE = 20\nconst THRESHOLD_LABEL = `${RECOMMENDED_MAX_PERCENT}%`\n\nconst SectionHeading = ({ children }: { children: string }) => (\n <Text bold={true} component=\"h3\" sx={{ mb: 12 }} variant=\"body1\">\n {children}\n </Text>\n)\n\nconst Definition = ({ definition, term }: { definition: string; term?: string }) => (\n <Box\n component=\"li\"\n sx={{\n backgroundImage: darkOverlay,\n bgcolor: 'background.default',\n borderRadius: '8px',\n px: 8,\n py: 6,\n }}\n >\n <Text component=\"p\" variant=\"body2\">\n {term && <b>{term} </b>}\n {definition}\n </Text>\n </Box>\n)\n\nconst Definitions = ({ copy }: { copy: CreditUtilizationCopy }) => {\n const rows =\n copy.ratio_definition && copy.utilization_definition\n ? [\n { definition: copy.ratio_definition, term: copy.ratio_term },\n { definition: copy.utilization_definition, term: copy.utilization_term },\n ]\n : [{ definition: copy.ratio_explanation }]\n\n return (\n <Stack component=\"ul\" role=\"list\" sx={{ gap: 12, listStyle: 'none', m: 0, p: 0 }}>\n {rows.map((row) => (\n <Definition key={row.definition} {...row} />\n ))}\n </Stack>\n )\n}\n\nconst Legend = ({ copy, percentage }: { copy: CreditUtilizationCopy; percentage?: number }) => {\n const theme = useTheme()\n const last = UTILIZATION_BANDS.length - 1\n const band = percentage === undefined ? undefined : getUtilizationBand(percentage)\n\n return (\n <Box sx={{ mt: 24, position: 'relative' }}>\n {band && percentage !== undefined && (\n <Box\n aria-label={`${percentage}% ${copy[band.band]}`}\n role=\"img\"\n sx={{\n bgcolor: 'background.paper',\n border: '4px solid',\n borderColor: band.color(theme),\n borderRadius: '50%',\n height: MARKER_SIZE,\n left: `clamp(0px, calc(${getLegendPosition(percentage)}% - ${MARKER_SIZE / 2}px), calc(100% - ${MARKER_SIZE}px))`,\n position: 'absolute',\n top: -4,\n width: MARKER_SIZE,\n }}\n />\n )}\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, p: 0 }}\n >\n {UTILIZATION_BANDS.map(({ band: name, color, range }, index) => (\n <Box component=\"li\" key={name} 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[name]}\n </Text>\n </Box>\n ))}\n </Stack>\n </Box>\n )\n}\n\nconst UtilizationBar = ({ card: { label, percentage } }: { card: CreditUtilizationCard }) => {\n const theme = useTheme()\n\n if (percentage === null) return null\n\n return (\n <Box sx={{ mt: 16 }}>\n <Box\n aria-label={label}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={percentage}\n aria-valuetext={`${percentage}%`}\n role=\"meter\"\n sx={{ bgcolor: 'divider', borderRadius: 999, height: 8, overflow: 'hidden' }}\n >\n <Box\n sx={{\n bgcolor: getUtilizationBand(percentage).color(theme),\n borderRadius: 999,\n height: '100%',\n width: `${percentage}%`,\n }}\n />\n </Box>\n <Stack\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n ml: `${RECOMMENDED_MAX_PERCENT}%`,\n transform: 'translateX(-50%)',\n width: 'max-content',\n }}\n >\n <Box sx={{ bgcolor: 'divider', height: 6, width: '1px' }} />\n <Text variant=\"caption\">{THRESHOLD_LABEL}</Text>\n </Stack>\n </Box>\n )\n}\n\nconst cardButtonLabel = (card: CreditUtilizationCard, accountDetailsLabel?: string) =>\n [\n card.label,\n formatCurrency(card.amount, CURRENCY_FORMAT.cents),\n card.percentage === null ? undefined : `${card.percentage}%`,\n accountDetailsLabel,\n ]\n .filter(Boolean)\n .join(', ')\n\nconst CardUtilization = ({\n accountDetailsLabel,\n card,\n copy,\n onClick,\n}: {\n accountDetailsLabel?: string\n card: CreditUtilizationCard\n copy: CreditUtilizationCopy\n onClick?: () => void\n}) => (\n <Box component=\"li\">\n <Box\n {...(onClick && {\n 'aria-haspopup': 'dialog',\n 'aria-label': cardButtonLabel(card, accountDetailsLabel),\n component: ButtonBase,\n onClick,\n })}\n sx={{\n backgroundImage: darkOverlay,\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n display: 'block',\n p: 16,\n textAlign: 'left',\n width: '100%',\n ...(onClick && {\n '&:hover': { bgcolor: 'action.hover' },\n '&.Mui-focusVisible': { bgcolor: 'action.focus' },\n }),\n }}\n >\n <Stack sx={{ alignItems: 'flex-start', 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, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {card.label}\n </Text>\n <Text variant=\"body2\">{formatCurrency(card.amount, CURRENCY_FORMAT.cents)}</Text>\n </Stack>\n {card.percentage !== null && (\n <Text bold={true} variant=\"body1\">\n {card.percentage}%\n </Text>\n )}\n </Stack>\n {card.percentage === null && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4, mt: 16 }}>\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 <UtilizationBar card={card} />\n </Box>\n </Box>\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 accountDetailsLabel,\n cards,\n copy,\n onCardClick,\n summary,\n}: CreditUtilizationContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', minHeight: '100%' }}>\n <Stack sx={{ bgcolor: 'background.paper', p: 24 }}>\n <SectionHeading>{copy.what_does_this_mean}</SectionHeading>\n <Definitions copy={copy} />\n <Legend copy={copy} percentage={summary?.percentage} />\n <TipSection\n icon={DRAWER_TIP_ICON}\n message={\n <span\n dangerouslySetInnerHTML={{ __html: sanitizeHtml(copy.tip || copy.recommendation) }}\n />\n }\n sx={{ mb: 0, mt: 24, mx: 0 }}\n />\n </Stack>\n {cards.length > 0 && (\n <Stack sx={{ borderTop: '1px solid', borderTopColor: 'divider', p: 24 }}>\n <SectionHeading>{copy.your_cards || 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\n accountDetailsLabel={accountDetailsLabel}\n card={card}\n copy={copy}\n key={key}\n onClick={onCardClick && card.accountLoaded ? () => onCardClick(card) : undefined}\n />\n ))}\n </Stack>\n </Stack>\n )}\n </Stack>\n)\n\nexport default CreditUtilizationContent\n"],"mappings":";;;;;;;;;;;;;AAqCA,IAAM,IAAA,CAAe,MAAiB,EAAM,MAAM,WAAW,CAAA,KAAM,QAE7D,IAAc,IACd,IAAkB,OAElB,IAAA,CAAkB,EAAE,UAAA,EAAA,MACxB,gBAAA,EAAC,GAAD;AAAA,EAAM,MAAM;AAAA,EAAM,WAAU;AAAA,EAAK,IAAI,EAAE,IAAI,GAAG;AAAA,EAAG,SAAQ;AAAA,EACtD,UAAA;AACG,CAAA,GAGF,IAAA,CAAc,EAAE,YAAA,GAAY,MAAA,EAAA,MAChC,gBAAA,EAAC,GAAD;AAAA,EACE,WAAU;AAAA,EACV,IAAI;AAAA,IACF,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,WAAU;AAAA,IAAI,SAAQ;AAAA,IAA5B,UAAA,CACG,KAAQ,gBAAA,EAAC,KAAD,EAAA,UAAA,CAAI,GAAK,GAAI,EAAA,CAAA,GACrB,CACG;AAAA;AACH,CAAA,GAGD,IAAA,CAAe,EAAE,MAAA,EAAA,MAA4C;AACjE,QAAM,I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AA,EAAC,QAAD,EACE,yBAAyB,EAAE,QAAQ,EAAa,EAAK,OAAO,EAAK,cAAc,EAAE,EAClF,CAAA;AAAA,QAEH,IAAI;AAAA,UAAE,IAAI;AAAA,UAAG,IAAI;AAAA,UAAI,IAAI;AAAA,QAAE;AAAA,MAC5B,CAAA;AAAA,IACI;AAAA,EACN,CAAA,GAAA,EAAM,SAAS,KACd,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,WAAW;AAAA,MAAa,gBAAgB;AAAA,MAAW,GAAG;AAAA,IAAG;AAAA,IAAtE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAiB,EAAK,cAAc,EAAK,gBAAgC,CAAA,GACzE,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,QACuB,qBAAA;AAAA,QACf,MAAA;AAAA,QACA,MAAA;AAAA,QAEN,SAAS,KAAe,EAAK,gBAAA,MAAsB,EAAY,CAAI,IAAI;AAAA,MACxE,GAFM,CAEN,CACF;AAAA,IACI,CAAA,CACF;AAAA,EAEJ,CAAA,CAAA"}
1
+ {"version":3,"file":"CreditUtilizationContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Stack from '@mui/material/Stack'\nimport { useTheme, type Theme } 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 { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { sanitizeHtml } from '../../../core/utils/SanitizeHtml'\nimport { TipSection } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\nimport { ELEVATION_SHADOW } from '../../components/shared/elevation'\n\nimport {\n getLegendPosition,\n getUtilizationBand,\n RECOMMENDED_MAX_PERCENT,\n UTILIZATION_BANDS,\n type CreditCardRow,\n type CreditUtilizationSummary,\n} from './layout'\n\nexport interface CreditUtilizationCard extends CreditCardRow {\n accountLoaded: boolean\n institutionGuid: string\n}\n\nexport interface CreditUtilizationContentProps {\n summary?: CreditUtilizationSummary\n cards: CreditUtilizationCard[]\n copy: CreditUtilizationCopy\n onCardClick?: (card: CreditUtilizationCard) => void\n accountDetailsLabel?: string\n}\n\nconst darkOverlay = (theme: Theme) => theme.vars?.overlays?.[1] ?? 'none'\n\nconst MARKER_SIZE = 20\nconst THRESHOLD_LABEL = `${RECOMMENDED_MAX_PERCENT}%`\n\nconst SectionHeading = ({ children }: { children: string }) => (\n <Text bold={true} component=\"h3\" sx={{ mb: 12 }} variant=\"body1\">\n {children}\n </Text>\n)\n\nconst Definition = ({ definition, term }: { definition: string; term?: string }) => (\n <Box\n component=\"li\"\n sx={{\n backgroundImage: darkOverlay,\n bgcolor: 'background.default',\n borderRadius: '8px',\n p: 8,\n }}\n >\n <Text color=\"text.secondary\" component=\"p\" variant=\"subtitle2\">\n {term && (\n <Box component=\"b\" sx={{ color: 'text.primary' }}>\n {term}{' '}\n </Box>\n )}\n {definition}\n </Text>\n </Box>\n)\n\nconst Definitions = ({ copy }: { copy: CreditUtilizationCopy }) => {\n const rows =\n copy.ratio_definition && copy.utilization_definition\n ? [\n { definition: copy.ratio_definition, term: copy.ratio_term },\n { definition: copy.utilization_definition, term: copy.utilization_term },\n ]\n : [{ definition: copy.ratio_explanation }]\n\n return (\n <Stack component=\"ul\" role=\"list\" sx={{ gap: 12, listStyle: 'none', m: 0, p: 0 }}>\n {rows.map((row) => (\n <Definition key={row.definition} {...row} />\n ))}\n </Stack>\n )\n}\n\nconst Legend = ({ copy, percentage }: { copy: CreditUtilizationCopy; percentage?: number }) => {\n const theme = useTheme()\n const last = UTILIZATION_BANDS.length - 1\n const band = percentage === undefined ? undefined : getUtilizationBand(percentage)\n\n return (\n <Box sx={{ mt: 24, position: 'relative' }}>\n {band && percentage !== undefined && (\n <Box\n aria-label={`${percentage}% ${copy[band.band]}`}\n role=\"img\"\n sx={{\n bgcolor: 'background.paper',\n border: '4px solid',\n borderColor: band.color(theme),\n borderRadius: '50%',\n height: MARKER_SIZE,\n left: `clamp(0px, calc(${getLegendPosition(percentage)}% - ${MARKER_SIZE / 2}px), calc(100% - ${MARKER_SIZE}px))`,\n position: 'absolute',\n top: -4,\n width: MARKER_SIZE,\n }}\n />\n )}\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, p: 0 }}\n >\n {UTILIZATION_BANDS.map(({ band: name, color, range }, index) => (\n <Box component=\"li\" key={name} sx={{ flex: 1, minWidth: 0, overflowWrap: 'anywhere' }}>\n <Box\n aria-hidden={true}\n sx={{\n bgcolor: color(theme),\n borderRadius:\n index === 0 ? '99px 0 0 99px' : index === last ? '0 99px 99px 0' : undefined,\n height: 12,\n mb: 8,\n }}\n />\n <Text component=\"p\" sx={{ fontWeight: 700 }} variant=\"tiny\">\n {range}\n </Text>\n <Text color=\"text.secondary\" component=\"p\" variant=\"tiny\">\n {copy[name]}\n </Text>\n </Box>\n ))}\n </Stack>\n </Box>\n )\n}\n\nconst UtilizationBar = ({ card: { label, percentage } }: { card: CreditUtilizationCard }) => {\n const theme = useTheme()\n\n if (percentage === null) return null\n\n return (\n <Box sx={{ mt: 16 }}>\n <Box\n aria-label={label}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={percentage}\n aria-valuetext={`${percentage}%`}\n role=\"meter\"\n sx={{ bgcolor: 'divider', borderRadius: '4px', height: 12, overflow: 'hidden' }}\n >\n <Box\n sx={{\n bgcolor: getUtilizationBand(percentage).color(theme),\n borderRadius: '4px',\n height: '100%',\n width: `${percentage}%`,\n }}\n />\n </Box>\n <Stack\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n ml: `${RECOMMENDED_MAX_PERCENT}%`,\n transform: 'translateX(-50%)',\n width: 'max-content',\n }}\n >\n <Box sx={{ bgcolor: 'divider', height: 6, width: '1px' }} />\n <Text variant=\"caption\">{THRESHOLD_LABEL}</Text>\n </Stack>\n </Box>\n )\n}\n\nconst cardButtonLabel = (card: CreditUtilizationCard, accountDetailsLabel?: string) =>\n [\n card.label,\n formatCurrency(card.amount, CURRENCY_FORMAT.cents),\n card.percentage === null ? undefined : `${card.percentage}%`,\n accountDetailsLabel,\n ]\n .filter(Boolean)\n .join(', ')\n\nconst CardUtilization = ({\n accountDetailsLabel,\n card,\n copy,\n onClick,\n}: {\n accountDetailsLabel?: string\n card: CreditUtilizationCard\n copy: CreditUtilizationCopy\n onClick?: () => void\n}) => (\n <Box component=\"li\">\n <Box\n {...(onClick && {\n 'aria-haspopup': 'dialog',\n 'aria-label': cardButtonLabel(card, accountDetailsLabel),\n component: ButtonBase,\n onClick,\n })}\n sx={{\n backgroundImage: darkOverlay,\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n display: 'block',\n pb: 8,\n pt: 16,\n px: 16,\n textAlign: 'left',\n width: '100%',\n ...(onClick && {\n '&:hover': { bgcolor: 'action.hover' },\n '&.Mui-focusVisible': { bgcolor: 'action.focus' },\n }),\n }}\n >\n <Stack sx={{ alignItems: 'flex-start', 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, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {card.label}\n </Text>\n <Text variant=\"body2\">{formatCurrency(card.amount, CURRENCY_FORMAT.cents)}</Text>\n </Stack>\n {card.percentage !== null && (\n <Text bold={true} variant=\"body1\">\n {card.percentage}%\n </Text>\n )}\n </Stack>\n {card.percentage === null && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4, mt: 16 }}>\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 <UtilizationBar card={card} />\n </Box>\n </Box>\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 accountDetailsLabel,\n cards,\n copy,\n onCardClick,\n summary,\n}: CreditUtilizationContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', minHeight: '100%' }}>\n <Stack sx={{ bgcolor: 'background.paper', p: 24 }}>\n <SectionHeading>{copy.what_does_this_mean}</SectionHeading>\n <Definitions copy={copy} />\n <Legend copy={copy} percentage={summary?.percentage} />\n <TipSection\n icon={DRAWER_TIP_ICON}\n message={\n <Box\n component=\"span\"\n dangerouslySetInnerHTML={{ __html: sanitizeHtml(copy.tip || copy.recommendation) }}\n // Figma: \"Tip:\" Bold, the other emphasised phrases SemiBold.\n sx={{ '& b': { fontWeight: 600 }, '& b:first-of-type': { fontWeight: 700 } }}\n />\n }\n sx={{ mb: 0, mt: 24, mx: 0 }}\n />\n </Stack>\n {cards.length > 0 && (\n <Stack sx={{ borderTop: '1px solid', borderTopColor: 'divider', p: 24 }}>\n <SectionHeading>{copy.your_cards || copy.per_card_header}</SectionHeading>\n <Stack component=\"ul\" role=\"list\" sx={{ gap: 24, listStyle: 'none', m: 0, p: 0 }}>\n {keyedCards(cards).map(({ card, key }) => (\n <CardUtilization\n accountDetailsLabel={accountDetailsLabel}\n card={card}\n copy={copy}\n key={key}\n onClick={onCardClick && card.accountLoaded ? () => onCardClick(card) : undefined}\n />\n ))}\n </Stack>\n </Stack>\n )}\n </Stack>\n)\n\nexport default CreditUtilizationContent\n"],"mappings":";;;;;;;;;;;;;AAqCA,IAAM,IAAA,CAAe,MAAiB,EAAM,MAAM,WAAW,CAAA,KAAM,QAE7D,IAAc,IACd,IAAkB,OAElB,IAAA,CAAkB,EAAE,UAAA,EAAA,MACxB,gBAAA,EAAC,GAAD;AAAA,EAAM,MAAM;AAAA,EAAM,WAAU;AAAA,EAAK,IAAI,EAAE,IAAI,GAAG;AAAA,EAAG,SAAQ;AAAA,EACtD,UAAA;AACG,CAAA,GAGF,IAAA,CAAc,EAAE,YAAA,GAAY,MAAA,EAAA,MAChC,gBAAA,EAAC,GAAD;AAAA,EACE,WAAU;AAAA,EACV,IAAI;AAAA,IACF,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,GAAG;AAAA,EACL;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAI,SAAQ;AAAA,IAAnD,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,MAAK,WAAU;AAAA,MAAI,IAAI,EAAE,OAAO,eAAe;AAAA,MAA/C,UAAA,CACG,GAAM,GACJ;AAAA,IAEN,CAAA,GAAA,CACG;AAAA;AACH,CAAA,GAGD,IAAA,CAAe,EAAE,MAAA,EAAA,MAA4C;AACjE,QAAM,IACJ,EAAK,oBAAoB,EAAK,yBAC1B,CACE;AAAA,IAAE,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MAAM;AAAA,QACN,SACE,gBAAA,EAAC,GAAD;AAAA,UACE,WAAU;AAAA,UACV,yBAAyB,EAAE,QAAQ,EAAa,EAAK,OAAO,EAAK,cAAc,EAAE;AAAA,UAEjF,IAAI;AAAA,YAAE,OAAO,EAAE,YAAY,IAAI;AAAA,YAAG,qBAAqB,EAAE,YAAY,IAAI;AAAA,UAAE;AAAA,QAC5E,CAAA;AAAA,QAEH,IAAI;AAAA,UAAE,IAAI;AAAA,UAAG,IAAI;AAAA,UAAI,IAAI;AAAA,QAAE;AAAA,MAC5B,CAAA;AAAA,IACI;AAAA,EACN,CAAA,GAAA,EAAM,SAAS,KACd,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,WAAW;AAAA,MAAa,gBAAgB;AAAA,MAAW,GAAG;AAAA,IAAG;AAAA,IAAtE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAiB,EAAK,cAAc,EAAK,gBAAgC,CAAA,GACzE,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,QACuB,qBAAA;AAAA,QACf,MAAA;AAAA,QACA,MAAA;AAAA,QAEN,SAAS,KAAe,EAAK,gBAAA,MAAsB,EAAY,CAAI,IAAI;AAAA,MACxE,GAFM,CAEN,CACF;AAAA,IACI,CAAA,CACF;AAAA,EAEJ,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Theme } from '@mui/material/styles';
2
- import { DataSeries } from '../../../core';
2
+ import { DataSeries, DrilldownData } from '../../../core';
3
3
  import { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData';
4
4
  export type UtilizationBand = 'excellent' | 'good' | 'fair' | 'needs_work';
5
5
  export interface UtilizationBandSpec {
@@ -29,6 +29,10 @@ export interface CreditCardRow {
29
29
  limit: number | null;
30
30
  percentage: number | null;
31
31
  }
32
+ /** The drawer's facts: the opening CTA's `drilldown_data` (Insights 2.0), else the legacy `instance_slot_data`. */
33
+ export declare const readDrawerFacts: (cta: {
34
+ drilldown_data?: DrilldownData;
35
+ } | undefined, legacy?: InsightsInstanceSlotData) => InsightsInstanceSlotData | undefined;
32
36
  export declare const readSummary: (data?: InsightsInstanceSlotData) => CreditUtilizationSummary | undefined;
33
37
  /** One object per `data` row, keyed by `names` (pulse's `buildDataSeries`). */
34
38
  export declare const readCardRows: (series?: DataSeries | unknown[]) => CreditCardRow[];
@@ -1,70 +1,74 @@
1
- import { asNumber as i } from "../../blocks/slotReaders.es.js";
2
- var d = {
1
+ import { asNumber as c } from "../../blocks/slotReaders.es.js";
2
+ var m = {
3
3
  band: "needs_work",
4
4
  range: ">30%",
5
5
  maxPercent: 1 / 0,
6
- color: (e) => e.palette.error.main
7
- }, c = [
6
+ color: (a) => a.palette.error.main
7
+ }, i = [
8
8
  {
9
9
  band: "excellent",
10
10
  range: "0-10%",
11
11
  maxPercent: 10,
12
- color: (e) => e.palette.success.dark
12
+ color: (a) => a.palette.success.dark
13
13
  },
14
14
  {
15
15
  band: "good",
16
16
  range: "11-20%",
17
17
  maxPercent: 20,
18
- color: (e) => e.palette.success.main
18
+ color: (a) => a.palette.success.main
19
19
  },
20
20
  {
21
21
  band: "fair",
22
22
  range: "21-30%",
23
23
  maxPercent: 30,
24
- color: (e) => e.palette.warning.main
24
+ color: (a) => a.palette.warning.main
25
25
  },
26
- d
27
- ], l = (e) => Math.min(100, Math.max(0, Math.round(e))), p = (e) => c.find(({ maxPercent: t }) => l(e) <= t) ?? d, f = (e) => {
28
- const t = l(e), a = 100 / c.length, n = c.findIndex(({ maxPercent: m }) => t <= m), r = n === 0 ? 0 : c[n - 1].maxPercent, o = Math.min(c[n].maxPercent, 100);
29
- return a * (n + (t - r) / (o - r));
30
- }, b = (e) => {
31
- const t = i(e?.accounts_balance_sum), a = i(e?.accounts_credit_limit_sum), n = i(e?.credit_utilization_percentage);
32
- if (!(t === void 0 || a === void 0 || n === void 0))
26
+ m
27
+ ], l = (a) => Math.min(100, Math.max(0, Math.round(a))), p = (a) => i.find(({ maxPercent: n }) => l(a) <= n) ?? m, v = (a) => {
28
+ const n = l(a), t = 100 / i.length, e = i.findIndex(({ maxPercent: d }) => n <= d), r = e === 0 ? 0 : i[e - 1].maxPercent, o = Math.min(i[e].maxPercent, 100);
29
+ return t * (e + (n - r) / (o - r));
30
+ }, _ = (a, n) => {
31
+ const t = a?.drilldown_data;
32
+ return t !== void 0 && ["accounts_balance_sum", "data_series"].some((e) => t[e] != null) ? t : n;
33
+ }, b = (a) => {
34
+ const n = c(a?.accounts_balance_sum), t = c(a?.accounts_credit_limit_sum), e = c(a?.credit_utilization_percentage);
35
+ if (!(n === void 0 || t === void 0 || e === void 0))
33
36
  return {
34
- balance: t,
35
- limit: a,
36
- percentage: l(n)
37
+ balance: n,
38
+ limit: t,
39
+ percentage: l(e)
37
40
  };
38
- }, v = (e) => {
39
- if (!e || Array.isArray(e) || !e.names || !Array.isArray(e.data)) return [];
40
- const { names: t } = e;
41
- return e.data.flatMap((a) => {
42
- const n = Object.fromEntries(t.map((u, s) => [u, a[s]]));
43
- if (typeof n.guid != "string" || typeof n.label != "string") return [];
44
- const r = i(n.amount) ?? 0, o = i(n.total_amount);
41
+ }, f = (a) => {
42
+ if (!a || Array.isArray(a) || !a.names || !Array.isArray(a.data)) return [];
43
+ const { names: n } = a;
44
+ return a.data.flatMap((t) => {
45
+ const e = Object.fromEntries(n.map((u, s) => [u, t[s]]));
46
+ if (typeof e.guid != "string" || typeof e.label != "string") return [];
47
+ const r = c(e.amount) ?? 0, o = c(e.total_amount);
45
48
  if (o === void 0 || o <= 0) return [{
46
49
  amount: r,
47
- guid: n.guid,
48
- label: n.label,
50
+ guid: e.guid,
51
+ label: e.label,
49
52
  limit: null,
50
53
  percentage: null
51
54
  }];
52
- const m = i(n.percentage) ?? r / o * 100;
55
+ const d = c(e.percentage) ?? r / o * 100;
53
56
  return [{
54
57
  amount: r,
55
- guid: n.guid,
56
- label: n.label,
58
+ guid: e.guid,
59
+ label: e.label,
57
60
  limit: o,
58
- percentage: l(m)
61
+ percentage: l(d)
59
62
  }];
60
63
  });
61
64
  };
62
65
  export {
63
- c as UTILIZATION_BANDS,
64
- f as getLegendPosition,
66
+ i as UTILIZATION_BANDS,
67
+ v as getLegendPosition,
65
68
  p as getUtilizationBand,
66
69
  l as normalizePercent,
67
- v as readCardRows,
70
+ f as readCardRows,
71
+ _ as readDrawerFacts,
68
72
  b as readSummary
69
73
  };
70
74
 
@@ -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'\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.main,\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.dark,\n },\n { band: 'good', range: '11-20%', maxPercent: 20, color: (theme) => theme.palette.success.main },\n { band: 'fair', range: '21-30%', maxPercent: 30, color: (theme) => theme.palette.warning.main },\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 const RECOMMENDED_MAX_PERCENT = 30\n\nexport const getLegendPosition = (percent: number): number => {\n const value = normalizePercent(percent)\n const share = 100 / UTILIZATION_BANDS.length\n const index = UTILIZATION_BANDS.findIndex(({ maxPercent }) => value <= maxPercent)\n const from = index === 0 ? 0 : UTILIZATION_BANDS[index - 1].maxPercent\n const to = Math.min(UTILIZATION_BANDS[index].maxPercent, 100)\n\n return share * (index + (value - from) / (to - from))\n}\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,EAC1C;AAAA,EACA;AAAA,IAAE,MAAM;AAAA,IAAQ,OAAO;AAAA,IAAU,YAAY;AAAA,IAAI,OAAA,CAAQ,MAAU,EAAM,QAAQ,QAAQ;AAAA,EAAK;AAAA,EAC9F;AAAA,IAAE,MAAM;AAAA,IAAQ,OAAO;AAAA,IAAU,YAAY;AAAA,IAAI,OAAA,CAAQ,MAAU,EAAM,QAAQ,QAAQ;AAAA,EAAK;AAAA,EAC9F;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,GAI5E,IAAA,CAAqB,MAA4B;AAC5D,QAAM,IAAQ,EAAiB,CAAO,GAChC,IAAQ,MAAM,EAAkB,QAChC,IAAQ,EAAkB,UAAA,CAAW,EAAE,YAAA,EAAA,MAAiB,KAAS,CAAU,GAC3E,IAAO,MAAU,IAAI,IAAI,EAAkB,IAAQ,CAAA,EAAG,YACtD,IAAK,KAAK,IAAI,EAAkB,CAAA,EAAO,YAAY,GAAG;AAE5D,SAAO,KAAS,KAAS,IAAQ,MAAS,IAAK;AACjD,GAiBa,IAAA,CACX,MACyC;AACzC,QAAM,IAAU,EAAS,GAAM,oBAAoB,GAC7C,IAAQ,EAAS,GAAM,yBAAyB,GAChD,IAAa,EAAS,GAAM,6BAA6B;AAE/D,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,EAAS,EAAI,MAAM,KAAK,GACjC,IAAQ,EAAS,EAAI,YAAY;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
+ {"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, DrilldownData } 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.main,\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.dark,\n },\n { band: 'good', range: '11-20%', maxPercent: 20, color: (theme) => theme.palette.success.main },\n { band: 'fair', range: '21-30%', maxPercent: 30, color: (theme) => theme.palette.warning.main },\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 const RECOMMENDED_MAX_PERCENT = 30\n\nexport const getLegendPosition = (percent: number): number => {\n const value = normalizePercent(percent)\n const share = 100 / UTILIZATION_BANDS.length\n const index = UTILIZATION_BANDS.findIndex(({ maxPercent }) => value <= maxPercent)\n const from = index === 0 ? 0 : UTILIZATION_BANDS[index - 1].maxPercent\n const to = Math.min(UTILIZATION_BANDS[index].maxPercent, 100)\n\n return share * (index + (value - from) / (to - from))\n}\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\n/** The drawer's facts: the opening CTA's `drilldown_data` (Insights 2.0), else the legacy `instance_slot_data`. */\nexport const readDrawerFacts = (\n cta: { drilldown_data?: DrilldownData } | undefined,\n legacy?: InsightsInstanceSlotData,\n): InsightsInstanceSlotData | undefined => {\n const drilldown = cta?.drilldown_data\n const hasFacts =\n drilldown !== undefined &&\n ['accounts_balance_sum', 'data_series'].some((key) => drilldown[key] != null)\n\n return hasFacts ? (drilldown as InsightsInstanceSlotData) : legacy\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;AAA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AAA;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,EAAS,EAAI,MAAM,KAAK,GACjC,IAAQ,EAAS,EAAI,YAAY;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"}
@@ -4,6 +4,8 @@ export declare const donutChartVariant: {
4
4
  readonly DepositSummary: "deposit_summary";
5
5
  /** Credit Card Close to Limit; the embedded card's small donut reuses it. */
6
6
  readonly CreditLimit: "credit_limit";
7
+ /** Credit Utilization: the arc coloured by the utilization in the centre. */
8
+ readonly CreditUtilization: "credit_utilization";
7
9
  };
8
10
  export type DonutChartVariant = (typeof donutChartVariant)[keyof typeof donutChartVariant];
9
11
  /** `remainderOfTotal`: the second arc is what is left of the second legend value after the first. */
@@ -1,27 +1,29 @@
1
- var r = {
1
+ var i = {
2
2
  DepositSummary: "deposit_summary",
3
- CreditLimit: "credit_limit"
4
- }, a = (t) => {
5
- const i = { colors: [t.palette.success.main, t.palette.success.light] }, o = [t.palette.warning.main, t.palette.divider];
3
+ CreditLimit: "credit_limit",
4
+ CreditUtilization: "credit_utilization"
5
+ }, e = (t) => {
6
+ const o = { colors: [t.palette.success.main, t.palette.success.light] }, r = [t.palette.warning.main, t.palette.divider], a = {
7
+ dynamicPrimary: "creditUtilization",
8
+ secondaryColor: t.palette.divider
9
+ };
6
10
  return {
7
- [r.DepositSummary]: i,
8
- [r.CreditLimit]: {
9
- colors: o,
11
+ [i.DepositSummary]: o,
12
+ [i.CreditLimit]: {
13
+ colors: r,
10
14
  arcs: "remainderOfTotal"
11
15
  },
16
+ [i.CreditUtilization]: a,
12
17
  CostOfLivingToIncome: { secondaryColor: t.palette.divider },
13
- MonthlyDepositSummaryV2: i,
18
+ MonthlyDepositSummaryV2: o,
14
19
  MonthlyNonEssentialCategorySummaryV2: { colors: [t.palette.chartMono.chartMono3 ?? t.palette.text.primary, t.palette.chartMono.chartMono5 ?? t.palette.divider] },
15
- CreditCardCloseToLimit: { colors: o },
16
- CreditUtilization: {
17
- dynamicPrimary: "creditUtilization",
18
- secondaryColor: t.palette.divider
19
- }
20
+ CreditCardCloseToLimit: { colors: r },
21
+ CreditUtilization: a
20
22
  };
21
23
  };
22
24
  export {
23
- r as donutChartVariant,
24
- a as getLayoutConfig
25
+ i as donutChartVariant,
26
+ e as getLayoutConfig
25
27
  };
26
28
 
27
29
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\n\n/** Ditto's `donut_chart_block` variants; the template-name keys below are V1 aliases. */\nexport const donutChartVariant = {\n DepositSummary: 'deposit_summary',\n /** Credit Card Close to Limit; the embedded card's small donut reuses it. */\n CreditLimit: 'credit_limit',\n} as const\n\nexport type DonutChartVariant = (typeof donutChartVariant)[keyof typeof donutChartVariant]\n\n/** `remainderOfTotal`: the second arc is what is left of the second legend value after the first. */\ntype DonutArcs = { arcs?: 'remainderOfTotal' }\n\nexport type DonutChartLayoutConfig = DonutArcs &\n (\n | { colors: [string, string] }\n | { secondaryColor: string }\n | { dynamicPrimary: 'creditUtilization'; secondaryColor: string }\n )\n\nexport const getLayoutConfig = (theme: Theme): Record<string, DonutChartLayoutConfig> => {\n const depositSummary: DonutChartLayoutConfig = {\n colors: [theme.palette.success.main, theme.palette.success.light],\n }\n\n const creditLimitColors: [string, string] = [theme.palette.warning.main, theme.palette.divider]\n\n return {\n [donutChartVariant.DepositSummary]: depositSummary,\n // Spending and the rest of the limit, while the legend shows the full limit (pulse Chart.js).\n [donutChartVariant.CreditLimit]: { colors: creditLimitColors, arcs: 'remainderOfTotal' },\n\n // V1 aliases: the template name as the variant.\n CostOfLivingToIncome: {\n secondaryColor: theme.palette.divider,\n },\n MonthlyDepositSummaryV2: depositSummary,\n MonthlyNonEssentialCategorySummaryV2: {\n colors: [\n theme.palette.chartMono.chartMono3 ?? theme.palette.text.primary,\n theme.palette.chartMono.chartMono5 ?? theme.palette.divider,\n ],\n },\n CreditCardCloseToLimit: { colors: creditLimitColors },\n CreditUtilization: {\n dynamicPrimary: 'creditUtilization',\n secondaryColor: theme.palette.divider,\n },\n }\n}\n"],"mappings":"AAGA,IAAa,IAAoB;AAAA,EAC/B,gBAAgB;AAAA,EAEhB,aAAa;AACf,GAca,IAAA,CAAmB,MAAyD;AACvF,QAAM,IAAyC,EAC7C,QAAQ,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,QAAQ,KAAK,EAClE,GAEM,IAAsC,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,OAAO;AAE9F,SAAO;AAAA,IACJ,CAAA,EAAkB,cAAA,GAAiB;AAAA,IAEnC,CAAA,EAAkB,WAAA,GAAc;AAAA,MAAE,QAAQ;AAAA,MAAmB,MAAM;AAAA,IAAmB;AAAA,IAGvF,sBAAsB,EACpB,gBAAgB,EAAM,QAAQ,QAChC;AAAA,IACA,yBAAyB;AAAA,IACzB,sCAAsC,EACpC,QAAQ,CACN,EAAM,QAAQ,UAAU,cAAc,EAAM,QAAQ,KAAK,SACzD,EAAM,QAAQ,UAAU,cAAc,EAAM,QAAQ,OACtD,EACF;AAAA,IACA,wBAAwB,EAAE,QAAQ,EAAkB;AAAA,IACpD,mBAAmB;AAAA,MACjB,gBAAgB;AAAA,MAChB,gBAAgB,EAAM,QAAQ;AAAA,IAChC;AAAA,EACF;AACF"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\n\n/** Ditto's `donut_chart_block` variants; the template-name keys below are V1 aliases. */\nexport const donutChartVariant = {\n DepositSummary: 'deposit_summary',\n /** Credit Card Close to Limit; the embedded card's small donut reuses it. */\n CreditLimit: 'credit_limit',\n /** Credit Utilization: the arc coloured by the utilization in the centre. */\n CreditUtilization: 'credit_utilization',\n} as const\n\nexport type DonutChartVariant = (typeof donutChartVariant)[keyof typeof donutChartVariant]\n\n/** `remainderOfTotal`: the second arc is what is left of the second legend value after the first. */\ntype DonutArcs = { arcs?: 'remainderOfTotal' }\n\nexport type DonutChartLayoutConfig = DonutArcs &\n (\n | { colors: [string, string] }\n | { secondaryColor: string }\n | { dynamicPrimary: 'creditUtilization'; secondaryColor: string }\n )\n\nexport const getLayoutConfig = (theme: Theme): Record<string, DonutChartLayoutConfig> => {\n const depositSummary: DonutChartLayoutConfig = {\n colors: [theme.palette.success.main, theme.palette.success.light],\n }\n\n const creditLimitColors: [string, string] = [theme.palette.warning.main, theme.palette.divider]\n const creditUtilization: DonutChartLayoutConfig = {\n dynamicPrimary: 'creditUtilization',\n secondaryColor: theme.palette.divider,\n }\n\n return {\n [donutChartVariant.DepositSummary]: depositSummary,\n // Spending and the rest of the limit, while the legend shows the full limit (pulse Chart.js).\n [donutChartVariant.CreditLimit]: { colors: creditLimitColors, arcs: 'remainderOfTotal' },\n [donutChartVariant.CreditUtilization]: creditUtilization,\n\n // V1 aliases: the template name as the variant.\n CostOfLivingToIncome: {\n secondaryColor: theme.palette.divider,\n },\n MonthlyDepositSummaryV2: depositSummary,\n MonthlyNonEssentialCategorySummaryV2: {\n colors: [\n theme.palette.chartMono.chartMono3 ?? theme.palette.text.primary,\n theme.palette.chartMono.chartMono5 ?? theme.palette.divider,\n ],\n },\n CreditCardCloseToLimit: { colors: creditLimitColors },\n CreditUtilization: creditUtilization,\n }\n}\n"],"mappings":"AAGA,IAAa,IAAoB;AAAA,EAC/B,gBAAgB;AAAA,EAEhB,aAAa;AAAA,EAEb,mBAAmB;AACrB,GAca,IAAA,CAAmB,MAAyD;AACvF,QAAM,IAAyC,EAC7C,QAAQ,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,QAAQ,KAAK,EAClE,GAEM,IAAsC,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,OAAO,GACxF,IAA4C;AAAA,IAChD,gBAAgB;AAAA,IAChB,gBAAgB,EAAM,QAAQ;AAAA,EAChC;AAEA,SAAO;AAAA,IACJ,CAAA,EAAkB,cAAA,GAAiB;AAAA,IAEnC,CAAA,EAAkB,WAAA,GAAc;AAAA,MAAE,QAAQ;AAAA,MAAmB,MAAM;AAAA,IAAmB;AAAA,IACtF,CAAA,EAAkB,iBAAA,GAAoB;AAAA,IAGvC,sBAAsB,EACpB,gBAAgB,EAAM,QAAQ,QAChC;AAAA,IACA,yBAAyB;AAAA,IACzB,sCAAsC,EACpC,QAAQ,CACN,EAAM,QAAQ,UAAU,cAAc,EAAM,QAAQ,KAAK,SACzD,EAAM,QAAQ,UAAU,cAAc,EAAM,QAAQ,OACtD,EACF;AAAA,IACA,wBAAwB,EAAE,QAAQ,EAAkB;AAAA,IACpD,mBAAmB;AAAA,EACrB;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { useAccountStore as c, useCategoryStore as f, useGlobalCopyStore as u, useGlobalStore as p, useGlobalUiStore as y } from "../common/context/hooks.es.js";
2
2
  import { useWidgetLoadTimer as g } from "../common/hooks/useWidgetLoadTimer.es.js";
3
- import h from "../common/components/MiniWidgetContainer.es.js";
4
- import b from "../common/components/Loader.es.js";
3
+ import b from "../common/components/MiniWidgetContainer.es.js";
4
+ import h from "../common/components/Loader.es.js";
5
5
  import x from "./components/SpendingChart.es.js";
6
6
  import n from "react";
7
7
  import { observer as C } from "mobx-react-lite";
@@ -19,7 +19,7 @@ var L = ({ onPrimaryCtaClick: l, sx: s }) => {
19
19
  t,
20
20
  e,
21
21
  a
22
- ]), !t || !e || !r ? /* @__PURE__ */ o(b, {}) : /* @__PURE__ */ o(h, {
22
+ ]), !t || !e || !r ? /* @__PURE__ */ o(h, {}) : /* @__PURE__ */ o(b, {
23
23
  contentStyles: {
24
24
  flex: 1,
25
25
  minHeight: 0,
@@ -35,7 +35,6 @@ var L = ({ onPrimaryCtaClick: l, sx: s }) => {
35
35
  sx: {
36
36
  display: "flex",
37
37
  flexDirection: "column",
38
- minWidth: 288,
39
38
  ...s
40
39
  },
41
40
  title: i.mini_title,
@@ -1 +1 @@
1
- {"version":3,"file":"TrendsMiniWidget.es.js","names":[],"sources":["../../src/trends/TrendsMiniWidget.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n MiniWidgetContainer,\n useAccountStore,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalStore,\n useGlobalUiStore,\n useWidgetLoadTimer,\n} from '../common'\nimport { MiniWidgetProps } from '../core'\n\nimport SpendingChart from './components/SpendingChart'\n\nconst TrendsMiniWidget: React.FC<MiniWidgetProps> = ({ onPrimaryCtaClick, sx }) => {\n const { isAccountDataLoaded, loadAccountData } = useAccountStore()\n const { loadMonthlyCategoryTotals, monthlyTotalsLoaded } = useCategoryStore()\n const { isInitialized } = useGlobalStore()\n const { trends: trendsCopy } = useGlobalCopyStore()\n const { selectedAccounts } = useGlobalUiStore()\n\n React.useEffect(() => {\n if (!isAccountDataLoaded) {\n loadAccountData().finally()\n }\n }, [])\n\n useWidgetLoadTimer({\n widgetName: 'TrendsMiniWidget',\n isLoaded: monthlyTotalsLoaded,\n })\n\n React.useEffect(() => {\n if (isInitialized && isAccountDataLoaded) {\n loadMonthlyCategoryTotals(selectedAccounts).finally()\n }\n }, [isAccountDataLoaded, isInitialized, selectedAccounts])\n\n if (!isAccountDataLoaded || !isInitialized || !monthlyTotalsLoaded) {\n return <Loader />\n }\n\n return (\n <MiniWidgetContainer\n contentStyles={{ flex: 1, minHeight: 0, '&:last-child': { pb: 0 } }}\n onPrimaryCtaClick={onPrimaryCtaClick}\n primaryCtaLabel={trendsCopy.primary_cta}\n subTitle={trendsCopy.mini_sub_title}\n heightLimits={{ min: 320, max: 360 }}\n sx={{ display: 'flex', flexDirection: 'column', minWidth: 288, ...sx }}\n title={trendsCopy.mini_title}\n >\n <SpendingChart />\n </MiniWidgetContainer>\n )\n}\n\nexport default observer(TrendsMiniWidget)\n"],"mappings":";;;;;;;;AAiBA,IAAM,IAAA,CAA+C,EAAE,mBAAA,GAAmB,IAAA,EAAA,MAAS;AACjF,QAAM,EAAE,qBAAA,GAAqB,iBAAA,EAAA,IAAoB,EAAgB,GAC3D,EAAE,2BAAA,GAA2B,qBAAA,EAAA,IAAwB,EAAiB,GACtE,EAAE,eAAA,EAAA,IAAkB,EAAe,GACnC,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,kBAAA,EAAA,IAAqB,EAAiB;AAmB9C,SAjBA,EAAM,UAAA,MAAgB;AACpB,IAAK,KACH,EAAgB,EAAE,QAAQ;AAAA,EAE9B,GAAG,CAAC,CAAC,GAEL,EAAmB;AAAA,IACjB,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC,GAED,EAAM,UAAA,MAAgB;AACpB,IAAI,KAAiB,KACnB,EAA0B,CAAgB,EAAE,QAAQ;AAAA,EAExD,GAAG;AAAA,IAAC;AAAA,IAAqB;AAAA,IAAe;AAAA,EAAgB,CAAC,GAErD,CAAC,KAAuB,CAAC,KAAiB,CAAC,IACtC,gBAAA,EAAC,GAAD,CAAS,CAAA,IAIhB,gBAAA,EAAC,GAAD;AAAA,IACE,eAAe;AAAA,MAAE,MAAM;AAAA,MAAG,WAAW;AAAA,MAAG,gBAAgB,EAAE,IAAI,EAAE;AAAA,IAAE;AAAA,IAC/C,mBAAA;AAAA,IACnB,iBAAiB,EAAW;AAAA,IAC5B,UAAU,EAAW;AAAA,IACrB,cAAc;AAAA,MAAE,KAAK;AAAA,MAAK,KAAK;AAAA,IAAI;AAAA,IACnC,IAAI;AAAA,MAAE,SAAS;AAAA,MAAQ,eAAe;AAAA,MAAU,UAAU;AAAA,MAAK,GAAG;AAAA,IAAG;AAAA,IACrE,OAAO,EAAW;AAAA,IAElB,UAAA,gBAAA,EAAC,GAAD,CAAgB,CAAA;AAAA,EACG,CAAA;AAEzB,GAEA,IAAe,EAAS,CAAgB"}
1
+ {"version":3,"file":"TrendsMiniWidget.es.js","names":[],"sources":["../../src/trends/TrendsMiniWidget.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n MiniWidgetContainer,\n useAccountStore,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalStore,\n useGlobalUiStore,\n useWidgetLoadTimer,\n} from '../common'\nimport { MiniWidgetProps } from '../core'\n\nimport SpendingChart from './components/SpendingChart'\n\nconst TrendsMiniWidget: React.FC<MiniWidgetProps> = ({ onPrimaryCtaClick, sx }) => {\n const { isAccountDataLoaded, loadAccountData } = useAccountStore()\n const { loadMonthlyCategoryTotals, monthlyTotalsLoaded } = useCategoryStore()\n const { isInitialized } = useGlobalStore()\n const { trends: trendsCopy } = useGlobalCopyStore()\n const { selectedAccounts } = useGlobalUiStore()\n\n React.useEffect(() => {\n if (!isAccountDataLoaded) {\n loadAccountData().finally()\n }\n }, [])\n\n useWidgetLoadTimer({\n widgetName: 'TrendsMiniWidget',\n isLoaded: monthlyTotalsLoaded,\n })\n\n React.useEffect(() => {\n if (isInitialized && isAccountDataLoaded) {\n loadMonthlyCategoryTotals(selectedAccounts).finally()\n }\n }, [isAccountDataLoaded, isInitialized, selectedAccounts])\n\n if (!isAccountDataLoaded || !isInitialized || !monthlyTotalsLoaded) {\n return <Loader />\n }\n\n return (\n <MiniWidgetContainer\n contentStyles={{ flex: 1, minHeight: 0, '&:last-child': { pb: 0 } }}\n onPrimaryCtaClick={onPrimaryCtaClick}\n primaryCtaLabel={trendsCopy.primary_cta}\n subTitle={trendsCopy.mini_sub_title}\n heightLimits={{ min: 320, max: 360 }}\n sx={{ display: 'flex', flexDirection: 'column', ...sx }}\n title={trendsCopy.mini_title}\n >\n <SpendingChart />\n </MiniWidgetContainer>\n )\n}\n\nexport default observer(TrendsMiniWidget)\n"],"mappings":";;;;;;;;AAiBA,IAAM,IAAA,CAA+C,EAAE,mBAAA,GAAmB,IAAA,EAAA,MAAS;AACjF,QAAM,EAAE,qBAAA,GAAqB,iBAAA,EAAA,IAAoB,EAAgB,GAC3D,EAAE,2BAAA,GAA2B,qBAAA,EAAA,IAAwB,EAAiB,GACtE,EAAE,eAAA,EAAA,IAAkB,EAAe,GACnC,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,kBAAA,EAAA,IAAqB,EAAiB;AAmB9C,SAjBA,EAAM,UAAA,MAAgB;AACpB,IAAK,KACH,EAAgB,EAAE,QAAQ;AAAA,EAE9B,GAAG,CAAC,CAAC,GAEL,EAAmB;AAAA,IACjB,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC,GAED,EAAM,UAAA,MAAgB;AACpB,IAAI,KAAiB,KACnB,EAA0B,CAAgB,EAAE,QAAQ;AAAA,EAExD,GAAG;AAAA,IAAC;AAAA,IAAqB;AAAA,IAAe;AAAA,EAAgB,CAAC,GAErD,CAAC,KAAuB,CAAC,KAAiB,CAAC,IACtC,gBAAA,EAAC,GAAD,CAAS,CAAA,IAIhB,gBAAA,EAAC,GAAD;AAAA,IACE,eAAe;AAAA,MAAE,MAAM;AAAA,MAAG,WAAW;AAAA,MAAG,gBAAgB,EAAE,IAAI,EAAE;AAAA,IAAE;AAAA,IAC/C,mBAAA;AAAA,IACnB,iBAAiB,EAAW;AAAA,IAC5B,UAAU,EAAW;AAAA,IACrB,cAAc;AAAA,MAAE,KAAK;AAAA,MAAK,KAAK;AAAA,IAAI;AAAA,IACnC,IAAI;AAAA,MAAE,SAAS;AAAA,MAAQ,eAAe;AAAA,MAAU,GAAG;AAAA,IAAG;AAAA,IACtD,OAAO,EAAW;AAAA,IAElB,UAAA,gBAAA,EAAC,GAAD,CAAgB,CAAA;AAAA,EACG,CAAA;AAEzB,GAEA,IAAe,EAAS,CAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.192",
3
+ "version": "9.7.194-alpha-ram-cu-1",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",