@mx-cartographer/experiences 7.8.2-alpha.bb6 → 7.8.2-alpha.mm0

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.
@@ -4,24 +4,24 @@ import H from "@mui/material/FormControlLabel";
4
4
  import P from "@mui/material/Radio";
5
5
  import U from "@mui/material/styles/useTheme";
6
6
  import B from "@mui/material/Tooltip";
7
- import { makeAutoObservable as p, toJS as K } from "mobx";
7
+ import { makeAutoObservable as p } from "mobx";
8
8
  import { endOfToday as f } from "date-fns/endOfToday";
9
- import { formatISO as V } from "date-fns/formatISO";
9
+ import { formatISO as K } from "date-fns/formatISO";
10
10
  import { getUnixTime as O } from "date-fns/getUnixTime";
11
- import { isBefore as v } from "date-fns/isBefore";
11
+ import { isBefore as V } from "date-fns/isBefore";
12
12
  import { startOfMonth as h } from "date-fns/startOfMonth";
13
13
  import { startOfToday as m } from "date-fns/startOfToday";
14
- import { subDays as Y } from "date-fns/subDays";
14
+ import { subDays as v } from "date-fns/subDays";
15
15
  import { O as n, a as y, T as b } from "./User-B0LnmiKO.mjs";
16
16
  import { T as D } from "./TransactionApi-CjBoLleL.mjs";
17
- import { b as F } from "./Category-CevNQ03n.mjs";
18
- import { f as W } from "./exportTransactionsToCSV-DtQ7ovAR.mjs";
19
- import { format as $ } from "date-fns/format";
20
- import { fromUnixTime as k } from "date-fns/fromUnixTime";
21
- import { f as I, D as C, O as z } from "./Dialog-B4PI-_bL.mjs";
22
- import { endOfMonth as X } from "date-fns/endOfMonth";
17
+ import { b as Y } from "./Category-CevNQ03n.mjs";
18
+ import { f as F } from "./exportTransactionsToCSV-DtQ7ovAR.mjs";
19
+ import { format as W } from "date-fns/format";
20
+ import { fromUnixTime as $ } from "date-fns/fromUnixTime";
21
+ import { f as I, D as C, O as k } from "./Dialog-B4PI-_bL.mjs";
22
+ import { endOfMonth as z } from "date-fns/endOfMonth";
23
23
  import { B as u } from "./BeatApi-De2IaqH2.mjs";
