@mx-cartographer/experiences 9.7.2 → 9.7.4

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/common/constants/Analytics.d.ts +1 -0
  3. package/dist/common/constants/Analytics.es.js +2 -1
  4. package/dist/common/constants/Analytics.es.js.map +1 -1
  5. package/dist/common/context/hooks.d.ts +1 -0
  6. package/dist/common/context/hooks.es.js +30 -29
  7. package/dist/common/context/hooks.es.js.map +1 -1
  8. package/dist/common/context/index.d.ts +1 -1
  9. package/dist/common/index.es.js +140 -139
  10. package/dist/core/api/AgreementApi.d.ts +7 -0
  11. package/dist/core/api/AgreementApi.es.js +14 -0
  12. package/dist/core/api/AgreementApi.es.js.map +1 -0
  13. package/dist/core/api/index.d.ts +1 -0
  14. package/dist/core/constants/ApiEndpoints.d.ts +1 -0
  15. package/dist/core/constants/ApiEndpoints.es.js +1 -0
  16. package/dist/core/constants/ApiEndpoints.es.js.map +1 -1
  17. package/dist/core/index.es.js +92 -88
  18. package/dist/core/stores/AgreementStore.d.ts +12 -0
  19. package/dist/core/stores/AgreementStore.es.js +35 -0
  20. package/dist/core/stores/AgreementStore.es.js.map +1 -0
  21. package/dist/core/stores/GlobalStore.d.ts +2 -1
  22. package/dist/core/stores/GlobalStore.es.js +32 -30
  23. package/dist/core/stores/GlobalStore.es.js.map +1 -1
  24. package/dist/core/stores/GlobalUiStore.d.ts +1 -0
  25. package/dist/core/stores/GlobalUiStore.es.js +9 -4
  26. package/dist/core/stores/GlobalUiStore.es.js.map +1 -1
  27. package/dist/core/stores/UserStore.d.ts +2 -1
  28. package/dist/core/stores/UserStore.es.js +42 -29
  29. package/dist/core/stores/UserStore.es.js.map +1 -1
  30. package/dist/core/stores/index.d.ts +1 -0
  31. package/dist/core/types/Agreement.d.ts +6 -0
  32. package/dist/core/types/Insights.d.ts +1 -0
  33. package/dist/core/types/Insights.es.js.map +1 -1
  34. package/dist/core/types/User.d.ts +1 -0
  35. package/dist/core/types/index.d.ts +1 -0
  36. package/dist/core/types/localization/CommonCopy.d.ts +15 -0
  37. package/dist/dashboard/Dashboard.es.js +68 -36
  38. package/dist/dashboard/Dashboard.es.js.map +1 -1
  39. package/dist/dashboard/WelcomeDialog.d.ts +7 -0
  40. package/dist/dashboard/WelcomeDialog.es.js +281 -0
  41. package/dist/dashboard/WelcomeDialog.es.js.map +1 -0
  42. package/dist/dashboard/index.d.ts +2 -0
  43. package/dist/dashboard/index.es.js +4 -2
  44. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +77 -65
  45. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  46. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +8 -0
  47. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +93 -81
  48. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  49. package/dist/insights-v2/components/DirectDepositCard.es.js +4 -4
  50. package/dist/insights-v2/index.es.js +13 -13
  51. package/package.json +2 -1
@@ -10,130 +10,134 @@ import { TransactionStatus as W, TransactionType as k } from "./types/Transactio
10
10
  import { ScreenSize as w } from "./types/ScreenSize.es.js";
11
11
  import { Frequency as _, RecurrenceStatus as j, RecurrenceType as v, RepeatingType as J } from "./types/RepeatingTransaction.es.js";
12
12
  import { AccountApi as Q } from "./api/AccountApi.es.js";
