@mx-cartographer/experiences 6.26.0 → 6.26.1-alpha.mega1

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 (84) hide show
  1. package/dist/AccountStore-DkL93tXL.mjs +317 -0
  2. package/dist/AccountStore-DkL93tXL.mjs.map +1 -0
  3. package/dist/BudgetUtil-CVqAdv-j.mjs +187 -0
  4. package/dist/BudgetUtil-CVqAdv-j.mjs.map +1 -0
  5. package/dist/CashflowStore-gPEEBiXo.mjs +53 -0
  6. package/dist/CashflowStore-gPEEBiXo.mjs.map +1 -0
  7. package/dist/CategoryStore-m7oieLzP.mjs +260 -0
  8. package/dist/CategoryStore-m7oieLzP.mjs.map +1 -0
  9. package/dist/ConnectMiniWidget-CQWafYtQ.mjs +22966 -0
  10. package/dist/ConnectMiniWidget-CQWafYtQ.mjs.map +1 -0
  11. package/dist/DebtsStore-cUhIgJx6.mjs +145 -0
  12. package/dist/DebtsStore-cUhIgJx6.mjs.map +1 -0
  13. package/dist/Donut-CGNFni9y.mjs +58 -0
  14. package/dist/Donut-CGNFni9y.mjs.map +1 -0
  15. package/dist/FinstrongStore-BDG7l0nI.mjs +183 -0
  16. package/dist/FinstrongStore-BDG7l0nI.mjs.map +1 -0
  17. package/dist/GoalStore-o2waGeyf.mjs +293 -0
  18. package/dist/GoalStore-o2waGeyf.mjs.map +1 -0
  19. package/dist/Loader-CwdK8lfx.mjs +147 -0
  20. package/dist/Loader-CwdK8lfx.mjs.map +1 -0
  21. package/dist/MerchantStore-Cck9IGIH.mjs +125 -0
  22. package/dist/MerchantStore-Cck9IGIH.mjs.map +1 -0
  23. package/dist/NetWorthStore-D5eUfGQt.mjs +66 -0
  24. package/dist/NetWorthStore-D5eUfGQt.mjs.map +1 -0
  25. package/dist/NotificationStore-DCxw8W7u.mjs +141 -0
  26. package/dist/NotificationStore-DCxw8W7u.mjs.map +1 -0
  27. package/dist/RecurringTransactionsStore-Bijrgllq.mjs +337 -0
  28. package/dist/RecurringTransactionsStore-Bijrgllq.mjs.map +1 -0
  29. package/dist/SettingsStore-BhOYgUOa.mjs +352 -0
  30. package/dist/SettingsStore-BhOYgUOa.mjs.map +1 -0
  31. package/dist/TransactionApi-Dnbyi1JL.mjs +175 -0
  32. package/dist/TransactionApi-Dnbyi1JL.mjs.map +1 -0
  33. package/dist/TransactionStore-CiEtt5XJ.mjs +417 -0
  34. package/dist/TransactionStore-CiEtt5XJ.mjs.map +1 -0
  35. package/dist/TrendsStore-Idq3QfoA.mjs +131 -0
  36. package/dist/TrendsStore-Idq3QfoA.mjs.map +1 -0
  37. package/dist/accounts/index.es.js +18 -0
  38. package/dist/accounts/index.es.js.map +1 -0
  39. package/dist/analytics/index.es.js +170 -0
  40. package/dist/analytics/index.es.js.map +1 -0
  41. package/dist/budgets/index.es.js +1116 -0
  42. package/dist/budgets/index.es.js.map +1 -0
  43. package/dist/cashflow/index.es.js +118 -0
  44. package/dist/cashflow/index.es.js.map +1 -0
  45. package/dist/categories/index.es.js +10 -0
  46. package/dist/categories/index.es.js.map +1 -0
  47. package/dist/common/context/hooks.d.ts +13 -13
  48. package/dist/common/index.es.js +1549 -0
  49. package/dist/common/index.es.js.map +1 -0
  50. package/dist/dashboard/index.es.js +257 -0
  51. package/dist/dashboard/index.es.js.map +1 -0
  52. package/dist/debts/index.es.js +9 -0
  53. package/dist/debts/index.es.js.map +1 -0
  54. package/dist/finstrong/index.es.js +11 -0
  55. package/dist/finstrong/index.es.js.map +1 -0
  56. package/dist/goals/index.es.js +9 -0
  57. package/dist/goals/index.es.js.map +1 -0
  58. package/dist/help/components/content/section/index.d.ts +15 -15
  59. package/dist/help/index.es.js +6 -0
  60. package/dist/help/index.es.js.map +1 -0
  61. package/dist/investments/index.es.js +1694 -0
  62. package/dist/investments/index.es.js.map +1 -0
  63. package/dist/merchants/index.es.js +7 -0
  64. package/dist/merchants/index.es.js.map +1 -0
  65. package/dist/microinsights/index.es.js +21 -0
  66. package/dist/microinsights/index.es.js.map +1 -0
  67. package/dist/networth/index.es.js +11 -0
  68. package/dist/networth/index.es.js.map +1 -0
  69. package/dist/notifications/index.es.js +116 -0
  70. package/dist/notifications/index.es.js.map +1 -0
  71. package/dist/recurringtransactions/index.es.js +14 -0
  72. package/dist/recurringtransactions/index.es.js.map +1 -0
  73. package/dist/settings/index.es.js +112 -0
  74. package/dist/settings/index.es.js.map +1 -0
  75. package/dist/spending/index.es.js +632 -0
  76. package/dist/spending/index.es.js.map +1 -0
  77. package/dist/transactions/index.es.js +19 -0
  78. package/dist/transactions/index.es.js.map +1 -0
  79. package/dist/trends/index.es.js +10 -0
  80. package/dist/trends/index.es.js.map +1 -0
  81. package/package.json +91 -3
  82. package/dist/index.d.ts +0 -22
  83. package/dist/index.es.js +0 -29907
  84. package/dist/index.es.js.map +0 -1
