@mx-cartographer/experiences 7.2.15-alpha.sms1 → 7.2.15-alpha.sms3

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,36 +4,36 @@ 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, runInAction as d } from "mobx";
7
+ import { makeAutoObservable as y, autorun as B, runInAction as d } from "mobx";
8
8
  import { endOfToday as D } from "date-fns/endOfToday";
9
- import { formatISO as B } from "date-fns/formatISO";
9
+ import { formatISO as Y } from "date-fns/formatISO";
10
10
  import { fromUnixTime as h } from "date-fns/fromUnixTime";
11
11
  import { getUnixTime as u } from "date-fns/getUnixTime";
12
- import { isBefore as Y } from "date-fns/isBefore";
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";
15
- import { subDays as F } from "date-fns/subDays";
15
+ import { subDays as W } from "date-fns/subDays";
16
16
  import { O as n, a as G, T as w } from "./User-BQUxBeZV.mjs";
17
17
  import { T as p } from "./TransactionApi-B3Tksf7L.mjs";
18
- import { b as W } from "./Category-CevNQ03n.mjs";
19
- import { f as z } from "./exportTransactionsToCSV-7bVS7KXf.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";
18
+ import { b as z } from "./Category-CevNQ03n.mjs";
19
+ import { f as k } from "./exportTransactionsToCSV-7bVS7KXf.mjs";
20
+ import { format as $ } from "date-fns/format";
21
+ import { f as g, D as O, O as X } from "./Dialog-CWW597AF.mjs";
22
+ import { endOfMonth as j } from "date-fns/endOfMonth";
23
23
  import { B as f } from "./BeatApi-DhJpgCLz.mjs";
24
- const j = ({
25
- checked: S = !1,
24
+ const Z = ({
25
+ checked: l = !1,
26
26
  label: t,
27
27
  sx: a = {},
28
28
  tooltip: e = "",
29
29
  value: c
30
30
  }) => {
31
- const _ = V(), i = _.palette.mode === "light" ? _.palette.grey[400] : _.palette.grey[700], A = S ? _.palette.action.active : i;
31
+ const _ = V(), i = _.palette.mode === "light" ? _.palette.grey[400] : _.palette.grey[700], A = l ? _.palette.action.active : i;
32
32
  return /* @__PURE__ */ C(
33
33
  P,
34
34
  {
35
35
  bgcolor: "background.paper",
36
- border: `${S ? 3 : 1}px solid`,
36
+ border: `${l ? 3 : 1}px solid`,
37
37
  borderColor: A,
38
38
  borderRadius: 2,
39
39
  mt: -2,
@@ -59,7 +59,7 @@ const j = ({
59
59
  ) })
60
60
  }
61
61
  );
62
- }, ft = j, x = {
62
+ }, mt = Z, x = {
63
63
  ASC: "ASC",
64
64
  DESC: "DESC",
65
65
  DIRECTION: {
@@ -322,74 +322,74 @@ const j = ({
322
322
  category: o.TRANSACTIONS_WIDGET,
323
323
  label: r.DELETE_TRANSACTION
324
324
  }
325
- }, Z = async (S, t) => !t || !m[S] ? null : t.sendAnalyticEvent(m[S]), L = {
325
+ }, q = async (l, t) => !t || !m[l] ? null : t.sendAnalyticEvent(m[l]), 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
- }, q = (S, t, a, e = []) => {
332
+ }, J = (l, t, a, e = []) => {
333
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])
334
+ const { transaction_guid: N, tag_guid: I } = s;
335
+ if (!A[N])
336
336
  return {
337
337
  ...A,
338
- [l]: [I]
338
+ [N]: [I]
339
339
  };
340
- const E = [...A[l], I];
340
+ const E = [...A[N], I];
341
341
  return {
342
342
  ...A,
343
- [l]: E
343
+ [N]: E
344
344
  };
345
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] ?? [];
346
+ return l.map((A) => {
347
+ const s = c[A.account_guid], N = A.category_guid ? _[A.category_guid] : null, I = i[A.guid] ?? [];
348
348
  return {
349
349
  ...A,
350
350
  account: s?.user_name || "Unknown",
351
351
  accountIsClosed: s?.is_closed,
352
352
  accountIsHidden: s?.is_hidden,
353
- category: l?.name || "Uncategorized",
354
- isIncome: A.top_level_category_guid === W.INCOME,
353
+ category: N?.name || "Uncategorized",
354
+ isIncome: A.top_level_category_guid === z.INCOME,
355
355
  isPending: A.feed_status === G.PENDING,
356
356
  number: s?.account_number || "",
357
357
  payee: A.description,
358
358
  tags: I
359
359
  };
360
360
  });
