@mx-cartographer/experiences 9.5.3 → 9.6.0
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 +7 -0
- package/dist/common/components/CurrencyDialog.d.ts +10 -2
- package/dist/common/components/CurrencyDialog.es.js +56 -50
- package/dist/common/components/CurrencyDialog.es.js.map +1 -1
- package/dist/core/index.es.js +111 -109
- package/dist/core/types/Insights.d.ts +33 -16
- package/dist/core/types/Insights.es.js +6 -0
- package/dist/core/types/Insights.es.js.map +1 -0
- package/dist/core/types/index.d.ts +2 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +21 -0
- package/dist/core/types/localization/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +31 -25
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.d.ts +13 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +128 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/index.d.ts +1 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +14 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +14 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +5 -2
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +36 -35
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.d.ts +2 -2
- package/dist/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js +6 -5
- package/dist/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +22 -22
- package/dist/insights-v2/components/CompactInsightCard.d.ts +4 -4
- package/dist/insights-v2/components/CompactInsightCard.es.js +50 -46
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +10 -10
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +17 -17
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.d.ts +2 -1
- package/dist/insights-v2/mappings/blocks.es.js +62 -62
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/insights-v2/mappings/hasDrawerBlock.d.ts +1 -0
- package/dist/insights-v2/mappings/hasDrawerBlock.es.js +13 -0
- package/dist/insights-v2/mappings/hasDrawerBlock.es.js.map +1 -0
- package/dist/insights-v2/resolveInsightRender.d.ts +8 -5
- package/dist/insights-v2/resolveInsightRender.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +32 -31
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import l from "
|
|
1
|
+
import { slot as l } from "../../../../core/types/Insights.es.js";
|
|
2
|
+
import o from "../../../components/WithdrawalCard.es.js";
|
|
2
3
|
import n from "@mui/material/Stack";
|
|
3
4
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
var
|
|
5
|
-
const r = e.instance_slot.
|
|
5
|
+
var c = ({ payload: e }) => {
|
|
6
|
+
const r = l(e.instance_slot.data, "series"), [a] = Array.isArray(r) ? r : [];
|
|
6
7
|
return !Number.isFinite(a?.amount) || !Number.isFinite(a?.balance) ? null : /* @__PURE__ */ t(n, {
|
|
7
8
|
sx: { px: 16 },
|
|
8
|
-
children: /* @__PURE__ */ t(
|
|
9
|
+
children: /* @__PURE__ */ t(o, {
|
|
9
10
|
amount: a.amount,
|
|
10
11
|
amountLabel: a.amount_label,
|
|
11
12
|
balance: a.balance,
|
|
@@ -15,7 +16,7 @@ var s = ({ payload: e }) => {
|
|
|
15
16
|
});
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
c as default
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=WithdrawalBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithdrawalBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport WithdrawalCard from '../../../components/WithdrawalCard'\nimport type { BlockProps } from '../../types'\n\n/** The Withdrawal row on `instance_slot.
|
|
1
|
+
{"version":3,"file":"WithdrawalBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { slot } from '../../../../core'\nimport WithdrawalCard from '../../../components/WithdrawalCard'\nimport type { BlockProps } from '../../types'\n\n/** The Withdrawal row on `instance_slot.data.series`. */\nexport interface WithdrawalRow {\n amount?: number\n amount_label?: string\n balance?: number\n balance_label?: string\n withdrawal_date?: string\n}\n\n/**\n * The `withdrawal_block` (Highlight Withdrawal), reading one row on\n * `instance_slot.data.series`. Text (`amount_label`, `withdrawal_date`,\n * `balance_label`) renders as sent; `amount` and `balance` are numbers and are formatted by the\n * card. Renders nothing unless the row carries both numbers.\n */\nconst WithdrawalBlock = ({ payload }: BlockProps) => {\n const rows = slot<WithdrawalRow[]>(payload.instance_slot.data, 'series')\n const [row] = Array.isArray(rows) ? rows : []\n\n if (!Number.isFinite(row?.amount) || !Number.isFinite(row?.balance)) return null\n\n return (\n <Stack sx={{ px: 16 }}>\n <WithdrawalCard\n amount={row.amount as number}\n amountLabel={row.amount_label}\n balance={row.balance as number}\n balanceLabel={row.balance_label}\n withdrawalDate={row.withdrawal_date}\n />\n </Stack>\n )\n}\n\nexport default WithdrawalBlock\n"],"mappings":";;;;AAqBA,IAAM,IAAA,CAAmB,EAAE,SAAA,EAAA,MAA0B;AACnD,QAAM,IAAO,EAAsB,EAAQ,cAAc,MAAM,QAAQ,GACjE,CAAC,CAAA,IAAO,MAAM,QAAQ,CAAI,IAAI,IAAO,CAAC;AAE5C,SAAI,CAAC,OAAO,SAAS,GAAK,MAAM,KAAK,CAAC,OAAO,SAAS,GAAK,OAAO,IAAU,OAG1E,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,IAAI,GAAG;AAAA,IAClB,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,QAAQ,EAAI;AAAA,MACZ,aAAa,EAAI;AAAA,MACjB,SAAS,EAAI;AAAA,MACb,cAAc,EAAI;AAAA,MAClB,gBAAgB,EAAI;AAAA,IACrB,CAAA;AAAA,EACI,CAAA;AAEX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getLayoutConfig: (variant
|
|
1
|
+
export declare const getLayoutConfig: (variant?: string | null, isCibc?: boolean) => {
|
|
2
2
|
image: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
|
|
3
3
|
} | {
|
|
4
4
|
image: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.ts"],"sourcesContent":["// SVGs to be moved to S3 and imported from there.\nimport { ReactComponent as UpcomingTaxDeadline } from './images/UpcomingTaxDeadlineAlert.svg'\nimport { ReactComponent as UpcomingTaxDeadlineCIBC } from './images/UpcomingTaxDeadlineAlertCIBC.svg'\n\nimport { ReactComponent as FederalBankHoliday } from './images/FederalBankHoliday.svg'\nimport { ReactComponent as FederalBankHolidayCIBC } from './images/FederalBankHolidayCibc.svg'\n\nimport { ReactComponent as DesignateEmergencySavingsAccount } from './images/DesignateEmergencySavingsAccount.svg'\n\nexport const getLayoutConfig = (variant
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.ts"],"sourcesContent":["// SVGs to be moved to S3 and imported from there.\nimport { ReactComponent as UpcomingTaxDeadline } from './images/UpcomingTaxDeadlineAlert.svg'\nimport { ReactComponent as UpcomingTaxDeadlineCIBC } from './images/UpcomingTaxDeadlineAlertCIBC.svg'\n\nimport { ReactComponent as FederalBankHoliday } from './images/FederalBankHoliday.svg'\nimport { ReactComponent as FederalBankHolidayCIBC } from './images/FederalBankHolidayCibc.svg'\n\nimport { ReactComponent as DesignateEmergencySavingsAccount } from './images/DesignateEmergencySavingsAccount.svg'\n\nexport const getLayoutConfig = (variant?: string | null, isCibc: boolean = false) => {\n const config = {\n Holiday: {\n image: isCibc ? FederalBankHolidayCIBC : FederalBankHoliday,\n },\n Reminder: {\n image: isCibc ? UpcomingTaxDeadlineCIBC : UpcomingTaxDeadline,\n },\n Savings: {\n image: DesignateEmergencySavingsAccount,\n },\n }\n return config[variant as keyof typeof config]\n}\n"],"mappings":";;;;;AASA,IAAa,IAAA,CAAmB,GAAyB,IAAkB,QAYlE;AAAA,EAVL,SAAS,EACP,OAAO,IAAS,IAAyB,EAC3C;AAAA,EACA,UAAU,EACR,OAAO,IAAS,IAA0B,EAC5C;AAAA,EACA,SAAS,EACP,OAAO,EACT;AAEK,GAAO,CAAA"}
|
|
@@ -4,17 +4,17 @@ import { isContactSupportCtaDisabled as H } from "../actionBlocks/ContactSupport
|
|
|
4
4
|
import { logoFromRef as M } from "./shared/EntityLogo.es.js";
|
|
5
5
|
import { actionBlocksKey as P } from "../mappings/actionBlocksKey.es.js";
|
|
6
6
|
import { ErrorCard as U } from "./ErrorCard.es.js";
|
|
7
|
-
import {
|
|
8
|
-
import z from "
|
|
9
|
-
import G from "./
|
|
10
|
-
import
|
|
11
|
-
import X from "./
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
7
|
+
import { useBeatCtaActions as j } from "../ctaActions/useCtaAction.es.js";
|
|
8
|
+
import { blocks as z } from "../mappings/blocks.es.js";
|
|
9
|
+
import G from "./Footer.es.js";
|
|
10
|
+
import K from "./Header.es.js";
|
|
11
|
+
import { FeedbackBar as X } from "./FeedbackBar.es.js";
|
|
12
|
+
import V from "./FeedbackDialog.es.js";
|
|
13
|
+
import { DismissInsightDialog as W } from "./DismissInsightDialog.es.js";
|
|
14
|
+
import { HiddenConfirmationCard as Y } from "./HiddenConfirmationCard.es.js";
|
|
15
|
+
import { LoadingCard as q } from "./LoadingCard.es.js";
|
|
16
|
+
import { ObsolesceBanner as J } from "./ObsolesceBanner.es.js";
|
|
17
|
+
import { ActionBlockLayer as Q } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
18
18
|
import { useBeatFeedbackFlow as Z } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
19
19
|
import { observer as $ } from "mobx-react-lite";
|
|
20
20
|
import b from "@mui/material/Stack";
|
|
@@ -42,7 +42,7 @@ var so = {}, no = {
|
|
|
42
42
|
px: 2,
|
|
43
43
|
textTransform: "none"
|
|
44
44
|
}, Ro = $(({ beat: t, beatActions: s = so, obsolete: c, isLoading: x = !1, isError: _ = !1 }) => {
|
|
45
|
-
const v = N(), { config: S } = E(), o = Z(t, s), { runCta: T, primary: C, secondary: g } =
|
|
45
|
+
const v = N(), { config: S } = E(), o = Z(t, s), { runCta: T, primary: C, secondary: g } = j(t, s, t.insights_payload?.primary_cta, t.insights_payload?.secondary_cta);
|
|
46
46
|
if (_) return /* @__PURE__ */ i(U, {});
|
|
47
47
|
const e = t.insights_payload;
|
|
48
48
|
if (!e || o.cardState === "dismissed") return null;
|
|
@@ -57,17 +57,17 @@ var so = {}, no = {
|
|
|
57
57
|
}
|
|
58
58
|
await T(f, u);
|
|
59
59
|
}
|
|
60
|
-
}, k =
|
|
60
|
+
}, k = z[A], d = L === "mini", m = v.insights_feed?.general, p = c?.state === "not_refreshable" && !F && !!m;
|
|
61
61
|
return /* @__PURE__ */ i(R, {
|
|
62
62
|
value: o.wrappedActions,
|
|
63
63
|
children: /* @__PURE__ */ a(b, {
|
|
64
64
|
sx: { mb: 16 },
|
|
65
65
|
children: [
|
|
66
|
-
o.cardState === "confirming" ? /* @__PURE__ */ i(
|
|
66
|
+
o.cardState === "confirming" ? /* @__PURE__ */ i(Y, {
|
|
67
67
|
onClose: o.collapseConfirmation,
|
|
68
68
|
onLeaveFeedback: o.openHideSurvey,
|
|
69
69
|
onUndo: o.undoDismiss
|
|
70
|
-
}) : /* @__PURE__ */ a(to, { children: [c && m && /* @__PURE__ */ i(
|
|
70
|
+
}) : /* @__PURE__ */ a(to, { children: [c && m && /* @__PURE__ */ i(J, {
|
|
71
71
|
...c,
|
|
72
72
|
copy: m
|
|
73
73
|
}), /* @__PURE__ */ a(ao, {
|
|
@@ -79,12 +79,12 @@ var so = {}, no = {
|
|
|
79
79
|
} },
|
|
80
80
|
children: [
|
|
81
81
|
p && /* @__PURE__ */ i(ro, { sx: no }),
|
|
82
|
-
/* @__PURE__ */ i(
|
|
82
|
+
/* @__PURE__ */ i(K, {
|
|
83
83
|
isMini: d,
|
|
84
84
|
subtitle: w,
|
|
85
85
|
title: D ?? ""
|
|
86
86
|
}),
|
|
87
|
-
x ? /* @__PURE__ */ i(
|
|
87
|
+
x ? /* @__PURE__ */ i(q, {}) : k && /* @__PURE__ */ i(k, {
|
|
88
88
|
beatGuid: I,
|
|
89
89
|
payload: e
|
|
90
90
|
}),
|
|
@@ -136,19 +136,19 @@ var so = {}, no = {
|
|
|
136
136
|
children: n.label
|
|
137
137
|
})]
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */ i(
|
|
139
|
+
/* @__PURE__ */ i(X, {
|
|
140
140
|
onTellUsMore: o.openRatingSurvey,
|
|
141
141
|
show: o.isFeedbackBarShown
|
|
142
142
|
})
|
|
143
143
|
]
|
|
144
144
|
})] }),
|
|
145
|
-
/* @__PURE__ */ i(
|
|
146
|
-
/* @__PURE__ */ i(
|
|
145
|
+
/* @__PURE__ */ i(Q, { beat: t }),
|
|
146
|
+
/* @__PURE__ */ i(W, {
|
|
147
147
|
isOpen: o.isDismissOpen,
|
|
148
148
|
onClose: o.closeDismissDialog,
|
|
149
149
|
onDismiss: o.confirmDismiss
|
|
150
150
|
}),
|
|
151
|
-
o.isSurveyOpen && /* @__PURE__ */ i(
|
|
151
|
+
o.isSurveyOpen && /* @__PURE__ */ i(V, {
|
|
152
152
|
characterLimitLabel: o.survey.characterLimitLabel,
|
|
153
153
|
closeAriaLabel: o.survey.closeAriaLabel,
|
|
154
154
|
isOpen: !0,
|
|
@@ -161,7 +161,7 @@ var so = {}, no = {
|
|
|
161
161
|
secondaryText: o.survey.backText,
|
|
162
162
|
title: o.survey.title
|
|
163
163
|
}),
|
|
164
|
-
o.cardState === "visible" && e.footer && /* @__PURE__ */ i(
|
|
164
|
+
o.cardState === "visible" && e.footer && /* @__PURE__ */ i(G, { footer: e.footer })
|
|
165
165
|
]
|
|
166
166
|
})
|
|
167
167
|
});
|
|
@@ -19,13 +19,13 @@ export interface CompactInsightCardProps {
|
|
|
19
19
|
* The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).
|
|
20
20
|
*
|
|
21
21
|
* Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML
|
|
22
|
-
* description with the primary CTA under it, and on the right the
|
|
23
|
-
* `<BadgedTile>`. Under ditto's `
|
|
24
|
-
*
|
|
22
|
+
* description with the primary CTA under it, and on the right the slot's `logo` in a
|
|
23
|
+
* `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under
|
|
24
|
+
* `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads
|
|
25
25
|
* `widget_type`.
|
|
26
26
|
*
|
|
27
27
|
* The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot
|
|
28
|
-
*
|
|
28
|
+
* carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.
|
|
29
29
|
*/
|
|
30
30
|
declare const CompactInsightCard: ({ isCtaDisabled, onCtaClick, onTap, payload, }: CompactInsightCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export default CompactInsightCard;
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { slot as y } from "../../core/types/Insights.es.js";
|
|
2
|
+
import { createVariantBlock as k } from "../blocks/createVariantBlock.es.js";
|
|
3
|
+
import m from "./BadgedTile.es.js";
|
|
4
|
+
import { InsightOptionsMenu as I } from "./InsightOptionsMenu.es.js";
|
|
5
|
+
import w from "./LogoFromGuid.es.js";
|
|
6
|
+
import v from "./StatusBadge.es.js";
|
|
6
7
|
import l from "@mui/material/Stack";
|
|
7
|
-
import { P as
|
|
8
|
-
import
|
|
9
|
-
import { Icon as
|
|
8
|
+
import { P as C, Text as _ } from "@mxenabled/mxui";
|
|
9
|
+
import S from "@mui/material/Button";
|
|
10
|
+
import { Icon as B } from "@mxenabled/mx-icons";
|
|
10
11
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
12
|
+
import p from "@mui/material/Box";
|
|
13
|
+
import z from "@mui/material/Card";
|
|
14
|
+
var a = 44, d = ({ logo: r }) => r ? /* @__PURE__ */ t(w, {
|
|
14
15
|
logo: r,
|
|
15
|
-
size:
|
|
16
|
-
}) : /* @__PURE__ */ t(
|
|
16
|
+
size: a
|
|
17
|
+
}) : /* @__PURE__ */ t(p, {
|
|
17
18
|
"data-testid": "compact-insight-card-fallback-icon",
|
|
18
19
|
sx: {
|
|
19
20
|
alignItems: "center",
|
|
20
21
|
bgcolor: "primary.lighter",
|
|
21
22
|
display: "flex",
|
|
22
|
-
height:
|
|
23
|
+
height: a,
|
|
23
24
|
justifyContent: "center",
|
|
24
|
-
width:
|
|
25
|
+
width: a
|
|
25
26
|
},
|
|
26
|
-
children: /* @__PURE__ */ t(
|
|
27
|
+
children: /* @__PURE__ */ t(B, {
|
|
27
28
|
color: "primary",
|
|
28
29
|
fill: !0,
|
|
29
30
|
name: "lightbulb",
|
|
30
31
|
size: 24
|
|
31
32
|
})
|
|
32
|
-
}),
|
|
33
|
-
center: /* @__PURE__ */ t(
|
|
34
|
-
size:
|
|
33
|
+
}), c = ({ logo: r }) => /* @__PURE__ */ t(m, {
|
|
34
|
+
center: /* @__PURE__ */ t(d, { logo: r }),
|
|
35
|
+
size: a,
|
|
35
36
|
sx: { flexShrink: 0 }
|
|
36
|
-
}),
|
|
37
|
-
center: /* @__PURE__ */ t(
|
|
38
|
-
size:
|
|
37
|
+
}), P = ({ logo: r }) => /* @__PURE__ */ t(m, {
|
|
38
|
+
center: /* @__PURE__ */ t(d, { logo: r }),
|
|
39
|
+
size: a,
|
|
39
40
|
sx: { flexShrink: 0 },
|
|
40
|
-
topRight: /* @__PURE__ */ t(
|
|
41
|
-
}),
|
|
42
|
-
variants: {
|
|
43
|
-
|
|
41
|
+
topRight: /* @__PURE__ */ t(v, { tone: "warning" })
|
|
42
|
+
}), V = k({
|
|
43
|
+
variants: {
|
|
44
|
+
minimal: c,
|
|
45
|
+
with_warning_badge: P
|
|
46
|
+
},
|
|
47
|
+
fallback: c,
|
|
44
48
|
name: "InsightVisual"
|
|
45
|
-
}),
|
|
46
|
-
const { description:
|
|
47
|
-
i.stopPropagation(), !(r || !o) &&
|
|
49
|
+
}), j = (r) => r.stopPropagation(), $ = ({ isCtaDisabled: r = !1, onCtaClick: g, onTap: e, payload: f }) => {
|
|
50
|
+
const { description: h, instance_slot: s, primary_cta: o, title: x } = f, u = y(s.data, "logo"), b = (i) => {
|
|
51
|
+
i.stopPropagation(), !(r || !o) && g?.(o);
|
|
48
52
|
};
|
|
49
|
-
return /* @__PURE__ */ n(
|
|
53
|
+
return /* @__PURE__ */ n(z, {
|
|
50
54
|
"data-testid": "compact-insight-card",
|
|
51
|
-
...
|
|
52
|
-
onClick:
|
|
55
|
+
...e ? {
|
|
56
|
+
onClick: e,
|
|
53
57
|
onKeyDown: (i) => {
|
|
54
|
-
i.target === i.currentTarget && (i.key === "Enter" || i.key === " ") && (i.preventDefault(),
|
|
58
|
+
i.target === i.currentTarget && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), e?.());
|
|
55
59
|
},
|
|
56
60
|
role: "button",
|
|
57
61
|
tabIndex: 0
|
|
@@ -62,7 +66,7 @@ var e = 44, m = ({ logo: r }) => r ? /* @__PURE__ */ t(k, {
|
|
|
62
66
|
pl: 8,
|
|
63
67
|
pr: 16,
|
|
64
68
|
pt: 8,
|
|
65
|
-
...
|
|
69
|
+
...e && { cursor: "pointer" }
|
|
66
70
|
},
|
|
67
71
|
children: [/* @__PURE__ */ n(l, {
|
|
68
72
|
sx: {
|
|
@@ -73,14 +77,14 @@ var e = 44, m = ({ logo: r }) => r ? /* @__PURE__ */ t(k, {
|
|
|
73
77
|
pl: 8,
|
|
74
78
|
pt: 4
|
|
75
79
|
},
|
|
76
|
-
children: [/* @__PURE__ */ t(
|
|
80
|
+
children: [/* @__PURE__ */ t(_, {
|
|
77
81
|
bold: !0,
|
|
78
82
|
variant: "body1",
|
|
79
|
-
children:
|
|
80
|
-
}), /* @__PURE__ */ t(
|
|
81
|
-
onClick:
|
|
83
|
+
children: x ?? ""
|
|
84
|
+
}), /* @__PURE__ */ t(p, {
|
|
85
|
+
onClick: j,
|
|
82
86
|
sx: { display: "flex" },
|
|
83
|
-
children: /* @__PURE__ */ t(
|
|
87
|
+
children: /* @__PURE__ */ t(I, {})
|
|
84
88
|
})]
|
|
85
89
|
}), /* @__PURE__ */ n(l, {
|
|
86
90
|
sx: {
|
|
@@ -95,13 +99,13 @@ var e = 44, m = ({ logo: r }) => r ? /* @__PURE__ */ t(k, {
|
|
|
95
99
|
gap: 8,
|
|
96
100
|
minWidth: 0
|
|
97
101
|
},
|
|
98
|
-
children: [/* @__PURE__ */ t(
|
|
99
|
-
dangerouslySetInnerHTML: { __html:
|
|
102
|
+
children: [/* @__PURE__ */ t(C, {
|
|
103
|
+
dangerouslySetInnerHTML: { __html: h.html_text },
|
|
100
104
|
"data-testid": "compact-insight-card-description",
|
|
101
105
|
variant: "subtitle2"
|
|
102
|
-
}), o?.label && /* @__PURE__ */ t(
|
|
106
|
+
}), o?.label && /* @__PURE__ */ t(S, {
|
|
103
107
|
"aria-disabled": r,
|
|
104
|
-
onClick:
|
|
108
|
+
onClick: b,
|
|
105
109
|
size: "small",
|
|
106
110
|
sx: {
|
|
107
111
|
alignSelf: "flex-start",
|
|
@@ -115,15 +119,15 @@ var e = 44, m = ({ logo: r }) => r ? /* @__PURE__ */ t(k, {
|
|
|
115
119
|
variant: "text",
|
|
116
120
|
children: o.label
|
|
117
121
|
})]
|
|
118
|
-
}), /* @__PURE__ */ t(
|
|
119
|
-
logo:
|
|
122
|
+
}), /* @__PURE__ */ t(V, {
|
|
123
|
+
logo: u,
|
|
120
124
|
variant: s.variant
|
|
121
125
|
})]
|
|
122
126
|
})]
|
|
123
127
|
});
|
|
124
128
|
};
|
|
125
129
|
export {
|
|
126
|
-
|
|
130
|
+
$ as default
|
|
127
131
|
};
|
|
128
132
|
|
|
129
133
|
//# sourceMappingURL=CompactInsightCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\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 { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport type { InsightsPayload, LogoRef, PrimaryCTA } from '../../core'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport StatusBadge from './StatusBadge'\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The first slot row's logo, when the envelope carries a row. */\n logo?: LogoRef | null\n}\n\n/** The row's logo, or the neutral insight glyph when the slot has no row. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `embedded`: the logo badged with a status glyph (Figma 1941:111897). */\nconst EmbeddedVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight — `with_header` already serves both Large\n * Transaction and Fee Detected — so an insight wanting the badged logo reuses `embedded`. Only a\n * genuinely different visual registers a new entry, and existing ones are never touched.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: { embedded: EmbeddedVisual },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the first slot row's logo in a\n * `<BadgedTile>`. Under ditto's `embedded` variant the tile takes a status badge; micro sends no\n * variant and draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * has no row. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const { description, instance_slot, primary_cta, title } = payload\n const rowLogo = instance_slot.data_series?.[0]?.logo\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !primary_cta) return\n onCtaClick?.(primary_cta)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n // Only the card itself: Enter on the CTA button is the button's own click.\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onTap?.()\n }\n }\n\n const interactiveProps = onTap\n ? { onClick: onTap, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 }\n : {}\n\n return (\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{ minWidth: 288, pb: 12, pl: 8, pr: 16, pt: 8, ...(onTap && { cursor: 'pointer' }) }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ flexDirection: 'row', gap: 16, pl: 8, pt: 4 }}>\n <Stack sx={{ flex: 1, gap: 8, minWidth: 0 }}>\n {/* `html_text` is rendered server-side by mrs_content from the ditto copy template (bold\n amount / merchant), not user-authored input; painted the same way `BaseLayout` paints\n the full card's description. */}\n <P\n dangerouslySetInnerHTML={{ __html: description.html_text }}\n data-testid=\"compact-insight-card-description\"\n variant=\"subtitle2\"\n />\n {primary_cta?.label && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // Figma 1941:111897 lines the CTA label up with the description's left edge. The\n // column already pads 8, so the button's own 8 is pulled back out — padding kept so\n // the tap target does not shrink.\n ml: -8,\n px: 8,\n ...(isCtaDisabled && { color: 'text.disabled', cursor: 'default' }),\n }}\n variant=\"text\"\n >\n {primary_cta.label}\n </Button>\n )}\n </Stack>\n\n <InsightVisual logo={rowLogo} variant={instance_slot.variant} />\n </Stack>\n </Card>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAM,IAAY,IAQZ,IAAA,CAAkB,EAAE,MAAA,EAAA,MACxB,IACE,gBAAA,EAAC,GAAD;AAAA,EAAoB,MAAA;AAAA,EAAM,MAAM;AAAY,CAAA,IAE5C,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAU,MAAM;AAAA,IAAM,MAAK;AAAA,IAAY,MAAM;AAAA,EAAK,CAAA;AAC3D,CAAA,GAIH,IAAA,CAAe,EAAE,MAAA,EAAA,MACrB,gBAAA,EAAC,GAAD;AAAA,EAAY,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EAAG,MAAM;AAAA,EAAW,IAAI,EAAE,YAAY,EAAE;AAAI,CAAA,GAIzF,IAAA,CAAkB,EAAE,MAAA,EAAA,MACxB,gBAAA,EAAC,GAAD;AAAA,EACE,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EACrC,MAAM;AAAA,EACN,IAAI,EAAE,YAAY,EAAE;AAAA,EACpB,UAAU,gBAAA,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ACvB,UAAA,KAAS;AAAA,MACN,CAAA,GAEN,gBAAA,EAAC,GAAD;AAAA,QAAK,SAAS;AAAA,QAAiB,IAAI,EAAE,SAAS,OAAO;AAAA,QACnD,UAAA,gBAAA,EAAC,GAAD,CAAqB,CAAA;AAAA,MAClB,CAAA,CACA;AAAA,IAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,eAAe;AAAA,QAAO,KAAK;AAAA,QAAI,IAAI;AAAA,QAAG,IAAI;AAAA,MAAE;AAAA,MAAzD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,MAAM;AAAA,UAAG,KAAK;AAAA,UAAG,UAAU;AAAA,QAAE;AAAA,QAA1C,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,UACE,yBAAyB,EAAE,QAAQ,EAAY,UAAU;AAAA,UACzD,eAAY;AAAA,UACZ,SAAQ;AAAA,QACT,CAAA,GACA,GAAa,SACZ,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAIX,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,GAAI,KAAiB;AAAA,cAAE,OAAO;AAAA,cAAiB,QAAQ;AAAA,YAAU;AAAA,UACnE;AAAA,UACA,SAAQ;AAAA,UAEP,UAAA,EAAY;AAAA,QACP,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QAAe,MAAM;AAAA,QAAS,SAAS,EAAc;AAAA,MAAU,CAAA,CAC1D;AAAA,IACH,CAAA,CAAA;AAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\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 { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { slot } from '../../core'\nimport type { InsightsPayload, LogoRef, PrimaryCTA } from '../../core'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport StatusBadge from './StatusBadge'\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n}\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: { minimal: PlainVisual, with_warning_badge: WarningBadgeVisual },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const { description, instance_slot, primary_cta, title } = payload\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = slot<LogoRef>(instance_slot.data, 'logo')\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !primary_cta) return\n onCtaClick?.(primary_cta)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n // Only the card itself: Enter on the CTA button is the button's own click.\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onTap?.()\n }\n }\n\n const interactiveProps = onTap\n ? { onClick: onTap, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 }\n : {}\n\n return (\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ flexDirection: 'row', gap: 16, pl: 8, pt: 4 }}>\n <Stack sx={{ flex: 1, gap: 8, minWidth: 0 }}>\n {/* `html_text` is rendered server-side by mrs_content from the ditto copy template (bold\n amount / merchant), not user-authored input; painted the same way `BaseLayout` paints\n the full card's description. */}\n <P\n dangerouslySetInnerHTML={{ __html: description.html_text }}\n data-testid=\"compact-insight-card-description\"\n variant=\"subtitle2\"\n />\n {primary_cta?.label && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // Figma 1941:111897 lines the CTA label up with the description's left edge. The\n // column already pads 8, so the button's own 8 is pulled back out — padding kept so\n // the tap target does not shrink.\n ml: -8,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n {primary_cta.label}\n </Button>\n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AAAA,MAAO,IAAI;AAAA,QAAE,eAAe;AAAA,QAAO,KAAK;AAAA,QAAI,IAAI;AAAA,QAAG,IAAI;AAAA,MAAE;AAAA,MAAzD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,MAAM;AAAA,UAAG,KAAK;AAAA,UAAG,UAAU;AAAA,QAAE;AAAA,QAA1C,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,UACE,yBAAyB,EAAE,QAAQ,EAAY,UAAU;AAAA,UACzD,eAAY;AAAA,UACZ,SAAQ;AAAA,QACT,CAAA,GACA,GAAa,SACZ,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAIX,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,GAAI,KAAiB;AAAA,cACnB,OAAO;AAAA,cACP,QAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,SAAQ;AAAA,UAEP,UAAA,EAAY;AAAA,QACP,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QAAe,MAAM;AAAA,QAAS,SAAS,EAAc;AAAA,MAAU,CAAA,CAC1D;AAAA,IACH,CAAA,CAAA;AAAA;AAEV"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { sendBeatCta as l } from "../../common/utils/PostMessage.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
var w = {}, o = ({ cta: t }) => t.action_key &&
|
|
2
|
+
import { HOST_ACTIONS as f } from "./hostActions.es.js";
|
|
3
|
+
import { ctaActions as m } from "./ctaConfig.es.js";
|
|
4
|
+
import { ctaHandlers as C } from "./ctaHandlers.es.js";
|
|
5
|
+
import { resolveCtaMetadata as v } from "./ctaPostMessages.es.js";
|
|
6
|
+
import { hasDrawerBlock as g } from "../mappings/hasDrawerBlock.es.js";
|
|
7
|
+
var w = {}, o = ({ cta: t }) => t.action_key && m[t.action_key] || w, H = (t) => {
|
|
8
8
|
const a = o(t);
|
|
9
9
|
return { disabled: t.stores.insightsV2Store.ctaStatus[t.beat.guid] === "pending" || (a.disabledWhen?.(t) ?? !1) };
|
|
10
10
|
}, n = ({ beat: t, slot: a, stores: r }) => {
|
|
@@ -20,17 +20,17 @@ var w = {}, o = ({ cta: t }) => t.action_key && C[t.action_key] || w, H = (t) =>
|
|
|
20
20
|
userGuid: t.insights_payload?.user_guid ?? t.user_guid
|
|
21
21
|
});
|
|
22
22
|
}, S = (t) => {
|
|
23
|
-
|
|
23
|
+
g(t.cta.block) && n(t);
|
|
24
24
|
}, _ = (t, { beat: a, stores: r }) => {
|
|
25
25
|
t === "refreshBeat" && r.emitUpdate({ staleBeatGuid: a.guid });
|
|
26
26
|
}, y = ({ beat: t, slot: a, hostActions: r }) => {
|
|
27
27
|
a !== "primary" || t.cta_clicked_at || Promise.resolve().then(() => r.onCtaAction?.({
|
|
28
28
|
beatGuid: t.guid,
|
|
29
|
-
name:
|
|
29
|
+
name: f.markCtaClicked
|
|
30
30
|
})).catch(() => {
|
|
31
31
|
});
|
|
32
32
|
}, c = async (t, a, r) => {
|
|
33
|
-
const e =
|
|
33
|
+
const e = C[a];
|
|
34
34
|
if (!e) throw new Error(`Unknown CTA handler "${a}"`);
|
|
35
35
|
await e(t);
|
|
36
36
|
for (const s of r) _(s, t);
|
|
@@ -56,7 +56,7 @@ var w = {}, o = ({ cta: t }) => t.action_key && C[t.action_key] || w, H = (t) =>
|
|
|
56
56
|
};
|
|
57
57
|
a.skipCtaClicked || y(e), await u(e, async () => {
|
|
58
58
|
a.run && await c(e, a.run, a.onSuccess ?? []);
|
|
59
|
-
const s =
|
|
59
|
+
const s = v(e);
|
|
60
60
|
s && h(e, s);
|
|
61
61
|
const i = a.next ?? (a.run ? "none" : "default");
|
|
62
62
|
i === "default" ? S(e) : i === "drawer" && n(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/runCtaAction.ts"],"sourcesContent":["import { sendBeatCta } from '../../common/utils/PostMessage'\nimport { hasDrawerBlock } from '../mappings/
|
|
1
|
+
{"version":3,"file":"runCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/runCtaAction.ts"],"sourcesContent":["import { sendBeatCta } from '../../common/utils/PostMessage'\nimport { hasDrawerBlock } from '../mappings/hasDrawerBlock'\nimport { ctaActions } from './ctaConfig'\nimport { resolveCtaMetadata } from './ctaPostMessages'\nimport { ctaHandlers, type CtaHandlerName } from './ctaHandlers'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaPostMessageMetadata } from '../../core'\nimport type {\n CtaContext,\n CtaEffect,\n CtaHandler,\n CtaHandlerContext,\n CtaState,\n CtaStateContext,\n CtaStep,\n RunHandlerOptions,\n} from './types'\n\nconst DEFAULT_STEP: CtaStep = {}\n\n// ─── Resolution ─────────────────────────────────────────────────────────────\n\n/** The beat's own context (input a block collected for it), `{}` until something is written. */\nexport const beatContextOf = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) =>\n stores.insightsV2Store.beatContext[beat.guid] ?? {}\n\n/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */\nexport const resolveStep = ({ cta }: Pick<CtaStateContext, 'cta'>): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables; the step's `disabledWhen` may add to that. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n\n return { disabled: pending || (step.disabledWhen?.(ctx) ?? false) }\n}\n\n// ─── Targets and effects ────────────────────────────────────────────────────\n\n/** Opens the beat's drawer for whichever slot triggered the current step. */\nconst openDrawerForSlot = ({\n beat,\n slot,\n stores,\n}: Pick<CtaContext, 'beat' | 'slot' | 'stores'>) => {\n stores.insightsV2Store.openCtaDrawer(\n beat.guid,\n slot === 'primary' ? 'primaryCta' : 'secondaryCta',\n )\n}\n\n/**\n * Posts this CTA's resolved message (event, op and beat-specific payload, from the backend's\n * `cta.metadata` or the template's `ctaPostMessages` entry) to the host.\n */\nconst postCtaMessage = ({ beat, stores }: CtaContext, metadata: CtaPostMessageMetadata) => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n const { event, action, payload } = metadata\n\n sendBeatCta(beat, {\n event: event ?? undefined,\n op: action ?? undefined,\n extras: payload ?? undefined,\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: beat.insights_payload?.user_guid ?? beat.user_guid,\n })\n}\n\n/**\n * Default target: open the drawer for a real block, otherwise nothing. A post message is never\n * implied by a missing block; it is sent only when one resolves (see runCtaAction).\n */\nconst runDefaultTarget = (ctx: CtaContext) => {\n if (hasDrawerBlock(ctx.cta.block)) openDrawerForSlot(ctx)\n}\n\nconst runEffect = (effect: CtaEffect, { beat, stores }: CtaContext) => {\n switch (effect) {\n case 'refreshBeat':\n stores.emitUpdate({ staleBeatGuid: beat.guid })\n break\n }\n}\n\n/**\n * First primary click records `cta_clicked_at` through the host. Fire-and-forget: whatever the\n * host does (reject, throw, return nothing) must never fail the user's action.\n */\nconst markCtaClicked = ({ beat, slot, hostActions }: CtaContext) => {\n if (slot !== 'primary' || beat.cta_clicked_at) return\n\n // Wrapping the call in `.then` turns a synchronous throw into a rejection, and the `.catch`\n // swallows both: a failed cta_clicked_at write is not the user's action.\n Promise.resolve()\n .then(() =>\n hostActions.onCtaAction?.({ beatGuid: beat.guid, name: HOST_ACTIONS.markCtaClicked }),\n )\n .catch(() => {})\n}\n\n// ─── Shared bookkeeping ─────────────────────────────────────────────────────\n\n/** Runs a named handler, then its `onSuccess` effects. Shared by card CTAs and drawer saves. */\nconst runHandlerWithEffects = async (\n ctx: CtaContext,\n handlerName: CtaHandlerName,\n onSuccess: CtaEffect[],\n): Promise<void> => {\n // Names are typed, but the map is still indexed defensively: config can come from anywhere.\n const handler = (ctaHandlers as Record<string, CtaHandler>)[handlerName]\n\n if (!handler) throw new Error(`Unknown CTA handler \"${handlerName}\"`)\n\n await handler(ctx)\n\n for (const effect of onSuccess) runEffect(effect, ctx)\n}\n\n/** Per-beat status around `work`: `pending` -> `done` | `error` (+ captureException). */\nconst withCtaStatus = async (\n { beat, stores }: Pick<CtaContext, 'beat' | 'stores'>,\n work: () => Promise<void>,\n captureContext: Record<string, string> = {},\n): Promise<boolean> => {\n const { insightsV2Store } = stores\n\n insightsV2Store.setCtaStatus(beat.guid, 'pending')\n\n try {\n await work()\n insightsV2Store.setCtaStatus(beat.guid, 'done')\n\n return true\n } catch (error) {\n insightsV2Store.setCtaStatus(beat.guid, 'error')\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n ...captureContext,\n })\n\n return false\n }\n}\n\n// ─── Entry points ───────────────────────────────────────────────────────────\n\n/**\n * Runs the CTA's step: `run` handler, `onSuccess` effects, the CTA's post message if one resolves\n * (backend `cta.metadata` or the template's `ctaPostMessages` entry; skipped when the handler\n * throws), then the `next` target. No resolved message = no post.\n */\nexport const runCtaAction = async (ctx: CtaContext): Promise<void> => {\n const step = resolveStep(ctx)\n const stepParams = typeof step.params === 'function' ? step.params(ctx) : step.params\n const stepCtx: CtaContext = { ...ctx, params: { ...stepParams, ...ctx.params } }\n\n if (!step.skipCtaClicked) markCtaClicked(stepCtx)\n\n await withCtaStatus(stepCtx, async () => {\n if (step.run) await runHandlerWithEffects(stepCtx, step.run, step.onSuccess ?? [])\n\n const metadata = resolveCtaMetadata(stepCtx)\n\n if (metadata) postCtaMessage(stepCtx, metadata)\n\n const target = step.next ?? (step.run ? 'none' : 'default')\n\n if (target === 'default') runDefaultTarget(stepCtx)\n else if (target === 'drawer') openDrawerForSlot(stepCtx)\n })\n}\n\n/** Placeholder CTA for handlers run from inside a drawer, where no card slot is involved. */\nconst DIRECT_CTA = { label: '', block: '' }\n\n/** Runs a handler directly (drawer Save buttons): same bookkeeping as a card CTA. True on success. */\nexport const runCtaHandler = (\n ctx: CtaHandlerContext,\n handlerName: CtaHandlerName,\n { onSuccess = [] }: RunHandlerOptions = {},\n): Promise<boolean> => {\n const fullCtx: CtaContext = { ...ctx, cta: DIRECT_CTA, slot: 'primary' }\n\n return withCtaStatus(fullCtx, () => runHandlerWithEffects(fullCtx, handlerName, onSuccess), {\n handler: handlerName,\n })\n}\n"],"mappings":";;;;;;AAkBA,IAAM,IAAwB,CAAC,GASlB,IAAA,CAAe,EAAE,KAAA,EAAA,MAC3B,EAAI,cAAc,EAAW,EAAI,UAAA,KAAgB,GAGvC,IAAA,CAAmB,MAAmC;AACjE,QAAM,IAAO,EAAY,CAAG;AAG5B,SAAO,EAAE,UAFO,EAAI,OAAO,gBAAgB,UAAU,EAAI,KAAK,IAAA,MAAU,cAEzC,EAAK,eAAe,CAAG,KAAK,IAAO;AACpE,GAKM,IAAA,CAAqB,EACzB,MAAA,GACA,MAAA,GACA,QAAA,EAAA,MACkD;AAClD,EAAA,EAAO,gBAAgB,cACrB,EAAK,MACL,MAAS,YAAY,eAAe,cACtC;AACF,GAMM,IAAA,CAAkB,EAAE,MAAA,GAAM,QAAA,EAAA,GAAsB,MAAqC;AACzF,QAAM,EAAE,mBAAA,GAAmB,cAAA,EAAA,IAAiB,EAAO,aAAa,WAC1D,EAAE,OAAA,GAAO,QAAA,GAAQ,SAAA,EAAA,IAAY;AAEnC,EAAA,EAAY,GAAM;AAAA,IAChB,OAAO,KAAS;AAAA,IAChB,IAAI,KAAU;AAAA,IACd,QAAQ,KAAW;AAAA,IACnB,iBAAiB;AAAA,IACjB,eAAe,GAAc,QAAQ;AAAA,IACrC,UAAU,EAAK,kBAAkB,aAAa,EAAK;AAAA,EACrD,CAAC;AACH,GAMM,IAAA,CAAoB,MAAoB;AAC5C,EAAI,E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,GAAG;AAAA,IAAK,QAAQ;AAAA,MAAE,GAAG;AAAA,MAAY,GAAG,EAAI;AAAA,IAAO;AAAA,EAAE;AAE/E,EAAK,EAAK,kBAAgB,EAAe,CAAO,GAEhD,MAAM,EAAc,GAAS,YAAY;AACvC,IAAI,EAAK,OAAK,MAAM,EAAsB,GAAS,EAAK,KAAK,EAAK,aAAa,CAAC,CAAC;AAEjF,UAAM,IAAW,EAAmB,CAAO;AAE3C,IAAI,KAAU,EAAe,GAAS,CAAQ;AAE9C,UAAM,IAAS,EAAK,SAAS,EAAK,MAAM,SAAS;AAEjD,IAAI,MAAW,YAAW,EAAiB,CAAO,IACzC,MAAW,YAAU,EAAkB,CAAO;AAAA,EACzD,CAAC;AACH,GAGM,IAAa;AAAA,EAAE,OAAO;AAAA,EAAI,OAAO;AAAG,GAG7B,IAAA,CACX,GACA,GACA,EAAE,WAAA,IAAY,CAAC,EAAA,IAAyB,CAAC,MACpB;AACrB,QAAM,IAAsB;AAAA,IAAE,GAAG;AAAA,IAAK,KAAK;AAAA,IAAY,MAAM;AAAA,EAAU;AAEvE,SAAO,EAAc,GAAA,MAAe,EAAsB,GAAS,GAAa,CAAS,GAAG,EAC1F,SAAS,EACX,CAAC;AACH"}
|
|
@@ -32,14 +32,14 @@ import { SVGImageBlock as lr } from "./blocks/ImageBlocks/SVGImageBlock/SVGImage
|
|
|
32
32
|
import Cr from "./components/AmountPill.es.js";
|
|
33
33
|
import Br from "./components/DesignateEmergencySavingsCard.es.js";
|
|
34
34
|
import { ErrorCard as hr } from "./components/ErrorCard.es.js";
|
|
35
|
-
import {
|
|
36
|
-
import Ar from "./
|
|
37
|
-
import {
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
35
|
+
import { HOST_ACTIONS as Sr } from "./ctaActions/hostActions.es.js";
|
|
36
|
+
import { useBeatCtaActions as Ar, useCtaHandler as Tr } from "./ctaActions/useCtaAction.es.js";
|
|
37
|
+
import { FeedbackBar as Ir } from "./components/FeedbackBar.es.js";
|
|
38
|
+
import Hr from "./components/FeedbackDialog.es.js";
|
|
39
|
+
import { DismissInsightDialog as Or } from "./components/DismissInsightDialog.es.js";
|
|
40
|
+
import { HiddenConfirmationCard as Er } from "./components/HiddenConfirmationCard.es.js";
|
|
41
|
+
import { LoadingCard as Rr } from "./components/LoadingCard.es.js";
|
|
42
|
+
import { ObsolesceBanner as Vr } from "./components/ObsolesceBanner.es.js";
|
|
43
43
|
import yr from "./components/BaseLayout.es.js";
|
|
44
44
|
import Gr from "./components/StatusMessageCard.es.js";
|
|
45
45
|
import Nr from "./components/LogoTile.es.js";
|
|
@@ -63,24 +63,24 @@ export {
|
|
|
63
63
|
Br as DesignateEmergencySavingsCard,
|
|
64
64
|
J as DirectDepositBlock,
|
|
65
65
|
q as DirectDepositCard,
|
|
66
|
-
|
|
66
|
+
Or as DismissInsightDialog,
|
|
67
67
|
R as DonutChartBlock,
|
|
68
68
|
O as DoubleBarChartBlock,
|
|
69
69
|
V as DoubleProgressBarBlock,
|
|
70
70
|
hr as ErrorCard,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
Ir as FeedbackBar,
|
|
72
|
+
Hr as FeedbackDialog,
|
|
73
|
+
Sr as HOST_ACTIONS,
|
|
74
|
+
Er as HiddenConfirmationCard,
|
|
75
75
|
S as InsightErrorCard,
|
|
76
76
|
c as InsightOptionsMenu,
|
|
77
77
|
or as InsightTransactionRow,
|
|
78
|
-
|
|
78
|
+
Rr as LoadingCard,
|
|
79
79
|
Ur as LogoClusterCard,
|
|
80
80
|
d as LogoFromGuid,
|
|
81
81
|
Nr as LogoTile,
|
|
82
82
|
qr as MerchantHighlightCard,
|
|
83
|
-
|
|
83
|
+
Vr as ObsolesceBanner,
|
|
84
84
|
n as OverflowMenu,
|
|
85
85
|
Jr as P2PLogoStack,
|
|
86
86
|
lr as SVGImageBlock,
|
|
@@ -105,6 +105,6 @@ export {
|
|
|
105
105
|
C as isLogoGuid,
|
|
106
106
|
m as resolveInsightRender,
|
|
107
107
|
a as useBeatActions,
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
Ar as useBeatCtaActions,
|
|
109
|
+
Tr as useCtaHandler
|
|
110
110
|
};
|
|
@@ -6,7 +6,8 @@ var _ = {
|
|
|
6
6
|
CONTACT_SUPPORT_ACTION_BLOCK: "contact_support_block",
|
|
7
7
|
RECURRING_TRANSACTION_ACTION_BLOCK: "recurring_transaction_block",
|
|
8
8
|
TRANSACTION_LIST_ACTION_BLOCK: "transaction_list_block",
|
|
9
|
-
REMAINING_CASH_ACTION_BLOCK: "remaining_cash_block"
|
|
9
|
+
REMAINING_CASH_ACTION_BLOCK: "remaining_cash_block",
|
|
10
|
+
AMOUNT_INPUT_MODAL_ACTION_BLOCK: "amount_input_modal_block"
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
13
|
_ as actionBlocksKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`). `make_transfer` is a legacy\n// name that stays as an alias until the last legacy payload is gone.\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'PlaceholderActionBlock',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n}\n"],"mappings":"AAiBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;
|
|
1
|
+
{"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`). `make_transfer` is a legacy\n// name that stays as an alias until the last legacy payload is gone.\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'PlaceholderActionBlock',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n}\n"],"mappings":"AAiBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AACnC"}
|
|
@@ -2,11 +2,12 @@ import { Beat, GlobalCopy, InsightsPayload } from '../../core';
|
|
|
2
2
|
export interface ActionBlockProps {
|
|
3
3
|
beat: Beat;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export { hasDrawerBlock } from './hasDrawerBlock';
|
|
6
6
|
export interface ActionBlockEntry {
|
|
7
7
|
Component: React.ComponentType<ActionBlockProps>;
|
|
8
8
|
usePrepare: (props: ActionBlockProps) => void;
|
|
9
9
|
title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string;
|
|
10
|
+
presentation?: 'drawer' | 'modal';
|
|
10
11
|
}
|
|
11
12
|
export declare const actionBlocks: Record<string, ActionBlockEntry>;
|
|
12
13
|
export declare const blocks: Record<string, React.ComponentType<{
|