@mx-cartographer/experiences 9.7.131 → 9.7.132
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 +5 -0
- package/dist/core/utils/NumberFormatting.d.ts +6 -0
- package/dist/core/utils/NumberFormatting.es.js +20 -16
- package/dist/core/utils/NumberFormatting.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js +17 -17
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +38 -38
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js +14 -14
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -26
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js +22 -22
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/SavingsCalculator.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +47 -47
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +18 -18
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +28 -28
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +57 -56
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +50 -50
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +52 -51
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +17 -17
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +20 -20
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +25 -25
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +17 -16
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +34 -34
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js +7 -7
- package/dist/insights-v2/blocks/ChartBlocks/DoubleProgressBarBlock/ProgressBar.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js +13 -13
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +39 -39
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +20 -20
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +44 -44
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js +25 -25
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +39 -46
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +18 -18
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +19 -19
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +9 -9
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +12 -12
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +58 -57
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +18 -18
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +10 -10
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js +13 -13
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +3 -1
- package/dist/insights-v2/blocks/slotReaders.es.js +17 -6
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +44 -43
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/SaveAnExtraCard.es.js +6 -6
- package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
- package/dist/insights-v2/components/WithdrawalCard.es.js +20 -20
- package/dist/insights-v2/components/WithdrawalCard.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,22 +4,23 @@ import { getCategoryColor as N } from "../../core/utils/CategoryUtil.es.js";
|
|
|
4
4
|
import { TinyBarChart as P } from "../../common/components/TinyBarChart.es.js";
|
|
5
5
|
import { BAR_ARIA_LABEL as W, buildChartData as K, buildDataSeries as j } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
6
6
|
import { ThemedSVGImage as F } from "./chartblocks/ThemedSVGImage.es.js";
|
|
7
|
-
import {
|
|
7
|
+
import { asLogoRef as H } from "../blocks/slotReaders.es.js";
|
|
8
|
+
import { postCtaMessage as M } from "../ctaActions/runCtaAction.es.js";
|
|
8
9
|
import p from "./LogoFromGuid.es.js";
|
|
9
|
-
import { createVariantBlock as
|
|
10
|
-
import { ActionBlockLayer as
|
|
10
|
+
import { createVariantBlock as Z } from "../blocks/createVariantBlock.es.js";
|
|
11
|
+
import { ActionBlockLayer as X } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
11
12
|
import y from "./BadgedTile.es.js";
|
|
12
|
-
import { InsightOptionsMenu as
|
|
13
|
-
import { ReactComponent as
|
|
13
|
+
import { InsightOptionsMenu as $ } from "./InsightOptionsMenu.es.js";
|
|
14
|
+
import { ReactComponent as q } from "./shared/images/FeeDetected.es.js";
|
|
14
15
|
import S from "./StatusBadge.es.js";
|
|
15
16
|
import x from "@mui/material/Stack";
|
|
16
|
-
import { P as
|
|
17
|
-
import
|
|
17
|
+
import { P as J, Text as C } from "@mxenabled/mxui";
|
|
18
|
+
import Q from "@mui/material/Button";
|
|
18
19
|
import { Icon as v } from "@mxenabled/mx-icons";
|
|
19
|
-
import { Fragment as
|
|
20
|
+
import { Fragment as U, jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
20
21
|
import e from "@mui/material/Box";
|
|
21
|
-
import
|
|
22
|
-
var
|
|
22
|
+
import Y from "@mui/material/Card";
|
|
23
|
+
var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
23
24
|
left: "50%",
|
|
24
25
|
position: "absolute",
|
|
25
26
|
top: "50%",
|
|
@@ -47,12 +48,12 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
47
48
|
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
48
49
|
size: c,
|
|
49
50
|
sx: { flexShrink: 0 }
|
|
50
|
-
}),
|
|
51
|
+
}), et = ({ logo: r }) => /* @__PURE__ */ t(y, {
|
|
51
52
|
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
52
53
|
size: c,
|
|
53
54
|
sx: { flexShrink: 0 },
|
|
54
55
|
topRight: /* @__PURE__ */ t(S, { tone: "warning" })
|
|
55
|
-
}),
|
|
56
|
+
}), ot = 24, at = ({ logo: r }) => /* @__PURE__ */ t(y, {
|
|
56
57
|
bottomLeft: r ? /* @__PURE__ */ t(e, {
|
|
57
58
|
"aria-hidden": !0,
|
|
58
59
|
sx: {
|
|
@@ -67,21 +68,21 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
67
68
|
...r,
|
|
68
69
|
alt: void 0
|
|
69
70
|
},
|
|
70
|
-
size:
|
|
71
|
+
size: ot
|
|
71
72
|
})
|
|
72
73
|
}) : void 0,
|
|
73
74
|
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
74
75
|
size: c,
|
|
75
76
|
sx: { flexShrink: 0 },
|
|
76
77
|
topRight: /* @__PURE__ */ t(S, { tone: "error" })
|
|
77
|
-
}),
|
|
78
|
+
}), nt = () => /* @__PURE__ */ t(F, {
|
|
78
79
|
divProps: { style: {
|
|
79
80
|
flexShrink: 0,
|
|
80
81
|
lineHeight: 0,
|
|
81
82
|
width: "max-content"
|
|
82
83
|
} },
|
|
83
|
-
image:
|
|
84
|
-
}), b = 24,
|
|
84
|
+
image: q
|
|
85
|
+
}), b = 24, st = () => /* @__PURE__ */ t(e, {
|
|
85
86
|
"aria-hidden": !0,
|
|
86
87
|
"data-testid": "linked-logos-badge",
|
|
87
88
|
sx: {
|
|
@@ -101,7 +102,7 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
101
102
|
size: 16,
|
|
102
103
|
sx: { color: "primary.contrastText" }
|
|
103
104
|
})
|
|
104
|
-
}),
|
|
105
|
+
}), lt = () => /* @__PURE__ */ t(e, {
|
|
105
106
|
"aria-hidden": !0,
|
|
106
107
|
"data-testid": "linked-logos-badge",
|
|
107
108
|
sx: {
|
|
@@ -125,14 +126,14 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
125
126
|
transform: "rotate(-90deg)"
|
|
126
127
|
}
|
|
127
128
|
})
|
|
128
|
-
}),
|
|
129
|
+
}), dt = ({ data: r, template: o }) => {
|
|
129
130
|
const { from_logo: l, to_logo: a } = r ?? {}, i = o === "SwitchDirectDeposit";
|
|
130
131
|
return /* @__PURE__ */ d(e, {
|
|
131
132
|
sx: {
|
|
132
133
|
flexShrink: 0,
|
|
133
|
-
height:
|
|
134
|
+
height: it,
|
|
134
135
|
position: "relative",
|
|
135
|
-
width:
|
|
136
|
+
width: rt
|
|
136
137
|
},
|
|
137
138
|
children: [
|
|
138
139
|
/* @__PURE__ */ t(e, {
|
|
@@ -187,10 +188,10 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
187
188
|
size: I
|
|
188
189
|
})
|
|
189
190
|
}),
|
|
190
|
-
i ? /* @__PURE__ */ t(
|
|
191
|
+
i ? /* @__PURE__ */ t(lt, {}) : /* @__PURE__ */ t(st, {})
|
|
191
192
|
]
|
|
192
193
|
});
|
|
193
|
-
},
|
|
194
|
+
}, ct = ({ data: r }) => {
|
|
194
195
|
const o = j(_(r, "series"));
|
|
195
196
|
if (!o.length) return null;
|
|
196
197
|
const l = _(r, "category_guid"), a = K(o, W).slice(-3);
|
|
@@ -202,18 +203,18 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
202
203
|
data: a
|
|
203
204
|
})
|
|
204
205
|
});
|
|
205
|
-
},
|
|
206
|
+
}, pt = Z({
|
|
206
207
|
variants: {
|
|
207
|
-
category_color:
|
|
208
|
-
linked_logos:
|
|
208
|
+
category_color: ct,
|
|
209
|
+
linked_logos: dt,
|
|
209
210
|
minimal: w,
|
|
210
|
-
stacked_logos:
|
|
211
|
-
with_illustration:
|
|
212
|
-
with_warning_badge:
|
|
211
|
+
stacked_logos: at,
|
|
212
|
+
with_illustration: nt,
|
|
213
|
+
with_warning_badge: et
|
|
213
214
|
},
|
|
214
215
|
fallback: w,
|
|
215
216
|
name: "InsightVisual"
|
|
216
|
-
}),
|
|
217
|
+
}), gt = {
|
|
217
218
|
BillAmountNotStandard: {
|
|
218
219
|
key: "in_description_cta",
|
|
219
220
|
trigger: "inDescriptionCta"
|
|
@@ -227,17 +228,17 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
227
228
|
trigger: "inDescriptionCta"
|
|
228
229
|
},
|
|
229
230
|
SwitchDirectDeposit: { key: "in_description_cta" }
|
|
230
|
-
},
|
|
231
|
-
const D = V(), { openActionDrawer:
|
|
231
|
+
}, mt = (r) => r.stopPropagation(), Gt = ({ beat: r, isCtaDisabled: o = !1, onCtaClick: l, onTap: a, payload: i }) => {
|
|
232
|
+
const D = V(), { openActionDrawer: L } = G(), { description: B, instance_slot: m, primary_cta: h, title: E } = i, n = gt[i.template ?? ""], f = n ? i[n.key] : h, u = i.in_description_cta?.post_message_metadata, R = !n || !!n.trigger || !!r && !!u, A = H(_(m.data, "logo")), z = (s) => {
|
|
232
233
|
if (s.stopPropagation(), !(o || !f)) {
|
|
233
234
|
if (n) {
|
|
234
|
-
if (r && n.trigger)
|
|
235
|
+
if (r && n.trigger) L({
|
|
235
236
|
guid: r.guid,
|
|
236
237
|
trigger: n.trigger
|
|
237
238
|
});
|
|
238
239
|
else if (r && u) {
|
|
239
240
|
const { action: O, ...T } = u;
|
|
240
|
-
|
|
241
|
+
M({
|
|
241
242
|
beat: r,
|
|
242
243
|
stores: D
|
|
243
244
|
}, {
|
|
@@ -250,7 +251,7 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
250
251
|
h && l?.(h);
|
|
251
252
|
}
|
|
252
253
|
};
|
|
253
|
-
return /* @__PURE__ */ d(
|
|
254
|
+
return /* @__PURE__ */ d(U, { children: [/* @__PURE__ */ d(Y, {
|
|
254
255
|
"data-testid": "compact-insight-card",
|
|
255
256
|
...a ? {
|
|
256
257
|
onClick: a,
|
|
@@ -282,9 +283,9 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
282
283
|
variant: "body1",
|
|
283
284
|
children: E ?? ""
|
|
284
285
|
}), /* @__PURE__ */ t(e, {
|
|
285
|
-
onClick:
|
|
286
|
+
onClick: mt,
|
|
286
287
|
sx: { display: "flex" },
|
|
287
|
-
children: /* @__PURE__ */ t(
|
|
288
|
+
children: /* @__PURE__ */ t($, {})
|
|
288
289
|
})]
|
|
289
290
|
}), /* @__PURE__ */ d(x, {
|
|
290
291
|
sx: {
|
|
@@ -301,8 +302,8 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
301
302
|
minWidth: 0,
|
|
302
303
|
pt: 2
|
|
303
304
|
},
|
|
304
|
-
children: [/* @__PURE__ */ t(
|
|
305
|
-
dangerouslySetInnerHTML: { __html:
|
|
305
|
+
children: [/* @__PURE__ */ t(J, {
|
|
306
|
+
dangerouslySetInnerHTML: { __html: B.html_text },
|
|
306
307
|
"data-testid": "compact-insight-card-description",
|
|
307
308
|
sx: {
|
|
308
309
|
display: "-webkit-box",
|
|
@@ -310,10 +311,10 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
310
311
|
overflow: "hidden",
|
|
311
312
|
textOverflow: "ellipsis",
|
|
312
313
|
WebkitBoxOrient: "vertical",
|
|
313
|
-
WebkitLineClamp:
|
|
314
|
+
WebkitLineClamp: tt
|
|
314
315
|
},
|
|
315
316
|
variant: "subtitle2"
|
|
316
|
-
}), f?.label && R && /* @__PURE__ */ t(
|
|
317
|
+
}), f?.label && R && /* @__PURE__ */ t(Q, {
|
|
317
318
|
"aria-disabled": o,
|
|
318
319
|
onClick: z,
|
|
319
320
|
size: "small",
|
|
@@ -334,17 +335,17 @@ var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
|
334
335
|
children: f.label
|
|
335
336
|
})
|
|
336
337
|
})]
|
|
337
|
-
}), /* @__PURE__ */ t(
|
|
338
|
+
}), /* @__PURE__ */ t(pt, {
|
|
338
339
|
data: m.data,
|
|
339
340
|
logo: A,
|
|
340
341
|
template: i.template,
|
|
341
342
|
variant: m.variant
|
|
342
343
|
})]
|
|
343
344
|
})]
|
|
344
|
-
}), r && /* @__PURE__ */ t(
|
|
345
|
+
}), r && /* @__PURE__ */ t(X, { beat: r })] });
|
|
345
346
|
};
|
|
346
347
|
export {
|
|
347
|
-
|
|
348
|
+
Gt as default
|
|
348
349
|
};
|
|
349
350
|
|
|
350
351
|
//# sourceMappingURL=CompactInsightCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { useGlobalStore, useInsightsV2Store } from '../../common'\nimport { TinyBarChart } from '../../common/components/TinyBarChart'\nimport { slot } from '../../core'\nimport type {\n Beat,\n DataSeries,\n InsightsPayload,\n InstanceSlotData,\n LogoRef,\n PrimaryCTA,\n} from '../../core'\nimport type { ActionDrawerTrigger } from '../../core/stores'\nimport type { AccountSwitchBlockV2Data } from '../../core/types/InsightsInstanceSlotData'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport {\n BAR_ARIA_LABEL,\n buildChartData,\n buildDataSeries,\n} from '../blocks/ChartBlocks/BarchartBlock/utils'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { postCtaMessage } from '../ctaActions'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport { ReactComponent as FeeDetectedIllustration } from './shared/images/FeeDetected.svg'\nimport { ThemedSVGImage } from './chartblocks/ThemedSVGImage'\nimport StatusBadge from './StatusBadge'\n\nconst DESCRIPTION_MAX_LINES = 2\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n /** The slot's whole `data`, for a visual drawn from more than the logo (`category_color`, `linked_logos`). */\n data?: InstanceSlotData\n /** The envelope's template, for a beat's own badge on `linked_logos`. */\n template?: string\n}\n\n// Figma 1943:219189: 36px logos at opposite corners of a 75×74 box, the badge and rings centred.\nconst LINKED_LOGO_SIZE = 36\nconst LINKED_BOX_WIDTH = 75\nconst LINKED_BOX_HEIGHT = 74\n\nconst CENTRED = {\n left: '50%',\n position: 'absolute',\n top: '50%',\n transform: 'translate(-50%, -50%)',\n} as const\n\n/** Figma 222:33404 (Embedded | Bill Amount Not Standard) shows the latest three bars. */\nconst BAR_CHART_BAR_COUNT = 3\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\nconst STACKED_LOGO_SIZE = 24\n\n/** ditto `stacked_logos`: the row logo twice, plus an error badge. The copy is `aria-hidden`, so the logo is named once. */\nconst StackedLogosVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n bottomLeft={\n logo ? (\n <Box\n aria-hidden={true}\n sx={{\n borderRadius: '6px',\n display: 'flex',\n outline: '2px solid',\n outlineColor: 'background.paper',\n overflow: 'hidden',\n }}\n >\n <LogoFromGuid logo={{ ...logo, alt: undefined }} size={STACKED_LOGO_SIZE} />\n </Box>\n ) : undefined\n }\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"error\" />}\n />\n)\n\n/**\n * ditto `with_illustration`: artwork in place of the logo tile (Fee Detected's search illustration).\n * A single SVG themed at runtime by `ThemedSVGImage`: its `brand300` elements are recolored to the\n * theme's `primary.main` (so it follows dark mode), while `fill=\"white\"` areas stay white. The\n * slot's `logo` is deliberately unused: the illustration replaces the tile.\n */\nconst IllustrationVisual = () => {\n return (\n <ThemedSVGImage\n divProps={{ style: { flexShrink: 0, lineHeight: 0, width: 'max-content' } }}\n image={FeeDetectedIllustration}\n />\n )\n}\n\nconst SWAP_BADGE_SIZE = 24\n\nconst LinkBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.main',\n border: '2px solid',\n borderColor: 'primary.contrastText',\n borderRadius: '12px',\n display: 'flex',\n justifyContent: 'center',\n p: 2,\n zIndex: 1,\n }}\n >\n <Icon name=\"link\" size={16} sx={{ color: 'primary.contrastText' }} />\n </Box>\n)\n\n/**\n * Switch Direct Deposit (Figma 1941:167601): the outlined `swap_vertical_circle`, turned horizontal,\n * over a contrast disc: a primary ring and arrows on white. Drawn 1.2× so its circle fills 24px.\n */\nconst SwapBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.contrastText',\n borderRadius: '50%',\n display: 'flex',\n height: SWAP_BADGE_SIZE,\n justifyContent: 'center',\n overflow: 'hidden',\n width: SWAP_BADGE_SIZE,\n zIndex: 1,\n }}\n >\n <Icon\n name=\"swap_vertical_circle\"\n size={SWAP_BADGE_SIZE * 1.2}\n sx={{ color: 'primary.main', flexShrink: 0, transform: 'rotate(-90deg)' }}\n />\n </Box>\n)\n\n/**\n * ditto `linked_logos` (Figma 1943:219189, Embedded | Discovered Accounts): the two institutions at\n * opposite corners of a 75×74 box — `from_logo` top-left, `to_logo` bottom-right — meeting on the\n * diagonal, with a badge over two rings at the centre (Switch Direct Deposit: the swap badge on an\n * outlined inner ring). The rings and badge are decorative (`aria-hidden`); each logo's accessible\n * name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data, template }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\n const isSwap = template === 'SwitchDirectDeposit'\n\n return (\n <Box\n sx={{\n flexShrink: 0,\n height: LINKED_BOX_HEIGHT,\n position: 'relative',\n width: LINKED_BOX_WIDTH,\n }}\n >\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n borderRadius: '50%',\n height: 36,\n width: 36,\n ...(isSwap\n ? { border: '2px solid', borderColor: 'primary.light' }\n : { bgcolor: 'primary.light' }),\n }}\n />\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '50%',\n height: 48,\n width: 48,\n }}\n />\n <Box sx={{ borderRadius: '4px', left: 0, overflow: 'hidden', position: 'absolute', top: 0 }}>\n <LogoFromGuid logo={from_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n <Box\n sx={{ borderRadius: '4px', bottom: 0, overflow: 'hidden', position: 'absolute', right: 0 }}\n >\n <LogoFromGuid logo={to_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n {isSwap ? <SwapBadge /> : <LinkBadge />}\n </Box>\n )\n}\n\n/**\n * ditto `category_color`: a tiny bar chart of the latest bars in place of the logo tile, tinted by\n * the slot's category, the newest bar solid (Figma 222:33404). Draws nothing without a series.\n */\nconst BarChartVisual = ({ data }: InsightVisualProps) => {\n const series = buildDataSeries(slot<DataSeries>(data, 'series'))\n if (!series.length) return null\n\n const categoryGuid = slot<string>(data, 'category_guid')\n const bars = buildChartData(series, BAR_ARIA_LABEL).slice(-BAR_CHART_BAR_COUNT)\n\n return (\n <Box data-testid=\"compact-insight-card-bar-chart\" sx={{ flexShrink: 0 }}>\n <TinyBarChart\n color={(theme) =>\n categoryGuid ? getCategoryColor(categoryGuid, theme) : theme.palette.primary.main\n }\n data={bars}\n />\n </Box>\n )\n}\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: {\n category_color: BarChartVisual,\n linked_logos: LinkedLogosVisual,\n minimal: PlainVisual,\n stacked_logos: StackedLogosVisual,\n with_illustration: IllustrationVisual,\n with_warning_badge: WarningBadgeVisual,\n },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\n/**\n * Beats whose embedded CTA the card reads from its own envelope key and opens in this card's\n * `ActionBlockLayer`, as a bar click does on the full card. The trigger names that key, so the layer\n * resolves the same CTA. Without a trigger the link posts its host message instead (Switch Direct\n * Deposit's op_1: Atomic runs only in pulse). Every other beat keeps `primary_cta` and hands it to\n * the host's `onCtaClick` (e.g. `contact_support_block`). A new beat adds its template here.\n */\nconst BEAT_CTA_CONFIG: Record<\n string,\n { key: 'primary_cta' | 'in_description_cta'; trigger?: ActionDrawerTrigger }\n> = {\n BillAmountNotStandard: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n ConnectDiscoveredAccountsV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n DuplicatePaymentV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n SwitchDirectDeposit: { key: 'in_description_cta' },\n}\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /** The envelope's beat; when given, the card mounts its `ActionBlockLayer` for CTA drawers. */\n beat?: Beat\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n beat,\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const stores = useGlobalStore()\n const { openActionDrawer } = useInsightsV2Store()\n const { description, instance_slot, primary_cta, title } = payload\n const beatCta = BEAT_CTA_CONFIG[payload.template ?? '']\n const cta = beatCta ? payload[beatCta.key] : primary_cta\n const message = payload.in_description_cta?.post_message_metadata\n // A link that posts needs its beat and message; without them it draws nothing.\n const canAct = !beatCta || !!beatCta.trigger || (!!beat && !!message)\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = slot<LogoRef>(instance_slot.data, 'logo')\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !cta) return\n\n if (beatCta) {\n if (beat && beatCta.trigger) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\n else if (beat && message) {\n const { action, ...extras } = message\n postCtaMessage({ beat, stores }, { action, payload: extras })\n }\n return\n }\n if (primary_cta) 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 <>\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, pl: 8 }}>\n <Stack sx={{ alignSelf: 'stretch', flex: 1, gap: 8, minWidth: 0, pt: 2 }}>\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 sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: DESCRIPTION_MAX_LINES,\n }}\n variant=\"subtitle2\"\n />\n {cta?.label && canAct && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // The label lines up with the description (the column pads 8; the tap target keeps\n // its padding). `my: 0` drops the theme's -12px text-button margin.\n ml: -8,\n my: 0,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {cta.label}\n </Text>\n </Button>\n )}\n </Stack>\n\n <InsightVisual\n data={instance_slot.data}\n logo={rowLogo}\n template={payload.template}\n variant={instance_slot.variant}\n />\n </Stack>\n </Card>\n {/* Outside the Card: the drawer is a portal, and its clicks would otherwise bubble to `onTap`. */}\n {beat && <ActionBlockLayer beat={beat} />}\n </>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAwB,GAGxB,IAAY,IAYZ,IAAmB,IACnB,KAAmB,IACnB,KAAoB,IAEpB,IAAU;AAAA,EACd,MAAM;AAAA,EACN,UA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Z,UAAU;AAAA,YACV,cAAc;AAAA,YACd,iBAAiB;AAAA,YACjB,iBAAiB;AAAA,UACnB;AAAA,UACA,SAAQ;AAAA,QACT,CAAA,GACA,GAAK,SAAS,KACb,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAGX,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,GAAI,KAAiB;AAAA,cACnB,OAAO;AAAA,cACP,QAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,SAAQ;AAAA,UAER,UAAA,gBAAA,EAAC,GAAD;AAAA,YAAM,MAAM;AAAA,YAAM,SAAQ;AAAA,YACvB,UAAA,EAAI;AAAA,UACD,CAAA;AAAA,QACA,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,IAAD;AAAA,QACE,MAAM,EAAc;AAAA,QACpB,MAAM;AAAA,QACN,UAAU,EAAQ;AAAA,QAClB,SAAS,EAAc;AAAA,MACxB,CAAA,CACI;AAAA,IACH,CAAA,CAAA;AAAA,EAEL,CAAA,GAAA,KAAQ,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA,CACxC,EAAA,CAAA;AAEN"}
|
|
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 { useGlobalStore, useInsightsV2Store } from '../../common'\nimport { TinyBarChart } from '../../common/components/TinyBarChart'\nimport { slot } from '../../core'\nimport type {\n Beat,\n DataSeries,\n InsightsPayload,\n InstanceSlotData,\n LogoRef,\n PrimaryCTA,\n} from '../../core'\nimport type { ActionDrawerTrigger } from '../../core/stores'\nimport type { AccountSwitchBlockV2Data } from '../../core/types/InsightsInstanceSlotData'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport {\n BAR_ARIA_LABEL,\n buildChartData,\n buildDataSeries,\n} from '../blocks/ChartBlocks/BarchartBlock/utils'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { postCtaMessage } from '../ctaActions'\nimport { asLogoRef } from '../blocks/slotReaders'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport { ReactComponent as FeeDetectedIllustration } from './shared/images/FeeDetected.svg'\nimport { ThemedSVGImage } from './chartblocks/ThemedSVGImage'\nimport StatusBadge from './StatusBadge'\n\nconst DESCRIPTION_MAX_LINES = 2\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n /** The slot's whole `data`, for a visual drawn from more than the logo (`category_color`, `linked_logos`). */\n data?: InstanceSlotData\n /** The envelope's template, for a beat's own badge on `linked_logos`. */\n template?: string\n}\n\n// Figma 1943:219189: 36px logos at opposite corners of a 75×74 box, the badge and rings centred.\nconst LINKED_LOGO_SIZE = 36\nconst LINKED_BOX_WIDTH = 75\nconst LINKED_BOX_HEIGHT = 74\n\nconst CENTRED = {\n left: '50%',\n position: 'absolute',\n top: '50%',\n transform: 'translate(-50%, -50%)',\n} as const\n\n/** Figma 222:33404 (Embedded | Bill Amount Not Standard) shows the latest three bars. */\nconst BAR_CHART_BAR_COUNT = 3\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\nconst STACKED_LOGO_SIZE = 24\n\n/** ditto `stacked_logos`: the row logo twice, plus an error badge. The copy is `aria-hidden`, so the logo is named once. */\nconst StackedLogosVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n bottomLeft={\n logo ? (\n <Box\n aria-hidden={true}\n sx={{\n borderRadius: '6px',\n display: 'flex',\n outline: '2px solid',\n outlineColor: 'background.paper',\n overflow: 'hidden',\n }}\n >\n <LogoFromGuid logo={{ ...logo, alt: undefined }} size={STACKED_LOGO_SIZE} />\n </Box>\n ) : undefined\n }\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"error\" />}\n />\n)\n\n/**\n * ditto `with_illustration`: artwork in place of the logo tile (Fee Detected's search illustration).\n * A single SVG themed at runtime by `ThemedSVGImage`: its `brand300` elements are recolored to the\n * theme's `primary.main` (so it follows dark mode), while `fill=\"white\"` areas stay white. The\n * slot's `logo` is deliberately unused: the illustration replaces the tile.\n */\nconst IllustrationVisual = () => {\n return (\n <ThemedSVGImage\n divProps={{ style: { flexShrink: 0, lineHeight: 0, width: 'max-content' } }}\n image={FeeDetectedIllustration}\n />\n )\n}\n\nconst SWAP_BADGE_SIZE = 24\n\nconst LinkBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.main',\n border: '2px solid',\n borderColor: 'primary.contrastText',\n borderRadius: '12px',\n display: 'flex',\n justifyContent: 'center',\n p: 2,\n zIndex: 1,\n }}\n >\n <Icon name=\"link\" size={16} sx={{ color: 'primary.contrastText' }} />\n </Box>\n)\n\n/**\n * Switch Direct Deposit (Figma 1941:167601): the outlined `swap_vertical_circle`, turned horizontal,\n * over a contrast disc: a primary ring and arrows on white. Drawn 1.2× so its circle fills 24px.\n */\nconst SwapBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.contrastText',\n borderRadius: '50%',\n display: 'flex',\n height: SWAP_BADGE_SIZE,\n justifyContent: 'center',\n overflow: 'hidden',\n width: SWAP_BADGE_SIZE,\n zIndex: 1,\n }}\n >\n <Icon\n name=\"swap_vertical_circle\"\n size={SWAP_BADGE_SIZE * 1.2}\n sx={{ color: 'primary.main', flexShrink: 0, transform: 'rotate(-90deg)' }}\n />\n </Box>\n)\n\n/**\n * ditto `linked_logos` (Figma 1943:219189, Embedded | Discovered Accounts): the two institutions at\n * opposite corners of a 75×74 box — `from_logo` top-left, `to_logo` bottom-right — meeting on the\n * diagonal, with a badge over two rings at the centre (Switch Direct Deposit: the swap badge on an\n * outlined inner ring). The rings and badge are decorative (`aria-hidden`); each logo's accessible\n * name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data, template }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\n const isSwap = template === 'SwitchDirectDeposit'\n\n return (\n <Box\n sx={{\n flexShrink: 0,\n height: LINKED_BOX_HEIGHT,\n position: 'relative',\n width: LINKED_BOX_WIDTH,\n }}\n >\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n borderRadius: '50%',\n height: 36,\n width: 36,\n ...(isSwap\n ? { border: '2px solid', borderColor: 'primary.light' }\n : { bgcolor: 'primary.light' }),\n }}\n />\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '50%',\n height: 48,\n width: 48,\n }}\n />\n <Box sx={{ borderRadius: '4px', left: 0, overflow: 'hidden', position: 'absolute', top: 0 }}>\n <LogoFromGuid logo={from_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n <Box\n sx={{ borderRadius: '4px', bottom: 0, overflow: 'hidden', position: 'absolute', right: 0 }}\n >\n <LogoFromGuid logo={to_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n {isSwap ? <SwapBadge /> : <LinkBadge />}\n </Box>\n )\n}\n\n/**\n * ditto `category_color`: a tiny bar chart of the latest bars in place of the logo tile, tinted by\n * the slot's category, the newest bar solid (Figma 222:33404). Draws nothing without a series.\n */\nconst BarChartVisual = ({ data }: InsightVisualProps) => {\n const series = buildDataSeries(slot<DataSeries>(data, 'series'))\n if (!series.length) return null\n\n const categoryGuid = slot<string>(data, 'category_guid')\n const bars = buildChartData(series, BAR_ARIA_LABEL).slice(-BAR_CHART_BAR_COUNT)\n\n return (\n <Box data-testid=\"compact-insight-card-bar-chart\" sx={{ flexShrink: 0 }}>\n <TinyBarChart\n color={(theme) =>\n categoryGuid ? getCategoryColor(categoryGuid, theme) : theme.palette.primary.main\n }\n data={bars}\n />\n </Box>\n )\n}\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: {\n category_color: BarChartVisual,\n linked_logos: LinkedLogosVisual,\n minimal: PlainVisual,\n stacked_logos: StackedLogosVisual,\n with_illustration: IllustrationVisual,\n with_warning_badge: WarningBadgeVisual,\n },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\n/**\n * Beats whose embedded CTA the card reads from its own envelope key and opens in this card's\n * `ActionBlockLayer`, as a bar click does on the full card. The trigger names that key, so the layer\n * resolves the same CTA. Without a trigger the link posts its host message instead (Switch Direct\n * Deposit's op_1: Atomic runs only in pulse). Every other beat keeps `primary_cta` and hands it to\n * the host's `onCtaClick` (e.g. `contact_support_block`). A new beat adds its template here.\n */\nconst BEAT_CTA_CONFIG: Record<\n string,\n { key: 'primary_cta' | 'in_description_cta'; trigger?: ActionDrawerTrigger }\n> = {\n BillAmountNotStandard: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n ConnectDiscoveredAccountsV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n DuplicatePaymentV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n SwitchDirectDeposit: { key: 'in_description_cta' },\n}\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /** The envelope's beat; when given, the card mounts its `ActionBlockLayer` for CTA drawers. */\n beat?: Beat\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n beat,\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const stores = useGlobalStore()\n const { openActionDrawer } = useInsightsV2Store()\n const { description, instance_slot, primary_cta, title } = payload\n const beatCta = BEAT_CTA_CONFIG[payload.template ?? '']\n const cta = beatCta ? payload[beatCta.key] : primary_cta\n const message = payload.in_description_cta?.post_message_metadata\n // A link that posts needs its beat and message; without them it draws nothing.\n const canAct = !beatCta || !!beatCta.trigger || (!!beat && !!message)\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = asLogoRef(slot(instance_slot.data, 'logo'))\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !cta) return\n\n if (beatCta) {\n if (beat && beatCta.trigger) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\n else if (beat && message) {\n const { action, ...extras } = message\n postCtaMessage({ beat, stores }, { action, payload: extras })\n }\n return\n }\n if (primary_cta) 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 <>\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, pl: 8 }}>\n <Stack sx={{ alignSelf: 'stretch', flex: 1, gap: 8, minWidth: 0, pt: 2 }}>\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 sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: DESCRIPTION_MAX_LINES,\n }}\n variant=\"subtitle2\"\n />\n {cta?.label && canAct && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // The label lines up with the description (the column pads 8; the tap target keeps\n // its padding). `my: 0` drops the theme's -12px text-button margin.\n ml: -8,\n my: 0,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {cta.label}\n </Text>\n </Button>\n )}\n </Stack>\n\n <InsightVisual\n data={instance_slot.data}\n logo={rowLogo}\n template={payload.template}\n variant={instance_slot.variant}\n />\n </Stack>\n </Card>\n {/* Outside the Card: the drawer is a portal, and its clicks would otherwise bubble to `onTap`. */}\n {beat && <ActionBlockLayer beat={beat} />}\n </>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAwB,GAGxB,IAAY,IAYZ,IAAmB,IACnB,KAAmB,IACnB,KAAoB,IAEpB,IAAU;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AAAA,EACL,WAAW;AACb,GAMM,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,KAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,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,GAGG,KAA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core/utils/NumberFormatting.es.js";
|
|
2
|
+
import { P as u, Text as o } from "@mxenabled/mxui";
|
|
3
3
|
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
4
4
|
import t from "@mui/material/Box";
|
|
5
|
-
var g = ({ primaryText:
|
|
6
|
-
const [l, s, d] =
|
|
5
|
+
var g = ({ primaryText: n = [], secondaryText: i = [], bgcolor: c = "success.main", sx: a }) => {
|
|
6
|
+
const [l, s, d] = n, [p, x] = i;
|
|
7
7
|
return /* @__PURE__ */ e(t, {
|
|
8
8
|
sx: {
|
|
9
9
|
border: "1px solid",
|
|
@@ -21,7 +21,7 @@ var g = ({ primaryText: i = [], secondaryText: n = [], bgcolor: c = "success.mai
|
|
|
21
21
|
textAlign: "center"
|
|
22
22
|
},
|
|
23
23
|
children: [
|
|
24
|
-
/* @__PURE__ */ r(
|
|
24
|
+
/* @__PURE__ */ r(u, {
|
|
25
25
|
color: "inherit",
|
|
26
26
|
variant: "subtitle1",
|
|
27
27
|
children: l
|
|
@@ -30,7 +30,7 @@ var g = ({ primaryText: i = [], secondaryText: n = [], bgcolor: c = "success.mai
|
|
|
30
30
|
bold: !0,
|
|
31
31
|
color: "inherit",
|
|
32
32
|
variant: "h1",
|
|
33
|
-
children:
|
|
33
|
+
children: m(Number(s ?? "0"), h.cents)
|
|
34
34
|
}),
|
|
35
35
|
/* @__PURE__ */ r(o, {
|
|
36
36
|
color: "inherit",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveAnExtraCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SaveAnExtraCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\ninterface SaveAnExtraCardProps {\n primaryText?: string[]\n secondaryText?: string[]\n bgcolor?: string\n sx?: SxProps<Theme>\n}\n\nconst SaveAnExtraCard = ({\n primaryText = [],\n secondaryText = [],\n bgcolor = 'success.main',\n sx,\n}: SaveAnExtraCardProps) => {\n const [leadIn, amount, trailingCopy] = primaryText\n const [projected, projectedCaption] = secondaryText\n\n return (\n <Box\n sx={{\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: 2,\n\n overflow: 'hidden',\n ...sx,\n }}\n >\n {/* Green header */}\n <Box\n sx={{\n bgcolor,\n color: 'success.contrastText',\n p: 16,\n pt: 12,\n textAlign: 'center',\n }}\n >\n <P color=\"inherit\" variant=\"subtitle1\">\n {leadIn}\n </P>\n <Text bold={true} color=\"inherit\" variant=\"h1\">\n {formatCurrency(Number(amount ?? '0'),
|
|
1
|
+
{"version":3,"file":"SaveAnExtraCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SaveAnExtraCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { CURRENCY_FORMAT, formatCurrency } from '../../core/utils/NumberFormatting'\n\ninterface SaveAnExtraCardProps {\n primaryText?: string[]\n secondaryText?: string[]\n bgcolor?: string\n sx?: SxProps<Theme>\n}\n\nconst SaveAnExtraCard = ({\n primaryText = [],\n secondaryText = [],\n bgcolor = 'success.main',\n sx,\n}: SaveAnExtraCardProps) => {\n const [leadIn, amount, trailingCopy] = primaryText\n const [projected, projectedCaption] = secondaryText\n\n return (\n <Box\n sx={{\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: 2,\n\n overflow: 'hidden',\n ...sx,\n }}\n >\n {/* Green header */}\n <Box\n sx={{\n bgcolor,\n color: 'success.contrastText',\n p: 16,\n pt: 12,\n textAlign: 'center',\n }}\n >\n <P color=\"inherit\" variant=\"subtitle1\">\n {leadIn}\n </P>\n <Text bold={true} color=\"inherit\" variant=\"h1\">\n {formatCurrency(Number(amount ?? '0'), CURRENCY_FORMAT.cents)}\n </Text>\n {/* A block, as in Figma: inline, the caption sat on a text line 5px below the amount. */}\n <Text color=\"inherit\" sx={{ display: 'block' }} variant=\"caption\">\n {trailingCopy}\n </Text>\n </Box>\n\n {/* White footer with projected amount. The projected balance arrives\n pre-formatted from the backend (e.g. \"$3,320\"), so render it as-is. */}\n <Box\n sx={{\n bgcolor: 'background.paper',\n px: 16,\n py: 12,\n textAlign: 'center',\n }}\n >\n <Text variant=\"h3\">{projected}</Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {projectedCaption}\n </Text>\n </Box>\n </Box>\n )\n}\n\nexport default SaveAnExtraCard\n"],"mappings":";;;;AAcA,IAAM,IAAA,CAAmB,EACvB,aAAA,IAAc,CAAC,GACf,eAAA,IAAgB,CAAC,GACjB,SAAA,IAAU,gBACV,IAAA,EAAA,MAC0B;AAC1B,QAAM,CAAC,GAAQ,GAAQ,CAAA,IAAgB,GACjC,CAAC,GAAW,CAAA,IAAoB;AAEtC,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MAEd,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IARF,UAAA,CAWE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,SAAA;AAAA,QACA,OAAO;AAAA,QACP,GAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MAPF,UAAA;AAAA,QASE,gBAAA,EAAC,GAAD;AAAA,UAAG,OAAM;AAAA,UAAU,SAAQ;AAAA,UACxB,UAAA;AAAA,QACA,CAAA;AAAA,QACH,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,OAAM;AAAA,UAAU,SAAQ;AAAA,UACvC,UAAA,EAAe,OAAO,KAAU,GAAG,GAAG,EAAgB,KAAK;AAAA,QACxD,CAAA;AAAA,QAEN,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAU,IAAI,EAAE,SAAS,QAAQ;AAAA,UAAG,SAAQ;AAAA,UACrD,UAAA;AAAA,QACG,CAAA;AAAA,MACH;AAAA,IAIL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MANF,UAAA,CAQE,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAM,UAAA;AAAA,MAAgB,CAAA,GACpC,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,SAAQ;AAAA,QAClC,UAAA;AAAA,MACG,CAAA,CACH;AAAA,IACF,CAAA,CAAA;AAAA;AAET"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { formatDate as
|
|
2
|
-
import {
|
|
1
|
+
import { formatDate as h } from "../../core/constants/DateFormats.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as n, formatCurrency as d } from "../../core/utils/NumberFormatting.es.js";
|
|
3
3
|
import i from "@mui/material/Stack";
|
|
4
4
|
import { Text as o } from "@mxenabled/mxui";
|
|
5
5
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
import { parseISO as
|
|
7
|
-
import
|
|
8
|
-
var
|
|
6
|
+
import { parseISO as x } from "date-fns";
|
|
7
|
+
import u from "@mui/material/Divider";
|
|
8
|
+
var b = (r) => r === 0 ? d(0, n.cents) : `-${d(Math.abs(r), n.cents)}`, g = /^\d{4}-\d{2}-\d{2}$/, v = {
|
|
9
9
|
month: "long",
|
|
10
10
|
day: "numeric",
|
|
11
11
|
year: "numeric"
|
|
12
|
-
},
|
|
13
|
-
if (!r || !
|
|
14
|
-
const e =
|
|
15
|
-
return Number.isNaN(e.getTime()) ? r :
|
|
16
|
-
},
|
|
17
|
-
const m =
|
|
12
|
+
}, y = (r) => {
|
|
13
|
+
if (!r || !g.test(r)) return r;
|
|
14
|
+
const e = x(r);
|
|
15
|
+
return Number.isNaN(e.getTime()) ? r : h(e, v);
|
|
16
|
+
}, W = ({ amount: r, amountLabel: e, balance: f, balanceLabel: c, withdrawalDate: l, sx: p }) => {
|
|
17
|
+
const m = y(l), s = m ? [e, m].filter(Boolean).join(" ") : "";
|
|
18
18
|
return /* @__PURE__ */ a(i, {
|
|
19
19
|
sx: {
|
|
20
20
|
border: "1px solid",
|
|
@@ -22,7 +22,7 @@ var u = (r) => r === 0 ? n(0, "0,0.00") : `-${n(Math.abs(r), "0,0.00")}`, b = /^
|
|
|
22
22
|
borderRadius: "4px",
|
|
23
23
|
overflow: "hidden",
|
|
24
24
|
width: "100%",
|
|
25
|
-
...
|
|
25
|
+
...p
|
|
26
26
|
},
|
|
27
27
|
children: [
|
|
28
28
|
/* @__PURE__ */ a(i, {
|
|
@@ -33,14 +33,14 @@ var u = (r) => r === 0 ? n(0, "0,0.00") : `-${n(Math.abs(r), "0,0.00")}`, b = /^
|
|
|
33
33
|
},
|
|
34
34
|
children: [/* @__PURE__ */ t(o, {
|
|
35
35
|
variant: "h1",
|
|
36
|
-
children:
|
|
37
|
-
}),
|
|
36
|
+
children: b(r)
|
|
37
|
+
}), s && /* @__PURE__ */ t(o, {
|
|
38
38
|
color: "text.secondary",
|
|
39
39
|
variant: "caption",
|
|
40
|
-
children:
|
|
40
|
+
children: s
|
|
41
41
|
})]
|
|
42
42
|
}),
|
|
43
|
-
/* @__PURE__ */ t(
|
|
43
|
+
/* @__PURE__ */ t(u, {}),
|
|
44
44
|
/* @__PURE__ */ a(i, {
|
|
45
45
|
sx: {
|
|
46
46
|
alignItems: "center",
|
|
@@ -51,21 +51,21 @@ var u = (r) => r === 0 ? n(0, "0,0.00") : `-${n(Math.abs(r), "0,0.00")}`, b = /^
|
|
|
51
51
|
px: 16,
|
|
52
52
|
py: 2
|
|
53
53
|
},
|
|
54
|
-
children: [
|
|
54
|
+
children: [c && /* @__PURE__ */ t(o, {
|
|
55
55
|
color: "text.secondary",
|
|
56
56
|
variant: "caption",
|
|
57
|
-
children:
|
|
57
|
+
children: c
|
|
58
58
|
}), /* @__PURE__ */ t(o, {
|
|
59
59
|
bold: !0,
|
|
60
60
|
variant: "body2",
|
|
61
|
-
children:
|
|
61
|
+
children: d(f, n.cents)
|
|
62
62
|
})]
|
|
63
63
|
})
|
|
64
64
|
]
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
export {
|
|
68
|
-
|
|
68
|
+
W as default
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
//# sourceMappingURL=WithdrawalCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithdrawalCard.es.js","names":[],"sources":["../../../src/insights-v2/components/WithdrawalCard.tsx"],"sourcesContent":["import Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { parseISO } from 'date-fns'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatDate } from '../../core/constants'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\n// A withdrawal is a debit, so a non-zero amount is shown with a leading minus (\"-$100.00\"); zero is\n// shown unsigned (\"$0.00\"). The sign comes from the magnitude, so an amount that already arrives\n// negative does not render a double minus.\nconst formatWithdrawalAmount = (amount: number) =>\n amount === 0
|
|
1
|
+
{"version":3,"file":"WithdrawalCard.es.js","names":[],"sources":["../../../src/insights-v2/components/WithdrawalCard.tsx"],"sourcesContent":["import Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { parseISO } from 'date-fns'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatDate } from '../../core/constants'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../core/utils/NumberFormatting'\n\n// A withdrawal is a debit, so a non-zero amount is shown with a leading minus (\"-$100.00\"); zero is\n// shown unsigned (\"$0.00\"). The sign comes from the magnitude, so an amount that already arrives\n// negative does not render a double minus.\nconst formatWithdrawalAmount = (amount: number) =>\n amount === 0\n ? formatCurrency(0, CURRENCY_FORMAT.cents)\n : `-${formatCurrency(Math.abs(amount), CURRENCY_FORMAT.cents)}`\n\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\nconst WITHDRAWAL_DATE_FORMAT = { month: 'long', day: 'numeric', year: 'numeric' }\n\n// The bucket 1 slot sends the stored beat date as a calendar day (\"2026-10-05\"). parseISO reads a\n// date-only string as local midnight, so the viewer sees the day it names; new Date() would read UTC\n// midnight and show the day before west of UTC. A date that already arrives worded renders as sent,\n// and so does one that matches the shape but names no real day (\"2026-02-30\" parses to an Invalid\n// Date, which Intl cannot format) - the same guard Footer applies before formatting.\nconst formatWithdrawalDate = (value?: string) => {\n if (!value || !ISO_DATE.test(value)) return value\n\n const parsed = parseISO(value)\n\n return Number.isNaN(parsed.getTime()) ? value : formatDate(parsed, WITHDRAWAL_DATE_FORMAT)\n}\n\ninterface WithdrawalCardProps {\n /** Withdrawn amount as a plain number (e.g. `100`); the card adds the minus sign. */\n amount: number\n /** Pre-localized lead-in for the date line (e.g. \"Withdrawn on\"). */\n amountLabel?: string\n /** Account balance after the withdrawal, shown in the grey footer row. */\n balance: number\n /** Pre-localized footer label for the balance (e.g. \"Balance\"). */\n balanceLabel?: string\n /** Pre-localized withdrawal date (e.g. \"October 5, 2026\"). */\n withdrawalDate?: string\n sx?: SxProps\n}\n\n/**\n * A centered withdrawal highlight: the amount as a headline with a date line beneath it\n * (\"{amountLabel} {withdrawalDate}\"), over a grey footer row showing the balance. Labels arrive\n * localized from the backend; the card formats the two numbers (the amount gets a leading minus\n * unless it is zero) and an ISO `withdrawalDate` (as the calendar day it names). The date line is\n * hidden when `withdrawalDate` is empty.\n *\n * Figma: Withdrawal component block (Highlight Withdrawal). Scope is the Content section only.\n */\nconst WithdrawalCard = ({\n amount,\n amountLabel,\n balance,\n balanceLabel,\n withdrawalDate,\n sx,\n}: WithdrawalCardProps) => {\n const formattedDate = formatWithdrawalDate(withdrawalDate)\n const dateLine = formattedDate ? [amountLabel, formattedDate].filter(Boolean).join(' ') : ''\n\n return (\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '4px',\n overflow: 'hidden',\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', gap: 4, p: 16 }}>\n <Text variant=\"h1\">{formatWithdrawalAmount(amount)}</Text>\n {dateLine && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateLine}\n </Text>\n )}\n </Stack>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n {balanceLabel && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {balanceLabel}\n </Text>\n )}\n <Text bold={true} variant=\"body2\">\n {formatCurrency(balance, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n )\n}\n\nexport default WithdrawalCard\n"],"mappings":";;;;;;;AAcA,IAAM,IAAA,CAA0B,MAC9B,MAAW,IACP,EAAe,GAAG,EAAgB,KAAK,IACvC,IAAI,EAAe,KAAK,IAAI,CAAM,GAAG,EAAgB,KAAK,CAAA,IAE1D,IAAW,uBACX,IAAyB;AAAA,EAAE,OAAO;AAAA,EAAQ,KAAK;AAAA,EAAW,MAAM;AAAU,GAO1E,IAAA,CAAwB,MAAmB;AAC/C,MAAI,CAAC,KAAS,CAAC,EAAS,KAAK,CAAK,EAAG,QAAO;AAE5C,QAAM,IAAS,EAAS,CAAK;AAE7B,SAAO,OAAO,MAAM,EAAO,QAAQ,CAAC,IAAI,IAAQ,EAAW,GAAQ,CAAsB;AAC3F,GAyBM,IAAA,CAAkB,EACtB,QAAA,GACA,aAAA,GACA,SAAA,GACA,cAAA,GACA,gBAAA,GACA,IAAA,EAAA,MACyB;AACzB,QAAM,IAAgB,EAAqB,CAAc,GACnD,IAAW,IAAgB,CAAC,GAAa,CAAa,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,IAAI;AAE1F,S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