@mx-cartographer/experiences 6.26.18-alpha.mega4 → 6.26.18-alpha.sms1

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 (97) hide show
  1. package/dist/common/context/hooks.d.ts +13 -13
  2. package/dist/help/components/content/section/index.d.ts +15 -15
  3. package/dist/index.d.ts +22 -0
  4. package/dist/index.es.js +30335 -0
  5. package/dist/index.es.js.map +1 -0
  6. package/package.json +3 -155
  7. package/dist/Account-DM32_5k9.mjs +0 -30
  8. package/dist/AccountDetailsContent-B_qRSB8l.mjs +0 -677
  9. package/dist/AccountDetailsHeader-CAm6ADMq.mjs +0 -119
  10. package/dist/AccountFields-Bb4pds0q.mjs +0 -135
  11. package/dist/AccountListItem-G7iAesaO.mjs +0 -90
  12. package/dist/AccountStore-RSanus_m.mjs +0 -230
  13. package/dist/Accounts-BfAQRG8R.mjs +0 -9
  14. package/dist/BeatApi-DLu87ijw.mjs +0 -21
  15. package/dist/BeatStore-By4aGoRM.mjs +0 -81
  16. package/dist/BudgetUtil-DcqclhiQ.mjs +0 -101
  17. package/dist/CashflowStore-D9Dpuz7X.mjs +0 -91
  18. package/dist/Category-5S6uwuXz.mjs +0 -301
  19. package/dist/CategorySelectorDrawer-DgrePTRg.mjs +0 -397
  20. package/dist/CategoryStore-B5EW6I1d.mjs +0 -183
  21. package/dist/CategoryUtil-DRyruNgi.mjs +0 -78
  22. package/dist/ConnectDrawer-DPnfeIfn.mjs +0 -508
  23. package/dist/ConnectionsDrawer-BCzpuNsK.mjs +0 -52
  24. package/dist/CurrencyInput-DzsPiUsU.mjs +0 -83
  25. package/dist/CurrencyText-YUhH2caW.mjs +0 -20
  26. package/dist/DateUtil-BcuH7ErC.mjs +0 -48
  27. package/dist/DebtsStore-C6VcBnpG.mjs +0 -60
  28. package/dist/Dialog-CWW597AF.mjs +0 -123
  29. package/dist/Donut-1UMNcG67.mjs +0 -57
  30. package/dist/Drawer-kEE73B87.mjs +0 -113
  31. package/dist/EmptyState-Dcb-o2tl.mjs +0 -55
  32. package/dist/Fetch-CkFKy79O.mjs +0 -116
  33. package/dist/FinstrongStore-mkALvztw.mjs +0 -101
  34. package/dist/GoalStore-DyCr4wNc.mjs +0 -263
  35. package/dist/HeaderCell-DjuifqHJ.mjs +0 -6
  36. package/dist/Help-DhcC-C05.mjs +0 -320
  37. package/dist/Help-toqAK5eD.mjs +0 -3173
  38. package/dist/IconBacking-B9oC6uL2.mjs +0 -39
  39. package/dist/InvestmentUtil-jOyOgzIB.mjs +0 -134
  40. package/dist/LineChart-CQWu5KoO.mjs +0 -403
  41. package/dist/ListItemAction-Df3OPMOW.mjs +0 -69
  42. package/dist/Loader-Dp1P2gNw.mjs +0 -14
  43. package/dist/Localization-2MODESHW.mjs +0 -30
  44. package/dist/ManageIncome-BVt_XQbo.mjs +0 -535
  45. package/dist/MerchantStore-DVH-QOf0.mjs +0 -37
  46. package/dist/MicroWidgetContainer-DaLW43tE.mjs +0 -45
  47. package/dist/MiniWidgetContainer-BcNPxZt2.mjs +0 -39
  48. package/dist/NetWorthStore-DE8CQBMM.mjs +0 -150
  49. package/dist/Notification-AMGWM1Al.mjs +0 -78
  50. package/dist/NotificationSettings-CPZN0l8X.mjs +0 -667
  51. package/dist/NotificationStore-DHtSGySy.mjs +0 -67
  52. package/dist/NumberFormatting-CtWHhyBX.mjs +0 -40
  53. package/dist/OriginalBalanceAction-s9sUxofR.mjs +0 -115
  54. package/dist/RecurringSettings-DIEsympT.mjs +0 -57
  55. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +0 -263
  56. package/dist/RepeatingTransaction-BPWfaB3f.mjs +0 -282
  57. package/dist/SearchBox-B2_zLv8-.mjs +0 -42
  58. package/dist/SettingsStore-CE7jDVFL.mjs +0 -265
  59. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +0 -69
  60. package/dist/SpendingData-ByFCw95X.mjs +0 -53
  61. package/dist/StatusBar-BK_uYHAB.mjs +0 -30
  62. package/dist/TabContentContainer-j01JYR_7.mjs +0 -21
  63. package/dist/Transaction-C-5-Iuab.mjs +0 -312
  64. package/dist/TransactionApi-DbbcjI2L.mjs +0 -86
  65. package/dist/TransactionDetails-B5qfs9Zh.mjs +0 -1283
  66. package/dist/TransactionStore-BWi6_2Ny.mjs +0 -669
  67. package/dist/TrendsStore-Borh98aN.mjs +0 -448
  68. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +0 -1959
  69. package/dist/WidgetContainer-CmGNZW0M.mjs +0 -548
  70. package/dist/accounts/index.es.js +0 -752
  71. package/dist/analytics/index.es.js +0 -171
  72. package/dist/budgets/index.es.js +0 -1070
  73. package/dist/cashflow/index.es.js +0 -1098
  74. package/dist/categories/index.es.js +0 -9
  75. package/dist/common/index.es.js +0 -1451
  76. package/dist/dashboard/index.es.js +0 -181
  77. package/dist/debts/index.es.js +0 -1460
  78. package/dist/exportTransactionsToCSV-j4g8bdVZ.mjs +0 -47
  79. package/dist/finstrong/index.es.js +0 -1455
  80. package/dist/goals/index.es.js +0 -1209
  81. package/dist/help/index.es.js +0 -14
  82. package/dist/hooks-ClhFlg78.mjs +0 -71
  83. package/dist/insights/index.d.ts +0 -1
  84. package/dist/insights/index.es.js +0 -4
  85. package/dist/investments/index.es.js +0 -1638
  86. package/dist/merchants/index.es.js +0 -79
  87. package/dist/microinsights/index.es.js +0 -16
  88. package/dist/networth/index.es.js +0 -542
  89. package/dist/notifications/index.es.js +0 -192
  90. package/dist/recurringtransactions/index.es.js +0 -879
  91. package/dist/settings/index.es.js +0 -879
  92. package/dist/spending/index.es.js +0 -570
  93. package/dist/transactions/index.es.js +0 -587
  94. package/dist/trends/index.es.js +0 -1103
  95. package/dist/useCombineEvents-DaDBSR_1.mjs +0 -92
  96. package/dist/useDimensions-27p2evRx.mjs +0 -36
  97. package/dist/useScreenSize-B6JyS_Lj.mjs +0 -36
