@mx-cartographer/experiences 6.26.32 → 7.0.0-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 (98) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Account-DY6nxO7y.mjs +30 -0
  3. package/dist/AccountDetailsContent-DvPs81kL.mjs +677 -0
  4. package/dist/AccountDetailsHeader-W2U7ZVm_.mjs +119 -0
  5. package/dist/AccountFields-DAVcbZy5.mjs +135 -0
  6. package/dist/AccountListItem-DFlbdcmT.mjs +90 -0
  7. package/dist/AccountStore-CU7qV3vg.mjs +230 -0
  8. package/dist/Accounts-BLlrQA5m.mjs +9 -0
  9. package/dist/BeatApi-DLu87ijw.mjs +21 -0
  10. package/dist/BeatStore-By4aGoRM.mjs +81 -0
  11. package/dist/BudgetUtil-Ci1TN0J5.mjs +101 -0
  12. package/dist/CashflowStore-D9Dpuz7X.mjs +91 -0
  13. package/dist/Category-5S6uwuXz.mjs +301 -0
  14. package/dist/CategorySelectorDrawer-rHyHHYuh.mjs +397 -0
  15. package/dist/CategoryStore-B5EW6I1d.mjs +183 -0
  16. package/dist/CategoryUtil-DRyruNgi.mjs +78 -0
  17. package/dist/ConnectDrawer-D9cR5phc.mjs +508 -0
  18. package/dist/ConnectionsDrawer-BzGqljSp.mjs +52 -0
  19. package/dist/CurrencyInput-D74cemI2.mjs +83 -0
  20. package/dist/CurrencyText-YUhH2caW.mjs +20 -0
  21. package/dist/DateUtil-BcuH7ErC.mjs +48 -0
  22. package/dist/DebtsStore-S0l9kr0r.mjs +60 -0
  23. package/dist/Dialog-CWW597AF.mjs +123 -0
  24. package/dist/Donut-1UMNcG67.mjs +57 -0
  25. package/dist/Drawer-kEE73B87.mjs +113 -0
  26. package/dist/EmptyState-Dcb-o2tl.mjs +55 -0
  27. package/dist/Fetch-CkFKy79O.mjs +116 -0
  28. package/dist/FinstrongStore-mkALvztw.mjs +101 -0
  29. package/dist/GoalStore-DioeeL-s.mjs +263 -0
  30. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  31. package/dist/Help-DhcC-C05.mjs +320 -0
  32. package/dist/Help-DpYRO8oA.mjs +3181 -0
  33. package/dist/IconBacking-B9oC6uL2.mjs +39 -0
  34. package/dist/InvestmentUtil-jOyOgzIB.mjs +134 -0
  35. package/dist/LineChart-CcyX38kK.mjs +499 -0
  36. package/dist/ListItemAction-BabpYivr.mjs +69 -0
  37. package/dist/Loader-Dp1P2gNw.mjs +14 -0
  38. package/dist/Localization-2MODESHW.mjs +30 -0
  39. package/dist/ManageIncome-ndMuhJMG.mjs +535 -0
  40. package/dist/MerchantStore-DVH-QOf0.mjs +37 -0
  41. package/dist/MicroWidgetContainer-CsvHLYKX.mjs +45 -0
  42. package/dist/MiniWidgetContainer-BoOp-A05.mjs +39 -0
  43. package/dist/NetWorthStore-PD-RUe09.mjs +150 -0
  44. package/dist/Notification-AMGWM1Al.mjs +78 -0
  45. package/dist/NotificationSettings-VhHuMAFU.mjs +667 -0
  46. package/dist/NotificationStore-DHtSGySy.mjs +67 -0
  47. package/dist/NumberFormatting-CtWHhyBX.mjs +40 -0
  48. package/dist/OriginalBalanceAction-D39mx6uE.mjs +115 -0
  49. package/dist/RecurringSettings-D_HnMYZP.mjs +57 -0
  50. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +263 -0
  51. package/dist/RepeatingTransaction-BPWfaB3f.mjs +282 -0
  52. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  53. package/dist/SettingsStore-CE7jDVFL.mjs +265 -0
  54. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +69 -0
  55. package/dist/SpendingData-BkrxzHdr.mjs +55 -0
  56. package/dist/StatusBar-BK_uYHAB.mjs +30 -0
  57. package/dist/TabContentContainer-j01JYR_7.mjs +21 -0
  58. package/dist/Transaction-CA0FW2Ij.mjs +312 -0
  59. package/dist/TransactionApi-DbbcjI2L.mjs +86 -0
  60. package/dist/TransactionDetails-WBHFmbxL.mjs +1283 -0
  61. package/dist/TransactionStore-CeLdmVnC.mjs +669 -0
  62. package/dist/TrendsStore-BHJUapXF.mjs +487 -0
  63. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +1959 -0
  64. package/dist/WidgetContainer-DWCusxYI.mjs +556 -0
  65. package/dist/accounts/index.es.js +752 -0
  66. package/dist/analytics/index.es.js +171 -0
  67. package/dist/budgets/index.es.js +1075 -0
  68. package/dist/cashflow/index.es.js +1098 -0
  69. package/dist/categories/index.es.js +9 -0
  70. package/dist/common/context/hooks.d.ts +13 -13
  71. package/dist/common/index.es.js +1451 -0
  72. package/dist/dashboard/index.es.js +181 -0
  73. package/dist/debts/index.es.js +1460 -0
  74. package/dist/exportTransactionsToCSV-CmwsKl2D.mjs +47 -0
  75. package/dist/finstrong/index.es.js +1455 -0
  76. package/dist/goals/index.es.js +1209 -0
  77. package/dist/help/components/content/section/index.d.ts +15 -15
  78. package/dist/help/index.es.js +14 -0
  79. package/dist/hooks-30y_BLwc.mjs +71 -0
  80. package/dist/index.d.ts +0 -22
  81. package/dist/insights/index.d.ts +1 -0
  82. package/dist/insights/index.es.js +4 -0
  83. package/dist/investments/index.es.js +1638 -0
  84. package/dist/merchants/index.es.js +79 -0
  85. package/dist/microinsights/index.es.js +16 -0
  86. package/dist/networth/index.es.js +576 -0
  87. package/dist/notifications/index.es.js +192 -0
  88. package/dist/recurringtransactions/index.es.js +879 -0
  89. package/dist/settings/index.es.js +879 -0
  90. package/dist/spending/index.es.js +570 -0
  91. package/dist/transactions/index.es.js +587 -0
  92. package/dist/trends/index.es.js +1086 -0
  93. package/dist/useCombineEvents-DaDBSR_1.mjs +92 -0
  94. package/dist/useDimensions-27p2evRx.mjs +36 -0
  95. package/dist/useScreenSize-B6JyS_Lj.mjs +36 -0
  96. package/package.json +155 -3
  97. package/dist/index.es.js +0 -30508
  98. package/dist/index.es.js.map +0 -1
