@mx-cartographer/experiences 9.7.64 → 9.7.66-alpha-harini-sov2-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/core/stores/RecurringTransactionsStore.es.js +27 -22
- package/dist/core/stores/RecurringTransactionsStore.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +2 -7
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +6 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +37 -37
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +10 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +12 -7
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +29 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +28 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.d.ts +7 -14
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +13 -25
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +4 -4
- package/dist/insights-v2/components/BaseLayout.es.js +121 -104
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +9 -6
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +46 -0
- package/dist/insights-v2/ctaActions/types.d.ts +16 -2
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +42 -30
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +69 -64
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.es.js +104 -96
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/Description.es.js +16 -13
- package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.d.ts +0 -18
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js +0 -13
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js.map +0 -1
|
@@ -1,61 +1,68 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import { useAppConfig as
|
|
4
|
-
import { TransactionType as
|
|
1
|
+
import { buildDynamicCopy as W } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as ge, formatDate as fe } from "../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { useAppConfig as he, useCategoryStore as _e, useEvent as Te, useGlobalCopyStore as ye, useGlobalUiStore as Se, useTransactionStore as be, useUserStore as Ce } from "../../../common/context/hooks.es.js";
|
|
4
|
+
import { TransactionType as ve } from "../../../core/types/Transaction.es.js";
|
|
5
5
|
import { fromUnixUTC as De } from "../../../core/utils/DateUtil.es.js";
|
|
6
|
-
import { formatCurrency as
|
|
7
|
-
import { ANALYTICS_EVENTS as
|
|
8
|
-
import { isFeatureEnabled as
|
|
9
|
-
import { isTransferTransaction as
|
|
10
|
-
import
|
|
11
|
-
import { BottomActions as m, DEFAULT_BOTTOM_ACTIONS as
|
|
6
|
+
import { formatCurrency as V } from "../../../core/utils/NumberFormatting.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS as Ae } from "../../../common/constants/Analytics.es.js";
|
|
8
|
+
import { isFeatureEnabled as xe } from "../../../core/utils/UserUtils.es.js";
|
|
9
|
+
import { isTransferTransaction as Ie } from "../../../core/utils/TransactionUtils.es.js";
|
|
10
|
+
import Le from "../../../common/components/Loader.es.js";
|
|
11
|
+
import { BottomActions as m, DEFAULT_BOTTOM_ACTIONS as Oe, DEFAULT_TOP_ACTIONS as we, TopActions as h } from "../../constants/Actions.es.js";
|
|
12
12
|
import { resolveInsightRender as Ee } from "../../../insights-v2/resolveInsightRender.es.js";
|
|
13
|
-
import { isContactSupportCtaDisabled as
|
|
14
|
-
import { actionBlocksKey as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { EmbeddedCard as
|
|
19
|
-
import { AddMerchantBudgetAction as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
13
|
+
import { isContactSupportCtaDisabled as Me } from "../../../insights-v2/actionBlocks/ContactSupportActionBlock.es.js";
|
|
14
|
+
import { actionBlocksKey as Ne } from "../../../insights-v2/mappings/actionBlocksKey.es.js";
|
|
15
|
+
import Be from "../../../insights-v2/components/InsightErrorCard.es.js";
|
|
16
|
+
import ke from "../../../insights-v2/components/CompactInsightCard.es.js";
|
|
17
|
+
import Fe from "../../../insights/components/shared/ChartTransactionWithDrillDown.es.js";
|
|
18
|
+
import { EmbeddedCard as Re } from "../../../insights/components/shared/InsightsCard/EmbeddedCard.es.js";
|
|
19
|
+
import { AddMerchantBudgetAction as Ge } from "./transactiondetails/actions/AddMerchantBudgetAction.es.js";
|
|
20
|
+
import Pe from "./transactiondetails/actions/CategoryAction.es.js";
|
|
21
|
+
import Ue from "./transactiondetails/actions/DateAction.es.js";
|
|
22
|
+
import We from "./transactiondetails/actions/DeleteAction.es.js";
|
|
23
23
|
import Ve from "./transactiondetails/actions/DeleteLogoAction.es.js";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
24
|
+
import He from "./transactiondetails/actions/ExcludeAction.es.js";
|
|
25
|
+
import Xe from "./transactiondetails/actions/MemoAction.es.js";
|
|
26
26
|
import je from "./transactiondetails/actions/SplitAction.es.js";
|
|
27
27
|
import ze from "./transactiondetails/actions/TagsAction.es.js";
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import { getEmbeddedInstanceSlotByBeatTemplates as
|
|
28
|
+
import qe from "./transactiondetails/Description.es.js";
|
|
29
|
+
import Ke from "./transactiondetails/FlagTransaction.es.js";
|
|
30
|
+
import Ye from "./transactiondetails/TransactionDetailsView.es.js";
|
|
31
|
+
import { getEmbeddedInstanceSlotByBeatTemplates as $e } from "./getEmbeddedInstanceSlotByBeatTemplates.es.js";
|
|
32
32
|
import s, { useMemo as H } from "react";
|
|
33
|
-
import { observer as
|
|
33
|
+
import { observer as Ze } from "mobx-react-lite";
|
|
34
34
|
import c from "@mui/material/Stack";
|
|
35
|
-
import { MerchantLogo as
|
|
36
|
-
import { endOfMonth as
|
|
37
|
-
import { isBefore as
|
|
38
|
-
import { startOfMonth as
|
|
39
|
-
import
|
|
35
|
+
import { MerchantLogo as X, P as Je, Text as _ } from "@mxenabled/mxui";
|
|
36
|
+
import { endOfMonth as Qe } from "date-fns/endOfMonth";
|
|
37
|
+
import { isBefore as et } from "date-fns/isBefore";
|
|
38
|
+
import { startOfMonth as j } from "date-fns/startOfMonth";
|
|
39
|
+
import z from "@mui/material/Paper";
|
|
40
40
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
41
|
-
import { useTheme as
|
|
41
|
+
import { useTheme as tt } from "@mui/material/styles";
|
|
42
42
|
import q from "@mui/material/Box";
|
|
43
43
|
import K from "@mui/material/Divider";
|
|
44
44
|
import Y from "@mui/material/List";
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
var
|
|
45
|
+
import rt from "@mui/material/Alert";
|
|
46
|
+
import ot from "@mui/material/Snackbar";
|
|
47
|
+
var D = 64, $ = {
|
|
48
|
+
boxShadow: "none",
|
|
49
|
+
"& .MuiAvatar-root": {
|
|
50
|
+
height: 32,
|
|
51
|
+
width: 32
|
|
52
|
+
},
|
|
53
|
+
"& .MuiDivider-inset": { marginLeft: "68px" }
|
|
54
|
+
}, it = 8, Z = {
|
|
48
55
|
fontWeight: 700,
|
|
49
56
|
letterSpacing: "0.27px",
|
|
50
57
|
textTransform: "uppercase"
|
|
51
|
-
},
|
|
52
|
-
const { onEvent:
|
|
53
|
-
r.block ===
|
|
58
|
+
}, at = ({ bottomActions: T = Oe, canFlagTransaction: J = !0, topActions: A = we, transaction: e, shouldShowEmbeddedCard: x = !0, onContactSupport: I }) => {
|
|
59
|
+
const { onEvent: Q } = Te(), { config: ee } = he(), { isCopyLoaded: te } = Se(), { userFeatures: re } = Ce(), { accounts: oe, common: ie, insights_feed: d } = ye(), { detailedCategories: L } = _e(), { alert: O, associatedBeats: w, detailedTransactions: E, cachedStartDate: M, loadEmbeddedInstanceTransactions: ae, setAlert: N } = be(), [ne, B] = s.useState(!1), [k, F] = s.useState(!1), [se, de] = s.useState(!1), le = tt(), me = e?.number && e.number.length > 4, R = e?.number ? me ? e.number : `••••${e.number}` : void 0, G = e?.transaction_type === ve.CREDIT, P = Ie(e) && !!e.institutionName, a = s.useMemo(() => w.find((r) => r.associated_transaction_guid === e.guid), [w, e]), y = x ? Ee(a) : "legacy", S = y === "v2" ? a?.insights_payload : void 0, o = x && y === "legacy" ? $e(ie, a) : null, ce = (r) => {
|
|
60
|
+
r.block === Ne.CONTACT_SUPPORT_ACTION_BLOCK && I?.();
|
|
54
61
|
}, [l, b] = s.useState(o ? o.dataSeries.length - 1 : 0);
|
|
55
|
-
s.useEffect(() =>
|
|
62
|
+
s.useEffect(() => Q(Ae.TRANSACTION_DETAILS_VIEW, { transaction_guid: e.guid }), []), s.useEffect(() => {
|
|
56
63
|
if (!o || o.dataSeries.length === 0) return;
|
|
57
|
-
const { date: r } = o.dataSeries[l], i =
|
|
58
|
-
|
|
64
|
+
const { date: r } = o.dataSeries[l], i = j(r);
|
|
65
|
+
et(i, M) && (F(!0), ae(i).finally(() => {
|
|
59
66
|
F(!1);
|
|
60
67
|
}));
|
|
61
68
|
}, [
|
|
@@ -63,7 +70,7 @@ var v = 64, ot = 8, $ = {
|
|
|
63
70
|
o,
|
|
64
71
|
M
|
|
65
72
|
]);
|
|
66
|
-
const C = T.includes(m.MerchantBudget) && !e?.merchant_guid ? T.filter((r) => r !== m.MerchantBudget) : T,
|
|
73
|
+
const C = T.includes(m.MerchantBudget) && !e?.merchant_guid ? T.filter((r) => r !== m.MerchantBudget) : T, v = H(() => {
|
|
67
74
|
if (o) {
|
|
68
75
|
const r = L.find((f) => f.guid === e.top_level_category_guid), i = a?.payload?.average_amount ?? 0, p = e.amount;
|
|
69
76
|
let g = d.general.increased_text;
|
|
@@ -74,45 +81,45 @@ var v = 64, ot = 8, $ = {
|
|
|
74
81
|
};
|
|
75
82
|
}
|
|
76
83
|
return null;
|
|
77
|
-
}, [o, L]),
|
|
84
|
+
}, [o, L]), ue = H(() => {
|
|
78
85
|
if (!o?.dataSeries?.length) return [];
|
|
79
|
-
const { guid: r, date: i } = o.dataSeries[l], p =
|
|
80
|
-
return
|
|
86
|
+
const { guid: r, date: i } = o.dataSeries[l], p = j(i), g = Qe(i);
|
|
87
|
+
return E.filter((f) => {
|
|
81
88
|
const U = De(f.date);
|
|
82
89
|
return U >= p && U <= g && f.guid === r;
|
|
83
90
|
});
|
|
84
91
|
}, [
|
|
85
92
|
l,
|
|
86
93
|
o,
|
|
87
|
-
|
|
94
|
+
E,
|
|
88
95
|
k
|
|
89
96
|
]);
|
|
90
|
-
if (!
|
|
91
|
-
const u =
|
|
97
|
+
if (!te) return /* @__PURE__ */ t(Le, {});
|
|
98
|
+
const u = xe(re, "MX_TXN_DETAILS_VIEW_ONLY"), pe = le.palette.mode === "dark" ? "grey.800" : "grey.100";
|
|
92
99
|
return /* @__PURE__ */ n(q, {
|
|
93
100
|
className: "mx-txn-transaction-details",
|
|
94
101
|
width: "100%",
|
|
95
102
|
children: [
|
|
96
103
|
e && /* @__PURE__ */ n(c, { children: [
|
|
97
104
|
/* @__PURE__ */ n(c, {
|
|
98
|
-
gap:
|
|
105
|
+
gap: 8,
|
|
99
106
|
p: 24,
|
|
100
107
|
children: [
|
|
101
108
|
/* @__PURE__ */ t(q, {
|
|
102
109
|
sx: {
|
|
103
110
|
bgcolor: "background.paper",
|
|
104
|
-
borderRadius: `${
|
|
105
|
-
height:
|
|
111
|
+
borderRadius: `${it}px`,
|
|
112
|
+
height: D,
|
|
106
113
|
overflow: "hidden",
|
|
107
|
-
width:
|
|
114
|
+
width: D
|
|
108
115
|
},
|
|
109
|
-
children: /* @__PURE__ */ t(
|
|
116
|
+
children: /* @__PURE__ */ t(X, {
|
|
110
117
|
categoryGuid: e.top_level_category_guid || "",
|
|
111
118
|
merchantGuid: e.merchant_guid || "",
|
|
112
|
-
size:
|
|
119
|
+
size: D
|
|
113
120
|
})
|
|
114
121
|
}),
|
|
115
|
-
/* @__PURE__ */ t(
|
|
122
|
+
/* @__PURE__ */ t(qe, {
|
|
116
123
|
displayValue: P ? e.institutionName : void 0,
|
|
117
124
|
transaction: e,
|
|
118
125
|
viewOnly: u || P
|
|
@@ -121,25 +128,25 @@ var v = 64, ot = 8, $ = {
|
|
|
121
128
|
direction: "row",
|
|
122
129
|
justifyContent: "space-between",
|
|
123
130
|
sx: { minHeight: 44 },
|
|
124
|
-
children: [/* @__PURE__ */ n(
|
|
131
|
+
children: [/* @__PURE__ */ n(Je, {
|
|
125
132
|
color: G ? "success.main" : "text.primary",
|
|
126
133
|
variant: "h1",
|
|
127
|
-
children: [G ? "+" : "",
|
|
128
|
-
}), !u &&
|
|
134
|
+
children: [G ? "+" : "", V(e.amount, "0,0.00")]
|
|
135
|
+
}), !u && J && /* @__PURE__ */ t(Ke, { transaction: e })]
|
|
129
136
|
}),
|
|
130
|
-
S && /* @__PURE__ */ t(
|
|
137
|
+
S && /* @__PURE__ */ t(ke, {
|
|
131
138
|
beat: a,
|
|
132
|
-
isCtaDisabled:
|
|
133
|
-
onCtaClick:
|
|
139
|
+
isCtaDisabled: Me(S.primary_cta?.block, ee, I),
|
|
140
|
+
onCtaClick: ce,
|
|
134
141
|
payload: S
|
|
135
142
|
}),
|
|
136
|
-
y === "error" && a && /* @__PURE__ */ t(
|
|
143
|
+
y === "error" && a && /* @__PURE__ */ t(Be, {
|
|
137
144
|
beat: a,
|
|
138
145
|
variant: "plain"
|
|
139
146
|
}),
|
|
140
|
-
o?.instanceSlot && /* @__PURE__ */ t(
|
|
147
|
+
o?.instanceSlot && /* @__PURE__ */ t(Re, {
|
|
141
148
|
callToAction: o.callToAction,
|
|
142
|
-
description:
|
|
149
|
+
description: W(d.general.embedded_description, v.changetype, /* @__PURE__ */ t("strong", { children: v.percentageAmount })),
|
|
143
150
|
instanceSlot: o.instanceSlot,
|
|
144
151
|
onCtaClick: () => {
|
|
145
152
|
B(!0);
|
|
@@ -148,9 +155,10 @@ var v = 64, ot = 8, $ = {
|
|
|
148
155
|
}),
|
|
149
156
|
/* @__PURE__ */ n(c, {
|
|
150
157
|
sx: {
|
|
151
|
-
bgcolor:
|
|
158
|
+
bgcolor: pe,
|
|
152
159
|
borderRadius: "4px",
|
|
153
160
|
gap: 4,
|
|
161
|
+
mt: 16,
|
|
154
162
|
p: 8
|
|
155
163
|
},
|
|
156
164
|
children: [/* @__PURE__ */ t(_, {
|
|
@@ -165,7 +173,7 @@ var v = 64, ot = 8, $ = {
|
|
|
165
173
|
children: [/* @__PURE__ */ t(_, {
|
|
166
174
|
color: "text.secondary",
|
|
167
175
|
sx: {
|
|
168
|
-
|
|
176
|
+
...Z,
|
|
169
177
|
minWidth: 0
|
|
170
178
|
},
|
|
171
179
|
truncate: !0,
|
|
@@ -174,7 +182,7 @@ var v = 64, ot = 8, $ = {
|
|
|
174
182
|
}), R && /* @__PURE__ */ t(_, {
|
|
175
183
|
color: "text.secondary",
|
|
176
184
|
sx: {
|
|
177
|
-
|
|
185
|
+
...Z,
|
|
178
186
|
flexShrink: 0
|
|
179
187
|
},
|
|
180
188
|
variant: "tiny",
|
|
@@ -184,13 +192,13 @@ var v = 64, ot = 8, $ = {
|
|
|
184
192
|
})
|
|
185
193
|
]
|
|
186
194
|
}),
|
|
187
|
-
/* @__PURE__ */ t(
|
|
195
|
+
/* @__PURE__ */ t(z, {
|
|
188
196
|
square: !0,
|
|
189
|
-
sx:
|
|
190
|
-
children: u ? /* @__PURE__ */ t(
|
|
191
|
-
r === h.Category && /* @__PURE__ */ t(
|
|
192
|
-
r === h.Date && /* @__PURE__ */ t(
|
|
193
|
-
r === h.Memo && /* @__PURE__ */ t(
|
|
197
|
+
sx: $,
|
|
198
|
+
children: u ? /* @__PURE__ */ t(Ye, { transaction: e }) : /* @__PURE__ */ t(Y, { children: A.map((r, i) => /* @__PURE__ */ n(s.Fragment, { children: [
|
|
199
|
+
r === h.Category && /* @__PURE__ */ t(Pe, { transaction: e }),
|
|
200
|
+
r === h.Date && /* @__PURE__ */ t(Ue, { transaction: e }),
|
|
201
|
+
r === h.Memo && /* @__PURE__ */ t(Xe, { transaction: e }),
|
|
194
202
|
r === h.Tags && /* @__PURE__ */ t(ze, { transaction: e }),
|
|
195
203
|
/* @__PURE__ */ t(K, {
|
|
196
204
|
component: "li",
|
|
@@ -204,30 +212,30 @@ var v = 64, ot = 8, $ = {
|
|
|
204
212
|
ml: 26,
|
|
205
213
|
mt: 16,
|
|
206
214
|
variant: "body1",
|
|
207
|
-
children:
|
|
208
|
-
}), /* @__PURE__ */ t(
|
|
215
|
+
children: oe.actions
|
|
216
|
+
}), /* @__PURE__ */ t(z, {
|
|
209
217
|
square: !0,
|
|
210
|
-
sx:
|
|
218
|
+
sx: $,
|
|
211
219
|
children: /* @__PURE__ */ n(Y, { children: [C.map((r, i) => /* @__PURE__ */ n(s.Fragment, { children: [
|
|
212
|
-
r === m.MerchantBudget && /* @__PURE__ */ t(
|
|
220
|
+
r === m.MerchantBudget && /* @__PURE__ */ t(Ge, { transaction: e }),
|
|
213
221
|
r === m.SplitTransaction && /* @__PURE__ */ t(je, { transaction: e }),
|
|
214
|
-
r === m.HideTransaction && /* @__PURE__ */ t(
|
|
222
|
+
r === m.HideTransaction && /* @__PURE__ */ t(He, { transaction: e }),
|
|
215
223
|
r === m.MerchantLogo && /* @__PURE__ */ t(Ve, { transaction: e }),
|
|
216
224
|
/* @__PURE__ */ t(K, {
|
|
217
225
|
component: "li",
|
|
218
226
|
variant: i < C.length - 1 ? "inset" : "fullWidth"
|
|
219
227
|
})
|
|
220
|
-
] }, r)), e.is_manual && !e.parent_guid && !e.has_been_split && /* @__PURE__ */ t(
|
|
228
|
+
] }, r)), e.is_manual && !e.parent_guid && !e.has_been_split && /* @__PURE__ */ t(We, { transaction: e })] })
|
|
221
229
|
})] })
|
|
222
230
|
] }),
|
|
223
|
-
a && o && /* @__PURE__ */ t(
|
|
224
|
-
ariaLabel:
|
|
231
|
+
a && o && /* @__PURE__ */ t(Fe, {
|
|
232
|
+
ariaLabel: fe(o?.dataSeries[l]?.date, ge.MONTH),
|
|
225
233
|
barChartProps: {
|
|
226
234
|
amounts: {
|
|
227
235
|
average: a.payload.average_amount,
|
|
228
|
-
formattedAverage:
|
|
236
|
+
formattedAverage: V(a.payload.average_amount, "0,0")
|
|
229
237
|
},
|
|
230
|
-
color:
|
|
238
|
+
color: v.category?.color || "",
|
|
231
239
|
data: o.chartData,
|
|
232
240
|
margin: {
|
|
233
241
|
bottom: 10,
|
|
@@ -252,51 +260,51 @@ var v = 64, ot = 8, $ = {
|
|
|
252
260
|
},
|
|
253
261
|
data: o.chartData,
|
|
254
262
|
defaultSelectedIndex: l,
|
|
255
|
-
icon: /* @__PURE__ */ t(
|
|
263
|
+
icon: /* @__PURE__ */ t(X, {
|
|
256
264
|
alt: e.description ?? "",
|
|
257
265
|
categoryGuid: e.category_guid ?? "",
|
|
258
266
|
merchantGuid: e.merchant_guid ?? "",
|
|
259
267
|
size: 16
|
|
260
268
|
}),
|
|
261
|
-
isOpen:
|
|
269
|
+
isOpen: ne,
|
|
262
270
|
onClose: () => {
|
|
263
271
|
B(!1), b(o.dataSeries.length - 1);
|
|
264
272
|
},
|
|
265
273
|
onTabChange: (r) => {
|
|
266
274
|
b(r);
|
|
267
275
|
},
|
|
268
|
-
tipSection:
|
|
269
|
-
message:
|
|
270
|
-
onDismiss: () =>
|
|
276
|
+
tipSection: se ? void 0 : {
|
|
277
|
+
message: W(d.general.tip_section_message, /* @__PURE__ */ t("strong", { children: d.general.tip_section_title }), /* @__PURE__ */ t("strong", { children: a.primary_transaction?.description })),
|
|
278
|
+
onDismiss: () => de(!0)
|
|
271
279
|
},
|
|
272
280
|
title: d.general.transaction_history_title,
|
|
273
281
|
transactionListProps: {
|
|
274
282
|
showLoader: k,
|
|
275
283
|
showInsights: !0,
|
|
276
|
-
transaction:
|
|
284
|
+
transaction: ue
|
|
277
285
|
}
|
|
278
286
|
}),
|
|
279
|
-
/* @__PURE__ */ t(
|
|
287
|
+
/* @__PURE__ */ t(ot, {
|
|
280
288
|
anchorOrigin: {
|
|
281
289
|
vertical: "bottom",
|
|
282
290
|
horizontal: "right"
|
|
283
291
|
},
|
|
284
292
|
autoHideDuration: 3500,
|
|
285
293
|
onClose: () => N(""),
|
|
286
|
-
open: !!
|
|
287
|
-
children: /* @__PURE__ */ t(
|
|
294
|
+
open: !!O,
|
|
295
|
+
children: /* @__PURE__ */ t(rt, {
|
|
288
296
|
closeText: "",
|
|
289
297
|
onClose: () => N(""),
|
|
290
298
|
severity: "success",
|
|
291
299
|
variant: "filled",
|
|
292
|
-
children:
|
|
300
|
+
children: O
|
|
293
301
|
})
|
|
294
302
|
})
|
|
295
303
|
]
|
|
296
304
|
});
|
|
297
|
-
},
|
|
305
|
+
}, Jt = Ze(at);
|
|
298
306
|
export {
|
|
299
|
-
|
|
307
|
+
Jt as default
|
|
300
308
|
};
|
|
301
309
|
|
|
302
310
|
//# sourceMappingURL=TransactionDetails.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDetails.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionDetails.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Paper from '@mui/material/Paper'\nimport Snackbar from '@mui/material/Snackbar'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useAppConfig,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { type PrimaryCTA, Transaction, TransactionType } from '../../../core'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks`, whose chart blocks\n// reach back into transactions code — the circular-import/TDZ trap `actionBlocksKey.ts` documents.\nimport { isContactSupportCtaDisabled } from '../../../insights-v2/actionBlocks/ContactSupportActionBlock'\nimport CompactInsightCard from '../../../insights-v2/components/CompactInsightCard'\nimport InsightErrorCard from '../../../insights-v2/components/InsightErrorCard'\nimport { actionBlocksKey } from '../../../insights-v2/mappings/actionBlocksKey'\nimport { resolveInsightRender } from '../../../insights-v2/resolveInsightRender'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { isTransferTransaction } from '../../../core/utils/TransactionUtils'\nimport { isFeatureEnabled } from '../../../core/utils/UserUtils'\nimport { ChartTransactionWithDrillDown, EmbeddedCard } from '../../../insights'\n\nimport {\n BottomActions,\n DEFAULT_BOTTOM_ACTIONS,\n DEFAULT_TOP_ACTIONS,\n TopActions,\n} from '../../constants/Actions'\n\nimport {\n AddMerchantBudgetAction,\n CategoryAction,\n DateAction,\n DeleteAction,\n DeleteLogoAction,\n ExcludeAction,\n MemoAction,\n SplitAction,\n TagsAction,\n} from './transactiondetails/actions'\nimport Description from './transactiondetails/Description'\nimport FlagTransaction from './transactiondetails/FlagTransaction'\nimport TransactionDetailsView from './transactiondetails/TransactionDetailsView'\nimport { getEmbeddedInstanceSlotByBeatTemplates } from './getEmbeddedInstanceSlotByBeatTemplates'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nexport interface TransactionDetailsProps {\n bottomActions?: BottomActions[]\n canFlagTransaction?: boolean\n topActions?: TopActions[]\n transaction: Transaction\n shouldShowEmbeddedCard?: boolean\n /**\n * Opens the host's contact-support flow when the embedded insight card's CTA is\n * `contact_support_block`. This module cannot import the help module (hosts that don't ship the\n * Help widget stub the import — pulse's webpack `IgnorePlugin`), so the host supplies it. Without\n * it, or with the client's `enable_support_requests` off, the CTA renders disabled.\n */\n onContactSupport?: () => void\n}\n\nconst LOGO_SIZE = 64\n// Fixed per Figma; the theme's shape.borderRadius is client-configurable.\nconst LOGO_RADIUS = 8\n\n// Account feed line per Figma: 9/12 bold 700, uppercase, 0.27px tracking.\nconst FEED_LINE_SX = {\n fontWeight: 700,\n letterSpacing: '0.27px',\n textTransform: 'uppercase',\n} as const\n\nconst TransactionDetails: React.FC<TransactionDetailsProps> = ({\n bottomActions = DEFAULT_BOTTOM_ACTIONS,\n canFlagTransaction = true,\n topActions = DEFAULT_TOP_ACTIONS,\n transaction,\n shouldShowEmbeddedCard = true,\n onContactSupport,\n}) => {\n const { onEvent } = useEvent()\n const { config } = useAppConfig()\n const { isCopyLoaded } = useGlobalUiStore()\n const { userFeatures } = useUserStore()\n const { accounts: copy, common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { detailedCategories } = useCategoryStore()\n const {\n alert,\n associatedBeats,\n detailedTransactions,\n cachedStartDate,\n loadEmbeddedInstanceTransactions,\n setAlert,\n } = useTransactionStore()\n\n const [showTranscationDrilldownDrawer, setShowTransactionDrillDownDrawer] = React.useState(false)\n\n const [isLoading, setIsLoading] = React.useState(false)\n const [closeTipSection, setCloseTipSection] = React.useState(false)\n const theme = useTheme()\n\n const showFullNumber = transaction?.number && transaction.number.length > 4\n const maskedNumber = transaction?.number\n ? showFullNumber\n ? transaction.number\n : `\\u2022\\u2022\\u2022\\u2022${transaction.number}`\n : undefined\n\n const isCredit = transaction?.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n // Insights 2.0 (insights_v2.2.md §8.3, §10.1): branch on the beat the widget already matched from\n // its associated-beats fetch (which carries `widget_type=embedded`). `v2` renders the compact card\n // from the held envelope and `error` the error card, both in the slot above the account block;\n // only `legacy` runs the per-template switch below. There is deliberately no fetch on open.\n const insightRender = shouldShowEmbeddedCard ? resolveInsightRender(beat) : 'legacy'\n const v2Payload = insightRender === 'v2' ? beat?.insights_payload : undefined\n\n const embeddedData =\n shouldShowEmbeddedCard && insightRender === 'legacy'\n ? getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n : null\n\n // `contact_support_block` hands off to the host's flow (see `onContactSupport`). The card itself\n // never opens anything; `isContactSupportCtaDisabled` keeps the CTA inert when it cannot be honoured.\n const handleV2CtaClick = (cta: PrimaryCTA) => {\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n onContactSupport?.()\n }\n }\n\n const [selectedTabIndex, setSelectedTabIndex] = React.useState(\n embeddedData ? embeddedData.dataSeries.length - 1 : 0,\n )\n\n React.useEffect(\n () =>\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_VIEW, { transaction_guid: transaction.guid }),\n [],\n )\n\n React.useEffect(() => {\n if (!embeddedData || embeddedData.dataSeries.length === 0) return\n\n const { date: selectedSeriesItemDate } = embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n\n if (isBefore(start, cachedStartDate)) {\n setIsLoading(true)\n loadEmbeddedInstanceTransactions(start).finally(() => {\n setIsLoading(false)\n })\n }\n }, [selectedTabIndex, embeddedData, cachedStartDate])\n\n //if merchant_guid is null then no need to show the MerchantBudget action.\n const updatedBottomActions =\n bottomActions.includes(BottomActions.MerchantBudget) && !transaction?.merchant_guid\n ? bottomActions.filter((action) => action !== BottomActions.MerchantBudget)\n : bottomActions\n\n const embeddedCardDataCategory = useMemo(() => {\n if (embeddedData) {\n const category = detailedCategories.find(\n (cat) => cat.guid === transaction.top_level_category_guid,\n )\n const mean = beat?.payload?.average_amount ?? 0\n const currentAmount = transaction.amount\n\n let changetype = insightsCopy.general.increased_text\n if (currentAmount - mean < 0) {\n changetype = insightsCopy.general.decreased_text\n }\n const percentageAmount =\n mean === 0 ? 0 : Math.round((Math.abs(currentAmount - mean) / mean) * 100)\n\n return { category, percentageAmount, changetype }\n }\n return null\n }, [embeddedData, detailedCategories])\n\n const filteredTransactions = useMemo(() => {\n if (!embeddedData?.dataSeries?.length) {\n return []\n }\n\n const { guid: selectedSeriesItemGuid, date: selectedSeriesItemDate } =\n embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n const end = endOfMonth(selectedSeriesItemDate)\n\n return detailedTransactions.filter((t) => {\n const transactionDate = fromUnixUTC(t.date)\n return transactionDate >= start && transactionDate <= end && t.guid === selectedSeriesItemGuid\n })\n }, [selectedTabIndex, embeddedData, detailedTransactions, isLoading])\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n const shouldShowViewOnlyMode = isFeatureEnabled(userFeatures, 'MX_TXN_DETAILS_VIEW_ONLY')\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <Box className=\"mx-txn-transaction-details\" width=\"100%\">\n {transaction && (\n <Stack>\n <Stack gap={12} p={24}>\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: `${LOGO_RADIUS}px`,\n height: LOGO_SIZE,\n overflow: 'hidden',\n width: LOGO_SIZE,\n }}\n >\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={LOGO_SIZE}\n />\n </Box>\n\n <Description\n displayValue={showInstitution ? transaction.institutionName : undefined}\n transaction={transaction}\n viewOnly={shouldShowViewOnlyMode || showInstitution}\n />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ minHeight: 44 }}>\n <P color={isCredit ? 'success.main' : 'text.primary'} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </P>\n {!shouldShowViewOnlyMode && canFlagTransaction && (\n <FlagTransaction transaction={transaction} />\n )}\n </Stack>\n\n {v2Payload && (\n <CompactInsightCard\n beat={beat}\n isCtaDisabled={isContactSupportCtaDisabled(\n v2Payload.primary_cta?.block,\n config,\n onContactSupport,\n )}\n onCtaClick={handleV2CtaClick}\n payload={v2Payload}\n />\n )}\n {insightRender === 'error' && beat && <InsightErrorCard beat={beat} variant=\"plain\" />}\n {embeddedData?.instanceSlot && (\n <EmbeddedCard\n callToAction={embeddedData.callToAction}\n description={\n buildDynamicCopy(\n insightsCopy.general.embedded_description,\n embeddedCardDataCategory!.changetype,\n <strong>{embeddedCardDataCategory!.percentageAmount}</strong>,\n ) as string\n }\n instanceSlot={embeddedData.instanceSlot}\n onCtaClick={() => {\n setShowTransactionDrillDownDrawer(true)\n }}\n title={beat!.html_micro_title!}\n />\n )}\n <Stack sx={{ bgcolor: bgColor, borderRadius: '4px', gap: 4, p: 8 }}>\n <Text bold={true}>{transaction.account}</Text>\n <Stack\n alignItems=\"baseline\"\n data-testid=\"account-feed-line\"\n direction=\"row\"\n gap={4}\n sx={{ overflow: 'hidden' }}\n >\n <Text\n color=\"text.secondary\"\n sx={{ ...FEED_LINE_SX, minWidth: 0 }}\n truncate={true}\n variant=\"tiny\"\n >\n {transaction.feed_description}\n </Text>\n {maskedNumber && (\n <Text\n color=\"text.secondary\"\n sx={{ ...FEED_LINE_SX, flexShrink: 0 }}\n variant=\"tiny\"\n >\n {maskedNumber}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n {shouldShowViewOnlyMode ? (\n <TransactionDetailsView transaction={transaction} />\n ) : (\n <List>\n {topActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === TopActions.Category && <CategoryAction transaction={transaction} />}\n {action === TopActions.Date && <DateAction transaction={transaction} />}\n {action === TopActions.Memo && <MemoAction transaction={transaction} />}\n {action === TopActions.Tags && <TagsAction transaction={transaction} />}\n <Divider\n component=\"li\"\n variant={index < topActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n </List>\n )}\n </Paper>\n\n {!shouldShowViewOnlyMode && updatedBottomActions.length > 0 && (\n <React.Fragment>\n <Text bold={true} mb={8} ml={26} mt={16} variant=\"body1\">\n {copy.actions}\n </Text>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n <List>\n {updatedBottomActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === BottomActions.MerchantBudget && (\n <AddMerchantBudgetAction transaction={transaction} />\n )}\n {action === BottomActions.SplitTransaction && (\n <SplitAction transaction={transaction} />\n )}\n {action === BottomActions.HideTransaction && (\n <ExcludeAction transaction={transaction} />\n )}\n {action === BottomActions.MerchantLogo && (\n <DeleteLogoAction transaction={transaction} />\n )}\n <Divider\n component=\"li\"\n variant={index < updatedBottomActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n\n {/*\n Show DeleteAction only if:\n - The transaction is manual\n - The transaction is NOT a parent transaction (no parent_guid)\n - The transaction has NOT been split (has_been_split is false)\n \n This ensures delete is hidden for parent or split transactions.\n */}\n {transaction.is_manual &&\n !transaction.parent_guid &&\n !transaction.has_been_split && <DeleteAction transaction={transaction} />}\n </List>\n </Paper>\n </React.Fragment>\n )}\n </Stack>\n )}\n {beat && embeddedData && (\n <ChartTransactionWithDrillDown\n ariaLabel={formatDate(\n embeddedData?.dataSeries[selectedTabIndex]?.date,\n DATE_FORMATS_INTL.MONTH,\n )}\n barChartProps={{\n amounts: {\n average: beat.payload.average_amount,\n formattedAverage: formatCurrency(beat.payload.average_amount, '0,0'),\n },\n color: embeddedCardDataCategory!.category?.color || '',\n data: embeddedData.chartData,\n margin: { bottom: 10, left: 24, right: 24, top: 20 },\n monthlyAmountLabel: insightsCopy.general.monthly_amount,\n onBarClick: (index) => {\n setSelectedTabIndex(index)\n },\n trendAmountLabel: insightsCopy.general.trend,\n legendPosition: 'top',\n }}\n beat={{\n heading: beat.html_title,\n subHeading: {\n category_guid: transaction.category_guid ?? '',\n merchant_guid: transaction.merchant_guid ?? '',\n description: transaction.description ?? '',\n },\n }}\n data={embeddedData.chartData}\n defaultSelectedIndex={selectedTabIndex}\n icon={\n <MerchantLogo\n alt={transaction.description ?? ''}\n categoryGuid={transaction.category_guid ?? ''}\n merchantGuid={transaction.merchant_guid ?? ''}\n size={16}\n />\n }\n isOpen={showTranscationDrilldownDrawer}\n onClose={() => {\n setShowTransactionDrillDownDrawer(false)\n setSelectedTabIndex(embeddedData!.dataSeries.length - 1)\n }}\n onTabChange={(index: number) => {\n setSelectedTabIndex(index)\n }}\n tipSection={\n !closeTipSection\n ? {\n message: buildDynamicCopy(\n insightsCopy.general.tip_section_message,\n <strong>{insightsCopy.general.tip_section_title}</strong>,\n <strong>{beat.primary_transaction?.description}</strong>,\n ) as string,\n onDismiss: () => setCloseTipSection(true),\n }\n : undefined\n }\n title={insightsCopy.general.transaction_history_title}\n transactionListProps={{\n showLoader: isLoading,\n showInsights: true,\n transaction: filteredTransactions,\n }}\n />\n )}\n <Snackbar\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n autoHideDuration={3500}\n onClose={() => setAlert('')}\n open={Boolean(alert)}\n >\n <Alert closeText=\"\" onClose={() => setAlert('')} severity=\"success\" variant=\"filled\">\n {alert}\n </Alert>\n </Snackbar>\n </Box>\n )\n}\n\nexport default observer(TransactionDetails)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,IAAM,IAAY,IAEZ,KAAc,GAGd,IAAe;AAAA,EACnB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AACjB,GAEM,KAAA,CAAyD,EAC7D,eAAA,IAAgB,IAChB,oBAAA,IAAqB,IACrB,YAAA,IAAa,IACb,aAAA,GACA,wBAAA,IAAyB,IACzB,kBAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,QAAA,EAAA,IAAW,GAAa,GAC1B,EAAE,cAAA,GAAA,IAAiB,GAAiB,GACpC,EAAE,cAAA,GAAA,IAAiB,GAAa,GAChC,EAAE,UAAU,IAAM,QAAQ,IAAY,eAAe,EAAA,IAAiB,GAAmB,GAEzF,EAAE,oBAAA,EAAA,IAAuB,GAAiB,GAC1C,EACJ,OAAA,GACA,iBAAA,GACA,sBAAA,GACA,iBAAA,GACA,kCAAA,IACA,UAAA,EAAA,IACE,GAAoB,GAElB,CAAC,IAAgC,CAAA,IAAqC,EAAM,SAAS,EAAK,GAE1F,CAAC,GAAW,CAAA,IAAgB,EAA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EAAC,GAAD;AAAA,UACE,KAAK,EAAY,eAAe;AAAA,UAChC,cAAc,EAAY,iBAAiB;AAAA,UAC3C,cAAc,EAAY,iBAAiB;AAAA,UAC3C,MAAM;AAAA,QACP,CAAA;AAAA,QAEH,QAAQ;AAAA,QACR,SAAA,MAAe;AACb,UAAA,EAAkC,EAAK,GACvC,EAAoB,EAAc,WAAW,SAAS,CAAC;AAAA,QACzD;AAAA,QACA,aAAA,CAAc,MAAkB;AAC9B,UAAA,EAAoB,CAAK;AAAA,QAC3B;AAAA,QACA,YACG,KASG,SARA;AAAA,UACE,SAAS,EACP,EAAa,QAAQ,qBACrB,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAa,QAAQ,kBAA0B,CAAA,GACxD,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAK,qBAAqB,YAAoB,CAAA,CACzD;AAAA,UACA,WAAA,MAAiB,GAAmB,EAAI;AAAA,QAC1C;AAAA,QAGN,OAAO,EAAa,QAAQ;AAAA,QAC5B,sBAAsB;AAAA,UACpB,YAAY;AAAA,UACZ,cAAc;AAAA,UACd,aAAa;AAAA,QACf;AAAA,MACD,CAAA;AAAA,MAEH,gBAAA,EAAC,IAAD;AAAA,QACE,cAAc;AAAA,UAAE,UAAU;AAAA,UAAU,YAAY;AAAA,QAAQ;AAAA,QACxD,kBAAkB;AAAA,QAClB,SAAA,MAAe,EAAS,EAAE;AAAA,QAC1B,MAAM,EAAQ;AAAA,QAEd,UAAA,gBAAA,EAAC,IAAD;AAAA,UAAO,WAAU;AAAA,UAAG,SAAA,MAAe,EAAS,EAAE;AAAA,UAAG,UAAS;AAAA,UAAU,SAAQ;AAAA,UACzE,UAAA;AAAA,QACI,CAAA;AAAA,MACC,CAAA;AAAA,IACP;AAAA;AAET,GAEA,KAAe,GAAS,EAAkB"}
|
|
1
|
+
{"version":3,"file":"TransactionDetails.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionDetails.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Paper from '@mui/material/Paper'\nimport Snackbar from '@mui/material/Snackbar'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useAppConfig,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { type PrimaryCTA, Transaction, TransactionType } from '../../../core'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks`, whose chart blocks\n// reach back into transactions code — the circular-import/TDZ trap `actionBlocksKey.ts` documents.\nimport { isContactSupportCtaDisabled } from '../../../insights-v2/actionBlocks/ContactSupportActionBlock'\nimport CompactInsightCard from '../../../insights-v2/components/CompactInsightCard'\nimport InsightErrorCard from '../../../insights-v2/components/InsightErrorCard'\nimport { actionBlocksKey } from '../../../insights-v2/mappings/actionBlocksKey'\nimport { resolveInsightRender } from '../../../insights-v2/resolveInsightRender'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { isTransferTransaction } from '../../../core/utils/TransactionUtils'\nimport { isFeatureEnabled } from '../../../core/utils/UserUtils'\nimport { ChartTransactionWithDrillDown, EmbeddedCard } from '../../../insights'\n\nimport {\n BottomActions,\n DEFAULT_BOTTOM_ACTIONS,\n DEFAULT_TOP_ACTIONS,\n TopActions,\n} from '../../constants/Actions'\n\nimport {\n AddMerchantBudgetAction,\n CategoryAction,\n DateAction,\n DeleteAction,\n DeleteLogoAction,\n ExcludeAction,\n MemoAction,\n SplitAction,\n TagsAction,\n} from './transactiondetails/actions'\nimport Description from './transactiondetails/Description'\nimport FlagTransaction from './transactiondetails/FlagTransaction'\nimport TransactionDetailsView from './transactiondetails/TransactionDetailsView'\nimport { getEmbeddedInstanceSlotByBeatTemplates } from './getEmbeddedInstanceSlotByBeatTemplates'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nexport interface TransactionDetailsProps {\n bottomActions?: BottomActions[]\n canFlagTransaction?: boolean\n topActions?: TopActions[]\n transaction: Transaction\n shouldShowEmbeddedCard?: boolean\n /**\n * Opens the host's contact-support flow when the embedded insight card's CTA is\n * `contact_support_block`. This module cannot import the help module (hosts that don't ship the\n * Help widget stub the import — pulse's webpack `IgnorePlugin`), so the host supplies it. Without\n * it, or with the client's `enable_support_requests` off, the CTA renders disabled.\n */\n onContactSupport?: () => void\n}\n\nconst LOGO_SIZE = 64\n\n// Action rows per Figma: a 32px icon tile, so text starts at x68 (24 padding + 32 + 12 margin) and\n// the inset divider lines up with it. MUI's inset divider defaults to 72.\nconst ROWS_SX = {\n boxShadow: 'none',\n '& .MuiAvatar-root': { height: 32, width: 32 },\n '& .MuiDivider-inset': { marginLeft: '68px' },\n} as const\n// Fixed per Figma; the theme's shape.borderRadius is client-configurable.\nconst LOGO_RADIUS = 8\n\n// Account feed line per Figma: 9/12 bold 700, uppercase, 0.27px tracking.\nconst FEED_LINE_SX = {\n fontWeight: 700,\n letterSpacing: '0.27px',\n textTransform: 'uppercase',\n} as const\n\nconst TransactionDetails: React.FC<TransactionDetailsProps> = ({\n bottomActions = DEFAULT_BOTTOM_ACTIONS,\n canFlagTransaction = true,\n topActions = DEFAULT_TOP_ACTIONS,\n transaction,\n shouldShowEmbeddedCard = true,\n onContactSupport,\n}) => {\n const { onEvent } = useEvent()\n const { config } = useAppConfig()\n const { isCopyLoaded } = useGlobalUiStore()\n const { userFeatures } = useUserStore()\n const { accounts: copy, common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { detailedCategories } = useCategoryStore()\n const {\n alert,\n associatedBeats,\n detailedTransactions,\n cachedStartDate,\n loadEmbeddedInstanceTransactions,\n setAlert,\n } = useTransactionStore()\n\n const [showTranscationDrilldownDrawer, setShowTransactionDrillDownDrawer] = React.useState(false)\n\n const [isLoading, setIsLoading] = React.useState(false)\n const [closeTipSection, setCloseTipSection] = React.useState(false)\n const theme = useTheme()\n\n const showFullNumber = transaction?.number && transaction.number.length > 4\n const maskedNumber = transaction?.number\n ? showFullNumber\n ? transaction.number\n : `\\u2022\\u2022\\u2022\\u2022${transaction.number}`\n : undefined\n\n const isCredit = transaction?.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n // Insights 2.0 (insights_v2.2.md §8.3, §10.1): branch on the beat the widget already matched from\n // its associated-beats fetch (which carries `widget_type=embedded`). `v2` renders the compact card\n // from the held envelope and `error` the error card, both in the slot above the account block;\n // only `legacy` runs the per-template switch below. There is deliberately no fetch on open.\n const insightRender = shouldShowEmbeddedCard ? resolveInsightRender(beat) : 'legacy'\n const v2Payload = insightRender === 'v2' ? beat?.insights_payload : undefined\n\n const embeddedData =\n shouldShowEmbeddedCard && insightRender === 'legacy'\n ? getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n : null\n\n // `contact_support_block` hands off to the host's flow (see `onContactSupport`). The card itself\n // never opens anything; `isContactSupportCtaDisabled` keeps the CTA inert when it cannot be honoured.\n const handleV2CtaClick = (cta: PrimaryCTA) => {\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n onContactSupport?.()\n }\n }\n\n const [selectedTabIndex, setSelectedTabIndex] = React.useState(\n embeddedData ? embeddedData.dataSeries.length - 1 : 0,\n )\n\n React.useEffect(\n () =>\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_VIEW, { transaction_guid: transaction.guid }),\n [],\n )\n\n React.useEffect(() => {\n if (!embeddedData || embeddedData.dataSeries.length === 0) return\n\n const { date: selectedSeriesItemDate } = embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n\n if (isBefore(start, cachedStartDate)) {\n setIsLoading(true)\n loadEmbeddedInstanceTransactions(start).finally(() => {\n setIsLoading(false)\n })\n }\n }, [selectedTabIndex, embeddedData, cachedStartDate])\n\n //if merchant_guid is null then no need to show the MerchantBudget action.\n const updatedBottomActions =\n bottomActions.includes(BottomActions.MerchantBudget) && !transaction?.merchant_guid\n ? bottomActions.filter((action) => action !== BottomActions.MerchantBudget)\n : bottomActions\n\n const embeddedCardDataCategory = useMemo(() => {\n if (embeddedData) {\n const category = detailedCategories.find(\n (cat) => cat.guid === transaction.top_level_category_guid,\n )\n const mean = beat?.payload?.average_amount ?? 0\n const currentAmount = transaction.amount\n\n let changetype = insightsCopy.general.increased_text\n if (currentAmount - mean < 0) {\n changetype = insightsCopy.general.decreased_text\n }\n const percentageAmount =\n mean === 0 ? 0 : Math.round((Math.abs(currentAmount - mean) / mean) * 100)\n\n return { category, percentageAmount, changetype }\n }\n return null\n }, [embeddedData, detailedCategories])\n\n const filteredTransactions = useMemo(() => {\n if (!embeddedData?.dataSeries?.length) {\n return []\n }\n\n const { guid: selectedSeriesItemGuid, date: selectedSeriesItemDate } =\n embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n const end = endOfMonth(selectedSeriesItemDate)\n\n return detailedTransactions.filter((t) => {\n const transactionDate = fromUnixUTC(t.date)\n return transactionDate >= start && transactionDate <= end && t.guid === selectedSeriesItemGuid\n })\n }, [selectedTabIndex, embeddedData, detailedTransactions, isLoading])\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n const shouldShowViewOnlyMode = isFeatureEnabled(userFeatures, 'MX_TXN_DETAILS_VIEW_ONLY')\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <Box className=\"mx-txn-transaction-details\" width=\"100%\">\n {transaction && (\n <Stack>\n <Stack gap={8} p={24}>\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: `${LOGO_RADIUS}px`,\n height: LOGO_SIZE,\n overflow: 'hidden',\n width: LOGO_SIZE,\n }}\n >\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={LOGO_SIZE}\n />\n </Box>\n\n <Description\n displayValue={showInstitution ? transaction.institutionName : undefined}\n transaction={transaction}\n viewOnly={shouldShowViewOnlyMode || showInstitution}\n />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ minHeight: 44 }}>\n <P color={isCredit ? 'success.main' : 'text.primary'} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </P>\n {!shouldShowViewOnlyMode && canFlagTransaction && (\n <FlagTransaction transaction={transaction} />\n )}\n </Stack>\n\n {v2Payload && (\n <CompactInsightCard\n beat={beat}\n isCtaDisabled={isContactSupportCtaDisabled(\n v2Payload.primary_cta?.block,\n config,\n onContactSupport,\n )}\n onCtaClick={handleV2CtaClick}\n payload={v2Payload}\n />\n )}\n {insightRender === 'error' && beat && <InsightErrorCard beat={beat} variant=\"plain\" />}\n {embeddedData?.instanceSlot && (\n <EmbeddedCard\n callToAction={embeddedData.callToAction}\n description={\n buildDynamicCopy(\n insightsCopy.general.embedded_description,\n embeddedCardDataCategory!.changetype,\n <strong>{embeddedCardDataCategory!.percentageAmount}</strong>,\n ) as string\n }\n instanceSlot={embeddedData.instanceSlot}\n onCtaClick={() => {\n setShowTransactionDrillDownDrawer(true)\n }}\n title={beat!.html_micro_title!}\n />\n )}\n {/* 24px below the amount: mt 16 plus the parent's 8px gap. */}\n <Stack sx={{ bgcolor: bgColor, borderRadius: '4px', gap: 4, mt: 16, p: 8 }}>\n <Text bold={true}>{transaction.account}</Text>\n <Stack\n alignItems=\"baseline\"\n data-testid=\"account-feed-line\"\n direction=\"row\"\n gap={4}\n sx={{ overflow: 'hidden' }}\n >\n <Text\n color=\"text.secondary\"\n sx={{ ...FEED_LINE_SX, minWidth: 0 }}\n truncate={true}\n variant=\"tiny\"\n >\n {transaction.feed_description}\n </Text>\n {maskedNumber && (\n <Text\n color=\"text.secondary\"\n sx={{ ...FEED_LINE_SX, flexShrink: 0 }}\n variant=\"tiny\"\n >\n {maskedNumber}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n\n <Paper square={true} sx={ROWS_SX}>\n {shouldShowViewOnlyMode ? (\n <TransactionDetailsView transaction={transaction} />\n ) : (\n <List>\n {topActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === TopActions.Category && <CategoryAction transaction={transaction} />}\n {action === TopActions.Date && <DateAction transaction={transaction} />}\n {action === TopActions.Memo && <MemoAction transaction={transaction} />}\n {action === TopActions.Tags && <TagsAction transaction={transaction} />}\n <Divider\n component=\"li\"\n variant={index < topActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n </List>\n )}\n </Paper>\n\n {!shouldShowViewOnlyMode && updatedBottomActions.length > 0 && (\n <React.Fragment>\n <Text bold={true} mb={8} ml={26} mt={16} variant=\"body1\">\n {copy.actions}\n </Text>\n\n <Paper square={true} sx={ROWS_SX}>\n <List>\n {updatedBottomActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === BottomActions.MerchantBudget && (\n <AddMerchantBudgetAction transaction={transaction} />\n )}\n {action === BottomActions.SplitTransaction && (\n <SplitAction transaction={transaction} />\n )}\n {action === BottomActions.HideTransaction && (\n <ExcludeAction transaction={transaction} />\n )}\n {action === BottomActions.MerchantLogo && (\n <DeleteLogoAction transaction={transaction} />\n )}\n <Divider\n component=\"li\"\n variant={index < updatedBottomActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n\n {/*\n Show DeleteAction only if:\n - The transaction is manual\n - The transaction is NOT a parent transaction (no parent_guid)\n - The transaction has NOT been split (has_been_split is false)\n \n This ensures delete is hidden for parent or split transactions.\n */}\n {transaction.is_manual &&\n !transaction.parent_guid &&\n !transaction.has_been_split && <DeleteAction transaction={transaction} />}\n </List>\n </Paper>\n </React.Fragment>\n )}\n </Stack>\n )}\n {beat && embeddedData && (\n <ChartTransactionWithDrillDown\n ariaLabel={formatDate(\n embeddedData?.dataSeries[selectedTabIndex]?.date,\n DATE_FORMATS_INTL.MONTH,\n )}\n barChartProps={{\n amounts: {\n average: beat.payload.average_amount,\n formattedAverage: formatCurrency(beat.payload.average_amount, '0,0'),\n },\n color: embeddedCardDataCategory!.category?.color || '',\n data: embeddedData.chartData,\n margin: { bottom: 10, left: 24, right: 24, top: 20 },\n monthlyAmountLabel: insightsCopy.general.monthly_amount,\n onBarClick: (index) => {\n setSelectedTabIndex(index)\n },\n trendAmountLabel: insightsCopy.general.trend,\n legendPosition: 'top',\n }}\n beat={{\n heading: beat.html_title,\n subHeading: {\n category_guid: transaction.category_guid ?? '',\n merchant_guid: transaction.merchant_guid ?? '',\n description: transaction.description ?? '',\n },\n }}\n data={embeddedData.chartData}\n defaultSelectedIndex={selectedTabIndex}\n icon={\n <MerchantLogo\n alt={transaction.description ?? ''}\n categoryGuid={transaction.category_guid ?? ''}\n merchantGuid={transaction.merchant_guid ?? ''}\n size={16}\n />\n }\n isOpen={showTranscationDrilldownDrawer}\n onClose={() => {\n setShowTransactionDrillDownDrawer(false)\n setSelectedTabIndex(embeddedData!.dataSeries.length - 1)\n }}\n onTabChange={(index: number) => {\n setSelectedTabIndex(index)\n }}\n tipSection={\n !closeTipSection\n ? {\n message: buildDynamicCopy(\n insightsCopy.general.tip_section_message,\n <strong>{insightsCopy.general.tip_section_title}</strong>,\n <strong>{beat.primary_transaction?.description}</strong>,\n ) as string,\n onDismiss: () => setCloseTipSection(true),\n }\n : undefined\n }\n title={insightsCopy.general.transaction_history_title}\n transactionListProps={{\n showLoader: isLoading,\n showInsights: true,\n transaction: filteredTransactions,\n }}\n />\n )}\n <Snackbar\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n autoHideDuration={3500}\n onClose={() => setAlert('')}\n open={Boolean(alert)}\n >\n <Alert closeText=\"\" onClose={() => setAlert('')} severity=\"success\" variant=\"filled\">\n {alert}\n </Alert>\n </Snackbar>\n </Box>\n )\n}\n\nexport default observer(TransactionDetails)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,IAAM,IAAY,IAIZ,IAAU;AAAA,EACd,WAAW;AAAA,EACX,qBAAqB;AAAA,IAAE,QAAQ;AAAA,IAAI,OAAO;AAAA,EAAG;AAAA,EAC7C,uBAAuB,EAAE,YAAY,OAAO;AAC9C,GAEM,KAAc,GAGd,IAAe;AAAA,EACnB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AACjB,GAEM,KAAA,CAAyD,EAC7D,eAAA,IAAgB,IAChB,oBAAA,IAAqB,IACrB,YAAA,IAAa,IACb,aAAA,GACA,wBAAA,IAAyB,IACzB,kBAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,QAAA,GAAA,IAAW,GAAa,GAC1B,EAAE,cAAA,GAAA,IAAiB,GAAiB,GACpC,EAAE,cAAA,GAAA,IAAiB,GAAa,GAChC,EAAE,UAAU,IAAM,QAAQ,IAAY,eAAe,EAAA,IAAiB,GAAmB,GAEzF,EAAE,oBAAA,EAAA,IAAuB,GAAiB,GAC1C,EACJ,OAAA,GACA,iBAAA,GACA,sBAAA,GACA,iBAAA,GACA,kCAAA,IACA,UAAA,EAAA,IACE,GAAoB,GAElB,CAAC,IAAgC,CAAA,IAAqC,EAAM,SAAS,EAAK,GAE1F,CAAC,GAAW,CAAA,IAAgB,EAAM,SAAS,EAAK,GAChD,CAAC,IAAiB,EAAA,IAAsB,EAAM,SA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AAA,UAC3C,cAAc,EAAY,iBAAiB;AAAA,UAC3C,MAAM;AAAA,QACP,CAAA;AAAA,QAEH,QAAQ;AAAA,QACR,SAAA,MAAe;AACb,UAAA,EAAkC,EAAK,GACvC,EAAoB,EAAc,WAAW,SAAS,CAAC;AAAA,QACzD;AAAA,QACA,aAAA,CAAc,MAAkB;AAC9B,UAAA,EAAoB,CAAK;AAAA,QAC3B;AAAA,QACA,YACG,KASG,SARA;AAAA,UACE,SAAS,EACP,EAAa,QAAQ,qBACrB,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAa,QAAQ,kBAA0B,CAAA,GACxD,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAK,qBAAqB,YAAoB,CAAA,CACzD;AAAA,UACA,WAAA,MAAiB,GAAmB,EAAI;AAAA,QAC1C;AAAA,QAGN,OAAO,EAAa,QAAQ;AAAA,QAC5B,sBAAsB;AAAA,UACpB,YAAY;AAAA,UACZ,cAAc;AAAA,UACd,aAAa;AAAA,QACf;AAAA,MACD,CAAA;AAAA,MAEH,gBAAA,EAAC,IAAD;AAAA,QACE,cAAc;AAAA,UAAE,UAAU;AAAA,UAAU,YAAY;AAAA,QAAQ;AAAA,QACxD,kBAAkB;AAAA,QAClB,SAAA,MAAe,EAAS,EAAE;AAAA,QAC1B,MAAM,EAAQ;AAAA,QAEd,UAAA,gBAAA,EAAC,IAAD;AAAA,UAAO,WAAU;AAAA,UAAG,SAAA,MAAe,EAAS,EAAE;AAAA,UAAG,UAAS;AAAA,UAAU,SAAQ;AAAA,UACzE,UAAA;AAAA,QACI,CAAA;AAAA,MACC,CAAA;AAAA,IACP;AAAA;AAET,GAEA,KAAe,GAAS,EAAkB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useEvent as E, useGlobalCopyStore as h, useTransactionStore as
|
|
2
|
-
import { useAriaLive as
|
|
3
|
-
import { ANALYTICS_EVENTS as
|
|
4
|
-
import { ON_CLICK_EVENTS as
|
|
1
|
+
import { useEvent as E, useGlobalCopyStore as h, useTransactionStore as x } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { useAriaLive as R } from "../../../../common/hooks/useAriaLive.es.js";
|
|
3
|
+
import { ANALYTICS_EVENTS as S } from "../../../../common/constants/Analytics.es.js";
|
|
4
|
+
import { ON_CLICK_EVENTS as v } from "../../../constants/OnClickEvents.es.js";
|
|
5
5
|
import n from "react";
|
|
6
|
-
import { observer as
|
|
7
|
-
import
|
|
6
|
+
import { observer as y } from "mobx-react-lite";
|
|
7
|
+
import N from "@mui/material/Stack";
|
|
8
8
|
import { Icon as L, Text as O } from "@mxenabled/mxui";
|
|
9
9
|
import A from "@mui/material/Button";
|
|
10
10
|
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
@@ -13,14 +13,14 @@ import D from "@mui/material/IconButton";
|
|
|
13
13
|
import k from "@mui/material/TextField";
|
|
14
14
|
import w from "@mui/material/FormGroup";
|
|
15
15
|
var K = ({ transaction: o, viewOnly: p = !1, displayValue: s }) => {
|
|
16
|
-
const l = p || !!s, { updateTransaction: f } =
|
|
16
|
+
const l = p || !!s, { updateTransaction: f } = x(), { common: I, transactions: t } = h(), { onEvent: c } = E(), { announce: T, ariaLive: _ } = R(), [r, d] = n.useState(!1), [i, u] = n.useState(""), m = n.useRef(null);
|
|
17
17
|
n.useEffect(() => {
|
|
18
18
|
r && (u(o.description), m?.current?.focus());
|
|
19
19
|
}, [r]);
|
|
20
20
|
const C = () => {
|
|
21
|
-
d(!0), c(
|
|
21
|
+
d(!0), c(v.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK), setTimeout(() => document.getElementById("transaction-description-input")?.focus(), 0);
|
|
22
22
|
}, b = async () => {
|
|
23
|
-
c(
|
|
23
|
+
c(S.TRANSACTION_DETAILS_CLICK_DESCRIPTION, { transaction_guid: o.guid }), await f({
|
|
24
24
|
...o,
|
|
25
25
|
description: i
|
|
26
26
|
}), d(!1), T(`${t.payee_title}: ${i}`), setTimeout(() => document.getElementById("transaction-description-edit-button")?.focus(), 0);
|
|
@@ -57,11 +57,11 @@ var K = ({ transaction: o, viewOnly: p = !1, displayValue: s }) => {
|
|
|
57
57
|
variant: "outlined",
|
|
58
58
|
children: I.save_button
|
|
59
59
|
})]
|
|
60
|
-
}) : /* @__PURE__ */ a(
|
|
60
|
+
}) : /* @__PURE__ */ a(N, {
|
|
61
61
|
alignItems: "center",
|
|
62
62
|
direction: "row",
|
|
63
63
|
gap: 4,
|
|
64
|
-
sx: { minHeight:
|
|
64
|
+
sx: { minHeight: 24 },
|
|
65
65
|
children: [/* @__PURE__ */ e(O, {
|
|
66
66
|
bold: !0,
|
|
67
67
|
children: s ?? o.description
|
|
@@ -69,7 +69,10 @@ var K = ({ transaction: o, viewOnly: p = !1, displayValue: s }) => {
|
|
|
69
69
|
"aria-label": t.payee_edit,
|
|
70
70
|
id: "transaction-description-edit-button",
|
|
71
71
|
onClick: C,
|
|
72
|
-
sx: {
|
|
72
|
+
sx: {
|
|
73
|
+
color: "action.active",
|
|
74
|
+
my: "-10px"
|
|
75
|
+
},
|
|
73
76
|
children: /* @__PURE__ */ e(L, {
|
|
74
77
|
name: "create",
|
|
75
78
|
size: 22
|
|
@@ -77,7 +80,7 @@ var K = ({ transaction: o, viewOnly: p = !1, displayValue: s }) => {
|
|
|
77
80
|
})]
|
|
78
81
|
})]
|
|
79
82
|
});
|
|
80
|
-
}, W =
|
|
83
|
+
}, W = y(K);
|
|
81
84
|
export {
|
|
82
85
|
W as default
|
|
83
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Description.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactiondetails/Description.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport FormGroup from '@mui/material/FormGroup'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { Icon, Text } from '@mxenabled/mxui'\n\nimport type { Transaction } from '../../../../core'\n\nimport {\n ANALYTICS_EVENTS,\n useEvent,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../../common'\nimport { useAriaLive } from '../../../../common/hooks/useAriaLive'\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\n\ninterface DescriptionProps {\n transaction: Transaction\n viewOnly?: boolean\n // Overrides the displayed value (e.g. institution name on transfers) while\n // leaving the underlying transaction description untouched. A display override\n // is inherently read-only, so it also suppresses the edit affordance.\n displayValue?: string\n}\n\nconst Description: React.FC<DescriptionProps> = ({\n transaction,\n viewOnly = false,\n displayValue,\n}) => {\n const isReadOnly = viewOnly || Boolean(displayValue)\n const { updateTransaction } = useTransactionStore()\n const { common: commonCopy, transactions: copy } = useGlobalCopyStore()\n const { onEvent } = useEvent()\n const { announce, ariaLive } = useAriaLive()\n\n const [isEditing, setIsEditing] = React.useState(false)\n const [description, setDescription] = React.useState('')\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n React.useEffect(() => {\n if (isEditing) {\n setDescription(transaction.description)\n inputRef?.current?.focus()\n }\n }, [isEditing])\n\n const handleEdit = () => {\n setIsEditing(true)\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK)\n setTimeout(() => document.getElementById(`transaction-description-input`)?.focus(), 0)\n }\n\n const handleSave = async () => {\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_DESCRIPTION, {\n transaction_guid: transaction.guid,\n })\n await updateTransaction({ ...transaction, description })\n setIsEditing(false)\n announce(`${copy.payee_title}: ${description}`)\n setTimeout(() => document.getElementById(`transaction-description-edit-button`)?.focus(), 0)\n }\n\n return (\n <Box className=\"mx-txn-transaction-description\">\n {ariaLive}\n {isEditing ? (\n <FormGroup row={true}>\n <TextField\n aria-label={copy.payee_title}\n id={`transaction-description-input`}\n label={copy.payee_title}\n name={copy.payee_title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => setDescription(e.target.value)}\n ref={inputRef}\n slotProps={{ htmlInput: { maxLength: 140 } }}\n sx={{\n backgroundColor: 'background.paper',\n '.MuiOutlinedInput-root': { borderTopRightRadius: 0, borderBottomRightRadius: 0 },\n '.MuiOutlinedInput-input': { p: 11 },\n width: 250,\n }}\n value={description}\n />\n <Button\n disabled={!description}\n onClick={handleSave}\n sx={{\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }}\n variant=\"outlined\"\n >\n {commonCopy.save_button}\n </Button>\n </FormGroup>\n ) : (\n <Stack alignItems=\"center\" direction=\"row\" gap={4} sx={{ minHeight:
|
|
1
|
+
{"version":3,"file":"Description.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactiondetails/Description.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport FormGroup from '@mui/material/FormGroup'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { Icon, Text } from '@mxenabled/mxui'\n\nimport type { Transaction } from '../../../../core'\n\nimport {\n ANALYTICS_EVENTS,\n useEvent,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../../common'\nimport { useAriaLive } from '../../../../common/hooks/useAriaLive'\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\n\ninterface DescriptionProps {\n transaction: Transaction\n viewOnly?: boolean\n // Overrides the displayed value (e.g. institution name on transfers) while\n // leaving the underlying transaction description untouched. A display override\n // is inherently read-only, so it also suppresses the edit affordance.\n displayValue?: string\n}\n\nconst Description: React.FC<DescriptionProps> = ({\n transaction,\n viewOnly = false,\n displayValue,\n}) => {\n const isReadOnly = viewOnly || Boolean(displayValue)\n const { updateTransaction } = useTransactionStore()\n const { common: commonCopy, transactions: copy } = useGlobalCopyStore()\n const { onEvent } = useEvent()\n const { announce, ariaLive } = useAriaLive()\n\n const [isEditing, setIsEditing] = React.useState(false)\n const [description, setDescription] = React.useState('')\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n React.useEffect(() => {\n if (isEditing) {\n setDescription(transaction.description)\n inputRef?.current?.focus()\n }\n }, [isEditing])\n\n const handleEdit = () => {\n setIsEditing(true)\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK)\n setTimeout(() => document.getElementById(`transaction-description-input`)?.focus(), 0)\n }\n\n const handleSave = async () => {\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_DESCRIPTION, {\n transaction_guid: transaction.guid,\n })\n await updateTransaction({ ...transaction, description })\n setIsEditing(false)\n announce(`${copy.payee_title}: ${description}`)\n setTimeout(() => document.getElementById(`transaction-description-edit-button`)?.focus(), 0)\n }\n\n return (\n <Box className=\"mx-txn-transaction-description\">\n {ariaLive}\n {isEditing ? (\n <FormGroup row={true}>\n <TextField\n aria-label={copy.payee_title}\n id={`transaction-description-input`}\n label={copy.payee_title}\n name={copy.payee_title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => setDescription(e.target.value)}\n ref={inputRef}\n slotProps={{ htmlInput: { maxLength: 140 } }}\n sx={{\n backgroundColor: 'background.paper',\n '.MuiOutlinedInput-root': { borderTopRightRadius: 0, borderBottomRightRadius: 0 },\n '.MuiOutlinedInput-input': { p: 11 },\n width: 250,\n }}\n value={description}\n />\n <Button\n disabled={!description}\n onClick={handleSave}\n sx={{\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }}\n variant=\"outlined\"\n >\n {commonCopy.save_button}\n </Button>\n </FormGroup>\n ) : (\n <Stack alignItems=\"center\" direction=\"row\" gap={4} sx={{ minHeight: 24 }}>\n <Text bold={true}>{displayValue ?? transaction.description}</Text>\n {!isReadOnly && (\n <IconButton\n aria-label={copy.payee_edit}\n id={`transaction-description-edit-button`}\n onClick={handleEdit}\n // 44px tap target, but only 24px of layout height (Figma's name row).\n sx={{ color: 'action.active', my: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