13
- import { AnalyticsApi as Y } from "./api/AnalyticsApi.es.js";
14
- import { AppDataApi as $ } from "./api/AppDataApi.es.js";
15
- import { BannerApi as ro } from "./api/BannerApi.es.js";
16
- import { BeatApi as io } from "./api/BeatApi.es.js";
17
- import { BudgetsApi as eo } from "./api/BudgetsApi.es.js";
18
- import { CategoryApi as no } from "./api/CategoryApi.es.js";
19
- import { FinstrongApi as ao } from "./api/FinstrongApi.es.js";
20
- import { GlobalCopyApi as so } from "./api/GlobalCopyApi.es.js";
21
- import { GoalApi as Ao } from "./api/GoalApi.es.js";
22
- import { HelpApi as yo } from "./api/HelpApi.es.js";
23
- import { HoldingApi as lo } from "./api/HoldingApi.es.js";
24
- import { MerchantApi as Co } from "./api/MerchantApi.es.js";
25
- import { NotificationApi as ho } from "./api/NotificationApi.es.js";
26
- import { RepeatingTransactionsApi as Go } from "./api/RepeatingTransactionsApi.es.js";
27
- import { ScheduledPaymentsApi as Lo } from "./api/ScheduledPaymentsApi.es.js";
28
- import { SettingsApi as Eo } from "./api/SettingsApi.es.js";
29
- import { TransactionApi as Po } from "./api/TransactionApi.es.js";
30
- import { UserApi as Fo } from "./api/UserApi.es.js";
31
- import { WidgetApi as Mo } from "./api/WidgetApi.es.js";
32
- import { AccountStore as Vo } from "./stores/AccountStore.es.js";
33
- import { AppDataStore as Oo } from "./stores/AppDataStore.es.js";
34
- import { AnalyticsStore as ko } from "./stores/AnalyticsStore.es.js";
35
- import { BeatStore as wo } from "./stores/BeatStore.es.js";
36
- import { BudgetsStore as _o } from "./stores/BudgetsStore.es.js";
37
- import { CashflowStore as vo } from "./stores/CashflowStore.es.js";
38
- import { CategoryStore as Ko } from "./stores/CategoryStore.es.js";
39
- import { ConnectStore as Xo } from "./stores/ConnectStore.es.js";
40
- import { DebtsStore as Zo } from "./stores/DebtsStore.es.js";
41
- import { FinstrongStore as or } from "./stores/FinstrongStore.es.js";
42
- import { GlobalStore as tr } from "./stores/GlobalStore.es.js";
43
- import { GlobalUiStore as mr } from "./stores/GlobalUiStore.es.js";
44
- import { GlobalCopyStore as pr } from "./stores/GlobalCopyStore.es.js";
45
- import { GoalStore as fr } from "./stores/GoalStore.es.js";
46
- import { HelpStore as cr } from "./stores/HelpStore.es.js";
47
- import { HoldingStore as Sr } from "./stores/HoldingStore.es.js";
48
- import { InsightsV2Store as ur } from "./stores/InsightsV2Store.es.js";
49
- import { MerchantStore as Tr } from "./stores/MerchantStore.es.js";
50
- import { NetWorthStore as gr } from "./stores/NetWorthStore.es.js";
51
- import { NotificationStore as Cr } from "./stores/NotificationStore.es.js";
52
- import { RecurringTransactionsStore as hr } from "./stores/RecurringTransactionsStore.es.js";
53
- import { SettingsStore as Gr } from "./stores/SettingsStore.es.js";
54
- import { TransactionStore as Lr } from "./stores/TransactionStore.es.js";
55
- import { TrendsStore as Er } from "./stores/TrendsStore.es.js";
56
- import { UserStore as Pr } from "./stores/UserStore.es.js";
13
+ import { AgreementApi as Y } from "./api/AgreementApi.es.js";
14
+ import { AnalyticsApi as $ } from "./api/AnalyticsApi.es.js";
15
+ import { AppDataApi as ro } from "./api/AppDataApi.es.js";
16
+ import { BannerApi as io } from "./api/BannerApi.es.js";
17
+ import { BeatApi as eo } from "./api/BeatApi.es.js";
18
+ import { BudgetsApi as no } from "./api/BudgetsApi.es.js";
19
+ import { CategoryApi as ao } from "./api/CategoryApi.es.js";
20
+ import { FinstrongApi as so } from "./api/FinstrongApi.es.js";
21
+ import { GlobalCopyApi as Ao } from "./api/GlobalCopyApi.es.js";
22
+ import { GoalApi as yo } from "./api/GoalApi.es.js";
23
+ import { HelpApi as lo } from "./api/HelpApi.es.js";
24
+ import { HoldingApi as Co } from "./api/HoldingApi.es.js";
25
+ import { MerchantApi as ho } from "./api/MerchantApi.es.js";
26
+ import { NotificationApi as Go } from "./api/NotificationApi.es.js";
27
+ import { RepeatingTransactionsApi as Lo } from "./api/RepeatingTransactionsApi.es.js";
28
+ import { ScheduledPaymentsApi as Eo } from "./api/ScheduledPaymentsApi.es.js";
29
+ import { SettingsApi as Po } from "./api/SettingsApi.es.js";
30
+ import { TransactionApi as Fo } from "./api/TransactionApi.es.js";
31
+ import { UserApi as Mo } from "./api/UserApi.es.js";
32
+ import { WidgetApi as Vo } from "./api/WidgetApi.es.js";
33
+ import { AccountStore as Oo } from "./stores/AccountStore.es.js";
34
+ import { AgreementStore as ko } from "./stores/AgreementStore.es.js";
35
+ import { AppDataStore as wo } from "./stores/AppDataStore.es.js";
36
+ import { AnalyticsStore as _o } from "./stores/AnalyticsStore.es.js";
37
+ import { BeatStore as vo } from "./stores/BeatStore.es.js";
38
+ import { BudgetsStore as Ko } from "./stores/BudgetsStore.es.js";
39
+ import { CashflowStore as Xo } from "./stores/CashflowStore.es.js";
40
+ import { CategoryStore as Zo } from "./stores/CategoryStore.es.js";
41
+ import { ConnectStore as or } from "./stores/ConnectStore.es.js";
42
+ import { DebtsStore as tr } from "./stores/DebtsStore.es.js";
43
+ import { FinstrongStore as mr } from "./stores/FinstrongStore.es.js";
44
+ import { GlobalStore as pr } from "./stores/GlobalStore.es.js";
45
+ import { GlobalUiStore as fr } from "./stores/GlobalUiStore.es.js";
46
+ import { GlobalCopyStore as cr } from "./stores/GlobalCopyStore.es.js";
47
+ import { GoalStore as Sr } from "./stores/GoalStore.es.js";
48
+ import { HelpStore as ur } from "./stores/HelpStore.es.js";
49
+ import { HoldingStore as Tr } from "./stores/HoldingStore.es.js";
50
+ import { InsightsV2Store as gr } from "./stores/InsightsV2Store.es.js";
51
+ import { MerchantStore as Cr } from "./stores/MerchantStore.es.js";
52
+ import { NetWorthStore as hr } from "./stores/NetWorthStore.es.js";
53
+ import { NotificationStore as Gr } from "./stores/NotificationStore.es.js";
54
+ import { RecurringTransactionsStore as Lr } from "./stores/RecurringTransactionsStore.es.js";
55
+ import { SettingsStore as Er } from "./stores/SettingsStore.es.js";
56
+ import { TransactionStore as Pr } from "./stores/TransactionStore.es.js";
57
+ import { TrendsStore as Fr } from "./stores/TrendsStore.es.js";
58
+ import { UserStore as Mr } from "./stores/UserStore.es.js";
57
59
  export {
58
60
  Q as AccountApi,
59
61
  f as AccountIcon,
60
62
  a as AccountIconVariants,
61
63
  M as AccountNotificationTypes,
62
- Vo as AccountStore,
64
+ Oo as AccountStore,
63
65
  c as AccountSubType,
64
66
  s as AccountType,
65
67
  S as AccountTypeName,
66
- Y as AnalyticsApi,
67
- ko as AnalyticsStore,
68
- $ as AppDataApi,
69
- Oo as AppDataStore,
70
- ro as BannerApi,
71
- io as BeatApi,
72
- wo as BeatStore,
68
+ Y as AgreementApi,
69
+ ko as AgreementStore,
70
+ $ as AnalyticsApi,
71
+ _o as AnalyticsStore,
72
+ ro as AppDataApi,
73
+ wo as AppDataStore,
74
+ io as BannerApi,
75
+ eo as BeatApi,
76
+ vo as BeatStore,
73
77
  U as BudgetNotificationTypes,
74
- eo as BudgetsApi,
75
- _o as BudgetsStore,
76
- vo as CashflowStore,
77
- no as CategoryApi,
78
- Ko as CategoryStore,
79
- Xo as ConnectStore,
78
+ no as BudgetsApi,
79
+ Ko as BudgetsStore,
80
+ Xo as CashflowStore,
81
+ ao as CategoryApi,
82
+ Zo as CategoryStore,
83
+ or as ConnectStore,
80
84
  A as ConnectionStatus,
81
85
  u as ConnectionStatusEnums,
82
- Zo as DebtsStore,
86
+ tr as DebtsStore,
83
87
  y as ErrorStatuses,
84
88
  B as ExpenseStatus,
85
89
  p as Fetch,
86
- ao as FinstrongApi,
87
- or as FinstrongStore,
90
+ so as FinstrongApi,
91
+ mr as FinstrongStore,
88
92
  _ as Frequency,
89
- so as GlobalCopyApi,
90
- pr as GlobalCopyStore,
91
- tr as GlobalStore,
92
- mr as GlobalUiStore,
93
- Ao as GoalApi,
94
- fr as GoalStore,
93
+ Ao as GlobalCopyApi,
94
+ cr as GlobalCopyStore,
95
+ pr as GlobalStore,
96
+ fr as GlobalUiStore,
97
+ yo as GoalApi,
98
+ Sr as GoalStore,
95
99
  E as GoalType,
96
- yo as HelpApi,
97
- cr as HelpStore,
98
- lo as HoldingApi,
99
- Sr as HoldingStore,
100
+ lo as HelpApi,
101
+ ur as HelpStore,
102
+ Co as HoldingApi,
103
+ Tr as HoldingStore,
100
104
  V as InsightNotificationTypes,
101
- ur as InsightsV2Store,
105
+ gr as InsightsV2Store,
102
106
  r as LOCALES,
103
- Co as MerchantApi,
104
- Tr as MerchantStore,
107
+ ho as MerchantApi,
108
+ Cr as MerchantStore,
105
109
  I as MetaType,
106
110
  T as MfaStatuses,
107
- gr as NetWorthStore,
111
+ hr as NetWorthStore,
108
112
  l as NonConnectedStatuses,
109
- ho as NotificationApi,
110
- Cr as NotificationStore,
113
+ Go as NotificationApi,
114
+ Gr as NotificationStore,
111
115
  x as NotificationTypes,
112
116
  g as ProcessingStatuses,
113
117
  d as PropertyType,
114
118
  C as PropertyTypeName,
115
119
  j as RecurrenceStatus,
116
120
  v as RecurrenceType,
117
- hr as RecurringTransactionsStore,
118
- Go as RepeatingTransactionsApi,
121
+ Lr as RecurringTransactionsStore,
122
+ Lo as RepeatingTransactionsApi,
119
123
  J as RepeatingType,
120
124
  L as ScheduledPaymentTypes,
121
- Lo as ScheduledPaymentsApi,
125
+ Eo as ScheduledPaymentsApi,
122
126
  w as ScreenSize,
123
- Eo as SettingsApi,
124
- Gr as SettingsStore,
127
+ Po as SettingsApi,
128
+ Er as SettingsStore,
125
129
  N as StatusName,
126
130
  P as TrackType,
127
- Po as TransactionApi,
131
+ Fo as TransactionApi,
128
132
  W as TransactionStatus,
129
- Lr as TransactionStore,
133
+ Pr as TransactionStore,
130
134
  k as TransactionType,
131
- Er as TrendsStore,
132
- Fo as UserApi,
133
- Pr as UserStore,
135
+ Fr as TrendsStore,
136
+ Mo as UserApi,
137
+ Mr as UserStore,
134
138
  b as UserVerification,
135
139
  t as VALID_LOCALES,
136
- Mo as WidgetApi,
140
+ Vo as WidgetApi,
137
141
  i as buildDynamicCopy,
138
142
  m as getLocale,
139
143
  F as slot
@@ -0,0 +1,12 @@
1
+ import { AgreementApi } from '../api';
2
+ import { Agreement } from '../types';
3
+ import { GlobalStore } from './GlobalStore';
4
+ export declare class AgreementStore {
5
+ globalStore: GlobalStore;
6
+ api: AgreementApi;
7
+ agreement: Agreement;
8
+ isLoaded: boolean;
9
+ hasError: boolean;
10
+ constructor(globalStore: GlobalStore);
11
+ loadAgreement: () => Promise<void>;
12
+ }
@@ -0,0 +1,35 @@
1
+ import { AgreementApi as t } from "../api/AgreementApi.es.js";
2
+ import { makeAutoObservable as o, runInAction as r } from "mobx";
3
+ var i = class {
4
+ globalStore;
5
+ api;
6
+ agreement = {};
7
+ isLoaded = !1;
8
+ hasError = !1;
9
+ constructor(e) {
10
+ this.globalStore = e, this.api = new t(e.endpoint, e.sessionToken, e.onError), o(this);
11
+ }
12
+ loadAgreement = async () => {
13
+ r(() => {
14
+ this.hasError = !1;
15
+ });
16
+ try {
17
+ const e = await this.api.getAgreement();
18
+ r(() => {
19
+ this.agreement = e, this.isLoaded = !0;
20
+ });
21
+ } catch (e) {
22
+ this.globalStore.captureException(e, {
23
+ store: "AgreementStore",
24
+ action: "loadAgreement"
25
+ }), r(() => {
26
+ this.hasError = !0;
27
+ });
28
+ }
29
+ };
30
+ };
31
+ export {
32
+ i as AgreementStore
33
+ };
34
+
35
+ //# sourceMappingURL=AgreementStore.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementStore.es.js","names":[],"sources":["../../../src/core/stores/AgreementStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AgreementApi } from '../api'\nimport { Agreement } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AgreementStore {\n globalStore: GlobalStore\n api: AgreementApi\n\n agreement: Agreement = {} as Agreement\n isLoaded = false\n hasError = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new AgreementApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadAgreement = async () => {\n runInAction(() => {\n this.hasError = false\n })\n\n try {\n const agreement = await this.api.getAgreement()\n\n runInAction(() => {\n this.agreement = agreement\n this.isLoaded = true\n })\n } catch (error) {\n this.globalStore.captureException(error, { store: 'AgreementStore', action: 'loadAgreement' })\n\n runInAction(() => {\n this.hasError = true\n })\n }\n }\n}\n"],"mappings":";;AAOA,IAAa,IAAb,MAA4B;AAAA,EAC1B;AAAA,EACA;AAAA,EAEA,YAAuB,CAAC;AAAA,EACxB,WAAW;AAAA,EACX,WAAW;AAAA,EAEX,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAa,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE/F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,gBAAgB,YAAY;AAC1B,IAAA,EAAA,MAAkB;AAChB,WAAK,WAAW;AAAA,IAClB,CAAC;AAED,QAAI;AACF,YAAM,IAAY,MAAM,KAAK,IAAI,aAAa;AAE9C,MAAA,EAAA,MAAkB;AAChB,aAAK,YAAY,GACjB,KAAK,WAAW;AAAA,MAClB,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,YAAY,iBAAiB,GAAO;AAAA,QAAE,OAAO;AAAA,QAAkB,QAAQ;AAAA,MAAgB,CAAC,GAE7F,EAAA,MAAkB;AAChB,aAAK,WAAW;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { AccountStore, AnalyticsStore, AppDataStore, BeatStore, BudgetsStore, CashflowStore, CategoryStore, ConnectStore, DebtsStore, FinstrongStore, GlobalCopyStore, GlobalUiStore, GoalStore, HelpStore, HoldingStore, InsightsV2Store, MerchantStore, NetWorthStore, NotificationStore, RecurringTransactionsStore, SettingsStore, TransactionStore, TrendsStore, UserStore } from '../stores';
1
+ import { AccountStore, AgreementStore, AnalyticsStore, AppDataStore, BeatStore, BudgetsStore, CashflowStore, CategoryStore, ConnectStore, DebtsStore, FinstrongStore, GlobalCopyStore, GlobalUiStore, GoalStore, HelpStore, HoldingStore, InsightsV2Store, MerchantStore, NetWorthStore, NotificationStore, RecurringTransactionsStore, SettingsStore, TransactionStore, TrendsStore, UserStore } from '../stores';
2
2
  import { Account, Category, Institution, Member, AppConfig, AppData, Beat, GlobalCaptureException, GlobalErrorHandler, MerchantBudget, Tag, Tagging, Transaction, TransactionRule, UserFeature } from '../types';
3
3
  interface LoadDataProps {
4
4
  accounts?: Account[];
@@ -32,6 +32,7 @@ export declare class GlobalStore {
32
32
  onError?: GlobalErrorHandler;
33
33
  onStoreUpdate?: OnStoreUpdate;
34
34
  accountStore: AccountStore;
35
+ agreementStore: AgreementStore;
35
36
  appDataStore: AppDataStore;
36
37
  analyticsStore: AnalyticsStore;
37
38
  beatStore: BeatStore;
@@ -1,37 +1,39 @@
1
1
  import { AccountStore as p } from "./AccountStore.es.js";
2
+ import { AgreementStore as m } from "./AgreementStore.es.js";
2
3
  import { AppDataStore as c } from "./AppDataStore.es.js";
3
- import { AnalyticsStore as m } from "./AnalyticsStore.es.js";
4
- import { BeatStore as f } from "./BeatStore.es.js";
5
- import { BudgetsStore as l } from "./BudgetsStore.es.js";
6
- import { CashflowStore as g } from "./CashflowStore.es.js";
7
- import { CategoryStore as w } from "./CategoryStore.es.js";
8
- import { ConnectStore as d } from "./ConnectStore.es.js";
9
- import { DebtsStore as u } from "./DebtsStore.es.js";
10
- import { FinstrongStore as b } from "./FinstrongStore.es.js";
11
- import { DefaultAppConfig as S } from "../constants/DefaultConfig.es.js";
12
- import { GlobalUiStore as y } from "./GlobalUiStore.es.js";
13
- import { GlobalCopyStore as C } from "./GlobalCopyStore.es.js";
14
- import { GoalStore as U } from "./GoalStore.es.js";
4
+ import { AnalyticsStore as f } from "./AnalyticsStore.es.js";
5
+ import { BeatStore as l } from "./BeatStore.es.js";
6
+ import { BudgetsStore as g } from "./BudgetsStore.es.js";
7
+ import { CashflowStore as w } from "./CashflowStore.es.js";
8
+ import { CategoryStore as d } from "./CategoryStore.es.js";
9
+ import { ConnectStore as u } from "./ConnectStore.es.js";
10
+ import { DebtsStore as b } from "./DebtsStore.es.js";
11
+ import { FinstrongStore as y } from "./FinstrongStore.es.js";
12
+ import { DefaultAppConfig as h } from "../constants/DefaultConfig.es.js";
13
+ import { GlobalUiStore as C } from "./GlobalUiStore.es.js";
14
+ import { GlobalCopyStore as U } from "./GlobalCopyStore.es.js";
15
+ import { GoalStore as A } from "./GoalStore.es.js";
15
16
  import { HelpStore as D } from "./HelpStore.es.js";
16
- import { HoldingStore as A } from "./HoldingStore.es.js";
17
- import { InsightsV2Store as T } from "./InsightsV2Store.es.js";
18
- import { MerchantStore as E } from "./MerchantStore.es.js";
19
- import { NetWorthStore as x } from "./NetWorthStore.es.js";
20
- import { NotificationStore as k } from "./NotificationStore.es.js";
21
- import { RecurringTransactionsStore as G } from "./RecurringTransactionsStore.es.js";
22
- import { SettingsStore as I } from "./SettingsStore.es.js";
23
- import { TransactionStore as M } from "./TransactionStore.es.js";
24
- import { TrendsStore as V } from "./TrendsStore.es.js";
25
- import { UserStore as W } from "./UserStore.es.js";
26
- import { autorun as v, makeAutoObservable as z } from "mobx";
27
- var ht = class {
28
- appConfig = S;
17
+ import { HoldingStore as T } from "./HoldingStore.es.js";
18
+ import { InsightsV2Store as E } from "./InsightsV2Store.es.js";
19
+ import { MerchantStore as x } from "./MerchantStore.es.js";
20
+ import { NetWorthStore as k } from "./NetWorthStore.es.js";
21
+ import { NotificationStore as G } from "./NotificationStore.es.js";
22
+ import { RecurringTransactionsStore as I } from "./RecurringTransactionsStore.es.js";
23
+ import { SettingsStore as M } from "./SettingsStore.es.js";
24
+ import { TransactionStore as V } from "./TransactionStore.es.js";
25
+ import { TrendsStore as W } from "./TrendsStore.es.js";
26
+ import { UserStore as v } from "./UserStore.es.js";
27
+ import { autorun as z, makeAutoObservable as B } from "mobx";
28
+ var pt = class {
29
+ appConfig = h;
29
30
  endpoint = "/";
30
31
  sessionToken = "";
31
32
  onCaptureException;
32
33
  onError;
33
34
  onStoreUpdate;
34
35
  accountStore;
36
+ agreementStore;
35
37
  appDataStore;
36
38
  analyticsStore;
37
39
  beatStore;
@@ -55,8 +57,8 @@ var ht = class {
55
57
  userStore;
56
58
  globalUiStore;
57
59
  insightsV2Store;
58
- constructor(t = S, o = "/", r, e, i) {
59
- this.appConfig = t, this.endpoint = o, this.sessionToken = t.options.session_token ?? "", this.onCaptureException = i, this.onError = r, this.onStoreUpdate = e, this.accountStore = new p(this), this.appDataStore = new c(this), this.analyticsStore = new m(this), this.beatStore = new f(this), this.budgetsStore = new l(this), this.cashflowStore = new g(this), this.categoryStore = new w(this), this.connectStore = new d(this), this.copyStore = new C(this), this.debtsStore = new u(this), this.finstrongStore = new b(this), this.goalStore = new U(this), this.helpStore = new D(this), this.holdingStore = new A(this), this.merchantStore = new E(this), this.netWorthStore = new x(this), this.notificationStore = new k(this), this.recurringTransactionsStore = new G(this), this.settingsStore = new I(this), this.transactionStore = new M(this), this.trendsStore = new V(this), this.userStore = new W(this), this.globalUiStore = new y(this), this.insightsV2Store = new T(this), z(this), v(() => {
60
+ constructor(t = h, o = "/", e, r, i) {
61
+ this.appConfig = t, this.endpoint = o, this.sessionToken = t.options.session_token ?? "", this.onCaptureException = i, this.onError = e, this.onStoreUpdate = r, this.accountStore = new p(this), this.agreementStore = new m(this), this.appDataStore = new c(this), this.analyticsStore = new f(this), this.beatStore = new l(this), this.budgetsStore = new g(this), this.cashflowStore = new w(this), this.categoryStore = new d(this), this.connectStore = new u(this), this.copyStore = new U(this), this.debtsStore = new b(this), this.finstrongStore = new y(this), this.goalStore = new A(this), this.helpStore = new D(this), this.holdingStore = new T(this), this.merchantStore = new x(this), this.netWorthStore = new k(this), this.notificationStore = new G(this), this.recurringTransactionsStore = new I(this), this.settingsStore = new M(this), this.transactionStore = new V(this), this.trendsStore = new W(this), this.userStore = new v(this), this.globalUiStore = new C(this), this.insightsV2Store = new E(this), B(this), z(() => {
60
62
  const { transactions: s } = this.transactionStore;
61
63
  this.emitUpdate({ transactions: s });
62
64
  });
@@ -82,12 +84,12 @@ var ht = class {
82
84
  this.userStore.loadUserFeatures()
83
85
  ]);
84
86
  };
85
- loadData = async ({ accounts: t, appData: o, associatedBeats: r, categories: e, institutions: i, transactionRules: s, transactions: a, userFeatures: n, merchantBudgets: h } = {}) => {
86
- (!o || !n) && await this.loadConfigData(), o && this.appDataStore.setAppData(o), n && this.userStore.setUserFeatures(n), t && (await this.accountStore.loadMembers(), i && this.accountStore.setInstitutions(i), this.accountStore.setAccounts(t)), r && this.transactionStore.setAssociatedBeats(r), e && this.categoryStore.setCategories(e), a && this.transactionStore.setTransactions(a), s && this.transactionStore.setTransactionRules(s), h && this.budgetsStore.setMerchantBudgets(h);
87
+ loadData = async ({ accounts: t, appData: o, associatedBeats: e, categories: r, institutions: i, transactionRules: s, transactions: a, userFeatures: n, merchantBudgets: S } = {}) => {
88
+ (!o || !n) && await this.loadConfigData(), o && this.appDataStore.setAppData(o), n && this.userStore.setUserFeatures(n), t && (await this.accountStore.loadMembers(), i && this.accountStore.setInstitutions(i), this.accountStore.setAccounts(t)), e && this.transactionStore.setAssociatedBeats(e), r && this.categoryStore.setCategories(r), a && this.transactionStore.setTransactions(a), s && this.transactionStore.setTransactionRules(s), S && this.budgetsStore.setMerchantBudgets(S);
87
89
  };
88
90
  };
89
91
  export {
90
- ht as GlobalStore
92
+ pt as GlobalStore
91
93
  };
92
94
 
93
95
  //# sourceMappingURL=GlobalStore.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalStore.ts"],"sourcesContent":["import { autorun, makeAutoObservable } from 'mobx'\n\nimport { DefaultAppConfig } from '../constants/DefaultConfig'\n\nimport {\n AccountStore,\n AnalyticsStore,\n AppDataStore,\n BeatStore,\n BudgetsStore,\n CashflowStore,\n CategoryStore,\n ConnectStore,\n DebtsStore,\n FinstrongStore,\n GlobalCopyStore,\n GlobalUiStore,\n GoalStore,\n HelpStore,\n HoldingStore,\n InsightsV2Store,\n MerchantStore,\n NetWorthStore,\n NotificationStore,\n RecurringTransactionsStore,\n SettingsStore,\n TransactionStore,\n TrendsStore,\n UserStore,\n} from '../stores'\n\nimport type {\n Account,\n Category,\n Institution,\n Member,\n AppConfig,\n AppData,\n Beat,\n GlobalCaptureException,\n GlobalErrorHandler,\n MerchantBudget,\n Tag,\n Tagging,\n Transaction,\n TransactionRule,\n UserFeature,\n} from '../types'\n\ninterface LoadDataProps {\n accounts?: Account[]\n appData?: AppData\n associatedBeats?: Beat[]\n categories?: Category[]\n institutions?: Institution[]\n members?: Member[]\n merchantBudgets?: MerchantBudget[]\n taggings?: Tagging[]\n tags?: Tag[]\n transactionRules?: TransactionRule[]\n transactions?: Transaction[]\n userFeatures?: UserFeature[]\n}\n\ntype OnStoreUpdate = (update: ObservedUpdate) => void\nexport type ObservedUpdate = {\n transactions?: Transaction[]\n /**\n * Guid of a beat whose data went stale because of an action taken inside experiences\n * (e.g. an insight CTA that mutated data). Hosts refetch that beat's sampled data.\n * Emitted only from explicit actions, never from the transactions autorun.\n */\n staleBeatGuid?: string\n}\nexport class GlobalStore {\n // Global properties\n appConfig: AppConfig = DefaultAppConfig\n endpoint: string = '/'\n sessionToken: string = ''\n onCaptureException?: GlobalCaptureException\n onError?: GlobalErrorHandler\n onStoreUpdate?: OnStoreUpdate\n\n // Data Stores\n accountStore: AccountStore\n appDataStore: AppDataStore\n analyticsStore: AnalyticsStore\n beatStore: BeatStore\n budgetsStore: BudgetsStore\n cashflowStore: CashflowStore\n categoryStore: CategoryStore\n connectStore: ConnectStore\n copyStore: GlobalCopyStore\n debtsStore: DebtsStore\n finstrongStore: FinstrongStore\n goalStore: GoalStore\n helpStore: HelpStore\n holdingStore: HoldingStore\n merchantStore: MerchantStore\n netWorthStore: NetWorthStore\n notificationStore: NotificationStore\n recurringTransactionsStore: RecurringTransactionsStore\n settingsStore: SettingsStore\n transactionStore: TransactionStore\n trendsStore: TrendsStore\n userStore: UserStore\n\n // UI Stores\n globalUiStore: GlobalUiStore\n insightsV2Store: InsightsV2Store\n\n constructor(\n appConfig: AppConfig = DefaultAppConfig,\n endpoint: string = '/',\n onError?: GlobalErrorHandler,\n onStoreUpdate?: OnStoreUpdate,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.appConfig = appConfig\n this.endpoint = endpoint\n this.sessionToken = appConfig.options.session_token ?? ''\n this.onCaptureException = onCaptureException\n this.onError = onError\n this.onStoreUpdate = onStoreUpdate\n\n this.accountStore = new AccountStore(this)\n this.appDataStore = new AppDataStore(this)\n this.analyticsStore = new AnalyticsStore(this)\n this.beatStore = new BeatStore(this)\n this.budgetsStore = new BudgetsStore(this)\n this.cashflowStore = new CashflowStore(this)\n this.categoryStore = new CategoryStore(this)\n this.connectStore = new ConnectStore(this)\n this.copyStore = new GlobalCopyStore(this)\n this.debtsStore = new DebtsStore(this)\n this.finstrongStore = new FinstrongStore(this)\n this.goalStore = new GoalStore(this)\n this.helpStore = new HelpStore(this)\n this.holdingStore = new HoldingStore(this)\n this.merchantStore = new MerchantStore(this)\n this.netWorthStore = new NetWorthStore(this)\n this.notificationStore = new NotificationStore(this)\n this.recurringTransactionsStore = new RecurringTransactionsStore(this)\n this.settingsStore = new SettingsStore(this)\n this.transactionStore = new TransactionStore(this)\n this.trendsStore = new TrendsStore(this)\n this.userStore = new UserStore(this)\n\n this.globalUiStore = new GlobalUiStore(this)\n this.insightsV2Store = new InsightsV2Store(this)\n\n makeAutoObservable(this)\n\n // detects a change based on an observed value\n autorun(() => {\n // destructure or assign new variables to observe changes to them\n // in this case we are observing changes to `transactions`\n const { transactions } = this.transactionStore\n this.emitUpdate({\n transactions,\n })\n })\n }\n\n get isInitialized() {\n return this.globalUiStore.isInitialized\n }\n\n captureException = (error: unknown, context?: Record<string, string>) => {\n if (this.onCaptureException) {\n this.onCaptureException(error, context)\n return\n }\n console.error('Unreported error:', error, context)\n }\n\n // emits change triggered in the autorun\n emitUpdate = (change: ObservedUpdate) => {\n this.onStoreUpdate?.(change)\n }\n\n loadConfigData = async () => {\n await Promise.all([\n // Load copy, config and user data\n this.copyStore.loadCopy(),\n this.appDataStore.loadAppData(),\n this.accountStore.refreshMembers(),\n this.userStore.loadUserFeatures(),\n ])\n }\n\n loadData = async ({\n accounts,\n appData,\n associatedBeats,\n categories,\n institutions,\n transactionRules,\n transactions,\n userFeatures,\n merchantBudgets,\n }: LoadDataProps = {}) => {\n if (!appData || !userFeatures) {\n await this.loadConfigData()\n }\n\n // Keep for backwards compatibility for Insights\n if (appData) {\n this.appDataStore.setAppData(appData)\n }\n\n if (userFeatures) {\n this.userStore.setUserFeatures(userFeatures)\n }\n\n if (accounts) {\n await this.accountStore.loadMembers()\n if (institutions) {\n this.accountStore.setInstitutions(institutions)\n }\n this.accountStore.setAccounts(accounts)\n }\n\n if (associatedBeats) {\n this.transactionStore.setAssociatedBeats(associatedBeats)\n }\n\n if (categories) {\n this.categoryStore.setCategories(categories)\n }\n\n if (transactions) {\n this.transactionStore.setTransactions(transactions)\n }\n\n if (transactionRules) {\n this.transactionStore.setTransactionRules(transactionRules)\n }\n\n if (merchantBudgets) {\n this.budgetsStore.setMerchantBudgets(merchantBudgets)\n }\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"GlobalStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalStore.ts"],"sourcesContent":["import { autorun, makeAutoObservable } from 'mobx'\n\nimport { DefaultAppConfig } from '../constants/DefaultConfig'\n\nimport {\n AccountStore,\n AgreementStore,\n AnalyticsStore,\n AppDataStore,\n BeatStore,\n BudgetsStore,\n CashflowStore,\n CategoryStore,\n ConnectStore,\n DebtsStore,\n FinstrongStore,\n GlobalCopyStore,\n GlobalUiStore,\n GoalStore,\n HelpStore,\n HoldingStore,\n InsightsV2Store,\n MerchantStore,\n NetWorthStore,\n NotificationStore,\n RecurringTransactionsStore,\n SettingsStore,\n TransactionStore,\n TrendsStore,\n UserStore,\n} from '../stores'\n\nimport type {\n Account,\n Category,\n Institution,\n Member,\n AppConfig,\n AppData,\n Beat,\n GlobalCaptureException,\n GlobalErrorHandler,\n MerchantBudget,\n Tag,\n Tagging,\n Transaction,\n TransactionRule,\n UserFeature,\n} from '../types'\n\ninterface LoadDataProps {\n accounts?: Account[]\n appData?: AppData\n associatedBeats?: Beat[]\n categories?: Category[]\n institutions?: Institution[]\n members?: Member[]\n merchantBudgets?: MerchantBudget[]\n taggings?: Tagging[]\n tags?: Tag[]\n transactionRules?: TransactionRule[]\n transactions?: Transaction[]\n userFeatures?: UserFeature[]\n}\n\ntype OnStoreUpdate = (update: ObservedUpdate) => void\nexport type ObservedUpdate = {\n transactions?: Transaction[]\n /**\n * Guid of a beat whose data went stale because of an action taken inside experiences\n * (e.g. an insight CTA that mutated data). Hosts refetch that beat's sampled data.\n * Emitted only from explicit actions, never from the transactions autorun.\n */\n staleBeatGuid?: string\n}\nexport class GlobalStore {\n // Global properties\n appConfig: AppConfig = DefaultAppConfig\n endpoint: string = '/'\n sessionToken: string = ''\n onCaptureException?: GlobalCaptureException\n onError?: GlobalErrorHandler\n onStoreUpdate?: OnStoreUpdate\n\n // Data Stores\n accountStore: AccountStore\n agreementStore: AgreementStore\n appDataStore: AppDataStore\n analyticsStore: AnalyticsStore\n beatStore: BeatStore\n budgetsStore: BudgetsStore\n cashflowStore: CashflowStore\n categoryStore: CategoryStore\n connectStore: ConnectStore\n copyStore: GlobalCopyStore\n debtsStore: DebtsStore\n finstrongStore: FinstrongStore\n goalStore: GoalStore\n helpStore: HelpStore\n holdingStore: HoldingStore\n merchantStore: MerchantStore\n netWorthStore: NetWorthStore\n notificationStore: NotificationStore\n recurringTransactionsStore: RecurringTransactionsStore\n settingsStore: SettingsStore\n transactionStore: TransactionStore\n trendsStore: TrendsStore\n userStore: UserStore\n\n // UI Stores\n globalUiStore: GlobalUiStore\n insightsV2Store: InsightsV2Store\n\n constructor(\n appConfig: AppConfig = DefaultAppConfig,\n endpoint: string = '/',\n onError?: GlobalErrorHandler,\n onStoreUpdate?: OnStoreUpdate,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.appConfig = appConfig\n this.endpoint = endpoint\n this.sessionToken = appConfig.options.session_token ?? ''\n this.onCaptureException = onCaptureException\n this.onError = onError\n this.onStoreUpdate = onStoreUpdate\n\n this.accountStore = new AccountStore(this)\n this.agreementStore = new AgreementStore(this)\n this.appDataStore = new AppDataStore(this)\n this.analyticsStore = new AnalyticsStore(this)\n this.beatStore = new BeatStore(this)\n this.budgetsStore = new BudgetsStore(this)\n this.cashflowStore = new CashflowStore(this)\n this.categoryStore = new CategoryStore(this)\n this.connectStore = new ConnectStore(this)\n this.copyStore = new GlobalCopyStore(this)\n this.debtsStore = new DebtsStore(this)\n this.finstrongStore = new FinstrongStore(this)\n this.goalStore = new GoalStore(this)\n this.helpStore = new HelpStore(this)\n this.holdingStore = new HoldingStore(this)\n this.merchantStore = new MerchantStore(this)\n this.netWorthStore = new NetWorthStore(this)\n this.notificationStore = new NotificationStore(this)\n this.recurringTransactionsStore = new RecurringTransactionsStore(this)\n this.settingsStore = new SettingsStore(this)\n this.transactionStore = new TransactionStore(this)\n this.trendsStore = new TrendsStore(this)\n this.userStore = new UserStore(this)\n\n this.globalUiStore = new GlobalUiStore(this)\n this.insightsV2Store = new InsightsV2Store(this)\n\n makeAutoObservable(this)\n\n // detects a change based on an observed value\n autorun(() => {\n // destructure or assign new variables to observe changes to them\n // in this case we are observing changes to `transactions`\n const { transactions } = this.transactionStore\n this.emitUpdate({\n transactions,\n })\n })\n }\n\n get isInitialized() {\n return this.globalUiStore.isInitialized\n }\n\n captureException = (error: unknown, context?: Record<string, string>) => {\n if (this.onCaptureException) {\n this.onCaptureException(error, context)\n return\n }\n console.error('Unreported error:', error, context)\n }\n\n // emits change triggered in the autorun\n emitUpdate = (change: ObservedUpdate) => {\n this.onStoreUpdate?.(change)\n }\n\n loadConfigData = async () => {\n await Promise.all([\n // Load copy, config and user data\n this.copyStore.loadCopy(),\n this.appDataStore.loadAppData(),\n this.accountStore.refreshMembers(),\n this.userStore.loadUserFeatures(),\n ])\n }\n\n loadData = async ({\n accounts,\n appData,\n associatedBeats,\n categories,\n institutions,\n transactionRules,\n transactions,\n userFeatures,\n merchantBudgets,\n }: LoadDataProps = {}) => {\n if (!appData || !userFeatures) {\n await this.loadConfigData()\n }\n\n // Keep for backwards compatibility for Insights\n if (appData) {\n this.appDataStore.setAppData(appData)\n }\n\n if (userFeatures) {\n this.userStore.setUserFeatures(userFeatures)\n }\n\n if (accounts) {\n await this.accountStore.loadMembers()\n if (institutions) {\n this.accountStore.setInstitutions(institutions)\n }\n this.accountStore.setAccounts(accounts)\n }\n\n if (associatedBeats) {\n this.transactionStore.setAssociatedBeats(associatedBeats)\n }\n\n if (categories) {\n this.categoryStore.setCategories(categories)\n }\n\n if (transactions) {\n this.transactionStore.setTransactions(transactions)\n }\n\n if (transactionRules) {\n this.transactionStore.setTransactionRules(transactionRules)\n }\n\n if (merchantBudgets) {\n this.budgetsStore.setMerchantBudgets(merchantBudgets)\n }\n }\n}\n"],"mappings":"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"}
@@ -16,6 +16,7 @@ export declare class GlobalUiStore {
16
16
  get isConfigLoaded(): boolean;
17
17
  get areUserFeaturesLoaded(): boolean;
18
18
  get isInitialized(): boolean;
19
+ get shouldShowWelcomeDialog(): boolean;
19
20
  populateAccountFilterMap: (accounts: Account[]) => void;
20
21
  resetAccountFilterMap: () => void;
21
22
  updateAccountFilterMap: (guid: string, isIncluded: boolean) => void;
@@ -1,6 +1,6 @@
1
1
  import { addMonths as o } from "date-fns/addMonths";
2
- import { endOfMonth as i } from "date-fns/endOfMonth";
3
- import { startOfMonth as s } from "date-fns/startOfMonth";
2
+ import { endOfMonth as s } from "date-fns/endOfMonth";
3
+ import { startOfMonth as i } from "date-fns/startOfMonth";
4
4
  import { makeAutoObservable as r, reaction as l } from "mobx";
5
5
  import { getMonth as a } from "date-fns/getMonth";
6
6
  var h = class {
@@ -8,8 +8,8 @@ var h = class {
8
8
  accountFilterMap = /* @__PURE__ */ new Map();
9
9
  displayedDate = /* @__PURE__ */ new Date();
10
10
  displayedDateRange = {
11
- start: s(this.displayedDate),
12
- end: i(this.displayedDate)
11
+ start: i(this.displayedDate),
12
+ end: s(this.displayedDate)
13
13
  };
14
14
  constructor(t) {
15
15
  r(this), this.globalStore = t, l(() => this.globalStore.accountStore.visibleAccounts, (e) => {
@@ -37,6 +37,11 @@ var h = class {
37
37
  get isInitialized() {
38
38
  return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded;
39
39
  }
40
+ get shouldShowWelcomeDialog() {
41
+ if (!this.isInitialized) return !1;
42
+ const { config: t } = this.globalStore.appDataStore.appConfig, e = this.globalStore.appDataStore.user;
43
+ return !!(t.display_terms_and_conditions && e && !e.has_accepted_terms);
44
+ }
40
45
  populateAccountFilterMap = (t) => {
41
46
  t && t.forEach((e) => {
42
47
  this.accountFilterMap.set(e.guid, !e.is_excluded_from_accounts);
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalUiStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalUiStore.ts"],"sourcesContent":["import { makeAutoObservable, reaction } from 'mobx'\n\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { getMonth } from 'date-fns/getMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport { Account } from '../types'\n\nimport type { GlobalStore } from './GlobalStore'\n\nexport class GlobalUiStore {\n globalStore: GlobalStore\n\n accountFilterMap: Map<string, boolean> = new Map()\n\n displayedDate = new Date()\n displayedDateRange = {\n start: startOfMonth(this.displayedDate),\n end: endOfMonth(this.displayedDate),\n }\n\n constructor(globalStore: GlobalStore) {\n makeAutoObservable(this)\n this.globalStore = globalStore\n\n reaction(\n () => this.globalStore.accountStore.visibleAccounts,\n (visibleAccounts) => {\n this.populateAccountFilterMap(visibleAccounts)\n },\n )\n }\n\n get allSelectedAccounts() {\n return this.globalStore.accountStore.detailedAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccounts() {\n return this.globalStore.accountStore.visibleAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccountGuids() {\n return this.selectedAccounts.map((account) => account.guid)\n }\n\n get isCopyLoaded() {\n return this.globalStore.copyStore.isInitialized\n }\n\n get isConfigLoaded() {\n return this.globalStore.appDataStore.isAppDataLoaded\n }\n\n get areUserFeaturesLoaded() {\n return this.globalStore.userStore.userFeaturesLoaded\n }\n\n get isInitialized() {\n return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded\n }\n\n populateAccountFilterMap = (accounts: Account[]) => {\n if (accounts) {\n accounts.forEach((account) => {\n this.accountFilterMap.set(account.guid, !account.is_excluded_from_accounts)\n })\n }\n }\n\n resetAccountFilterMap = () => {\n this.accountFilterMap.clear()\n this.populateAccountFilterMap(this.globalStore.accountStore.visibleAccounts)\n }\n\n updateAccountFilterMap = (guid: string, isIncluded: boolean) => {\n this.accountFilterMap.set(guid, isIncluded)\n }\n\n setDisplayedDate = (startDate: Date, endDate: Date) => {\n this.displayedDate = endDate\n this.displayedDateRange = {\n start: startDate,\n end: endDate,\n }\n }\n\n get shouldDisableNextDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const nextMonth = getMonth(addMonths(new Date(), 1))\n\n return selectedMonth === nextMonth\n }\n\n get shouldDisablePrevDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const currentMonth = getMonth(new Date())\n\n return selectedMonth === currentMonth\n }\n}\n"],"mappings":";;;;;AAWA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EAEA,mBAAyC,oBAAI,IAAI;AAAA,EAEjD,gBAAgB,oBAAI,KAAK;AAAA,EACzB,qBAAqB;AAAA,IACnB,OAAO,EAAa,KAAK,aAAa;AAAA,IACtC,KAAK,EAAW,KAAK,aAAa;AAAA,EACpC;AAAA,EAEA,YAAY,GAA0B;AACpC,IAAA,EAAmB,IAAI,GACvB,KAAK,cAAc,GAEnB,EAAA,MACQ,KAAK,YAAY,aAAa,iBAAA,CACnC,MAAoB;AACnB,WAAK,yBAAyB,CAAe;AAAA,IAC/C,CACF;AAAA,EACF;AAAA,EAEA,IAAI,sBAAsB;AACxB,WAAO,KAAK,YAAY,aAAa,iBAAiB,OAAA,CACnD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK,YAAY,aAAa,gBAAgB,OAAA,CAClD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,uBAAuB;AACzB,WAAO,KAAK,iBAAiB,IAAA,CAAK,MAAY,EAAQ,IAAI;AAAA,EAC5D;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,iBAAiB;AACnB,WAAO,KAAK,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,IAAI,wBAAwB;AAC1B,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,KAAK,gBAAgB,KAAK,kBAAkB,KAAK;AAAA,EAC1D;AAAA,EAEA,2BAAA,CAA4B,MAAwB;AAClD,IAAI,KACF,EAAS,QAAA,CAAS,MAAY;AAC5B,WAAK,iBAAiB,IAAI,EAAQ,MAAM,CAAC,EAAQ,yBAAyB;AAAA,IAC5E,CAAC;AAAA,EAEL;AAAA,EAEA,wBAAA,MAA8B;AAC5B,SAAK,iBAAiB,MAAM,GAC5B,KAAK,yBAAyB,KAAK,YAAY,aAAa,eAAe;AAAA,EAC7E;AAAA,EAEA,yBAAA,CAA0B,GAAc,MAAwB;AAC9D,SAAK,iBAAiB,IAAI,GAAM,CAAU;AAAA,EAC5C;AAAA,EAEA,mBAAA,CAAoB,GAAiB,MAAkB;AACrD,SAAK,gBAAgB,GACrB,KAAK,qBAAqB;AAAA,MACxB,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEA,IAAI,wBAAwB;AAI1B,WAHsB,EAAS,KAAK,aAG7B,MAFW,EAAS,EAAU,oBAAI,KAAK,GAAG,CAAC,CAEzB;AAAA,EAC3B;AAAA,EAEA,IAAI,wBAAwB;AAI1B,WAHsB,EAAS,KAAK,aAG7B,MAFc,EAAS,oBAAI,KAAK,CAEd;AAAA,EAC3B;AACF"}
1
+ {"version":3,"file":"GlobalUiStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalUiStore.ts"],"sourcesContent":["import { makeAutoObservable, reaction } from 'mobx'\n\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { getMonth } from 'date-fns/getMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport { Account } from '../types'\n\nimport type { GlobalStore } from './GlobalStore'\n\nexport class GlobalUiStore {\n globalStore: GlobalStore\n\n accountFilterMap: Map<string, boolean> = new Map()\n\n displayedDate = new Date()\n displayedDateRange = {\n start: startOfMonth(this.displayedDate),\n end: endOfMonth(this.displayedDate),\n }\n\n constructor(globalStore: GlobalStore) {\n makeAutoObservable(this)\n this.globalStore = globalStore\n\n reaction(\n () => this.globalStore.accountStore.visibleAccounts,\n (visibleAccounts) => {\n this.populateAccountFilterMap(visibleAccounts)\n },\n )\n }\n\n get allSelectedAccounts() {\n return this.globalStore.accountStore.detailedAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccounts() {\n return this.globalStore.accountStore.visibleAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccountGuids() {\n return this.selectedAccounts.map((account) => account.guid)\n }\n\n get isCopyLoaded() {\n return this.globalStore.copyStore.isInitialized\n }\n\n get isConfigLoaded() {\n return this.globalStore.appDataStore.isAppDataLoaded\n }\n\n get areUserFeaturesLoaded() {\n return this.globalStore.userStore.userFeaturesLoaded\n }\n\n get isInitialized() {\n return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded\n }\n\n get shouldShowWelcomeDialog() {\n if (!this.isInitialized) {\n return false\n }\n\n const { config } = this.globalStore.appDataStore.appConfig\n const user = this.globalStore.appDataStore.user\n\n return Boolean(config.display_terms_and_conditions && user && !user.has_accepted_terms)\n }\n\n populateAccountFilterMap = (accounts: Account[]) => {\n if (accounts) {\n accounts.forEach((account) => {\n this.accountFilterMap.set(account.guid, !account.is_excluded_from_accounts)\n })\n }\n }\n\n resetAccountFilterMap = () => {\n this.accountFilterMap.clear()\n this.populateAccountFilterMap(this.globalStore.accountStore.visibleAccounts)\n }\n\n updateAccountFilterMap = (guid: string, isIncluded: boolean) => {\n this.accountFilterMap.set(guid, isIncluded)\n }\n\n setDisplayedDate = (startDate: Date, endDate: Date) => {\n this.displayedDate = endDate\n this.displayedDateRange = {\n start: startDate,\n end: endDate,\n }\n }\n\n get shouldDisableNextDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const nextMonth = getMonth(addMonths(new Date(), 1))\n\n return selectedMonth === nextMonth\n }\n\n get shouldDisablePrevDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const currentMonth = getMonth(new Date())\n\n return selectedMonth === currentMonth\n }\n}\n"],"mappings":";;;;;AAWA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EAEA,mBAAyC,oBAAI,IAAI;AAAA,EAEjD,gBAAgB,oBAAI,KAAK;AAAA,EACzB,qBAAqB;AAAA,IACnB,OAAO,EAAa,KAAK,aAAa;AAAA,IACtC,KAAK,EAAW,KAAK,aAAa;AAAA,EACpC;AAAA,EAEA,YAAY,GAA0B;AACpC,IAAA,EAAmB,IAAI,GACvB,KAAK,cAAc,GAEnB,EAAA,MACQ,KAAK,YAAY,aAAa,iBAAA,CACnC,MAAoB;AACnB,WAAK,yBAAyB,CAAe;AAAA,IAC/C,CACF;AAAA,EACF;AAAA,EAEA,IAAI,sBAAsB;AACxB,WAAO,KAAK,YAAY,aAAa,iBAAiB,OAAA,CACnD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK,YAAY,aAAa,gBAAgB,OAAA,CAClD,MAAqB,CAAC,EAAQ,yBACjC;AAAA,EACF;AAAA,EAEA,IAAI,uBAAuB;AACzB,WAAO,KAAK,iBAAiB,IAAA,CAAK,MAAY,EAAQ,IAAI;AAAA,EAC5D;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,iBAAiB;AACnB,WAAO,KAAK,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,IAAI,wBAAwB;AAC1B,WAAO,KAAK,YAAY,UAAU;AAAA,EACpC;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,KAAK,gBAAgB,KAAK,kBAAkB,KAAK;AAAA,EAC1D;AAAA,EAEA,IAAI,0BAA0B;AAC5B,QAAI,CAAC,KAAK,cACR,QAAO;AAGT,UAAM,EAAE,QAAA,EAAA,IAAW,KAAK,YAAY,aAAa,WAC3C,IAAO,KAAK,YAAY,aAAa;AAE3C,WAAO,GAAQ,EAAO,gCAAgC,KAAQ,CAAC,EAAK;AAAA,EACtE;AAAA,EAEA,2BAAA,CAA4B,MAAwB;AAClD,IAAI,KACF,EAAS,QAAA,CAAS,MAAY;AAC5B,WAAK,iBAAiB,IAAI,EAAQ,MAAM,CAAC,EAAQ,yBAAyB;AAAA,IAC5E,CAAC;AAAA,EAEL;AAAA,EAEA,wBAAA,MAA8B;AAC5B,SAAK,iBAAiB,MAAM,GAC5B,KAAK,yBAAyB,KAAK,YAAY,aAAa,eAAe;AAAA,EAC7E;AAAA,EAEA,yBAAA,CAA0B,GAAc,MAAwB;AAC9D,SAAK,iBAAiB,IAAI,GAAM,CAAU;AAAA,EAC5C;AAAA,EAEA,mBAAA,CAAoB,GAAiB,MAAkB;AACrD,SAAK,gBAAgB,GACrB,KAAK,qBAAqB;AAAA,MACxB,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEA,IAAI,wBAAwB;AAI1B,WAHsB,EAAS,KAAK,aAG7B,MAFW,EAAS,EAAU,oBAAI,KAAK,GAAG,CAAC,CAEzB;AAAA,EAC3B;AAAA,EAEA,IAAI,wBAAwB;AAI1B,WAHsB,EAAS,KAAK,aAG7B,MAFc,EAAS,oBAAI,KAAK,CAEd;AAAA,EAC3B;AACF"}
@@ -12,7 +12,8 @@ export declare class UserStore {
12
12
  get user(): User;
13
13
  setUserFeatures: (features: UserFeature[]) => void;
14
14
  loadUserFeatures: () => Promise<void>;
15
- updateUser: (user: User) => Promise<void>;
15
+ acceptTerms: () => Promise<void>;
16
+ updateUser: (user: User) => Promise<any>;
16
17
  updateUserProfile: (userProfile: UserProfile) => Promise<void>;
17
18
  /**
18
19
  * Seeds the profile. The host (pulse) loads `user_insight_profile` and pushes it in here;
@@ -6,8 +6,8 @@ var u = class {
6
6
  userFeatures = [];
7
7
  userFeaturesLoaded = !1;
8
8
  userInsightProfile = null;
9
- constructor(e) {
10
- this.globalStore = e, this.api = new t(e.endpoint, e.sessionToken, e.onError), s(this);
9
+ constructor(r) {
10
+ this.globalStore = r, this.api = new t(r.endpoint, r.sessionToken, r.onError), s(this);
11
11
  }
12
12
  get userProfile() {
13
13
  return this.globalStore.appDataStore.userProfile;
@@ -15,53 +15,66 @@ var u = class {
15
15
  get user() {
16
16
  return this.globalStore.appDataStore.user;
17
17
  }
18
- setUserFeatures = (e) => {
19
- this.userFeatures = e, this.userFeaturesLoaded = !0;
18
+ setUserFeatures = (r) => {
19
+ this.userFeatures = r, this.userFeaturesLoaded = !0;
20
20
  };
21
21
  loadUserFeatures = async () => {
22
22
  try {
23
- const e = await this.api.getUserFeatures();
24
- this.setUserFeatures(e);
25
- } catch (e) {
26
- this.captureError("loadUserFeatures", e), this.setUserFeatures([]);
23
+ const r = await this.api.getUserFeatures();
24
+ this.setUserFeatures(r);
25
+ } catch (r) {
26
+ this.captureError("loadUserFeatures", r), this.setUserFeatures([]);
27
+ }
28
+ };
29
+ acceptTerms = async () => {
30
+ if (!this.user) {
31
+ const r = /* @__PURE__ */ new Error("Cannot accept terms: user not loaded.");
32
+ throw this.captureError("acceptTerms", r), r;
33
+ }
34
+ if (!(await this.updateUser({
35
+ ...this.user,
36
+ has_accepted_terms: !0
37
+ }))?.has_accepted_terms) {
38
+ const r = /* @__PURE__ */ new Error("Failed to persist terms acceptance.");
39
+ throw this.captureError("acceptTerms", r), r;
27
40
  }
28
41
  };
29
- updateUser = async (e) => {
42
+ updateUser = async (r) => {
30
43
  try {
31
- const r = await this.api.updateUser(e);
32
- this.globalStore.appDataStore.setUser(r);
33
- } catch (r) {
34
- throw this.captureError("updateUser", r), r;
44
+ const e = await this.api.updateUser(r);
45
+ return e && this.globalStore.appDataStore.setUser(e), e;
46
+ } catch (e) {
47
+ throw this.captureError("updateUser", e), e;
35
48
  }
36
49
  };
37
- updateUserProfile = async (e) => {
50
+ updateUserProfile = async (r) => {
38
51
  try {
39
- const r = await this.api.updateUserProfile(e);
40
- this.globalStore.appDataStore.setUserProfile(r);
41
- } catch (r) {
42
- this.captureError("updateUserProfile", r);
52
+ const e = await this.api.updateUserProfile(r);
53
+ this.globalStore.appDataStore.setUserProfile(e);
54
+ } catch (e) {
55
+ this.captureError("updateUserProfile", e);
43
56
  }
44
57
  };
45
- setUserInsightProfile = (e) => {
46
- this.userInsightProfile = e;
58
+ setUserInsightProfile = (r) => {
59
+ this.userInsightProfile = r;
47
60
  };
48
- updateUserInsightProfile = async (e) => {
61
+ updateUserInsightProfile = async (r) => {
49
62
  if (!this.userInsightProfile) throw new Error("User insight profile has not been loaded; refusing a partial PUT");
50
63
  try {
51
- const r = await this.api.updateUserInsightProfile({
64
+ const e = await this.api.updateUserInsightProfile({
52
65
  ...this.userInsightProfile,
53
- ...e
66
+ ...r
54
67
  });
55
68
  return a(() => {
56
- this.userInsightProfile = r;
57
- }), r;
58
- } catch (r) {
59
- throw this.captureError("updateUserInsightProfile", r), r;
69
+ this.userInsightProfile = e;
70
+ }), e;
71
+ } catch (e) {
72
+ throw this.captureError("updateUserInsightProfile", e), e;
60
73
  }
61
74
  };
62
- captureError = (e, r) => this.globalStore.captureException(r, {
75
+ captureError = (r, e) => this.globalStore.captureException(e, {
63
76
  store: "UserStore",
64
- action: e
77
+ action: r
65
78
  });
66
79
  };
67
80
  export {