@mx-cartographer/experiences 9.7.13 → 9.7.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +60 -67
  3. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  4. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +0 -8
  5. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +82 -94
  6. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  7. package/dist/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/layout.d.ts +1 -1
  8. package/dist/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/layout.es.js.map +1 -1
  9. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.d.ts +6 -0
  10. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +28 -0
  11. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -0
  12. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/index.d.ts +4 -0
  13. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.d.ts +18 -0
  14. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js +73 -0
  15. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js.map +1 -0
  16. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +1 -1
  17. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  18. package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -1
  19. package/dist/insights-v2/components/DirectDepositCard.es.js +17 -14
  20. package/dist/insights-v2/components/DirectDepositCard.es.js.map +1 -1
  21. package/dist/insights-v2/components/WithdrawalCard.d.ts +4 -4
  22. package/dist/insights-v2/components/WithdrawalCard.es.js +26 -16
  23. package/dist/insights-v2/components/WithdrawalCard.es.js.map +1 -1
  24. package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +8 -7
  25. package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -1
  26. package/dist/insights-v2/index.es.js +116 -111
  27. package/dist/insights-v2/mappings/blocks.es.js +6 -6
  28. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/DirectDepositBlock.d.ts +0 -16
  31. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/DirectDepositBlock.es.js +0 -24
  32. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/DirectDepositBlock.es.js.map +0 -1
  33. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/index.d.ts +0 -1
  34. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/layout.d.ts +0 -28
  35. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/layout.es.js +0 -63
  36. package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/layout.es.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ import { InsightsPayload } from '../../../../core';
