@mx-cartographer/experiences 9.4.58 → 9.4.60
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 +42 -1
- package/dist/core/api/BeatApi.d.ts +6 -0
- package/dist/core/api/BeatApi.es.js +1 -1
- package/dist/core/api/BeatApi.es.js.map +1 -1
- package/dist/core/api/UserApi.d.ts +2 -1
- package/dist/core/api/UserApi.es.js +6 -5
- package/dist/core/api/UserApi.es.js.map +1 -1
- package/dist/core/constants/ApiEndpoints.d.ts +1 -0
- package/dist/core/constants/ApiEndpoints.es.js +1 -0
- package/dist/core/constants/ApiEndpoints.es.js.map +1 -1
- package/dist/core/stores/AccountStore.d.ts +2 -1
- package/dist/core/stores/AccountStore.es.js +16 -16
- package/dist/core/stores/AccountStore.es.js.map +1 -1
- package/dist/core/stores/BeatStore.d.ts +6 -0
- package/dist/core/stores/BeatStore.es.js +30 -17
- package/dist/core/stores/BeatStore.es.js.map +1 -1
- package/dist/core/stores/BudgetsStore.d.ts +2 -1
- package/dist/core/stores/BudgetsStore.es.js +8 -8
- package/dist/core/stores/BudgetsStore.es.js.map +1 -1
- package/dist/core/stores/CategoryStore.d.ts +7 -0
- package/dist/core/stores/CategoryStore.es.js +18 -7
- package/dist/core/stores/CategoryStore.es.js.map +1 -1
- package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
- package/dist/core/stores/SettingsStore.d.ts +2 -1
- package/dist/core/stores/SettingsStore.es.js +11 -11
- package/dist/core/stores/SettingsStore.es.js.map +1 -1
- package/dist/core/stores/TransactionStore.d.ts +4 -2
- package/dist/core/stores/TransactionStore.es.js +6 -6
- package/dist/core/stores/TransactionStore.es.js.map +1 -1
- package/dist/core/stores/UserStore.d.ts +15 -1
- package/dist/core/stores/UserStore.es.js +21 -3
- package/dist/core/stores/UserStore.es.js.map +1 -1
- package/dist/core/types/Beat.d.ts +6 -0
- package/dist/core/types/Beat.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +127 -5
- package/dist/core/types/InsightsInstanceSlotData.d.ts +1 -13
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
- package/dist/core/types/RepeatingTransaction.d.ts +2 -0
- package/dist/core/types/RepeatingTransaction.es.js.map +1 -1
- package/dist/core/types/User.d.ts +11 -0
- package/dist/core/types/index.d.ts +2 -3
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.d.ts +31 -0
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +22 -0
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.d.ts +10 -9
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +7 -7
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/beatActions.d.ts +7 -0
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +30 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +67 -24
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/index.d.ts +1 -1
- package/dist/insights-v2/components/BadgedTile.d.ts +22 -0
- package/dist/insights-v2/components/BadgedTile.es.js +46 -0
- package/dist/insights-v2/components/BadgedTile.es.js.map +1 -0
- package/dist/insights-v2/components/BaseLayout.es.js +113 -92
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.d.ts +31 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js +129 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -0
- package/dist/insights-v2/components/Footer.d.ts +1 -4
- package/dist/insights-v2/components/Footer.es.js +30 -21
- package/dist/insights-v2/components/Footer.es.js.map +1 -1
- package/dist/insights-v2/components/Header.es.js +10 -10
- package/dist/insights-v2/components/Header.es.js.map +1 -1
- package/dist/insights-v2/components/InsightErrorCard.d.ts +19 -0
- package/dist/insights-v2/components/InsightErrorCard.es.js +45 -0
- package/dist/insights-v2/components/InsightErrorCard.es.js.map +1 -0
- package/dist/insights-v2/components/InsightTransactionRow.es.js +19 -15
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +26 -0
- package/dist/insights-v2/components/LogoFromGuid.es.js +48 -0
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -0
- package/dist/insights-v2/components/StatusBadge.d.ts +16 -0
- package/dist/insights-v2/components/StatusBadge.es.js +29 -0
- package/dist/insights-v2/components/StatusBadge.es.js.map +1 -0
- package/dist/insights-v2/components/StatusPill.d.ts +11 -2
- package/dist/insights-v2/components/StatusPill.es.js +25 -13
- package/dist/insights-v2/components/StatusPill.es.js.map +1 -1
- package/dist/insights-v2/components/SubHeader.es.js +7 -5
- package/dist/insights-v2/components/SubHeader.es.js.map +1 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +11 -11
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/components/shared/EntityLogo.d.ts +26 -0
- package/dist/insights-v2/components/shared/EntityLogo.es.js +33 -0
- package/dist/insights-v2/components/shared/EntityLogo.es.js.map +1 -0
- package/dist/insights-v2/index.d.ts +6 -0
- package/dist/insights-v2/index.es.js +95 -81
- 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.es.js +50 -44
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/insights-v2/resolveInsightRender.d.ts +30 -0
- package/dist/insights-v2/resolveInsightRender.es.js +10 -0
- package/dist/insights-v2/resolveInsightRender.es.js.map +1 -0
- package/dist/microinsights/cards/InsightCard.es.js +83 -39
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/carousel/BeatList.es.js +24 -24
- package/dist/microinsights/carousel/BeatList.es.js.map +1 -1
- package/dist/notifications/components/NotificationBadge.es.js +12 -10
- package/dist/notifications/components/NotificationBadge.es.js.map +1 -1
- package/dist/notifications/components/NotificationCard.es.js +27 -18
- package/dist/notifications/components/NotificationCard.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +7 -0
- package/dist/transactions/components/shared/TransactionDetails.es.js +159 -143
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionInsightTag.d.ts +26 -0
- package/dist/transactions/components/shared/TransactionInsightTag.es.js +53 -0
- package/dist/transactions/components/shared/TransactionInsightTag.es.js.map +1 -0
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +30 -39
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiontable/cells/AmountCell.es.js +15 -15
- package/dist/transactions/components/shared/transactiontable/cells/AmountCell.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
1
|
+
import { useAppConfig as M, useGlobalCopyStore as N, useInsightsV2Store as R } from "../../common/context/hooks.es.js";
|
|
2
2
|
import { sendBeatCta as H } from "../../common/utils/PostMessage.es.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
|
|
3
|
+
import { BeatActionsProvider as P } from "../beatActions.es.js";
|
|
4
|
+
import { isContactSupportCtaDisabled as G } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
5
|
+
import { logoFromRef as U } from "./shared/EntityLogo.es.js";
|
|
6
|
+
import { actionBlocksKey as j } from "../mappings/actionBlocksKey.es.js";
|
|
7
|
+
import { blocks as z, hasDrawerBlock as K } from "../mappings/blocks.es.js";
|
|
8
|
+
import V from "./Footer.es.js";
|
|
9
|
+
import W from "./Header.es.js";
|
|
10
|
+
import { FeedbackBar as X } from "./FeedbackBar.es.js";
|
|
11
|
+
import Y from "./FeedbackDialog.es.js";
|
|
12
|
+
import { DismissInsightDialog as q } from "./DismissInsightDialog.es.js";
|
|
13
|
+
import { HiddenConfirmationCard as J } from "./HiddenConfirmationCard.es.js";
|
|
14
|
+
import { ErrorCard as Q } from "./ErrorCard.es.js";
|
|
15
|
+
import { LoadingCard as Z } from "./LoadingCard.es.js";
|
|
16
|
+
import { ObsolesceBanner as $ } from "./ObsolesceBanner.es.js";
|
|
17
|
+
import { ActionBlockLayer as oo } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
18
|
+
import { useBeatFeedbackFlow as eo } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
19
|
+
import { observer as io } from "mobx-react-lite";
|
|
20
|
+
import u from "@mui/material/Stack";
|
|
21
|
+
import { P as to, Text as ro } from "@mxenabled/mxui";
|
|
22
|
+
import b from "@mui/material/Button";
|
|
23
|
+
import { ChevronRight as so } from "@mxenabled/mx-icons";
|
|
24
|
+
import { Fragment as no, jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
25
|
+
import ao from "@mui/material/Box";
|
|
26
|
+
import lo from "@mui/material/Card";
|
|
27
|
+
var co = {}, mo = {
|
|
25
28
|
position: "absolute",
|
|
26
29
|
top: 0,
|
|
27
30
|
left: 0,
|
|
@@ -30,61 +33,71 @@ var ie = {}, re = {
|
|
|
30
33
|
backgroundColor: "background.default",
|
|
31
34
|
opacity: 0.7,
|
|
32
35
|
zIndex: 1
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
}, po = {
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
alignSelf: "flex-start",
|
|
39
|
+
display: "flex",
|
|
40
|
+
fontWeight: 600,
|
|
41
|
+
height: 44,
|
|
42
|
+
px: 2,
|
|
43
|
+
textTransform: "none"
|
|
44
|
+
}, Po = io(({ beat: t, beatActions: c = co, obsolete: m, isLoading: y = !1, isError: _ = !1 }) => {
|
|
45
|
+
const { openCtaDrawer: v } = R(), x = N(), { is_mobile_webview: k, clientConfig: S, config: T } = M(), o = eo(t, c);
|
|
46
|
+
if (_) return /* @__PURE__ */ e(Q, {});
|
|
47
|
+
const i = t.insights_payload;
|
|
48
|
+
if (!i || o.cardState === "dismissed") return null;
|
|
49
|
+
const { instance_slot: w, primary_cta: r, secondary_cta: a, sub_title: B, title: D, widget_type: O, guid: C, user_guid: L, dismissed_at: I } = i, { block: F } = w, A = B ?? (i.subtitle ? {
|
|
50
|
+
logo: U(i.logo),
|
|
51
|
+
text: i.subtitle
|
|
52
|
+
} : void 0), l = (s) => G(s, T, c.onContactSupport), g = (s, E) => {
|
|
53
|
+
l(s) || (s === j.CONTACT_SUPPORT_ACTION_BLOCK ? c.onContactSupport?.() : K(s) ? v(C, E) : H(t, {
|
|
54
|
+
isMobileWebview: k,
|
|
55
|
+
webviewScheme: S?.master?.ui_message_webview_url_scheme,
|
|
56
|
+
userGuid: L
|
|
57
|
+
}));
|
|
58
|
+
}, h = z[F], p = O === "mini", d = x.insights_feed?.general, f = m?.state === "not_refreshable" && !I && !!d;
|
|
59
|
+
return /* @__PURE__ */ e(P, {
|
|
60
|
+
value: o.wrappedActions,
|
|
61
|
+
children: /* @__PURE__ */ n(u, {
|
|
48
62
|
sx: { mb: 16 },
|
|
49
63
|
children: [
|
|
50
|
-
|
|
51
|
-
onClose:
|
|
52
|
-
onLeaveFeedback:
|
|
53
|
-
onUndo:
|
|
54
|
-
}) : /* @__PURE__ */
|
|
55
|
-
...
|
|
56
|
-
copy:
|
|
57
|
-
}), /* @__PURE__ */
|
|
58
|
-
inert:
|
|
59
|
-
sx: { ...
|
|
64
|
+
o.cardState === "confirming" ? /* @__PURE__ */ e(J, {
|
|
65
|
+
onClose: o.collapseConfirmation,
|
|
66
|
+
onLeaveFeedback: o.openHideSurvey,
|
|
67
|
+
onUndo: o.undoDismiss
|
|
68
|
+
}) : /* @__PURE__ */ n(no, { children: [m && d && /* @__PURE__ */ e($, {
|
|
69
|
+
...m,
|
|
70
|
+
copy: d
|
|
71
|
+
}), /* @__PURE__ */ n(lo, {
|
|
72
|
+
inert: f,
|
|
73
|
+
sx: { ...f && {
|
|
60
74
|
position: "relative",
|
|
61
75
|
zIndex: 2,
|
|
62
76
|
pointerEvents: "none"
|
|
63
77
|
} },
|
|
64
78
|
children: [
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
isMini:
|
|
68
|
-
subtitle:
|
|
69
|
-
title:
|
|
79
|
+
f && /* @__PURE__ */ e(ao, { sx: mo }),
|
|
80
|
+
/* @__PURE__ */ e(W, {
|
|
81
|
+
isMini: p,
|
|
82
|
+
subtitle: A,
|
|
83
|
+
title: D ?? ""
|
|
70
84
|
}),
|
|
71
|
-
y ? /* @__PURE__ */
|
|
72
|
-
beatGuid:
|
|
73
|
-
payload:
|
|
85
|
+
y ? /* @__PURE__ */ e(Z, {}) : h && /* @__PURE__ */ e(h, {
|
|
86
|
+
beatGuid: C,
|
|
87
|
+
payload: i
|
|
74
88
|
}),
|
|
75
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ n(u, {
|
|
76
90
|
sx: {
|
|
77
91
|
gap: 6,
|
|
78
92
|
pb: 16,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
pt: 12
|
|
93
|
+
pt: 12,
|
|
94
|
+
px: 16
|
|
82
95
|
},
|
|
83
|
-
children: [/* @__PURE__ */
|
|
84
|
-
dangerouslySetInnerHTML: { __html:
|
|
96
|
+
children: [/* @__PURE__ */ e(to, {
|
|
97
|
+
dangerouslySetInnerHTML: { __html: i.description.html_text },
|
|
85
98
|
variant: "subtitle2"
|
|
86
|
-
}),
|
|
87
|
-
endIcon: /* @__PURE__ */
|
|
99
|
+
}), t?.in_description_cta && /* @__PURE__ */ e(b, {
|
|
100
|
+
endIcon: /* @__PURE__ */ e(so, {}),
|
|
88
101
|
onClick: () => {
|
|
89
102
|
},
|
|
90
103
|
sx: {
|
|
@@ -92,57 +105,65 @@ var ie = {}, re = {
|
|
|
92
105
|
p: 4,
|
|
93
106
|
width: "max-content"
|
|
94
107
|
},
|
|
95
|
-
children:
|
|
108
|
+
children: t.in_description_cta
|
|
96
109
|
})]
|
|
97
110
|
}),
|
|
98
|
-
|
|
111
|
+
r?.label && /* @__PURE__ */ n(u, {
|
|
99
112
|
sx: {
|
|
100
113
|
gap: 8,
|
|
101
114
|
pb: 16,
|
|
102
115
|
px: 16
|
|
103
116
|
},
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
-
|
|
117
|
+
children: [p ? /* @__PURE__ */ e(ro, {
|
|
118
|
+
color: "primary.main",
|
|
119
|
+
sx: po,
|
|
120
|
+
variant: "button",
|
|
121
|
+
children: r.label
|
|
122
|
+
}) : /* @__PURE__ */ e(b, {
|
|
123
|
+
"aria-disabled": l(r.block),
|
|
124
|
+
onClick: () => g(r.block, "primaryCta"),
|
|
125
|
+
sx: { ...l(r.block) && { color: "text.disabled" } },
|
|
106
126
|
variant: "outlined",
|
|
107
|
-
children:
|
|
108
|
-
}), a?.label && /* @__PURE__ */
|
|
127
|
+
children: r.label
|
|
128
|
+
}), !p && a?.label && /* @__PURE__ */ e(b, {
|
|
129
|
+
"aria-disabled": l(a.block),
|
|
109
130
|
color: "secondary",
|
|
110
|
-
onClick: () =>
|
|
131
|
+
onClick: () => g(a.block, "secondaryCta"),
|
|
111
132
|
children: a.label
|
|
112
133
|
})]
|
|
113
134
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
onTellUsMore:
|
|
116
|
-
show:
|
|
135
|
+
/* @__PURE__ */ e(X, {
|
|
136
|
+
onTellUsMore: o.openRatingSurvey,
|
|
137
|
+
show: o.isFeedbackBarShown
|
|
117
138
|
})
|
|
118
139
|
]
|
|
119
140
|
})] }),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
isOpen:
|
|
123
|
-
onClose:
|
|
124
|
-
onDismiss:
|
|
141
|
+
/* @__PURE__ */ e(oo, { beat: t }),
|
|
142
|
+
/* @__PURE__ */ e(q, {
|
|
143
|
+
isOpen: o.isDismissOpen,
|
|
144
|
+
onClose: o.closeDismissDialog,
|
|
145
|
+
onDismiss: o.confirmDismiss
|
|
125
146
|
}),
|
|
126
|
-
|
|
127
|
-
characterLimitLabel:
|
|
128
|
-
closeAriaLabel:
|
|
147
|
+
o.isSurveyOpen && /* @__PURE__ */ e(Y, {
|
|
148
|
+
characterLimitLabel: o.survey.characterLimitLabel,
|
|
149
|
+
closeAriaLabel: o.survey.closeAriaLabel,
|
|
129
150
|
isOpen: !0,
|
|
130
|
-
onBackClick:
|
|
131
|
-
onClose:
|
|
132
|
-
onSubmit:
|
|
133
|
-
onTextInputFocus:
|
|
134
|
-
options:
|
|
135
|
-
primaryText:
|
|
136
|
-
secondaryText:
|
|
137
|
-
title:
|
|
151
|
+
onBackClick: o.feedbackDialogCallbacks.onBackClick,
|
|
152
|
+
onClose: o.closeSurvey,
|
|
153
|
+
onSubmit: o.submitSurvey,
|
|
154
|
+
onTextInputFocus: o.feedbackDialogCallbacks.onTextInputFocus,
|
|
155
|
+
options: o.survey.options,
|
|
156
|
+
primaryText: o.survey.submitText,
|
|
157
|
+
secondaryText: o.survey.backText,
|
|
158
|
+
title: o.survey.title
|
|
138
159
|
}),
|
|
139
|
-
|
|
160
|
+
o.cardState === "visible" && i.footer && /* @__PURE__ */ e(V, { footer: i.footer })
|
|
140
161
|
]
|
|
141
162
|
})
|
|
142
163
|
});
|
|
143
164
|
});
|
|
144
165
|
export {
|
|
145
|
-
|
|
166
|
+
Po as default
|
|
146
167
|
};
|
|
147
168
|
|
|
148
169
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { 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, hasDrawerBlock } from '../mappings/blocks'\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, useInsightsV2Store } from '../../common'\nimport { sendBeatCta } from '../../common/utils/PostMessage'\nimport type { Beat } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\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 zIndex: 1,\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 { openCtaDrawer } = useInsightsV2Store()\n const copy = useGlobalCopyStore()\n const { is_mobile_webview, clientConfig } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\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 {\n instance_slot,\n primary_cta,\n secondary_cta,\n sub_title,\n title,\n widget_type,\n guid,\n user_guid,\n dismissed_at,\n } = insights_payload\n const { block } = instance_slot\n\n // A CTA with a real drilldown `block` opens a drawer; otherwise it notifies\n // the host app via a beat/cta post message (the \"Make a Transfer\" CTA on the\n // Save an extra $100 beat). Mirrors Pulse's SaveAnExtra100Dollars beat.\n const handleCtaClick = (\n ctaBlock: string | null | undefined,\n source: 'primaryCta' | 'secondaryCta',\n ) => {\n if (hasDrawerBlock(ctaBlock)) {\n openCtaDrawer(guid, source)\n } else {\n sendBeatCta(beat, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: user_guid,\n })\n }\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const isMini = widget_type === 'mini'\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={flow.wrappedActions}>\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={sub_title} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pl: 12, pr: 16, pt: 12 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* TODO: Migrate to insights_payload.in_description_cta once backend provides it */}\n {beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {!isMini && primary_cta?.label && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n <Button\n onClick={() => handleCtaClick(primary_cta.block, 'primaryCta')}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n {secondary_cta?.label && (\n <Button\n color=\"secondary\"\n onClick={() => handleCtaClick(secondary_cta.block, 'secondaryCta')}\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":";;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AACV,GAEM,KAAa,EAAA,CAChB,EACC,MAAA,GACA,aAAA,IAAc,IACd,UAAA,GACA,WAAA,IAAY,IACZ,SAAA,IAAU,GAAA,MACW;AACrB,QAAM,EAAE,eAAA,EAAA,IAAkB,EAAmB,GACvC,IAAO,EAAmB,GAC1B,EAAE,mBAAA,GAAmB,cAAA,EAAA,IAAiB,EAAa,GACnD,IAAO,EAAoB,GAAM,CAAW;AAGlD,MAAI,EAAS,QAAO,gBAAA,EAAC,GAAD,CAAY,CAAA;AAEhC,QAAM,IAAmB,EAAK;AAG9B,MADI,CAAC,KACD,EAAK,cAAc,YAAa,QAAO;AAE3C,QAAM,EACJ,eAAA,GACA,aAAA,GACA,eAAA,GACA,WAAA,GACA,OAAA,GACA,a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AC,GAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,QAE/B,gBAAA,EAAC,GAAD;AAAA,UACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,GAAD;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,GAAD,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 { 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, Text } from '@mxenabled/mxui'\n\nimport { blocks, hasDrawerBlock } 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, useInsightsV2Store } from '../../common'\nimport { sendBeatCta } from '../../common/utils/PostMessage'\nimport type { Beat } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\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 zIndex: 1,\n} as const\n\n// Figma (Mini | Large Transaction): a left-aligned link under the description. The 2px padding plus\n// the CTA row's 16 lines the label up with the description's 18. The label is not a Button, so it\n// carries the theme's MuiButton look itself: semi-bold, no uppercase (typography.button uppercases),\n// and the medium Button's 44px height with the text centred.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\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 { openCtaDrawer } = useInsightsV2Store()\n const copy = useGlobalCopyStore()\n const { is_mobile_webview, clientConfig, config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\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 {\n instance_slot,\n primary_cta,\n secondary_cta,\n sub_title,\n title,\n widget_type,\n guid,\n user_guid,\n dismissed_at,\n } = insights_payload\n const { block } = instance_slot\n\n // V1 sends `sub_title: { text, logo }`. The V2 envelope flattens it to a `subtitle` string\n // with the logo promoted to a payload-level `LogoRef` (an entity guid or a status icon), so\n // rebuild the shape `Header`/`SubHeader` already render. `sub_title` wins when a beat sends both.\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 // A CTA with a real drilldown `block` opens a drawer; otherwise it notifies\n // the host app via a beat/cta post message (the \"Make a Transfer\" CTA on the\n // Save an extra $100 beat). Mirrors Pulse's SaveAnExtra100Dollars beat.\n //\n // `contact_support_block` is the exception: it is the help module's flow, which insights-v2\n // cannot import (hosts that don't ship the Help widget stub the import), so the host injects it\n // as `beatActions.onContactSupport` and the CTA calls it directly — never a drawer. Without a\n // handler, or with `enable_support_requests` off, the CTA renders disabled and does nothing.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const handleCtaClick = (\n ctaBlock: string | null | undefined,\n source: 'primaryCta' | 'secondaryCta',\n ) => {\n if (isCtaDisabled(ctaBlock)) return\n\n if (ctaBlock === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n beatActions.onContactSupport?.()\n } else if (hasDrawerBlock(ctaBlock)) {\n openCtaDrawer(guid, source)\n } else {\n sendBeatCta(beat, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: user_guid,\n })\n }\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const isMini = widget_type === 'mini'\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={flow.wrappedActions}>\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={title ?? ''} />\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 variant=\"subtitle2\"\n />\n {/* TODO: Migrate to insights_payload.in_description_cta once backend provides it */}\n {beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {primary_cta?.label && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {isMini ? (\n // Mini is a tap target, as in V1: the card, not this label, is the control. The label\n // is deliberately not a button, so a tap on it reaches the host's card handler (Pulse\n // posts `carousel/cta`, the same redirect a V1 mini card sends) instead of opening\n // the action drawer the full card's CTA opens.\n <Text color=\"primary.main\" sx={MINI_CTA_SX} variant=\"button\">\n {primary_cta.label}\n </Text>\n ) : (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block)}\n onClick={() => handleCtaClick(primary_cta.block, 'primaryCta')}\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 {!isMini && secondary_cta?.label && (\n <Button\n aria-disabled={isCtaDisabled(secondary_cta.block)}\n color=\"secondary\"\n onClick={() => handleCtaClick(secondary_cta.block, 'secondaryCta')}\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AACV,GAMM,KAAc;AAAA,EAClB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,IAAI;AAAA,EAC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ACjC,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,GAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InsightsPayload, PrimaryCTA } from '../../core';
|
|
2
|
+
export interface CompactInsightCardProps {
|
|
3
|
+
/** A `micro` or `embedded` envelope. */
|
|
4
|
+
payload: InsightsPayload;
|
|
5
|
+
/**
|
|
6
|
+
* Makes the whole card the tap target. What a tap does is the host's decision (post to the
|
|
7
|
+
* host app, open a drawer, …); the card never opens anything itself. Omit for a static card.
|
|
8
|
+
*/
|
|
9
|
+
onTap?: () => void;
|
|
10
|
+
/** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */
|
|
11
|
+
onCtaClick?: (cta: PrimaryCTA) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot
|
|
14
|
+
* honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).
|
|
15
|
+
*/
|
|
16
|
+
isCtaDisabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).
|
|
20
|
+
*
|
|
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 first slot row's logo in a
|
|
23
|
+
* `<BadgedTile>`. Under ditto's `embedded` variant the tile takes a status badge; micro sends no
|
|
24
|
+
* variant and draws the logo alone. The card lays out from the envelope alone and never reads
|
|
25
|
+
* `widget_type`.
|
|
26
|
+
*
|
|
27
|
+
* The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot
|
|
28
|
+
* has no row. The `pill` on the same envelope is the transaction row's, not the card's.
|
|
29
|
+
*/
|
|
30
|
+
declare const CompactInsightCard: ({ isCtaDisabled, onCtaClick, onTap, payload, }: CompactInsightCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default CompactInsightCard;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createVariantBlock as b } from "../blocks/createVariantBlock.es.js";
|
|
2
|
+
import c from "./BadgedTile.es.js";
|
|
3
|
+
import { InsightOptionsMenu as y } from "./InsightOptionsMenu.es.js";
|
|
4
|
+
import k from "./LogoFromGuid.es.js";
|
|
5
|
+
import I from "./StatusBadge.es.js";
|
|
6
|
+
import l from "@mui/material/Stack";
|
|
7
|
+
import { P as v, Text as w } from "@mxenabled/mxui";
|
|
8
|
+
import C from "@mui/material/Button";
|
|
9
|
+
import { Icon as S } from "@mxenabled/mx-icons";
|
|
10
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
11
|
+
import d from "@mui/material/Box";
|
|
12
|
+
import _ from "@mui/material/Card";
|
|
13
|
+
var e = 44, m = ({ logo: r }) => r ? /* @__PURE__ */ t(k, {
|
|
14
|
+
logo: r,
|
|
15
|
+
size: e
|
|
16
|
+
}) : /* @__PURE__ */ t(d, {
|
|
17
|
+
"data-testid": "compact-insight-card-fallback-icon",
|
|
18
|
+
sx: {
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
bgcolor: "primary.lighter",
|
|
21
|
+
display: "flex",
|
|
22
|
+
height: e,
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
width: e
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ t(S, {
|
|
27
|
+
color: "primary",
|
|
28
|
+
fill: !0,
|
|
29
|
+
name: "lightbulb",
|
|
30
|
+
size: 24
|
|
31
|
+
})
|
|
32
|
+
}), z = ({ logo: r }) => /* @__PURE__ */ t(c, {
|
|
33
|
+
center: /* @__PURE__ */ t(m, { logo: r }),
|
|
34
|
+
size: e,
|
|
35
|
+
sx: { flexShrink: 0 }
|
|
36
|
+
}), B = ({ logo: r }) => /* @__PURE__ */ t(c, {
|
|
37
|
+
center: /* @__PURE__ */ t(m, { logo: r }),
|
|
38
|
+
size: e,
|
|
39
|
+
sx: { flexShrink: 0 },
|
|
40
|
+
topRight: /* @__PURE__ */ t(I, { tone: "warning" })
|
|
41
|
+
}), P = b({
|
|
42
|
+
variants: { embedded: B },
|
|
43
|
+
fallback: z,
|
|
44
|
+
name: "InsightVisual"
|
|
45
|
+
}), V = (r) => r.stopPropagation(), T = ({ isCtaDisabled: r = !1, onCtaClick: p, onTap: a, payload: f }) => {
|
|
46
|
+
const { description: g, instance_slot: s, primary_cta: o, title: h } = f, x = s.data_series?.[0]?.logo, u = (i) => {
|
|
47
|
+
i.stopPropagation(), !(r || !o) && p?.(o);
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ n(_, {
|
|
50
|
+
"data-testid": "compact-insight-card",
|
|
51
|
+
...a ? {
|
|
52
|
+
onClick: a,
|
|
53
|
+
onKeyDown: (i) => {
|
|
54
|
+
i.target === i.currentTarget && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), a?.());
|
|
55
|
+
},
|
|
56
|
+
role: "button",
|
|
57
|
+
tabIndex: 0
|
|
58
|
+
} : {},
|
|
59
|
+
sx: {
|
|
60
|
+
minWidth: 288,
|
|
61
|
+
pb: 12,
|
|
62
|
+
pl: 8,
|
|
63
|
+
pr: 16,
|
|
64
|
+
pt: 8,
|
|
65
|
+
...a && { cursor: "pointer" }
|
|
66
|
+
},
|
|
67
|
+
children: [/* @__PURE__ */ n(l, {
|
|
68
|
+
sx: {
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
flexDirection: "row",
|
|
71
|
+
gap: 8,
|
|
72
|
+
justifyContent: "space-between",
|
|
73
|
+
pl: 8,
|
|
74
|
+
pt: 4
|
|
75
|
+
},
|
|
76
|
+
children: [/* @__PURE__ */ t(w, {
|
|
77
|
+
bold: !0,
|
|
78
|
+
variant: "body1",
|
|
79
|
+
children: h ?? ""
|
|
80
|
+
}), /* @__PURE__ */ t(d, {
|
|
81
|
+
onClick: V,
|
|
82
|
+
sx: { display: "flex" },
|
|
83
|
+
children: /* @__PURE__ */ t(y, {})
|
|
84
|
+
})]
|
|
85
|
+
}), /* @__PURE__ */ n(l, {
|
|
86
|
+
sx: {
|
|
87
|
+
flexDirection: "row",
|
|
88
|
+
gap: 16,
|
|
89
|
+
pl: 8,
|
|
90
|
+
pt: 4
|
|
91
|
+
},
|
|
92
|
+
children: [/* @__PURE__ */ n(l, {
|
|
93
|
+
sx: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
gap: 8,
|
|
96
|
+
minWidth: 0
|
|
97
|
+
},
|
|
98
|
+
children: [/* @__PURE__ */ t(v, {
|
|
99
|
+
dangerouslySetInnerHTML: { __html: g.html_text },
|
|
100
|
+
"data-testid": "compact-insight-card-description",
|
|
101
|
+
variant: "subtitle2"
|
|
102
|
+
}), o?.label && /* @__PURE__ */ t(C, {
|
|
103
|
+
"aria-disabled": r,
|
|
104
|
+
onClick: u,
|
|
105
|
+
size: "small",
|
|
106
|
+
sx: {
|
|
107
|
+
alignSelf: "flex-start",
|
|
108
|
+
ml: -8,
|
|
109
|
+
px: 8,
|
|
110
|
+
...r && {
|
|
111
|
+
color: "text.disabled",
|
|
112
|
+
cursor: "default"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
variant: "text",
|
|
116
|
+
children: o.label
|
|
117
|
+
})]
|
|
118
|
+
}), /* @__PURE__ */ t(P, {
|
|
119
|
+
logo: x,
|
|
120
|
+
variant: s.variant
|
|
121
|
+
})]
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
T as default
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=CompactInsightCard.es.js.map
|
|
@@ -0,0 +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,EAAC,GAAD,EAAa,MAAK,UAAW,CAAA;AACxC,CAAA,GAUG,IAAgB,EAAuC;AAAA,EAC3D,UAAU,EAAE,UAAU,EAAe;AAAA,EACrC,UAAU;AAAA,EACV,MAAM;AACR,CAAC,GAmBK,IAA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ormats.es.js";
|
|
2
|
+
import { fromUnixUTC as c } from "../../core/utils/DateUtil.es.js";
|
|
3
|
+
import m from "@mui/material/Stack";
|
|
4
|
+
import { Text as e } from "@mxenabled/mxui";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
var f = (r) => {
|
|
7
|
+
if (typeof r != "number" || Number.isNaN(r)) return "";
|
|
8
|
+
const t = c(r);
|
|
9
|
+
return Number.isNaN(t.getTime()) ? "" : i(t, a.FULL_MONTH_DAY_YEAR);
|
|
10
|
+
}, T = ({ footer: r }) => {
|
|
11
|
+
const t = r.date ?? f(r.timestamp), n = r.account ?? "";
|
|
12
|
+
return /* @__PURE__ */ s(m, {
|
|
13
|
+
sx: {
|
|
14
|
+
flexDirection: "row",
|
|
15
|
+
justifyContent: "space-between",
|
|
16
|
+
px: 16,
|
|
17
|
+
py: 8
|
|
18
|
+
},
|
|
19
|
+
children: [/* @__PURE__ */ o(e, {
|
|
20
|
+
color: "text.secondary",
|
|
21
|
+
variant: "tiny",
|
|
22
|
+
children: t
|
|
23
|
+
}), /* @__PURE__ */ o(e, {
|
|
24
|
+
color: "text.secondary",
|
|
25
|
+
variant: "tiny",
|
|
26
|
+
children: n
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
21
30
|
export {
|
|
22
|
-
|
|
31
|
+
T as default
|
|
23
32
|
};
|
|
24
33
|
|
|
25
34
|
//# sourceMappingURL=Footer.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.es.js","names":[],"sources":["../../../src/insights-v2/components/Footer.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\
|
|
1
|
+
{"version":3,"file":"Footer.es.js","names":[],"sources":["../../../src/insights-v2/components/Footer.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../core/constants'\nimport type { Footer as FooterData } from '../../core'\nimport { fromUnixUTC } from '../../core/utils/DateUtil'\n\ninterface FooterProps {\n footer: FooterData\n}\n\n/**\n * V1 beats send a pre-formatted `date` string; the V2 envelope (LargeTransactionV2 onward) sends\n * the date as unix seconds instead (`date` -> `timestamp`). Both render, because the footer is\n * shared by every insight and V1 beats are still live.\n *\n * `account` is spelled the same on both. The backend resolves plurality into that one field (one\n * account -> its name, several -> a localized `N Accounts`), so there is no separate `accounts`.\n */\nconst formatTimestamp = (timestamp?: number) => {\n if (typeof timestamp !== 'number' || Number.isNaN(timestamp)) return ''\n const parsed = fromUnixUTC(timestamp)\n if (Number.isNaN(parsed.getTime())) return ''\n return formatDate(parsed, DATE_FORMATS_INTL.FULL_MONTH_DAY_YEAR)\n}\n\nconst Footer = ({ footer }: FooterProps) => {\n const date = footer.date ?? formatTimestamp(footer.timestamp)\n const account = footer.account ?? ''\n\n return (\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between', px: 16, py: 8 }}>\n <Text color=\"text.secondary\" variant=\"tiny\">\n {date}\n </Text>\n <Text color=\"text.secondary\" variant=\"tiny\">\n {account}\n </Text>\n </Stack>\n )\n}\n\nexport default Footer\n"],"mappings":";;;;;AAoBA,IAAM,IAAA,CAAmB,MAAuB;AAC9C,MAAI,OAAO,KAAc,YAAY,OAAO,MAAM,CAAS,EAAG,QAAO;AACrE,QAAM,IAAS,EAAY,CAAS;AACpC,SAAI,OAAO,MAAM,EAAO,QAAQ,CAAC,IAAU,KACpC,EAAW,GAAQ,EAAkB,mBAAmB;AACjE,GAEM,IAAA,CAAU,EAAE,QAAA,EAAA,MAA0B;AAC1C,QAAM,IAAO,EAAO,QAAQ,EAAgB,EAAO,SAAS,GACtD,IAAU,EAAO,WAAW;AAElC,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,eAAe;AAAA,MAAO,gBAAgB;AAAA,MAAiB,IAAI;AAAA,MAAI,IAAI;AAAA,IAAE;AAAA,IAAlF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAM,OAAM;AAAA,MAAiB,SAAQ;AAAA,MAClC,UAAA;AAAA,IACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,MAAM,OAAM;AAAA,MAAiB,SAAQ;AAAA,MAClC,UAAA;AAAA,IACG,CAAA,CACD;AAAA;AAEX"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import m from "./SubHeader.es.js";
|
|
2
1
|
import { useBeatActions as s } from "../beatActions.es.js";
|
|
3
|
-
import { InsightOptionsMenu as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { InsightOptionsMenu as m } from "./InsightOptionsMenu.es.js";
|
|
3
|
+
import a from "./SubHeader.es.js";
|
|
4
|
+
import e from "@mui/material/Stack";
|
|
5
|
+
import { H3 as f } from "@mxenabled/mxui";
|
|
6
6
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
var g = ({ isMini: n, subtitle:
|
|
7
|
+
var g = ({ isMini: n, subtitle: t, title: i }) => {
|
|
8
8
|
const { onMenuAction: p } = s();
|
|
9
|
-
return /* @__PURE__ */ o(
|
|
9
|
+
return /* @__PURE__ */ o(e, {
|
|
10
10
|
sx: {
|
|
11
11
|
gap: 4,
|
|
12
12
|
pb: 12,
|
|
@@ -14,14 +14,14 @@ var g = ({ isMini: n, subtitle: e, title: i }) => {
|
|
|
14
14
|
pr: 16,
|
|
15
15
|
pt: 16
|
|
16
16
|
},
|
|
17
|
-
children: [/* @__PURE__ */ o(
|
|
17
|
+
children: [/* @__PURE__ */ o(e, {
|
|
18
18
|
sx: {
|
|
19
|
-
alignItems: "
|
|
19
|
+
alignItems: "flex-start",
|
|
20
20
|
flexDirection: "row",
|
|
21
21
|
justifyContent: "space-between"
|
|
22
22
|
},
|
|
23
|
-
children: [/* @__PURE__ */ r(
|
|
24
|
-
}),
|
|
23
|
+
children: [/* @__PURE__ */ r(f, { children: i }), !n && p && /* @__PURE__ */ r(m, {})]
|
|
24
|
+
}), t && /* @__PURE__ */ r(a, { subtitle: t })]
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
export {
|