@mx-cartographer/experiences 9.7.34 → 9.7.36
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 +8 -0
- package/README.md +39 -106
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +20 -0
- package/dist/core/types/localization/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +192 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.d.ts +13 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +94 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/index.d.ts +1 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.d.ts +15 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +37 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/ConfidenceMeter.d.ts +13 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/ConfidenceMeter.es.js +62 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/ConfidenceMeter.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.d.ts +11 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +100 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/index.d.ts +1 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.d.ts +27 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js +35 -0
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +36 -23
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +2 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +3 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +75 -63
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Beat } from '../../../core';
|
|
2
|
+
export type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK';
|
|
3
|
+
export declare const BUDGET_TIER_COLORS: Record<BudgetTier, string>;
|
|
4
|
+
export declare const DEFAULT_TIER_COLOR = "success.main";
|
|
5
|
+
export declare const calculateBudgetPercent: (total: number, limit: number) => number;
|
|
6
|
+
export declare const calculateBudgetTier: (percent: number) => BudgetTier | undefined;
|
|
7
|
+
export declare const tierColor: (tier: BudgetTier | undefined) => string;
|
|
8
|
+
export interface BudgetFacts {
|
|
9
|
+
categoryGuid?: string;
|
|
10
|
+
merchantGuid?: string;
|
|
11
|
+
spent?: number;
|
|
12
|
+
budgeted?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const resolveBudgetFacts: (beat: Beat) => BudgetFacts;
|
|
15
|
+
export declare const daysLeftInBudgetMonth: (beat: Beat, now?: Date) => number | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { endOfMonth as i } from "date-fns/endOfMonth";
|
|
2
|
+
import { startOfMonth as s } from "date-fns/startOfMonth";
|
|
3
|
+
import { differenceInCalendarDays as u } from "date-fns/differenceInCalendarDays";
|
|
4
|
+
var c = {
|
|
5
|
+
LOW: "success.light",
|
|
6
|
+
MEDIUM: "warning.light",
|
|
7
|
+
HIGH: "warning.main",
|
|
8
|
+
OFF_TRACK: "error.main"
|
|
9
|
+
}, g = "success.main", y = (t, r) => Math.ceil((r ? t / r : 0) * 100), p = (t) => {
|
|
10
|
+
if (t > 100) return "OFF_TRACK";
|
|
11
|
+
if (t >= 75) return "HIGH";
|
|
12
|
+
if (t >= 50) return "MEDIUM";
|
|
13
|
+
if (t >= 25) return "LOW";
|
|
14
|
+
}, v = (t) => t ? c[t] : g, n = (t) => typeof t == "number" && Number.isFinite(t) ? t : void 0, o = (t) => typeof t == "string" && t ? t : void 0, h = (t) => {
|
|
15
|
+
const r = t.insights_payload, a = r?.instance_slot?.data ?? r?.instance_slot_data ?? {};
|
|
16
|
+
return {
|
|
17
|
+
categoryGuid: o(a.category_guid) ?? r?.primary_category_guid ?? t.primary_category_guid ?? void 0,
|
|
18
|
+
merchantGuid: o(a.merchant_guid) ?? r?.primary_merchant_guid ?? t.primary_merchant_guid ?? void 0,
|
|
19
|
+
spent: n(a.spent_amount),
|
|
20
|
+
budgeted: n(a.budgeted_amount)
|
|
21
|
+
};
|
|
22
|
+
}, l = (t, r = /* @__PURE__ */ new Date()) => {
|
|
23
|
+
const a = t.active_at ?? t.insights_payload?.active_at, e = a == null ? r : new Date(typeof a == "number" ? a * 1e3 : a), d = Number.isNaN(e.getTime()) ? r : e;
|
|
24
|
+
if (!(i(d) < s(r)))
|
|
25
|
+
return u(i(r), r) + 1;
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
c as BUDGET_TIER_COLORS,
|
|
29
|
+
g as DEFAULT_TIER_COLOR,
|
|
30
|
+
y as calculateBudgetPercent,
|
|
31
|
+
p as calculateBudgetTier,
|
|
32
|
+
l as daysLeftInBudgetMonth,
|
|
33
|
+
h as resolveBudgetFacts,
|
|
34
|
+
v as tierColor
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=layout.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/BudgetDetailsBlock/layout.ts"],"sourcesContent":["import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport type { Beat } from '../../../core'\n\nexport type BudgetTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'OFF_TRACK'\n\nexport const BUDGET_TIER_COLORS: Record<BudgetTier, string> = {\n LOW: 'success.light',\n MEDIUM: 'warning.light',\n HIGH: 'warning.main',\n OFF_TRACK: 'error.main',\n}\n\nexport const DEFAULT_TIER_COLOR = 'success.main'\n\nexport const calculateBudgetPercent = (total: number, limit: number) =>\n Math.ceil((limit ? total / limit : 0) * 100)\n\nexport const calculateBudgetTier = (percent: number): BudgetTier | undefined => {\n if (percent > 100) return 'OFF_TRACK'\n if (percent >= 75) return 'HIGH'\n if (percent >= 50) return 'MEDIUM'\n if (percent >= 25) return 'LOW'\n\n return undefined\n}\n\nexport const tierColor = (tier: BudgetTier | undefined) =>\n tier ? BUDGET_TIER_COLORS[tier] : DEFAULT_TIER_COLOR\n\nexport interface BudgetFacts {\n categoryGuid?: string\n merchantGuid?: string\n spent?: number\n budgeted?: number\n}\n\nconst finiteNumber = (value: unknown) =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined\n\nconst nonEmptyString = (value: unknown) => (typeof value === 'string' && value ? value : undefined)\n\nexport const resolveBudgetFacts = (beat: Beat): BudgetFacts => {\n const payload = beat.insights_payload\n const data = (payload?.instance_slot?.data ?? payload?.instance_slot_data ?? {}) as Record<\n string,\n unknown\n >\n\n return {\n categoryGuid:\n nonEmptyString(data.category_guid) ??\n payload?.primary_category_guid ??\n beat.primary_category_guid ??\n undefined,\n merchantGuid:\n nonEmptyString(data.merchant_guid) ??\n payload?.primary_merchant_guid ??\n beat.primary_merchant_guid ??\n undefined,\n spent: finiteNumber(data.spent_amount),\n budgeted: finiteNumber(data.budgeted_amount),\n }\n}\n\nexport const daysLeftInBudgetMonth = (beat: Beat, now = new Date()) => {\n const raw = beat.active_at ?? beat.insights_payload?.active_at\n const at = raw == null ? now : new Date(typeof raw === 'number' ? raw * 1000 : raw)\n const activeAt = Number.isNaN(at.getTime()) ? now : at\n if (endOfMonth(activeAt) < startOfMonth(now)) return undefined\n\n return differenceInCalendarDays(endOfMonth(now), now) + 1\n}\n"],"mappings":";;;AAQA,IAAa,IAAiD;AAAA,EAC5D,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AACb,GAEa,IAAqB,gBAErB,IAAA,CAA0B,GAAe,MACpD,KAAK,MAAM,IAAQ,IAAQ,IAAQ,KAAK,GAAG,GAEhC,IAAA,CAAuB,MAA4C;AAC9E,MAAI,IAAU,IAAK,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAC1B,MAAI,KAAW,GAAI,QAAO;AAG5B,GAEa,IAAA,CAAa,MACxB,IAAO,EAAmB,CAAA,IAAQ,GAS9B,IAAA,CAAgB,MACpB,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ,QAE1D,IAAA,CAAkB,MAAoB,OAAO,KAAU,YAAY,IAAQ,IAAQ,QAE5E,IAAA,CAAsB,MAA4B;AAC7D,QAAM,IAAU,EAAK,kBACf,IAAQ,GAAS,eAAe,QAAQ,GAAS,sBAAsB,CAAC;AAK9E,SAAO;AAAA,IACL,cACE,EAAe,EAAK,aAAa,KACjC,GAAS,yBACT,EAAK,yBACL;AAAA,IACF,cACE,EAAe,EAAK,aAAa,KACjC,GAAS,yBACT,EAAK,yBACL;AAAA,IACF,OAAO,EAAa,EAAK,YAAY;AAAA,IACrC,UAAU,EAAa,EAAK,eAAe;AAAA,EAC7C;AACF,GAEa,IAAA,CAAyB,GAAY,IAAM,oBAAI,KAAK,MAAM;AACrE,QAAM,IAAM,EAAK,aAAa,EAAK,kBAAkB,WAC/C,IAAK,KAAO,OAAO,IAAM,IAAI,KAAK,OAAO,KAAQ,WAAW,IAAM,MAAO,CAAG,GAC5E,IAAW,OAAO,MAAM,EAAG,QAAQ,CAAC,IAAI,IAAM;AACpD,MAAI,EAAA,EAAW,CAAQ,IAAI,EAAa,CAAG;AAE3C,WAAO,EAAyB,EAAW,CAAG,GAAG,CAAG,IAAI;AAC1D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OverdraftCopy } from '../../../core';
|
|
2
|
+
interface ConfidenceMeterProps {
|
|
3
|
+
/** Percent, 0 to 100. */
|
|
4
|
+
level: number;
|
|
5
|
+
copy: OverdraftCopy;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The four-band confidence meter from the pulse Transparent Overdraft drawer: low, medium, high and
|
|
9
|
+
* very high bars with a ring over the band the percent falls in. The bars are decoration; the meter
|
|
10
|
+
* role on the wrapper carries the value and the band's name.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ConfidenceMeter: ({ copy, level }: ConfidenceMeterProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BANDS as o, confidenceBand as d } from "./layout.es.js";
|
|
2
|
+
import { Text as s } from "@mxenabled/mxui";
|
|
3
|
+
import { jsx as i, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
import a from "@mui/material/Box";
|
|
5
|
+
var t = 20, y = ({ copy: x, level: l }) => {
|
|
6
|
+
const r = d(l), n = o.find((e) => e.key === r) ?? o[0];
|
|
7
|
+
return /* @__PURE__ */ c(a, {
|
|
8
|
+
"aria-label": x.confidence_level_aria,
|
|
9
|
+
"aria-valuemax": 100,
|
|
10
|
+
"aria-valuemin": 0,
|
|
11
|
+
"aria-valuenow": l,
|
|
12
|
+
"aria-valuetext": x[r],
|
|
13
|
+
"data-band": r,
|
|
14
|
+
role: "meter",
|
|
15
|
+
sx: {
|
|
16
|
+
px: 24,
|
|
17
|
+
py: 8
|
|
18
|
+
},
|
|
19
|
+
children: [/* @__PURE__ */ c(a, {
|
|
20
|
+
sx: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
gap: "2px",
|
|
23
|
+
position: "relative"
|
|
24
|
+
},
|
|
25
|
+
children: [o.map((e, p) => /* @__PURE__ */ i(a, { sx: {
|
|
26
|
+
bgcolor: e.color,
|
|
27
|
+
borderRadius: p === 0 ? "6px 0 0 6px" : p === o.length - 1 ? "0 6px 6px 0" : 0,
|
|
28
|
+
flex: 1,
|
|
29
|
+
height: 12
|
|
30
|
+
} }, e.key)), /* @__PURE__ */ i(a, { sx: {
|
|
31
|
+
bgcolor: "background.paper",
|
|
32
|
+
border: 3,
|
|
33
|
+
borderColor: n.color,
|
|
34
|
+
borderRadius: "50%",
|
|
35
|
+
boxSizing: "border-box",
|
|
36
|
+
height: t,
|
|
37
|
+
left: `clamp(0px, calc(${l}% - ${t / 2}px), calc(100% - ${t}px))`,
|
|
38
|
+
position: "absolute",
|
|
39
|
+
top: -8 / 2,
|
|
40
|
+
width: t
|
|
41
|
+
} })]
|
|
42
|
+
}), /* @__PURE__ */ i(a, {
|
|
43
|
+
sx: {
|
|
44
|
+
display: "flex",
|
|
45
|
+
gap: "2px",
|
|
46
|
+
pt: 12
|
|
47
|
+
},
|
|
48
|
+
children: o.map((e) => /* @__PURE__ */ i(s, {
|
|
49
|
+
bold: e.key === r,
|
|
50
|
+
color: e.key === r ? "text.primary" : "text.secondary",
|
|
51
|
+
sx: { flex: 1 },
|
|
52
|
+
variant: "caption",
|
|
53
|
+
children: x[e.key]
|
|
54
|
+
}, e.key))
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
y as ConfidenceMeter
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=ConfidenceMeter.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfidenceMeter.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/OverdraftBlock/ConfidenceMeter.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport type { OverdraftCopy } from '../../../core'\nimport { BANDS, confidenceBand } from './layout'\n\ninterface ConfidenceMeterProps {\n /** Percent, 0 to 100. */\n level: number\n copy: OverdraftCopy\n}\n\nconst RING = 20\n\n/**\n * The four-band confidence meter from the pulse Transparent Overdraft drawer: low, medium, high and\n * very high bars with a ring over the band the percent falls in. The bars are decoration; the meter\n * role on the wrapper carries the value and the band's name.\n */\nexport const ConfidenceMeter = ({ copy, level }: ConfidenceMeterProps) => {\n const activeKey = confidenceBand(level)\n const active = BANDS.find((band) => band.key === activeKey) ?? BANDS[0]\n\n return (\n <Box\n aria-label={copy.confidence_level_aria}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={level}\n aria-valuetext={copy[activeKey]}\n data-band={activeKey}\n role=\"meter\"\n sx={{ px: 24, py: 8 }}\n >\n <Box sx={{ display: 'flex', gap: '2px', position: 'relative' }}>\n {BANDS.map((band, index) => (\n <Box\n key={band.key}\n sx={{\n bgcolor: band.color,\n borderRadius:\n index === 0 ? '6px 0 0 6px' : index === BANDS.length - 1 ? '0 6px 6px 0' : 0,\n flex: 1,\n height: 12,\n }}\n />\n ))}\n <Box\n sx={{\n bgcolor: 'background.paper',\n border: 3,\n borderColor: active.color,\n borderRadius: '50%',\n boxSizing: 'border-box',\n height: RING,\n left: `clamp(0px, calc(${level}% - ${RING / 2}px), calc(100% - ${RING}px))`,\n position: 'absolute',\n top: -(RING - 12) / 2,\n width: RING,\n }}\n />\n </Box>\n <Box sx={{ display: 'flex', gap: '2px', pt: 12 }}>\n {BANDS.map((band) => (\n <Text\n bold={band.key === activeKey}\n color={band.key === activeKey ? 'text.primary' : 'text.secondary'}\n key={band.key}\n sx={{ flex: 1 }}\n variant=\"caption\"\n >\n {copy[band.key]}\n </Text>\n ))}\n </Box>\n </Box>\n )\n}\n"],"mappings":";;;;AAaA,IAAM,IAAO,IAOA,IAAA,CAAmB,EAAE,MAAA,GAAM,OAAA,EAAA,MAAkC;AACxE,QAAM,IAAY,EAAe,CAAK,GAChC,IAAS,EAAM,KAAA,CAAM,MAAS,EAAK,QAAQ,CAAS,KAAK,EAAM,CAAA;AAErE,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY,EAAK;AAAA,IACjB,iBAAe;AAAA,IACf,iBAAe;AAAA,IACf,iBAAe;AAAA,IACf,kBAAgB,EAAK,CAAA;AAAA,IACrB,aAAW;AAAA,IACX,MAAK;AAAA,IACL,IAAI;AAAA,MAAE,IAAI;AAAA,MAAI,IAAI;AAAA,IAAE;AAAA,IARtB,UAAA,CAUE,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI;AAAA,QAAE,SAAS;AAAA,QAAQ,KAAK;AAAA,QAAO,UAAU;AAAA,MAAW;AAAA,MAA7D,UAAA,CACG,EAAM,IAAA,CAAK,GAAM,MAChB,gBAAA,EAAC,GAAD,EAEE,IAAI;AAAA,QACF,SAAS,EAAK;AAAA,QACd,cACE,MAAU,IAAI,gBAAgB,MAAU,EAAM,SAAS,IAAI,gBAAgB;AAAA,QAC7E,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,EACD,GARM,EAAK,GAQX,CACF,GACD,gBAAA,EAAC,GAAD,EACE,IAAI;AAAA,QACF,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,aAAa,EAAO;AAAA,QACpB,cAAc;AAAA,QACd,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,MAAM,mBAAmB,CAAA,OAAY,IAAO,CAAA,oBAAqB,CAAA;AAAA,QACjE,UAAU;AAAA,QACV,KAAK,KAAe;AAAA,QACpB,OAAO;AAAA,MACT,EACD,CAAA,CACE;AAAA,IACL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI;AAAA,QAAE,SAAS;AAAA,QAAQ,KAAK;AAAA,QAAO,IAAI;AAAA,MAAG;AAAA,MAC5C,UAAA,EAAM,IAAA,CAAK,MACV,gBAAA,EAAC,GAAD;AAAA,QACE,MAAM,EAAK,QAAQ;AAAA,QACnB,OAAO,EAAK,QAAQ,IAAY,iBAAiB;AAAA,QAEjD,IAAI,EAAE,MAAM,EAAE;AAAA,QACd,SAAQ;AAAA,QAEP,UAAA,EAAK,EAAK,GAAA;AAAA,MACP,GALC,EAAK,GAKN,CACP;AAAA,IACE,CAAA,CACF;AAAA;AAET"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionBlockProps } from '../../mappings/blocks';
|
|
2
|
+
/** Loads accounts once per open when the host did not attach the beat's primary account. */
|
|
3
|
+
export declare const useOverdraftPrepare: ({ beat }: ActionBlockProps) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Transparent Overdraft's "Learn more" drawer (MEW2-3355): the account at risk, the projected
|
|
6
|
+
* overdraft amount, when it is expected, and the confidence meter. Everything is on the beat; the
|
|
7
|
+
* account store is read only to name the account when the host did not attach it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const OverdraftBlock: (({ beat }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import v from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
|
+
import { useAccountStore as l, useGlobalCopyStore as h } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { formatCurrency as x } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { resolveOverdraftFacts as g, resolvePrimaryAccount as y } from "./layout.es.js";
|
|
5
|
+
import { ConfidenceMeter as _ } from "./ConfidenceMeter.es.js";
|
|
6
|
+
import { useEffect as b } from "react";
|
|
7
|
+
import { observer as I } from "mobx-react-lite";
|
|
8
|
+
import o from "@mui/material/Stack";
|
|
9
|
+
import { InstitutionLogo as C, Text as e } from "@mxenabled/mxui";
|
|
10
|
+
import { Icon as k } from "@mxenabled/mx-icons";
|
|
11
|
+
import { Fragment as w, jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
12
|
+
var P = ({ beat: s }) => {
|
|
13
|
+
const { accountsLoaded: n, loadAccounts: i } = l();
|
|
14
|
+
b(() => {
|
|
15
|
+
!s.primary_account && !n && i();
|
|
16
|
+
}, []);
|
|
17
|
+
}, T = I(function({ beat: n }) {
|
|
18
|
+
const { common: i, insights_feed: u } = h(), { accounts: f } = l(), c = u?.transparent_overdraft;
|
|
19
|
+
if (!c) return /* @__PURE__ */ r(o, {
|
|
20
|
+
sx: { p: 24 },
|
|
21
|
+
children: /* @__PURE__ */ r(e, { children: i?.error_message })
|
|
22
|
+
});
|
|
23
|
+
const a = y(n, f), m = a ? v(a) : "", { amount: p, confidence: d } = g(n);
|
|
24
|
+
return /* @__PURE__ */ t(o, {
|
|
25
|
+
sx: {
|
|
26
|
+
bgcolor: "background.paper",
|
|
27
|
+
pb: 24
|
|
28
|
+
},
|
|
29
|
+
children: [/* @__PURE__ */ t(o, {
|
|
30
|
+
sx: {
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap: 4,
|
|
33
|
+
px: 24,
|
|
34
|
+
py: 16
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
m && /* @__PURE__ */ t(o, {
|
|
38
|
+
sx: {
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
flexDirection: "row",
|
|
41
|
+
gap: 12
|
|
42
|
+
},
|
|
43
|
+
children: [/* @__PURE__ */ r(C, {
|
|
44
|
+
alt: "",
|
|
45
|
+
institutionGuid: a?.institution_guid ?? "",
|
|
46
|
+
size: 20
|
|
47
|
+
}), /* @__PURE__ */ r(e, {
|
|
48
|
+
bold: !0,
|
|
49
|
+
component: "p",
|
|
50
|
+
variant: "body1",
|
|
51
|
+
children: m
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
p !== void 0 && /* @__PURE__ */ r(e, {
|
|
55
|
+
bold: !0,
|
|
56
|
+
component: "p",
|
|
57
|
+
variant: "h1",
|
|
58
|
+
children: x(p, "0,0.00")
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ t(o, {
|
|
61
|
+
sx: {
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
gap: 4
|
|
65
|
+
},
|
|
66
|
+
children: [/* @__PURE__ */ r(k, {
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
fill: !0,
|
|
69
|
+
name: "error",
|
|
70
|
+
size: 16,
|
|
71
|
+
sx: { color: "warning.main" }
|
|
72
|
+
}), /* @__PURE__ */ r(e, {
|
|
73
|
+
color: "text.secondary",
|
|
74
|
+
variant: "body2",
|
|
75
|
+
children: c.to_occur_within_the_next_seven_days
|
|
76
|
+
})]
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
}), d !== void 0 && /* @__PURE__ */ t(w, { children: [/* @__PURE__ */ r(e, {
|
|
80
|
+
bold: !0,
|
|
81
|
+
component: "h3",
|
|
82
|
+
sx: {
|
|
83
|
+
px: 24,
|
|
84
|
+
py: 12,
|
|
85
|
+
textTransform: "uppercase"
|
|
86
|
+
},
|
|
87
|
+
variant: "caption",
|
|
88
|
+
children: c.confidence_level
|
|
89
|
+
}), /* @__PURE__ */ r(_, {
|
|
90
|
+
copy: c,
|
|
91
|
+
level: d
|
|
92
|
+
})] })]
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
export {
|
|
96
|
+
T as OverdraftBlock,
|
|
97
|
+
P as useOverdraftPrepare
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=OverdraftBlock.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverdraftBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useGlobalCopyStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { ConfidenceMeter } from './ConfidenceMeter'\nimport { resolvePrimaryAccount, resolveOverdraftFacts } from './layout'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const useOverdraftPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n/**\n * Transparent Overdraft's \"Learn more\" drawer (MEW2-3355): the account at risk, the projected\n * overdraft amount, when it is expected, and the confidence meter. Everything is on the beat; the\n * account store is read only to name the account when the host did not attach it.\n */\nexport const OverdraftBlock = observer(function OverdraftBlock({ beat }: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { accounts } = useAccountStore()\n const copy = insightsFeedCopy?.transparent_overdraft\n\n if (!copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n const account = resolvePrimaryAccount(beat, accounts)\n const accountName = account ? getAccountDisplayName(account) : ''\n const { amount, confidence } = resolveOverdraftFacts(beat)\n\n return (\n <Stack sx={{ bgcolor: 'background.paper', pb: 24 }}>\n <Stack sx={{ alignItems: 'center', gap: 4, px: 24, py: 16 }}>\n {accountName && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <InstitutionLogo alt=\"\" institutionGuid={account?.institution_guid ?? ''} size={20} />\n <Text bold={true} component=\"p\" variant=\"body1\">\n {accountName}\n </Text>\n </Stack>\n )}\n {amount !== undefined && (\n <Text bold={true} component=\"p\" variant=\"h1\">\n {formatCurrency(amount, '0,0.00')}\n </Text>\n )}\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n <Icon\n aria-hidden=\"true\"\n fill={true}\n name=\"error\"\n size={16}\n sx={{ color: 'warning.main' }}\n />\n <Text color=\"text.secondary\" variant=\"body2\">\n {copy.to_occur_within_the_next_seven_days}\n </Text>\n </Stack>\n </Stack>\n {confidence !== undefined && (\n <>\n <Text\n bold={true}\n component=\"h3\"\n sx={{ px: 24, py: 12, textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {copy.confidence_level}\n </Text>\n <ConfidenceMeter copy={copy} level={confidence} />\n </>\n )}\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;AAiBA,IAAa,IAAA,CAAuB,EAAE,MAAA,EAAA,MAA6B;AACjE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAA,MAAgB;AACd,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GAAG,CAAC,CAAC;AACP,GAOa,IAAiB,EAAS,SAAwB,EAAE,MAAA,EAAA,GAA0B;AACzF,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/B,IAAO,GAAkB;AAE/B,MAAI,CAAC,EACH,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,cAAoB,CAAA;AAAA,EAClC,CAAA;AAIX,QAAM,IAAU,EAAsB,GAAM,CAAQ,GAC9C,IAAc,IAAU,EAAsB,CAAO,IAAI,IACzD,EAAE,QAAA,GAAQ,YAAA,EAAA,IAAe,EAAsB,CAAI;AAEzD,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,SAAS;AAAA,MAAoB,IAAI;AAAA,IAAG;AAAA,IAAjD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAU,KAAK;AAAA,QAAG,IAAI;AAAA,QAAI,IAAI;AAAA,MAAG;AAAA,MAA1D,UAAA;AAAA,QACG,KACC,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,YAAY;AAAA,YAAU,eAAe;AAAA,YAAO,KAAK;AAAA,UAAG;AAAA,UAAjE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YAAiB,KAAI;AAAA,YAAG,iBAAiB,GAAS,oBAAoB;AAAA,YAAI,MAAM;AAAA,UAAK,CAAA,GACrF,gBAAA,EAAC,GAAD;AAAA,YAAM,MAAM;AAAA,YAAM,WAAU;AAAA,YAAI,SAAQ;AAAA,YACrC,UAAA;AAAA,UACG,CAAA,CACD;AAAA;QAER,MAAW,UACV,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,WAAU;AAAA,UAAI,SAAQ;AAAA,UACrC,UAAA,EAAe,GAAQ,QAAQ;AAAA,QAC5B,CAAA;AAAA,QAER,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,YAAY;AAAA,YAAU,eAAe;AAAA,YAAO,KAAK;AAAA,UAAE;AAAA,UAAhE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YACE,eAAY;AAAA,YACZ,MAAM;AAAA,YACN,MAAK;AAAA,YACL,MAAM;AAAA,YACN,IAAI,EAAE,OAAO,eAAe;AAAA,UAC7B,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA,EAAK;AAAA,UACF,CAAA,CACD;AAAA;MACF;AAAA,IACN,CAAA,GAAA,MAAe,UACd,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,WAAU;AAAA,MACV,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,QAAI,eAAe;AAAA,MAAY;AAAA,MACjD,SAAQ;AAAA,MAEP,UAAA,EAAK;AAAA,IACF,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,MAAuB,MAAA;AAAA,MAAM,OAAO;AAAA,IAAa,CAAA,CACjD,EAAA,CAAA,CAEC;AAAA;AAEX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OverdraftBlock, useOverdraftPrepare } from './OverdraftBlock';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Account, Beat } from '../../../core';
|
|
2
|
+
/** The meter's bands, low to very high, each with its theme colour. */
|
|
3
|
+
export declare const BANDS: readonly [{
|
|
4
|
+
readonly key: "low";
|
|
5
|
+
readonly color: "success.main";
|
|
6
|
+
}, {
|
|
7
|
+
readonly key: "medium";
|
|
8
|
+
readonly color: "success.dark";
|
|
9
|
+
}, {
|
|
10
|
+
readonly key: "high";
|
|
11
|
+
readonly color: "warning.main";
|
|
12
|
+
}, {
|
|
13
|
+
readonly key: "very_high";
|
|
14
|
+
readonly color: "error.dark";
|
|
15
|
+
}];
|
|
16
|
+
export type ConfidenceBand = (typeof BANDS)[number]['key'];
|
|
17
|
+
export declare const confidenceBand: (level: number) => ConfidenceBand;
|
|
18
|
+
export interface OverdraftFacts {
|
|
19
|
+
/** The projected overdraft, positive, as the drawer prints it. */
|
|
20
|
+
amount?: number;
|
|
21
|
+
/** The backend's percent confidence that the overdraft will occur. */
|
|
22
|
+
confidence?: number;
|
|
23
|
+
}
|
|
24
|
+
/** The drawer's two figures from the V2 envelope's `drilldown_data`; undefined unless a finite number. */
|
|
25
|
+
export declare const resolveOverdraftFacts: (beat: Beat) => OverdraftFacts;
|
|
26
|
+
/** The beat's primary account: from the beat when the host attached it, else the loaded accounts. */
|
|
27
|
+
export declare const resolvePrimaryAccount: (beat: Beat, accounts: Account[]) => Account | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var u = [
|
|
2
|
+
{
|
|
3
|
+
key: "low",
|
|
4
|
+
color: "success.main"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
key: "medium",
|
|
8
|
+
color: "success.dark"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: "high",
|
|
12
|
+
color: "warning.main"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
key: "very_high",
|
|
16
|
+
color: "error.dark"
|
|
17
|
+
}
|
|
18
|
+
], i = 25, c = 50, t = 75, d = (r) => r > t ? "very_high" : r > c ? "high" : r > i ? "medium" : "low", s = (r) => {
|
|
19
|
+
const n = r.insights_payload?.drilldown_data, e = (a) => {
|
|
20
|
+
const o = n?.[a];
|
|
21
|
+
return typeof o == "number" && Number.isFinite(o) ? o : void 0;
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
amount: e("projected_overdraft_amount"),
|
|
25
|
+
confidence: e("confidence_level")
|
|
26
|
+
};
|
|
27
|
+
}, m = (r, n) => r.primary_account ?? n.find((e) => e.guid === r.primary_account_guid);
|
|
28
|
+
export {
|
|
29
|
+
u as BANDS,
|
|
30
|
+
d as confidenceBand,
|
|
31
|
+
s as resolveOverdraftFacts,
|
|
32
|
+
m as resolvePrimaryAccount
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=layout.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/OverdraftBlock/layout.ts"],"sourcesContent":["import type { Account, Beat } from '../../../core'\n\n/** The meter's bands, low to very high, each with its theme colour. */\nexport const BANDS = [\n { key: 'low', color: 'success.main' },\n { key: 'medium', color: 'success.dark' },\n { key: 'high', color: 'warning.main' },\n { key: 'very_high', color: 'error.dark' },\n] as const\n\nexport type ConfidenceBand = (typeof BANDS)[number]['key']\n\n/** Upper bound (inclusive) of each band but the last, as the pulse drawer drew them. */\nconst LOW_MAX = 25\nconst MEDIUM_MAX = 50\nconst HIGH_MAX = 75\n\nexport const confidenceBand = (level: number): ConfidenceBand => {\n if (level > HIGH_MAX) return 'very_high'\n if (level > MEDIUM_MAX) return 'high'\n if (level > LOW_MAX) return 'medium'\n\n return 'low'\n}\n\nexport interface OverdraftFacts {\n /** The projected overdraft, positive, as the drawer prints it. */\n amount?: number\n /** The backend's percent confidence that the overdraft will occur. */\n confidence?: number\n}\n\n/** The drawer's two figures from the V2 envelope's `drilldown_data`; undefined unless a finite number. */\nexport const resolveOverdraftFacts = (beat: Beat): OverdraftFacts => {\n const data = beat.insights_payload?.drilldown_data\n const numberAt = (key: string) => {\n const value = data?.[key]\n\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n }\n\n return {\n amount: numberAt('projected_overdraft_amount'),\n confidence: numberAt('confidence_level'),\n }\n}\n\n/** The beat's primary account: from the beat when the host attached it, else the loaded accounts. */\nexport const resolvePrimaryAccount = (beat: Beat, accounts: Account[]): Account | undefined =>\n beat.primary_account ?? accounts.find((account) => account.guid === beat.primary_account_guid)\n"],"mappings":"AAGA,IAAa,IAAQ;AAAA,EACnB;AAAA,IAAE,KAAK;AAAA,IAAO,OAAO;AAAA,EAAe;AAAA,EACpC;AAAA,IAAE,KAAK;AAAA,IAAU,OAAO;AAAA,EAAe;AAAA,EACvC;AAAA,IAAE,KAAK;AAAA,IAAQ,OAAO;AAAA,EAAe;AAAA,EACrC;AAAA,IAAE,KAAK;AAAA,IAAa,OAAO;AAAA,EAAa;AAC1C,GAKM,IAAU,IACV,IAAa,IACb,IAAW,IAEJ,IAAA,CAAkB,MACzB,IAAQ,IAAiB,cACzB,IAAQ,IAAmB,SAC3B,IAAQ,IAAgB,WAErB,OAWI,IAAA,CAAyB,MAA+B;AACnE,QAAM,IAAO,EAAK,kBAAkB,gBAC9B,IAAA,CAAY,MAAgB;AAChC,UAAM,IAAQ,IAAO,CAAA;AAErB,WAAO,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,IAAI,IAAQ;AAAA,EACvE;AAEA,SAAO;AAAA,IACL,QAAQ,EAAS,4BAA4B;AAAA,IAC7C,YAAY,EAAS,kBAAkB;AAAA,EACzC;AACF,GAGa,IAAA,CAAyB,GAAY,MAChD,EAAK,mBAAmB,EAAS,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAK,oBAAoB"}
|
|
@@ -1,54 +1,67 @@
|
|
|
1
|
-
import { AccountType as
|
|
2
|
-
import { BEAT_OPERATION_1 as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { AccountType as l } from "../../core/types/Account.es.js";
|
|
2
|
+
import { BEAT_OPERATION_1 as r, BEAT_OPERATION_2 as d } from "../../common/utils/PostMessage.es.js";
|
|
3
|
+
import { resolveOverdraftFacts as _ } from "../actionBlocks/OverdraftBlock/layout.es.js";
|
|
4
|
+
var s = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, stores: t }) => a.primary_account ?? t.accountStore.accounts.find((n) => n.guid === a.primary_account_guid), p = ({ beat: a, stores: t }) => {
|
|
5
|
+
const n = new Set(a.account_guids);
|
|
6
|
+
return t.accountStore.accounts.filter((o) => n.has(o.guid) && s(o));
|
|
7
|
+
}, m = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type === l.SAVINGS && s(t)), i = { primary: () => ({ action: r }) }, c = { primary: (a) => {
|
|
8
|
+
const t = e(a)?.external_guid, { amount: n } = _(a.beat);
|
|
9
|
+
return !t || n === void 0 ? null : {
|
|
10
|
+
action: r,
|
|
11
|
+
payload: {
|
|
12
|
+
projected_overdraft_amount: n,
|
|
13
|
+
destination_account_ids: [t],
|
|
14
|
+
destination_account_id: t
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
} }, y = {
|
|
7
18
|
SaveAnExtra100Dollars: i,
|
|
8
19
|
SaveAnExtra100DollarsV2: i,
|
|
9
|
-
PaydayCashLeftOverStatus: { primary: () => ({ action:
|
|
10
|
-
EmergencyFundWithdrawal: { primary: () => ({ action:
|
|
20
|
+
PaydayCashLeftOverStatus: { primary: () => ({ action: r }) },
|
|
21
|
+
EmergencyFundWithdrawal: { primary: () => ({ action: r }) },
|
|
11
22
|
LowAccountBalance: { primary: (a) => {
|
|
12
23
|
const t = e(a);
|
|
13
24
|
return t ? {
|
|
14
|
-
action:
|
|
25
|
+
action: r,
|
|
15
26
|
payload: { account_guid: t.external_guid }
|
|
16
27
|
} : null;
|
|
17
28
|
} },
|
|
18
|
-
MonthlyObligationsStatus: { primary: ({ beat: a }) => (a.payload?.total_remaining ?? 0) < 0 ? { action:
|
|
19
|
-
DesignateEmergencySavingsAccount: { primary: ({ cta: a }) => a.action_key === "open_savings_account" ? { action:
|
|
29
|
+
MonthlyObligationsStatus: { primary: ({ beat: a }) => (a.payload?.total_remaining ?? 0) < 0 ? { action: r } : null },
|
|
30
|
+
DesignateEmergencySavingsAccount: { primary: ({ cta: a }) => a.action_key === "open_savings_account" ? { action: r } : null },
|
|
20
31
|
ReplenishSavings: { primary: (a) => ({
|
|
21
|
-
action:
|
|
32
|
+
action: r,
|
|
22
33
|
payload: {
|
|
23
34
|
total_amount_withdrawn: a.beat.payload?.total_amount,
|
|
24
|
-
accounts:
|
|
35
|
+
accounts: p(a).map((t) => ({
|
|
25
36
|
account_guid: t.external_guid,
|
|
26
37
|
account_name: a.beat.payload?.account_name?.default
|
|
27
38
|
}))
|
|
28
39
|
}
|
|
29
40
|
}) },
|
|
41
|
+
TransparentOverdraft: c,
|
|
42
|
+
TransparentOverdraftV2: c,
|
|
30
43
|
SavingsOpportunityV2: { primary: (a) => {
|
|
31
44
|
const t = e(a);
|
|
32
45
|
if (!t) return null;
|
|
33
|
-
const
|
|
46
|
+
const n = m(a), o = {
|
|
34
47
|
amount: a.beat.payload?.suggested_savings_amount,
|
|
35
48
|
source_account_id: t.external_guid
|
|
36
49
|
};
|
|
37
|
-
return
|
|
38
|
-
action:
|
|
50
|
+
return n.length ? {
|
|
51
|
+
action: r,
|
|
39
52
|
payload: {
|
|
40
|
-
...
|
|
41
|
-
destination_account_ids:
|
|
53
|
+
...o,
|
|
54
|
+
destination_account_ids: n.map((u) => u.external_guid)
|
|
42
55
|
}
|
|
43
56
|
} : {
|
|
44
|
-
action:
|
|
45
|
-
payload:
|
|
57
|
+
action: d,
|
|
58
|
+
payload: o
|
|
46
59
|
};
|
|
47
60
|
} }
|
|
48
|
-
},
|
|
61
|
+
}, A = (a) => a.cta.metadata ?? y[a.beat.template]?.[a.slot]?.(a) ?? null;
|
|
49
62
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
y as ctaPostMessages,
|
|
64
|
+
A as resolveCtaMetadata
|
|
52
65
|
};
|
|
53
66
|
|
|
54
67
|
//# sourceMappingURL=ctaPostMessages.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctaPostMessages.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaPostMessages.ts"],"sourcesContent":["import { BEAT_OPERATION_1, BEAT_OPERATION_2 } from '../../common/utils/PostMessage'\nimport { AccountType, type Account, type CtaPostMessageMetadata } from '../../core'\nimport type { CtaSlot, CtaStateContext } from './types'\n\n/**\n * Interim per-template post messages, carried over from the pulse beats, for CTAs the backend\n * does not yet describe with `cta.metadata`. Each resolver returns the same shape the backend\n * will send, or `null` for \"no message\" (the default then only opens the drawer for a block).\n * Backend `metadata` always wins, so entries become dead the moment tupac ships the key for\n * their template.\n *\n * Remove once every template here has `metadata` from the backend: delete this file, its test\n * and README section, and the `resolveCtaMetadata` call in `runCtaAction.ts`.\n */\nexport type CtaPostMessageResolver = (ctx: CtaStateContext) => CtaPostMessageMetadata | null\n\ntype BeatContext = Pick<CtaStateContext, 'beat' | 'stores'>\n\nconst isUsable = (account: Account) =>\n !account.is_hidden && !account.is_deleted && !account.is_closed\n\n/** The beat's primary account: from the beat when the host attached it, else the account store. */\nconst primaryAccountOf = ({ beat, stores }: BeatContext): Account | undefined =>\n beat.primary_account ??\n stores.accountStore.accounts.find((account) => account.guid === beat.primary_account_guid)\n\n/** The accounts the beat points at (`account_guids`), as loaded in the account store. */\nconst beatAccountsOf = ({ beat, stores }: BeatContext): Account[] => {\n const guids = new Set<string>(beat.account_guids)\n\n return stores.accountStore.accounts.filter(\n (account) => guids.has(account.guid) && isUsable(account),\n )\n}\n\nconst savingsAccountsOf = ({ stores }: BeatContext): Account[] =>\n stores.accountStore.accounts.filter(\n (account) => account.account_type === AccountType.SAVINGS && isUsable(account),\n )\n\n/** \"Make Transfer\": the base `beat/cta` op_1, nothing beat-specific. */\nconst saveAnExtra100Dollars: Partial<Record<CtaSlot, CtaPostMessageResolver>> = {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n}\n\nexport const ctaPostMessages: Record<string, Partial<Record<CtaSlot, CtaPostMessageResolver>>> = {\n SaveAnExtra100Dollars: saveAnExtra100Dollars,\n /** The Insights 2.0 template: the same \"Make a Transfer\" op_1 as V1. */\n SaveAnExtra100DollarsV2: saveAnExtra100Dollars,\n\n /** \"Transfer to Savings\" / \"Transfer Funds\": the base `beat/cta` op_1 on both variants. */\n PaydayCashLeftOverStatus: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /**\n * \"Make a Transfer\" / \"View Emergency Savings\": both deep-link into online banking through the\n * base `beat/cta` op_1 (the label differs by variant, the action does not, as in V1). The\n * secondary \"View Transaction\" opens the transaction-details drilldown, not a post message.\n */\n EmergencyFundWithdrawal: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /** \"Transfer\": op_1 with the primary account's external id. No primary account → default. */\n LowAccountBalance: {\n primary: (ctx) => {\n const account = primaryAccountOf(ctx)\n\n return account\n ? { action: BEAT_OPERATION_1, payload: { account_guid: account.external_guid } }\n : null\n },\n },\n\n /** Posts only while off track (negative remaining); on track the CTA opens the drawer. */\n MonthlyObligationsStatus: {\n primary: ({ beat }) =>\n (beat.payload?.total_remaining ?? 0) < 0 ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /**\n * \"Open a Savings Account\": op_1 for the open_savings_account press only. The backend names that\n * key on the open_account state (no designation and no savings account — pulse's legacy branch),\n * so the frontend repeats no data rule and it holds on every widget. \"Save\"\n * (select_savings_account) saves the pick through ctaConfig instead; the saved state has no press.\n */\n DesignateEmergencySavingsAccount: {\n primary: ({ cta }) =>\n cta.action_key === 'open_savings_account' ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /** op_1 with the withdrawn total and the beat's accounts (external ids). */\n ReplenishSavings: {\n primary: (ctx) => ({\n action: BEAT_OPERATION_1,\n payload: {\n total_amount_withdrawn: ctx.beat.payload?.total_amount,\n accounts: beatAccountsOf(ctx).map((account) => ({\n account_guid: account.external_guid,\n account_name: ctx.beat.payload?.account_name?.default,\n })),\n },\n }),\n },\n\n /** op_1 = transfer into the user's savings accounts; op_2 = open one when there are none. */\n SavingsOpportunityV2: {\n primary: (ctx) => {\n const source = primaryAccountOf(ctx)\n\n if (!source) return null\n\n const savings = savingsAccountsOf(ctx)\n const payload = {\n amount: ctx.beat.payload?.suggested_savings_amount,\n source_account_id: source.external_guid,\n }\n\n return savings.length\n ? {\n action: BEAT_OPERATION_1,\n payload: {\n ...payload,\n destination_account_ids: savings.map((account) => account.external_guid),\n },\n }\n : { action: BEAT_OPERATION_2, payload }\n },\n },\n}\n\n/** Backend `cta.metadata` first, else this template's interim resolver for the slot, else null. */\nexport const resolveCtaMetadata = (ctx: CtaStateContext): CtaPostMessageMetadata | null =>\n ctx.cta.metadata ?? ctaPostMessages[ctx.beat.template]?.[ctx.slot]?.(ctx) ?? null\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ctaPostMessages.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaPostMessages.ts"],"sourcesContent":["import { BEAT_OPERATION_1, BEAT_OPERATION_2 } from '../../common/utils/PostMessage'\nimport { AccountType, type Account, type CtaPostMessageMetadata } from '../../core'\nimport { resolveOverdraftFacts } from '../actionBlocks/OverdraftBlock/layout'\nimport type { CtaSlot, CtaStateContext } from './types'\n\n/**\n * Interim per-template post messages, carried over from the pulse beats, for CTAs the backend\n * does not yet describe with `cta.metadata`. Each resolver returns the same shape the backend\n * will send, or `null` for \"no message\" (the default then only opens the drawer for a block).\n * Backend `metadata` always wins, so entries become dead the moment tupac ships the key for\n * their template.\n *\n * Remove once every template here has `metadata` from the backend: delete this file, its test\n * and README section, and the `resolveCtaMetadata` call in `runCtaAction.ts`.\n */\nexport type CtaPostMessageResolver = (ctx: CtaStateContext) => CtaPostMessageMetadata | null\n\ntype BeatContext = Pick<CtaStateContext, 'beat' | 'stores'>\n\nconst isUsable = (account: Account) =>\n !account.is_hidden && !account.is_deleted && !account.is_closed\n\n/** The beat's primary account: from the beat when the host attached it, else the account store. */\nconst primaryAccountOf = ({ beat, stores }: BeatContext): Account | undefined =>\n beat.primary_account ??\n stores.accountStore.accounts.find((account) => account.guid === beat.primary_account_guid)\n\n/** The accounts the beat points at (`account_guids`), as loaded in the account store. */\nconst beatAccountsOf = ({ beat, stores }: BeatContext): Account[] => {\n const guids = new Set<string>(beat.account_guids)\n\n return stores.accountStore.accounts.filter(\n (account) => guids.has(account.guid) && isUsable(account),\n )\n}\n\nconst savingsAccountsOf = ({ stores }: BeatContext): Account[] =>\n stores.accountStore.accounts.filter(\n (account) => account.account_type === AccountType.SAVINGS && isUsable(account),\n )\n\n/** \"Make Transfer\": the base `beat/cta` op_1, nothing beat-specific. */\nconst saveAnExtra100Dollars: Partial<Record<CtaSlot, CtaPostMessageResolver>> = {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n}\n\n/**\n * \"Transfer funds\": op_1 with the projected overdraft and the primary account's external id, sent\n * twice because the beat only ever has one account: hosts read the legacy `destination_account_ids`\n * list or the newer `destination_account_id`. Money movement, so no message without both the amount\n * and a destination id → default.\n */\nconst overdraft: Partial<Record<CtaSlot, CtaPostMessageResolver>> = {\n primary: (ctx) => {\n const destination = primaryAccountOf(ctx)?.external_guid\n const { amount } = resolveOverdraftFacts(ctx.beat)\n\n if (!destination || amount === undefined) return null\n\n return {\n action: BEAT_OPERATION_1,\n payload: {\n projected_overdraft_amount: amount,\n destination_account_ids: [destination],\n destination_account_id: destination,\n },\n }\n },\n}\n\nexport const ctaPostMessages: Record<string, Partial<Record<CtaSlot, CtaPostMessageResolver>>> = {\n SaveAnExtra100Dollars: saveAnExtra100Dollars,\n /** The Insights 2.0 template: the same \"Make a Transfer\" op_1 as V1. */\n SaveAnExtra100DollarsV2: saveAnExtra100Dollars,\n\n /** \"Transfer to Savings\" / \"Transfer Funds\": the base `beat/cta` op_1 on both variants. */\n PaydayCashLeftOverStatus: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /**\n * \"Make a Transfer\" / \"View Emergency Savings\": both deep-link into online banking through the\n * base `beat/cta` op_1 (the label differs by variant, the action does not, as in V1). The\n * secondary \"View Transaction\" opens the transaction-details drilldown, not a post message.\n */\n EmergencyFundWithdrawal: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /** \"Transfer\": op_1 with the primary account's external id. No primary account → default. */\n LowAccountBalance: {\n primary: (ctx) => {\n const account = primaryAccountOf(ctx)\n\n return account\n ? { action: BEAT_OPERATION_1, payload: { account_guid: account.external_guid } }\n : null\n },\n },\n\n /** Posts only while off track (negative remaining); on track the CTA opens the drawer. */\n MonthlyObligationsStatus: {\n primary: ({ beat }) =>\n (beat.payload?.total_remaining ?? 0) < 0 ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /**\n * \"Open a Savings Account\": op_1 for the open_savings_account press only. The backend names that\n * key on the open_account state (no designation and no savings account — pulse's legacy branch),\n * so the frontend repeats no data rule and it holds on every widget. \"Save\"\n * (select_savings_account) saves the pick through ctaConfig instead; the saved state has no press.\n */\n DesignateEmergencySavingsAccount: {\n primary: ({ cta }) =>\n cta.action_key === 'open_savings_account' ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /** op_1 with the withdrawn total and the beat's accounts (external ids). */\n ReplenishSavings: {\n primary: (ctx) => ({\n action: BEAT_OPERATION_1,\n payload: {\n total_amount_withdrawn: ctx.beat.payload?.total_amount,\n accounts: beatAccountsOf(ctx).map((account) => ({\n account_guid: account.external_guid,\n account_name: ctx.beat.payload?.account_name?.default,\n })),\n },\n }),\n },\n\n TransparentOverdraft: overdraft,\n TransparentOverdraftV2: overdraft,\n\n /** op_1 = transfer into the user's savings accounts; op_2 = open one when there are none. */\n SavingsOpportunityV2: {\n primary: (ctx) => {\n const source = primaryAccountOf(ctx)\n\n if (!source) return null\n\n const savings = savingsAccountsOf(ctx)\n const payload = {\n amount: ctx.beat.payload?.suggested_savings_amount,\n source_account_id: source.external_guid,\n }\n\n return savings.length\n ? {\n action: BEAT_OPERATION_1,\n payload: {\n ...payload,\n destination_account_ids: savings.map((account) => account.external_guid),\n },\n }\n : { action: BEAT_OPERATION_2, payload }\n },\n },\n}\n\n/** Backend `cta.metadata` first, else this template's interim resolver for the slot, else null. */\nexport const resolveCtaMetadata = (ctx: CtaStateContext): CtaPostMessageMetadata | null =>\n ctx.cta.metadata ?? ctaPostMessages[ctx.beat.template]?.[ctx.slot]?.(ctx) ?? null\n"],"mappings":";;;AAmBA,IAAM,IAAA,CAAY,MAChB,CAAC,EAAQ,aAAa,CAAC,EAAQ,cAAc,CAAC,EAAQ,WAGlD,IAAA,CAAoB,EAAE,MAAA,GAAM,QAAA,EAAA,MAChC,EAAK,mBACL,EAAO,aAAa,SAAS,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAK,oBAAoB,GAGrF,IAAA,CAAkB,EAAE,MAAA,GAAM,QAAA,EAAA,MAAqC;AACnE,QAAM,IAAQ,IAAI,IAAY,EAAK,aAAa;AAEhD,SAAO,EAAO,aAAa,SAAS,OAAA,CACjC,MAAY,EAAM,IAAI,EAAQ,IAAI,KAAK,EAAS,CAAO,CAC1D;AACF,GAEM,IAAA,CAAqB,EAAE,QAAA,EAAA,MAC3B,EAAO,aAAa,SAAS,OAAA,CAC1B,MAAY,EAAQ,iBAAiB,EAAY,WAAW,EAAS,CAAO,CAC/E,GAGI,IAA0E,EAC9E,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C,GAQM,IAA8D,EAClE,SAAA,CAAU,MAAQ;AAChB,QAAM,IAAc,EAAiB,CAAG,GAAG,eACrC,EAAE,QAAA,EAAA,IAAW,EAAsB,EAAI,IAAI;AAEjD,SAAI,CAAC,KAAe,MAAW,SAAkB,OAE1C;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,4BAA4B;AAAA,MAC5B,yBAAyB,CAAC,CAAW;AAAA,MACrC,wBAAwB;AAAA,IAC1B;AAAA,EACF;AACF,EACF,GAEa,IAAoF;AAAA,EAC/F,uBAAuB;AAAA,EAEvB,yBAAyB;AAAA,EAGzB,0BAA0B,EACxB,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C;AAAA,EAOA,yBAAyB,EACvB,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C;AAAA,EAGA,mBAAmB,EACjB,SAAA,CAAU,MAAQ;AAChB,UAAM,IAAU,EAAiB,CAAG;AAEpC,WAAO,IACH;AAAA,MAAE,QAAQ;AAAA,MAAkB,SAAS,EAAE,cAAc,EAAQ,cAAc;AAAA,IAAE,IAC7E;AAAA,EACN,EACF;AAAA,EAGA,0BAA0B,EACxB,SAAA,CAAU,EAAE,MAAA,EAAA,OACT,EAAK,SAAS,mBAAmB,KAAK,IAAI,EAAE,QAAQ,EAAiB,IAAI,KAC9E;AAAA,EAQA,kCAAkC,EAChC,SAAA,CAAU,EAAE,KAAA,EAAA,MACV,EAAI,eAAe,yBAAyB,EAAE,QAAQ,EAAiB,IAAI,KAC/E;AAAA,EAGA,kBAAkB,EAChB,SAAA,CAAU,OAAS;AAAA,IACjB,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,wBAAwB,EAAI,KAAK,SAAS;AAAA,MAC1C,UAAU,EAAe,CAAG,EAAE,IAAA,CAAK,OAAa;AAAA,QAC9C,cAAc,EAAQ;AAAA,QACtB,cAAc,EAAI,KAAK,SAAS,cAAc;AAAA,MAChD,EAAE;AAAA,IACJ;AAAA,EACF,GACF;AAAA,EAEA,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EAGxB,sBAAsB,EACpB,SAAA,CAAU,MAAQ;AAChB,UAAM,IAAS,EAAiB,CAAG;AAEnC,QAAI,CAAC,EAAQ,QAAO;AAEpB,UAAM,IAAU,EAAkB,CAAG,GAC/B,IAAU;AAAA,MACd,QAAQ,EAAI,KAAK,SAAS;AAAA,MAC1B,mBAAmB,EAAO;AAAA,IAC5B;AAEA,WAAO,EAAQ,SACX;AAAA,MACE,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,GAAG;AAAA,QACH,yBAAyB,EAAQ,IAAA,CAAK,MAAY,EAAQ,aAAa;AAAA,MACzE;AAAA,IACF,IACA;AAAA,MAAE,QAAQ;AAAA,MAAkB,SAAA;AAAA,IAAQ;AAAA,EAC1C,EACF;AACF,GAGa,IAAA,CAAsB,MACjC,EAAI,IAAI,YAAY,EAAgB,EAAI,KAAK,QAAA,IAAY,EAAI,IAAA,IAAQ,CAAG,KAAK"}
|
|
@@ -12,7 +12,9 @@ export declare const actionBlocksKey: {
|
|
|
12
12
|
TRANSACTION_LIST_ACTION_BLOCK: string;
|
|
13
13
|
REMAINING_CASH_ACTION_BLOCK: string;
|
|
14
14
|
AMOUNT_INPUT_MODAL_ACTION_BLOCK: string;
|
|
15
|
+
OVERDRAFT_ACTION_BLOCK: string;
|
|
15
16
|
CREDIT_UTILIZATION_ACTION_BLOCK: string;
|
|
16
17
|
EMERGENCY_SAVINGS_ACTION_BLOCK: string;
|
|
17
18
|
PAYOFF_CALCULATOR_ACTION_BLOCK: string;
|
|
19
|
+
BUDGET_DETAILS_ACTION_BLOCK: string;
|
|
18
20
|
};
|
|
@@ -12,9 +12,11 @@ var _ = {
|
|
|
12
12
|
TRANSACTION_LIST_ACTION_BLOCK: "transaction_list_block",
|
|
13
13
|
REMAINING_CASH_ACTION_BLOCK: "remaining_cash_block",
|
|
14
14
|
AMOUNT_INPUT_MODAL_ACTION_BLOCK: "amount_input_modal_block",
|
|
15
|
+
OVERDRAFT_ACTION_BLOCK: "transparent_overdraft_block",
|
|
15
16
|
CREDIT_UTILIZATION_ACTION_BLOCK: "credit_utilization_block",
|
|
16
17
|
EMERGENCY_SAVINGS_ACTION_BLOCK: "emergency_savings_block",
|
|
17
|
-
PAYOFF_CALCULATOR_ACTION_BLOCK: "payoff_calculator_block"
|
|
18
|
+
PAYOFF_CALCULATOR_ACTION_BLOCK: "payoff_calculator_block",
|
|
19
|
+
BUDGET_DETAILS_ACTION_BLOCK: "budget_details_block"
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
22
|
_ as actionBlocksKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;
|
|
1
|
+
{"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n BUDGET_DETAILS_ACTION_BLOCK: 'budget_details_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,6BAA6B;AAC/B"}
|