@mx-cartographer/experiences 9.7.155 → 9.7.157

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 (47) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/core/types/localization/InsightsFeedCopy.d.ts +6 -5
  3. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js +19 -22
  4. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js.map +1 -1
  5. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +44 -49
  6. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +37 -41
  8. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/BlockErrorMessage.d.ts +4 -0
  10. package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js +17 -0
  11. package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js.map +1 -0
  12. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +116 -120
  13. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +14 -18
  15. package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -1
  16. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.d.ts +0 -6
  17. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +34 -26
  18. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -1
  19. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.d.ts +4 -4
  20. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +239 -220
  21. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.d.ts +2 -0
  23. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js +36 -32
  24. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js +4 -8
  26. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/useCreditUtilizationPrepare.es.js.map +1 -1
  27. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -28
  28. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
  29. package/dist/insights-v2/actionBlocks/HelpBlock/HelpBlock.es.js +11 -14
  30. package/dist/insights-v2/actionBlocks/HelpBlock/HelpBlock.es.js.map +1 -1
  31. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +28 -30
  32. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
  33. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +53 -55
  34. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
  35. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +26 -31
  36. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
  37. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
  38. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +38 -41
  39. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  40. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js +11 -16
  41. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map +1 -1
  42. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +39 -42
  43. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  44. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +76 -78
  45. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  46. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  47. package/package.json +1 -1
@@ -1,41 +1,42 @@
1
- import I from "../../../common/utils/AccountDisplayName.es.js";
2
- import { useAccountStore as g, useGlobalCopyStore as S } from "../../../common/context/hooks.es.js";
1
+ import C from "../../../common/utils/AccountDisplayName.es.js";
2
+ import { useAccountStore as P, useGlobalCopyStore as S } from "../../../common/context/hooks.es.js";
3
3
  import A from "../../../common/components/Loader.es.js";
4
- import { isPayoffPossible as w } from "./payoff.es.js";
5
- import { buildPayoffRows as F, initialPayoffInputs as R, parsePayoffInputs as k, resolvePrimaryAccount as D, validatePayoffInputs as L } from "./layout.es.js";
6
- import { CalculationFailed as $, PayoffResults as j } from "./PayoffResults.es.js";
7
- import l from "react";
8
- import { observer as B } from "mobx-react-lite";
9
- import c from "@mui/material/Stack";
10
- import { InstitutionLogo as E, Text as h, TextField as T } from "@mxenabled/mxui";
11
- import G from "@mui/material/Button";
12
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
4
+ import { BlockErrorMessage as w } from "../BlockErrorMessage.es.js";
5
+ import { isPayoffPossible as k } from "./payoff.es.js";
6
+ import { buildPayoffRows as F, initialPayoffInputs as R, parsePayoffInputs as B, resolvePrimaryAccount as D, validatePayoffInputs as E } from "./layout.es.js";
7
+ import { CalculationFailed as L, PayoffResults as $ } from "./PayoffResults.es.js";
8
+ import c from "react";
9
+ import { observer as j } from "mobx-react-lite";
10
+ import u from "@mui/material/Stack";
11
+ import { InstitutionLogo as T, Text as x, TextField as G } from "@mxenabled/mxui";
12
+ import M from "@mui/material/Button";
13
+ import { jsx as o, jsxs as m } from "react/jsx-runtime";
13
14
  import N from "@mui/material/InputAdornment";
