@mx-cartographer/experiences 9.7.125 → 9.7.126

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +75 -74
  3. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  4. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +23 -22
  5. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
  6. package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js +21 -21
  7. package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js.map +1 -1
  8. package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js +22 -24
  9. package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js.map +1 -1
  10. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +52 -51
  11. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  12. package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js +16 -16
  13. package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js.map +1 -1
  14. package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +17 -16
  15. package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +19 -18
  17. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
  18. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +31 -31
  19. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
  20. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.d.ts +2 -7
  21. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +35 -34
  22. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
  23. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +33 -33
  24. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
  25. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.d.ts +2 -7
  26. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +16 -15
  27. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js.map +1 -1
  28. package/dist/insights-v2/blocks/slotReaders.d.ts +12 -0
  29. package/dist/insights-v2/blocks/slotReaders.es.js +9 -0
  30. package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -0
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [9.7.126] - 11-10-2026
2
+
3
+ - **CHANGED** - Insights V2 cards drop a slot value of the wrong kind (for example a number where text is expected) instead of passing it through; valid slots render the same (WEC-2259)
4
+
1
5
  ## [9.7.125] - 11-09-2026
2
6
 
3
7
  - **FIXED** - Micro Deposits' category tiles use Figma's category background (25% of the category colour, was 15%); no other beat changes (WEC-2109)
@@ -1,38 +1,39 @@
1
1
  import { slot as d } from "../../../../core/types/Insights.es.js";
2
- import { formatCurrency as I } from "../../../../core/utils/NumberFormatting.es.js";
3
- import { resolveVariantConfig as P } from "../../resolveVariantConfig.es.js";
4
- import { useContainerDimensions as H } from "../../../hooks/useContainerDimensions.es.js";
5
- import N from "../../../components/LogoFromGuid.es.js";
6
- import { Confetti as E } from "../../../components/shared/Confetti.es.js";
7
- import { ReactComponent as G } from "../../../components/shared/images/PaidOffCard.es.js";
8
- import { ReactComponent as O } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
9
- import { statusIconName as W } from "../../../components/statusIcon.es.js";
10
- import { isDetailedAccountVariant as q } from "../DetailedAccountBlock/layout.es.js";
11
- import J from "../DetailedAccountBlock/DetailedAccountBlock.es.js";
12
- import { HeaderComponent as K } from "./HeaderComponent.es.js";
13
- import { getLayoutConfig as M } from "./layout.es.js";
14
- import { IconComponent as Q } from "./IconComponent.es.js";
15
- import { useRef as U } from "react";
16
- import e from "@mui/material/Stack";
2
+ import { formatCurrency as T } from "../../../../core/utils/NumberFormatting.es.js";
3
+ import { resolveVariantConfig as $ } from "../../resolveVariantConfig.es.js";
4
+ import { useContainerDimensions as j } from "../../../hooks/useContainerDimensions.es.js";
5
+ import F from "../../../components/LogoFromGuid.es.js";
6
+ import { Confetti as P } from "../../../components/shared/Confetti.es.js";
7
+ import { ReactComponent as N } from "../../../components/shared/images/PaidOffCard.es.js";
8
+ import { ReactComponent as E } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
9
+ import { statusIconName as G } from "../../../components/statusIcon.es.js";
10
+ import { asNumber as H, asText as x } from "../../slotReaders.es.js";
11
+ import { isDetailedAccountVariant as O } from "../DetailedAccountBlock/layout.es.js";
12
+ import W from "../DetailedAccountBlock/DetailedAccountBlock.es.js";
13
+ import { HeaderComponent as q } from "./HeaderComponent.es.js";
14
+ import { getLayoutConfig as J } from "./layout.es.js";
15
+ import { IconComponent as K } from "./IconComponent.es.js";
16
+ import { useRef as M } from "react";
17
+ import r from "@mui/material/Stack";
17
18
  import { Text as l } from "@mxenabled/mxui";