2
+ interface DetailedAccountBlockProps {
3
+ payload: InsightsPayload;
4
+ }
5
+ declare const DetailedAccountBlock: ({ payload }: DetailedAccountBlockProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default DetailedAccountBlock;
@@ -0,0 +1,28 @@
1
+ import { slot as d } from "../../../../core/types/Insights.es.js";
2
+ import f from "../../../components/LogoFromGuid.es.js";
3
+ import { resolveVariantConfig as g } from "../../resolveVariantConfig.es.js";
4
+ import p from "../../../components/DirectDepositCard.es.js";
5
+ import { detailedAccountVariant as _, getLayoutConfig as v } from "./layout.es.js";
6
+ import { jsx as i } from "react/jsx-runtime";
7
+ import { useTheme as D } from "@mui/material/styles";
8
+ var k = ({ payload: e }) => {
9
+ const a = D(), { account_name: r, account_type: n, data: u, institution_guid: t, institution_name: m, status_text: s, variant: l } = e.instance_slot, o = d(u, "logo") ?? (t ? {
10
+ alt: m ?? t,
11
+ guid: t
12
+ } : void 0), c = g(v(a), l, _.Neutral, "DetailedAccountBlock");
13
+ return /* @__PURE__ */ i(p, {
14
+ ...c,
15
+ logo: o?.guid ? /* @__PURE__ */ i(f, {
16
+ logo: o,
17
+ size: 48
18
+ }) : null,
19
+ name: r,
20
+ statusLabel: s,
21
+ subtitle: n
22
+ });
23
+ };
24
+ export {
25
+ k as default
26
+ };
27
+
28
+ //# sourceMappingURL=DetailedAccountBlock.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DetailedAccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport DirectDepositCard from '../../../components/DirectDepositCard'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\n\nimport { detailedAccountVariant, getLayoutConfig } from './layout'\n\ninterface DetailedAccountBlockProps {\n payload: InsightsPayload\n}\n\nconst DetailedAccountBlock = ({ payload }: DetailedAccountBlockProps) => {\n const theme = useTheme()\n const {\n account_name,\n account_type,\n data,\n institution_guid,\n institution_name,\n status_text,\n variant,\n } = payload.instance_slot\n const logo =\n slot<LogoRef>(data, 'logo') ??\n (institution_guid\n ? { alt: institution_name ?? institution_guid, guid: institution_guid }\n : undefined)\n const layout = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n detailedAccountVariant.Neutral,\n 'DetailedAccountBlock',\n )\n\n return (\n <DirectDepositCard\n {...layout}\n logo={logo?.guid ? <LogoFromGuid logo={logo} size={48} /> : null}\n name={account_name}\n statusLabel={status_text}\n subtitle={account_type}\n />\n )\n}\n\nexport default DetailedAccountBlock\n"],"mappings":";;;;;;;AAcA,IAAM,IAAA,CAAwB,EAAE,SAAA,EAAA,MAAyC;AACvE,QAAM,IAAQ,EAAS,GACjB,EACJ,cAAA,GACA,cAAA,GACA,MAAA,GACA,kBAAA,GACA,kBAAA,GACA,aAAA,GACA,SAAA,EAAA,IACE,EAAQ,eACN,IACJ,EAAc,GAAM,MAAM,MACzB,IACG;AAAA,IAAE,KAAK,KAAoB;AAAA,IAAkB,MAAM;AAAA,EAAiB,IACpE,SACA,IAAS,EACb,EAAgB,CAAK,GACrB,GACA,EAAuB,SACvB,sBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MAAM,GAAM,OAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAK,CAAA,IAAI;AAAA,IAC5D,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX,CAAA;AAEL"}
@@ -0,0 +1,4 @@
1
+ export { default as DetailedAccountBlock } from './DetailedAccountBlock';
2
+ export { detailedAccountVariant, directDepositVariant, isDetailedAccountVariant } from './layout';
3
+ /** @deprecated `direct_deposit_block` is an alias of `DetailedAccountBlock`. */
4
+ export { default as DirectDepositBlock } from './DetailedAccountBlock';
@@ -0,0 +1,18 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ import { DirectDepositCardStyleProps } from '../../../components/DirectDepositCard';
3
+ export declare const detailedAccountVariant: {
4
+ readonly Neutral: "detailed_neutral";
5
+ readonly Primary: "detailed_primary";
6
+ readonly Success: "detailed_success";
7
+ readonly Celebration: "detailed_celebration";
8
+ };
9
+ export type DetailedAccountVariant = (typeof detailedAccountVariant)[keyof typeof detailedAccountVariant];
10
+ export declare const directDepositVariant: {
11
+ readonly SetUpDirectDeposit: "set_up_direct_deposit";
12
+ readonly DirectDepositComplete: "direct_deposit_complete";
13
+ readonly MissingInterestRate: "missing_interest_rate";
14
+ readonly InterestRateAdded: "interest_rate_added";
15
+ };
16
+ export type DirectDepositVariant = (typeof directDepositVariant)[keyof typeof directDepositVariant];
17
+ export declare const isDetailedAccountVariant: (variant?: string | null) => variant is DetailedAccountVariant | DirectDepositVariant;
18
+ export declare const getLayoutConfig: (theme: Theme) => Record<DetailedAccountVariant | DirectDepositVariant, DirectDepositCardStyleProps>;
@@ -0,0 +1,73 @@
1
+ import { WARM_LIME_ACCENT_GRADIENT as d } from "../../../components/celebrationGradients.es.js";
2
+ var e = {
3
+ Neutral: "detailed_neutral",
4
+ Primary: "detailed_primary",
5
+ Success: "detailed_success",
6
+ Celebration: "detailed_celebration"
7
+ }, r = {
8
+ SetUpDirectDeposit: "set_up_direct_deposit",
9
+ DirectDepositComplete: "direct_deposit_complete",
10
+ MissingInterestRate: "missing_interest_rate",
11
+ InterestRateAdded: "interest_rate_added"
12
+ }, s = /* @__PURE__ */ new Set([...Object.values(e), ...Object.values(r)]), _ = (t) => t != null && s.has(t), g = {
13
+ light: "linear-gradient(180deg, #A0B9F8 0%, #2C64EF 100%)",
14
+ dark: "linear-gradient(180deg, #1F46A7 0%, #6B92F4 100%)"
15
+ }, p = {
16
+ light: "linear-gradient(180deg, #94C9B7 0%, #12875E 100%)",
17
+ dark: "linear-gradient(180deg, #0D5F42 0%, #59AB8E 100%)"
18
+ }, b = {
19
+ bgcolor: "grey.200",
20
+ borderColor: "grey.200",
21
+ labelColor: "text.primary"
22
+ }, m = {
23
+ bgcolor: "primary.lighter",
24
+ borderColor: "primary.lighter",
25
+ labelColor: "text.primary"
26
+ }, c = {
27
+ bgcolor: "success.main",
28
+ borderColor: "success.main",
29
+ labelColor: "success.contrastText"
30
+ }, A = (t) => {
31
+ const a = t.palette.mode, i = {
32
+ bgcolor: "primary.lighter",
33
+ nameVariant: "body2",
34
+ pill: b
35
+ }, o = {
36
+ backgroundImage: g[a],
37
+ bgcolor: "background.paper",
38
+ nameVariant: "body1",
39
+ pill: m
40
+ }, l = {
41
+ backgroundImage: p[a],
42
+ bgcolor: "background.paper",
43
+ nameVariant: "body1",
44
+ pill: c
45
+ }, n = {
46
+ backgroundImage: d,
47
+ bgcolor: "background.paper",
48
+ nameVariant: "body2",
49
+ pill: {
50
+ ...c,
51
+ icon: "check_circle"
52
+ },
53
+ showConfetti: !0
54
+ };
55
+ return {
56
+ [e.Neutral]: i,
57
+ [e.Primary]: o,
58
+ [e.Success]: l,
59
+ [e.Celebration]: n,
60
+ [r.SetUpDirectDeposit]: i,
61
+ [r.MissingInterestRate]: o,
62
+ [r.InterestRateAdded]: l,
63
+ [r.DirectDepositComplete]: n
64
+ };
65
+ };
66
+ export {
67
+ e as detailedAccountVariant,
68
+ r as directDepositVariant,
69
+ A as getLayoutConfig,
70
+ _ as isDetailedAccountVariant
71
+ };
72
+
73
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport { WARM_LIME_ACCENT_GRADIENT } from '../../../components/celebrationGradients'\nimport type {\n DirectDepositCardStyleProps,\n DirectDepositPillConfig,\n} from '../../../components/DirectDepositCard'\n\nexport const detailedAccountVariant = {\n Neutral: 'detailed_neutral',\n Primary: 'detailed_primary',\n Success: 'detailed_success',\n Celebration: 'detailed_celebration',\n} as const\n\nexport type DetailedAccountVariant =\n (typeof detailedAccountVariant)[keyof typeof detailedAccountVariant]\n\nexport const directDepositVariant = {\n SetUpDirectDeposit: 'set_up_direct_deposit',\n DirectDepositComplete: 'direct_deposit_complete',\n MissingInterestRate: 'missing_interest_rate',\n InterestRateAdded: 'interest_rate_added',\n} as const\n\nexport type DirectDepositVariant = (typeof directDepositVariant)[keyof typeof directDepositVariant]\n\nconst VARIANTS = new Set<string>([\n ...Object.values(detailedAccountVariant),\n ...Object.values(directDepositVariant),\n])\n\nexport const isDetailedAccountVariant = (\n variant?: string | null,\n): variant is DetailedAccountVariant | DirectDepositVariant =>\n variant != null && VARIANTS.has(variant)\n\nconst MISSING_RATE_GRADIENTS = {\n light: 'linear-gradient(180deg, #A0B9F8 0%, #2C64EF 100%)',\n dark: 'linear-gradient(180deg, #1F46A7 0%, #6B92F4 100%)',\n} as const\n\nconst RATE_ADDED_GRADIENTS = {\n light: 'linear-gradient(180deg, #94C9B7 0%, #12875E 100%)',\n dark: 'linear-gradient(180deg, #0D5F42 0%, #59AB8E 100%)',\n} as const\n\nconst NEUTRAL_PILL: DirectDepositPillConfig = {\n bgcolor: 'grey.200',\n borderColor: 'grey.200',\n labelColor: 'text.primary',\n}\n\nconst PRIMARY_TINT_PILL: DirectDepositPillConfig = {\n bgcolor: 'primary.lighter',\n borderColor: 'primary.lighter',\n labelColor: 'text.primary',\n}\n\nconst SUCCESS_PILL: DirectDepositPillConfig = {\n bgcolor: 'success.main',\n borderColor: 'success.main',\n labelColor: 'success.contrastText',\n}\n\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<DetailedAccountVariant | DirectDepositVariant, DirectDepositCardStyleProps> => {\n const mode = theme.palette.mode\n const neutral: DirectDepositCardStyleProps = {\n bgcolor: 'primary.lighter',\n nameVariant: 'body2',\n pill: NEUTRAL_PILL,\n }\n const primary: DirectDepositCardStyleProps = {\n backgroundImage: MISSING_RATE_GRADIENTS[mode],\n bgcolor: 'background.paper',\n nameVariant: 'body1',\n pill: PRIMARY_TINT_PILL,\n }\n const success: DirectDepositCardStyleProps = {\n backgroundImage: RATE_ADDED_GRADIENTS[mode],\n bgcolor: 'background.paper',\n nameVariant: 'body1',\n pill: SUCCESS_PILL,\n }\n const celebration: DirectDepositCardStyleProps = {\n backgroundImage: WARM_LIME_ACCENT_GRADIENT,\n bgcolor: 'background.paper',\n nameVariant: 'body2',\n pill: { ...SUCCESS_PILL, icon: 'check_circle' },\n showConfetti: true,\n }\n\n return {\n [detailedAccountVariant.Neutral]: neutral,\n [detailedAccountVariant.Primary]: primary,\n [detailedAccountVariant.Success]: success,\n [detailedAccountVariant.Celebration]: celebration,\n [directDepositVariant.SetUpDirectDeposit]: neutral,\n [directDepositVariant.MissingInterestRate]: primary,\n [directDepositVariant.InterestRateAdded]: success,\n [directDepositVariant.DirectDepositComplete]: celebration,\n }\n}\n"],"mappings":";AAQA,IAAa,IAAyB;AAAA,EACpC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,aAAa;AACf,GAKa,IAAuB;AAAA,EAClC,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,mBAAmB;AACrB,GAIM,IAAW,oBAAI,IAAY,CAC/B,GAAG,OAAO,OAAO,CAAsB,GACvC,GAAG,OAAO,OAAO,CAAoB,CACvC,CAAC,GAEY,IAAA,CACX,MAEA,KAAW,QAAQ,EAAS,IAAI,CAAO,GAEnC,IAAyB;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AACR,GAEM,IAAuB;AAAA,EAC3B,OAAO;AAAA,EACP,MAAM;AACR,GAEM,IAAwC;AAAA,EAC5C,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AACd,GAEM,IAA6C;AAAA,EACjD,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AACd,GAEM,IAAwC;AAAA,EAC5C,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AACd,GAEa,IAAA,CACX,MACuF;AACvF,QAAM,IAAO,EAAM,QAAQ,MACrB,IAAuC;AAAA,IAC3C,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,EACR,GACM,IAAuC;AAAA,IAC3C,iBAAiB,EAAuB,CAAA;AAAA,IACxC,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,EACR,GACM,IAAuC;AAAA,IAC3C,iBAAiB,EAAqB,CAAA;AAAA,IACtC,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,EACR,GACM,IAA2C;AAAA,IAC/C,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,MAAE,GAAG;AAAA,MAAc,MAAM;AAAA,IAAe;AAAA,IAC9C,cAAc;AAAA,EAChB;AAEA,SAAO;AAAA,IACJ,CAAA,EAAuB,OAAA,GAAU;AAAA,IACjC,CAAA,EAAuB,OAAA,GAAU;AAAA,IACjC,CAAA,EAAuB,OAAA,GAAU;AAAA,IACjC,CAAA,EAAuB,WAAA,GAAc;AAAA,IACrC,CAAA,EAAqB,kBAAA,GAAqB;AAAA,IAC1C,CAAA,EAAqB,mBAAA,GAAsB;AAAA,IAC3C,CAAA,EAAqB,iBAAA,GAAoB;AAAA,IACzC,CAAA,EAAqB,qBAAA,GAAwB;AAAA,EAChD;AACF"}
@@ -31,5 +31,5 @@ export interface TransactionLayoutConfig {
31
31
  /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */
32
32
  statusMessage?: boolean;
33
33
  }
34
- /** Per-variant `TransactionListCard` props (mirrors DirectDepositBlock's `getLayoutConfig`). */
34
+ /** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */
35
35
  export declare const getLayoutConfig: (theme: Theme) => Record<TransactionBlockVariant, TransactionLayoutConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport {\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — borderless row on the blue slot wash (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n NoHeader: 'no_header',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card then renders borderless on paper. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DirectDepositBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n [transactionBlockVariant.WithHeader]: { showHeader: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n },\n [transactionBlockVariant.StatusMessage]: { showHeader: false, statusMessage: true },\n})\n"],"mappings":";AAoBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAiBa,IAAA,CACX,OAC8D;AAAA,EAC7D,CAAA,EAAwB,UAAA,GAAa,EAAE,YAAY,GAAK;AAAA,EACxD,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,EAC1C;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IAAE,YAAY;AAAA,IAAO,eAAe;AAAA,EAAK;AACpF"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport {\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — borderless row on the blue slot wash (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n NoHeader: 'no_header',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card then renders borderless on paper. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n [transactionBlockVariant.WithHeader]: { showHeader: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n },\n [transactionBlockVariant.StatusMessage]: { showHeader: false, statusMessage: true },\n})\n"],"mappings":";AAoBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAiBa,IAAA,CACX,OAC8D;AAAA,EAC7D,CAAA,EAAwB,UAAA,GAAa,EAAE,YAAY,GAAK;AAAA,EACxD,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,EAC1C;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IAAE,YAAY;AAAA,IAAO,eAAe;AAAA,EAAK;AACpF"}
