@mx-cartographer/experiences 6.26.1-alpha.mega1 → 6.26.2-ram1-alpha-finstrong-financial-strength-section

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/CHANGELOG.md +13 -5
  2. package/dist/categories/util/CategoryUtil.d.ts +2 -3
  3. package/dist/common/context/hooks.d.ts +13 -13
  4. package/dist/common/types/Category.d.ts +8 -2
  5. package/dist/common/types/index.d.ts +1 -1
  6. package/dist/common/types/localization/FinstrongCopy.d.ts +10 -0
  7. package/dist/finstrong/FinancialStrengthCard.d.ts +3 -0
  8. package/dist/finstrong/components/ConnectMoreAccountsCard.d.ts +5 -1
  9. package/dist/finstrong/stores/FinstrongStore.d.ts +2 -2
  10. package/dist/finstrong/util/finstrongUtils.d.ts +1 -1
  11. package/dist/help/components/content/section/index.d.ts +15 -15
  12. package/dist/index.d.ts +22 -0
  13. package/dist/index.es.js +29963 -0
  14. package/dist/index.es.js.map +1 -0
  15. package/dist/trends/components/CategoriesList.d.ts +5 -5
  16. package/dist/trends/components/CategoriesListItem.d.ts +4 -7
  17. package/dist/trends/components/CategoryDetailChart.d.ts +1 -5
  18. package/dist/trends/stores/TrendsStore.d.ts +16 -11
  19. package/package.json +3 -91
  20. package/dist/AccountStore-DkL93tXL.mjs +0 -317
  21. package/dist/AccountStore-DkL93tXL.mjs.map +0 -1
  22. package/dist/BudgetUtil-CVqAdv-j.mjs +0 -187
  23. package/dist/BudgetUtil-CVqAdv-j.mjs.map +0 -1
  24. package/dist/CashflowStore-gPEEBiXo.mjs +0 -53
  25. package/dist/CashflowStore-gPEEBiXo.mjs.map +0 -1
  26. package/dist/CategoryStore-m7oieLzP.mjs +0 -260
  27. package/dist/CategoryStore-m7oieLzP.mjs.map +0 -1
  28. package/dist/ConnectMiniWidget-CQWafYtQ.mjs +0 -22966
  29. package/dist/ConnectMiniWidget-CQWafYtQ.mjs.map +0 -1
  30. package/dist/DebtsStore-cUhIgJx6.mjs +0 -145
  31. package/dist/DebtsStore-cUhIgJx6.mjs.map +0 -1
  32. package/dist/Donut-CGNFni9y.mjs +0 -58
  33. package/dist/Donut-CGNFni9y.mjs.map +0 -1
  34. package/dist/FinstrongStore-BDG7l0nI.mjs +0 -183
  35. package/dist/FinstrongStore-BDG7l0nI.mjs.map +0 -1
  36. package/dist/GoalStore-o2waGeyf.mjs +0 -293
  37. package/dist/GoalStore-o2waGeyf.mjs.map +0 -1
  38. package/dist/Loader-CwdK8lfx.mjs +0 -147
  39. package/dist/Loader-CwdK8lfx.mjs.map +0 -1
  40. package/dist/MerchantStore-Cck9IGIH.mjs +0 -125
  41. package/dist/MerchantStore-Cck9IGIH.mjs.map +0 -1
  42. package/dist/NetWorthStore-D5eUfGQt.mjs +0 -66
  43. package/dist/NetWorthStore-D5eUfGQt.mjs.map +0 -1
  44. package/dist/NotificationStore-DCxw8W7u.mjs +0 -141
  45. package/dist/NotificationStore-DCxw8W7u.mjs.map +0 -1
  46. package/dist/RecurringTransactionsStore-Bijrgllq.mjs +0 -337
  47. package/dist/RecurringTransactionsStore-Bijrgllq.mjs.map +0 -1
  48. package/dist/SettingsStore-BhOYgUOa.mjs +0 -352
  49. package/dist/SettingsStore-BhOYgUOa.mjs.map +0 -1
  50. package/dist/TransactionApi-Dnbyi1JL.mjs +0 -175
  51. package/dist/TransactionApi-Dnbyi1JL.mjs.map +0 -1
  52. package/dist/TransactionStore-CiEtt5XJ.mjs +0 -417
  53. package/dist/TransactionStore-CiEtt5XJ.mjs.map +0 -1
  54. package/dist/TrendsStore-Idq3QfoA.mjs +0 -131
  55. package/dist/TrendsStore-Idq3QfoA.mjs.map +0 -1
  56. package/dist/accounts/index.es.js +0 -18
  57. package/dist/accounts/index.es.js.map +0 -1
  58. package/dist/analytics/index.es.js +0 -170
  59. package/dist/analytics/index.es.js.map +0 -1
  60. package/dist/budgets/index.es.js +0 -1116
  61. package/dist/budgets/index.es.js.map +0 -1
  62. package/dist/cashflow/index.es.js +0 -118
  63. package/dist/cashflow/index.es.js.map +0 -1
  64. package/dist/categories/index.es.js +0 -10
  65. package/dist/categories/index.es.js.map +0 -1
  66. package/dist/common/index.es.js +0 -1549
  67. package/dist/common/index.es.js.map +0 -1
  68. package/dist/dashboard/index.es.js +0 -257
  69. package/dist/dashboard/index.es.js.map +0 -1
  70. package/dist/debts/index.es.js +0 -9
  71. package/dist/debts/index.es.js.map +0 -1
  72. package/dist/finstrong/index.es.js +0 -11
  73. package/dist/finstrong/index.es.js.map +0 -1
  74. package/dist/goals/index.es.js +0 -9
  75. package/dist/goals/index.es.js.map +0 -1
  76. package/dist/help/index.es.js +0 -6
  77. package/dist/help/index.es.js.map +0 -1
  78. package/dist/investments/index.es.js +0 -1694
  79. package/dist/investments/index.es.js.map +0 -1
  80. package/dist/merchants/index.es.js +0 -7
  81. package/dist/merchants/index.es.js.map +0 -1
  82. package/dist/microinsights/index.es.js +0 -21
  83. package/dist/microinsights/index.es.js.map +0 -1
  84. package/dist/networth/index.es.js +0 -11
  85. package/dist/networth/index.es.js.map +0 -1
  86. package/dist/notifications/index.es.js +0 -116
  87. package/dist/notifications/index.es.js.map +0 -1
  88. package/dist/recurringtransactions/index.es.js +0 -14
  89. package/dist/recurringtransactions/index.es.js.map +0 -1
  90. package/dist/settings/index.es.js +0 -112
  91. package/dist/settings/index.es.js.map +0 -1
  92. package/dist/spending/index.es.js +0 -632
  93. package/dist/spending/index.es.js.map +0 -1
  94. package/dist/transactions/index.es.js +0 -19
  95. package/dist/transactions/index.es.js.map +0 -1
  96. package/dist/trends/index.es.js +0 -10
  97. package/dist/trends/index.es.js.map +0 -1