@@ -1,1209 +0,0 @@
1
- import { T as i, M as G, C as fe, G as pe } from "../GoalStore-DyCr4wNc.mjs";
2
- import { a as $n, b as Un } from "../GoalStore-DyCr4wNc.mjs";
3
- import { jsxs as s, jsx as e, Fragment as Y } from "react/jsx-runtime";
4
- import T from "react";
5
- import { observer as M } from "mobx-react-lite";
6
- import Be from "@mui/material/Alert";
7
- import Le from "@mui/material/Snackbar";
8
- import b from "@mui/material/Stack";
9
- import se from "@mui/material/Tab";
10
- import We from "@mui/material/Tabs";
11
- import { Text as y, H2 as me, P as V, H3 as Ve, Icon as Pe, InstitutionLogo as ae } from "@mxenabled/mxui";
12
- import _e from "@mui/material/Button";
13
- import Te from "@mui/material/Card";
14
- import ye from "@mui/material/CardActionArea";
15
- import Ae from "@mui/material/CardContent";
16
- import he from "@mui/material/Unstable_Grid2";
17
- import re from "@mui/material/Avatar";
18
- import He from "@mui/material/CardHeader";
19
- import { Payments as Ce, NoteStack as Se, Person as Re, ChevronRight as B, CheckCircle as je, Icon as ge, ExpandLess as Fe, ExpandMore as ze, AddBox as Ee, Trophy as Xe } from "@mxenabled/mx-icons";
20
- import { fromUnixTime as q } from "date-fns/fromUnixTime";
21
- import { b as N } from "../Localization-2MODESHW.mjs";
22
- import { a as $e, f as v } from "../NumberFormatting-CtWHhyBX.mjs";
23
- import { f as ee, D as te, a as Ue } from "../Dialog-CWW597AF.mjs";
24
- import { u as A, i as x, c as H, o as ve, g as xe, a as Ie } from "../hooks-ClhFlg78.mjs";
25
- import { u as ue } from "../useScreenSize-B6JyS_Lj.mjs";
26
- import { S as Ye } from "../StatusBar-BK_uYHAB.mjs";
27
- import R from "@mui/material/Divider";
28
- import L from "@mui/material/List";
29
- import { L as ne } from "../ListItemAction-Df3OPMOW.mjs";
30
- import { C as Ge } from "../CurrencyInput-DzsPiUsU.mjs";
31
- import w from "@mui/material/ListItem";
32
- import D from "@mui/material/ListItemButton";
33
- import K from "@mui/material/ListItemText";
34
- import Ze from "@mui/icons-material/DragHandle";
35
- import { DataGridPro as qe } from "@mui/x-data-grid-pro";
36
- import { D as j } from "../Drawer-kEE73B87.mjs";
37
- import P from "@mui/material/ListItemAvatar";
38
- import Je from "@mui/material/Collapse";
39
- import Qe from "@mui/material/ListItemIcon";
40
- import et from "@mui/material/Checkbox";
41
- import { A as be } from "../ConnectDrawer-DPnfeIfn.mjs";
42
- import { u as tt, A as nt } from "../AccountDetailsHeader-CAm6ADMq.mjs";
43
- import { A as ot } from "../AccountDetailsContent-B_qRSB8l.mjs";
44
- import Ne from "@mui/material/TextField";
45
- import { M as at, I as rt, O as it } from "../OriginalBalanceAction-s9sUxofR.mjs";
46
- import { getUnixTime as lt } from "date-fns/getUnixTime";
47
- import { isValid as st } from "date-fns/isValid";
48
- import { AdapterDateFns as ct } from "@mui/x-date-pickers/AdapterDateFnsV3";
49
- import { DatePicker as dt } from "@mui/x-date-pickers";
50
- import { LocalizationProvider as mt } from "@mui/x-date-pickers/LocalizationProvider";
51
- import { E as _t } from "../EmptyState-Dcb-o2tl.mjs";
52
- import { A as Z, W as ut } from "../WidgetContainer-CmGNZW0M.mjs";
53
- import { L as ke } from "../Loader-Dp1P2gNw.mjs";
54
- import pt from "@mui/material/Stack/Stack";
55
- import ht from "@mui/material/Box";
56
- import gt from "@mui/material/styles/useTheme";
57
- import { S as bt } from "../SingleSegmentDonut-BgbLgwHi.mjs";
58
- import { M as ft } from "../MicroWidgetContainer-DaLW43tE.mjs";
59
- function ce({ title: t, subtitle: n }) {
60
- return /* @__PURE__ */ s(b, { children: [
61
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t }),
62
- /* @__PURE__ */ e(y, { sx: { fontWeight: 400 }, variant: "Body", children: n })
63
- ] });
64
- }
65
- function we(t, n) {
66
- const d = n.track_type === i.DEBT_TRACK ? n.initial_amount : n.amount;
67
- let r = n.current_amount / d;
68
- r > 1 && (r = 1), r = n.track_type === i.DEBT_TRACK ? 1 - r : r, isNaN(r) && (r = 1);
69
- let u = "chart.chart1", a = "common.black";
70
- n.track_type === i.DEBT_TRACK ? (a = "common.white", u = "chart.chart5") : n.track_type === i.RETIREMENT_TRACK && (u = "chart.chart6");
71
- const _ = {
72
- style: "percent",
73
- minimumFractionDigits: 0,
74
- maximumFractionDigits: 0
75
- }, p = n.is_complete ? n.completed_at : n.projected_to_complete_at, c = p ? q(p) : /* @__PURE__ */ new Date(), h = N(
76
- t.goal_percentage,
77
- $e(r, _)
78
- ), o = N(
79
- n.is_complete ? t.completed_label : t.goal_projection,
80
- ee(c, te.MONTH_SHORT_YEAR)
81
- );
82
- return {
83
- backgroundColor: u,
84
- color: a,
85
- percentage: r,
86
- percentageText: h,
87
- projectedText: o
88
- };
89
- }
90
- function Tt(t) {
91
- return [
92
- {
93
- bgcolor: "chart.chart1",
94
- icon: "attach_money",
95
- label: t.saving_goal_label,
96
- description: t.saving_goal_description,
97
- subTypes: [
98
- {
99
- icon: "ecg_heart",
100
- label: t.saving_goal_emergency_fund,
101
- metaType: G.EMERGENCY_FUND
102
- },
103
- {
104
- icon: "directions_car",
105
- label: t.saving_gaol_automobile,
106
- metaType: G.AUTOMOBILE
107
- },
108
- { icon: "school", label: t.saving_goal_college, metaType: G.COLLEGE },
109
- { icon: "home", label: t.saving_goal_home, metaType: G.HOUSE },
110
- {
111
- icon: "mountain_flag",
112
- label: t.saving_goal_recreational,
113
- metaType: G.RECREATIONAL_VEHICLE
114
- },
115
- { icon: "airplane_ticket", label: t.saving_goal_vacation, metaType: G.VACATION },
116
- {
117
- icon: "desktop_windows",
118
- label: t.saving_goal_electronic,
119
- metaType: G.ELECTRONIC
120
- },
121
- { icon: "payments", label: t.saving_goal_other, metaType: G.OTHER }
122
- ],
123
- type: i.SAVINGS_TRACK
124
- },
125
- {
126
- bgcolor: "chart.chart5",
127
- icon: "note_stack",
128
- label: t.debt_goal_label,
129
- description: t.debt_goal_description,
130
- subTypes: [],
131
- type: i.DEBT_TRACK
132
- },
133
- {
134
- bgcolor: "chart.chart6",
135
- icon: "person",
136
- label: t.retirement_goal_label,
137
- description: t.retirement_goal_description,
138
- subTypes: [],
139
- type: i.RETIREMENT_TRACK
140
- }
141
- ];
142
- }
143
- const yt = (t, n) => {
144
- switch (t) {
145
- case i.DEBT_TRACK:
146
- return N(n.zero_state_ongoing, "debt");
147
- case i.SAVINGS_TRACK:
148
- return N(n.zero_state_ongoing, "saving");
149
- default:
150
- return N(n.zero_state_ongoing, "retirement");
151
- }
152
- }, At = (t, n) => n ? v(t, t < 1e3 ? "0" : "0.00a").replace(
153
- /(\d+)(?:\.0+|(\.\d*?[1-9])0*)([a-zA-Z]* ?\$?)/g,
154
- "$1$2$3"
155
- ) : v(t, "0,0.00"), De = M(
156
- ({ goal: t, isInDrawer: n = !1, onClick: d }) => {
157
- const { goals: r } = A(), { isMobile: u, isTablet: a } = ue(), _ = u || a, {
158
- backgroundColor: p,
159
- color: c,
160
- percentage: h,
161
- percentageText: o,
162
- projectedText: g
163
- } = we(r, t), l = t.track_type === i.DEBT_TRACK ? t.initial_amount : t.amount, m = [
164
- {
165
- color: p,
166
- percentage: `${h}`
167
- }
168
- ];
169
- let f = /* @__PURE__ */ e(Ce, {});
170
- return t.track_type === i.DEBT_TRACK ? f = /* @__PURE__ */ e(Se, {}) : t.track_type === i.RETIREMENT_TRACK && (f = /* @__PURE__ */ e(Re, {})), /* @__PURE__ */ e(Te, { elevation: 2, children: /* @__PURE__ */ s(ye, { disabled: !d, onClick: d, children: [
171
- /* @__PURE__ */ e(
172
- He,
173
- {
174
- avatar: /* @__PURE__ */ e(re, { sx: { bgcolor: p, color: c, height: 48, width: 48 }, variant: "rounded", children: f }),
175
- subheader: /* @__PURE__ */ e(y, { variant: n || _ ? "H3" : "H2", children: `${v(t.current_amount, _ ? "0,0" : "0,0.00")} / ${At(
176
- l,
177
- _
178
- )}` }),
179
- title: /* @__PURE__ */ e(me, { color: "text.secondary", fontWeight: 400, variant: "Body", children: t.name })
180
- }
181
- ),
182
- /* @__PURE__ */ e(Ae, { sx: { pt: 0 }, children: /* @__PURE__ */ s(b, { gap: 6, children: [
183
- /* @__PURE__ */ e(Ye, { data: m, height: 24 }),
184
- /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
185
- /* @__PURE__ */ e(y, { color: "text.secondary", variant: "XSmall", children: o }),
186
- t.projected_to_complete_at && /* @__PURE__ */ e(y, { color: "text.secondary", variant: "XSmall", children: g })
187
- ] })
188
- ] }) })
189
- ] }) });
190
- }
191
- ), Ct = M(({ trackType: t }) => {
192
- const { goals: n } = A(), { setAlert: d, monthlyCashFlowProfile: r, updateMonthlyCashFlowProfile: u } = x(), a = T.useMemo(() => {
193
- let h = 0;
194
- return t === i.SAVINGS_TRACK ? h = r?.amount_allocated_for_savings_goals || 0 : t === i.DEBT_TRACK ? h = r?.amount_allocated_for_debt_goals || 0 : t === i.RETIREMENT_TRACK && (h = r?.amount_allocated_for_retirement_goals || 0), h;
195
- }, [r]), [_, p] = T.useState(a), c = async () => {
196
- if (r) {
197
- const h = { ...r };
198
- t === i.SAVINGS_TRACK ? h.amount_allocated_for_savings_goals = _ : t === i.DEBT_TRACK ? h.amount_allocated_for_debt_goals = _ : t === i.RETIREMENT_TRACK && (h.amount_allocated_for_retirement_goals = _), await u(h), d(n.alert_contribution_updated);
199
- }
200
- };
201
- return /* @__PURE__ */ e(b, { bgcolor: "background.paper", children: /* @__PURE__ */ e(
202
- ne,
203
- {
204
- isSaveDisabled: !_ || isNaN(_),
205
- label: n.contribution_label,
206
- onCancel: () => p(a),
207
- onSave: c,
208
- primaryText: n.contribution_label,
209
- secondaryText: v(a, "0,0.00"),
210
- children: /* @__PURE__ */ e(
211
- Ge,
212
- {
213
- amount: _,
214
- autoFocus: !0,
215
- error: !_ || isNaN(_),
216
- fullWidth: !0,
217
- minAmount: 0,
218
- setAmount: (h) => p(isNaN(Number(h)) ? _ : Number(h)),
219
- sx: { ".MuiTypography-Body": { p: 0 } }
220
- }
221
- )
222
- }
223
- ) });
224
- }), St = ({ goals: t }) => {
225
- const { goals: n, common: d } = A(), { reorderGoals: r, setAlert: u } = x(), [a, _] = T.useState(!1), [p, c] = T.useState(t.map((m) => ({ ...m })));
226
- T.useEffect(() => {
227
- a && c(t.map((m) => ({ ...m })));
228
- }, [a]);
229
- const h = [
230
- {
231
- field: "name",
232
- flex: 1,
233
- renderCell: (m) => {
234
- const f = m.row;
235
- return /* @__PURE__ */ s(b, { children: [
236
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: f.name }),
237
- /* @__PURE__ */ e(y, { variant: "XSmall", children: N(
238
- n.goal_projection,
239
- ee(
240
- q(f.projected_to_complete_at || 0),
241
- te.MONTH_SHORT_YEAR
242
- )
243
- ) })
244
- ] });
245
- },
246
- sortable: !1
247
- },
248
- {
249
- align: "right",
250
- field: "amount",
251
- minWidth: 140,
252
- renderCell: (m) => {
253
- const f = m.row;
254
- return /* @__PURE__ */ e(y, { bold: !0, sx: { mr: 12 }, variant: "Body", children: v(f.amount, "0,0.00") });
255
- },
256
- sortable: !1
257
- }
258
- ], o = p.map((m) => ({
259
- id: m.guid,
260
- isHovering: !1,
261
- __reorder__: m.name,
262
- ...m
263
- })), g = ({ oldIndex: m, targetIndex: f }) => {
264
- const E = [...p];
265
- E.splice(f, 0, E.splice(m, 1)[0]);
266
- for (let C = 0; C < E.length; C += 1)
267
- E[C].position = C + 1;
268
- c(E);
269
- }, l = async () => {
270
- await r(p), u(n.alert_goals_reordered), _(!1);
271
- };
272
- return /* @__PURE__ */ s(b, { children: [
273
- /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(D, { onClick: () => _(!0), children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ s(
274
- b,
275
- {
276
- alignItems: "center",
277
- color: "action.active",
278
- direction: "row",
279
- justifyContent: "space-between",
280
- children: [
281
- /* @__PURE__ */ e(y, { color: "primary.light", variant: "Body", children: n.reorder_goals_title }),
282
- /* @__PURE__ */ e(B, { color: "primary" })
283
- ]
284
- }
285
- ) }) }) }),
286
- /* @__PURE__ */ e(
287
- j,
288
- {
289
- ariaLabelClose: d.close_aria,
290
- isOpen: a,
291
- onClose: () => _(!1),
292
- onPrimaryAction: l,
293
- title: n.reorder_goals_title,
294
- children: /* @__PURE__ */ s(b, { children: [
295
- /* @__PURE__ */ e(V, { sx: { my: 12, mx: 24 }, children: n.reorder_goals_description }),
296
- /* @__PURE__ */ e(
297
- qe,
298
- {
299
- columnHeaderHeight: 0,
300
- columns: h,
301
- disableColumnFilter: !0,
302
- disableColumnMenu: !0,
303
- hideFooter: !0,
304
- onRowOrderChange: g,
305
- rowReordering: !0,
306
- rows: o,
307
- slots: {
308
- rowReorderIcon: () => /* @__PURE__ */ e(Ze, { sx: { ml: 12 } })
309
- //TODO: Add to mx-icons
310
- },
311
- sx: {
312
- "& .MuiDataGrid-columnHeaders": {
313
- borderBottomWidth: 0
314
- }
315
- }
316
- }
317
- )
318
- ] })
319
- }
320
- )
321
- ] });
322
- }, Rt = ({ goal: t, index: n }) => {
323
- const { goals: d } = A();
324
- return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(D, { children: [
325
- t.track_type !== i.RETIREMENT_TRACK && /* @__PURE__ */ e(
326
- P,
327
- {
328
- sx: {
329
- alignItems: "center",
330
- display: "flex",
331
- justifyContent: "center",
332
- ".MuiAvatar-root": { height: "16px", width: "16px" }
333
- },
334
- children: /* @__PURE__ */ e(re, { sx: { bgcolor: "text.primary", height: "16px", width: "16px" }, children: /* @__PURE__ */ e(y, { bold: !0, variant: "XSmall", children: n + 1 }) })
335
- }
336
- ),
337
- /* @__PURE__ */ e(K, { primaryTypographyProps: { variant: "Body" }, children: /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
338
- /* @__PURE__ */ s(b, { children: [
339
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.name }),
340
- /* @__PURE__ */ e(y, { variant: "XSmall", children: N(
341
- d.goal_projection,
342
- ee(
343
- q(t.projected_to_complete_at || 0),
344
- te.MONTH_SHORT_YEAR
345
- )
346
- ) })
347
- ] }),
348
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: v(t.amount, "0,0.00") })
349
- ] }) })
350
- ] }) });
351
- }, Et = ({ goal: t }) => {
352
- const { goals: n } = A();
353
- return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(D, { children: [
354
- /* @__PURE__ */ e(P, { sx: { alignItems: "center", display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ e(je, { color: "success", filled: !0, size: 20 }) }),
355
- /* @__PURE__ */ e(K, { primaryTypographyProps: { variant: "Body" }, children: /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
356
- /* @__PURE__ */ s(b, { children: [
357
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.name }),
358
- /* @__PURE__ */ e(y, { variant: "XSmall", children: N(
359
- n.completed_label,
360
- ee(
361
- q(t.completed_at || 0),
362
- te.MONTH_SHORT_YEAR
363
- )
364
- ) })
365
- ] }),
366
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: v(t.amount, "0,0.00") })
367
- ] }) })
368
- ] }) }, t.guid);
369
- }, vt = ({ trackType: t }) => {
370
- const { goals: n, common: d } = A(), { orderedGoals: r } = x(), u = r.filter((m) => m.track_type === t), a = u.filter(
371
- (m) => m.track_type === i.SAVINGS_TRACK && !m.has_been_spent || m.track_type !== i.SAVINGS_TRACK && !m.is_complete
372
- ), _ = u.filter(
373
- (m) => m.track_type === i.SAVINGS_TRACK && m.has_been_spent || m.track_type !== i.SAVINGS_TRACK && m.is_complete
374
- ), [p, c] = T.useState(!1);
375
- let h = n.manage_saving_goals, o = n.manage_saving_drawer_title, g = n.manage_saving_title, l = n.manage_saving_description;
376
- return t === i.DEBT_TRACK ? (h = n.manage_debt_goals, o = n.manage_debt_drawer_title, g = n.manage_debt_title, l = n.manage_debt_description) : t === i.RETIREMENT_TRACK && (h = n.manage_retirement_goals, o = n.manage_retirement_drawer_title, g = n.manage_retirement_title, l = n.manage_retirement_description), /* @__PURE__ */ s(b, { children: [
377
- /* @__PURE__ */ e(_e, { endIcon: /* @__PURE__ */ e(B, {}), onClick: () => c(!0), children: h }),
378
- /* @__PURE__ */ e(
379
- j,
380
- {
381
- ariaLabelClose: d.close_aria,
382
- isOpen: p,
383
- onClose: () => c(!1),
384
- title: o,
385
- children: /* @__PURE__ */ s(b, { children: [
386
- /* @__PURE__ */ s(b, { m: 24, children: [
387
- /* @__PURE__ */ e(Ve, { children: g }),
388
- /* @__PURE__ */ e(V, { color: "text.secondary", sx: { textWrap: "wrap" }, variant: "ParagraphSmall", children: l })
389
- ] }),
390
- /* @__PURE__ */ e(Ct, { trackType: t }),
391
- /* @__PURE__ */ e(y, { bold: !0, sx: { mb: 4, mx: 24, mt: 12 }, variant: "XSmall", children: n.goal_priority }),
392
- /* @__PURE__ */ s(L, { sx: { bgcolor: "background.paper" }, children: [
393
- a.map((m, f) => {
394
- const E = f >= a.length - 1;
395
- return /* @__PURE__ */ s(b, { children: [
396
- /* @__PURE__ */ e(Rt, { goal: m, index: f }),
397
- /* @__PURE__ */ e(
398
- R,
399
- {
400
- variant: E && t === i.RETIREMENT_TRACK ? "fullWidth" : "inset"
401
- }
402
- )
403
- ] }, `ongoing-${m.guid}`);
404
- }),
405
- t !== i.RETIREMENT_TRACK && /* @__PURE__ */ s(b, { children: [
406
- /* @__PURE__ */ e(St, { goals: a }),
407
- /* @__PURE__ */ e(R, {})
408
- ] })
409
- ] }),
410
- t !== i.RETIREMENT_TRACK && _.length > 0 && /* @__PURE__ */ s(b, { children: [
411
- /* @__PURE__ */ e(y, { bold: !0, sx: { mb: 4, mx: 24, mt: 12 }, variant: "XSmall", children: n.complete_title }),
412
- /* @__PURE__ */ e(L, { sx: { bgcolor: "background.paper" }, children: _.map((m, f) => {
413
- const E = f > a.length - 1;
414
- return /* @__PURE__ */ s(b, { children: [
415
- /* @__PURE__ */ e(Et, { goal: m }),
416
- /* @__PURE__ */ e(R, { variant: E ? "fullWidth" : "inset" })
417
- ] }, `complete-${m.guid}`);
418
- }) })
419
- ] })
420
- ] })
421
- }
422
- )
423
- ] });
424
- }, de = M(({ trackType: t, onAddGoals: n }) => {
425
- const { isMobile: d } = ue(), { goals: r } = A(), { orderedGoals: u, setSelectedGoal: a } = x(), _ = u.filter((o) => o.track_type === t), p = _.filter(
426
- (o) => o.track_type === i.SAVINGS_TRACK && !o.has_been_spent || o.track_type !== i.SAVINGS_TRACK && !o.is_complete
427
- ), c = _.filter(
428
- (o) => o.track_type === i.SAVINGS_TRACK && o.has_been_spent || o.track_type !== i.SAVINGS_TRACK && o.is_complete
429
- ), h = t === i.DEBT_TRACK ? r.zero_state_complete_debt : r.zero_state_complete_savings;
430
- return /* @__PURE__ */ s(b, { mt: 16, mx: d ? 24 : 0, children: [
431
- /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", justifyContent: "space-between", mb: 8, children: [
432
- /* @__PURE__ */ e(y, { color: "text.secondary", variant: "Small", children: r.ongoing_title }),
433
- /* @__PURE__ */ e(vt, { trackType: t })
434
- ] }),
435
- p.length > 0 ? /* @__PURE__ */ e(he, { container: !0, spacing: 24, children: p.map((o, g, l) => (
436
- // Goal should be full width in mobile or if it's the first goal (unless there are 2)
437
- /* @__PURE__ */ e(he, { xs: d || g === 0 && l.length !== 2 ? 12 : 6, children: /* @__PURE__ */ e(De, { goal: o, onClick: () => a(o) }, o.guid) }, g)
438
- )) }) : /* @__PURE__ */ s(
439
- b,
440
- {
441
- alignItems: "center",
442
- bgcolor: "background.default",
443
- borderRadius: 2,
444
- height: 166,
445
- justifyContent: "center",
446
- py: 18,
447
- children: [
448
- /* @__PURE__ */ e(
449
- V,
450
- {
451
- sx: (o) => ({
452
- color: "text.secondary",
453
- [o.breakpoints.down("sm")]: {
454
- px: 10
455
- },
456
- width: { sm: 381 }
457
- }),
458
- variant: "Small",
459
- children: yt(t, r)
460
- }
461
- ),
462
- /* @__PURE__ */ e(_e, { onClick: n, sx: { mt: 16, width: { sm: 224 } }, variant: "contained", children: r.add_goals_button })
463
- ]
464
- }
465
- ),
466
- t !== i.RETIREMENT_TRACK && /* @__PURE__ */ s(b, { gap: 16, mt: 48, children: [
467
- /* @__PURE__ */ e(y, { color: "text.secondary", variant: "Small", children: r.complete_title }),
468
- c.length === 0 && /* @__PURE__ */ e(b, { alignItems: "center", bgcolor: "background.default", borderRadius: 2, py: 18, children: /* @__PURE__ */ e(
469
- V,
470
- {
471
- sx: (o) => ({
472
- color: "text.secondary",
473
- width: { sm: 393 },
474
- [o.breakpoints.down("sm")]: {
475
- px: 10
476
- }
477
- }),
478
- variant: "Small",
479
- children: h
480
- }
481
- ) }),
482
- c.map((o) => /* @__PURE__ */ e(Te, { elevation: 2, children: /* @__PURE__ */ e(ye, { onClick: () => a(o), children: /* @__PURE__ */ e(Ae, { sx: { ":last-child": { pb: 16 } }, children: /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
483
- /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", gap: 6, children: [
484
- /* @__PURE__ */ e(Pe, { color: "success", fill: !0, name: "check_circle", size: 20 }),
485
- /* @__PURE__ */ e(y, { color: "text.secondary", variant: "Body", children: o.name })
486
- ] }),
487
- /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: v(o.amount, "0,0.00") })
488
- ] }) }) }) }, o.guid))
489
- ] })
490
- ] });
491
- }), xt = ({ goalType: t, onClick: n }) => {
492
- const { goals: d } = A(), { bgcolor: r, icon: u, label: a, description: _, subTypes: p, type: c } = t, [h, o] = T.useState(!1), g = p.length > 0;
493
- return /* @__PURE__ */ e(b, { children: /* @__PURE__ */ s(L, { sx: { bgcolor: "background.paper" }, children: [
494
- /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(
495
- D,
496
- {
497
- onClick: g ? () => o(!h) : () => n(
498
- c === i.RETIREMENT_TRACK ? d.retirement : "",
499
- c === i.RETIREMENT_TRACK ? G.RETIREMENT : G.OTHER,
500
- c
501
- ),
502
- children: [
503
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(re, { sx: { bgcolor: r }, variant: "rounded", children: /* @__PURE__ */ e(ge, { name: u, sx: { color: "grey.900" } }) }) }),
504
- /* @__PURE__ */ e(K, { primary: a, secondary: _, sx: { mr: 24 } }),
505
- !g && /* @__PURE__ */ e(B, {}),
506
- g && (h ? /* @__PURE__ */ e(Fe, {}) : /* @__PURE__ */ e(ze, {}))
507
- ]
508
- }
509
- ) }),
510
- /* @__PURE__ */ e(R, { variant: "inset" }),
511
- g && /* @__PURE__ */ e(Je, { in: h, children: /* @__PURE__ */ e(L, { sx: { bgcolor: "background.default" }, children: p.map((l, m) => /* @__PURE__ */ e(w, { sx: { pl: 48 }, children: /* @__PURE__ */ s(D, { onClick: () => n(l.label, l.metaType, c), children: [
512
- /* @__PURE__ */ e(Qe, { sx: { mr: 8 }, children: /* @__PURE__ */ e(ge, { name: l.icon }) }),
513
- /* @__PURE__ */ e(
514
- K,
515
- {
516
- primary: l.label,
517
- primaryTypographyProps: { variant: "Body" }
518
- }
519
- ),
520
- /* @__PURE__ */ e(B, {})
521
- ] }) }, m)) }) })
522
- ] }) });
523
- }, Ke = ({
524
- accounts: t,
525
- isOpen: n,
526
- onClose: d,
527
- onSave: r,
528
- title: u
529
- }) => {
530
- const { goals: a, common: _ } = A(), [p, c] = T.useState([]), h = (o) => {
531
- const g = p.findIndex((m) => m.guid === o.guid), l = [...p];
532
- g >= 0 ? l.splice(g, 1) : l.push(o), c(l);
533
- };
534
- return /* @__PURE__ */ s(
535
- j,
536
- {
537
- ariaLabelClose: _.close_aria,
538
- isOpen: n,
539
- onClose: d,
540
- onPrimaryAction: () => r(p),
541
- title: u,
542
- children: [
543
- /* @__PURE__ */ e(V, { color: "text.secondary", sx: { mx: 24, my: 12 }, children: a.select_debt_accounts_description }),
544
- /* @__PURE__ */ s(L, { sx: { bgcolor: "background.white" }, children: [
545
- /* @__PURE__ */ e(R, { variant: "fullWidth" }),
546
- t.map((o, g) => /* @__PURE__ */ s(T.Fragment, { children: [
547
- /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(D, { onClick: () => h(o), children: [
548
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
549
- ae,
550
- {
551
- alt: o?.name || "",
552
- institutionGuid: o?.institution_guid || ""
553
- }
554
- ) }),
555
- /* @__PURE__ */ e(
556
- K,
557
- {
558
- primary: o.name || o.feed_name,
559
- secondary: v(o.balance || 0, "0,0.00")
560
- }
561
- ),
562
- /* @__PURE__ */ e(et, { checked: p.some((l) => l.guid === o.guid) })
563
- ] }) }),
564
- /* @__PURE__ */ e(R, { variant: g < t.length - 1 ? "inset" : "fullWidth" })
565
- ] }, o.guid))
566
- ] }),
567
- /* @__PURE__ */ e(
568
- fe,
569
- {
570
- description: a.connect_description,
571
- label: a.connect_button,
572
- title: a.connect_title
573
- }
574
- )
575
- ]
576
- }
577
- );
578
- }, It = ({ onClose: t }) => {
579
- const { goals: n } = A(), { addGoal: d, debtGoals: r, setAlert: u, setSelectedGoal: a } = x(), { visibleDebtAccounts: _ } = H(), [p, c] = T.useState(!1), h = Tt(n), o = (l, m, f) => {
580
- f === i.DEBT_TRACK ? c(!0) : a({
581
- amount: 0,
582
- current_amount: 0,
583
- goal_type: pe.SAVE_AMOUNT,
584
- initial_amount: 0,
585
- meta_type: m,
586
- name: l,
587
- track_type: f
588
- });
589
- }, g = async (l) => {
590
- for (const m of l) {
591
- let f = G.CREDIT_CARD;
592
- m.account_type === be.LOAN ? f = G.LOANS : m.account_type === be.LINE_OF_CREDIT && (f = G.LINE_OF_CREDIT), await d({
593
- account_guid: m.guid,
594
- amount: 0,
595
- current_amount: 0,
596
- goal_type: pe.KEEP_BALANCE_BELOW,
597
- initial_amount: m.balance || 0,
598
- interest_rate: m.interest_rate || 0,
599
- meta_type: f,
600
- monthly_payment: m.minimum_payment || 0,
601
- name: m.name || m.feed_name || "",
602
- track_type: i.DEBT_TRACK
603
- }), u(n.alert_goal_added);
604
- }
605
- c(!1), t?.(i.DEBT_TRACK);
606
- };
607
- return /* @__PURE__ */ s(b, { children: [
608
- /* @__PURE__ */ e(L, { sx: { bgcolor: "background.paper" }, children: h.map((l, m) => /* @__PURE__ */ e(xt, { goalType: l, onClick: o }, m)) }),
609
- /* @__PURE__ */ e(
610
- Ke,
611
- {
612
- accounts: _.filter((l) => !r.find((m) => m.account_guid === l.guid)),
613
- isOpen: p,
614
- onClose: () => c(!1),
615
- onSave: g,
616
- title: n.select_debt_accounts_title
617
- }
618
- )
619
- ] });
620
- }, Me = ({ account: t }) => {
621
- const { accounts: n } = A(), { setSelectedAccount: d } = tt(), [r, u] = T.useState(!1);
622
- return /* @__PURE__ */ s(w, { sx: { bgcolor: "background.paper" }, children: [
623
- /* @__PURE__ */ s(D, { onClick: () => {
624
- d(t), u(!0);
625
- }, children: [
626
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
627
- ae,
628
- {
629
- alt: t.name || "",
630
- institutionGuid: t.institution_guid || ""
631
- }
632
- ) }),
633
- /* @__PURE__ */ e(
634
- K,
635
- {
636
- primary: t.name || t.feed_name,
637
- secondary: v(t.balance || 0, "0,0.00")
638
- }
639
- ),
640
- /* @__PURE__ */ e(B, {})
641
- ] }),
642
- /* @__PURE__ */ e(j, { isOpen: r, onClose: () => u(!1), title: n.account_details, children: /* @__PURE__ */ s(b, { children: [
643
- /* @__PURE__ */ e(nt, {}),
644
- /* @__PURE__ */ e(ot, {})
645
- ] }) })
646
- ] });
647
- }, Gt = M(({ goal: t }) => {
648
- const { goals: n } = A(), { setAlert: d, setSelectedGoal: r, updateGoal: u } = x(), [a, _] = T.useState(t.amount), p = !t.guid, c = a < 0 || a > 9999999999e-2, h = t.track_type === i.SAVINGS_TRACK && t.has_been_spent || t.track_type !== i.SAVINGS_TRACK && t.is_complete, o = async () => {
649
- const l = { ...t, amount: a };
650
- t.amount = a, p ? r(l) : (await u(l), d(n.alert_goal_updated_amount));
651
- }, g = () => {
652
- setTimeout(() => {
653
- _(t.amount);
654
- }, 250);
655
- };
656
- return /* @__PURE__ */ e(
657
- ne,
658
- {
659
- isDisabled: h,
660
- isSaveDisabled: c,
661
- label: n.details_amount_to_save,
662
- onCancel: g,
663
- onSave: o,
664
- primaryText: n.details_amount_to_save,
665
- secondaryText: v(t.amount, "0,0"),
666
- zeroStateText: p && t.amount === 0 ? n.add_amount : void 0,
667
- children: /* @__PURE__ */ e(
668
- Ge,
669
- {
670
- amount: a,
671
- autoFocus: !0,
672
- error: c,
673
- fullWidth: !0,
674
- minAmount: 0,
675
- setAmount: (l) => _(isNaN(Number(l)) ? a : Number(l)),
676
- sx: { ".MuiTypography-Body": { p: 0 } }
677
- }
678
- )
679
- }
680
- );
681
- }), Nt = ({ goal: t }) => {
682
- const { visibleCheckingAccounts: n, visibleSavingsAccounts: d } = H(), { accounts: r, goals: u } = A(), { setAlert: a, setSelectedGoal: _, updateGoal: p } = x(), c = !t.guid, [h, o] = T.useState(!1), g = async ({ balance: l, guid: m }) => {
683
- const f = { ...t, account_guid: m, current_amount: l || 0 };
684
- c ? _(f) : (await p(f), a(u.alert_account_changed)), o(!1);
685
- };
686
- return /* @__PURE__ */ s(b, { children: [
687
- c && !t.account_guid ? /* @__PURE__ */ e(w, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ s(D, { onClick: () => o(!0), children: [
688
- /* @__PURE__ */ e(K, { children: /* @__PURE__ */ s(b, { alignItems: "center", color: "primary.main", direction: "row", gap: 8, children: [
689
- /* @__PURE__ */ e(Ee, { filled: !0 }),
690
- u.details_add_account
691
- ] }) }),
692
- /* @__PURE__ */ e(B, { color: "primary" })
693
- ] }) }) : /* @__PURE__ */ s(b, { sx: { gap: 8, my: 24, mx: 24 }, children: [
694
- /* @__PURE__ */ e(_e, { onClick: () => o(!0), variant: "text", children: u.details_change_account }),
695
- /* @__PURE__ */ e(
696
- y,
697
- {
698
- color: "text.secondary",
699
- sx: { textAlign: "center", whiteSpace: "wrap" },
700
- variant: "Paragraph",
701
- children: N(u.details_change_account_description, t.name)
702
- }
703
- )
704
- ] }),
705
- /* @__PURE__ */ e(j, { isOpen: h, onClose: () => o(!1), title: u.details_change_account, children: /* @__PURE__ */ s(b, { children: [
706
- /* @__PURE__ */ e(y, { bold: !0, sx: { mb: 4, ml: 24, mt: 12 }, variant: "XSmall", children: r.account_types[1] }),
707
- /* @__PURE__ */ e(L, { sx: { bgcolor: "background.paper" }, children: n.map((l) => /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(D, { onClick: () => g(l), children: [
708
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
709
- ae,
710
- {
711
- alt: l?.name || "",
712
- institutionGuid: l?.institution_guid || ""
713
- }
714
- ) }),
715
- /* @__PURE__ */ e(
716
- K,
717
- {
718
- primary: l?.name || l?.feed_name,
719
- secondary: v(l?.balance || 0, "0,0.00")
720
- }
721
- ),
722
- /* @__PURE__ */ e(B, {})
723
- ] }) }, l.guid)) }),
724
- /* @__PURE__ */ e(y, { bold: !0, sx: { mb: 4, ml: 24, mt: 12 }, variant: "XSmall", children: r.account_types[2] }),
725
- /* @__PURE__ */ e(L, { sx: { bgcolor: "background.paper" }, children: d.map((l) => /* @__PURE__ */ e(w, { children: /* @__PURE__ */ s(D, { onClick: () => g(l), children: [
726
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
727
- ae,
728
- {
729
- alt: l?.name || "",
730
- institutionGuid: l?.institution_guid || ""
731
- }
732
- ) }),
733
- /* @__PURE__ */ e(
734
- K,
735
- {
736
- primary: l?.name || l?.feed_name,
737
- secondary: v(l?.balance || 0, "0,0.00")
738
- }
739
- ),
740
- /* @__PURE__ */ e(B, {})
741
- ] }) }, l.guid)) }),
742
- /* @__PURE__ */ e(
743
- fe,
744
- {
745
- description: u.connect_description,
746
- label: u.connect_button,
747
- title: u.connect_title
748
- }
749
- )
750
- ] }) })
751
- ] });
752
- }, kt = M(({ goal: t }) => {
753
- const { goals: n } = A(), { setAlert: d, setSelectedGoal: r, updateGoal: u } = x(), [a, _] = T.useState(t.name), p = !t.guid, c = t.track_type === i.SAVINGS_TRACK && t.has_been_spent || t.track_type !== i.SAVINGS_TRACK && t.is_complete, h = async () => {
754
- const g = { ...t, name: a };
755
- t.name = a, p ? r(g) : (await u(g), d(n.alert_goal_updated_name));
756
- }, o = () => {
757
- setTimeout(() => {
758
- _(t.name);
759
- }, 250);
760
- };
761
- return /* @__PURE__ */ e(
762
- ne,
763
- {
764
- isDisabled: c,
765
- isSaveDisabled: !a,
766
- label: n.details_goal_name,
767
- onCancel: o,
768
- onSave: h,
769
- primaryText: n.details_goal_name,
770
- secondaryText: t.name,
771
- children: /* @__PURE__ */ e(
772
- Ne,
773
- {
774
- error: !a,
775
- fullWidth: !0,
776
- label: n.details_goal_name,
777
- onChange: (g) => _(g.target.value),
778
- value: a
779
- }
780
- )
781
- }
782
- );
783
- }), wt = ({ goal: t }) => {
784
- const { goals: n } = A(), { setAlert: d, setSelectedGoal: r, updateGoal: u } = x(), [a, _] = T.useState(t.retirement_age || 65), p = !t.guid, c = async () => {
785
- if (!isNaN(a)) {
786
- const g = { ...t, retirement_age: a };
787
- t.retirement_age = a, p ? r(g) : (await u(g), d(n.alert_goal_updated_retirement_age));
788
- }
789
- }, h = () => {
790
- setTimeout(() => {
791
- _(t.retirement_age || 65);
792
- }, 250);
793
- }, o = !a || isNaN(a) || a < 20 || a >= 100;
794
- return /* @__PURE__ */ e(
795
- ne,
796
- {
797
- isDisabled: t.is_complete,
798
- isSaveDisabled: o,
799
- label: n.details_retirement_age,
800
- onCancel: h,
801
- onSave: c,
802
- primaryText: n.details_retirement_age,
803
- secondaryText: `${t.retirement_age}`,
804
- zeroStateText: p && !t.retirement_age ? n.add_age : void 0,
805
- children: /* @__PURE__ */ e(
806
- Ne,
807
- {
808
- error: o,
809
- fullWidth: !0,
810
- label: n.details_retirement_age,
811
- onChange: (g) => _(Number(g.target.value)),
812
- value: isNaN(a) ? "" : a
813
- }
814
- )
815
- }
816
- );
817
- }, Dt = M(({ goal: t }) => {
818
- const { goals: n } = A(), { user: d, updateUser: r } = ve(), { setAlert: u } = x(), [a, _] = T.useState(q(d.birthday ?? 0)), [p, c] = T.useState(null), h = t.is_complete, o = async () => {
819
- a && st(a) && (await r({ ...d, birthday: lt(a) }), u(n.alert_goal_updated_birthday));
820
- };
821
- return /* @__PURE__ */ e(
822
- ne,
823
- {
824
- isDisabled: h,
825
- isSaveDisabled: !!p,
826
- label: n.details_birthday,
827
- onSave: o,
828
- primaryText: n.details_birthday,
829
- secondaryText: `${ee(q(d.birthday ?? 0), te.MONTH_DAY_YEAR)}`,
830
- zeroStateText: !t.guid && !d.birthday ? n.add_birthday : void 0,
831
- children: /* @__PURE__ */ e(mt, { dateAdapter: ct, children: /* @__PURE__ */ e(
832
- dt,
833
- {
834
- label: n.details_birthday,
835
- onChange: _,
836
- onError: (g) => c(g),
837
- sx: { width: "100%" },
838
- value: a
839
- }
840
- ) })
841
- }
842
- );
843
- }), Kt = ({ goal: t }) => {
844
- const { goals: n } = A(), { visibleInvestmentAccounts: d } = H(), {
845
- addRetirementGoalAccount: r,
846
- newRetirementGoalAccounts: u,
847
- retirementGoalAccounts: a,
848
- selectedGoal: _,
849
- setAlert: p,
850
- setNewRetirementGoalAccounts: c,
851
- setSelectedGoal: h
852
- } = x(), [o, g] = T.useState(!1), l = !t.guid, m = d.filter(
853
- (C) => l ? u.find((S) => S.account_guid === C.guid) : a.find((S) => S.account_guid === C.guid)
854
- ), f = d.filter(
855
- (C) => !a.find((S) => S.account_guid === C.guid)
856
- ), E = async (C) => {
857
- const S = C.map((I) => ({
858
- account_guid: I.guid,
859
- retirement_goal_guid: t.guid
860
- }));
861
- if (l)
862
- c(S);
863
- else
864
- for (const I of S)
865
- await r(I), p(n.alert_account_added);
866
- h({
867
- ..._,
868
- current_amount: C.reduce((I, F) => I + (F.balance || 0), 0)
869
- }), g(!1);
870
- };
871
- return /* @__PURE__ */ s(b, { children: [
872
- m.map((C) => /* @__PURE__ */ s(b, { children: [
873
- /* @__PURE__ */ e(Me, { account: C }),
874
- /* @__PURE__ */ e(R, {})
875
- ] }, C.guid)),
876
- /* @__PURE__ */ e(w, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ s(D, { onClick: () => g(!0), children: [
877
- /* @__PURE__ */ e(K, { children: /* @__PURE__ */ s(b, { alignItems: "center", color: "primary.main", direction: "row", gap: 8, children: [
878
- /* @__PURE__ */ e(Ee, { filled: !0 }),
879
- n.details_add_account
880
- ] }) }),
881
- /* @__PURE__ */ e(B, { color: "primary" })
882
- ] }) }),
883
- /* @__PURE__ */ e(
884
- Ke,
885
- {
886
- accounts: f,
887
- isOpen: o,
888
- onClose: () => g(!1),
889
- onSave: E,
890
- title: n.add_select_accounts
891
- }
892
- )
893
- ] });
894
- }, Mt = M(({ goal: t }) => {
895
- const { goals: n } = A(), { visibleAccounts: d } = H(), r = T.useMemo(
896
- () => d.find((_) => _.guid === t.account_guid),
897
- [d, t]
898
- ), u = t.track_type;
899
- let a = n.details_save_title;
900
- return t.track_type === i.DEBT_TRACK ? a = n.details_debt_title : t.track_type === i.RETIREMENT_TRACK && (a = n.details_retirement_title), /* @__PURE__ */ s(b, { children: [
901
- /* @__PURE__ */ s(b, { mx: 24, children: [
902
- /* @__PURE__ */ e(y, { color: "text.secondary", sx: { mb: 4, mt: 24 }, variant: "XSmall", children: a }),
903
- /* @__PURE__ */ e(De, { goal: t, isInDrawer: !0 }),
904
- /* @__PURE__ */ e(y, { color: "text.secondary", sx: { mb: 4, mt: 24 }, variant: "XSmall", children: n.details_title })
905
- ] }),
906
- /* @__PURE__ */ s(L, { sx: { bgcolor: "background.paper" }, children: [
907
- /* @__PURE__ */ e(kt, { goal: t }),
908
- /* @__PURE__ */ e(R, { sx: { ml: 24 } }),
909
- (u === i.SAVINGS_TRACK || u === i.RETIREMENT_TRACK) && /* @__PURE__ */ s(Y, { children: [
910
- /* @__PURE__ */ e(Gt, { goal: t }),
911
- /* @__PURE__ */ e(R, { sx: { ml: u === i.RETIREMENT_TRACK ? 24 : 0 } })
912
- ] }),
913
- t.track_type === i.DEBT_TRACK && /* @__PURE__ */ s(Y, { children: [
914
- /* @__PURE__ */ e(at, { goal: t }),
915
- /* @__PURE__ */ e(R, { sx: { ml: 24 } }),
916
- /* @__PURE__ */ e(rt, { goal: t }),
917
- /* @__PURE__ */ e(R, { sx: { ml: 24 } }),
918
- /* @__PURE__ */ e(it, { goal: t }),
919
- /* @__PURE__ */ e(R, { variant: "fullWidth" })
920
- ] }),
921
- t.track_type === i.RETIREMENT_TRACK && /* @__PURE__ */ s(Y, { children: [
922
- /* @__PURE__ */ e(wt, { goal: t }),
923
- /* @__PURE__ */ e(R, { sx: { ml: 24 } }),
924
- /* @__PURE__ */ e(Dt, { goal: t }),
925
- /* @__PURE__ */ e(R, { variant: "fullWidth" })
926
- ] })
927
- ] }),
928
- /* @__PURE__ */ e(y, { color: "text.secondary", sx: { mb: 4, ml: 24, mt: 12 }, variant: "XSmall", children: t.track_type === i.RETIREMENT_TRACK ? n.details_accounts : n.details_account }),
929
- t.track_type !== i.RETIREMENT_TRACK && r && /* @__PURE__ */ s(Y, { children: [
930
- /* @__PURE__ */ e(Me, { account: r }),
931
- /* @__PURE__ */ e(R, {})
932
- ] }),
933
- t.track_type === i.RETIREMENT_TRACK && /* @__PURE__ */ s(Y, { children: [
934
- /* @__PURE__ */ e(Kt, { goal: t }),
935
- /* @__PURE__ */ e(R, {})
936
- ] }),
937
- t.track_type === i.SAVINGS_TRACK && !t.is_complete && /* @__PURE__ */ e(Nt, { goal: t })
938
- ] });
939
- }), Ot = M(({ onClose: t }) => {
940
- const { visibleInvestmentAccounts: n } = H(), { goals: d, common: r } = A(), {
941
- addGoal: u,
942
- addRetirementGoal: a,
943
- deleteGoal: _,
944
- deleteRetirementGoal: p,
945
- newRetirementGoalAccounts: c,
946
- retirementGoalAccounts: h,
947
- selectedGoal: o,
948
- setAlert: g,
949
- setSelectedGoal: l,
950
- updateGoal: m
951
- } = x(), { user: f } = ve(), [E, C] = T.useState(!1), S = !o?.guid, I = o?.track_type === i.SAVINGS_TRACK && o.is_complete && !o.has_been_spent, F = T.useMemo(() => {
952
- const k = S ? c : h;
953
- return n.filter(($) => k.some((O) => O.account_guid === $.guid));
954
- }, [S, n, c, h]), J = T.useMemo(() => {
955
- if (!o) return !1;
956
- const { account_guid: k, track_type: $, name: O, amount: Q, retirement_age: W } = o;
957
- return $ === i.SAVINGS_TRACK ? k ? !!O && !!Q : !1 : $ === i.RETIREMENT_TRACK ? F.length ? !!O && !!Q && !!W && !!f.birthday : !1 : !0;
958
- }, [o, F, f.birthday]);
959
- let z = r.delete_button, X = () => C(!0);
960
- S ? (X = () => oe(), z = r.save_button) : I && (X = () => le(), z = d.mark_as_complete_button);
961
- const oe = async () => {
962
- if (o) {
963
- const k = o.track_type;
964
- k !== i.RETIREMENT_TRACK ? await u(o) : k === i.RETIREMENT_TRACK && await a({ ...o, target_amount: o.amount }), g(d.alert_goal_added), l(void 0), k && t?.(k);
965
- }
966
- }, ie = async () => {
967
- o && (o.track_type !== i.RETIREMENT_TRACK ? await _(o.guid) : o.track_type === i.RETIREMENT_TRACK && await p(o), g(d.alert_goal_deleted), l(void 0));
968
- }, le = async () => {
969
- const k = {
970
- ...o,
971
- has_been_spent: !0
972
- };
973
- await m(k), g(d.alert_goal_completed), l(void 0);
974
- };
975
- return /* @__PURE__ */ s(b, { children: [
976
- /* @__PURE__ */ e(
977
- j,
978
- {
979
- ariaLabelClose: r.close_aria,
980
- hasSecondaryAction: S,
981
- isOpen: !!o,
982
- isPrimaryDisabled: !J,
983
- onClose: () => l(void 0),
984
- onPrimaryAction: X,
985
- primaryColor: S || I ? "primary" : "error",
986
- primaryText: z,
987
- secondaryColor: "primary",
988
- title: d.goal_details,
989
- children: o && /* @__PURE__ */ e(Mt, { goal: o })
990
- }
991
- ),
992
- /* @__PURE__ */ e(
993
- Ue,
994
- {
995
- copy: { close_aria: r.close_aria, title: d.delete_goal },
996
- isOpen: E,
997
- maxWidth: "xs",
998
- onClose: () => C(!1),
999
- onPrimaryAction: ie,
1000
- primaryColor: "error",
1001
- primaryText: r.delete_button,
1002
- children: /* @__PURE__ */ e(y, { sx: { textWrap: "wrap" }, variant: "Paragraph", children: N(d.delete_description, o?.name || "") })
1003
- }
1004
- )
1005
- ] });
1006
- }), jn = M(({ onBackClick: t, sx: n }) => {
1007
- const { onEvent: d } = xe(), { isMobile: r } = ue(), { visibleAccounts: u } = H(), { isCopyLoaded: a, isInitialized: _, setSelectedAccounts: p } = Ie(), { goals: c, common: h } = A(), { alert: o, goals: g, goalsLoaded: l, loadGoals: m, monthlyCashFlowProfile: f, setAlert: E, retirmentGoals: C } = x(), [S, I] = T.useState(0), [F, J] = T.useState(!1), z = f?.amount_allocated_for_savings_goals || 0, X = f?.amount_allocated_for_debt_goals || 0, oe = f?.amount_allocated_for_retirement_goals || 0, ie = a ? N(
1008
- r ? c.tab_subtitle_mobile : c.tab_subtitle,
1009
- v(z, "0,0")
1010
- ) : "", le = a ? N(
1011
- r ? c.tab_subtitle_mobile : c.tab_subtitle,
1012
- v(X, "0,0")
1013
- ) : "", k = a ? N(
1014
- r ? c.tab_subtitle_mobile : c.tab_subtitle,
1015
- v(oe, "0,0")
1016
- ) : "";
1017
- T.useEffect(() => {
1018
- p(u), d(Z.GOALS_VIEW);
1019
- }, []), T.useEffect(() => {
1020
- _ && m().finally();
1021
- }, [_, z, X, oe]);
1022
- const $ = () => {
1023
- d(Z.GOALS_CLICK_FILTER);
1024
- }, O = () => {
1025
- J(!0), d(Z.GOALS_CLICK_ADD);
1026
- }, Q = (U) => {
1027
- J(!1), U === i.SAVINGS_TRACK ? I(0) : U === i.DEBT_TRACK ? I(1) : U === i.RETIREMENT_TRACK && I(2);
1028
- }, W = T.useMemo(
1029
- () => l && (g.length === 0 || g.every(({ track_type: U }) => !U) && C.length === 0),
1030
- [g, l, C]
1031
- );
1032
- return !l || !a || !_ ? /* @__PURE__ */ e(ke, {}) : /* @__PURE__ */ s(
1033
- ut,
1034
- {
1035
- accountOptions: u,
1036
- actions: [
1037
- {
1038
- iconName: "add",
1039
- label: c.add_title,
1040
- onClick: O
1041
- }
1042
- ],
1043
- onAccountsFilterClick: $,
1044
- onBackClick: t,
1045
- sx: n,
1046
- title: c.title,
1047
- children: [
1048
- /* @__PURE__ */ s(b, { mx: r ? 0 : 48, my: 24, children: [
1049
- /* @__PURE__ */ s(
1050
- We,
1051
- {
1052
- onChange: (U, Oe) => I(Oe),
1053
- sx: { bgcolor: "background.paper" },
1054
- textColor: "primary",
1055
- value: W ? !1 : S,
1056
- variant: "fullWidth",
1057
- children: [
1058
- /* @__PURE__ */ e(
1059
- se,
1060
- {
1061
- disabled: W,
1062
- label: /* @__PURE__ */ e(ce, { subtitle: ie, title: c.tab_saving_title })
1063
- }
1064
- ),
1065
- /* @__PURE__ */ e(
1066
- se,
1067
- {
1068
- disabled: W,
1069
- label: /* @__PURE__ */ e(ce, { subtitle: le, title: c.tab_debt_title })
1070
- }
1071
- ),
1072
- /* @__PURE__ */ e(
1073
- se,
1074
- {
1075
- disabled: W,
1076
- label: /* @__PURE__ */ e(ce, { subtitle: k, title: c.tab_retirement_title })
1077
- }
1078
- )
1079
- ]
1080
- }
1081
- ),
1082
- W ? /* @__PURE__ */ e(
1083
- _t,
1084
- {
1085
- header: c.create_goals_header,
1086
- icon: "trophy",
1087
- onClick: O,
1088
- primaryButton: c.add_goals_button,
1089
- subText: c.empty_state_subheader,
1090
- sx: {
1091
- width: { sm: 432 },
1092
- ".buttons-footer": {
1093
- width: 139
1094
- }
1095
- }
1096
- }
1097
- ) : /* @__PURE__ */ s(Y, { children: [
1098
- S === 0 && /* @__PURE__ */ e(de, { onAddGoals: O, trackType: i.SAVINGS_TRACK }),
1099
- S === 1 && /* @__PURE__ */ e(de, { onAddGoals: O, trackType: i.DEBT_TRACK }),
1100
- S === 2 && /* @__PURE__ */ e(de, { onAddGoals: O, trackType: i.RETIREMENT_TRACK })
1101
- ] })
1102
- ] }),
1103
- /* @__PURE__ */ e(Ot, { onClose: Q }),
1104
- /* @__PURE__ */ e(
1105
- j,
1106
- {
1107
- ariaLabelClose: h.close_aria,
1108
- isOpen: F,
1109
- onClose: () => J(!1),
1110
- title: c.add_goal_title,
1111
- children: /* @__PURE__ */ e(It, { onClose: Q })
1112
- }
1113
- ),
1114
- /* @__PURE__ */ e(Le, { onClose: () => E(""), open: !!o, children: /* @__PURE__ */ e(Be, { onClose: () => E(""), severity: "success", variant: "filled", children: o }) })
1115
- ]
1116
- }
1117
- );
1118
- }), Bt = M(({ goal: t }) => {
1119
- const { goals: n } = A(), d = gt(), {
1120
- backgroundColor: r,
1121
- color: u,
1122
- percentage: a,
1123
- projectedText: _
1124
- } = we(n, t), p = Math.round(a * 100);
1125
- let c = /* @__PURE__ */ e(Ce, {});
1126
- return t.track_type === i.DEBT_TRACK ? c = /* @__PURE__ */ e(Se, {}) : t.track_type === i.RETIREMENT_TRACK && (c = /* @__PURE__ */ e(Re, {})), /* @__PURE__ */ s(b, { alignItems: "center", direction: "row", spacing: 12, sx: { py: 12 }, children: [
1127
- /* @__PURE__ */ e(re, { sx: { bgcolor: r, color: u, height: 32, width: 32 }, variant: "rounded", children: c }),
1128
- /* @__PURE__ */ s(ht, { sx: { width: "100%" }, children: [
1129
- /* @__PURE__ */ e(me, { fontSize: 15, fontWeight: 600, variant: "body1", children: t.name }),
1130
- t.projected_to_complete_at && /* @__PURE__ */ e(y, { color: "text.secondary", variant: "XSmall", children: _ })
1131
- ] }),
1132
- /* @__PURE__ */ e(
1133
- bt,
1134
- {
1135
- backgroundStrokeColor: d.palette.border.lighter,
1136
- color: d.palette.primary.main,
1137
- percent: p,
1138
- size: 40,
1139
- strokeWidth: 3,
1140
- children: /* @__PURE__ */ e(V, { fontWeight: 700, variant: "caption", children: `${p}%` })
1141
- }
1142
- )
1143
- ] });
1144
- }), Lt = ({ header: t, subText: n, sx: d }) => /* @__PURE__ */ s(
1145
- b,
1146
- {
1147
- sx: {
1148
- alignItems: "center",
1149
- alignSelf: "center",
1150
- px: 24,
1151
- ...d
1152
- },
1153
- children: [
1154
- /* @__PURE__ */ e(Xe, { size: 32 }),
1155
- /* @__PURE__ */ e(me, { fontSize: 15, fontWeight: 600, children: t }),
1156
- /* @__PURE__ */ e(
1157
- V,
1158
- {
1159
- color: "text.secondary",
1160
- sx: { fontWeight: 400, maxWidth: { sm: 424 }, textAlign: "center" },
1161
- variant: "subtitle2",
1162
- children: n
1163
- }
1164
- )
1165
- ]
1166
- }
1167
- ), Fn = M(({ onCTAClick: t }) => {
1168
- const { visibleAccounts: n } = H(), { onEvent: d } = xe(), { goals: r } = A(), { isInitialized: u, setSelectedAccounts: a, isCopyLoaded: _ } = Ie(), { ongoingGoalsForMicroWidget: p, loadGoals: c, goalsLoaded: h } = x();
1169
- T.useEffect(() => {
1170
- a(n);
1171
- }, []), T.useEffect(() => {
1172
- u && (c().finally(), d(Z.GOALS_LOAD_WIDGET, {
1173
- state: n?.length ? "default" : "zeroState"
1174
- }));
1175
- }, [u]);
1176
- const o = T.useMemo(
1177
- () => h && p.length === 0,
1178
- [p, h]
1179
- ), g = () => {
1180
- d(
1181
- o ? Z.GOALS_CLICK_GET_STARTED : Z.GOALS_CLICK_VIEW_DETAILS
1182
- ), t();
1183
- };
1184
- return !h || !_ || !u ? /* @__PURE__ */ e(ke, {}) : /* @__PURE__ */ e(
1185
- ft,
1186
- {
1187
- className: "mx-goals-microwidget",
1188
- ctaLabel: o ? r.get_started : r.view_details,
1189
- onCTAClick: g,
1190
- title: r.title,
1191
- children: o ? /* @__PURE__ */ e(
1192
- Lt,
1193
- {
1194
- header: r.create_goals_header,
1195
- subText: r.micro_zero_state_description
1196
- }
1197
- ) : /* @__PURE__ */ e(pt, { sx: { justifyContent: "space-between" }, children: p.map((l, m) => /* @__PURE__ */ s(T.Fragment, { children: [
1198
- /* @__PURE__ */ e(Bt, { goal: l }),
1199
- m !== p.length - 1 && /* @__PURE__ */ e(R, {})
1200
- ] }, l.guid)) })
1201
- }
1202
- );
1203
- });
1204
- export {
1205
- $n as GoalApi,
1206
- Un as GoalStore,
1207
- Fn as GoalsMicroWidget,
1208
- jn as GoalsWidget
1209
- };