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

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.
@@ -28,7 +28,7 @@ const j = ({
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
  {
@@ -330,8 +330,8 @@ const j = ({
330
330
  ACCOUNT: "account",
331
331
  AMOUNT: "amount"
332
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;
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,24 +344,24 @@ 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
354
  isIncome: A.top_level_category_guid === W.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
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);
362
+ const s = tt(l, c, _), A = at(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
367
  }, tt = (l, t, a) => {
@@ -369,23 +369,23 @@ const j = ({
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 === J && 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, k(E, $)) || S(s, i.account) || S(s, `${i.amount}`) || S(s, i.memo) || I;
384
384
  });
385
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;
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);
@@ -418,7 +418,7 @@ 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
423
  endDate = X(/* @__PURE__ */ new Date());
424
424
  expandedSplits = [];
@@ -474,9 +474,10 @@ class mt {
474
474
  taggings = [];
475
475
  tags = [];
476
476
  transactionRules = [];
477
+ listeners = [];
477
478
  onAnalyticEvent = Z;
478
479
  constructor(t) {
479
- this.globalStore = t, this.uiStore = new it(), this.api = new p(
480
+ this.globalStore = t, this.uiStore = new st(), this.api = new p(
480
481
  t.endpoint,
481
482
  t.sessionToken,
482
483
  t.onError
@@ -498,6 +499,10 @@ 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 = () => this;
501
506
  get sortedTransactions() {
502
507
  return Q(
503
508
  this.filter,
@@ -617,11 +622,11 @@ class mt {
617
622
  };
618
623
  splitTransaction = async (t, a) => {
619
624
  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]);
625
+ for (let s = 0; s < a.length; s++) {
626
+ const A = await this.api.addTransaction(a[s]);
622
627
  c.push(A);
623
628
  }
624
- const _ = this.transactions.findIndex((i) => i.guid === t.guid);
629
+ const _ = this.transactions.findIndex((s) => s.guid === t.guid);
625
630
  _ >= 0 && d(
626
631
  () => this.rawTransactions = [
627
632
  ...this.transactions.slice(0, _),
@@ -632,14 +637,14 @@ class mt {
632
637
  );
633
638
  };
634
639
  unSplitTransaction = async (t) => {
635
- const a = this.transactions.filter((i) => i.parent_guid === t);
640
+ const a = this.transactions.filter((s) => s.parent_guid === t);
636
641
  await this.api.removeTransactionSplit(t);
637
642
  const e = [...this.transactions];
638
- a.forEach((i) => {
639
- const A = e.findIndex((s) => s.guid === i.guid);
643
+ a.forEach((s) => {
644
+ const A = e.findIndex((i) => i.guid === s.guid);
640
645
  A >= 0 && e.splice(A, 1);
641
646
  });
642
- const c = e.findIndex((i) => i.guid === t), _ = e[c];
647
+ const c = e.findIndex((s) => s.guid === t), _ = e[c];
643
648
  _.has_been_split = !1, c >= 0 && d(
644
649
  () => this.rawTransactions = [
645
650
  ...e.slice(0, c),
@@ -649,11 +654,11 @@ class mt {
649
654
  );
650
655
  };
651
656
  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);
657
+ const e = this.taggings.filter((s) => s.transaction_guid === a), c = new Set(e.map((s) => s.tag_guid)), _ = new Set(t);
658
+ for (const s of t)
659
+ c.has(s) || await this.addTagging(s, a);
660
+ for (const s of e)
661
+ _.has(s.tag_guid) || await this.removeTagging(s.guid);
657
662
  await this.loadTaggings();
658
663
  };
659
664
  updateTag = async (t) => {
@@ -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-DPdMpf5m.mjs";
22
+ import { S as Js } from "../TransactionStore-DPdMpf5m.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-DPdMpf5m.mjs";
7
+ import { T as Ea } from "../TransactionStore-DPdMpf5m.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: () => this;
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.sms5",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",