@@ -1,293 +0,0 @@
1
- import { makeAutoObservable as h, runInAction as n } from "mobx";
2
- import "bowser";
3
- import "date-fns/getUnixTime";
4
- import { ae as d, af as r, aN as a } from "./ConnectMiniWidget-CQWafYtQ.mjs";
5
- import "date-fns/intlFormat";
6
- import "date-fns/addMonths";
7
- import "date-fns/addQuarters";
8
- import "date-fns/addWeeks";
9
- import "date-fns/addYears";
10
- import "date-fns/getDay";
11
- import "date-fns/isBefore";
12
- import "date-fns/nextDay";
13
- import "date-fns/setDate";
14
- import "date-fns/startOfToday";
15
- import "date-fns/fromUnixTime";
16
- import "react";
17
- import "numeral";
18
- import "@mui/material";
19
- import "react/jsx-runtime";
20
- import "@mui/material/Button";
21
- import "@mxenabled/mxui";
22
- import "@mui/material/Tooltip";
23
- import "@mui/material/Box";
24
- import "@mui/material/IconButton";
25
- import "./Loader-CwdK8lfx.mjs";
26
- import "@mui/material/styles/useTheme";
27
- import "@mui/material/useMediaQuery";
28
- import "@mxenabled/cssinjs";
29
- import "date-fns/addDays";
30
- import "date-fns/eachDayOfInterval";
31
- import "date-fns/eachWeekOfInterval";
32
- import "date-fns/endOfMonth";
33
- import "date-fns/format";
34
- import "date-fns/isSameMonth";
35
- import "date-fns/startOfMonth";
36
- import "date-fns/subMonths";
37
- import "@mui/material/Paper";
38
- import "@mxenabled/mx-icons";
39
- import "date-fns/isSameDay";
40
- import "date-fns/isWithinInterval";
41
- import "d3";
42
- import "@mui/material/styles";
43
- import "@mui/x-charts";
44
- import "@mui/x-charts/ChartsTooltip";
45
- import "@mui/material/Stack";
46
- import "date-fns/differenceInCalendarDays";
47
- import "date-fns/endOfToday";
48
- import "date-fns/endOfYear";
49
- import "date-fns/startOfYear";
50
- import "date-fns/subDays";
51
- import "date-fns/subYears";
52
- import "@mui/material/ButtonGroup";
53
- import "@mui/material/Tab";
54
- import "@mui/material/Tabs";
55
- import "@mui/material/ToggleButton";
56
- import "@mui/material/ToggleButtonGroup";
57
- import "@mui/material/Dialog";
58
- import "@mui/material/DialogContent";
59
- import "@mui/material/Card";
60
- import "@mui/material/CardContent";
61
- import "@mui/material/CardHeader";
62
- import "uuid";
63
- import "@mui/material/CircularProgress";
64
- import "@mui/material/FormControlLabel";
65
- import "@mui/material/Radio";
66
- import "@mui/material/Avatar";
67
- import "@mui/material/ListItem";
68
- import "@mui/material/ListItemAvatar";
69
- import "@mui/material/ListItemButton";
70
- import "@mui/material/ListItemText";
71
- import "@mui/material/ListItemIcon";
72
- import "@mui/material/MenuItem";
73
- import "@mui/material/TextField";
74
- import "@mui/material/Switch";
75
- import "posthog-js";
76
- import "date-fns/differenceInDays";
77
- import "@mui/x-data-grid-pro";
78
- import "date-fns";
79
- import "@mui/material/Divider";
80
- import "@mui/material/List";
81
- import "date-fns/formatISO";
82
- import "date-fns/isAfter";
83
- import "date-fns/parseISO";
84
- import "date-fns/subQuarters";
85
- import "date-fns/lastDayOfMonth";
86
- import "date-fns/setDayOfYear";
87
- import "date-fns/addSeconds";
88
- import "date-fns/differenceInCalendarMonths";
89
- import "date-fns/getMonth";
90
- class m {
91
- fetchInstance;
92
- constructor(t, e) {
93
- this.fetchInstance = new d(t, e);
94
- }
95
- addGoal = async (t) => this.fetchInstance.post(r.GOALS, t).then((e) => e.goal);
96
- addRetirementGoal = async (t) => this.fetchInstance.post(r.RETIREMENT_GOALS, t).then((e) => e.retirement_goal);
97
- addRetirementGoalAccount = async (t) => this.fetchInstance.post(r.RETIREMENT_GOAL_ACCOUNTS, t).then((e) => e.retirement_goal_account);
98
- getGoalByGuid = async (t) => this.fetchInstance.get(`${r.GOALS}/${t}`).then((e) => e.goal);
99
- getGoals = async () => this.fetchInstance.get(r.GOALS).then((t) => t.goals);
100
- getMonthlyCashFlowProfile = async () => this.fetchInstance.get(r.MONTHLY_CASH_FLOW_PROFILE).then((t) => t.monthly_cash_flow_profile);
101
- getRetirementGoals = async () => this.fetchInstance.get(r.RETIREMENT_GOALS).then((t) => t.retirement_goals);
102
- getRetirementGoalAccounts = async () => this.fetchInstance.get(r.RETIREMENT_GOAL_ACCOUNTS).then((t) => t.retirement_goal_accounts);
103
- removeGoal = async (t) => this.fetchInstance.delete(`${r.GOALS}/${t}`).then((e) => e);
104
- removeRetirementGoal = async (t) => this.fetchInstance.delete(`${r.RETIREMENT_GOALS}/${t}`).then((e) => e);
105
- removeRetirementGoalAccount = async (t) => this.fetchInstance.delete(`${r.RETIREMENT_GOAL_ACCOUNTS}/${t}`).then((e) => e);
106
- reorderGoals = async (t) => this.fetchInstance.post(`${r.GOALS}/reposition`, { goals: t }).then((e) => e.goals);
107
- updateGoal = async (t) => this.fetchInstance.put(`${r.GOALS}/${t.guid}`, t).then((e) => e.goal);
108
- updateMonthlyCashFlowProfile = async (t) => this.fetchInstance.put(`${r.MONTHLY_CASH_FLOW_PROFILE}`, t).then((e) => e.monthly_cash_flow_profile);
109
- updateRetirementGoal = async (t) => this.fetchInstance.put(`${r.RETIREMENT_GOALS}/${t.guid}`, t).then((e) => e.retirement_goal);
110
- }
111
- class zt {
112
- globalStore;
113
- api = new m("/", "");
114
- alert = "";
115
- goals = [];
116
- retirementGoalAccounts = [];
117
- newRetirementGoalAccounts = [];
118
- selectedGoal = void 0;
119
- monthlyCashFlowProfile = void 0;
120
- goalsLoaded = !1;
121
- constructor(t) {
122
- this.globalStore = t, this.api = new m(t.endpoint, t.sessionToken), h(this);
123
- }
124
- get orderedGoals() {
125
- return this.goals.slice().sort((t, e) => t.position - e.position);
126
- }
127
- get debtGoals() {
128
- return this.orderedGoals.filter((t) => t.track_type === a.DEBT_TRACK);
129
- }
130
- get retirmentGoals() {
131
- return this.orderedGoals.filter((t) => t.track_type === a.RETIREMENT_TRACK);
132
- }
133
- get savingGoals() {
134
- return this.orderedGoals.filter((t) => t.track_type === a.SAVINGS_TRACK);
135
- }
136
- get ongoingGoalsForMicroWidget() {
137
- const t = this.goals.filter(
138
- (o) => !o.is_complete && o.track_type !== a.EMERGENCY_FUND_TRACK && o.track_type !== null
139
- ), e = [
140
- a.SAVINGS_TRACK,
141
- a.DEBT_TRACK,
142
- a.RETIREMENT_TRACK
143
- ];
144
- return t.sort((o, i) => {
145
- const s = o.track_type ? e.indexOf(o.track_type) : -1, c = i.track_type ? e.indexOf(i.track_type) : -1;
146
- return s - c;
147
- }).slice(0, 3);
148
- }
149
- addGoal = async (t) => {
150
- try {
151
- const e = await this.api.addGoal(t);
152
- n(() => {
153
- this.goals = [...this.goals, e];
154
- });
155
- } catch (e) {
156
- console.error(`Error occurred while adding goal: ${e}`);
157
- }
158
- };
159
- addRetirementGoal = async (t) => {
160
- const e = this.globalStore.copyStore.copy.goals;
161
- try {
162
- const o = await this.api.addRetirementGoal(t), i = [];
163
- for (const s of this.newRetirementGoalAccounts) {
164
- const c = await this.api.addRetirementGoalAccount({
165
- ...s,
166
- retirement_goal_guid: o.guid
167
- });
168
- i.push(c);
169
- }
170
- this.setNewRetirementGoalAccounts([]), n(() => {
171
- this.goals = [
172
- ...this.goals,
173
- {
174
- ...o,
175
- amount: o.target_amount,
176
- name: e.retirement,
177
- track_type: a.RETIREMENT_TRACK
178
- }
179
- ], this.retirementGoalAccounts = [...this.retirementGoalAccounts, ...i];
180
- });
181
- } catch (o) {
182
- console.error(`Error occurred while adding retirement goal: ${o}`);
183
- }
184
- };
185
- addRetirementGoalAccount = async (t) => {
186
- try {
187
- const e = await this.api.addRetirementGoalAccount(t);
188
- n(() => {
189
- this.retirementGoalAccounts = [...this.retirementGoalAccounts, e];
190
- });
191
- } catch (e) {
192
- console.error(`Error occurred while adding retirement goal account: ${e}`);
193
- }
194
- };
195
- loadGoals = async () => {
196
- const t = this.globalStore.copyStore.copy.goals;
197
- try {
198
- const e = await this.api.getGoals(), o = await this.api.getRetirementGoals(), i = await this.api.getRetirementGoalAccounts(), s = await this.api.getMonthlyCashFlowProfile(), c = [
199
- ...e,
200
- ...o.map((l) => ({
201
- ...l,
202
- amount: l.target_amount,
203
- name: t.retirement,
204
- track_type: a.RETIREMENT_TRACK
205
- }))
206
- ];
207
- n(() => {
208
- this.goals = c, this.retirementGoalAccounts = i, this.monthlyCashFlowProfile = s, this.goalsLoaded = !0;
209
- });
210
- } catch (e) {
211
- console.error(`Error occured while getting goals: ${e}`);
212
- }
213
- };
214
- deleteGoal = async (t) => {
215
- try {
216
- await this.api.removeGoal(t), n(() => {
217
- const e = this.goals.findIndex((o) => o.guid === t);
218
- e >= 0 && this.goals.splice(e, 1);
219
- });
220
- } catch (e) {
221
- console.error(`Error occured while deleting goal: ${e}`);
222
- }
223
- };
224
- deleteRetirementGoal = async (t) => {
225
- try {
226
- const e = this.retirementGoalAccounts.filter(
227
- (o) => o.retirement_goal_guid === t.guid
228
- );
229
- for (const o of e)
230
- await this.deleteRetirementGoalAccount(o.guid);
231
- await this.api.removeRetirementGoal(t.guid), n(() => {
232
- const o = this.goals.findIndex((i) => i.guid === t.guid);
233
- o >= 0 && this.goals.splice(o, 1);
234
- });
235
- } catch (e) {
236
- console.error(`Error deleting retirement goal: ${e}`);
237
- }
238
- };
239
- deleteRetirementGoalAccount = async (t) => {
240
- try {
241
- await this.api.removeRetirementGoalAccount(t), n(() => {
242
- const e = this.retirementGoalAccounts.findIndex((o) => o.guid === t);
243
- e >= 0 && this.retirementGoalAccounts.splice(e, 1);
244
- });
245
- } catch (e) {
246
- console.error(`Error deleting retirement goal account: ${e}`);
247
- }
248
- };
249
- reorderGoals = async (t) => {
250
- try {
251
- const e = await this.api.reorderGoals(t);
252
- n(() => {
253
- for (const o of e) {
254
- const i = this.goals.findIndex((s) => s.guid === o.guid);
255
- i >= 0 && (this.goals[i].position = o.position);
256
- }
257
- });
258
- } catch (e) {
259
- console.error(`Error reordering goals: ${e}`);
260
- }
261
- };
262
- setAlert = (t) => this.alert = t;
263
- setNewRetirementGoalAccounts = (t) => {
264
- this.newRetirementGoalAccounts = t;
265
- };
266
- setSelectedGoal = (t) => this.selectedGoal = t;
267
- updateGoal = async (t) => {
268
- try {
269
- const e = await this.api.updateGoal(t);
270
- n(() => {
271
- const o = this.goals.findIndex((i) => i.guid === t.guid);
272
- o >= 0 && (this.goals[o] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(e);
273
- });
274
- } catch (e) {
275
- console.error(`Error occurred while updating goal: ${e}`);
276
- }
277
- };
278
- updateMonthlyCashFlowProfile = async (t) => {
279
- try {
280
- const e = await this.api.updateMonthlyCashFlowProfile(t);
281
- n(() => {
282
- this.monthlyCashFlowProfile = e;
283
- });
284
- } catch (e) {
285
- console.error(`Error occurred while updating monthly Cash Flow profile: ${e}`);
286
- }
287
- };
288
- }
289
- export {
290
- m as G,
291
- zt as a
292
- };
293
- //# sourceMappingURL=GoalStore-o2waGeyf.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GoalStore-o2waGeyf.mjs","sources":["../src/goals/api/GoalApi.ts","../src/goals/stores/GoalStore.ts"],"sourcesContent":["import {\n ApiEndpoints,\n Fetch,\n Goal,\n MonthlyCashFlowProfile,\n RetirementGoalAccount,\n} from '../../common'\n\nexport class GoalApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n addGoal = async (goal: Goal) => {\n return this.fetchInstance.post(ApiEndpoints.GOALS, goal).then((data) => data.goal)\n }\n\n addRetirementGoal = async (goal: Goal) => {\n return this.fetchInstance\n .post(ApiEndpoints.RETIREMENT_GOALS, goal)\n .then((data) => data.retirement_goal)\n }\n\n addRetirementGoalAccount = async (retirementAccount: RetirementGoalAccount) => {\n return this.fetchInstance\n .post(ApiEndpoints.RETIREMENT_GOAL_ACCOUNTS, retirementAccount)\n .then((data) => data.retirement_goal_account)\n }\n\n getGoalByGuid = async (guid: string) => {\n return this.fetchInstance.get(`${ApiEndpoints.GOALS}/${guid}`).then((data) => data.goal)\n }\n\n getGoals = async () => {\n return this.fetchInstance.get(ApiEndpoints.GOALS).then((data) => data.goals)\n }\n\n getMonthlyCashFlowProfile = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.MONTHLY_CASH_FLOW_PROFILE)\n .then((data) => data.monthly_cash_flow_profile)\n }\n\n getRetirementGoals = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.RETIREMENT_GOALS)\n .then((data) => data.retirement_goals)\n }\n\n getRetirementGoalAccounts = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.RETIREMENT_GOAL_ACCOUNTS)\n .then((data) => data.retirement_goal_accounts)\n }\n\n removeGoal = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.GOALS}/${guid}`).then((data) => data)\n }\n\n removeRetirementGoal = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.RETIREMENT_GOALS}/${guid}`)\n .then((data) => data)\n }\n\n removeRetirementGoalAccount = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.RETIREMENT_GOAL_ACCOUNTS}/${guid}`)\n .then((data) => data)\n }\n\n reorderGoals = async (goals: Goal[]) => {\n return this.fetchInstance\n .post(`${ApiEndpoints.GOALS}/reposition`, { goals: goals })\n .then((data) => data.goals)\n }\n\n updateGoal = async (goal: Goal) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.GOALS}/${goal.guid}`, goal)\n .then((data) => data.goal)\n }\n\n updateMonthlyCashFlowProfile = async (profile: MonthlyCashFlowProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.MONTHLY_CASH_FLOW_PROFILE}`, profile)\n .then((data) => data.monthly_cash_flow_profile)\n }\n\n updateRetirementGoal = async (goal: Goal) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.RETIREMENT_GOALS}/${goal.guid}`, goal)\n .then((data) => data.retirement_goal)\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GoalApi } from '../api/GoalApi'\n\nimport {\n type Goal,\n type MonthlyCashFlowProfile,\n type RetirementGoalAccount,\n GlobalStore,\n TrackType,\n} from '../../common'\n\nexport class GoalStore {\n globalStore: GlobalStore\n api = new GoalApi('/', '')\n\n alert: string = ''\n goals: Goal[] = []\n retirementGoalAccounts: RetirementGoalAccount[] = []\n newRetirementGoalAccounts: RetirementGoalAccount[] = []\n selectedGoal: Goal | undefined = undefined\n monthlyCashFlowProfile: MonthlyCashFlowProfile | undefined = undefined\n goalsLoaded = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GoalApi(globalStore.endpoint, globalStore.sessionToken)\n\n makeAutoObservable(this)\n }\n\n get orderedGoals(): Goal[] {\n return this.goals.slice().sort((a, b) => a.position - b.position)\n }\n\n get debtGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.DEBT_TRACK)\n }\n\n get retirmentGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.RETIREMENT_TRACK)\n }\n\n get savingGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.SAVINGS_TRACK)\n }\n\n get ongoingGoalsForMicroWidget() {\n const ongoingGoals = this.goals.filter(\n (goal) =>\n !goal.is_complete &&\n goal.track_type !== TrackType.EMERGENCY_FUND_TRACK &&\n goal.track_type !== null,\n )\n const priorityOrder = [\n TrackType.SAVINGS_TRACK,\n TrackType.DEBT_TRACK,\n TrackType.RETIREMENT_TRACK,\n ]\n return ongoingGoals\n .sort((a, b) => {\n const aIndex = a.track_type ? priorityOrder.indexOf(a.track_type) : -1\n const bIndex = b.track_type ? priorityOrder.indexOf(b.track_type) : -1\n return aIndex - bIndex\n })\n .slice(0, 3)\n }\n\n addGoal = async (goal: Goal) => {\n try {\n const newGoal = await this.api.addGoal(goal)\n\n runInAction(() => {\n this.goals = [...this.goals, newGoal]\n })\n } catch (error) {\n console.error(`Error occurred while adding goal: ${error}`)\n }\n }\n\n addRetirementGoal = async (goal: Goal) => {\n const goalsCopy = this.globalStore.copyStore.copy.goals\n try {\n const newGoal: Goal = await this.api.addRetirementGoal(goal)\n const newAccounts = [] as RetirementGoalAccount[]\n for (const account of this.newRetirementGoalAccounts) {\n const newAccount = await this.api.addRetirementGoalAccount({\n ...account,\n retirement_goal_guid: newGoal.guid,\n })\n newAccounts.push(newAccount)\n }\n this.setNewRetirementGoalAccounts([])\n\n runInAction(() => {\n this.goals = [\n ...this.goals,\n {\n ...newGoal,\n amount: newGoal.target_amount,\n name: goalsCopy.retirement,\n track_type: TrackType.RETIREMENT_TRACK,\n } as Goal,\n ]\n this.retirementGoalAccounts = [...this.retirementGoalAccounts, ...newAccounts]\n })\n } catch (error) {\n console.error(`Error occurred while adding retirement goal: ${error}`)\n }\n }\n\n addRetirementGoalAccount = async (account: RetirementGoalAccount) => {\n try {\n const newAccount = await this.api.addRetirementGoalAccount(account)\n\n runInAction(() => {\n this.retirementGoalAccounts = [...this.retirementGoalAccounts, newAccount]\n })\n } catch (error) {\n console.error(`Error occurred while adding retirement goal account: ${error}`)\n }\n }\n\n loadGoals = async () => {\n const goalsCopy = this.globalStore.copyStore.copy.goals\n\n try {\n const goals = await this.api.getGoals()\n const retirementGoals = await this.api.getRetirementGoals()\n const retirementGoalAccounts = await this.api.getRetirementGoalAccounts()\n const monthlyCashFlowProfile = await this.api.getMonthlyCashFlowProfile()\n\n const allGoals = [\n ...goals,\n ...retirementGoals.map((goal: Goal) => ({\n ...goal,\n amount: goal.target_amount,\n name: goalsCopy.retirement,\n track_type: TrackType.RETIREMENT_TRACK,\n })),\n ]\n\n runInAction(() => {\n this.goals = allGoals\n this.retirementGoalAccounts = retirementGoalAccounts\n this.monthlyCashFlowProfile = monthlyCashFlowProfile\n this.goalsLoaded = true\n })\n } catch (error) {\n console.error(`Error occured while getting goals: ${error}`)\n }\n }\n\n deleteGoal = async (guid: string) => {\n try {\n await this.api.removeGoal(guid)\n\n runInAction(() => {\n const index = this.goals.findIndex((g) => g.guid === guid)\n if (index >= 0) {\n this.goals.splice(index, 1)\n }\n })\n } catch (error) {\n console.error(`Error occured while deleting goal: ${error}`)\n }\n }\n\n deleteRetirementGoal = async (goal: Goal) => {\n try {\n const accounts = this.retirementGoalAccounts.filter(\n (g) => g.retirement_goal_guid === goal.guid,\n )\n for (const account of accounts) {\n await this.deleteRetirementGoalAccount(account.guid)\n }\n await this.api.removeRetirementGoal(goal.guid)\n\n runInAction(() => {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals.splice(index, 1)\n }\n })\n } catch (error) {\n console.error(`Error deleting retirement goal: ${error}`)\n }\n }\n\n deleteRetirementGoalAccount = async (guid: string) => {\n try {\n await this.api.removeRetirementGoalAccount(guid)\n\n runInAction(() => {\n const index = this.retirementGoalAccounts.findIndex((rga) => rga.guid === guid)\n if (index >= 0) {\n this.retirementGoalAccounts.splice(index, 1)\n }\n })\n } catch (error) {\n console.error(`Error deleting retirement goal account: ${error}`)\n }\n }\n\n reorderGoals = async (goals: Goal[]) => {\n try {\n const reordered = (await this.api.reorderGoals(goals)) as Goal[]\n\n runInAction(() => {\n for (const goal of reordered) {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index].position = goal.position\n }\n }\n })\n } catch (error) {\n console.error(`Error reordering goals: ${error}`)\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setNewRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.newRetirementGoalAccounts = accounts\n }\n\n setSelectedGoal = (goal: Goal | undefined) => (this.selectedGoal = goal)\n\n updateGoal = async (goal: Goal) => {\n try {\n const updatedGoal = await this.api.updateGoal(goal)\n\n runInAction(() => {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index] = updatedGoal\n }\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(updatedGoal)\n }\n })\n } catch (error) {\n console.error(`Error occurred while updating goal: ${error}`)\n }\n }\n\n updateMonthlyCashFlowProfile = async (profile: MonthlyCashFlowProfile) => {\n try {\n const updatedProfile = await this.api.updateMonthlyCashFlowProfile(profile)\n\n runInAction(() => {\n this.monthlyCashFlowProfile = updatedProfile\n })\n } catch (error) {\n console.error(`Error occurred while updating monthly Cash Flow profile: ${error}`)\n }\n }\n}\n"],"names":["GoalApi","endpoint","token","Fetch","goal","ApiEndpoints","data","retirementAccount","guid","goals","profile","GoalStore","globalStore","makeAutoObservable","a","b","TrackType","ongoingGoals","priorityOrder","aIndex","bIndex","newGoal","runInAction","error","goalsCopy","newAccounts","account","newAccount","retirementGoals","retirementGoalAccounts","monthlyCashFlowProfile","allGoals","index","g","accounts","rga","reordered","alert","updatedGoal","updatedProfile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,MAAMA,EAAQ;AAAA,EACnB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,UAAU,OAAOE,MACR,KAAK,cAAc,KAAKC,EAAa,OAAOD,CAAI,EAAE,KAAK,CAACE,MAASA,EAAK,IAAI;AAAA,EAGnF,oBAAoB,OAAOF,MAClB,KAAK,cACT,KAAKC,EAAa,kBAAkBD,CAAI,EACxC,KAAK,CAACE,MAASA,EAAK,eAAe;AAAA,EAGxC,2BAA2B,OAAOC,MACzB,KAAK,cACT,KAAKF,EAAa,0BAA0BE,CAAiB,EAC7D,KAAK,CAACD,MAASA,EAAK,uBAAuB;AAAA,EAGhD,gBAAgB,OAAOE,MACd,KAAK,cAAc,IAAI,GAAGH,EAAa,KAAK,IAAIG,CAAI,EAAE,EAAE,KAAK,CAACF,MAASA,EAAK,IAAI;AAAA,EAGzF,WAAW,YACF,KAAK,cAAc,IAAID,EAAa,KAAK,EAAE,KAAK,CAACC,MAASA,EAAK,KAAK;AAAA,EAG7E,4BAA4B,YACnB,KAAK,cACT,IAAID,EAAa,yBAAyB,EAC1C,KAAK,CAACC,MAASA,EAAK,yBAAyB;AAAA,EAGlD,qBAAqB,YACZ,KAAK,cACT,IAAID,EAAa,gBAAgB,EACjC,KAAK,CAACC,MAASA,EAAK,gBAAgB;AAAA,EAGzC,4BAA4B,YACnB,KAAK,cACT,IAAID,EAAa,wBAAwB,EACzC,KAAK,CAACC,MAASA,EAAK,wBAAwB;AAAA,EAGjD,aAAa,OAAOE,MACX,KAAK,cAAc,OAAO,GAAGH,EAAa,KAAK,IAAIG,CAAI,EAAE,E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aACMf,GAAO;AACN,cAAA,MAAM,uCAAuCA,CAAK,EAAE;AAAA,IAC9D;AAAA,EAAA;AAAA,EAGF,+BAA+B,OAAOb,MAAoC;AACpE,QAAA;AACF,YAAM6B,IAAiB,MAAM,KAAK,IAAI,6BAA6B7B,CAAO;AAE1E,MAAAY,EAAY,MAAM;AAChB,aAAK,yBAAyBiB;AAAA,MAAA,CAC/B;AAAA,aACMhB,GAAO;AACN,cAAA,MAAM,4DAA4DA,CAAK,EAAE;AAAA,IACnF;AAAA,EAAA;AAEJ;"}
@@ -1,147 +0,0 @@
1
- import a from "react";
2
- import { jsx as n, jsxs as m } from "react/jsx-runtime";
3
- import C from "@mui/material/Button";
4
- import x from "@mui/material/Card";
5
- import v from "@mui/material/CardHeader";
6
- import w from "@mui/material/CardContent";
7
- import D from "@mui/material/IconButton";
8
- import { Icon as G, ChevronRight as T } from "@mxenabled/mx-icons";
9
- import { Text as f, H3 as W, useTokens as y } from "@mxenabled/mxui";
10
- import E from "@mui/material/CircularProgress";
11
- import R from "@mui/material/Stack";
12
- const p = a.createContext(null), $ = ({
13
- children: o,
14
- globalStore: t,
15
- onEvent: s,
16
- onPageView: r
17
- }) => /* @__PURE__ */ n(
18
- p.Provider,
19
- {
20
- value: {
21
- globalStore: t,
22
- onEvent: s,
23
- onPageView: r,
24
- children: o
25
- },
26
- children: o
27
- }
28
- ), h = a.createContext(null), P = ({ children: o, availableHeight: t, availableWidth: s }) => /* @__PURE__ */ n(
29
- h.Provider,
30
- {
31
- value: {
32
- availableHeight: t,
33
- availableWidth: s,
34
- children: o
35
- },
36
- children: o
37
- }
38
- ), e = (o = "useGlobalStore") => {
39
- const t = a.useContext(p);
40
- if (!t)
41
- throw new Error(`${o}() must be used within the GlobalDataContext`);
42
- return t;
43
- }, q = () => e("useAccountStore").globalStore.accountStore, X = () => e("useAppConfig").globalStore.appDataStore.appConfig, _ = () => e("useAnalyticsStore").globalStore.analyticsStore, J = () => e("useBudgetsStore").globalStore.budgetsStore, K = () => e("useCashflowStore").globalStore.cashflowStore, Q = () => e("useCategoryStore").globalStore.categoryStore, Y = () => e("useConnectStore").globalStore.connectStore, Z = () => e("useDebtsStore").globalStore.debtsStore, ee = () => e("useFinstrongStore").globalStore.finstrongStore, te = () => e("useGlobalStore").globalStore, oe = () => e("useGlobalUiStore").globalStore.globalUiStore, re = () => e("globalCopyStore").globalStore.copyStore.copy, se = () => e("useGoalStore").globalStore.goalStore, ne = () => e("useHelpStore").globalStore.helpStore, ae = () => e("useHoldingStore").globalStore.holdingStore, ie = () => e("useMerchantStore").globalStore.merchantStore, le = () => e("useNetWorthStore").globalStore.netWorthStore, ce = () => e("useNotificationStore").globalStore.notificationStore, ue = () => e("useRecurringTransactionsStore").globalStore.recurringTransactionsStore, Se = () => e("useSettingsStore").globalStore.settingsStore, ge = () => e("useTransactionStore").globalStore.transactionStore, be = () => e("useTrendsStore").globalStore.trendsStore, de = () => e("useUserStore").globalStore.userStore, me = () => ({ onEvent: e().onEvent }), fe = () => ({ onPageView: e().onPageView }), k = (o = "useWidgetContainerContext") => {
44
- const t = a.useContext(h);
45
- if (!t)
46
- throw new Error(`${o}() must be used within the WidgetContainerContext`);
47
- return t;
48
- }, pe = () => k(), z = (o, t) => a.useMemo(() => {
49
- let s = null;
50
- return (...r) => {
51
- s && clearTimeout(s), s = setTimeout(() => {
52
- o(...r);
53
- }, t);
54
- };
55
- }, [o, t]);
56
- function A(o = 100) {
57
- const [t, s] = a.useState({
58
- width: 0,
59
- height: 0
60
- }), r = a.useRef(null), c = a.useRef(t), S = z((l, i) => {
61
- (l !== c.current.width || i !== c.current.height) && (s({ width: l, height: i }), c.current = { width: l, height: i });
62
- }, o), g = a.useCallback(
63
- (l) => {
64
- if (r.current && (r.current.disconnect(), r.current = null), l?.nodeType === Node.ELEMENT_NODE) {
65
- const i = new ResizeObserver(([u]) => {
66
- if (u && u.borderBoxSize) {
67
- const { inlineSize: b, blockSize: d } = u.borderBoxSize[0];
68
- S(b, d);
69
- }
70
- });
71
- i.observe(l), r.current = i;
72
- }
73
- },
74
- [S]
75
- );
76
- return a.useEffect(() => () => {
77
- r.current && r.current.disconnect();
78
- }, []), [g, t];
79
- }
80
- const he = ({
81
- className: o = "mx-cmn-mini-widget",
82
- closeLabel: t,
83
- children: s,
84
- onClose: r,
85
- onPrimaryCtaClick: c,
86
- primaryCtaLabel: S = "",
87
- subTitle: g = "",
88
- sx: l = {},
89
- title: i = ""
90
- }) => {
91
- const [u, { height: b, width: d }] = A();
92
- return /* @__PURE__ */ m(x, { className: o, sx: { ...l }, children: [
93
- /* @__PURE__ */ n(
94
- v,
95
- {
96
- action: r ? /* @__PURE__ */ n(D, { "aria-label": t, onClick: r, children: /* @__PURE__ */ n(G, { name: "close", size: 24 }) }) : c && /* @__PURE__ */ n(C, { endIcon: /* @__PURE__ */ n(T, {}), onClick: c, children: /* @__PURE__ */ n(f, { bold: !0, variant: "Small", children: S }) }),
97
- subheader: g || null,
98
- subheaderTypographyProps: { variant: "Small" },
99
- sx: { pb: 4 },
100
- title: i ? /* @__PURE__ */ n(W, { sx: { pb: 4 }, children: i }) : null
101
- }
102
- ),
103
- /* @__PURE__ */ n(w, { ref: u, sx: { p: 0 }, children: /* @__PURE__ */ n(P, { availableHeight: b, availableWidth: d, children: s }) })
104
- ] });
105
- }, Ce = ({ height: o = 250, label: t = "", size: s = 32 }) => {
106
- const r = y();
107
- return /* @__PURE__ */ m(R, { alignItems: "center", gap: r.Spacing.XLarge, height: o, justifyContent: "center", children: [
108
- /* @__PURE__ */ n(E, { size: s }),
109
- t && /* @__PURE__ */ n(f, { children: t })
110
- ] });
111
- };
112
- export {
113
- P as A,
114
- A as B,
115
- Y as C,
116
- p as G,
117
- Ce as L,
118
- he as M,
119
- h as W,
120
- _ as a,
121
- re as b,
122
- me as c,
123
- oe as d,
124
- te as e,
125
- q as f,
126
- X as g,
127
- Q as h,
128
- ge as i,
129
- ae as j,
130
- pe as k,
131
- ue as l,
132
- K as m,
133
- Z as n,
134
- ee as o,
135
- se as p,
136
- ne as q,
137
- ie as r,
138
- le as s,
139
- ce as t,
140
- J as u,
141
- fe as v,
142
- Se as w,
143
- be as x,
144
- de as y,
145
- $ as z
146
- };
147
- //# sourceMappingURL=Loader-CwdK8lfx.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Loader-CwdK8lfx.mjs","sources":["../src/common/context/GlobalDataProvider.tsx","../src/common/context/WidgetContainerProvider.tsx","../src/common/context/hooks.tsx","../src/common/hooks/useDimensions.tsx","../src/common/components/MiniWidgetContainer.tsx","../src/common/components/Loader.tsx"],"sourcesContent":["import React from 'react'\n\nimport { GlobalStore } from '..'\n\nexport interface GlobalStoreContextTypes {\n children: React.ReactNode\n onEvent: (event: string, props?: object) => void\n onPageView: (pageViewEvent: string) => void\n globalStore: GlobalStore\n}\nexport const GlobalDataContext = React.createContext<GlobalStoreContextTypes | null>(null)\n\nexport const GlobalDataProvider: React.FC<React.PropsWithChildren<GlobalStoreContextTypes>> = ({\n children,\n globalStore,\n onEvent,\n onPageView,\n}) => {\n return (\n <GlobalDataContext.Provider\n value={{\n globalStore,\n onEvent,\n onPageView,\n children,\n }}\n >\n {children}\n </GlobalDataContext.Provider>\n )\n}\n","import React from 'react'\n\nexport interface WidgetContainerContextTypes {\n children: React.ReactNode\n availableHeight: number\n availableWidth: number\n}\nexport const WidgetContainerContext = React.createContext<WidgetContainerContextTypes | null>(null)\n\nexport const WidgetContainerProvider: React.FC<\n React.PropsWithChildren<WidgetContainerContextTypes>\n> = ({ children, availableHeight, availableWidth }) => {\n return (\n <WidgetContainerContext.Provider\n value={{\n availableHeight,\n availableWidth,\n children,\n }}\n >\n {children}\n </WidgetContainerContext.Provider>\n )\n}\n","import React from 'react'\nimport { GlobalDataContext } from './GlobalDataProvider'\nimport { WidgetContainerContext } from './WidgetContainerProvider'\n\nexport const useGlobalDataContext = (providerName = 'useGlobalStore') => {\n const context = React.useContext(GlobalDataContext)\n\n if (!context) {\n throw new Error(`${providerName}() must be used within the GlobalDataContext`)\n }\n return context\n}\n\nexport const useAccountStore = () =>\n useGlobalDataContext('useAccountStore').globalStore.accountStore\nexport const useAppConfig = () =>\n useGlobalDataContext('useAppConfig').globalStore.appDataStore.appConfig\nexport const useAnalyticsStore = () =>\n useGlobalDataContext('useAnalyticsStore').globalStore.analyticsStore\nexport const useBudgetsStore = () =>\n useGlobalDataContext('useBudgetsStore').globalStore.budgetsStore\nexport const useCashflowStore = () =>\n useGlobalDataContext('useCashflowStore').globalStore.cashflowStore\nexport const useCategoryStore = () =>\n useGlobalDataContext('useCategoryStore').globalStore.categoryStore\nexport const useConnectStore = () =>\n useGlobalDataContext('useConnectStore').globalStore.connectStore\nexport const useDebtStore = () => useGlobalDataContext('useDebtsStore').globalStore.debtsStore\nexport const useFinstrongStore = () =>\n useGlobalDataContext('useFinstrongStore').globalStore.finstrongStore\nexport const useGlobalStore = () => useGlobalDataContext('useGlobalStore').globalStore\nexport const useGlobalUiStore = () =>\n useGlobalDataContext('useGlobalUiStore').globalStore.globalUiStore\nexport const useGlobalCopyStore = () =>\n useGlobalDataContext('globalCopyStore').globalStore.copyStore.copy\nexport const useGoalStore = () => useGlobalDataContext('useGoalStore').globalStore.goalStore\nexport const useHelpStore = () => useGlobalDataContext('useHelpStore').globalStore.helpStore\nexport const useHoldingStore = () =>\n useGlobalDataContext('useHoldingStore').globalStore.holdingStore\nexport const useMerchantStore = () =>\n useGlobalDataContext('useMerchantStore').globalStore.merchantStore\nexport const useNetWorthStore = () =>\n useGlobalDataContext('useNetWorthStore').globalStore.netWorthStore\nexport const useNotificationStore = () =>\n useGlobalDataContext('useNotificationStore').globalStore.notificationStore\nexport const useRecurringTransactionsStore = () =>\n useGlobalDataContext('useRecurringTransactionsStore').globalStore.recurringTransactionsStore\nexport const useSettingsStore = () =>\n useGlobalDataContext('useSettingsStore').globalStore.settingsStore\nexport const useTransactionStore = () =>\n useGlobalDataContext('useTransactionStore').globalStore.transactionStore\nexport const useTrendsStore = () => useGlobalDataContext('useTrendsStore').globalStore.trendsStore\nexport const useUserStore = () => useGlobalDataContext('useUserStore').globalStore.userStore\n\nexport const useEvent = () => ({ onEvent: useGlobalDataContext().onEvent })\nexport const usePageView = () => ({ onPageView: useGlobalDataContext().onPageView })\n\nexport const useWidgetContainerContext = (providerName = 'useWidgetContainerContext') => {\n const context = React.useContext(WidgetContainerContext)\n\n if (!context) {\n throw new Error(`${providerName}() must be used within the WidgetContainerContext`)\n }\n\n return context\n}\n\nexport const useWidgetContainerProvider = () => useWidgetContainerContext()\n","// Based off the useMeasure hook from useHooks.com/usemeasure(ui.dev). Converted to typescript and added a debounce. https://github.com/uidotdev/usehooks/blob/main/index.js\n\nimport React from 'react'\n\ntype Dimensions = {\n width: number\n height: number\n}\n\n// Memoized debounce function\nconst useDebounce = <T extends (...args: any[]) => void>(func: T, delay: number) => {\n return React.useMemo(() => {\n let timeoutId: NodeJS.Timeout | null = null\n return (...args: Parameters<T>) => {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n timeoutId = setTimeout(() => {\n func(...args)\n }, delay)\n }\n }, [func, delay])\n}\n\nexport function useDimensions(\n debounceDelay: number = 100,\n): [React.RefCallback<HTMLElement>, Dimensions] {\n const [dimensions, setDimensions] = React.useState<Dimensions>({\n width: 0,\n height: 0,\n })\n\n const observerRef = React.useRef<ResizeObserver | null>(null)\n const previousDimensions = React.useRef<Dimensions>(dimensions)\n\n const debouncedSetDimensions = useDebounce((width: number, height: number) => {\n if (\n width !== previousDimensions.current.width ||\n height !== previousDimensions.current.height\n ) {\n setDimensions({ width, height })\n previousDimensions.current = { width, height }\n }\n }, debounceDelay)\n\n const customRef = React.useCallback(\n (node: HTMLElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect()\n observerRef.current = null\n }\n\n if (node?.nodeType === Node.ELEMENT_NODE) {\n const observer = new ResizeObserver(([entry]) => {\n if (entry && entry.borderBoxSize) {\n const { inlineSize: width, blockSize: height } = entry.borderBoxSize[0]\n debouncedSetDimensions(width, height)\n }\n })\n\n observer.observe(node)\n observerRef.current = observer\n }\n },\n [debouncedSetDimensions],\n )\n\n // Add cleanup effect\n React.useEffect(() => {\n return () => {\n if (observerRef.current) {\n observerRef.current.disconnect()\n }\n }\n }, [])\n\n return [customRef, dimensions]\n}\n","import React from 'react'\n\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport CardHeader from '@mui/material/CardHeader'\nimport CardContent from '@mui/material/CardContent'\nimport IconButton from '@mui/material/IconButton'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport { WidgetContainerProvider } from '../context'\nimport { useDimensions } from '../hooks/useDimensions'\n\ninterface CardContainerProps {\n className?: string\n closeLabel?: string\n onClose?: () => void\n onPrimaryCtaClick?: () => void\n primaryCtaLabel?: string\n subTitle?: string\n sx?: SxProps\n title?: string\n}\n\nconst MiniWidgetContainer: React.FC<React.PropsWithChildren<CardContainerProps>> = ({\n className = 'mx-cmn-mini-widget',\n closeLabel,\n children,\n onClose,\n onPrimaryCtaClick,\n primaryCtaLabel = '',\n subTitle = '',\n sx = {},\n title = '',\n}) => {\n const [containerRef, { height, width }] = useDimensions()\n\n return (\n <Card className={className} sx={{ ...sx }}>\n <CardHeader\n action={\n onClose ? (\n <IconButton aria-label={closeLabel} onClick={onClose}>\n <Icon name=\"close\" size={24} />\n </IconButton>\n ) : (\n onPrimaryCtaClick && (\n <Button endIcon={<ChevronRight />} onClick={onPrimaryCtaClick}>\n <Text bold={true} variant=\"Small\">\n {primaryCtaLabel}\n </Text>\n </Button>\n )\n )\n }\n subheader={subTitle ? subTitle : null}\n subheaderTypographyProps={{ variant: 'Small' }}\n sx={{ pb: 4 }}\n title={title ? <H3 sx={{ pb: 4 }}>{title}</H3> : null}\n />\n\n <CardContent ref={containerRef} sx={{ p: 0 }}>\n <WidgetContainerProvider availableHeight={height} availableWidth={width}>\n {children}\n </WidgetContainerProvider>\n </CardContent>\n </Card>\n )\n}\n\nexport default MiniWidgetContainer\n","import React from 'react'\n\nimport CircularProgress from '@mui/material/CircularProgress'\nimport Stack from '@mui/material/Stack'\n\nimport { Text, useTokens } from '@mxenabled/mxui'\n\ninterface LoaderProps {\n height?: number\n label?: string\n size?: number\n}\n\nconst Loader: React.FC<LoaderProps> = ({ height = 250, label = '', size = 32 }) => {\n const tokens = useTokens()\n\n return (\n <Stack alignItems=\"center\" gap={tokens.Spacing.XLarge} height={height} justifyContent=\"center\">\n <CircularProgress size={size} />\n {label && <Text>{label}</Text>}\n </Stack>\n )\n}\n\nexport default Loader\n"],"names":["GlobalDataContext","React","GlobalDataProvider","children","globalStore","onEvent","onPageView","jsx","WidgetContainerContext","WidgetContainerProvider","availableHeight","availableWidth","useGlobalDataContext","providerName","context","useAccountStore","useAppConfig","useAnalyticsStore","useBudgetsStore","useCashflowStore","useCategoryStore","useConnectStore","useDebtStore","useFinstrongStore","useGlobalStore","useGlobalUiStore","useGlobalCopyStore","useGoalStore","useHelpStore","useHoldingStore","useMerchantStore","useNetWorthStore","useNotificationStore","useRecurringTransactionsStore","useSettingsStore","useTransactionStore","useTrendsStore","useUserStore","useEvent","usePageView","useWidgetContainerContext","useWidgetContainerProvider","useDebounce","func","delay","timeoutId","args","useDimensions","debounceDelay","dimensions","setDimensions","observerRef","previousDimensions","debouncedSetDimensions","width","height","customRef","node","observer","entry","MiniWidgetContainer","className","closeLabel","onClose","onPrimaryCtaClick","primaryCtaLabel","subTitle","sx","title","containerRef","Card","CardHeader","IconButton","Icon","Button","ChevronRight","Text","H3","CardContent","Loader","label","size","tokens","useTokens","jsxs","Stack","CircularProgress"],"mappings":";;;;;;;;;;;AAUa,MAAAA,IAAoBC,EAAM,cAA8C,IAAI,GAE5EC,IAAiF,CAAC;AAAA,EAC7F,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AACF,MAEI,gB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A;AAAA,EACzB,EAAA,CAAA;AAEJ;"}
@@ -1,125 +0,0 @@
1
- import { makeAutoObservable as c, runInAction as m } from "mobx";
2
- import "bowser";
3
- import "date-fns/getUnixTime";
4
- import { ae as h, af as p } from "./ConnectMiniWidget-CQWafYtQ.mjs";
5
- import "date-fns/intlFormat";
6
- import "date-fns/addMonths";
7
- import "date-fns/addQuarters";
8
- import "date-fns/addWeeks";
9
- import "date-fns/addYears";
10
- import "date-fns/getDay";
11
- import "date-fns/isBefore";
12
- import "date-fns/nextDay";
13
- import "date-fns/setDate";
14
- import "date-fns/startOfToday";
15
- import "date-fns/fromUnixTime";
16
- import "react";
17
- import "numeral";
18
- import "@mui/material";
19
- import "react/jsx-runtime";
20
- import "@mui/material/Button";
21
- import "@mxenabled/mxui";
22
- import "@mui/material/Tooltip";
23
- import "@mui/material/Box";
24
- import "@mui/material/IconButton";
25
- import "./Loader-CwdK8lfx.mjs";
26
- import "@mui/material/styles/useTheme";
27
- import "@mui/material/useMediaQuery";
28
- import "@mxenabled/cssinjs";
29
- import "date-fns/addDays";
30
- import "date-fns/eachDayOfInterval";
31
- import "date-fns/eachWeekOfInterval";
32
- import "date-fns/endOfMonth";
33
- import "date-fns/format";
34
- import "date-fns/isSameMonth";
35
- import "date-fns/startOfMonth";
36
- import "date-fns/subMonths";
37
- import "@mui/material/Paper";
38
- import "@mxenabled/mx-icons";
39
- import "date-fns/isSameDay";
40
- import "date-fns/isWithinInterval";
41
- import "d3";
42
- import "@mui/material/styles";
43
- import "@mui/x-charts";
44
- import "@mui/x-charts/ChartsTooltip";
45
- import "@mui/material/Stack";
46
- import "date-fns/differenceInCalendarDays";
47
- import "date-fns/endOfToday";
48
- import "date-fns/endOfYear";
49
- import "date-fns/startOfYear";
50
- import "date-fns/subDays";
51
- import "date-fns/subYears";
52
- import "@mui/material/ButtonGroup";
53
- import "@mui/material/Tab";
54
- import "@mui/material/Tabs";
55
- import "@mui/material/ToggleButton";
56
- import "@mui/material/ToggleButtonGroup";
57
- import "@mui/material/Dialog";
58
- import "@mui/material/DialogContent";
59
- import "@mui/material/Card";
60
- import "@mui/material/CardContent";
61
- import "@mui/material/CardHeader";
62
- import "uuid";
63
- import "@mui/material/CircularProgress";
64
- import "@mui/material/FormControlLabel";
65
- import "@mui/material/Radio";
66
- import "@mui/material/Avatar";
67
- import "@mui/material/ListItem";
68
- import "@mui/material/ListItemAvatar";
69
- import "@mui/material/ListItemButton";
70
- import "@mui/material/ListItemText";
71
- import "@mui/material/ListItemIcon";
72
- import "@mui/material/MenuItem";
73
- import "@mui/material/TextField";
74
- import "@mui/material/Switch";
75
- import "posthog-js";
76
- import "date-fns/differenceInDays";
77
- import "@mui/x-data-grid-pro";
78
- import "date-fns";
79
- import "@mui/material/Divider";
80
- import "@mui/material/List";
81
- import "date-fns/formatISO";
82
- import "date-fns/isAfter";
83
- import "date-fns/parseISO";
84
- import "date-fns/subQuarters";
85
- import "date-fns/lastDayOfMonth";
86
- import "date-fns/setDayOfYear";
87
- import "date-fns/addSeconds";
88
- import "date-fns/differenceInCalendarMonths";
89
- import "date-fns/getMonth";
90
- class e {
91
- fetchInstance;
92
- constructor(t, i) {
93
- this.fetchInstance = new h(t, i);
94
- }
95
- getMerchants = async (t = [], i = [], a = 1, s = 25) => {
96
- let o = p.MERCHANTS;
97
- return o += `?page=${a}&per_page=${s}`, t.length && t.forEach((r) => o += `&fuzzy_name[]=${r}`), i.length && i.forEach((r) => o += `&guid[]=${r}`), this.fetchInstance.get(o).then((r) => r.merchants);
98
- };
99
- getMerchantByGuid = async (t) => this.fetchInstance.get(`${p.MERCHANTS}/${t}`).then((i) => i.merchant);
100
- }
101
- class Qt {
102
- globalStore;
103
- api = new e("/", "");
104
- merchant = null;
105
- merchants = [];
106
- isLoading = !1;
107
- constructor(t) {
108
- this.globalStore = t, this.api = new e(t.endpoint, t.sessionToken), c(this);
109
- }
110
- loadMerchants = async (t = "") => {
111
- this.isLoading = !0;
112
- const i = await this.api.getMerchants([t]);
113
- m(() => {
114
- this.merchants = i, this.isLoading = !1;
115
- });
116
- };
117
- loadMerchantByGuid = async (t) => {
118
- const i = await this.api.getMerchantByGuid(t);
119
- m(() => this.merchant = i);
120
- };
121
- }
122
- export {
123
- Qt as M
124
- };
125
- //# sourceMappingURL=MerchantStore-Cck9IGIH.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MerchantStore-Cck9IGIH.mjs","sources":["../src/merchants/api/MerchantApi.ts","../src/merchants/stores/MerchantStore.ts"],"sourcesContent":["import { ApiEndpoints, Fetch } from '../../common'\n\nexport class MerchantApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n getMerchants = async (\n searchValues = [] as string[],\n guids = [] as string[],\n page = 1,\n perPage = 25,\n ) => {\n let url = ApiEndpoints.MERCHANTS\n url += `?page=${page}&per_page=${perPage}`\n\n if (searchValues.length) {\n searchValues.forEach((value) => (url += `&fuzzy_name[]=${value}`))\n }\n\n if (guids.length) {\n guids.forEach((guid) => (url += `&guid[]=${guid}`))\n }\n\n return this.fetchInstance.get(url).then((data) => data.merchants)\n }\n\n getMerchantByGuid = async (guid: string) => {\n return this.fetchInstance.get(`${ApiEndpoints.MERCHANTS}/${guid}`).then((data) => data.merchant)\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { MerchantApi } from '../api/MerchantApi'\n\nimport { GlobalStore, Merchant } from '../../common'\n\nexport interface CopyObject {\n [key: string]: string\n}\n\nexport class MerchantStore {\n globalStore: GlobalStore\n api: MerchantApi = new MerchantApi('/', '')\n\n merchant: Merchant | null = null\n merchants: Merchant[] = []\n isLoading = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new MerchantApi(globalStore.endpoint, globalStore.sessionToken)\n\n makeAutoObservable(this)\n }\n\n loadMerchants = async (searchValue = '') => {\n this.isLoading = true\n\n const merchants = await this.api.getMerchants([searchValue])\n\n runInAction(() => {\n this.merchants = merchants\n this.isLoading = false\n })\n }\n\n loadMerchantByGuid = async (guid: string) => {\n const merchant = await this.api.getMerchantByGuid(guid)\n\n runInAction(() => (this.merchant = merchant))\n }\n}\n"],"names":["MerchantApi","endpoint","token","Fetch","searchValues","guids","page","perPage","url","ApiEndpoints","value","guid","data","MerchantStore","globalStore","makeAutoObservable","searchValue","merchants","runInAction","merchant"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,EAAY;AAAA,EACvB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,eAAe,OACbE,IAAe,CAAA,GACfC,IAAQ,CACR,GAAAC,IAAO,GACPC,IAAU,OACP;AACH,QAAIC,IAAMC,EAAa;AAChB,WAAAD,KAAA,SAASF,CAAI,aAAaC,CAAO,IAEpCH,EAAa,UACfA,EAAa,QAAQ,CAACM,MAAWF,KAAO,iBAAiBE,CAAK,EAAG,GAG/DL,EAAM,UACRA,EAAM,QAAQ,CAACM,MAAUH,KAAO,WAAWG,CAAI,EAAG,GAG7C,KAAK,cAAc,IAAIH,CAAG,EAAE,KAAK,CAACI,MAASA,EAAK,SAAS;AAAA,EAAA;AAAA,EAGlE,oBAAoB,OAAOD,MAClB,KAAK,cAAc,IAAI,GAAGF,EAAa,SAAS,IAAIE,CAAI,EAAE,EAAE,KAAK,CAACC,MAASA,EAAK,QAAQ;AAEnG;ACtBO,MAAMC,GAAc;AAAA,EACzB;AAAA,EACA,MAAmB,IAAIb,EAAY,KAAK,EAAE;AAAA,EAE1C,WAA4B;AAAA,EAC5B,YAAwB,CAAA;AAAA,EACxB,YAAY;AAAA,EAEZ,YAAYc,GAA0B;AACpC,SAAK,cAAcA,GACnB,KAAK,MAAM,IAAId,EAAYc,EAAY,UAAUA,EAAY,YAA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