@mx-cartographer/experiences 9.7.115 → 9.7.117

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 (38) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +75 -72
  3. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  4. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +10 -8
  5. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +103 -80
  6. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +2 -0
  8. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.d.ts +12 -0
  10. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.es.js +34 -0
  11. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.es.js.map +1 -0
  12. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +46 -41
  13. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +15 -13
  15. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.d.ts +1 -7
  17. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +8 -10
  18. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
  19. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.d.ts +13 -17
  20. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js +16 -11
  21. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js.map +1 -1
  22. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.d.ts +6 -2
  23. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js +7 -6
  24. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js.map +1 -1
  25. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +12 -12
  26. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js +4 -4
  27. package/dist/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js +1 -1
  28. package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +4 -4
  29. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +4 -4
  30. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +4 -4
  31. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +8 -8
  32. package/dist/transactions/components/shared/TransactionList.d.ts +2 -0
  33. package/dist/transactions/components/shared/TransactionList.es.js +47 -46
  34. package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
  35. package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +5 -0
  36. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +37 -37
  37. package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
  38. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ import r from "../../components/LogoFromGuid.es.js";
2
+ import i from "@mui/material/Stack";
3
+ import { Text as e } from "@mxenabled/mxui";
4
+ import { jsx as o, jsxs as n } from "react/jsx-runtime";
5
+ var u = ({ transaction: t, institutionGuid: a }) => /* @__PURE__ */ n(i, {
6
+ "data-testid": "transaction-account-subline",
7
+ sx: {
8
+ alignItems: "center",
9
+ flexDirection: "row",
10
+ gap: 4,
11
+ minWidth: 0
12
+ },
13
+ children: [a && /* @__PURE__ */ o(i, {
14
+ "data-testid": "transaction-account-logo",
15
+ sx: { flexShrink: 0 },
16
+ children: /* @__PURE__ */ o(r, {
17
+ logo: {
18
+ alt: t.institutionName ?? t.account,
19
+ guid: a
20
+ },
21
+ size: 16
22
+ })
23
+ }), /* @__PURE__ */ o(e, {
24
+ truncate: !0,
25
+ variant: "caption",
26
+ children: t.account
27
+ })]
28
+ });
29
+ export {
30
+ u as TransactionAccountSubline,
31
+ u as default
32
+ };
33
+
34
+ //# sourceMappingURL=TransactionAccountSubline.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionAccountSubline.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionAccountSubline.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport type { Transaction } from '../../../core'\nimport LogoFromGuid from '../../components/LogoFromGuid'\n\nexport interface TransactionAccountSublineProps {\n transaction: Transaction\n /** The account's institution guid (`INS-…`); omitted, the row shows the name alone. */\n institutionGuid?: string | null\n}\n\n/**\n * A summary-header drawer row's subline (Figma: Drilldown | Replenish Savings): the account's 16px\n * institution logo and its name in caption, 4px apart, instead of the category.\n */\nexport const TransactionAccountSubline = ({\n transaction,\n institutionGuid,\n}: TransactionAccountSublineProps) => (\n <Stack\n data-testid=\"transaction-account-subline\"\n sx={{ alignItems: 'center', flexDirection: 'row', gap: 4, minWidth: 0 }}\n >\n {institutionGuid && (\n <Stack data-testid=\"transaction-account-logo\" sx={{ flexShrink: 0 }}>\n <LogoFromGuid\n logo={{ alt: transaction.institutionName ?? transaction.account, guid: institutionGuid }}\n size={16}\n />\n </Stack>\n )}\n <Text truncate={true} variant=\"caption\">\n {transaction.account}\n </Text>\n </Stack>\n)\n\nexport default TransactionAccountSubline\n"],"mappings":";;;;AAiBA,IAAa,IAAA,CAA6B,EACxC,aAAA,GACA,iBAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,eAAe;AAAA,IAAO,KAAK;AAAA,IAAG,UAAU;AAAA,EAAE;AAAA,EAFxE,UAAA,CAIG,KACC,gBAAA,EAAC,GAAD;AAAA,IAAO,eAAY;AAAA,IAA2B,IAAI,EAAE,YAAY,EAAE;AAAA,IAChE,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QAAE,KAAK,EAAY,mBAAmB,EAAY;AAAA,QAAS,MAAM;AAAA,MAAgB;AAAA,MACvF,MAAM;AAAA,IACP,CAAA;AAAA,EACI,CAAA,GAET,gBAAA,EAAC,GAAD;AAAA,IAAM,UAAU;AAAA,IAAM,SAAQ;AAAA,IAC3B,UAAA,EAAY;AAAA,EACT,CAAA,CACD"}
@@ -1,62 +1,67 @@
1
- import { useGlobalCopyStore as b, useInsightsV2Store as M, useTransactionStore as j } from "../../../common/context/hooks.es.js";
2
- import u from "../../../common/components/drawer/Drawer.es.js";
3
- import x from "../../../transactions/components/shared/TransactionList.es.js";
4
- import { selectTransactionsByGuids as A } from "../../CommonUtils.es.js";
5
- import { getDynamicCtaBasedOnTriggers as G } from "../util.es.js";
6
- import { TransactionDetailsBlock as I } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
7
- import { HelpBlock as F } from "../HelpBlock/HelpBlock.es.js";
8
- import { readHelpHeader as R, readSummary as $ } from "./layout.es.js";
9
- import { TransactionListHelpHeader as z } from "./TransactionListHelpHeader.es.js";
10
- import { TransactionListSummaryCard as V } from "./TransactionListSummaryCard.es.js";
11
- import _ from "react";
12
- import { observer as q } from "mobx-react-lite";
13
- import { Fragment as E, jsx as a, jsxs as J } from "react/jsx-runtime";
14
- var K = (o) => Array.isArray(o) && o.every((t) => typeof t == "string"), N = (o, t) => {
15
- const n = o.insights_payload?.drilldown_data, i = o.insights_payload?.instance_slot_data ?? {}, [e, s] = t && Object.hasOwn(t, "transaction_guids") ? ["cta.drilldown_data", t.transaction_guids] : n && Object.hasOwn(n, "transaction_guids") ? ["drilldown_data", n.transaction_guids] : ["instance_slot_data", i.transaction_guids];
1
+ import { useAccountStore as I, useGlobalCopyStore as R, useInsightsV2Store as x, useTransactionStore as j } from "../../../common/context/hooks.es.js";
2
+ import _ from "../../../common/components/drawer/Drawer.es.js";
3
+ import G from "../../../transactions/components/shared/TransactionList.es.js";
4
+ import { selectTransactionsByGuids as N } from "../../CommonUtils.es.js";
5
+ import { getDynamicCtaBasedOnTriggers as E } from "../util.es.js";
6
+ import { TransactionDetailsBlock as F } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
7
+ import { HelpBlock as V } from "../HelpBlock/HelpBlock.es.js";
8
+ import { TRANSACTION_LIST_VARIANTS as $, readHelpHeader as z, readSummary as U } from "./layout.es.js";
9
+ import { TransactionAccountSubline as Y } from "./TransactionAccountSubline.es.js";
10
+ import { TransactionListHelpHeader as q } from "./TransactionListHelpHeader.es.js";
11
+ import { TransactionListSummaryCard as J } from "./TransactionListSummaryCard.es.js";
12
+ import g from "react";
13
+ import { observer as K } from "mobx-react-lite";
14
+ import { Fragment as P, jsx as o, jsxs as Q } from "react/jsx-runtime";
15
+ var W = (n) => Array.isArray(n) && n.every((t) => typeof t == "string"), X = (n, t) => {
16
+ const a = n.insights_payload?.drilldown_data, i = n.insights_payload?.instance_slot_data ?? {}, [l, s] = t && Object.hasOwn(t, "transaction_guids") ? ["cta.drilldown_data", t.transaction_guids] : a && Object.hasOwn(a, "transaction_guids") ? ["drilldown_data", a.transaction_guids] : ["instance_slot_data", i.transaction_guids];
16
17
  if (s != null) {
17
- if (K(s)) return s;
18
- console.warn(`[TransactionListBlock] ${e}.transaction_guids is not a list of guids — listing no transactions.`);
18
+ if (W(s)) return s;
19
+ console.warn(`[TransactionListBlock] ${l}.transaction_guids is not a list of guids — listing no transactions.`);
19
20
  }
20
- }, it = q(function({ beat: t }) {
21
- const { common: n, insights_feed: i } = b(), { actionDrawer: e, setActionContext: s } = M(), g = j(), [f, m] = _.useState(!1), [y, p] = _.useState(!1), { primary_cta: h, secondary_cta: C, in_description_cta: T, is_zero_state: w, drilldown_data: O, title: H } = t.insights_payload ?? {}, l = G(e, h, C, T), c = N(t, l?.drilldown_data), L = A(g.detailedTransactions, c), d = $(l), S = d?.count ?? c?.length ?? 0, v = d !== void 0 && !w && (c?.length ?? 0) > 0, r = R(l, O), k = (D) => {
22
- s({ transaction_guid: D }), m(!0);
23
- }, B = () => {
24
- m(!1), s({ transaction_guid: void 0 });
21
+ }, pt = K(function({ beat: t }) {
22
+ const { common: a, insights_feed: i } = R(), { actionDrawer: l, setActionContext: s } = x(), f = j(), y = I(), [S, u] = g.useState(!1), [T, p] = g.useState(!1), { primary_cta: h, secondary_cta: C, in_description_cta: A, is_zero_state: O, drilldown_data: v, title: w } = t.insights_payload ?? {}, e = E(l, h, C, A), d = X(t, e?.drilldown_data), H = N(f.detailedTransactions, d), m = U(e), L = m?.count ?? d?.length ?? 0, k = m !== void 0 && !O && (d?.length ?? 0) > 0, r = z(e, v), B = e?.variant === $.SUMMARY_HEADER ? (c) => /* @__PURE__ */ o(Y, {
23
+ institutionGuid: y.accounts.find(({ guid: b }) => b === c.account_guid)?.institution_guid,
24
+ transaction: c
25
+ }) : void 0, D = (c) => {
26
+ s({ transaction_guid: c }), u(!0);
27
+ }, M = () => {
28
+ u(!1), s({ transaction_guid: void 0 });
25
29
  };
26
- return /* @__PURE__ */ J(E, { children: [
27
- v && /* @__PURE__ */ a(V, {
30
+ return /* @__PURE__ */ Q(P, { children: [
31
+ k && /* @__PURE__ */ o(J, {
28
32
  copy: i.general,
29
- count: S,
30
- summary: d
33
+ count: L,
34
+ summary: m
31
35
  }),
32
- r && /* @__PURE__ */ a(z, {
36
+ r && /* @__PURE__ */ o(q, {
33
37
  descriptionHtml: r.descriptionHtml,
34
38
  learnMoreLabel: r.learnMore?.label,
35
39
  onLearnMore: () => p(!0),
36
- title: H ?? ""
40
+ title: w ?? ""
37
41
  }),
38
- /* @__PURE__ */ a(x, {
39
- onClick: k,
40
- transaction: L
42
+ /* @__PURE__ */ o(G, {
43
+ onClick: D,
44
+ renderSecondaryText: B,
45
+ transaction: H
41
46
  }),
42
- r?.learnMore && /* @__PURE__ */ a(u, {
43
- ariaLabelClose: n.close_aria,
44
- isOpen: y,
47
+ r?.learnMore && /* @__PURE__ */ o(_, {
48
+ ariaLabelClose: a.close_aria,
49
+ isOpen: T,
45
50
  onClose: () => p(!1),
46
51
  title: r.learnMore.label,
47
- children: /* @__PURE__ */ a(F, { beat: t })
52
+ children: /* @__PURE__ */ o(V, { beat: t })
48
53
  }),
49
- /* @__PURE__ */ a(u, {
50
- ariaLabelClose: n.close_aria,
51
- isOpen: f,
52
- onClose: B,
54
+ /* @__PURE__ */ o(_, {
55
+ ariaLabelClose: a.close_aria,
56
+ isOpen: S,
57
+ onClose: M,
53
58
  title: i.general.transaction_details_title,
54
- children: /* @__PURE__ */ a(I, { beat: t })
59
+ children: /* @__PURE__ */ o(F, { beat: t })
55
60
  })
56
61
  ] });
57
62
  });
58
63
  export {
59
- it as TransactionListBlock
64
+ pt as TransactionListBlock
60
65
  };
61
66
 
62
67
  //# sourceMappingURL=TransactionListBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { HelpBlock } from '../HelpBlock'\nimport { readHelpHeader, readSummary } from './layout'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\n : drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so resolve\n // which CTA opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { primary_cta, secondary_cta, in_description_cta, is_zero_state, drilldown_data, title } =\n beat.insights_payload ?? {}\n const currentCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n const showSummary = summary !== undefined && !is_zero_state && (guids?.length ?? 0) > 0\n const helpHeader = readHelpHeader(currentCta, drilldown_data)\n\n const handleRowClick = (guid: string) => {\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList onClick={handleRowClick} transaction={transactions} />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAM,IAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,IAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAgB,OAAO,OAAO,GAAc,mBAAmB,IAC3D,CAAC,sBAAsB,EAAa,iBAAiB,IACrD,KAAa,OAAO,OAAO,GAAW,mBAAmB,IACvD,CAAC,kBAAkB,EAAU,iBAAiB,IAC9C,CAAC,sBAAsB,EAAS,iBAAiB;AAEzD,MAAI,KAAS,MACb;AAAA,QAAI,EAAc,CAAK,EAAG,QAAO;AAEjC,YAAQ,KACN,0BAA0B,CAAA,sEAC5B;AAAA;AAEF,GAYa,KAAuB,EAAS,SAA8B,EACzE,MAAA,EAAA,GAC4B;AAC5B,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAiB,EAAmB,GACzE,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,EAAmB,GACxD,IAAmB,EAAoB,GAEvC,CAAC,GAAe,CAAA,IAAoB,EAAM,SAAS,EAAK,GACxD,CAAC,GAAY,CAAA,IAAiB,EAAM,SAAS,EAAK,GAMlD,EAAE,aAAA,GAAa,eAAA,GAAe,oBAAA,GAAoB,eAAA,GAAe,gBAAA,GAAgB,OAAA,EAAA,IACrF,EAAK,oBAAoB,CAAC,GACtB,IAAa,EACjB,GACA,GACA,GACA,CACF,GAEM,IAAQ,EAAwB,GAAM,GAAY,c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AAO,CAAA;AAAA,IAChC,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n useAccountStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { HelpBlock } from '../HelpBlock'\nimport { readHelpHeader, readSummary, TRANSACTION_LIST_VARIANTS } from './layout'\nimport { TransactionAccountSubline } from './TransactionAccountSubline'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\n : drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n const accountStore = useAccountStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so resolve\n // which CTA opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { primary_cta, secondary_cta, in_description_cta, is_zero_state, drilldown_data, title } =\n beat.insights_payload ?? {}\n const currentCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n const showSummary = summary !== undefined && !is_zero_state && (guids?.length ?? 0) > 0\n const helpHeader = readHelpHeader(currentCta, drilldown_data)\n\n // Only the summary-header drawer (Replenish Savings' Savings Withdrawal) subtitles its rows with the\n // account's institution logo and name (Figma: Drilldown | Replenish Savings); every other list keeps\n // the category.\n const renderSecondaryText =\n currentCta?.variant === TRANSACTION_LIST_VARIANTS.SUMMARY_HEADER\n ? (transaction: Transaction) => (\n <TransactionAccountSubline\n institutionGuid={\n accountStore.accounts.find(({ guid }) => guid === transaction.account_guid)\n ?.institution_guid\n }\n transaction={transaction}\n />\n )\n : undefined\n\n const handleRowClick = (guid: string) => {\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList\n onClick={handleRowClick}\n renderSecondaryText={renderSecondaryText}\n transaction={transactions}\n />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAM,IAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,IAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,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s, formatDate as f } from "../../../core/constants/DateFormats.es.js";
3
3
  import { formatCurrency as x } from "../../../core/utils/NumberFormatting.es.js";
4
- import { getLogoElevation as h } from "../../components/logoShadow.es.js";
4
+ import { getLogoElevation as g } from "../../components/logoShadow.es.js";
5
5
  import n from "@mui/material/Stack";
6
6
  import { Text as e } from "@mxenabled/mxui";
7
- import { Icon as u } from "@mxenabled/mx-icons";
7
+ import { Icon as h } from "@mxenabled/mx-icons";
8
8
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
9
- import { alpha as l } from "@mui/material/styles";
9
+ import { alpha as m } from "@mui/material/styles";
10
10
  import c from "@mui/material/Box";
11
- var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t, a].filter((o) => o !== void 0).map((o) => f(o, s.MONTH_DAY)).join(" – "), L = ({ summary: t, count: a, copy: o }) => {
12
- const m = b(t.startDate, t.endDate);
11
+ var u = "_1{count} transactions", _ = "_1{count} transaction", b = (a, o) => [a, o].filter((t) => t !== void 0).map((t) => f(t, s.MONTH_DAY)).join(" – "), L = ({ summary: a, count: o, copy: t }) => {
12
+ const l = b(a.startDate, a.endDate);
13
13
  return /* @__PURE__ */ r(c, {
14
14
  sx: {
15
15
  px: 24,
@@ -20,7 +20,7 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t,
20
20
  sx: {
21
21
  bgcolor: "background.paper",
22
22
  borderRadius: "8px",
23
- boxShadow: h,
23
+ boxShadow: g,
24
24
  gap: 11,
25
25
  p: 16
26
26
  },
@@ -33,7 +33,7 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t,
33
33
  children: [/* @__PURE__ */ r(c, {
34
34
  sx: {
35
35
  alignItems: "center",
36
- bgcolor: (i) => l(i.palette.primary.main, 0.15),
36
+ bgcolor: (i) => m(i.palette.primary.main, 0.15),
37
37
  borderRadius: "4px",
38
38
  color: "primary.main",
39
39
  display: "flex",
@@ -41,33 +41,35 @@ var g = "_1{count} transactions", _ = "_1{count} transaction", b = (t, a) => [t,
41
41
  justifyContent: "center",
42
42
  width: 56
43
43
  },
44
- children: /* @__PURE__ */ r(u, {
44
+ children: /* @__PURE__ */ r(h, {
45
45
  "aria-hidden": !0,
46
46
  fill: !0,
47
47
  name: "savings",
48
48
  size: 32
49
49
  })
50
- }), /* @__PURE__ */ p(n, { children: [m && /* @__PURE__ */ r(e, {
50
+ }), /* @__PURE__ */ p(n, { children: [l && /* @__PURE__ */ r(e, {
51
51
  color: "text.secondary",
52
52
  variant: "caption",
53
- children: m
53
+ children: l
54
54
  }), /* @__PURE__ */ r(e, {
55
55
  bold: !0,
56
56
  component: "p",
57
57
  variant: "h1",
58
- children: x(t.amount, "0,0.00")
58
+ children: x(a.amount, "0,0.00")
59
59
  })] })]
60
60
  }), /* @__PURE__ */ r(c, {
61
61
  sx: {
62
- bgcolor: (i) => l(i.palette.primary.main, 0.15),
62
+ alignItems: "center",
63
+ bgcolor: (i) => m(i.palette.primary.main, 0.15),
63
64
  borderRadius: "999px",
65
+ display: "flex",
64
66
  px: 12,
65
67
  py: 2
66
68
  },
67
69
  children: /* @__PURE__ */ r(e, {
68
70
  color: "primary.dark",
69
71
  variant: "caption",
70
- children: d(o.transaction_count_one ?? _, o.transaction_count ?? g, a, String(a))
72
+ children: d(t.transaction_count_one ?? _, t.transaction_count ?? u, o, String(o))
71
73
  })
72
74
  })]
73
75
  })
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListSummaryCard.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildPluralCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nimport type { TransactionListSummary } from './layout'\n\nexport interface TransactionListSummaryCardProps {\n summary: TransactionListSummary\n /** Pill count: the CTA's `drilldown_data.count`, else the number of guids the beat names. */\n count: number\n /** Only the two pill-copy keys the card reads. */\n copy: Pick<InsightsFeedCopy['general'], 'transaction_count' | 'transaction_count_one'>\n}\n\n// English default until the localized-content service ships the pill copy in every locale.\nconst DEFAULT_COUNT_COPY = '_1{count} transactions'\nconst DEFAULT_COUNT_ONE_COPY = '_1{count} transaction'\n\n// Endpoints are already validated `Date`s from `readSummary` (invalid/junk omitted there).\nconst formatRange = (start?: Date, end?: Date): string =>\n [start, end]\n .filter((d): d is Date => d !== undefined)\n .map((d) => formatDate(d, DATE_FORMATS_INTL.MONTH_DAY))\n .join(' – ')\n\n/**\n * Summary header for the Transaction List drawer: a white card with a themed icon tile, the date\n * range, the headline amount, and a `{count} transactions` pill. Driven by the beat's summary\n * figures (see `readSummary` in layout.ts). Theme-aware tokens keep it correct in dark mode.\n *\n * Figma: Drilldown | Replenish Savings (\"Savings Withdrawal\"). Currently only Replenish Savings\n * declares the `summary_header` variant, so the tile carries its `savings` icon.\n */\nexport const TransactionListSummaryCard = ({\n summary,\n count,\n copy,\n}: TransactionListSummaryCardProps) => {\n const dateRange = formatRange(summary.startDate, summary.endDate)\n\n return (\n <Box sx={{ px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 11,\n p: 16,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '4px',\n color: 'primary.main',\n display: 'flex',\n height: 56,\n justifyContent: 'center',\n width: 56,\n }}\n >\n <Icon aria-hidden={true} fill={true} name=\"savings\" size={32} />\n </Box>\n <Stack>\n {dateRange && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateRange}\n </Text>\n )}\n <Text bold={true} component=\"p\" variant=\"h1\">\n {formatCurrency(summary.amount, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n\n <Box\n sx={{\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\n px: 12,\n py: 2,\n }}\n >\n <Text color=\"primary.dark\" variant=\"caption\">\n {\n buildPluralCopy(\n copy.transaction_count_one ?? DEFAULT_COUNT_ONE_COPY,\n copy.transaction_count ?? DEFAULT_COUNT_COPY,\n count,\n String(count),\n ) as string\n }\n </Text>\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport default TransactionListSummaryCard\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,IAAqB,0BACrB,IAAyB,yBAGzB,IAAA,CAAe,GAAc,MACjC,CAAC,GAAO,CAAG,EACR,OAAA,CAAQ,MAAiB,MAAM,MAAS,EACxC,IAAA,CAAK,MAAM,EAAW,GAAG,EAAkB,SAAS,CAAC,EACrD,KAAK,KAAK,GAUF,IAAA,CAA8B,EACzC,SAAA,GACA,OAAA,GACA,MAAA,EAAA,MACqC;AACrC,QAAM,IAAY,EAAY,EAAQ,WAAW,EAAQ,OAAO;AAEhE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE,IAAI;AAAA,MAAI,IAAI;AAAA,MAAI,IAAI;AAAA,IAAG;AAAA,IAChC,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,SAAS;AAAA,QACT,cAAc;AAAA,QACd,WAAW;AAAA,QACX,KAAK;AAAA,QACL,GAAG;AAAA,MACL;AAAA,MAPF,UAAA,CASE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,YAAY;AAAA,UAAU,eAAe;AAAA,UAAO,KAAK;AAAA,QAAG;AAAA,QAAjE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,YAAY;AAAA,YACZ,SAAA,CAAU,MAAU,EAAM,EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,YAC1D,cAAc;AAAA,YACd,OAAO;AAAA,YACP,SAAS;AAAA,YACT,QAAQ;AAAA,YACR,gBAAgB;AAAA,YAChB,OAAO;AAAA,UACT;AAAA,UAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,YAAM,eAAa;AAAA,YAAM,MAAM;AAAA,YAAM,MAAK;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA;AAAA,QAC5D,CAAA,GACL,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,GAER,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,WAAU;AAAA,UAAI,SAAQ;AAAA,UACrC,UAAA,EAAe,EAAQ,QAAQ,QAAQ;AAAA,QACpC,CAAA,CACD,EAAA,CAAA,CACF;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,SAAA,CAAU,MAAU,EAAM,EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,UAC1D,cAAc;AAAA,UACd,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,SAAQ;AAAA,UAE/B,UAAA,EACE,EAAK,yBAAyB,GAC9B,EAAK,qBAAqB,GAC1B,GACA,OAAO,CAAK,CACd;AAAA,QAEE,CAAA;AAAA,MACH,CAAA,CACA;AAAA;EACJ,CAAA;AAET"}
1
+ {"version":3,"file":"TransactionListSummaryCard.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildPluralCopy } from '../../../core/utils/Localization'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nimport type { TransactionListSummary } from './layout'\n\nexport interface TransactionListSummaryCardProps {\n summary: TransactionListSummary\n /** Pill count: the CTA's `drilldown_data.count`, else the number of guids the beat names. */\n count: number\n /** Only the two pill-copy keys the card reads. */\n copy: Pick<InsightsFeedCopy['general'], 'transaction_count' | 'transaction_count_one'>\n}\n\n// English default until the localized-content service ships the pill copy in every locale.\nconst DEFAULT_COUNT_COPY = '_1{count} transactions'\nconst DEFAULT_COUNT_ONE_COPY = '_1{count} transaction'\n\n// Endpoints are already validated `Date`s from `readSummary` (invalid/junk omitted there).\nconst formatRange = (start?: Date, end?: Date): string =>\n [start, end]\n .filter((d): d is Date => d !== undefined)\n .map((d) => formatDate(d, DATE_FORMATS_INTL.MONTH_DAY))\n .join(' – ')\n\n/**\n * Summary header for the Transaction List drawer: a white card with a themed icon tile, the date\n * range, the headline amount, and a `{count} transactions` pill. Driven by the beat's summary\n * figures (see `readSummary` in layout.ts). Theme-aware tokens keep it correct in dark mode.\n *\n * Figma: Drilldown | Replenish Savings (\"Savings Withdrawal\"). Currently only Replenish Savings\n * declares the `summary_header` variant, so the tile carries its `savings` icon.\n */\nexport const TransactionListSummaryCard = ({\n summary,\n count,\n copy,\n}: TransactionListSummaryCardProps) => {\n const dateRange = formatRange(summary.startDate, summary.endDate)\n\n return (\n <Box sx={{ px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 11,\n p: 16,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '4px',\n color: 'primary.main',\n display: 'flex',\n height: 56,\n justifyContent: 'center',\n width: 56,\n }}\n >\n <Icon aria-hidden={true} fill={true} name=\"savings\" size={32} />\n </Box>\n <Stack>\n {dateRange && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateRange}\n </Text>\n )}\n <Text bold={true} component=\"p\" variant=\"h1\">\n {formatCurrency(summary.amount, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n\n {/* Figma Tag: a 20px pill. As a flex container the inline caption becomes a flex item, so its own\n 16px line box (not the pill's inherited line height) sets 2 + 16 + 2, centered. */}\n <Box\n sx={{\n alignItems: 'center',\n bgcolor: (theme) => alpha(theme.palette.primary.main, 0.15),\n borderRadius: '999px',\n display: 'flex',\n px: 12,\n py: 2,\n }}\n >\n <Text color=\"primary.dark\" variant=\"caption\">\n {\n buildPluralCopy(\n copy.transaction_count_one ?? DEFAULT_COUNT_ONE_COPY,\n copy.transaction_count ?? DEFAULT_COUNT_COPY,\n count,\n String(count),\n ) as string\n }\n </Text>\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport default TransactionListSummaryCard\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,IAAqB,0BACrB,IAAyB,yBAGzB,IAAA,CAAe,GAAc,MACjC,CAAC,GAAO,CAAG,EACR,OAAA,CAAQ,MAAiB,MAAM,MAAS,EACxC,IAAA,CAAK,MAAM,EAAW,GAAG,EAAkB,SAAS,CAAC,EACrD,KAAK,KAAK,GAUF,IAAA,CAA8B,EACzC,SAAA,GACA,OAAA,GACA,MAAA,EAAA,MACqC;AACrC,QAAM,IAAY,EAAY,EAAQ,WAAW,EAAQ,OAAO;AAEhE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE,IAAI;AAAA,MAAI,IAAI;AAAA,MAAI,IAAI;AAAA,IAAG;AAA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gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAe,SAAQ;AAAA,UAE/B,UAAA,EACE,EAAK,yBAAyB,GAC9B,EAAK,qBAAqB,GAC1B,GACA,OAAO,CAAK,CACd;AAAA,QAEE,CAAA;AAAA,MACH,CAAA,CACA;AAAA;EACJ,CAAA;AAET"}
@@ -1,11 +1,5 @@
1
1
  import { DonutChartBlockData } from '../../../../core/types/InsightsInstanceSlotData';
2
2
  import { BlockProps } from '../../types';
3
- /**
4
- * `donut_chart_block`: a donut with a centre total and a two-row legend.
5
- *
6
- * Reads `main` and `legends` from `instance_slot.data` (the Insights 2.0 envelope; ditto variant
7
- * `deposit_summary` for Monthly Deposit Summary), falling back to the V1 `instance_slot_data` for
8
- * payloads that still carry the facts there. The palette comes from `./layout.ts` by variant.
9
- */
3
+ /** `donut_chart_block`: a donut with a centre total and a two-row legend; V1 `instance_slot_data` is the fallback. */
10
4
  declare const DonutChartBlock: ({ payload }: BlockProps<Partial<DonutChartBlockData>>) => import("react/jsx-runtime").JSX.Element | null;
11
5
  export default DonutChartBlock;
@@ -1,23 +1,21 @@
1
1
  import { formatValueByType as e } from "../../../CommonUtils.es.js";
2
2
  import v from "./DonutChart.es.js";
3
3
  import { getDonutChartColors as y } from "./utils.es.js";
4
- import { Fragment as f, jsx as i, jsxs as b } from "react/jsx-runtime";
4
+ import { Fragment as b, jsx as u, jsxs as f } from "react/jsx-runtime";
5
5
  import { useTheme as h } from "@mui/material/styles";
6
- var j = ({ payload: s }) => {
7
- const c = h(), { instance_slot: l, instance_slot_data: r } = s, { variant: m } = l, n = l.data, t = n?.main ? n : r ?? {}, _ = Array.isArray(t.legends) ? t.legends : [], { main: o } = t;
6
+ var j = ({ payload: i }) => {
7
+ const s = h(), { instance_slot: l, instance_slot_data: r } = i, { variant: c } = l, n = l.data, t = n?.main ? n : r ?? {}, m = Array.isArray(t.legends) ? t.legends : [], { main: o } = t;
8
8
  if (!o) return null;
9
- const u = y(m, {
9
+ const _ = y(c, {
10
10
  ...t,
11
11
  category_guid: t.category_guid ?? r?.category_guid
12
- }, c);
13
- if (!u) return null;
14
- const d = _.map((a, p) => ({
12
+ }, s), d = m.map((a, p) => ({
15
13
  value: a.value,
16
- color: u[p],
14
+ color: _[p],
17
15
  label: a.label,
18
- labelValue: /* @__PURE__ */ b(f, { children: [/* @__PURE__ */ i("b", { children: e(a.value, a.value_type ?? "amount", "0,0.00") }), a.additional_value && a.additional_value_type ? ` (${e(a.additional_value, a.additional_value_type, "0,0.00")})` : null] })
16
+ labelValue: /* @__PURE__ */ f(b, { children: [/* @__PURE__ */ u("b", { children: e(a.value, a.value_type ?? "amount", "0,0.00") }), a.additional_value && a.additional_value_type ? ` (${e(a.additional_value, a.additional_value_type, "0,0.00")})` : null] })
19
17
  }));
20
- return /* @__PURE__ */ i(v, {
18
+ return /* @__PURE__ */ u(v, {
21
19
  centerLabel: o.label,
22
20
  centerValue: e(Number(o.value), o.value_type, "0,0"),
23
21
  data: d
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\n\nimport type { DonutChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { formatValueByType } from '../../../CommonUtils'\n\nimport type { BlockProps } from '../../types'\n\nimport DonutChartV2 from './DonutChart'\nimport { getDonutChartColors } from './utils'\n\n/**\n * `donut_chart_block`: a donut with a centre total and a two-row legend.\n *\n * Reads `main` and `legends` from `instance_slot.data` (the Insights 2.0 envelope; ditto variant\n * `deposit_summary` for Monthly Deposit Summary), falling back to the V1 `instance_slot_data` for\n * payloads that still carry the facts there. The palette comes from `./layout.ts` by variant.\n */\nconst DonutChartBlock = ({ payload }: BlockProps<Partial<DonutChartBlockData>>) => {\n const theme = useTheme()\n const { instance_slot, instance_slot_data } = payload\n const { variant } = instance_slot\n // V2 contract first (`instance_slot.data`), V1 `instance_slot_data` as the legacy alias.\n const slotData = instance_slot.data as Partial<DonutChartBlockData> | undefined\n const blockData: Partial<DonutChartBlockData> = slotData?.main\n ? slotData\n : (instance_slot_data ?? {})\n const legends = Array.isArray(blockData.legends) ? blockData.legends : []\n const { main } = blockData\n\n if (!main) return null\n\n const colors = getDonutChartColors(\n variant,\n { ...blockData, category_guid: blockData.category_guid ?? instance_slot_data?.category_guid },\n theme,\n )\n\n if (!colors) return null\n\n const data = legends.map((legend, index) => ({\n value: legend.value,\n color: colors[index],\n label: legend.label,\n labelValue: (\n <>\n <b>{formatValueByType(legend.value, legend.value_type ?? 'amount', '0,0.00')}</b>\n {legend.additional_value && legend.additional_value_type\n ? ` (${formatValueByType(legend.additional_value, legend.additional_value_type, '0,0.00')})`\n : null}\n </>\n ),\n }))\n\n return (\n <DonutChartV2\n centerLabel={main.label}\n centerValue={formatValueByType(Number(main.value), main.value_type, '0,0')}\n data={data}\n />\n )\n}\n\nexport default DonutChartBlock\n"],"mappings":";;;;;AAkBA,IAAM,IAAA,CAAmB,EAAE,SAAA,EAAA,MAAwD;AACjF,QAAM,IAAQ,EAAS,GACjB,EAAE,eAAA,GAAe,oBAAA,EAAA,IAAuB,GACxC,EAAE,SAAA,EAAA,IAAY,GAEd,IAAW,EAAc,MACzB,IAA0C,GAAU,OACtD,IACC,KAAsB,CAAC,GACtB,IAAU,MAAM,QAAQ,EAAU,OAAO,IAAI,EAAU,UAAU,CAAC,GAClE,EAAE,MAAA,EAAA,IAAS;AAEjB,MAAI,CAAC,EAAM,QAAO;AAElB,QAAM,IAAS,EACb,GACA;AAAA,IAAE,GAAG;AAAA,IAAW,eAAe,EAAU,iBAAiB,GAAoB;AAAA,EAAc,GAC5F,CACF;AAEA,MAAI,CAAC,EAAQ,QAAO;AAEpB,QAAM,IAAO,EAAQ,IAAA,CAAK,GAAQ,OAAW;AAAA,IAC3C,OAAO,EAAO;AAAA,IACd,OAAO,EAAO,CAAA;AAAA,IACd,OAAO,EAAO;AAAA,IACd,YACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,KAAD,EAAA,UAAI,EAAkB,EAAO,OAAO,EAAO,cAAc,UAAU,QAAQ,EAAK,CAAA,GAC/E,EAAO,oBAAoB,EAAO,wBAC/B,KAAK,EAAkB,EAAO,kBAAkB,EAAO,uBAAuB,QAAQ,CAAA,MACtF,IACJ,EAAA,CAAA;AAAA,EAEN,EAAE;AAEF,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,aAAa,EAAK;AAAA,IAClB,aAAa,EAAkB,OAAO,EAAK,KAAK,GAAG,EAAK,YAAY,KAAK;AAAA,IACnE,MAAA;AAAA,EACP,CAAA;AAEL"}
1
+ {"version":3,"file":"DonutChartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\n\nimport type { DonutChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { formatValueByType } from '../../../CommonUtils'\n\nimport type { BlockProps } from '../../types'\n\nimport DonutChartV2 from './DonutChart'\nimport { getDonutChartColors } from './utils'\n\n/** `donut_chart_block`: a donut with a centre total and a two-row legend; V1 `instance_slot_data` is the fallback. */\nconst DonutChartBlock = ({ payload }: BlockProps<Partial<DonutChartBlockData>>) => {\n const theme = useTheme()\n const { instance_slot, instance_slot_data } = payload\n const { variant } = instance_slot\n // V2 contract first (`instance_slot.data`), V1 `instance_slot_data` as the legacy alias.\n const slotData = instance_slot.data as Partial<DonutChartBlockData> | undefined\n const blockData: Partial<DonutChartBlockData> = slotData?.main\n ? slotData\n : (instance_slot_data ?? {})\n const legends = Array.isArray(blockData.legends) ? blockData.legends : []\n const { main } = blockData\n\n if (!main) return null\n\n const colors = getDonutChartColors(\n variant,\n { ...blockData, category_guid: blockData.category_guid ?? instance_slot_data?.category_guid },\n theme,\n )\n\n const data = legends.map((legend, index) => ({\n value: legend.value,\n color: colors[index],\n label: legend.label,\n labelValue: (\n <>\n <b>{formatValueByType(legend.value, legend.value_type ?? 'amount', '0,0.00')}</b>\n {legend.additional_value && legend.additional_value_type\n ? ` (${formatValueByType(legend.additional_value, legend.additional_value_type, '0,0.00')})`\n : null}\n </>\n ),\n }))\n\n return (\n <DonutChartV2\n centerLabel={main.label}\n centerValue={formatValueByType(Number(main.value), main.value_type, '0,0')}\n data={data}\n />\n )\n}\n\nexport default DonutChartBlock\n"],"mappings":";;;;;AAYA,IAAM,IAAA,CAAmB,EAAE,SAAA,EAAA,MAAwD;AACjF,QAAM,IAAQ,EAAS,GACjB,EAAE,eAAA,GAAe,oBAAA,EAAA,IAAuB,GACxC,EAAE,SAAA,EAAA,IAAY,GAEd,IAAW,EAAc,MACzB,IAA0C,GAAU,OACtD,IACC,KAAsB,CAAC,GACtB,IAAU,MAAM,QAAQ,EAAU,OAAO,IAAI,EAAU,UAAU,CAAC,GAClE,EAAE,MAAA,EAAA,IAAS;AAEjB,MAAI,CAAC,EAAM,QAAO;AAElB,QAAM,IAAS,EACb,GACA;AAAA,IAAE,GAAG;AAAA,IAAW,eAAe,EAAU,iBAAiB,GAAoB;AAAA,EAAc,GAC5F,CACF,GAEM,IAAO,EAAQ,IAAA,CAAK,GAAQ,OAAW;AAAA,IAC3C,OAAO,EAAO;AAAA,IACd,OAAO,EAAO,CAAA;AAAA,IACd,OAAO,EAAO;AAAA,IACd,YACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,KAAD,EAAA,UAAI,EAAkB,EAAO,OAAO,EAAO,cAAc,UAAU,QAAQ,EAAK,CAAA,GAC/E,EAAO,oBAAoB,EAAO,wBAC/B,KAAK,EAAkB,EAAO,kBAAkB,EAAO,uBAAuB,QAAQ,CAAA,MACtF,IACJ,EAAA,CAAA;AAAA,EAEN,EAAE;AAEF,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,aAAa,EAAK;AAAA,IAClB,aAAa,EAAkB,OAAO,EAAK,KAAK,GAAG,EAAK,YAAY,KAAK;AAAA,IACnE,MAAA;AAAA,EACP,CAAA;AAEL"}
@@ -1,19 +1,15 @@
1
1
  import { Theme } from '@mui/material/styles';
2
- export declare const getLayoutConfig: (theme: Theme) => {
3
- CostOfLivingToIncome: {
4
- secondaryColor: string;
5
- };
6
- MonthlyDepositSummaryV2: {
7
- colors: string[];
8
- };
9
- MonthlyNonEssentialCategorySummaryV2: {
10
- colors: (string | undefined)[];
11
- };
12
- CreditCardCloseToLimit: {
13
- colors: string[];
14
- };
15
- CreditUtilization: {
16
- dynamicPrimary: string;
17
- secondaryColor: string;
18
- };
2
+ /** Ditto's `donut_chart_block` variants; the template-name keys below are V1 aliases. */
3
+ export declare const donutChartVariant: {
4
+ readonly DepositSummary: "deposit_summary";
19
5
  };
6
+ export type DonutChartVariant = (typeof donutChartVariant)[keyof typeof donutChartVariant];
7
+ export type DonutChartLayoutConfig = {
8
+ colors: [string, string];
9
+ } | {
10
+ secondaryColor: string;
11
+ } | {
12
+ dynamicPrimary: 'creditUtilization';
13
+ secondaryColor: string;
14
+ };
15
+ export declare const getLayoutConfig: (theme: Theme) => Record<string, DonutChartLayoutConfig>;
@@ -1,15 +1,20 @@
1
- var t = (o) => ({
2
- CostOfLivingToIncome: { secondaryColor: o.palette.divider },
3
- MonthlyDepositSummaryV2: { colors: [o.palette.success.main, o.palette.success.light] },
4
- MonthlyNonEssentialCategorySummaryV2: { colors: [o.palette.chartMono.chartMono3, o.palette.chartMono.chartMono5] },
5
- CreditCardCloseToLimit: { colors: [o.palette.warning.main, o.palette.divider] },
6
- CreditUtilization: {
7
- dynamicPrimary: "creditUtilization",
8
- secondaryColor: o.palette.divider
9
- }
10
- });
1
+ var a = { DepositSummary: "deposit_summary" }, r = (t) => {
2
+ const o = { colors: [t.palette.success.main, t.palette.success.light] };
3
+ return {
4
+ [a.DepositSummary]: o,
5
+ CostOfLivingToIncome: { secondaryColor: t.palette.divider },
6
+ MonthlyDepositSummaryV2: o,
7
+ MonthlyNonEssentialCategorySummaryV2: { colors: [t.palette.chartMono.chartMono3 ?? t.palette.text.primary, t.palette.chartMono.chartMono5 ?? t.palette.divider] },
8
+ CreditCardCloseToLimit: { colors: [t.palette.warning.main, t.palette.divider] },
9
+ CreditUtilization: {
10
+ dynamicPrimary: "creditUtilization",
11
+ secondaryColor: t.palette.divider
12
+ }
13
+ };
14
+ };
11
15
  export {
12
- t as getLayoutConfig
16
+ a as donutChartVariant,
17
+ r as getLayoutConfig
13
18
  };
14
19
 
15
20
  //# 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'\nexport const getLayoutConfig = (theme: Theme) => {\n return {\n CostOfLivingToIncome: {\n secondaryColor: theme.palette.divider,\n },\n MonthlyDepositSummaryV2: {\n colors: [theme.palette.success.main, theme.palette.success.light],\n },\n MonthlyNonEssentialCategorySummaryV2: {\n colors: [theme.palette.chartMono.chartMono3, theme.palette.chartMono.chartMono5],\n },\n CreditCardCloseToLimit: {\n colors: [theme.palette.warning.main, theme.palette.divider],\n },\n CreditUtilization: {\n dynamicPrimary: 'creditUtilization',\n secondaryColor: theme.palette.divider,\n },\n }\n}\n"],"mappings":"AACA,IAAa,IAAA,CAAmB,OACvB;AAAA,EACL,sBAAsB,EACpB,gBAAgB,EAAM,QAAQ,QAChC;AAAA,EACA,yBAAyB,EACvB,QAAQ,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,QAAQ,KAAK,EAClE;AAAA,EACA,sCAAsC,EACpC,QAAQ,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU,EACjF;AAAA,EACA,wBAAwB,EACtB,QAAQ,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,OAAO,EAC5D;AAAA,EACA,mBAAmB;AAAA,IACjB,gBAAgB;AAAA,IAChB,gBAAgB,EAAM,QAAQ;AAAA,EAChC;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} as const\n\nexport type DonutChartVariant = (typeof donutChartVariant)[keyof typeof donutChartVariant]\n\nexport type DonutChartLayoutConfig =\n | { colors: [string, string] }\n | { secondaryColor: string }\n | { dynamicPrimary: 'creditUtilization'; secondaryColor: string }\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 return {\n [donutChartVariant.DepositSummary]: depositSummary,\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: {\n colors: [theme.palette.warning.main, theme.palette.divider],\n },\n CreditUtilization: {\n dynamicPrimary: 'creditUtilization',\n secondaryColor: theme.palette.divider,\n },\n }\n}\n"],"mappings":"AAGA,IAAa,IAAoB,EAC/B,gBAAgB,kBAClB,GASa,IAAA,CAAmB,MAAyD;AACvF,QAAM,IAAyC,EAC7C,QAAQ,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,QAAQ,KAAK,EAClE;AAEA,SAAO;AAAA,IACJ,CAAA,EAAkB,cAAA,GAAiB;AAAA,IAGpC,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,EACtB,QAAQ,CAAC,EAAM,QAAQ,QAAQ,MAAM,EAAM,QAAQ,OAAO,EAC5D;AAAA,IACA,mBAAmB;AAAA,MACjB,gBAAgB;AAAA,MAChB,gBAAgB,EAAM,QAAQ;AAAA,IAChC;AAAA,EACF;AACF"}
@@ -1,3 +1,7 @@
1
1
  import { Theme } from '@mui/material/styles';
2
- import { InsightsInstanceSlotData } from '../../../../core/types/InsightsInstanceSlotData';
3
- export declare const getDonutChartColors: (variant: string | null | undefined, blockData: InsightsInstanceSlotData, theme: Theme) => [string, string] | null;
2
+ import { DonutChartBlockData } from '../../../../core/types/InsightsInstanceSlotData';
3
+ /** The facts the palette may read: the centre value (credit utilization) and the category. */
4
+ export type DonutColorData = Partial<DonutChartBlockData> & {
5
+ category_guid?: string;
6
+ };
7
+ export declare const getDonutChartColors: (variant: string | null | undefined, blockData: DonutColorData, theme: Theme) => [string, string];
@@ -1,11 +1,12 @@
1
- import { getCategoryColor as a } from "../../../../core/utils/CategoryUtil.es.js";
2
- import { getLayoutConfig as t } from "./layout.es.js";
3
- var u = (n, i, o) => {
4
- const r = t(o)[n];
5
- return r ? "dynamicPrimary" in r && r.dynamicPrimary === "creditUtilization" ? [Number(i.main?.value ?? 0) > 30 ? o.palette.error.main : o.palette.warning.main, r.secondaryColor] : "secondaryColor" in r ? [a(i.category_guid ?? "", o), r.secondaryColor] : r.colors : null;
1
+ import { getCategoryColor as t } from "../../../../core/utils/CategoryUtil.es.js";
2
+ import { resolveVariantConfig as n } from "../../resolveVariantConfig.es.js";
3
+ import { donutChartVariant as e, getLayoutConfig as m } from "./layout.es.js";
4
+ var y = (i, a, o) => {
5
+ const r = n(m(o), i, e.DepositSummary, "DonutChartBlock");
6
+ return "dynamicPrimary" in r && r.dynamicPrimary === "creditUtilization" ? [Number(a.main?.value ?? 0) > 30 ? o.palette.error.main : o.palette.warning.main, r.secondaryColor] : "secondaryColor" in r ? [t(a.category_guid ?? "", o), r.secondaryColor] : r.colors;
6
7
  };
7
8
  export {
8
- u as getDonutChartColors
9
+ y as getDonutChartColors
9
10
  };
10
11
 
11
12
  //# sourceMappingURL=utils.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { getLayoutConfig } from './layout'\nimport type { InsightsInstanceSlotData } from '../../../../core/types/InsightsInstanceSlotData'\n\nexport const getDonutChartColors = (\n variant: string | null | undefined,\n blockData: InsightsInstanceSlotData,\n theme: Theme,\n): [string, string] | null => {\n const layouts = getLayoutConfig(theme)\n const variantConfig = layouts[variant as keyof ReturnType<typeof getLayoutConfig>] as\n | { dynamicPrimary: string; secondaryColor: string }\n | { secondaryColor: string }\n | { colors: [string, string] }\n | undefined\n\n if (!variantConfig) return null\n\n if ('dynamicPrimary' in variantConfig && variantConfig.dynamicPrimary === 'creditUtilization') {\n const utilization = Number(blockData.main?.value ?? 0)\n const primaryColor = utilization > 30 ? theme.palette.error.main : theme.palette.warning.main\n return [primaryColor, variantConfig.secondaryColor]\n }\n\n if ('secondaryColor' in variantConfig) {\n const categoryColor = getCategoryColor(blockData.category_guid ?? '', theme)\n return [categoryColor, variantConfig.secondaryColor]\n }\n\n return variantConfig.colors\n}\n"],"mappings":";;AAKA,IAAa,IAAA,CACX,GACA,GACA,MAC4B;AAE5B,QAAM,IADU,EAAgB,CACV,EAAQ,CAAA;AAM9B,SAAK,IAED,oBAAoB,KAAiB,EAAc,mBAAmB,sBAGjE,CAFa,OAAO,EAAU,MAAM,SAAS,CAC/B,IAAc,KAAK,EAAM,QAAQ,MAAM,OAAO,EAAM,QAAQ,QAAQ,MACnE,EAAc,cAAc,IAGhD,oBAAoB,IAEf,CADe,EAAiB,EAAU,iBAAiB,IAAI,CAC9D,GAAe,EAAc,cAAc,IAG9C,EAAc,SAbM;AAc7B"}
1
+ {"version":3,"file":"utils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport type { DonutChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { donutChartVariant, getLayoutConfig } from './layout'\n\n/** The facts the palette may read: the centre value (credit utilization) and the category. */\nexport type DonutColorData = Partial<DonutChartBlockData> & { category_guid?: string }\n\nexport const getDonutChartColors = (\n variant: string | null | undefined,\n blockData: DonutColorData,\n theme: Theme,\n): [string, string] => {\n const variantConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n donutChartVariant.DepositSummary,\n 'DonutChartBlock',\n )\n\n if ('dynamicPrimary' in variantConfig && variantConfig.dynamicPrimary === 'creditUtilization') {\n const utilization = Number(blockData.main?.value ?? 0)\n const primaryColor = utilization > 30 ? theme.palette.error.main : theme.palette.warning.main\n return [primaryColor, variantConfig.secondaryColor]\n }\n\n if ('secondaryColor' in variantConfig) {\n const categoryColor = getCategoryColor(blockData.category_guid ?? '', theme)\n return [categoryColor, variantConfig.secondaryColor]\n }\n\n return variantConfig.colors\n}\n"],"mappings":";;;AASA,IAAa,IAAA,CACX,GACA,GACA,MACqB;AACrB,QAAM,IAAgB,EACpB,EAAgB,CAAK,GACrB,GACA,EAAkB,gBAClB,iBACF;AAEA,SAAI,oBAAoB,KAAiB,EAAc,mBAAmB,sBAGjE,CAFa,OAAO,EAAU,MAAM,SAAS,CAC/B,IAAc,KAAK,EAAM,QAAQ,MAAM,OAAO,EAAM,QAAQ,QAAQ,MACnE,EAAc,cAAc,IAGhD,oBAAoB,IAEf,CADe,EAAiB,EAAU,iBAAiB,IAAI,CAC9D,GAAe,EAAc,cAAc,IAG9C,EAAc;AACvB"}
@@ -1,12 +1,12 @@
1
1
  import { slot as d } from "../../../../core/types/Insights.es.js";
2
2
  import { formatCurrency as I } from "../../../../core/utils/NumberFormatting.es.js";
3
3
  import { useContainerDimensions as P } from "../../../hooks/useContainerDimensions.es.js";
4
- import H from "../../../components/LogoFromGuid.es.js";
5
- import { Confetti as N } from "../../../components/shared/Confetti.es.js";
6
- import { ReactComponent as E } from "../../../components/shared/images/PaidOffCard.es.js";
7
- import { ReactComponent as G } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
8
- import { statusIconName as O } from "../../../components/statusIcon.es.js";
9
- import { resolveVariantConfig as W } from "../../resolveVariantConfig.es.js";
4
+ import { resolveVariantConfig as H } from "../../resolveVariantConfig.es.js";
5
+ import N from "../../../components/LogoFromGuid.es.js";
6
+ import { Confetti as E } from "../../../components/shared/Confetti.es.js";
7
+ import { ReactComponent as G } from "../../../components/shared/images/PaidOffCard.es.js";
8
+ import { ReactComponent as O } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
9
+ import { statusIconName as W } from "../../../components/statusIcon.es.js";
10
10
  import { isDetailedAccountVariant as q } from "../DetailedAccountBlock/layout.es.js";
11
11
  import J from "../DetailedAccountBlock/DetailedAccountBlock.es.js";
12
12
  import { HeaderComponent as K } from "./HeaderComponent.es.js";
@@ -22,9 +22,9 @@ import a from "@mui/material/Box";
22
22
  var vo = ({ payload: g }) => {
23
23
  const h = X(), b = U(null), { height: w, width: v } = P(b), { instance_slot: n } = g, { variant: p, institution_guid: D, institution_name: A, icon_name: B, merchant_name: F } = n;
24
24
  if (q(p)) return /* @__PURE__ */ o(J, { payload: g });
25
- const { data: i } = n, m = i !== void 0, f = d(i, "amount"), u = m ? typeof f == "number" && Number.isFinite(f) ? f : void 0 : n.amount, y = d(i, "sub_text"), R = typeof y == "string" ? y : void 0, T = m ? R : n.sub_text, L = m ? R : n.label, _ = d(i, "header_text"), s = m ? typeof _ == "string" ? _ : void 0 : n.header_text, c = d(i, "logo"), t = W(M(h), p, "default", "AccountBlock");
25
+ const { data: i } = n, m = i !== void 0, f = d(i, "amount"), u = m ? typeof f == "number" && Number.isFinite(f) ? f : void 0 : n.amount, y = d(i, "sub_text"), R = typeof y == "string" ? y : void 0, T = m ? R : n.sub_text, L = m ? R : n.label, _ = d(i, "header_text"), s = m ? typeof _ == "string" ? _ : void 0 : n.header_text, c = d(i, "logo"), t = H(M(h), p, "default", "AccountBlock");
26
26
  if (t?.isConfetti) {
27
- const x = O(c?.guid), V = {
27
+ const x = W(c?.guid), V = {
28
28
  paidOffCard: /* @__PURE__ */ o(a, {
29
29
  sx: {
30
30
  flexShrink: 0,
@@ -32,7 +32,7 @@ var vo = ({ payload: g }) => {
32
32
  position: "relative",
33
33
  width: 48
34
34
  },
35
- children: /* @__PURE__ */ o(E, {
35
+ children: /* @__PURE__ */ o(G, {
36
36
  "aria-hidden": !0,
37
37
  role: "presentation",
38
38
  style: {
@@ -42,7 +42,7 @@ var vo = ({ payload: g }) => {
42
42
  }
43
43
  })
44
44
  }),
45
- savings: /* @__PURE__ */ o(G, {
45
+ savings: /* @__PURE__ */ o(O, {
46
46
  "aria-hidden": !0,
47
47
  height: 55,
48
48
  role: "presentation",
@@ -71,7 +71,7 @@ var vo = ({ payload: g }) => {
71
71
  size: t.logo_icon_size ?? 24,
72
72
  sx: { color: "success.contrastText" }
73
73
  })
74
- }) : c?.guid ? /* @__PURE__ */ o(H, {
74
+ }) : c?.guid ? /* @__PURE__ */ o(N, {
75
75
  logo: c,
76
76
  size: 48
77
77
  }) : null
@@ -103,7 +103,7 @@ var vo = ({ payload: g }) => {
103
103
  position: "absolute",
104
104
  zIndex: 1
105
105
  },
106
- children: /* @__PURE__ */ o(N, {
106
+ children: /* @__PURE__ */ o(E, {
107
107
  height: w,
108
108
  shouldRun: w > 0 && v > 0,
109
109
  width: v
@@ -1,7 +1,7 @@
1
1
  import a from "../../../../common/components/IconBacking.es.js";
2
- import u from "../../../components/LogoFromGuid.es.js";
2
+ import { resolveVariantConfig as u } from "../../resolveVariantConfig.es.js";
3
+ import g from "../../../components/LogoFromGuid.es.js";
3
4
  import { statusIconName as l } from "../../../components/statusIcon.es.js";
4
- import { resolveVariantConfig as g } from "../../resolveVariantConfig.es.js";
5
5
  import { getLayoutConfig as f } from "./layout.es.js";
6
6
  import { InstitutionLogo as p } from "@mxenabled/mxui";
7
7
  import { Icon as n } from "@mxenabled/mx-icons";
@@ -9,14 +9,14 @@ import { jsx as i, jsxs as s } from "react/jsx-runtime";
9
9
  import { useTheme as b } from "@mui/material/styles";
10
10
  import { Stack as c } from "@mui/material";
11
11
  var y = ({ slot: r, variant: d, logo: e }) => {
12
- const m = b(), o = g(f(m), d, "default", "AccountBlock");
12
+ const m = b(), o = u(f(m), d, "default", "AccountBlock");
13
13
  if (/^INS-[A-Za-z0-9-]+$/.test(e?.guid ?? "")) return /* @__PURE__ */ s(c, {
14
14
  sx: {
15
15
  alignItems: "center",
16
16
  flexDirection: "row",
17
17
  position: "relative"
18
18
  },
19
- children: [/* @__PURE__ */ i(u, {
19
+ children: [/* @__PURE__ */ i(g, {
20
20
  logo: e,
21
21
  size: 48
22
22
  }), o.badge && /* @__PURE__ */ i(a, {