@mx-cartographer/experiences 7.0.3 → 7.0.5

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.
@@ -0,0 +1,79 @@
1
+ import { jsx as e, Fragment as b, jsxs as t } from "react/jsx-runtime";
2
+ import m from "react";
3
+ import { observer as u } from "mobx-react-lite";
4
+ import c from "@mui/material/Box";
5
+ import p from "@mui/material/Tab";
6
+ import R from "@mui/material/Tabs";
7
+ import l from "@mui/material/Divider";
8
+ import T from "@mui/material/List";
9
+ import C from "@mui/material/Stack";
10
+ import { R as x, A as S, a as E, M as A } from "./ManageIncome-DT62iZim.mjs";
11
+ import { u as h, h as y, e as _ } from "./hooks-02T565vf.mjs";
12
+ import { R as v, F as N } from "./RepeatingTransaction-BW4J-jeJ.mjs";
13
+ import { A as d } from "./WidgetContainer-BG-fdDOf.mjs";
14
+ const I = u(() => {
15
+ const { recurring: r } = h(), { repeatingTransactions: s } = y(), { onEvent: o } = _(), a = (n) => {
16
+ o(d.RECURRING_TRANSACTIONS_CLICK_EXPENSE, {
17
+ repeating_transaction_guid: n.guid
18
+ });
19
+ }, g = () => {
20
+ o(d.RECURRING_TRANSACTIONS_CLICK_ADD_EXPENSE);
21
+ }, i = s.filter(
22
+ (n) => n.repeating_transaction_type !== v.Income && (n.transactions.length > 0 || n.recurrence_type === N.EveryYear)
23
+ );
24
+ return /* @__PURE__ */ e(b, { children: i.length !== 0 ? /* @__PURE__ */ t(C, { sx: { justifyContent: "space-between", height: "calc(100% - 57px)" }, children: [
25
+ /* @__PURE__ */ e(T, { sx: { bgcolor: "background.paper" }, children: i.map((n, f) => /* @__PURE__ */ t(m.Fragment, { children: [
26
+ /* @__PURE__ */ e(x, { onClick: a, repeatingTransaction: n }),
27
+ /* @__PURE__ */ e(
28
+ l,
29
+ {
30
+ variant: f < i.length - 1 ? "inset" : "fullWidth"
31
+ }
32
+ )
33
+ ] }, n.guid)) }),
34
+ /* @__PURE__ */ t(c, { children: [
35
+ /* @__PURE__ */ e(l, {}),
36
+ /* @__PURE__ */ e(
37
+ c,
38
+ {
39
+ sx: {
40
+ alignContent: "center",
41
+ bgcolor: "background.paper",
42
+ justifyContent: "flex-end",
43
+ px: 24,
44
+ py: 12,
45
+ textAlign: "right"
46
+ },
47
+ children: /* @__PURE__ */ e(S, { label: r.add_expense, onAddRecurringTransaction: g })
48
+ }
49
+ )
50
+ ] })
51
+ ] }) : /* @__PURE__ */ e(E, { zeroStateFor: "expenses" }) });
52
+ }), X = u(() => {
53
+ const [r, s] = m.useState(0), { onEvent: o } = _(), { recurring: a } = h();
54
+ return /* @__PURE__ */ t(c, { bgcolor: "background.default", height: "100%", children: [
55
+ /* @__PURE__ */ t(
56
+ R,
57
+ {
58
+ onChange: (i, n) => {
59
+ s(n), o(
60
+ n === 0 ? "recurring_transactions_widget_manage_expenses" : "recurring_transactions_widget_edit_income"
61
+ );
62
+ },
63
+ sx: { bgcolor: "background.paper" },
64
+ value: r,
65
+ variant: "fullWidth",
66
+ children: [
67
+ /* @__PURE__ */ e(p, { label: a.expenses }),
68
+ /* @__PURE__ */ e(p, { label: a.income })
69
+ ]
70
+ }
71
+ ),
72
+ r === 0 && /* @__PURE__ */ e(I, {}),
73
+ r === 1 && /* @__PURE__ */ e(A, {})
74
+ ] });
75
+ });
76
+ export {
77
+ I as M,
78
+ X as R
79
+ };
@@ -8,7 +8,7 @@ import { startOfMonth as I } from "date-fns/startOfMonth";
8
8
  import { startOfToday as c } from "date-fns/startOfToday";
