@mx-cartographer/experiences 9.7.130 → 9.7.131

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 (24) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +38 -38
  3. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  4. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +2 -0
  5. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +13 -12
  6. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +74 -104
  8. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +14 -0
  10. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +59 -13
  11. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +19 -18
  13. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
  14. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +6 -6
  15. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js +22 -28
  17. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js.map +1 -1
  18. package/dist/insights-v2/components/celebrationGradients.d.ts +15 -1
  19. package/dist/insights-v2/components/celebrationGradients.es.js +16 -7
  20. package/dist/insights-v2/components/celebrationGradients.es.js.map +1 -1
  21. package/dist/insights-v2/components/shared/elevation.d.ts +2 -0
  22. package/dist/insights-v2/components/shared/elevation.es.js +3 -2
  23. package/dist/insights-v2/components/shared/elevation.es.js.map +1 -1
  24. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [9.7.131] - 11-11-2026
2
+
3
+ - **CHANGED** - Insights V2 code follows its own patterns: the Make Transfer drawer's per-variant settings live in its layout, and a stray shadow, a wash and two tile gradients move into the shared elevation and gradient files; no visual or behaviour change (WEC-2259)
4
+
1
5
  ## [9.7.130] - 11-10-2026
2
6
 
3
7
  - **CHANGED** - Insights V2 drops a blank (whitespace-only) payload text value or guid as it already drops an empty one, in the drawers, the Create Budget dialog and the budget analytics event; payload values are read through one shared set of readers (WEC-2259)
@@ -9,34 +9,34 @@ import { useCtaHandler as Z } from "../../ctaActions/useCtaAction.es.js";
9
9
  import { useAnalyticsEvent as oo } from "../../analytics/useAnalyticsEvent.es.js";
10
10
  import { getDynamicCtaBasedOnTriggers as eo } from "../util.es.js";
11
11
  import { CreateBudgetDialog as to } from "./CreateBudgetDialog.es.js";
12
- import { AMOUNT_INPUT_VARIANTS as io, findLowBalanceProfile as no, isAmountInputVariant as x, isWholeAmount as ro, resolveAmountInputVariant as ao, toInputValue as so } from "./layout.es.js";
12
+ import { AMOUNT_INPUT_VARIANTS as io, CREATE_BUDGET_VARIANT as no, findLowBalanceProfile as ro, isAmountInputVariant as x, isWholeAmount as ao, resolveAmountInputVariant as so, toInputValue as co } from "./layout.es.js";
13
13
  import a from "react";
14
- import { observer as k } from "mobx-react-lite";
15
- import V from "@mui/material/Stack";
16
- import { H3 as co, InstitutionLogo as lo, Text as w } from "@mxenabled/mxui";
17
- import { Icon as uo } from "@mxenabled/mx-icons";
14
+ import { observer as V } from "mobx-react-lite";
15
+ import k from "@mui/material/Stack";
16
+ import { H3 as lo, InstitutionLogo as uo, Text as w } from "@mxenabled/mxui";
17
+ import { Icon as mo } from "@mxenabled/mx-icons";
18
18
  import { jsx as o, jsxs as O } from "react/jsx-runtime";
