@mx-cartographer/experiences 9.2.6 → 9.2.7

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.
@@ -1,42 +1,42 @@
1
1
  import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
- import c from "react";
3
- import { observer as I } from "mobx-react-lite";
4
- import { startOfMonth as at } from "date-fns/startOfMonth";
5
- import { endOfMonth as it } from "date-fns/endOfMonth";
6
- import L from "@mui/material/Box";
7
- import y from "@mui/material/Stack";
8
- import $ from "@mui/material/Tab";
9
- import rt from "@mui/material/Tabs";
10
- import { useTheme as _t } from "@mui/material/styles";
11
- import { g as st, a as lt, S as B, b as q } from "../SpendingLegend-CxvNOg3c.mjs";
12
- import { Text as T, Icon as bt } from "@mxenabled/mxui";
13
- import { f as k } from "../NumberFormatting--XMeeBfr.mjs";
14
- import { u as A, l as R, c as ct, a as P, i as H, g as dt, f as yt } from "../hooks-97sNJ_lf.mjs";
15
- import { u as gt } from "../useWidgetLoadTimer-B0tB-yzL.mjs";
16
- import { L as pt } from "../Loader-CxeBwuPG.mjs";
17
- import { M as Ct } from "../MiniWidgetContainer-Bmv_WeUd.mjs";
2
+ import r from "react";
3
+ import { observer as R } from "mobx-react-lite";
4
+ import { startOfMonth as it } from "date-fns/startOfMonth";
5
+ import { endOfMonth as rt } from "date-fns/endOfMonth";
6
+ import E from "@mui/material/Box";
7
+ import S from "@mui/material/Stack";
8
+ import G from "@mui/material/Tab";
9
+ import st from "@mui/material/Tabs";
10
+ import { useTheme as yt } from "@mui/material/styles";
11
+ import { g as lt, a as ct, S as F, b as q } from "../SpendingLegend-CxvNOg3c.mjs";
12
+ import { Text as D, Icon as bt } from "@mxenabled/mxui";
13
+ import { f as B } from "../NumberFormatting--XMeeBfr.mjs";
14
+ import { u as W, l as k, c as dt, a as P, i as H, g as gt, f as Ct } from "../hooks-97sNJ_lf.mjs";
15
+ import { u as pt } from "../useWidgetLoadTimer-B0tB-yzL.mjs";
16
+ import { L as ut } from "../Loader-CxeBwuPG.mjs";
17
+ import { M as St } from "../MiniWidgetContainer-Bmv_WeUd.mjs";
18
18
  import { startOfToday as J } from "date-fns/startOfToday";
19
- import St from "@mui/material/Button";
20
- import { useTheme as Tt } from "@mui/material";
21
- import { e as Mt } from "../TransactionUtils-BphBJBbU.mjs";
22
- import { T as Dt } from "../EmbeddedCard-CQEnrozC.mjs";
23
- import { T as xt } from "../TransactionDetails-CLc7oeHT.mjs";
19
+ import Tt from "@mui/material/Button";
20
+ import { useTheme as Mt } from "@mui/material";
21
+ import { e as Dt } from "../TransactionUtils-BphBJBbU.mjs";
22
+ import { T as xt } from "../EmbeddedCard-CQEnrozC.mjs";
23
+ import { T as Lt } from "../TransactionDetails-CLc7oeHT.mjs";
24
24
  import vt from "@mui/material/Collapse";
25
25
  import wt from "@mui/material/Divider";
26
26
  import Q from "@mui/material/List";
27
27
  import X from "@mui/material/ListItem";
28
28
  import Z from "@mui/material/ListItemButton";
29
- import { u as Lt } from "../useScreenSize-mWpmnh5w.mjs";
29
+ import { u as At } from "../useScreenSize-mWpmnh5w.mjs";
30
30
  import { D as tt } from "../Drawer-DsnW2o0v.mjs";
31
- import { C as w } from "../Category-DEKZGLYe.mjs";
31
+ import { C as I } from "../Category-DEKZGLYe.mjs";
32
32
  import { parseISO as et } from "date-fns/parseISO";
33
33
  import { A as nt } from "../Analytics-D-jdcL72.mjs";
