@mx-cartographer/experiences 3.14.0-alpha.mm5 → 3.14.0-alpha.mm6

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.
package/dist/index.es.js CHANGED
@@ -29,7 +29,7 @@ import { addDays as fe } from "date-fns/addDays";
29
29
  import { addMonths as $A } from "date-fns/addMonths";
30
30
  import { eachDayOfInterval as eo } from "date-fns/eachDayOfInterval";
31
31
  import { eachWeekOfInterval as to } from "date-fns/eachWeekOfInterval";
32
- import { endOfMonth as SA } from "date-fns/endOfMonth";
32
+ import { endOfMonth as IA } from "date-fns/endOfMonth";
33
33
  import { format as UA } from "date-fns/format";
34
34
  import { isBefore as pA } from "date-fns/isBefore";
35
35
  import { isSameMonth as no } from "date-fns/isSameMonth";
@@ -1674,7 +1674,7 @@ const Ys = ({
1674
1674
  h(e), m(n), e && u(e);
1675
1675
  }, [e, n]);
1676
1676
  const f = g.useMemo(() => {
1677
- const L = to({ start: EA(c), end: SA(c) }), x = [];
1677
+ const L = to({ start: EA(c), end: IA(c) }), x = [];
1678
1678
  for (let P = 0; P < L.length; P++) {
1679
1679
  const O = L[P], _ = eo({ start: O, end: fe(O, 6) }), G = [];
1680
1680
  for (let B = 0; B < _.length; B++)
@@ -2197,7 +2197,7 @@ const Ys = ({
2197
2197
  type: "line",
2198
2198
  highlightScope: { highlight: "item" },
2199
2199
  valueFormatter: (mA) => Q(mA, "0,0")
2200
- })), TA = i.map((M, eA) => ({
2200
+ })), SA = i.map((M, eA) => ({
2201
2201
  id: `unstacked-${eA}`,
2202
2202
  guid: M.category_guid,
2203
2203
  top_level_guid: M.top_level_category_guid,
@@ -2207,12 +2207,12 @@ const Ys = ({
2207
2207
  label: M.category_name,
2208
2208
  type: "line",
2209
2209
  valueFormatter: (mA) => Q(mA, "0,0")
2210
- })), cA = [...AA, ...TA], bA = [
2210
+ })), cA = [...AA, ...SA], TA = [
2211
2211
  ...AA.map(({ guid: M, top_level_guid: eA }) => ({
2212
2212
  guid: M,
2213
2213
  top_level_guid: eA
2214
2214
  })),
2215
- ...TA.map(({ guid: M, top_level_guid: eA }) => ({
2215
+ ...SA.map(({ guid: M, top_level_guid: eA }) => ({
2216
2216
  guid: M,
2217
2217
  top_level_guid: eA
2218
2218
  }))
@@ -2345,7 +2345,7 @@ const Ys = ({
2345
2345
  /* @__PURE__ */ t(
2346
2346
  lc,
2347
2347
  {
2348
- categoryGuids: bA,
2348
+ categoryGuids: TA,
2349
2349
  hoveredLegend: h,
2350
2350
  onClickLegend: Te,
2351
2351
  onHoverLegend: Se,
@@ -2525,7 +2525,7 @@ const Ys = ({
2525
2525
  calendarActions: A,
2526
2526
  color: e = "primary",
2527
2527
  copy: n,
2528
- range: r = [EA(Z()), SA(Ne())],
2528
+ range: r = [EA(Z()), IA(Ne())],
2529
2529
  shouldShrinkToIcon: a = !0,
2530
2530
  toolTipContent: i = "",
2531
2531
  variant: o = "outlined"
@@ -2542,17 +2542,17 @@ const Ys = ({
2542
2542
  o === "timeframebuttons" && A.onRangeChanged(G());
2543
2543
  }, [P]);
2544
2544
  const G = () => {
2545
- const F = SA(Ne());
2546
- return [SA(ae(F, P)), F];
2545
+ const F = IA(Ne());
2546
+ return [IA(ae(F, P)), F];
2547
2547
  }, B = (F) => {
2548
- const aA = [...h], AA = h[0], TA = h[1], cA = F === "previous";
2548
+ const aA = [...h], AA = h[0], SA = h[1], cA = F === "previous";
2549
2549
  if (m === n.dateRangePickerCopy.dateRangeThisMonth)
2550
- aA[0] = cA ? ae(AA, 1) : $A(AA, 1), aA[1] = SA(cA ? ae(TA, 1) : $A(TA, 1));
2550
+ aA[0] = cA ? ae(AA, 1) : $A(AA, 1), aA[1] = IA(cA ? ae(SA, 1) : $A(SA, 1));
2551
2551
  else if (m === n.dateRangePickerCopy.dateRangeYTD || m === n.dateRangePickerCopy.dateRangeLastYear)
2552
2552
  aA[0] = cA ? mr(fr(AA), 1) : Ct(fr(AA), 1), aA[1] = cA ? mr(Cr(AA), 1) : Ct(Cr(AA), 1);
2553
2553
  else {
2554
- const bA = So(TA, AA);
2555
- aA[0] = F === "previous" ? ie(AA, bA) : fe(AA, bA), aA[1] = F === "previous" ? ie(TA, bA) : fe(TA, bA);
2554
+ const TA = So(SA, AA);
2555
+ aA[0] = F === "previous" ? ie(AA, TA) : fe(AA, TA), aA[1] = F === "previous" ? ie(SA, TA) : fe(SA, TA);
2556
2556
  }
2557
2557
  C(aA), A.onRangeChanged(aA);
2558
2558
  }, K = () => {
@@ -3560,7 +3560,7 @@ class Tc {
3560
3560
  api = new Rr("/", "");
3561
3561
  categoryApi = new _t("/", "");
3562
3562
  globalStore;
3563
- dateRange = { start: EA(Z()), end: SA(Z()) };
3563
+ dateRange = { start: EA(Z()), end: IA(Z()) };
3564
3564
  budgets = [];
3565
3565
  categoryTotals = [];
3566
3566
  theme = {};
@@ -4300,7 +4300,7 @@ const Ja = {
4300
4300
  };
4301
4301
  let Gc = class {
4302
4302
  beginDate = EA(/* @__PURE__ */ new Date());
4303
- endDate = SA(/* @__PURE__ */ new Date());
4303
+ endDate = IA(/* @__PURE__ */ new Date());
4304
4304
  expandedSplits = [];
4305
4305
  isInitialized = !1;
4306
4306
  height = 550;
@@ -5308,7 +5308,7 @@ class xl {
5308
5308
  }
5309
5309
  };
5310
5310
  loadMonthlyCategoryTotals = async (e = this.globalStore.accountStore.accounts, n, r) => {
5311
- const a = CA(EA(n ?? ae(/* @__PURE__ */ new Date(), 5))), i = CA(SA(r ?? /* @__PURE__ */ new Date()));
5311
+ const a = CA(EA(n ?? ae(/* @__PURE__ */ new Date(), 5))), i = CA(IA(r ?? /* @__PURE__ */ new Date()));
5312
5312
  try {
5313
5313
  const o = await this.api.getMonthlyCategoryTotals(a, i, e);
5314
5314
  J(() => {
@@ -6578,13 +6578,13 @@ const $a = ({ transaction: A }) => {
6578
6578
  selectedAccounts: K,
6579
6579
  setDisplayedDate: X,
6580
6580
  setSelectedAccounts: F
6581
- } = vA(), [aA, AA] = g.useState(""), [TA, cA] = g.useState(""), [bA, Ae] = g.useState(!1), [Se, Te] = g.useState(!1), [M, eA] = g.useState(!1);
6581
+ } = vA(), [aA, AA] = g.useState(""), [SA, cA] = g.useState(""), [TA, Ae] = g.useState(!1), [Se, Te] = g.useState(!1), [M, eA] = g.useState(!1);
6582
6582
  g.useEffect(() => {
6583
6583
  F(a);
6584
6584
  }, [a]), g.useEffect(() => {
6585
- const IA = EA(Z()), lr = SA(Z());
6586
- X(IA, lr), y({
6587
- dateRange: { start: IA, end: lr },
6585
+ const bA = EA(Z()), lr = IA(Z());
6586
+ X(bA, lr), y({
6587
+ dateRange: { start: bA, end: lr },
6588
6588
  accounts: K.map((Gi) => Gi.guid)
6589
6589
  }), eA(!0), O(j.TRANSACTIONS_VIEW);
6590
6590
  }, []), g.useEffect(() => {
@@ -6597,15 +6597,15 @@ const $a = ({ transaction: A }) => {
6597
6597
  h(n);
6598
6598
  }, [n]);
6599
6599
  const mA = g.useMemo(
6600
- () => a.filter((IA) => IA.is_manual),
6600
+ () => a.filter((bA) => bA.is_manual),
6601
6601
  [a]
6602
- ), NA = TA ? S.find((IA) => IA.guid === TA) : void 0, Ue = c && !!s.payee && !!s.account_guid && !!s.category_guid, ln = (IA) => {
6603
- X(IA[0], IA[1]);
6604
- }, dn = (IA) => {
6605
- d(IA), y({
6602
+ ), NA = SA ? S.find((bA) => bA.guid === SA) : void 0, Ue = c && !!s.payee && !!s.account_guid && !!s.category_guid, ln = (bA) => {
6603
+ X(bA[0], bA[1]);
6604
+ }, dn = (bA) => {
6605
+ d(bA), y({
6606
6606
  ...f,
6607
- searchTerm: IA
6608
- }), O(j.TRANSACTIONS_CLICK_SEARCH, { search_term: IA });
6607
+ searchTerm: bA
6608
+ }), O(j.TRANSACTIONS_CLICK_SEARCH, { search_term: bA });
6609
6609
  }, _i = () => {
6610
6610
  ad(S, v), O(j.TRANSACTIONS_CLICK_EXPORT);
6611
6611
  }, Bi = () => {
@@ -6667,17 +6667,17 @@ const $a = ({ transaction: A }) => {
6667
6667
  sl,
6668
6668
  {
6669
6669
  height: `calc(${e} - ${Gr}px)`,
6670
- onCategoryClick: (IA) => {
6671
- cA(IA), AA(
6670
+ onCategoryClick: (bA) => {
6671
+ cA(bA), AA(
6672
6672
  "category"
6673
6673
  /* Category */
6674
6674
  );
6675
6675
  },
6676
- onRowClick: (IA) => {
6677
- cA(IA), AA(
6676
+ onRowClick: (bA) => {
6677
+ cA(bA), AA(
6678
6678
  "transaction"
6679
6679
  /* Transaction */
6680
- ), O(j.TRANSACTIONS_CLICK_DETAILS, { transaction_guid: IA });
6680
+ ), O(j.TRANSACTIONS_CLICK_DETAILS, { transaction_guid: bA });
6681
6681
  }
6682
6682
  }
6683
6683
  )
@@ -6694,8 +6694,8 @@ const $a = ({ transaction: A }) => {
6694
6694
  nt,
6695
6695
  {
6696
6696
  height: `calc(${e} - ${Gr}px)`,
6697
- onClick: (IA) => {
6698
- cA(IA), AA(
6697
+ onClick: (bA) => {
6698
+ cA(bA), AA(
6699
6699
  "transaction"
6700
6700
  /* Transaction */
6701
6701
  );
@@ -6742,7 +6742,7 @@ const $a = ({ transaction: A }) => {
6742
6742
  rd,
6743
6743
  {
6744
6744
  copy: { title: x.add_manual_account },
6745
- isOpen: bA,
6745
+ isOpen: TA,
6746
6746
  onClose: () => {
6747
6747
  Ae(!1);
6748
6748
  },
@@ -6913,7 +6913,7 @@ const $a = ({ transaction: A }) => {
6913
6913
  g.useEffect(() => {
6914
6914
  c({
6915
6915
  accounts: d,
6916
- dateRange: { start: ie(Z(), 90), end: SA(Z()) }
6916
+ dateRange: { start: ie(Z(), 90), end: IA(Z()) }
6917
6917
  });
6918
6918
  }, []), g.useEffect(() => {
6919
6919
  if (S && A.sequenceGuid) {
@@ -7665,10 +7665,10 @@ const $a = ({ transaction: A }) => {
7665
7665
  ] });
7666
7666
  }, hi = T(zd), it = (A, e) => A + e.amount, gn = (A) => A.activityType === yA.Income && Je(A.expectedDate, {
7667
7667
  start: EA(Z()),
7668
- end: SA(Z())
7668
+ end: IA(Z())
7669
7669
  }), Dt = (A) => A.activityType === yA.Expense && Je(A.expectedDate, {
7670
7670
  start: EA(Z()),
7671
- end: SA(Z())
7671
+ end: IA(Z())
7672
7672
  }), Cn = (A) => A.occurredOnDate && Je(A.occurredOnDate, {
7673
7673
  start: EA(/* @__PURE__ */ new Date()),
7674
7674
  end: fe(Z(), 30)
@@ -7758,7 +7758,7 @@ const $a = ({ transaction: A }) => {
7758
7758
  }, o = /* @__PURE__ */ t(
7759
7759
  zn,
7760
7760
  {
7761
- maxDate: SA($A(/* @__PURE__ */ new Date(), 1)),
7761
+ maxDate: IA($A(/* @__PURE__ */ new Date(), 1)),
7762
7762
  minDate: EA(/* @__PURE__ */ new Date()),
7763
7763
  onMonthChange: i,
7764
7764
  showDaysOutsideCurrentMonth: !0,
@@ -8219,7 +8219,7 @@ class Jd {
8219
8219
  try {
8220
8220
  const e = await this.cashflowApi.getCashflowEventsByDateRange(
8221
8221
  ie(Z(), 90),
8222
- SA(Z())
8222
+ IA(Z())
8223
8223
  );
8224
8224
  J(() => {
8225
8225
  this.cashflowEvents = e.filter(
@@ -9068,19 +9068,19 @@ const ou = ({ activity: A }) => /* @__PURE__ */ l(iA, { children: [
9068
9068
  if (!(_.length < 1)) {
9069
9069
  b(!0);
9070
9070
  for (let cA = 0; cA < _.length; cA++) {
9071
- const bA = _[cA], Ae = ii(
9072
- bA,
9073
- bA.frequency,
9074
- bA.nextDate
9071
+ const TA = _[cA], Ae = ii(
9072
+ TA,
9073
+ TA.frequency,
9074
+ TA.nextDate
9075
9075
  ), Se = await e(Ae);
9076
9076
  if (Se) {
9077
- const Te = oi(Se, bA);
9077
+ const Te = oi(Se, TA);
9078
9078
  await A(Te);
9079
9079
  }
9080
9080
  }
9081
9081
  i();
9082
9082
  }
9083
- }, TA = !X && m || !X && _.length < 1;
9083
+ }, SA = !X && m || !X && _.length < 1;
9084
9084
  return /* @__PURE__ */ l(
9085
9085
  I,
9086
9086
  {
@@ -9123,12 +9123,12 @@ const ou = ({ activity: A }) => /* @__PURE__ */ l(iA, { children: [
9123
9123
  /* @__PURE__ */ t(ge, { pb: 12, children: r.add_income_title }),
9124
9124
  /* @__PURE__ */ t(fA, { mb: 24, children: r.add_income_description }),
9125
9125
  _.length > 0 && !X && /* @__PURE__ */ l(iA, { children: [
9126
- /* @__PURE__ */ t(sA, { children: _.map((cA, bA) => /* @__PURE__ */ l(g.Fragment, { children: [
9126
+ /* @__PURE__ */ t(sA, { children: _.map((cA, TA) => /* @__PURE__ */ l(g.Fragment, { children: [
9127
9127
  /* @__PURE__ */ t(Jn, { bgcolor: "background.paper", children: tn(
9128
9128
  CA(cA.nextDate || cA.date)
9129
9129
  ) }),
9130
9130
  /* @__PURE__ */ t(Vn, { transaction: cA }),
9131
- bA !== _.length - 1 && /* @__PURE__ */ t(k, {})
9131
+ TA !== _.length - 1 && /* @__PURE__ */ t(k, {})
9132
9132
  ] }, cA.guid)) }),
9133
9133
  /* @__PURE__ */ l(w, { alignItems: "center", direction: "row", children: [
9134
9134
  /* @__PURE__ */ t(k, { sx: { flexGrow: 1 } }),
@@ -9142,13 +9142,13 @@ const ou = ({ activity: A }) => /* @__PURE__ */ l(iA, { children: [
9142
9142
  )
9143
9143
  ] })
9144
9144
  ] }),
9145
- TA && /* @__PURE__ */ t(
9145
+ SA && /* @__PURE__ */ t(
9146
9146
  si,
9147
9147
  {
9148
9148
  bgcolor: "background.paper",
9149
9149
  onSearch: (cA) => d({
9150
9150
  ...u,
9151
- custom: (bA) => cA ? li(bA, cA) : vt(bA)
9151
+ custom: (TA) => cA ? li(TA, cA) : vt(TA)
9152
9152
  }),
9153
9153
  onSelected: (cA) => {
9154
9154
  K(cA), f(!1);
@@ -9325,7 +9325,7 @@ let Iu = class {
9325
9325
  // if there is no income activity
9326
9326
  get expensesTilNextIncome() {
9327
9327
  return this.upcomingExpenses.filter(
9328
- (e) => pA(e.expectedDate, this.nextIncome?.expectedDate || SA(/* @__PURE__ */ new Date()))
9328
+ (e) => pA(e.expectedDate, this.nextIncome?.expectedDate || IA(/* @__PURE__ */ new Date()))
9329
9329
  );
9330
9330
  }
9331
9331
  setNextIncome = (e) => {
@@ -9371,7 +9371,7 @@ class Ou {
9371
9371
  displayedDate = /* @__PURE__ */ new Date();
9372
9372
  displayedDateRange = {
9373
9373
  start: EA(this.displayedDate),
9374
- end: SA(this.displayedDate)
9374
+ end: IA(this.displayedDate)
9375
9375
  };
9376
9376
  constructor(e) {
9377
9377
  LA(this), this.globalStore = e;
@@ -14591,22 +14591,22 @@ const St = g.createContext(null), kh = ({
14591
14591
  onTouchStart: K,
14592
14592
  ref: C,
14593
14593
  children: [
14594
- A.map((AA, TA) => /* @__PURE__ */ t(
14594
+ A.map((AA, SA) => /* @__PURE__ */ t(
14595
14595
  Zh,
14596
14596
  {
14597
14597
  ariaLabel: z(
14598
14598
  L.card_position_in_carousel_aria,
14599
- TA + 1,
14599
+ SA + 1,
14600
14600
  A.length + 1
14601
14601
  ),
14602
14602
  beat: AA,
14603
- index: TA,
14604
- isActiveCard: TA === F,
14603
+ index: SA,
14604
+ isActiveCard: SA === F,
14605
14605
  onCardClick: a,
14606
14606
  posthog: i,
14607
14607
  ...X
14608
14608
  },
14609
- `${AA.guid} ${TA}`
14609
+ `${AA.guid} ${SA}`
14610
14610
  )),
14611
14611
  /* @__PURE__ */ t(
14612
14612
  ug,
@@ -15267,7 +15267,7 @@ const St = g.createContext(null), kh = ({
15267
15267
  o(
15268
15268
  n,
15269
15269
  EA(/* @__PURE__ */ new Date()),
15270
- SA(/* @__PURE__ */ new Date())
15270
+ IA(/* @__PURE__ */ new Date())
15271
15271
  ).finally();
15272
15272
  }, [n]);
15273
15273
  const [s, c] = g.useState(""), [u, d] = g.useState(0), h = g.useMemo(
@@ -15609,7 +15609,7 @@ const St = g.createContext(null), kh = ({
15609
15609
  g.useEffect(() => {
15610
15610
  o(n);
15611
15611
  }, [n]), g.useEffect(() => {
15612
- i(EA(Z()), SA(Z())), u(!0), s(j.SPENDING_VIEW);
15612
+ i(EA(Z()), IA(Z())), u(!0), s(j.SPENDING_VIEW);
15613
15613
  }, []);
15614
15614
  const d = (h) => {
15615
15615
  i(h[0], h[1]);
@@ -15627,7 +15627,7 @@ const St = g.createContext(null), kh = ({
15627
15627
  }
15628
15628
  );
15629
15629
  }, u7 = T(bg), Ig = (A) => De[A] ?? De.default, Dg = (A) => Re[A], xg = (A) => A.reduce((e, n) => {
15630
- const r = SA(new Date(n.year, n.month)), a = {
15630
+ const r = EA(new Date(n.year, n.month - 1)), a = {
15631
15631
  top_level_category_guid: n.top_level_category_guid,
15632
15632
  category_guid: n.category_guid,
15633
15633
  amount: n.total,
@@ -15644,7 +15644,7 @@ const St = g.createContext(null), kh = ({
15644
15644
  const h = s.filter((m) => m.year_month === d).reduce((m, f) => m + Math.abs(f.amount), 0);
15645
15645
  return { x: new Date(
15646
15646
  Number(String(d).slice(0, 4)),
15647
- Number(String(d).slice(4))
15647
+ Number(String(d).slice(4)) - 1
15648
15648
  ), y: h };
15649
15649
  }).sort((d, h) => d.x.getTime() - h.x.getTime());
15650
15650
  return {
@@ -15768,7 +15768,7 @@ const St = g.createContext(null), kh = ({
15768
15768
  }, zg = ({ onBackClick: A, sx: e }) => {
15769
15769
  const n = GA(), { onEvent: r } = V(), { isDesktop: a, isTablet: i, isMobile: o } = XA(), { accounts: s } = PA(), { loadMonthlyCategoryTotals: c, monthlyCategoryTotals: u } = MA(), { isInitialized: d, selectedAccounts: h, setSelectedAccounts: C } = vA(), { trends: m } = D(), f = n.palette.mode === "dark", [y, v] = g.useState(!1), [S, b] = g.useState("Chart"), [L, x] = g.useState(""), [P, O] = g.useState({
15770
15770
  start: EA(ae(/* @__PURE__ */ new Date(), 5)),
15771
- end: SA(/* @__PURE__ */ new Date())
15771
+ end: IA(/* @__PURE__ */ new Date())
15772
15772
  }), [_, G] = g.useState(6);
15773
15773
  g.useEffect(() => {
15774
15774
  C(s);
@@ -15820,11 +15820,11 @@ const St = g.createContext(null), kh = ({
15820
15820
  c(h, eA, mA), O({ start: eA, end: mA }), r(j.TRENDS_CLICK_DATE, {
15821
15821
  time_period: NA + "M"
15822
15822
  }), G(NA);
15823
- }, TA = () => {
15823
+ }, SA = () => {
15824
15824
  r(j.TRENDS_CLICK_FILTER);
15825
15825
  }, cA = (M) => {
15826
15826
  x(M);
15827
- }, bA = (M) => {
15827
+ }, TA = (M) => {
15828
15828
  x(M), r(j.TRENDS_CLICK_LEGEND, { category: Re[M] });
15829
15829
  }, Ae = (M) => {
15830
15830
  r(j.TRENDS_HOVER_LEGEND, { category: Re[M] });
@@ -15840,7 +15840,7 @@ const St = g.createContext(null), kh = ({
15840
15840
  calendarActions: { onRangeChanged: AA },
15841
15841
  dateRange: P,
15842
15842
  dateRangeVariant: "timeframebuttons",
15843
- onAccountsFilterClick: TA,
15843
+ onAccountsFilterClick: SA,
15844
15844
  onBackClick: A,
15845
15845
  sx: e,
15846
15846
  title: m.title,
@@ -15926,7 +15926,7 @@ const St = g.createContext(null), kh = ({
15926
15926
  S === "Chart" && /* @__PURE__ */ t(
15927
15927
  dc,
15928
15928
  {
15929
- onClickLegend: bA,
15929
+ onClickLegend: TA,
15930
15930
  onHoverArea: Se,
15931
15931
  onHoverLegend: Ae,
15932
15932
  onHoverPoint: Te,
@@ -15953,7 +15953,7 @@ const St = g.createContext(null), kh = ({
15953
15953
  (i) => i.top_level_category_guid !== p.INCOME && i.top_level_category_guid !== p.TRANSFER && i.total > 0
15954
15954
  );
15955
15955
  let r = EA(ae(/* @__PURE__ */ new Date(), 5));
15956
- const a = SA(/* @__PURE__ */ new Date());
15956
+ const a = IA(/* @__PURE__ */ new Date());
15957
15957
  for (; pA(r, a); )
15958
15958
  e.push({
15959
15959
  x: $(r, W.MONTH_SHORT),