@mx-cartographer/experiences 7.3.0-alpha.sms1 → 7.3.0

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 (104) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/{Account-Bxw0_4FU.mjs → Account-YwUMFz93.mjs} +1 -1
  3. package/dist/{AccountDetailsContent-CAM9y39M.mjs → AccountDetailsContent-BgCST7mK.mjs} +8 -8
  4. package/dist/AccountDetailsHeader-jAFWoHj7.mjs +87 -0
  5. package/dist/{AccountFields-C9FlatNb.mjs → AccountFields-DPxMPBF0.mjs} +2 -2
  6. package/dist/{AccountListItem-JFMZROh7.mjs → AccountListItem-D6rWAreC.mjs} +8 -8
  7. package/dist/{AccountStore-BgNOyMdp.mjs → AccountStore-B5E98oM1.mjs} +100 -74
  8. package/dist/Accounts-UIlYCmHb.mjs +9 -0
  9. package/dist/{BeatApi-DhJpgCLz.mjs → BeatApi-De2IaqH2.mjs} +1 -1
  10. package/dist/{BeatStore-IBnXd4YK.mjs → BeatStore-D_NYuBSz.mjs} +1 -1
  11. package/dist/{BudgetUtil-B2ZXyw-g.mjs → BudgetUtil-CXvenbdN.mjs} +1 -1
  12. package/dist/{CategorySelectorDrawer-DUe4lH5-.mjs → CategorySelectorDrawer-Buy70Y3V.mjs} +21 -19
  13. package/dist/CategoryStore-BEdFs69_.mjs +183 -0
  14. package/dist/CategoryUtil-BR3H5i6n.mjs +78 -0
  15. package/dist/{ConnectDrawer-BQNs-hjk.mjs → ConnectDrawer-CbxHKlRv.mjs} +10 -10
  16. package/dist/{ConnectionsDrawer-ByGQE7D5.mjs → ConnectionsDrawer-C6kanU7I.mjs} +4 -4
  17. package/dist/{CurrencyInput-DUsQbkXb.mjs → CurrencyInput-lSC7oPDg.mjs} +1 -1
  18. package/dist/{DebtsStore-C9bblOgW.mjs → DebtsStore-DgIcphe_.mjs} +1 -1
  19. package/dist/{ExportCsvAction-sX8Rg4Ov.mjs → ExportCsvAction-DZ10CbWd.mjs} +3 -3
  20. package/dist/{Fetch-87LIQbEA.mjs → Fetch-DecPFeGU.mjs} +24 -22
  21. package/dist/{FinstrongStore-F2c607dj.mjs → FinstrongStore-CL7t5lBL.mjs} +1 -1
  22. package/dist/{GoalStore-D-aB35SY.mjs → GoalStore-CAlmSu4U.mjs} +112 -152
  23. package/dist/{Help-B6dIcujh.mjs → Help-hi9I9EYP.mjs} +1 -1
  24. package/dist/{LineChart-D4GI7nVh.mjs → LineChart-eK4IQImU.mjs} +2 -2
  25. package/dist/{ListItemAction-DHa3KJPs.mjs → ListItemAction-BmL5buOf.mjs} +1 -1
  26. package/dist/{ManageIncome-1s_q5W4X.mjs → ManageIncome-Cypo9qY4.mjs} +66 -65
  27. package/dist/{MerchantStore-DrFvsUyy.mjs → MerchantStore-WvZ4gnQe.mjs} +1 -1
  28. package/dist/{MicroWidgetContainer-DpeqN9n3.mjs → MicroWidgetContainer-CFdMGJKg.mjs} +1 -1
  29. package/dist/{MiniWidgetContainer-D0gfmbaF.mjs → MiniWidgetContainer-BdgBvpga.mjs} +1 -1
  30. package/dist/{NetWorthStore-DCsTZpuS.mjs → NetWorthStore-CxqIxAgN.mjs} +2 -2
  31. package/dist/{NotificationSettings-DqrkNMod.mjs → NotificationSettings-DxytNHlN.mjs} +240 -237
  32. package/dist/{NotificationStore-BxP_P2dA.mjs → NotificationStore-CDX_kqHa.mjs} +7 -15
  33. package/dist/{OriginalBalanceAction-CWuVvRq9.mjs → OriginalBalanceAction-V6FEoIDe.mjs} +3 -3
  34. package/dist/{RecurringSettings-A_rAGCTP.mjs → RecurringSettings-iIupYxJW.mjs} +4 -4
  35. package/dist/{RecurringTransactions-DK8dWldr.mjs → RecurringTransactions-ej39mgA6.mjs} +3 -3
  36. package/dist/{RecurringTransactionsStore-C4YOD7_D.mjs → RecurringTransactionsStore-BiwCzScZ.mjs} +26 -29
  37. package/dist/{SettingsStore-BcgS_Ohv.mjs → SettingsStore-krIRNwHK.mjs} +3 -3
  38. package/dist/{ToggleListItem-r0Kx56wF.mjs → ToggleListItem-ciFTiqRS.mjs} +19 -14
  39. package/dist/TransactionApi-CjBoLleL.mjs +86 -0
  40. package/dist/{TransactionDetails-oP1eSuiS.mjs → TransactionDetails-BUoNbsu-.mjs} +402 -367
  41. package/dist/TransactionStore-C1oyQCZK.mjs +677 -0
  42. package/dist/TrendsStore-5PvDT_o6.mjs +182 -0
  43. package/dist/{User-BQUxBeZV.mjs → User-Bj34_i8g.mjs} +1 -1
  44. package/dist/{ViewMoreMicroCard-SCn2wt4i.mjs → ViewMoreMicroCard-lihSDk2J.mjs} +517 -493
  45. package/dist/{WidgetContainer-BHWANqT4.mjs → WidgetContainer-BnTgAfQn.mjs} +2 -2
  46. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +4 -1
  47. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.d.ts +2 -1
  48. package/dist/accounts/index.es.js +241 -203
  49. package/dist/accounts/stores/AccountStore.d.ts +22 -25
  50. package/dist/accounts/utils/Accounts.d.ts +1 -2
  51. package/dist/analytics/index.es.js +2 -2
  52. package/dist/budgets/index.es.js +500 -507
  53. package/dist/budgets/store/BudgetsStore.d.ts +0 -1
  54. package/dist/cashflow/index.es.js +384 -382
  55. package/dist/categories/index.es.js +2 -2
  56. package/dist/categories/stores/CategoryStore.d.ts +1 -5
  57. package/dist/categories/util/CategoryUtil.d.ts +2 -3
  58. package/dist/common/components/charts/index.d.ts +0 -2
  59. package/dist/common/index.es.js +391 -376
  60. package/dist/common/stores/AppDataStore.d.ts +1 -3
  61. package/dist/common/stores/GlobalCopyStore.d.ts +1 -0
  62. package/dist/common/stores/GlobalStore.d.ts +10 -4
  63. package/dist/common/stores/UserStore.d.ts +2 -3
  64. package/dist/common/types/Account.d.ts +6 -9
  65. package/dist/common/types/Global.d.ts +1 -0
  66. package/dist/dashboard/index.es.js +2 -2
  67. package/dist/debts/index.es.js +506 -498
  68. package/dist/{exportTransactionsToCSV-7bVS7KXf.mjs → exportTransactionsToCSV-B8qpk5MU.mjs} +14 -13
  69. package/dist/finstrong/index.es.js +417 -415
  70. package/dist/goals/index.es.js +559 -557
  71. package/dist/goals/stores/GoalStore.d.ts +4 -17
  72. package/dist/help/index.es.js +3 -3
  73. package/dist/{hooks-D6XlXHf4.mjs → hooks-Cy8JnjCg.mjs} +2 -2
  74. package/dist/insights/index.es.js +1 -1
  75. package/dist/investments/index.es.js +437 -435
  76. package/dist/investments/stores/HoldingStore.d.ts +0 -1
  77. package/dist/merchants/index.es.js +2 -2
  78. package/dist/microinsights/carousel/BeatList.d.ts +10 -0
  79. package/dist/microinsights/carousel/CarouselControls.d.ts +1 -1
  80. package/dist/microinsights/index.es.js +1 -1
  81. package/dist/microinsights/interfaces.d.ts +0 -1
  82. package/dist/networth/index.es.js +176 -174
  83. package/dist/notifications/index.es.js +23 -23
  84. package/dist/notifications/stores/NotificationStore.d.ts +1 -3
  85. package/dist/recurringtransactions/index.es.js +175 -173
  86. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +2 -3
  87. package/dist/settings/index.es.js +285 -279
  88. package/dist/spending/index.es.js +282 -281
  89. package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -0
  90. package/dist/transactions/index.es.js +63 -64
  91. package/dist/transactions/stores/TransactionStore.d.ts +77 -21
  92. package/dist/trends/index.es.js +948 -583
  93. package/dist/{useAccountDisplayName-BUAApBIb.mjs → useAccountDisplayName-D6sQsNNQ.mjs} +2 -2
  94. package/dist/{useCombineEvents-BUDIR1ba.mjs → useCombineEvents-CRwX-qWE.mjs} +1 -1
  95. package/dist/{useInsightsEnabled-DBpwEq10.mjs → useInsightsEnabled-BxytCjq5.mjs} +1 -1
  96. package/package.json +4 -4
  97. package/dist/AccountDetailsHeader-JtSX6Uf9.mjs +0 -120
  98. package/dist/Accounts-BRf_YeTf.mjs +0 -27
  99. package/dist/CategoryStore-yHI0hWmK.mjs +0 -174
  100. package/dist/CategoryUtil-pZRIYOgN.mjs +0 -80
  101. package/dist/TransactionApi-B3Tksf7L.mjs +0 -86
  102. package/dist/TransactionStore-ai3uII_r.mjs +0 -690
  103. package/dist/TrendsStore-DCYbpXPO.mjs +0 -559
  104. package/dist/useAriaLive-B3_pRUio.mjs +0 -35
