@mx-cartographer/experiences 9.7.89 → 9.7.90

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 CHANGED
@@ -1,3 +1,8 @@
1
+ ## [9.7.90] - 11-03-2026
2
+
3
+ - **FIXED** - Unexpected Subscription Payment design QA (WEC-2126), USP only: dark "Not subscribed" bar border and icon in `text.primary` (were black on black), status Undo 13/16, `warning_wash` row card at elevation/1 (`TransactionListCard elevated`, with the dark-mode tint), Subscription Status dialog at elevation/16 with 12/16 answer buttons and a 220px reasons dialog
4
+ - **ADDED** - `StatusSnackbar` `variant: 'strong'` (opt-in; Figma `<Snackbar>`: 600 tone, white text, elevation/16, 24px message, 15/20 action, 20px / 16px close frame), used by the Subscription Status modal; `shared/elevation.ts` (`ELEVATION_SHADOW`); the elevated row's dark tint is the theme's `overlays[1]` variable; `tests/utils/emotionRuleText` for nested emotion rules
5
+
1
6
  ## [9.7.89] - 11-03-2026
2
7
 
3
8
  - **ADDED** - Weekly New Merchants V3 on Insights 2.0 (WEC-2189): a flat-`series` `with_footer` variant on `transaction_block` (rows plus the `data.footer_text` / `data.footer_amount` "Total" summary, no in-card header — the week date range is the card subtitle) for the multiple case; the single case reuses the existing `no_header` variant, which renders the same. The block already renders N rows and the footer generically, so this is `layout.ts` config only; tupac fills the row array and the money-bag "Others" row via `$facts.transactions_series`. An `ICO-` row logo (the money-bag "Others" overflow) now renders as a rounded `chart.chart2` accent tile - background at 15% opacity with a full-colour glyph, per the MX accent-icon pattern and Figma - instead of a bare icon. Block tests for both variants, a `TransactionBlock` Storybook page, and a `WeeklyNewMerchantsV3` insight story (`no_header` single, `with_footer` multiple with the "Others" overflow row)
@@ -1,113 +1,119 @@
1
- import { useGlobalCopyStore as V, useGlobalStore as X, useInsightsV2Store as $ } from "../../common/context/hooks.es.js";
1
+ import { useGlobalCopyStore as z, useGlobalStore as X, useInsightsV2Store as $ } from "../../common/context/hooks.es.js";
2
2
  import { slot as d } from "../../core/types/Insights.es.js";
3
3
  import { formatCurrency as q } from "../../core/utils/NumberFormatting.es.js";
4
- import R from "../../common/components/dialog/Dialog.es.js";
4
+ import N from "../../common/components/dialog/Dialog.es.js";
5
5
  import { useBeatActions as Z } from "../beatActions.es.js";
6
6
  import { USER_RESPONSE as f, answerSubscription as J, repeatingTransactionOf as K, reportSubscriptionMarkedIncorrect as Q } from "../ctaActions/subscriptionAnswer.es.js";
7
7
  import Y from "../components/LogoFromGuid.es.js";
8
8
  import "../components/celebrationGradients.es.js";
9
- import rr from "../components/TransactionListCard.es.js";
10
- import { subscriptionFrequency as tr } from "../components/SubscriptionStatus/subscriptionFrequency.es.js";
11
- import er from "../components/shared/StatusSnackbar.es.js";
12
- import { getDynamicCtaBasedOnTriggers as or } from "./util.es.js";
13
- import { useEffect as sr, useRef as M, useState as T } from "react";
14
- import { observer as nr } from "mobx-react-lite";
9
+ import { ELEVATION_SHADOW as tt } from "../components/shared/elevation.es.js";
10
+ import rt from "../components/TransactionListCard.es.js";
11
+ import { subscriptionFrequency as ot } from "../components/SubscriptionStatus/subscriptionFrequency.es.js";
12
+ import et from "../components/shared/StatusSnackbar.es.js";
13
+ import { getDynamicCtaBasedOnTriggers as st } from "./util.es.js";
14
+ import { useEffect as it, useRef as R, useState as T } from "react";
15
+ import { observer as nt } from "mobx-react-lite";
15
16
  import B from "@mui/material/Stack";