361
- }, J = "uncategorized", Q = (S, t, a, e, c, _) => {
362
- const i = tt(S, c, _), A = at(i, a, e);
361
+ }, Q = "uncategorized", tt = (l, t, a, e, c, _) => {
362
+ const i = at(l, c, _), A = et(i, a, e);
363
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);
364
+ const N = A.findIndex((E) => E.guid === s), I = _.filter((E) => E.parent_guid === s);
365
+ A.splice(N + 1, 0, ...I);
366
366
  }), A;
367
- }, tt = (S, t, a) => {
367
+ }, at = (l, t, a) => {
368
368
  const {
369
369
  accounts: e = [],
370
370
  dateRange: c = { start: R(b()), end: D() },
371
371
  custom: _ = () => !0,
372
372
  searchTerm: i = "",
373
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)
374
+ } = l;
375
+ return a.filter((s) => A ? !s.has_been_split : !s.parent_guid).filter((s) => !!e.find((N) => N === s.account_guid)).filter((s) => s.date >= u(c.start) && s.date <= u(c.end)).filter(_).filter((s) => {
376
+ if (i === Q && s.has_been_split)
377
377
  return !1;
378
378
  if (/^spl/i.test(i) && (s.has_been_split || s.parent_guid))
379
379
  return !0;
380
380
  const I = s.tags.some(
381
- (M) => N(i, t.find((H) => H.guid === M)?.name)
381
+ (M) => S(i, t.find((H) => H.guid === M)?.name)
382
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;
383
+ return S(i, s.payee) || S(i, s.feed_description) || S(i, s.category) || S(i, g(E, O.MONTH)) || S(i, g(E, O.DAY)) || S(i, g(E, O.FULL_MONTH_DAY)) || S(i, g(E, O.MONTH_DAY_YEAR)) || S(i, $(E, X)) || S(i, s.account) || S(i, `${s.amount}`) || S(i, s.memo) || I;
384
384
  });
385
- }, at = (S, t, a) => [...S].sort((e, c) => {
385
+ }, et = (l, t, a) => [...l].sort((e, c) => {
386
386
  const _ = t, i = (e[_] || "") > (c[_] || "");
387
387
  let A = i ? -1 : 1, s = i ? 1 : -1;
388
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() ?? "";
389
+ }), S = (l, t) => {
390
+ const a = l.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
391
391
  return a.every((c) => e.indexOf(c) > -1);
392
- }, et = {
392
+ }, it = {
393
393
  account_guid: "",
394
394
  amount: 0,
395
395
  currency_code: "",
@@ -418,9 +418,9 @@ const j = ({
418
418
  memo: void 0,
419
419
  tags: []
420
420
  };
421
- class it {
421
+ class st {
422
422
  beginDate = R(/* @__PURE__ */ new Date());
423
- endDate = X(/* @__PURE__ */ new Date());
423
+ endDate = j(/* @__PURE__ */ new Date());
424
424
  expandedSplits = [];
425
425
  isInitialized = !1;
426
426
  height = 550;
@@ -428,7 +428,7 @@ class it {
428
428
  shouldDisableDrawerScroll = !1;
429
429
  searchValue = "";
430
430
  selectedAccountGuids = [];
431
- manualTransaction = et;
431
+ manualTransaction = it;
432
432
  isAmountValid = !1;
433
433
  showInsights = !1;
434
434
  constructor() {
@@ -459,13 +459,13 @@ class it {
459
459
  this.manualTransaction = t;
460
460
  };
461
461
  }
462
- class mt {
462
+ class yt {
463
463
  globalStore;
464
464
  uiStore;
465
465
  api = new p("/", "");
466
466
  beatApi = new f("/", "");
467
467
  associatedBeats = [];
468
- cachedStartDate = F(b(), 90);
468
+ cachedStartDate = W(b(), 90);
469
469
  filter = {};
470
470
  isLoading = !0;
471
471
  rawTransactions = [];
@@ -474,13 +474,13 @@ class mt {
474
474
  taggings = [];
475
475
  tags = [];
476
476
  transactionRules = [];
477
- onAnalyticEvent = Z;
477
+ onAnalyticEvent = q;
478
478
  constructor(t) {
479
- this.globalStore = t, this.uiStore = new it(), this.api = new p(
479
+ this.globalStore = t, this.uiStore = new st(), this.api = new p(
480
480
  t.endpoint,
481
481
  t.sessionToken,
482
482
  t.onError
483
- ), this.beatApi = new f(t.endpoint, t.sessionToken, t.onError), y(this);
483
+ ), this.beatApi = new f(t.endpoint, t.sessionToken, t.onError), y(this), B(() => this.transactions);
484
484
  }
485
485
  loadTransactionData = async ({
486
486
  associatedBeats: t,
@@ -499,7 +499,7 @@ class mt {
499
499
  });
500
500
  };
501
501
  get sortedTransactions() {
502
- return Q(
502
+ return tt(
503
503
  this.filter,
504
504
  this.uiStore.expandedSplits,
505
505
  this.sortColumn,
@@ -509,7 +509,7 @@ class mt {
509
509
  );
510
510
  }
511
511
  get sortedTransactionsWithSplits() {
512
- return z(this.sortedTransactions, this.transactions);
512
+ return k(this.sortedTransactions, this.transactions);
513
513
  }
514
514
  get transactions() {
515
515
  return this.augmentTransactions(this.rawTransactions);
@@ -545,7 +545,7 @@ class mt {
545
545
  this.globalStore.accountStore.updateAccountBalance(a.account_guid, e);
546
546
  }
547
547
  };
548
- augmentTransactions = (t) => q(
548
+ augmentTransactions = (t) => J(
549
549
  t,
550
550
  this.globalStore.accountStore.visibleAccounts,
551
551
  this.globalStore.categoryStore.categories,
@@ -553,7 +553,7 @@ class mt {
553
553
  );
554
554
  getTransactionData = () => ({});
555
555
  loadAssociatedBeats = async (t, a) => {
556
- const e = t ? B(t, { representation: "date" }) : void 0, c = a ?? await this.beatApi.getBeatsWithAssociatedTransaction(e);
556
+ const e = t ? Y(t, { representation: "date" }) : void 0, c = a ?? await this.beatApi.getBeatsWithAssociatedTransaction(e);
557
557
  d(() => this.associatedBeats = c);
558
558
  };
559
559
  loadTags = async () => {
@@ -607,7 +607,7 @@ class mt {
607
607
  }
608
608
  };
609
609
  setFilter = (t) => {
610
- this.filter = t, t.dateRange && Y(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start, D()).then(() => {
610
+ this.filter = t, t.dateRange && F(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start, D()).then(() => {
611
611
  t.dateRange && (this.cachedStartDate = t.dateRange.start);
612
612
  });
613
613
  };
@@ -661,17 +661,17 @@ class mt {
661
661
  };
662
662
  updateTransaction = async (t) => {
663
663
  const a = await this.api.updateTransaction(t), e = this.transactions.findIndex((c) => c.guid === t.guid);
664
- e >= 0 && d(
664
+ e >= 0 && (console.log("updateTransaction ran 2", e), d(
665
665
  () => this.rawTransactions = [
666
666
  ...this.transactions.slice(0, e),
667
667
  a,
668
668
  ...this.transactions.slice(e + 1)
669
669
  ]
670
- );
670
+ ));
671
671
  };
672
672
  }
673
673
  export {
674
- et as D,
675
- ft as S,
676
- mt as T
674
+ it as D,
675
+ mt as S,
676
+ yt as T
677
677
  };
@@ -18,8 +18,8 @@ import { C as Ys } from "../CurrencyInput-DUsQbkXb.mjs";
18
18
  import { L as zs } from "../Loader-DUaFpDGv.mjs";
19
19
  import { R as js } from "../ResponsiveButton-DZFp78fJ.mjs";
20
20
  import { S as Vs } from "../SearchBox-B2_zLv8-.mjs";
21
- import { T as at } from "../TransactionStore-DxPLdF3B.mjs";
22
- import { S as Js } from "../TransactionStore-DxPLdF3B.mjs";
21
+ import { T as at } from "../TransactionStore-Dx8hFybD.mjs";
22
+ import { S as Js } from "../TransactionStore-Dx8hFybD.mjs";
23
23
  import { T as er } from "../TabContentContainer-j01JYR_7.mjs";
24
24
  import { I as rr } from "../IconBacking-B9oC6uL2.mjs";
25
25
  import { D as ar, F as nr, a as ir, c as cr, R as dr, S as lr } from "../RecurringTransactions-ej39mgA6.mjs";
@@ -3,8 +3,8 @@ import { u as P, C as Pe, D as $e, M as Ve, c as We, T as Ge, a as Ue } from "..
3
3
  import { B as xa, d as wa, b as Ia } from "../TransactionDetails-BqCr2FTh.mjs";
4
4
  import { T as M } from "../User-BQUxBeZV.mjs";
5
5
  import { O as Da } from "../User-BQUxBeZV.mjs";
6
- import { S as ae, D as Fe } from "../TransactionStore-DxPLdF3B.mjs";
7
- import { T as Ea } from "../TransactionStore-DxPLdF3B.mjs";
6
+ import { S as ae, D as Fe } from "../TransactionStore-Dx8hFybD.mjs";
7
+ import { T as Ea } from "../TransactionStore-Dx8hFybD.mjs";
8
8
  import { e as ze } from "../exportTransactionsToCSV-7bVS7KXf.mjs";
9
9
  import { E as Ma } from "../ExportCsvAction-sX8Rg4Ov.mjs";
10
10
  import { jsxs as _, jsx as e } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.2.15-alpha.sms1",
3
+ "version": "7.2.15-alpha.sms3",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",