@mx-cartographer/experiences 9.2.9-alpha.al1 → 9.2.9-alpha.al2

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.
@@ -7,7 +7,7 @@ import { A as r } from "./ApiEndpoints-YY8ajnnd.mjs";
7
7
  import Rt from "posthog-js";
8
8
  import { endOfMonth as b } from "date-fns/endOfMonth";
9
9
  import { startOfMonth as R } from "date-fns/startOfMonth";
10
- import { startOfToday as S } from "date-fns/startOfToday";
10
+ import { startOfToday as y } from "date-fns/startOfToday";
11
11
  import { C as w, b as Ct } from "./Category-DEKZGLYe.mjs";
12
12
  import { addDays as Dt } from "date-fns/addDays";
13
13
  import { differenceInDays as xt } from "date-fns/differenceInDays";
@@ -21,15 +21,15 @@ import { fromUnixTime as Ht } from "date-fns/fromUnixTime";
21
21
  import { f as k, D as H } from "./DateFormats-HudZ3Bjs.mjs";
22
22
  import { T, c as q } from "./GoalsUtil-C9EnLWvC.mjs";
23
23
  import { A as Wt, m as Vt, a as zt, b as qt } from "./InvestmentUtil-BItV7uEs.mjs";
24
- import { f as Kt, b as Qt, a as K, c as Yt, d as jt, e as Xt, s as Jt } from "./NetWorthUtils-Dj7CgAg2.mjs";
24
+ import { f as Kt, b as Qt, a as K, c as jt, d as Yt, e as Xt, s as Jt } from "./NetWorthUtils-Dj7CgAg2.mjs";
25
25
  import { f as Zt } from "./NotificationUtils-BRGFTePr.mjs";
26
26
  import { isAfter as F } from "date-fns/isAfter";
27
27
  import { isSameDay as Q } from "date-fns/isSameDay";
28
28
  import { isWithinInterval as pt } from "date-fns/isWithinInterval";
29
29
  import { subDays as _t } from "date-fns/subDays";
30
- import { f as U, h as te, b as L, a as y } from "./RecurringTransactionsUtil-CfWviBh1.mjs";
30
+ import { f as U, h as te, b as L, a as f } from "./RecurringTransactionsUtil-CfWviBh1.mjs";
31
31
  import { I as u, A as _, B } from "./Notification-DTNYSd8P.mjs";
32
- import { endOfToday as Y } from "date-fns/endOfToday";
32
+ import { endOfToday as j } from "date-fns/endOfToday";
33
33
  import { formatISO as ee } from "date-fns/formatISO";
34
34
  import { addSeconds as se } from "date-fns/addSeconds";
35
35
  import { differenceInCalendarMonths as ae } from "date-fns/differenceInCalendarMonths";
@@ -52,7 +52,7 @@ class M {
52
52
  refreshAllMembers = async () => this.fetchInstance.get(`${r.MEMBERS}/refresh_all`).then((t) => t);
53
53
  updateAccount = async (t) => this.fetchInstance.put(`${r.ACCOUNTS}/${t.guid}`, t).then((e) => e.account);
54
54
  }