19
- import mo from "@mui/material/Dialog";
20
- import po from "@mui/material/IconButton";
21
- var v = ({ children: y, closeAriaLabel: i, heading: n, onClose: e }) => {
19
+ import po from "@mui/material/Dialog";
20
+ import _o from "@mui/material/IconButton";
21
+ var E = ({ children: y, closeAriaLabel: i, heading: n, onClose: e }) => {
22
22
  const l = a.useId();
23
- return /* @__PURE__ */ o(mo, {
23
+ return /* @__PURE__ */ o(po, {
24
24
  "aria-labelledby": n ? l : void 0,
25
25
  maxWidth: "xs",
26
26
  onClose: e,
27
27
  open: !0,
28
- children: /* @__PURE__ */ O(V, {
28
+ children: /* @__PURE__ */ O(k, {
29
29
  sx: {
30
30
  gap: 12,
31
31
  p: 24,
32
32
  position: "relative"
33
33
  },
34
34
  children: [
35
- n && /* @__PURE__ */ o(co, {
35
+ n && /* @__PURE__ */ o(lo, {
36
36
  id: l,
37
37
  children: n
38
38
  }),
39
- /* @__PURE__ */ o(po, {
39
+ /* @__PURE__ */ o(_o, {
40
40
  "aria-label": i || "Close",
41
41
  onClick: e,
42
42
  sx: {
@@ -44,7 +44,7 @@ var v = ({ children: y, closeAriaLabel: i, heading: n, onClose: e }) => {
44
44
  right: 8,
45
45
  top: 18
46
46
  },
47
- children: /* @__PURE__ */ o(uo, {
47
+ children: /* @__PURE__ */ o(mo, {
48
48
  name: "close",
49
49
  sx: { color: "action.active" }
50
50
  })
@@ -53,79 +53,79 @@ var v = ({ children: y, closeAriaLabel: i, heading: n, onClose: e }) => {
53
53
  ]
54
54
  })
55
55
  });
56
- }, ko = k(function({ beat: i }) {
57
- const { common: n } = H(), { actionDrawer: e, closeActionDrawer: l } = P(), s = q(), { primary_cta: u, secondary_cta: p, in_description_cta: _ } = i.insights_payload ?? {}, [m] = a.useState(() => ao(eo(e, u, p, _))), r = m === "create_budget";
56
+ }, ko = V(function({ beat: i }) {
57
+ const { common: n } = H(), { actionDrawer: e, closeActionDrawer: l } = P(), s = q(), { primary_cta: u, secondary_cta: p, in_description_cta: _ } = i.insights_payload ?? {}, [m] = a.useState(() => so(eo(e, u, p, _))), r = m === no;
58
58
  return a.useEffect(() => {
59
59
  r && !s.categoriesLoaded && s.loadCategories();
60
- }, [s, r]), r ? s.categoriesLoaded ? /* @__PURE__ */ o(to, { beat: i }) : /* @__PURE__ */ o(v, {
60
+ }, [s, r]), r ? s.categoriesLoaded ? /* @__PURE__ */ o(to, { beat: i }) : /* @__PURE__ */ o(E, {
61
61
  closeAriaLabel: n?.close_aria,
62
62
  onClose: l,
63
63
  children: /* @__PURE__ */ o(B, {})
64
- }) : /* @__PURE__ */ o(_o, {
64
+ }) : /* @__PURE__ */ o(fo, {
65
65
  beat: i,
66
66
  variant: m
67
67
  });
68
- }), _o = k(function({ beat: i, variant: n }) {
69
- const { common: e, insights_feed: l } = H(), { closeActionDrawer: s } = P(), u = J(), { userInsightProfile: p } = K(), _ = Z(i, X()), m = oo(), r = l?.amount_input_modal, t = n === io.LOW_BALANCE_THRESHOLD, S = t ? no(u.notificationProfiles, i.primary_account_guid) : void 0, E = t ? S?.threshold : p?.savings_opportunity_minimum_checking_account_balance, [G, R] = a.useState(t), f = a.useRef(!0);
68
+ }), fo = V(function({ beat: i, variant: n }) {
69
+ const { common: e, insights_feed: l } = H(), { closeActionDrawer: s } = P(), u = J(), { userInsightProfile: p } = K(), _ = Z(i, X()), m = oo(), r = l?.amount_input_modal, t = n === io.LOW_BALANCE_THRESHOLD, I = t ? ro(u.notificationProfiles, i.primary_account_guid) : void 0, T = t ? I?.threshold : p?.savings_opportunity_minimum_checking_account_balance, [R, G] = a.useState(t), f = a.useRef(!0);
70
70
  a.useEffect(() => (f.current = !0, () => {
71
71
  f.current = !1;
72
72
  }), []), a.useEffect(() => {
73
73
  t && u.loadNotificationProfiles().finally(() => {
74
- f.current && R(!1);
74
+ f.current && G(!1);
75
75
  });
76
76
  }, [t, u]);
77
- const [F, M] = a.useState(null), [T, C] = a.useState(!1), [U, I] = a.useState(!1), g = F ?? so(E);
78
- if (G) return /* @__PURE__ */ o(v, {
77
+ const [F, M] = a.useState(null), [v, C] = a.useState(!1), [U, S] = a.useState(!1), g = F ?? co(T);
78
+ if (R) return /* @__PURE__ */ o(E, {
79
79
  closeAriaLabel: e?.close_aria,
80
80
  onClose: s,
81
81
  children: /* @__PURE__ */ o(B, {})
82
82
  });
83
83
  const c = x(n) ? r?.[n] : void 0, D = !!c?.title && !!c.description && !!c.input_label && !!r?.whole_number_error && !!r.save_error && !!e?.save_button && (!t || !!e.cancel_button) && !!e.close_aria;
84
- if (!r || !c || !D || !(t ? S : p))
85
- return console.warn(`amount_input_modal_block: ${r ? x(n) ? D ? t ? "no low-balance profile for the account" : "user insight profile not set by the host" : `copy incomplete for "${n}"` : `unknown variant "${n}"` : "copy namespace missing"}`), /* @__PURE__ */ o(v, {
84
+ if (!r || !c || !D || !(t ? I : p))
85
+ return console.warn(`amount_input_modal_block: ${r ? x(n) ? D ? t ? "no low-balance profile for the account" : "user insight profile not set by the host" : `copy incomplete for "${n}"` : `unknown variant "${n}"` : "copy namespace missing"}`), /* @__PURE__ */ o(E, {
86
86
  closeAriaLabel: e?.close_aria,
87
87
  heading: e?.error_heading,
88
88
  onClose: s,
89
89
  children: /* @__PURE__ */ o(w, { children: e?.error_message })
90
90
  });
91
- const b = () => {
91
+ const L = () => {
92
92
  m(t ? d.EDIT_INSIGHT_THRESHOLD_CANCELED : d.EDIT_SAFETY_NET_CANCEL), s();
93
- }, L = !t && !!E, N = i.primary_account ? z(i.primary_account) : "", A = ro(g), $ = g !== "" && !A, W = async () => {
94
- if (!A || T) return;
93
+ }, b = !t && !!T, N = i.primary_account ? z(i.primary_account) : "", A = ao(g), $ = g !== "" && !A, W = async () => {
94
+ if (!A || v) return;
95
95
  const h = Number(g);
96
- C(!0), I(!1);
96
+ C(!0), S(!1);
97
97
  const Y = t ? await _("updateNotificationProfileThreshold", {
98
- profileGuid: S?.guid,
98
+ profileGuid: I?.guid,
99
99
  threshold: h
100
100
  }, { analytics: d.EDIT_INSIGHT_THRESHOLD_SAVE }) : await _("updateUserInsightProfile", { fields: { savings_opportunity_minimum_checking_account_balance: h } }, { analytics: d.EDIT_SAFETY_NET_SAVE });
101
- f.current && (C(!1), Y ? s() : I(!0));
101
+ f.current && (C(!1), Y ? s() : S(!0));
102
102
  };
103
103
  return /* @__PURE__ */ o(Q, {
104
104
  closeAriaLabel: e.close_aria,
105
- content: j(L && c.description_edit || c.description, /* @__PURE__ */ o("strong", { children: N }, "account")),
105
+ content: j(b && c.description_edit || c.description, /* @__PURE__ */ o("strong", { children: N }, "account")),
106
106
  errorText: $ ? r.whole_number_error : U ? r.save_error : void 0,
107
107
  handleInputChange: (h) => {
108
- M(h), I(!1);
108
+ M(h), S(!1);
109
109
  },
110
110
  handleInputClick: t ? () => m(d.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED) : void 0,
111
- handleModalClose: b,
111
+ handleModalClose: L,
112
112
  handlePrimaryAction: () => {
113
113
  W();
114
114
  },
115
- handleSecondaryAction: b,
115
+ handleSecondaryAction: L,
116
116
  inputLabel: c.input_label,
117
117
  inputValue: g,
118
118
  isOpen: !0,
119
- isPrimaryDisabled: T || !A,
119
+ isPrimaryDisabled: v || !A,
120
120
  primaryText: e.save_button,
121
121
  secondaryText: t ? e.cancel_button : void 0,
122
- subtitle: t && i.primary_account ? /* @__PURE__ */ O(V, {
122
+ subtitle: t && i.primary_account ? /* @__PURE__ */ O(k, {
123
123
  sx: {
124
124
  alignItems: "center",
125
125
  flexDirection: "row",
126
126
  gap: 8
127
127
  },
128
- children: [/* @__PURE__ */ o(lo, {
128
+ children: [/* @__PURE__ */ o(uo, {
129
129
  alt: "",
130
130
  institutionGuid: i.primary_account.institution_guid ?? "",
131
131
  size: 16
@@ -136,7 +136,7 @@ var v = ({ children: y, closeAriaLabel: i, heading: n, onClose: e }) => {
136
136
  children: N
137
137
  })]
138
138
  }) : void 0,
139
- title: L && c.title_edit || c.title
139
+ title: b && c.title_edit || c.title
140
140
  });
141
141
  });
142
142
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"AmountInputModalBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport MuiDialog from '@mui/material/Dialog'\nimport IconButton from '@mui/material/IconButton'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n CurrencyDialog,\n Loader,\n buildDynamicCopy,\n useCategoryStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useSettingsStore,\n useUserStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { useBeatActions } from '../../beatActions'\nimport { useCtaHandler } from '../../ctaActions'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\nimport { CreateBudgetDialog } from './CreateBudgetDialog'\nimport {\n AMOUNT_INPUT_VARIANTS,\n findLowBalanceProfile,\n isAmountInputVariant,\n isWholeAmount,\n resolveAmountInputVariant,\n toInputValue,\n} from './layout'\n\n/** Dialog frame for the formless states: loading and a non-retriable problem. */\nconst StatusDialog = ({\n children,\n closeAriaLabel,\n heading,\n onClose,\n}: React.PropsWithChildren<{ closeAriaLabel?: string; heading?: string; onClose: () => void }>) => {\n const headingId = React.useId()\n\n return (\n <MuiDialog\n aria-labelledby={heading ? headingId : undefined}\n maxWidth=\"xs\"\n onClose={onClose}\n open={true}\n >\n <Stack sx={{ gap: 12, p: 24, position: 'relative' }}>\n {heading && <H3 id={headingId}>{heading}</H3>}\n <IconButton\n aria-label={closeAriaLabel || 'Close'}\n onClick={onClose}\n sx={{ position: 'absolute', right: 8, top: 18 }}\n >\n <Icon name=\"close\" sx={{ color: 'action.active' }} />\n </IconButton>\n {children}\n </Stack>\n </MuiDialog>\n )\n}\n\n/** `amount_input_modal_block`: one whole-dollar amount in a modal, picked by the CTA variant. */\nexport const AmountInputModalBlock = observer(function AmountInputModalBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const categoryStore = useCategoryStore()\n const { primary_cta, secondary_cta, in_description_cta } = beat.insights_payload ?? {}\n // Read once on open: a refreshed beat must not swap the dialog under its snackbar.\n const [variant] = React.useState(() =>\n resolveAmountInputVariant(\n getDynamicCtaBasedOnTriggers(actionDrawer, primary_cta, secondary_cta, in_description_cta),\n ),\n )\n const isCreateBudget = variant === 'create_budget'\n\n // The create dialog names the category, so it waits for the category store.\n React.useEffect(() => {\n if (isCreateBudget && !categoryStore.categoriesLoaded) void categoryStore.loadCategories()\n }, [categoryStore, isCreateBudget])\n\n if (!isCreateBudget) return <AmountSettingDialog beat={beat} variant={variant} />\n\n return categoryStore.categoriesLoaded ? (\n <CreateBudgetDialog beat={beat} />\n ) : (\n <StatusDialog closeAriaLabel={commonCopy?.close_aria} onClose={closeActionDrawer}>\n <Loader />\n </StatusDialog>\n )\n})\n\n/** The low-balance threshold and safety-net settings (the two `AMOUNT_INPUT_VARIANTS`). */\nconst AmountSettingDialog = observer(function AmountSettingDialog({\n beat,\n variant,\n}: ActionBlockProps & { variant?: string }) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { closeActionDrawer } = useInsightsV2Store()\n const settingsStore = useSettingsStore()\n const { userInsightProfile } = useUserStore()\n const runHandler = useCtaHandler(beat, useBeatActions())\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n const copy = insightsFeedCopy?.amount_input_modal\n const isLowBalance = variant === AMOUNT_INPUT_VARIANTS.LOW_BALANCE_THRESHOLD\n\n const lowBalanceProfile = isLowBalance\n ? findLowBalanceProfile(settingsStore.notificationProfiles, beat.primary_account_guid)\n : undefined\n const savedAmount = isLowBalance\n ? lowBalanceProfile?.threshold\n : userInsightProfile?.savings_opportunity_minimum_checking_account_balance\n\n // Mounting is the open, so profiles reload here and the threshold prefills as saved now.\n const [isLoadingProfiles, setIsLoadingProfiles] = React.useState(isLowBalance)\n // False once unmounted: a save that resolves after the user closed the dialog must not close\n // (or update) whatever action session is open by then.\n const isMounted = React.useRef(true)\n\n React.useEffect(() => {\n isMounted.current = true\n\n return () => {\n isMounted.current = false\n }\n }, [])\n\n React.useEffect(() => {\n if (!isLowBalance) return\n\n void settingsStore.loadNotificationProfiles().finally(() => {\n if (isMounted.current) setIsLoadingProfiles(false)\n })\n }, [isLowBalance, settingsStore])\n\n // `null` until the user types: the field shows the saved amount until then.\n const [typed, setTyped] = React.useState<string | null>(null)\n const [isSaving, setIsSaving] = React.useState(false)\n const [saveFailed, setSaveFailed] = React.useState(false)\n\n const value = typed ?? toInputValue(savedAmount)\n\n if (isLoadingProfiles) {\n return (\n <StatusDialog closeAriaLabel={commonCopy?.close_aria} onClose={closeActionDrawer}>\n <Loader />\n </StatusDialog>\n )\n }\n\n // Copy ships separately (see the doc's Rollout order), so check every string the form renders:\n // a partial ship falls to the error dialog instead of throwing mid-render.\n const variantCopy = isAmountInputVariant(variant) ? copy?.[variant] : undefined\n const hasCopy =\n !!variantCopy?.title &&\n !!variantCopy.description &&\n !!variantCopy.input_label &&\n !!copy?.whole_number_error &&\n !!copy.save_error &&\n !!commonCopy?.save_button &&\n // Cancel renders for the low-balance variant only.\n (!isLowBalance || !!commonCopy.cancel_button) &&\n !!commonCopy.close_aria\n const hasProfile = isLowBalance ? !!lowBalanceProfile : !!userInsightProfile\n\n if (!copy || !variantCopy || !hasCopy || !hasProfile) {\n // One message to the user; distinct warnings so a rollout problem can be traced to its cause.\n console.warn(\n `amount_input_modal_block: ${\n !copy\n ? 'copy namespace missing'\n : !isAmountInputVariant(variant)\n ? `unknown variant \"${variant}\"`\n : !hasCopy\n ? `copy incomplete for \"${variant}\"`\n : isLowBalance\n ? 'no low-balance profile for the account'\n : 'user insight profile not set by the host'\n }`,\n )\n\n return (\n <StatusDialog\n closeAriaLabel={commonCopy?.close_aria}\n heading={commonCopy?.error_heading}\n onClose={closeActionDrawer}\n >\n <Text>{commonCopy?.error_message}</Text>\n </StatusDialog>\n )\n }\n\n // Trigger 4 — user dismissed without saving (close icon, Cancel button, backdrop). Pulse\n // parity: EditThreshold.js close button / EditSafetyNet.js cancel button.\n const handleDismiss = () => {\n fireAnalyticsEvent(\n isLowBalance\n ? ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_CANCELED\n : ANALYTICS_EVENTS_CONFIG.EDIT_SAFETY_NET_CANCEL,\n )\n closeActionDrawer()\n }\n\n const isEdit = !isLowBalance && !!savedAmount\n const accountName = beat.primary_account ? getAccountDisplayName(beat.primary_account) : ''\n const isValid = isWholeAmount(value)\n const isInvalid = value !== '' && !isValid\n\n const handleSave = async () => {\n // Guarded here too, not only by the disabled button: Enter submits the dialog's form directly.\n if (!isValid || isSaving) return\n\n const amount = Number(value)\n\n setIsSaving(true)\n setSaveFailed(false)\n\n // Trigger 2: save analytics ride the handler run, fired only on success.\n const ok = isLowBalance\n ? await runHandler(\n 'updateNotificationProfileThreshold',\n { profileGuid: lowBalanceProfile?.guid, threshold: amount },\n { analytics: ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_SAVE },\n )\n : await runHandler(\n 'updateUserInsightProfile',\n { fields: { savings_opportunity_minimum_checking_account_balance: amount } },\n { analytics: ANALYTICS_EVENTS_CONFIG.EDIT_SAFETY_NET_SAVE },\n )\n\n if (!isMounted.current) return\n\n setIsSaving(false)\n\n if (ok) closeActionDrawer()\n else setSaveFailed(true)\n }\n\n return (\n <CurrencyDialog\n closeAriaLabel={commonCopy.close_aria}\n // Only strings and the <strong> go in, so the result is renderable (the helper's type also\n // admits raw DOM nodes).\n content={\n buildDynamicCopy(\n (isEdit && variantCopy.description_edit) || variantCopy.description,\n <strong key=\"account\">{accountName}</strong>,\n ) as React.ReactNode\n }\n errorText={isInvalid ? copy.whole_number_error : saveFailed ? copy.save_error : undefined}\n handleInputChange={(next) => {\n setTyped(next)\n setSaveFailed(false)\n }}\n handleInputClick={\n // Pulse fires input-selected for the threshold dialog only (EditThreshold.js); the\n // safety-net dialog has no input event.\n isLowBalance\n ? () => fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED)\n : undefined\n }\n handleModalClose={handleDismiss}\n handlePrimaryAction={() => void handleSave()}\n handleSecondaryAction={handleDismiss}\n inputLabel={variantCopy.input_label}\n inputValue={value}\n isOpen={true}\n isPrimaryDisabled={isSaving || !isValid}\n primaryText={commonCopy.save_button}\n secondaryText={isLowBalance ? commonCopy.cancel_button : undefined}\n subtitle={\n isLowBalance && beat.primary_account ? (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {/* Decorative: the account name is the visible text beside it. */}\n <InstitutionLogo\n alt=\"\"\n institutionGuid={beat.primary_account.institution_guid ?? ''}\n size={16}\n />\n <Text color=\"text.secondary\" uppercase={true} variant=\"body2\">\n {accountName}\n </Text>\n </Stack>\n ) : undefined\n }\n title={(isEdit && variantCopy.title_edit) || variantCopy.title}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAA,CAAgB,EACpB,UAAA,GACA,gBAAA,GACA,SAAA,GACA,SAAA,EAAA,MACiG;AACjG,QAAM,IAAY,EAAM,MAAM;AAE9B,SACE,gBAAA,EAAC,IAAD;AAAA,IACE,mBAAiB,IAAU,IAAY;AAAA,IACvC,UAAS;AAAA,IACA,SAAA;AAAA,IACT,MAAM;AAAA,IAEN,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,KAAK;AAAA,QAAI,GAAG;AAAA,QAAI,UAAU;AAAA,MAAW;AAAA,MAAlD,UAAA;AAAA,QACG,KAAW,gBA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gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,EAAW;AAAA,IAG3B,SACE,EACG,KAAU,EAAY,oBAAqB,EAAY,aACxD,gBAAA,EAAC,UAAD,EAAA,UAAuB,EAAoB,GAA/B,SAA+B,CAC7C;AAAA,IAEF,WAAW,IAAY,EAAK,qBAAqB,IAAa,EAAK,aAAa;AAAA,IAChF,mBAAA,CAAoB,MAAS;AAC3B,MAAA,EAAS,CAAI,GACb,EAAc,EAAK;AAAA,IACrB;AAAA,IACA,kBAGE,IAAA,MACU,EAAmB,EAAwB,qCAAqC,IACtF;AAAA,IAEN,kBAAkB;AAAA,IAClB,qBAAA,MAAA;AAA2B,MAAK,EAAW;AAAA;AAAA,IAC3C,uBAAuB;AAAA,IACvB,YAAY,EAAY;AAAA,IACxB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,mBAAmB,KAAY,CAAC;AAAA,IAChC,aAAa,EAAW;AAAA,IACxB,eAAe,IAAe,EAAW,gBAAgB;AAAA,IACzD,UACE,KAAgB,EAAK,kBACnB,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAU,eAAe;AAAA,QAAO,KAAK;AAAA,MAAE;AAAA,MAAhE,UAAA,CAEE,gBAAA,EAAC,IAAD;AAAA,QACE,KAAI;AAAA,QACJ,iBAAiB,EAAK,gBAAgB,oBAAoB;AAAA,QAC1D,MAAM;AAAA,MACP,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,WAAW;AAAA,QAAM,SAAQ;AAAA,QACnD,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACL,CAAA,IAAA;AAAA,IAEN,OAAQ,KAAU,EAAY,cAAe,EAAY;AAAA,EAC1D,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"AmountInputModalBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport MuiDialog from '@mui/material/Dialog'\nimport IconButton from '@mui/material/IconButton'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n CurrencyDialog,\n Loader,\n buildDynamicCopy,\n useCategoryStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useSettingsStore,\n useUserStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { useBeatActions } from '../../beatActions'\nimport { useCtaHandler } from '../../ctaActions'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\nimport { CreateBudgetDialog } from './CreateBudgetDialog'\nimport {\n AMOUNT_INPUT_VARIANTS,\n CREATE_BUDGET_VARIANT,\n findLowBalanceProfile,\n isAmountInputVariant,\n isWholeAmount,\n resolveAmountInputVariant,\n toInputValue,\n} from './layout'\n\n/** Dialog frame for the formless states: loading and a non-retriable problem. */\nconst StatusDialog = ({\n children,\n closeAriaLabel,\n heading,\n onClose,\n}: React.PropsWithChildren<{ closeAriaLabel?: string; heading?: string; onClose: () => void }>) => {\n const headingId = React.useId()\n\n return (\n <MuiDialog\n aria-labelledby={heading ? headingId : undefined}\n maxWidth=\"xs\"\n onClose={onClose}\n open={true}\n >\n <Stack sx={{ gap: 12, p: 24, position: 'relative' }}>\n {heading && <H3 id={headingId}>{heading}</H3>}\n <IconButton\n aria-label={closeAriaLabel || 'Close'}\n onClick={onClose}\n sx={{ position: 'absolute', right: 8, top: 18 }}\n >\n <Icon name=\"close\" sx={{ color: 'action.active' }} />\n </IconButton>\n {children}\n </Stack>\n </MuiDialog>\n )\n}\n\n/** `amount_input_modal_block`: one whole-dollar amount in a modal, picked by the CTA variant. */\nexport const AmountInputModalBlock = observer(function AmountInputModalBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const categoryStore = useCategoryStore()\n const { primary_cta, secondary_cta, in_description_cta } = beat.insights_payload ?? {}\n // Read once on open: a refreshed beat must not swap the dialog under its snackbar.\n const [variant] = React.useState(() =>\n resolveAmountInputVariant(\n getDynamicCtaBasedOnTriggers(actionDrawer, primary_cta, secondary_cta, in_description_cta),\n ),\n )\n const isCreateBudget = variant === CREATE_BUDGET_VARIANT\n\n // The create dialog names the category, so it waits for the category store.\n React.useEffect(() => {\n if (isCreateBudget && !categoryStore.categoriesLoaded) void categoryStore.loadCategories()\n }, [categoryStore, isCreateBudget])\n\n if (!isCreateBudget) return <AmountSettingDialog beat={beat} variant={variant} />\n\n return categoryStore.categoriesLoaded ? (\n <CreateBudgetDialog beat={beat} />\n ) : (\n <StatusDialog closeAriaLabel={commonCopy?.close_aria} onClose={closeActionDrawer}>\n <Loader />\n </StatusDialog>\n )\n})\n\n/** The low-balance threshold and safety-net settings (the two `AMOUNT_INPUT_VARIANTS`). */\nconst AmountSettingDialog = observer(function AmountSettingDialog({\n beat,\n variant,\n}: ActionBlockProps & { variant?: string }) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { closeActionDrawer } = useInsightsV2Store()\n const settingsStore = useSettingsStore()\n const { userInsightProfile } = useUserStore()\n const runHandler = useCtaHandler(beat, useBeatActions())\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n const copy = insightsFeedCopy?.amount_input_modal\n const isLowBalance = variant === AMOUNT_INPUT_VARIANTS.LOW_BALANCE_THRESHOLD\n\n const lowBalanceProfile = isLowBalance\n ? findLowBalanceProfile(settingsStore.notificationProfiles, beat.primary_account_guid)\n : undefined\n const savedAmount = isLowBalance\n ? lowBalanceProfile?.threshold\n : userInsightProfile?.savings_opportunity_minimum_checking_account_balance\n\n // Mounting is the open, so profiles reload here and the threshold prefills as saved now.\n const [isLoadingProfiles, setIsLoadingProfiles] = React.useState(isLowBalance)\n // False once unmounted: a save that resolves after the user closed the dialog must not close\n // (or update) whatever action session is open by then.\n const isMounted = React.useRef(true)\n\n React.useEffect(() => {\n isMounted.current = true\n\n return () => {\n isMounted.current = false\n }\n }, [])\n\n React.useEffect(() => {\n if (!isLowBalance) return\n\n void settingsStore.loadNotificationProfiles().finally(() => {\n if (isMounted.current) setIsLoadingProfiles(false)\n })\n }, [isLowBalance, settingsStore])\n\n // `null` until the user types: the field shows the saved amount until then.\n const [typed, setTyped] = React.useState<string | null>(null)\n const [isSaving, setIsSaving] = React.useState(false)\n const [saveFailed, setSaveFailed] = React.useState(false)\n\n const value = typed ?? toInputValue(savedAmount)\n\n if (isLoadingProfiles) {\n return (\n <StatusDialog closeAriaLabel={commonCopy?.close_aria} onClose={closeActionDrawer}>\n <Loader />\n </StatusDialog>\n )\n }\n\n // Copy ships separately (see the doc's Rollout order), so check every string the form renders:\n // a partial ship falls to the error dialog instead of throwing mid-render.\n const variantCopy = isAmountInputVariant(variant) ? copy?.[variant] : undefined\n const hasCopy =\n !!variantCopy?.title &&\n !!variantCopy.description &&\n !!variantCopy.input_label &&\n !!copy?.whole_number_error &&\n !!copy.save_error &&\n !!commonCopy?.save_button &&\n // Cancel renders for the low-balance variant only.\n (!isLowBalance || !!commonCopy.cancel_button) &&\n !!commonCopy.close_aria\n const hasProfile = isLowBalance ? !!lowBalanceProfile : !!userInsightProfile\n\n if (!copy || !variantCopy || !hasCopy || !hasProfile) {\n // One message to the user; distinct warnings so a rollout problem can be traced to its cause.\n console.warn(\n `amount_input_modal_block: ${\n !copy\n ? 'copy namespace missing'\n : !isAmountInputVariant(variant)\n ? `unknown variant \"${variant}\"`\n : !hasCopy\n ? `copy incomplete for \"${variant}\"`\n : isLowBalance\n ? 'no low-balance profile for the account'\n : 'user insight profile not set by the host'\n }`,\n )\n\n return (\n <StatusDialog\n closeAriaLabel={commonCopy?.close_aria}\n heading={commonCopy?.error_heading}\n onClose={closeActionDrawer}\n >\n <Text>{commonCopy?.error_message}</Text>\n </StatusDialog>\n )\n }\n\n // Trigger 4 — user dismissed without saving (close icon, Cancel button, backdrop). Pulse\n // parity: EditThreshold.js close button / EditSafetyNet.js cancel button.\n const handleDismiss = () => {\n fireAnalyticsEvent(\n isLowBalance\n ? ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_CANCELED\n : ANALYTICS_EVENTS_CONFIG.EDIT_SAFETY_NET_CANCEL,\n )\n closeActionDrawer()\n }\n\n const isEdit = !isLowBalance && !!savedAmount\n const accountName = beat.primary_account ? getAccountDisplayName(beat.primary_account) : ''\n const isValid = isWholeAmount(value)\n const isInvalid = value !== '' && !isValid\n\n const handleSave = async () => {\n // Guarded here too, not only by the disabled button: Enter submits the dialog's form directly.\n if (!isValid || isSaving) return\n\n const amount = Number(value)\n\n setIsSaving(true)\n setSaveFailed(false)\n\n // Trigger 2: save analytics ride the handler run, fired only on success.\n const ok = isLowBalance\n ? await runHandler(\n 'updateNotificationProfileThreshold',\n { profileGuid: lowBalanceProfile?.guid, threshold: amount },\n { analytics: ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_SAVE },\n )\n : await runHandler(\n 'updateUserInsightProfile',\n { fields: { savings_opportunity_minimum_checking_account_balance: amount } },\n { analytics: ANALYTICS_EVENTS_CONFIG.EDIT_SAFETY_NET_SAVE },\n )\n\n if (!isMounted.current) return\n\n setIsSaving(false)\n\n if (ok) closeActionDrawer()\n else setSaveFailed(true)\n }\n\n return (\n <CurrencyDialog\n closeAriaLabel={commonCopy.close_aria}\n // Only strings and the <strong> go in, so the result is renderable (the helper's type also\n // admits raw DOM nodes).\n content={\n buildDynamicCopy(\n (isEdit && variantCopy.description_edit) || variantCopy.description,\n <strong key=\"account\">{accountName}</strong>,\n ) as React.ReactNode\n }\n errorText={isInvalid ? copy.whole_number_error : saveFailed ? copy.save_error : undefined}\n handleInputChange={(next) => {\n setTyped(next)\n setSaveFailed(false)\n }}\n handleInputClick={\n // Pulse fires input-selected for the threshold dialog only (EditThreshold.js); the\n // safety-net dialog has no input event.\n isLowBalance\n ? () => fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED)\n : undefined\n }\n handleModalClose={handleDismiss}\n handlePrimaryAction={() => void handleSave()}\n handleSecondaryAction={handleDismiss}\n inputLabel={variantCopy.input_label}\n inputValue={value}\n isOpen={true}\n isPrimaryDisabled={isSaving || !isValid}\n primaryText={commonCopy.save_button}\n secondaryText={isLowBalance ? commonCopy.cancel_button : undefined}\n subtitle={\n isLowBalance && beat.primary_account ? (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {/* Decorative: the account name is the visible text beside it. */}\n <InstitutionLogo\n alt=\"\"\n institutionGuid={beat.primary_account.institution_guid ?? ''}\n size={16}\n />\n <Text color=\"text.secondary\" uppercase={true} variant=\"body2\">\n {accountName}\n </Text>\n </Stack>\n ) : undefined\n }\n title={(isEdit && variantCopy.title_edit) || variantCopy.title}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,IAAA,CAAgB,EACpB,UAAA,GACA,gBAAA,GACA,SAAA,GACA,SAAA,EAAA,MACiG;AACjG,QAAM,IAAY,EAAM,MAAM;AAE9B,SACE,gBAAA,EAAC,IAAD;AAAA,IACE,mBAAiB,IAAU,IAAY;AAAA,IACvC,UAAS;AAAA,IACA,SAAA;AAAA,IACT,MAAM;AAAA,IAEN,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,KAAK;AAAA,QAAI,GAAG;AAAA,QAAI,UAAU;AAAA,MAAW;AAAA,MAAlD,UAAA;AAAA,QACG,KAAW,gBAAA,EAAC,IAAD;AAAA,UAAI,IAAI;AAAA,UAAY,UAAA;AAAA,QAAY,CAAA;AAAA,QAC5C,gBAAA,EAAC,IAAD;AAAA,UACE,cAAY,KAAk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,UAAuB,EAAoB,GAA/B,SAA+B,CAC7C;AAAA,IAEF,WAAW,IAAY,EAAK,qBAAqB,IAAa,EAAK,aAAa;AAAA,IAChF,mBAAA,CAAoB,MAAS;AAC3B,MAAA,EAAS,CAAI,GACb,EAAc,EAAK;AAAA,IACrB;AAAA,IACA,kBAGE,IAAA,MACU,EAAmB,EAAwB,qCAAqC,IACtF;AAAA,IAEN,kBAAkB;AAAA,IAClB,qBAAA,MAAA;AAA2B,MAAK,EAAW;AAAA;AAAA,IAC3C,uBAAuB;AAAA,IACvB,YAAY,EAAY;AAAA,IACxB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,mBAAmB,KAAY,CAAC;AAAA,IAChC,aAAa,EAAW;AAAA,IACxB,eAAe,IAAe,EAAW,gBAAgB;AAAA,IACzD,UACE,KAAgB,EAAK,kBACnB,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAU,eAAe;AAAA,QAAO,KAAK;AAAA,MAAE;AAAA,MAAhE,UAAA,CAEE,gBAAA,EAAC,IAAD;AAAA,QACE,KAAI;AAAA,QACJ,iBAAiB,EAAK,gBAAgB,oBAAoB;AAAA,QAC1D,MAAM;AAAA,MACP,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,WAAW;AAAA,QAAM,SAAQ;AAAA,QACnD,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACL,CAAA,IAAA;AAAA,IAEN,OAAQ,KAAU,EAAY,cAAe,EAAY;AAAA,EAC1D,CAAA;AAEL,CAAC"}
@@ -4,6 +4,8 @@ export declare const AMOUNT_INPUT_VARIANTS: {
4
4
  readonly LOW_BALANCE_THRESHOLD: "low_balance_threshold";
5
5
  readonly SAFETY_NET: "safety_net";
6
6
  };
7
+ /** Opens the Create Budget dialog instead of an amount setting (Category Spending). */
8
+ export declare const CREATE_BUDGET_VARIANT = "create_budget";
7
9
  export type AmountInputVariant = (typeof AMOUNT_INPUT_VARIANTS)[keyof typeof AMOUNT_INPUT_VARIANTS];
8
10
  export declare const isAmountInputVariant: (variant?: string | null) => variant is AmountInputVariant;
9
11
  /**
@@ -1,19 +1,20 @@
1
- import { AccountNotificationTypes as i } from "../../../core/types/Notification.es.js";
2
- import { actionBlocksKey as a } from "../../mappings/actionBlocksKey.es.js";
3
- var o = {
1
+ import { AccountNotificationTypes as a } from "../../../core/types/Notification.es.js";
2
+ import { actionBlocksKey as o } from "../../mappings/actionBlocksKey.es.js";
3
+ var e = {
4
4
  LOW_BALANCE_THRESHOLD: "low_balance_threshold",
5
5
  SAFETY_NET: "safety_net"
6
- }, T = (t) => Object.values(o).includes(t ?? ""), u = (t) => {
6
+ }, T = "create_budget", u = (t) => Object.values(e).includes(t ?? ""), N = (t) => {
7
7
  if (t?.variant) return t.variant;
8
- if (t?.block === a.SAFETY_NET_ACTION_BLOCK) return o.SAFETY_NET;
9
- }, e = 1e9, N = (t) => /^\d+$/.test(t) && Number(t) >= 1 && Number(t) <= e, c = (t) => t ? String(Math.round(t)) : "", l = (t, n) => n ? t.find((r) => r.entity_guid === n && r.notification_type === i.AccountBalanceLow) : void 0;
8
+ if (t?.block === o.SAFETY_NET_ACTION_BLOCK) return e.SAFETY_NET;
9
+ }, i = 1e9, c = (t) => /^\d+$/.test(t) && Number(t) >= 1 && Number(t) <= i, v = (t) => t ? String(Math.round(t)) : "", E = (t, r) => r ? t.find((n) => n.entity_guid === r && n.notification_type === a.AccountBalanceLow) : void 0;
10
10
  export {
11
- o as AMOUNT_INPUT_VARIANTS,
12
- l as findLowBalanceProfile,
13
- T as isAmountInputVariant,
14
- N as isWholeAmount,
15
- u as resolveAmountInputVariant,
16
- c as toInputValue
11
+ e as AMOUNT_INPUT_VARIANTS,
12
+ T as CREATE_BUDGET_VARIANT,
13
+ E as findLowBalanceProfile,
14
+ u as isAmountInputVariant,
15
+ c as isWholeAmount,
16
+ N as resolveAmountInputVariant,
17
+ v as toInputValue
17
18
  };
18
19
 
19
20
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/layout.ts"],"sourcesContent":["import type { NotificationProfile } from '../../../core'\nimport { AccountNotificationTypes } from '../../../core/types/Notification'\nimport { actionBlocksKey } from '../../mappings/actionBlocksKey'\n\n/** CTA variants `amount_input_modal_block` serves (ditto sets one on the beat's CTA). */\nexport const AMOUNT_INPUT_VARIANTS = {\n LOW_BALANCE_THRESHOLD: 'low_balance_threshold',\n SAFETY_NET: 'safety_net',\n} as const\n\nexport type AmountInputVariant = (typeof AMOUNT_INPUT_VARIANTS)[keyof typeof AMOUNT_INPUT_VARIANTS]\n\nexport const isAmountInputVariant = (variant?: string | null): variant is AmountInputVariant =>\n Object.values<string>(AMOUNT_INPUT_VARIANTS).includes(variant ?? '')\n\n/**\n * The variant the modal edits, from the CTA that opened it. ditto drives the shared\n * `amount_input_modal_block` by an explicit CTA variant, but gives Savings Opportunity's safety-net\n * reminder a dedicated `safety_net_block` with no variant, so there the block name selects it. An\n * explicit variant always wins (so an unknown one still falls to the block's \"unknown variant\" path).\n */\nexport const resolveAmountInputVariant = (cta?: {\n block?: string | null\n variant?: string | null\n}): string | undefined => {\n if (cta?.variant) return cta.variant\n if (cta?.block === actionBlocksKey.SAFETY_NET_ACTION_BLOCK)\n return AMOUNT_INPUT_VARIANTS.SAFETY_NET\n return undefined\n}\n\n/** Pulse v1's upper bound for a safety net; applied to both variants. */\nconst MAX_AMOUNT = 1_000_000_000\n\n/** Whole dollars from 1 to `MAX_AMOUNT`, as pulse v1 accepted for both settings. */\nexport const isWholeAmount = (value: string): boolean =>\n /^\\d+$/.test(value) && Number(value) >= 1 && Number(value) <= MAX_AMOUNT\n\n/** A saved amount as the field's starting text; nothing saved (or zero) starts empty. */\nexport const toInputValue = (amount?: number | null): string =>\n amount ? String(Math.round(amount)) : ''\n\n/** The account's low-balance alert profile, which holds the threshold (as pulse v1 looked it up). */\nexport const findLowBalanceProfile = (\n profiles: NotificationProfile[],\n accountGuid?: string | null,\n): NotificationProfile | undefined =>\n accountGuid\n ? profiles.find(\n (profile) =>\n profile.entity_guid === accountGuid &&\n profile.notification_type === AccountNotificationTypes.AccountBalanceLow,\n )\n : undefined\n"],"mappings":";;AAKA,IAAa,IAAwB;AAAA,EACnC,uBAAuB;AAAA,EACvB,YAAY;AACd,GAIa,IAAA,CAAwB,MACnC,OAAO,OAAe,CAAqB,EAAE,SAAS,KAAW,EAAE,GAQxD,IAAA,CAA6B,MAGhB;AACxB,MAAI,GAAK,QAAS,QAAO,EAAI;AAC7B,MAAI,GAAK,UAAU,EAAgB,wBACjC,QAAO,EAAsB;AAEjC,GAGM,IAAa,KAGN,IAAA,CAAiB,MAC5B,QAAQ,KAAK,CAAK,KAAK,OAAO,CAAK,KAAK,KAAK,OAAO,CAAK,KAAK,GAGnD,IAAA,CAAgB,MAC3B,IAAS,OAAO,KAAK,MAAM,CAAM,CAAC,IAAI,IAG3B,IAAA,CACX,GACA,MAEA,IACI,EAAS,KAAA,CACN,MACC,EAAQ,gBAAgB,KACxB,EAAQ,sBAAsB,EAAyB,iBAC3D,IACA"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/layout.ts"],"sourcesContent":["import type { NotificationProfile } from '../../../core'\nimport { AccountNotificationTypes } from '../../../core/types/Notification'\nimport { actionBlocksKey } from '../../mappings/actionBlocksKey'\n\n/** CTA variants `amount_input_modal_block` serves (ditto sets one on the beat's CTA). */\nexport const AMOUNT_INPUT_VARIANTS = {\n LOW_BALANCE_THRESHOLD: 'low_balance_threshold',\n SAFETY_NET: 'safety_net',\n} as const\n\n/** Opens the Create Budget dialog instead of an amount setting (Category Spending). */\nexport const CREATE_BUDGET_VARIANT = 'create_budget'\n\nexport type AmountInputVariant = (typeof AMOUNT_INPUT_VARIANTS)[keyof typeof AMOUNT_INPUT_VARIANTS]\n\nexport const isAmountInputVariant = (variant?: string | null): variant is AmountInputVariant =>\n Object.values<string>(AMOUNT_INPUT_VARIANTS).includes(variant ?? '')\n\n/**\n * The variant the modal edits, from the CTA that opened it. ditto drives the shared\n * `amount_input_modal_block` by an explicit CTA variant, but gives Savings Opportunity's safety-net\n * reminder a dedicated `safety_net_block` with no variant, so there the block name selects it. An\n * explicit variant always wins (so an unknown one still falls to the block's \"unknown variant\" path).\n */\nexport const resolveAmountInputVariant = (cta?: {\n block?: string | null\n variant?: string | null\n}): string | undefined => {\n if (cta?.variant) return cta.variant\n if (cta?.block === actionBlocksKey.SAFETY_NET_ACTION_BLOCK)\n return AMOUNT_INPUT_VARIANTS.SAFETY_NET\n return undefined\n}\n\n/** Pulse v1's upper bound for a safety net; applied to both variants. */\nconst MAX_AMOUNT = 1_000_000_000\n\n/** Whole dollars from 1 to `MAX_AMOUNT`, as pulse v1 accepted for both settings. */\nexport const isWholeAmount = (value: string): boolean =>\n /^\\d+$/.test(value) && Number(value) >= 1 && Number(value) <= MAX_AMOUNT\n\n/** A saved amount as the field's starting text; nothing saved (or zero) starts empty. */\nexport const toInputValue = (amount?: number | null): string =>\n amount ? String(Math.round(amount)) : ''\n\n/** The account's low-balance alert profile, which holds the threshold (as pulse v1 looked it up). */\nexport const findLowBalanceProfile = (\n profiles: NotificationProfile[],\n accountGuid?: string | null,\n): NotificationProfile | undefined =>\n accountGuid\n ? profiles.find(\n (profile) =>\n profile.entity_guid === accountGuid &&\n profile.notification_type === AccountNotificationTypes.AccountBalanceLow,\n )\n : undefined\n"],"mappings":";;AAKA,IAAa,IAAwB;AAAA,EACnC,uBAAuB;AAAA,EACvB,YAAY;AACd,GAGa,IAAwB,iBAIxB,IAAA,CAAwB,MACnC,OAAO,OAAe,CAAqB,EAAE,SAAS,KAAW,EAAE,GAQxD,IAAA,CAA6B,MAGhB;AACxB,MAAI,GAAK,QAAS,QAAO,EAAI;AAC7B,MAAI,GAAK,UAAU,EAAgB,wBACjC,QAAO,EAAsB;AAEjC,GAGM,IAAa,KAGN,IAAA,CAAiB,MAC5B,QAAQ,KAAK,CAAK,KAAK,OAAO,CAAK,KAAK,KAAK,OAAO,CAAK,KAAK,GAGnD,IAAA,CAAgB,MAC3B,IAAS,OAAO,KAAK,MAAM,CAAM,CAAC,IAAI,IAG3B,IAAA,CACX,GACA,MAEA,IACI,EAAS,KAAA,CACN,MACC,EAAQ,gBAAgB,KACxB,EAAQ,sBAAsB,EAAyB,iBAC3D,IACA"}
@@ -1,51 +1,21 @@
1
1
  import { buildDynamicCopy as y } from "../../../core/utils/Localization.es.js";
2
2
  import { formatCurrency as d } from "../../../core/utils/NumberFormatting.es.js";
3
- import { BalanceStepper as S } from "./BalanceStepper.es.js";
4
- import w from "./SaveEnoughToLiveOnBottomSection.es.js";
5
- import { toNumber as p, variants as C } from "./layout.es.js";
6
- import v from "react";
3
+ import { BalanceStepper as w } from "./BalanceStepper.es.js";
4
+ import C from "./SaveEnoughToLiveOnBottomSection.es.js";
5
+ import { PROJECTIONS as I, toNumber as b, variants as S } from "./layout.es.js";
6
+ import u from "react";
7
7
  import { Text as i } from "@mxenabled/mxui";
8
- import { Icon as E } from "@mxenabled/mx-icons";
9
- import { Fragment as f, jsx as e, jsxs as a } from "react/jsx-runtime";
10
- import { Card as I, Divider as A, List as T, ListItem as H, Stack as l } from "@mui/material";
11
- var N = [
12
- {
13
- label: "3 months",
14
- value: 3
15
- },
16
- {
17
- label: "6 months",
18
- value: 6
19
- },
20
- {
21
- label: "9 months",
22
- value: 9
23
- }
24
- ], O = [
25
- {
26
- label: "1 month",
27
- value: 1
28
- },
29
- {
30
- label: "3 months",
31
- value: 3
32
- },
33
- {
34
- label: "6 months",
35
- value: 6
36
- },
37
- {
38
- label: "9 months",
39
- value: 9
40
- }
41
- ], W = ({ copy: o, leading: r }) => /* @__PURE__ */ a(l, {
8
+ import { Icon as j } from "@mxenabled/mx-icons";
9
+ import { Fragment as v, jsx as e, jsxs as r } from "react/jsx-runtime";
10
+ import { Card as A, Divider as E, List as W, ListItem as k, Stack as a } from "@mui/material";
11
+ var L = ({ copy: o, leading: t }) => /* @__PURE__ */ r(a, {
42
12
  sx: {
43
13
  bgcolor: "background.paper",
44
14
  p: 24,
45
15
  borderBottom: "1px solid",
46
16
  borderColor: "divider"
47
17
  },
48
- children: [r, /* @__PURE__ */ a(l, {
18
+ children: [t, /* @__PURE__ */ r(a, {
49
19
  sx: { gap: 8 },
50
20
  children: [/* @__PURE__ */ e(i, {
51
21
  variant: "h3",
@@ -57,18 +27,18 @@ var N = [
57
27
  children: o.description
58
28
  })]
59
29
  })]
60
- }), j = ({ availableBalances: o, expenses: r, totalRemaining: t, copy: n }) => /* @__PURE__ */ e(l, {
30
+ }), O = ({ availableBalances: o, expenses: t, totalRemaining: n, copy: c }) => /* @__PURE__ */ e(a, {
61
31
  sx: {
62
32
  pt: 24,
63
33
  px: 24
64
34
  },
65
- children: /* @__PURE__ */ a(I, {
35
+ children: /* @__PURE__ */ r(A, {
66
36
  sx: {
67
37
  px: 16,
68
38
  pt: 16,
69
39
  pb: 12
70
40
  },
71
- children: [/* @__PURE__ */ a(l, {
41
+ children: [/* @__PURE__ */ r(a, {
72
42
  sx: {
73
43
  border: 1,
74
44
  borderColor: "divider",
@@ -81,7 +51,7 @@ var N = [
81
51
  mb: 12
82
52
  },
83
53
  children: [
84
- /* @__PURE__ */ a(l, {
54
+ /* @__PURE__ */ r(a, {
85
55
  sx: {
86
56
  width: 155,
87
57
  textAlign: "center"
@@ -93,14 +63,14 @@ var N = [
93
63
  }), /* @__PURE__ */ e(i, {
94
64
  sx: { color: "text.secondary" },
95
65
  variant: "caption",
96
- children: n.available_text
66
+ children: c.available_text
97
67
  })]
98
68
  }),
99
- /* @__PURE__ */ e(E, {
69
+ /* @__PURE__ */ e(j, {
100
70
  name: "remove",
101
71
  size: 20
102
72
  }),
103
- /* @__PURE__ */ a(l, {
73
+ /* @__PURE__ */ r(a, {
104
74
  sx: {
105
75
  width: 155,
106
76
  textAlign: "center"
@@ -108,15 +78,15 @@ var N = [
108
78
  children: [/* @__PURE__ */ e(i, {
109
79
  sx: { fontWeight: 600 },
110
80
  variant: "body1",
111
- children: d(r, "0,0.00")
81
+ children: d(t, "0,0.00")
112
82
  }), /* @__PURE__ */ e(i, {
113
83
  sx: { color: "text.secondary" },
114
84
  variant: "caption",
115
- children: n.expenses_text
85
+ children: c.expenses_text
116
86
  })]
117
87
  })
118
88
  ]
119
- }), /* @__PURE__ */ a(l, {
89
+ }), /* @__PURE__ */ r(a, {
120
90
  sx: {
121
91
  textAlign: "center",
122
92
  flexDirection: "row",
@@ -124,18 +94,18 @@ var N = [
124
94
  alignItems: "center",
125
95
  gap: 4
126
96
  },
127
- children: [/* @__PURE__ */ a(i, {
97
+ children: [/* @__PURE__ */ r(i, {
128
98
  sx: { color: "text.secondary" },
129
99
  variant: "body2",
130
- children: [n.total_remaining_text, ":"]
100
+ children: [c.total_remaining_text, ":"]
131
101
  }), /* @__PURE__ */ e(i, {
132
102
  sx: { fontWeight: 600 },
133
103
  variant: "body2",
134
- children: d(t, "0,0.00")
104
+ children: d(n, "0,0.00")
135
105
  })]
136
106
  })]
137
107
  })
138
- }), k = ({ availableBalances: o, date: r, copy: t }) => /* @__PURE__ */ a(l, {
108
+ }), R = ({ availableBalances: o, date: t, copy: n }) => /* @__PURE__ */ r(a, {
139
109
  sx: {
140
110
  pt: 6,
141
111
  pb: 14,
@@ -147,22 +117,22 @@ var N = [
147
117
  truncate: !1,
148
118
  variant: "h3",
149
119
  children: d(o, "0,0.00")
150
- }), r && /* @__PURE__ */ e(i, {
120
+ }), t && /* @__PURE__ */ e(i, {
151
121
  sx: {
152
122
  color: "text.secondary",
153
123
  fontWeight: 400
154
124
  },
155
125
  truncate: !1,
156
126
  variant: "subtitle2",
157
- children: y(t.your_available_balances_text, r)
127
+ children: y(n.your_available_balances_text, t)
158
128
  })]
159
- }), L = ({ bodyContent: o, bodyDescription: r, monthsTable: t, deltaAmount: n, initialAmount: s, seedAmount: c, copy: m }) => {
160
- const [b, h] = v.useState(s ?? c ?? 0);
161
- v.useEffect(() => {
162
- s == null && c != null && h(c);
163
- }, [s, c]);
164
- const g = t.length - 1;
165
- return /* @__PURE__ */ a(f, { children: [/* @__PURE__ */ a(l, {
129
+ }), T = ({ bodyContent: o, bodyDescription: t, monthsTable: n, deltaAmount: c, initialAmount: s, seedAmount: l, copy: h }) => {
130
+ const [m, p] = u.useState(s ?? l ?? 0);
131
+ u.useEffect(() => {
132
+ s == null && l != null && p(l);
133
+ }, [s, l]);
134
+ const g = n.length - 1;
135
+ return /* @__PURE__ */ r(v, { children: [/* @__PURE__ */ r(a, {
166
136
  sx: {
167
137
  p: 24,
168
138
  gap: 8
@@ -172,13 +142,13 @@ var N = [
172
142
  truncate: !1,
173
143
  variant: "body1",
174
144
  children: o
175
- }), /* @__PURE__ */ e(S, {
176
- amount: d(b, "0,0.00"),
177
- copy: m,
178
- onDecrement: () => h((x) => Math.max(0, x - n)),
179
- onIncrement: () => h((x) => x + n)
145
+ }), /* @__PURE__ */ e(w, {
146
+ amount: d(m, "0,0.00"),
147
+ copy: h,
148
+ onDecrement: () => p((x) => Math.max(0, x - c)),
149
+ onIncrement: () => p((x) => x + c)
180
150
  })]
181
- }), /* @__PURE__ */ a(l, {
151
+ }), /* @__PURE__ */ r(a, {
182
152
  sx: { gap: 8 },
183
153
  children: [/* @__PURE__ */ e(i, {
184
154
  sx: {
@@ -187,22 +157,22 @@ var N = [
187
157
  },
188
158
  truncate: !1,
189
159
  variant: "body1",
190
- children: r
191
- }), /* @__PURE__ */ e(T, {
160
+ children: t
161
+ }), /* @__PURE__ */ e(W, {
192
162
  sx: {
193
163
  bgcolor: "background.paper",
194
164
  width: "100%"
195
165
  },
196
- children: t.map(({ label: x, value: u }, _) => /* @__PURE__ */ a(v.Fragment, { children: [/* @__PURE__ */ e(H, {
166
+ children: n.map(({ label: x, value: f }, _) => /* @__PURE__ */ r(u.Fragment, { children: [/* @__PURE__ */ e(k, {
197
167
  disableGutters: !0,
198
168
  disablePadding: !0,
199
169
  sx: {
200
170
  minHeight: 52,
201
171
  bgcolor: "background.paper"
202
172
  },
203
- children: /* @__PURE__ */ e(l, {
173
+ children: /* @__PURE__ */ e(a, {
204
174
  sx: { width: "100%" },
205
- children: /* @__PURE__ */ a(l, {
175
+ children: /* @__PURE__ */ r(a, {
206
176
  sx: {
207
177
  flexDirection: "row",
208
178
  justifyContent: "space-between",
@@ -219,57 +189,57 @@ var N = [
219
189
  sx: { fontWeight: 600 },
220
190
  truncate: !1,
221
191
  variant: "body1",
222
- children: d(u * b, "0,0")
192
+ children: d(f * m, "0,0")
223
193
  })]
224
194
  })
225
195
  })
226
- }), /* @__PURE__ */ e(A, {
196
+ }), /* @__PURE__ */ e(E, {
227
197
  component: "li",
228
198
  sx: { ml: _ === g ? 0 : 24 }
229
- })] }, u))
199
+ })] }, f))
230
200
  })]
231
201
  })] });
232
- }, z = ({ variant: o, slotData: r, copy: t }) => {
233
- const n = o === C.SAVE_ENOUGH_TO_LIVE_ON, s = r?.available_balance, c = p(r?.avg_monthly_spend), m = p(r?.upcoming_expenses), b = p(r?.total_remaining), h = r?.time_period, g = r?.date;
234
- return /* @__PURE__ */ a(f, { children: [
235
- /* @__PURE__ */ e(W, {
236
- copy: t,
237
- leading: n && s != null && c != null && h ? /* @__PURE__ */ e(w, {
238
- content: h,
239
- leftLabel: t.available_balances_text,
240
- leftValue: d(s, "0,0.00"),
241
- rightLabel: t.average_monthly_spend_text,
242
- rightValue: d(c, "0,0.00"),
202
+ }, $ = ({ variant: o, slotData: t, copy: n }) => {
203
+ const c = o === S.SAVE_ENOUGH_TO_LIVE_ON, s = I[o], l = t?.available_balance, h = b(t?.avg_monthly_spend), m = b(t?.upcoming_expenses), p = b(t?.total_remaining), g = t?.time_period, x = t?.date;
204
+ return /* @__PURE__ */ r(v, { children: [
205
+ /* @__PURE__ */ e(L, {
206
+ copy: n,
207
+ leading: c && l != null && h != null && g ? /* @__PURE__ */ e(C, {
208
+ content: g,
209
+ leftLabel: n.available_balances_text,
210
+ leftValue: d(l, "0,0.00"),
211
+ rightLabel: n.average_monthly_spend_text,
212
+ rightValue: d(h, "0,0.00"),
243
213
  sx: {
244
214
  width: "100%",
245
215
  mb: 24
246
216
  }
247
217
  }) : null
248
218
  }),
249
- !n && s != null && m != null && /* @__PURE__ */ e(j, {
250
- availableBalances: s,
251
- copy: t,
219
+ !c && l != null && m != null && /* @__PURE__ */ e(O, {
220
+ availableBalances: l,
221
+ copy: n,
252
222
  expenses: m,
253
- totalRemaining: b
223
+ totalRemaining: p
254
224
  }),
255
- /* @__PURE__ */ e(L, {
256
- bodyContent: n ? t.body_spending_content : t.body_saving_content,
257
- bodyDescription: n ? t.body_spending_description : t.body_saving_description,
258
- copy: t,
259
- deltaAmount: n ? 50 : 5,
260
- initialAmount: n ? null : 100,
261
- monthsTable: n ? O : N,
262
- seedAmount: n ? c : void 0
225
+ /* @__PURE__ */ e(T, {
226
+ bodyContent: n[s.contentKey],
227
+ bodyDescription: n[s.descriptionKey],
228
+ copy: n,
229
+ deltaAmount: s.deltaAmount,
230
+ initialAmount: s.initialAmount,
231
+ monthsTable: s.months,
232
+ seedAmount: s.initialAmount == null ? h : void 0
263
233
  }),
264
- n && s != null && /* @__PURE__ */ e(k, {
265
- availableBalances: s,
266
- copy: t,
267
- date: g
234
+ c && l != null && /* @__PURE__ */ e(R, {
235
+ availableBalances: l,
236
+ copy: n,
237
+ date: x
268
238
  })
269
239
  ] });
270
240
  };
271
241
  export {
272
- z as MakeTransferActionBlock
242
+ $ as MakeTransferActionBlock
273
243
  };
274
244
 
275
245
  //# sourceMappingURL=MakeTransferActionBlock.es.js.map