@mx-cartographer/experiences 7.2.15-alpha.sms4 → 7.2.15-alpha.sms6

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,31 +4,31 @@ 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, runInAction as d, autorun as B } 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 = ({
24
+ const Z = ({
25
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 = l ? _.palette.action.active : i;
31
+ const _ = V(), s = _.palette.mode === "light" ? _.palette.grey[400] : _.palette.grey[700], A = l ? _.palette.action.active : s;
32
32
  return /* @__PURE__ */ C(
33
33
  P,
34
34
  {
@@ -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,16 +322,16 @@ const j = ({
322
322
  category: o.TRANSACTIONS_WIDGET,
323
323
  label: r.DELETE_TRANSACTION
324
324
  }
325
- }, Z = async (l, t) => !t || !m[l] ? null : t.sendAnalyticEvent(m[l]), 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 = (l, 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: N, tag_guid: I } = s;
332
+ }, J = (l, t, a, e = []) => {
333
+ const c = t.reduce((A, i) => ({ ...A, [i.guid]: i }), {}), _ = a.reduce((A, i) => ({ ...A, [i.guid]: i }), {}), s = e.reduce((A, i) => {
334
+ const { transaction_guid: N, tag_guid: I } = i;
335
335
  if (!A[N])
336
336
  return {
337
337
  ...A,
@@ -344,52 +344,52 @@ const j = ({
344
344
  };
345
345
  }, {});
346
346
  return l.map((A) => {
347
- const s = c[A.account_guid], N = A.category_guid ? _[A.category_guid] : null, I = i[A.guid] ?? [];
347
+ const i = c[A.account_guid], N = A.category_guid ? _[A.category_guid] : null, I = s[A.guid] ?? [];
348
348
  return {
349
349
  ...A,
350
- account: s?.user_name || "Unknown",
351
- accountIsClosed: s?.is_closed,
352
- accountIsHidden: s?.is_hidden,
350
+ account: i?.user_name || "Unknown",
351
+ accountIsClosed: i?.is_closed,
352
+ accountIsHidden: i?.is_hidden,
353
353
  category: N?.name || "Uncategorized",
354
- isIncome: A.top_level_category_guid === W.INCOME,
354
+ isIncome: A.top_level_category_guid === z.INCOME,
355
355
  isPending: A.feed_status === G.PENDING,
356
- number: s?.account_number || "",
356
+ number: i?.account_number || "",
357
357
  payee: A.description,
358
358
  tags: I
359
359
  };
360
360
  });
361
- }, J = "uncategorized", Q = (l, t, a, e, c, _) => {
362
- const i = tt(l, c, _), A = at(i, a, e);
363
- return t.forEach((s) => {
364
- const N = A.findIndex((E) => E.guid === s), I = _.filter((E) => E.parent_guid === s);
361
+ }, Q = "uncategorized", tt = (l, t, a, e, c, _) => {
362
+ const s = at(l, c, _), A = et(s, a, e);
363
+ return t.forEach((i) => {
364
+ const N = A.findIndex((E) => E.guid === i), I = _.filter((E) => E.parent_guid === i);
365
365
  A.splice(N + 1, 0, ...I);
366
366
  }), A;
367
- }, tt = (l, 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
- searchTerm: i = "",
372
+ searchTerm: s = "",
373
373
  showSplits: A = !1
374
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 === J && s.has_been_split)
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 >= u(c.start) && i.date <= u(c.end)).filter(_).filter((i) => {
376
+ if (s === Q && i.has_been_split)
377
377
  return !1;
378
- if (/^spl/i.test(i) && (s.has_been_split || s.parent_guid))
378
+ if (/^spl/i.test(s) && (i.has_been_split || i.parent_guid))
379
379
  return !0;
380
- const I = s.tags.some(
381
- (M) => S(i, t.find((H) => H.guid === M)?.name)
382
- ), E = h(s.date);
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, k(E, $)) || S(i, s.account) || S(i, `${s.amount}`) || S(i, s.memo) || I;
380
+ const I = i.tags.some(
381
+ (M) => S(s, t.find((H) => H.guid === M)?.name)
382
+ ), E = h(i.date);
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
- }, at = (l, t, a) => [...l].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;
385
+ }, et = (l, t, a) => [...l].sort((e, c) => {
386
+ const _ = t, s = (e[_] || "") > (c[_] || "");
387
+ let A = s ? -1 : 1, i = s ? 1 : -1;
388
+ return (t === L.DATE || t === L.AMOUNT) && (A = s ? 1 : -1, i = s ? -1 : 1), a === x.ASC ? A : i;
389
389
  }), S = (l, t) => {
390
390
  const a = l.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
391
391
  return a.every((c) => e.indexOf(c) > -1);
392
- }, et = {
392
+ }, st = {
393
393
  account_guid: "",
394
394
  amount: 0,
395
395
  currency_code: "",
@@ -420,7 +420,7 @@ const j = ({
420
420
  };
421
421
  class it {
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 = st;
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,7 +474,8 @@ class mt {
474
474
  taggings = [];
475
475
  tags = [];
476
476
  transactionRules = [];
477
- onAnalyticEvent = Z;
477
+ listeners = [];
478
+ onAnalyticEvent = q;
478
479
  constructor(t) {
479
480
  this.globalStore = t, this.uiStore = new it(), this.api = new p(
480
481
  t.endpoint,
@@ -498,8 +499,14 @@ class mt {
498
499
  this.uiStore.setIsInitialized(!0);
499
500
  });
500
501
  };
502
+ subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
503
+ this.listeners = this.listeners.filter((a) => a !== t);
504
+ });
505
+ getSnapshot = () => {
506
+ B(() => this.transactions);
507
+ };
501
508
  get sortedTransactions() {
502
- return Q(
509
+ return tt(
503
510
  this.filter,
504
511
  this.uiStore.expandedSplits,
505
512
  this.sortColumn,
@@ -509,7 +516,7 @@ class mt {
509
516
  );
510
517
  }
511
518
  get sortedTransactionsWithSplits() {
512
- return z(this.sortedTransactions, this.transactions);
519
+ return k(this.sortedTransactions, this.transactions);
513
520
  }
514
521
  get transactions() {
515
522
  return this.augmentTransactions(this.rawTransactions);
@@ -545,7 +552,7 @@ class mt {
545
552
  this.globalStore.accountStore.updateAccountBalance(a.account_guid, e);
546
553
  }
547
554
  };
548
- augmentTransactions = (t) => q(
555
+ augmentTransactions = (t) => J(
549
556
  t,
550
557
  this.globalStore.accountStore.visibleAccounts,
551
558
  this.globalStore.categoryStore.categories,
@@ -553,7 +560,7 @@ class mt {
553
560
  );
554
561
  getTransactionData = () => ({});
555
562
  loadAssociatedBeats = async (t, a) => {
556
- const e = t ? B(t, { representation: "date" }) : void 0, c = a ?? await this.beatApi.getBeatsWithAssociatedTransaction(e);
563
+ const e = t ? Y(t, { representation: "date" }) : void 0, c = a ?? await this.beatApi.getBeatsWithAssociatedTransaction(e);
557
564
  d(() => this.associatedBeats = c);
558
565
  };
559
566
  loadTags = async () => {
@@ -607,7 +614,7 @@ class mt {
607
614
  }
608
615
  };
609
616
  setFilter = (t) => {
610
- this.filter = t, t.dateRange && Y(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start, D()).then(() => {
617
+ this.filter = t, t.dateRange && F(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start, D()).then(() => {
611
618
  t.dateRange && (this.cachedStartDate = t.dateRange.start);
612
619
  });
613
620
  };
@@ -617,11 +624,11 @@ class mt {
617
624
  };
618
625
  splitTransaction = async (t, a) => {
619
626
  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]);
627
+ for (let s = 0; s < a.length; s++) {
628
+ const A = await this.api.addTransaction(a[s]);
622
629
  c.push(A);
623
630
  }
624
- const _ = this.transactions.findIndex((i) => i.guid === t.guid);
631
+ const _ = this.transactions.findIndex((s) => s.guid === t.guid);
625
632
  _ >= 0 && d(
626
633
  () => this.rawTransactions = [
627
634
  ...this.transactions.slice(0, _),
@@ -632,14 +639,14 @@ class mt {
632
639
  );
633
640
  };
634
641
  unSplitTransaction = async (t) => {
635
- const a = this.transactions.filter((i) => i.parent_guid === t);
642
+ const a = this.transactions.filter((s) => s.parent_guid === t);
636
643
  await this.api.removeTransactionSplit(t);
637
644
  const e = [...this.transactions];
638
- a.forEach((i) => {
639
- const A = e.findIndex((s) => s.guid === i.guid);
645
+ a.forEach((s) => {
646
+ const A = e.findIndex((i) => i.guid === s.guid);
640
647
  A >= 0 && e.splice(A, 1);
641
648
  });
642
- const c = e.findIndex((i) => i.guid === t), _ = e[c];
649
+ const c = e.findIndex((s) => s.guid === t), _ = e[c];
643
650
  _.has_been_split = !1, c >= 0 && d(
644
651
  () => this.rawTransactions = [
645
652
  ...e.slice(0, c),
@@ -649,11 +656,11 @@ class mt {
649
656
  );
650
657
  };
651
658
  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);
659
+ const e = this.taggings.filter((s) => s.transaction_guid === a), c = new Set(e.map((s) => s.tag_guid)), _ = new Set(t);
660
+ for (const s of t)
661
+ c.has(s) || await this.addTagging(s, a);
662
+ for (const s of e)
663
+ _.has(s.tag_guid) || await this.removeTagging(s.guid);
657
664
  await this.loadTaggings();
658
665
  };
659
666
  updateTag = async (t) => {
@@ -671,7 +678,7 @@ class mt {
671
678
  };
672
679
  }
673
680
  export {
674
- et as D,
675
- ft as S,
676
- mt as T
681
+ st as D,
682
+ mt as S,
683
+ yt as T
677
684
  };
@@ -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-RGu9PZK8.mjs";
22
- import { S as Js } from "../TransactionStore-RGu9PZK8.mjs";
21
+ import { T as at } from "../TransactionStore-DULGYXzv.mjs";
22
+ import { S as Js } from "../TransactionStore-DULGYXzv.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";
@@ -1198,7 +1198,7 @@ class Je {
1198
1198
  userStore;
1199
1199
  // UI Stores
1200
1200
  globalUiStore;
1201
- listeners = [];
1201
+ // listeners = [] as any
1202
1202
  constructor(t = K, e = "/", r) {
1203
1203
  this.appConfig = t, this.endpoint = e, this.sessionToken = t.options.session_token ?? "", this.onError = r, this.accountStore = new ft(this), this.appDataStore = new ie(this), this.analyticsStore = new ee(this), this.beatStore = new St(this), this.budgetsStore = new se(this), this.cashflowStore = new nt(this), this.categoryStore = new et(this), this.connectStore = new ce(this), this.copyStore = new te(this), this.debtsStore = new xt(this), this.finstrongStore = new Ct(this), this.goalStore = new it(this), this.helpStore = new ae(this), this.holdingStore = new ne(this), this.merchantStore = new Tt(this), this.netWorthStore = new Bt(this), this.notificationStore = new st(this), this.recurringTransactionsStore = new mt(this), this.settingsStore = new It(this), this.transactionStore = new at(this), this.trendsStore = new ct(this), this.userStore = new le(this), this.globalUiStore = new de(this), f(this);
1204
1204
  }
@@ -1230,10 +1230,15 @@ class Je {
1230
1230
  })
1231
1231
  ]), this.globalUiStore.setInitialized(!0);
1232
1232
  };
1233
- subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
1234
- this.listeners = this.listeners.filter((e) => e !== t);
1235
- });
1236
- getSnapshot = () => this;
1233
+ // subscribe = (listener: any) => {
1234
+ // this.listeners = [...this.listeners, listener]
1235
+ // return () => {
1236
+ // this.listeners = this.listeners.filter((l: any) => l !== listener)
1237
+ // }
1238
+ // }
1239
+ // getSnapshot = () => {
1240
+ // return this
1241
+ // }
1237
1242
  }
1238
1243
  export {
1239
1244
  vs as ANALYTICS_EVENTS,
@@ -64,11 +64,8 @@ export declare class GlobalStore {
64
64
  trendsStore: TrendsStore;
65
65
  userStore: UserStore;
66
66
  globalUiStore: GlobalUiStore;
67
- listeners: any;
68
67
  constructor(appConfig?: AppConfig, endpoint?: string, onError?: GlobalErrorHandler);
69
68
  get isInitialized(): boolean;
70
69
  loadData: ({ accounts, appData, associatedBeats, categories, institutions, transactionRules, transactions, userFeatures, }?: LoadDataProps) => Promise<void>;
71
- subscribe: (listener: any) => () => void;
72
- getSnapshot: () => this;
73
70
  }
74
71
  export {};
@@ -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-RGu9PZK8.mjs";
7
- import { T as Ea } from "../TransactionStore-RGu9PZK8.mjs";
6
+ import { S as ae, D as Fe } from "../TransactionStore-DULGYXzv.mjs";
7
+ import { T as Ea } from "../TransactionStore-DULGYXzv.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";
@@ -26,6 +26,7 @@ export declare class TransactionStore {
26
26
  taggings: Tagging[];
27
27
  tags: Tag[];
28
28
  transactionRules: TransactionRule[];
29
+ listeners: any;
29
30
  onAnalyticEvent: (event: string, session: import('../analytics').AnalyticSession | null) => Promise<any>;
30
31
  constructor(globalStore: GlobalStore);
31
32
  loadTransactionData: ({ associatedBeats, transactionRules, transactions, }?: {
@@ -35,6 +36,8 @@ export declare class TransactionStore {
35
36
  transactionRules?: TransactionRule[];
36
37
  transactions?: Transaction[];
37
38
  }) => Promise<void>;
39
+ subscribe: (listener: any) => () => void;
40
+ getSnapshot: () => void;
38
41
  get sortedTransactions(): Transaction[];
39
42
  get sortedTransactionsWithSplits(): Transaction[];
40
43
  get transactions(): Transaction[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.2.15-alpha.sms4",
3
+ "version": "7.2.15-alpha.sms6",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",