@mx-cartographer/experiences 7.2.15-alpha.sms14 → 7.2.15-alpha.sms16

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.
@@ -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: _ = !1,
25
+ checked: l = !1,
26
26
  label: t,
27
27
  sx: a = {},
28
28
  tooltip: e = "",
29
29
  value: c
30
30
  }) => {
31
- const l = V(), s = l.palette.mode === "light" ? l.palette.grey[400] : l.palette.grey[700], A = _ ? l.palette.action.active : s;
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
  {
35
35
  bgcolor: "background.paper",
36
- border: `${_ ? 3 : 1}px solid`,
36
+ border: `${l ? 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: l.palette.action.active }, ...a },
43
+ sx: { "&:hover": { borderColor: _.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: l.palette.action.active } }
51
+ sx: { "&.Mui-checked": { color: _.palette.action.active } }
52
52
  }
53
53
  ),
54
54
  label: t,
@@ -322,15 +322,15 @@ const Z = ({
322
322
  category: T.TRANSACTIONS_WIDGET,
323
323
  label: r.DELETE_TRANSACTION
324
324
  }
325
- }, q = async (_, t) => !t || !m[_] ? null : t.sendAnalyticEvent(m[_]), 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
- }, 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) => {
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
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 _.map((A) => {
347
- const i = c[A.account_guid], N = A.category_guid ? l[A.category_guid] : null, I = s[A.guid] ?? [];
346
+ return l.map((A) => {
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
350
  account: i?.user_name || "Unknown",
@@ -358,21 +358,21 @@ const Z = ({
358
358
  tags: I
359
359
  };
360
360
  });
361
- }, Q = "uncategorized", tt = (_, t, a, e, c, l) => {
362
- const s = at(_, c, l), A = et(s, a, e);
361
+ }, Q = "uncategorized", tt = (l, t, a, e, c, _) => {
362
+ const s = at(l, c, _), A = et(s, a, e);
363
363
  return t.forEach((i) => {
364
- const N = A.findIndex((E) => E.guid === i), I = l.filter((E) => E.parent_guid === 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
- }, at = (_, t, a) => {
367
+ }, at = (l, t, a) => {
368
368
  const {
369
369
  accounts: e = [],
370
370
  dateRange: c = { start: R(b()), end: D() },
371
- custom: l = () => !0,
371
+ custom: _ = () => !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 >= h(c.start) && i.date <= h(c.end)).filter(l).filter((i) => {
374
+ } = l;
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(_).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))
@@ -382,12 +382,12 @@ const Z = ({
382
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 = (_, t, a) => [..._].sort((e, c) => {
386
- const l = t, s = (e[l] || "") > (c[l] || "");
385
+ }, et = (l, t, a) => [...l].sort((e, c) => {
386
+ const _ = t, s = (e[_] || "") > (c[_] || "");
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 = (_, t) => {
390
- const a = _.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
392
  }, st = {
393
393
  account_guid: "",
@@ -482,12 +482,12 @@ class yt {
482
482
  t.sessionToken,
483
483
  t.onError
484
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;
485
+ const a = this.transactions, e = this.associatedBeats, c = this.taggings, _ = this.tags;
486
486
  return this.emitChange(), {
487
487
  transactions: a,
488
488
  associatedBeats: e,
489
489
  taggings: c,
490
- tags: l
490
+ tags: _
491
491
  };
492
492
  });
493
493
  }
@@ -510,9 +510,10 @@ class yt {
510
510
  subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
511
511
  this.listeners = this.listeners.filter((a) => a !== t);
512
512
  });
513
- getSnapshot = () => this.transactions;
513
+ getSnapshot = () => [
514
+ { transactions: this.transactions }
515
+ ];
514
516
  emitChange = () => {
515
- console.log("change emitted");
516
517
  for (const t of this.listeners)
517
518
  t();
518
519
  };
@@ -639,12 +640,12 @@ class yt {
639
640
  const A = await this.api.addTransaction(a[s]);
640
641
  c.push(A);
641
642
  }
642
- const l = this.transactions.findIndex((s) => s.guid === t.guid);
643
- l >= 0 && d(
643
+ const _ = this.transactions.findIndex((s) => s.guid === t.guid);
644
+ _ >= 0 && d(
644
645
  () => this.rawTransactions = [
645
- ...this.transactions.slice(0, l),
646
+ ...this.transactions.slice(0, _),
646
647
  e,
647
- ...this.transactions.slice(l + 1),
648
+ ...this.transactions.slice(_ + 1),
648
649
  ...c
649
650
  ]
650
651
  );
@@ -657,21 +658,21 @@ class yt {
657
658
  const A = e.findIndex((i) => i.guid === s.guid);
658
659
  A >= 0 && e.splice(A, 1);
659
660
  });
660
- const c = e.findIndex((s) => s.guid === t), l = e[c];
661
- l.has_been_split = !1, c >= 0 && d(
661
+ const c = e.findIndex((s) => s.guid === t), _ = e[c];
662
+ _.has_been_split = !1, c >= 0 && d(
662
663
  () => this.rawTransactions = [
663
664
  ...e.slice(0, c),
664
- l,
665
+ _,
665
666
  ...e.slice(c + 1)
666
667
  ]
667
668
  );
668
669
  };
669
670
  updateTaggings = async (t, a) => {
670
- const e = this.taggings.filter((s) => s.transaction_guid === a), c = new Set(e.map((s) => s.tag_guid)), l = new Set(t);
671
+ const e = this.taggings.filter((s) => s.transaction_guid === a), c = new Set(e.map((s) => s.tag_guid)), _ = new Set(t);
671
672
  for (const s of t)
672
673
  c.has(s) || await this.addTagging(s, a);
673
674
  for (const s of e)
674
- l.has(s.tag_guid) || await this.removeTagging(s.guid);
675
+ _.has(s.tag_guid) || await this.removeTagging(s.guid);
675
676
  await this.loadTaggings();
676
677
  };
677
678
  updateTag = async (t) => {
@@ -679,13 +680,13 @@ class yt {
679
680
  };
680
681
  updateTransaction = async (t) => {
681
682
  const a = await this.api.updateTransaction(t), e = this.transactions.findIndex((c) => c.guid === t.guid);
682
- e >= 0 && (console.log("updateTransaction ran 2", e), d(
683
+ e >= 0 && d(
683
684
  () => this.rawTransactions = [
684
685
  ...this.transactions.slice(0, e),
685
686
  a,
686
687
  ...this.transactions.slice(e + 1)
687
688
  ]
688
- ));
689
+ );
689
690
  };
690
691
  }
691
692
  export {
@@ -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-Dv3n3lyT.mjs";
22
- import { S as Js } from "../TransactionStore-Dv3n3lyT.mjs";
21
+ import { T as at } from "../TransactionStore-BrRiXnH4.mjs";
22
+ import { S as Js } from "../TransactionStore-BrRiXnH4.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-dRfjqJ3s.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-Dv3n3lyT.mjs";
7
- import { T as Ea } from "../TransactionStore-Dv3n3lyT.mjs";
6
+ import { S as ae, D as Fe } from "../TransactionStore-BrRiXnH4.mjs";
7
+ import { T as Ea } from "../TransactionStore-BrRiXnH4.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";
@@ -37,7 +37,9 @@ export declare class TransactionStore {
37
37
  transactions?: Transaction[];
38
38
  }) => Promise<void>;
39
39
  subscribe: (listener: any) => () => void;
40
- getSnapshot: () => Transaction[];
40
+ getSnapshot: () => {
41
+ transactions: Transaction[];
42
+ }[];
41
43
  emitChange: () => void;
42
44
  get sortedTransactions(): Transaction[];
43
45
  get sortedTransactionsWithSplits(): Transaction[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.2.15-alpha.sms14",
3
+ "version": "7.2.15-alpha.sms16",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",