@mx-cartographer/experiences 9.7.96 → 9.7.97-alpha-harini-mos-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +3 -3
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +5 -4
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +25 -24
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +2 -2
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +49 -69
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +25 -8
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +33 -17
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +13 -13
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [9.7.98] - 11-04-2026
|
|
2
|
+
|
|
3
|
+
- **CHANGED** - Monthly Obligations Status drawer (WEC-2115): `AccountListBlock` is now a reusable block — its "How is this calculated?" breakdown renders from a generic row list, and the figures are read from the opened CTA's `drilldown_data` (ditto's `monthly_obligations` recipe on `account_list_block`) instead of the card-level `drilldown_data` tupac no longer sends. The calculation moves to the 3-value model matching Figma: **Available Funds − Planned Expenses = Total Remaining** (was the 4-value current-cash / estimated-income / recurring-expenses breakdown); the `account_list` copy keys change accordingly. The accounts list, totals and wiring are unchanged. **Breaking / deploy order:** `AccountListCopy` now requires `available_funds` and `planned_expenses` and treats `remaining` as "Total Remaining", so host apps must serve the new `account_list` copy (mr_copy / mrs_content) and ditto must serve the `monthly_obligations` recipe (ditto ≥ 1.7.45, !103) before this ships — otherwise the breakdown labels resolve blank and the figures are absent.
|
|
4
|
+
|
|
5
|
+
## [9.7.97] - 11-03-2026
|
|
6
|
+
|
|
7
|
+
- **ADDED** - HSA Deposit beat on Insights 2.0: the `with_header_footer` transaction card whose CTA opens Transaction Details for one deposit and the Transaction List for several (WEC-2214)
|
|
8
|
+
- **FIXED** - `BaseLayout` no longer throws on a `null` primary or secondary CTA (WEC-2214)
|
|
9
|
+
|
|
1
10
|
## [9.7.96] - 11-03-2026
|
|
2
11
|
|
|
3
12
|
- **FIXED** - Monthly Spend legend drops amount (MEW2-3428)
|
|
@@ -419,9 +419,9 @@ export interface AccountListCopy {
|
|
|
419
419
|
/** Drawer title. */
|
|
420
420
|
title: string;
|
|
421
421
|
how_is_this_calculated: string;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
422
|
+
available_funds: string;
|
|
423
|
+
planned_expenses: string;
|
|
424
|
+
/** The emphasised "Total Remaining" row. */
|
|
425
425
|
remaining: string;
|
|
426
426
|
accounts_header: string;
|
|
427
427
|
total_balance: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
2
2
|
/**
|
|
3
|
-
* Account List drawer (MEW2-3363): the beat's calculation
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Account List drawer (MEW2-3363): the beat's calculation plus the accounts behind it from the
|
|
4
|
+
* account store, largest balance first, with their total. Reusable across insights — the calculation
|
|
5
|
+
* is read from whichever CTA opened the drawer (`getDynamicCtaBasedOnTriggers`), whose `drilldown_data`
|
|
6
|
+
* tupac fills from ditto's `*_cta_drilldown_data` recipe; nothing is tied to one CTA kind. `observer`:
|
|
7
|
+
* reads copy, accounts and the open drawer from MobX stores.
|
|
7
8
|
*/
|
|
8
9
|
export declare const AccountListBlock: (({ beat }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
9
10
|
displayName: string;
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAccountStore as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import _ from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as h, useGlobalCopyStore as A, useGlobalStore as S, useInsightsV2Store as b } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import s from "../../../common/components/Loader.es.js";
|
|
4
|
+
import { getDynamicCtaBasedOnTriggers as w } from "../util.es.js";
|
|
5
|
+
import B from "./AccountListContent.es.js";
|
|
6
|
+
import { buildSummary as v, lastFour as C, resolveBeatAccounts as L, sumBalances as x } from "./layout.es.js";
|
|
7
|
+
import { observer as k } from "mobx-react-lite";
|
|
8
|
+
import D from "@mui/material/Stack";
|
|
9
|
+
import { Text as F } from "@mxenabled/mxui";
|
|
9
10
|
import { jsx as t } from "react/jsx-runtime";
|
|
10
|
-
var
|
|
11
|
+
var G = (o) => ({
|
|
11
12
|
balance: o.balance ?? 0,
|
|
12
13
|
guid: o.guid,
|
|
13
14
|
institutionGuid: o.institution_guid ?? "",
|
|
14
|
-
lastFour:
|
|
15
|
-
name:
|
|
16
|
-
}),
|
|
17
|
-
const { copyStore:
|
|
18
|
-
if (!
|
|
19
|
-
if (!
|
|
15
|
+
lastFour: C(o.account_number),
|
|
16
|
+
name: _(o)
|
|
17
|
+
}), H = k(function({ beat: i }) {
|
|
18
|
+
const { copyStore: e } = S(), { common: c, insights_feed: a } = A(), { accountsLoaded: m, cashAccounts: u, visibleAccounts: l } = h(), { actionDrawer: d } = b(), r = a?.account_list;
|
|
19
|
+
if (!e.isInitialized) return /* @__PURE__ */ t(s, {});
|
|
20
|
+
if (!r) return /* @__PURE__ */ t(D, {
|
|
20
21
|
sx: { p: 24 },
|
|
21
|
-
children: /* @__PURE__ */ t(
|
|
22
|
+
children: /* @__PURE__ */ t(F, { children: c?.error_message ?? "Something went wrong." })
|
|
22
23
|
});
|
|
23
|
-
if (!
|
|
24
|
-
const i =
|
|
25
|
-
return /* @__PURE__ */ t(
|
|
26
|
-
accounts:
|
|
27
|
-
copy:
|
|
28
|
-
summary:
|
|
29
|
-
totalBalance:
|
|
24
|
+
if (!m) return /* @__PURE__ */ t(s, {});
|
|
25
|
+
const { primary_cta: p, secondary_cta: f, in_description_cta: g } = i.insights_payload ?? {}, y = w(d, p, f, g)?.drilldown_data, n = L(i, l, u);
|
|
26
|
+
return /* @__PURE__ */ t(B, {
|
|
27
|
+
accounts: n.map(G),
|
|
28
|
+
copy: r,
|
|
29
|
+
summary: v(y, r),
|
|
30
|
+
totalBalance: x(n)
|
|
30
31
|
});
|
|
31
32
|
});
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
+
H as AccountListBlock
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
//# sourceMappingURL=AccountListBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {
|
|
1
|
+
{"version":3,"file":"AccountListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useGlobalCopyStore,\n useGlobalStore,\n useInsightsV2Store,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\nimport AccountListContent, { type AccountListRow } from './AccountListContent'\nimport { buildSummary, lastFour, resolveBeatAccounts, sumBalances } from './layout'\n\nconst toRow = (account: Account): AccountListRow => ({\n balance: account.balance ?? 0,\n guid: account.guid,\n institutionGuid: account.institution_guid ?? '',\n lastFour: lastFour(account.account_number),\n name: getAccountDisplayName(account),\n})\n\n/**\n * Account List drawer (MEW2-3363): the beat's calculation plus the accounts behind it from the\n * account store, largest balance first, with their total. Reusable across insights — the calculation\n * is read from whichever CTA opened the drawer (`getDynamicCtaBasedOnTriggers`), whose `drilldown_data`\n * tupac fills from ditto's `*_cta_drilldown_data` recipe; nothing is tied to one CTA kind. `observer`:\n * reads copy, accounts and the open drawer from MobX stores.\n */\nexport const AccountListBlock = observer(function AccountListBlock({ beat }: ActionBlockProps) {\n const { copyStore } = useGlobalStore()\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accountsLoaded, cashAccounts, visibleAccounts } = useAccountStore()\n const { actionDrawer } = useInsightsV2Store()\n const copy = insightsFeedCopy?.account_list\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 { primary_cta, secondary_cta, in_description_cta } = beat.insights_payload ?? {}\n // The calculation rides on the CTA that opened the drawer, not the card: tupac resolves ditto's\n // per-CTA drilldown recipe onto it.\n const drilldown = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n primary_cta,\n secondary_cta,\n in_description_cta,\n )?.drilldown_data\n const listed = resolveBeatAccounts(beat, visibleAccounts, cashAccounts)\n\n return (\n <AccountListContent\n accounts={listed.map(toRow)}\n copy={copy}\n summary={buildSummary(drilldown, copy)}\n totalBalance={sumBalances(listed)}\n />\n )\n})\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,IAA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ummary } from './layout';
|
|
3
3
|
export interface AccountListRow {
|
|
4
4
|
guid: string;
|
|
5
5
|
name: string;
|
|
@@ -12,7 +12,7 @@ export interface AccountListRow {
|
|
|
12
12
|
export interface AccountListContentProps {
|
|
13
13
|
copy: AccountListCopy;
|
|
14
14
|
/** Omitted when the beat carries no calculation: the drawer is just the list. */
|
|
15
|
-
summary?:
|
|
15
|
+
summary?: AccountListSummary;
|
|
16
16
|
/** Already ordered. */
|
|
17
17
|
accounts: AccountListRow[];
|
|
18
18
|
totalBalance: number;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { DEFAULT_INSTITUTION_LOGO_URL as
|
|
2
|
-
import { formatSignedCurrency as
|
|
3
|
-
import { createElement as
|
|
1
|
+
import { DEFAULT_INSTITUTION_LOGO_URL as b } from "../../../core/constants/InstitutionLogo.es.js";
|
|
2
|
+
import { formatSignedCurrency as x } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { createElement as g } from "react";
|
|
4
4
|
import n from "@mui/material/Stack";
|
|
5
|
-
import { InstitutionLogo as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
var
|
|
5
|
+
import { InstitutionLogo as f, Text as l } from "@mxenabled/mxui";
|
|
6
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
7
|
+
import c from "@mui/material/Box";
|
|
8
|
+
import m from "@mui/material/Divider";
|
|
9
|
+
var p = ({ children: o }) => /* @__PURE__ */ r(l, {
|
|
10
10
|
bold: !0,
|
|
11
11
|
sx: {
|
|
12
12
|
flexShrink: 0,
|
|
13
13
|
fontVariantNumeric: "tabular-nums"
|
|
14
14
|
},
|
|
15
15
|
variant: "body1",
|
|
16
|
-
children:
|
|
17
|
-
}),
|
|
16
|
+
children: o
|
|
17
|
+
}), u = ({ bold: o = !1, label: e, value: i }) => /* @__PURE__ */ t(n, {
|
|
18
18
|
sx: {
|
|
19
19
|
alignItems: "center",
|
|
20
20
|
flexDirection: "row",
|
|
@@ -22,24 +22,24 @@ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__
|
|
|
22
22
|
minHeight: 44,
|
|
23
23
|
px: 16
|
|
24
24
|
},
|
|
25
|
-
children: [/* @__PURE__ */
|
|
26
|
-
bold:
|
|
25
|
+
children: [/* @__PURE__ */ r(l, {
|
|
26
|
+
bold: o,
|
|
27
27
|
sx: { flexGrow: 1 },
|
|
28
28
|
variant: "body1",
|
|
29
|
-
children:
|
|
30
|
-
}), /* @__PURE__ */
|
|
31
|
-
}),
|
|
29
|
+
children: e
|
|
30
|
+
}), /* @__PURE__ */ r(p, { children: i })]
|
|
31
|
+
}), v = ({ summary: o }) => /* @__PURE__ */ t(n, {
|
|
32
32
|
sx: {
|
|
33
33
|
gap: 12,
|
|
34
34
|
pt: 24,
|
|
35
35
|
px: 24
|
|
36
36
|
},
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ r(l, {
|
|
38
38
|
bold: !0,
|
|
39
39
|
component: "h3",
|
|
40
40
|
variant: "body1",
|
|
41
|
-
children:
|
|
42
|
-
}), /* @__PURE__ */
|
|
41
|
+
children: o.heading
|
|
42
|
+
}), /* @__PURE__ */ r(n, {
|
|
43
43
|
sx: {
|
|
44
44
|
bgcolor: "background.paper",
|
|
45
45
|
border: "1px solid",
|
|
@@ -47,30 +47,13 @@ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__
|
|
|
47
47
|
borderRadius: "8px",
|
|
48
48
|
overflow: "hidden"
|
|
49
49
|
},
|
|
50
|
-
children: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */ e(p, {}),
|
|
56
|
-
/* @__PURE__ */ e(c, {
|
|
57
|
-
label: r.estimated_income,
|
|
58
|
-
value: v(o.estimatedIncome)
|
|
59
|
-
}),
|
|
60
|
-
/* @__PURE__ */ e(p, {}),
|
|
61
|
-
/* @__PURE__ */ e(c, {
|
|
62
|
-
label: r.recurring_expenses,
|
|
63
|
-
value: l(-o.upcomingExpenses)
|
|
64
|
-
}),
|
|
65
|
-
/* @__PURE__ */ e(p, {}),
|
|
66
|
-
/* @__PURE__ */ e(c, {
|
|
67
|
-
bold: !0,
|
|
68
|
-
label: r.remaining,
|
|
69
|
-
value: l(o.totalRemaining)
|
|
70
|
-
})
|
|
71
|
-
]
|
|
50
|
+
children: o.rows.map((e, i) => /* @__PURE__ */ t(c, { children: [i > 0 && /* @__PURE__ */ r(m, {}), /* @__PURE__ */ r(u, {
|
|
51
|
+
bold: e.bold,
|
|
52
|
+
label: e.label,
|
|
53
|
+
value: e.value
|
|
54
|
+
})] }, e.key))
|
|
72
55
|
})]
|
|
73
|
-
}),
|
|
56
|
+
}), y = ({ balance: o, institutionGuid: e, isLast: i, lastFour: a, name: d }) => /* @__PURE__ */ t(c, {
|
|
74
57
|
component: "li",
|
|
75
58
|
sx: { position: "relative" },
|
|
76
59
|
children: [/* @__PURE__ */ t(n, {
|
|
@@ -82,10 +65,10 @@ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__
|
|
|
82
65
|
py: 12
|
|
83
66
|
},
|
|
84
67
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ r(f, {
|
|
86
69
|
alt: "",
|
|
87
|
-
institutionGuid:
|
|
88
|
-
logoUrl:
|
|
70
|
+
institutionGuid: e,
|
|
71
|
+
logoUrl: e ? void 0 : b,
|
|
89
72
|
size: 32
|
|
90
73
|
}),
|
|
91
74
|
/* @__PURE__ */ t(n, {
|
|
@@ -93,51 +76,48 @@ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__
|
|
|
93
76
|
flexGrow: 1,
|
|
94
77
|
minWidth: 0
|
|
95
78
|
},
|
|
96
|
-
children: [/* @__PURE__ */
|
|
79
|
+
children: [/* @__PURE__ */ r(l, {
|
|
97
80
|
truncate: !0,
|
|
98
81
|
variant: "body1",
|
|
99
|
-
children:
|
|
100
|
-
}),
|
|
82
|
+
children: d
|
|
83
|
+
}), a && /* @__PURE__ */ r(l, {
|
|
101
84
|
color: "text.secondary",
|
|
102
85
|
variant: "caption",
|
|
103
|
-
children: `•••• ${
|
|
86
|
+
children: `•••• ${a}`
|
|
104
87
|
})]
|
|
105
88
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ r(p, { children: x(o) })
|
|
107
90
|
]
|
|
108
|
-
}), /* @__PURE__ */
|
|
91
|
+
}), /* @__PURE__ */ r(m, { sx: {
|
|
109
92
|
bottom: 0,
|
|
110
|
-
left:
|
|
93
|
+
left: i ? 0 : 24,
|
|
111
94
|
position: "absolute",
|
|
112
95
|
right: 0
|
|
113
96
|
} })]
|
|
114
|
-
}),
|
|
97
|
+
}), R = ({ accounts: o, copy: e, summary: i, totalBalance: a }) => /* @__PURE__ */ t(n, {
|
|
115
98
|
sx: {
|
|
116
99
|
bgcolor: "background.default",
|
|
117
100
|
pb: 24
|
|
118
101
|
},
|
|
119
|
-
children: [
|
|
120
|
-
copy: o,
|
|
121
|
-
summary: a
|
|
122
|
-
}), r.length === 0 ? /* @__PURE__ */ e(i, {
|
|
102
|
+
children: [i && /* @__PURE__ */ r(v, { summary: i }), o.length === 0 ? /* @__PURE__ */ r(l, {
|
|
123
103
|
component: "p",
|
|
124
104
|
sx: { p: 24 },
|
|
125
|
-
children:
|
|
105
|
+
children: e.no_accounts
|
|
126
106
|
}) : /* @__PURE__ */ t(n, { children: [
|
|
127
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ r(c, {
|
|
128
108
|
sx: {
|
|
129
109
|
pb: 4,
|
|
130
110
|
pt: 16,
|
|
131
111
|
px: 24
|
|
132
112
|
},
|
|
133
|
-
children: /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ r(l, {
|
|
134
114
|
bold: !0,
|
|
135
115
|
component: "h3",
|
|
136
116
|
variant: "body1",
|
|
137
|
-
children:
|
|
117
|
+
children: e.accounts_header
|
|
138
118
|
})
|
|
139
119
|
}),
|
|
140
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ r(n, {
|
|
141
121
|
component: "ul",
|
|
142
122
|
sx: {
|
|
143
123
|
bgcolor: "background.paper",
|
|
@@ -145,10 +125,10 @@ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__
|
|
|
145
125
|
m: 0,
|
|
146
126
|
p: 0
|
|
147
127
|
},
|
|
148
|
-
children:
|
|
149
|
-
...
|
|
150
|
-
isLast:
|
|
151
|
-
key:
|
|
128
|
+
children: o.map(({ guid: d, ...h }, s) => /* @__PURE__ */ g(y, {
|
|
129
|
+
...h,
|
|
130
|
+
isLast: s === o.length - 1,
|
|
131
|
+
key: d
|
|
152
132
|
}))
|
|
153
133
|
}),
|
|
154
134
|
/* @__PURE__ */ t(n, {
|
|
@@ -160,17 +140,17 @@ var v = (r) => r > 0 ? `+${l(r)}` : l(r), x = ({ children: r }) => /* @__PURE__
|
|
|
160
140
|
px: 24,
|
|
161
141
|
py: 14
|
|
162
142
|
},
|
|
163
|
-
children: [/* @__PURE__ */
|
|
143
|
+
children: [/* @__PURE__ */ r(l, {
|
|
164
144
|
bold: !0,
|
|
165
145
|
sx: { flexGrow: 1 },
|
|
166
146
|
variant: "body1",
|
|
167
|
-
children:
|
|
168
|
-
}), /* @__PURE__ */
|
|
147
|
+
children: e.total_balance
|
|
148
|
+
}), /* @__PURE__ */ r(p, { children: x(a) })]
|
|
169
149
|
})
|
|
170
150
|
] })]
|
|
171
151
|
});
|
|
172
152
|
export {
|
|
173
|
-
|
|
153
|
+
R as default
|
|
174
154
|
};
|
|
175
155
|
|
|
176
156
|
//# sourceMappingURL=AccountListContent.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountListContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListContent.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\n\nimport type {
|
|
1
|
+
{"version":3,"file":"AccountListContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/AccountListContent.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\n\nimport type { AccountListSummary } from './layout'\n\nexport interface AccountListRow {\n guid: string\n name: string\n /** The last digits of the account number, shown masked; empty when unknown. */\n lastFour: string\n /** Empty when no institution is known: the default logo is shown. */\n institutionGuid: string\n balance: number\n}\n\nexport interface AccountListContentProps {\n copy: AccountListCopy\n /** Omitted when the beat carries no calculation: the drawer is just the list. */\n summary?: AccountListSummary\n /** Already ordered. */\n accounts: AccountListRow[]\n totalBalance: number\n}\n\nconst Amount = ({ children }: { children: string }) => (\n <Text bold={true} sx={{ flexShrink: 0, fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {children}\n </Text>\n)\n\nconst BreakdownRow = ({\n bold = false,\n label,\n value,\n}: {\n bold?: boolean\n label: string\n value: string\n}) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 16 }}>\n <Text bold={bold} sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Amount>{value}</Amount>\n </Stack>\n)\n\n/**\n * The drawer's calculation, rendered from an abstract list of rows so any insight can reuse it: a\n * heading, then a boxed breakdown ending in its emphasised total. The block supplies the rows and\n * their formatted values.\n */\nconst Summary = ({ summary }: { summary: AccountListSummary }) => (\n <Stack sx={{ gap: 12, pt: 24, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {summary.heading}\n </Text>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n {summary.rows.map((row, index) => (\n <Box key={row.key}>\n {index > 0 && <Divider />}\n <BreakdownRow bold={row.bold} label={row.label} value={row.value} />\n </Box>\n ))}\n </Stack>\n </Stack>\n)\n\n/** One row. The last row's divider runs full width; the rest are inset to the text. */\nconst RowItem = ({\n balance,\n institutionGuid,\n isLast,\n lastFour,\n name,\n}: Omit<AccountListRow, 'guid'> & { isLast: boolean }) => (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12, px: 24, py: 12 }}>\n <InstitutionLogo\n alt=\"\"\n institutionGuid={institutionGuid}\n logoUrl={institutionGuid ? undefined : DEFAULT_INSTITUTION_LOGO_URL}\n size={32}\n />\n <Stack sx={{ flexGrow: 1, minWidth: 0 }}>\n <Text truncate={true} variant=\"body1\">\n {name}\n </Text>\n {lastFour && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {`•••• ${lastFour}`}\n </Text>\n )}\n </Stack>\n <Amount>{formatSignedCurrency(balance)}</Amount>\n </Stack>\n <Divider sx={{ bottom: 0, left: isLast ? 0 : 24, position: 'absolute', right: 0 }} />\n </Box>\n)\n\n/** Presentational body of the Account List drawer, minus the drawer header. */\nconst AccountListContent = ({ accounts, copy, summary, totalBalance }: AccountListContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n {summary && <Summary summary={summary} />}\n {accounts.length === 0 ? (\n <Text component=\"p\" sx={{ p: 24 }}>\n {copy.no_accounts}\n </Text>\n ) : (\n <Stack>\n <Box sx={{ pb: 4, pt: 16, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {copy.accounts_header}\n </Text>\n </Box>\n <Stack component=\"ul\" sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}>\n {accounts.map(({ guid, ...row }, index) => (\n <RowItem {...row} isLast={index === accounts.length - 1} key={guid} />\n ))}\n </Stack>\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n flexDirection: 'row',\n gap: 16,\n px: 24,\n py: 14,\n }}\n >\n <Text bold={true} sx={{ flexGrow: 1 }} variant=\"body1\">\n {copy.total_balance}\n </Text>\n <Amount>{formatSignedCurrency(totalBalance)}</Amount>\n </Stack>\n </Stack>\n )}\n </Stack>\n)\n\nexport default AccountListContent\n"],"mappings":";;;;;;;;AA+BA,IAAM,IAAA,CAAU,EAAE,UAAA,EAAA,MAChB,gBAAA,EAAC,GAAD;AAAA,EAAM,MAAM;AAAA,EAAM,IAAI;AAAA,IAAE,YAAY;AAAA,IAAG,oBAAoB;AAAA,EAAe;AAAA,EAAG,SAAQ;AAAA,EAClF,UAAA;AACG,CAAA,GAGF,IAAA,CAAgB,EACpB,MAAA,IAAO,IACP,OAAA,GACA,OAAA,EAAA,MAMA,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,eAAe;AAAA,IAAO,KAAK;AAAA,IAAI,WAAW;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAAxF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAY,MAAA;AAAA,IAAM,IAAI,EAAE,UAAU,EAAE;AAAA,IAAG,SAAQ;AAAA,IAC5C,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD,EAAA,UAAS,EAAc,CAAA,CAClB;IAQH,IAAA,CAAW,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,gBAAA,EAAC,GAAD;AAAA,MAAO,WAAU;AAAA,MAAK,IAAI;AAAA,QAAE,SAAS;AAAA,QAAoB,WAAW;AAAA,QAAQ,GAAG;AAAA,QAAG,GAAG;AAAA,MAAE;AAAA,MACpF,UAAA,EAAS,IAAA,CAAK,EAAE,MAAA,GAAM,GAAG,EAAA,GAAO,MAC/B,gBAAA,EAAC,GAAD;AAAA,QAAS,GAAI;AAAA,QAAK,QAAQ,MAAU,EAAS,SAAS;AAAA,QAAG,KAAK;AAAA,MAAO,CAAA,CACtE;AAAA,IACI,CAAA;AAAA,IACP,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,MARF,UAAA,CAUE,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,IAAI,EAAE,UAAU,EAAE;AAAA,QAAG,SAAQ;AAAA,QAC5C,UAAA,EAAK;AAAA,MACF,CAAA,GACN,gBAAA,EAAC,GAAD,EAAA,UAAS,EAAqB,CAAY,EAAU,CAAA,CAC/C;AAAA;EACF,EAAA,CAAA,CAEJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Account, Beat } from '../../../core';
|
|
1
|
+
import { Account, Beat, DrilldownData } from '../../../core';
|
|
2
|
+
import { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy';
|
|
2
3
|
/**
|
|
3
4
|
* The accounts the drawer lists, largest balance first: the beat's `account_guids` among the store's
|
|
4
5
|
* visible accounts, or every visible account the store counts as cash when the beat names none
|
|
@@ -10,11 +11,27 @@ export declare const resolveBeatAccounts: (beat: Beat, visibleAccounts: Account[
|
|
|
10
11
|
export declare const sumBalances: (accounts: Account[]) => number;
|
|
11
12
|
/** The last four digits of an account number; empty when the account has none. */
|
|
12
13
|
export declare const lastFour: (accountNumber?: string) => string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/** A generic breakdown row: a label and its already-formatted display value. */
|
|
15
|
+
export interface SummaryRow {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
value: string;
|
|
19
|
+
/** The emphasised total row. */
|
|
20
|
+
bold?: boolean;
|
|
18
21
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The drawer's "How is this calculated?" breakdown that AccountListContent renders — a heading and an
|
|
24
|
+
* ordered list of label/value rows, so the presentational component is independent of any one insight's
|
|
25
|
+
* model. Each insight supplies its own builder (see `buildSummary` for Monthly Obligations) for this shape.
|
|
26
|
+
*/
|
|
27
|
+
export interface AccountListSummary {
|
|
28
|
+
heading: string;
|
|
29
|
+
rows: SummaryRow[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The Monthly Obligations breakdown builder: maps the opened CTA's `drilldown_data` (ditto's three
|
|
33
|
+
* `monthly_obligations` recipe keys) and the copy into an `AccountListSummary`. `undefined` unless every
|
|
34
|
+
* figure is a finite number, so a degraded row shows the account list alone. Another insight that reuses
|
|
35
|
+
* AccountListContent adds its own builder for its own keys.
|
|
36
|
+
*/
|
|
37
|
+
export declare const buildSummary: (drilldown: DrilldownData | undefined, copy: AccountListCopy) => AccountListSummary | undefined;
|
|
@@ -1,24 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { formatSignedCurrency as s } from "../../../core/utils/NumberFormatting.es.js";
|
|
2
|
+
var u = (e) => e.balance ?? 0, v = (e, a, n) => {
|
|
3
|
+
const l = new Set(e.account_guids?.length ? e.account_guids : n.map(({ guid: r }) => r));
|
|
4
|
+
return a.filter((r) => l.has(r.guid)).sort((r, t) => u(t) - u(r));
|
|
5
|
+
}, d = (e) => e.reduce((a, n) => a + u(n), 0), c = (e) => e?.replace(/\D/g, "").slice(-4) ?? "", i = (e, a) => {
|
|
6
|
+
const n = e?.[a];
|
|
7
|
+
return typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
8
|
+
}, m = (e, a) => {
|
|
9
|
+
const n = i(e, "available_funds"), l = i(e, "planned_expenses"), r = i(e, "total_remaining");
|
|
10
|
+
if (!(n === void 0 || l === void 0 || r === void 0))
|
|
10
11
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
heading: a.how_is_this_calculated,
|
|
13
|
+
rows: [
|
|
14
|
+
{
|
|
15
|
+
key: "available_funds",
|
|
16
|
+
label: a.available_funds,
|
|
17
|
+
value: s(n)
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: "planned_expenses",
|
|
21
|
+
label: a.planned_expenses,
|
|
22
|
+
value: s(-l)
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
bold: !0,
|
|
26
|
+
key: "remaining",
|
|
27
|
+
label: a.remaining,
|
|
28
|
+
value: s(r)
|
|
29
|
+
}
|
|
30
|
+
]
|
|
15
31
|
};
|
|
16
32
|
};
|
|
17
33
|
export {
|
|
18
|
-
m as
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
m as buildSummary,
|
|
35
|
+
c as lastFour,
|
|
36
|
+
v as resolveBeatAccounts,
|
|
37
|
+
d as sumBalances
|
|
22
38
|
};
|
|
23
39
|
|
|
24
40
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import type { Account, Beat } from '../../../core'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n/**\n * The accounts the drawer lists, largest balance first: the beat's `account_guids` among the store's\n * visible accounts, or every visible account the store counts as cash when the beat names none\n * (tupac's Monthly Obligations factory sums the cash accounts without recording their guids). Both\n * rules are the store's: `visibleAccounts` applies the widget's hidden, closed and external/held\n * settings, `cashAccounts` says which types are cash.\n */\nexport const resolveBeatAccounts = (\n beat: Beat,\n visibleAccounts: Account[],\n cashAccounts: Account[],\n): Account[] => {\n const guids = new Set<string>(\n beat.account_guids?.length ? beat.account_guids : cashAccounts.map(({ guid }) => guid),\n )\n\n return visibleAccounts\n .filter((account) => guids.has(account.guid))\n .sort((a, b) => balanceOf(b) - balanceOf(a))\n}\n\nexport const sumBalances = (accounts: Account[]): number =>\n accounts.reduce((total, account) => total + balanceOf(account), 0)\n\n/** The last four digits of an account number; empty when the account has none. */\nexport const lastFour = (accountNumber?: string): string =>\n accountNumber?.replace(/\\D/g, '').slice(-4) ?? ''\n\nexport interface
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import type { Account, Beat, DrilldownData } from '../../../core'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n/**\n * The accounts the drawer lists, largest balance first: the beat's `account_guids` among the store's\n * visible accounts, or every visible account the store counts as cash when the beat names none\n * (tupac's Monthly Obligations factory sums the cash accounts without recording their guids). Both\n * rules are the store's: `visibleAccounts` applies the widget's hidden, closed and external/held\n * settings, `cashAccounts` says which types are cash.\n */\nexport const resolveBeatAccounts = (\n beat: Beat,\n visibleAccounts: Account[],\n cashAccounts: Account[],\n): Account[] => {\n const guids = new Set<string>(\n beat.account_guids?.length ? beat.account_guids : cashAccounts.map(({ guid }) => guid),\n )\n\n return visibleAccounts\n .filter((account) => guids.has(account.guid))\n .sort((a, b) => balanceOf(b) - balanceOf(a))\n}\n\nexport const sumBalances = (accounts: Account[]): number =>\n accounts.reduce((total, account) => total + balanceOf(account), 0)\n\n/** The last four digits of an account number; empty when the account has none. */\nexport const lastFour = (accountNumber?: string): string =>\n accountNumber?.replace(/\\D/g, '').slice(-4) ?? ''\n\n/** A generic breakdown row: a label and its already-formatted display value. */\nexport interface SummaryRow {\n key: string\n label: string\n value: string\n /** The emphasised total row. */\n bold?: boolean\n}\n\n/**\n * The drawer's \"How is this calculated?\" breakdown that AccountListContent renders — a heading and an\n * ordered list of label/value rows, so the presentational component is independent of any one insight's\n * model. Each insight supplies its own builder (see `buildSummary` for Monthly Obligations) for this shape.\n */\nexport interface AccountListSummary {\n heading: string\n rows: SummaryRow[]\n}\n\nconst numberFrom = (drilldown: DrilldownData | undefined, key: string): number | undefined => {\n const value = drilldown?.[key]\n\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n}\n\n/**\n * The Monthly Obligations breakdown builder: maps the opened CTA's `drilldown_data` (ditto's three\n * `monthly_obligations` recipe keys) and the copy into an `AccountListSummary`. `undefined` unless every\n * figure is a finite number, so a degraded row shows the account list alone. Another insight that reuses\n * AccountListContent adds its own builder for its own keys.\n */\nexport const buildSummary = (\n drilldown: DrilldownData | undefined,\n copy: AccountListCopy,\n): AccountListSummary | undefined => {\n const availableFunds = numberFrom(drilldown, 'available_funds')\n const plannedExpenses = numberFrom(drilldown, 'planned_expenses')\n const totalRemaining = numberFrom(drilldown, 'total_remaining')\n\n if (availableFunds === undefined || plannedExpenses === undefined || totalRemaining === undefined) {\n return undefined\n }\n\n return {\n heading: copy.how_is_this_calculated,\n rows: [\n { key: 'available_funds', label: copy.available_funds, value: formatSignedCurrency(availableFunds) },\n // Shown as a deduction (-$1,200.00), per Figma; the figure is stored positive.\n { key: 'planned_expenses', label: copy.planned_expenses, value: formatSignedCurrency(-plannedExpenses) },\n { bold: true, key: 'remaining', label: copy.remaining, value: formatSignedCurrency(totalRemaining) },\n ],\n }\n}\n"],"mappings":";AAIA,IAAM,IAAA,CAAa,MAAqB,EAAQ,WAAW,GAS9C,IAAA,CACX,GACA,GACA,MACc;AACd,QAAM,I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ionBlocks/ActionBlockLayer.es.js";
|
|
15
15
|
import ko from "./Footer.es.js";
|
|
16
16
|
import yo from "./Header.es.js";
|
|
17
|
-
import { FeedbackBar as
|
|
18
|
-
import { DismissInsightDialog as
|
|
17
|
+
import { FeedbackBar as vo } from "./FeedbackBar.es.js";
|
|
18
|
+
import { DismissInsightDialog as xo } from "./DismissInsightDialog.es.js";
|
|
19
19
|
import { HiddenConfirmationCard as So } from "./HiddenConfirmationCard.es.js";
|
|
20
20
|
import { LoadingCard as To } from "./LoadingCard.es.js";
|
|
21
21
|
import { ObsolesceBanner as Lo } from "./ObsolesceBanner.es.js";
|
|
22
22
|
import { useBeatFeedbackFlow as wo } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
23
23
|
import { useMemo as Ao } from "react";
|
|
24
24
|
import { observer as Bo } from "mobx-react-lite";
|
|
25
|
-
import
|
|
25
|
+
import x from "@mui/material/Stack";
|
|
26
26
|
import { P as Do } from "@mxenabled/mxui";
|
|
27
27
|
import f from "@mui/material/Button";
|
|
28
28
|
import { ChevronRight as I } from "@mxenabled/mx-icons";
|
|
@@ -66,7 +66,7 @@ var Eo = {}, Ho = {
|
|
|
66
66
|
py: 12,
|
|
67
67
|
"&.Mui-disabled": { color: "text.disabled" }
|
|
68
68
|
}, Ci = Bo(({ beat: t, beatActions: l = Eo, obsolete: g, isLoading: F = !1, isError: E = !1 }) => {
|
|
69
|
-
const H = eo(), P = ro(), { config: M } = to(), o = wo(t, l), b = no(), { runCta: N, primary: _, secondary: T, linkPresentation: R } = uo(t, l, t.insights_payload?.primary_cta, t.insights_payload?.secondary_cta, t.insights_payload?.in_description_cta), c = t.insights_payload?.widget_type === "mini", W = Ao(() => ({
|
|
69
|
+
const H = eo(), P = ro(), { config: M } = to(), o = wo(t, l), b = no(), { runCta: N, primary: _, secondary: T, linkPresentation: R } = uo(t, l, t.insights_payload?.primary_cta ?? void 0, t.insights_payload?.secondary_cta ?? void 0, t.insights_payload?.in_description_cta ?? void 0), c = t.insights_payload?.widget_type === "mini", W = Ao(() => ({
|
|
70
70
|
...o.wrappedActions,
|
|
71
71
|
beat: t
|
|
72
72
|
}), [o.wrappedActions, t]);
|
|
@@ -106,10 +106,10 @@ var Eo = {}, Ho = {
|
|
|
106
106
|
template: t.template,
|
|
107
107
|
handler: "cardClick"
|
|
108
108
|
})));
|
|
109
|
-
}, y = H.insights_feed?.general,
|
|
109
|
+
}, y = H.insights_feed?.general, v = g?.state === "not_refreshable" && !V && !!y;
|
|
110
110
|
return /* @__PURE__ */ i(ao, {
|
|
111
111
|
value: W,
|
|
112
|
-
children: /* @__PURE__ */ C(
|
|
112
|
+
children: /* @__PURE__ */ C(x, {
|
|
113
113
|
sx: { mb: 16 },
|
|
114
114
|
children: [
|
|
115
115
|
o.cardState === "confirming" ? /* @__PURE__ */ i(So, {
|
|
@@ -120,14 +120,14 @@ var Eo = {}, Ho = {
|
|
|
120
120
|
...g,
|
|
121
121
|
copy: y
|
|
122
122
|
}), /* @__PURE__ */ C(Fo, {
|
|
123
|
-
inert:
|
|
124
|
-
sx: { ...
|
|
123
|
+
inert: v,
|
|
124
|
+
sx: { ...v && {
|
|
125
125
|
position: "relative",
|
|
126
126
|
zIndex: 2,
|
|
127
127
|
pointerEvents: "none"
|
|
128
128
|
} },
|
|
129
129
|
children: [
|
|
130
|
-
|
|
130
|
+
v && /* @__PURE__ */ i(Io, { sx: Ho }),
|
|
131
131
|
/* @__PURE__ */ i(yo, {
|
|
132
132
|
isMini: c,
|
|
133
133
|
subtitle: K,
|
|
@@ -137,7 +137,7 @@ var Eo = {}, Ho = {
|
|
|
137
137
|
beatGuid: L,
|
|
138
138
|
payload: e
|
|
139
139
|
}),
|
|
140
|
-
/* @__PURE__ */ C(
|
|
140
|
+
/* @__PURE__ */ C(x, {
|
|
141
141
|
sx: {
|
|
142
142
|
gap: 6,
|
|
143
143
|
pb: 16,
|
|
@@ -173,7 +173,7 @@ var Eo = {}, Ho = {
|
|
|
173
173
|
})
|
|
174
174
|
]
|
|
175
175
|
}),
|
|
176
|
-
Z && /* @__PURE__ */ C(
|
|
176
|
+
Z && /* @__PURE__ */ C(x, {
|
|
177
177
|
sx: {
|
|
178
178
|
gap: 8,
|
|
179
179
|
pb: 16,
|
|
@@ -208,14 +208,14 @@ var Eo = {}, Ho = {
|
|
|
208
208
|
})
|
|
209
209
|
]
|
|
210
210
|
}),
|
|
211
|
-
/* @__PURE__ */ i(
|
|
211
|
+
/* @__PURE__ */ i(vo, {
|
|
212
212
|
onTellUsMore: o.openRatingSurvey,
|
|
213
213
|
show: o.isFeedbackBarShown
|
|
214
214
|
})
|
|
215
215
|
]
|
|
216
216
|
})] }),
|
|
217
217
|
/* @__PURE__ */ i(_o, { beat: t }),
|
|
218
|
-
/* @__PURE__ */ i(
|
|
218
|
+
/* @__PURE__ */ i(xo, {
|
|
219
219
|
isOpen: o.isDismissOpen,
|
|
220
220
|
onClose: o.closeDismissDialog,
|
|
221
221
|
onDismiss: o.confirmDismiss
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { type MouseEvent, useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { HOST_ACTIONS, reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Figma's 24px text link: 13/16 semibold, 16px line plus 4px above and below, its text starting at the\n// card's 16px inset. A minimum height, not the theme's fixed 44px Button height, so a long or translated\n// label wraps instead of overflowing; MUI's 64px minimum width and centring are undone for the same inset.\n// The in-description links use it as is, with the Button's 20px chevron, so they are 28px tall, as in\n// Figma's Low Account Balance full card (node 438:27877); the 24px is the mini CTA's, which has no icon.\nconst TEXT_LINK_SX = {\n alignSelf: 'flex-start',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n justifyContent: 'flex-start',\n lineHeight: '16px',\n minHeight: 24,\n minWidth: 0,\n px: 0,\n py: 4,\n textAlign: 'left',\n} as const\n\n// Mini CTA label, which fits Pulse's 312px mini slide as a text link.\nconst MINI_CTA_SX = {\n ...TEXT_LINK_SX,\n alignItems: 'center',\n display: 'flex',\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary, at least 40px tall with 12/16 padding, as in Figma. `color=\"inherit\"` keeps\n// hover, ripple and focus off the primary palette. An unavailable CTA (contact_support_block with no host\n// handler) is dimmed at the call site, as the primary CTA is, because it is only aria-disabled and so\n// never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n lineHeight: '16px',\n minHeight: 40,\n px: 16,\n py: 12,\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n linkPresentation,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n beat.insights_payload?.in_description_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n // Mini: the card's action (in_description_cta) mirrors the full card's state, as a label only.\n // Answered → the status's action word (Undo) and its answered title; hidden → no label. The tap\n // stays the host's (it opens the insight with its block), so nothing runs from mini itself.\n const miniPresentation = isMini ? linkPresentation : undefined\n const miniStatus = miniPresentation?.kind === 'status' ? miniPresentation : undefined\n const actionLabel = miniPresentation ? miniStatus?.action?.label : ctaLabel\n const cardTitle = miniPresentation?.title || title || ''\n const showActionLink = !!actionLabel && !isCtaButton\n const showCtaRow = (isCtaButton && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const handleMiniActionClick = (event: MouseEvent) => {\n const { onCtaAction } = beatActions\n if (!onCtaAction) return\n event.stopPropagation()\n Promise.resolve()\n .then(() => onCtaAction({ beatGuid: beat.guid, name: HOST_ACTIONS.cardClick }))\n .catch((error) =>\n stores.captureException(error, {\n store: 'BaseLayout',\n template: beat.template,\n handler: 'cardClick',\n }),\n )\n }\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={cardTitle} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n sx={{ fontWeight: 'fontWeightRegular' }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={TEXT_LINK_SX}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* The card's action with no primary CTA button, never a drawer: mini hands its tap to\n the host (`cardClick`); a full card's block-less link bubbles to the host's card handler. */}\n {showActionLink && (\n <Button\n onClick={isMini ? handleMiniActionClick : undefined}\n sx={MINI_CTA_SX}\n variant=\"text\"\n >\n {actionLabel}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={TEXT_LINK_SX}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n sx={primaryPresentation.sx}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;A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ACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,IAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,IAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
1
|
+
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { type MouseEvent, useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { HOST_ACTIONS, reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Figma's 24px text link: 13/16 semibold, 16px line plus 4px above and below, its text starting at the\n// card's 16px inset. A minimum height, not the theme's fixed 44px Button height, so a long or translated\n// label wraps instead of overflowing; MUI's 64px minimum width and centring are undone for the same inset.\n// The in-description links use it as is, with the Button's 20px chevron, so they are 28px tall, as in\n// Figma's Low Account Balance full card (node 438:27877); the 24px is the mini CTA's, which has no icon.\nconst TEXT_LINK_SX = {\n alignSelf: 'flex-start',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n justifyContent: 'flex-start',\n lineHeight: '16px',\n minHeight: 24,\n minWidth: 0,\n px: 0,\n py: 4,\n textAlign: 'left',\n} as const\n\n// Mini CTA label, which fits Pulse's 312px mini slide as a text link.\nconst MINI_CTA_SX = {\n ...TEXT_LINK_SX,\n alignItems: 'center',\n display: 'flex',\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary, at least 40px tall with 12/16 padding, as in Figma. `color=\"inherit\"` keeps\n// hover, ripple and focus off the primary palette. An unavailable CTA (contact_support_block with no host\n// handler) is dimmed at the call site, as the primary CTA is, because it is only aria-disabled and so\n// never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n lineHeight: '16px',\n minHeight: 40,\n px: 16,\n py: 12,\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n linkPresentation,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta ?? undefined,\n beat.insights_payload?.secondary_cta ?? undefined,\n beat.insights_payload?.in_description_cta ?? undefined,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n // Mini: the card's action (in_description_cta) mirrors the full card's state, as a label only.\n // Answered → the status's action word (Undo) and its answered title; hidden → no label. The tap\n // stays the host's (it opens the insight with its block), so nothing runs from mini itself.\n const miniPresentation = isMini ? linkPresentation : undefined\n const miniStatus = miniPresentation?.kind === 'status' ? miniPresentation : undefined\n const actionLabel = miniPresentation ? miniStatus?.action?.label : ctaLabel\n const cardTitle = miniPresentation?.title || title || ''\n const showActionLink = !!actionLabel && !isCtaButton\n const showCtaRow = (isCtaButton && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const handleMiniActionClick = (event: MouseEvent) => {\n const { onCtaAction } = beatActions\n if (!onCtaAction) return\n event.stopPropagation()\n Promise.resolve()\n .then(() => onCtaAction({ beatGuid: beat.guid, name: HOST_ACTIONS.cardClick }))\n .catch((error) =>\n stores.captureException(error, {\n store: 'BaseLayout',\n template: beat.template,\n handler: 'cardClick',\n }),\n )\n }\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={cardTitle} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n sx={{ fontWeight: 'fontWeightRegular' }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={TEXT_LINK_SX}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* The card's action with no primary CTA button, never a drawer: mini hands its tap to\n the host (`cardClick`); a full card's block-less link bubbles to the host's card handler. */}\n {showActionLink && (\n <Button\n onClick={isMini ? handleMiniActionClick : undefined}\n sx={MINI_CTA_SX}\n variant=\"text\"\n >\n {actionLabel}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={TEXT_LINK_SX}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n sx={primaryPresentation.sx}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AA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