24
- const j = ({
24
+ const X = ({
25
25
  checked: l = !1,
26
26
  label: t,
27
27
  sx: a = {},
@@ -59,7 +59,7 @@ const j = ({
59
59
  ) })
60
60
  }
61
61
  );
62
- }, ft = j, G = {
62
+ }, pt = X, G = {
63
63
  ASC: "ASC",
64
64
  DESC: "DESC",
65
65
  DIRECTION: {
@@ -322,7 +322,7 @@ const j = ({
322
322
  category: T.TRANSACTIONS_WIDGET,
323
323
  label: r.DELETE_TRANSACTION
324
324
  }
325
- }, J = async (l, t) => !t || !R[l] ? null : t.sendAnalyticEvent(R[l]), L = {
325
+ }, j = async (l, t) => !t || !R[l] ? null : t.sendAnalyticEvent(R[l]), L = {
326
326
  FLAG: "flag",
327
327
  DATE: "date",
328
328
  PAYEE: "payee",
@@ -331,40 +331,40 @@ const j = ({
331
331
  AMOUNT: "amount"
332
332
  }, Z = (l, t, a, e = []) => {
333
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: _, tag_guid: N } = i;
335
- if (!c[_])
334
+ const { transaction_guid: S, tag_guid: N } = i;
335
+ if (!c[S])
336
336
  return {
337
337
  ...c,
338
- [_]: [N]
338
+ [S]: [N]
339
339
  };
340
- const g = [...c[_], N];
340
+ const g = [...c[S], N];
341
341
  return {
342
342
  ...c,
343
- [_]: g
343
+ [S]: g
344
344
  };
345
345
  }, {});
346
346
  return l.map((c) => {
347
- const i = A[c.account_guid], _ = c.category_guid ? d[c.category_guid] : null, N = s[c.guid] ?? [];
347
+ const i = A[c.account_guid], S = c.category_guid ? d[c.category_guid] : null, N = s[c.guid] ?? [];
348
348
  return {
349
349
  ...c,
350
350
  account: i?.user_name || "Unknown",
351
351
  accountIsClosed: i?.is_closed,
352
352
  accountIsHidden: i?.is_hidden,
353
- category: _?.name || "Uncategorized",
354
- isIncome: c.top_level_category_guid === F.INCOME,
353
+ category: S?.name || "Uncategorized",
354
+ isIncome: c.top_level_category_guid === Y.INCOME,
355
355
  isPending: c.feed_status === y.PENDING,
356
356
  number: i?.account_number || "",
357
357
  payee: c.description,
358
358
  tags: N
359
359
  };
360
360
  });
361
- }, q = "uncategorized", Q = (l, t, a, e, A, d) => {
362
- const s = tt(l, A, d), c = at(s, a, e);
361
+ }, q = "uncategorized", J = (l, t, a, e, A, d) => {
362
+ const s = Q(l, A, d), c = tt(s, a, e);
363
363
  return t.forEach((i) => {
364
- const _ = c.findIndex((g) => g.guid === i), N = d.filter((g) => g.parent_guid === i);
365
- c.splice(_ + 1, 0, ...N);
364
+ const S = c.findIndex((g) => g.guid === i), N = d.filter((g) => g.parent_guid === i);
365
+ c.splice(S + 1, 0, ...N);
366
366
  }), c;
367
- }, tt = (l, t, a) => {
367
+ }, Q = (l, t, a) => {
368
368
  const {
369
369
  accounts: e = [],
370
370
  dateRange: A = { start: h(m()), end: f() },
@@ -372,24 +372,24 @@ const j = ({
372
372
  searchTerm: s = "",
373
373
  showSplits: c = !1
374
374
  } = l;
375
- return a.filter((i) => c ? !i.has_been_split : !i.parent_guid).filter((i) => !!e.find((_) => _ === i.account_guid)).filter((i) => i.date >= O(A.start) && i.date <= O(A.end)).filter(d).filter((i) => {
375
+ return a.filter((i) => c ? !i.has_been_split : !i.parent_guid).filter((i) => !!e.find((S) => S === i.account_guid)).filter((i) => i.date >= O(A.start) && i.date <= O(A.end)).filter(d).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 N = i.tags.some(
381
- (w) => S(s, t.find((x) => x.guid === w)?.name)
382
- ), g = k(i.date);
383
- return S(s, i.payee) || S(s, i.feed_description) || S(s, i.category) || S(s, I(g, C.MONTH)) || S(s, I(g, C.DAY)) || S(s, I(g, C.FULL_MONTH_DAY)) || S(s, I(g, C.MONTH_DAY_YEAR)) || S(s, $(g, z)) || S(s, i.account) || S(s, `${i.amount}`) || S(s, i.memo) || N;
381
+ (w) => _(s, t.find((x) => x.guid === w)?.name)
382
+ ), g = $(i.date);
383
+ return _(s, i.payee) || _(s, i.feed_description) || _(s, i.category) || _(s, I(g, C.MONTH)) || _(s, I(g, C.DAY)) || _(s, I(g, C.FULL_MONTH_DAY)) || _(s, I(g, C.MONTH_DAY_YEAR)) || _(s, W(g, k)) || _(s, i.account) || _(s, `${i.amount}`) || _(s, i.memo) || N;
384
384
  });
385
- }, at = (l, t, a) => [...l].sort((e, A) => {
385
+ }, tt = (l, t, a) => [...l].sort((e, A) => {
386
386
  const d = t, s = (e[d] || "") > (A[d] || "");
387
387
  let c = s ? -1 : 1, i = s ? 1 : -1;
388
388
  return (t === L.DATE || t === L.AMOUNT) && (c = s ? 1 : -1, i = s ? -1 : 1), a === G.ASC ? c : i;
389
- }), S = (l, t) => {
389
+ }), _ = (l, t) => {
390
390
  const a = l.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
391
391
  return a.every((A) => e.indexOf(A) > -1);
392
- }, et = {
392
+ }, at = {
393
393
  account_guid: "",
394
394
  amount: 0,
395
395
  currency_code: "",
@@ -418,16 +418,16 @@ const j = ({
418
418
  memo: void 0,
419
419
  tags: []
420
420
  };
421
- class st {
421
+ class et {
422
422
  beginDate = h(/* @__PURE__ */ new Date());
423
- endDate = X(/* @__PURE__ */ new Date());
423
+ endDate = z(/* @__PURE__ */ new Date());
424
424
  expandedSplits = [];
425
425
  height = 550;
426
426
  width = 1e3;
427
427
  shouldDisableDrawerScroll = !1;
428
428
  searchValue = "";
429
429
  selectedAccountGuids = [];
430
- manualTransaction = et;
430
+ manualTransaction = at;
431
431
  isAmountValid = !1;
432
432
  showInsights = !1;
433
433
  constructor() {
@@ -457,7 +457,7 @@ class st {
457
457
  this.manualTransaction = t;
458
458
  };
459
459
  }
460
- class mt {
460
+ class ft {
461
461
  globalStore;
462
462
  uiStore;
463
463
  api = new D("/", "");
@@ -477,14 +477,14 @@ class mt {
477
477
  transactionRules = [];
478
478
  transactionRulesLoaded = !1;
479
479
  transactionRulesLoading = !1;
480
- cachedStartDate = Y(m(), 90);
480
+ cachedStartDate = v(m(), 90);
481
481
  filter = {};
482
482
  isLoading = !0;
483
483
  sortColumn = L.DATE;
484
484
  sortDirection = G.DESC;
485
- onAnalyticEvent = J;
485
+ onAnalyticEvent = j;
486
486
  constructor(t) {
487
- this.globalStore = t, this.uiStore = new st(), this.api = new D(
487
+ this.globalStore = t, this.uiStore = new et(), this.api = new D(
488
488
  t.endpoint,
489
489
  t.sessionToken,
490
490
  t.onError
@@ -512,7 +512,7 @@ class mt {
512
512
  ) : [];
513
513
  }
514
514
  get sortedTransactions() {
515
- return console.warn("Sorting & Filtering: ", K(this.filter)), Q(
515
+ return J(
516
516
  this.filter,
517
517
  this.uiStore.expandedSplits,
518
518
  this.sortColumn,
@@ -522,7 +522,7 @@ class mt {
522
522
  );
523
523
  }
524
524
  get sortedTransactionsWithSplits() {
525
- return W(this.sortedTransactions, this.transactions);
525
+ return F(this.sortedTransactions, this.transactions);
526
526
  }
527
527
  setAssociatedBeats = (t) => {
528
528
  this.associatedBeats = t, this.associatedBeatsLoading = !1, this.associatedBeatsLoaded = !0;
@@ -573,7 +573,7 @@ class mt {
573
573
  loadAssociatedBeats = async (t) => {
574
574
  if (this.associatedBeatsLoading) return;
575
575
  this.associatedBeatsLoading = !0;
576
- const a = t ? V(t, { representation: "date" }) : void 0;
576
+ const a = t ? K(t, { representation: "date" }) : void 0;
577
577
  try {
578
578
  const e = await this.beatApi.getBeatsWithAssociatedTransaction(a);
579
579
  this.setAssociatedBeats(e);
@@ -644,7 +644,7 @@ class mt {
644
644
  }
645
645
  };
646
646
  setFilter = (t) => {
647
- this.filter = t, t.dateRange && v(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start).then(() => {
647
+ this.filter = t, t.dateRange && V(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start).then(() => {
648
648
  t.dateRange && (this.cachedStartDate = t.dateRange.start);
649
649
  });
650
650
  };
@@ -699,7 +699,7 @@ class mt {
699
699
  };
700
700
  }
701
701
  export {
702
- et as D,
703
- ft as S,
704
- mt as T
702
+ at as D,
703
+ pt as S,
704
+ ft as T
705
705
  };