@mx-cartographer/experiences 7.2.15-alpha.sms21 → 7.2.15-alpha.sms23

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.
@@ -482,20 +482,15 @@ 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;
486
- return this.emitChange(), a;
485
+ const a = this.transactions, e = this.associatedBeats, c = this.taggings, _ = this.tags;
486
+ return this.emitChange(), {
487
+ transactions: a,
488
+ associatedBeats: e,
489
+ taggings: c,
490
+ tags: _
491
+ };
487
492
  });
488
493
  }
489
- // begin subscription for external library, ie Pulse
490
- subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
491
- this.listeners = this.listeners.filter((a) => a !== t);
492
- });
493
- getTransactionsSnapshot = () => this.transactions;
494
- emitChange = () => {
495
- for (const t of this.listeners)
496
- t();
497
- };
498
- // end subscription for external library, ie Pulse
499
494
  loadTransactionData = async ({
500
495
  associatedBeats: t,
501
496
  transactionRules: a,
@@ -512,6 +507,14 @@ class yt {
512
507
  this.uiStore.setIsInitialized(!0);
513
508
  });
514
509
  };
510
+ subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
511
+ this.listeners = this.listeners.filter((a) => a !== t);
512
+ });
513
+ getTransactionsSnapshot = () => this.transactions;
514
+ emitChange = () => {
515
+ for (const t of this.listeners)
516
+ t();
517
+ };
515
518
  get sortedTransactions() {
516
519
  return tt(
517
520
  this.filter,
@@ -18,8 +18,8 @@ import { C as Qs } from "../CurrencyInput-DUsQbkXb.mjs";
18
18
  import { L as Xs } from "../Loader-DUaFpDGv.mjs";
19
19
  import { R as Ks } from "../ResponsiveButton-DZFp78fJ.mjs";
20
20
  import { S as Zs } from "../SearchBox-B2_zLv8-.mjs";
21
- import { T as at } from "../TransactionStore-DjKt2XdF.mjs";
22
- import { S as tr } from "../TransactionStore-DjKt2XdF.mjs";
21
+ import { T as at } from "../TransactionStore-CdycC8sN.mjs";
22
+ import { S as tr } from "../TransactionStore-CdycC8sN.mjs";
23
23
  import { T as sr } from "../TabContentContainer-j01JYR_7.mjs";
24
24
  import { I as or } from "../IconBacking-B9oC6uL2.mjs";
25
25
  import { D as nr, F as ir, a as cr, c as dr, R as lr, S as ur } from "../RecurringTransactions-ej39mgA6.mjs";
@@ -1174,7 +1174,6 @@ class ts {
1174
1174
  sessionToken = "";
1175
1175
  onError;
1176
1176
  listeners = [];
1177
- // todo
1178
1177
  // Data Stores
1179
1178
  accountStore;
1180
1179
  appDataStore;
@@ -1203,16 +1202,23 @@ class ts {
1203
1202
  constructor(t = K, e = "/", r) {
1204
1203
  this.appConfig = t, this.endpoint = e, this.sessionToken = t.options.session_token ?? "", this.onError = r, this.accountStore = new yt(this), this.appDataStore = new ce(this), this.analyticsStore = new se(this), this.beatStore = new bt(this), this.budgetsStore = new re(this), this.cashflowStore = new nt(this), this.categoryStore = new et(this), this.connectStore = new de(this), this.copyStore = new ee(this), this.debtsStore = new Ct(this), this.finstrongStore = new vt(this), this.goalStore = new it(this), this.helpStore = new ne(this), this.holdingStore = new ie(this), this.merchantStore = new Bt(this), this.netWorthStore = new It(this), this.notificationStore = new st(this), this.recurringTransactionsStore = new mt(this), this.settingsStore = new Nt(this), this.transactionStore = new at(this), this.trendsStore = new ct(this), this.userStore = new ue(this), this.globalUiStore = new le(this), f(this), ft(() => {
1205
1204
  const o = this.transactionStore;
1206
- return this.emitChange(), o;
1205
+ return console.log("change happened"), this.emitChange(), {
1206
+ transactionStore: o
1207
+ };
1207
1208
  });
1208
1209
  }
1209
1210
  get isInitialized() {
1210
1211
  return this.globalUiStore.isInitialized;
1211
1212
  }
1213
+ // for external libraries like Pulse to subscribe
1214
+ // to global store snapshots, like `getTransactionStoreSnapshot` below
1215
+ // using `useSyncExternalStore` https://react.dev/reference/react/useSyncExternalStore
1212
1216
  subscribe = (t) => (this.listeners = [...this.listeners, t], () => {
1213
1217
  this.listeners = this.listeners.filter((e) => e !== t);
1214
1218
  });
1219
+ // returns change subscribed to in the autorun (found in the constructor)
1215
1220
  getTransactionStoreSnapshot = () => this.transactionStore;
1221
+ // emits change triggered in the autorun
1216
1222
  emitChange = () => {
1217
1223
  for (const t of this.listeners)
1218
1224
  t();
@@ -36,12 +36,13 @@ interface LoadDataProps {
36
36
  transactions?: Transaction[];
37
37
  userFeatures?: UserFeature[];
38
38
  }
39
+ type Listener = () => void;
39
40
  export declare class GlobalStore {
40
41
  appConfig: AppConfig;
41
42
  endpoint: string;
42
43
  sessionToken: string;
43
44
  onError?: GlobalErrorHandler;
44
- listeners: any[];
45
+ listeners: Listener[];
45
46
  accountStore: AccountStore;
46
47
  appDataStore: AppDataStore;
47
48
  analyticsStore: AnalyticsStore;
@@ -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-DjKt2XdF.mjs";
7
- import { T as Ea } from "../TransactionStore-DjKt2XdF.mjs";
6
+ import { S as ae, D as Fe } from "../TransactionStore-CdycC8sN.mjs";
7
+ import { T as Ea } from "../TransactionStore-CdycC8sN.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";
@@ -29,9 +29,6 @@ export declare class TransactionStore {
29
29
  listeners: any;
30
30
  onAnalyticEvent: (event: string, session: import('../analytics').AnalyticSession | null) => Promise<any>;
31
31
  constructor(globalStore: GlobalStore);
32
- subscribe: (listener: any) => () => void;
33
- getTransactionsSnapshot: () => Transaction[];
34
- emitChange: () => void;
35
32
  loadTransactionData: ({ associatedBeats, transactionRules, transactions, }?: {
36
33
  associatedBeats?: Beat[];
37
34
  taggings?: Tagging[];
@@ -39,6 +36,9 @@ export declare class TransactionStore {
39
36
  transactionRules?: TransactionRule[];
40
37
  transactions?: Transaction[];
41
38
  }) => Promise<void>;
39
+ subscribe: (listener: any) => () => void;
40
+ getTransactionsSnapshot: () => Transaction[];
41
+ emitChange: () => void;
42
42
  get sortedTransactions(): Transaction[];
43
43
  get sortedTransactionsWithSplits(): Transaction[];
44
44
  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.sms21",
3
+ "version": "7.2.15-alpha.sms23",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",