@@ -0,0 +1,352 @@
1
+ import { makeAutoObservable as N, runInAction as l } from "mobx";
2
+ import "bowser";
3
+ import "date-fns/getUnixTime";
4
+ import "date-fns/intlFormat";
5
+ import { ae as D, af as n, ar as u, aq as o, a_ as i } from "./ConnectMiniWidget-CQWafYtQ.mjs";
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
+ import { T as g } from "./TransactionApi-Dnbyi1JL.mjs";
91
+ class y {
92
+ fetchInstance;
93
+ constructor(t, e) {
94
+ this.fetchInstance = new D(t, e);
95
+ }
96
+ deleteDevice = async (t) => this.fetchInstance.delete(`${n.DEVICES}/${t}`).then((e) => e);
97
+ generateDeviceToken = async () => this.fetchInstance.get(`${n.USER}/mobile_token`).then((t) => t.mobile_token);
98
+ getDevices = async () => this.fetchInstance.get(n.DEVICES).then((t) => t.map((e) => e.device));
99
+ getNotificationProfiles = async () => this.fetchInstance.get(n.NOTIFICATION_PROFILES).then((t) => t.notification_profiles);
100
+ // verifications endpoints respond with HTTP status codes; they error otherwise
101
+ sendEmailVerification = async () => this.fetchInstance.post(n.EMAIL_VERIFICATIONS);
102
+ sendPhoneVerification = async () => this.fetchInstance.post(n.PHONE_VERIFICATIONS + "/deliver");
103
+ verifyPhoneToken = async (t) => this.fetchInstance.post(n.PHONE_VERIFICATIONS + "/verify", { sms_verification_token: t }).then((e) => ({ verified: e.verified }));
104
+ updateDevice = async (t) => this.fetchInstance.put(`${n.DEVICES}/${t.guid}`, t).then((e) => e.device);
105
+ updateNotificationProfile = async (t) => this.fetchInstance.put(`${n.NOTIFICATION_PROFILES}/${t.guid}`, t).then((e) => e.notification_profile);
106
+ updateUserCommunicationProfile = async (t) => this.fetchInstance.put(n.USER_COMMUNICATION_PROFILE, t).then((e) => e.user_communication_profile);
107
+ getInsightsNotificationProfiles = async () => this.fetchInstance.get(`${n.NOTIFICATION_PROFILES}/${n.INSIGHTS_NOTIFICATION_PROFILES}`).then((t) => t);
108
+ }
109
+ const v = "PARENT-ENTITY", C = (a, t) => ({
110
+ [u.BudgetExceeded]: t.notification_budget_exceeded,
111
+ [u.BudgetOffTarget]: t.notification_budget_off_target,
112
+ [o.DebtPaymentReminder]: t.notification_debt_payment_reminder,
113
+ [o.AccountBalanceLow]: t.notification_low_balance,
114
+ [o.AccountDepositLargePosted]: t.notification_large_deposit,
115
+ [o.AccountDepositLarge]: t.notification_large_deposit,
116
+ [o.TransactionExpenseLarge]: t.notification_large_expense,
117
+ [o.TransactionFeeCharge]: t.notification_transaction_fee,
118
+ [o.InternationalTransaction]: t.notification_transaction_is_international,
119
+ [i.AccountBalanceLow]: t.account_balance_low,
120
+ [i.BillAmountNotStandard]: t.bill_amount_not_standard,
121
+ [i.CategorySpending]: t.category_spending,
122
+ [i.CreditCardCloseToLimit]: t.credit_card_close_to_limit,
123
+ [i.DebtPaymentReminder]: t.debt_payment_reminder,
124
+ [i.DuplicatePayment]: t.duplicate_payment,
125
+ [i.MonthlySpendComparison]: t.monthly_spend_comparison,
126
+ [i.MonthlySpendToIncomeComparison]: t.monthly_spend_to_income_comparison,
127
+ [i.MonthlySubscriptionAggregate]: t.monthly_subscription_aggregate,
128
+ [i.MonthlyTopMerchantSpending]: t.monthly_top_merchant_spending,
129
+ [i.SaveAnExtra100Dollars]: t.save_an_extra_100_dollars,
130
+ [i.SavingsOpportunity]: t.savings_opportunity,
131
+ [i.SetUpDirectDeposit]: t.set_up_direct_deposit,
132
+ [i.SwitchDirectDeposit]: t.switch_direct_deposit,
133
+ [i.UncategorizedTransactions]: t.uncategorized_transactions,
134
+ [i.UnifiedDeposit]: t.unified_deposit,
135
+ [i.UpcomingBill]: t.upcoming_bill,
136
+ [i.WeekendSpendingSummary]: t.weekend_spending_summary,
137
+ [i.WeeklyNewMerchants]: t.weekly_new_merchants,
138
+ [i.DiscoveredAccounts]: t.discovered_account,
139
+ [i.TransactionExpenseLarge]: t.large_transaction,
140
+ [i.PromotionalCampaignMessages]: t.promotional_campaign_messages,
141
+ [i.TransparentOverdraft]: t.transparent_overdraft
142
+ })[a] || "", R = (a, t, e, r, p, f) => {
143
+ const h = [], {
144
+ email_notifications_enabled: P,
145
+ sms_notifications_enabled: I,
146
+ push_notifications_enabled: T
147
+ } = t, {
148
+ opted_out_of_email_notifications: b,
149
+ opted_out_of_sms_notifications: E,
150
+ opted_out_of_push_notifications: S
151
+ } = p;
152
+ for (const s of r.filter((d) => d.entity_guid === v)) {
153
+ const d = C(s.notification_type, e), A = r.filter(
154
+ (c) => c.entity_guid !== v && c.notification_type === s.notification_type && a.some((_) => _.guid === c.entity_guid)
155
+ ), m = [];
156
+ P && !b && s.email_channel && f.email && m.push(e.delivery_method_email_label), I && !E && s.sms_channel && f.phone && m.push(e.delivery_method_sms_label), T && !S && s.push_channel && m.push(e.delivery_method_push_label), h.push({
157
+ ...s,
158
+ children: A.map((c) => ({
159
+ ...c,
160
+ account: a.find((_) => _.guid === c.entity_guid),
161
+ label: d
162
+ })),
163
+ deliveryMethodsLabel: m.join(", "),
164
+ label: d
165
+ });
166
+ }
167
+ return h;
168
+ };
169
+ class ue {
170
+ globalStore;
171
+ api = new y("/", "");
172
+ transactionApi = new g("/", "");
173
+ alert = { message: "", severity: void 0 };
174
+ devices = [];
175
+ notificationProfiles = [];
176
+ selectedRule = void 0;
177
+ transactionRules = [];
178
+ constructor(t) {
179
+ this.globalStore = t, this.api = new y(t.endpoint, t.sessionToken), this.transactionApi = new g(t.endpoint, t.sessionToken), N(this);
180
+ }
181
+ get accountProfiles() {
182
+ const t = this.globalStore.appDataStore.clientCommunicationProfile;
183
+ return this.detailedNotificationProfiles.filter(
184
+ (e) => e.notification_type === o.DebtPaymentReminder && t.debt_payment_reminder_notifications_enabled || e.notification_type === o.AccountBalanceLow && t.low_balance_notifications_enabled || e.notification_type === o.AccountDepositLarge && t.large_deposit_notifications_enabled || e.notification_type === o.TransactionExpenseLarge && t.large_expense_notifications_enabled || e.notification_type === o.TransactionFeeCharge && t.transaction_fee_notifications_enabled || e.notification_type === o.InternationalTransaction && t.transaction_is_international_notifications_enabled || e.notification_type === o.AccountDepositLargePosted && t.large_deposit_notifications_enabled
185
+ );
186
+ }
187
+ get budgetProfiles() {
188
+ const t = this.globalStore.appDataStore.clientCommunicationProfile;
189
+ return this.detailedNotificationProfiles.filter(
190
+ (e) => e.notification_type === u.BudgetExceeded && t.budget_exceeded_notifications_enabled || e.notification_type === u.BudgetOffTarget && t.budget_off_target_notifications_enabled
191
+ );
192
+ }
193
+ get insightsProfiles() {
194
+ return this.detailedNotificationProfiles.filter(
195
+ (t) => Object.values(i).includes(t.notification_type)
196
+ );
197
+ }
198
+ get clientCommunicationProfile() {
199
+ return this.globalStore.appDataStore.clientCommunicationProfile;
200
+ }
201
+ get copy() {
202
+ return this.globalStore.copyStore.copy.settings;
203
+ }
204
+ get detailedNotificationProfiles() {
205
+ return this.globalStore.isInitialized ? R(
206
+ this.globalStore.accountStore.accounts,
207
+ this.clientCommunicationProfile,
208
+ this.copy,
209
+ this.notificationProfiles,
210
+ this.userCommunicationsProfile,
211
+ this.globalStore.userStore.user
212
+ ) : [];
213
+ }
214
+ get userCommunicationsProfile() {
215
+ return this.globalStore.appDataStore.userCommunicationProfile;
216
+ }
217
+ deleteDevice = async (t) => {
218
+ try {
219
+ await this.api.deleteDevice(t);
220
+ const e = this.devices.findIndex((r) => r.guid === t);
221
+ return e >= 0 && l(() => {
222
+ this.devices.splice(e, 1);
223
+ }), { success: !0 };
224
+ } catch {
225
+ return console.error(`Error deleting device: ${t}`), { success: !1 };
226
+ }
227
+ };
228
+ deleteTransactionRule = async () => {
229
+ this.selectedRule && this.transactionApi.removeTransactionRule(this.selectedRule?.guid).then(() => {
230
+ this.setAlert(this.copy.delete_rule_success, "success"), this.loadTransactionRules();
231
+ }).catch(() => {
232
+ this.setAlert(this.copy.delete_rule_error, "error");
233
+ });
234
+ };
235
+ generateDeviceToken = async () => {
236
+ try {
237
+ return await this.api.generateDeviceToken();
238
+ } catch (t) {
239
+ console.error(`Error generating device token: ${t}`);
240
+ }
241
+ };
242
+ loadDevices = async () => {
243
+ try {
244
+ const t = await this.api.getDevices();
245
+ l(() => {
246
+ this.devices = t;
247
+ });
248
+ } catch (t) {
249
+ console.error(`Error loading devices: ${t}`);
250
+ }
251
+ };
252
+ loadNotificationProfiles = async () => {
253
+ try {
254
+ const t = await this.api.getNotificationProfiles();
255
+ l(() => {
256
+ this.notificationProfiles = t;
257
+ });
258
+ } catch (t) {
259
+ console.error(`Error loading notification profiles: ${t}`);
260
+ }
261
+ };
262
+ loadTransactionRules = async () => {
263
+ try {
264
+ const t = await this.transactionApi.getTransactionRules();
265
+ l(() => {
266
+ this.transactionRules = t;
267
+ });
268
+ } catch (t) {
269
+ console.error(`Error loading transaction rules: ${t}`);
270
+ }
271
+ };
272
+ sendEmailVerification = async () => {
273
+ try {
274
+ await this.api.sendEmailVerification(), this.setAlert(this.copy.verification_sent_success, "success");
275
+ } catch (t) {
276
+ console.error(`Error sending email verification: ${t}`), this.setAlert(this.copy.verification_sent_error, "error");
277
+ }
278
+ };
279
+ sendPhoneVerification = async () => {
280
+ try {
281
+ await this.api.sendPhoneVerification(), this.setAlert(this.copy.verification_sent_success, "success");
282
+ } catch (t) {
283
+ console.error(`Error sending phone verification: ${t}`), this.setAlert(this.copy.verification_sent_error, "error");
284
+ }
285
+ };
286
+ setAlert = (t, e = void 0) => this.alert = { message: t, severity: e };
287
+ setSelectedRule = (t) => {
288
+ this.selectedRule = t;
289
+ };
290
+ updateDevice = async (t) => {
291
+ try {
292
+ const e = await this.api.updateDevice(t), r = this.devices.findIndex((p) => p.guid === t.guid);
293
+ return r >= 0 && l(() => {
294
+ this.devices[r] = e;
295
+ }), { success: !0 };
296
+ } catch (e) {
297
+ return console.error(`Error updating device: ${e}`), { success: !1 };
298
+ }
299
+ };
300
+ updateNotificationProfile = async (t) => {
301
+ try {
302
+ const e = await this.api.updateNotificationProfile(t), r = this.notificationProfiles.findIndex((p) => p.guid === t.guid);
303
+ r >= 0 && l(() => {
304
+ this.notificationProfiles[r] = e;
305
+ });
306
+ } catch (e) {
307
+ console.error(`Error updating notification profile: ${e}`);
308
+ }
309
+ };
310
+ updateRuleCategory = async (t) => {
311
+ this.transactionApi.updateTransactionRule(t).then(() => {
312
+ this.loadTransactionRules();
313
+ });
314
+ };
315
+ updateRulePayee = async (t) => {
316
+ this.transactionApi.updateTransactionRule(t).then(() => {
317
+ this.setAlert(this.copy.edit_payee_success, "success"), this.loadTransactionRules();
318
+ }).catch(() => {
319
+ this.setAlert(this.copy.edit_payee_error, "error");
320
+ });
321
+ };
322
+ updateUser = async (t) => {
323
+ this.globalStore.userStore.updateUser(t).then(() => {
324
+ this.setAlert(this.copy.information_updated_success, "success");
325
+ }).catch(() => {
326
+ this.setAlert(this.copy.information_updated_error, "error");
327
+ });
328
+ };
329
+ updateUserCommunicationProfile = async (t) => {
330
+ try {
331
+ const e = await this.api.updateUserCommunicationProfile(t);
332
+ this.globalStore.appDataStore.setUserCommunicationProfile(e);
333
+ } catch (e) {
334
+ console.error(`Error occurred while updating user communication profile: ${e}`);
335
+ }
336
+ };
337
+ verifyPhoneToken = async (t) => {
338
+ try {
339
+ const { verified: e } = await this.api.verifyPhoneToken(t);
340
+ if (!e)
341
+ throw new Error();
342
+ this.setAlert(this.copy.verified_phone_success, "success");
343
+ } catch (e) {
344
+ console.error(`Error verifying phone token: ${e}`), this.setAlert(this.copy.verified_phone_error, "error");
345
+ }
346
+ };
347
+ }
348
+ export {
349
+ y as S,
350
+ ue as a
351
+ };
352
+ //# sourceMappingURL=SettingsStore-BhOYgUOa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsStore-BhOYgUOa.mjs","sources":["../src/settings/api/SettingsApi.ts","../src/settings/util/Notifications.ts","../src/settings/stores/SettingsStore.ts"],"sourcesContent":["import Fetch from '../../common/utils/Fetch'\n\nimport {\n type Device,\n type NotificationProfile,\n ApiEndpoints,\n UserCommunicationProfile,\n} from '../../common'\n\nexport class SettingsApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n deleteDevice = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.DEVICES}/${guid}`).then((data) => data)\n }\n\n generateDeviceToken = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.USER}/mobile_token`)\n .then((data) => data.mobile_token)\n }\n\n getDevices = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.DEVICES)\n .then((data) => data.map((item: { device: Device }) => item.device))\n }\n\n getNotificationProfiles = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.NOTIFICATION_PROFILES)\n .then((data) => data.notification_profiles)\n }\n\n // verifications endpoints respond with HTTP status codes; they error otherwise\n sendEmailVerification = async () => {\n return this.fetchInstance.post(ApiEndpoints.EMAIL_VERIFICATIONS)\n }\n\n sendPhoneVerification = async () => {\n return this.fetchInstance.post(ApiEndpoints.PHONE_VERIFICATIONS + '/deliver')\n }\n\n verifyPhoneToken = async (sms_verification_token: string) => {\n return this.fetchInstance\n .post(ApiEndpoints.PHONE_VERIFICATIONS + '/verify', { sms_verification_token })\n .then((res) => ({ verified: res.verified }))\n }\n\n updateDevice = async (device: Device) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.DEVICES}/${device.guid}`, device)\n .then((data) => data.device)\n }\n\n updateNotificationProfile = async (notificationProfile: NotificationProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.NOTIFICATION_PROFILES}/${notificationProfile.guid}`, notificationProfile)\n .then((data) => data.notification_profile)\n }\n\n updateUserCommunicationProfile = async (userCommunicationProfile: UserCommunicationProfile) => {\n return this.fetchInstance\n .put(ApiEndpoints.USER_COMMUNICATION_PROFILE, userCommunicationProfile)\n .then((data) => data.user_communication_profile)\n }\n\n getInsightsNotificationProfiles = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.NOTIFICATION_PROFILES}/${ApiEndpoints.INSIGHTS_NOTIFICATION_PROFILES}`)\n .then((data) => data)\n }\n}\n","import {\n type Account,\n type ClientCommunicationProfile,\n type DetailedNotificationProfile,\n type NotificationProfile,\n type SettingsCopy,\n type User,\n type UserCommunicationProfile,\n AccountNotificationTypes,\n BudgetNotificationTypes,\n InsightNotificationTypes,\n} from '../../common'\n\nconst PARENT_ENTITY = 'PARENT-ENTITY'\n\nconst getProfileLabel = (notificationType: number, copy: SettingsCopy) => {\n const labelMap: Record<number, string> = {\n [BudgetNotificationTypes.BudgetExceeded]: copy.notification_budget_exceeded,\n [BudgetNotificationTypes.BudgetOffTarget]: copy.notification_budget_off_target,\n [AccountNotificationTypes.DebtPaymentReminder]: copy.notification_debt_payment_reminder,\n [AccountNotificationTypes.AccountBalanceLow]: copy.notification_low_balance,\n [AccountNotificationTypes.AccountDepositLargePosted]: copy.notification_large_deposit,\n [AccountNotificationTypes.AccountDepositLarge]: copy.notification_large_deposit,\n [AccountNotificationTypes.TransactionExpenseLarge]: copy.notification_large_expense,\n [AccountNotificationTypes.TransactionFeeCharge]: copy.notification_transaction_fee,\n [AccountNotificationTypes.InternationalTransaction]:\n copy.notification_transaction_is_international,\n [InsightNotificationTypes.AccountBalanceLow]: copy.account_balance_low,\n [InsightNotificationTypes.BillAmountNotStandard]: copy.bill_amount_not_standard,\n [InsightNotificationTypes.CategorySpending]: copy.category_spending,\n [InsightNotificationTypes.CreditCardCloseToLimit]: copy.credit_card_close_to_limit,\n [InsightNotificationTypes.DebtPaymentReminder]: copy.debt_payment_reminder,\n [InsightNotificationTypes.DuplicatePayment]: copy.duplicate_payment,\n [InsightNotificationTypes.MonthlySpendComparison]: copy.monthly_spend_comparison,\n [InsightNotificationTypes.MonthlySpendToIncomeComparison]:\n copy.monthly_spend_to_income_comparison,\n [InsightNotificationTypes.MonthlySubscriptionAggregate]: copy.monthly_subscription_aggregate,\n [InsightNotificationTypes.MonthlyTopMerchantSpending]: copy.monthly_top_merchant_spending,\n [InsightNotificationTypes.SaveAnExtra100Dollars]: copy.save_an_extra_100_dollars,\n [InsightNotificationTypes.SavingsOpportunity]: copy.savings_opportunity,\n [InsightNotificationTypes.SetUpDirectDeposit]: copy.set_up_direct_deposit,\n [InsightNotificationTypes.SwitchDirectDeposit]: copy.switch_direct_deposit,\n [InsightNotificationTypes.UncategorizedTransactions]: copy.uncategorized_transactions,\n [InsightNotificationTypes.UnifiedDeposit]: copy.unified_deposit,\n [InsightNotificationTypes.UpcomingBill]: copy.upcoming_bill,\n [InsightNotificationTypes.WeekendSpendingSummary]: copy.weekend_spending_summary,\n [InsightNotificationTypes.WeeklyNewMerchants]: copy.weekly_new_merchants,\n [InsightNotificationTypes.DiscoveredAccounts]: copy.discovered_account,\n [InsightNotificationTypes.TransactionExpenseLarge]: copy.large_transaction,\n [InsightNotificationTypes.PromotionalCampaignMessages]: copy.promotional_campaign_messages,\n [InsightNotificationTypes.TransparentOverdraft]: copy.transparent_overdraft,\n }\n\n return labelMap[notificationType] || ''\n}\n\nexport const augmentNotificationProfiles = (\n accounts: Account[],\n clientCommunicationsProfile: ClientCommunicationProfile,\n copy: SettingsCopy,\n profiles: NotificationProfile[],\n userCommunicationsProfile: UserCommunicationProfile,\n user: User,\n) => {\n const detailedProfiles = [] as DetailedNotificationProfile[]\n const {\n email_notifications_enabled: clientEmailEnabled,\n sms_notifications_enabled: clientSmsEnabled,\n push_notifications_enabled: clientPushEnabled,\n } = clientCommunicationsProfile\n\n const {\n opted_out_of_email_notifications: userEmailOptedOut,\n opted_out_of_sms_notifications: userSmsOptedOut,\n opted_out_of_push_notifications: userPushOptedOut,\n } = userCommunicationsProfile\n\n for (const profile of profiles.filter((profile) => profile.entity_guid === PARENT_ENTITY)) {\n const label = getProfileLabel(profile.notification_type, copy)\n const children = profiles.filter(\n (child) =>\n child.entity_guid !== PARENT_ENTITY &&\n child.notification_type === profile.notification_type &&\n accounts.some((account) => account.guid === child.entity_guid),\n )\n\n const deliveryMethods = [] as string[]\n if (clientEmailEnabled && !userEmailOptedOut && profile.email_channel && user.email) {\n deliveryMethods.push(copy.delivery_method_email_label)\n }\n if (clientSmsEnabled && !userSmsOptedOut && profile.sms_channel && user.phone) {\n deliveryMethods.push(copy.delivery_method_sms_label)\n }\n if (clientPushEnabled && !userPushOptedOut && profile.push_channel) {\n deliveryMethods.push(copy.delivery_method_push_label)\n }\n\n detailedProfiles.push({\n ...profile,\n children: children.map((child) => ({\n ...child,\n account: accounts.find((a) => a.guid === child.entity_guid),\n label,\n })),\n deliveryMethodsLabel: deliveryMethods.join(', '),\n label,\n })\n }\n\n return detailedProfiles\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AlertProps } from '@mui/material'\n\nimport {\n AccountNotificationTypes,\n BudgetNotificationTypes,\n GlobalStore,\n InsightNotificationTypes,\n SettingsCopy,\n TransactionRule,\n} from '../../common'\n\nimport type {\n DetailedNotificationProfile,\n Device,\n NotificationProfile,\n User,\n UserCommunicationProfile,\n} from '../../common'\n\nimport { SettingsApi } from '../api/SettingsApi'\nimport { augmentNotificationProfiles } from '../util/Notifications'\n\nimport { TransactionApi } from '../../transactions'\n\ninterface SettingsAlertProps {\n message: string\n severity: AlertProps['severity']\n}\n\nexport class SettingsStore {\n globalStore: GlobalStore\n api: SettingsApi = new SettingsApi('/', '')\n transactionApi: TransactionApi = new TransactionApi('/', '')\n\n alert: SettingsAlertProps = { message: '', severity: undefined }\n devices: Device[] = []\n notificationProfiles: NotificationProfile[] = []\n selectedRule: TransactionRule | undefined = undefined\n transactionRules: TransactionRule[] = []\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new SettingsApi(globalStore.endpoint, globalStore.sessionToken)\n this.transactionApi = new TransactionApi(globalStore.endpoint, globalStore.sessionToken)\n\n makeAutoObservable(this)\n }\n\n get accountProfiles() {\n const ccp = this.globalStore.appDataStore.clientCommunicationProfile\n\n // TODO: There has to be a better way to do this, but for now, it works\n return this.detailedNotificationProfiles.filter(\n (np) =>\n (np.notification_type === AccountNotificationTypes.DebtPaymentReminder &&\n ccp.debt_payment_reminder_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.AccountBalanceLow &&\n ccp.low_balance_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.AccountDepositLarge &&\n ccp.large_deposit_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.TransactionExpenseLarge &&\n ccp.large_expense_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.TransactionFeeCharge &&\n ccp.transaction_fee_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.InternationalTransaction &&\n ccp.transaction_is_international_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.AccountDepositLargePosted &&\n ccp.large_deposit_notifications_enabled),\n )\n }\n\n get budgetProfiles() {\n const ccp = this.globalStore.appDataStore.clientCommunicationProfile\n\n // TODO: There has to be a better way to do this, but for now, it works\n return this.detailedNotificationProfiles.filter(\n (np) =>\n (np.notification_type === BudgetNotificationTypes.BudgetExceeded &&\n ccp.budget_exceeded_notifications_enabled) ||\n (np.notification_type === BudgetNotificationTypes.BudgetOffTarget &&\n ccp.budget_off_target_notifications_enabled),\n )\n }\n\n get insightsProfiles() {\n return this.detailedNotificationProfiles.filter((np) =>\n Object.values(InsightNotificationTypes).includes(np.notification_type),\n )\n }\n\n get clientCommunicationProfile() {\n return this.globalStore.appDataStore.clientCommunicationProfile\n }\n\n get copy(): SettingsCopy {\n return this.globalStore.copyStore.copy.settings\n }\n\n get detailedNotificationProfiles(): DetailedNotificationProfile[] {\n // Don't attempt to augment profile if global store is not initialized\n if (!this.globalStore.isInitialized) return []\n\n return augmentNotificationProfiles(\n this.globalStore.accountStore.accounts,\n this.clientCommunicationProfile,\n this.copy,\n this.notificationProfiles,\n this.userCommunicationsProfile,\n this.globalStore.userStore.user,\n )\n }\n\n get userCommunicationsProfile() {\n return this.globalStore.appDataStore.userCommunicationProfile\n }\n\n deleteDevice = async (guid: string) => {\n try {\n await this.api.deleteDevice(guid)\n\n const index = this.devices.findIndex((d) => d.guid === guid)\n if (index >= 0) {\n runInAction(() => {\n this.devices.splice(index, 1)\n })\n }\n\n return { success: true }\n } catch (error) {\n console.error(`Error deleting device: ${guid}`)\n return { success: false }\n }\n }\n\n deleteTransactionRule = async () => {\n if (!this.selectedRule) {\n return\n }\n this.transactionApi\n .removeTransactionRule(this.selectedRule?.guid)\n .then(() => {\n this.setAlert(this.copy.delete_rule_success, 'success')\n this.loadTransactionRules()\n })\n .catch(() => {\n this.setAlert(this.copy.delete_rule_error, 'error')\n })\n }\n\n generateDeviceToken = async () => {\n try {\n return await this.api.generateDeviceToken()\n } catch (error) {\n console.error(`Error generating device token: ${error}`)\n }\n return undefined\n }\n\n loadDevices = async () => {\n try {\n const devices = await this.api.getDevices()\n\n runInAction(() => {\n this.devices = devices\n })\n } catch (error) {\n console.error(`Error loading devices: ${error}`)\n }\n }\n\n loadNotificationProfiles = async () => {\n try {\n const profiles = await this.api.getNotificationProfiles()\n\n runInAction(() => {\n this.notificationProfiles = profiles\n })\n } catch (error) {\n console.error(`Error loading notification profiles: ${error}`)\n }\n }\n\n loadTransactionRules = async () => {\n try {\n const rules = await this.transactionApi.getTransactionRules()\n\n runInAction(() => {\n this.transactionRules = rules\n })\n } catch (error) {\n console.error(`Error loading transaction rules: ${error}`)\n }\n }\n\n sendEmailVerification = async () => {\n try {\n await this.api.sendEmailVerification()\n this.setAlert(this.copy.verification_sent_success, 'success')\n } catch (error) {\n console.error(`Error sending email verification: ${error}`)\n this.setAlert(this.copy.verification_sent_error, 'error')\n }\n }\n\n sendPhoneVerification = async () => {\n try {\n await this.api.sendPhoneVerification()\n this.setAlert(this.copy.verification_sent_success, 'success')\n } catch (error) {\n console.error(`Error sending phone verification: ${error}`)\n this.setAlert(this.copy.verification_sent_error, 'error')\n }\n }\n\n setAlert = (message: string, severity: SettingsAlertProps['severity'] = undefined) =>\n (this.alert = { message, severity })\n\n setSelectedRule = (rule?: TransactionRule) => {\n this.selectedRule = rule\n }\n\n updateDevice = async (device: Device) => {\n try {\n const updatedDevice = await this.api.updateDevice(device)\n\n const index = this.devices.findIndex((d) => d.guid === device.guid)\n if (index >= 0) {\n runInAction(() => {\n this.devices[index] = updatedDevice\n })\n }\n return { success: true }\n } catch (error) {\n console.error(`Error updating device: ${error}`)\n return { success: false }\n }\n }\n\n updateNotificationProfile = async (profile: NotificationProfile) => {\n try {\n const updatedProfile = await this.api.updateNotificationProfile(profile)\n\n const index = this.notificationProfiles.findIndex((p) => p.guid === profile.guid)\n if (index >= 0) {\n runInAction(() => {\n this.notificationProfiles[index] = updatedProfile\n })\n }\n } catch (error) {\n console.error(`Error updating notification profile: ${error}`)\n }\n }\n\n updateRuleCategory = async (rule: TransactionRule) => {\n this.transactionApi.updateTransactionRule(rule).then(() => {\n this.loadTransactionRules()\n })\n }\n\n updateRulePayee = async (rule: TransactionRule) => {\n this.transactionApi\n .updateTransactionRule(rule)\n .then(() => {\n this.setAlert(this.copy.edit_payee_success, 'success')\n this.loadTransactionRules()\n })\n .catch(() => {\n this.setAlert(this.copy.edit_payee_error, 'error')\n })\n }\n\n updateUser = async (user: User) => {\n this.globalStore.userStore\n .updateUser(user)\n .then(() => {\n this.setAlert(this.copy.information_updated_success, 'success')\n })\n .catch(() => {\n this.setAlert(this.copy.information_updated_error, 'error')\n })\n }\n\n updateUserCommunicationProfile = async (profile: UserCommunicationProfile) => {\n try {\n const updatedProfile = await this.api.updateUserCommunicationProfile(profile)\n\n this.globalStore.appDataStore.setUserCommunicationProfile(updatedProfile)\n } catch (error) {\n console.error(`Error occurred while updating user communication profile: ${error}`)\n }\n }\n\n verifyPhoneToken = async (sms_verification_token: string) => {\n try {\n const { verified } = await this.api.verifyPhoneToken(sms_verification_token)\n if (!verified) {\n throw new Error()\n }\n this.setAlert(this.copy.verified_phone_success, 'success')\n } catch (error) {\n console.error(`Error verifying phone token: ${error}`)\n this.setAlert(this.copy.verified_phone_error, 'error')\n }\n }\n}\n"],"names":["SettingsApi","endpoint","token","Fetch","guid","ApiEndpoints","data","item","sms_verification_token","res","device","notificationProfile","userCommunicationProfile","PARENT_ENTITY","getProfileLabel","notificationType","copy","BudgetNotificationTypes","AccountNotificationTypes","InsightNotificationTypes","augmentNotificationProfiles","accounts","clientCommunicationsProfile","profiles","userCommunicationsProfile","user","detailedProfiles","clientEmailEnabled","clientSmsEnabled","clientPushEnabled","userEmailOptedOut","userSmsOptedOut","userPushOptedOut","profile","label","children","child","account","deliveryMethods","a","SettingsStore","TransactionApi","globalStore","makeAutoObservable","ccp","np","index","d","runInAction","error","devices","rules","message","severity","rule","updatedDevice","updatedProfile","verified"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAMA,EAAY;AAAA,EACvB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,eAAe,OAAOE,MACb,KAAK,cAAc,OAAO,GAAGC,EAAa,OAAO,IAAID,CAAI,EAAE,EAAE,KAAK,CAACE,MAASA,CAAI;AAAA,EAGzF,sBAAsB,YACb,KAAK,cACT,IAAI,GAAGD,EAAa,IAAI,eAAe,EACvC,KAAK,CAACC,MAASA,EAAK,YAAY;AAAA,EAGrC,aAAa,YACJ,KAAK,cACT,IAAID,EAAa,OAAO,EACxB,KAAK,CAACC,MAASA,EAAK,IAAI,CAACC,MAA6BA,EAAK,MAAM,CAAC;AAAA,EAGvE,0BAA0B,YACjB,KAAK,cACT,IAAIF,EAAa,qBAAqB,EACtC,KAAK,CAACC,MAASA,EAAK,qBAAqB;AAAA;AAAA,EAI9C,wBAAwB,YACf,KAAK,cAAc,KAAKD,EAAa,mBAAmB;AAAA,EAGjE,wBAAwB,YACf,KAAK,cAAc,KAAKA,EAAa,sBAAsB,UAAU;AAAA,EAG9E,mBAAmB,OAAOG,MACjB,KAAK,cACT,KAAKH,EAAa,sBAAsB,WAAW,EAAE,wBAAAG,EAAA,CAAwB,EAC7E,KAAK,CAACC,OAAS,EAAE,UAAUA,EAAI,SAAW,EAAA;AAAA,EAG/C,eAAe,OAAOC,MACb,KAAK,cACT,IAAI,GAAGL,EAAa,OAAO,IAAIK,EAAO,IAAI,IAAIA,CAAM,EACpD,KA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,MAAmC;AACvD,QAAA;AACF,YAAM,EAAE,UAAAiD,EAAS,IAAI,MAAM,KAAK,IAAI,iBAAiBjD,CAAsB;AAC3E,UAAI,CAACiD;AACH,cAAM,IAAI,MAAM;AAElB,WAAK,SAAS,KAAK,KAAK,wBAAwB,SAAS;AAAA,aAClDR,GAAO;AACN,cAAA,MAAM,gCAAgCA,CAAK,EAAE,GACrD,KAAK,SAAS,KAAK,KAAK,sBAAsB,OAAO;AAAA,IACvD;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,175 @@
1
+ import "bowser";
2
+ import "date-fns/getUnixTime";
3
+ import { ae as m, af as n } from "./ConnectMiniWidget-CQWafYtQ.mjs";
4
+ import "date-fns/intlFormat";
5
+ import "date-fns/addMonths";
6
+ import "date-fns/addQuarters";
7
+ import "date-fns/addWeeks";
8
+ import "date-fns/addYears";
9
+ import "date-fns/getDay";
10
+ import "date-fns/isBefore";
11
+ import "date-fns/nextDay";
12
+ import "date-fns/setDate";
13
+ import "date-fns/startOfToday";
14
+ import "date-fns/fromUnixTime";
15
+ import "react";
16
+ import "numeral";
17
+ import "@mui/material";
18
+ import "react/jsx-runtime";
19
+ import "@mui/material/Button";
20
+ import "@mxenabled/mxui";
21
+ import "@mui/material/Tooltip";
22
+ import "@mui/material/Box";
23
+ import "@mui/material/IconButton";
24
+ import "./Loader-CwdK8lfx.mjs";
25
+ import "@mui/material/styles/useTheme";
26
+ import "@mui/material/useMediaQuery";
27
+ import "@mxenabled/cssinjs";
28
+ import "date-fns/addDays";
29
+ import "date-fns/eachDayOfInterval";
30
+ import "date-fns/eachWeekOfInterval";
31
+ import "date-fns/endOfMonth";
32
+ import "date-fns/format";
33
+ import "date-fns/isSameMonth";
34
+ import "date-fns/startOfMonth";
35
+ import "date-fns/subMonths";
36
+ import "@mui/material/Paper";
37
+ import "@mxenabled/mx-icons";
38
+ import "date-fns/isSameDay";
39
+ import "date-fns/isWithinInterval";
40
+ import "d3";
41
+ import "@mui/material/styles";
42
+ import "@mui/x-charts";
43
+ import "@mui/x-charts/ChartsTooltip";
44
+ import "@mui/material/Stack";
45
+ import "date-fns/differenceInCalendarDays";
46
+ import "date-fns/endOfToday";
47
+ import "date-fns/endOfYear";
48
+ import "date-fns/startOfYear";
49
+ import "date-fns/subDays";
50
+ import "date-fns/subYears";
51
+ import "@mui/material/ButtonGroup";
52
+ import "@mui/material/Tab";
53
+ import "@mui/material/Tabs";
54
+ import "@mui/material/ToggleButton";
55
+ import "@mui/material/ToggleButtonGroup";
56
+ import "@mui/material/Dialog";
57
+ import "@mui/material/DialogContent";
58
+ import "@mui/material/Card";
59
+ import "@mui/material/CardContent";
60
+ import "@mui/material/CardHeader";
61
+ import "uuid";
62
+ import "@mui/material/CircularProgress";
63
+ import "@mui/material/FormControlLabel";
64
+ import "@mui/material/Radio";
65
+ import "@mui/material/Avatar";
66
+ import "@mui/material/ListItem";
67
+ import "@mui/material/ListItemAvatar";
68
+ import "@mui/material/ListItemButton";
69
+ import "@mui/material/ListItemText";
70
+ import "@mui/material/ListItemIcon";
71
+ import "@mui/material/MenuItem";
72
+ import "@mui/material/TextField";
73
+ import "@mui/material/Switch";
74
+ import "mobx";
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 Mt {
91
+ fetchInstance;
92
+ constructor(t, e) {
93
+ this.fetchInstance = new m(t, e);
94
+ }
95
+ addTag = async (t) => this.fetchInstance.post(n.TAGS, t).then((e) => e.tag);
96
+ addTagging = async (t) => this.fetchInstance.post(n.TAGGINGS, t).then((e) => e.tagging);
97
+ addTransaction = async (t) => this.fetchInstance.post(n.TRANSACTIONS, t).then((e) => e.transaction);
98
+ addTransactionRule = async (t) => this.fetchInstance.post(n.TRANSACTION_RULES, t).then((e) => e);
99
+ getTaggings = async () => this.fetchInstance.get(n.TAGGINGS).then((t) => t.map((e) => e.tagging));
100
+ getTags = async () => this.fetchInstance.get(n.TAGS).then((t) => t.map((e) => e.tag));
101
+ getTransactionRules = async () => this.fetchInstance.get(n.TRANSACTION_RULES).then((t) => t.transaction_rules);
102
+ getTransactionsByDateRange = async (t, e) => this.fetchInstance.get(`${n.TRANSACTIONS}/by_date/${t}/${e}`).then((a) => a.map((r) => r.transaction));
103
+ // DEPRECATED
104
+ getTransactionsByAccountsAndDateRange = async (t, e, a) => {
105
+ console.warn("DEPRECATED: getTransactionsByAccountsAndDateRange will be removed");
106
+ const r = t.reduce(
107
+ (s, o, i) => `${s}account_guids[]=${o}${i !== t.length - 1 ? "&" : ""}`,
108
+ ""
109
+ );
110
+ return this.fetchInstance.get(`${n.TRANSACTIONS}/by_date/${e}/${a}?${r}`).then((s) => s.map((o) => o.transaction));
111
+ };
112
+ // DEPRECATED
113
+ getTransactionsByGuids = async (t) => (console.warn("DEPRECATED: getTransactionsByGuids will be removed"), this.fetchInstance.post(`${n.TRANSACTIONS}/by_guids`, { guids: t.join("+") }).then((e) => e.map((a) => a.transaction)));
114
+ // DEPRECATED
115
+ getTransactionsByCategoryAndDate = async (t, e, a) => (console.warn("DEPRECATED: getTransactionsByCategoryAndDate will be removed"), this.fetchInstance.get(
116
+ `${n.TRANSACTIONS}/by_category_guid/${t}/by_date/${e}/${a}`
117
+ ).then((r) => r.map((s) => s.transaction)));
118
+ // DEPRECATED
119
+ getTransactionsByCategoryDateAndAccounts = async (t, e, a, r) => {
120
+ console.warn("DEPRECATED: getTransactionsByCategoryDateAndAccounts will be removed");
121
+ const s = r.reduce(
122
+ (o, i, c) => `${o}account_guids[]=${i}${c !== r.length - 1 ? "&" : ""}`,
123
+ ""
124
+ );
125
+ return this.fetchInstance.get(
126
+ `${n.TRANSACTIONS}/by_category_guid/${t}/by_date/${e}/${a}?${s}`
127
+ ).then((o) => o.map((i) => i.transaction));
128
+ };
129
+ // DEPRECATED
130
+ getTransactionsByCategoriesDateAndAccounts = async (t, e, a, r) => {
131
+ console.warn("DEPRECATED: getTransactionsByCategoriesDateAndAccounts will be removed");
132
+ const s = r.reduce(
133
+ (o, i, c) => `${o}account_guids[]=${i}${c !== r.length - 1 ? "&" : ""}`,
134
+ ""
135
+ );
136
+ return this.fetchInstance.get(
137
+ `${n.TRANSACTIONS}/by_category_guids/${t.join(
138
+ "+"
139
+ )}/by_date/${e}/${a}?${s}`
140
+ ).then((o) => o.map((i) => i.transaction));
141
+ };
142
+ /**
143
+ * DEPRECATED
144
+ * Get all transactions by the top level category, between begin date and end date, and optionally
145
+ * filtered by accounts
146
+ * @param categoryGuid The top level category guid
147
+ * @param beginDate the start date
148
+ * @param endDate the end date
149
+ * @param accountGuids an optional list of account guids
150
+ */
151
+ getTransactionsByTopLevelCategoryAndDate = async (t, e, a, r = []) => {
152
+ console.warn("DEPRECATED: getTransactionsByTopLevelCategoryAndDate will be removed");
153
+ let s = `${n.TRANSACTIONS}/by_top_level_category_guid/${t}/by_date/${e}/${a}`;
154
+ if (r.length > 0) {
155
+ const o = r.reduce(
156
+ (i, c, p) => `${i}account_guids[]=${c}${p !== r.length - 1 ? "&" : ""}`,
157
+ ""
158
+ );
159
+ s += `?${o}`;
160
+ }
161
+ return this.fetchInstance.get(s).then((o) => o.map((i) => i.transaction));
162
+ };
163
+ removeTag = async (t) => this.fetchInstance.delete(`${n.TAGS}/${t}`).then((e) => e);
164
+ removeTagging = async (t) => this.fetchInstance.delete(`${n.TAGGINGS}/${t}`).then((e) => e);
165
+ removeTransaction = async (t) => this.fetchInstance.delete(`${n.TRANSACTIONS}/${t}`).then((e) => e);
166
+ removeTransactionRule = async (t) => this.fetchInstance.delete(`${n.TRANSACTION_RULES}/${t}`);
167
+ removeTransactionSplit = async (t) => this.fetchInstance.delete(`${n.TRANSACTIONS}/${t}/unsplit`).then((e) => e);
168
+ updateTransactionRule = async (t) => this.fetchInstance.put(`${n.TRANSACTION_RULES}/${t.guid}`, t).then((e) => e);
169
+ updateTag = async (t) => this.fetchInstance.put(`${n.TAGS}/${t.guid}`, t).then((e) => e.tag);
170
+ updateTransaction = async (t) => this.fetchInstance.put(`${n.TRANSACTIONS}/${t.guid}`, t).then((e) => e.transaction);
171
+ }
172
+ export {
173
+ Mt as T
174
+ };
175
+ //# sourceMappingURL=TransactionApi-Dnbyi1JL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionApi-Dnbyi1JL.mjs","sources":["../src/transactions/api/TransactionApi.ts"],"sourcesContent":["import { Fetch } from '../../common'\nimport { ApiEndpoints } from '../../common'\n\nimport type { Tag, Tagging, Transaction, TransactionRule } from '../../common'\n\nexport class TransactionApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n addTag = async (tag: Tag) => {\n return this.fetchInstance.post(ApiEndpoints.TAGS, tag).then((data) => data.tag)\n }\n\n addTagging = async (tagging: Tagging) => {\n return this.fetchInstance.post(ApiEndpoints.TAGGINGS, tagging).then((data) => data.tagging)\n }\n\n addTransaction = async (transaction: Transaction) => {\n return this.fetchInstance\n .post(ApiEndpoints.TRANSACTIONS, transaction)\n .then((data) => data.transaction)\n }\n\n addTransactionRule = async (rule: TransactionRule) => {\n return this.fetchInstance.post(ApiEndpoints.TRANSACTION_RULES, rule).then((data) => data)\n }\n\n getTaggings = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.TAGGINGS)\n .then((data) => data.map((item: { tagging: Tagging }) => item.tagging))\n }\n\n getTags = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.TAGS)\n .then((data) => data.map((item: { tag: Tag }) => item.tag))\n }\n\n getTransactionRules = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.TRANSACTION_RULES)\n .then((data) => data.transaction_rules)\n }\n\n getTransactionsByDateRange = async (startDate: number, endDate: number) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.TRANSACTIONS}/by_date/${startDate}/${endDate}`)\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByAccountsAndDateRange = async (\n accountGuids: string[],\n beginDate: number,\n endDate: number,\n ) => {\n console.warn('DEPRECATED: getTransactionsByAccountsAndDateRange will be removed')\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n\n return this.fetchInstance\n .get(`${ApiEndpoints.TRANSACTIONS}/by_date/${beginDate}/${endDate}?${accountsList}`)\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByGuids = async (guids: string[]) => {\n console.warn('DEPRECATED: getTransactionsByGuids will be removed')\n return this.fetchInstance\n .post(`${ApiEndpoints.TRANSACTIONS}/by_guids`, { guids: guids.join('+') })\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByCategoryAndDate = async (\n categoryGuid: string,\n beginDate: number,\n endDate: number,\n ) => {\n console.warn('DEPRECATED: getTransactionsByCategoryAndDate will be removed')\n return this.fetchInstance\n .get(\n `${ApiEndpoints.TRANSACTIONS}/by_category_guid/${categoryGuid}/by_date/${beginDate}/${endDate}`,\n )\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByCategoryDateAndAccounts = async (\n categoryGuid: string,\n beginDate: number,\n endDate: number,\n accountGuids: string[],\n ) => {\n console.warn('DEPRECATED: getTransactionsByCategoryDateAndAccounts will be removed')\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n\n return this.fetchInstance\n .get(\n `${ApiEndpoints.TRANSACTIONS}/by_category_guid/${categoryGuid}/by_date/${beginDate}/${endDate}?${accountsList}`,\n )\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByCategoriesDateAndAccounts = async (\n categoryGuids: string[],\n beginDate: number,\n endDate: number,\n accountGuids: string[],\n ) => {\n console.warn('DEPRECATED: getTransactionsByCategoriesDateAndAccounts will be removed')\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n\n return this.fetchInstance\n .get(\n `${ApiEndpoints.TRANSACTIONS}/by_category_guids/${categoryGuids.join(\n '+',\n )}/by_date/${beginDate}/${endDate}?${accountsList}`,\n )\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n /**\n * DEPRECATED\n * Get all transactions by the top level category, between begin date and end date, and optionally\n * filtered by accounts\n * @param categoryGuid The top level category guid\n * @param beginDate the start date\n * @param endDate the end date\n * @param accountGuids an optional list of account guids\n */\n getTransactionsByTopLevelCategoryAndDate = async (\n categoryGuid: string,\n beginDate: number,\n endDate: number,\n accountGuids: string[] = [],\n ) => {\n console.warn('DEPRECATED: getTransactionsByTopLevelCategoryAndDate will be removed')\n let url = `${ApiEndpoints.TRANSACTIONS}/by_top_level_category_guid/${categoryGuid}/by_date/${beginDate}/${endDate}`\n\n if (accountGuids.length > 0) {\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n url += `?${accountsList}`\n }\n\n return this.fetchInstance\n .get(url)\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n removeTag = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.TAGS}/${guid}`).then((data) => data)\n }\n\n removeTagging = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.TAGGINGS}/${guid}`).then((data) => data)\n }\n\n removeTransaction = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.TRANSACTIONS}/${guid}`).then((data) => data)\n }\n\n removeTransactionRule = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.TRANSACTION_RULES}/${guid}`)\n }\n\n removeTransactionSplit = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.TRANSACTIONS}/${guid}/unsplit`)\n .then((data) => data)\n }\n\n updateTransactionRule = async (rule: TransactionRule) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.TRANSACTION_RULES}/${rule.guid}`, rule)\n .then((data) => data)\n }\n\n updateTag = async (tag: Tag) => {\n return this.fetchInstance.put(`${ApiEndpoints.TAGS}/${tag.guid}`, tag).then((data) => data.tag)\n }\n\n updateTransaction = async (transaction: Transaction) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.TRANSACTIONS}/${transaction.guid}`, transaction)\n .then((data) => data.transaction)\n }\n}\n"],"names":["TransactionApi","endpoint","token","Fetch","tag","ApiEndpoints","data","tagging","transaction","rule","item","startDate","endDate","accountGuids","beginDate","accountsList","acc","guid","guids","categoryGuid","i","categoryGuids","url"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAMA,GAAe;AAAA,EAC1B;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,SAAS,OAAOE,MACP,KAAK,cAAc,KAAKC,EAAa,MAAMD,CAAG,EAAE,KAAK,CAACE,MAASA,EAAK,GAAG;AAAA,EAGhF,aAAa,OAAOC,MACX,KAAK,cAAc,KAAKF,EAAa,UAAUE,CAAO,EAAE,KAAK,CAACD,MAASA,EAAK,OAAO;AAAA,EAG5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