14
- var tt = ({ beat: i }) => {
15
- const { accountsLoaded: t, loadAccounts: s } = g();
16
- l.useEffect(() => {
17
- !i.primary_account && !t && s();
15
+ var et = ({ beat: i }) => {
16
+ const { accountsLoaded: t, loadAccounts: n } = P();
17
+ c.useEffect(() => {
18
+ !i.primary_account && !t && n();
18
19
  }, []);
19
20
  }, O = ({ account: i, copy: t }) => {
20
- const s = l.useId(), [a, f] = l.useState(() => R(i)), [u, m] = l.useState({}), [p, v] = l.useState({ status: "idle" }), b = i ? I(i) : "", _ = (e) => (n) => f((r) => ({
21
+ const n = c.useId(), [a, f] = c.useState(() => R(i)), [l, g] = c.useState({}), [d, v] = c.useState({ status: "idle" }), y = i ? C(i) : "", I = (e) => (s) => f((r) => ({
21
22
  ...r,
22
- [e]: n.target.value
23
- })), C = (e) => {
23
+ [e]: s.target.value
24
+ })), _ = (e) => {
24
25
  e.preventDefault();
25
- const n = L(a, t);
26
- if (m(n), Object.keys(n).length > 0) return;
27
- const { balance: r, interestRate: x, monthlyPayment: P } = k(a);
28
- v(w(x, r, P) ? {
26
+ const s = E(a, t);
27
+ if (g(s), Object.keys(s).length > 0) return;
28
+ const { balance: r, interestRate: h, monthlyPayment: b } = B(a);
29
+ v(k(h, r, b) ? {
29
30
  status: "calculated",
30
- rows: F(x, r, P)
31
+ rows: F(h, r, b)
31
32
  } : { status: "failed" });
32
- }, y = (e, n, r) => /* @__PURE__ */ o(T, {
33
- error: !!u[e],
33
+ }, p = (e, s, r) => /* @__PURE__ */ o(G, {
34
+ error: !!l[e],
34
35
  fullWidth: !0,
35
- helperText: u[e],
36
- id: `${s}-${e}`,
37
- label: n,
38
- onChange: _(e),
36
+ helperText: l[e],
37
+ id: `${n}-${e}`,
38
+ label: s,
39
+ onChange: I(e),
39
40
  slotProps: {
40
41
  htmlInput: { inputMode: "decimal" },
41
42
  input: { [r.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */ o(N, {
@@ -46,59 +47,59 @@ var tt = ({ beat: i }) => {
46
47
  },
47
48
  value: a[e]
48
49
  });
49
- return /* @__PURE__ */ d(c, {
50
+ return /* @__PURE__ */ m(u, {
50
51
  component: "form",
51
52
  noValidate: !0,
52
- onSubmit: C,
53
+ onSubmit: _,
53
54
  sx: { p: 16 },
54
55
  children: [
55
- b && /* @__PURE__ */ d(c, {
56
+ y && /* @__PURE__ */ m(u, {
56
57
  sx: {
57
58
  alignItems: "center",
58
59
  flexDirection: "row",
59
60
  gap: 8
60
61
  },
61
- children: [/* @__PURE__ */ o(E, {
62
+ children: [/* @__PURE__ */ o(T, {
62
63
  alt: "",
63
64
  institutionGuid: i?.institution_guid ?? "",
64
65
  size: 24
65
- }), /* @__PURE__ */ o(h, {
66
+ }), /* @__PURE__ */ o(x, {
66
67
  component: "p",
67
68
  variant: "body2",
68
- children: b
69
+ children: y
69
70
  })]
70
71
  }),
71
- /* @__PURE__ */ o(h, {
72
+ /* @__PURE__ */ o(x, {
72
73
  color: "text.secondary",
73
74
  component: "p",
74
75
  sx: { mt: 16 },
75
76
  variant: "body2",
76
77
  children: t.description
77
78
  }),
78
- /* @__PURE__ */ d(c, {
79
+ /* @__PURE__ */ m(u, {
79
80
  sx: {
80
81
  gap: 24,
81
82
  pb: 24,
82
83
  pt: 32
83
84
  },
84
- children: [y("balance", t.credit_card_balance, {
85
+ children: [p("balance", t.credit_card_balance, {
85
86
  position: "start",
86
87
  symbol: "$"
87
- }), /* @__PURE__ */ d(c, {
88
+ }), /* @__PURE__ */ m(u, {
88
89
  sx: {
89
90
  flexDirection: "row",
90
91
  gap: 16
91
92
  },
92
- children: [y("interestRate", t.interest_rate, {
93
+ children: [p("interestRate", t.interest_rate, {
93
94
  position: "end",
94
95
  symbol: "%"
95
- }), y("monthlyPayment", t.monthly_payment, {
96
+ }), p("monthlyPayment", t.monthly_payment, {
96
97
  position: "start",
97
98
  symbol: "$"
98
99
  })]
99
100
  })]
100
101
  }),
101
- /* @__PURE__ */ o(G, {
102
+ /* @__PURE__ */ o(M, {
102
103
  fullWidth: !0,
103
104
  sx: {
104
105
  mb: 24,
@@ -108,25 +109,22 @@ var tt = ({ beat: i }) => {
108
109
  variant: "contained",
109
110
  children: t.calculate
110
111
  }),
111
- p.status === "failed" ? /* @__PURE__ */ o($, { copy: t }) : /* @__PURE__ */ o(j, {
112
+ d.status === "failed" ? /* @__PURE__ */ o(L, { copy: t }) : /* @__PURE__ */ o($, {
112
113
  copy: t,
113
- rows: p.status === "calculated" ? p.rows : void 0
114
+ rows: d.status === "calculated" ? d.rows : void 0
114
115
  })
115
116
  ]
116
117
  });
117
- }, ot = B(function({ beat: t }) {
118
- const { common: s, insights_feed: a } = S(), { accounts: f, accountsLoaded: u } = g(), m = a?.payoff_calculator;
119
- return m ? !t.primary_account && !u ? /* @__PURE__ */ o(A, {}) : /* @__PURE__ */ o(O, {
120
- account: D(t, f),
121
- copy: m
122
- }, t.guid) : /* @__PURE__ */ o(c, {
123
- sx: { p: 24 },
124
- children: /* @__PURE__ */ o(h, { children: s?.error_message })
125
- });
118
+ }, rt = j(function({ beat: t }) {
119
+ const { insights_feed: n } = S(), { accounts: a, accountsLoaded: f } = P(), l = n?.payoff_calculator;
120
+ return l ? !t.primary_account && !f ? /* @__PURE__ */ o(A, {}) : /* @__PURE__ */ o(O, {
121
+ account: D(t, a),
122
+ copy: l
123
+ }, t.guid) : /* @__PURE__ */ o(w, {});
126
124
  });
127
125
  export {
128
- ot as PayoffCalculatorBlock,
129
- tt as usePayoffCalculatorPrepare
126
+ rt as PayoffCalculatorBlock,
127
+ et as usePayoffCalculatorPrepare
130
128
  };
131
129
 
132
130
  //# sourceMappingURL=PayoffCalculatorBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayoffCalculatorBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Button from '@mui/material/Button'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport {\n buildPayoffRows,\n initialPayoffInputs,\n parsePayoffInputs,\n resolvePrimaryAccount,\n validatePayoffInputs,\n type PayoffErrors,\n type PayoffField,\n type PayoffInputs,\n type PayoffRow,\n} from './layout'\nimport { isPayoffPossible } from './payoff'\nimport { CalculationFailed, PayoffResults } from './PayoffResults'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const usePayoffCalculatorPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\ntype Outcome =\n | { status: 'idle' }\n | { status: 'calculated'; rows: PayoffRow[] }\n | { status: 'failed' }\n\ninterface PayoffCalculatorFormProps {\n account?: Account\n copy: PayoffCalculatorCopy\n}\n\nconst PayoffCalculatorForm = ({ account, copy }: PayoffCalculatorFormProps) => {\n const id = React.useId()\n const [inputs, setInputs] = React.useState<PayoffInputs>(() => initialPayoffInputs(account))\n const [errors, setErrors] = React.useState<PayoffErrors>({})\n const [outcome, setOutcome] = React.useState<Outcome>({ status: 'idle' })\n\n const accountName = account ? getAccountDisplayName(account) : ''\n\n const setField = (field: PayoffField) => (event: React.ChangeEvent<HTMLInputElement>) =>\n setInputs((previous) => ({ ...previous, [field]: event.target.value }))\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n\n const nextErrors = validatePayoffInputs(inputs, copy)\n\n setErrors(nextErrors)\n if (Object.keys(nextErrors).length > 0) return\n\n const { balance, interestRate, monthlyPayment } = parsePayoffInputs(inputs)\n\n setOutcome(\n isPayoffPossible(interestRate, balance, monthlyPayment)\n ? { status: 'calculated', rows: buildPayoffRows(interestRate, balance, monthlyPayment) }\n : { status: 'failed' },\n )\n }\n\n const field = (\n name: PayoffField,\n label: string,\n adornment: { position: 'start' | 'end'; symbol: string },\n ) => (\n <TextField\n error={!!errors[name]}\n fullWidth={true}\n helperText={errors[name]}\n id={`${id}-${name}`}\n label={label}\n onChange={setField(name)}\n slotProps={{\n htmlInput: { inputMode: 'decimal' },\n input: {\n [adornment.position === 'start' ? 'startAdornment' : 'endAdornment']: (\n <InputAdornment aria-hidden=\"true\" position={adornment.position}>\n {adornment.symbol}\n </InputAdornment>\n ),\n },\n }}\n value={inputs[name]}\n />\n )\n\n return (\n <Stack component=\"form\" noValidate={true} onSubmit={handleSubmit} sx={{ p: 16 }}>\n {accountName && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <InstitutionLogo alt=\"\" institutionGuid={account?.institution_guid ?? ''} size={24} />\n <Text component=\"p\" variant=\"body2\">\n {accountName}\n </Text>\n </Stack>\n )}\n <Text color=\"text.secondary\" component=\"p\" sx={{ mt: 16 }} variant=\"body2\">\n {copy.description}\n </Text>\n <Stack sx={{ gap: 24, pb: 24, pt: 32 }}>\n {field('balance', copy.credit_card_balance, { position: 'start', symbol: '$' })}\n <Stack sx={{ flexDirection: 'row', gap: 16 }}>\n {field('interestRate', copy.interest_rate, { position: 'end', symbol: '%' })}\n {field('monthlyPayment', copy.monthly_payment, { position: 'start', symbol: '$' })}\n </Stack>\n </Stack>\n <Button fullWidth={true} sx={{ mb: 24, mt: 8 }} type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n {outcome.status === 'failed' ? (\n <CalculationFailed copy={copy} />\n ) : (\n <PayoffResults\n copy={copy}\n rows={outcome.status === 'calculated' ? outcome.rows : undefined}\n />\n )}\n </Stack>\n )\n}\n\n/**\n * Monthly Credit Card Interest Summary's \"Learn how to save\" drawer: the credit card payoff\n * calculator. The beat's account prefills the balance, interest rate and minimum payment; the\n * user edits them and compares the payoff at that payment, $10 more and $20 more.\n */\nexport const PayoffCalculatorBlock = observer(function PayoffCalculatorBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accounts, accountsLoaded } = useAccountStore()\n const copy = insightsFeedCopy?.payoff_calculator\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if (!beat.primary_account && !accountsLoaded) return <Loader />\n\n return (\n <PayoffCalculatorForm\n account={resolvePrimaryAccount(beat, accounts)}\n copy={copy}\n key={beat.guid}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAa,KAAA,CAA8B,EAAE,MAAA,EAAA,MAA6B;AACxE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GAAG,CAAC,CAAC;AACP,GAYM,IAAA,CAAwB,EAAE,SAAA,GAAS,MAAA,EAAA,MAAsC;AAC7E,QAAM,IAAK,EAAM,MAAM,GACjB,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAA,MAA6B,EAAoB,CAAO,CAAC,GACrF,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAuB,CAAC,CAAC,GACrD,CAAC,GAAS,CAAA,IAAc,EAAM,SAAkB,EAAE,QAAQ,OAAO,CAAC,GAElE,IAAc,IAAU,EAAsB,CAAO,IAAI,IAEzD,IAAA,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,EAAC,GAAD,EAAyB,MAAA,EAAO,CAAA,IAEhC,gBAAA,EAAC,GAAD;AAAA,QACQ,MAAA;AAAA,QACN,MAAM,EAAQ,WAAW,eAAe,EAAQ,OAAO;AAAA,MACxD,CAAA;AAAA,IAEE;AAAA;AAEX,GAOa,KAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,UAAA,GAAU,gBAAA,EAAA,IAAmB,EAAgB,GAC/C,IAAO,GAAkB;AAE/B,SAAK,IAQD,CAAC,EAAK,mBAAmB,CAAC,IAAuB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAG5D,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAsB,GAAM,CAAQ;AAAA,IACvC,MAAA;AAAA,EAEP,GADM,EAAK,IACX,IAbC,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,cAAoB,CAAA;AAAA,EAClC,CAAA;AAab,CAAC"}
1
+ {"version":3,"file":"PayoffCalculatorBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Button from '@mui/material/Button'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport {\n buildPayoffRows,\n initialPayoffInputs,\n parsePayoffInputs,\n resolvePrimaryAccount,\n validatePayoffInputs,\n type PayoffErrors,\n type PayoffField,\n type PayoffInputs,\n type PayoffRow,\n} from './layout'\nimport { isPayoffPossible } from './payoff'\nimport { CalculationFailed, PayoffResults } from './PayoffResults'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const usePayoffCalculatorPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\ntype Outcome =\n | { status: 'idle' }\n | { status: 'calculated'; rows: PayoffRow[] }\n | { status: 'failed' }\n\ninterface PayoffCalculatorFormProps {\n account?: Account\n copy: PayoffCalculatorCopy\n}\n\nconst PayoffCalculatorForm = ({ account, copy }: PayoffCalculatorFormProps) => {\n const id = React.useId()\n const [inputs, setInputs] = React.useState<PayoffInputs>(() => initialPayoffInputs(account))\n const [errors, setErrors] = React.useState<PayoffErrors>({})\n const [outcome, setOutcome] = React.useState<Outcome>({ status: 'idle' })\n\n const accountName = account ? getAccountDisplayName(account) : ''\n\n const setField = (field: PayoffField) => (event: React.ChangeEvent<HTMLInputElement>) =>\n setInputs((previous) => ({ ...previous, [field]: event.target.value }))\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n\n const nextErrors = validatePayoffInputs(inputs, copy)\n\n setErrors(nextErrors)\n if (Object.keys(nextErrors).length > 0) return\n\n const { balance, interestRate, monthlyPayment } = parsePayoffInputs(inputs)\n\n setOutcome(\n isPayoffPossible(interestRate, balance, monthlyPayment)\n ? { status: 'calculated', rows: buildPayoffRows(interestRate, balance, monthlyPayment) }\n : { status: 'failed' },\n )\n }\n\n const field = (\n name: PayoffField,\n label: string,\n adornment: { position: 'start' | 'end'; symbol: string },\n ) => (\n <TextField\n error={!!errors[name]}\n fullWidth={true}\n helperText={errors[name]}\n id={`${id}-${name}`}\n label={label}\n onChange={setField(name)}\n slotProps={{\n htmlInput: { inputMode: 'decimal' },\n input: {\n [adornment.position === 'start' ? 'startAdornment' : 'endAdornment']: (\n <InputAdornment aria-hidden=\"true\" position={adornment.position}>\n {adornment.symbol}\n </InputAdornment>\n ),\n },\n }}\n value={inputs[name]}\n />\n )\n\n return (\n <Stack component=\"form\" noValidate={true} onSubmit={handleSubmit} sx={{ p: 16 }}>\n {accountName && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <InstitutionLogo alt=\"\" institutionGuid={account?.institution_guid ?? ''} size={24} />\n <Text component=\"p\" variant=\"body2\">\n {accountName}\n </Text>\n </Stack>\n )}\n <Text color=\"text.secondary\" component=\"p\" sx={{ mt: 16 }} variant=\"body2\">\n {copy.description}\n </Text>\n <Stack sx={{ gap: 24, pb: 24, pt: 32 }}>\n {field('balance', copy.credit_card_balance, { position: 'start', symbol: '$' })}\n <Stack sx={{ flexDirection: 'row', gap: 16 }}>\n {field('interestRate', copy.interest_rate, { position: 'end', symbol: '%' })}\n {field('monthlyPayment', copy.monthly_payment, { position: 'start', symbol: '$' })}\n </Stack>\n </Stack>\n <Button fullWidth={true} sx={{ mb: 24, mt: 8 }} type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n {outcome.status === 'failed' ? (\n <CalculationFailed copy={copy} />\n ) : (\n <PayoffResults\n copy={copy}\n rows={outcome.status === 'calculated' ? outcome.rows : undefined}\n />\n )}\n </Stack>\n )\n}\n\n/**\n * Monthly Credit Card Interest Summary's \"Learn how to save\" drawer: the credit card payoff\n * calculator. The beat's account prefills the balance, interest rate and minimum payment; the\n * user edits them and compares the payoff at that payment, $10 more and $20 more.\n */\nexport const PayoffCalculatorBlock = observer(function PayoffCalculatorBlock({\n beat,\n}: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accounts, accountsLoaded } = useAccountStore()\n const copy = insightsFeedCopy?.payoff_calculator\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n if (!beat.primary_account && !accountsLoaded) return <Loader />\n\n return (\n <PayoffCalculatorForm\n account={resolvePrimaryAccount(beat, accounts)}\n copy={copy}\n key={beat.guid}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAa,KAAA,CAA8B,EAAE,MAAA,EAAA,MAA6B;AACxE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GAAG,CAAC,CAAC;AACP,GAYM,IAAA,CAAwB,EAAE,SAAA,GAAS,MAAA,EAAA,MAAsC;AAC7E,QAAM,IAAK,EAAM,MAAM,GACjB,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAA,MAA6B,EAAoB,CAAO,CAAC,GACrF,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAuB,CAAC,CAAC,GACrD,CAAC,GAAS,CAAA,IAAc,EAAM,SAAkB,EAAE,QAAQ,OAAO,CAAC,GAElE,IAAc,IAAU,EAAsB,CAAO,IAAI,IAEzD,IAAA,CAAY,MAAA,CAAwB,MACxC,EAAA,CAAW,OAAc;AAAA,IAAE,GAAG;AAAA,IAAW,CAAA,CAAA,GAAQ,EAAM,OAAO;AAAA,EAAM,EAAE,GAElE,IAAA,CAAgB,MAA4C;AAChE,IAAA,EAAM,eAAe;AAErB,UAAM,IAAa,EAAqB,GAAQ,CAAI;AAGpD,QADA,EAAU,CAAU,GAChB,OAAO,KAAK,CAAU,EAAE,SAAS,EAAG;AAExC,UAAM,EAAE,SAAA,GAAS,cAAA,GAAc,gBAAA,EAAA,IAAmB,EAAkB,CAAM;AAE1E,IAAA,EACE,EAAiB,GAAc,GAAS,CAAc,IAClD;AAAA,MAAE,QAAQ;AAAA,MAAc,MAAM,EAAgB,GAAc,GAAS,CAAc;AAAA,IAAE,IACrF,EAAE,QAAQ,SAAS,CACzB;AAAA,EACF,G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ADM,EAAK,IACX,IAVM,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAY/B,CAAC"}
@@ -1,42 +1,37 @@
1
- import { useAccountStore as d, useGlobalCopyStore as g, useGlobalStore as y } from "../../../common/context/hooks.es.js";
2
- import S from "../../../common/components/drawer/Drawer.es.js";
3
- import i from "../../../common/components/Loader.es.js";
4
- import { AccountDetailsBlock as A } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
5
- import { buildStrategies as _, resolveStrategyAccounts as C, toPayoffAccountRow as h } from "./layout.es.js";
6
- import b from "./PayoffStrategiesContent.es.js";
7
- import { useState as k } from "react";
8
- import { observer as v } from "mobx-react-lite";
9
- import w from "@mui/material/Stack";
10
- import { Text as x } from "@mxenabled/mxui";
11
- import { Fragment as G, jsx as o, jsxs as P } from "react/jsx-runtime";
12
- var E = v(function({ beat: r }) {
13
- const [t, c] = k(null), { copyStore: s } = y(), { accounts: n, common: a, insights_feed: l } = g(), { accountsLoaded: m, visibleAccounts: u } = d(), e = l?.general;
14
- if (!s.isInitialized) return /* @__PURE__ */ o(i, {});
15
- if (!e) return /* @__PURE__ */ o(w, {
16
- sx: { p: 24 },
17
- children: /* @__PURE__ */ o(x, { children: a?.error_message ?? "Something went wrong." })
18
- });
19
- if (!m) return /* @__PURE__ */ o(i, {});
20
- const p = C(r, u).map(h), f = () => c(null);
21
- return /* @__PURE__ */ P(G, { children: [/* @__PURE__ */ o(b, {
22
- accounts: p,
23
- copy: e,
1
+ import { useAccountStore as m, useGlobalCopyStore as p } from "../../../common/context/hooks.es.js";
2
+ import f from "../../../common/components/drawer/Drawer.es.js";
3
+ import d from "../../../common/components/Loader.es.js";
4
+ import { BlockErrorMessage as g } from "../BlockErrorMessage.es.js";
5
+ import { AccountDetailsBlock as y } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
6
+ import { buildStrategies as A, resolveStrategyAccounts as S, toPayoffAccountRow as _ } from "./layout.es.js";
7
+ import C from "./PayoffStrategiesContent.es.js";
8
+ import { useState as b } from "react";
9
+ import { observer as k } from "mobx-react-lite";
10
+ import { Fragment as v, jsx as o, jsxs as h } from "react/jsx-runtime";
11
+ var O = k(function({ beat: e }) {
12
+ const [t, c] = b(null), { accounts: s, insights_feed: a } = p(), { accountsLoaded: n, visibleAccounts: i } = m(), r = a?.general;
13
+ if (!r) return /* @__PURE__ */ o(g, {});
14
+ if (!n) return /* @__PURE__ */ o(d, {});
15
+ const u = S(e, i).map(_), l = () => c(null);
16
+ return /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ o(C, {
17
+ accounts: u,
18
+ copy: r,
24
19
  onAccountClick: c,
25
- strategies: _(e)
26
- }), /* @__PURE__ */ o(S, {
27
- ariaLabelClose: n?.close_account_details_aria,
20
+ strategies: A(r)
21
+ }), /* @__PURE__ */ o(f, {
22
+ ariaLabelClose: s?.close_account_details_aria,
28
23
  isOpen: t !== null,
29
- onClose: f,
30
- title: n?.account_details,
31
- children: t && /* @__PURE__ */ o(A, { beat: {
32
- ...r,
24
+ onClose: l,
25
+ title: s?.account_details,
26
+ children: t && /* @__PURE__ */ o(y, { beat: {
27
+ ...e,
33
28
  primary_account: void 0,
34
29
  primary_account_guid: t
35
30
  } })
36
31
  })] });
37
32
  });
38
33
  export {
39
- E as PayoffStrategiesBlock
34
+ O as PayoffStrategiesBlock
40
35
  };
41
36
 
42
37
  //# sourceMappingURL=PayoffStrategiesBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useAccountStore,\n useGlobalCopyStore,\n useGlobalStore,\n} from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\n/**\n * Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the\n * beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the\n * shared AccountDetailsBlock) in a nested drawer.\n */\nexport const PayoffStrategiesBlock = observer(function PayoffStrategiesBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { copyStore } = useGlobalStore()\n const {\n accounts: accountsCopy,\n common: commonCopy,\n insights_feed: insightsFeedCopy,\n } = useGlobalCopyStore()\n const { accountsLoaded, visibleAccounts } = useAccountStore()\n const copy = insightsFeedCopy?.general\n\n if (!copyStore.isInitialized) return <Loader />\n\n // Copy loads once at app start, so a retry cannot clear a missing namespace: a plain message.\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message ?? 'Something went wrong.'}</Text>\n </Stack>\n )\n }\n\n if (!accountsLoaded) return <Loader />\n\n const rows = resolveStrategyAccounts(beat, visibleAccounts).map(toPayoffAccountRow)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <PayoffStrategiesContent\n accounts={rows}\n copy={copy}\n onAccountClick={setTappedAccountGuid}\n strategies={buildStrategies(copy)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;AAyBA,IAAa,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,WAAA,EAAA,IAAc,EAAe,GAC/B,EACJ,UAAU,GACV,QAAQ,GACR,eAAe,EAAA,IACb,EAAmB,GACjB,EAAE,gBAAA,GAAgB,iBAAA,EAAA,IAAoB,EAAgB,GACtD,IAAO,GAAkB;AAE/B,MAAI,CAAC,EAAU,cAAe,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAG9C,MAAI,CAAC,EACH,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,iBAAiB,wBAA8B,CAAA;AAAA,EAC7D,CAAA;AAIX,MAAI,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAErC,QAAM,IAAO,EAAwB,GAAM,CAAe,EAAE,IAAI,CAAkB,GAC5E,IAAA,MAA4B,EAAqB,IAAI;AAE3D,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,IACJ,MAAA;AAAA,IACN,gBAAgB;AAAA,IAChB,YAAY,EAAgB,CAAI;AAAA,EACjC,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,GAAc;AAAA,IAC9B,QAAQ,MAAsB;AAAA,IAC9B,SAAS;AAAA,IACT,OAAO,GAAc;AAAA,IAEpB,UAAA,KAEC,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
+ {"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Drawer, Loader, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\n/**\n * Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the\n * beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the\n * shared AccountDetailsBlock) in a nested drawer.\n */\nexport const PayoffStrategiesBlock = observer(function PayoffStrategiesBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { accounts: accountsCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accountsLoaded, visibleAccounts } = useAccountStore()\n const copy = insightsFeedCopy?.general\n\n if (!copy) {\n return <BlockErrorMessage />\n }\n\n if (!accountsLoaded) return <Loader />\n\n const rows = resolveStrategyAccounts(beat, visibleAccounts).map(toPayoffAccountRow)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <PayoffStrategiesContent\n accounts={rows}\n copy={copy}\n onAccountClick={setTappedAccountGuid}\n strategies={buildStrategies(copy)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;AAiBA,IAAa,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,UAAU,GAAc,eAAe,EAAA,IAAqB,EAAmB,GACjF,EAAE,gBAAA,GAAgB,iBAAA,EAAA,IAAoB,EAAgB,GACtD,IAAO,GAAkB;AAE/B,MAAI,CAAC,EACH,QAAO,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAG7B,MAAI,CAAC,EAAgB,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAErC,QAAM,IAAO,EAAwB,GAAM,CAAe,EAAE,IAAI,CAAkB,GAC5E,IAAA,MAA4B,EAAqB,IAAI;AAE3D,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,IACJ,MAAA;AAAA,IACN,gBAAgB;AAAA,IAChB,YAAY,EAAgB,CAAI;AAAA,EACjC,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,GAAc;AAAA,IAC9B,QAAQ,MAAsB;AAAA,IAC9B,SAAS;AAAA,IACT,OAAO,GAAc;AAAA,IAEpB,UAAA,KAEC,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 +1 @@
1
- {"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const cta = useOpenedCta(beat)\n\n return <PlaceholderVariants beat={beat} variant={cta?.variant} />\n})\n"],"mappings":";;;;;;;AA2BA,IAAM,IAAqB,EAAA,CAAU,EAAE,MAAA,EAAA,MAAoC;A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ock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts. ActionBlockLayer mounts it once\n// copy has loaded; render `BlockErrorMessage` when its copy or data is missing.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const cta = useOpenedCta(beat)\n\n return <PlaceholderVariants beat={beat} variant={cta?.variant} />\n})\n"],"mappings":";;;;;;;AA4BA,IAAM,IAAqB,EAAA,CAAU,EAAE,MAAA,EAAA,MAAoC;AAGzE,QAAM,EAAE,eAAA,IAAgB,GAAG,UAAA,IAAW,EAAA,IAAM,EAAmC,KAAK,CAAC;AAErF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,KAAK;AAAA,MAAG,GAAG;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAAtE,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD,EAAA,UAAI,+BAAgC,CAAA;AAAA,MACpC,gBAAA,EAAC,GAAD,EAAA,UAAM,+IAGA,CAAA;AAAA,MACN,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA;AAAA,MAC7B,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,QAAM;AAAA,QACsB;AAAA,QAAc;AAAA,QAAY;AAAA,MAChD,EAAA,CAAA;AAAA,IACD;AAAA;AAEX,CAAC,GAGK,IAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAG,GAAG;AAAA,IAAI,WAAW;AAAA,EAAS;AAAA,EAAtE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAI,yCAA0C,CAAA,GAC9C,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA,CACxB;IAKH,IAAsB,EAA4C;AAAA,EACtE,UAAU;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV,MAAM;AACR,CAAC,GAEY,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,IAAM,EAAa,CAAI;AAE7B,SAAO,gBAAA,EAAC,GAAD;AAAA,IAA2B,MAAA;AAAA,IAAM,SAAS,GAAK;AAAA,EAAU,CAAA;AAClE,CAAC"}
@@ -1,47 +1,44 @@
1
- import { CategoryGuids as h } from "../../../core/constants/Category.es.js";
2
- import { DEFAULT_INSTITUTION_LOGO_URL as _ } from "../../../core/constants/InstitutionLogo.es.js";
3
- import y from "../../../common/utils/AccountDisplayName.es.js";
4
- import { useAccountStore as C, useAppConfig as x, useCashflowStore as T, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
1
+ import { CategoryGuids as f } from "../../../core/constants/Category.es.js";
2
+ import { DEFAULT_INSTITUTION_LOGO_URL as h } from "../../../core/constants/InstitutionLogo.es.js";
3
+ import _ from "../../../common/utils/AccountDisplayName.es.js";
4
+ import { useAccountStore as y, useAppConfig as C, useCashflowStore as x, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
5
5
  import { getAccountStartingBalance as R } from "../../../core/utils/AccountUtils.es.js";
6
- import L from "../../../common/components/Loader.es.js";
7
- import r from "../../components/CategoryTile.es.js";
8
- import { ErrorCard as E } from "../../components/ErrorCard.es.js";
9
- import { useRecurringExpensesLoadState as S } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
10
- import { foldOtherRows as a, getCaption as U } from "./layout.es.js";
11
- import A from "./RemainingCashContent.es.js";
12
- import { observer as I } from "mobx-react-lite";
13
- import O from "@mui/material/Stack";
14
- import { InstitutionLogo as s, Text as b } from "@mxenabled/mxui";
15
- import { jsx as n } from "react/jsx-runtime";
16
- var Q = I(function(N) {
17
- const { common: m, insights_feed: i } = G(), { config: c } = x(), { uiStore: t } = T(), { accountsLoaded: p } = C(), { failed: u, ready: d, retry: g } = S(), e = i?.remaining_cash;
18
- if (i?.general && !e) return /* @__PURE__ */ n(O, {
19
- sx: { p: 24 },
20
- children: /* @__PURE__ */ n(b, { children: m?.error_message })
21
- });
22
- if (u) return /* @__PURE__ */ n(E, { onRetry: g });
23
- if (!d || !p || !e) return /* @__PURE__ */ n(L, {});
24
- const l = a(t.selectedCashAccounts.map((o) => ({
25
- amount: R(o, c.display_available_balance_in_accounts),
6
+ import T from "../../../common/components/Loader.es.js";
7
+ import { BlockErrorMessage as E } from "../BlockErrorMessage.es.js";
8
+ import i from "../../components/CategoryTile.es.js";
9
+ import { ErrorCard as L } from "../../components/ErrorCard.es.js";
10
+ import { useRecurringExpensesLoadState as U } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
11
+ import { foldOtherRows as r, getCaption as A } from "./layout.es.js";
12
+ import I from "./RemainingCashContent.es.js";
13
+ import { observer as O } from "mobx-react-lite";
14
+ import { InstitutionLogo as a } from "@mxenabled/mxui";
15
+ import { jsx as t } from "react/jsx-runtime";
16
+ var J = O(function(b) {
17
+ const { insights_feed: s } = G(), { config: m } = C(), { uiStore: n } = x(), { accountsLoaded: c } = y(), { failed: u, ready: p, retry: d } = U(), e = s?.remaining_cash;
18
+ if (!e) return /* @__PURE__ */ t(E, {});
19
+ if (u) return /* @__PURE__ */ t(L, { onRetry: d });
20
+ if (!p || !c) return /* @__PURE__ */ t(T, {});
21
+ const g = r(n.selectedCashAccounts.map((o) => ({
22
+ amount: R(o, m.display_available_balance_in_accounts),
26
23
  key: o.guid,
27
- leading: /* @__PURE__ */ n(s, {
24
+ leading: /* @__PURE__ */ t(a, {
28
25
  alt: "",
29
26
  institutionGuid: o.institution_guid ?? "",
30
27
  size: 32
31
28
  }),
32
- name: y(o)
29
+ name: _(o)
33
30
  })), {
34
31
  multi: e.other_accounts,
35
32
  one: e.other_accounts_one
36
- }, /* @__PURE__ */ n(s, {
33
+ }, /* @__PURE__ */ t(a, {
37
34
  alt: "",
38
35
  institutionGuid: "",
39
- logoUrl: _,
36
+ logoUrl: h,
40
37
  size: 32
41
- })), f = a(t.expensesTilNextIncome.map((o) => ({
38
+ })), l = r(n.expensesTilNextIncome.map((o) => ({
42
39
  amount: o.amount,
43
40
  key: `${o.repeatingTransactionGuid}-${o.expectedDate.getTime()}`,
44
- leading: /* @__PURE__ */ n(r, {
41
+ leading: /* @__PURE__ */ t(i, {
45
42
  categoryGuid: o.categoryGuid,
46
43
  size: 32
47
44
  }),
@@ -49,33 +46,33 @@ var Q = I(function(N) {
49
46
  })), {
50
47
  multi: e.other_expenses,
51
48
  one: e.other_expenses_one
52
- }, /* @__PURE__ */ n(r, {
53
- categoryGuid: h.UNCATEGORIZED,
49
+ }, /* @__PURE__ */ t(i, {
50
+ categoryGuid: f.UNCATEGORIZED,
54
51
  size: 32
55
52
  }));
56
- return /* @__PURE__ */ n(A, {
53
+ return /* @__PURE__ */ t(I, {
57
54
  accounts: {
58
55
  header: e.accounts_header,
59
- rows: l
56
+ rows: g
60
57
  },
61
58
  expenses: {
62
59
  header: e.recurring_expenses_header,
63
- rows: f
60
+ rows: l
64
61
  },
65
62
  summary: {
66
- remaining: t.hasUpcomingPayday ? {
67
- amount: t.remainingUntilPayday,
68
- caption: U(e, t.daysUntilNextIncome)
63
+ remaining: n.hasUpcomingPayday ? {
64
+ amount: n.remainingUntilPayday,
65
+ caption: A(e, n.daysUntilNextIncome)
69
66
  } : void 0,
70
- cashOnHand: t.selectedCashBalance,
67
+ cashOnHand: n.selectedCashBalance,
71
68
  cashOnHandLabel: e.cash_on_hand,
72
- upcomingExpenses: t.upcomingExpensesTotal,
69
+ upcomingExpenses: n.upcomingExpensesTotal,
73
70
  upcomingExpensesLabel: e.upcoming_expenses
74
71
  }
75
72
  });
76
73
  });
77
74
  export {
78
- Q as RemainingCashBlock
75
+ J as RemainingCashBlock
79
76
  };
80
77
 
81
78
  //# sourceMappingURL=RemainingCashBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loads once, so a retry can't fix a missing namespace: a plain message, not ErrorCard.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded || !copy) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,IAAa,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB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A,IAAE,OAAO,EAAK;AAAA,IAAgB,KAAK,EAAK;AAAA,EAAmB,GAC3D,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAc;AAAA,IAAe,MAAM;AAAA,EAAK,CAAA,CACtE;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import { InstitutionLogo } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n if (!copy) return <BlockErrorMessage />\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,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K,GAAG,EAAQ,wBAAA,IAA4B,EAAQ,aAAa,QAAQ,CAAA;AAAA,IACzE,SAAS,gBAAA,EAAC,GAAD;AAAA,MAAc,cAAc,EAAQ;AAAA,MAAc,MAAM;AAAA,IAAK,CAAA;AAAA,IACtE,MAAM,EAAQ;AAAA,EAChB,EAAE,GACF;AAAA,IAAE,OAAO,EAAK;AAAA,IAAgB,KAAK,EAAK;AAAA,EAAmB,GAC3D,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAc;AAAA,IAAe,MAAM;AAAA,EAAK,CAAA,CACtE;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
@@ -1,25 +1,20 @@
1
- import { useGlobalCopyStore as m } from "../../../common/context/hooks.es.js";
2
- import s from "../../../common/components/Loader.es.js";
3
- import { useTransactionDetailsBlock as c } from "./useTransactionDetailsBlock.es.js";
4
- import l from "../../../transactions/components/shared/TransactionDetails.es.js";
1
+ import n from "../../../common/components/Loader.es.js";
2
+ import { BlockErrorMessage as e } from "../BlockErrorMessage.es.js";
3
+ import { useTransactionDetailsBlock as m } from "./useTransactionDetailsBlock.es.js";
4
+ import c from "../../../transactions/components/shared/TransactionDetails.es.js";
5
5
  import { observer as f } from "mobx-react-lite";
6
- import p from "@mui/material/Stack";
7
- import { Text as d } from "@mxenabled/mxui";
8
6
  import { jsx as o } from "react/jsx-runtime";
9
- var S = f(function({ beat: t }) {
10
- const { common: i } = m(), { bottomActions: e, isLoading: n, topActions: a, transaction: r } = c(t);
11
- return n ? /* @__PURE__ */ o(s, {}) : r ? /* @__PURE__ */ o(l, {
12
- bottomActions: e,
7
+ var T = f(function({ beat: t }) {
8
+ const { bottomActions: i, isLoading: a, topActions: s, transaction: r } = m(t);
9
+ return a ? /* @__PURE__ */ o(n, {}) : r ? /* @__PURE__ */ o(c, {
10
+ bottomActions: i,
13
11
  shouldShowEmbeddedCard: !1,
14
- topActions: a,
12
+ topActions: s,
15
13
  transaction: r
16
- }) : /* @__PURE__ */ o(p, {
17
- sx: { p: 24 },
18
- children: /* @__PURE__ */ o(d, { children: i.error_message })
19
- });
14
+ }) : /* @__PURE__ */ o(e, {});
20
15
  });
21
16
  export {
22
- S as TransactionDetailsBlock
17
+ T as TransactionDetailsBlock
23
18
  };
24
19
 
25
20
  //# sourceMappingURL=TransactionDetailsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useGlobalCopyStore } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Loading finished and the guid still resolves to nothing — a stale beat pointing at a deleted or\n // out-of-window transaction. Mirrors ActionBlockLayer's unknown-block branch rather than rendering\n // an empty drawer.\n if (!transaction) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy.error_message}</Text>\n </Stack>\n )\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n // Embedded insight card is a PFM-only concern (TransactionDetails defaults to true); this beat's own drawer must not show a redundant embedded card of itself.\n shouldShowEmbeddedCard={false}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;;;AAoBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAK1B,IASH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,IAEf,wBAAwB;AAAA,IACZ,YAAA;AAAA,IACC,aAAA;AAAA,EACd,CAAA,IAbC,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,EAAW,cAAoB,CAAA;AAAA,EACjC,CAAA;AAab,CAAC"}
1
+ {"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { Loader } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Stale beat: its transaction was deleted or is out of window.\n if (!transaction) {\n return <BlockErrorMessage />\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n // Embedded insight card is a PFM-only concern (TransactionDetails defaults to true); this beat's own drawer must not show a redundant embedded card of itself.\n shouldShowEmbeddedCard={false}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;AAkBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAG1B,IAKH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,IAEf,wBAAwB;AAAA,IACZ,YAAA;AAAA,IACC,aAAA;AAAA,EACd,CAAA,IAVM,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAY/B,CAAC"}