@@ -1,8 +1,8 @@
1
1
  export * from './AccountBlock';
2
2
  export * from './AccountSwitchBlock';
3
- export * from './DirectDepositBlock';
4
3
  export * from './BudgetBlock';
5
4
  export * from './DebtsBlock';
5
+ export * from './DetailedAccountBlock';
6
6
  export * from './RepeatingTransactionBlock';
7
7
  export * from './SaveExtraBlock';
8
8
  export * from './SavingsOpportunityBlock';
@@ -1,20 +1,23 @@
1
- import n from "./StatusPill.es.js";
2
- import b from "./AccountHeroCard.es.js";
3
- import { ConfettiOverlay as f } from "./shared/ConfettiOverlay.es.js";
4
- import { NEUTRAL_PILL as s } from "../blocks/ComponentBlocks/DirectDepositBlock/layout.es.js";
5
- import { Icon as C } from "@mxenabled/mx-icons";
1
+ import m from "./StatusPill.es.js";
2
+ import n from "./AccountHeroCard.es.js";
3
+ import { ConfettiOverlay as C } from "./shared/ConfettiOverlay.es.js";
4
+ import { Icon as s } from "@mxenabled/mx-icons";
6
5
  import { jsx as r } from "react/jsx-runtime";
7
- var h = ({ backgroundImage: t, bgcolor: i = "primary.lighter", logo: a, name: d, nameVariant: m = "body2", pill: o = s, showConfetti: l = !1, statusLabel: e, subtitle: c }) => /* @__PURE__ */ r(b, {
8
- backdrop: l ? /* @__PURE__ */ r(f, {}) : void 0,
6
+ var f = {
7
+ bgcolor: "grey.200",
8
+ borderColor: "grey.200",
9
+ labelColor: "text.primary"
10
+ }, u = ({ backgroundImage: t, bgcolor: a = "primary.lighter", logo: i, name: l, nameVariant: d = "body2", pill: o = f, showConfetti: b = !1, statusLabel: e, subtitle: c }) => /* @__PURE__ */ r(n, {
11
+ backdrop: b ? /* @__PURE__ */ r(C, {}) : void 0,
9
12
  backgroundImage: t,
10
- bgcolor: i,
11
- logo: a,
12
- name: d,
13
- nameVariant: m,
14
- status: e ? /* @__PURE__ */ r(n, {
13
+ bgcolor: a,
14
+ logo: i,
15
+ name: l,
16
+ nameVariant: d,
17
+ status: e ? /* @__PURE__ */ r(m, {
15
18
  bgcolor: o.bgcolor,
16
19
  borderColor: o.borderColor,
17
- icon: o.icon ? /* @__PURE__ */ r(C, {
20
+ icon: o.icon ? /* @__PURE__ */ r(s, {
18
21
  "aria-hidden": !0,
19
22
  "data-testid": "pill-icon",
20
23
  name: o.icon,
@@ -31,7 +34,7 @@ var h = ({ backgroundImage: t, bgcolor: i = "primary.lighter", logo: a, name: d,
31
34
  subtitle: c
32
35
  });
33
36
  export {
34
- h as default
37
+ u as default
35
38
  };
36
39
 
37
40
  //# sourceMappingURL=DirectDepositCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DirectDepositCard.es.js","names":[],"sources":["../../../src/insights-v2/components/DirectDepositCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport AccountHeroCard from './AccountHeroCard'\nimport StatusPill from './StatusPill'\n\nimport { ConfettiOverlay } from './shared/ConfettiOverlay'\nimport { NEUTRAL_PILL } from '../blocks/ComponentBlocks/DirectDepositBlock/layout'\n\nexport interface DirectDepositPillConfig {\n /** Pill background color token. */\n bgcolor: string\n /** Pill border color token. */\n borderColor: string\n /** Pill label color token. */\n labelColor: string\n /** Optional mx-icons glyph rendered before the label (e.g. `check_circle`). */\n icon?: string\n}\n\n/**\n * Style props for the card. Variant-specific values live in the Direct Deposit\n * block's `layout.ts` (`getLayoutConfig`) — the card itself is variant-agnostic.\n */\nexport interface DirectDepositCardStyleProps {\n /** Slot surface token behind the white hero card. Default `primary.lighter`. */\n bgcolor?: string\n /** Decorative wash layered over `bgcolor` (celebration/gradient slots). */\n backgroundImage?: string\n /** Confetti burst behind the hero card (complete states). */\n showConfetti?: boolean\n /** Hero name typography. Default `body2` (13/16); rate variants use `body1` (15/20). */\n nameVariant?: 'body1' | 'body2'\n /** Status pill color tokens + optional leading glyph. */\n pill?: DirectDepositPillConfig\n}\n\ninterface DirectDepositCardProps extends DirectDepositCardStyleProps {\n /** Institution/account logo, rendered overhanging the hero card's top edge. */\n logo: ReactNode\n /** Primary line, e.g. \"Epic Bank Checking, *1234\". */\n name: ReactNode\n /** Optional secondary line, e.g. \"Checking Account\" / \"Credit Card\". */\n subtitle?: ReactNode\n /** Optional status pill label, e.g. \"Direct Deposit Not Set Up\". */\n statusLabel?: ReactNode\n}\n\n/**\n * The basic Direct Deposit hero card: an overhanging logo above a white card\n * with a name, optional subtitle, and a status pill, over a tinted/gradient\n * slot with an optional confetti backdrop.\n *\n * Purely presentational — it knows nothing about beats or variants. The Direct\n * Deposit block resolves `instance_slot.variant` to these style props via its\n * `layout.ts` (`getLayoutConfig`).\n */\nconst DirectDepositCard = ({\n backgroundImage,\n bgcolor = 'primary.lighter',\n logo,\n name,\n nameVariant = 'body2',\n pill = NEUTRAL_PILL,\n showConfetti = false,\n statusLabel,\n subtitle,\n}: DirectDepositCardProps) => {\n return (\n <AccountHeroCard\n backdrop={showConfetti ? <ConfettiOverlay /> : undefined}\n backgroundImage={backgroundImage}\n bgcolor={bgcolor}\n logo={logo}\n name={name}\n nameVariant={nameVariant}\n status={\n statusLabel ? (\n <StatusPill\n bgcolor={pill.bgcolor}\n borderColor={pill.borderColor}\n icon={\n pill.icon ? (\n <Icon\n aria-hidden={true}\n data-testid=\"pill-icon\"\n name={pill.icon}\n size={16}\n sx={{ color: pill.labelColor }}\n />\n ) : undefined\n }\n label={statusLabel}\n labelColor={pill.labelColor}\n // Figma pill geometry: 24px tall, 12px side padding, no stroke\n // (StatusPill defaults draw a 1px border and 16px padding).\n sx={{ border: 'none', px: 12 }}\n />\n ) : undefined\n }\n subtitle={subtitle}\n />\n )\n}\n\nexport default DirectDepositCard\n"],"mappings":";;;;;;AA0DA,IAAM,IAAA,CAAqB,EACzB,iBAAA,GACA,SAAA,IAAU,mBACV,MAAA,GACA,MAAA,GACA,aAAA,IAAc,SACd,MAAA,IAAO,GACP,cAAA,IAAe,IACf,aAAA,GACA,UAAA,EAAA,MAGE,gBAAA,EAAC,GAAD;AAAA,EACE,UAAU,IAAe,gBAAA,EAAC,GAAD,CAAkB,CAAA,IAAI;AAAA,EAC9B,iBAAA;AAAA,EACR,SAAA;AAAA,EACH,MAAA;AAAA,EACA,MAAA;AAAA,EACO,aAAA;AAAA,EACb,QACE,IACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAK;AAAA,IACd,aAAa,EAAK;AAAA,IAClB,MACE,EAAK,OACH,gBAAA,EAAC,GAAD;AAAA,MACE,eAAa;AAAA,MACb,eAAY;AAAA,MACZ,MAAM,EAAK;AAAA,MACX,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,EAAK,WAAW;AAAA,IAC9B,CAAA,IACC;AAAA,IAEN,OAAO;AAAA,IACP,YAAY,EAAK;AAAA,IAGjB,IAAI;AAAA,MAAE,QAAQ;AAAA,MAAQ,IAAI;AAAA,IAAG;AAAA,EAC9B,CAAA,IACC;AAAA,EAEI,UAAA;AACX,CAAA"}
1
+ {"version":3,"file":"DirectDepositCard.es.js","names":[],"sources":["../../../src/insights-v2/components/DirectDepositCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport AccountHeroCard from './AccountHeroCard'\nimport StatusPill from './StatusPill'\n\nimport { ConfettiOverlay } from './shared/ConfettiOverlay'\n\nexport interface DirectDepositPillConfig {\n /** Pill background color token. */\n bgcolor: string\n /** Pill border color token. */\n borderColor: string\n /** Pill label color token. */\n labelColor: string\n /** Optional mx-icons glyph rendered before the label (e.g. `check_circle`). */\n icon?: string\n}\n\n/**\n * Style props for the card. Variant-specific values live in the Direct Deposit\n * block's `layout.ts` (`getLayoutConfig`) — the card itself is variant-agnostic.\n */\nexport interface DirectDepositCardStyleProps {\n /** Slot surface token behind the white hero card. Default `primary.lighter`. */\n bgcolor?: string\n /** Decorative wash layered over `bgcolor` (celebration/gradient slots). */\n backgroundImage?: string\n /** Confetti burst behind the hero card (complete states). */\n showConfetti?: boolean\n /** Hero name typography. Default `body2` (13/16); rate variants use `body1` (15/20). */\n nameVariant?: 'body1' | 'body2'\n /** Status pill color tokens + optional leading glyph. */\n pill?: DirectDepositPillConfig\n}\n\nconst NEUTRAL_PILL: DirectDepositPillConfig = {\n bgcolor: 'grey.200',\n borderColor: 'grey.200',\n labelColor: 'text.primary',\n}\n\ninterface DirectDepositCardProps extends DirectDepositCardStyleProps {\n /** Institution/account logo, rendered overhanging the hero card's top edge. */\n logo: ReactNode\n /** Primary line, e.g. \"Epic Bank Checking, *1234\". */\n name: ReactNode\n /** Optional secondary line, e.g. \"Checking Account\" / \"Credit Card\". */\n subtitle?: ReactNode\n /** Optional status pill label, e.g. \"Direct Deposit Not Set Up\". */\n statusLabel?: ReactNode\n}\n\n/**\n * The basic Direct Deposit hero card: an overhanging logo above a white card\n * with a name, optional subtitle, and a status pill, over a tinted/gradient\n * slot with an optional confetti backdrop.\n *\n * Purely presentational — it knows nothing about beats or variants. The Direct\n * Deposit block resolves `instance_slot.variant` to these style props via its\n * `layout.ts` (`getLayoutConfig`).\n */\nconst DirectDepositCard = ({\n backgroundImage,\n bgcolor = 'primary.lighter',\n logo,\n name,\n nameVariant = 'body2',\n pill = NEUTRAL_PILL,\n showConfetti = false,\n statusLabel,\n subtitle,\n}: DirectDepositCardProps) => {\n return (\n <AccountHeroCard\n backdrop={showConfetti ? <ConfettiOverlay /> : undefined}\n backgroundImage={backgroundImage}\n bgcolor={bgcolor}\n logo={logo}\n name={name}\n nameVariant={nameVariant}\n status={\n statusLabel ? (\n <StatusPill\n bgcolor={pill.bgcolor}\n borderColor={pill.borderColor}\n icon={\n pill.icon ? (\n <Icon\n aria-hidden={true}\n data-testid=\"pill-icon\"\n name={pill.icon}\n size={16}\n sx={{ color: pill.labelColor }}\n />\n ) : undefined\n }\n label={statusLabel}\n labelColor={pill.labelColor}\n // Figma pill geometry: 24px tall, 12px side padding, no stroke\n // (StatusPill defaults draw a 1px border and 16px padding).\n sx={{ border: 'none', px: 12 }}\n />\n ) : undefined\n }\n subtitle={subtitle}\n />\n )\n}\n\nexport default DirectDepositCard\n"],"mappings":";;;;;AAqCA,IAAM,IAAwC;AAAA,EAC5C,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AACd,GAsBM,IAAA,CAAqB,EACzB,iBAAA,GACA,SAAA,IAAU,mBACV,MAAA,GACA,MAAA,GACA,aAAA,IAAc,SACd,MAAA,IAAO,GACP,cAAA,IAAe,IACf,aAAA,GACA,UAAA,EAAA,MAGE,gBAAA,EAAC,GAAD;AAAA,EACE,UAAU,IAAe,gBAAA,EAAC,GAAD,CAAkB,CAAA,IAAI;AAAA,EAC9B,iBAAA;AAAA,EACR,SAAA;AAAA,EACH,MAAA;AAAA,EACA,MAAA;AAAA,EACO,aAAA;AAAA,EACb,QACE,IACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAK;AAAA,IACd,aAAa,EAAK;AAAA,IAClB,MACE,EAAK,OACH,gBAAA,EAAC,GAAD;AAAA,MACE,eAAa;AAAA,MACb,eAAY;AAAA,MACZ,MAAM,EAAK;AAAA,MACX,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,EAAK,WAAW;AAAA,IAC9B,CAAA,IACC;AAAA,IAEN,OAAO;AAAA,IACP,YAAY,EAAK;AAAA,IAGjB,IAAI;AAAA,MAAE,QAAQ;AAAA,MAAQ,IAAI;AAAA,IAAG;AAAA,EAC9B,CAAA,IACC;AAAA,EAEI,UAAA;AACX,CAAA"}
@@ -14,10 +14,10 @@ interface WithdrawalCardProps {
14
14
  }
15
15
  /**
16
16
  * A centered withdrawal highlight: the amount as a headline with a date line beneath it
17
- * ("{amountLabel} {withdrawalDate}"), over a grey footer row showing the balance. All text arrives
18
- * localized from the backend; only the two numbers are formatted here (the amount gets a leading
19
- * minus unless it is zero). The date line is hidden when both `amountLabel` and `withdrawalDate`
20
- * are empty.
17
+ * ("{amountLabel} {withdrawalDate}"), over a grey footer row showing the balance. Labels arrive
18
+ * localized from the backend; the card formats the two numbers (the amount gets a leading minus
19
+ * unless it is zero) and an ISO `withdrawalDate` (as the calendar day it names). The date line is
20
+ * hidden when `withdrawalDate` is empty.
21
21
  *
22
22
  * Figma: Withdrawal component block (Highlight Withdrawal). Scope is the Content section only.
23
23
  */
@@ -1,11 +1,21 @@
1
+ import { formatDate as f } from "../../core/constants/DateFormats.es.js";
1
2
  import { formatCurrency as n } from "../../core/utils/NumberFormatting.es.js";
2
- import t from "@mui/material/Stack";
3
- import { Text as e } from "@mxenabled/mxui";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import m from "@mui/material/Divider";
6
- var x = (o) => o === 0 ? n(0, "0,0.00") : `-${n(Math.abs(o), "0,0.00")}`, y = ({ amount: o, amountLabel: l, balance: s, balanceLabel: d, withdrawalDate: a, sx: p }) => {
7
- const c = a ? [l, a].filter(Boolean).join(" ") : "";
8
- return /* @__PURE__ */ i(t, {
3
+ import i from "@mui/material/Stack";
4
+ import { Text as o } from "@mxenabled/mxui";
5
+ import { jsx as t, jsxs as a } from "react/jsx-runtime";
6
+ import { parseISO as h } from "date-fns";
7
+ import x from "@mui/material/Divider";
8
+ var u = (r) => r === 0 ? n(0, "0,0.00") : `-${n(Math.abs(r), "0,0.00")}`, b = /^\d{4}-\d{2}-\d{2}$/, y = {
9
+ month: "long",
10
+ day: "numeric",
11
+ year: "numeric"
12
+ }, g = (r) => {
13
+ if (!r || !b.test(r)) return r;
14
+ const e = h(r);
15
+ return Number.isNaN(e.getTime()) ? r : f(e, y);
16
+ }, j = ({ amount: r, amountLabel: e, balance: s, balanceLabel: d, withdrawalDate: l, sx: p }) => {
17
+ const m = g(l), c = m ? [e, m].filter(Boolean).join(" ") : "";
18
+ return /* @__PURE__ */ a(i, {
9
19
  sx: {
10
20
  border: "1px solid",
11
21
  borderColor: "divider",
@@ -15,25 +25,25 @@ var x = (o) => o === 0 ? n(0, "0,0.00") : `-${n(Math.abs(o), "0,0.00")}`, y = ({
15
25
  ...p
16
26
  },
17
27
  children: [
18
- /* @__PURE__ */ i(t, {
28
+ /* @__PURE__ */ a(i, {
19
29
  sx: {
20
30
  alignItems: "center",
21
31
  gap: 4,
22
32
  px: 16,
23
33
  py: 20
24
34
  },
25
- children: [/* @__PURE__ */ r(e, {
35
+ children: [/* @__PURE__ */ t(o, {
26
36
  bold: !0,
27
37
  variant: "h1",
28
- children: x(o)
29
- }), c && /* @__PURE__ */ r(e, {
38
+ children: u(r)
39
+ }), c && /* @__PURE__ */ t(o, {
30
40
  color: "text.secondary",
31
41
  variant: "caption",
32
42
  children: c
33
43
  })]
34
44
  }),
35
- /* @__PURE__ */ r(m, {}),
36
- /* @__PURE__ */ i(t, {
45
+ /* @__PURE__ */ t(x, {}),
46
+ /* @__PURE__ */ a(i, {
37
47
  sx: {
38
48
  alignItems: "center",
39
49
  bgcolor: "background.default",
@@ -43,11 +53,11 @@ var x = (o) => o === 0 ? n(0, "0,0.00") : `-${n(Math.abs(o), "0,0.00")}`, y = ({
43
53
  px: 16,
44
54
  py: 2
45
55
  },
46
- children: [d && /* @__PURE__ */ r(e, {
56
+ children: [d && /* @__PURE__ */ t(o, {
47
57
  color: "text.secondary",
48
58
  variant: "caption",
49
59
  children: d
50
- }), /* @__PURE__ */ r(e, {
60
+ }), /* @__PURE__ */ t(o, {
51
61
  bold: !0,
52
62
  variant: "body2",
53
63
  children: n(s, "0,0.00")
@@ -57,7 +67,7 @@ var x = (o) => o === 0 ? n(0, "0,0.00") : `-${n(Math.abs(o), "0,0.00")}`, y = ({
57
67
  });
58
68
  };
59
69
  export {
60
- y as default
70
+ j as default
61
71
  };
62
72
 
63
73
  //# sourceMappingURL=WithdrawalCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithdrawalCard.es.js","names":[],"sources":["../../../src/insights-v2/components/WithdrawalCard.tsx"],"sourcesContent":["import Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\n// A withdrawal is a debit, so a non-zero amount is shown with a leading minus (\"-$100.00\"); zero is\n// shown unsigned (\"$0.00\"). The sign comes from the magnitude, so an amount that already arrives\n// negative does not render a double minus.\nconst formatWithdrawalAmount = (amount: number) =>\n amount === 0 ? formatCurrency(0, '0,0.00') : `-${formatCurrency(Math.abs(amount), '0,0.00')}`\n\ninterface WithdrawalCardProps {\n /** Withdrawn amount as a plain number (e.g. `100`); the card adds the minus sign. */\n amount: number\n /** Pre-localized lead-in for the date line (e.g. \"Withdrawn on\"). */\n amountLabel?: string\n /** Account balance after the withdrawal, shown in the grey footer row. */\n balance: number\n /** Pre-localized footer label for the balance (e.g. \"Balance\"). */\n balanceLabel?: string\n /** Pre-localized withdrawal date (e.g. \"October 5, 2026\"). */\n withdrawalDate?: string\n sx?: SxProps\n}\n\n/**\n * A centered withdrawal highlight: the amount as a headline with a date line beneath it\n * (\"{amountLabel} {withdrawalDate}\"), over a grey footer row showing the balance. All text arrives\n * localized from the backend; only the two numbers are formatted here (the amount gets a leading\n * minus unless it is zero). The date line is hidden when both `amountLabel` and `withdrawalDate`\n * are empty.\n *\n * Figma: Withdrawal component block (Highlight Withdrawal). Scope is the Content section only.\n */\nconst WithdrawalCard = ({\n amount,\n amountLabel,\n balance,\n balanceLabel,\n withdrawalDate,\n sx,\n}: WithdrawalCardProps) => {\n const dateLine = withdrawalDate ? [amountLabel, withdrawalDate].filter(Boolean).join(' ') : ''\n\n return (\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '4px',\n overflow: 'hidden',\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', gap: 4, px: 16, py: 20 }}>\n <Text bold={true} variant=\"h1\">\n {formatWithdrawalAmount(amount)}\n </Text>\n {dateLine && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateLine}\n </Text>\n )}\n </Stack>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n {balanceLabel && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {balanceLabel}\n </Text>\n )}\n <Text bold={true} variant=\"body2\">\n {formatCurrency(balance, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n )\n}\n\nexport default WithdrawalCard\n"],"mappings":";;;;;AAWA,IAAM,IAAA,CAA0B,MAC9B,MAAW,IAAI,EAAe,GAAG,QAAQ,IAAI,IAAI,EAAe,KAAK,IAAI,CAAM,GAAG,QAAQ,CAAA,IAyBtF,IAAA,CAAkB,EACtB,QAAA,GACA,aAAA,GACA,SAAA,GACA,cAAA,GACA,gBAAA,GACA,IAAA,EAAA,MACyB;AACzB,QAAM,IAAW,IAAiB,CAAC,GAAa,CAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,IAAI;AAE5F,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IARF,UAAA;AAAA,MAUE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,YAAY;AAAA,UAAU,KAAK;AAAA,UAAG,IAAI;AAAA,UAAI,IAAI;AAAA,QAAG;AAAA,QAA1D,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAuB,CAAM;AAAA,QAC1B,CAAA,GACL,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,CAEH;AAAA;MACP,gBAAA,EAAC,GAAD,CAAU,CAAA;AAAA,MACV,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,eAAe;AAAA,UACf,gBAAgB;AAAA,UAChB,WAAW;AAAA,UACX,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QATF,UAAA,CAWG,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,GAER,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAe,GAAS,QAAQ;AAAA,QAC7B,CAAA,CACD;AAAA;IACF;AAAA;AAEX"}
1
+ {"version":3,"file":"WithdrawalCard.es.js","names":[],"sources":["../../../src/insights-v2/components/WithdrawalCard.tsx"],"sourcesContent":["import Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { parseISO } from 'date-fns'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatDate } from '../../core/constants'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\n// A withdrawal is a debit, so a non-zero amount is shown with a leading minus (\"-$100.00\"); zero is\n// shown unsigned (\"$0.00\"). The sign comes from the magnitude, so an amount that already arrives\n// negative does not render a double minus.\nconst formatWithdrawalAmount = (amount: number) =>\n amount === 0 ? formatCurrency(0, '0,0.00') : `-${formatCurrency(Math.abs(amount), '0,0.00')}`\n\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\nconst WITHDRAWAL_DATE_FORMAT = { month: 'long', day: 'numeric', year: 'numeric' }\n\n// The bucket 1 slot sends the stored beat date as a calendar day (\"2026-10-05\"). parseISO reads a\n// date-only string as local midnight, so the viewer sees the day it names; new Date() would read UTC\n// midnight and show the day before west of UTC. A date that already arrives worded renders as sent,\n// and so does one that matches the shape but names no real day (\"2026-02-30\" parses to an Invalid\n// Date, which Intl cannot format) - the same guard Footer applies before formatting.\nconst formatWithdrawalDate = (value?: string) => {\n if (!value || !ISO_DATE.test(value)) return value\n\n const parsed = parseISO(value)\n\n return Number.isNaN(parsed.getTime()) ? value : formatDate(parsed, WITHDRAWAL_DATE_FORMAT)\n}\n\ninterface WithdrawalCardProps {\n /** Withdrawn amount as a plain number (e.g. `100`); the card adds the minus sign. */\n amount: number\n /** Pre-localized lead-in for the date line (e.g. \"Withdrawn on\"). */\n amountLabel?: string\n /** Account balance after the withdrawal, shown in the grey footer row. */\n balance: number\n /** Pre-localized footer label for the balance (e.g. \"Balance\"). */\n balanceLabel?: string\n /** Pre-localized withdrawal date (e.g. \"October 5, 2026\"). */\n withdrawalDate?: string\n sx?: SxProps\n}\n\n/**\n * A centered withdrawal highlight: the amount as a headline with a date line beneath it\n * (\"{amountLabel} {withdrawalDate}\"), over a grey footer row showing the balance. Labels arrive\n * localized from the backend; the card formats the two numbers (the amount gets a leading minus\n * unless it is zero) and an ISO `withdrawalDate` (as the calendar day it names). The date line is\n * hidden when `withdrawalDate` is empty.\n *\n * Figma: Withdrawal component block (Highlight Withdrawal). Scope is the Content section only.\n */\nconst WithdrawalCard = ({\n amount,\n amountLabel,\n balance,\n balanceLabel,\n withdrawalDate,\n sx,\n}: WithdrawalCardProps) => {\n const formattedDate = formatWithdrawalDate(withdrawalDate)\n const dateLine = formattedDate ? [amountLabel, formattedDate].filter(Boolean).join(' ') : ''\n\n return (\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '4px',\n overflow: 'hidden',\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', gap: 4, px: 16, py: 20 }}>\n <Text bold={true} variant=\"h1\">\n {formatWithdrawalAmount(amount)}\n </Text>\n {dateLine && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {dateLine}\n </Text>\n )}\n </Stack>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n {balanceLabel && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {balanceLabel}\n </Text>\n )}\n <Text bold={true} variant=\"body2\">\n {formatCurrency(balance, '0,0.00')}\n </Text>\n </Stack>\n </Stack>\n )\n}\n\nexport default WithdrawalCard\n"],"mappings":";;;;;;;AAcA,IAAM,IAAA,CAA0B,MAC9B,MAAW,IAAI,EAAe,GAAG,QAAQ,IAAI,IAAI,EAAe,KAAK,IAAI,CAAM,GAAG,QAAQ,CAAA,IAEtF,IAAW,uBACX,IAAyB;AAAA,EAAE,OAAO;AAAA,EAAQ,KAAK;AAAA,EAAW,MAAM;AAAU,GAO1E,IAAA,CAAwB,MAAmB;AAC/C,MAAI,CAAC,KAAS,CAAC,EAAS,KAAK,CAAK,EAAG,QAAO;AAE5C,QAAM,IAAS,EAAS,CAAK;AAE7B,SAAO,OAAO,MAAM,EAAO,QAAQ,CAAC,IAAI,IAAQ,EAAW,GAAQ,CAAsB;AAC3F,GAyBM,IAAA,CAAkB,EACtB,QAAA,GACA,aAAA,GACA,SAAA,GACA,cAAA,GACA,gBAAA,GACA,IAAA,EAAA,MACyB;AACzB,QAAM,IAAgB,EAAqB,CAAc,GACnD,IAAW,IAAgB,CAAC,GAAa,CAAa,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,IAAI;AAE1F,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IARF,UAAA;AAAA,MAUE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,YAAY;AAAA,UAAU,KAAK;AAAA,UAAG,IAAI;AAAA,UAAI,IAAI;AAAA,QAAG;AAAA,QAA1D,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAuB,CAAM;AAAA,QAC1B,CAAA,GACL,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,CAEH;AAAA;MACP,gBAAA,EAAC,GAAD,CAAU,CAAA;AAAA,MACV,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,eAAe;AAAA,UACf,gBAAgB;AAAA,UAChB,WAAW;AAAA,UACX,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QATF,UAAA,CAWG,KACC,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,GAER,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAe,GAAS,QAAQ;AAAA,QAC7B,CAAA,CACD;AAAA;IACF;AAAA;AAEX"}
@@ -1,14 +1,15 @@
1
1
  import { AccountType as s } from "../../core/types/Account.es.js";
2
2
  import { BEAT_OPERATION_1 as n, BEAT_OPERATION_2 as l } from "../../common/utils/PostMessage.es.js";
3
- var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, r = ({ beat: a, stores: t }) => a.primary_account ?? t.accountStore.accounts.find((o) => o.guid === a.primary_account_guid), d = ({ beat: a, stores: t }) => {
3
+ var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, stores: t }) => a.primary_account ?? t.accountStore.accounts.find((o) => o.guid === a.primary_account_guid), d = ({ beat: a, stores: t }) => {
4
4
  const o = new Set(a.account_guids);
5
- return t.accountStore.accounts.filter((e) => o.has(e.guid) && c(e));
5
+ return t.accountStore.accounts.filter((r) => o.has(r.guid) && c(r));
6
6
  }, _ = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type === s.SAVINGS && c(t)), i = { primary: () => ({ action: n }) }, g = {
7
7
  SaveAnExtra100Dollars: i,
8
8
  SaveAnExtra100DollarsV2: i,
9
9
  PaydayCashLeftOverStatus: { primary: () => ({ action: n }) },
10
+ EmergencyFundWithdrawal: { primary: () => ({ action: n }) },
10
11
  LowAccountBalance: { primary: (a) => {
11
- const t = r(a);
12
+ const t = e(a);
12
13
  return t ? {
13
14
  action: n,
14
15
  payload: { account_guid: t.external_guid }
@@ -27,21 +28,21 @@ var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, r = ({ beat: a, st
27
28
  }
28
29
  }) },
29
30
  SavingsOpportunityV2: { primary: (a) => {
30
- const t = r(a);
31
+ const t = e(a);
31
32
  if (!t) return null;
32
- const o = _(a), e = {
33
+ const o = _(a), r = {
33
34
  amount: a.beat.payload?.suggested_savings_amount,
34
35
  source_account_id: t.external_guid
35
36
  };
36
37
  return o.length ? {
37
38
  action: n,
38
39
  payload: {
39
- ...e,
40
+ ...r,
40
41
  destination_account_ids: o.map((u) => u.external_guid)
41
42
  }
42
43
  } : {
43
44
  action: l,
44
- payload: e
45
+ payload: r
45
46
  };
46
47
  } }
47
48
  }, y = (a) => a.cta.metadata ?? g[a.beat.template]?.[a.slot]?.(a) ?? null;
@@ -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 /** \"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 savings account\": only when nothing is designated and there is no savings account to\n * pick from. The other states save the pick through an `action_key` (see `ctaConfig.ts`).\n */\n DesignateEmergencySavingsAccount: {\n primary: ({ beat }) =>\n !beat.payload?.emergency_savings_account_guid && !beat.account_guids.length\n ? { action: BEAT_OPERATION_1 }\n : 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":";;AAkBA,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,GAEa,IAAoF;AAAA,EAC/F,uBAAuB;AAAA,EAEvB,yBAAyB;AAAA,EAGzB,0BAA0B,EACxB,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,EAMA,kCAAkC,EAChC,SAAA,CAAU,EAAE,MAAA,EAAA,MACV,CAAC,EAAK,SAAS,kCAAkC,CAAC,EAAK,cAAc,SACjE,EAAE,QAAQ,EAAiB,IAC3B,KACR;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,EAGA,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"}
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 savings account\": only when nothing is designated and there is no savings account to\n * pick from. The other states save the pick through an `action_key` (see `ctaConfig.ts`).\n */\n DesignateEmergencySavingsAccount: {\n primary: ({ beat }) =>\n !beat.payload?.emergency_savings_account_guid && !beat.account_guids.length\n ? { action: BEAT_OPERATION_1 }\n : 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":";;AAkBA,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,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,EAMA,kCAAkC,EAChC,SAAA,CAAU,EAAE,MAAA,EAAA,MACV,CAAC,EAAK,SAAS,kCAAkC,CAAC,EAAK,cAAc,SACjE,EAAE,QAAQ,EAAiB,IAC3B,KACR;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,EAGA,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"}