9
9
  import { subDays as y } from "date-fns/subDays";
10
10
  import { F as x, A as o } from "./Fetch-CkFKy79O.mjs";
11
- import { b as A, a, c as h, d as u } from "./RepeatingTransaction-BPWfaB3f.mjs";
11
+ import { b as A, a, c as h, d as u } from "./RepeatingTransaction-BW4J-jeJ.mjs";
12
12
  var E = /* @__PURE__ */ ((r) => (r.Small = "small", r.Medium = "medium", r.Large = "large", r))(E || {});
13
13
  const U = 44;
14
14
  class d {
@@ -0,0 +1,291 @@
1
+ import { jsxs as M, Fragment as B, jsx as d } from "react/jsx-runtime";
2
+ import P from "@mui/material/Avatar";
3
+ import w from "@mui/material/ListItem";
4
+ import L from "@mui/material/ListItemAvatar";
5
+ import U from "@mui/material/ListItemButton";
6
+ import G from "@mui/material/ListItemText";
7
+ import { Icon as I, IconWeight as S } from "@mxenabled/mxui";
8
+ import C from "@mui/material/ListItemIcon";
9
+ import $ from "@mui/material/MenuItem";
10
+ import j from "@mui/material/TextField";
11
+ import { ExpandMore as z } from "@mxenabled/mx-icons";
12
+ import { addDays as Q } from "date-fns/addDays";
13
+ import { addMonths as f } from "date-fns/addMonths";
14
+ import { addQuarters as A } from "date-fns/addQuarters";
15
+ import { addYears as K } from "date-fns/addYears";
16
+ import { formatISO as H } from "date-fns/formatISO";
17
+ import { fromUnixTime as V } from "date-fns/fromUnixTime";
18
+ import { getUnixTime as y } from "date-fns/getUnixTime";
19
+ import { isAfter as h } from "date-fns/isAfter";
20
+ import { isBefore as i } from "date-fns/isBefore";
21
+ import { isSameDay as X } from "date-fns/isSameDay";
22
+ import { nextDay as E } from "date-fns/nextDay";
23
+ import { parseISO as J } from "date-fns/parseISO";
24
+ import { setDate as g } from "date-fns/setDate";
25
+ import { startOfToday as b } from "date-fns/startOfToday";
26
+ import { subDays as D } from "date-fns/subDays";
27
+ import { subMonths as Z } from "date-fns/subMonths";
28
+ import { subQuarters as N } from "date-fns/subQuarters";
29
+ import { subYears as T } from "date-fns/subYears";
30
+ import { lastDayOfMonth as q } from "date-fns/lastDayOfMonth";
31
+ import { setDayOfYear as F } from "date-fns/setDayOfYear";
32
+ import { g as R, a as ee, b as te, c as re, d as oe, e as ae, f as ne } from "./DateUtil-BcuH7ErC.mjs";
33
+ import { b as W } from "./NumberFormatting-CtWHhyBX.mjs";
34
+ import { f as v, D as k } from "./Dialog-CWW597AF.mjs";
35
+ import { b as l } from "./Localization-2MODESHW.mjs";
36
+ const se = ({ iconName: e, label: a, onClick: t, value: n }) => {
37
+ const o = /* @__PURE__ */ M(B, { children: [
38
+ /* @__PURE__ */ d(L, { children: /* @__PURE__ */ d(P, { sx: { bgcolor: "border.light" }, variant: "rounded", children: /* @__PURE__ */ d(I, { name: e, sx: { color: "text.primary" }, weight: S.Dark }) }) }),
39
+ /* @__PURE__ */ d(
40
+ G,
41
+ {
42
+ primary: a,
43
+ primaryTypographyProps: { variant: "XSmall" },
44
+ secondary: n,
45
+ secondaryTypographyProps: { color: "text.default", variant: "Body", fontWeight: 600 }
46
+ }
47
+ )
48
+ ] });
49
+ return t ? /* @__PURE__ */ d(w, { disableGutters: !0, disablePadding: !0, children: /* @__PURE__ */ M(U, { onClick: t, children: [
50
+ o,
51
+ /* @__PURE__ */ d(C, { children: /* @__PURE__ */ d(I, { name: "chevron_right", size: 24 }) })
52
+ ] }) }) : /* @__PURE__ */ d(w, { disableGutters: !1, disablePadding: !1, children: o });
53
+ }, Fe = se, Re = ({ label: e, onChange: a, options: t, value: n }) => /* @__PURE__ */ d(
54
+ j,
55
+ {
56
+ InputLabelProps: { shrink: !0 },
57
+ SelectProps: {
58
+ IconComponent: (r) => /* @__PURE__ */ d(z, { size: 20, sx: { mr: 4 }, ...r })
59
+ },
60
+ defaultValue: 0,
61
+ label: e,
62
+ onChange: (r) => {
63
+ a(Number(r.target.value));
64
+ },
65
+ select: !0,
66
+ value: n,
67
+ variant: "outlined",
68
+ children: t.map((r) => /* @__PURE__ */ d($, { value: r.id, children: r.label }, r.id))
69
+ }
70
+ ), ce = (e) => {
71
+ if (!e) return "";
72
+ let a = e.user_name || e.feed_name || "";
73
+ return e.account_number && (a = `${a} *${e.account_number}`), a;
74
+ }, ie = (e, a) => {
75
+ const t = [], n = e.transactions.find(
76
+ (m) => m.repeating_transaction_guid === e.guid
77
+ );
78
+ if (!n) return [];
79
+ const o = J(e.predicted_occurs_on), r = {
80
+ accountGuid: e.account?.guid || "",
81
+ amount: e.amount,
82
+ categoryGuid: n.category_guid || "",
83
+ expectedDate: o,
84
+ frequency: e.recurrence_type,
85
+ institutionGuid: e.account?.institution_guid || "",
86
+ institutionName: ce(e.account),
87
+ merchantGuid: e.merchant_guid,
88
+ name: e.description,
89
+ recurrenceDay: e.recurrence_day,
90
+ repeatingTransactionGuid: e.guid,
91
+ secondRecurrenceDay: e.second_recurrence_day,
92
+ status: p.Upcoming,
93
+ type: e.repeating_transaction_type === Y.Income ? O.Income : O.Expense,
94
+ transaction: void 0
95
+ }, u = a.start, c = a.end;
96
+ switch (e.recurrence_type) {
97
+ case s.EveryWeek:
98
+ t.push(...ue(r, u, c));
99
+ break;
100
+ case s.EveryOtherWeek:
101
+ t.push(...de(r, u, c));
102
+ break;
103
+ case s.TwiceAMonth:
104
+ t.push(...me(r, u, c));
105
+ break;
106
+ case s.EveryMonth:
107
+ t.push(...le(r, u, c));
108
+ break;
109
+ case s.EveryOtherMonth:
110
+ t.push(...he(r, u, c));
111
+ break;
112
+ case s.EveryQuarter:
113
+ t.push(...fe(r, u, c));
114
+ break;
115
+ case s.EveryOtherQuarter:
116
+ t.push(...pe(r, u, c));
117
+ break;
118
+ case s.EveryYear:
119
+ t.push(...ye(r, u, c));
120
+ break;
121
+ }
122
+ for (const m of t) {
123
+ const _ = e.transactions.find(
124
+ (x) => x.repeating_transaction_guid === e.guid && x.date > y(D(m.expectedDate, 5)) && x.date < y(Q(m.expectedDate, 5))
125
+ );
126
+ _ ? (m.transaction = _, m.status = p.Paid, m.occurredOnDate = V(_.date)) : i(m.expectedDate, D(b(), 3)) && (m.status = p.Missed);
127
+ }
128
+ return t;
129
+ }, ue = (e, a, t) => {
130
+ const n = [];
131
+ let o = E(a, e.recurrenceDay);
132
+ for (; i(o, t); )
133
+ n.push({ ...e, expectedDate: o }), o = E(o, e.recurrenceDay);
134
+ return n;
135
+ }, de = (e, a, t) => {
136
+ const n = [], o = e.expectedDate;
137
+ if (i(o, t)) {
138
+ let r = D(o, 14);
139
+ for (; h(r, a) || X(r, a); )
140
+ n.push({ ...e, expectedDate: r }), r = D(r, 14);
141
+ for (r = o; h(r, a) && i(r, t); )
142
+ n.push({ ...e, expectedDate: r }), r = Q(r, 14);
143
+ }
144
+ return n;
145
+ }, me = (e, a, t) => {
146
+ const n = [];
147
+ let o = g(a, e.recurrenceDay);
148
+ for (; i(o, t); )
149
+ n.push({ ...e, expectedDate: o }), o = f(o, 1);
150
+ let r = e.secondRecurrenceDay && e.secondRecurrenceDay < 28 ? g(a, e.secondRecurrenceDay) : q(a);
151
+ for (; i(r, t); )
152
+ n.push({ ...e, expectedDate: r }), r = f(r, 1);
153
+ return n;
154
+ }, le = (e, a, t) => {
155
+ const n = [];
156
+ let o = g(a, e.recurrenceDay);
157
+ for (n.push({ ...e, expectedDate: o }), o = f(o, 1); i(o, t); )
158
+ n.push({ ...e, expectedDate: o }), o = f(o, 1);
159
+ return n;
160
+ }, he = (e, a, t) => {
161
+ const n = [], o = e.expectedDate;
162
+ let r = i(o, t) ? o : Z(o, 2);
163
+ for (; i(r, t); )
164
+ h(r, a) && n.push({ ...e, expectedDate: r }), r = f(r, 2);
165
+ return n;
166
+ }, fe = (e, a, t) => {
167
+ const n = [], o = e.expectedDate;
168
+ let r = i(o, t) ? o : N(o, 1);
169
+ for (; i(r, t); )
170
+ h(r, a) && n.push({ ...e, expectedDate: r }), r = A(r, 1);
171
+ return n;
172
+ }, pe = (e, a, t) => {
173
+ const n = [], o = e.expectedDate;
174
+ let r = i(o, t) ? o : N(o, 2);
175
+ for (; i(r, t); )
176
+ h(r, a) && n.push({ ...e, expectedDate: r }), r = A(r, 2);
177
+ return n;
178
+ }, ye = (e, a, t) => {
179
+ const n = [], o = e.expectedDate;
180
+ let r = i(o, t) ? o : T(o, 1);
181
+ for (; i(r, t); )
182
+ h(r, a) && n.push({ ...e, expectedDate: r }), r = K(r, 1);
183
+ return n;
184
+ }, et = (e, a) => {
185
+ const t = [];
186
+ for (const n of e) {
187
+ const o = ie(n, a);
188
+ t.push(...o);
189
+ }
190
+ return t.sort(
191
+ (n, o) => y(n.occurredOnDate || n.expectedDate) - y(o.occurredOnDate || o.expectedDate)
192
+ );
193
+ }, tt = (e, a, t) => {
194
+ const n = [];
195
+ for (const o of a) {
196
+ const r = t.filter(
197
+ (u) => u.repeating_transaction_guid === o.guid
198
+ );
199
+ t.length > 0 && n.push({
200
+ ...o,
201
+ account: e.find((u) => u.guid === o.account_guid),
202
+ transactions: r
203
+ });
204
+ }
205
+ return n;
206
+ }, rt = (e) => e.reduce((a, t) => {
207
+ const n = H(t.expectedDate, { representation: "date" }), o = a.find(
208
+ (r) => r.date.toString() === t.expectedDate.toString()
209
+ );
210
+ return o ? o.recurrences.push(t) : a.push({
211
+ date: t.expectedDate,
212
+ id: `date-${n}`,
213
+ recurrences: [t]
214
+ }), a;
215
+ }, []), ot = (e, a, t) => {
216
+ const n = E(b(), a.recurrence_day), o = F(b(), a.recurrence_day), r = W(a.recurrence_day), u = a.second_recurrence_day ? W(a.second_recurrence_day) : "";
217
+ let c = t ? l(e.monthly_ordinal, r) : e.monthly;
218
+ switch (a.recurrence_type) {
219
+ case s.EveryQuarter:
220
+ c = t ? l(e.quarterly_ordinal, r) : e.quarterly;
221
+ break;
222
+ case s.EveryWeek:
223
+ c = t ? l(
224
+ e.weekly_ordinal,
225
+ v(n, k.DAY_OF_WEEK)
226
+ ) : e.weekly;
227
+ break;
228
+ case s.EveryYear:
229
+ c = t ? l(
230
+ e.anually_ordinal,
231
+ v(o, k.MONTH_DAY)
232
+ ) : e.anually;
233
+ break;
234
+ case s.EveryOtherWeek:
235
+ c = t ? l(
236
+ e.every_other_week_ordinal,
237
+ v(n, k.DAY_OF_WEEK)
238
+ ) : e.every_other_week;
239
+ break;
240
+ case s.EveryOtherMonth:
241
+ c = t ? l(e.every_other_month_ordinal, r) : e.every_other_month;
242
+ break;
243
+ case s.EveryOtherQuarter:
244
+ c = t ? l(e.every_other_quarter_ordinal, r) : e.every_other_quarter;
245
+ break;
246
+ case s.TwiceAMonth:
247
+ c = t ? l(e.twice_a_month_ordinal, r, u) : e.twice_a_month;
248
+ break;
249
+ }
250
+ return c;
251
+ }, at = (e, a) => {
252
+ let t = a;
253
+ switch (e) {
254
+ case s.EveryWeek:
255
+ t = ne(a);
256
+ break;
257
+ case s.EveryOtherWeek:
258
+ t = ae(a);
259
+ break;
260
+ case s.EveryMonth:
261
+ t = oe(a);
262
+ break;
263
+ case s.EveryOtherMonth:
264
+ t = re(a);
265
+ break;
266
+ case s.EveryQuarter:
267
+ t = te(a);
268
+ break;
269
+ case s.EveryOtherQuarter:
270
+ t = ee(a);
271
+ break;
272
+ case s.EveryYear:
273
+ t = R(a);
274
+ break;
275
+ }
276
+ return t;
277
+ };
278
+ var s = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.EveryWeek = 1] = "EveryWeek", e[e.EveryOtherWeek = 2] = "EveryOtherWeek", e[e.EveryMonth = 3] = "EveryMonth", e[e.EveryOtherMonth = 4] = "EveryOtherMonth", e[e.EveryQuarter = 5] = "EveryQuarter", e[e.EveryOtherQuarter = 6] = "EveryOtherQuarter", e[e.EveryYear = 7] = "EveryYear", e[e.TwiceAMonth = 8] = "TwiceAMonth", e))(s || {}), p = /* @__PURE__ */ ((e) => (e[e.Paid = 0] = "Paid", e[e.Missed = 1] = "Missed", e[e.Upcoming = 2] = "Upcoming", e))(p || {}), O = /* @__PURE__ */ ((e) => (e[e.Expense = 0] = "Expense", e[e.Income = 1] = "Income", e))(O || {}), Y = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Subscription = 1] = "Subscription", e[e.Bill = 2] = "Bill", e[e.Income = 3] = "Income", e[e.Transfer = 4] = "Transfer", e))(Y || {});
279
+ export {
280
+ Fe as D,
281
+ s as F,
282
+ Y as R,
283
+ Re as S,
284
+ p as a,
285
+ et as b,
286
+ O as c,
287
+ tt as d,
288
+ at as e,
289
+ rt as f,
290
+ ot as g
291
+ };
@@ -46,7 +46,7 @@ import { u as Qe, b as et } from "../CategorySelectorDrawer-Dyzb3UDU.mjs";
46
46
  import Te from "@mui/material/CardHeader";
47
47
  import { subDays as tt } from "date-fns/subDays";
48
48
  import nt from "@mui/material/IconButton";
49
- import { M as ot } from "../ManageIncome-BtKRPjvO.mjs";
49
+ import { M as ot } from "../ManageIncome-DT62iZim.mjs";
50
50
  const ye = 5, at = 100, rt = 25, st = (t) => {
51
51
  const o = (a) => {
52
52
  a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
@@ -942,8 +942,8 @@ const ht = ({
942
942
  isOpen: f,
943
943
  onClose: () => _(!1),
944
944
  title: n.manage_income,
945
- children: /* @__PURE__ */ d(b, { gap: 4, sx: { height: "100%" }, children: [
946
- /* @__PURE__ */ e(p, { bold: !0, sx: { mt: 12, mx: 24 }, variant: "Small", children: s.income_title }),
945
+ children: /* @__PURE__ */ d(b, { sx: { height: "100%" }, children: [
946
+ /* @__PURE__ */ e(p, { bold: !0, sx: { mb: 4, mt: 12, mx: 24 }, variant: "Small", children: s.income_title }),
947
947
  /* @__PURE__ */ e(ot, { forOverview: !0 })
948
948
  ] })
949
949
  }