@@ -0,0 +1,669 @@
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import H from "@mui/material/Box";
3
+ import P from "@mui/material/FormControlLabel";
4
+ import U from "@mui/material/Radio";
5
+ import K from "@mui/material/styles/useTheme";
6
+ import V from "@mui/material/Tooltip";
7
+ import { makeAutoObservable as y, runInAction as d } from "mobx";
8
+ import { endOfToday as D } from "date-fns/endOfToday";
9
+ import { formatISO as v } from "date-fns/formatISO";
10
+ import { fromUnixTime as u } from "date-fns/fromUnixTime";
11
+ import { getUnixTime as h } from "date-fns/getUnixTime";
12
+ import { isBefore as B } from "date-fns/isBefore";
13
+ import { startOfMonth as R } from "date-fns/startOfMonth";
14
+ import { startOfToday as G } from "date-fns/startOfToday";
15
+ import { subDays as Y } from "date-fns/subDays";
16
+ import { O as n, a as b, T as F } from "./Transaction-CA0FW2Ij.mjs";
17
+ import { T as p } from "./TransactionApi-DbbcjI2L.mjs";
18
+ import { c as W } from "./Category-5S6uwuXz.mjs";
19
+ import { f as z } from "./exportTransactionsToCSV-CmwsKl2D.mjs";
20
+ import { format as k } from "date-fns/format";
21
+ import { f as g, D as O, O as $ } from "./Dialog-CWW597AF.mjs";
22
+ import { endOfMonth as X } from "date-fns/endOfMonth";
23
+ import { B as f } from "./BeatApi-DLu87ijw.mjs";
24
+ const j = ({
25
+ checked: S = !1,
26
+ label: t,
27
+ sx: a = {},
28
+ tooltip: e = "",
29
+ value: A
30
+ }) => {
31
+ const _ = K(), i = _.palette.mode === "light" ? _.palette.grey[400] : _.palette.grey[700], c = S ? _.palette.action.active : i;
32
+ return /* @__PURE__ */ C(
33
+ H,
34
+ {
35
+ bgcolor: "background.paper",
36
+ border: `${S ? 3 : 1}px solid`,
37
+ borderColor: c,
38
+ borderRadius: 2,
39
+ mt: -2,
40
+ mx: 8,
41
+ pr: 8,
42
+ py: 4,
43
+ sx: { "&:hover": { borderColor: _.palette.action.active }, ...a },
44
+ children: /* @__PURE__ */ C(V, { title: e, children: /* @__PURE__ */ C(
45
+ P,
46
+ {
47
+ control: /* @__PURE__ */ C(
48
+ U,
49
+ {
50
+ disableRipple: !0,
51
+ sx: { "&.Mui-checked": { color: _.palette.action.active } }
52
+ }
53
+ ),
54
+ label: t,
55
+ labelPlacement: "start",
56
+ sx: { ml: 0, pl: 8 },
57
+ value: A
58
+ }
59
+ ) })
60
+ }
61
+ );
62
+ }, ft = j, w = {
63
+ ASC: "ASC",
64
+ DESC: "DESC",
65
+ DIRECTION: {
66
+ ASC: "ascending",
67
+ DESC: "descending"
68
+ },
69
+ ALIGN: {
70
+ center: "center",
71
+ left: "flex-start",
72
+ right: "flex-end"
73
+ }
74
+ }, T = {
75
+ ADD: "Add",
76
+ ADD_CATEGORY: "Add Category",
77
+ CHANGE_CATEGORY: "Change Category",
78
+ CHANGE_DATE: "Change Date",
79
+ CLOSE: "Close",
80
+ DELETE: "Delete",
81
+ EDIT: "Edit",
82
+ HIDE: "Hide",
83
+ SAVE: "Save",
84
+ SPLIT: "Split",
85
+ SELECT: "Select",
86
+ UNHIDE: "Unhide",
87
+ UNSPLIT: "Unsplit"
88
+ }, o = {
89
+ TRANSACTION_DETAILS: "Transaction Details",
90
+ TRANSACTIONS_LIST: "Transactions List",
91
+ TRANSACTIONS_WIDGET: "Transactions Widget"
92
+ }, r = {
93
+ ADD_TRANSACTION: "Manual Transaction",
94
+ CATEGORY: "Category",
95
+ DATE: "Date",
96
+ DELETE_MERCHANT_LOGO: "Merchant Logo",
97
+ DELETE_TRANSACTION: "Delete Transaction",
98
+ DESCRIPTION: "Description",
99
+ EXPORT_CSV: "Export CSV",
100
+ FLAG: "Flag",
101
+ HIDE_TRANSACTION: "Hide Transaction",
102
+ MEMO: "Memo",
103
+ SPLITS: "Split Transactions",
104
+ TAGS: "Tags",
105
+ TAG_ADD: "Add Tag",
106
+ TAG_DELETE: "Delete Tag",
107
+ TAG_EDIT: "Edit Tag",
108
+ TRANSACTION: "Transaction",
109
+ TRANSACTIONS_LIST: "Transactions List",
110
+ UNHIDE_TRANSACTION: "Unhide Transaction"
111
+ }, m = {
112
+ // splits
113
+ [n.ON_TRANSACTION_SPLIT_CLICK]: {
114
+ action: T.SELECT,
115
+ category: o.TRANSACTION_DETAILS,
116
+ label: r.SPLITS
117
+ },
118
+ [n.ON_TRANSACTION_SPLIT_CATEGORY_CLICK]: {
119
+ action: T.ADD_CATEGORY,
120
+ category: o.TRANSACTION_DETAILS,
121
+ label: r.SPLITS
122
+ },
123
+ [n.ON_TRANSACTION_SPLIT_DELETE_CLICK]: {
124
+ action: T.DELETE,
125
+ category: o.TRANSACTION_DETAILS,
126
+ label: r.SPLITS
127
+ },
128
+ [n.ON_TRANSACTION_SPLIT_SAVE_CLICK]: {
129
+ action: T.SPLIT,
130
+ category: o.TRANSACTION_DETAILS,
131
+ label: r.SPLITS
132
+ },
133
+ [n.ON_TRANSACTION_UNSPLIT]: {
134
+ action: T.UNSPLIT,
135
+ category: o.TRANSACTION_DETAILS,
136
+ label: r.SPLITS
137
+ },
138
+ // category
139
+ [n.ON_TRANSACTION_CATEGORY_CLICK]: {
140
+ action: T.SELECT,
141
+ category: o.TRANSACTIONS_LIST,
142
+ label: r.CATEGORY
143
+ },
144
+ [n.ON_TRANSACTION_CATEGORY_CHANGED]: {
145
+ action: T.CHANGE_CATEGORY,
146
+ category: o.TRANSACTION_DETAILS,
147
+ label: r.CATEGORY
148
+ },
149
+ // date
150
+ [n.ON_TRANSACTION_DATE_CHANGED]: {
151
+ action: T.SAVE,
152
+ category: o.TRANSACTION_DETAILS,
153
+ label: r.DATE
154
+ },
155
+ [n.ON_TRANSACTION_DATE_CLICK]: {
156
+ action: T.SELECT,
157
+ category: o.TRANSACTION_DETAILS,
158
+ label: r.DATE
159
+ },
160
+ // merchant logo
161
+ [n.ON_TRANSACTION_DELETE_LOGO_CANCEL]: {
162
+ action: T.CLOSE,
163
+ category: o.TRANSACTION_DETAILS,
164
+ label: r.DELETE_MERCHANT_LOGO
165
+ },
166
+ [n.ON_TRANSACTION_DELETE_LOGO_CLICK]: {
167
+ action: T.SELECT,
168
+ category: o.TRANSACTION_DETAILS,
169
+ label: r.DELETE_MERCHANT_LOGO
170
+ },
171
+ [n.ON_TRANSACTION_DELETE_LOGO_DELETED]: {
172
+ action: T.DELETE,
173
+ category: o.TRANSACTION_DETAILS,
174
+ label: r.DELETE_MERCHANT_LOGO
175
+ },
176
+ // description
177
+ [n.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK]: {
178
+ action: T.EDIT,
179
+ category: o.TRANSACTION_DETAILS,
180
+ label: r.DESCRIPTION
181
+ },
182
+ [n.ON_TRANSACTION_DESCRIPTION_SAVE_CLICK]: {
183
+ action: T.SAVE,
184
+ category: o.TRANSACTION_DETAILS,
185
+ label: r.DESCRIPTION
186
+ },
187
+ // hide transactions
188
+ [n.ON_TRANSACTION_HIDDEN]: {
189
+ action: T.SAVE,
190
+ category: o.TRANSACTION_DETAILS,
191
+ label: r.HIDE_TRANSACTION
192
+ },
193
+ [n.ON_TRANSACTION_HIDE_CLICK]: {
194
+ action: T.SELECT,
195
+ category: o.TRANSACTION_DETAILS,
196
+ label: r.HIDE_TRANSACTION
197
+ },
198
+ [n.ON_TRANSACTION_HIDE_CANCEL_CLICK]: {
199
+ action: T.CLOSE,
200
+ category: o.TRANSACTION_DETAILS,
201
+ label: r.HIDE_TRANSACTION
202
+ },
203
+ // transaction list
204
+ [n.ON_TRANSACTION_LIST_ITEM_CLICK]: {
205
+ action: T.SELECT,
206
+ category: o.TRANSACTIONS_LIST,
207
+ label: r.TRANSACTION
208
+ },
209
+ // memo
210
+ [n.ON_TRANSACTION_MEMO_CHANGED]: {
211
+ action: T.SAVE,
212
+ category: o.TRANSACTION_DETAILS,
213
+ label: r.MEMO
214
+ },
215
+ [n.ON_TRANSACTION_MEMO_CLICK]: {
216
+ action: T.SELECT,
217
+ category: o.TRANSACTION_DETAILS,
218
+ label: r.MEMO
219
+ },
220
+ // tags
221
+ [n.ON_TRANSACTION_TAGS_CHANGED]: {
222
+ action: T.SAVE,
223
+ category: o.TRANSACTION_DETAILS,
224
+ label: r.TAGS
225
+ },
226
+ [n.ON_TRANSACTION_TAGS_CLICK]: {
227
+ action: T.SELECT,
228
+ category: o.TRANSACTION_DETAILS,
229
+ label: r.TAGS
230
+ },
231
+ [n.ON_TRANSACTION_TAGS_TAG_ADD_CANCEL_CLICK]: {
232
+ action: T.CLOSE,
233
+ category: o.TRANSACTION_DETAILS,
234
+ label: r.TAGS
235
+ },
236
+ [n.ON_TRANSACTION_TAGS_TAG_ADD_CLICK]: {
237
+ action: T.ADD,
238
+ category: o.TRANSACTION_DETAILS,
239
+ label: r.TAG_ADD
240
+ },
241
+ [n.ON_TRANSACTION_TAGS_TAG_ADDED]: {
242
+ action: T.SAVE,
243
+ category: o.TRANSACTION_DETAILS,
244
+ label: r.TAG_ADD
245
+ },
246
+ [n.ON_TRANSACTION_TAGS_TAG_DELETE_CLICK]: {
247
+ action: T.SELECT,
248
+ category: o.TRANSACTION_DETAILS,
249
+ label: r.TAG_DELETE
250
+ },
251
+ [n.ON_TRANSACTION_TAGS_TAG_DELETE_CANCEL_CLICK]: {
252
+ action: T.CLOSE,
253
+ category: o.TRANSACTION_DETAILS,
254
+ label: r.TAG_DELETE
255
+ },
256
+ [n.ON_TRANSACTION_TAGS_TAG_DELETED]: {
257
+ action: T.SAVE,
258
+ category: o.TRANSACTION_DETAILS,
259
+ label: r.TAG_DELETE
260
+ },
261
+ [n.ON_TRANSACTION_TAGS_TAG_EDIT_CLICK]: {
262
+ action: T.EDIT,
263
+ category: o.TRANSACTION_DETAILS,
264
+ label: r.TAG_EDIT
265
+ },
266
+ [n.ON_TRANSACTION_TAGS_TAG_EDIT_SAVED]: {
267
+ action: T.SAVE,
268
+ category: o.TRANSACTION_DETAILS,
269
+ label: r.TAG_EDIT
270
+ },
271
+ // flag
272
+ [n.ON_TRANSACTION_TOGGLE_FLAG_CLICK]: {
273
+ action: T.SELECT,
274
+ category: o.TRANSACTION_DETAILS,
275
+ label: r.FLAG
276
+ },
277
+ // hide
278
+ [n.ON_TRANSACTION_UNHIDDEN]: {
279
+ action: T.SAVE,
280
+ category: o.TRANSACTION_DETAILS,
281
+ label: r.UNHIDE_TRANSACTION
282
+ },
283
+ [n.ON_TRANSACTION_UNHIDE_CLICK]: {
284
+ action: T.SELECT,
285
+ category: o.TRANSACTION_DETAILS,
286
+ label: r.UNHIDE_TRANSACTION
287
+ },
288
+ [n.ON_TRANSACTION_UNHIDE_CANCEL_CLICK]: {
289
+ action: T.CLOSE,
290
+ category: o.TRANSACTION_DETAILS,
291
+ label: r.UNHIDE_TRANSACTION
292
+ },
293
+ // export CSV
294
+ [n.ON_TRANSACTION_EXPORT_CSV_CLICK]: {
295
+ action: T.SELECT,
296
+ category: o.TRANSACTIONS_WIDGET,
297
+ label: r.EXPORT_CSV
298
+ },
299
+ // add transaction
300
+ [n.ON_TRANSACTION_MANUAL_ADD_CLICK]: {
301
+ action: T.SELECT,
302
+ category: o.TRANSACTIONS_WIDGET,
303
+ label: r.ADD_TRANSACTION
304
+ },
305
+ [n.ON_TRANSACTION_MANUAL_ADD_ADDED]: {
306
+ action: T.ADD,
307
+ category: o.TRANSACTIONS_WIDGET,
308
+ label: r.ADD_TRANSACTION
309
+ },
310
+ [n.ON_TRANSACTION_DELETE_CLICK]: {
311
+ action: T.SELECT,
312
+ category: o.TRANSACTIONS_WIDGET,
313
+ label: r.DELETE_TRANSACTION
314
+ },
315
+ [n.ON_TRANSACTION_DELETE_CANCEL]: {
316
+ action: T.CLOSE,
317
+ category: o.TRANSACTIONS_WIDGET,
318
+ label: r.DELETE_TRANSACTION
319
+ },
320
+ [n.ON_TRANSACTION_DELETE_DELETED]: {
321
+ action: T.DELETE,
322
+ category: o.TRANSACTIONS_WIDGET,
323
+ label: r.DELETE_TRANSACTION
324
+ }
325
+ }, Z = async (S, t) => !t || !m[S] ? null : t.sendAnalyticEvent(m[S]), L = {
326
+ FLAG: "flag",
327
+ DATE: "date",
328
+ PAYEE: "payee",
329
+ CATEGORY: "category",
330
+ ACCOUNT: "account",
331
+ AMOUNT: "amount"
332
+ }, q = (S, t, a, e = []) => {
333
+ const A = t.reduce((c, s) => ({ ...c, [s.guid]: s }), {}), _ = a.reduce((c, s) => ({ ...c, [s.guid]: s }), {}), i = e.reduce((c, s) => {
334
+ const { transaction_guid: l, tag_guid: I } = s;
335
+ if (!c[l])
336
+ return {
337
+ ...c,
338
+ [l]: [I]
339
+ };
340
+ const E = [...c[l], I];
341
+ return {
342
+ ...c,
343
+ [l]: E
344
+ };
345
+ }, {});
346
+ return S.map((c) => {
347
+ const s = A[c.account_guid], l = c.category_guid ? _[c.category_guid] : null, I = i[c.guid] ?? [];
348
+ return {
349
+ ...c,
350
+ account: s?.user_name || "Unknown",
351
+ accountIsClosed: s?.is_closed,
352
+ accountIsHidden: s?.is_hidden,
353
+ category: l?.name || "Uncategorized",
354
+ isIncome: c.top_level_category_guid === W.INCOME,
355
+ isPending: c.feed_status === b.PENDING,
356
+ number: s?.account_number || "",
357
+ payee: c.description,
358
+ tags: I
359
+ };
360
+ });
361
+ }, J = "uncategorized", Q = (S, t, a, e, A, _) => {
362
+ const i = tt(S, A, _), c = at(i, a, e);
363
+ return t.forEach((s) => {
364
+ const l = c.findIndex((E) => E.guid === s), I = _.filter((E) => E.parent_guid === s);
365
+ c.splice(l + 1, 0, ...I);
366
+ }), c;
367
+ }, tt = (S, t, a) => {
368
+ const {
369
+ accounts: e = [],
370
+ dateRange: A = { start: R(G()), end: D() },
371
+ custom: _ = () => !0,
372
+ searchTerm: i = "",
373
+ showSplits: c = !1
374
+ } = S;
375
+ return a.filter((s) => c ? !s.has_been_split : !s.parent_guid).filter((s) => !!e.find((l) => l === s.account_guid)).filter((s) => s.date >= h(A.start) && s.date <= h(A.end)).filter(_).filter((s) => {
376
+ if (i === J && s.has_been_split)
377
+ return !1;
378
+ if (/^spl/i.test(i) && (s.has_been_split || s.parent_guid))
379
+ return !0;
380
+ const I = s.tags.some(
381
+ (x) => N(i, t.find((M) => M.guid === x)?.name)
382
+ ), E = u(s.date);
383
+ return N(i, s.payee) || N(i, s.feed_description) || N(i, s.category) || N(i, g(E, O.MONTH)) || N(i, g(E, O.DAY)) || N(i, g(E, O.FULL_MONTH_DAY)) || N(i, g(E, O.MONTH_DAY_YEAR)) || N(i, k(E, $)) || N(i, s.account) || N(i, `${s.amount}`) || N(i, s.memo) || I;
384
+ });
385
+ }, at = (S, t, a) => [...S].sort((e, A) => {
386
+ const _ = t, i = (e[_] || "") > (A[_] || "");
387
+ let c = i ? -1 : 1, s = i ? 1 : -1;
388
+ return (t === L.DATE || t === L.AMOUNT) && (c = i ? 1 : -1, s = i ? -1 : 1), a === w.ASC ? c : s;
389
+ }), N = (S, t) => {
390
+ const a = S.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
391
+ return a.every((A) => e.indexOf(A) > -1);
392
+ }, et = {
393
+ account_guid: "",
394
+ amount: 0,
395
+ currency_code: "",
396
+ date: 0,
397
+ description: "",
398
+ duplicate: !1,
399
+ feed_description: "",
400
+ feed_status: b.POSTED,
401
+ feed_transaction_date: 0,
402
+ has_been_split: !1,
403
+ has_been_viewed: !1,
404
+ is_cleared: !1,
405
+ is_flagged: !1,
406
+ is_hidden: !1,
407
+ is_manual: !0,
408
+ is_personal: !0,
409
+ is_reimbursable: !1,
410
+ is_subscription: !1,
411
+ is_void: !1,
412
+ revision: 1,
413
+ transaction_type: F.DEBIT,
414
+ user_guid: "",
415
+ is_duplicate: !1,
416
+ feed_transacted_at: 0,
417
+ guid: "",
418
+ memo: void 0,
419
+ tags: []
420
+ };
421
+ class it {
422
+ beginDate = R(/* @__PURE__ */ new Date());
423
+ endDate = X(/* @__PURE__ */ new Date());
424
+ expandedSplits = [];
425
+ isInitialized = !1;
426
+ height = 550;
427
+ width = 1e3;
428
+ shouldDisableDrawerScroll = !1;
429
+ searchValue = "";
430
+ selectedAccountGuids = [];
431
+ manualTransaction = et;
432
+ isAmountValid = !1;
433
+ showInsights = !1;
434
+ constructor() {
435
+ y(this);
436
+ }
437
+ setDateRange = (t, a) => {
438
+ this.beginDate = t, this.endDate = a;
439
+ };
440
+ setIsInitialized = (t) => this.isInitialized = t;
441
+ setIsAmountValid = (t) => this.isAmountValid = t;
442
+ setSearchValue = (t) => this.searchValue = t;
443
+ setSelectedAccountGuids = (t) => this.selectedAccountGuids = t;
444
+ setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
445
+ setShowInsights = (t) => {
446
+ this.showInsights = t;
447
+ };
448
+ setSize = (t, a) => {
449
+ this.height = t, this.width = a;
450
+ };
451
+ toggleSplit = (t) => {
452
+ const a = [...this.expandedSplits], e = this.expandedSplits.findIndex((A) => A === t);
453
+ e >= 0 ? a.splice(e, 1) : a.push(t), this.expandedSplits = a;
454
+ };
455
+ clearExpandedSplits = () => {
456
+ this.expandedSplits.length !== 0 && (this.expandedSplits = []);
457
+ };
458
+ updateManualTransaction = (t) => {
459
+ this.manualTransaction = t;
460
+ };
461
+ }
462
+ class mt {
463
+ globalStore;
464
+ uiStore;
465
+ api = new p("/", "");
466
+ beatApi = new f("/", "");
467
+ associatedBeats = [];
468
+ cachedStartDate = Y(G(), 90);
469
+ filter = {};
470
+ isLoading = !0;
471
+ rawTransactions = [];
472
+ sortColumn = L.DATE;
473
+ sortDirection = w.DESC;
474
+ taggings = [];
475
+ tags = [];
476
+ transactionRules = [];
477
+ onAnalyticEvent = Z;
478
+ constructor(t) {
479
+ this.globalStore = t, this.uiStore = new it(), this.api = new p(t.endpoint, t.sessionToken), this.beatApi = new f(t.endpoint, t.sessionToken), y(this);
480
+ }
481
+ loadTransactionData = async ({
482
+ associatedBeats: t,
483
+ transactionRules: a,
484
+ transactions: e
485
+ } = {}) => {
486
+ await Promise.all([
487
+ this.loadAssociatedBeats(R(/* @__PURE__ */ new Date()), t),
488
+ this.loadTags(),
489
+ this.loadTaggings(),
490
+ this.loadTransactionRules(a),
491
+ // By default loads 90 days of transactions
492
+ this.loadTransactions(this.cachedStartDate, D(), e)
493
+ ]), d(() => {
494
+ this.uiStore.setIsInitialized(!0);
495
+ });
496
+ };
497
+ get sortedTransactions() {
498
+ return Q(
499
+ this.filter,
500
+ this.uiStore.expandedSplits,
501
+ this.sortColumn,
502
+ this.sortDirection,
503
+ this.tags,
504
+ this.transactions
505
+ );
506
+ }
507
+ get sortedTransactionsWithSplits() {
508
+ return z(this.sortedTransactions, this.transactions);
509
+ }
510
+ get transactions() {
511
+ return this.augmentTransactions(this.rawTransactions);
512
+ }
513
+ addTag = async (t) => {
514
+ await this.api.addTag({ name: t }), await this.loadTags();
515
+ };
516
+ addTagging = async (t, a) => {
517
+ await this.api.addTagging({
518
+ tag_guid: t,
519
+ transaction_guid: a
520
+ });
521
+ };
522
+ addOrUpdateTransactionRule = async (t, a) => {
523
+ const e = this.transactionRules.find(
524
+ (A) => A.guid === a.user_transaction_rule_guid
525
+ );
526
+ e ? await this.api.updateTransactionRule({
527
+ ...e,
528
+ category_guid: t,
529
+ description: a.description
530
+ }) : await this.api.addTransactionRule({
531
+ category_guid: t,
532
+ description: a.description,
533
+ match_description: a.description
534
+ }), await this.loadTransactionRules();
535
+ };
536
+ addTransaction = async (t) => {
537
+ const a = await this.api.addTransaction(t);
538
+ a && d(() => this.rawTransactions = [a, ...this.transactions]);
539
+ };
540
+ augmentTransactions = (t) => q(
541
+ t,
542
+ this.globalStore.accountStore.visibleAccounts,
543
+ this.globalStore.categoryStore.categories,
544
+ this.taggings
545
+ );
546
+ getTransactionData = () => ({});
547
+ loadAssociatedBeats = async (t, a) => {
548
+ const e = t ? v(t, { representation: "date" }) : void 0, A = a ?? await this.beatApi.getBeatsWithAssociatedTransaction(e);
549
+ d(() => this.associatedBeats = A);
550
+ };
551
+ loadTags = async () => {
552
+ const t = await this.api.getTags();
553
+ d(() => this.tags = t);
554
+ };
555
+ loadTaggings = async () => {
556
+ const t = await this.api.getTaggings();
557
+ d(() => this.taggings = t);
558
+ };
559
+ loadTransactionRules = async (t) => {
560
+ const a = t ?? await this.api.getTransactionRules();
561
+ d(() => this.transactionRules = a);
562
+ };
563
+ loadTransactions = async (t = this.cachedStartDate, a = D(), e) => {
564
+ this.setIsLoading(!0), this.rawTransactions = [];
565
+ try {
566
+ const A = e ?? await this.api.getTransactionsByDateRange(h(t), h(a));
567
+ d(() => {
568
+ this.rawTransactions = A;
569
+ });
570
+ } catch (A) {
571
+ console.error(`Error occurred while loading transactions: ${A}`);
572
+ }
573
+ this.setIsLoading(!1);
574
+ };
575
+ // DEPRECATED
576
+ loadTransactionsByDateRange = async (t, a) => {
577
+ console.warn("DEPRECATED: loadTransactionsByDateRange will be removed"), this.setFilter({
578
+ ...this.filter,
579
+ dateRange: { start: u(a), end: u(t) }
580
+ });
581
+ };
582
+ modifyTransactionByAccountGuid = (t, a) => {
583
+ this.rawTransactions = this.transactions.map(
584
+ (e) => e.account_guid === t ? { ...e, ...a } : e
585
+ );
586
+ };
587
+ removeTag = async (t) => {
588
+ await this.api.removeTag(t), await this.loadTags();
589
+ };
590
+ removeTagging = async (t) => {
591
+ await this.api.removeTagging(t);
592
+ };
593
+ removeTransaction = async (t) => {
594
+ await this.api.removeTransaction(t);
595
+ const a = this.transactions.findIndex((e) => e.guid === t);
596
+ if (a >= 0) {
597
+ const e = [...this.transactions];
598
+ e.splice(a, 1), d(() => this.rawTransactions = e);
599
+ }
600
+ };
601
+ setFilter = (t) => {
602
+ this.filter = t, t.dateRange && B(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start, D()).then(() => {
603
+ t.dateRange && (this.cachedStartDate = t.dateRange.start);
604
+ });
605
+ };
606
+ setIsLoading = (t) => this.isLoading = t;
607
+ setSortData = (t, a) => {
608
+ this.sortColumn = t, this.sortDirection = a;
609
+ };
610
+ splitTransaction = async (t, a) => {
611
+ const e = await this.api.updateTransaction(t), A = [];
612
+ for (let i = 0; i < a.length; i++) {
613
+ const c = await this.api.addTransaction(a[i]);
614
+ A.push(c);
615
+ }
616
+ const _ = this.transactions.findIndex((i) => i.guid === t.guid);
617
+ _ >= 0 && d(
618
+ () => this.rawTransactions = [
619
+ ...this.transactions.slice(0, _),
620
+ e,
621
+ ...this.transactions.slice(_ + 1),
622
+ ...A
623
+ ]
624
+ );
625
+ };
626
+ unSplitTransaction = async (t) => {
627
+ const a = this.transactions.filter((i) => i.parent_guid === t);
628
+ await this.api.removeTransactionSplit(t);
629
+ const e = [...this.transactions];
630
+ a.forEach((i) => {
631
+ const c = e.findIndex((s) => s.guid === i.guid);
632
+ c >= 0 && e.splice(c, 1);
633
+ });
634
+ const A = e.findIndex((i) => i.guid === t), _ = e[A];
635
+ _.has_been_split = !1, A >= 0 && d(
636
+ () => this.rawTransactions = [
637
+ ...e.slice(0, A),
638
+ _,
639
+ ...e.slice(A + 1)
640
+ ]
641
+ );
642
+ };
643
+ updateTaggings = async (t, a) => {
644
+ const e = this.taggings.filter((i) => i.transaction_guid === a), A = new Set(e.map((i) => i.tag_guid)), _ = new Set(t);
645
+ for (const i of t)
646
+ A.has(i) || await this.addTagging(i, a);
647
+ for (const i of e)
648
+ _.has(i.tag_guid) || await this.removeTagging(i.guid);
649
+ await this.loadTaggings();
650
+ };
651
+ updateTag = async (t) => {
652
+ await this.api.updateTag(t), await this.loadTags();
653
+ };
654
+ updateTransaction = async (t) => {
655
+ const a = await this.api.updateTransaction(t), e = this.transactions.findIndex((A) => A.guid === t.guid);
656
+ e >= 0 && d(
657
+ () => this.rawTransactions = [
658
+ ...this.transactions.slice(0, e),
659
+ a,
660
+ ...this.transactions.slice(e + 1)
661
+ ]
662
+ );
663
+ };
664
+ }
665
+ export {
666
+ et as D,
667
+ ft as S,
668
+ mt as T
669
+ };