@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
@@ -0,0 +1,677 @@
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import P from "@mui/material/Box";
3
+ import U from "@mui/material/FormControlLabel";
4
+ import K from "@mui/material/Radio";
5
+ import V 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 B } from "date-fns/formatISO";
10
+ import { fromUnixTime as h } from "date-fns/fromUnixTime";
11
+ import { getUnixTime as u } from "date-fns/getUnixTime";
12
+ import { isBefore as Y } from "date-fns/isBefore";
13
+ import { startOfMonth as R } from "date-fns/startOfMonth";
14
+ import { startOfToday as b } from "date-fns/startOfToday";
15
+ import { subDays as F } from "date-fns/subDays";
16
+ import { O as n, a as G, T as w } from "./User-Bj34_i8g.mjs";
17
+ import { T as p } from "./TransactionApi-CjBoLleL.mjs";
18
+ import { b as W } from "./Category-CevNQ03n.mjs";
19
+ import { f as z } from "./exportTransactionsToCSV-B8qpk5MU.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-De2IaqH2.mjs";
24
+ const j = ({
25
+ checked: S = !1,
26
+ label: t,
27
+ sx: a = {},
28
+ tooltip: e = "",
29
+ value: c
30
+ }) => {
31
+ const _ = V(), i = _.palette.mode === "light" ? _.palette.grey[400] : _.palette.grey[700], A = S ? _.palette.action.active : i;
32
+ return /* @__PURE__ */ C(
33
+ P,
34
+ {
35
+ bgcolor: "background.paper",
36
+ border: `${S ? 3 : 1}px solid`,
37
+ borderColor: A,
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
+ U,
46
+ {
47
+ control: /* @__PURE__ */ C(
48
+ K,
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: c
58
+ }
59
+ ) })
60
+ }
61
+ );
62
+ }, ft = j, x = {
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 c = t.reduce((A, s) => ({ ...A, [s.guid]: s }), {}), _ = a.reduce((A, s) => ({ ...A, [s.guid]: s }), {}), i = e.reduce((A, s) => {
334
+ const { transaction_guid: l, tag_guid: I } = s;
335
+ if (!A[l])
336
+ return {
337
+ ...A,
338
+ [l]: [I]
339
+ };
340
+ const E = [...A[l], I];
341
+ return {
342
+ ...A,
343
+ [l]: E
344
+ };
345
+ }, {});
346
+ return S.map((A) => {
347
+ const s = c[A.account_guid], l = A.category_guid ? _[A.category_guid] : null, I = i[A.guid] ?? [];
348
+ return {
349
+ ...A,
350
+ account: s?.user_name || "Unknown",
351
+ accountIsClosed: s?.is_closed,
352
+ accountIsHidden: s?.is_hidden,
353
+ category: l?.name || "Uncategorized",
354
+ isIncome: A.top_level_category_guid === W.INCOME,
355
+ isPending: A.feed_status === G.PENDING,
356
+ number: s?.account_number || "",
357
+ payee: A.description,
358
+ tags: I
359
+ };
360
+ });
361
+ }, J = "uncategorized", Q = (S, t, a, e, c, _) => {
362
+ const i = tt(S, c, _), A = at(i, a, e);
363
+ return t.forEach((s) => {
364
+ const l = A.findIndex((E) => E.guid === s), I = _.filter((E) => E.parent_guid === s);
365
+ A.splice(l + 1, 0, ...I);
366
+ }), A;
367
+ }, tt = (S, t, a) => {
368
+ const {
369
+ accounts: e = [],
370
+ dateRange: c = { start: R(b()), end: D() },
371
+ custom: _ = () => !0,
372
+ searchTerm: i = "",
373
+ showSplits: A = !1
374
+ } = S;
375
+ return a.filter((s) => A ? !s.has_been_split : !s.parent_guid).filter((s) => !!e.find((l) => l === s.account_guid)).filter((s) => s.date >= u(c.start) && s.date <= u(c.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
+ (M) => N(i, t.find((H) => H.guid === M)?.name)
382
+ ), E = h(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, c) => {
386
+ const _ = t, i = (e[_] || "") > (c[_] || "");
387
+ let A = i ? -1 : 1, s = i ? 1 : -1;
388
+ return (t === L.DATE || t === L.AMOUNT) && (A = i ? 1 : -1, s = i ? -1 : 1), a === x.ASC ? A : s;
389
+ }), N = (S, t) => {
390
+ const a = S.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
391
+ return a.every((c) => e.indexOf(c) > -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: G.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: w.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((c) => c === 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 = F(b(), 90);
469
+ filter = {};
470
+ isLoading = !0;
471
+ rawTransactions = [];
472
+ sortColumn = L.DATE;
473
+ sortDirection = x.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(
480
+ t.endpoint,
481
+ t.sessionToken,
482
+ t.onError
483
+ ), this.beatApi = new f(t.endpoint, t.sessionToken, t.onError), y(this);
484
+ }
485
+ loadTransactionData = async ({
486
+ associatedBeats: t,
487
+ transactionRules: a,
488
+ transactions: e
489
+ } = {}) => {
490
+ await Promise.all([
491
+ this.loadAssociatedBeats(R(/* @__PURE__ */ new Date()), t),
492
+ this.loadTags(),
493
+ this.loadTaggings(),
494
+ this.loadTransactionRules(a),
495
+ // By default loads 90 days of transactions
496
+ this.loadTransactions(this.cachedStartDate, D(), e)
497
+ ]), d(() => {
498
+ this.uiStore.setIsInitialized(!0);
499
+ });
500
+ };
501
+ get sortedTransactions() {
502
+ return Q(
503
+ this.filter,
504
+ this.uiStore.expandedSplits,
505
+ this.sortColumn,
506
+ this.sortDirection,
507
+ this.tags,
508
+ this.transactions
509
+ );
510
+ }
511
+ get sortedTransactionsWithSplits() {
512
+ return z(this.sortedTransactions, this.transactions);
513
+ }
514
+ get transactions() {
515
+ return this.augmentTransactions(this.rawTransactions);
516
+ }
517
+ addTag = async (t) => {
518
+ await this.api.addTag({ name: t }), await this.loadTags();
519
+ };
520
+ addTagging = async (t, a) => {
521
+ await this.api.addTagging({
522
+ tag_guid: t,
523
+ transaction_guid: a
524
+ });
525
+ };
526
+ addOrUpdateTransactionRule = async (t, a) => {
527
+ const e = this.transactionRules.find(
528
+ (c) => c.guid === a.user_transaction_rule_guid
529
+ );
530
+ e ? await this.api.updateTransactionRule({
531
+ ...e,
532
+ category_guid: t,
533
+ description: a.description
534
+ }) : await this.api.addTransactionRule({
535
+ category_guid: t,
536
+ description: a.description,
537
+ match_description: a.description
538
+ }), await this.loadTransactionRules();
539
+ };
540
+ addTransaction = async (t) => {
541
+ const a = await this.api.addTransaction(t);
542
+ if (a) {
543
+ d(() => this.rawTransactions = [a, ...this.transactions]);
544
+ const e = a.transaction_type === w.CREDIT ? a.amount : -a.amount;
545
+ this.globalStore.accountStore.updateAccountBalance(a.account_guid, e);
546
+ }
547
+ };
548
+ augmentTransactions = (t) => q(
549
+ t,
550
+ this.globalStore.accountStore.visibleAccounts,
551
+ this.globalStore.categoryStore.categories,
552
+ this.taggings
553
+ );
554
+ getTransactionData = () => ({});
555
+ loadAssociatedBeats = async (t, a) => {
556
+ const e = t ? B(t, { representation: "date" }) : void 0, c = a ?? await this.beatApi.getBeatsWithAssociatedTransaction(e);
557
+ d(() => this.associatedBeats = c);
558
+ };
559
+ loadTags = async () => {
560
+ const t = await this.api.getTags();
561
+ d(() => this.tags = t);
562
+ };
563
+ loadTaggings = async () => {
564
+ const t = await this.api.getTaggings();
565
+ d(() => this.taggings = t);
566
+ };
567
+ loadTransactionRules = async (t) => {
568
+ const a = t ?? await this.api.getTransactionRules();
569
+ d(() => this.transactionRules = a);
570
+ };
571
+ loadTransactions = async (t = this.cachedStartDate, a = D(), e) => {
572
+ this.setIsLoading(!0), this.rawTransactions = [];
573
+ try {
574
+ const c = e ?? await this.api.getTransactionsByDateRange(u(t), u(a));
575
+ d(() => {
576
+ this.rawTransactions = c;
577
+ });
578
+ } catch (c) {
579
+ console.error(`Error occurred while loading transactions: ${c}`);
580
+ }
581
+ this.setIsLoading(!1);
582
+ };
583
+ // DEPRECATED
584
+ loadTransactionsByDateRange = async (t, a) => {
585
+ console.warn("DEPRECATED: loadTransactionsByDateRange will be removed"), this.setFilter({
586
+ ...this.filter,
587
+ dateRange: { start: h(a), end: h(t) }
588
+ });
589
+ };
590
+ modifyTransactionByAccountGuid = (t, a) => {
591
+ this.rawTransactions = this.transactions.map(
592
+ (e) => e.account_guid === t ? { ...e, ...a } : e
593
+ );
594
+ };
595
+ removeTag = async (t) => {
596
+ await this.api.removeTag(t), await this.loadTags();
597
+ };
598
+ removeTagging = async (t) => {
599
+ await this.api.removeTagging(t);
600
+ };
601
+ removeTransaction = async (t) => {
602
+ await this.api.removeTransaction(t);
603
+ const a = this.transactions.findIndex((e) => e.guid === t);
604
+ if (a >= 0) {
605
+ const e = [...this.transactions];
606
+ e.splice(a, 1), d(() => this.rawTransactions = e);
607
+ }
608
+ };
609
+ setFilter = (t) => {
610
+ this.filter = t, t.dateRange && Y(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start, D()).then(() => {
611
+ t.dateRange && (this.cachedStartDate = t.dateRange.start);
612
+ });
613
+ };
614
+ setIsLoading = (t) => this.isLoading = t;
615
+ setSortData = (t, a) => {
616
+ this.sortColumn = t, this.sortDirection = a;
617
+ };
618
+ splitTransaction = async (t, a) => {
619
+ const e = await this.api.updateTransaction(t), c = [];
620
+ for (let i = 0; i < a.length; i++) {
621
+ const A = await this.api.addTransaction(a[i]);
622
+ c.push(A);
623
+ }
624
+ const _ = this.transactions.findIndex((i) => i.guid === t.guid);
625
+ _ >= 0 && d(
626
+ () => this.rawTransactions = [
627
+ ...this.transactions.slice(0, _),
628
+ e,
629
+ ...this.transactions.slice(_ + 1),
630
+ ...c
631
+ ]
632
+ );
633
+ };
634
+ unSplitTransaction = async (t) => {
635
+ const a = this.transactions.filter((i) => i.parent_guid === t);
636
+ await this.api.removeTransactionSplit(t);
637
+ const e = [...this.transactions];
638
+ a.forEach((i) => {
639
+ const A = e.findIndex((s) => s.guid === i.guid);
640
+ A >= 0 && e.splice(A, 1);
641
+ });
642
+ const c = e.findIndex((i) => i.guid === t), _ = e[c];
643
+ _.has_been_split = !1, c >= 0 && d(
644
+ () => this.rawTransactions = [
645
+ ...e.slice(0, c),
646
+ _,
647
+ ...e.slice(c + 1)
648
+ ]
649
+ );
650
+ };
651
+ updateTaggings = async (t, a) => {
652
+ const e = this.taggings.filter((i) => i.transaction_guid === a), c = new Set(e.map((i) => i.tag_guid)), _ = new Set(t);
653
+ for (const i of t)
654
+ c.has(i) || await this.addTagging(i, a);
655
+ for (const i of e)
656
+ _.has(i.tag_guid) || await this.removeTagging(i.guid);
657
+ await this.loadTaggings();
658
+ };
659
+ updateTag = async (t) => {
660
+ await this.api.updateTag(t), await this.loadTags();
661
+ };
662
+ updateTransaction = async (t) => {
663
+ const a = await this.api.updateTransaction(t), e = this.transactions.findIndex((c) => c.guid === t.guid);
664
+ e >= 0 && d(
665
+ () => this.rawTransactions = [
666
+ ...this.transactions.slice(0, e),
667
+ a,
668
+ ...this.transactions.slice(e + 1)
669
+ ]
670
+ );
671
+ };
672
+ }
673
+ export {
674
+ et as D,
675
+ ft as S,
676
+ mt as T
677
+ };