@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.
- package/CHANGELOG.md +4 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +75 -74
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +23 -22
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js +21 -21
- package/dist/insights-v2/blocks/ComponentBlocks/GasPurchaseBlock/GasPurchaseBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js +22 -24
- package/dist/insights-v2/blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +52 -51
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js +16 -16
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +17 -16
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +19 -18
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +31 -31
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.d.ts +2 -7
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +35 -34
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +33 -33
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.d.ts +2 -7
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +16 -15
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js.map +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +12 -0
- package/dist/insights-v2/blocks/slotReaders.es.js +9 -0
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -0
- package/package.json +1 -1
package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useGlobalCopyStore as v } from "../../../../common/context/hooks.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ReactComponent as
|
|
6
|
-
import { ReactComponent as
|
|
7
|
-
import
|
|
8
|
-
import { H2 as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import
|
|
11
|
-
var g = (
|
|
2
|
+
import { formatCurrency as u } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { ThemedSVGImage as h } from "../../../components/chartblocks/ThemedSVGImage.es.js";
|
|
4
|
+
import { asNumber as b, asText as y, slotOrFlat as a } from "../../slotReaders.es.js";
|
|
5
|
+
import { ReactComponent as _ } from "../../../components/shared/images/SaveEnoughToLiveOnBottom.es.js";
|
|
6
|
+
import { ReactComponent as w } from "../../../components/shared/images/SaveEnoughToLiveOnTop.es.js";
|
|
7
|
+
import n from "@mui/material/Stack";
|
|
8
|
+
import { H2 as C, Text as f } from "@mxenabled/mxui";
|
|
9
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
10
|
+
import R from "@mui/material/Box";
|
|
11
|
+
var g = ({ label: o, amount: r }) => /* @__PURE__ */ t(n, {
|
|
12
12
|
direction: "row",
|
|
13
13
|
sx: {
|
|
14
14
|
alignItems: "center",
|
|
@@ -17,59 +17,59 @@ var g = (e) => typeof e == "number" && Number.isFinite(e), u = ({ label: e, amou
|
|
|
17
17
|
minHeight: 40,
|
|
18
18
|
px: 16
|
|
19
19
|
},
|
|
20
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ e(f, {
|
|
21
21
|
color: "text.secondary",
|
|
22
22
|
component: "dt",
|
|
23
23
|
variant: "caption",
|
|
24
|
-
children:
|
|
25
|
-
}), /* @__PURE__ */
|
|
24
|
+
children: o
|
|
25
|
+
}), /* @__PURE__ */ e(f, {
|
|
26
26
|
bold: !0,
|
|
27
27
|
color: "text.primary",
|
|
28
28
|
component: "dd",
|
|
29
29
|
sx: { m: 0 },
|
|
30
30
|
variant: "body2",
|
|
31
|
-
children:
|
|
31
|
+
children: u(r, "0,0")
|
|
32
32
|
})]
|
|
33
|
-
}),
|
|
34
|
-
const r =
|
|
35
|
-
return !m || !s ||
|
|
33
|
+
}), H = ({ payload: o }) => {
|
|
34
|
+
const r = o.widget_type === "mini", d = v().insights_feed?.make_transfer, m = d?.available_balances_text, s = d?.average_monthly_spend_text, { instance_slot: i = {} } = o, l = b(a(i, "available_balance")), c = b(a(i, "avg_monthly_spend")), p = y(a(i, "time_period")), x = !!p;
|
|
35
|
+
return !m || !s || l === void 0 || c === void 0 ? null : /* @__PURE__ */ t(n, {
|
|
36
36
|
sx: {
|
|
37
37
|
alignItems: "center",
|
|
38
38
|
gap: r ? 12 : 24,
|
|
39
39
|
px: 16,
|
|
40
40
|
width: "100%"
|
|
41
41
|
},
|
|
42
|
-
children: [(!r || x) && /* @__PURE__ */
|
|
42
|
+
children: [(!r || x) && /* @__PURE__ */ t(n, {
|
|
43
43
|
sx: { alignItems: "center" },
|
|
44
|
-
children: [!r && /* @__PURE__ */
|
|
44
|
+
children: [!r && /* @__PURE__ */ e(h, {
|
|
45
45
|
divProps: { style: {
|
|
46
46
|
maxWidth: "100%",
|
|
47
47
|
width: 264
|
|
48
48
|
} },
|
|
49
|
-
image:
|
|
50
|
-
}), x && /* @__PURE__ */
|
|
49
|
+
image: w
|
|
50
|
+
}), x && /* @__PURE__ */ t(R, {
|
|
51
51
|
sx: {
|
|
52
52
|
display: "grid",
|
|
53
53
|
mt: r ? 0 : -60,
|
|
54
54
|
placeItems: "center"
|
|
55
55
|
},
|
|
56
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ e(h, {
|
|
57
57
|
divProps: { style: {
|
|
58
58
|
gridArea: "1 / 1",
|
|
59
59
|
maxWidth: "none",
|
|
60
60
|
width: 262
|
|
61
61
|
} },
|
|
62
|
-
image:
|
|
63
|
-
}), /* @__PURE__ */
|
|
62
|
+
image: _
|
|
63
|
+
}), /* @__PURE__ */ e(C, {
|
|
64
64
|
sx: {
|
|
65
65
|
color: "neutral.contrastText",
|
|
66
66
|
gridArea: "1 / 1",
|
|
67
67
|
textAlign: "center"
|
|
68
68
|
},
|
|
69
|
-
children:
|
|
69
|
+
children: p
|
|
70
70
|
})]
|
|
71
71
|
})]
|
|
72
|
-
}), /* @__PURE__ */
|
|
72
|
+
}), /* @__PURE__ */ t(n, {
|
|
73
73
|
component: "dl",
|
|
74
74
|
sx: {
|
|
75
75
|
"& > div + div": {
|
|
@@ -82,18 +82,18 @@ var g = (e) => typeof e == "number" && Number.isFinite(e), u = ({ label: e, amou
|
|
|
82
82
|
m: 0,
|
|
83
83
|
width: "100%"
|
|
84
84
|
},
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
-
amount:
|
|
85
|
+
children: [/* @__PURE__ */ e(g, {
|
|
86
|
+
amount: l,
|
|
87
87
|
label: m
|
|
88
|
-
}), /* @__PURE__ */
|
|
89
|
-
amount:
|
|
88
|
+
}), /* @__PURE__ */ e(g, {
|
|
89
|
+
amount: c,
|
|
90
90
|
label: s
|
|
91
91
|
})]
|
|
92
92
|
})]
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
export {
|
|
96
|
-
|
|
96
|
+
H as default
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
//# sourceMappingURL=SavingsSummaryBlock.es.js.map
|
package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavingsSummaryBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport {
|
|
1
|
+
{"version":3,"file":"SavingsSummaryBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { ThemedSVGImage } from '../../../components/chartblocks/ThemedSVGImage'\nimport { ReactComponent as BrushStroke } from '../../../components/shared/images/SaveEnoughToLiveOnBottom.svg'\nimport { ReactComponent as CalendarGraphic } from '../../../components/shared/images/SaveEnoughToLiveOnTop.svg'\nimport { asNumber, asText, slotOrFlat } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\n\nconst Row = ({ label, amount }: { label: string; amount: number }) => (\n <Stack\n direction=\"row\"\n sx={{ alignItems: 'center', gap: 16, justifyContent: 'space-between', minHeight: 40, px: 16 }}\n >\n <Text color=\"text.secondary\" component=\"dt\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} color=\"text.primary\" component=\"dd\" sx={{ m: 0 }} variant=\"body2\">\n {formatCurrency(amount, '0,0')}\n </Text>\n </Stack>\n)\n\nconst SavingsSummaryBlock = ({ payload }: BlockProps) => {\n const hideCalendar = payload.widget_type === 'mini'\n const copy = useGlobalCopyStore().insights_feed?.make_transfer\n const balanceLabel = copy?.available_balances_text\n const spendLabel = copy?.average_monthly_spend_text\n\n const { instance_slot = {} } = payload\n const balance = asNumber(slotOrFlat(instance_slot, 'available_balance'))\n const spend = asNumber(slotOrFlat(instance_slot, 'avg_monthly_spend'))\n const timePeriod = asText(slotOrFlat(instance_slot, 'time_period'))\n const hasTimePeriod = !!timePeriod\n\n // Both figures need a label and a real number; never show a made-up $0.\n if (!balanceLabel || !spendLabel || balance === undefined || spend === undefined) {\n return null\n }\n\n return (\n <Stack sx={{ alignItems: 'center', gap: hideCalendar ? 12 : 24, px: 16, width: '100%' }}>\n {(!hideCalendar || hasTimePeriod) && (\n <Stack sx={{ alignItems: 'center' }}>\n {!hideCalendar && (\n <ThemedSVGImage\n divProps={{ style: { maxWidth: '100%', width: 264 } }}\n image={CalendarGraphic}\n />\n )}\n {hasTimePeriod && (\n <Box sx={{ display: 'grid', mt: hideCalendar ? 0 : -60, placeItems: 'center' }}>\n <ThemedSVGImage\n divProps={{ style: { gridArea: '1 / 1', maxWidth: 'none', width: 262 } }}\n image={BrushStroke}\n />\n <H2 sx={{ color: 'neutral.contrastText', gridArea: '1 / 1', textAlign: 'center' }}>\n {timePeriod}\n </H2>\n </Box>\n )}\n </Stack>\n )}\n <Stack\n component=\"dl\"\n sx={{\n '& > div + div': { borderTop: 1, borderColor: 'divider' },\n border: 1,\n borderColor: 'divider',\n borderRadius: '4px',\n m: 0,\n width: '100%',\n }}\n >\n <Row amount={balance} label={balanceLabel} />\n <Row amount={spend} label={spendLabel} />\n </Stack>\n </Stack>\n )\n}\n\nexport default SavingsSummaryBlock\n"],"mappings":";;;;;;;;;;AAaA,IAAM,IAAA,CAAO,EAAE,OAAA,GAAO,QAAA,EAAA,MACpB,gBAAA,EAAC,GAAD;AAAA,EACE,WAAU;AAAA,EACV,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAI,gBAAgB;AAAA,IAAiB,WAAW;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAF9F,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAK,SAAQ;AAAA,IACjD,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,OAAM;AAAA,IAAe,WAAU;AAAA,IAAK,IAAI,EAAE,GAAG,EAAE;AAAA,IAAG,SAAQ;AAAA,IACzE,UAAA,EAAe,GAAQ,KAAK;AAAA,EACzB,CAAA,CACD;IAGH,IAAA,CAAuB,EAAE,SAAA,EAAA,MAA0B;AACvD,QAAM,IAAe,EAAQ,gBAAgB,QACvC,IAAO,EAAmB,EAAE,eAAe,eAC3C,IAAe,GAAM,yBACrB,IAAa,GAAM,4BAEnB,EAAE,eAAA,IAAgB,CAAC,EAAA,IAAM,GACzB,IAAU,EAAS,EAAW,GAAe,mBAAmB,CAAC,GACjE,IAAQ,EAAS,EAAW,GAAe,mBAAmB,CAAC,GAC/D,IAAa,EAAO,EAAW,GAAe,aAAa,CAAC,GAC5D,IAAgB,CA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BAAA,EAAC,GAAD;AAAA,QAAK,QAAQ;AAAA,QAAS,OAAO;AAAA,MAAe,CAAA,GAC5C,gBAAA,EAAC,GAAD;AAAA,QAAK,QAAQ;AAAA,QAAO,OAAO;AAAA,MAAa,CAAA,CACnC;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|
|
@@ -10,13 +10,8 @@ export declare const BACKDROP_TILES: {
|
|
|
10
10
|
top: number;
|
|
11
11
|
}[];
|
|
12
12
|
/**
|
|
13
|
-
* Upcoming Subscription
|
|
14
|
-
*
|
|
15
|
-
* `SubscriptionHeroCard` with the scattered faded-logo backdrop.
|
|
16
|
-
*
|
|
17
|
-
* Wrapped in `createVariantBlock` from day one so an added design branch is a new registry
|
|
18
|
-
* entry, not a rewrite of dispatch logic. Today only `upcoming_subscription` is defined; an
|
|
19
|
-
* unknown variant degrades to it.
|
|
13
|
+
* Upcoming Subscription (Figma "Full | Upcoming Subscription"). `createVariantBlock` so a new design
|
|
14
|
+
* is a registry entry; an unknown variant renders `upcoming_subscription`.
|
|
20
15
|
*/
|
|
21
16
|
declare const UpcomingSubscriptionBlock: ({ payload, beatGuid }: UpcomingSubscriptionBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
17
|
export default UpcomingSubscriptionBlock;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
1
|
+
import { useGlobalCopyStore as k } from "../../../../common/context/hooks.es.js";
|
|
2
2
|
import { slot as c } from "../../../../core/types/Insights.es.js";
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
3
|
+
import { formatCurrency as S } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import z from "../../../components/LogoFromGuid.es.js";
|
|
5
|
+
import { asNumber as h, asText as b } from "../../slotReaders.es.js";
|
|
6
|
+
import C from "../../../components/SubscriptionHeroCard.es.js";
|
|
7
|
+
import { createVariantBlock as $ } from "../../createVariantBlock.es.js";
|
|
8
|
+
import { CADENCE as B, upcomingSubscriptionVariant as T } from "./layout.es.js";
|
|
9
|
+
import V from "@mui/material/Stack";
|
|
10
|
+
import { jsx as o, jsxs as j } from "react/jsx-runtime";
|
|
10
11
|
import r from "@mui/material/Box";
|
|
11
|
-
var
|
|
12
|
+
var w = [
|
|
12
13
|
{
|
|
13
14
|
size: 51,
|
|
14
15
|
opacity: 0.5,
|
|
@@ -88,24 +89,24 @@ var E = [
|
|
|
88
89
|
top: 57.9
|
|
89
90
|
}
|
|
90
91
|
], x = ({ payload: i }) => {
|
|
91
|
-
const s =
|
|
92
|
-
alt:
|
|
93
|
-
guid:
|
|
94
|
-
} : null,
|
|
92
|
+
const s = k().insights_feed?.upcoming_subscription_block, { instance_slot: p } = i, { data: e } = p, a = i.widget_type === "mini", l = h(c(e, "recurrence_type")), m = h(c(e, "amount")), f = b(c(e, "merchant_name")), u = b(c(e, "merchant_guid")), d = l !== void 0 ? B[l] : void 0, y = s?.[d?.copyKey] ?? d?.word, n = u ? {
|
|
93
|
+
alt: f ?? "",
|
|
94
|
+
guid: u
|
|
95
|
+
} : null, g = m === void 0 ? "" : S(m, "0,0.00"), _ = g ? /* @__PURE__ */ j("span", {
|
|
95
96
|
"data-testid": "subscription-price",
|
|
96
97
|
children: [/* @__PURE__ */ o(r, {
|
|
97
98
|
component: "span",
|
|
98
99
|
sx: { fontWeight: 700 },
|
|
99
|
-
children:
|
|
100
|
-
}),
|
|
100
|
+
children: g
|
|
101
|
+
}), y ? /* @__PURE__ */ o(r, {
|
|
101
102
|
component: "span",
|
|
102
103
|
sx: { fontWeight: 400 },
|
|
103
|
-
children: ` / ${
|
|
104
|
+
children: ` / ${y}`
|
|
104
105
|
}) : null]
|
|
105
|
-
}) : null,
|
|
106
|
+
}) : null, v = n ? /* @__PURE__ */ o(r, {
|
|
106
107
|
"aria-hidden": !0,
|
|
107
108
|
"data-testid": "upcoming-subscription-backdrop",
|
|
108
|
-
children:
|
|
109
|
+
children: w.map((t) => /* @__PURE__ */ o(r, {
|
|
109
110
|
sx: {
|
|
110
111
|
alignItems: "center",
|
|
111
112
|
display: "flex",
|
|
@@ -117,41 +118,41 @@ var E = [
|
|
|
117
118
|
top: `${t.top}%`,
|
|
118
119
|
width: t.size
|
|
119
120
|
},
|
|
120
|
-
children: /* @__PURE__ */ o(
|
|
121
|
+
children: /* @__PURE__ */ o(z, {
|
|
121
122
|
logo: n,
|
|
122
123
|
size: t.size
|
|
123
124
|
})
|
|
124
125
|
}, `${t.size}-${t.left}-${t.top}`))
|
|
125
126
|
}) : null;
|
|
126
|
-
return /* @__PURE__ */ o(
|
|
127
|
+
return /* @__PURE__ */ o(V, {
|
|
127
128
|
sx: { px: 16 },
|
|
128
|
-
children: /* @__PURE__ */ o(
|
|
129
|
-
backdrop:
|
|
130
|
-
compact:
|
|
131
|
-
logo: n ? /* @__PURE__ */ o(
|
|
129
|
+
children: /* @__PURE__ */ o(C, {
|
|
130
|
+
backdrop: v,
|
|
131
|
+
compact: a,
|
|
132
|
+
logo: n ? /* @__PURE__ */ o(z, {
|
|
132
133
|
logo: n,
|
|
133
|
-
size:
|
|
134
|
+
size: a ? 40 : 64
|
|
134
135
|
}) : null,
|
|
135
|
-
name:
|
|
136
|
+
name: f ?? "",
|
|
136
137
|
price: _,
|
|
137
138
|
sx: { px: 0 }
|
|
138
139
|
})
|
|
139
140
|
});
|
|
140
|
-
},
|
|
141
|
-
const
|
|
142
|
-
return /* @__PURE__ */ o(
|
|
141
|
+
}, F = ({ payload: i, beatGuid: s }) => {
|
|
142
|
+
const p = i.instance_slot.variant ?? void 0;
|
|
143
|
+
return /* @__PURE__ */ o(E, {
|
|
143
144
|
beatGuid: s,
|
|
144
145
|
payload: i,
|
|
145
|
-
variant:
|
|
146
|
+
variant: p
|
|
146
147
|
});
|
|
147
|
-
},
|
|
148
|
-
variants: { [
|
|
148
|
+
}, E = $({
|
|
149
|
+
variants: { [T.Hero]: x },
|
|
149
150
|
fallback: x,
|
|
150
151
|
name: "UpcomingSubscriptionBlock"
|
|
151
152
|
});
|
|
152
153
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
w as BACKDROP_TILES,
|
|
155
|
+
F as default
|
|
155
156
|
};
|
|
156
157
|
|
|
157
158
|
//# sourceMappingURL=UpcomingSubscriptionBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpcomingSubscriptionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { Frequency, slot, type InsightsPayload } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport SubscriptionHeroCard from '../../../components/SubscriptionHeroCard'\nimport { createVariantBlock } from '../../createVariantBlock'\n\nimport { CADENCE, upcomingSubscriptionVariant } from './layout'\n\ninterface UpcomingSubscriptionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\n//
|
|
1
|
+
{"version":3,"file":"UpcomingSubscriptionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport { Frequency, slot, type InsightsPayload } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport SubscriptionHeroCard from '../../../components/SubscriptionHeroCard'\nimport { createVariantBlock } from '../../createVariantBlock'\nimport { asNumber, asText } from '../../slotReaders'\n\nimport { CADENCE, upcomingSubscriptionVariant } from './layout'\n\ninterface UpcomingSubscriptionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\n// Backdrop logo positions as % of the hero slot; the card clips the ones at the edge, as in Figma.\nexport const BACKDROP_TILES: { size: number; opacity: number; left: number; top: number }[] = [\n { size: 51, opacity: 0.5, left: 6.9, top: -13.7 },\n { size: 51, opacity: 0.5, left: 82.8, top: 75.9 },\n { size: 33, opacity: 0.35, left: 15.9, top: 35.7 },\n { size: 33, opacity: 0.35, left: -5.0, top: 57.1 },\n { size: 33, opacity: 0.35, left: 9.3, top: 89.8 },\n { size: 33, opacity: 0.35, left: 96.0, top: 48.8 },\n { size: 33, opacity: 0.35, left: 69.7, top: -9.3 },\n { size: 26, opacity: 0.25, left: 33.1, top: 76.4 },\n { size: 26, opacity: 0.25, left: 0.6, top: 24.8 },\n { size: 26, opacity: 0.25, left: 94.1, top: 5.5 },\n { size: 26, opacity: 0.25, left: 75.4, top: 27.5 },\n { size: 16, opacity: 0.1, left: 59.7, top: 88.8 },\n { size: 16, opacity: 0.1, left: 72.3, top: 57.9 },\n]\n\nconst UpcomingSubscriptionVariant = ({ payload }: UpcomingSubscriptionBlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.upcoming_subscription_block\n const { instance_slot } = payload\n const { data } = instance_slot\n const isMini = payload.widget_type === 'mini'\n\n // V2 only (reached via `is_insights_v2`): an empty or wrongly typed slot draws nothing.\n const dataType = asNumber(slot(data, 'recurrence_type'))\n\n const amount = asNumber(slot(data, 'amount'))\n const merchant_name = asText(slot(data, 'merchant_name'))\n const merchant_guid = asText(slot(data, 'merchant_guid'))\n // The host's cadence word, else English; an unknown type shows the price alone.\n const entry = dataType !== undefined ? CADENCE[dataType as Frequency] : undefined\n const cadence = copy?.[entry?.copyKey as keyof typeof copy] ?? entry?.word\n\n const logoRef = merchant_guid ? { alt: merchant_name ?? '', guid: merchant_guid } : null\n const amountText = amount === undefined ? '' : formatCurrency(amount, '0,0.00')\n // Figma: the amount is bold and \"/ month\" regular, in one pill.\n const price = amountText ? (\n <span data-testid=\"subscription-price\">\n <Box component=\"span\" sx={{ fontWeight: 700 }}>\n {amountText}\n </Box>\n {cadence ? <Box component=\"span\" sx={{ fontWeight: 400 }}>{` / ${cadence}`}</Box> : null}\n </span>\n ) : null\n\n const backdrop = logoRef ? (\n // aria-hidden here too, in case the card's own wrapper changes.\n <Box aria-hidden={true} data-testid=\"upcoming-subscription-backdrop\">\n {BACKDROP_TILES.map((t) => (\n <Box\n key={`${t.size}-${t.left}-${t.top}`}\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: t.size,\n justifyContent: 'center',\n left: `${t.left}%`,\n opacity: t.opacity,\n position: 'absolute',\n top: `${t.top}%`,\n width: t.size,\n }}\n >\n <LogoFromGuid logo={logoRef} size={t.size} />\n </Box>\n ))}\n </Box>\n ) : null\n\n return (\n <Stack sx={{ px: 16 }}>\n <SubscriptionHeroCard\n backdrop={backdrop}\n compact={isMini}\n // Pulse clips mini at 312px: a 40px logo keeps the action label in view.\n logo={logoRef ? <LogoFromGuid logo={logoRef} size={isMini ? 40 : 64} /> : null}\n name={merchant_name ?? ''}\n price={price}\n sx={{ px: 0 }}\n />\n </Stack>\n )\n}\n\n/**\n * Upcoming Subscription (Figma \"Full | Upcoming Subscription\"). `createVariantBlock` so a new design\n * is a registry entry; an unknown variant renders `upcoming_subscription`.\n */\nconst UpcomingSubscriptionBlock = ({ payload, beatGuid }: UpcomingSubscriptionBlockProps) => {\n const variant = payload.instance_slot.variant ?? undefined\n return <Variants beatGuid={beatGuid} payload={payload} variant={variant} />\n}\n\nconst Variants = createVariantBlock<UpcomingSubscriptionBlockProps>({\n variants: {\n [upcomingSubscriptionVariant.Hero]: UpcomingSubscriptionVariant,\n },\n fallback: UpcomingSubscriptionVariant,\n name: 'UpcomingSubscriptionBlock',\n})\n\nexport default UpcomingSubscriptionBlock\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,IAAiF;AAAA,EAC5F;AAAA,IAAE,MAAM;AAAA,IAAI,SA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K,GAAG,EAAE,GAAA;AAAA,QACV,OAAO,EAAE;AAAA,MACX;AAAA,MAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAc,MAAM;AAAA,QAAS,MAAM,EAAE;AAAA,MAAO,CAAA;AAAA,IACzC,GAdE,GAAG,EAAE,IAAA,IAAQ,EAAE,IAAA,IAAQ,EAAE,GAAA,EAc3B,CACN;AAAA,EACE,CAAA,IACH;AAEJ,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,IAAI,GAAG;AAAA,IAClB,UAAA,gBAAA,EAAC,GAAD;AAAA,MACY,UAAA;AAAA,MACV,SAAS;AAAA,MAET,MAAM,IAAU,gBAAA,EAAC,GAAD;AAAA,QAAc,MAAM;AAAA,QAAS,MAAM,IAAS,KAAK;AAAA,MAAK,CAAA,IAAI;AAAA,MAC1E,MAAM,KAAiB;AAAA,MAChB,OAAA;AAAA,MACP,IAAI,EAAE,IAAI,EAAE;AAAA,IACb,CAAA;AAAA,EACI,CAAA;AAEX,GAMM,IAAA,CAA6B,EAAE,SAAA,GAAS,UAAA,EAAA,MAA+C;AAC3F,QAAM,IAAU,EAAQ,cAAc,WAAW;AACjD,SAAO,gBAAA,EAAC,GAAD;AAAA,IAAoB,UAAA;AAAA,IAAmB,SAAA;AAAA,IAAkB,SAAA;AAAA,EAAU,CAAA;AAC5E,GAEM,IAAW,EAAmD;AAAA,EAClE,UAAU,EAAA,CACP,EAA4B,IAAA,GAAO,EACtC;AAAA,EACA,UAAU;AAAA,EACV,MAAM;AACR,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { buildDynamicCopy as x } from "../../../../core/utils/Localization.es.js";
|
|
2
2
|
import { useGlobalCopyStore as y } from "../../../../common/context/hooks.es.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Text as
|
|
3
|
+
import { formatCurrency as w } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import C, { isLogoGuid as _ } from "../../../components/LogoFromGuid.es.js";
|
|
5
|
+
import { asNumber as L, slotOrFlat as h } from "../../slotReaders.es.js";
|
|
6
|
+
import f from "../../../components/LogoTile.es.js";
|
|
7
|
+
import i from "@mui/material/Stack";
|
|
8
|
+
import { Text as n } from "@mxenabled/mxui";
|
|
9
9
|
import { Icon as R } from "@mxenabled/mx-icons";
|
|
10
|
-
import { jsx as o, jsxs as
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
10
|
+
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
11
|
+
var g = 6, d = 32, S = (r) => typeof r == "object" && r !== null, G = ({ row: r }) => {
|
|
12
|
+
if (_(r.logo?.guid)) return /* @__PURE__ */ o(C, {
|
|
13
13
|
logo: r.logo,
|
|
14
|
-
size:
|
|
14
|
+
size: d
|
|
15
15
|
});
|
|
16
16
|
const e = r.logo?.alt;
|
|
17
17
|
return /* @__PURE__ */ o(R, {
|
|
@@ -24,15 +24,15 @@ var b = 6, m = 32, S = (r) => typeof r == "object" && r !== null, G = ({ row: r
|
|
|
24
24
|
sx: { color: "text.secondary" }
|
|
25
25
|
});
|
|
26
26
|
}, B = ({ payload: r }) => {
|
|
27
|
-
const e = y().insights_feed?.general, { instance_slot:
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
return /* @__PURE__ */ o(
|
|
27
|
+
const e = y().insights_feed?.general, { instance_slot: c = {} } = r, m = L(h(c, "amount"));
|
|
28
|
+
if (m === void 0) return null;
|
|
29
|
+
const p = h(c, "data_series"), t = (Array.isArray(p) ? p : []).filter(S), u = t.length > g ? t.slice(0, 5) : t, a = t.length - u.length, s = x(e?.more_merchants ?? "", `${a}`) || void 0;
|
|
30
|
+
return /* @__PURE__ */ o(i, {
|
|
31
31
|
sx: {
|
|
32
32
|
px: 16,
|
|
33
33
|
width: "100%"
|
|
34
34
|
},
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ l(i, {
|
|
36
36
|
sx: {
|
|
37
37
|
border: 1,
|
|
38
38
|
borderColor: "divider",
|
|
@@ -42,55 +42,55 @@ var b = 6, m = 32, S = (r) => typeof r == "object" && r !== null, G = ({ row: r
|
|
|
42
42
|
pt: 12,
|
|
43
43
|
px: 16
|
|
44
44
|
},
|
|
45
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ l(i, {
|
|
46
46
|
direction: "row",
|
|
47
47
|
sx: {
|
|
48
48
|
alignItems: "baseline",
|
|
49
49
|
gap: 6
|
|
50
50
|
},
|
|
51
|
-
children: [/* @__PURE__ */ o(
|
|
51
|
+
children: [/* @__PURE__ */ o(n, {
|
|
52
52
|
component: "p",
|
|
53
53
|
variant: "h2",
|
|
54
|
-
children:
|
|
55
|
-
}), /* @__PURE__ */ o(
|
|
54
|
+
children: w(m, "0,0.00")
|
|
55
|
+
}), /* @__PURE__ */ o(n, {
|
|
56
56
|
color: "text.secondary",
|
|
57
57
|
variant: "caption",
|
|
58
58
|
children: e?.total
|
|
59
59
|
})]
|
|
60
|
-
}), t.length ? /* @__PURE__ */
|
|
60
|
+
}), t.length ? /* @__PURE__ */ l(i, {
|
|
61
61
|
component: "ul",
|
|
62
62
|
direction: "row",
|
|
63
63
|
sx: {
|
|
64
64
|
flexWrap: "wrap",
|
|
65
65
|
gap: 8,
|
|
66
|
-
justifyContent: t.length >=
|
|
66
|
+
justifyContent: t.length >= g ? "space-between" : "flex-start",
|
|
67
67
|
listStyle: "none",
|
|
68
68
|
m: 0,
|
|
69
69
|
p: 0
|
|
70
70
|
},
|
|
71
|
-
children: [
|
|
71
|
+
children: [u.map((b, v) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(f, {
|
|
72
72
|
borderColor: "divider",
|
|
73
73
|
borderRadius: 4,
|
|
74
|
-
size:
|
|
75
|
-
children: /* @__PURE__ */ o(G, { row:
|
|
76
|
-
}) }, v)),
|
|
74
|
+
size: d,
|
|
75
|
+
children: /* @__PURE__ */ o(G, { row: b })
|
|
76
|
+
}) }, v)), a > 0 && /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(f, {
|
|
77
77
|
bgcolor: "action.hover",
|
|
78
78
|
borderColor: null,
|
|
79
79
|
borderRadius: 4,
|
|
80
|
-
size:
|
|
81
|
-
children: /* @__PURE__ */ o(
|
|
82
|
-
"aria-label":
|
|
80
|
+
size: d,
|
|
81
|
+
children: /* @__PURE__ */ o(n, {
|
|
82
|
+
"aria-label": s,
|
|
83
83
|
bold: !0,
|
|
84
84
|
color: "text.secondary",
|
|
85
|
-
role:
|
|
85
|
+
role: s ? "img" : void 0,
|
|
86
86
|
variant: "body2",
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
"aria-hidden":
|
|
89
|
-
children: ["+",
|
|
87
|
+
children: /* @__PURE__ */ l("span", {
|
|
88
|
+
"aria-hidden": s ? !0 : void 0,
|
|
89
|
+
children: ["+", a]
|
|
90
90
|
})
|
|
91
91
|
})
|
|
92
92
|
}) })]
|
|
93
|
-
}) : /* @__PURE__ */ o(
|
|
93
|
+
}) : /* @__PURE__ */ o(n, {
|
|
94
94
|
color: "text.secondary",
|
|
95
95
|
variant: "body2",
|
|
96
96
|
children: e?.no_small_purchases_found
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeeklySmallPurchasesBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport
|
|
1
|
+
{"version":3,"file":"WeeklySmallPurchasesBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport type { InstanceSlotRow } from '../../../../core'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid, { isLogoGuid } from '../../../components/LogoFromGuid'\nimport LogoTile from '../../../components/LogoTile'\nimport { asNumber, slotOrFlat } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\n\nconst MAX_LOGOS = 6\nconst LOGO_SIZE = 32\n\nconst isRow = (row: unknown): row is InstanceSlotRow => typeof row === 'object' && row !== null\n\nconst RowLogo = ({ row }: { row: InstanceSlotRow }) => {\n if (isLogoGuid(row.logo?.guid)) return <LogoFromGuid logo={row.logo} size={LOGO_SIZE} />\n\n const alt = row.logo?.alt\n return (\n <Icon\n aria-hidden={alt ? undefined : true}\n aria-label={alt}\n data-icon=\"storefront\"\n name=\"storefront\"\n role={alt ? 'img' : undefined}\n size={20}\n sx={{ color: 'text.secondary' }}\n />\n )\n}\n\nconst WeeklySmallPurchasesBlock = ({ payload }: BlockProps) => {\n const generalCopy = useGlobalCopyStore().insights_feed?.general\n\n const { instance_slot = {} } = payload\n const amount = asNumber(slotOrFlat(instance_slot, 'amount'))\n if (amount === undefined) return null\n\n const rawRows = slotOrFlat(instance_slot, 'data_series')\n const rows = (Array.isArray(rawRows) ? rawRows : []).filter(isRow)\n // Past 6, the last tile becomes \"+N\" so the row stays at 6 tiles like Figma.\n const visibleRows = rows.length > MAX_LOGOS ? rows.slice(0, MAX_LOGOS - 1) : rows\n const overflowCount = rows.length - visibleRows.length\n const moreLabel =\n (buildDynamicCopy(generalCopy?.more_merchants ?? '', `${overflowCount}`) as string) || undefined\n\n return (\n <Stack sx={{ px: 16, width: '100%' }}>\n <Stack\n sx={{\n border: 1,\n borderColor: 'divider',\n borderRadius: '8px',\n gap: 12,\n pb: 16,\n pt: 12,\n px: 16,\n }}\n >\n <Stack direction=\"row\" sx={{ alignItems: 'baseline', gap: 6 }}>\n <Text component=\"p\" variant=\"h2\">\n {formatCurrency(amount, '0,0.00')}\n </Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {generalCopy?.total}\n </Text>\n </Stack>\n {rows.length ? (\n <Stack\n component=\"ul\"\n direction=\"row\"\n sx={{\n flexWrap: 'wrap',\n gap: 8,\n justifyContent: rows.length >= MAX_LOGOS ? 'space-between' : 'flex-start',\n listStyle: 'none',\n m: 0,\n p: 0,\n }}\n >\n {visibleRows.map((row, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <li key={index}>\n <LogoTile borderColor=\"divider\" borderRadius={4} size={LOGO_SIZE}>\n <RowLogo row={row} />\n </LogoTile>\n </li>\n ))}\n {overflowCount > 0 && (\n <li>\n <LogoTile\n bgcolor=\"action.hover\"\n borderColor={null}\n borderRadius={4}\n size={LOGO_SIZE}\n >\n <Text\n aria-label={moreLabel}\n bold={true}\n color=\"text.secondary\"\n role={moreLabel ? 'img' : undefined}\n variant=\"body2\"\n >\n <span aria-hidden={moreLabel ? true : undefined}>+{overflowCount}</span>\n </Text>\n </LogoTile>\n </li>\n )}\n </Stack>\n ) : (\n <Text color=\"text.secondary\" variant=\"body2\">\n {generalCopy?.no_small_purchases_found}\n </Text>\n )}\n </Stack>\n </Stack>\n )\n}\n\nexport default WeeklySmallPurchasesBlock\n"],"mappings":";;;;;;;;;;AAcA,IAAM,IAAY,GACZ,IAAY,IAEZ,IAAA,CAAS,MAAyC,OAAO,KAAQ,YAAY,MAAQ,MAErF,IAAA,CAAW,EAAE,KAAA,EAAA,MAAoC;AACrD,MAAI,EAAW,EAAI,MAAM,IAAI,EAAG,QAAO,gBAAA,EAAC,GAAD;AAAA,IAAc,MAAM,EAAI;AAAA,IAAM,MAAM;AAAA,EAAY,CAAA;AAEvF,QAAM,IAAM,EAAI,MAAM;AACtB,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,eAAa,IAAM,SAAY;AAAA,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
|
|
|
1
1
|
interface EmergencySavingsAccountPickerProps {
|
|
2
2
|
beatGuid?: string;
|
|
3
|
-
/** The
|
|
3
|
+
/** The `savings_account_picker` slot data. */
|
|
4
4
|
data?: Record<string, unknown>;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Designate Emergency Savings Account picker (svg_image_block / savings_account_picker). Lists
|
|
8
|
-
* the user's savings accounts from the account store; the words come from the slot. A pick is
|
|
9
|
-
* only written to the beat's context — the card's "Save" CTA (`select_savings_account`) reads it
|
|
10
|
-
* and makes the API call.
|
|
11
|
-
*/
|
|
6
|
+
/** Lists savings accounts; a pick goes to the beat's context, and the "Save" CTA (`select_savings_account`) submits it. */
|
|
12
7
|
export declare const EmergencySavingsAccountPicker: (({ beatGuid, data }: EmergencySavingsAccountPickerProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
13
8
|
displayName: string;
|
|
14
9
|
};
|
package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { useAccountStore as
|
|
1
|
+
import { useAccountStore as g, useInsightsV2Store as p } from "../../../../common/context/hooks.es.js";
|
|
2
2
|
import { ANALYTICS_EVENTS_CONFIG as _ } from "../../../analytics/analyticsEventsConfig.es.js";
|
|
3
3
|
import { useAnalyticsEvent as v } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { asText as t } from "../../slotReaders.es.js";
|
|
5
|
+
import E from "../../../components/DesignateEmergencySavingsCard.es.js";
|
|
6
|
+
import { observer as S } from "mobx-react-lite";
|
|
7
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
8
|
+
var b = S(({ beatGuid: o, data: n = {} }) => {
|
|
9
|
+
const i = g(), r = p(), l = v();
|
|
10
|
+
if (!o) return null;
|
|
11
|
+
const a = t(r.beatContext[o]?.selected_account_guid), s = i.visibleSavingsAccounts.filter((e) => !e.is_closed && !e.is_deleted).map(({ guid: e, name: u }) => ({
|
|
11
12
|
value: e,
|
|
12
|
-
label:
|
|
13
|
-
})), c = a ??
|
|
14
|
-
return /* @__PURE__ */
|
|
13
|
+
label: u ?? ""
|
|
14
|
+
})), c = a ?? t(n.emergency_savings_account_guid), m = s.some((e) => e.value === c) ? c ?? "" : "";
|
|
15
|
+
return /* @__PURE__ */ d(E, {
|
|
15
16
|
graphic: null,
|
|
16
17
|
onChange: (e) => {
|
|
17
|
-
r.setBeatContext(
|
|
18
|
+
r.setBeatContext(o, { selected_account_guid: e }), l(_.EMERGENCY_SAVINGS_ACCT_SELECTED);
|
|
18
19
|
},
|
|
19
20
|
options: s,
|
|
20
|
-
placeholder:
|
|
21
|
-
selectLabel:
|
|
21
|
+
placeholder: t(n.picker_placeholder),
|
|
22
|
+
selectLabel: t(n.picker_label),
|
|
22
23
|
sx: { width: "100%" },
|
|
23
|
-
value:
|
|
24
|
+
value: m
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
27
|
export {
|
package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmergencySavingsAccountPicker.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useInsightsV2Store } from '../../../../common'\nimport DesignateEmergencySavingsCard from '../../../components/DesignateEmergencySavingsCard'\nimport { ANALYTICS_EVENTS_CONFIG } from '../../../analytics/analyticsEventsConfig'\nimport { useAnalyticsEvent } from '../../../analytics'\n\ninterface EmergencySavingsAccountPickerProps {\n beatGuid?: string\n /** The
|
|
1
|
+
{"version":3,"file":"EmergencySavingsAccountPicker.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useInsightsV2Store } from '../../../../common'\nimport DesignateEmergencySavingsCard from '../../../components/DesignateEmergencySavingsCard'\nimport { ANALYTICS_EVENTS_CONFIG } from '../../../analytics/analyticsEventsConfig'\nimport { useAnalyticsEvent } from '../../../analytics'\nimport { asText } from '../../slotReaders'\n\ninterface EmergencySavingsAccountPickerProps {\n beatGuid?: string\n /** The `savings_account_picker` slot data. */\n data?: Record<string, unknown>\n}\n\n/** Lists savings accounts; a pick goes to the beat's context, and the \"Save\" CTA (`select_savings_account`) submits it. */\nexport const EmergencySavingsAccountPicker = observer(\n ({ beatGuid, data = {} }: EmergencySavingsAccountPickerProps) => {\n const accountStore = useAccountStore()\n const insightsV2Store = useInsightsV2Store()\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!beatGuid) return null\n\n const picked = asText(insightsV2Store.beatContext[beatGuid]?.selected_account_guid)\n // Only an account the user can still save into: visible, open and not deleted.\n const options = accountStore.visibleSavingsAccounts\n .filter((account) => !account.is_closed && !account.is_deleted)\n .map(({ guid, name }) => ({ value: guid, label: name ?? '' }))\n\n // The pick, else the slot's designation, only if still an option (else the placeholder).\n const candidate = picked ?? asText(data.emergency_savings_account_guid)\n const value = options.some((option) => option.value === candidate) ? (candidate ?? '') : ''\n\n const onChange = (guid: string) => {\n insightsV2Store.setBeatContext(beatGuid, { selected_account_guid: guid })\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SELECTED)\n }\n\n return (\n <DesignateEmergencySavingsCard\n graphic={null}\n onChange={onChange}\n options={options}\n placeholder={asText(data.picker_placeholder)}\n selectLabel={asText(data.picker_label)}\n sx={{ width: '100%' }}\n value={value}\n />\n )\n },\n)\n"],"mappings":";;;;;;;AAeA,IAAa,IAAgC,EAAA,CAC1C,EAAE,UAAA,GAAU,MAAA,IAAO,CAAC,EAAA,MAA4C;AAC/D,QAAM,IAAe,EAAgB,GAC/B,IAAkB,EAAmB,GACrC,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAU,QAAO;AAEtB,QAAM,IAAS,EAAO,EAAgB,YAAY,CAAA,GAAW,qBAAqB,GAE5E,IAAU,EAAa,uBAC1B,OAAA,CAAQ,MAAY,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAAU,EAC7D,IAAA,CAAK,EAAE,MAAA,GAAM,MAAA,EAAA,OAAY;AAAA,IAAE,OAAO;AAAA,IAAM,OAAO,KAAQ;AAAA,EAAG,EAAE,GAGzD,IAAY,KAAU,EAAO,EAAK,8BAA8B,GAChE,IAAQ,EAAQ,KAAA,CAAM,MAAW,EAAO,UAAU,CAAS,IAAK,KAAa,KAAM;AAOzF,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,IACC,UARR,CAAY,MAAiB;AACjC,MAAA,EAAgB,eAAe,GAAU,EAAE,uBAAuB,EAAK,CAAC,GACxE,EAAmB,EAAwB,+BAA+B;AAAA,IAC5E;AAAA,IAMa,SAAA;AAAA,IACT,aAAa,EAAO,EAAK,kBAAkB;AAAA,IAC3C,aAAa,EAAO,EAAK,YAAY;AAAA,IACrC,IAAI,EAAE,OAAO,OAAO;AAAA,IACb,OAAA;AAAA,EACR,CAAA;AAEL,CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InstanceSlot } from '../../core';
|
|
2
|
+
/** A field V1 payloads carry flat on the slot, beside `data`. */
|
|
3
|
+
export type FlatSlotKey = Exclude<keyof InstanceSlot, 'data' | 'block' | 'variant'>;
|
|
4
|
+
/**
|
|
5
|
+
* `data` first, then the flat field V1 payloads carry beside it. Any non-null `data` value wins,
|
|
6
|
+
* even one of the wrong kind (`data` is the truth; the caller's guard then drops it). For blocks
|
|
7
|
+
* that still accept V1; a V2-only block reads `slot()` so a stale flat field never shows.
|
|
8
|
+
*/
|
|
9
|
+
export declare const slotOrFlat: (instanceSlot: InstanceSlot, key: FlatSlotKey) => unknown;
|
|
10
|
+
/** A finite number, else undefined (so a card never shows a made-up value). */
|
|
11
|
+
export declare const asNumber: (value: unknown) => number | undefined;
|
|
12
|
+
export declare const asText: (value: unknown) => string | undefined;
|