@mx-cartographer/experiences 7.2.15-alpha.sms7 → 7.2.15-alpha.sms9
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.
- package/dist/{TransactionStore-bphuV3xu.mjs → TransactionStore-iyLMPILT.mjs} +131 -124
- package/dist/common/index.es.js +443 -418
- package/dist/common/stores/GlobalStore.d.ts +4 -0
- package/dist/transactions/index.es.js +2 -2
- package/dist/transactions/stores/TransactionStore.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4,11 +4,11 @@ import U from "@mui/material/FormControlLabel";
|
|
|
4
4
|
import K from "@mui/material/Radio";
|
|
5
5
|
import V from "@mui/material/styles/useTheme";
|
|
6
6
|
import v from "@mui/material/Tooltip";
|
|
7
|
-
import { makeAutoObservable as y,
|
|
7
|
+
import { makeAutoObservable as y, autorun as B, runInAction as d } from "mobx";
|
|
8
8
|
import { endOfToday as D } from "date-fns/endOfToday";
|
|
9
9
|
import { formatISO as Y } from "date-fns/formatISO";
|
|
10
|
-
import { fromUnixTime as
|
|
11
|
-
import { getUnixTime as
|
|
10
|
+
import { fromUnixTime as u } from "date-fns/fromUnixTime";
|
|
11
|
+
import { getUnixTime as h } from "date-fns/getUnixTime";
|
|
12
12
|
import { isBefore as F } from "date-fns/isBefore";
|
|
13
13
|
import { startOfMonth as R } from "date-fns/startOfMonth";
|
|
14
14
|
import { startOfToday as b } from "date-fns/startOfToday";
|
|
@@ -22,25 +22,25 @@ import { f as g, D as O, O as X } from "./Dialog-CWW597AF.mjs";
|
|
|
22
22
|
import { endOfMonth as j } from "date-fns/endOfMonth";
|
|
23
23
|
import { B as f } from "./BeatApi-DhJpgCLz.mjs";
|
|
24
24
|
const Z = ({
|
|
25
|
-
checked:
|
|
25
|
+
checked: _ = !1,
|
|
26
26
|
label: t,
|
|
27
27
|
sx: a = {},
|
|
28
28
|
tooltip: e = "",
|
|
29
29
|
value: c
|
|
30
30
|
}) => {
|
|
31
|
-
const
|
|
31
|
+
const l = V(), s = l.palette.mode === "light" ? l.palette.grey[400] : l.palette.grey[700], A = _ ? l.palette.action.active : s;
|
|
32
32
|
return /* @__PURE__ */ C(
|
|
33
33
|
P,
|
|
34
34
|
{
|
|
35
35
|
bgcolor: "background.paper",
|
|
36
|
-
border: `${
|
|
36
|
+
border: `${_ ? 3 : 1}px solid`,
|
|
37
37
|
borderColor: A,
|
|
38
38
|
borderRadius: 2,
|
|
39
39
|
mt: -2,
|
|
40
40
|
mx: 8,
|
|
41
41
|
pr: 8,
|
|
42
42
|
py: 4,
|
|
43
|
-
sx: { "&:hover": { borderColor:
|
|
43
|
+
sx: { "&:hover": { borderColor: l.palette.action.active }, ...a },
|
|
44
44
|
children: /* @__PURE__ */ C(v, { title: e, children: /* @__PURE__ */ C(
|
|
45
45
|
U,
|
|
46
46
|
{
|
|
@@ -48,7 +48,7 @@ const Z = ({
|
|
|
48
48
|
K,
|
|
49
49
|
{
|
|
50
50
|
disableRipple: !0,
|
|
51
|
-
sx: { "&.Mui-checked": { color:
|
|
51
|
+
sx: { "&.Mui-checked": { color: l.palette.action.active } }
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
54
|
label: t,
|
|
@@ -71,7 +71,7 @@ const Z = ({
|
|
|
71
71
|
left: "flex-start",
|
|
72
72
|
right: "flex-end"
|
|
73
73
|
}
|
|
74
|
-
},
|
|
74
|
+
}, o = {
|
|
75
75
|
ADD: "Add",
|
|
76
76
|
ADD_CATEGORY: "Add Category",
|
|
77
77
|
CHANGE_CATEGORY: "Change Category",
|
|
@@ -85,7 +85,7 @@ const Z = ({
|
|
|
85
85
|
SELECT: "Select",
|
|
86
86
|
UNHIDE: "Unhide",
|
|
87
87
|
UNSPLIT: "Unsplit"
|
|
88
|
-
},
|
|
88
|
+
}, T = {
|
|
89
89
|
TRANSACTION_DETAILS: "Transaction Details",
|
|
90
90
|
TRANSACTIONS_LIST: "Transactions List",
|
|
91
91
|
TRANSACTIONS_WIDGET: "Transactions Widget"
|
|
@@ -111,226 +111,226 @@ const Z = ({
|
|
|
111
111
|
}, m = {
|
|
112
112
|
// splits
|
|
113
113
|
[n.ON_TRANSACTION_SPLIT_CLICK]: {
|
|
114
|
-
action:
|
|
115
|
-
category:
|
|
114
|
+
action: o.SELECT,
|
|
115
|
+
category: T.TRANSACTION_DETAILS,
|
|
116
116
|
label: r.SPLITS
|
|
117
117
|
},
|
|
118
118
|
[n.ON_TRANSACTION_SPLIT_CATEGORY_CLICK]: {
|
|
119
|
-
action:
|
|
120
|
-
category:
|
|
119
|
+
action: o.ADD_CATEGORY,
|
|
120
|
+
category: T.TRANSACTION_DETAILS,
|
|
121
121
|
label: r.SPLITS
|
|
122
122
|
},
|
|
123
123
|
[n.ON_TRANSACTION_SPLIT_DELETE_CLICK]: {
|
|
124
|
-
action:
|
|
125
|
-
category:
|
|
124
|
+
action: o.DELETE,
|
|
125
|
+
category: T.TRANSACTION_DETAILS,
|
|
126
126
|
label: r.SPLITS
|
|
127
127
|
},
|
|
128
128
|
[n.ON_TRANSACTION_SPLIT_SAVE_CLICK]: {
|
|
129
|
-
action:
|
|
130
|
-
category:
|
|
129
|
+
action: o.SPLIT,
|
|
130
|
+
category: T.TRANSACTION_DETAILS,
|
|
131
131
|
label: r.SPLITS
|
|
132
132
|
},
|
|
133
133
|
[n.ON_TRANSACTION_UNSPLIT]: {
|
|
134
|
-
action:
|
|
135
|
-
category:
|
|
134
|
+
action: o.UNSPLIT,
|
|
135
|
+
category: T.TRANSACTION_DETAILS,
|
|
136
136
|
label: r.SPLITS
|
|
137
137
|
},
|
|
138
138
|
// category
|
|
139
139
|
[n.ON_TRANSACTION_CATEGORY_CLICK]: {
|
|
140
|
-
action:
|
|
141
|
-
category:
|
|
140
|
+
action: o.SELECT,
|
|
141
|
+
category: T.TRANSACTIONS_LIST,
|
|
142
142
|
label: r.CATEGORY
|
|
143
143
|
},
|
|
144
144
|
[n.ON_TRANSACTION_CATEGORY_CHANGED]: {
|
|
145
|
-
action:
|
|
146
|
-
category:
|
|
145
|
+
action: o.CHANGE_CATEGORY,
|
|
146
|
+
category: T.TRANSACTION_DETAILS,
|
|
147
147
|
label: r.CATEGORY
|
|
148
148
|
},
|
|
149
149
|
// date
|
|
150
150
|
[n.ON_TRANSACTION_DATE_CHANGED]: {
|
|
151
|
-
action:
|
|
152
|
-
category:
|
|
151
|
+
action: o.SAVE,
|
|
152
|
+
category: T.TRANSACTION_DETAILS,
|
|
153
153
|
label: r.DATE
|
|
154
154
|
},
|
|
155
155
|
[n.ON_TRANSACTION_DATE_CLICK]: {
|
|
156
|
-
action:
|
|
157
|
-
category:
|
|
156
|
+
action: o.SELECT,
|
|
157
|
+
category: T.TRANSACTION_DETAILS,
|
|
158
158
|
label: r.DATE
|
|
159
159
|
},
|
|
160
160
|
// merchant logo
|
|
161
161
|
[n.ON_TRANSACTION_DELETE_LOGO_CANCEL]: {
|
|
162
|
-
action:
|
|
163
|
-
category:
|
|
162
|
+
action: o.CLOSE,
|
|
163
|
+
category: T.TRANSACTION_DETAILS,
|
|
164
164
|
label: r.DELETE_MERCHANT_LOGO
|
|
165
165
|
},
|
|
166
166
|
[n.ON_TRANSACTION_DELETE_LOGO_CLICK]: {
|
|
167
|
-
action:
|
|
168
|
-
category:
|
|
167
|
+
action: o.SELECT,
|
|
168
|
+
category: T.TRANSACTION_DETAILS,
|
|
169
169
|
label: r.DELETE_MERCHANT_LOGO
|
|
170
170
|
},
|
|
171
171
|
[n.ON_TRANSACTION_DELETE_LOGO_DELETED]: {
|
|
172
|
-
action:
|
|
173
|
-
category:
|
|
172
|
+
action: o.DELETE,
|
|
173
|
+
category: T.TRANSACTION_DETAILS,
|
|
174
174
|
label: r.DELETE_MERCHANT_LOGO
|
|
175
175
|
},
|
|
176
176
|
// description
|
|
177
177
|
[n.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK]: {
|
|
178
|
-
action:
|
|
179
|
-
category:
|
|
178
|
+
action: o.EDIT,
|
|
179
|
+
category: T.TRANSACTION_DETAILS,
|
|
180
180
|
label: r.DESCRIPTION
|
|
181
181
|
},
|
|
182
182
|
[n.ON_TRANSACTION_DESCRIPTION_SAVE_CLICK]: {
|
|
183
|
-
action:
|
|
184
|
-
category:
|
|
183
|
+
action: o.SAVE,
|
|
184
|
+
category: T.TRANSACTION_DETAILS,
|
|
185
185
|
label: r.DESCRIPTION
|
|
186
186
|
},
|
|
187
187
|
// hide transactions
|
|
188
188
|
[n.ON_TRANSACTION_HIDDEN]: {
|
|
189
|
-
action:
|
|
190
|
-
category:
|
|
189
|
+
action: o.SAVE,
|
|
190
|
+
category: T.TRANSACTION_DETAILS,
|
|
191
191
|
label: r.HIDE_TRANSACTION
|
|
192
192
|
},
|
|
193
193
|
[n.ON_TRANSACTION_HIDE_CLICK]: {
|
|
194
|
-
action:
|
|
195
|
-
category:
|
|
194
|
+
action: o.SELECT,
|
|
195
|
+
category: T.TRANSACTION_DETAILS,
|
|
196
196
|
label: r.HIDE_TRANSACTION
|
|
197
197
|
},
|
|
198
198
|
[n.ON_TRANSACTION_HIDE_CANCEL_CLICK]: {
|
|
199
|
-
action:
|
|
200
|
-
category:
|
|
199
|
+
action: o.CLOSE,
|
|
200
|
+
category: T.TRANSACTION_DETAILS,
|
|
201
201
|
label: r.HIDE_TRANSACTION
|
|
202
202
|
},
|
|
203
203
|
// transaction list
|
|
204
204
|
[n.ON_TRANSACTION_LIST_ITEM_CLICK]: {
|
|
205
|
-
action:
|
|
206
|
-
category:
|
|
205
|
+
action: o.SELECT,
|
|
206
|
+
category: T.TRANSACTIONS_LIST,
|
|
207
207
|
label: r.TRANSACTION
|
|
208
208
|
},
|
|
209
209
|
// memo
|
|
210
210
|
[n.ON_TRANSACTION_MEMO_CHANGED]: {
|
|
211
|
-
action:
|
|
212
|
-
category:
|
|
211
|
+
action: o.SAVE,
|
|
212
|
+
category: T.TRANSACTION_DETAILS,
|
|
213
213
|
label: r.MEMO
|
|
214
214
|
},
|
|
215
215
|
[n.ON_TRANSACTION_MEMO_CLICK]: {
|
|
216
|
-
action:
|
|
217
|
-
category:
|
|
216
|
+
action: o.SELECT,
|
|
217
|
+
category: T.TRANSACTION_DETAILS,
|
|
218
218
|
label: r.MEMO
|
|
219
219
|
},
|
|
220
220
|
// tags
|
|
221
221
|
[n.ON_TRANSACTION_TAGS_CHANGED]: {
|
|
222
|
-
action:
|
|
223
|
-
category:
|
|
222
|
+
action: o.SAVE,
|
|
223
|
+
category: T.TRANSACTION_DETAILS,
|
|
224
224
|
label: r.TAGS
|
|
225
225
|
},
|
|
226
226
|
[n.ON_TRANSACTION_TAGS_CLICK]: {
|
|
227
|
-
action:
|
|
228
|
-
category:
|
|
227
|
+
action: o.SELECT,
|
|
228
|
+
category: T.TRANSACTION_DETAILS,
|
|
229
229
|
label: r.TAGS
|
|
230
230
|
},
|
|
231
231
|
[n.ON_TRANSACTION_TAGS_TAG_ADD_CANCEL_CLICK]: {
|
|
232
|
-
action:
|
|
233
|
-
category:
|
|
232
|
+
action: o.CLOSE,
|
|
233
|
+
category: T.TRANSACTION_DETAILS,
|
|
234
234
|
label: r.TAGS
|
|
235
235
|
},
|
|
236
236
|
[n.ON_TRANSACTION_TAGS_TAG_ADD_CLICK]: {
|
|
237
|
-
action:
|
|
238
|
-
category:
|
|
237
|
+
action: o.ADD,
|
|
238
|
+
category: T.TRANSACTION_DETAILS,
|
|
239
239
|
label: r.TAG_ADD
|
|
240
240
|
},
|
|
241
241
|
[n.ON_TRANSACTION_TAGS_TAG_ADDED]: {
|
|
242
|
-
action:
|
|
243
|
-
category:
|
|
242
|
+
action: o.SAVE,
|
|
243
|
+
category: T.TRANSACTION_DETAILS,
|
|
244
244
|
label: r.TAG_ADD
|
|
245
245
|
},
|
|
246
246
|
[n.ON_TRANSACTION_TAGS_TAG_DELETE_CLICK]: {
|
|
247
|
-
action:
|
|
248
|
-
category:
|
|
247
|
+
action: o.SELECT,
|
|
248
|
+
category: T.TRANSACTION_DETAILS,
|
|
249
249
|
label: r.TAG_DELETE
|
|
250
250
|
},
|
|
251
251
|
[n.ON_TRANSACTION_TAGS_TAG_DELETE_CANCEL_CLICK]: {
|
|
252
|
-
action:
|
|
253
|
-
category:
|
|
252
|
+
action: o.CLOSE,
|
|
253
|
+
category: T.TRANSACTION_DETAILS,
|
|
254
254
|
label: r.TAG_DELETE
|
|
255
255
|
},
|
|
256
256
|
[n.ON_TRANSACTION_TAGS_TAG_DELETED]: {
|
|
257
|
-
action:
|
|
258
|
-
category:
|
|
257
|
+
action: o.SAVE,
|
|
258
|
+
category: T.TRANSACTION_DETAILS,
|
|
259
259
|
label: r.TAG_DELETE
|
|
260
260
|
},
|
|
261
261
|
[n.ON_TRANSACTION_TAGS_TAG_EDIT_CLICK]: {
|
|
262
|
-
action:
|
|
263
|
-
category:
|
|
262
|
+
action: o.EDIT,
|
|
263
|
+
category: T.TRANSACTION_DETAILS,
|
|
264
264
|
label: r.TAG_EDIT
|
|
265
265
|
},
|
|
266
266
|
[n.ON_TRANSACTION_TAGS_TAG_EDIT_SAVED]: {
|
|
267
|
-
action:
|
|
268
|
-
category:
|
|
267
|
+
action: o.SAVE,
|
|
268
|
+
category: T.TRANSACTION_DETAILS,
|
|
269
269
|
label: r.TAG_EDIT
|
|
270
270
|
},
|
|
271
271
|
// flag
|
|
272
272
|
[n.ON_TRANSACTION_TOGGLE_FLAG_CLICK]: {
|
|
273
|
-
action:
|
|
274
|
-
category:
|
|
273
|
+
action: o.SELECT,
|
|
274
|
+
category: T.TRANSACTION_DETAILS,
|
|
275
275
|
label: r.FLAG
|
|
276
276
|
},
|
|
277
277
|
// hide
|
|
278
278
|
[n.ON_TRANSACTION_UNHIDDEN]: {
|
|
279
|
-
action:
|
|
280
|
-
category:
|
|
279
|
+
action: o.SAVE,
|
|
280
|
+
category: T.TRANSACTION_DETAILS,
|
|
281
281
|
label: r.UNHIDE_TRANSACTION
|
|
282
282
|
},
|
|
283
283
|
[n.ON_TRANSACTION_UNHIDE_CLICK]: {
|
|
284
|
-
action:
|
|
285
|
-
category:
|
|
284
|
+
action: o.SELECT,
|
|
285
|
+
category: T.TRANSACTION_DETAILS,
|
|
286
286
|
label: r.UNHIDE_TRANSACTION
|
|
287
287
|
},
|
|
288
288
|
[n.ON_TRANSACTION_UNHIDE_CANCEL_CLICK]: {
|
|
289
|
-
action:
|
|
290
|
-
category:
|
|
289
|
+
action: o.CLOSE,
|
|
290
|
+
category: T.TRANSACTION_DETAILS,
|
|
291
291
|
label: r.UNHIDE_TRANSACTION
|
|
292
292
|
},
|
|
293
293
|
// export CSV
|
|
294
294
|
[n.ON_TRANSACTION_EXPORT_CSV_CLICK]: {
|
|
295
|
-
action:
|
|
296
|
-
category:
|
|
295
|
+
action: o.SELECT,
|
|
296
|
+
category: T.TRANSACTIONS_WIDGET,
|
|
297
297
|
label: r.EXPORT_CSV
|
|
298
298
|
},
|
|
299
299
|
// add transaction
|
|
300
300
|
[n.ON_TRANSACTION_MANUAL_ADD_CLICK]: {
|
|
301
|
-
action:
|
|
302
|
-
category:
|
|
301
|
+
action: o.SELECT,
|
|
302
|
+
category: T.TRANSACTIONS_WIDGET,
|
|
303
303
|
label: r.ADD_TRANSACTION
|
|
304
304
|
},
|
|
305
305
|
[n.ON_TRANSACTION_MANUAL_ADD_ADDED]: {
|
|
306
|
-
action:
|
|
307
|
-
category:
|
|
306
|
+
action: o.ADD,
|
|
307
|
+
category: T.TRANSACTIONS_WIDGET,
|
|
308
308
|
label: r.ADD_TRANSACTION
|
|
309
309
|
},
|
|
310
310
|
[n.ON_TRANSACTION_DELETE_CLICK]: {
|
|
311
|
-
action:
|
|
312
|
-
category:
|
|
311
|
+
action: o.SELECT,
|
|
312
|
+
category: T.TRANSACTIONS_WIDGET,
|
|
313
313
|
label: r.DELETE_TRANSACTION
|
|
314
314
|
},
|
|
315
315
|
[n.ON_TRANSACTION_DELETE_CANCEL]: {
|
|
316
|
-
action:
|
|
317
|
-
category:
|
|
316
|
+
action: o.CLOSE,
|
|
317
|
+
category: T.TRANSACTIONS_WIDGET,
|
|
318
318
|
label: r.DELETE_TRANSACTION
|
|
319
319
|
},
|
|
320
320
|
[n.ON_TRANSACTION_DELETE_DELETED]: {
|
|
321
|
-
action:
|
|
322
|
-
category:
|
|
321
|
+
action: o.DELETE,
|
|
322
|
+
category: T.TRANSACTIONS_WIDGET,
|
|
323
323
|
label: r.DELETE_TRANSACTION
|
|
324
324
|
}
|
|
325
|
-
}, q = async (
|
|
325
|
+
}, q = async (_, t) => !t || !m[_] ? null : t.sendAnalyticEvent(m[_]), L = {
|
|
326
326
|
FLAG: "flag",
|
|
327
327
|
DATE: "date",
|
|
328
328
|
PAYEE: "payee",
|
|
329
329
|
CATEGORY: "category",
|
|
330
330
|
ACCOUNT: "account",
|
|
331
331
|
AMOUNT: "amount"
|
|
332
|
-
}, J = (
|
|
333
|
-
const c = t.reduce((A, i) => ({ ...A, [i.guid]: i }), {}),
|
|
332
|
+
}, J = (_, t, a, e = []) => {
|
|
333
|
+
const c = t.reduce((A, i) => ({ ...A, [i.guid]: i }), {}), l = a.reduce((A, i) => ({ ...A, [i.guid]: i }), {}), s = e.reduce((A, i) => {
|
|
334
334
|
const { transaction_guid: N, tag_guid: I } = i;
|
|
335
335
|
if (!A[N])
|
|
336
336
|
return {
|
|
@@ -343,8 +343,8 @@ const Z = ({
|
|
|
343
343
|
[N]: E
|
|
344
344
|
};
|
|
345
345
|
}, {});
|
|
346
|
-
return
|
|
347
|
-
const i = c[A.account_guid], N = A.category_guid ?
|
|
346
|
+
return _.map((A) => {
|
|
347
|
+
const i = c[A.account_guid], N = A.category_guid ? l[A.category_guid] : null, I = s[A.guid] ?? [];
|
|
348
348
|
return {
|
|
349
349
|
...A,
|
|
350
350
|
account: i?.user_name || "Unknown",
|
|
@@ -358,36 +358,36 @@ const Z = ({
|
|
|
358
358
|
tags: I
|
|
359
359
|
};
|
|
360
360
|
});
|
|
361
|
-
}, Q = "uncategorized", tt = (
|
|
362
|
-
const s = at(
|
|
361
|
+
}, Q = "uncategorized", tt = (_, t, a, e, c, l) => {
|
|
362
|
+
const s = at(_, c, l), A = et(s, a, e);
|
|
363
363
|
return t.forEach((i) => {
|
|
364
|
-
const N = A.findIndex((E) => E.guid === i), I =
|
|
364
|
+
const N = A.findIndex((E) => E.guid === i), I = l.filter((E) => E.parent_guid === i);
|
|
365
365
|
A.splice(N + 1, 0, ...I);
|
|
366
366
|
}), A;
|
|
367
|
-
}, at = (
|
|
367
|
+
}, at = (_, t, a) => {
|
|
368
368
|
const {
|
|
369
369
|
accounts: e = [],
|
|
370
370
|
dateRange: c = { start: R(b()), end: D() },
|
|
371
|
-
custom:
|
|
371
|
+
custom: l = () => !0,
|
|
372
372
|
searchTerm: s = "",
|
|
373
373
|
showSplits: A = !1
|
|
374
|
-
} =
|
|
375
|
-
return a.filter((i) => A ? !i.has_been_split : !i.parent_guid).filter((i) => !!e.find((N) => N === i.account_guid)).filter((i) => i.date >=
|
|
374
|
+
} = _;
|
|
375
|
+
return a.filter((i) => A ? !i.has_been_split : !i.parent_guid).filter((i) => !!e.find((N) => N === i.account_guid)).filter((i) => i.date >= h(c.start) && i.date <= h(c.end)).filter(l).filter((i) => {
|
|
376
376
|
if (s === Q && i.has_been_split)
|
|
377
377
|
return !1;
|
|
378
378
|
if (/^spl/i.test(s) && (i.has_been_split || i.parent_guid))
|
|
379
379
|
return !0;
|
|
380
380
|
const I = i.tags.some(
|
|
381
381
|
(M) => S(s, t.find((H) => H.guid === M)?.name)
|
|
382
|
-
), E =
|
|
382
|
+
), E = u(i.date);
|
|
383
383
|
return S(s, i.payee) || S(s, i.feed_description) || S(s, i.category) || S(s, g(E, O.MONTH)) || S(s, g(E, O.DAY)) || S(s, g(E, O.FULL_MONTH_DAY)) || S(s, g(E, O.MONTH_DAY_YEAR)) || S(s, $(E, X)) || S(s, i.account) || S(s, `${i.amount}`) || S(s, i.memo) || I;
|
|
384
384
|
});
|
|
385
|
-
}, et = (
|
|
386
|
-
const
|
|
385
|
+
}, et = (_, t, a) => [..._].sort((e, c) => {
|
|
386
|
+
const l = t, s = (e[l] || "") > (c[l] || "");
|
|
387
387
|
let A = s ? -1 : 1, i = s ? 1 : -1;
|
|
388
388
|
return (t === L.DATE || t === L.AMOUNT) && (A = s ? 1 : -1, i = s ? -1 : 1), a === x.ASC ? A : i;
|
|
389
|
-
}), S = (
|
|
390
|
-
const a =
|
|
389
|
+
}), S = (_, t) => {
|
|
390
|
+
const a = _.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
|
|
391
391
|
return a.every((c) => e.indexOf(c) > -1);
|
|
392
392
|
}, st = {
|
|
393
393
|
account_guid: "",
|
|
@@ -481,7 +481,15 @@ class yt {
|
|
|
481
481
|
t.endpoint,
|
|
482
482
|
t.sessionToken,
|
|
483
483
|
t.onError
|
|
484
|
-
), this.beatApi = new f(t.endpoint, t.sessionToken, t.onError), y(this)
|
|
484
|
+
), this.beatApi = new f(t.endpoint, t.sessionToken, t.onError), y(this), B(() => {
|
|
485
|
+
const a = this.transactions, e = this.associatedBeats, c = this.taggings, l = this.tags;
|
|
486
|
+
return this.emitChange(), {
|
|
487
|
+
transactions: a,
|
|
488
|
+
associatedBeats: e,
|
|
489
|
+
taggings: c,
|
|
490
|
+
tags: l
|
|
491
|
+
};
|
|
492
|
+
});
|
|
485
493
|
}
|
|
486
494
|
loadTransactionData = async ({
|
|
487
495
|
associatedBeats: t,
|
|
@@ -502,11 +510,10 @@ class yt {
|
|
|
502
510
|
subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
|
|
503
511
|
this.listeners = this.listeners.filter((a) => a !== t);
|
|
504
512
|
});
|
|
505
|
-
getSnapshot = () =>
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
(
|
|
509
|
-
);
|
|
513
|
+
getSnapshot = () => this.transactions;
|
|
514
|
+
emitChange = () => {
|
|
515
|
+
for (const t of this.listeners)
|
|
516
|
+
t();
|
|
510
517
|
};
|
|
511
518
|
get sortedTransactions() {
|
|
512
519
|
return tt(
|
|
@@ -581,7 +588,7 @@ class yt {
|
|
|
581
588
|
loadTransactions = async (t = this.cachedStartDate, a = D(), e) => {
|
|
582
589
|
this.setIsLoading(!0), this.rawTransactions = [];
|
|
583
590
|
try {
|
|
584
|
-
const c = e ?? await this.api.getTransactionsByDateRange(
|
|
591
|
+
const c = e ?? await this.api.getTransactionsByDateRange(h(t), h(a));
|
|
585
592
|
d(() => {
|
|
586
593
|
this.rawTransactions = c;
|
|
587
594
|
});
|
|
@@ -594,7 +601,7 @@ class yt {
|
|
|
594
601
|
loadTransactionsByDateRange = async (t, a) => {
|
|
595
602
|
console.warn("DEPRECATED: loadTransactionsByDateRange will be removed"), this.setFilter({
|
|
596
603
|
...this.filter,
|
|
597
|
-
dateRange: { start:
|
|
604
|
+
dateRange: { start: u(a), end: u(t) }
|
|
598
605
|
});
|
|
599
606
|
};
|
|
600
607
|
modifyTransactionByAccountGuid = (t, a) => {
|
|
@@ -631,12 +638,12 @@ class yt {
|
|
|
631
638
|
const A = await this.api.addTransaction(a[s]);
|
|
632
639
|
c.push(A);
|
|
633
640
|
}
|
|
634
|
-
const
|
|
635
|
-
|
|
641
|
+
const l = this.transactions.findIndex((s) => s.guid === t.guid);
|
|
642
|
+
l >= 0 && d(
|
|
636
643
|
() => this.rawTransactions = [
|
|
637
|
-
...this.transactions.slice(0,
|
|
644
|
+
...this.transactions.slice(0, l),
|
|
638
645
|
e,
|
|
639
|
-
...this.transactions.slice(
|
|
646
|
+
...this.transactions.slice(l + 1),
|
|
640
647
|
...c
|
|
641
648
|
]
|
|
642
649
|
);
|
|
@@ -649,21 +656,21 @@ class yt {
|
|
|
649
656
|
const A = e.findIndex((i) => i.guid === s.guid);
|
|
650
657
|
A >= 0 && e.splice(A, 1);
|
|
651
658
|
});
|
|
652
|
-
const c = e.findIndex((s) => s.guid === t),
|
|
653
|
-
|
|
659
|
+
const c = e.findIndex((s) => s.guid === t), l = e[c];
|
|
660
|
+
l.has_been_split = !1, c >= 0 && d(
|
|
654
661
|
() => this.rawTransactions = [
|
|
655
662
|
...e.slice(0, c),
|
|
656
|
-
|
|
663
|
+
l,
|
|
657
664
|
...e.slice(c + 1)
|
|
658
665
|
]
|
|
659
666
|
);
|
|
660
667
|
};
|
|
661
668
|
updateTaggings = async (t, a) => {
|
|
662
|
-
const e = this.taggings.filter((s) => s.transaction_guid === a), c = new Set(e.map((s) => s.tag_guid)),
|
|
669
|
+
const e = this.taggings.filter((s) => s.transaction_guid === a), c = new Set(e.map((s) => s.tag_guid)), l = new Set(t);
|
|
663
670
|
for (const s of t)
|
|
664
671
|
c.has(s) || await this.addTagging(s, a);
|
|
665
672
|
for (const s of e)
|
|
666
|
-
|
|
673
|
+
l.has(s.tag_guid) || await this.removeTagging(s.guid);
|
|
667
674
|
await this.loadTaggings();
|
|
668
675
|
};
|
|
669
676
|
updateTag = async (t) => {
|