@mx-cartographer/experiences 7.7.2 → 7.8.0-alpha-ram-goal-bug

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 (92) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/Account-BiB1F8lL.mjs +118 -0
  3. package/dist/{Account-BfkKlfsW.mjs → Account-DuOz1a27.mjs} +1 -1
  4. package/dist/AccountApi-DgZ8ILj1.mjs +19 -0
  5. package/dist/{AccountDetailsHeader-DqYIuhOs.mjs → AccountDetailsHeader-Cf2TUJnM.mjs} +4 -4
  6. package/dist/AccountDisplayName-CO7z3v99.mjs +11 -0
  7. package/dist/{AccountFields-yP8QdgPd.mjs → AccountFields-UdOvbQ5H.mjs} +7 -6
  8. package/dist/{AccountListItem-DMbu9ehd.mjs → AccountListItem-BPVxmNT_.mjs} +7 -7
  9. package/dist/AccountStore-BbPWe2C9.mjs +244 -0
  10. package/dist/Accounts-M-LTzStv.mjs +27 -0
  11. package/dist/{CategoryStore-Cnw9yUys.mjs → CategoryStore-BYICdb9m.mjs} +73 -73
  12. package/dist/CategoryUtil-meuejJqP.mjs +80 -0
  13. package/dist/{ConnectionsDrawer-BqR6FWJO.mjs → ConnectionsDrawer-BDpVTTSe.mjs} +1 -1
  14. package/dist/{DebtsStore-DuSdXM1k.mjs → DebtsStore-BIbOVCPe.mjs} +12 -12
  15. package/dist/{ExportCsvAction-HK5CeZWR.mjs → ExportCsvAction-CDuzTva1.mjs} +2 -2
  16. package/dist/GlobalAccountFilter-DQCPNc95.mjs +316 -0
  17. package/dist/GoalStore-B4LVt_kH.mjs +422 -0
  18. package/dist/{ManageIncome-BrTrlplL.mjs → ManageIncome-CL3hv8i9.mjs} +44 -44
  19. package/dist/NetWorthStore-yV43kJro.mjs +168 -0
  20. package/dist/{NotificationSettings-D4Vh3z8I.mjs → NotificationSettings-SPg3pwbX.mjs} +171 -169
  21. package/dist/{NotificationStore-CDX_kqHa.mjs → NotificationStore-Ck2KdNmT.mjs} +22 -14
  22. package/dist/{RecurringSettings-D2V6l77l.mjs → RecurringSettings-Bmnnpb48.mjs} +16 -16
  23. package/dist/{RecurringTransactionsStore-Caf1cq4v.mjs → RecurringTransactionsStore-BQBEJOPP.mjs} +91 -81
  24. package/dist/{RecurringTransactions-Bf4lX0Cn.mjs → RepeatingTransaction-miZVnk_A.mjs} +4 -4
  25. package/dist/{SettingsStore-krIRNwHK.mjs → SettingsStore-BHpuyujx.mjs} +1 -1
  26. package/dist/SkeletonLoader-BaNboJjD.mjs +38 -0
  27. package/dist/{SpendingLegend-gTCJLLkV.mjs → SpendingLegend-CD60HCYS.mjs} +33 -33
  28. package/dist/{TransactionDetails-7MHOshKQ.mjs → TransactionDetails-BDhz3DLT.mjs} +2 -2
  29. package/dist/TransactionStore-BSp5bOKg.mjs +705 -0
  30. package/dist/{User-LJpEwPtn.mjs → User-B0LnmiKO.mjs} +21 -20
  31. package/dist/WidgetContainer-BbPS3Yxz.mjs +555 -0
  32. package/dist/accounts/index.es.js +421 -391
  33. package/dist/accounts/stores/AccountStore.d.ts +30 -23
  34. package/dist/accounts/utils/Accounts.d.ts +2 -1
  35. package/dist/budgets/index.es.js +546 -540
  36. package/dist/budgets/store/BudgetsStore.d.ts +1 -0
  37. package/dist/cashflow/index.es.js +444 -457
  38. package/dist/categories/index.es.js +1 -1
  39. package/dist/categories/stores/CategoryStore.d.ts +10 -5
  40. package/dist/categories/util/CategoryUtil.d.ts +3 -2
  41. package/dist/common/components/GlobalAccountFilter.d.ts +11 -0
  42. package/dist/common/components/SkeletonLoader.d.ts +7 -0
  43. package/dist/common/components/WidgetContainer.d.ts +7 -6
  44. package/dist/common/components/globalaccountfilter/GlobalAccountFilterList.d.ts +7 -0
  45. package/dist/common/components/index.d.ts +2 -2
  46. package/dist/common/hooks/useAriaLive.d.ts +1 -1
  47. package/dist/common/index.es.js +459 -445
  48. package/dist/common/stores/AppDataStore.d.ts +3 -1
  49. package/dist/common/stores/GlobalCopyStore.d.ts +0 -1
  50. package/dist/common/stores/GlobalStore.d.ts +3 -3
  51. package/dist/common/stores/GlobalUiStore.d.ts +10 -6
  52. package/dist/common/stores/UserStore.d.ts +3 -2
  53. package/dist/common/types/Account.d.ts +9 -6
  54. package/dist/dashboard/index.es.js +84 -116
  55. package/dist/debts/index.es.js +417 -413
  56. package/dist/{exportTransactionsToCSV-BrTYdSgJ.mjs → exportTransactionsToCSV-DtQ7ovAR.mjs} +1 -1
  57. package/dist/finstrong/index.es.js +1167 -1110
  58. package/dist/goals/index.es.js +618 -598
  59. package/dist/goals/stores/GoalStore.d.ts +19 -4
  60. package/dist/help/index.es.js +13 -13
  61. package/dist/investments/index.es.js +330 -325
  62. package/dist/investments/stores/HoldingStore.d.ts +1 -0
  63. package/dist/networth/components/NetWorthChart.d.ts +3 -2
  64. package/dist/networth/components/NetWorthList.d.ts +3 -3
  65. package/dist/networth/index.es.js +423 -433
  66. package/dist/networth/stores/NetWorthStore.d.ts +20 -9
  67. package/dist/networth/utils/NetWorthUtils.d.ts +2 -2
  68. package/dist/notifications/index.es.js +90 -91
  69. package/dist/notifications/stores/NotificationStore.d.ts +3 -1
  70. package/dist/recurringtransactions/components/MicroWidgetContent.d.ts +3 -0
  71. package/dist/recurringtransactions/index.es.js +543 -562
  72. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +4 -2
  73. package/dist/settings/index.es.js +253 -248
  74. package/dist/spending/index.es.js +282 -301
  75. package/dist/transactions/index.es.js +269 -263
  76. package/dist/transactions/stores/TransactionStore.d.ts +26 -77
  77. package/dist/transactions/stores/UiStore.d.ts +0 -2
  78. package/dist/trends/index.es.js +708 -699
  79. package/dist/{useAccountDisplayName-BTvP_pw6.mjs → useAccountDisplayName-Bot2tb4n.mjs} +1 -1
  80. package/package.json +3 -3
  81. package/dist/AccountStore-CWFzg8-E.mjs +0 -260
  82. package/dist/Accounts-CWt-NRq8.mjs +0 -9
  83. package/dist/CategoryUtil-DZflYFam.mjs +0 -78
  84. package/dist/ConnectDrawer-BOjfI6rz.mjs +0 -563
  85. package/dist/GoalStore-C7ahxxLi.mjs +0 -364
  86. package/dist/NetWorthStore-xWIo9CYU.mjs +0 -150
  87. package/dist/TransactionStore-DJwPaZuM.mjs +0 -677
  88. package/dist/WidgetContainer-CrK6tyHr.mjs +0 -572
  89. package/dist/common/components/accountfilter/AccountFilter.d.ts +0 -20
  90. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +0 -31
  91. package/dist/common/components/accountfilter/index.d.ts +0 -1
  92. package/dist/{ToggleListItem-ciFTiqRS.mjs → Notification-Bs1fdbzI.mjs} +1 -1