55
- class j {
55
+ class Y {
56
56
  fetchInstance;
57
57
  constructor(t, e, s) {
58
58
  this.fetchInstance = new p(t, e, void 0, s);
@@ -231,7 +231,18 @@ class ot {
231
231
  updateDevice = async (t) => this.fetchInstance.put(`${r.DEVICES}/${t.guid}`, t).then((e) => e.device);
232
232
  updateNotificationProfile = async (t) => this.fetchInstance.put(`${r.NOTIFICATION_PROFILES}/${t.guid}`, t).then((e) => e.notification_profile);
233
233
  updateUserCommunicationProfile = async (t) => this.fetchInstance.put(r.USER_COMMUNICATION_PROFILE, t).then((e) => e.user_communication_profile);
234
- updatePassword = async (t) => this.fetchInstance.put(r.CHANGE_PASSWORD, { user: t });
234
+ updatePassword = async (t) => {
235
+ const e = await fetch(`${this.fetchInstance.endpoint}${r.CHANGE_PASSWORD}`, {
236
+ method: "PUT",
237
+ headers: this.fetchInstance.headers,
238
+ body: JSON.stringify(t)
239
+ });
240
+ if (!e.ok) {
241
+ const a = (await e.json().catch(() => null))?.user?.errors, i = a?.message?.[0] || a?.plaintext_password?.[0];
242
+ throw new Error(i);
243
+ }
244
+ return e.json();
245
+ };
235
246
  getInsightsNotificationProfiles = async () => this.fetchInstance.get(`${r.NOTIFICATION_PROFILES}/${r.INSIGHTS_NOTIFICATION_PROFILES}`).then((t) => t);
236
247
  }
237
248
  class O {
@@ -300,7 +311,7 @@ class O {
300
311
  let i = `${r.TRANSACTIONS}/by_top_level_category_guid/${t}/by_date/${e}/${s}`;
301
312
  if (a.length > 0) {
302
313
  const o = a.reduce(
303
- (l, g, f) => `${l}account_guids[]=${g}${f !== a.length - 1 ? "&" : ""}`,
314
+ (l, g, S) => `${l}account_guids[]=${g}${S !== a.length - 1 ? "&" : ""}`,
304
315
  ""
305
316
  );
306
317
  i += `?${o}`;
@@ -559,11 +570,11 @@ class ce {
559
570
  try {
560
571
  const e = [];
561
572
  for (const [o, l] of t.entries()) {
562
- const g = this.accounts.find((f) => f.guid === o);
573
+ const g = this.accounts.find((S) => S.guid === o);
563
574
  if (g && g.is_excluded_from_accounts === l) {
564
- const f = { ...g, is_excluded_from_accounts: !l };
575
+ const S = { ...g, is_excluded_from_accounts: !l };
565
576
  e.push(
566
- this.api.updateAccount(f).catch((C) => (console.error("Error occurred while updating account filter:", C), this.globalStore.captureException(C, { store: "AccountStore" }), null))
577
+ this.api.updateAccount(S).catch((C) => (console.error("Error occurred while updating account filter:", C), this.globalStore.captureException(C, { store: "AccountStore" }), null))
567
578
  );
568
579
  }
569
580
  }
@@ -589,13 +600,13 @@ let le = class {
589
600
  };
590
601
  class he {
591
602
  globalStore;
592
- api = new j("/", "");
603
+ api = new Y("/", "");
593
604
  bannerApi = new X("/");
594
605
  appData = {};
595
606
  isAppDataLoaded = !1;
596
607
  banner = {};
597
608
  constructor(t) {
598
- this.globalStore = t, this.api = new j(t.endpoint, t.sessionToken, t.onError), h(this);
609
+ this.globalStore = t, this.api = new Y(t.endpoint, t.sessionToken, t.onError), h(this);
599
610
  }
600
611
  get appConfig() {
601
612
  return this.globalStore.appConfig;
@@ -777,7 +788,7 @@ class _e {
777
788
  api = new J("/", "");
778
789
  globalStore;
779
790
  alert = "";
780
- dateRange = { start: R(S()), end: b(S()) };
791
+ dateRange = { start: R(y()), end: b(y()) };
781
792
  budgets = [];
782
793
  selectedBudget;
783
794
  selectedSubBudget;
@@ -941,11 +952,11 @@ class _e {
941
952
  }
942
953
  };
943
954
  }
944
- class ye {
955
+ class fe {
945
956
  globalStore;
946
957
  uiStore;
947
958
  constructor(t) {
948
- this.globalStore = t, this.uiStore = new Se(t), h(this);
959
+ this.globalStore = t, this.uiStore = new ye(t), h(this);
949
960
  }
950
961
  completeOnboarding = async () => {
951
962
  const t = {
@@ -955,13 +966,13 @@ class ye {
955
966
  await this.globalStore.userStore.updateUserProfile(t);
956
967
  };
957
968
  }
958
- let Se = class {
969
+ let ye = class {
959
970
  globalStore;
960
971
  // Cashflow is hard-coded to display 30 days starting from today. This is the
961
972
  // single source of truth for Cash Flow's window; it intentionally does NOT
962
973
  // mutate RecurringTransactionsStore.dateRange, so Cash Flow stays decoupled
963
974
  // from other widgets (e.g. Recurring Transactions) that drive that shared range.
964
- dateRange = { start: S(), end: Dt(S(), 30) };
975
+ dateRange = { start: y(), end: Dt(y(), 30) };
965
976
  isDirty = !1;
966
977
  constructor(t) {
967
978
  this.globalStore = t, h(this);
@@ -1001,7 +1012,7 @@ let Se = class {
1001
1012
  }
1002
1013
  // Returns the number of days until the next income activity or 0 if there is no income activity
1003
1014
  get daysUntilNextIncome() {
1004
- return this.nextIncome ? Math.abs(xt(S(), this.nextIncome.expectedDate)) : 0;
1015
+ return this.nextIncome ? Math.abs(xt(y(), this.nextIncome.expectedDate)) : 0;
1005
1016
  }
1006
1017
  // Returns the expenses (Activities) until the next income activity or the end of the month
1007
1018
  // if there is no income activity
@@ -1011,7 +1022,7 @@ let Se = class {
1011
1022
  );
1012
1023
  }
1013
1024
  };
1014
- class fe {
1025
+ class Se {
1015
1026
  globalStore;
1016
1027
  uiStore;
1017
1028
  api = new Z("/", "");
@@ -1521,7 +1532,7 @@ class Ns {
1521
1532
  // UI Stores
1522
1533
  globalUiStore;
1523
1534
  constructor(t = ht, e = "/", s, a, i) {
1524
- this.appConfig = t, this.endpoint = e, this.sessionToken = t.options.session_token ?? "", this.onCaptureException = i, this.onError = s, this.onStoreUpdate = a, this.accountStore = new ce(this), this.appDataStore = new he(this), this.analyticsStore = new de(this), this.beatStore = new pe(this), this.budgetsStore = new _e(this), this.cashflowStore = new ye(this), this.categoryStore = new fe(this), this.connectStore = new Te(this), this.copyStore = new Ce(this), this.debtsStore = new be(this), this.finstrongStore = new Ie(this), this.goalStore = new De(this), this.helpStore = new ve(this), this.holdingStore = new Ge(this), this.merchantStore = new Ne(this), this.netWorthStore = new Be(this), this.notificationStore = new Me(this), this.recurringTransactionsStore = new Oe(this), this.settingsStore = new Fe(this), this.transactionStore = new Ue(this), this.trendsStore = new He(this), this.userStore = new We(this), this.globalUiStore = new Re(this), h(this), mt(() => {
1535
+ this.appConfig = t, this.endpoint = e, this.sessionToken = t.options.session_token ?? "", this.onCaptureException = i, this.onError = s, this.onStoreUpdate = a, this.accountStore = new ce(this), this.appDataStore = new he(this), this.analyticsStore = new de(this), this.beatStore = new pe(this), this.budgetsStore = new _e(this), this.cashflowStore = new fe(this), this.categoryStore = new Se(this), this.connectStore = new Te(this), this.copyStore = new Ce(this), this.debtsStore = new be(this), this.finstrongStore = new Ie(this), this.goalStore = new De(this), this.helpStore = new ve(this), this.holdingStore = new Ge(this), this.merchantStore = new Ne(this), this.netWorthStore = new Be(this), this.notificationStore = new Me(this), this.recurringTransactionsStore = new Oe(this), this.settingsStore = new Fe(this), this.transactionStore = new Ue(this), this.trendsStore = new He(this), this.userStore = new We(this), this.globalUiStore = new Re(this), h(this), mt(() => {
1525
1536
  const { transactions: o } = this.transactionStore;
1526
1537
  this.emitUpdate({
1527
1538
  transactions: o
@@ -1556,9 +1567,9 @@ class Ns {
1556
1567
  transactionRules: o,
1557
1568
  transactions: l,
1558
1569
  userFeatures: g,
1559
- merchantBudgets: f
1570
+ merchantBudgets: S
1560
1571
  } = {}) => {
1561
- (!e || !g) && await this.loadConfigData(), e && this.appDataStore.setAppData(e), g && this.userStore.setUserFeatures(g), t && (await this.accountStore.loadMembers(), i && this.accountStore.setInstitutions(i), this.accountStore.setAccounts(t)), s && this.transactionStore.setAssociatedBeats(s), a && this.categoryStore.setCategories(a), l && this.transactionStore.setTransactions(l), o && this.transactionStore.setTransactionRules(o), f && this.budgetsStore.setMerchantBudgets(f);
1572
+ (!e || !g) && await this.loadConfigData(), e && this.appDataStore.setAppData(e), g && this.userStore.setUserFeatures(g), t && (await this.accountStore.loadMembers(), i && this.accountStore.setInstitutions(i), this.accountStore.setAccounts(t)), s && this.transactionStore.setAssociatedBeats(s), a && this.categoryStore.setCategories(a), l && this.transactionStore.setTransactions(l), o && this.transactionStore.setTransactionRules(o), S && this.budgetsStore.setMerchantBudgets(S);
1562
1573
  };
1563
1574
  }
1564
1575
  class Re {
@@ -2064,10 +2075,10 @@ class Be {
2064
2075
  return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : void 0;
2065
2076
  }
2066
2077
  get gainsLosses() {
2067
- return Yt(this.selectedData);
2078
+ return jt(this.selectedData);
2068
2079
  }
2069
2080
  get assetsLiabilities() {
2070
- const { assets: t, liabilities: e, totalAssets: s, totalLiabilities: a } = jt(
2081
+ const { assets: t, liabilities: e, totalAssets: s, totalLiabilities: a } = Yt(
2071
2082
  this.netWorthData.accounts
2072
2083
  );
2073
2084
  return {
@@ -2149,7 +2160,7 @@ class Oe {
2149
2160
  repeatingTransactions = [];
2150
2161
  isDataLoaded = !1;
2151
2162
  selectedDay;
2152
- dateRange = { start: R(S()), end: b(S()) };
2163
+ dateRange = { start: R(y()), end: b(y()) };
2153
2164
  selectedRepeatingTransactionGuid = null;
2154
2165
  selectedRecurrence = null;
2155
2166
  alert = { message: "", severity: void 0 };
@@ -2191,7 +2202,7 @@ class Oe {
2191
2202
  * Returns the upcoming expense recurrences scoped to the supplied date range.
2192
2203
  */
2193
2204
  upcomingExpensesForRange = (t) => this.recurrencesForRange(t).filter(
2194
- (e) => e.type === L.Expense && e.status === y.Upcoming
2205
+ (e) => e.type === L.Expense && e.status === f.Upcoming
2195
2206
  );
2196
2207
  /**
2197
2208
  * Returns the income recurrences scoped to the supplied date range.
@@ -2203,13 +2214,13 @@ class Oe {
2203
2214
  * Returns the upcoming income recurrences scoped to the supplied date range.
2204
2215
  */
2205
2216
  upcomingIncomeForRange = (t) => this.incomeForRange(t).filter(
2206
- (e) => e.status === y.Upcoming
2217
+ (e) => e.status === f.Upcoming
2207
2218
  );
2208
2219
  /**
2209
2220
  * Returns the next upcoming income recurrence scoped to the supplied range.
2210
2221
  */
2211
2222
  nextIncomeForRange = (t) => this.upcomingIncomeForRange(t).find(
2212
- (e) => F(e.expectedDate, S())
2223
+ (e) => F(e.expectedDate, y())
2213
2224
  );
2214
2225
  /**
2215
2226
  * Returns all recurrences built from repeating transactions and filtered by accounts.
@@ -2222,7 +2233,7 @@ class Oe {
2222
2233
  */
2223
2234
  get pastRecurrences() {
2224
2235
  return this.recurrences.filter(
2225
- (t) => t.status === y.Paid || t.status === y.Missed
2236
+ (t) => t.status === f.Paid || t.status === f.Missed
2226
2237
  );
2227
2238
  }
2228
2239
  /**
@@ -2231,7 +2242,7 @@ class Oe {
2231
2242
  */
2232
2243
  get upcomingRecurrences() {
2233
2244
  return this.recurrences.filter(
2234
- (t) => F(t.expectedDate, _t(S(), 3)) && W(t.expectedDate, this.dateRange.end) && t.status === y.Upcoming
2245
+ (t) => F(t.expectedDate, _t(y(), 3)) && W(t.expectedDate, this.dateRange.end) && t.status === f.Upcoming
2235
2246
  );
2236
2247
  }
2237
2248
  /**
@@ -2247,7 +2258,7 @@ class Oe {
2247
2258
  */
2248
2259
  get upcomingExpenses() {
2249
2260
  return this.expenses.filter(
2250
- (t) => t.status === y.Upcoming
2261
+ (t) => t.status === f.Upcoming
2251
2262
  );
2252
2263
  }
2253
2264
  /**
@@ -2263,11 +2274,11 @@ class Oe {
2263
2274
  */
2264
2275
  get upcomingIncome() {
2265
2276
  return this.income.filter(
2266
- (t) => t.status === y.Upcoming
2277
+ (t) => t.status === f.Upcoming
2267
2278
  );
2268
2279
  }
2269
2280
  get nextIncomeRecurrence() {
2270
- return this.upcomingIncome.find((t) => F(t.expectedDate, S()));
2281
+ return this.upcomingIncome.find((t) => F(t.expectedDate, y()));
2271
2282
  }
2272
2283
  /**
2273
2284
  * Returns the expense recurrences for the current month.
@@ -2295,19 +2306,19 @@ class Oe {
2295
2306
  * Calculates the total amount of all paid expenses for the current month.
2296
2307
  */
2297
2308
  get paidExpenseTotal() {
2298
- return this.currentMonthExpenses.filter((t) => t.status === y.Paid).reduce(A, 0);
2309
+ return this.currentMonthExpenses.filter((t) => t.status === f.Paid).reduce(A, 0);
2299
2310
  }
2300
2311
  /**
2301
2312
  * Calculates the total amount of all missed expenses for the current month.
2302
2313
  */
2303
2314
  get missedExpenseTotal() {
2304
- return this.currentMonthExpenses.filter((t) => t.status === y.Missed).reduce(A, 0);
2315
+ return this.currentMonthExpenses.filter((t) => t.status === f.Missed).reduce(A, 0);
2305
2316
  }
2306
2317
  /**
2307
2318
  * Calculates the total amount of all upcoming expenses for the current month.
2308
2319
  */
2309
2320
  get upcomingExpenseTotal() {
2310
- return this.currentMonthExpenses.filter((t) => t.status === y.Upcoming).reduce(A, 0);
2321
+ return this.currentMonthExpenses.filter((t) => t.status === f.Upcoming).reduce(A, 0);
2311
2322
  }
2312
2323
  /**
2313
2324
  * Calculates the total amount of all income for the current month.
@@ -2319,13 +2330,13 @@ class Oe {
2319
2330
  * Calculates the total amount of all paid income for the current month.
2320
2331
  */
2321
2332
  get paidIncomeTotal() {
2322
- return this.currentMonthIncome.filter((t) => t.status === y.Paid).reduce(A, 0);
2333
+ return this.currentMonthIncome.filter((t) => t.status === f.Paid).reduce(A, 0);
2323
2334
  }
2324
2335
  /**
2325
2336
  * Calculates the total amount of all upcoming income for the current month.
2326
2337
  */
2327
2338
  get upcomingIncomeTotal() {
2328
- return this.currentMonthIncome.filter((t) => t.status === y.Upcoming).reduce(A, 0);
2339
+ return this.currentMonthIncome.filter((t) => t.status === f.Upcoming).reduce(A, 0);
2329
2340
  }
2330
2341
  /**
2331
2342
  * Get the recurrences for the currently selected day.
@@ -2507,19 +2518,19 @@ const ut = "PARENT-ENTITY", Pe = (n, t) => ({
2507
2518
  const o = [], {
2508
2519
  email_notifications_enabled: l,
2509
2520
  sms_notifications_enabled: g,
2510
- push_notifications_enabled: f
2521
+ push_notifications_enabled: S
2511
2522
  } = t, {
2512
2523
  opted_out_of_email_notifications: C,
2513
- opted_out_of_sms_notifications: yt,
2514
- opted_out_of_push_notifications: St
2524
+ opted_out_of_sms_notifications: ft,
2525
+ opted_out_of_push_notifications: yt
2515
2526
  } = a;
2516
2527
  for (const E of s.filter((D) => D.entity_guid === ut)) {
2517
- const D = Pe(E.notification_type, e), ft = s.filter(
2528
+ const D = Pe(E.notification_type, e), St = s.filter(
2518
2529
  (I) => I.entity_guid !== ut && I.notification_type === E.notification_type && n.some((P) => P.guid === I.entity_guid)
2519
2530
  ), x = [];
2520
- l && !C && E.email_channel && i.email && x.push(e.delivery_method_email_label), g && !yt && E.sms_channel && i.phone && x.push(e.delivery_method_sms_label), f && !St && E.push_channel && x.push(e.delivery_method_push_label), o.push({
2531
+ l && !C && E.email_channel && i.email && x.push(e.delivery_method_email_label), g && !ft && E.sms_channel && i.phone && x.push(e.delivery_method_sms_label), S && !yt && E.push_channel && x.push(e.delivery_method_push_label), o.push({
2521
2532
  ...E,
2522
- children: ft.map((I) => ({
2533
+ children: St.map((I) => ({
2523
2534
  ...I,
2524
2535
  account: n.find((P) => P.guid === I.entity_guid),
2525
2536
  label: D
@@ -2660,7 +2671,9 @@ class Fe {
2660
2671
  try {
2661
2672
  await this.api.updatePassword(t), this.setAlert(this.copy.password_updated_success, "success");
2662
2673
  } catch (e) {
2663
- console.error("Error updating password:", e), this.globalStore.captureException(e, { store: "SettingsStore" }), this.setAlert(this.copy.password_updated_error, "error");
2674
+ console.error("Error updating password:", e), this.globalStore.captureException(e, { store: "SettingsStore" });
2675
+ const s = e instanceof Error && e.message ? e.message : this.copy.password_updated_error;
2676
+ this.setAlert(s, "error");
2664
2677
  }
2665
2678
  };
2666
2679
  updateDevice = async (t) => {
@@ -2744,7 +2757,7 @@ class Ue {
2744
2757
  transactionRulesLoaded = !1;
2745
2758
  transactionRulesLoading = !1;
2746
2759
  transactionSplitting = !1;
2747
- cachedStartDate = _t(S(), 90);
2760
+ cachedStartDate = _t(y(), 90);
2748
2761
  filter = {};
2749
2762
  isLoading = !0;
2750
2763
  alert = "";
@@ -2925,7 +2938,7 @@ class Ue {
2925
2938
  try {
2926
2939
  const e = await this.api.getTransactionsByDateRange(
2927
2940
  m(t),
2928
- m(Y())
2941
+ m(j())
2929
2942
  );
2930
2943
  this.setTransactions(e), c(() => {
2931
2944
  this.cachedStartDate = t;
@@ -3060,7 +3073,7 @@ class Ue {
3060
3073
  try {
3061
3074
  const e = await this.api.getTransactionsByDateRange(
3062
3075
  m(t),
3063
- m(Y())
3076
+ m(j())
3064
3077
  );
3065
3078
  this.cachedStartDate = t, this.transactions = e;
3066
3079
  } catch (e) {
@@ -3197,7 +3210,7 @@ class We {
3197
3210
  export {
3198
3211
  M as A,
3199
3212
  X as B,
3200
- ye as C,
3213
+ fe as C,
3201
3214
  be as D,
3202
3215
  tt as F,
3203
3216
  Ce as G,
@@ -3211,13 +3224,13 @@ export {
3211
3224
  lt as W,
3212
3225
  ce as a,
3213
3226
  de as b,
3214
- j as c,
3227
+ Y as c,
3215
3228
  he as d,
3216
3229
  pe as e,
3217
3230
  J as f,
3218
3231
  _e as g,
3219
3232
  Z as h,
3220
- fe as i,
3233
+ Se as i,
3221
3234
  Te as j,
3222
3235
  Ie as k,
3223
3236
  Ns as l,
@@ -3236,4 +3249,4 @@ export {
3236
3249
  He as y,
3237
3250
  We as z
3238
3251
  };
3239
- //# sourceMappingURL=UserStore-BU7ooo3o.mjs.map
3252
+ //# sourceMappingURL=UserStore-cI7SJMs_.mjs.map