@mx-cartographer/experiences 9.7.157-alpha-ram-cccl-1 → 9.7.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/common/components/CurrencyDialog.d.ts +1 -3
- package/dist/common/components/CurrencyDialog.es.js +42 -45
- package/dist/common/components/CurrencyDialog.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +0 -8
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +83 -83
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +1 -36
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +15 -63
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +59 -64
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +1 -18
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +66 -88
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +17 -17
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.d.ts +2 -11
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js +7 -16
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.d.ts +0 -4
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js +7 -13
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.d.ts +20 -4
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +54 -56
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +4 -4
- package/dist/insights-v2/components/CompactInsightCard.es.js +138 -162
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +13 -13
- package/package.json +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.d.ts +0 -11
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js +0 -123
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js.map +0 -1
- package/dist/insights-v2/components/shared/UtilizationBar.d.ts +0 -15
- package/dist/insights-v2/components/shared/UtilizationBar.es.js +0 -31
- package/dist/insights-v2/components/shared/UtilizationBar.es.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [9.7.158] - 11-16-2026
|
|
2
|
+
|
|
3
|
+
- **CHANGED** - Debt Payment Reminder card labels come only from the backend (WEC-2312)
|
|
4
|
+
- **CHANGED** - Debt Payment Reminder QA page moves to Debt Payment Reminder V4 (WEC-2312)
|
|
5
|
+
|
|
1
6
|
## [9.7.157] - 11-13-2026
|
|
2
7
|
|
|
3
8
|
- **CHANGED** - Credit Utilization drawer matches the Figma drill-down with short definitions, a marker on the utilization bands, a tip and a card per credit card that opens Account Details (WEC-2318)
|
|
@@ -27,8 +27,6 @@ interface CurrencyDialogProps {
|
|
|
27
27
|
/** A line under the title, e.g. the account a setting applies to. */
|
|
28
28
|
subtitle?: ReactNode;
|
|
29
29
|
title: string;
|
|
30
|
-
/** `$` before the value (the default), or `%` after it for a percentage. */
|
|
31
|
-
unit?: 'currency' | 'percent';
|
|
32
30
|
}
|
|
33
|
-
declare const CurrencyDialog: ({ closeAriaLabel, content, errorText, inputLabel, inputValue, isOpen, isPrimaryDisabled, handleInputChange, handleInputClick, handleModalClose, handlePrimaryAction, handleSecondaryAction, primaryColor, primaryText, secondaryColor, secondaryText, subtitle, title,
|
|
31
|
+
declare const CurrencyDialog: ({ closeAriaLabel, content, errorText, inputLabel, inputValue, isOpen, isPrimaryDisabled, handleInputChange, handleInputClick, handleModalClose, handlePrimaryAction, handleSecondaryAction, primaryColor, primaryText, secondaryColor, secondaryText, subtitle, title, }: CurrencyDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
32
|
export default CurrencyDialog;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useScreenSize as
|
|
1
|
+
import { useScreenSize as S } from "../hooks/useScreenSize.es.js";
|
|
2
2
|
import n from "@mui/material/Stack";
|
|
3
|
-
import { H3 as
|
|
3
|
+
import { H3 as j, P as M } from "@mxenabled/mxui";
|
|
4
4
|
import f from "@mui/material/Button";
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { jsx as o, jsxs as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const d =
|
|
15
|
-
return /* @__PURE__ */ o(
|
|
16
|
-
"aria-label":
|
|
5
|
+
import { Icon as $ } from "@mxenabled/mx-icons";
|
|
6
|
+
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
7
|
+
import B from "@mui/material/Dialog";
|
|
8
|
+
import F from "@mui/material/DialogContent";
|
|
9
|
+
import H from "@mui/material/IconButton";
|
|
10
|
+
import w from "@mui/material/DialogActions";
|
|
11
|
+
import A from "@mui/material/InputAdornment";
|
|
12
|
+
import N from "@mui/material/TextField";
|
|
13
|
+
var X = ({ closeAriaLabel: h, content: g, errorText: a, inputLabel: r, inputValue: i, isOpen: u, isPrimaryDisabled: x = !1, handleInputChange: b, handleInputClick: C, handleModalClose: m, handlePrimaryAction: s, handleSecondaryAction: D, primaryColor: k = "primary", primaryText: p, secondaryColor: v = "primary", secondaryText: l, subtitle: y, title: c }) => {
|
|
14
|
+
const d = x || (r ? !(i !== "" && i !== "0" && !isNaN(parseFloat(i ?? "0"))) : !1), { isSmallMobile: I } = S();
|
|
15
|
+
return /* @__PURE__ */ o(B, {
|
|
16
|
+
"aria-label": c,
|
|
17
17
|
"aria-labelledby": "modal-title",
|
|
18
18
|
maxWidth: "xs",
|
|
19
19
|
onClose: m,
|
|
20
|
-
open:
|
|
20
|
+
open: u,
|
|
21
21
|
role: "dialog",
|
|
22
22
|
sx: {
|
|
23
23
|
"& .MuiDialogContent-root": { p: 0 },
|
|
24
|
-
...
|
|
24
|
+
...I && { "& .MuiDialog-paper": { minWidth: "100%" } }
|
|
25
25
|
},
|
|
26
|
-
children: /* @__PURE__ */ o(
|
|
27
|
-
onSubmit: (
|
|
28
|
-
|
|
26
|
+
children: /* @__PURE__ */ o(F, { children: /* @__PURE__ */ t("form", {
|
|
27
|
+
onSubmit: (e) => {
|
|
28
|
+
e.preventDefault(), d || s();
|
|
29
29
|
},
|
|
30
30
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ t(n, {
|
|
32
32
|
sx: {
|
|
33
33
|
alignItems: "center",
|
|
34
34
|
flexDirection: "row",
|
|
@@ -39,14 +39,14 @@ var Y = ({ closeAriaLabel: u, content: g, errorText: a, inputLabel: t, inputValu
|
|
|
39
39
|
pr: 16,
|
|
40
40
|
pt: 24
|
|
41
41
|
},
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ t(n, {
|
|
43
43
|
sx: { gap: 4 },
|
|
44
|
-
children: [/* @__PURE__ */ o(
|
|
44
|
+
children: [/* @__PURE__ */ o(j, {
|
|
45
45
|
id: "modal-title",
|
|
46
|
-
children:
|
|
47
|
-
}),
|
|
48
|
-
}), /* @__PURE__ */ o(
|
|
49
|
-
"aria-label":
|
|
46
|
+
children: c
|
|
47
|
+
}), y]
|
|
48
|
+
}), /* @__PURE__ */ o(H, {
|
|
49
|
+
"aria-label": h,
|
|
50
50
|
onClick: m,
|
|
51
51
|
sx: {
|
|
52
52
|
minHeight: 24,
|
|
@@ -54,50 +54,47 @@ var Y = ({ closeAriaLabel: u, content: g, errorText: a, inputLabel: t, inputValu
|
|
|
54
54
|
right: 8,
|
|
55
55
|
top: 18
|
|
56
56
|
},
|
|
57
|
-
children: /* @__PURE__ */ o(
|
|
57
|
+
children: /* @__PURE__ */ o($, {
|
|
58
58
|
name: "close",
|
|
59
59
|
sx: { color: "action.active" }
|
|
60
60
|
})
|
|
61
61
|
})]
|
|
62
62
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ t(n, {
|
|
64
64
|
sx: {
|
|
65
65
|
gap: 24,
|
|
66
66
|
px: 24
|
|
67
67
|
},
|
|
68
|
-
children: [/* @__PURE__ */ o(
|
|
68
|
+
children: [/* @__PURE__ */ o(M, {
|
|
69
69
|
variant: "subtitle1",
|
|
70
70
|
children: g
|
|
71
|
-
}),
|
|
71
|
+
}), r && /* @__PURE__ */ o(N, {
|
|
72
72
|
autoFocus: !0,
|
|
73
73
|
error: !!a,
|
|
74
74
|
helperText: a,
|
|
75
75
|
inputMode: "decimal",
|
|
76
|
-
label:
|
|
77
|
-
onChange: ({ target: { value:
|
|
78
|
-
/^\d*\.?\d*$/.test(
|
|
76
|
+
label: r,
|
|
77
|
+
onChange: ({ target: { value: e } }) => {
|
|
78
|
+
/^\d*\.?\d*$/.test(e) && b?.(e);
|
|
79
79
|
},
|
|
80
|
-
onClick:
|
|
80
|
+
onClick: C,
|
|
81
81
|
slotProps: {
|
|
82
|
-
input:
|
|
83
|
-
position: "end",
|
|
84
|
-
children: "%"
|
|
85
|
-
}) } : { startAdornment: /* @__PURE__ */ o(h, {
|
|
82
|
+
input: { startAdornment: /* @__PURE__ */ o(A, {
|
|
86
83
|
position: "start",
|
|
87
84
|
children: "$"
|
|
88
85
|
}) },
|
|
89
86
|
formHelperText: { role: "alert" },
|
|
90
87
|
htmlInput: {
|
|
91
|
-
"aria-label":
|
|
88
|
+
"aria-label": r,
|
|
92
89
|
noValidate: !0,
|
|
93
90
|
pattern: "[0-9]*\\.?[0-9]*"
|
|
94
91
|
}
|
|
95
92
|
},
|
|
96
93
|
type: "text",
|
|
97
|
-
value:
|
|
94
|
+
value: i
|
|
98
95
|
})]
|
|
99
96
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ t(w, {
|
|
101
98
|
sx: {
|
|
102
99
|
justifyContent: "flex-end",
|
|
103
100
|
gap: 16,
|
|
@@ -107,15 +104,15 @@ var Y = ({ closeAriaLabel: u, content: g, errorText: a, inputLabel: t, inputValu
|
|
|
107
104
|
children: [l && /* @__PURE__ */ o(f, {
|
|
108
105
|
"aria-label": l,
|
|
109
106
|
color: v,
|
|
110
|
-
onClick:
|
|
107
|
+
onClick: D,
|
|
111
108
|
children: l
|
|
112
109
|
}), /* @__PURE__ */ o(f, {
|
|
113
|
-
"aria-label":
|
|
110
|
+
"aria-label": p,
|
|
114
111
|
color: k,
|
|
115
112
|
disabled: d,
|
|
116
113
|
onClick: s,
|
|
117
114
|
variant: "contained",
|
|
118
|
-
children:
|
|
115
|
+
children: p
|
|
119
116
|
})]
|
|
120
117
|
})
|
|
121
118
|
]
|
|
@@ -123,7 +120,7 @@ var Y = ({ closeAriaLabel: u, content: g, errorText: a, inputLabel: t, inputValu
|
|
|
123
120
|
});
|
|
124
121
|
};
|
|
125
122
|
export {
|
|
126
|
-
|
|
123
|
+
X as default
|
|
127
124
|
};
|
|
128
125
|
|
|
129
126
|
//# sourceMappingURL=CurrencyDialog.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyDialog.es.js","names":[],"sources":["../../../src/common/components/CurrencyDialog.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, P } from '@mxenabled/mxui'\n\nimport Button, { type ButtonProps } from '@mui/material/Button'\nimport Dialog from '@mui/material/Dialog'\nimport DialogActions from '@mui/material/DialogActions'\nimport DialogContent from '@mui/material/DialogContent'\nimport IconButton from '@mui/material/IconButton'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { useScreenSize } from '../hooks'\n\ninterface CurrencyDialogProps {\n closeAriaLabel: string\n /** Body copy; a node so callers can emphasise part of it (e.g. a bold account name). */\n content?: ReactNode\n /** Validation or save error, shown under the input and marking it invalid. */\n errorText?: string\n inputLabel?: string\n inputValue?: string\n isOpen: boolean\n /** Disables the primary button on top of the built-in input check (e.g. while saving). */\n isPrimaryDisabled?: boolean\n handleInputChange?: (value: string) => void\n /**\n * Click on the amount input (e.g. analytics). Click, not focus: the input autofocuses on open,\n * so a focus callback would fire per open rather than per user interaction.\n */\n handleInputClick?: () => void\n handleModalClose: () => void\n handlePrimaryAction: () => void\n handleSecondaryAction?: () => void\n primaryColor?: ButtonProps['color']\n primaryText: string\n secondaryColor?: ButtonProps['color']\n secondaryText?: string\n /** A line under the title, e.g. the account a setting applies to. */\n subtitle?: ReactNode\n title: string\n
|
|
1
|
+
{"version":3,"file":"CurrencyDialog.es.js","names":[],"sources":["../../../src/common/components/CurrencyDialog.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, P } from '@mxenabled/mxui'\n\nimport Button, { type ButtonProps } from '@mui/material/Button'\nimport Dialog from '@mui/material/Dialog'\nimport DialogActions from '@mui/material/DialogActions'\nimport DialogContent from '@mui/material/DialogContent'\nimport IconButton from '@mui/material/IconButton'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { useScreenSize } from '../hooks'\n\ninterface CurrencyDialogProps {\n closeAriaLabel: string\n /** Body copy; a node so callers can emphasise part of it (e.g. a bold account name). */\n content?: ReactNode\n /** Validation or save error, shown under the input and marking it invalid. */\n errorText?: string\n inputLabel?: string\n inputValue?: string\n isOpen: boolean\n /** Disables the primary button on top of the built-in input check (e.g. while saving). */\n isPrimaryDisabled?: boolean\n handleInputChange?: (value: string) => void\n /**\n * Click on the amount input (e.g. analytics). Click, not focus: the input autofocuses on open,\n * so a focus callback would fire per open rather than per user interaction.\n */\n handleInputClick?: () => void\n handleModalClose: () => void\n handlePrimaryAction: () => void\n handleSecondaryAction?: () => void\n primaryColor?: ButtonProps['color']\n primaryText: string\n secondaryColor?: ButtonProps['color']\n secondaryText?: string\n /** A line under the title, e.g. the account a setting applies to. */\n subtitle?: ReactNode\n title: string\n}\n\n// Created for V2 of BudgetDetailsDrawer.\n// The previous design will be replaced once the new design is finalized.\n// Also needs to be updated to use the mxui library\n// with the updated Dialog components.\n\nconst CurrencyDialog = ({\n closeAriaLabel,\n content,\n errorText,\n inputLabel,\n inputValue,\n isOpen,\n isPrimaryDisabled = false,\n handleInputChange,\n handleInputClick,\n handleModalClose,\n handlePrimaryAction,\n handleSecondaryAction,\n primaryColor = 'primary',\n primaryText,\n secondaryColor = 'primary',\n secondaryText,\n subtitle,\n title,\n}: CurrencyDialogProps) => {\n const numericValue = parseFloat(inputValue ?? '0')\n const isValid = inputValue !== '' && inputValue !== '0' && !isNaN(numericValue)\n // One rule for the button and for Enter: the form's submit must not bypass a disabled button.\n const isPrimaryBlocked = isPrimaryDisabled || (inputLabel ? !isValid : false)\n\n const { isSmallMobile } = useScreenSize()\n\n return (\n <Dialog\n aria-label={title}\n aria-labelledby=\"modal-title\"\n maxWidth=\"xs\"\n onClose={handleModalClose}\n open={isOpen}\n role=\"dialog\"\n sx={{\n '& .MuiDialogContent-root': { p: 0 },\n ...(isSmallMobile && { '& .MuiDialog-paper': { minWidth: '100%' } }),\n }}\n >\n <DialogContent>\n <form\n onSubmit={(e) => {\n e.preventDefault()\n if (!isPrimaryBlocked) handlePrimaryAction()\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 12,\n pl: 24,\n position: 'relative',\n pr: 16,\n pt: 24,\n }}\n >\n <Stack sx={{ gap: 4 }}>\n <H3 id=\"modal-title\">{title}</H3>\n {subtitle}\n </Stack>\n <IconButton\n aria-label={closeAriaLabel}\n onClick={handleModalClose}\n sx={{ minHeight: 24, position: 'absolute', right: 8, top: 18 }}\n >\n <Icon name=\"close\" sx={{ color: 'action.active' }} />\n </IconButton>\n </Stack>\n <Stack sx={{ gap: 24, px: 24 }}>\n <P variant=\"subtitle1\">{content}</P>\n {inputLabel && (\n <TextField\n autoFocus={true}\n error={!!errorText}\n helperText={errorText}\n inputMode=\"decimal\"\n label={inputLabel}\n onChange={({ target: { value } }) => {\n if (!/^\\d*\\.?\\d*$/.test(value)) return\n\n handleInputChange?.(value)\n }}\n onClick={handleInputClick}\n slotProps={{\n input: {\n startAdornment: <InputAdornment position=\"start\">$</InputAdornment>,\n },\n // Announce errors: focus is usually on the primary button when one appears.\n formHelperText: { role: 'alert' },\n htmlInput: {\n 'aria-label': inputLabel,\n noValidate: true,\n pattern: '[0-9]*\\\\.?[0-9]*',\n },\n }}\n type=\"text\"\n value={inputValue}\n />\n )}\n </Stack>\n <DialogActions\n sx={{\n justifyContent: 'flex-end',\n gap: 16,\n p: 24,\n '>:not(style)~:not(style)': { ml: 0 },\n }}\n >\n {secondaryText && (\n <Button\n aria-label={secondaryText}\n color={secondaryColor}\n onClick={handleSecondaryAction}\n >\n {secondaryText}\n </Button>\n )}\n <Button\n aria-label={primaryText}\n color={primaryColor}\n disabled={isPrimaryBlocked}\n onClick={handlePrimaryAction}\n variant=\"contained\"\n >\n {primaryText}\n </Button>\n </DialogActions>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport default CurrencyDialog\n"],"mappings":";;;;;;;;;;;;AAkDA,IAAM,IAAA,CAAkB,EACtB,gBAAA,GACA,SAAA,GACA,WAAA,GACA,YAAA,GACA,YAAA,GACA,QAAA,GACA,mBAAA,IAAoB,IACpB,mBAAA,GACA,kBAAA,GACA,kBAAA,GACA,qBAAA,GACA,uBAAA,GACA,cAAA,IAAe,WACf,aAAA,GACA,gBAAA,IAAiB,WACjB,eAAA,GACA,UAAA,GACA,OAAA,EAAA,MACyB;AAIzB,QAAM,IAAmB,MAAsB,IAAa,EAF5C,MAAe,MAAM,MAAe,OAAO,CAAC,MADvC,WAAW,KAAc,GACoB,CAAY,KAEP,KAEjE,EAAE,eAAA,EAAA,IAAkB,EAAc;AAExC,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY;AAAA,IACZ,mBAAgB;AAAA,IAChB,UAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN,MAAK;AAAA,IACL,IAAI;AAAA,MACF,4BAA4B,EAAE,GAAG,EAAE;AAAA,MACnC,GAAI,KAAiB,EAAE,sBAAsB,EAAE,UAAU,OAAO,EAAE;AAAA,IACpE;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD,EAAA,UACE,gBAAA,EAAC,QAAD;AAAA,MACE,UAAA,CAAW,MAAM;AACf,UAAE,eAAe,GACZ,KAAkB,EAAoB;AAAA,MAC7C;AAAA,MAJF,UAAA;AAAA,QAME,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,YAAY;AAAA,YACZ,eAAe;AAAA,YACf,gBAAgB;AAAA,YAChB,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,UAAU;AAAA,YACV,IAAI;AAAA,YACJ,IAAI;AAAA,UACN;AAAA,UAVF,UAAA,CAYE,gBAAA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,YACL,OAAO;AAAA,UACR,CAAA,CAEE;AAAA;QACP,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,gBAAgB;AAAA,YAChB,KAAK;AAAA,YACL,GAAG;AAAA,YACH,4BAA4B,EAAE,IAAI,EAAE;AAAA,UACtC;AAAA,UANF,UAAA,CAQG,KACC,gBAAA,EAAC,GAAD;AAAA,YACE,cAAY;AAAA,YACZ,OAAO;AAAA,YACP,SAAS;AAAA,YAER,UAAA;AAAA,UACK,CAAA,GAEV,gBAAA,EAAC,GAAD;AAAA,YACE,cAAY;AAAA,YACZ,OAAO;AAAA,YACP,UAAU;AAAA,YACV,SAAS;AAAA,YACT,SAAQ;AAAA,YAEP,UAAA;AAAA,UACK,CAAA,CACK;AAAA;MACX;AAAA,IACO,CAAA,EAAA,CAAA;AAAA,EACT,CAAA;AAEZ"}
|
|
@@ -177,10 +177,6 @@ export interface TransactionHistoryBlock {
|
|
|
177
177
|
}
|
|
178
178
|
export interface TransactionListBlockCopy {
|
|
179
179
|
deposit_history_drawer_title?: string;
|
|
180
|
-
/** Credit Card Close to Limit's Spending list (`credit_limit_header`): its title, the limit's label and `_1{percentage}` utilization. */
|
|
181
|
-
credit_limit_header_drawer_title?: string;
|
|
182
|
-
credit_limit_header_credit_limit?: string;
|
|
183
|
-
credit_limit_header_utilization?: string;
|
|
184
180
|
/** The Subscriptions drawer's title (Monthly Subscription Aggregate V2). */
|
|
185
181
|
subscriptions_drawer_title?: string;
|
|
186
182
|
/** `_1{month}`: the count tile's caption, e.g. "Subscriptions in October". */
|
|
@@ -355,12 +351,8 @@ export interface AmountInputModalVariantCopy {
|
|
|
355
351
|
export interface AmountInputModalCopy {
|
|
356
352
|
low_balance_threshold: AmountInputModalVariantCopy;
|
|
357
353
|
safety_net: AmountInputModalVariantCopy;
|
|
358
|
-
/** Credit Card Close to Limit's alert percentage; optional until the host serves mrs_content >= 5.7.71. */
|
|
359
|
-
credit_limit_percentage?: AmountInputModalVariantCopy;
|
|
360
354
|
/** Validation message for anything but a positive whole-dollar amount. */
|
|
361
355
|
whole_number_error: string;
|
|
362
|
-
/** Validation message for anything but a whole number from 1 to 100 (credit_limit_percentage). */
|
|
363
|
-
percentage_error?: string;
|
|
364
356
|
/** Shown in the dialog when the save request fails; the value stays so Save can be retried. */
|
|
365
357
|
save_error: string;
|
|
366
358
|
}
|
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import
|
|
3
|
-
import { useCategoryStore as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useBeatActions as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { buildDynamicCopy as j } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import z from "../../../common/utils/AccountDisplayName.es.js";
|
|
3
|
+
import { useCategoryStore as q, useGlobalCopyStore as w, useInsightsV2Store as P, useSettingsStore as J, useUserStore as K } from "../../../common/context/hooks.es.js";
|
|
4
|
+
import B from "../../../common/components/Loader.es.js";
|
|
5
|
+
import Q from "../../../common/components/CurrencyDialog.es.js";
|
|
6
|
+
import { useBeatActions as X } from "../../beatActions.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS_CONFIG as d } from "../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
+
import { useCtaHandler as Z } from "../../ctaActions/useCtaAction.es.js";
|
|
9
|
+
import { useAnalyticsEvent as oo } from "../../analytics/useAnalyticsEvent.es.js";
|
|
10
|
+
import { useOpenedCta as eo } from "../useOpenedCta.es.js";
|
|
11
|
+
import { CreateBudgetDialog as to } from "./CreateBudgetDialog.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";
|
|
12
13
|
import r from "react";
|
|
13
|
-
import { observer as
|
|
14
|
-
import
|
|
15
|
-
import { H3 as
|
|
16
|
-
import { Icon as
|
|
17
|
-
import { jsx as
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
var S = ({ children:
|
|
21
|
-
const
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
"aria-labelledby": n ?
|
|
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 H } from "@mxenabled/mxui";
|
|
17
|
+
import { Icon as mo } from "@mxenabled/mx-icons";
|
|
18
|
+
import { jsx as o, jsxs as O } from "react/jsx-runtime";
|
|
19
|
+
import po from "@mui/material/Dialog";
|
|
20
|
+
import fo from "@mui/material/IconButton";
|
|
21
|
+
var S = ({ children: g, closeAriaLabel: i, heading: n, onClose: e }) => {
|
|
22
|
+
const a = r.useId();
|
|
23
|
+
return /* @__PURE__ */ o(po, {
|
|
24
|
+
"aria-labelledby": n ? a : void 0,
|
|
24
25
|
maxWidth: "xs",
|
|
25
|
-
onClose:
|
|
26
|
+
onClose: e,
|
|
26
27
|
open: !0,
|
|
27
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ O(k, {
|
|
28
29
|
sx: {
|
|
29
30
|
gap: 12,
|
|
30
31
|
p: 24,
|
|
31
32
|
position: "relative"
|
|
32
33
|
},
|
|
33
34
|
children: [
|
|
34
|
-
n && /* @__PURE__ */
|
|
35
|
-
id:
|
|
35
|
+
n && /* @__PURE__ */ o(lo, {
|
|
36
|
+
id: a,
|
|
36
37
|
children: n
|
|
37
38
|
}),
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ o(fo, {
|
|
39
40
|
"aria-label": i || "Close",
|
|
40
|
-
onClick:
|
|
41
|
+
onClick: e,
|
|
41
42
|
sx: {
|
|
42
43
|
position: "absolute",
|
|
43
44
|
right: 8,
|
|
44
45
|
top: 18
|
|
45
46
|
},
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ o(mo, {
|
|
47
48
|
name: "close",
|
|
48
49
|
sx: { color: "action.active" }
|
|
49
50
|
})
|
|
50
51
|
}),
|
|
51
|
-
|
|
52
|
+
g
|
|
52
53
|
]
|
|
53
54
|
})
|
|
54
55
|
});
|
|
55
|
-
},
|
|
56
|
-
const { common: n } =
|
|
56
|
+
}, ko = V(function({ beat: i }) {
|
|
57
|
+
const { common: n } = w(), { closeActionDrawer: e } = P(), a = q(), l = eo(i), [u] = r.useState(() => so(l)), m = u === no;
|
|
57
58
|
return r.useEffect(() => {
|
|
58
|
-
|
|
59
|
-
}, [
|
|
59
|
+
m && !a.categoriesLoaded && a.loadCategories();
|
|
60
|
+
}, [a, m]), m ? a.categoriesLoaded ? /* @__PURE__ */ o(to, { beat: i }) : /* @__PURE__ */ o(S, {
|
|
60
61
|
closeAriaLabel: n?.close_aria,
|
|
61
|
-
onClose:
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
}) : /* @__PURE__ */
|
|
62
|
+
onClose: e,
|
|
63
|
+
children: /* @__PURE__ */ o(B, {})
|
|
64
|
+
}) : /* @__PURE__ */ o(_o, {
|
|
64
65
|
beat: i,
|
|
65
|
-
variant:
|
|
66
|
+
variant: u
|
|
66
67
|
});
|
|
67
|
-
}),
|
|
68
|
-
const { common:
|
|
68
|
+
}), _o = V(function({ beat: i, variant: n }) {
|
|
69
|
+
const { common: e, insights_feed: a } = w(), { closeActionDrawer: l } = P(), u = J(), { userInsightProfile: m } = K(), A = Z(i, X()), E = oo(), c = a?.amount_input_modal, t = n === io.LOW_BALANCE_THRESHOLD, h = t ? ro(u.notificationProfiles, i.primary_account_guid) : void 0, T = t ? h?.threshold : m?.savings_opportunity_minimum_checking_account_balance, [R, G] = r.useState(t), p = r.useRef(!0);
|
|
69
70
|
r.useEffect(() => (p.current = !0, () => {
|
|
70
71
|
p.current = !1;
|
|
71
72
|
}), []), r.useEffect(() => {
|
|
72
|
-
|
|
73
|
-
p.current &&
|
|
73
|
+
t && u.loadNotificationProfiles().finally(() => {
|
|
74
|
+
p.current && G(!1);
|
|
74
75
|
});
|
|
75
|
-
}, [
|
|
76
|
-
const [
|
|
77
|
-
if (
|
|
78
|
-
closeAriaLabel:
|
|
79
|
-
onClose:
|
|
80
|
-
children: /* @__PURE__ */
|
|
76
|
+
}, [t, u]);
|
|
77
|
+
const [F, M] = r.useState(null), [C, v] = r.useState(!1), [U, y] = r.useState(!1), f = F ?? co(T);
|
|
78
|
+
if (R) return /* @__PURE__ */ o(S, {
|
|
79
|
+
closeAriaLabel: e?.close_aria,
|
|
80
|
+
onClose: l,
|
|
81
|
+
children: /* @__PURE__ */ o(B, {})
|
|
81
82
|
});
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
return console.warn(`amount_input_modal_block: ${
|
|
85
|
-
closeAriaLabel:
|
|
86
|
-
heading:
|
|
87
|
-
onClose:
|
|
88
|
-
children: /* @__PURE__ */
|
|
83
|
+
const s = x(n) ? c?.[n] : void 0, D = !!s?.title && !!s.description && !!s.input_label && !!c?.whole_number_error && !!c.save_error && !!e?.save_button && (!t || !!e.cancel_button) && !!e.close_aria;
|
|
84
|
+
if (!c || !s || !D || !(t ? h : m))
|
|
85
|
+
return console.warn(`amount_input_modal_block: ${c ? 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(S, {
|
|
86
|
+
closeAriaLabel: e?.close_aria,
|
|
87
|
+
heading: e?.error_heading,
|
|
88
|
+
onClose: l,
|
|
89
|
+
children: /* @__PURE__ */ o(H, { children: e?.error_message })
|
|
89
90
|
});
|
|
90
91
|
const L = () => {
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
if (!
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
profileGuid:
|
|
98
|
-
threshold:
|
|
99
|
-
}, { analytics:
|
|
100
|
-
p.current && (
|
|
92
|
+
E(t ? d.EDIT_INSIGHT_THRESHOLD_CANCELED : d.EDIT_SAFETY_NET_CANCEL), l();
|
|
93
|
+
}, b = !t && !!T, N = i.primary_account ? z(i.primary_account) : "", I = ao(f), $ = f !== "" && !I, W = async () => {
|
|
94
|
+
if (!I || C) return;
|
|
95
|
+
const _ = Number(f);
|
|
96
|
+
v(!0), y(!1);
|
|
97
|
+
const Y = t ? await A("updateNotificationProfileThreshold", {
|
|
98
|
+
profileGuid: h?.guid,
|
|
99
|
+
threshold: _
|
|
100
|
+
}, { analytics: d.EDIT_INSIGHT_THRESHOLD_SAVE }) : await A("updateUserInsightProfile", { fields: { savings_opportunity_minimum_checking_account_balance: _ } }, { analytics: d.EDIT_SAFETY_NET_SAVE });
|
|
101
|
+
p.current && (v(!1), Y ? l() : y(!0));
|
|
101
102
|
};
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
closeAriaLabel:
|
|
104
|
-
content:
|
|
105
|
-
errorText:
|
|
106
|
-
handleInputChange: (
|
|
107
|
-
|
|
103
|
+
return /* @__PURE__ */ o(Q, {
|
|
104
|
+
closeAriaLabel: e.close_aria,
|
|
105
|
+
content: j(b && s.description_edit || s.description, /* @__PURE__ */ o("strong", { children: N }, "account")),
|
|
106
|
+
errorText: $ ? c.whole_number_error : U ? c.save_error : void 0,
|
|
107
|
+
handleInputChange: (_) => {
|
|
108
|
+
M(_), y(!1);
|
|
108
109
|
},
|
|
109
|
-
handleInputClick:
|
|
110
|
+
handleInputClick: t ? () => E(d.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED) : void 0,
|
|
110
111
|
handleModalClose: L,
|
|
111
112
|
handlePrimaryAction: () => {
|
|
112
113
|
W();
|
|
113
114
|
},
|
|
114
115
|
handleSecondaryAction: L,
|
|
115
|
-
inputLabel:
|
|
116
|
+
inputLabel: s.input_label,
|
|
116
117
|
inputValue: f,
|
|
117
118
|
isOpen: !0,
|
|
118
|
-
isPrimaryDisabled:
|
|
119
|
-
primaryText:
|
|
120
|
-
secondaryText:
|
|
121
|
-
subtitle:
|
|
119
|
+
isPrimaryDisabled: C || !I,
|
|
120
|
+
primaryText: e.save_button,
|
|
121
|
+
secondaryText: t ? e.cancel_button : void 0,
|
|
122
|
+
subtitle: t && i.primary_account ? /* @__PURE__ */ O(k, {
|
|
122
123
|
sx: {
|
|
123
124
|
alignItems: "center",
|
|
124
125
|
flexDirection: "row",
|
|
125
126
|
gap: 8
|
|
126
127
|
},
|
|
127
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ o(uo, {
|
|
128
129
|
alt: "",
|
|
129
130
|
institutionGuid: i.primary_account.institution_guid ?? "",
|
|
130
131
|
size: 16
|
|
131
|
-
}), /* @__PURE__ */
|
|
132
|
+
}), /* @__PURE__ */ o(H, {
|
|
132
133
|
color: "text.secondary",
|
|
133
134
|
uppercase: !0,
|
|
134
135
|
variant: "body2",
|
|
135
|
-
children:
|
|
136
|
+
children: N
|
|
136
137
|
})]
|
|
137
138
|
}) : void 0,
|
|
138
|
-
title:
|
|
139
|
-
unit: o.unit
|
|
139
|
+
title: b && s.title_edit || s.title
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
export {
|
|
143
|
-
|
|
143
|
+
ko as AmountInputModalBlock
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
//# sourceMappingURL=AmountInputModalBlock.es.js.map
|
|
@@ -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 { useAnalyticsEvent } from '../../analytics'\nimport { useBeatActions } from '../../beatActions'\nimport { useCtaHandler } from '../../ctaActions'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useOpenedCta } from '../useOpenedCta'\n\nimport { CreateBudgetDialog } from './CreateBudgetDialog'\nimport {\n AMOUNT_SETTINGS,\n CREATE_BUDGET_VARIANT,\n findLowBalanceProfile,\n isAmountInputVariant,\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 { closeActionDrawer } = useInsightsV2Store()\n const categoryStore = useCategoryStore()\n const openedCta = useOpenedCta(beat)\n // Read once on open: a refreshed beat must not swap the dialog under its snackbar.\n const [variant] = React.useState(() => resolveAmountInputVariant(openedCta))\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/** One amount or percentage setting, per its `AMOUNT_SETTINGS` entry (`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 setting = isAmountInputVariant(variant) ? AMOUNT_SETTINGS[variant] : undefined\n const source = setting?.source\n const isLowBalance = source?.kind === 'lowBalanceProfile'\n\n const lowBalanceProfile = isLowBalance\n ? findLowBalanceProfile(settingsStore.notificationProfiles, beat.primary_account_guid)\n : undefined\n const savedAmount =\n source?.kind === 'insightProfile'\n ? userInsightProfile?.[source.field]\n : lowBalanceProfile?.threshold\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 ?? setting?.defaultValue)\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 errorCopy = setting ? copy?.[setting.errorKey] : undefined\n const hasCopy =\n !!variantCopy?.title &&\n !!variantCopy.description &&\n !!variantCopy.input_label &&\n !!errorCopy &&\n !!copy?.save_error &&\n !!commonCopy?.save_button &&\n (!setting?.hasCancel || !!commonCopy.cancel_button) &&\n !!commonCopy.close_aria\n const hasProfile = isLowBalance ? !!lowBalanceProfile : !!userInsightProfile\n\n if (!copy || !setting || !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 : !setting\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(setting.analytics.cancel)\n closeActionDrawer()\n }\n\n const { inputSelected } = setting.analytics\n const isEdit = setting.hasEditCopy && !!savedAmount\n const accountName = beat.primary_account ? getAccountDisplayName(beat.primary_account) : ''\n const isValid = setting.isValid(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 =\n setting.source.kind === 'insightProfile'\n ? await runHandler(\n 'updateUserInsightProfile',\n { fields: { [setting.source.field]: amount } },\n { analytics: setting.analytics.save },\n )\n : await runHandler(\n 'updateNotificationProfileThreshold',\n { profileGuid: lowBalanceProfile?.guid, threshold: amount },\n { analytics: setting.analytics.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 ? errorCopy : saveFailed ? copy.save_error : undefined}\n handleInputChange={(next) => {\n setTyped(next)\n setSaveFailed(false)\n }}\n handleInputClick={inputSelected ? () => fireAnalyticsEvent(inputSelected) : undefined}\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={setting.hasCancel ? commonCopy.cancel_button : undefined}\n subtitle={\n setting.showsAccount && 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 unit={setting.unit}\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,gBAAA,EAAC,IAAD;AAAA,UAAI,IAAI;AAAA,UAAY,UAAA;AAAA,QAAY,CAAA;AAAA,QAC5C,gBAAA,EAAC,IAAD;AAAA,UACE,cAAY,KAAkB;AAAA,UAC9B,SAAS;AAAA,UACT,IAAI;AAAA,YAAE,UAAU;AAAA,YAAY,OAAO;AAAA,YAAG,KAAK;AAAA,UAAG;AAAA,UAE9C,UAAA,gBAAA,EAAC,IAAD;AAAA,YAAM,MAAK;AAAA,YAAQ,IAAI,EAAE,OAAO,gBAAgB;AAAA,UAAI,CAAA;AAAA,QAC1C,CAAA;AAAA,QACX;AAAA,MACI;AAAA;EACE,CAAA;AAEf,GAGa,KAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,mBAAA,EAAA,IAAsB,EAAmB,GAC3C,IAAgB,EAAiB,GACjC,IAAY,GAAa,CAAI,GAE7B,CAAC,CAAA,IAAW,EAAM,SAAA,MAAe,GAA0B,CAAS,CAAC,GACrE,IAAiB,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AC;AAAA,IAChC,aAAa,EAAW;AAAA,IACxB,eAAe,EAAQ,YAAY,EAAW,gBAAgB;AAAA,IAC9D,UACE,EAAQ,gBAAgB,EAAK,kBAC3B,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,IACzD,MAAM,EAAQ;AAAA,EACf,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 { useOpenedCta } from '../useOpenedCta'\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 { closeActionDrawer } = useInsightsV2Store()\n const categoryStore = useCategoryStore()\n const openedCta = useOpenedCta(beat)\n // Read once on open: a refreshed beat must not swap the dialog under its snackbar.\n const [variant] = React.useState(() => resolveAmountInputVariant(openedCta))\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=\"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