18
- import { Icon as z } from "@mxenabled/mx-icons";
19
- import { jsx as o, jsxs as r } from "react/jsx-runtime";
20
- import { useTheme as X } from "@mui/material/styles";
21
- import a from "@mui/material/Box";
22
- var vo = ({ payload: g }) => {
23
- const h = X(), b = U(null), { height: w, width: v } = H(b), { instance_slot: n } = g, { variant: p, institution_guid: D, institution_name: A, icon_name: B, merchant_name: F } = n;
24
- if (q(p)) return /* @__PURE__ */ o(J, { payload: g });
25
- const { data: i } = n, m = i !== void 0, f = d(i, "amount"), u = m ? typeof f == "number" && Number.isFinite(f) ? f : void 0 : n.amount, y = d(i, "sub_text"), R = typeof y == "string" ? y : void 0, T = m ? R : n.sub_text, L = m ? R : n.label, _ = d(i, "header_text"), s = m ? typeof _ == "string" ? _ : void 0 : n.header_text, c = d(i, "logo"), t = P(M(h), p, "default", "AccountBlock");
26
- if (t?.isConfetti) {
27
- const x = W(c?.guid), V = {
28
- paidOffCard: /* @__PURE__ */ o(a, {
19
+ import { Icon as k } from "@mxenabled/mx-icons";
20
+ import { jsx as o, jsxs as t } from "react/jsx-runtime";
21
+ import { useTheme as Q } from "@mui/material/styles";
22
+ import s from "@mui/material/Box";
23
+ var wo = ({ payload: g }) => {
24
+ const h = Q(), b = M(null), { height: w, width: v } = j(b), { instance_slot: n } = g, { variant: p, institution_guid: I, institution_name: S, icon_name: z, merchant_name: D } = n;
25
+ if (O(p)) return /* @__PURE__ */ o(W, { payload: g });
26
+ const { data: i } = n, m = i !== void 0, u = m ? H(d(i, "amount")) : n.amount, y = x(d(i, "sub_text")), R = m ? y : n.sub_text, A = m ? y : n.label, a = m ? x(d(i, "header_text")) : n.header_text, c = d(i, "logo"), e = $(J(h), p, "default", "AccountBlock");
27
+ if (e?.isConfetti) {
28
+ const f = G(c?.guid), B = {
29
+ paidOffCard: /* @__PURE__ */ o(s, {
29
30
  sx: {
30
31
  flexShrink: 0,
31
32
  height: 32,
32
33
  position: "relative",
33
34
  width: 48
34
35
  },
35
- children: /* @__PURE__ */ o(G, {
36
+ children: /* @__PURE__ */ o(N, {
36
37
  "aria-hidden": !0,
37
38
  role: "presentation",
38
39
  style: {
@@ -42,13 +43,13 @@ var vo = ({ payload: g }) => {
42
43
  }
43
44
  })
44
45
  }),
45
- savings: /* @__PURE__ */ o(O, {
46
+ savings: /* @__PURE__ */ o(E, {
46
47
  "aria-hidden": !0,
47
48
  height: 55,
48
49
  role: "presentation",
49
50
  width: 55
50
51
  }),
51
- logo: /* @__PURE__ */ o(a, {
52
+ logo: /* @__PURE__ */ o(s, {
52
53
  sx: {
53
54
  borderRadius: "4px",
54
55
  flexShrink: 0,
@@ -56,8 +57,8 @@ var vo = ({ payload: g }) => {
56
57
  overflow: "hidden",
57
58
  width: 48
58
59
  },
59
- children: x ? /* @__PURE__ */ o(e, {
60
- "data-icon": x,
60
+ children: f ? /* @__PURE__ */ o(r, {
61
+ "data-icon": f,
61
62
  sx: {
62
63
  alignItems: "center",
63
64
  bgcolor: "success.main",
@@ -65,59 +66,59 @@ var vo = ({ payload: g }) => {
65
66
  justifyContent: "center",
66
67
  width: "100%"
67
68
  },
68
- children: /* @__PURE__ */ o(z, {
69
+ children: /* @__PURE__ */ o(k, {
69
70
  "aria-hidden": !0,
70
- name: x,
71
- size: t.logo_icon_size ?? 24,
71
+ name: f,
72
+ size: e.logo_icon_size ?? 24,
72
73
  sx: { color: "success.contrastText" }
73
74
  })
74
- }) : c?.guid ? /* @__PURE__ */ o(N, {
75
+ }) : c?.guid ? /* @__PURE__ */ o(F, {
75
76
  logo: c,
76
77
  size: 48
77
78
  }) : null
78
79
  })
79
- }[t.graphic ?? "logo"], C = d(i, "secondary_text"), $ = typeof C == "string" && C || (F ?? A), S = t.secondarySource === "merchant" ? $ : L, k = S ? /* @__PURE__ */ o(l, {
80
- color: t.secondaryColor,
81
- variant: t.secondaryVariant,
82
- children: S
83
- }) : null, j = u != null ? /* @__PURE__ */ o(l, {
80
+ }[e.graphic ?? "logo"], L = x(d(i, "secondary_text")) || (D ?? S), _ = e.secondarySource === "merchant" ? L : A, C = _ ? /* @__PURE__ */ o(l, {
81
+ color: e.secondaryColor,
82
+ variant: e.secondaryVariant,
83
+ children: _
84
+ }) : null, V = u != null ? /* @__PURE__ */ o(l, {
84
85
  bold: !0,
85
86
  color: "success.dark",
86
- variant: t.amountVariant,
87
- children: `${t.amountPrefix ?? ""}${I(u, "0,0.00")}`
87
+ variant: e.amountVariant,
88
+ children: `${e.amountPrefix ?? ""}${T(u, "0,0.00")}`
88
89
  }) : null;
89
- return /* @__PURE__ */ r(a, {
90
+ return /* @__PURE__ */ t(s, {
90
91
  ref: b,
91
92
  sx: {
92
- backgroundImage: t.gradient,
93
+ backgroundImage: e.gradient,
93
94
  bgcolor: "background.paper",
94
95
  overflow: "hidden",
95
96
  position: "relative",
96
97
  p: 16,
97
98
  width: "100%"
98
99
  },
99
- children: [/* @__PURE__ */ o(a, {
100
+ children: [/* @__PURE__ */ o(s, {
100
101
  sx: {
101
102
  inset: 0,
102
103
  pointerEvents: "none",
103
104
  position: "absolute",
104
105
  zIndex: 1
105
106
  },
106
- children: /* @__PURE__ */ o(E, {
107
+ children: /* @__PURE__ */ o(P, {
107
108
  height: w,
108
109
  shouldRun: w > 0 && v > 0,
109
110
  width: v
110
111
  })
111
- }), /* @__PURE__ */ r(e, {
112
+ }), /* @__PURE__ */ t(r, {
112
113
  sx: {
113
114
  borderRadius: "8px",
114
- ...t.cardShadow && { boxShadow: h.shadows[1] },
115
+ ...e.cardShadow && { boxShadow: h.shadows[1] },
115
116
  overflow: "hidden",
116
117
  position: "relative",
117
118
  width: "100%",
118
119
  zIndex: 2
119
120
  },
120
- children: [t.categoryStrip && s && /* @__PURE__ */ o(a, {
121
+ children: [e.categoryStrip && a && /* @__PURE__ */ o(s, {
121
122
  sx: {
122
123
  bgcolor: "success.main",
123
124
  px: 12,
@@ -126,56 +127,56 @@ var vo = ({ payload: g }) => {
126
127
  children: /* @__PURE__ */ o(l, {
127
128
  color: "success.contrastText",
128
129
  variant: "caption",
129
- children: s
130
+ children: a
130
131
  })
131
- }), /* @__PURE__ */ r(e, {
132
+ }), /* @__PURE__ */ t(r, {
132
133
  sx: {
133
134
  alignItems: "center",
134
135
  bgcolor: "success.lighter",
135
136
  border: "1px solid",
136
137
  borderColor: "success.main",
137
138
  borderRadius: "8px",
138
- ...t.categoryStrip && {
139
+ ...e.categoryStrip && {
139
140
  borderTopLeftRadius: 0,
140
141
  borderTopRightRadius: 0,
141
142
  borderTop: 0
142
143
  },
143
144
  flexDirection: "row",
144
- ...t.rowSx
145
+ ...e.rowSx
145
146
  },
146
- children: [/* @__PURE__ */ o(a, {
147
+ children: [/* @__PURE__ */ o(s, {
147
148
  sx: {
148
149
  display: "flex",
149
150
  flexShrink: 0
150
151
  },
151
- children: V
152
- }), /* @__PURE__ */ r(e, {
152
+ children: B
153
+ }), /* @__PURE__ */ t(r, {
153
154
  sx: {
154
155
  flex: "1 0 0",
155
156
  minWidth: 0
156
157
  },
157
158
  children: [
158
- t.secondaryPosition === "above" && k,
159
- j,
160
- t.secondaryPosition === "below" && k
159
+ e.secondaryPosition === "above" && C,
160
+ V,
161
+ e.secondaryPosition === "below" && C
161
162
  ]
162
163
  })]
163
164
  })]
164
165
  })]
165
166
  });
166
167
  }
167
- return /* @__PURE__ */ o(e, {
168
+ return /* @__PURE__ */ o(r, {
168
169
  sx: {
169
- background: t.background,
170
+ background: e.background,
170
171
  p: 16
171
172
  },
172
- children: /* @__PURE__ */ r(e, {
173
+ children: /* @__PURE__ */ t(r, {
173
174
  sx: {
174
175
  borderRadius: "8px",
175
176
  boxShadow: h.shadows[1],
176
177
  width: "100%"
177
178
  },
178
- children: [s && /* @__PURE__ */ o(K, { headerText: s }), /* @__PURE__ */ r(e, {
179
+ children: [a && /* @__PURE__ */ o(q, { headerText: a }), /* @__PURE__ */ t(r, {
179
180
  sx: {
180
181
  alignItems: "center",
181
182
  bgcolor: "background.paper",
@@ -183,34 +184,34 @@ var vo = ({ payload: g }) => {
183
184
  gap: 16,
184
185
  p: 16,
185
186
  width: "100%",
186
- ...s && {
187
+ ...a && {
187
188
  borderTopLeftRadius: "0",
188
189
  borderTopRightRadius: "0"
189
190
  },
190
- ...(D || B || c?.guid) && { flexDirection: "row" }
191
+ ...(I || z || c?.guid) && { flexDirection: "row" }
191
192
  },
192
- children: [/* @__PURE__ */ o(Q, {
193
+ children: [/* @__PURE__ */ o(K, {
193
194
  logo: c,
194
195
  slot: n,
195
196
  variant: p
196
- }), /* @__PURE__ */ r(e, { children: [u != null && /* @__PURE__ */ o(l, {
197
+ }), /* @__PURE__ */ t(r, { children: [u != null && /* @__PURE__ */ o(l, {
197
198
  variant: "h2",
198
- children: I(u, "0,0.00")
199
- }), /* @__PURE__ */ r(e, {
199
+ children: T(u, "0,0.00")
200
+ }), /* @__PURE__ */ t(r, {
200
201
  sx: {
201
202
  gap: 8,
202
203
  flexDirection: "row",
203
204
  alignItems: "center"
204
205
  },
205
- children: [t.sub_logo && /* @__PURE__ */ o(z, {
206
+ children: [e.sub_logo && /* @__PURE__ */ o(k, {
206
207
  color: "warning",
207
208
  fill: !0,
208
- name: t.sub_logo,
209
+ name: e.sub_logo,
209
210
  size: 20
210
- }), T && /* @__PURE__ */ o(l, {
211
+ }), R && /* @__PURE__ */ o(l, {
211
212
  color: "text.secondary",
212
213
  variant: "caption",
213
- children: T
214
+ children: R
214
215
  })]
215
216
  })] })]
216
217
  })]
@@ -218,7 +219,7 @@ var vo = ({ payload: g }) => {
218
219
  });
219
220
  };
220
221
  export {
221
- vo as default
222
+ wo as default
222
223
  };
223
224
 
224
225
  //# sourceMappingURL=AccountBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V2 variants fill `instance_slot.data` (ditto's account_block slots) and it is then the whole\n // truth: a slot it leaves empty, or sends with the wrong kind, draws nothing rather than falling\n // back to the stale flat field it supersedes. Beats not yet migrated send no `data` and keep the\n // flat fields.\n const { data } = instance_slot\n const v2 = data !== undefined\n const dataAmount = slot<unknown>(data, 'amount')\n const amount = v2\n ? typeof dataAmount === 'number' && Number.isFinite(dataAmount)\n ? dataAmount\n : undefined\n : instance_slot.amount\n // One V2 slot feeds the line under the amount on both tiles. V1 called it `sub_text` on the\n // standard tile and `label` on the confetti tile, so each keeps its own flat field.\n const dataSubText = slot<unknown>(data, 'sub_text')\n const v2SubText = typeof dataSubText === 'string' ? dataSubText : undefined\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const dataHeaderText = slot<unknown>(data, 'header_text')\n const header_text = v2\n ? typeof dataHeaderText === 'string'\n ? dataHeaderText\n : undefined\n : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n // Confetti-backed celebration variants (deposits, payoff, savings) — a success-tinted card\n // on a gradient + confetti wash. Everything variant-specific is flat on `layoutConfig`.\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // SVG is 58x46 but the card sits at (0,14) with the check badge overflowing top-right.\n // Box it to Figma's 48px graphic frame (the card is 44x32) and shift the SVG up so it aligns\n // with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // Deposit cards show the payer name — a merchant when we have one, otherwise the institution.\n // V2 sends it resolved as `data.secondary_text`; the flat fields remain the fallback.\n const dataSecondaryText = slot<unknown>(data, 'secondary_text')\n const payer =\n (typeof dataSecondaryText === 'string' && dataSecondaryText) ||\n (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GA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,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
1
+ {"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA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YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
@@ -1,37 +1,38 @@
1
- import { buildDynamicCopy as l } from "../../../../core/utils/Localization.es.js";
2
- import { GlobalDataContext as u } from "../../../../common/context/GlobalDataProvider.es.js";
3
- import { slot as s } from "../../../../core/types/Insights.es.js";
1
+ import { buildDynamicCopy as s } from "../../../../core/utils/Localization.es.js";
2
+ import { GlobalDataContext as l } from "../../../../common/context/GlobalDataProvider.es.js";
3
+ import { slot as u } from "../../../../core/types/Insights.es.js";
4
4
  import { resolveVariantConfig as c } from "../../resolveVariantConfig.es.js";
5
- import d from "../../../components/LogoFromGuid.es.js";
6
- import g from "../../../components/DirectDepositCard.es.js";
7
- import { detailedAccountVariant as p, getLayoutConfig as f } from "./layout.es.js";
8
- import { useContext as _ } from "react";
5
+ import g from "../../../components/LogoFromGuid.es.js";
6
+ import { asText as p, slotOrFlat as d } from "../../slotReaders.es.js";
7
+ import f from "../../../components/DirectDepositCard.es.js";
8
+ import { detailedAccountVariant as _, getLayoutConfig as v } from "./layout.es.js";
9
+ import { useContext as y } from "react";
9
10
  import { jsx as m } from "react/jsx-runtime";
10
- import { useTheme as v } from "@mui/material/styles";
11
- var n = (o, r) => s(o.data, r) ?? o[r], y = (o, r) => {
12
- const t = s(o.data, "logo"), e = n(o, "institution_guid"), a = t?.alt ?? n(o, "institution_name"), i = t ?? (e ? {
11
+ import { useTheme as x } from "@mui/material/styles";
12
+ var n = (t, a) => p(d(t, a)), C = (t, a) => {
13
+ const o = u(t.data, "logo"), e = n(t, "institution_guid"), r = o?.alt ?? n(t, "institution_name"), i = o ?? (e ? {
13
14
  guid: e,
14
- alt: a ?? e
15
+ alt: r ?? e
15
16
  } : void 0);
16
- return !i || !a ? i : {
17
+ return !i || !r ? i : {
17
18
  ...i,
18
- alt: r ? l(r, a) : a
19
+ alt: a ? s(a, r) : r
19
20
  };
20
- }, G = ({ payload: o }) => {
21
- const r = v(), { instance_slot: t } = o, e = _(u)?.globalStore.copyStore.copy.insights_feed?.general?.institution_Logo, a = y(t, e), i = c(f(r), t.variant, p.Neutral, "DetailedAccountBlock");
22
- return /* @__PURE__ */ m(g, {
21
+ }, j = ({ payload: t }) => {
22
+ const a = x(), { instance_slot: o } = t, e = y(l)?.globalStore.copyStore.copy.insights_feed?.general?.institution_Logo, r = C(o, e), i = c(v(a), o.variant, _.Neutral, "DetailedAccountBlock");
23
+ return /* @__PURE__ */ m(f, {
23
24
  ...i,
24
- logo: a?.guid ? /* @__PURE__ */ m(d, {
25
- logo: a,
25
+ logo: r?.guid ? /* @__PURE__ */ m(g, {
26
+ logo: r,
26
27
  size: 48
27
28
  }) : null,
28
- name: n(t, "account_name"),
29
- statusLabel: n(t, "status_text"),
30
- subtitle: n(t, "account_type")
29
+ name: n(o, "account_name"),
30
+ statusLabel: n(o, "status_text"),
31
+ subtitle: n(o, "account_type")
31
32
  });
32
33
  };
33
34
  export {
34
- G as default
35
+ j as default
35
36
  };
36
37
 
37
38
  //# sourceMappingURL=DetailedAccountBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DetailedAccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.tsx"],"sourcesContent":["import { useContext } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { GlobalDataContext } from '../../../../common/context/GlobalDataProvider'\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport DirectDepositCard from '../../../components/DirectDepositCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\n\nimport { detailedAccountVariant, getLayoutConfig } from './layout'\n\ninterface DetailedAccountBlockProps {\n payload: InsightsPayload\n}\n\ntype InstanceSlot = InsightsPayload['instance_slot']\n\n/** `data` first; the flat field is the earlier shape. */\nconst readFact = (instanceSlot: InstanceSlot, name: keyof InstanceSlot): string | undefined =>\n slot<string>(instanceSlot.data, name) ?? (instanceSlot[name] as string | undefined)\n\n/** The slot's logo, else one built from the guid; the alt is worded as legacy (\"{institution} Institution Logo\"). */\nconst resolveLogo = (instanceSlot: InstanceSlot, altCopy?: string): LogoRef | undefined => {\n const dataLogo = slot<LogoRef>(instanceSlot.data, 'logo')\n const guid = readFact(instanceSlot, 'institution_guid')\n const name = dataLogo?.alt ?? readFact(instanceSlot, 'institution_name')\n\n const logo = dataLogo ?? (guid ? { guid, alt: name ?? guid } : undefined)\n if (!logo || !name) return logo\n\n return { ...logo, alt: altCopy ? (buildDynamicCopy(altCopy, name) as string) : name }\n}\n\nconst DetailedAccountBlock = ({ payload }: DetailedAccountBlockProps) => {\n const theme = useTheme()\n const { instance_slot } = payload\n // Optional: the micro widget renders this block without a GlobalDataProvider.\n const altCopy =\n useContext(GlobalDataContext)?.globalStore.copyStore.copy.insights_feed?.general\n ?.institution_Logo\n const logo = resolveLogo(instance_slot, altCopy)\n const layout = resolveVariantConfig(\n getLayoutConfig(theme),\n instance_slot.variant,\n detailedAccountVariant.Neutral,\n 'DetailedAccountBlock',\n )\n\n return (\n <DirectDepositCard\n {...layout}\n logo={logo?.guid ? <LogoFromGuid logo={logo} size={48} /> : null}\n name={readFact(instance_slot, 'account_name')}\n statusLabel={readFact(instance_slot, 'status_text')}\n subtitle={readFact(instance_slot, 'account_type')}\n />\n )\n}\n\nexport default DetailedAccountBlock\n"],"mappings":";;;;;;;;;;AAqBA,IAAM,IAAA,CAAY,GAA4B,MAC5C,EAAa,EAAa,MAAM,CAAI,KAAM,EAAa,CAAA,GAGnD,IAAA,CAAe,GAA4B,MAA0C;AACzF,QAAM,IAAW,EAAc,EAAa,MAAM,MAAM,GAClD,IAAO,EAAS,GAAc,kBAAkB,GAChD,IAAO,GAAU,OAAO,EAAS,GAAc,kBAAkB,GAEjE,IAAO,MAAa,IAAO;AAAA,IAAE,MAAA;AAAA,IAAM,KAAK,KAAQ;AAAA,EAAK,IAAI;AAC/D,SAAI,CAAC,KAAQ,CAAC,IAAa,IAEpB;AAAA,IAAE,GAAG;AAAA,IAAM,KAAK,IAAW,EAAiB,GAAS,CAAI,IAAe;AAAA,EAAK;AACtF,GAEM,IAAA,CAAwB,EAAE,SAAA,EAAA,MAAyC;AACvE,QAAM,IAAQ,EAAS,GACjB,EAAE,eAAA,EAAA,IAAkB,GAEpB,IACJ,EAAW,CAAiB,GAAG,YAAY,UAAU,KAAK,eAAe,SACrE,kBACA,IAAO,EAAY,GAAe,CAAO,GACzC,IAAS,EACb,EAAgB,CAAK,GACrB,EAAc,SACd,EAAuB,SACvB,sBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MAAM,GAAM,OAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAK,CAAA,IAAI;AAAA,IAC5D,MAAM,EAAS,GAAe,cAAc;AAAA,IAC5C,aAAa,EAAS,GAAe,aAAa;AAAA,IAClD,UAAU,EAAS,GAAe,cAAc;AAAA,EACjD,CAAA;AAEL"}
1
+ {"version":3,"file":"DetailedAccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.tsx"],"sourcesContent":["import { useContext } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\n\nimport { GlobalDataContext } from '../../../../common/context/GlobalDataProvider'\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport DirectDepositCard from '../../../components/DirectDepositCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asText, slotOrFlat, type FlatSlotKey } from '../../slotReaders'\n\nimport { detailedAccountVariant, getLayoutConfig } from './layout'\n\ninterface DetailedAccountBlockProps {\n payload: InsightsPayload\n}\n\ntype InstanceSlot = InsightsPayload['instance_slot']\n\nconst readFact = (instanceSlot: InstanceSlot, name: FlatSlotKey): string | undefined =>\n asText(slotOrFlat(instanceSlot, name))\n\n/** The slot's logo, else one built from the guid; the alt is worded as legacy (\"{institution} Institution Logo\"). */\nconst resolveLogo = (instanceSlot: InstanceSlot, altCopy?: string): LogoRef | undefined => {\n const dataLogo = slot<LogoRef>(instanceSlot.data, 'logo')\n const guid = readFact(instanceSlot, 'institution_guid')\n const name = dataLogo?.alt ?? readFact(instanceSlot, 'institution_name')\n\n const logo = dataLogo ?? (guid ? { guid, alt: name ?? guid } : undefined)\n if (!logo || !name) return logo\n\n return { ...logo, alt: altCopy ? (buildDynamicCopy(altCopy, name) as string) : name }\n}\n\nconst DetailedAccountBlock = ({ payload }: DetailedAccountBlockProps) => {\n const theme = useTheme()\n const { instance_slot } = payload\n // Optional: the micro widget renders this block without a GlobalDataProvider.\n const altCopy =\n useContext(GlobalDataContext)?.globalStore.copyStore.copy.insights_feed?.general\n ?.institution_Logo\n const logo = resolveLogo(instance_slot, altCopy)\n const layout = resolveVariantConfig(\n getLayoutConfig(theme),\n instance_slot.variant,\n detailedAccountVariant.Neutral,\n 'DetailedAccountBlock',\n )\n\n return (\n <DirectDepositCard\n {...layout}\n logo={logo?.guid ? <LogoFromGuid logo={logo} size={48} /> : null}\n name={readFact(instance_slot, 'account_name')}\n statusLabel={readFact(instance_slot, 'status_text')}\n subtitle={readFact(instance_slot, 'account_type')}\n />\n )\n}\n\nexport default DetailedAccountBlock\n"],"mappings":";;;;;;;;;;;AAqBA,IAAM,IAAA,CAAY,GAA4B,MAC5C,EAAO,EAAW,GAAc,CAAI,CAAC,GAGjC,IAAA,CAAe,GAA4B,MAA0C;AACzF,QAAM,IAAW,EAAc,EAAa,MAAM,MAAM,GAClD,IAAO,EAAS,GAAc,kBAAkB,GAChD,IAAO,GAAU,OAAO,EAAS,GAAc,kBAAkB,GAEjE,IAAO,MAAa,IAAO;AAAA,IAAE,MAAA;AAAA,IAAM,KAAK,KAAQ;AAAA,EAAK,IAAI;AAC/D,SAAI,CAAC,KAAQ,CAAC,IAAa,IAEpB;AAAA,IAAE,GAAG;AAAA,IAAM,KAAK,IAAW,EAAiB,GAAS,CAAI,IAAe;AAAA,EAAK;AACtF,GAEM,IAAA,CAAwB,EAAE,SAAA,EAAA,MAAyC;AACvE,QAAM,IAAQ,EAAS,GACjB,EAAE,eAAA,EAAA,IAAkB,GAEpB,IACJ,EAAW,CAAiB,GAAG,YAAY,UAAU,KAAK,eAAe,SACrE,kBACA,IAAO,EAAY,GAAe,CAAO,GACzC,IAAS,EACb,EAAgB,CAAK,GACrB,EAAc,SACd,EAAuB,SACvB,sBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MAAM,GAAM,OAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAK,CAAA,IAAI;AAAA,IAC5D,MAAM,EAAS,GAAe,cAAc;AAAA,IAC5C,aAAa,EAAS,GAAe,aAAa;AAAA,IAClD,UAAU,EAAS,GAAe,cAAc;AAAA,EACjD,CAAA;AAEL"}
@@ -1,14 +1,14 @@
1
- import { buildPluralCopy as u } from "../../../../core/utils/Localization.es.js";
2
- import { useGlobalCopyStore as f } from "../../../../common/context/hooks.es.js";
3
- import { slot as g } from "../../../../core/types/Insights.es.js";
4
- import { formatCurrency as h } from "../../../../core/utils/NumberFormatting.es.js";
5
- import x from "./GasGraphic.es.js";
1
+ import { buildPluralCopy as m } from "../../../../core/utils/Localization.es.js";
2
+ import { useGlobalCopyStore as u } from "../../../../common/context/hooks.es.js";
3
+ import { formatCurrency as f } from "../../../../core/utils/NumberFormatting.es.js";
4
+ import { asNumber as _, slotOrFlat as s } from "../../slotReaders.es.js";
5
+ import g from "./GasGraphic.es.js";
6
6
  import o from "@mui/material/Stack";
7
7
  import { Text as a } from "@mxenabled/mxui";
8
- import { jsx as t, jsxs as p } from "react/jsx-runtime";
9
- var b = "_1{count} Fill-ups", v = "_1{count} Fill-up", y = "spent on gas", m = (r) => typeof r == "number" && Number.isFinite(r), T = ({ payload: r }) => {
10
- const i = f().insights_feed?.general, { instance_slot: l = {}, widget_type: d } = r, n = d === "mini", e = (c) => g(l.data, c) ?? l[c], s = e("total_fill_up_visits"), _ = e("total_spend") ?? e("total_debt_for_fill_up_visits_in_prev_month");
11
- return !m(s) || !m(_) ? null : /* @__PURE__ */ p(o, {
8
+ import { jsx as r, jsxs as l } from "react/jsx-runtime";
9
+ var h = "_1{count} Fill-ups", x = "_1{count} Fill-up", v = "spent on gas", P = ({ payload: c }) => {
10
+ const t = u().insights_feed?.general, { instance_slot: i = {}, widget_type: d } = c, n = d === "mini", e = _(s(i, "total_fill_up_visits")), p = _(s(i, "total_spend") ?? s(i, "total_debt_for_fill_up_visits_in_prev_month"));
11
+ return e === void 0 || p === void 0 ? null : /* @__PURE__ */ l(o, {
12
12
  direction: "row",
13
13
  sx: {
14
14
  alignItems: "center",
@@ -17,51 +17,51 @@ var b = "_1{count} Fill-ups", v = "_1{count} Fill-up", y = "spent on gas", m = (
17
17
  py: n ? 12 : 16,
18
18
  width: "100%"
19
19
  },
20
- children: [/* @__PURE__ */ t(x, {
20
+ children: [/* @__PURE__ */ r(g, {
21
21
  height: n ? 94 : 130,
22
- label: i?.gas_pump
23
- }), /* @__PURE__ */ p(o, {
22
+ label: t?.gas_pump
23
+ }), /* @__PURE__ */ l(o, {
24
24
  sx: {
25
25
  flex: 1,
26
26
  justifyContent: "center",
27
27
  minWidth: 0,
28
28
  pb: 12
29
29
  },
30
- children: [/* @__PURE__ */ t(o, {
30
+ children: [/* @__PURE__ */ r(o, {
31
31
  sx: {
32
32
  bgcolor: "primary.lighter",
33
33
  borderRadius: "4px 4px 0 0",
34
34
  px: 10,
35
35
  py: 4
36
36
  },
37
- children: /* @__PURE__ */ t(a, {
37
+ children: /* @__PURE__ */ r(a, {
38
38
  color: "primary.dark",
39
39
  sx: { fontWeight: 700 },
40
40
  variant: "caption",
41
- children: u(i?.gas_fill_ups_count_one ?? v, i?.gas_fill_ups_count ?? b, s, String(s))
41
+ children: m(t?.gas_fill_ups_count_one ?? x, t?.gas_fill_ups_count ?? h, e, String(e))
42
42
  })
43
- }), /* @__PURE__ */ p(o, {
43
+ }), /* @__PURE__ */ l(o, {
44
44
  sx: {
45
45
  bgcolor: "background.default",
46
46
  borderRadius: "0 0 4px 4px",
47
47
  gap: 2,
48
48
  p: 8
49
49
  },
50
- children: [/* @__PURE__ */ t(a, {
50
+ children: [/* @__PURE__ */ r(a, {
51
51
  component: "span",
52
52
  variant: "h3",
53
- children: h(_, "0,0")
54
- }), /* @__PURE__ */ t(a, {
53
+ children: f(p, "0,0")
54
+ }), /* @__PURE__ */ r(a, {
55
55
  color: "text.secondary",
56
56
  variant: "caption",
57
- children: i?.gas_spent_on_gas ?? y
57
+ children: t?.gas_spent_on_gas ?? v
58
58
  })]
59
59
  })]
60
60
  })]
61
61
  });
62
62
  };
63
63
  export {
64
- T as default
64
+ P as default
65
65
  };
66
66
 
67
67
  //# sourceMappingURL=GasPurchaseBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GasPurchaseBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy, useGlobalCopyStore } from '../../../../common'\nimport { slot, type InstanceSlot } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport type { BlockProps } from '../../types'\n\nimport GasGraphic from './GasGraphic'\n\nconst DEFAULT_FILL_UPS = '_1{count} Fill-ups'\nconst DEFAULT_FILL_UPS_ONE = '_1{count} Fill-up'\nconst DEFAULT_SPENT_ON_GAS = 'spent on gas'\n\ntype GasPurchaseSlot = Pick<\n InstanceSlot,\n 'total_fill_up_visits' | 'total_spend' | 'total_debt_for_fill_up_visits_in_prev_month'\n>\n\nconst isFiniteNumber = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value)\n\nconst GasPurchaseBlock = ({ payload }: BlockProps) => {\n const generalCopy = useGlobalCopyStore().insights_feed?.general\n\n const { instance_slot = {}, widget_type } = payload\n const isMini = widget_type === 'mini'\n const field = <K extends keyof GasPurchaseSlot>(key: K) =>\n slot<InstanceSlot[K]>(instance_slot.data, key) ?? instance_slot[key]\n\n const visits = field('total_fill_up_visits')\n const spend = field('total_spend') ?? field('total_debt_for_fill_up_visits_in_prev_month')\n\n if (!isFiniteNumber(visits) || !isFiniteNumber(spend)) return null\n\n return (\n <Stack\n direction=\"row\"\n sx={{\n alignItems: 'center',\n gap: isMini ? 12 : 16,\n px: 16,\n py: isMini ? 12 : 16,\n width: '100%',\n }}\n >\n <GasGraphic height={isMini ? 94 : 130} label={generalCopy?.gas_pump} />\n <Stack sx={{ flex: 1, justifyContent: 'center', minWidth: 0, pb: 12 }}>\n <Stack sx={{ bgcolor: 'primary.lighter', borderRadius: '4px 4px 0 0', px: 10, py: 4 }}>\n <Text color=\"primary.dark\" sx={{ fontWeight: 700 }} variant=\"caption\">\n {\n buildPluralCopy(\n generalCopy?.gas_fill_ups_count_one ?? DEFAULT_FILL_UPS_ONE,\n generalCopy?.gas_fill_ups_count ?? DEFAULT_FILL_UPS,\n visits,\n String(visits),\n ) as string\n }\n </Text>\n </Stack>\n <Stack sx={{ bgcolor: 'background.default', borderRadius: '0 0 4px 4px', gap: 2, p: 8 }}>\n <Text component=\"span\" variant=\"h3\">\n {formatCurrency(spend, '0,0')}\n </Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {generalCopy?.gas_spent_on_gas ?? DEFAULT_SPENT_ON_GAS}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default GasPurchaseBlock\n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AsB,GACnC,GACA,OAAO,CAAM,CACf;AAAA,QAEE,CAAA;AAAA,MACD,CAAA,GACP,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,SAAS;AAAA,UAAsB,cAAc;AAAA,UAAe,KAAK;AAAA,UAAG,GAAG;AAAA,QAAE;AAAA,QAAtF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,WAAU;AAAA,UAAO,SAAQ;AAAA,UAC5B,UAAA,EAAe,GAAO,KAAK;AAAA,QACxB,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA,GAAa,oBAAoB;AAAA,QAC9B,CAAA,CACD;AAAA,MACF,CAAA,CAAA;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
1
+ {"version":3,"file":"GasPurchaseBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy, useGlobalCopyStore } from '../../../../common'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { asNumber, slotOrFlat } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\n\nimport GasGraphic from './GasGraphic'\n\nconst DEFAULT_FILL_UPS = '_1{count} Fill-ups'\nconst DEFAULT_FILL_UPS_ONE = '_1{count} Fill-up'\nconst DEFAULT_SPENT_ON_GAS = 'spent on gas'\n\nconst GasPurchaseBlock = ({ payload }: BlockProps) => {\n const generalCopy = useGlobalCopyStore().insights_feed?.general\n\n const { instance_slot = {}, widget_type } = payload\n const isMini = widget_type === 'mini'\n const visits = asNumber(slotOrFlat(instance_slot, 'total_fill_up_visits'))\n const spend = asNumber(\n slotOrFlat(instance_slot, 'total_spend') ??\n slotOrFlat(instance_slot, 'total_debt_for_fill_up_visits_in_prev_month'),\n )\n\n if (visits === undefined || spend === undefined) return null\n\n return (\n <Stack\n direction=\"row\"\n sx={{\n alignItems: 'center',\n gap: isMini ? 12 : 16,\n px: 16,\n py: isMini ? 12 : 16,\n width: '100%',\n }}\n >\n <GasGraphic height={isMini ? 94 : 130} label={generalCopy?.gas_pump} />\n <Stack sx={{ flex: 1, justifyContent: 'center', minWidth: 0, pb: 12 }}>\n <Stack sx={{ bgcolor: 'primary.lighter', borderRadius: '4px 4px 0 0', px: 10, py: 4 }}>\n <Text color=\"primary.dark\" sx={{ fontWeight: 700 }} variant=\"caption\">\n {\n buildPluralCopy(\n generalCopy?.gas_fill_ups_count_one ?? DEFAULT_FILL_UPS_ONE,\n generalCopy?.gas_fill_ups_count ?? DEFAULT_FILL_UPS,\n visits,\n String(visits),\n ) as string\n }\n </Text>\n </Stack>\n <Stack sx={{ bgcolor: 'background.default', borderRadius: '0 0 4px 4px', gap: 2, p: 8 }}>\n <Text component=\"span\" variant=\"h3\">\n {formatCurrency(spend, '0,0')}\n </Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {generalCopy?.gas_spent_on_gas ?? DEFAULT_SPENT_ON_GAS}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default GasPurchaseBlock\n"],"mappings":";;;;;;;;AAWA,IAAM,IAAmB,sBACnB,IAAuB,qBACvB,IAAuB,gBAEvB,IAAA,CAAoB,EAAE,SAAA,EAAA,MAA0B;AACpD,QAAM,IAAc,EAAmB,EAAE,eAAe,SAElD,EAAE,eAAA,IAAgB,CAAC,GAAG,aAAA,EAAA,IAAgB,GACtC,IAAS,MAAgB,QACzB,IAAS,EAAS,EAAW,GAAe,sBAAsB,CAAC,GACnE,IAAQ,EACZ,EAAW,GAAe,aAAa,KACrC,EAAW,GAAe,6CAA6C,CAC3E;AAEA,SAAI,MAAW,UAAa,MAAU,SAAkB,OAGtD,gBAAA,EAAC,GAAD;AAAA,IACE,WAAU;AAAA,IACV,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,KA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