@@ -0,0 +1,422 @@
1
+ import { jsxs as u, jsx as l } from "react/jsx-runtime";
2
+ import E from "react";
3
+ import T from "@mui/material/Button";
4
+ import I from "@mui/material/Card";
5
+ import N from "@mui/material/CardContent";
6
+ import w from "@mui/material/CardHeader";
7
+ import O from "@mui/material/Stack";
8
+ import { AccountBalance as L, ChevronRight as S } from "@mxenabled/mx-icons";
9
+ import { Text as g } from "@mxenabled/mxui";
10
+ import { b as y } from "./GlobalAccountFilter-DQCPNc95.mjs";
11
+ import { a as b } from "./hooks-ZMp65DFz.mjs";
12
+ import { makeAutoObservable as D, runInAction as _ } from "mobx";
13
+ import { F, A as i } from "./Fetch-DecPFeGU.mjs";
14
+ import { fromUnixTime as R } from "date-fns/fromUnixTime";
15
+ import { addYears as v } from "date-fns/addYears";
16
+ import { getUnixTime as x } from "date-fns/getUnixTime";
17
+ import { b as d } from "./Localization-2MODESHW.mjs";
18
+ import { a as K } from "./NumberFormatting-DjTD0t3W.mjs";
19
+ import { f as P, D as B } from "./Dialog-B4PI-_bL.mjs";
20
+ const nt = ({ description: o, label: t, title: e }) => {
21
+ const { config: r } = b(), [a, s] = E.useState(!1);
22
+ return /* @__PURE__ */ u(E.Fragment, { children: [
23
+ /* @__PURE__ */ u(I, { sx: { m: 24 }, children: [
24
+ /* @__PURE__ */ l(
25
+ w,
26
+ {
27
+ avatar: /* @__PURE__ */ l(L, {}),
28
+ sx: { ".MuiCardHeader-avatar": { mr: 8 } },
29
+ title: /* @__PURE__ */ l(g, { bold: !0, variant: "Body", children: e })
30
+ }
31
+ ),
32
+ /* @__PURE__ */ l(N, { sx: { ":last-child": { pb: 4 }, ml: 28, py: 0 }, children: /* @__PURE__ */ u(O, { alignItems: "flex-start", spacing: 2, children: [
33
+ /* @__PURE__ */ l(g, { color: "text.secondary", sx: { textWrap: "wrap" }, variant: "ParagraphSmall", children: o }),
34
+ r.show_connections_widget_in_master && /* @__PURE__ */ l(
35
+ T,
36
+ {
37
+ endIcon: /* @__PURE__ */ l(S, {}),
38
+ onClick: () => s(!0),
39
+ sx: {
40
+ pl: 0,
41
+ ":hover": {
42
+ bgcolor: "unset"
43
+ }
44
+ },
45
+ variant: "text",
46
+ children: t
47
+ }
48
+ )
49
+ ] }) })
50
+ ] }),
51
+ /* @__PURE__ */ l(
52
+ y,
53
+ {
54
+ onClose: () => s(!1),
55
+ showConnectWidget: a,
56
+ title: t
57
+ }
58
+ )
59
+ ] });
60
+ };
61
+ var n = /* @__PURE__ */ ((o) => (o[o.DEBT_TRACK = 1] = "DEBT_TRACK", o[o.SAVINGS_TRACK = 2] = "SAVINGS_TRACK", o[o.RETIREMENT_TRACK = 3] = "RETIREMENT_TRACK", o[o.EMERGENCY_FUND_TRACK = 4] = "EMERGENCY_FUND_TRACK", o))(n || {}), $ = /* @__PURE__ */ ((o) => (o[o.SAVE_AMOUNT = 1] = "SAVE_AMOUNT", o[o.KEEP_BALANCE_BELOW = 2] = "KEEP_BALANCE_BELOW", o[o.KEEP_BALANCE_ABOVE = 3] = "KEEP_BALANCE_ABOVE", o[o.ACTION = 4] = "ACTION", o))($ || {}), c = /* @__PURE__ */ ((o) => (o[o.AUTOMOBILE = 1] = "AUTOMOBILE", o[o.COLLEGE = 2] = "COLLEGE", o[o.HOUSE = 3] = "HOUSE", o[o.RECREATIONAL_VEHICLE = 4] = "RECREATIONAL_VEHICLE", o[o.VACATION = 5] = "VACATION", o[o.ELECTRONIC = 6] = "ELECTRONIC", o[o.OTHER = 7] = "OTHER", o[o.RETIREMENT = 8] = "RETIREMENT", o[o.EMERGENCY_FUND = 9] = "EMERGENCY_FUND", o[o.SETUP_BUDGETS = 10] = "SETUP_BUDGETS", o[o.START_MONEY_MANAGEMENT = 11] = "START_MONEY_MANAGEMENT", o[o.CREDIT_CARD = 12] = "CREDIT_CARD", o[o.LINE_OF_CREDIT = 13] = "LINE_OF_CREDIT", o[o.LOANS = 14] = "LOANS", o))(c || {});
62
+ class A {
63
+ fetchInstance;
64
+ constructor(t, e, r) {
65
+ this.fetchInstance = new F(t, e, void 0, r);
66
+ }
67
+ addGoal = async (t) => this.fetchInstance.post(i.GOALS, t).then((e) => e.goal);
68
+ addRetirementGoal = async (t) => this.fetchInstance.post(i.RETIREMENT_GOALS, t).then((e) => e.retirement_goal);
69
+ addRetirementGoalAccount = async (t) => this.fetchInstance.post(i.RETIREMENT_GOAL_ACCOUNTS, t).then((e) => e.retirement_goal_account);
70
+ getGoalByGuid = async (t) => this.fetchInstance.get(`${i.GOALS}/${t}`).then((e) => e.goal);
71
+ getGoals = async () => this.fetchInstance.get(i.GOALS).then((t) => t.goals);
72
+ getMonthlyCashFlowProfile = async () => this.fetchInstance.get(i.MONTHLY_CASH_FLOW_PROFILE).then((t) => t.monthly_cash_flow_profile);
73
+ getRetirementGoals = async () => this.fetchInstance.get(i.RETIREMENT_GOALS).then((t) => t.retirement_goals);
74
+ getRetirementGoalAccounts = async () => this.fetchInstance.get(i.RETIREMENT_GOAL_ACCOUNTS).then((t) => t.retirement_goal_accounts);
75
+ removeGoal = async (t) => this.fetchInstance.delete(`${i.GOALS}/${t}`).then((e) => e);
76
+ removeRetirementGoal = async (t) => this.fetchInstance.delete(`${i.RETIREMENT_GOALS}/${t}`).then((e) => e);
77
+ removeRetirementGoalAccount = async (t) => this.fetchInstance.delete(`${i.RETIREMENT_GOAL_ACCOUNTS}/${t}`).then((e) => e);
78
+ reorderGoals = async (t) => this.fetchInstance.post(`${i.GOALS}/reposition`, { goals: t }).then((e) => e.goals);
79
+ updateGoal = async (t) => this.fetchInstance.put(`${i.GOALS}/${t.guid}`, t).then((e) => e.goal);
80
+ updateMonthlyCashFlowProfile = async (t) => this.fetchInstance.put(`${i.MONTHLY_CASH_FLOW_PROFILE}`, t).then((e) => e.monthly_cash_flow_profile);
81
+ updateRetirementGoal = async (t) => this.fetchInstance.put(`${i.RETIREMENT_GOALS}/${t.guid}`, t).then((e) => e.retirement_goal);
82
+ }
83
+ function it(o, t) {
84
+ const e = t.track_type === n.DEBT_TRACK ? t.initial_amount : t.amount;
85
+ let r = t.current_amount / e;
86
+ r > 1 && (r = 1), r = t.track_type === n.DEBT_TRACK ? 1 - r : r, isNaN(r) && (r = 1);
87
+ let a = "chart.chart1", s = "common.black";
88
+ t.track_type === n.DEBT_TRACK ? (s = "common.white", a = "chart.chart5") : t.track_type === n.RETIREMENT_TRACK && (a = "chart.chart6");
89
+ const h = {
90
+ style: "percent",
91
+ minimumFractionDigits: 0,
92
+ maximumFractionDigits: 0
93
+ }, m = t.is_complete ? t.completed_at : t.projected_to_complete_at, f = m ? R(m) : /* @__PURE__ */ new Date(), C = d(
94
+ o.goal_percentage,
95
+ K(r, h)
96
+ ), p = d(
97
+ t.is_complete ? o.completed_label : o.goal_projection,
98
+ P(f, B.MONTH_SHORT_YEAR)
99
+ );
100
+ return {
101
+ backgroundColor: a,
102
+ color: s,
103
+ percentage: r,
104
+ percentageText: C,
105
+ projectedText: p
106
+ };
107
+ }
108
+ function st(o) {
109
+ return [
110
+ {
111
+ bgcolor: "chart.chart1",
112
+ icon: "attach_money",
113
+ label: o.saving_goal_label,
114
+ description: o.saving_goal_description,
115
+ subTypes: [
116
+ {
117
+ icon: "ecg_heart",
118
+ label: o.saving_goal_emergency_fund,
119
+ metaType: c.EMERGENCY_FUND
120
+ },
121
+ {
122
+ icon: "directions_car",
123
+ label: o.saving_gaol_automobile,
124
+ metaType: c.AUTOMOBILE
125
+ },
126
+ { icon: "school", label: o.saving_goal_college, metaType: c.COLLEGE },
127
+ { icon: "home", label: o.saving_goal_home, metaType: c.HOUSE },
128
+ {
129
+ icon: "mountain_flag",
130
+ label: o.saving_goal_recreational,
131
+ metaType: c.RECREATIONAL_VEHICLE
132
+ },
133
+ { icon: "airplane_ticket", label: o.saving_goal_vacation, metaType: c.VACATION },
134
+ {
135
+ icon: "desktop_windows",
136
+ label: o.saving_goal_electronic,
137
+ metaType: c.ELECTRONIC
138
+ },
139
+ { icon: "payments", label: o.saving_goal_other, metaType: c.OTHER }
140
+ ],
141
+ type: n.SAVINGS_TRACK
142
+ },
143
+ {
144
+ bgcolor: "chart.chart5",
145
+ icon: "note_stack",
146
+ label: o.debt_goal_label,
147
+ description: o.debt_goal_description,
148
+ subTypes: [],
149
+ type: n.DEBT_TRACK
150
+ },
151
+ {
152
+ bgcolor: "chart.chart6",
153
+ icon: "person",
154
+ label: o.retirement_goal_label,
155
+ description: o.retirement_goal_description,
156
+ subTypes: [],
157
+ type: n.RETIREMENT_TRACK
158
+ }
159
+ ];
160
+ }
161
+ const ct = (o, t) => {
162
+ switch (o) {
163
+ case n.DEBT_TRACK:
164
+ return d(t.zero_state_ongoing, "debt");
165
+ case n.SAVINGS_TRACK:
166
+ return d(t.zero_state_ongoing, "saving");
167
+ default:
168
+ return d(t.zero_state_ongoing, "retirement");
169
+ }
170
+ }, G = (o, t) => {
171
+ const e = R(t), r = v(e, o);
172
+ return x(r);
173
+ };
174
+ class lt {
175
+ globalStore;
176
+ api = new A("/", "");
177
+ goals = [];
178
+ goalsLoaded = !1;
179
+ retirementGoals = [];
180
+ retirementGoalsLoaded = !1;
181
+ retirementGoalAccounts = [];
182
+ retirementGoalAccountsLoaded = !1;
183
+ monthlyCashFlowProfile = void 0;
184
+ monthlyCashFlowProfileLoaded = !1;
185
+ newRetirementGoalAccounts = [];
186
+ alert = "";
187
+ selectedGoal = void 0;
188
+ constructor(t) {
189
+ this.globalStore = t, this.api = new A(t.endpoint, t.sessionToken, t.onError), D(this);
190
+ }
191
+ get allGoals() {
192
+ if (!this.isAllGoalDataLoaded) return [];
193
+ const t = this.globalStore.copyStore.copy.goals, e = this.globalStore.userStore.user.birthday;
194
+ return [
195
+ ...this.goals,
196
+ ...this.retirementGoals.map((r) => ({
197
+ ...r,
198
+ amount: r.target_amount,
199
+ name: t.retirement,
200
+ track_type: n.RETIREMENT_TRACK,
201
+ projected_to_complete_at: r.retirement_age && e ? G(r.retirement_age, e) : void 0
202
+ }))
203
+ ];
204
+ }
205
+ get orderedGoals() {
206
+ return this.allGoals.slice().sort((t, e) => t.position - e.position);
207
+ }
208
+ get debtGoals() {
209
+ return this.orderedGoals.filter((t) => t.track_type === n.DEBT_TRACK);
210
+ }
211
+ get retirmentGoals() {
212
+ return this.orderedGoals.filter((t) => t.track_type === n.RETIREMENT_TRACK);
213
+ }
214
+ get savingGoals() {
215
+ return this.orderedGoals.filter((t) => t.track_type === n.SAVINGS_TRACK);
216
+ }
217
+ get ongoingGoalsForMicroWidget() {
218
+ const t = this.allGoals.filter(
219
+ (r) => !r.is_complete && r.track_type !== n.EMERGENCY_FUND_TRACK && r.track_type !== null
220
+ ), e = [
221
+ n.SAVINGS_TRACK,
222
+ n.DEBT_TRACK,
223
+ n.RETIREMENT_TRACK
224
+ ];
225
+ return t.sort((r, a) => {
226
+ const s = r.track_type ? e.indexOf(r.track_type) : -1, h = a.track_type ? e.indexOf(a.track_type) : -1;
227
+ return s - h;
228
+ }).slice(0, 3);
229
+ }
230
+ get isAllGoalDataLoaded() {
231
+ return this.goalsLoaded && this.retirementGoalsLoaded && this.retirementGoalAccountsLoaded && this.monthlyCashFlowProfileLoaded;
232
+ }
233
+ setGoals = (t) => {
234
+ this.goals = t, this.goalsLoaded = !0;
235
+ };
236
+ setRetirementGoals = (t) => {
237
+ this.retirementGoals = t, this.retirementGoalsLoaded = !0;
238
+ };
239
+ setRetirementGoalAccounts = (t) => {
240
+ this.retirementGoalAccounts = t, this.retirementGoalAccountsLoaded = !0;
241
+ };
242
+ setMonthlyCashFlowProfile = (t) => {
243
+ this.monthlyCashFlowProfile = t, this.monthlyCashFlowProfileLoaded = !0;
244
+ };
245
+ loadGoalData = async () => {
246
+ await Promise.all([
247
+ this.loadGoals(),
248
+ this.loadRetirementGoals(),
249
+ this.loadRetirementGoalAccounts(),
250
+ this.loadMonthlyCashFlowProfile()
251
+ ]);
252
+ };
253
+ loadGoals = async () => {
254
+ try {
255
+ const t = await this.api.getGoals();
256
+ this.setGoals(t);
257
+ } catch (t) {
258
+ console.error(`Error occured while getting goals: ${t}`);
259
+ }
260
+ };
261
+ loadRetirementGoals = async () => {
262
+ try {
263
+ const t = await this.api.getRetirementGoals();
264
+ this.setRetirementGoals(t);
265
+ } catch (t) {
266
+ console.error(`Error occurred while loading retirement goals: ${t}`);
267
+ }
268
+ };
269
+ loadRetirementGoalAccounts = async () => {
270
+ try {
271
+ const t = await this.api.getRetirementGoalAccounts();
272
+ this.setRetirementGoalAccounts(t);
273
+ } catch (t) {
274
+ console.error(`Error occurred while loading retirement goal accounts: ${t}`);
275
+ }
276
+ };
277
+ loadMonthlyCashFlowProfile = async () => {
278
+ try {
279
+ const t = await this.api.getMonthlyCashFlowProfile();
280
+ this.setMonthlyCashFlowProfile(t);
281
+ } catch (t) {
282
+ console.error(`Error occurred while loading monthly cash flow profile: ${t}`);
283
+ }
284
+ };
285
+ addGoal = async (t) => {
286
+ try {
287
+ const e = await this.api.addGoal(t);
288
+ this.setGoals([...this.goals, e]);
289
+ } catch (e) {
290
+ console.error(`Error occurred while adding goal: ${e}`);
291
+ }
292
+ };
293
+ addRetirementGoal = async (t) => {
294
+ const e = this.globalStore.copyStore.copy.goals;
295
+ try {
296
+ const r = await this.api.addRetirementGoal(t), a = [], s = this.globalStore.userStore.user.birthday;
297
+ for (const h of this.newRetirementGoalAccounts) {
298
+ const m = await this.api.addRetirementGoalAccount({
299
+ ...h,
300
+ retirement_goal_guid: r.guid
301
+ });
302
+ a.push(m);
303
+ }
304
+ this.setNewRetirementGoalAccounts([]), this.retirementGoals = [
305
+ ...this.retirementGoals,
306
+ {
307
+ ...r,
308
+ amount: r.target_amount,
309
+ name: e.retirement,
310
+ track_type: n.RETIREMENT_TRACK,
311
+ projected_to_complete_at: r.retirement_age && s ? G(r.retirement_age, s) : void 0
312
+ }
313
+ ], this.setRetirementGoalAccounts([...this.retirementGoalAccounts, ...a]);
314
+ } catch (r) {
315
+ console.error(`Error occurred while adding retirement goal: ${r}`);
316
+ }
317
+ };
318
+ addRetirementGoalAccount = async (t) => {
319
+ try {
320
+ const e = await this.api.addRetirementGoalAccount(t);
321
+ _(() => {
322
+ this.retirementGoalAccounts = [...this.retirementGoalAccounts, e];
323
+ });
324
+ } catch (e) {
325
+ console.error(`Error occurred while adding retirement goal account: ${e}`);
326
+ }
327
+ };
328
+ deleteGoal = async (t) => {
329
+ try {
330
+ await this.api.removeGoal(t);
331
+ const e = this.goals.findIndex((r) => r.guid === t);
332
+ e >= 0 && this.goals.splice(e, 1);
333
+ } catch (e) {
334
+ console.error(`Error occured while deleting goal: ${e}`);
335
+ }
336
+ };
337
+ deleteRetirementGoal = async (t) => {
338
+ try {
339
+ const e = this.retirementGoalAccounts.filter(
340
+ (a) => a.retirement_goal_guid === t.guid
341
+ );
342
+ for (const a of e)
343
+ await this.deleteRetirementGoalAccount(a.guid);
344
+ await this.api.removeRetirementGoal(t.guid);
345
+ const r = this.retirementGoals.findIndex((a) => a.guid === t.guid);
346
+ r >= 0 && this.retirementGoals.splice(r, 1);
347
+ } catch (e) {
348
+ console.error(`Error deleting retirement goal: ${e}`);
349
+ }
350
+ };
351
+ deleteRetirementGoalAccount = async (t) => {
352
+ try {
353
+ await this.api.removeRetirementGoalAccount(t);
354
+ const e = this.retirementGoalAccounts.findIndex((r) => r.guid === t);
355
+ e >= 0 && this.retirementGoalAccounts.splice(e, 1);
356
+ } catch (e) {
357
+ console.error(`Error deleting retirement goal account: ${e}`);
358
+ }
359
+ };
360
+ reorderGoals = async (t) => {
361
+ try {
362
+ const e = await this.api.reorderGoals(t);
363
+ _(() => {
364
+ for (const r of e) {
365
+ const a = this.goals.findIndex((s) => s.guid === r.guid);
366
+ a >= 0 && (this.goals[a].position = r.position);
367
+ }
368
+ });
369
+ } catch (e) {
370
+ console.error(`Error reordering goals: ${e}`);
371
+ }
372
+ };
373
+ setAlert = (t) => this.alert = t;
374
+ setNewRetirementGoalAccounts = (t) => {
375
+ this.newRetirementGoalAccounts = t;
376
+ };
377
+ setSelectedGoal = (t) => this.selectedGoal = t;
378
+ updateGoal = async (t) => {
379
+ try {
380
+ const e = await this.api.updateGoal(t);
381
+ _(() => {
382
+ const r = this.goals.findIndex((a) => a.guid === t.guid);
383
+ r >= 0 && (this.goals[r] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(e);
384
+ });
385
+ } catch (e) {
386
+ console.error(`Error occurred while updating goal: ${e}`);
387
+ }
388
+ };
389
+ updateRetirementGoal = async (t) => {
390
+ try {
391
+ const e = await this.api.updateRetirementGoal({
392
+ ...t,
393
+ target_amount: t.amount
394
+ });
395
+ _(() => {
396
+ const r = this.retirementGoals.findIndex((a) => a.guid === t.guid);
397
+ r >= 0 && (this.retirementGoals[r] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(this.allGoals.find((a) => a.guid === t.guid));
398
+ });
399
+ } catch (e) {
400
+ console.error(`Error occurred while updating goal: ${e}`);
401
+ }
402
+ };
403
+ updateMonthlyCashFlowProfile = async (t) => {
404
+ try {
405
+ const e = await this.api.updateMonthlyCashFlowProfile(t);
406
+ this.setMonthlyCashFlowProfile(e);
407
+ } catch (e) {
408
+ console.error(`Error occurred while updating monthly Cash Flow profile: ${e}`);
409
+ }
410
+ };
411
+ }
412
+ export {
413
+ nt as C,
414
+ $ as G,
415
+ c as M,
416
+ n as T,
417
+ ct as a,
418
+ st as b,
419
+ A as c,
420
+ lt as d,
421
+ it as g
422
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsxs as c, jsx as e, Fragment as L } from "react/jsx-runtime";
2
- import u from "react";
2
+ import _ from "react";
3
3
  import { observer as A } from "mobx-react-lite";
4
4
  import M from "@mui/material/Box";
5
5
  import T from "@mui/material/Divider";
@@ -10,14 +10,14 @@ import ae from "@mui/material/ListItem";
10
10
  import ie from "@mui/material/ListItemAvatar";
11
11
  import se from "@mui/material/ListItemButton";
12
12
  import ce from "@mui/material/ListItemText";
13
- import { F as d, S as N, D as Y, g as Q, R as E, e as le } from "./RecurringTransactions-Bf4lX0Cn.mjs";
13
+ import { F as d, S as N, D as Y, g as Q, R, e as le } from "./RepeatingTransaction-miZVnk_A.mjs";
14
14
  import { subDays as de } from "date-fns/subDays";
15
15
  import { startOfToday as z } from "date-fns/startOfToday";
16
- import { endOfMonth as ue } from "date-fns/endOfMonth";
17
- import { parseISO as _e } from "date-fns/parseISO";
16
+ import { endOfMonth as _e } from "date-fns/endOfMonth";
17
+ import { parseISO as ue } from "date-fns/parseISO";
18
18
  import $ from "@mui/material/Button";
19
19
  import { Delete as me, Add as pe, ReceiptLong as he } from "@mxenabled/mx-icons";
20
- import { T as X, a as ye, u as ge, S as fe, b as Ce } from "./TransactionDetails-7MHOshKQ.mjs";
20
+ import { T as X, a as ye, u as ge, S as fe, b as Ce } from "./TransactionDetails-BDhz3DLT.mjs";
21
21
  import { getDayOfYear as be } from "date-fns/getDayOfYear";
22
22
  import { setDayOfYear as xe } from "date-fns/setDayOfYear";
23
23
  import { AdapterDateFns as Se } from "@mui/x-date-pickers/AdapterDateFnsV3";
@@ -26,14 +26,14 @@ import { LocalizationProvider as we } from "@mui/x-date-pickers/LocalizationProv
26
26
  import { u as w, j as G, g as P, b as Ae, h as Z, o as Ie } from "./hooks-ZMp65DFz.mjs";
27
27
  import { b as De, f as J } from "./NumberFormatting-DjTD0t3W.mjs";
28
28
  import { D as O } from "./Drawer-DV4NTsFg.mjs";
29
- import { A as R } from "./WidgetContainer-CrK6tyHr.mjs";
30
- import { f as Ee, D as Re, a as Te } from "./Dialog-B4PI-_bL.mjs";
29
+ import { A as E } from "./WidgetContainer-BbPS3Yxz.mjs";
30
+ import { f as Re, D as Ee, a as Te } from "./Dialog-B4PI-_bL.mjs";
31
31
  import { formatISO as Le } from "date-fns/formatISO";
32
32
  import { fromUnixTime as Oe } from "date-fns/fromUnixTime";
33
33
  import { S as ke } from "./SearchBox-B2_zLv8-.mjs";
34
34
  import { h as Ne } from "./DateUtil-D7U-nc1Y.mjs";
35
35
  import { b as B } from "./Category-CevNQ03n.mjs";
36
- import { T as V } from "./User-LJpEwPtn.mjs";
36
+ import { T as V } from "./User-B0LnmiKO.mjs";
37
37
  const ee = ({
38
38
  frequency: n,
39
39
  firstDay: t,
@@ -42,7 +42,7 @@ const ee = ({
42
42
  onFirstDayChange: s,
43
43
  onSecondDayChange: l
44
44
  }) => {
45
- const { recurring: r } = w(), a = u.useMemo(
45
+ const { recurring: r } = w(), a = _.useMemo(
46
46
  () => [
47
47
  { id: d.EveryWeek, label: r.frequency_every_week },
48
48
  { id: d.EveryOtherWeek, label: r.frequency_every_other_week },
@@ -118,7 +118,7 @@ const ee = ({
118
118
  ) })
119
119
  ] });
120
120
  }, Me = A(({ repeatingTransaction: n }) => {
121
- const { recurring: t } = w(), { updateRepeatingTransaction: o } = G(), { onEvent: i } = P(), [s, l] = u.useState(!1), [r, a] = u.useState(n.recurrence_type), [m, y] = u.useState(n.recurrence_day), [C, v] = u.useState(n.second_recurrence_day), b = async () => {
121
+ const { recurring: t } = w(), { updateRepeatingTransaction: o } = G(), { onEvent: i } = P(), [s, l] = _.useState(!1), [r, a] = _.useState(n.recurrence_type), [m, y] = _.useState(n.recurrence_day), [C, v] = _.useState(n.second_recurrence_day), b = async () => {
122
122
  await o({
123
123
  ...n,
124
124
  recurrence_type: r,
@@ -126,7 +126,7 @@ const ee = ({
126
126
  second_recurrence_day: C
127
127
  }), l(!1);
128
128
  }, g = () => {
129
- l(!0), i(R.RECURRING_TRANSACTIONS_DETAILS_CLICK_PAYMENT_SCHEDULE);
129
+ l(!0), i(E.RECURRING_TRANSACTIONS_DETAILS_CLICK_PAYMENT_SCHEDULE);
130
130
  };
131
131
  return /* @__PURE__ */ c(L, { children: [
132
132
  /* @__PURE__ */ e(
@@ -162,21 +162,21 @@ const ee = ({
162
162
  ] });
163
163
  }), Fe = A(
164
164
  ({ onDeleted: n, recurringTransaction: t }) => {
165
- const { recurring: o } = w(), { selectedAccountGuids: i } = Ae(), { onEvent: s } = P(), { deleteRepeatingTransaction: l } = G(), { setFilter: r, transactions: a } = Z(), { amount: m, description: y, merchant_guid: C } = t, [v, b] = u.useState(!1), [g, I] = u.useState("");
166
- u.useEffect(() => {
165
+ const { recurring: o } = w(), { selectedAccountGuids: i } = Ae(), { onEvent: s } = P(), { deleteRepeatingTransaction: l } = G(), { setFilter: r, transactions: a } = Z(), { amount: m, description: y, merchant_guid: C } = t, [v, b] = _.useState(!1), [g, I] = _.useState("");
166
+ _.useEffect(() => {
167
167
  r({
168
168
  accounts: i,
169
- dateRange: { start: de(z(), 90), end: ue(z()) },
170
- custom: (_) => _.repeating_transaction_guid === t.guid
169
+ dateRange: { start: de(z(), 90), end: _e(z()) },
170
+ custom: (u) => u.repeating_transaction_guid === t.guid
171
171
  });
172
172
  }, [t]);
173
- const f = u.useMemo(
174
- () => a.find((_) => _.guid === g),
173
+ const f = _.useMemo(
174
+ () => a.find((u) => u.guid === g),
175
175
  [g, a]
176
- ), p = t.repeating_transaction_type === E.Income, k = async () => {
176
+ ), p = t.repeating_transaction_type === R.Income, k = async () => {
177
177
  await l(t.guid), n();
178
178
  }, U = () => {
179
- b(!0), s(R.RECURRING_TRANSACTIONS_DETAILS_CLICK_DELETE);
179
+ b(!0), s(E.RECURRING_TRANSACTIONS_DETAILS_CLICK_DELETE);
180
180
  };
181
181
  return /* @__PURE__ */ c(h, { bgcolor: "background.default", direction: "column", height: "100%", children: [
182
182
  /* @__PURE__ */ c(h, { direction: "column", m: 24, children: [
@@ -194,9 +194,9 @@ const ee = ({
194
194
  p ? "+" : "",
195
195
  J(m, "0,0.00")
196
196
  ] }),
197
- /* @__PURE__ */ e(S, { color: "text.secondary", variant: "body2", children: `${o.next_payment_date}: ${Ee(
198
- _e(t.predicted_occurs_on),
199
- Re.MONTH_DAY_YEAR
197
+ /* @__PURE__ */ e(S, { color: "text.secondary", variant: "body2", children: `${o.next_payment_date}: ${Re(
198
+ ue(t.predicted_occurs_on),
199
+ Ee.MONTH_DAY_YEAR
200
200
  )}` })
201
201
  ] }),
202
202
  /* @__PURE__ */ c(K, { sx: { bgcolor: "background.paper" }, children: [
@@ -206,7 +206,7 @@ const ee = ({
206
206
  {
207
207
  iconName: "checkbook",
208
208
  label: o.account,
209
- value: t.account.institutionName || ""
209
+ value: t.account.displayName || ""
210
210
  }
211
211
  ),
212
212
  /* @__PURE__ */ e(T, { variant: "inset" })
@@ -266,10 +266,10 @@ const ee = ({
266
266
  ), Ge = A(
267
267
  ({ onClick: n = () => {
268
268
  }, repeatingTransaction: t }) => {
269
- const { recurring: o } = w(), [i, s] = u.useState(!1), l = u.useMemo(
269
+ const { recurring: o } = w(), [i, s] = _.useState(!1), l = _.useMemo(
270
270
  () => t.transactions.length === 0 ? "" : t.transactions[0].category_guid || "",
271
271
  [t]
272
- ), r = t.account?.institutionName || "", a = t.repeating_transaction_type === E.Income, m = Q(o, t, !0);
272
+ ), r = t.account?.displayName || "", a = t.repeating_transaction_type === R.Income, m = Q(o, t, !0);
273
273
  return /* @__PURE__ */ c(ae, { disableGutters: !0, disablePadding: !0, children: [
274
274
  /* @__PURE__ */ c(se, { onClick: () => {
275
275
  n(t), s(!0);
@@ -332,7 +332,7 @@ const ee = ({
332
332
  ariaLabelClose: o.close_drawer_aria,
333
333
  isOpen: i,
334
334
  onClose: () => s(!1),
335
- title: t.repeating_transaction_type === E.Income ? o.income_details : o.expense_details,
335
+ title: t.repeating_transaction_type === R.Income ? o.income_details : o.expense_details,
336
336
  children: /* @__PURE__ */ e(
337
337
  Fe,
338
338
  {
@@ -417,33 +417,33 @@ const ee = ({
417
417
  label: t,
418
418
  onAddRecurringTransaction: o = () => null
419
419
  }) => {
420
- const { recurring: i } = w(), { filter: s, setFilter: l, transactions: r } = Z(), { addRepeatingTransaction: a } = G(), { user: m } = Ie(), [y, C] = u.useState(!1), [v, b] = u.useState(""), [g, I] = u.useState(d.EveryMonth), [f, p] = u.useState(1), [k, U] = u.useState(15), _ = u.useMemo(
420
+ const { recurring: i } = w(), { filter: s, setFilter: l, transactions: r } = Z(), { addRepeatingTransaction: a } = G(), { user: m } = Ie(), [y, C] = _.useState(!1), [v, b] = _.useState(""), [g, I] = _.useState(d.EveryMonth), [f, p] = _.useState(1), [k, U] = _.useState(15), u = _.useMemo(
421
421
  () => r.find((x) => x.guid === v),
422
422
  [v, r]
423
423
  ), ne = () => {
424
424
  C(!0), l(n ? { ...s, custom: W } : { ...s, custom: q });
425
425
  }, re = async () => {
426
- if (!_) {
426
+ if (!u) {
427
427
  j();
428
428
  return;
429
429
  }
430
430
  o();
431
- const x = le(g, Oe(_.date)), D = {
432
- account_guid: _.account_guid,
433
- amount: _.amount,
431
+ const x = le(g, Oe(u.date)), D = {
432
+ account_guid: u.account_guid,
433
+ amount: u.amount,
434
434
  created_by: 0,
435
435
  // User
436
- merchant_guid: _.merchant_guid,
437
- description: _.payee || _.description || _.feed_description,
436
+ merchant_guid: u.merchant_guid,
437
+ description: u.payee || u.description || u.feed_description,
438
438
  predicted_occurs_on: Le(x, { representation: "date" }),
439
439
  recurrence_day: f,
440
440
  recurrence_type: g,
441
- repeating_transaction_type: n ? E.Income : E.Bill,
441
+ repeating_transaction_type: n ? R.Income : R.Bill,
442
442
  second_recurrence_day: k,
443
- transaction_type: _.transaction_type,
443
+ transaction_type: u.transaction_type,
444
444
  user_guid: m.guid
445
445
  };
446
- await a(D, _), j();
446
+ await a(D, u), j();
447
447
  }, j = () => {
448
448
  b(""), C(!1);
449
449
  };
@@ -479,7 +479,7 @@ const ee = ({
479
479
  onClose: () => b(""),
480
480
  onPrimaryAction: re,
481
481
  title: n ? i.income_details : i.expense_details,
482
- children: _ && /* @__PURE__ */ e(
482
+ children: u && /* @__PURE__ */ e(
483
483
  Ue,
484
484
  {
485
485
  firstDay: f,
@@ -488,7 +488,7 @@ const ee = ({
488
488
  onFrequencyChange: I,
489
489
  onSecondDayChange: U,
490
490
  secondDay: k,
491
- transaction: _
491
+ transaction: u
492
492
  }
493
493
  )
494
494
  }
@@ -509,7 +509,7 @@ const ee = ({
509
509
  label: r,
510
510
  onAddRecurringTransaction: () => {
511
511
  o(
512
- i ? R.RECURRING_TRANSACTIONS_CLICK_ADD_INCOME : R.RECURRING_ACTIVITY_CLICK_ADD_EXPENSE
512
+ i ? E.RECURRING_TRANSACTIONS_CLICK_ADD_INCOME : E.RECURRING_ACTIVITY_CLICK_ADD_EXPENSE
513
513
  );
514
514
  }
515
515
  }
@@ -517,14 +517,14 @@ const ee = ({
517
517
  ] });
518
518
  }
519
519
  ), At = A(({ forOverview: n = !1 }) => {
520
- const { recurring: t } = w(), { repeatingTransactions: o } = G(), { onEvent: i } = P(), s = (a) => {
521
- i(R.RECURRING_TRANSACTIONS_CLICK_INCOME, {
520
+ const { recurring: t } = w(), { detailedRepeatingTransactions: o } = G(), { onEvent: i } = P(), s = (a) => {
521
+ i(E.RECURRING_TRANSACTIONS_CLICK_INCOME, {
522
522
  repeating_transaction_guid: a.guid
523
523
  });
524
524
  }, l = () => {
525
- i(R.RECURRING_TRANSACTIONS_CLICK_ADD_INCOME);
525
+ i(E.RECURRING_TRANSACTIONS_CLICK_ADD_INCOME);
526
526
  }, r = o.filter(
527
- (a) => a.repeating_transaction_type === E.Income && (a.transactions.length > 0 || a.recurrence_type === d.EveryYear)
527
+ (a) => a.repeating_transaction_type === R.Income && (a.transactions.length > 0 || a.recurrence_type === d.EveryYear)
528
528
  );
529
529
  return /* @__PURE__ */ e(L, { children: r.length !== 0 ? /* @__PURE__ */ c(
530
530
  h,
@@ -535,7 +535,7 @@ const ee = ({
535
535
  },
536
536
  children: [
537
537
  n && /* @__PURE__ */ e(S, { bold: !0, sx: { mb: 4, mt: 12, mx: 24 }, variant: "Small", children: t.income }),
538
- /* @__PURE__ */ e(M, { sx: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ e(K, { sx: { bgcolor: "background.paper" }, children: r.map((a, m) => /* @__PURE__ */ c(u.Fragment, { children: [
538
+ /* @__PURE__ */ e(M, { sx: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ e(K, { sx: { bgcolor: "background.paper" }, children: r.map((a, m) => /* @__PURE__ */ c(_.Fragment, { children: [
539
539
  /* @__PURE__ */ e(Ge, { onClick: s, repeatingTransaction: a }),
540
540
  /* @__PURE__ */ e(
541
541
  T,