34
34
  import { W as It } from "../WidgetContainer-DvKtBdhn.mjs";
35
- const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y, { direction: "column", children: [
36
- /* @__PURE__ */ t(T, { bold: !0, sx: { textTransform: "none" }, variant: "body1", children: d }),
37
- /* @__PURE__ */ t(T, { variant: "caption", children: k(n, o === "mini" ? "0,0" : "0,0.00") })
38
- ] }), At = () => {
39
- const n = _t(), { goals: d, spending: o } = A(), { categories: a, dateRangeCategoryTotals: i } = R(), g = c.useMemo(
35
+ const V = ({ amount: n, label: s, variant: o = "full" }) => /* @__PURE__ */ p(S, { direction: "column", children: [
36
+ /* @__PURE__ */ t(D, { bold: !0, sx: { textTransform: "none" }, variant: "body1", children: s }),
37
+ /* @__PURE__ */ t(D, { variant: "caption", children: B(n, o === "mini" ? "0,0" : "0,0.00") })
38
+ ] }), Et = () => {
39
+ const n = yt(), { goals: s, spending: o } = W(), { categories: a, dateRangeCategoryTotals: i } = k(), g = r.useMemo(
40
40
  () => [
41
41
  n.palette.chartMono.chartMono5,
42
42
  n.palette.chartMono.chartMono4,
@@ -46,72 +46,72 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
46
46
  n.palette.chartMono.chartMono6
47
47
  ],
48
48
  [n]
49
- ), [e, r] = c.useState(""), [s, f] = c.useState(0), u = c.useMemo(
50
- () => st(a, d, n, i),
49
+ ), [e, l] = r.useState(""), [c, f] = r.useState(0), u = r.useMemo(
50
+ () => lt(a, s, n, i),
51
51
  [a, i]
52
- ), h = c.useMemo(
53
- () => lt(a, i, g),
52
+ ), h = r.useMemo(
53
+ () => ct(a, i, g),
54
54
  [a, i, g]
55
- ), M = (b, D) => {
56
- f(D), r("");
57
- }, _ = (b) => {
58
- r(e === b ? "" : b);
55
+ ), C = (y, L) => {
56
+ f(L), l("");
57
+ }, _ = (y) => {
58
+ l(e === y ? "" : y);
59
59
  };
60
- return /* @__PURE__ */ p(L, { width: "100%", children: [
60
+ return /* @__PURE__ */ p(E, { width: "100%", children: [
61
61
  /* @__PURE__ */ p(
62
- rt,
62
+ st,
63
63
  {
64
64
  "aria-label": o.mini_title,
65
- onChange: M,
65
+ onChange: C,
66
66
  sx: { touchAction: "manipulation" },
67
- value: s,
67
+ value: c,
68
68
  variant: "fullWidth",
69
69
  children: [
70
70
  /* @__PURE__ */ t(
71
- $,
71
+ G,
72
72
  {
73
73
  "aria-controls": "spending-tabpanel",
74
74
  id: "spending-tab",
75
75
  label: /* @__PURE__ */ t(
76
- G,
76
+ V,
77
77
  {
78
78
  amount: u.totalAmount,
79
79
  label: o.spend_tab_title,
80
80
  variant: "mini"
81
81
  }
82
82
  ),
83
- tabIndex: s === 0 ? 0 : -1
83
+ tabIndex: c === 0 ? 0 : -1
84
84
  }
85
85
  ),
86
86
  /* @__PURE__ */ t(
87
- $,
87
+ G,
88
88
  {
89
89
  "aria-controls": "income-tabpanel",
90
90
  id: "income-tab",
91
91
  label: /* @__PURE__ */ t(
92
- G,
92
+ V,
93
93
  {
94
94
  amount: h.totalAmount,
95
95
  label: o.income_tab_title,
96
96
  variant: "mini"
97
97
  }
98
98
  ),
99
- tabIndex: s === 1 ? 0 : -1
99
+ tabIndex: c === 1 ? 0 : -1
100
100
  }
101
101
  )
102
102
  ]
103
103
  }
104
104
  ),
105
105
  /* @__PURE__ */ t(
106
- L,
106
+ E,
107
107
  {
108
108
  "aria-labelledby": "spending-tab",
109
- hidden: s !== 0,
109
+ hidden: c !== 0,
110
110
  id: "spending-tabpanel",
111
111
  role: "tabpanel",
112
- children: /* @__PURE__ */ p(y, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
112
+ children: /* @__PURE__ */ p(S, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
113
113
  /* @__PURE__ */ t(
114
- B,
114
+ F,
115
115
  {
116
116
  data: u,
117
117
  onSelected: _,
@@ -124,15 +124,15 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
124
124
  }
125
125
  ),
126
126
  /* @__PURE__ */ t(
127
- L,
127
+ E,
128
128
  {
129
129
  "aria-labelledby": "income-tab",
130
- hidden: s !== 1,
130
+ hidden: c !== 1,
131
131
  id: "income-tabpanel",
132
132
  role: "tabpanel",
133
- children: /* @__PURE__ */ p(y, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
133
+ children: /* @__PURE__ */ p(S, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
134
134
  /* @__PURE__ */ t(
135
- B,
135
+ F,
136
136
  {
137
137
  data: h,
138
138
  isIncome: !0,
@@ -146,42 +146,42 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
146
146
  }
147
147
  )
148
148
  ] });
149
- }, Et = I(At), Wt = ({ onPrimaryCtaClick: n, sx: d = {} }) => {
150
- const { isAccountDataLoaded: o, loadAccountData: a } = ct(), { dateRangeTotalsLoaded: i, categoriesLoaded: g, loadCategories: e, loadDateRangeCategoryTotals: r } = R(), { spending: s } = A(), { isInitialized: f, selectedAccounts: u } = P();
151
- return gt({
149
+ }, Rt = R(Et), Wt = ({ onPrimaryCtaClick: n, sx: s = {} }) => {
150
+ const { isAccountDataLoaded: o, loadAccountData: a } = dt(), { dateRangeTotalsLoaded: i, categoriesLoaded: g, loadCategories: e, loadDateRangeCategoryTotals: l } = k(), { spending: c } = W(), { isInitialized: f, selectedAccounts: u } = P();
151
+ return pt({
152
152
  widgetName: "SpendingMiniWidget",
153
153
  isLoaded: i
154
- }), c.useEffect(() => {
154
+ }), r.useEffect(() => {
155
155
  o || a().finally(), g || e().finally();
156
- }, []), c.useEffect(() => {
157
- !f || !o || r(
156
+ }, []), r.useEffect(() => {
157
+ !f || !o || l(
158
158
  u,
159
- at(/* @__PURE__ */ new Date()),
160
- it(/* @__PURE__ */ new Date())
159
+ it(/* @__PURE__ */ new Date()),
160
+ rt(/* @__PURE__ */ new Date())
161
161
  ).finally();
162
- }, [f, o, u]), !f || !o || !i ? /* @__PURE__ */ t(pt, {}) : /* @__PURE__ */ t(
163
- Ct,
162
+ }, [f, o, u]), !f || !o || !i ? /* @__PURE__ */ t(ut, {}) : /* @__PURE__ */ t(
163
+ St,
164
164
  {
165
165
  className: "mx-exp-spending-miniwidget",
166
166
  onPrimaryCtaClick: n,
167
- primaryCtaLabel: s.primary_cta,
168
- primaryCtaLabelAria: s.primary_cta_aria,
169
- sx: { height: "100%", ...d },
170
- title: s.mini_title,
171
- children: /* @__PURE__ */ t(Et, {})
167
+ primaryCtaLabel: c.primary_cta,
168
+ primaryCtaLabelAria: c.primary_cta_aria,
169
+ sx: { height: "100%", ...s },
170
+ title: c.mini_title,
171
+ children: /* @__PURE__ */ t(Rt, {})
172
172
  }
173
173
  );
174
- }, Ce = I(Wt), Rt = ({
174
+ }, Se = R(Wt), Nt = ({
175
175
  data: n,
176
- onSelected: d,
176
+ onSelected: s,
177
177
  selectedId: o = "",
178
178
  title: a
179
179
  }) => {
180
- const { spending: i } = A(), g = n.categoryData.find((e) => e.guid === o);
181
- return /* @__PURE__ */ p(y, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
182
- /* @__PURE__ */ t(T, { bold: !0, id: "spending-list-title", sx: { py: 12 }, variant: "h3", children: `${a} ${i.by_category}` }),
180
+ const { spending: i } = W(), g = n.categoryData.find((e) => e.guid === o);
181
+ return /* @__PURE__ */ p(S, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
182
+ /* @__PURE__ */ t(D, { bold: !0, id: "spending-list-title", sx: { py: 12 }, variant: "h3", children: `${a} ${i.by_category}` }),
183
183
  /* @__PURE__ */ t(wt, { "aria-hidden": "true" }),
184
- /* @__PURE__ */ t(Q, { "aria-labelledby": "spending-list-title", children: n.categoryData.map((e) => /* @__PURE__ */ p(c.Fragment, { children: [
184
+ /* @__PURE__ */ t(Q, { "aria-labelledby": "spending-list-title", children: n.categoryData.map((e) => /* @__PURE__ */ p(r.Fragment, { children: [
185
185
  /* @__PURE__ */ t(
186
186
  X,
187
187
  {
@@ -197,11 +197,11 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
197
197
  {
198
198
  "aria-expanded": g?.guid === e.guid,
199
199
  id: `spending-list-category-${e.guid}`,
200
- onClick: () => d(e.guid),
200
+ onClick: () => s(e.guid),
201
201
  sx: { minHeight: 44, px: 8, py: 0 },
202
202
  children: [
203
203
  /* @__PURE__ */ t(
204
- L,
204
+ E,
205
205
  {
206
206
  "aria-hidden": "true",
207
207
  borderRadius: 4,
@@ -213,15 +213,15 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
213
213
  }
214
214
  ),
215
215
  /* @__PURE__ */ p(
216
- y,
216
+ S,
217
217
  {
218
218
  alignItems: "center",
219
219
  direction: "row",
220
220
  justifyContent: "space-between",
221
221
  width: "100%",
222
222
  children: [
223
- /* @__PURE__ */ t(T, { bold: o === e.guid, children: e.name }),
224
- /* @__PURE__ */ t(T, { bold: o === e.guid, variant: "body1", children: k(e.amount, "0,0.00") })
223
+ /* @__PURE__ */ t(D, { bold: o === e.guid, children: e.name }),
224
+ /* @__PURE__ */ t(D, { bold: o === e.guid, variant: "body1", children: B(e.amount, "0,0.00") })
225
225
  ]
226
226
  }
227
227
  )
@@ -230,7 +230,7 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
230
230
  )
231
231
  }
232
232
  ),
233
- e.categoryTotals && e.categoryTotals.length > 0 && /* @__PURE__ */ t(vt, { in: g?.guid === e.guid, unmountOnExit: !0, children: /* @__PURE__ */ t(Q, { sx: { borderBottom: 1, borderColor: "divider" }, children: g?.categoryTotals?.map((r) => /* @__PURE__ */ t(
233
+ e.categoryTotals && e.categoryTotals.length > 0 && /* @__PURE__ */ t(vt, { in: g?.guid === e.guid, unmountOnExit: !0, children: /* @__PURE__ */ t(Q, { sx: { borderBottom: 1, borderColor: "divider" }, children: g?.categoryTotals?.map((l) => /* @__PURE__ */ t(
234
234
  X,
235
235
  {
236
236
  sx: {
@@ -240,34 +240,34 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
240
240
  children: /* @__PURE__ */ t(
241
241
  Z,
242
242
  {
243
- id: `spending-list-subcategory-${r.guid}`,
244
- onClick: () => d(r.guid, !0),
243
+ id: `spending-list-subcategory-${l.guid}`,
244
+ onClick: () => s(l.guid, !0),
245
245
  sx: { minHeight: 44, px: 8, py: 0 },
246
- children: /* @__PURE__ */ p(y, { direction: "row", justifyContent: "space-between", width: "100%", children: [
247
- /* @__PURE__ */ p(T, { children: [
248
- r.name,
246
+ children: /* @__PURE__ */ p(S, { direction: "row", justifyContent: "space-between", width: "100%", children: [
247
+ /* @__PURE__ */ p(D, { children: [
248
+ l.name,
249
249
  " "
250
250
  ] }),
251
- /* @__PURE__ */ t(T, { children: k(r.amount, "0,0.00") })
251
+ /* @__PURE__ */ t(D, { children: B(l.amount, "0,0.00") })
252
252
  ] })
253
253
  }
254
254
  )
255
255
  },
256
- r.guid
256
+ l.guid
257
257
  )) }) })
258
258
  ] }, e.guid)) }),
259
- /* @__PURE__ */ t(T, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${i.total}: ${k(n.totalAmount, "0,0.00")}` })
259
+ /* @__PURE__ */ t(D, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${i.total}: ${B(n.totalAmount, "0,0.00")}` })
260
260
  ] });
261
- }, Nt = I(Rt), Ot = ({
261
+ }, $t = R(Nt), Ot = ({
262
262
  data: n,
263
- onSelected: d,
263
+ onSelected: s,
264
264
  onViewTransactions: o,
265
265
  selectedId: a,
266
266
  title: i
267
267
  }) => {
268
- const { isDesktop: g, isMobile: e } = Lt(), { dateRangeTotalsLoading: r } = R(), { spending: s } = A();
268
+ const { isDesktop: g, isMobile: e } = At(), { dateRangeTotalsLoading: l } = k(), { spending: c } = W();
269
269
  return /* @__PURE__ */ p(
270
- y,
270
+ S,
271
271
  {
272
272
  alignItems: e ? "center" : "flex-start",
273
273
  direction: e ? "column" : "row",
@@ -276,8 +276,8 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
276
276
  pt: 50,
277
277
  px: 8,
278
278
  children: [
279
- r && /* @__PURE__ */ t(
280
- B,
279
+ l && /* @__PURE__ */ t(
280
+ F,
281
281
  {
282
282
  data: {
283
283
  categoryData: [],
@@ -292,111 +292,111 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
292
292
  variant: "full"
293
293
  }
294
294
  ),
295
- !r && /* @__PURE__ */ t(
296
- B,
295
+ !l && /* @__PURE__ */ t(
296
+ F,
297
297
  {
298
298
  data: n,
299
299
  onSelected: (h) => {
300
- d(h), setTimeout(() => document.getElementById(`spending-list-category-${h}`)?.focus(), 0);
300
+ s(h), setTimeout(() => document.getElementById(`spending-list-category-${h}`)?.focus(), 0);
301
301
  },
302
302
  onViewTransactions: o,
303
303
  selectedId: a,
304
304
  size: g ? 400 : 300,
305
- totalLabel: s.total_amount,
305
+ totalLabel: c.total_amount,
306
306
  variant: "full"
307
307
  }
308
308
  ),
309
- /* @__PURE__ */ t(Nt, { data: n, onSelected: d, selectedId: a, title: i })
309
+ /* @__PURE__ */ t($t, { data: n, onSelected: s, selectedId: a, title: i })
310
310
  ]
311
311
  }
312
312
  );
313
- }, ot = I(Ot), kt = (n) => [
313
+ }, ot = R(Ot), kt = (n) => [
314
314
  n.palette.chartMono.chartMono5,
315
315
  n.palette.chartMono.chartMono4,
316
316
  n.palette.chartMono.chartMono3,
317
317
  n.palette.chartMono.chartMono2,
318
318
  n.palette.chartMono.chartMono1,
319
319
  n.palette.chartMono.chartMono6
320
- ], $t = () => {
321
- const n = Tt(), { is_mobile_webview: d } = H(), { clientConfig: o } = H(), { categories: a, dateRangeCategoryTotals: i } = R(), {
320
+ ], jt = () => {
321
+ const n = Mt(), { is_mobile_webview: s } = H(), { clientConfig: o } = H(), { categories: a, dateRangeCategoryTotals: i } = k(), {
322
322
  goals: g,
323
323
  spending: e,
324
- transactions: r
325
- } = A(), { displayedDateRange: s, selectedAccountGuids: f } = P(), {
324
+ transactions: l
325
+ } = W(), { displayedDateRange: c, selectedAccountGuids: f } = P(), {
326
326
  setFilter: u,
327
327
  sortedTransactions: h,
328
- sortedTransactionsWithSplits: M,
328
+ sortedTransactionsWithSplits: C,
329
329
  tags: _
330
- } = dt(), b = o?.master?.deep_link_params?.account_guids, D = o?.master?.deep_link_params?.view, [x, N] = c.useState(""), [v, C] = c.useState(D === "income" ? 1 : 0), [E, W] = c.useState(""), [O, j] = c.useState(!1), F = c.useMemo(
331
- () => st(a, g, n, i),
330
+ } = gt(), y = o?.master?.deep_link_params?.account_guids, L = o?.master?.deep_link_params?.view, [T, N] = r.useState(""), [v, $] = r.useState(L === "income" ? 1 : 0), [O, j] = r.useState(""), [b, w] = r.useState(!1), x = r.useMemo(
331
+ () => lt(a, g, n, i),
332
332
  [a, i]
333
- ), K = c.useMemo(
334
- () => lt(a, i, kt(n)),
333
+ ), A = r.useMemo(
334
+ () => ct(a, i, kt(n)),
335
335
  [a, i]
336
- ), V = c.useMemo(
337
- () => h.find((l) => l.guid === E),
338
- [E, h]
339
- ), ut = (l, S) => {
340
- C(S), N("");
341
- }, U = (l, S = !1) => {
342
- S ? mt(l) : N(x === l || l === "0" ? "" : l);
343
- }, mt = (l) => {
336
+ ), z = r.useMemo(
337
+ () => h.find((d) => d.guid === O),
338
+ [O, h]
339
+ ), mt = (d, M) => {
340
+ $(M), N("");
341
+ }, U = (d, M = !1) => {
342
+ M ? ht(d) : N(T === d || d === "0" ? "" : d);
343
+ }, ht = (d) => {
344
344
  u({
345
345
  ...{
346
- accounts: b || f,
347
- dateRange: s
346
+ accounts: y || f,
347
+ dateRange: c
348
348
  },
349
- custom: (m) => x === "other" ? m.top_level_category_guid === l : m.category_guid === l,
349
+ custom: (m) => T === "other" ? m.top_level_category_guid === d : m.category_guid === d,
350
350
  showSplits: !0
351
- }), j(!0);
352
- }, Y = (l) => {
353
- const S = {
354
- accounts: b || f,
355
- dateRange: s
351
+ }), w(!0);
352
+ }, Y = (d) => {
353
+ const M = {
354
+ accounts: y || f,
355
+ dateRange: c
356
356
  };
357
357
  if (v === 0)
358
- if (l === "other") {
359
- const m = F.categoryData.find((z) => z.guid === "other");
358
+ if (d === "other") {
359
+ const m = x.categoryData.find((K) => K.guid === "other");
360
360
  u({
361
- ...S,
362
- custom: (z) => !!m?.categoryTotals?.find((ft) => ft.guid === z.top_level_category_guid)
361
+ ...M,
362
+ custom: (K) => !!m?.categoryTotals?.find((_t) => _t.guid === K.top_level_category_guid)
363
363
  });
364
364
  } else
365
365
  u({
366
- ...S,
367
- custom: (m) => l ? m.top_level_category_guid === l : m.top_level_category_guid !== w.INCOME && m.category_guid !== w.INCOME && m.top_level_category_guid !== w.INVESTMENTS && m.top_level_category_guid !== w.TRANSFER,
368
- showSplits: !!l
366
+ ...M,
367
+ custom: (m) => d ? m.top_level_category_guid === d : m.top_level_category_guid !== I.INCOME && m.category_guid !== I.INCOME && m.top_level_category_guid !== I.INVESTMENTS && m.top_level_category_guid !== I.TRANSFER,
368
+ showSplits: !!d
369
369
  });
370
370
  else
371
371
  u({
372
- ...S,
373
- custom: (m) => l ? m.category_guid === l : m.category_guid === w.INCOME || m.top_level_category_guid === w.INCOME
372
+ ...M,
373
+ custom: (m) => d ? m.category_guid === d : m.category_guid === I.INCOME || m.top_level_category_guid === I.INCOME
374
374
  });
375
- j(!0);
376
- }, ht = () => {
377
- Mt(M, _);
375
+ w(!0);
376
+ }, ft = () => {
377
+ Dt(C, _);
378
378
  };
379
- return /* @__PURE__ */ p(L, { children: [
380
- /* @__PURE__ */ p(rt, { onChange: ut, value: v, variant: "fullWidth", children: [
379
+ return /* @__PURE__ */ p(E, { children: [
380
+ /* @__PURE__ */ p(st, { onChange: mt, value: v, variant: "fullWidth", children: [
381
381
  /* @__PURE__ */ t(
382
- $,
382
+ G,
383
383
  {
384
384
  label: /* @__PURE__ */ t(
385
- G,
385
+ V,
386
386
  {
387
- amount: F.totalAmount,
387
+ amount: x.totalAmount,
388
388
  label: e.spend_tab_title
389
389
  }
390
390
  )
391
391
  }
392
392
  ),
393
393
  /* @__PURE__ */ t(
394
- $,
394
+ G,
395
395
  {
396
396
  label: /* @__PURE__ */ t(
397
- G,
397
+ V,
398
398
  {
399
- amount: K.totalAmount,
399
+ amount: A.totalAmount,
400
400
  label: e.income_tab_title
401
401
  }
402
402
  )
@@ -406,20 +406,20 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
406
406
  v === 0 && /* @__PURE__ */ t(
407
407
  ot,
408
408
  {
409
- data: F,
409
+ data: x,
410
410
  onSelected: U,
411
411
  onViewTransactions: Y,
412
- selectedId: x,
412
+ selectedId: T,
413
413
  title: e.spend_tab_title
414
414
  }
415
415
  ),
416
416
  v === 1 && /* @__PURE__ */ t(
417
417
  ot,
418
418
  {
419
- data: K,
419
+ data: A,
420
420
  onSelected: U,
421
421
  onViewTransactions: Y,
422
- selectedId: x,
422
+ selectedId: T,
423
423
  title: e.income_tab_title
424
424
  }
425
425
  ),
@@ -427,20 +427,20 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
427
427
  tt,
428
428
  {
429
429
  ariaLabelClose: e.close_drawer_aria,
430
- isOpen: O,
431
- onClose: () => j(!1),
430
+ isOpen: b,
431
+ onClose: () => w(!1),
432
432
  title: e.transactions_drawer_title,
433
- children: /* @__PURE__ */ p(y, { children: [
434
- !d && h.length > 0 && /* @__PURE__ */ t(y, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ t(
435
- St,
433
+ children: /* @__PURE__ */ p(S, { children: [
434
+ !s && h.length > 0 && /* @__PURE__ */ t(S, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ t(
435
+ Tt,
436
436
  {
437
- onClick: ht,
437
+ onClick: ft,
438
438
  startIcon: /* @__PURE__ */ t(bt, { name: "ios_share" }),
439
439
  variant: "text",
440
- children: r.export_csv_btn
440
+ children: l.export_csv_btn
441
441
  }
442
442
  ) }),
443
- /* @__PURE__ */ t(Dt, { onClick: W })
443
+ /* @__PURE__ */ t(xt, { onClick: j })
444
444
  ] })
445
445
  }
446
446
  ),
@@ -448,46 +448,70 @@ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
448
448
  tt,
449
449
  {
450
450
  ariaLabelClose: e.close_drawer_aria,
451
- isOpen: !!V,
452
- onClose: () => W(""),
451
+ isOpen: !!z,
452
+ onClose: () => j(""),
453
453
  title: e.transaction_details_drawer_title,
454
- children: V && /* @__PURE__ */ t(xt, { transaction: V })
454
+ children: z && /* @__PURE__ */ t(Lt, { transaction: z })
455
455
  }
456
456
  )
457
457
  ] });
458
- }, Bt = I($t), Gt = ({ onBackClick: n, onMenuClick: d, sx: o = {} }) => {
459
- const { isAccountDataLoaded: a, loadAccountData: i } = ct(), { categoriesLoaded: g, dateRangeTotalsLoaded: e, loadCategories: r, loadDateRangeCategoryTotals: s } = R(), { isTransactionDataLoaded: f, loadTransactionData: u } = dt(), { spending: h } = A(), { displayedDateRange: M, isInitialized: _, setDisplayedDate: b, selectedAccounts: D } = P(), { onEvent: x } = yt(), { clientConfig: N } = H();
460
- gt({
458
+ }, Bt = R(jt), at = (n, s, o) => `${n.getTime()}-${s.getTime()}-${[...o].sort().join(",")}`, Gt = ({ onBackClick: n, onMenuClick: s, sx: o = {} }) => {
459
+ const { isAccountDataLoaded: a, loadAccountData: i } = dt(), { categoriesLoaded: g, dateRangeTotalsLoaded: e, loadCategories: l, loadDateRangeCategoryTotals: c } = k(), { isTransactionDataLoaded: f, loadTransactionData: u } = gt(), { spending: h } = W(), {
460
+ displayedDateRange: C,
461
+ isInitialized: _,
462
+ setDisplayedDate: y,
463
+ selectedAccounts: L,
464
+ selectedAccountGuids: T
465
+ } = P(), { onEvent: N } = Ct(), { clientConfig: v } = H();
466
+ pt({
461
467
  widgetName: "SpendingWidget",
462
468
  isLoaded: e
463
- }), c.useEffect(() => {
464
- const C = N?.master?.deep_link_params, E = C?.date_range ? [et(C.date_range.from), et(C.date_range.to)] : [at(J()), it(J())], W = E[0], O = E[1];
465
- b(W, O), a || i().finally(), g || r().finally(), f || u().finally(), _ && a && s(D, W, O).finally(), x(nt.SPENDING_VIEW);
466
- }, []), c.useEffect(() => {
467
- _ && a && s(
468
- D,
469
- M.start,
470
- M.end
471
- ).finally();
472
- }, [M, _, a, D]);
473
- const v = (C) => {
474
- b(C[0], C[1]);
469
+ });
470
+ const $ = r.useRef(null), O = r.useRef(!1);
471
+ r.useEffect(() => {
472
+ const b = v?.master?.deep_link_params, w = b?.date_range ? [et(b.date_range.from), et(b.date_range.to)] : [it(J()), rt(J())], x = w[0], A = w[1];
473
+ y(x, A), a || i().finally(), g || l().finally(), f || u().finally(), _ && a && ($.current = at(x, A, T), c(L, x, A).finally()), N(nt.SPENDING_VIEW);
474
+ }, []), r.useEffect(() => {
475
+ if (!O.current) {
476
+ O.current = !0;
477
+ return;
478
+ }
479
+ if (!_ || !a) return;
480
+ const b = at(
481
+ C.start,
482
+ C.end,
483
+ T
484
+ );
485
+ $.current !== b && ($.current = b, c(
486
+ L,
487
+ C.start,
488
+ C.end
489
+ ).finally());
490
+ }, [
491
+ C.start.getTime(),
492
+ C.end.getTime(),
493
+ _,
494
+ a,
495
+ T.join(",")
496
+ ]);
497
+ const j = (b) => {
498
+ y(b[0], b[1]);
475
499
  };
476
- return !_ || !a || !e ? /* @__PURE__ */ t(pt, {}) : /* @__PURE__ */ t(
500
+ return !_ || !a || !e ? /* @__PURE__ */ t(ut, {}) : /* @__PURE__ */ t(
477
501
  It,
478
502
  {
479
- calendarActions: { onRangeChanged: v },
480
- onAccountsFilterClick: () => x(nt.SPENDING_CLICK_FILTER),
503
+ calendarActions: { onRangeChanged: j },
504
+ onAccountsFilterClick: () => N(nt.SPENDING_CLICK_FILTER),
481
505
  onBackClick: n,
482
- onMenuClick: d,
506
+ onMenuClick: s,
483
507
  sx: o,
484
508
  title: h.title,
485
- children: /* @__PURE__ */ t(L, { width: "100%", children: /* @__PURE__ */ t(Bt, {}) })
509
+ children: /* @__PURE__ */ t(E, { width: "100%", children: /* @__PURE__ */ t(Bt, {}) })
486
510
  }
487
511
  );
488
- }, Se = I(Gt);
512
+ }, Te = R(Gt);
489
513
  export {
490
- Ce as SpendingMiniWidget,
491
- Se as SpendingWidget
514
+ Se as SpendingMiniWidget,
515
+ Te as SpendingWidget
492
516
  };
493
517
  //# sourceMappingURL=index.es.js.map