@@ -1,690 +0,0 @@
1
- import { jsx as I } from "react/jsx-runtime";
2
- import M from "@mui/material/Box";
3
- import H from "@mui/material/FormControlLabel";
4
- import P from "@mui/material/Radio";
5
- import U from "@mui/material/styles/useTheme";
6
- import K from "@mui/material/Tooltip";
7
- import { makeAutoObservable as p } from "mobx";
8
- import { endOfToday as f } from "date-fns/endOfToday";
9
- import { formatISO as V } from "date-fns/formatISO";
10
- import { getUnixTime as O } from "date-fns/getUnixTime";
11
- import { isBefore as v } from "date-fns/isBefore";
12
- import { startOfMonth as h } from "date-fns/startOfMonth";
13
- import { startOfToday as m } from "date-fns/startOfToday";
14
- import { subDays as B } from "date-fns/subDays";
15
- import { O as n, a as y, T as b } from "./User-BQUxBeZV.mjs";
16
- import { T as u } from "./TransactionApi-B3Tksf7L.mjs";
17
- import { b as Y } from "./Category-CevNQ03n.mjs";
18
- import { f as F } from "./exportTransactionsToCSV-7bVS7KXf.mjs";
19
- import { format as W } from "date-fns/format";
20
- import { fromUnixTime as z } from "date-fns/fromUnixTime";
21
- import { f as g, D as C, O as $ } from "./Dialog-CWW597AF.mjs";
22
- import { endOfMonth as k } from "date-fns/endOfMonth";
23
- import { B as L } from "./BeatApi-DhJpgCLz.mjs";
24
- const X = ({
25
- checked: l = !1,
26
- label: t,
27
- sx: a = {},
28
- tooltip: e = "",
29
- value: A
30
- }) => {
31
- const d = U(), s = d.palette.mode === "light" ? d.palette.grey[400] : d.palette.grey[700], c = l ? d.palette.action.active : s;
32
- return /* @__PURE__ */ I(
33
- M,
34
- {
35
- bgcolor: "background.paper",
36
- border: `${l ? 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: d.palette.action.active }, ...a },
44
- children: /* @__PURE__ */ I(K, { title: e, children: /* @__PURE__ */ I(
45
- H,
46
- {
47
- control: /* @__PURE__ */ I(
48
- P,
49
- {
50
- disableRipple: !0,
51
- sx: { "&.Mui-checked": { color: d.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
- }, pt = X, G = {
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
- }, o = {
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
- }, T = {
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
- }, R = {
112
- // splits
113
- [n.ON_TRANSACTION_SPLIT_CLICK]: {
114
- action: o.SELECT,
115
- category: T.TRANSACTION_DETAILS,
116
- label: r.SPLITS
117
- },
118
- [n.ON_TRANSACTION_SPLIT_CATEGORY_CLICK]: {
119
- action: o.ADD_CATEGORY,
120
- category: T.TRANSACTION_DETAILS,
121
- label: r.SPLITS
122
- },
123
- [n.ON_TRANSACTION_SPLIT_DELETE_CLICK]: {
124
- action: o.DELETE,
125
- category: T.TRANSACTION_DETAILS,
126
- label: r.SPLITS
127
- },
128
- [n.ON_TRANSACTION_SPLIT_SAVE_CLICK]: {
129
- action: o.SPLIT,
130
- category: T.TRANSACTION_DETAILS,
131
- label: r.SPLITS
132
- },
133
- [n.ON_TRANSACTION_UNSPLIT]: {
134
- action: o.UNSPLIT,
135
- category: T.TRANSACTION_DETAILS,
136
- label: r.SPLITS
137
- },
138
- // category
139
- [n.ON_TRANSACTION_CATEGORY_CLICK]: {
140
- action: o.SELECT,
141
- category: T.TRANSACTIONS_LIST,
142
- label: r.CATEGORY
143
- },
144
- [n.ON_TRANSACTION_CATEGORY_CHANGED]: {
145
- action: o.CHANGE_CATEGORY,
146
- category: T.TRANSACTION_DETAILS,
147
- label: r.CATEGORY
148
- },
149
- // date
150
- [n.ON_TRANSACTION_DATE_CHANGED]: {
151
- action: o.SAVE,
152
- category: T.TRANSACTION_DETAILS,
153
- label: r.DATE
154
- },
155
- [n.ON_TRANSACTION_DATE_CLICK]: {
156
- action: o.SELECT,
157
- category: T.TRANSACTION_DETAILS,
158
- label: r.DATE
159
- },
160
- // merchant logo
161
- [n.ON_TRANSACTION_DELETE_LOGO_CANCEL]: {
162
- action: o.CLOSE,
163
- category: T.TRANSACTION_DETAILS,
164
- label: r.DELETE_MERCHANT_LOGO
165
- },
166
- [n.ON_TRANSACTION_DELETE_LOGO_CLICK]: {
167
- action: o.SELECT,
168
- category: T.TRANSACTION_DETAILS,
169
- label: r.DELETE_MERCHANT_LOGO
170
- },
171
- [n.ON_TRANSACTION_DELETE_LOGO_DELETED]: {
172
- action: o.DELETE,
173
- category: T.TRANSACTION_DETAILS,
174
- label: r.DELETE_MERCHANT_LOGO
175
- },
176
- // description
177
- [n.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK]: {
178
- action: o.EDIT,
179
- category: T.TRANSACTION_DETAILS,
180
- label: r.DESCRIPTION
181
- },
182
- [n.ON_TRANSACTION_DESCRIPTION_SAVE_CLICK]: {
183
- action: o.SAVE,
184
- category: T.TRANSACTION_DETAILS,
185
- label: r.DESCRIPTION
186
- },
187
- // hide transactions
188
- [n.ON_TRANSACTION_HIDDEN]: {
189
- action: o.SAVE,
190
- category: T.TRANSACTION_DETAILS,
191
- label: r.HIDE_TRANSACTION
192
- },
193
- [n.ON_TRANSACTION_HIDE_CLICK]: {
194
- action: o.SELECT,
195
- category: T.TRANSACTION_DETAILS,
196
- label: r.HIDE_TRANSACTION
197
- },
198
- [n.ON_TRANSACTION_HIDE_CANCEL_CLICK]: {
199
- action: o.CLOSE,
200
- category: T.TRANSACTION_DETAILS,
201
- label: r.HIDE_TRANSACTION
202
- },
203
- // transaction list
204
- [n.ON_TRANSACTION_LIST_ITEM_CLICK]: {
205
- action: o.SELECT,
206
- category: T.TRANSACTIONS_LIST,
207
- label: r.TRANSACTION
208
- },
209
- // memo
210
- [n.ON_TRANSACTION_MEMO_CHANGED]: {
211
- action: o.SAVE,
212
- category: T.TRANSACTION_DETAILS,
213
- label: r.MEMO
214
- },
215
- [n.ON_TRANSACTION_MEMO_CLICK]: {
216
- action: o.SELECT,
217
- category: T.TRANSACTION_DETAILS,
218
- label: r.MEMO
219
- },
220
- // tags
221
- [n.ON_TRANSACTION_TAGS_CHANGED]: {
222
- action: o.SAVE,
223
- category: T.TRANSACTION_DETAILS,
224
- label: r.TAGS
225
- },
226
- [n.ON_TRANSACTION_TAGS_CLICK]: {
227
- action: o.SELECT,
228
- category: T.TRANSACTION_DETAILS,
229
- label: r.TAGS
230
- },
231
- [n.ON_TRANSACTION_TAGS_TAG_ADD_CANCEL_CLICK]: {
232
- action: o.CLOSE,
233
- category: T.TRANSACTION_DETAILS,
234
- label: r.TAGS
235
- },
236
- [n.ON_TRANSACTION_TAGS_TAG_ADD_CLICK]: {
237
- action: o.ADD,
238
- category: T.TRANSACTION_DETAILS,
239
- label: r.TAG_ADD
240
- },
241
- [n.ON_TRANSACTION_TAGS_TAG_ADDED]: {
242
- action: o.SAVE,
243
- category: T.TRANSACTION_DETAILS,
244
- label: r.TAG_ADD
245
- },
246
- [n.ON_TRANSACTION_TAGS_TAG_DELETE_CLICK]: {
247
- action: o.SELECT,
248
- category: T.TRANSACTION_DETAILS,
249
- label: r.TAG_DELETE
250
- },
251
- [n.ON_TRANSACTION_TAGS_TAG_DELETE_CANCEL_CLICK]: {
252
- action: o.CLOSE,
253
- category: T.TRANSACTION_DETAILS,
254
- label: r.TAG_DELETE
255
- },
256
- [n.ON_TRANSACTION_TAGS_TAG_DELETED]: {
257
- action: o.SAVE,
258
- category: T.TRANSACTION_DETAILS,
259
- label: r.TAG_DELETE
260
- },
261
- [n.ON_TRANSACTION_TAGS_TAG_EDIT_CLICK]: {
262
- action: o.EDIT,
263
- category: T.TRANSACTION_DETAILS,
264
- label: r.TAG_EDIT
265
- },
266
- [n.ON_TRANSACTION_TAGS_TAG_EDIT_SAVED]: {
267
- action: o.SAVE,
268
- category: T.TRANSACTION_DETAILS,
269
- label: r.TAG_EDIT
270
- },
271
- // flag
272
- [n.ON_TRANSACTION_TOGGLE_FLAG_CLICK]: {
273
- action: o.SELECT,
274
- category: T.TRANSACTION_DETAILS,
275
- label: r.FLAG
276
- },
277
- // hide
278
- [n.ON_TRANSACTION_UNHIDDEN]: {
279
- action: o.SAVE,
280
- category: T.TRANSACTION_DETAILS,
281
- label: r.UNHIDE_TRANSACTION
282
- },
283
- [n.ON_TRANSACTION_UNHIDE_CLICK]: {
284
- action: o.SELECT,
285
- category: T.TRANSACTION_DETAILS,
286
- label: r.UNHIDE_TRANSACTION
287
- },
288
- [n.ON_TRANSACTION_UNHIDE_CANCEL_CLICK]: {
289
- action: o.CLOSE,
290
- category: T.TRANSACTION_DETAILS,
291
- label: r.UNHIDE_TRANSACTION
292
- },
293
- // export CSV
294
- [n.ON_TRANSACTION_EXPORT_CSV_CLICK]: {
295
- action: o.SELECT,
296
- category: T.TRANSACTIONS_WIDGET,
297
- label: r.EXPORT_CSV
298
- },
299
- // add transaction
300
- [n.ON_TRANSACTION_MANUAL_ADD_CLICK]: {
301
- action: o.SELECT,
302
- category: T.TRANSACTIONS_WIDGET,
303
- label: r.ADD_TRANSACTION
304
- },
305
- [n.ON_TRANSACTION_MANUAL_ADD_ADDED]: {
306
- action: o.ADD,
307
- category: T.TRANSACTIONS_WIDGET,
308
- label: r.ADD_TRANSACTION
309
- },
310
- [n.ON_TRANSACTION_DELETE_CLICK]: {
311
- action: o.SELECT,
312
- category: T.TRANSACTIONS_WIDGET,
313
- label: r.DELETE_TRANSACTION
314
- },
315
- [n.ON_TRANSACTION_DELETE_CANCEL]: {
316
- action: o.CLOSE,
317
- category: T.TRANSACTIONS_WIDGET,
318
- label: r.DELETE_TRANSACTION
319
- },
320
- [n.ON_TRANSACTION_DELETE_DELETED]: {
321
- action: o.DELETE,
322
- category: T.TRANSACTIONS_WIDGET,
323
- label: r.DELETE_TRANSACTION
324
- }
325
- }, j = async (l, t) => !t || !R[l] ? null : t.sendAnalyticEvent(R[l]), D = {
326
- FLAG: "flag",
327
- DATE: "date",
328
- PAYEE: "payee",
329
- CATEGORY: "category",
330
- ACCOUNT: "account",
331
- AMOUNT: "amount"
332
- }, Z = (l, t, a, e = []) => {
333
- const A = t.reduce((c, i) => ({ ...c, [i.guid]: i }), {}), d = a.reduce((c, i) => ({ ...c, [i.guid]: i }), {}), s = e.reduce((c, i) => {
334
- const { transaction_guid: N, tag_guid: E } = i;
335
- if (!c[N])
336
- return {
337
- ...c,
338
- [N]: [E]
339
- };
340
- const S = [...c[N], E];
341
- return {
342
- ...c,
343
- [N]: S
344
- };
345
- }, {});
346
- return l.map((c) => {
347
- const i = A[c.account_guid], N = c.category_guid ? d[c.category_guid] : null, E = s[c.guid] ?? [];
348
- return {
349
- ...c,
350
- account: i?.user_name || "Unknown",
351
- accountIsClosed: i?.is_closed,
352
- accountIsHidden: i?.is_hidden,
353
- category: N?.name || "Uncategorized",
354
- isIncome: c.top_level_category_guid === Y.INCOME,
355
- isPending: c.feed_status === y.PENDING,
356
- number: i?.account_number || "",
357
- payee: c.description,
358
- tags: E
359
- };
360
- });
361
- }, q = "uncategorized", J = (l, t, a, e, A, d) => {
362
- const s = Q(l, A, d), c = tt(s, a, e);
363
- return t.forEach((i) => {
364
- const N = c.findIndex((S) => S.guid === i), E = d.filter((S) => S.parent_guid === i);
365
- c.splice(N + 1, 0, ...E);
366
- }), c;
367
- }, Q = (l, t, a) => {
368
- const {
369
- accounts: e = [],
370
- dateRange: A = { start: h(m()), end: f() },
371
- custom: d = () => !0,
372
- searchTerm: s = "",
373
- showSplits: c = !1
374
- } = l;
375
- return a.filter((i) => c ? !i.has_been_split : !i.parent_guid).filter((i) => !!e.find((N) => N === i.account_guid)).filter((i) => i.date >= O(A.start) && i.date <= O(A.end)).filter(d).filter((i) => {
376
- if (s === q && i.has_been_split)
377
- return !1;
378
- if (/^spl/i.test(s) && (i.has_been_split || i.parent_guid))
379
- return !0;
380
- const E = i.tags.some(
381
- (w) => _(s, t.find((x) => x.guid === w)?.name)
382
- ), S = z(i.date);
383
- return _(s, i.payee) || _(s, i.feed_description) || _(s, i.category) || _(s, g(S, C.MONTH)) || _(s, g(S, C.DAY)) || _(s, g(S, C.FULL_MONTH_DAY)) || _(s, g(S, C.MONTH_DAY_YEAR)) || _(s, W(S, $)) || _(s, i.account) || _(s, `${i.amount}`) || _(s, i.memo) || E;
384
- });
385
- }, tt = (l, t, a) => [...l].sort((e, A) => {
386
- const d = t, s = (e[d] || "") > (A[d] || "");
387
- let c = s ? -1 : 1, i = s ? 1 : -1;
388
- return (t === D.DATE || t === D.AMOUNT) && (c = s ? 1 : -1, i = s ? -1 : 1), a === G.ASC ? c : i;
389
- }), _ = (l, t) => {
390
- const a = l.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
391
- return a.every((A) => e.indexOf(A) > -1);
392
- }, at = {
393
- account_guid: "",
394
- amount: 0,
395
- currency_code: "",
396
- date: 0,
397
- description: "",
398
- duplicate: !1,
399
- feed_description: "",
400
- feed_status: y.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: b.DEBIT,
414
- user_guid: "",
415
- is_duplicate: !1,
416
- feed_transacted_at: 0,
417
- guid: "",
418
- memo: void 0,
419
- tags: []
420
- };
421
- class et {
422
- beginDate = h(/* @__PURE__ */ new Date());
423
- endDate = k(/* @__PURE__ */ new Date());
424
- expandedSplits = [];
425
- isInitialized = !1;
426
- height = 550;
427
- width = 1e3;
428
- shouldDisableDrawerScroll = !1;
429
- searchValue = "";
430
- selectedAccountGuids = [];
431
- manualTransaction = at;
432
- isAmountValid = !1;
433
- showInsights = !1;
434
- constructor() {
435
- p(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 ft {
463
- globalStore;
464
- uiStore;
465
- api = new u("/", "");
466
- beatApi = new L("/", "");
467
- associatedBeats = [];
468
- associatedBeatsLoaded = !1;
469
- transactions = [];
470
- transactionsLoaded = !1;
471
- taggings = [];
472
- taggingsLoaded = !1;
473
- tags = [];
474
- tagsLoaded = !1;
475
- transactionRules = [];
476
- transactionRulesLoaded = !1;
477
- cachedStartDate = B(m(), 90);
478
- filter = {};
479
- isLoading = !0;
480
- sortColumn = D.DATE;
481
- sortDirection = G.DESC;
482
- onAnalyticEvent = j;
483
- constructor(t) {
484
- this.globalStore = t, this.uiStore = new et(), this.api = new u(
485
- t.endpoint,
486
- t.sessionToken,
487
- t.onError
488
- ), this.beatApi = new L(t.endpoint, t.sessionToken, t.onError), p(this);
489
- }
490
- loadTransactionData = async () => {
491
- await Promise.all([
492
- this.loadAssociatedBeats(h(/* @__PURE__ */ new Date())),
493
- this.loadTags(),
494
- this.loadTaggings(),
495
- this.loadTransactionRules(),
496
- // By default loads 90 days of transactions
497
- this.loadTransactions(this.cachedStartDate)
498
- ]), this.uiStore.setIsInitialized(!0);
499
- };
500
- get isTransactionDataLoaded() {
501
- return this.associatedBeatsLoaded && this.tagsLoaded && this.taggingsLoaded && this.transactionRulesLoaded && this.transactionsLoaded;
502
- }
503
- get sortedTransactions() {
504
- return J(
505
- this.filter,
506
- this.uiStore.expandedSplits,
507
- this.sortColumn,
508
- this.sortDirection,
509
- this.tags,
510
- this.detailedTransactions
511
- );
512
- }
513
- get sortedTransactionsWithSplits() {
514
- return F(this.sortedTransactions, this.transactions);
515
- }
516
- get detailedTransactions() {
517
- return Z(
518
- this.transactions,
519
- this.globalStore.accountStore.visibleAccounts,
520
- this.globalStore.categoryStore.categories,
521
- this.taggings
522
- );
523
- }
524
- setAssociatedBeats = (t) => {
525
- this.associatedBeats = t, this.associatedBeatsLoaded = !0;
526
- };
527
- setTaggings = (t) => {
528
- this.taggings = t, this.taggingsLoaded = !0;
529
- };
530
- setTags = (t) => {
531
- this.tags = t, this.tagsLoaded = !0;
532
- };
533
- setTransactionRules = (t) => {
534
- this.transactionRules = t, this.transactionRulesLoaded = !0;
535
- };
536
- setTransactions = (t) => {
537
- this.transactions = t, this.transactionsLoaded = !0;
538
- };
539
- addTag = async (t) => {
540
- await this.api.addTag({ name: t }), await this.loadTags();
541
- };
542
- addTagging = async (t, a) => {
543
- await this.api.addTagging({
544
- tag_guid: t,
545
- transaction_guid: a
546
- });
547
- };
548
- addOrUpdateTransactionRule = async (t, a) => {
549
- const e = this.transactionRules.find(
550
- (A) => A.guid === a.user_transaction_rule_guid
551
- );
552
- e ? await this.api.updateTransactionRule({
553
- ...e,
554
- category_guid: t,
555
- description: a.description
556
- }) : await this.api.addTransactionRule({
557
- category_guid: t,
558
- description: a.description,
559
- match_description: a.description
560
- }), await this.loadTransactionRules();
561
- };
562
- addTransaction = async (t) => {
563
- const a = await this.api.addTransaction(t);
564
- if (a) {
565
- this.setTransactions([a, ...this.transactions]);
566
- const e = a.transaction_type === b.CREDIT ? a.amount : -a.amount;
567
- this.globalStore.accountStore.updateAccountBalance(a.account_guid, e);
568
- }
569
- };
570
- loadAssociatedBeats = async (t) => {
571
- const a = t ? V(t, { representation: "date" }) : void 0;
572
- try {
573
- const e = await this.beatApi.getBeatsWithAssociatedTransaction(a);
574
- this.setAssociatedBeats(e);
575
- } catch (e) {
576
- console.error(`Error occurred while loading associated beats: ${e}`);
577
- }
578
- };
579
- loadTags = async () => {
580
- try {
581
- const t = await this.api.getTags();
582
- this.setTags(t);
583
- } catch (t) {
584
- console.error(`Error occurred while loading tags: ${t}`);
585
- }
586
- };
587
- loadTaggings = async () => {
588
- try {
589
- const t = await this.api.getTaggings();
590
- this.setTaggings(t);
591
- } catch (t) {
592
- console.error(`Error occurred while loading taggings: ${t}`);
593
- }
594
- };
595
- loadTransactionRules = async () => {
596
- const t = await this.api.getTransactionRules();
597
- this.setTransactionRules(t);
598
- };
599
- loadTransactions = async (t = this.cachedStartDate) => {
600
- this.setIsLoading(!0), this.transactions = [];
601
- try {
602
- const a = await this.api.getTransactionsByDateRange(
603
- O(t),
604
- O(f())
605
- );
606
- this.setTransactions(a);
607
- } catch (a) {
608
- console.error(`Error occurred while loading transactions: ${a}`);
609
- }
610
- this.setIsLoading(!1);
611
- };
612
- modifyTransactionByAccountGuid = (t, a) => {
613
- this.transactions = this.transactions.map(
614
- (e) => e.account_guid === t ? { ...e, ...a } : e
615
- );
616
- };
617
- removeTag = async (t) => {
618
- await this.api.removeTag(t), await this.loadTags();
619
- };
620
- removeTagging = async (t) => {
621
- await this.api.removeTagging(t);
622
- };
623
- removeTransaction = async (t) => {
624
- await this.api.removeTransaction(t);
625
- const a = this.transactions.findIndex((e) => e.guid === t);
626
- if (a >= 0) {
627
- const e = [...this.transactions];
628
- e.splice(a, 1), this.setTransactions(e);
629
- }
630
- };
631
- setFilter = (t) => {
632
- this.filter = t, t.dateRange && v(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start).then(() => {
633
- t.dateRange && (this.cachedStartDate = t.dateRange.start);
634
- });
635
- };
636
- setIsLoading = (t) => this.isLoading = t;
637
- splitTransaction = async (t, a) => {
638
- const e = await this.api.updateTransaction(t), A = [];
639
- for (let s = 0; s < a.length; s++) {
640
- const c = await this.api.addTransaction(a[s]);
641
- A.push(c);
642
- }
643
- const d = this.transactions.findIndex((s) => s.guid === t.guid);
644
- d >= 0 && this.setTransactions([
645
- ...this.transactions.slice(0, d),
646
- e,
647
- ...this.transactions.slice(d + 1),
648
- ...A
649
- ]);
650
- };
651
- unSplitTransaction = async (t) => {
652
- const a = this.transactions.filter((s) => s.parent_guid === t);
653
- await this.api.removeTransactionSplit(t);
654
- const e = [...this.transactions];
655
- a.forEach((s) => {
656
- const c = e.findIndex((i) => i.guid === s.guid);
657
- c >= 0 && e.splice(c, 1);
658
- });
659
- const A = e.findIndex((s) => s.guid === t), d = e[A];
660
- d.has_been_split = !1, A >= 0 && this.setTransactions([
661
- ...e.slice(0, A),
662
- d,
663
- ...e.slice(A + 1)
664
- ]);
665
- };
666
- updateTaggings = async (t, a) => {
667
- const e = this.taggings.filter((s) => s.transaction_guid === a), A = new Set(e.map((s) => s.tag_guid)), d = new Set(t);
668
- for (const s of t)
669
- A.has(s) || await this.addTagging(s, a);
670
- for (const s of e)
671
- d.has(s.tag_guid) || await this.removeTagging(s.guid);
672
- await this.loadTaggings();
673
- };
674
- updateTag = async (t) => {
675
- await this.api.updateTag(t), await this.loadTags();
676
- };
677
- updateTransaction = async (t) => {
678
- const a = await this.api.updateTransaction(t), e = this.transactions.findIndex((A) => A.guid === t.guid);
679
- e >= 0 && this.setTransactions([
680
- ...this.transactions.slice(0, e),
681
- a,
682
- ...this.transactions.slice(e + 1)
683
- ]);
684
- };
685
- }
686
- export {
687
- at as D,
688
- pt as S,
689
- ft as T
690
- };