16
- import { Text as ir } from "@mxenabled/mxui";
17
- import { Icon as ar } from "@mxenabled/mx-icons";
18
- import { Fragment as cr, jsx as e, jsxs as C } from "react/jsx-runtime";
19
- import lr from "@mui/material/Divider";
20
- import ur from "@mui/material/ButtonBase";
21
- var mr = 32, G = {
17
+ import { Text as at } from "@mxenabled/mxui";
18
+ import { Icon as ct } from "@mxenabled/mx-icons";
19
+ import { Fragment as lt, jsx as o, jsxs as x } from "react/jsx-runtime";
20
+ import ut from "@mui/material/Divider";
21
+ import mt from "@mui/material/ButtonBase";
22
+ var pt = 32, G = {
22
23
  backgroundColor: "background.paper",
23
- borderRadius: 1
24
+ borderRadius: 1,
25
+ boxShadow: tt[16]
24
26
  }, L = {
25
27
  "& .MuiDialog-paper": G,
26
- "& .MuiDialogContent-root": { p: 0 }
27
- }, pr = [
28
+ "& .MuiDialogContent-root": { p: 0 },
29
+ "& .MuiDialogContent-root ~ .MuiStack-root .MuiButton-root": {
30
+ px: 16,
31
+ py: 12
32
+ }
33
+ }, dt = [
28
34
  ["never_subscribed", f.NEVER_SUBSCRIBED],
29
35
  ["cancelled", f.CANCELLED],
30
36
  ["one_time_purchase", f.ONE_TIME_PURCHASE]
31
- ], t = (i) => typeof i == "string" && i.trim() ? i : void 0, Tr = nr(function({ beat: x }) {
32
- const P = X(), { insights_feed: _, recurring: F } = V(), { actionDrawer: W, closeActionDrawer: g } = $(), U = Z(), [E, b] = T("answers"), [o, a] = T(null), c = M(!1), y = M(!1), r = _?.subscription_status_modal, l = x.insights_payload, S = pr.flatMap(([s, m]) => {
33
- const p = t(r?.[s]);
37
+ ], r = (n) => typeof n == "string" && n.trim() ? n : void 0, Lt = nt(function({ beat: C }) {
38
+ const P = X(), { insights_feed: _, recurring: W } = z(), { actionDrawer: F, closeActionDrawer: g } = $(), H = Z(), [E, b] = T("answers"), [e, a] = T(null), c = R(!1), y = R(!1), t = _?.subscription_status_modal, l = C.insights_payload, S = dt.flatMap(([s, m]) => {
39
+ const p = r(t?.[s]);
34
40
  return p ? [{
35
41
  label: p,
36
42
  userResponse: m
37
43
  }] : [];
38
- }), D = !!t(r?.title) && !!t(r?.subscribed_answer) && !!t(r?.not_subscribed_answer) && S.length > 0, I = !!_ && !D;
39
- if (sr(() => {
40
- I && (console.warn("[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing."), g());
41
- }, [I, g]), !l || !r || !D) return null;
42
- const h = t(r.close_aria) ?? t(r.toast_close_aria) ?? t(_?.settings_menu?.close) ?? "", O = o && t(o.severity === "success" ? r.success_message : r.error_message), v = {
43
- beat: x,
44
+ }), D = !!r(t?.title) && !!r(t?.subscribed_answer) && !!r(t?.not_subscribed_answer) && S.length > 0, O = !!_ && !D;
45
+ if (it(() => {
46
+ O && (console.warn("[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing."), g());
47
+ }, [O, g]), !l || !t || !D) return null;
48
+ const h = r(t.close_aria) ?? r(t.toast_close_aria) ?? r(_?.settings_menu?.close) ?? "", I = e && r(e.severity === "success" ? t.success_message : t.error_message), v = {
49
+ beat: C,
44
50
  stores: P,
45
- hostActions: U
46
- }, u = or(W, l.primary_cta, l.secondary_cta, l.in_description_cta)?.drilldown_data ?? {}, k = d(u, "logo"), w = d(u, "primary_text"), N = d(u, "amount"), A = async (s) => {
51
+ hostActions: H
52
+ }, u = st(F, l.primary_cta, l.secondary_cta, l.in_description_cta)?.drilldown_data ?? {}, M = d(u, "logo"), A = d(u, "primary_text"), k = d(u, "amount"), w = async (s) => {
47
53
  if (!y.current) {
48
54
  y.current = !0, a(null), b("saving");
49
55
  try {
50
- await J(v, s), t(r.success_message) ? a({ severity: "success" }) : n();
56
+ await J(v, s), r(t.success_message) ? a({ severity: "success" }) : i();
51
57
  } catch {
52
- t(r.error_message) ? a({
58
+ r(t.error_message) ? a({
53
59
  severity: "error",
54
60
  retry: s
55
- }) : n();
61
+ }) : i();
56
62
  } finally {
57
63
  y.current = !1;
58
64
  }
59
65
  b("done");
60
66
  }
61
- }, n = () => {
67
+ }, i = () => {
62
68
  a(null), g();
63
- }, j = () => {
69
+ }, U = () => {
64
70
  c.current = !0, Q(v), b("reasons");
65
- }, H = () => {
66
- c.current = !0, A(f.CONFIRMED);
67
- }, z = () => {
71
+ }, j = () => {
72
+ c.current = !0, w(f.CONFIRMED);
73
+ }, V = () => {
68
74
  if (c.current) {
69
75
  c.current = !1;
70
76
  return;
71
77
  }
72
- n();
78
+ i();
73
79
  };
74
- return /* @__PURE__ */ C(cr, { children: [
75
- /* @__PURE__ */ e(R, {
80
+ return /* @__PURE__ */ x(lt, { children: [
81
+ /* @__PURE__ */ o(N, {
76
82
  copy: {
77
- title: r.title,
83
+ title: t.title,
78
84
  close_aria: h
79
85
  },
80
86
  fullWidth: !0,
81
87
  isOpen: E === "answers",
82
- onClose: z,
83
- onPrimaryAction: H,
84
- onSecondaryAction: j,
85
- primaryText: r.subscribed_answer,
86
- secondaryText: r.not_subscribed_answer,
88
+ onClose: V,
89
+ onPrimaryAction: j,
90
+ onSecondaryAction: U,
91
+ primaryText: t.subscribed_answer,
92
+ secondaryText: t.not_subscribed_answer,
87
93
  sx: L,
88
- children: typeof w == "string" && w && /* @__PURE__ */ e(rr, {
94
+ children: typeof A == "string" && A && /* @__PURE__ */ o(rt, {
89
95
  background: "linear-gradient(201deg, rgba(255, 170, 0, 0.25) 1.86%, rgba(255, 68, 0, 0.25) 101.54%)",
90
96
  elevated: !0,
91
97
  rows: [{
92
- amount: typeof N == "number" ? q(N, "0,0.00") : "",
93
- amountCaption: tr(F, K(v)),
94
- leading: k ? /* @__PURE__ */ e(Y, {
95
- logo: k,
96
- size: mr
98
+ amount: typeof k == "number" ? q(k, "0,0.00") : "",
99
+ amountCaption: ot(W, K(v)),
100
+ leading: M ? /* @__PURE__ */ o(Y, {
101
+ logo: M,
102
+ size: pt
97
103
  }) : void 0,
98
104
  subtitle: d(u, "secondary_text") ?? "",
99
- title: w
105
+ title: A
100
106
  }]
101
107
  })
102
108
  }),
103
- /* @__PURE__ */ e(R, {
109
+ /* @__PURE__ */ o(N, {
104
110
  copy: {
105
- title: r.title,
111
+ title: t.title,
106
112
  close_aria: h
107
113
  },
108
114
  fullWidth: !0,
109
115
  isOpen: E === "reasons",
110
- onClose: n,
116
+ onClose: i,
111
117
  showActions: !1,
112
118
  sx: {
113
119
  ...L,
@@ -116,9 +122,9 @@ var mr = 32, G = {
116
122
  pb: 16
117
123
  }
118
124
  },
119
- children: /* @__PURE__ */ e(B, { children: S.map(({ label: s, userResponse: m }, p) => /* @__PURE__ */ C(B, { children: [/* @__PURE__ */ C(ur, {
125
+ children: /* @__PURE__ */ o(B, { children: S.map(({ label: s, userResponse: m }, p) => /* @__PURE__ */ x(B, { children: [/* @__PURE__ */ x(mt, {
120
126
  onClick: () => {
121
- A(m);
127
+ w(m);
122
128
  },
123
129
  sx: {
124
130
  gap: 12,
@@ -129,33 +135,37 @@ var mr = 32, G = {
129
135
  textAlign: "left",
130
136
  width: "100%"
131
137
  },
132
- children: [/* @__PURE__ */ e(ir, {
138
+ children: [/* @__PURE__ */ o(at, {
133
139
  variant: "body1",
134
140
  children: s
135
- }), /* @__PURE__ */ e(ar, {
141
+ }), /* @__PURE__ */ o(ct, {
136
142
  "aria-hidden": !0,
137
143
  name: "chevron_right",
138
144
  size: 24,
139
145
  sx: { color: "action.active" }
140
146
  })]
141
- }), p < S.length - 1 && /* @__PURE__ */ e(lr, { sx: { ml: 24 } })] }, m)) })
147
+ }), p < S.length - 1 && /* @__PURE__ */ o(ut, { sx: {
148
+ ml: 24,
149
+ mt: "-1px"
150
+ } })] }, m)) })
142
151
  }),
143
- o && O && /* @__PURE__ */ e(er, {
144
- actionText: o.retry ? t(r.try_again) : void 0,
145
- closeAriaLabel: t(r.toast_close_aria) ?? h,
146
- message: O,
147
- onActionClick: o.retry ? () => {
148
- A(o.retry);
152
+ e && I && /* @__PURE__ */ o(et, {
153
+ actionText: e.retry ? r(t.try_again) : void 0,
154
+ closeAriaLabel: r(t.toast_close_aria) ?? h,
155
+ message: I,
156
+ onActionClick: e.retry ? () => {
157
+ w(e.retry);
149
158
  } : void 0,
150
- onClose: n,
159
+ onClose: i,
151
160
  open: !0,
152
- severity: o.severity
161
+ severity: e.severity,
162
+ variant: "strong"
153
163
  })
154
164
  ] });
155
165
  });
156
166
  export {
157
- Tr as SubscriptionStatusModalBlock,
158
- Tr as default
167
+ Lt as SubscriptionStatusModalBlock,
168
+ Lt as default
159
169
  };
160
170
 
161
171
  //# sourceMappingURL=SubscriptionStatusModalBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionStatusModalBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SubscriptionStatusModalBlock.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { slot } from '../../core'\nimport type { LogoRef } from '../../core'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\nimport { useBeatActions } from '../beatActions'\nimport { WARNING_WASH_GRADIENT } from '../components/celebrationGradients'\nimport LogoFromGuid from '../components/LogoFromGuid'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { subscriptionFrequency } from '../components/SubscriptionStatus/subscriptionFrequency'\nimport TransactionListCard from '../components/TransactionListCard'\nimport {\n answerSubscription,\n repeatingTransactionOf,\n reportSubscriptionMarkedIncorrect,\n USER_RESPONSE,\n} from '../ctaActions/subscriptionAnswer'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from './util'\n\nconst ROW_LOGO_SIZE = 32\n\n// White paper, full-bleed content, 4px radius.\nconst DIALOG_PAPER_SX = { backgroundColor: 'background.paper', borderRadius: 1 }\nconst SUBSCRIPTION_DIALOG_SX = {\n '& .MuiDialog-paper': DIALOG_PAPER_SX,\n '& .MuiDialogContent-root': { p: 0 },\n}\n\n// The reasons in Figma order; a reason with no word drops its row.\nconst REASONS = [\n ['never_subscribed', USER_RESPONSE.NEVER_SUBSCRIBED],\n ['cancelled', USER_RESPONSE.CANCELLED],\n ['one_time_purchase', USER_RESPONSE.ONE_TIME_PURCHASE],\n] as const\n\n/** A non-empty word, or undefined. */\nconst word = (value?: string): string | undefined =>\n typeof value === 'string' && value.trim() ? value : undefined\n\ntype Phase = 'answers' | 'reasons' | 'saving' | 'done'\ninterface Notice {\n severity: 'success' | 'error'\n retry?: string\n}\n\n/** Unexpected Subscription Payment's Subscription Status modal. */\nexport const SubscriptionStatusModalBlock = observer(function SubscriptionStatusModalBlock({\n beat,\n}: ActionBlockProps) {\n const stores = useGlobalStore()\n const { insights_feed, recurring } = useGlobalCopyStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const beatActions = useBeatActions()\n const [phase, setPhase] = useState<Phase>('answers')\n const [notice, setNotice] = useState<Notice | null>(null)\n // The Dialog calls onClose after its actions; keep the flow open.\n const actionTaken = useRef(false)\n // One save at a time: a double tap (a closing dialog is still clickable) or Try Again sends one PUT.\n const saving = useRef(false)\n\n const copy = insights_feed?.subscription_status_modal\n const payload = beat.insights_payload\n // Only the words needed to answer: the title, both answers and at least one reason. The rest\n // (snackbar words, close labels, reviewed_title, a key added later) never block the modal.\n const reasons = REASONS.flatMap(([key, userResponse]) => {\n const label = word(copy?.[key])\n\n return label ? [{ label, userResponse }] : []\n })\n const ready =\n !!word(copy?.title) &&\n !!word(copy?.subscribed_answer) &&\n !!word(copy?.not_subscribed_answer) &&\n reasons.length > 0\n // Copy loaded (insights_feed is there) but incomplete: say so and close, not a silent open drawer.\n const incomplete = !!insights_feed && !ready\n\n useEffect(() => {\n if (!incomplete) return\n console.warn(\n '[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing.',\n )\n closeActionDrawer()\n }, [incomplete, closeActionDrawer])\n\n if (!payload || !copy || !ready) return null\n\n const closeLabel =\n word(copy.close_aria) ??\n word(copy.toast_close_aria) ??\n word(insights_feed?.settings_menu?.close) ??\n ''\n const noticeMessage =\n notice && word(notice.severity === 'success' ? copy.success_message : copy.error_message)\n\n const ctx = { beat, stores, hostActions: beatActions }\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload.primary_cta,\n payload.secondary_cta,\n payload.in_description_cta,\n )\n const row = cta?.drilldown_data ?? {}\n const logo = slot<LogoRef>(row, 'logo')\n const title = slot<string>(row, 'primary_text')\n const amount = slot<number>(row, 'amount')\n\n const save = async (userResponse: string) => {\n if (saving.current) return\n saving.current = true\n setNotice(null)\n setPhase('saving')\n try {\n await answerSubscription(ctx, userResponse)\n // No snackbar word: the save stands, the flow just ends without the snackbar.\n if (word(copy.success_message)) setNotice({ severity: 'success' })\n else finish()\n } catch {\n if (word(copy.error_message)) setNotice({ severity: 'error', retry: userResponse })\n else finish()\n } finally {\n saving.current = false\n }\n setPhase('done')\n }\n\n const finish = () => {\n setNotice(null)\n closeActionDrawer()\n }\n\n const chooseNotSubscribed = () => {\n actionTaken.current = true\n reportSubscriptionMarkedIncorrect(ctx)\n setPhase('reasons')\n }\n\n const chooseSubscribed = () => {\n actionTaken.current = true\n void save(USER_RESPONSE.CONFIRMED)\n }\n\n const closeAnswers = () => {\n if (actionTaken.current) {\n actionTaken.current = false\n return\n }\n finish()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'answers'}\n onClose={closeAnswers}\n onPrimaryAction={chooseSubscribed}\n onSecondaryAction={chooseNotSubscribed}\n primaryText={copy.subscribed_answer}\n secondaryText={copy.not_subscribed_answer}\n // Full-bleed wash between title and actions.\n sx={SUBSCRIPTION_DIALOG_SX}\n >\n {typeof title === 'string' && title && (\n <TransactionListCard\n background={WARNING_WASH_GRADIENT}\n elevated={true}\n rows={[\n {\n amount: typeof amount === 'number' ? formatCurrency(amount, '0,0.00') : '',\n amountCaption: subscriptionFrequency(recurring, repeatingTransactionOf(ctx)),\n leading: logo ? <LogoFromGuid logo={logo} size={ROW_LOGO_SIZE} /> : undefined,\n subtitle: slot<string>(row, 'secondary_text') ?? '',\n title,\n },\n ]}\n />\n )}\n </Dialog>\n\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'reasons'}\n onClose={finish}\n showActions={false}\n // Space under the list.\n sx={{ ...SUBSCRIPTION_DIALOG_SX, '& .MuiDialog-paper': { ...DIALOG_PAPER_SX, pb: 16 } }}\n >\n <Stack>\n {reasons.map(({ label, userResponse }, index) => (\n <Stack key={userResponse}>\n <ButtonBase\n onClick={() => void save(userResponse)}\n sx={{\n gap: 12,\n justifyContent: 'space-between',\n minHeight: 44,\n px: 24,\n py: 8,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Text variant=\"body1\">{label}</Text>\n <Icon\n aria-hidden={true}\n name=\"chevron_right\"\n size={24}\n sx={{ color: 'action.active' }}\n />\n </ButtonBase>\n {/* Between rows only. */}\n {index < reasons.length - 1 && <Divider sx={{ ml: 24 }} />}\n </Stack>\n ))}\n </Stack>\n </Dialog>\n\n {notice && noticeMessage && (\n <StatusSnackbar\n actionText={notice.retry ? word(copy.try_again) : undefined}\n closeAriaLabel={word(copy.toast_close_aria) ?? closeLabel}\n message={noticeMessage}\n onActionClick={notice.retry ? () => void save(notice.retry as string) : undefined}\n onClose={finish}\n open={true}\n severity={notice.severity}\n />\n )}\n </>\n )\n})\n\nexport default SubscriptionStatusModalBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,IAAM,KAAgB,IAGhB,IAAkB;AAAA,EAAE,iBAAiB;AAAA,EAAoB,cAAc;AAAE,GACzE,IAAyB;AAAA,EAC7B,sBAAsB;AAAA,EACtB,4BAA4B,EAAE,GAAG,EAAE;AACrC,GAGM,KAAU;AAAA,EACd,CAAC,oBAAoB,EAAc,gBAAgB;AAAA,EACnD,CAAC,aAAa,EAAc,SAAS;AAAA,EACrC,CAAC,qBAAqB,EAAc,iBAAiB;AACvD,GAGM,IAAA,CAAQ,MACZ,OAAO,KAAU,YAAY,EAAM,KAAK,IAAI,IAAQ,QASzC,KAA+B,GAAS,SAAsC,EACzF,MAAA,EAAA,GACmB;AACnB,QAAM,IAAS,EAAe,GACxB,EAAE,eAAA,GAAe,WAAA,EAAA,IAAc,EAAmB,GAClD,EAAE,cAAA,GAAc,m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AQ,EAAQ,SAAS,KAAK,gBAAA,EAAC,IAAD,EAAS,IAAI,EAAE,IAAI,GAAG,EAAI,CAAA,CACpD,EAAA,GAvBK,CAuBL,CACR,EACI,CAAA;AAAA,IACD,CAAA;AAAA,IAEP,KAAU,KACT,gBAAA,EAAC,IAAD;AAAA,MACE,YAAY,EAAO,QAAQ,EAAK,EAAK,SAAS,IAAI;AAAA,MAClD,gBAAgB,EAAK,EAAK,gBAAgB,KAAK;AAAA,MAC/C,SAAS;AAAA,MACT,eAAe,EAAO,QAAA,MAAA;AAAc,QAAK,EAAK,EAAO,KAAe;AAAA,UAAI;AAAA,MACxE,SAAS;AAAA,MACT,MAAM;AAAA,MACN,UAAU,EAAO;AAAA,IAClB,CAAA;AAAA,EAEH,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"SubscriptionStatusModalBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SubscriptionStatusModalBlock.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { slot } from '../../core'\nimport type { LogoRef } from '../../core'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\nimport { useBeatActions } from '../beatActions'\nimport { WARNING_WASH_GRADIENT } from '../components/celebrationGradients'\nimport LogoFromGuid from '../components/LogoFromGuid'\nimport { ELEVATION_SHADOW } from '../components/shared/elevation'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { subscriptionFrequency } from '../components/SubscriptionStatus/subscriptionFrequency'\nimport TransactionListCard from '../components/TransactionListCard'\nimport {\n answerSubscription,\n repeatingTransactionOf,\n reportSubscriptionMarkedIncorrect,\n USER_RESPONSE,\n} from '../ctaActions/subscriptionAnswer'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from './util'\n\nconst ROW_LOGO_SIZE = 32\n\n// Figma dialog: paper, 4px radius, elevation/16.\nconst DIALOG_PAPER_SX = {\n backgroundColor: 'background.paper',\n borderRadius: 1,\n boxShadow: ELEVATION_SHADOW[16],\n}\nconst SUBSCRIPTION_DIALOG_SX = {\n '& .MuiDialog-paper': DIALOG_PAPER_SX,\n '& .MuiDialogContent-root': { p: 0 },\n '& .MuiDialogContent-root ~ .MuiStack-root .MuiButton-root': { px: 16, py: 12 },\n}\n\n// The reasons in Figma order; a reason with no word drops its row.\nconst REASONS = [\n ['never_subscribed', USER_RESPONSE.NEVER_SUBSCRIBED],\n ['cancelled', USER_RESPONSE.CANCELLED],\n ['one_time_purchase', USER_RESPONSE.ONE_TIME_PURCHASE],\n] as const\n\n/** A non-empty word, or undefined. */\nconst word = (value?: string): string | undefined =>\n typeof value === 'string' && value.trim() ? value : undefined\n\ntype Phase = 'answers' | 'reasons' | 'saving' | 'done'\ninterface Notice {\n severity: 'success' | 'error'\n retry?: string\n}\n\n/** Unexpected Subscription Payment's Subscription Status modal. */\nexport const SubscriptionStatusModalBlock = observer(function SubscriptionStatusModalBlock({\n beat,\n}: ActionBlockProps) {\n const stores = useGlobalStore()\n const { insights_feed, recurring } = useGlobalCopyStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const beatActions = useBeatActions()\n const [phase, setPhase] = useState<Phase>('answers')\n const [notice, setNotice] = useState<Notice | null>(null)\n // The Dialog calls onClose after its actions; keep the flow open.\n const actionTaken = useRef(false)\n // One save at a time: a double tap (a closing dialog is still clickable) or Try Again sends one PUT.\n const saving = useRef(false)\n\n const copy = insights_feed?.subscription_status_modal\n const payload = beat.insights_payload\n // Only the words needed to answer: the title, both answers and at least one reason. The rest\n // (snackbar words, close labels, reviewed_title, a key added later) never block the modal.\n const reasons = REASONS.flatMap(([key, userResponse]) => {\n const label = word(copy?.[key])\n\n return label ? [{ label, userResponse }] : []\n })\n const ready =\n !!word(copy?.title) &&\n !!word(copy?.subscribed_answer) &&\n !!word(copy?.not_subscribed_answer) &&\n reasons.length > 0\n // Copy loaded (insights_feed is there) but incomplete: say so and close, not a silent open drawer.\n const incomplete = !!insights_feed && !ready\n\n useEffect(() => {\n if (!incomplete) return\n console.warn(\n '[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing.',\n )\n closeActionDrawer()\n }, [incomplete, closeActionDrawer])\n\n if (!payload || !copy || !ready) return null\n\n const closeLabel =\n word(copy.close_aria) ??\n word(copy.toast_close_aria) ??\n word(insights_feed?.settings_menu?.close) ??\n ''\n const noticeMessage =\n notice && word(notice.severity === 'success' ? copy.success_message : copy.error_message)\n\n const ctx = { beat, stores, hostActions: beatActions }\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload.primary_cta,\n payload.secondary_cta,\n payload.in_description_cta,\n )\n const row = cta?.drilldown_data ?? {}\n const logo = slot<LogoRef>(row, 'logo')\n const title = slot<string>(row, 'primary_text')\n const amount = slot<number>(row, 'amount')\n\n const save = async (userResponse: string) => {\n if (saving.current) return\n saving.current = true\n setNotice(null)\n setPhase('saving')\n try {\n await answerSubscription(ctx, userResponse)\n // No snackbar word: the save stands, the flow just ends without the snackbar.\n if (word(copy.success_message)) setNotice({ severity: 'success' })\n else finish()\n } catch {\n if (word(copy.error_message)) setNotice({ severity: 'error', retry: userResponse })\n else finish()\n } finally {\n saving.current = false\n }\n setPhase('done')\n }\n\n const finish = () => {\n setNotice(null)\n closeActionDrawer()\n }\n\n const chooseNotSubscribed = () => {\n actionTaken.current = true\n reportSubscriptionMarkedIncorrect(ctx)\n setPhase('reasons')\n }\n\n const chooseSubscribed = () => {\n actionTaken.current = true\n void save(USER_RESPONSE.CONFIRMED)\n }\n\n const closeAnswers = () => {\n if (actionTaken.current) {\n actionTaken.current = false\n return\n }\n finish()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'answers'}\n onClose={closeAnswers}\n onPrimaryAction={chooseSubscribed}\n onSecondaryAction={chooseNotSubscribed}\n primaryText={copy.subscribed_answer}\n secondaryText={copy.not_subscribed_answer}\n // Full-bleed wash between title and actions.\n sx={SUBSCRIPTION_DIALOG_SX}\n >\n {typeof title === 'string' && title && (\n <TransactionListCard\n background={WARNING_WASH_GRADIENT}\n elevated={true}\n rows={[\n {\n amount: typeof amount === 'number' ? formatCurrency(amount, '0,0.00') : '',\n amountCaption: subscriptionFrequency(recurring, repeatingTransactionOf(ctx)),\n leading: logo ? <LogoFromGuid logo={logo} size={ROW_LOGO_SIZE} /> : undefined,\n subtitle: slot<string>(row, 'secondary_text') ?? '',\n title,\n },\n ]}\n />\n )}\n </Dialog>\n\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'reasons'}\n onClose={finish}\n showActions={false}\n // Space under the list.\n sx={{ ...SUBSCRIPTION_DIALOG_SX, '& .MuiDialog-paper': { ...DIALOG_PAPER_SX, pb: 16 } }}\n >\n <Stack>\n {reasons.map(({ label, userResponse }, index) => (\n <Stack key={userResponse}>\n <ButtonBase\n onClick={() => void save(userResponse)}\n sx={{\n gap: 12,\n justifyContent: 'space-between',\n minHeight: 44,\n px: 24,\n py: 8,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Text variant=\"body1\">{label}</Text>\n <Icon\n aria-hidden={true}\n name=\"chevron_right\"\n size={24}\n sx={{ color: 'action.active' }}\n />\n </ButtonBase>\n {/* Between rows only, drawn over the row edge (as Figma) so rows stay 44px apart. */}\n {index < reasons.length - 1 && <Divider sx={{ ml: 24, mt: '-1px' }} />}\n </Stack>\n ))}\n </Stack>\n </Dialog>\n\n {notice && noticeMessage && (\n <StatusSnackbar\n actionText={notice.retry ? word(copy.try_again) : undefined}\n closeAriaLabel={word(copy.toast_close_aria) ?? closeLabel}\n message={noticeMessage}\n onActionClick={notice.retry ? () => void save(notice.retry as string) : undefined}\n onClose={finish}\n open={true}\n severity={notice.severity}\n variant=\"strong\"\n />\n )}\n </>\n )\n})\n\nexport default SubscriptionStatusModalBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAgB,IAGhB,IAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,WAAW,GAAiB,EAAA;AAC9B,GACM,IAAyB;AAAA,EAC7B,sBAAsB;AAAA,EACtB,4BAA4B,EAAE,GAAG,EAAE;AAAA,EACnC,6DAA6D;AAAA,IAAE,IAAI;AAAA,IAAI,IAAI;AAAA,EAAG;AAChF,GAGM,KAAU;AAAA,EACd,CAAC,oBAAoB,EAAc,gBAAgB;AAAA,EACnD,CAAC,aAAa,EAAc,SAAS;AAAA,EACrC,CAAC,qBAAqB,EAAc,iBAAiB;AACvD,GAGM,IAAA,CAAQ,MACZ,OAAO,KAAU,YAAY,EAAM,KAAK,IAAI,IAAQ,QASzC,KAA+B,GAAS,SAAsC,EACzF,MAAA,EAAA,GACmB;AACnB,QAAM,IAAS,EAAe,GACxB,EAAE,eAAA,GAAe,WAAA,EAAA,IAAc,EAAmB,GAClD,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAmB,GACzD,IAAc,EAAe,GAC7B,CAAC,GAAO,CAAA,IAAY,EAAgB,SAAS,GAC7C,CAAC,GAAQ,CAAA,IAAa,EAAwB,IAAI,GAElD,IAAc,EAAO,EAAK,GAE1B,IAAS,EAAO,EAAK,GAErB,IAAO,GAAe,2BACtB,IAAU,EAAK,kBAGf,IAAU,GAAQ,QAAA,CAAS,CAAC,GAAK,CAAA,MAAkB;AACvD,UAAM,IAAQ,EAAK,IAAO,CAAA,CAAI;AAE9B,WAAO,IAAQ,CAAC;AAAA,MAAE,OAAA;AAAA,MAAO,cAAA;AAAA,IAAa,CAAC,IAAI,CAAC;AAAA,EAC9C,CAAC,GACK,I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T,MAAM;AAAA,MACN,UAAU,EAAO;AAAA,MACjB,SAAQ;AAAA,IACT,CAAA;AAAA,EAEH,EAAA,CAAA;AAEN,CAAC"}
@@ -1,25 +1,25 @@
1
- import { useCategoryStore as $, useGlobalCopyStore as j, useGlobalStore as q } from "../../../../common/context/hooks.es.js";
1
+ import { useCategoryStore as j, useGlobalCopyStore as q, useGlobalStore as D } from "../../../../common/context/hooks.es.js";
2
2
  import { slot as s } from "../../../../core/types/Insights.es.js";
3
3
  import { formatCurrency as v } from "../../../../core/utils/NumberFormatting.es.js";
4
4
  import { getCategoryColor as C } from "../../../../core/utils/CategoryUtil.es.js";
5
- import { useBeatActions as D } from "../../../beatActions.es.js";
6
- import { USER_RESPONSE as H, repeatingTransactionOf as P } from "../../../ctaActions/subscriptionAnswer.es.js";
7
- import { logoFromRef as V } from "../../../components/shared/EntityLogo.es.js";
8
- import U from "../../../components/LogoFromGuid.es.js";
9
- import { statusIconName as W, statusIconPalette as I } from "../../../components/statusIcon.es.js";
10
- import { resolveVariantConfig as Y } from "../../resolveVariantConfig.es.js";
11
- import J from "../../../components/TransactionListCard.es.js";
12
- import K from "../../../components/StatusMessageCard.es.js";
13
- import { subscriptionFrequency as Q } from "../../../components/SubscriptionStatus/subscriptionFrequency.es.js";
14
- import { getLayoutConfig as X, transactionBlockVariant as oo } from "./layout.es.js";
15
- import { observer as to } from "mobx-react-lite";
16
- import { CategoryIcon as ro, InstitutionLogo as eo, MerchantLogo as io } from "@mxenabled/mxui";
5
+ import { useBeatActions as H } from "../../../beatActions.es.js";
6
+ import { USER_RESPONSE as P, repeatingTransactionOf as V } from "../../../ctaActions/subscriptionAnswer.es.js";
7
+ import { logoFromRef as U } from "../../../components/shared/EntityLogo.es.js";
8
+ import W from "../../../components/LogoFromGuid.es.js";
9
+ import { statusIconName as Y, statusIconPalette as I } from "../../../components/statusIcon.es.js";
10
+ import { resolveVariantConfig as J } from "../../resolveVariantConfig.es.js";
11
+ import K from "../../../components/TransactionListCard.es.js";
12
+ import Q from "../../../components/StatusMessageCard.es.js";
13
+ import { subscriptionFrequency as X } from "../../../components/SubscriptionStatus/subscriptionFrequency.es.js";
14
+ import { getLayoutConfig as oo, transactionBlockVariant as to } from "./layout.es.js";
15
+ import { observer as ro } from "mobx-react-lite";
16
+ import { CategoryIcon as eo, InstitutionLogo as io, MerchantLogo as no } from "@mxenabled/mxui";
17
17
  import { Icon as T } from "@mxenabled/mx-icons";
18
18
  import { jsx as t } from "react/jsx-runtime";
19
- import { alpha as S, useTheme as no } from "@mui/material/styles";
19
+ import { alpha as S, useTheme as ao } from "@mui/material/styles";
20
20
  import d from "@mui/material/Box";
21
- var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon: a }) => {
22
- const i = W(a?.guid);
21
+ var u = 32, so = Math.round(u * 0.625), co = 24, G = 32, uo = 20, lo = ({ icon: a }) => {
22
+ const i = Y(a?.guid);
23
23
  return i ? /* @__PURE__ */ t(d, {
24
24
  "aria-hidden": !0,
25
25
  "data-icon": i,
@@ -36,12 +36,12 @@ var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon:
36
36
  children: /* @__PURE__ */ t(T, {
37
37
  fill: !0,
38
38
  name: i,
39
- size: co,
39
+ size: uo,
40
40
  sx: { color: `${I(a?.color)}.contrastText` }
41
41
  })
42
42
  }) : null;
43
- }, lo = (a, i, c, l) => {
44
- const o = V(a.logo, a.primary_text);
43
+ }, mo = (a, i, c, l) => {
44
+ const o = U(a.logo, a.primary_text);
45
45
  if (o) {
46
46
  if (o.logo_name) {
47
47
  const e = !!o.logo_fill, r = o.logo_color ?? c.palette.chart.chart2 ?? c.palette.primary.main;
@@ -59,18 +59,18 @@ var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon:
59
59
  },
60
60
  children: /* @__PURE__ */ t(T, {
61
61
  name: o.logo_name,
62
- size: ao,
62
+ size: so,
63
63
  sx: { color: e ? r : o.logo_color }
64
64
  })
65
65
  });
66
66
  }
67
- if (o.merchant_guid) return /* @__PURE__ */ t(io, {
67
+ if (o.merchant_guid) return /* @__PURE__ */ t(no, {
68
68
  alt: o.merchant_name ?? "",
69
69
  categoryGuid: o.category_guid ? i(o.category_guid) : "",
70
70
  merchantGuid: o.merchant_guid,
71
71
  size: u
72
72
  });
73
- if (o.institution_guid) return /* @__PURE__ */ t(eo, {
73
+ if (o.institution_guid) return /* @__PURE__ */ t(io, {
74
74
  alt: o.institution_name ?? "",
75
75
  institutionGuid: o.institution_guid,
76
76
  size: u
@@ -84,7 +84,7 @@ var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon:
84
84
  return /* @__PURE__ */ t(d, {
85
85
  "data-testid": `category-icon-${e}`,
86
86
  sx: { display: "flex" },
87
- children: /* @__PURE__ */ t(ro, {
87
+ children: /* @__PURE__ */ t(eo, {
88
88
  categoryGuid: e,
89
89
  size: u,
90
90
  sx: r
@@ -92,20 +92,20 @@ var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon:
92
92
  });
93
93
  }
94
94
  }
95
- }, Ro = to(({ payload: a }) => {
96
- const i = no(), { getTopLevelCategoryGuid: c } = $(), l = q(), { recurring: o } = j(), { beat: e } = D(), { data: r, variant: E } = a.instance_slot, { answeredBackground: p, background: m, cardVariant: B, followsSubscription: g, raised: L, showFooter: k, showFrequency: y, showHeader: O, statusMessage: R, sx: A, tintedCategoryLogo: w } = Y(X(i), E, oo.NoHeader, "TransactionBlock"), _ = (y || g) && e ? P({
95
+ }, Ao = ro(({ payload: a }) => {
96
+ const i = ao(), { getTopLevelCategoryGuid: c } = j(), l = D(), { recurring: o } = q(), { beat: e } = H(), { data: r, variant: E } = a.instance_slot, { answeredBackground: p, background: m, cardVariant: B, elevated: L, followsSubscription: g, raised: k, showFooter: O, showFrequency: y, showHeader: R, statusMessage: A, sx: w, tintedCategoryLogo: z } = J(oo(i), E, to.NoHeader, "TransactionBlock"), _ = (y || g) && e ? V({
97
97
  beat: e,
98
98
  stores: l
99
- }) : void 0, h = !!g && _?.user_response === H.CONFIRMED;
100
- if (R) {
99
+ }) : void 0, h = !!g && _?.user_response === P.CONFIRMED;
100
+ if (A) {
101
101
  const n = s(r, "message");
102
- return typeof n != "string" || !n.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ t(K, {
102
+ return typeof n != "string" || !n.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ t(Q, {
103
103
  icon: /* @__PURE__ */ t(d, {
104
104
  "aria-hidden": "true",
105
105
  sx: { display: "flex" },
106
- children: /* @__PURE__ */ t(U, {
106
+ children: /* @__PURE__ */ t(W, {
107
107
  logo: s(r, "icon"),
108
- size: so
108
+ size: co
109
109
  })
110
110
  }),
111
111
  message: n,
@@ -117,29 +117,30 @@ var u = 32, ao = Math.round(u * 0.625), so = 24, G = 32, co = 20, uo = ({ icon:
117
117
  }
118
118
  const f = s(r, "series"), x = s(r, "header_text");
119
119
  if (!Array.isArray(f) || !f.length) return null;
120
- const z = O && typeof x == "string" ? x : void 0, b = s(r, "footer_text"), F = s(r, "footer_amount"), N = k && typeof b == "string" ? {
120
+ const F = R && typeof x == "string" ? x : void 0, b = s(r, "footer_text"), N = s(r, "footer_amount"), M = O && typeof b == "string" ? {
121
121
  label: b,
122
- amount: v(F, "0,0.00")
123
- } : void 0, M = y ? Q(o, _) : void 0, Z = g ? /* @__PURE__ */ t(uo, { icon: s(r, h ? "reviewed_icon" : "icon") }) : void 0;
124
- return /* @__PURE__ */ t(J, {
122
+ amount: v(N, "0,0.00")
123
+ } : void 0, Z = y ? X(o, _) : void 0, $ = g ? /* @__PURE__ */ t(lo, { icon: s(r, h ? "reviewed_icon" : "icon") }) : void 0;
124
+ return /* @__PURE__ */ t(K, {
125
125
  background: h && p ? p : m,
126
- badge: Z,
127
- footer: N,
128
- header: z,
129
- raised: L,
130
- sx: A,
126
+ badge: $,
127
+ elevated: L,
128
+ footer: M,
129
+ header: F,
130
+ raised: k,
131
+ sx: w,
131
132
  variant: B,
132
133
  rows: f.map((n) => ({
133
134
  amount: typeof n.amount == "number" ? v(n.amount, "0,0.00") : "",
134
- amountCaption: M,
135
- leading: lo(n, c, i, w ?? !1),
135
+ amountCaption: Z,
136
+ leading: mo(n, c, i, z ?? !1),
136
137
  subtitle: n.secondary_text ?? "",
137
138
  title: n.primary_text ?? ""
138
139
  }))
139
140
  });
140
141
  });
141
142
  export {
142
- Ro as TransactionBlock
143
+ Ao as TransactionBlock
143
144
  };
144
145
 
145
146
  //# sourceMappingURL=TransactionBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\nimport type { Theme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { statusIconName, statusIconPalette } from '../../../components/statusIcon'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf, USER_RESPONSE } from '../../../ctaActions/subscriptionAnswer'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 24\n// Status badge: palette disc, contrastText glyph.\nconst BADGE_SIZE = 32\nconst BADGE_GLYPH_SIZE = 20\n\n/** Status disc from `data.icon` / `data.reviewed_icon`. */\nconst SubscriptionBadge = ({ icon }: { icon?: LogoRef }) => {\n const name = statusIconName(icon?.guid)\n\n if (!name) return null\n\n return (\n <Box\n aria-hidden={true}\n data-icon={name}\n data-testid=\"subscription-badge\"\n sx={{\n alignItems: 'center',\n bgcolor: `${statusIconPalette(icon?.color)}.main`,\n borderRadius: '50%',\n display: 'flex',\n height: BADGE_SIZE,\n justifyContent: 'center',\n width: BADGE_SIZE,\n }}\n >\n <Icon\n fill={true}\n name={name}\n size={BADGE_GLYPH_SIZE}\n sx={{ color: `${statusIconPalette(icon?.color)}.contrastText` }}\n />\n </Box>\n )\n}\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That resolution applies both to a\n * `CAT-` row logo and to a merchant's `fallback_guid`. The tinted/bordered tile is opt-in per variant\n * (`tintedCategoryLogo`) and only styles the `CAT-` row branch; a merchant's `fallback_guid` is drawn\n * by `MerchantLogo`'s own untinted `CategoryIcon` fallback when the merchant image fails to load.\n */\nconst renderRowLogo = (\n row: InstanceSlotRow,\n resolveTopLevelCategory: (guid: string) => string,\n theme: Theme,\n tintedCategoryLogo: boolean,\n) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A `{ icon, color }` status logo (e.g. an overdraft warning) renders as a bare coloured glyph.\n // An ICO- fill logo (the Weekly New Merchants \"Others\" row - `logo_fill` is set for ICO- refs\n // only, in EntityLogo) renders as an accent tile: per the MX accent-icon pattern the background is\n // the tile colour at 15% opacity and the glyph is the full tile colour (Figma). The tile colour is\n // the logo's own colour when it carries one, else chart-2 - so tile and glyph always match.\n const accentTile = !!logo.logo_fill\n const tileColor = logo.logo_color ?? theme.palette.chart.chart2 ?? theme.palette.primary.main\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n ...(accentTile && {\n bgcolor: alpha(tileColor, 0.15),\n borderRadius: '8px',\n }),\n }}\n >\n <Icon\n name={logo.logo_name}\n size={ROW_ICON_SIZE}\n sx={{ color: accentTile ? tileColor : logo.logo_color }}\n />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n // When the variant opts in (`tintedCategoryLogo`), the tile is the Budget-style accent: the\n // category colour at 15% opacity, a 1px category-colour border, and a `text.primary` glyph\n // (Figma - Replenish Savings' multi-account Transfer row). Otherwise mxui's default tile, so other\n // beats' category logos are unchanged.\n const tintSx = tintedCategoryLogo\n ? {\n bgcolor: alpha(getCategoryColor(topLevelGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(topLevelGuid, theme)}`,\n color: 'text.primary',\n }\n : undefined\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} sx={tintSx} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\", Weekly New Merchants' \"Total\")\n * renders when the variant's `showFooter` config is set (`with_header_footer`, `with_footer`), from\n * `data.footer_text` with `data.footer_amount` beside it, formatted like the row amounts (the\n * contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const {\n answeredBackground,\n background,\n cardVariant,\n followsSubscription,\n raised,\n showFooter,\n showFrequency,\n showHeader,\n statusMessage,\n sx,\n tintedCategoryLogo,\n } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n // The live repeating transaction (read-only), for the frequency and the badge / answered wash.\n const repeating =\n (showFrequency || followsSubscription) && beat\n ? repeatingTransactionOf({ beat, stores })\n : undefined\n const subscribed = !!followsSubscription && repeating?.user_response === USER_RESPONSE.CONFIRMED\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n // The 20% wash layers over paper, as Figma's slot does.\n sx={background ? { backgroundImage: background, bgcolor: 'background.paper' } : undefined}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer =\n showFooter && typeof footerText === 'string'\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency = showFrequency ? subscriptionFrequency(recurringCopy, repeating) : undefined\n const badge = followsSubscription ? (\n <SubscriptionBadge icon={slot<LogoRef>(data, subscribed ? 'reviewed_icon' : 'icon')} />\n ) : undefined\n\n return (\n <TransactionListCard\n background={subscribed && answeredBackground ? answeredBackground : background}\n badge={badge}\n footer={footer}\n header={header}\n raised={raised}\n sx={sx}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid, theme, tintedCatego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,QAGA,IAAY,IAAgB,EAAsB,GAAe,CAAS,IAAI,QAC9E,IAAQ,IACZ,gBAAA,EAAC,IAAD,EAAmB,MAAM,EAAc,GAAM,IAAa,kBAAkB,MAAM,EAAI,CAAA,IACpF;AAEJ,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,YAAY,KAAc,IAAqB,IAAqB;AAAA,IAC7D,OAAA;AAAA,IACC,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACJ,IAAA;AAAA,IACJ,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,eAAe;AAAA,MACf,SAAS,GAAc,GAAK,GAAyB,GAAO,KAAsB,EAAK;AAAA,MACvF,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\nimport type { Theme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { statusIconName, statusIconPalette } from '../../../components/statusIcon'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf, USER_RESPONSE } from '../../../ctaActions/subscriptionAnswer'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 24\n// Status badge: palette disc, contrastText glyph.\nconst BADGE_SIZE = 32\nconst BADGE_GLYPH_SIZE = 20\n\n/** Status disc from `data.icon` / `data.reviewed_icon`. */\nconst SubscriptionBadge = ({ icon }: { icon?: LogoRef }) => {\n const name = statusIconName(icon?.guid)\n\n if (!name) return null\n\n return (\n <Box\n aria-hidden={true}\n data-icon={name}\n data-testid=\"subscription-badge\"\n sx={{\n alignItems: 'center',\n bgcolor: `${statusIconPalette(icon?.color)}.main`,\n borderRadius: '50%',\n display: 'flex',\n height: BADGE_SIZE,\n justifyContent: 'center',\n width: BADGE_SIZE,\n }}\n >\n <Icon\n fill={true}\n name={name}\n size={BADGE_GLYPH_SIZE}\n sx={{ color: `${statusIconPalette(icon?.color)}.contrastText` }}\n />\n </Box>\n )\n}\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That resolution applies both to a\n * `CAT-` row logo and to a merchant's `fallback_guid`. The tinted/bordered tile is opt-in per variant\n * (`tintedCategoryLogo`) and only styles the `CAT-` row branch; a merchant's `fallback_guid` is drawn\n * by `MerchantLogo`'s own untinted `CategoryIcon` fallback when the merchant image fails to load.\n */\nconst renderRowLogo = (\n row: InstanceSlotRow,\n resolveTopLevelCategory: (guid: string) => string,\n theme: Theme,\n tintedCategoryLogo: boolean,\n) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A `{ icon, color }` status logo (e.g. an overdraft warning) renders as a bare coloured glyph.\n // An ICO- fill logo (the Weekly New Merchants \"Others\" row - `logo_fill` is set for ICO- refs\n // only, in EntityLogo) renders as an accent tile: per the MX accent-icon pattern the background is\n // the tile colour at 15% opacity and the glyph is the full tile colour (Figma). The tile colour is\n // the logo's own colour when it carries one, else chart-2 - so tile and glyph always match.\n const accentTile = !!logo.logo_fill\n const tileColor = logo.logo_color ?? theme.palette.chart.chart2 ?? theme.palette.primary.main\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n ...(accentTile && {\n bgcolor: alpha(tileColor, 0.15),\n borderRadius: '8px',\n }),\n }}\n >\n <Icon\n name={logo.logo_name}\n size={ROW_ICON_SIZE}\n sx={{ color: accentTile ? tileColor : logo.logo_color }}\n />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n // When the variant opts in (`tintedCategoryLogo`), the tile is the Budget-style accent: the\n // category colour at 15% opacity, a 1px category-colour border, and a `text.primary` glyph\n // (Figma - Replenish Savings' multi-account Transfer row). Otherwise mxui's default tile, so other\n // beats' category logos are unchanged.\n const tintSx = tintedCategoryLogo\n ? {\n bgcolor: alpha(getCategoryColor(topLevelGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(topLevelGuid, theme)}`,\n color: 'text.primary',\n }\n : undefined\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} sx={tintSx} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\", Weekly New Merchants' \"Total\")\n * renders when the variant's `showFooter` config is set (`with_header_footer`, `with_footer`), from\n * `data.footer_text` with `data.footer_amount` beside it, formatted like the row amounts (the\n * contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const {\n answeredBackground,\n background,\n cardVariant,\n elevated,\n followsSubscription,\n raised,\n showFooter,\n showFrequency,\n showHeader,\n statusMessage,\n sx,\n tintedCategoryLogo,\n } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n // The live repeating transaction (read-only), for the frequency and the badge / answered wash.\n const repeating =\n (showFrequency || followsSubscription) && beat\n ? repeatingTransactionOf({ beat, stores })\n : undefined\n const subscribed = !!followsSubscription && repeating?.user_response === USER_RESPONSE.CONFIRMED\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n // The 20% wash layers over paper, as Figma's slot does.\n sx={background ? { backgroundImage: background, bgcolor: 'background.paper' } : undefined}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer =\n showFooter && typeof footerText === 'string'\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency = showFrequency ? subscriptionFrequency(recurringCopy, repeating) : undefined\n const badge = followsSubscription ? (\n <SubscriptionBadge icon={slot<LogoRef>(data, subscribed ? 'reviewed_icon' : 'icon')} />\n ) : undefined\n\n return (\n <TransactionListCard\n background={subscribed && answeredBackground ? answeredBackground : background}\n badge={badge}\n elevated={elevated}\n footer={footer}\n header={header}\n raised={raised}\n sx={sx}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid, theme, tintedCategoryLogo ?? false),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,IAAgB,IAEhB,KAAgB,KAAK,MAAM,IAAgB,KAAK,GAChD,KAAmB,IAEnB,IAAa,IACb,KAAmB,IAGnB,KAAA,CAAqB,EAAE,MAAA,EAAA,MAA+B;AAC1D,QAAM,IAAO,EAAe,GAAM,IAAI;AAEtC,SAAK,IAGH,gBAAA,EAAC,GAAD;AAAA,IACE,eAAa;AAAA,IACb,aAAW;AAAA,IACX,eAAY;AAAA,IACZ,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,SAAS,GAAG,EAAkB,GAAM,KAAK,CAAA;AAAA,MACzC,cAAc;AAAA,MACd,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACA,MAAA;AAAA,MACN,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,GAAG,EAAkB,GAAM,KAAK,CAAA,gBAAiB;AAAA,IAC/D,CAAA;AAAA,EACE,CAAA,IAvBW;AAyBpB,GAcM,KAAA,CACJ,GACA,GACA,GACA,MACG;AACH,QAAM,IAAO,EAAY,EAAI,MAAM,EAAI,YAAY;AAEnD,MAAK,GAEL;AAAA,QAAI,EAAK,WAAW;AAMlB,YAAM,IAAa,CAAC,CAAC,EAAK,WACpB,IAAY,EAAK,cAAc,EAAM,QAAQ,MAAM,UAAU,EAAM,QAAQ,QAAQ;AACzF,a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AO,OAAQ,QAAO;AAErD,QAAM,IAAS,KAAc,OAAO,KAAe,WAAW,IAAa,QAErE,IAAa,EAAa,GAAM,aAAa,GAC7C,IAAe,EAAa,GAAM,eAAe,GACjD,IACJ,KAAc,OAAO,KAAe,WAChC;AAAA,IACE,OAAO;AAAA,IACP,QAAQ,EAAe,GAAc,QAAQ;AAAA,EAC/C,IACA,QAGA,IAAY,IAAgB,EAAsB,GAAe,CAAS,IAAI,QAC9E,IAAQ,IACZ,gBAAA,EAAC,IAAD,EAAmB,MAAM,EAAc,GAAM,IAAa,kBAAkB,MAAM,EAAI,CAAA,IACpF;AAEJ,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,YAAY,KAAc,IAAqB,IAAqB;AAAA,IAC7D,OAAA;AAAA,IACG,UAAA;AAAA,IACF,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACJ,IAAA;AAAA,IACJ,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,eAAe;AAAA,MACf,SAAS,GAAc,GAAK,GAAyB,GAAO,KAAsB,EAAK;AAAA,MACvF,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
@@ -43,6 +43,8 @@ export interface TransactionLayoutConfig {
43
43
  followsSubscription?: boolean;
44
44
  /** Wash once subscribed. */
45
45
  answeredBackground?: string;
46
+ /** Row card at `elevation/1` (needs `background`). */
47
+ elevated?: boolean;
46
48
  /** Slot padding override (CSS shorthand). */
47
49
  sx?: SxProps;
48
50
  /** Border and shadow on the row card. */
@@ -1,4 +1,4 @@
1
- import { WARM_LIME_ACCENT_GRADIENT as a, WARNING_WASH_GRADIENT as o, getPrimaryWashGradient as t } from "../../../components/celebrationGradients.es.js";
1
+ import { WARM_LIME_ACCENT_GRADIENT as a, WARNING_WASH_GRADIENT as t, getPrimaryWashGradient as o } from "../../../components/celebrationGradients.es.js";
2
2
  var e = {
3
3
  WithHeader: "with_header",
4
4
  WithHeaderFooter: "with_header_footer",
@@ -28,16 +28,17 @@ var e = {
28
28
  },
29
29
  [e.InfoWash]: {
30
30
  showHeader: !1,
31
- background: t(r),
31
+ background: o(r),
32
32
  raised: !0,
33
33
  showFrequency: !0
34
34
  },
35
35
  [e.WarningWash]: {
36
36
  showHeader: !1,
37
- background: o,
37
+ background: t,
38
38
  showFrequency: !0,
39
39
  followsSubscription: !0,
40
40
  answeredBackground: a,
41
+ elevated: !0,
41
42
  sx: { p: "28px 24px 24px 32px" }
42
43
  },
43
44
  [e.StatusMessage]: {
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport {\n WARM_LIME_ACCENT_GRADIENT,\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — raised row (border + shadow) on the blue slot wash, with the\n * subscription's live frequency under the amount (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n WithHeaderFooter: 'with_header_footer',\n NoHeader: 'no_header',\n // A multi-row list with no in-card header plus a \"Total\" summary row (Weekly New Merchants; the\n // date range is the card subtitle). The plain no-footer list reuses `NoHeader`.\n WithFooter: 'with_footer',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */\n showFooter?: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card renders borderless unless `raised`. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n /** Caption each amount with the beat's live repeating transaction frequency. */\n showFrequency?: boolean\n /** Status badge and answered wash from the live repeating transaction. */\n followsSubscription?: boolean\n /** Wash once subscribed. */\n answeredBackground?: string\n /** Slot padding override (CSS shorthand). */\n sx?: SxProps\n /** Border and shadow on the row card. */\n raised?: boolean\n /**\n * Tint a `CAT-` row logo as the Budget-style accent tile (category colour at 15% opacity, a 1px\n * category-colour border, a `text.primary` glyph) instead of mxui's default. Opt-in per variant so\n * it stays scoped to the beats that want it (Replenish Savings' multi-account Transfer row), not\n * every `transaction_block` consumer.\n */\n tintedCategoryLogo?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n // `with_header` is Replenish Savings' multi-account card: its one summary row is a `CAT-` Transfer\n // logo, which we tint. (Other `with_header` beats, e.g. Large Transaction, use a merchant logo, so\n // the `CAT-` tint path never runs for them.)\n [transactionBlockVariant.WithHeader]: { showHeader: true, tintedCategoryLogo: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.WithFooter]: { showHeader: false, showFooter: true },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n raised: true,\n showFrequency: true,\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n showFrequency: true,\n followsSubscription: true,\n answeredBackground: WARM_LIME_ACCENT_GRADIENT,\n // Room for the badge.\n sx: { p: '28px 24px 24px 32px' },\n },\n // Figma 1941:207336: the banner sits on the warm-to-lime slot wash.\n [transactionBlockVariant.StatusMessage]: {\n showHeader: false,\n statusMessage: true,\n background: WARM_LIME_ACCENT_GRADIENT,\n },\n})\n"],"mappings":";AAwBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EAGV,YAAY;AAAA,EACZ,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAoCa,IAAA,CACX,OAC8D;AAAA,EAI7D,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAM,oBAAoB;AAAA,EAAK;AAAA,EAClF,CAAA,EAAwB,gBAAA,GAAmB;AAAA,IAAE,YAAY;AAAA,IAAM,YAAY;AAAA,EAAK;AAAA,EAChF,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAO,YAAY;AAAA,EAAK;AAAA,EAC3E,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,IACxC,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,qBAAqB;AAAA,IACrB,oBAAoB;AAAA,IAEpB,IAAI,EAAE,GAAG,sBAAsB;AAAA,EACjC;AAAA,EAEC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IACvC,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,YAAY;AAAA,EACd;AACF"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport {\n WARM_LIME_ACCENT_GRADIENT,\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — raised row (border + shadow) on the blue slot wash, with the\n * subscription's live frequency under the amount (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n WithHeaderFooter: 'with_header_footer',\n NoHeader: 'no_header',\n // A multi-row list with no in-card header plus a \"Total\" summary row (Weekly New Merchants; the\n // date range is the card subtitle). The plain no-footer list reuses `NoHeader`.\n WithFooter: 'with_footer',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */\n showFooter?: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card renders borderless unless `raised`. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n /** Caption each amount with the beat's live repeating transaction frequency. */\n showFrequency?: boolean\n /** Status badge and answered wash from the live repeating transaction. */\n followsSubscription?: boolean\n /** Wash once subscribed. */\n answeredBackground?: string\n /** Row card at `elevation/1` (needs `background`). */\n elevated?: boolean\n /** Slot padding override (CSS shorthand). */\n sx?: SxProps\n /** Border and shadow on the row card. */\n raised?: boolean\n /**\n * Tint a `CAT-` row logo as the Budget-style accent tile (category colour at 15% opacity, a 1px\n * category-colour border, a `text.primary` glyph) instead of mxui's default. Opt-in per variant so\n * it stays scoped to the beats that want it (Replenish Savings' multi-account Transfer row), not\n * every `transaction_block` consumer.\n */\n tintedCategoryLogo?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n // `with_header` is Replenish Savings' multi-account card: its one summary row is a `CAT-` Transfer\n // logo, which we tint. (Other `with_header` beats, e.g. Large Transaction, use a merchant logo, so\n // the `CAT-` tint path never runs for them.)\n [transactionBlockVariant.WithHeader]: { showHeader: true, tintedCategoryLogo: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.WithFooter]: { showHeader: false, showFooter: true },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n raised: true,\n showFrequency: true,\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n showFrequency: true,\n followsSubscription: true,\n answeredBackground: WARM_LIME_ACCENT_GRADIENT,\n elevated: true,\n // Room for the badge.\n sx: { p: '28px 24px 24px 32px' },\n },\n // Figma 1941:207336: the banner sits on the warm-to-lime slot wash.\n [transactionBlockVariant.StatusMessage]: {\n showHeader: false,\n statusMessage: true,\n background: WARM_LIME_ACCENT_GRADIENT,\n },\n})\n"],"mappings":";AAwBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EAGV,YAAY;AAAA,EACZ,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAsCa,IAAA,CACX,OAC8D;AAAA,EAI7D,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAM,oBAAoB;AAAA,EAAK;AAAA,EAClF,CAAA,EAAwB,gBAAA,GAAmB;AAAA,IAAE,YAAY;AAAA,IAAM,YAAY;AAAA,EAAK;AAAA,EAChF,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAO,YAAY;AAAA,EAAK;AAAA,EAC3E,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,IACxC,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,qBAAqB;AAAA,IACrB,oBAAoB;AAAA,IACpB,UAAU;AAAA,IAEV,IAAI,EAAE,GAAG,sBAAsB;AAAA,EACjC;AAAA,EAEC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IACvC,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,YAAY;AAAA,EACd;AACF"}
@@ -34,7 +34,7 @@ interface TransactionListCardProps {
34
34
  background?: string;
35
35
  /** Status disc over the card's corner (needs `background`). */
36
36
  badge?: ReactNode;
37
- /** Card shadow on the wash. */
37
+ /** Card at elevation/1 on the wash; not with `raised` (its shadow wins). */
38
38
  elevated?: boolean;
39
39
  /** Border and shadow on the inner card; only with `background` (Figma Transaction Row). */
40
40
  raised?: boolean;
@@ -1,11 +1,12 @@
1
1
  import k from "./InsightTransactionRow.es.js";
2
+ import { ELEVATION_SHADOW as I } from "./shared/elevation.es.js";
2
3
  import { Fragment as T } from "react";
3
4
  import i from "@mui/material/Stack";
4
- import { Text as h } from "@mxenabled/mxui";
5
- import { Fragment as b, jsx as r, jsxs as d } from "react/jsx-runtime";
6
- import f from "@mui/material/Box";
7
- import m from "@mui/material/Divider";
8
- var I = (n) => n === "primary" ? {
5
+ import { Text as m } from "@mxenabled/mxui";
6
+ import { Fragment as f, jsx as r, jsxs as a } from "react/jsx-runtime";
7
+ import g from "@mui/material/Box";
8
+ import u from "@mui/material/Divider";
9
+ var S = (n) => n === "primary" ? {
9
10
  radius: "8px",
10
11
  borderColor: "primary.main",
11
12
  headerBg: "primary.main",
@@ -29,21 +30,21 @@ var I = (n) => n === "primary" ? {
29
30
  px: 16,
30
31
  py: 2
31
32
  }
32
- }, V = ({ background: n, badge: c, elevated: g = !1, footer: l, header: a, raised: B = !1, rows: u, variant: y = "default", sx: C }) => {
33
- if (u.length === 0) return null;
34
- const e = I(y), o = !!n, t = o ? "8px" : e.radius, s = !!a && !o && e.headerInsideBorder, p = a ? /* @__PURE__ */ r(i, {
33
+ }, V = ({ background: n, badge: c, elevated: B = !1, footer: l, header: d, raised: y = !1, rows: x, variant: v = "default", sx: C }) => {
34
+ if (x.length === 0) return null;
35
+ const e = S(v), o = !!n, t = o ? "8px" : e.radius, s = !!d && !o && e.headerInsideBorder, p = d ? /* @__PURE__ */ r(i, {
35
36
  sx: {
36
37
  bgcolor: e.headerBg,
37
38
  justifyContent: "center",
38
39
  ...e.headerSx
39
40
  },
40
- children: /* @__PURE__ */ r(h, {
41
+ children: /* @__PURE__ */ r(m, {
41
42
  bold: e.headerBold,
42
43
  color: e.headerColor,
43
44
  variant: "caption",
44
- children: a
45
+ children: d
45
46
  })
46
- }) : null, v = l ? /* @__PURE__ */ d(b, { children: [/* @__PURE__ */ r(m, {}), /* @__PURE__ */ d(i, {
47
+ }) : null, w = l ? /* @__PURE__ */ a(f, { children: [/* @__PURE__ */ r(u, {}), /* @__PURE__ */ a(i, {
47
48
  sx: {
48
49
  alignItems: "center",
49
50
  bgcolor: o ? "background.paper" : "background.default",
@@ -53,25 +54,25 @@ var I = (n) => n === "primary" ? {
53
54
  px: 16,
54
55
  py: 2
55
56
  },
56
- children: [/* @__PURE__ */ r(h, {
57
+ children: [/* @__PURE__ */ r(m, {
57
58
  color: "text.secondary",
58
59
  variant: "caption",
59
60
  children: l.label
60
- }), /* @__PURE__ */ r(h, {
61
+ }), /* @__PURE__ */ r(m, {
61
62
  bold: !0,
62
63
  color: l.amountColor ?? "text.primary",
63
64
  variant: "body2",
64
65
  children: l.amount
65
66
  })]
66
- })] }) : null, w = /* @__PURE__ */ r(i, {
67
+ })] }) : null, R = /* @__PURE__ */ r(i, {
67
68
  role: "list",
68
69
  sx: { width: "100%" },
69
- children: u.map((R, x) => /* @__PURE__ */ d(T, { children: [x > 0 && /* @__PURE__ */ r(m, { role: "presentation" }), /* @__PURE__ */ r(f, {
70
+ children: x.map((h, b) => /* @__PURE__ */ a(T, { children: [b > 0 && /* @__PURE__ */ r(u, { role: "presentation" }), /* @__PURE__ */ r(g, {
70
71
  role: "listitem",
71
- children: /* @__PURE__ */ r(k, { ...R })
72
- })] }, x))
72
+ children: /* @__PURE__ */ r(k, { ...h })
73
+ })] }, b))
73
74
  });
74
- return /* @__PURE__ */ d(i, {
75
+ return /* @__PURE__ */ a(i, {
75
76
  "data-testid": "transaction-list-card",
76
77
  sx: {
77
78
  ...o ? {
@@ -86,7 +87,7 @@ var I = (n) => n === "primary" ? {
86
87
  ...C
87
88
  },
88
89
  children: [
89
- o && c && /* @__PURE__ */ r(f, {
90
+ o && c && /* @__PURE__ */ r(g, {
90
91
  sx: {
91
92
  left: 16,
92
93
  position: "absolute",
@@ -103,12 +104,15 @@ var I = (n) => n === "primary" ? {
103
104
  },
104
105
  children: p
105
106
  }),
106
- /* @__PURE__ */ d(i, {
107
+ /* @__PURE__ */ a(i, {
107
108
  sx: {
108
109
  ...o ? {
109
110
  bgcolor: "background.paper",
110
- ...g && { boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.12)" },
111
111
  ...B && {
112
+ backgroundImage: (h) => h.vars?.overlays?.[1] ?? "none",
113
+ boxShadow: I[1]
114
+ },
115
+ ...y && {
112
116
  border: "1px solid",
113
117
  borderColor: "divider",
114
118
  boxShadow: 1
@@ -119,15 +123,15 @@ var I = (n) => n === "primary" ? {
119
123
  },
120
124
  borderBottomLeftRadius: t,
121
125
  borderBottomRightRadius: t,
122
- borderTopLeftRadius: s || !a ? t : 0,
123
- borderTopRightRadius: s || !a ? t : 0,
126
+ borderTopLeftRadius: s || !d ? t : 0,
127
+ borderTopRightRadius: s || !d ? t : 0,
124
128
  overflow: "hidden",
125
129
  width: "100%"
126
130
  },
127
131
  children: [
128
- s && /* @__PURE__ */ d(b, { children: [p, /* @__PURE__ */ r(m, {})] }),
129
- w,
130
- v
132
+ s && /* @__PURE__ */ a(f, { children: [p, /* @__PURE__ */ r(u, {})] }),
133
+ R,
134
+ w
131
135
  ]
132
136
  })
133
137
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransactionListCard.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport InsightTransactionRow, { type InsightTransactionRowProps } from './InsightTransactionRow'\n\nexport interface FooterRow {\n label: ReactNode\n amount: ReactNode\n amountColor?: string\n}\n\ntype TransactionListCardVariant = 'default' | 'primary'\n\ninterface TransactionListCardProps {\n /** Optional header label above the rows (e.g. \"{Date}\", \"3 transactions\"). */\n header?: ReactNode\n /** One or more transaction rows. */\n rows: InsightTransactionRowProps[]\n /** Optional summary/total row rendered beneath a divider. */\n footer?: FooterRow\n /**\n * Card style:\n * - `default` — grey utility header, hairline border, radius 4.\n * - `primary` — filled `primary.main` header with white text and a matching\n * border, radius 8 (Figma \"Multi\" variant).\n *\n * In both cases the header is borderless; the border wraps the content block\n * below it.\n */\n variant?: TransactionListCardVariant\n /**\n * Optional background applied to the Slot behind the card. Must be a valid CSS\n * background string (gradient or color in CSS format); MUI theme tokens are\n * not resolved here (this is the CSS `background` shorthand, not `bgcolor`), so\n * use a CSS color literal instead. When set, the inner card renders borderless\n * on a white surface inside the padded Slot (Figma HSA Deposit), unless `raised`.\n */\n background?: string\n /** Status disc over the card's corner (needs `background`). */\n badge?: ReactNode\n /** Card shadow on the wash. */\n elevated?: boolean\n /** Border and shadow on the inner card; only with `background` (Figma Transaction Row). */\n raised?: boolean\n sx?: SxProps\n}\n\nconst getVariantStyles = (variant: TransactionListCardVariant) => {\n switch (variant) {\n case 'primary':\n // Borderless filled header on top of the bordered rows block.\n return {\n radius: '8px',\n borderColor: 'primary.main',\n headerBg: 'primary.main',\n headerColor: 'primary.contrastText',\n headerBold: false,\n headerInsideBorder: false,\n headerSx: { minHeight: 24, px: 12, py: 4 } as const,\n }\n default:\n // A single border wraps the card; the grey header sits inside it.\n return {\n radius: '8px',\n borderColor: 'divider',\n headerBg: 'background.default',\n headerColor: 'text.primary',\n headerBold: true,\n headerInsideBorder: true,\n headerSx: { minHeight: 36, px: 16, py: 2 } as const,\n }\n }\n}\n\n/**\n * List card composing an optional header label, one or more\n * `InsightTransactionRow`s (divided), and an optional footer/total row.\n * `variant` supplies the Figma design defaults for the two card styles.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst TransactionListCard = ({\n background,\n badge,\n elevated = false,\n footer,\n header,\n raised = false,\n rows,\n variant = 'default',\n sx,\n}: TransactionListCardProps) => {\n // rows usually comes from mapped API data, so an empty array is reachable and\n // would render a broken border shell; render nothing instead.\n if (rows.length === 0) return null\n\n const styles = getVariantStyles(variant)\n const hasBackground = Boolean(background)\n const radius = hasBackground ? '8px' : styles.radius\n // The header sits inside the border only for the bordered `default` variant;\n // for `primary`/backgrounded cards it sits above a separately-bordered body.\n const headerInsideBorder = Boolean(header) && !hasBackground && styles.headerInsideBorder\n\n const headerBlock = header ? (\n <Stack sx={{ bgcolor: styles.headerBg, justifyContent: 'center', ...styles.headerSx }}>\n <Text bold={styles.headerBold} color={styles.headerColor} variant=\"caption\">\n {header}\n </Text>\n </Stack>\n ) : null\n\n const footerBlock = footer ? (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: hasBackground ? 'background.paper' : 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {footer.label}\n </Text>\n <Text bold={true} color={footer.amountColor ?? 'text.primary'} variant=\"body2\">\n {footer.amount}\n </Text>\n </Stack>\n </>\n ) : null\n\n const rowsBlock = (\n <Stack role=\"list\" sx={{ width: '100%' }}>\n {rows.map((row, index) => (\n // Static, caller-ordered list that may contain identical rows, so the\n // array index is the correct key (a content-based key would collide).\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={index}>\n {index > 0 && <Divider role=\"presentation\" />}\n <Box role=\"listitem\">\n <InsightTransactionRow {...row} />\n </Box>\n </Fragment>\n ))}\n </Stack>\n )\n\n return (\n <Stack\n data-testid=\"transaction-list-card\"\n sx={{\n ...(hasBackground ? { background, p: 16 } : { pt: 8, px: 16 }),\n ...(hasBackground && badge ? { position: 'relative' } : {}),\n width: '100%',\n ...sx,\n }}\n >\n {hasBackground &&\n badge && (\n // Centred on the card's top-left corner.\n <Box sx={{ left: 16, position: 'absolute', top: 12, zIndex: 1 }}>{badge}</Box>\n )}\n {/* Header above the border for `primary`/backgrounded cards; top-rounded. */}\n {!headerInsideBorder && headerBlock && (\n <Stack\n sx={{\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n overflow: 'hidden',\n }}\n >\n {headerBlock}\n </Stack>\n )}\n\n <Stack\n sx={{\n ...(hasBackground\n ? {\n bgcolor: 'background.paper',\n ...(elevated && { boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.12)' }),\n ...(raised && { border: '1px solid', borderColor: 'divider', boxShadow: 1 }),\n }\n : { border: '1px solid', borderColor: styles.borderColor }),\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n borderTopLeftRadius: headerInsideBorder || !header ? radius : 0,\n borderTopRightRadius: headerInsideBorder || !header ? radius : 0,\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {/* Header inside the border for the `default` table variant. */}\n {headerInsideBorder && (\n <>\n {headerBlock}\n <Divider />\n </>\n )}\n {rowsBlock}\n {footerBlock}\n </Stack>\n </Stack>\n )\n}\n\nexport default TransactionListCard\n"],"mappings":";;;;;;;AAqDA,IAAM,IAAA,CAAoB,MAChB,MACD,YAEI;AAAA,EAC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UAAA;AAAA,MAAW,CAAA;AAAA,MAGhF,CAAC,KAAsB,KACtB,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,qBAAqB;AAAA,UACrB,sBAAsB;AAAA,UACtB,UAAU;AAAA,QACZ;AAAA,QAEC,UAAA;AAAA,MACI,CAAA;AAAA,MAGT,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,GAAI,IACA;AAAA,YACE,SAAS;AAAA,YACT,GAAI,KAAY,EAAE,WAAW,kCAAkC;AAAA,YAC/D,GAAI,KAAU;AAAA,cAAE,QAAQ;AAAA,cAAa,aAAa;AAAA,cAAW,WAAW;AAAA,YAAE;AAAA,UAC5E,IACA;AAAA,YAAE,QAAQ;AAAA,YAAa,aAAa,EAAO;AAAA,UAAY;AAAA,UAC3D,wBAAwB;AAAA,UACxB,yBAAyB;AAAA,UACzB,qBAAqB,KAAsB,CAAC,IAAS,IAAS;AAAA,UAC9D,sBAAsB,KAAsB,CAAC,IAAS,IAAS;AAAA,UAC/D,UAAU;AAAA,UACV,OAAO;AAAA,QACT;AAAA,QAfF,UAAA;AAAA,UAkBG,KACC,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,GACD,gBAAA,EAAC,GAAD,CAAU,CAAA,CACV,EAAA,CAAA;AAAA,UAEH;AAAA,UACA;AAAA,QACI;AAAA;IACF;AAAA;AAEX"}
1
+ {"version":3,"file":"TransactionListCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransactionListCard.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport InsightTransactionRow, { type InsightTransactionRowProps } from './InsightTransactionRow'\nimport { ELEVATION_SHADOW } from './shared/elevation'\n\nexport interface FooterRow {\n label: ReactNode\n amount: ReactNode\n amountColor?: string\n}\n\ntype TransactionListCardVariant = 'default' | 'primary'\n\ninterface TransactionListCardProps {\n /** Optional header label above the rows (e.g. \"{Date}\", \"3 transactions\"). */\n header?: ReactNode\n /** One or more transaction rows. */\n rows: InsightTransactionRowProps[]\n /** Optional summary/total row rendered beneath a divider. */\n footer?: FooterRow\n /**\n * Card style:\n * - `default` — grey utility header, hairline border, radius 4.\n * - `primary` — filled `primary.main` header with white text and a matching\n * border, radius 8 (Figma \"Multi\" variant).\n *\n * In both cases the header is borderless; the border wraps the content block\n * below it.\n */\n variant?: TransactionListCardVariant\n /**\n * Optional background applied to the Slot behind the card. Must be a valid CSS\n * background string (gradient or color in CSS format); MUI theme tokens are\n * not resolved here (this is the CSS `background` shorthand, not `bgcolor`), so\n * use a CSS color literal instead. When set, the inner card renders borderless\n * on a white surface inside the padded Slot (Figma HSA Deposit), unless `raised`.\n */\n background?: string\n /** Status disc over the card's corner (needs `background`). */\n badge?: ReactNode\n /** Card at elevation/1 on the wash; not with `raised` (its shadow wins). */\n elevated?: boolean\n /** Border and shadow on the inner card; only with `background` (Figma Transaction Row). */\n raised?: boolean\n sx?: SxProps\n}\n\nconst getVariantStyles = (variant: TransactionListCardVariant) => {\n switch (variant) {\n case 'primary':\n // Borderless filled header on top of the bordered rows block.\n return {\n radius: '8px',\n borderColor: 'primary.main',\n headerBg: 'primary.main',\n headerColor: 'primary.contrastText',\n headerBold: false,\n headerInsideBorder: false,\n headerSx: { minHeight: 24, px: 12, py: 4 } as const,\n }\n default:\n // A single border wraps the card; the grey header sits inside it.\n return {\n radius: '8px',\n borderColor: 'divider',\n headerBg: 'background.default',\n headerColor: 'text.primary',\n headerBold: true,\n headerInsideBorder: true,\n headerSx: { minHeight: 36, px: 16, py: 2 } as const,\n }\n }\n}\n\n/**\n * List card composing an optional header label, one or more\n * `InsightTransactionRow`s (divided), and an optional footer/total row.\n * `variant` supplies the Figma design defaults for the two card styles.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst TransactionListCard = ({\n background,\n badge,\n elevated = false,\n footer,\n header,\n raised = false,\n rows,\n variant = 'default',\n sx,\n}: TransactionListCardProps) => {\n // rows usually comes from mapped API data, so an empty array is reachable and\n // would render a broken border shell; render nothing instead.\n if (rows.length === 0) return null\n\n const styles = getVariantStyles(variant)\n const hasBackground = Boolean(background)\n const radius = hasBackground ? '8px' : styles.radius\n // The header sits inside the border only for the bordered `default` variant;\n // for `primary`/backgrounded cards it sits above a separately-bordered body.\n const headerInsideBorder = Boolean(header) && !hasBackground && styles.headerInsideBorder\n\n const headerBlock = header ? (\n <Stack sx={{ bgcolor: styles.headerBg, justifyContent: 'center', ...styles.headerSx }}>\n <Text bold={styles.headerBold} color={styles.headerColor} variant=\"caption\">\n {header}\n </Text>\n </Stack>\n ) : null\n\n const footerBlock = footer ? (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: hasBackground ? 'background.paper' : 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {footer.label}\n </Text>\n <Text bold={true} color={footer.amountColor ?? 'text.primary'} variant=\"body2\">\n {footer.amount}\n </Text>\n </Stack>\n </>\n ) : null\n\n const rowsBlock = (\n <Stack role=\"list\" sx={{ width: '100%' }}>\n {rows.map((row, index) => (\n // Static, caller-ordered list that may contain identical rows, so the\n // array index is the correct key (a content-based key would collide).\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={index}>\n {index > 0 && <Divider role=\"presentation\" />}\n <Box role=\"listitem\">\n <InsightTransactionRow {...row} />\n </Box>\n </Fragment>\n ))}\n </Stack>\n )\n\n return (\n <Stack\n data-testid=\"transaction-list-card\"\n sx={{\n ...(hasBackground ? { background, p: 16 } : { pt: 8, px: 16 }),\n ...(hasBackground && badge ? { position: 'relative' } : {}),\n width: '100%',\n ...sx,\n }}\n >\n {hasBackground &&\n badge && (\n // Centred on the card's top-left corner.\n <Box sx={{ left: 16, position: 'absolute', top: 12, zIndex: 1 }}>{badge}</Box>\n )}\n {/* Header above the border for `primary`/backgrounded cards; top-rounded. */}\n {!headerInsideBorder && headerBlock && (\n <Stack\n sx={{\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n overflow: 'hidden',\n }}\n >\n {headerBlock}\n </Stack>\n )}\n\n <Stack\n sx={{\n ...(hasBackground\n ? {\n bgcolor: 'background.paper',\n // elevation/1 shadow plus the dark-mode tint.\n ...(elevated && {\n backgroundImage: (theme: Theme) => theme.vars?.overlays?.[1] ?? 'none',\n boxShadow: ELEVATION_SHADOW[1],\n }),\n ...(raised && { border: '1px solid', borderColor: 'divider', boxShadow: 1 }),\n }\n : { border: '1px solid', borderColor: styles.borderColor }),\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n borderTopLeftRadius: headerInsideBorder || !header ? radius : 0,\n borderTopRightRadius: headerInsideBorder || !header ? radius : 0,\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {/* Header inside the border for the `default` table variant. */}\n {headerInsideBorder && (\n <>\n {headerBlock}\n <Divider />\n </>\n )}\n {rowsBlock}\n {footerBlock}\n </Stack>\n </Stack>\n )\n}\n\nexport default TransactionListCard\n"],"mappings":";;;;;;;;AAsDA,IAAM,IAAA,CAAoB,MAChB,MACD,YAEI;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,UAAU;AAAA,IAAE,WAAW;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAE;AAC3C,IAGO;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,UAAU;AAAA,IAAE,WAAW;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAE;AAC3C,GAWA,IAAA,CAAuB,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B;AAAA,YACA,GAAI,KAAU;AAAA,cAAE,QAAQ;AAAA,cAAa,aAAa;AAAA,cAAW,WAAW;AAAA,YAAE;AAAA,UAC5E,IACA;AAAA,YAAE,QAAQ;AAAA,YAAa,aAAa,EAAO;AAAA,UAAY;AAAA,UAC3D,wBAAwB;AAAA,UACxB,yBAAyB;AAAA,UACzB,qBAAqB,KAAsB,CAAC,IAAS,IAAS;AAAA,UAC9D,sBAAsB,KAAsB,CAAC,IAAS,IAAS;AAAA,UAC/D,UAAU;AAAA,UACV,OAAO;AAAA,QACT;AAAA,QAnBF,UAAA;AAAA,UAsBG,KACC,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,GACD,gBAAA,EAAC,GAAD,CAAU,CAAA,CACV,EAAA,CAAA;AAAA,UAEH;AAAA,UACA;AAAA,QACI;AAAA;IACF;AAAA;AAEX"}
@@ -1,7 +1,11 @@
1
+ /** `standard`: the mxui Toast; `strong`: Figma's `<Snackbar>` (600 tone, white text, elevation/16). */
2
+ export type StatusSnackbarVariant = 'standard' | 'strong';
1
3
  export interface StatusSnackbarProps {
2
4
  open: boolean;
3
5
  /** Snackbar tone — success (green, Figma 1941:167636) or error (red, Figma 1941:167637). */
4
6
  severity?: 'success' | 'error';
7
+ /** Snackbar design; defaults to `standard`. */
8
+ variant?: StatusSnackbarVariant;
5
9
  /** Status description, e.g. "Your feedback has been submitted.". */
6
10
  message: string;
7
11
  /** ARIA label for the close button. */
@@ -24,5 +28,5 @@ export interface StatusSnackbarProps {
24
28
  * so every surface renders the same Figma variants instead of re-wiring
25
29
  * Toast props.
26
30
  */
27
- declare const StatusSnackbar: ({ actionText, autoHideDuration, closeAriaLabel, message, onActionClick, onClose, open, severity, }: StatusSnackbarProps) => import("react/jsx-runtime").JSX.Element;
31
+ declare const StatusSnackbar: ({ actionText, autoHideDuration, closeAriaLabel, message, onActionClick, onClose, open, severity, variant, }: StatusSnackbarProps) => import("react/jsx-runtime").JSX.Element;
28
32
  export default StatusSnackbar;
@@ -1,19 +1,39 @@
1
+ import { ELEVATION_SHADOW as c } from "./elevation.es.js";
1
2
  import { Toast as u } from "@mxenabled/mxui";
2
- import { jsx as c } from "react/jsx-runtime";
3
- var p = ({ actionText: s, autoHideDuration: o, closeAriaLabel: r, message: a, onActionClick: t, onClose: e, open: l, severity: m = "success" }) => /* @__PURE__ */ c(u, {
4
- actionText: s,
5
- autoHideDuration: o,
6
- closeAriaLabel: r,
7
- handleClose: e,
3
+ import { jsx as m } from "react/jsx-runtime";
4
+ var p = (o) => ({
5
+ "& .MuiAlert-root": {
6
+ backgroundColor: (t) => t.palette[o][600] ?? t.palette[o].dark,
7
+ boxShadow: c[16],
8
+ color: "common.white"
9
+ },
10
+ "& .MuiAlert-icon, & .MuiAlert-action .MuiIconButton-root": { color: "common.white" },
11
+ "& .MuiAlert-action": {
12
+ mr: 0,
13
+ pl: 20
14
+ },
15
+ "& .MuiAlert-message p": { lineHeight: "24px" },
16
+ "& .MuiAlert-message .MuiButton-root": {
17
+ color: "common.white",
18
+ fontSize: 15,
19
+ fontWeight: 600,
20
+ lineHeight: "20px"
21
+ }
22
+ }), M = ({ actionText: o, autoHideDuration: t, closeAriaLabel: e, message: a, onActionClick: i, onClose: n, open: l, severity: r = "success", variant: s = "standard" }) => /* @__PURE__ */ m(u, {
23
+ actionText: o,
24
+ autoHideDuration: t,
25
+ closeAriaLabel: e,
26
+ handleClose: n,
8
27
  message: a,
9
- onActionClick: t,
28
+ onActionClick: i,
10
29
  open: l,
11
- severity: m,
12
- showAction: !!s,
13
- showClose: !0
30
+ severity: r,
31
+ showAction: !!o,
32
+ showClose: !0,
33
+ ...s === "strong" && { snackbarSx: p(r) }
14
34
  });
15
35
  export {
16
- p as default
36
+ M as default
17
37
  };
18
38
 
19
39
  //# sourceMappingURL=StatusSnackbar.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusSnackbar.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/StatusSnackbar.tsx"],"sourcesContent":["import { Toast } from '@mxenabled/mxui'\n\nexport interface StatusSnackbarProps {\n open: boolean\n /** Snackbar tone — success (green, Figma 1941:167636) or error (red, Figma 1941:167637). */\n severity?: 'success' | 'error'\n /** Status description, e.g. \"Your feedback has been submitted.\". */\n message: string\n /** ARIA label for the close button. */\n closeAriaLabel: string\n /** Fired on close / auto-hide. */\n onClose: () => void\n /**\n * Optional action button label (e.g. \"Try Again\"). The button renders only\n * when this is provided.\n */\n actionText?: string\n onActionClick?: () => void\n /** Auto-hide in ms; defaults to the mxui Toast default (3s). */\n autoHideDuration?: number\n}\n\n/**\n * Shared status snackbar for insights-v2 (Figma `<Snackbar>`): a filled\n * success/error toast with a message, a close button, and an optional action\n * (e.g. the feedback modal's Try Again). Thin wrapper over the mxui `Toast`\n * so every surface renders the same Figma variants instead of re-wiring\n * Toast props.\n */\nconst StatusSnackbar = ({\n actionText,\n autoHideDuration,\n closeAriaLabel,\n message,\n onActionClick,\n onClose,\n open,\n severity = 'success',\n}: StatusSnackbarProps) => (\n <Toast\n actionText={actionText}\n autoHideDuration={autoHideDuration}\n closeAriaLabel={closeAriaLabel}\n handleClose={onClose}\n message={message}\n onActionClick={onActionClick}\n open={open}\n severity={severity}\n showAction={!!actionText}\n showClose={true}\n />\n)\n\nexport default StatusSnackbar\n"],"mappings":";;AA6BA,IAAM,IAAA,CAAkB,EACtB,YAAA,GACA,kBAAA,GACA,gBAAA,GACA,SAAA,GACA,eAAA,GACA,SAAA,GACA,MAAA,GACA,UAAA,IAAW,UAAA,MAEX,gBAAA,EAAC,GAAD;AAAA,EACc,YAAA;AAAA,EACM,kBAAA;AAAA,EACF,gBAAA;AAAA,EAChB,aAAa;AAAA,EACJ,SAAA;AAAA,EACM,eAAA;AAAA,EACT,MAAA;AAAA,EACI,UAAA;AAAA,EACV,YAAY,CAAC,CAAC;AAAA,EACd,WAAW;AACZ,CAAA"}
1
+ {"version":3,"file":"StatusSnackbar.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/StatusSnackbar.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Toast } from '@mxenabled/mxui'\n\nimport { ELEVATION_SHADOW } from './elevation'\n\n/** `standard`: the mxui Toast; `strong`: Figma's `<Snackbar>` (600 tone, white text, elevation/16). */\nexport type StatusSnackbarVariant = 'standard' | 'strong'\n\nexport interface StatusSnackbarProps {\n open: boolean\n /** Snackbar tone — success (green, Figma 1941:167636) or error (red, Figma 1941:167637). */\n severity?: 'success' | 'error'\n /** Snackbar design; defaults to `standard`. */\n variant?: StatusSnackbarVariant\n /** Status description, e.g. \"Your feedback has been submitted.\". */\n message: string\n /** ARIA label for the close button. */\n closeAriaLabel: string\n /** Fired on close / auto-hide. */\n onClose: () => void\n /**\n * Optional action button label (e.g. \"Try Again\"). The button renders only\n * when this is provided.\n */\n actionText?: string\n onActionClick?: () => void\n /** Auto-hide in ms; defaults to the mxui Toast default (3s). */\n autoHideDuration?: number\n}\n\nconst strongSx = (severity: 'success' | 'error'): SxProps<Theme> => ({\n '& .MuiAlert-root': {\n backgroundColor: (theme: Theme) => theme.palette[severity][600] ?? theme.palette[severity].dark,\n boxShadow: ELEVATION_SHADOW[16],\n color: 'common.white',\n },\n '& .MuiAlert-icon, & .MuiAlert-action .MuiIconButton-root': { color: 'common.white' },\n // Figma close frame: 20px gap, 16px edge (the button keeps mxui's 44px target).\n '& .MuiAlert-action': { mr: 0, pl: 20 },\n '& .MuiAlert-message p': { lineHeight: '24px' },\n '& .MuiAlert-message .MuiButton-root': {\n color: 'common.white',\n fontSize: 15,\n fontWeight: 600,\n lineHeight: '20px',\n },\n})\n\n/**\n * Shared status snackbar for insights-v2 (Figma `<Snackbar>`): a filled\n * success/error toast with a message, a close button, and an optional action\n * (e.g. the feedback modal's Try Again). Thin wrapper over the mxui `Toast`\n * so every surface renders the same Figma variants instead of re-wiring\n * Toast props.\n */\nconst StatusSnackbar = ({\n actionText,\n autoHideDuration,\n closeAriaLabel,\n message,\n onActionClick,\n onClose,\n open,\n severity = 'success',\n variant = 'standard',\n}: StatusSnackbarProps) => (\n <Toast\n actionText={actionText}\n autoHideDuration={autoHideDuration}\n closeAriaLabel={closeAriaLabel}\n handleClose={onClose}\n message={message}\n onActionClick={onActionClick}\n open={open}\n severity={severity}\n showAction={!!actionText}\n showClose={true}\n {...(variant === 'strong' && { snackbarSx: strongSx(severity) })}\n />\n)\n\nexport default StatusSnackbar\n"],"mappings":";;;AA+BA,IAAM,IAAA,CAAY,OAAmD;AAAA,EACnE,oBAAoB;AAAA,IAClB,iBAAA,CAAkB,MAAiB,EAAM,QAAQ,CAAA,EAAU,GAAA,KAAQ,EAAM,QAAQ,CAAA,EAAU;AAAA,IAC3F,WAAW,EAAiB,EAAA;AAAA,IAC5B,OAAO;AAAA,EACT;AAAA,EACA,4DAA4D,EAAE,OAAO,eAAe;AAAA,EAEpF,sBAAsB;AAAA,IAAE,IAAI;AAAA,IAAG,IAAI;AAAA,EAAG;AAAA,EACtC,yBAAyB,EAAE,YAAY,OAAO;AAAA,EAC9C,uCAAuC;AAAA,IACrC,OAAO;AAAA,IACP,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AACF,IASM,IAAA,CAAkB,EACtB,YAAA,GACA,kBAAA,GACA,gBAAA,GACA,SAAA,GACA,eAAA,GACA,SAAA,GACA,MAAA,GACA,UAAA,IAAW,WACX,SAAA,IAAU,WAAA,MAEV,gBAAA,EAAC,GAAD;AAAA,EACc,YAAA;AAAA,EACM,kBAAA;AAAA,EACF,gBAAA;AAAA,EAChB,aAAa;AAAA,EACJ,SAAA;AAAA,EACM,eAAA;AAAA,EACT,MAAA;AAAA,EACI,UAAA;AAAA,EACV,YAAY,CAAC,CAAC;AAAA,EACd,WAAW;AAAA,EACX,GAAK,MAAY,YAAY,EAAE,YAAY,EAAS,CAAQ,EAAE;AAC/D,CAAA"}
@@ -0,0 +1,7 @@
1
+ /** Figma elevation shadows (single drop shadows, not MUI's `shadows[n]`). */
2
+ export declare const ELEVATION_SHADOW: {
3
+ /** `elevation/1`: rows on a wash. */
4
+ readonly 1: "0px 2px 8px rgba(0, 0, 0, 0.12)";
5
+ /** `elevation/16`: dialogs, snackbars. */
6
+ readonly 16: "0px 12px 20px rgba(0, 0, 0, 0.22)";
7
+ };
@@ -0,0 +1,9 @@
1
+ var p = {
2
+ 1: "0px 2px 8px rgba(0, 0, 0, 0.12)",
3
+ 16: "0px 12px 20px rgba(0, 0, 0, 0.22)"
4
+ };
5
+ export {
6
+ p as ELEVATION_SHADOW
7
+ };
8
+
9
+ //# sourceMappingURL=elevation.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elevation.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/elevation.ts"],"sourcesContent":["/** Figma elevation shadows (single drop shadows, not MUI's `shadows[n]`). */\nexport const ELEVATION_SHADOW = {\n /** `elevation/1`: rows on a wash. */\n 1: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n /** `elevation/16`: dialogs, snackbars. */\n 16: '0px 12px 20px rgba(0, 0, 0, 0.22)',\n} as const\n"],"mappings":"AACA,IAAa,IAAmB;AAAA,EAE9B,GAAG;AAAA,EAEH,IAAI;AACN"}
@@ -1,12 +1,12 @@
1
1
  import { ANALYTICS_EVENTS_CONFIG as o } from "../analytics/analyticsEventsConfig.es.js";
2
2
  import { CTA_STATUS_CONTENT_CLASS as r } from "../components/CtaStatus.es.js";
3
3
  import { HOST_ACTIONS as a } from "./hostActions.es.js";
4
- import { subscriptionEntryStep as n, subscriptionSurvey as _ } from "./subscriptionAnswer.es.js";
4
+ import { subscriptionEntryStep as n, subscriptionSurvey as p } from "./subscriptionAnswer.es.js";
5
5
  import { alpha as c } from "@mui/material/styles";
6
- var u = ({ beat: t, stores: i }) => {
7
- const e = i.insightsV2Store.beatContext[t.guid]?.selected_account_guid;
6
+ var u = ({ beat: t, stores: s }) => {
7
+ const e = s.insightsV2Store.beatContext[t.guid]?.selected_account_guid;
8
8
  if (typeof e == "string")
9
- return i.accountStore.visibleSavingsAccounts.some((s) => s.guid === e && !s.is_closed && !s.is_deleted) ? e : void 0;
9
+ return s.accountStore.visibleSavingsAccounts.some((i) => i.guid === e && !i.is_closed && !i.is_deleted) ? e : void 0;
10
10
  }, S = {
11
11
  dismiss_beat: {
12
12
  run: "delegateToHost",
@@ -29,7 +29,7 @@ var u = ({ beat: t, stores: i }) => {
29
29
  positive: "confirmed",
30
30
  negative: "incorrect"
31
31
  } }),
32
- surveyAnswer: _
32
+ surveyAnswer: p
33
33
  },
34
34
  confirm_subscription_status: {
35
35
  ...n({
@@ -39,12 +39,20 @@ var u = ({ beat: t, stores: i }) => {
39
39
  },
40
40
  sx: {
41
41
  minHeight: 56,
42
- [`& .${r}`]: { gap: 10 }
42
+ [`& .${r}`]: { gap: 10 },
43
+ "& > .MuiButton-root": {
44
+ fontSize: 13,
45
+ fontWeight: 600,
46
+ lineHeight: "16px",
47
+ minWidth: 0,
48
+ px: 8,
49
+ py: 4
50
+ }
43
51
  },
44
52
  negativeSx: {
45
53
  bgcolor: "background.paper",
46
- borderColor: (t) => c(t.palette.common.black, 0.5),
47
- [`& .${r} .MuiSvgIcon-root`]: { color: (t) => c(t.palette.common.black, 0.7) }
54
+ borderColor: (t) => c(t.palette.text.primary, 0.5),
55
+ [`& .${r} .MuiSvgIcon-root`]: { color: (t) => c(t.palette.text.primary, 0.7) }
48
56
  },
49
57
  answeredTitle: (t) => t.insights_feed?.subscription_status_modal?.reviewed_title
50
58
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { alpha, type Theme } from '@mui/material/styles'\n\nimport { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { CTA_STATUS_CONTENT_CLASS } from '../components/CtaStatus'\nimport { HOST_ACTIONS } from './hostActions'\nimport { subscriptionEntryStep, subscriptionSurvey } from './subscriptionAnswer'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n\n /**\n * SetUpDirectDeposit `not_set_up`: hand the press to the host, which owns the Atomic SDK and its\n * lifecycle. No drawer, no `refreshBeat`, and no interim post message is registered for the\n * template (a backend-supplied `cta.metadata` would still post).\n */\n atomic_flow: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.atomicTransact },\n },\n\n /**\n * SubscriptionDetected \"Does this look right?\": the shared subscription status CTA (every answer\n * counts, as pulse), answered through the survey.\n */\n confirm_subscription_detected: {\n ...subscriptionEntryStep({ statusLabels: { positive: 'confirmed', negative: 'incorrect' } }),\n surveyAnswer: subscriptionSurvey,\n },\n\n /**\n * Unexpected Subscription Payment: the shared subscription status CTA, answered through its\n * Subscription Status modal. Its Figma: a 56px bar, and a white \"Not subscribed\" bar with a 50%\n * black border and 70% black icon. Mini and micro mirror the status (`compactStatus`).\n */\n confirm_subscription_status: {\n ...subscriptionEntryStep({\n statusLabels: { positive: 'subscribed', negative: 'not_subscribed' },\n sx: { minHeight: 56, [`& .${CTA_STATUS_CONTENT_CLASS}`]: { gap: 10 } },\n negativeSx: {\n bgcolor: 'background.paper',\n borderColor: (theme: Theme) => alpha(theme.palette.common.black, 0.5),\n [`& .${CTA_STATUS_CONTENT_CLASS} .MuiSvgIcon-root`]: {\n color: (theme: Theme) => alpha(theme.palette.common.black, 0.7),\n },\n },\n answeredTitle: (copy) => copy.insights_feed?.subscription_status_modal?.reviewed_title,\n }),\n compactStatus: true,\n },\n}\n"],"mappings":";;;;;AAaA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OAAO,KAAW;AAMtB,WAJe,EAAO,aAAa,uBAAuB,KAAA,CACvD,MAAY,EAAQ,SAAS,KAAU,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAGlE,IAAS,IAAS;AAC3B,GAQa,IAAsC;AAAA,EAEjD,cAAc;AAAA,IACZ,K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ha, type Theme } from '@mui/material/styles'\n\nimport { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { CTA_STATUS_CONTENT_CLASS } from '../components/CtaStatus'\nimport { HOST_ACTIONS } from './hostActions'\nimport { subscriptionEntryStep, subscriptionSurvey } from './subscriptionAnswer'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n\n /**\n * SetUpDirectDeposit `not_set_up`: hand the press to the host, which owns the Atomic SDK and its\n * lifecycle. No drawer, no `refreshBeat`, and no interim post message is registered for the\n * template (a backend-supplied `cta.metadata` would still post).\n */\n atomic_flow: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.atomicTransact },\n },\n\n /**\n * SubscriptionDetected \"Does this look right?\": the shared subscription status CTA (every answer\n * counts, as pulse), answered through the survey.\n */\n confirm_subscription_detected: {\n ...subscriptionEntryStep({ statusLabels: { positive: 'confirmed', negative: 'incorrect' } }),\n surveyAnswer: subscriptionSurvey,\n },\n\n /** Unexpected Subscription Payment: Figma's status bar; mini and micro mirror it (`compactStatus`). */\n confirm_subscription_status: {\n ...subscriptionEntryStep({\n statusLabels: { positive: 'subscribed', negative: 'not_subscribed' },\n sx: {\n minHeight: 56,\n [`& .${CTA_STATUS_CONTENT_CLASS}`]: { gap: 10 },\n '& > .MuiButton-root': {\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n minWidth: 0,\n px: 8,\n py: 4,\n },\n },\n negativeSx: {\n bgcolor: 'background.paper',\n borderColor: (theme: Theme) => alpha(theme.palette.text.primary, 0.5),\n [`& .${CTA_STATUS_CONTENT_CLASS} .MuiSvgIcon-root`]: {\n color: (theme: Theme) => alpha(theme.palette.text.primary, 0.7),\n },\n },\n answeredTitle: (copy) => copy.insights_feed?.subscription_status_modal?.reviewed_title,\n }),\n compactStatus: true,\n },\n}\n"],"mappings":";;;;;AAaA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,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AAM,QAAQ,KAAK,SAAS,GAAG;AAAA,QACnE,CAAA,MAAM,CAAA,mBAAyB,GAAqB,EACnD,OAAA,CAAQ,MAAiB,EAAM,EAAM,QAAQ,KAAK,SAAS,GAAG,EAChE;AAAA,MACF;AAAA,MACA,eAAA,CAAgB,MAAS,EAAK,eAAe,2BAA2B;AAAA,IAC1E,CAAC;AAAA,IACD,eAAe;AAAA,EACjB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.89",
3
+ "version": "9.7.90",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",