@mx-cartographer/experiences 9.4.2 → 9.4.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.
- package/CHANGELOG.md +10 -1
- package/dist/core/constants/Investments.d.ts +3 -0
- package/dist/core/constants/Investments.es.js +34 -11
- package/dist/core/constants/Investments.es.js.map +1 -1
- package/dist/core/constants/repeatingTransactions.d.ts +6 -0
- package/dist/core/constants/repeatingTransactions.es.js +18 -3
- package/dist/core/constants/repeatingTransactions.es.js.map +1 -1
- package/dist/core/stores/HoldingStore.d.ts +3 -0
- package/dist/core/stores/HoldingStore.es.js +39 -29
- package/dist/core/stores/HoldingStore.es.js.map +1 -1
- package/dist/core/types/RepeatingTransaction.d.ts +2 -0
- package/dist/core/types/RepeatingTransaction.es.js.map +1 -1
- package/dist/core/types/Transaction.d.ts +1 -0
- package/dist/core/types/Transaction.es.js.map +1 -1
- package/dist/core/utils/InvestmentUtil.d.ts +4 -0
- package/dist/core/utils/InvestmentUtil.es.js +71 -58
- package/dist/core/utils/InvestmentUtil.es.js.map +1 -1
- package/dist/core/utils/RecurringTransactionsUtil.d.ts +1 -0
- package/dist/core/utils/RecurringTransactionsUtil.es.js +145 -143
- package/dist/core/utils/RecurringTransactionsUtil.es.js.map +1 -1
- package/dist/core/utils/TransactionUtils.d.ts +1 -0
- package/dist/investments/InvestmentsWidget.es.js +100 -66
- package/dist/investments/InvestmentsWidget.es.js.map +1 -1
- package/dist/investments/components/allocation/util/createInvestementsAllocationData.es.js +50 -59
- package/dist/investments/components/allocation/util/createInvestementsAllocationData.es.js.map +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js +16 -14
- package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js.map +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js +19 -17
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionList.es.js +16 -12
- package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { buildDynamicCopy as h } from "./Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as k, formatDate as O } from "../constants/DateFormats.es.js";
|
|
3
|
+
import { ALLOWED_MERCHANTLESS_BILL_CATEGORIES as R, ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES as B } from "../constants/repeatingTransactions.es.js";
|
|
4
|
+
import { Frequency as u, RecurrenceStatus as p, RecurrenceType as W, RepeatingType as q } from "../types/RepeatingTransaction.es.js";
|
|
5
|
+
import { formatOrdinal as A } from "./NumberFormatting.es.js";
|
|
6
|
+
import { getNextBiMonthlyDate as C, getNextBiQuarterlyDate as U, getNextBiWeeklyDate as F, getNextMonthlyDate as P, getNextQuarterlyDate as H, getNextTwiceMonthlyDate as $, getNextWeeklyDate as K, getNextYearlyDate as T, getTwiceMonthlyDates as j } from "./DateUtil.es.js";
|
|
7
|
+
import { addDays as S } from "date-fns/addDays";
|
|
8
|
+
import { addMonths as _ } from "date-fns/addMonths";
|
|
8
9
|
import { isBefore as i } from "date-fns/isBefore";
|
|
9
10
|
import { startOfToday as x } from "date-fns/startOfToday";
|
|
10
|
-
import { subMonths as
|
|
11
|
-
import { isSameDay as
|
|
12
|
-
import { addYears as
|
|
13
|
-
import { subDays as
|
|
14
|
-
import { subYears as
|
|
15
|
-
import { differenceInDays as
|
|
16
|
-
import { addQuarters as
|
|
17
|
-
import { addWeeks as
|
|
11
|
+
import { subMonths as z } from "date-fns/subMonths";
|
|
12
|
+
import { isSameDay as J } from "date-fns/isSameDay";
|
|
13
|
+
import { addYears as Y } from "date-fns/addYears";
|
|
14
|
+
import { subDays as N } from "date-fns/subDays";
|
|
15
|
+
import { subYears as V } from "date-fns/subYears";
|
|
16
|
+
import { differenceInDays as X } from "date-fns/differenceInDays";
|
|
17
|
+
import { addQuarters as Q } from "date-fns/addQuarters";
|
|
18
|
+
import { addWeeks as E } from "date-fns/addWeeks";
|
|
18
19
|
import { nextDay as M } from "date-fns/nextDay";
|
|
19
|
-
import { setDate as
|
|
20
|
-
import { fromUnixTime as
|
|
21
|
-
import { getUnixTime as
|
|
22
|
-
import { isAfter as
|
|
23
|
-
import { formatISO as
|
|
24
|
-
import { lastDayOfMonth as
|
|
25
|
-
import { parseISO as
|
|
26
|
-
import { setDay as
|
|
27
|
-
import { setDayOfYear as
|
|
28
|
-
import { subQuarters as
|
|
29
|
-
import { subWeeks as
|
|
30
|
-
var
|
|
20
|
+
import { setDate as g } from "date-fns/setDate";
|
|
21
|
+
import { fromUnixTime as Z } from "date-fns/fromUnixTime";
|
|
22
|
+
import { getUnixTime as l } from "date-fns/getUnixTime";
|
|
23
|
+
import { isAfter as f } from "date-fns/isAfter";
|
|
24
|
+
import { formatISO as ee } from "date-fns/formatISO";
|
|
25
|
+
import { lastDayOfMonth as te } from "date-fns/lastDayOfMonth";
|
|
26
|
+
import { parseISO as I } from "date-fns/parseISO";
|
|
27
|
+
import { setDay as re } from "date-fns/setDay";
|
|
28
|
+
import { setDayOfYear as L } from "date-fns/setDayOfYear";
|
|
29
|
+
import { subQuarters as G } from "date-fns/subQuarters";
|
|
30
|
+
import { subWeeks as ae } from "date-fns/subWeeks";
|
|
31
|
+
var ce = (e) => {
|
|
31
32
|
if (!e) return "";
|
|
32
33
|
let c = e.user_name || e.feed_name || "";
|
|
33
34
|
return e.account_number && (c = `${c} *${e.account_number}`), c;
|
|
34
|
-
},
|
|
35
|
-
const r = [], n = e.recurrence_type ===
|
|
35
|
+
}, ne = (e, c) => {
|
|
36
|
+
const r = [], n = e.recurrence_type === u.EveryYear, t = e.transactions.find((m) => m.repeating_transaction_guid === e.guid);
|
|
36
37
|
if (!n && !t) return [];
|
|
37
|
-
const a =
|
|
38
|
+
const a = I(e.predicted_occurs_on), s = {
|
|
38
39
|
accountGuid: e.account?.guid || "",
|
|
39
40
|
amount: e.amount,
|
|
40
41
|
categoryGuid: t?.category_guid || "",
|
|
41
42
|
expectedDate: a,
|
|
42
43
|
frequency: e.recurrence_type,
|
|
43
44
|
institutionGuid: e.account?.institution_guid || "",
|
|
44
|
-
institutionName:
|
|
45
|
+
institutionName: ce(e.account),
|
|
45
46
|
merchantGuid: e.merchant_guid,
|
|
46
47
|
name: e.description,
|
|
47
48
|
recurrenceDay: e.recurrence_day,
|
|
48
49
|
repeatingTransactionGuid: e.guid,
|
|
49
50
|
secondRecurrenceDay: e.second_recurrence_day,
|
|
50
|
-
status:
|
|
51
|
+
status: p.Upcoming,
|
|
51
52
|
type: e.repeating_transaction_type === q.Income ? W.Income : W.Expense,
|
|
52
53
|
transaction: void 0
|
|
53
54
|
}, o = c.start, d = c.end;
|
|
54
55
|
switch (e.recurrence_type) {
|
|
55
|
-
case
|
|
56
|
-
r.push(...
|
|
56
|
+
case u.EveryWeek:
|
|
57
|
+
r.push(...oe(s, o, d));
|
|
57
58
|
break;
|
|
58
|
-
case
|
|
59
|
-
r.push(...
|
|
59
|
+
case u.EveryOtherWeek:
|
|
60
|
+
r.push(...ue(s, o, d));
|
|
60
61
|
break;
|
|
61
|
-
case
|
|
62
|
-
r.push(...
|
|
62
|
+
case u.TwiceAMonth:
|
|
63
|
+
r.push(...se(s, o, d));
|
|
63
64
|
break;
|
|
64
|
-
case
|
|
65
|
-
r.push(...
|
|
65
|
+
case u.EveryMonth:
|
|
66
|
+
r.push(...ie(s, o, d));
|
|
66
67
|
break;
|
|
67
|
-
case
|
|
68
|
-
r.push(...
|
|
68
|
+
case u.EveryOtherMonth:
|
|
69
|
+
r.push(...de(s, o, d));
|
|
69
70
|
break;
|
|
70
|
-
case
|
|
71
|
-
r.push(...
|
|
71
|
+
case u.EveryQuarter:
|
|
72
|
+
r.push(...me(s, o, d));
|
|
72
73
|
break;
|
|
73
|
-
case
|
|
74
|
-
r.push(...
|
|
74
|
+
case u.EveryOtherQuarter:
|
|
75
|
+
r.push(...ye(s, o, d));
|
|
75
76
|
break;
|
|
76
|
-
case
|
|
77
|
-
r.push(...
|
|
77
|
+
case u.EveryYear:
|
|
78
|
+
r.push(..._e(s, o, d));
|
|
78
79
|
}
|
|
79
80
|
const D = /* @__PURE__ */ new Set();
|
|
80
81
|
for (const m of r) {
|
|
81
|
-
const b = e.transactions.filter((y) => y.repeating_transaction_guid === e.guid && !D.has(y.guid)), v = b.find((y) => y.date >
|
|
82
|
-
v ? (D.add(v.guid), m.transaction = v, m.status =
|
|
82
|
+
const b = e.transactions.filter((y) => y.repeating_transaction_guid === e.guid && !D.has(y.guid)), v = b.find((y) => y.date > l(N(m.expectedDate, 5)) && y.date < l(S(m.expectedDate, 5))) || (i(m.expectedDate, x()) ? b.reduce((y, w) => Math.abs(w.date - l(m.expectedDate)) < (y ? Math.abs(y.date - l(m.expectedDate)) : 1 / 0) ? w : y, void 0) : void 0);
|
|
83
|
+
v ? (D.add(v.guid), m.transaction = v, m.status = p.Paid, m.occurredOnDate = Z(v.date)) : i(m.expectedDate, N(x(), 3)) && (m.status = p.Missed);
|
|
83
84
|
}
|
|
84
85
|
return r;
|
|
85
|
-
},
|
|
86
|
+
}, oe = (e, c, r) => {
|
|
86
87
|
const n = [];
|
|
87
88
|
let t = M(c, e.recurrenceDay);
|
|
88
89
|
for (; i(t, r); )
|
|
@@ -91,192 +92,193 @@ var re = (e) => {
|
|
|
91
92
|
expectedDate: t
|
|
92
93
|
}), t = M(t, e.recurrenceDay);
|
|
93
94
|
return n;
|
|
94
|
-
},
|
|
95
|
+
}, ue = (e, c, r) => {
|
|
95
96
|
const n = [];
|
|
96
97
|
let t = e.expectedDate;
|
|
97
|
-
if (i(t, c)) for (; i(t, c); ) t =
|
|
98
|
+
if (i(t, c)) for (; i(t, c); ) t = E(t, 2);
|
|
98
99
|
else {
|
|
99
|
-
for (;
|
|
100
|
-
t =
|
|
100
|
+
for (; f(t, c) || J(t, c); ) t = ae(t, 2);
|
|
101
|
+
t = E(t, 2);
|
|
101
102
|
}
|
|
102
103
|
for (; i(t, r); )
|
|
103
104
|
n.push({
|
|
104
105
|
...e,
|
|
105
106
|
expectedDate: t
|
|
106
|
-
}), t =
|
|
107
|
+
}), t = S(t, 14);
|
|
107
108
|
return n;
|
|
108
|
-
},
|
|
109
|
+
}, se = (e, c, r) => {
|
|
109
110
|
const n = [];
|
|
110
|
-
let t =
|
|
111
|
+
let t = g(c, e.recurrenceDay);
|
|
111
112
|
for (; i(t, r); )
|
|
112
113
|
n.push({
|
|
113
114
|
...e,
|
|
114
115
|
expectedDate: t
|
|
115
|
-
}), t =
|
|
116
|
-
let a = e.secondRecurrenceDay && e.secondRecurrenceDay < 28 ?
|
|
116
|
+
}), t = _(t, 1);
|
|
117
|
+
let a = e.secondRecurrenceDay && e.secondRecurrenceDay < 28 ? g(c, e.secondRecurrenceDay) : te(c);
|
|
117
118
|
for (; i(a, r); )
|
|
118
119
|
n.push({
|
|
119
120
|
...e,
|
|
120
121
|
expectedDate: a
|
|
121
|
-
}), a =
|
|
122
|
+
}), a = _(a, 1);
|
|
122
123
|
return n;
|
|
123
|
-
},
|
|
124
|
+
}, ie = (e, c, r) => {
|
|
124
125
|
const n = [];
|
|
125
|
-
let t =
|
|
126
|
+
let t = g(c, e.recurrenceDay);
|
|
126
127
|
for (n.push({
|
|
127
128
|
...e,
|
|
128
129
|
expectedDate: t
|
|
129
|
-
}), t =
|
|
130
|
+
}), t = _(t, 1); i(t, r); )
|
|
130
131
|
n.push({
|
|
131
132
|
...e,
|
|
132
133
|
expectedDate: t
|
|
133
|
-
}), t =
|
|
134
|
+
}), t = _(t, 1);
|
|
134
135
|
return n;
|
|
135
|
-
},
|
|
136
|
+
}, de = (e, c, r) => {
|
|
136
137
|
const n = [], t = e.expectedDate;
|
|
137
|
-
let a = i(t, r) ? t :
|
|
138
|
+
let a = i(t, r) ? t : z(t, 2);
|
|
138
139
|
for (; i(a, r); )
|
|
139
|
-
|
|
140
|
+
f(a, c) && n.push({
|
|
140
141
|
...e,
|
|
141
142
|
expectedDate: a
|
|
142
|
-
}), a =
|
|
143
|
+
}), a = _(a, 2);
|
|
143
144
|
return n;
|
|
144
|
-
},
|
|
145
|
+
}, me = (e, c, r) => {
|
|
145
146
|
const n = [], t = e.expectedDate;
|
|
146
|
-
let a = i(t, r) ? t :
|
|
147
|
+
let a = i(t, r) ? t : G(t, 1);
|
|
147
148
|
for (; i(a, r); )
|
|
148
|
-
|
|
149
|
+
f(a, c) && n.push({
|
|
149
150
|
...e,
|
|
150
151
|
expectedDate: a
|
|
151
|
-
}), a =
|
|
152
|
+
}), a = Q(a, 1);
|
|
152
153
|
return n;
|
|
153
|
-
},
|
|
154
|
+
}, ye = (e, c, r) => {
|
|
154
155
|
const n = [], t = e.expectedDate;
|
|
155
|
-
let a = i(t, r) ? t :
|
|
156
|
+
let a = i(t, r) ? t : G(t, 2);
|
|
156
157
|
for (; i(a, r); )
|
|
157
|
-
|
|
158
|
+
f(a, c) && n.push({
|
|
158
159
|
...e,
|
|
159
160
|
expectedDate: a
|
|
160
|
-
}), a =
|
|
161
|
+
}), a = Q(a, 2);
|
|
161
162
|
return n;
|
|
162
|
-
},
|
|
163
|
+
}, _e = (e, c, r) => {
|
|
163
164
|
const n = [], t = e.expectedDate;
|
|
164
|
-
let a = i(t, r) ? t :
|
|
165
|
+
let a = i(t, r) ? t : V(t, 1);
|
|
165
166
|
for (; i(a, r); )
|
|
166
|
-
|
|
167
|
+
f(a, c) && n.push({
|
|
167
168
|
...e,
|
|
168
169
|
expectedDate: a
|
|
169
|
-
}), a =
|
|
170
|
+
}), a = Y(a, 1);
|
|
170
171
|
return n;
|
|
171
|
-
},
|
|
172
|
+
}, $e = (e, c) => {
|
|
172
173
|
const r = [];
|
|
173
174
|
for (const n of e) {
|
|
174
|
-
const t =
|
|
175
|
+
const t = ne(n, c);
|
|
175
176
|
r.push(...t);
|
|
176
177
|
}
|
|
177
|
-
return r.sort((n, t) =>
|
|
178
|
-
},
|
|
178
|
+
return r.sort((n, t) => l(n.occurredOnDate || n.expectedDate) - l(t.occurredOnDate || t.expectedDate));
|
|
179
|
+
}, Ke = (e, c, r) => {
|
|
179
180
|
const n = [];
|
|
180
181
|
for (const t of c) {
|
|
181
|
-
const a = r.filter((
|
|
182
|
+
const a = r.filter((s) => s.repeating_transaction_guid === t.guid);
|
|
182
183
|
r.length > 0 && n.push({
|
|
183
184
|
...t,
|
|
184
|
-
account: e.find((
|
|
185
|
+
account: e.find((s) => s.guid === t.account_guid),
|
|
185
186
|
transactions: a
|
|
186
187
|
});
|
|
187
188
|
}
|
|
188
189
|
return n;
|
|
189
|
-
},
|
|
190
|
-
const n =
|
|
190
|
+
}, Te = (e) => e.reduce((c, r) => {
|
|
191
|
+
const n = ee(r.expectedDate, { representation: "date" }), t = c.find((a) => a.date.toString() === r.expectedDate.toString());
|
|
191
192
|
return t ? t.recurrences.push(r) : c.push({
|
|
192
193
|
date: r.expectedDate,
|
|
193
194
|
id: `date-${n}`,
|
|
194
195
|
recurrences: [r]
|
|
195
196
|
}), c;
|
|
196
|
-
}, []),
|
|
197
|
-
const n = M(x(), c.recurrence_day), t =
|
|
198
|
-
let o = r ?
|
|
197
|
+
}, []), je = (e, c, r) => {
|
|
198
|
+
const n = M(x(), c.recurrence_day), t = L(x(), c.recurrence_day), a = A(c.recurrence_day), s = c.second_recurrence_day ? A(c.second_recurrence_day) : "";
|
|
199
|
+
let o = r ? h(e.monthly_ordinal, a) : e.monthly;
|
|
199
200
|
switch (c.recurrence_type) {
|
|
200
|
-
case
|
|
201
|
-
o = r ?
|
|
201
|
+
case u.EveryQuarter:
|
|
202
|
+
o = r ? h(e.quarterly_ordinal, a) : e.quarterly;
|
|
202
203
|
break;
|
|
203
|
-
case
|
|
204
|
-
o = r ?
|
|
204
|
+
case u.EveryWeek:
|
|
205
|
+
o = r ? h(e.weekly_ordinal, O(n, k.DAY_OF_WEEK)) : e.weekly;
|
|
205
206
|
break;
|
|
206
|
-
case
|
|
207
|
-
o = r ?
|
|
207
|
+
case u.EveryYear:
|
|
208
|
+
o = r ? h(e.anually_ordinal, O(t, k.MONTH_DAY)) : e.anually;
|
|
208
209
|
break;
|
|
209
|
-
case
|
|
210
|
-
o = r ?
|
|
210
|
+
case u.EveryOtherWeek:
|
|
211
|
+
o = r ? h(e.every_other_week_ordinal, O(n, k.DAY_OF_WEEK)) : e.every_other_week;
|
|
211
212
|
break;
|
|
212
|
-
case
|
|
213
|
-
o = r ?
|
|
213
|
+
case u.EveryOtherMonth:
|
|
214
|
+
o = r ? h(e.every_other_month_ordinal, a) : e.every_other_month;
|
|
214
215
|
break;
|
|
215
|
-
case
|
|
216
|
-
o = r ?
|
|
216
|
+
case u.EveryOtherQuarter:
|
|
217
|
+
o = r ? h(e.every_other_quarter_ordinal, a) : e.every_other_quarter;
|
|
217
218
|
break;
|
|
218
|
-
case
|
|
219
|
-
o = r ?
|
|
219
|
+
case u.TwiceAMonth:
|
|
220
|
+
o = r ? h(e.twice_a_month_ordinal, a, s) : e.twice_a_month;
|
|
220
221
|
}
|
|
221
222
|
return o;
|
|
222
|
-
},
|
|
223
|
+
}, he = (e, c, r, n) => {
|
|
223
224
|
let t = c;
|
|
224
|
-
r !== void 0 && (e ===
|
|
225
|
+
r !== void 0 && (e === u.EveryWeek || e === u.EveryOtherWeek ? t = re(c, r) : e === u.EveryYear ? t = L(c, r) : t = g(c, r));
|
|
225
226
|
let a = t;
|
|
226
227
|
switch (e) {
|
|
227
|
-
case
|
|
228
|
+
case u.EveryWeek:
|
|
228
229
|
a = K(t);
|
|
229
230
|
break;
|
|
230
|
-
case
|
|
231
|
+
case u.EveryOtherWeek:
|
|
231
232
|
a = F(t);
|
|
232
233
|
break;
|
|
233
|
-
case
|
|
234
|
+
case u.TwiceAMonth:
|
|
234
235
|
a = $(r ?? t.getDate(), n ?? 28);
|
|
235
236
|
break;
|
|
236
|
-
case
|
|
237
|
+
case u.EveryMonth:
|
|
237
238
|
a = P(t);
|
|
238
239
|
break;
|
|
239
|
-
case
|
|
240
|
-
a =
|
|
240
|
+
case u.EveryOtherMonth:
|
|
241
|
+
a = C(t);
|
|
241
242
|
break;
|
|
242
|
-
case
|
|
243
|
-
a =
|
|
243
|
+
case u.EveryQuarter:
|
|
244
|
+
a = H(t);
|
|
244
245
|
break;
|
|
245
|
-
case
|
|
246
|
+
case u.EveryOtherQuarter:
|
|
246
247
|
a = U(t);
|
|
247
248
|
break;
|
|
248
|
-
case
|
|
249
|
-
a =
|
|
249
|
+
case u.EveryYear:
|
|
250
|
+
a = T(t);
|
|
250
251
|
}
|
|
251
252
|
return a;
|
|
252
|
-
},
|
|
253
|
-
const r = c.find((o) => o.repeatingTransactionGuid === e.guid && o.status ===
|
|
253
|
+
}, ze = (e, c) => {
|
|
254
|
+
const r = c.find((o) => o.repeatingTransactionGuid === e.guid && o.status === p.Upcoming);
|
|
254
255
|
if (r) return r.expectedDate;
|
|
255
|
-
const n = (o) => c.some((d) => d.repeatingTransactionGuid === e.guid && d.status ===
|
|
256
|
-
[
|
|
257
|
-
[
|
|
258
|
-
[
|
|
259
|
-
const d =
|
|
260
|
-
return d.find((D) =>
|
|
256
|
+
const n = (o) => c.some((d) => d.repeatingTransactionGuid === e.guid && d.status === p.Paid && Math.abs(X(d.expectedDate, o)) <= 5), t = {
|
|
257
|
+
[u.EveryWeek]: (o) => E(o, 1),
|
|
258
|
+
[u.EveryOtherWeek]: (o) => E(o, 2),
|
|
259
|
+
[u.TwiceAMonth]: (o) => {
|
|
260
|
+
const d = j(e.recurrence_day, e.second_recurrence_day ?? 28);
|
|
261
|
+
return d.find((D) => f(D, o)) ?? d[d.length - 1];
|
|
261
262
|
},
|
|
262
|
-
[
|
|
263
|
-
[
|
|
264
|
-
[
|
|
265
|
-
[
|
|
266
|
-
[
|
|
267
|
-
}, a =
|
|
263
|
+
[u.EveryMonth]: (o) => _(o, 1),
|
|
264
|
+
[u.EveryOtherMonth]: (o) => _(o, 2),
|
|
265
|
+
[u.EveryQuarter]: (o) => _(o, 3),
|
|
266
|
+
[u.EveryOtherQuarter]: (o) => _(o, 6),
|
|
267
|
+
[u.EveryYear]: (o) => Y(o, 1)
|
|
268
|
+
}, a = he(e.recurrence_type, I(e.predicted_occurs_on), e.recurrence_day, e.second_recurrence_day);
|
|
268
269
|
if (!n(a)) return a;
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
};
|
|
270
|
+
const s = t[e.recurrence_type];
|
|
271
|
+
return s ? s(a) : a;
|
|
272
|
+
}, Je = (e) => !!(e.merchant_guid && e.merchant_guid.trim() !== "" || [e.category_guid, e.top_level_category_guid].filter((c) => !!c).some((c) => R.includes(c)) || e.main_class_guid && B.includes(e.main_class_guid));
|
|
272
273
|
export {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
274
|
+
Ke as augmentRepeatingTransactions,
|
|
275
|
+
$e as buildAllRecurrences,
|
|
276
|
+
ce as buildInstitutionName,
|
|
277
|
+
je as getFrequencyLabel,
|
|
278
|
+
he as getNextPaymentDate,
|
|
279
|
+
ze as getNextUpcomingDate,
|
|
280
|
+
Te as groupRecurrencesByDate,
|
|
281
|
+
Je as isEligibleRepeatingTransaction
|
|
280
282
|
};
|
|
281
283
|
|
|
282
284
|
//# sourceMappingURL=RecurringTransactionsUtil.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurringTransactionsUtil.es.js","names":[],"sources":["../../../src/core/utils/RecurringTransactionsUtil.ts"],"sourcesContent":["import { addDays } from 'date-fns/addDays'\nimport { addMonths } from 'date-fns/addMonths'\nimport { addQuarters } from 'date-fns/addQuarters'\nimport { addWeeks } from 'date-fns/addWeeks'\nimport { addYears } from 'date-fns/addYears'\nimport { differenceInDays } from 'date-fns/differenceInDays'\nimport { formatISO } from 'date-fns/formatISO'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { lastDayOfMonth } from 'date-fns/lastDayOfMonth'\nimport { nextDay } from 'date-fns/nextDay'\nimport { parseISO } from 'date-fns/parseISO'\nimport { setDate } from 'date-fns/setDate'\nimport { setDay } from 'date-fns/setDay'\nimport { setDayOfYear } from 'date-fns/setDayOfYear'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\nimport { subMonths } from 'date-fns/subMonths'\nimport { subQuarters } from 'date-fns/subQuarters'\nimport { subWeeks } from 'date-fns/subWeeks'\nimport { subYears } from 'date-fns/subYears'\n\nimport type { Day } from 'date-fns'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../constants'\nimport {\n type Account,\n type DateRange,\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceType,\n RecurrenceStatus,\n RepeatingType,\n Frequency,\n} from '../types'\n\nimport {\n getNextBiMonthlyDate,\n getNextBiQuarterlyDate,\n getNextBiWeeklyDate,\n getNextMonthlyDate,\n getNextQuarterlyDate,\n getNextTwiceMonthlyDate,\n getNextWeeklyDate,\n getNextYearlyDate,\n getTwiceMonthlyDates,\n} from './DateUtil'\nimport { formatOrdinal } from './NumberFormatting'\nimport { buildDynamicCopy } from './Localization'\n\nexport type GroupedRecurrence = {\n recurrences: Recurrence[]\n id: string\n date: Date\n}\n\nexport const buildInstitutionName = (account?: Account) => {\n if (!account) return ''\n\n let name = account.user_name || account.feed_name || ''\n if (account.account_number) {\n name = `${name} *${account.account_number}`\n }\n return name\n}\n\nconst buildRepeatingRecurrences = (\n repeatingTransaction: RepeatingTransaction,\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n const isYearly = repeatingTransaction.recurrence_type === Frequency.EveryYear\n\n const pastTransaction = repeatingTransaction.transactions.find(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n /*\n Since past transactions for yearly recurrences can be outside the 90 day data range, we need to display them\n even if there is no past transaction to match to. This will display it without a category, but that's the\n tradeoff until we impove our transactions service to return past transactions for all recurring transactions.\n */\n if (!isYearly && !pastTransaction) return []\n\n const occursOn = parseISO(repeatingTransaction.predicted_occurs_on)\n const baseRecurrence: Recurrence = {\n accountGuid: repeatingTransaction.account?.guid || '',\n amount: repeatingTransaction.amount,\n categoryGuid: pastTransaction?.category_guid || '',\n expectedDate: occursOn,\n frequency: repeatingTransaction.recurrence_type,\n institutionGuid: repeatingTransaction.account?.institution_guid || '',\n institutionName: buildInstitutionName(repeatingTransaction.account),\n merchantGuid: repeatingTransaction.merchant_guid,\n name: repeatingTransaction.description,\n recurrenceDay: repeatingTransaction.recurrence_day,\n repeatingTransactionGuid: repeatingTransaction.guid,\n secondRecurrenceDay: repeatingTransaction.second_recurrence_day,\n status: RecurrenceStatus.Upcoming,\n type:\n repeatingTransaction.repeating_transaction_type === RepeatingType.Income\n ? RecurrenceType.Income\n : RecurrenceType.Expense,\n transaction: undefined,\n }\n\n const startDate = dateRange.start\n const endDate = dateRange.end\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryWeek:\n recurrences.push(...getWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherWeek:\n recurrences.push(...getBiWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.TwiceAMonth:\n recurrences.push(...getTwiceMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryMonth:\n recurrences.push(...getMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherMonth:\n recurrences.push(...getBiMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryQuarter:\n recurrences.push(...getQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherQuarter:\n recurrences.push(...getBiQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryYear:\n recurrences.push(...getYearlyRecurrences(baseRecurrence, startDate, endDate))\n break\n }\n\n // Track which transactions have already been matched to avoid double-counting\n const matchedTransactionGuids = new Set<string>()\n\n for (const recurrence of recurrences) {\n // First, try to find a manually linked transaction (any date)\n const linkedTransactions = repeatingTransaction.transactions.filter(\n (t) =>\n t.repeating_transaction_guid === repeatingTransaction.guid &&\n !matchedTransactionGuids.has(t.guid),\n )\n\n const transaction =\n linkedTransactions.find(\n (t) =>\n t.date > getUnixTime(subDays(recurrence.expectedDate, 5)) &&\n t.date < getUnixTime(addDays(recurrence.expectedDate, 5)),\n ) ||\n (isBefore(recurrence.expectedDate, startOfToday())\n ? linkedTransactions.reduce<Transaction | undefined>((closest, t) => {\n const dist = Math.abs(t.date - getUnixTime(recurrence.expectedDate))\n const closestDist = closest\n ? Math.abs(closest.date - getUnixTime(recurrence.expectedDate))\n : Infinity\n return dist < closestDist ? t : closest\n }, undefined)\n : undefined)\n\n if (transaction) {\n matchedTransactionGuids.add(transaction.guid)\n recurrence.transaction = transaction\n recurrence.status = RecurrenceStatus.Paid\n recurrence.occurredOnDate = fromUnixTime(transaction.date)\n } else if (isBefore(recurrence.expectedDate, subDays(startOfToday(), 3))) {\n recurrence.status = RecurrenceStatus.Missed\n }\n }\n\n return recurrences\n}\n\nconst getWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const activities: Recurrence[] = []\n\n // Add recurrence for each week for the current month and next month\n let nextDate = nextDay(startDate, baseRecurrence.recurrenceDay as Day)\n while (isBefore(nextDate, endDate)) {\n activities.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = nextDay(nextDate, baseRecurrence.recurrenceDay as Day)\n }\n\n return activities\n}\n\nconst getBiWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n // Determine the first occurrence of the bi-weekly recurrence within the date range\n let nextDate = baseRecurrence.expectedDate\n if (isBefore(nextDate, startDate)) {\n while (isBefore(nextDate, startDate)) {\n nextDate = addWeeks(nextDate, 2)\n }\n } else {\n while (isAfter(nextDate, startDate) || isSameDay(nextDate, startDate)) {\n nextDate = subWeeks(nextDate, 2)\n }\n nextDate = addWeeks(nextDate, 2)\n }\n\n while (isBefore(nextDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = addDays(nextDate, 14)\n }\n\n return recurrences\n}\n\nconst getTwiceMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let firstOccurrence = setDate(startDate, baseRecurrence.recurrenceDay)\n\n while (isBefore(firstOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: firstOccurrence })\n firstOccurrence = addMonths(firstOccurrence, 1)\n }\n\n let secondOccurrence =\n baseRecurrence.secondRecurrenceDay && baseRecurrence.secondRecurrenceDay < 28\n ? setDate(startDate, baseRecurrence.secondRecurrenceDay)\n : lastDayOfMonth(startDate)\n\n while (isBefore(secondOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: secondOccurrence })\n secondOccurrence = addMonths(secondOccurrence, 1)\n }\n\n return recurrences\n}\n\nconst getMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let expectedDate = setDate(startDate, baseRecurrence.recurrenceDay)\n\n // Add current month's repeating transaction recurrence\n recurrences.push({ ...baseRecurrence, expectedDate })\n\n expectedDate = addMonths(expectedDate, 1)\n while (isBefore(expectedDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate })\n expectedDate = addMonths(expectedDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subMonths(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addMonths(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getYearlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subYears(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addYears(nextDate, 1)\n }\n\n return recurrences\n}\n\nexport const buildAllRecurrences = (\n repeatingTransactions: RepeatingTransaction[],\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const activity = buildRepeatingRecurrences(repeatingTransaction, dateRange)\n recurrences.push(...activity)\n }\n\n return recurrences.sort(\n (a, b) =>\n getUnixTime(a.occurredOnDate || a.expectedDate) -\n getUnixTime(b.occurredOnDate || b.expectedDate),\n )\n}\n\nexport const augmentRepeatingTransactions = (\n accounts: Account[],\n repeatingTransactions: RepeatingTransaction[],\n transactions: Transaction[],\n) => {\n const augmentedRepeatingTransactions: RepeatingTransaction[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const relatedTransactions = transactions.filter(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n if (transactions.length > 0) {\n augmentedRepeatingTransactions.push({\n ...repeatingTransaction,\n account: accounts.find((account) => account.guid === repeatingTransaction.account_guid),\n transactions: relatedTransactions,\n })\n }\n }\n\n return augmentedRepeatingTransactions\n}\n\nexport const groupRecurrencesByDate = (recurrences: Recurrence[]): GroupedRecurrence[] => {\n return recurrences.reduce((groupedRecurrences: GroupedRecurrence[], recurrence) => {\n const dateString = formatISO(recurrence.expectedDate, { representation: 'date' })\n const existingGroup = groupedRecurrences.find(\n (group) => group.date.toString() === recurrence.expectedDate.toString(),\n )\n\n if (existingGroup) {\n existingGroup.recurrences.push(recurrence)\n } else {\n groupedRecurrences.push({\n date: recurrence.expectedDate,\n id: `date-${dateString}`,\n recurrences: [recurrence],\n })\n }\n\n return groupedRecurrences\n }, [])\n}\n\nexport const getFrequencyLabel = (\n copy: RecurringCopy,\n repeatingTransaction: RepeatingTransaction,\n showOrdinal: boolean,\n) => {\n const nextWeekday = nextDay(startOfToday(), repeatingTransaction.recurrence_day as Day)\n const nextAnnualDate = setDayOfYear(startOfToday(), repeatingTransaction.recurrence_day)\n const firstDateOrdinal = formatOrdinal(repeatingTransaction.recurrence_day)\n const secondDateOrdinal = repeatingTransaction.second_recurrence_day\n ? formatOrdinal(repeatingTransaction.second_recurrence_day)\n : ''\n\n let frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.monthly_ordinal, firstDateOrdinal)\n : copy.monthly\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.quarterly_ordinal, firstDateOrdinal)\n : copy.quarterly\n break\n case Frequency.EveryWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.weekly_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.weekly\n break\n case Frequency.EveryYear:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.anually_ordinal,\n formatDate(nextAnnualDate, DATE_FORMATS_INTL.MONTH_DAY),\n )\n : copy.anually\n break\n case Frequency.EveryOtherWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.every_other_week_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.every_other_week\n break\n case Frequency.EveryOtherMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_month_ordinal, firstDateOrdinal)\n : copy.every_other_month\n break\n case Frequency.EveryOtherQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_quarter_ordinal, firstDateOrdinal)\n : copy.every_other_quarter\n break\n case Frequency.TwiceAMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.twice_a_month_ordinal, firstDateOrdinal, secondDateOrdinal)\n : copy.twice_a_month\n break\n }\n\n return frequencyLabel as string\n}\n\nexport const getNextPaymentDate = (\n frequency: Frequency,\n date: Date,\n recurrenceDay?: number,\n secondRecurrenceDay?: number,\n) => {\n let baseDate = date\n\n // Apply user selected recurrenceDay based on frequency type\n if (recurrenceDay !== undefined) {\n if (frequency === Frequency.EveryWeek || frequency === Frequency.EveryOtherWeek) {\n baseDate = setDay(date, recurrenceDay)\n } else if (frequency === Frequency.EveryYear) {\n baseDate = setDayOfYear(date, recurrenceDay)\n } else {\n baseDate = setDate(date, recurrenceDay)\n }\n }\n\n let nextDate = baseDate\n\n switch (frequency) {\n case Frequency.EveryWeek:\n nextDate = getNextWeeklyDate(baseDate)\n break\n case Frequency.EveryOtherWeek:\n nextDate = getNextBiWeeklyDate(baseDate)\n break\n case Frequency.TwiceAMonth:\n nextDate = getNextTwiceMonthlyDate(\n recurrenceDay ?? baseDate.getDate(),\n secondRecurrenceDay ?? 28,\n )\n break\n case Frequency.EveryMonth:\n nextDate = getNextMonthlyDate(baseDate)\n break\n case Frequency.EveryOtherMonth:\n nextDate = getNextBiMonthlyDate(baseDate)\n break\n case Frequency.EveryQuarter:\n nextDate = getNextQuarterlyDate(baseDate)\n break\n case Frequency.EveryOtherQuarter:\n nextDate = getNextBiQuarterlyDate(baseDate)\n break\n case Frequency.EveryYear:\n nextDate = getNextYearlyDate(baseDate)\n break\n }\n\n return nextDate\n}\n\nexport const getNextUpcomingDate = (\n recurringTransaction: RepeatingTransaction,\n recurrences: Recurrence[],\n): Date => {\n const nextUpcoming = recurrences.find(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Upcoming,\n )\n if (nextUpcoming) return nextUpcoming.expectedDate\n\n const isPaidNearDate = (date: Date) =>\n recurrences.some(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Paid &&\n Math.abs(differenceInDays(r.expectedDate, date)) <= 5,\n )\n\n const frequencyAdvancers: Partial<Record<Frequency, (d: Date) => Date>> = {\n [Frequency.EveryWeek]: (d) => addWeeks(d, 1),\n [Frequency.EveryOtherWeek]: (d) => addWeeks(d, 2),\n [Frequency.TwiceAMonth]: (d) => {\n const candidates = getTwiceMonthlyDates(\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day ?? 28,\n )\n return candidates.find((c) => isAfter(c, d)) ?? candidates[candidates.length - 1]\n },\n [Frequency.EveryMonth]: (d) => addMonths(d, 1),\n [Frequency.EveryOtherMonth]: (d) => addMonths(d, 2),\n [Frequency.EveryQuarter]: (d) => addMonths(d, 3),\n [Frequency.EveryOtherQuarter]: (d) => addMonths(d, 6),\n [Frequency.EveryYear]: (d) => addYears(d, 1),\n }\n\n const baseNext = getNextPaymentDate(\n recurringTransaction.recurrence_type,\n parseISO(recurringTransaction.predicted_occurs_on),\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day,\n )\n\n if (!isPaidNearDate(baseNext)) return baseNext\n\n const advance = frequencyAdvancers[recurringTransaction.recurrence_type]\n return advance ? advance(baseNext) : baseNext\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAa,KAAA,CAAwB,MAAsB;AACzD,MAAI,CAAC,EAAS,QAAO;AAErB,MAAI,IAAO,EAAQ,aAAa,EAAQ,aAAa;AACrD,SAAI,EAAQ,mBACV,IAAO,GAAG,CAAA,KAAS,EAAQ,cAAA,KAEtB;AACT,GAEM,KAAA,CACJ,GACA,MACG;AACH,QAAM,IAA4B,CAAC,GAE7B,IAAW,EAAqB,oBAAoB,EAAU,WAE9D,IAAkB,EAAqB,aAAa,KAAA,CACvD,MAAM,EAAE,+BAA+B,EAAqB,IAC/D;AAOA,MAAI,CAAC,KAAY,CAAC,EAAiB,QAAO,CAAC;AAE3C,QAAM,IAAW,EAAS,EAAqB,mBAAmB,GAC5D,IAA6B;AAAA,IACjC,aAAa,EAAqB,SAAS,QAAQ;AAAA,IACnD,QAAQ,EAAqB;AAAA,IAC7B,cAAc,GAAiB,iBAAiB;AAAA,IAChD,cAAc;AAAA,IACd,WAAW,EAAqB;AAAA,IAChC,iBAAiB,EAAqB,SAAS,oBAAoB;AAAA,IACnE,iBAAiB,GAAqB,EAAqB,OAAO;AAAA,IAClE,cAAc,EAAqB;AAAA,IACnC,MAAM,EAAqB;AAAA,IAC3B,eAAe,EAAqB;AAAA,IACpC,0BAA0B,EAAqB;AAAA,IAC/C,qBAAqB,EAAqB;AAAA,IAC1C,QAAQ,EAAiB;AAAA,IACzB,MACE,EAAqB,+BAA+B,EAAc,SAC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BAAmB,GACjD,EAAqB,gBACrB,EAAqB,qBACvB;AAEA,MAAI,CAAC,EAAe,CAAQ,EAAG,QAAO;AAEtC,QAAM,IAAU,EAAmB,EAAqB,eAAA;AACxD,SAAO,IAAU,EAAQ,CAAQ,IAAI;AACvC"}
|
|
1
|
+
{"version":3,"file":"RecurringTransactionsUtil.es.js","names":[],"sources":["../../../src/core/utils/RecurringTransactionsUtil.ts"],"sourcesContent":["import { addDays } from 'date-fns/addDays'\nimport { addMonths } from 'date-fns/addMonths'\nimport { addQuarters } from 'date-fns/addQuarters'\nimport { addWeeks } from 'date-fns/addWeeks'\nimport { addYears } from 'date-fns/addYears'\nimport { differenceInDays } from 'date-fns/differenceInDays'\nimport { formatISO } from 'date-fns/formatISO'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { lastDayOfMonth } from 'date-fns/lastDayOfMonth'\nimport { nextDay } from 'date-fns/nextDay'\nimport { parseISO } from 'date-fns/parseISO'\nimport { setDate } from 'date-fns/setDate'\nimport { setDay } from 'date-fns/setDay'\nimport { setDayOfYear } from 'date-fns/setDayOfYear'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\nimport { subMonths } from 'date-fns/subMonths'\nimport { subQuarters } from 'date-fns/subQuarters'\nimport { subWeeks } from 'date-fns/subWeeks'\nimport { subYears } from 'date-fns/subYears'\n\nimport type { Day } from 'date-fns'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../constants'\nimport {\n ALLOWED_MERCHANTLESS_BILL_CATEGORIES,\n ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES,\n} from '../constants/repeatingTransactions'\nimport {\n type Account,\n type DateRange,\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceType,\n RecurrenceStatus,\n RepeatingType,\n Frequency,\n} from '../types'\n\nimport {\n getNextBiMonthlyDate,\n getNextBiQuarterlyDate,\n getNextBiWeeklyDate,\n getNextMonthlyDate,\n getNextQuarterlyDate,\n getNextTwiceMonthlyDate,\n getNextWeeklyDate,\n getNextYearlyDate,\n getTwiceMonthlyDates,\n} from './DateUtil'\nimport { formatOrdinal } from './NumberFormatting'\nimport { buildDynamicCopy } from './Localization'\n\nexport type GroupedRecurrence = {\n recurrences: Recurrence[]\n id: string\n date: Date\n}\n\nexport const buildInstitutionName = (account?: Account) => {\n if (!account) return ''\n\n let name = account.user_name || account.feed_name || ''\n if (account.account_number) {\n name = `${name} *${account.account_number}`\n }\n return name\n}\n\nconst buildRepeatingRecurrences = (\n repeatingTransaction: RepeatingTransaction,\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n const isYearly = repeatingTransaction.recurrence_type === Frequency.EveryYear\n\n const pastTransaction = repeatingTransaction.transactions.find(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n /*\n Since past transactions for yearly recurrences can be outside the 90 day data range, we need to display them\n even if there is no past transaction to match to. This will display it without a category, but that's the\n tradeoff until we impove our transactions service to return past transactions for all recurring transactions.\n */\n if (!isYearly && !pastTransaction) return []\n\n const occursOn = parseISO(repeatingTransaction.predicted_occurs_on)\n const baseRecurrence: Recurrence = {\n accountGuid: repeatingTransaction.account?.guid || '',\n amount: repeatingTransaction.amount,\n categoryGuid: pastTransaction?.category_guid || '',\n expectedDate: occursOn,\n frequency: repeatingTransaction.recurrence_type,\n institutionGuid: repeatingTransaction.account?.institution_guid || '',\n institutionName: buildInstitutionName(repeatingTransaction.account),\n merchantGuid: repeatingTransaction.merchant_guid,\n name: repeatingTransaction.description,\n recurrenceDay: repeatingTransaction.recurrence_day,\n repeatingTransactionGuid: repeatingTransaction.guid,\n secondRecurrenceDay: repeatingTransaction.second_recurrence_day,\n status: RecurrenceStatus.Upcoming,\n type:\n repeatingTransaction.repeating_transaction_type === RepeatingType.Income\n ? RecurrenceType.Income\n : RecurrenceType.Expense,\n transaction: undefined,\n }\n\n const startDate = dateRange.start\n const endDate = dateRange.end\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryWeek:\n recurrences.push(...getWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherWeek:\n recurrences.push(...getBiWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.TwiceAMonth:\n recurrences.push(...getTwiceMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryMonth:\n recurrences.push(...getMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherMonth:\n recurrences.push(...getBiMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryQuarter:\n recurrences.push(...getQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherQuarter:\n recurrences.push(...getBiQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryYear:\n recurrences.push(...getYearlyRecurrences(baseRecurrence, startDate, endDate))\n break\n }\n\n // Track which transactions have already been matched to avoid double-counting\n const matchedTransactionGuids = new Set<string>()\n\n for (const recurrence of recurrences) {\n // First, try to find a manually linked transaction (any date)\n const linkedTransactions = repeatingTransaction.transactions.filter(\n (t) =>\n t.repeating_transaction_guid === repeatingTransaction.guid &&\n !matchedTransactionGuids.has(t.guid),\n )\n\n const transaction =\n linkedTransactions.find(\n (t) =>\n t.date > getUnixTime(subDays(recurrence.expectedDate, 5)) &&\n t.date < getUnixTime(addDays(recurrence.expectedDate, 5)),\n ) ||\n (isBefore(recurrence.expectedDate, startOfToday())\n ? linkedTransactions.reduce<Transaction | undefined>((closest, t) => {\n const dist = Math.abs(t.date - getUnixTime(recurrence.expectedDate))\n const closestDist = closest\n ? Math.abs(closest.date - getUnixTime(recurrence.expectedDate))\n : Infinity\n return dist < closestDist ? t : closest\n }, undefined)\n : undefined)\n\n if (transaction) {\n matchedTransactionGuids.add(transaction.guid)\n recurrence.transaction = transaction\n recurrence.status = RecurrenceStatus.Paid\n recurrence.occurredOnDate = fromUnixTime(transaction.date)\n } else if (isBefore(recurrence.expectedDate, subDays(startOfToday(), 3))) {\n recurrence.status = RecurrenceStatus.Missed\n }\n }\n\n return recurrences\n}\n\nconst getWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const activities: Recurrence[] = []\n\n // Add recurrence for each week for the current month and next month\n let nextDate = nextDay(startDate, baseRecurrence.recurrenceDay as Day)\n while (isBefore(nextDate, endDate)) {\n activities.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = nextDay(nextDate, baseRecurrence.recurrenceDay as Day)\n }\n\n return activities\n}\n\nconst getBiWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n // Determine the first occurrence of the bi-weekly recurrence within the date range\n let nextDate = baseRecurrence.expectedDate\n if (isBefore(nextDate, startDate)) {\n while (isBefore(nextDate, startDate)) {\n nextDate = addWeeks(nextDate, 2)\n }\n } else {\n while (isAfter(nextDate, startDate) || isSameDay(nextDate, startDate)) {\n nextDate = subWeeks(nextDate, 2)\n }\n nextDate = addWeeks(nextDate, 2)\n }\n\n while (isBefore(nextDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = addDays(nextDate, 14)\n }\n\n return recurrences\n}\n\nconst getTwiceMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let firstOccurrence = setDate(startDate, baseRecurrence.recurrenceDay)\n\n while (isBefore(firstOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: firstOccurrence })\n firstOccurrence = addMonths(firstOccurrence, 1)\n }\n\n let secondOccurrence =\n baseRecurrence.secondRecurrenceDay && baseRecurrence.secondRecurrenceDay < 28\n ? setDate(startDate, baseRecurrence.secondRecurrenceDay)\n : lastDayOfMonth(startDate)\n\n while (isBefore(secondOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: secondOccurrence })\n secondOccurrence = addMonths(secondOccurrence, 1)\n }\n\n return recurrences\n}\n\nconst getMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let expectedDate = setDate(startDate, baseRecurrence.recurrenceDay)\n\n // Add current month's repeating transaction recurrence\n recurrences.push({ ...baseRecurrence, expectedDate })\n\n expectedDate = addMonths(expectedDate, 1)\n while (isBefore(expectedDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate })\n expectedDate = addMonths(expectedDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subMonths(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addMonths(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getYearlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subYears(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addYears(nextDate, 1)\n }\n\n return recurrences\n}\n\nexport const buildAllRecurrences = (\n repeatingTransactions: RepeatingTransaction[],\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const activity = buildRepeatingRecurrences(repeatingTransaction, dateRange)\n recurrences.push(...activity)\n }\n\n return recurrences.sort(\n (a, b) =>\n getUnixTime(a.occurredOnDate || a.expectedDate) -\n getUnixTime(b.occurredOnDate || b.expectedDate),\n )\n}\n\nexport const augmentRepeatingTransactions = (\n accounts: Account[],\n repeatingTransactions: RepeatingTransaction[],\n transactions: Transaction[],\n) => {\n const augmentedRepeatingTransactions: RepeatingTransaction[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const relatedTransactions = transactions.filter(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n if (transactions.length > 0) {\n augmentedRepeatingTransactions.push({\n ...repeatingTransaction,\n account: accounts.find((account) => account.guid === repeatingTransaction.account_guid),\n transactions: relatedTransactions,\n })\n }\n }\n\n return augmentedRepeatingTransactions\n}\n\nexport const groupRecurrencesByDate = (recurrences: Recurrence[]): GroupedRecurrence[] => {\n return recurrences.reduce((groupedRecurrences: GroupedRecurrence[], recurrence) => {\n const dateString = formatISO(recurrence.expectedDate, { representation: 'date' })\n const existingGroup = groupedRecurrences.find(\n (group) => group.date.toString() === recurrence.expectedDate.toString(),\n )\n\n if (existingGroup) {\n existingGroup.recurrences.push(recurrence)\n } else {\n groupedRecurrences.push({\n date: recurrence.expectedDate,\n id: `date-${dateString}`,\n recurrences: [recurrence],\n })\n }\n\n return groupedRecurrences\n }, [])\n}\n\nexport const getFrequencyLabel = (\n copy: RecurringCopy,\n repeatingTransaction: RepeatingTransaction,\n showOrdinal: boolean,\n) => {\n const nextWeekday = nextDay(startOfToday(), repeatingTransaction.recurrence_day as Day)\n const nextAnnualDate = setDayOfYear(startOfToday(), repeatingTransaction.recurrence_day)\n const firstDateOrdinal = formatOrdinal(repeatingTransaction.recurrence_day)\n const secondDateOrdinal = repeatingTransaction.second_recurrence_day\n ? formatOrdinal(repeatingTransaction.second_recurrence_day)\n : ''\n\n let frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.monthly_ordinal, firstDateOrdinal)\n : copy.monthly\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.quarterly_ordinal, firstDateOrdinal)\n : copy.quarterly\n break\n case Frequency.EveryWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.weekly_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.weekly\n break\n case Frequency.EveryYear:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.anually_ordinal,\n formatDate(nextAnnualDate, DATE_FORMATS_INTL.MONTH_DAY),\n )\n : copy.anually\n break\n case Frequency.EveryOtherWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.every_other_week_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.every_other_week\n break\n case Frequency.EveryOtherMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_month_ordinal, firstDateOrdinal)\n : copy.every_other_month\n break\n case Frequency.EveryOtherQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_quarter_ordinal, firstDateOrdinal)\n : copy.every_other_quarter\n break\n case Frequency.TwiceAMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.twice_a_month_ordinal, firstDateOrdinal, secondDateOrdinal)\n : copy.twice_a_month\n break\n }\n\n return frequencyLabel as string\n}\n\nexport const getNextPaymentDate = (\n frequency: Frequency,\n date: Date,\n recurrenceDay?: number,\n secondRecurrenceDay?: number,\n) => {\n let baseDate = date\n\n // Apply user selected recurrenceDay based on frequency type\n if (recurrenceDay !== undefined) {\n if (frequency === Frequency.EveryWeek || frequency === Frequency.EveryOtherWeek) {\n baseDate = setDay(date, recurrenceDay)\n } else if (frequency === Frequency.EveryYear) {\n baseDate = setDayOfYear(date, recurrenceDay)\n } else {\n baseDate = setDate(date, recurrenceDay)\n }\n }\n\n let nextDate = baseDate\n\n switch (frequency) {\n case Frequency.EveryWeek:\n nextDate = getNextWeeklyDate(baseDate)\n break\n case Frequency.EveryOtherWeek:\n nextDate = getNextBiWeeklyDate(baseDate)\n break\n case Frequency.TwiceAMonth:\n nextDate = getNextTwiceMonthlyDate(\n recurrenceDay ?? baseDate.getDate(),\n secondRecurrenceDay ?? 28,\n )\n break\n case Frequency.EveryMonth:\n nextDate = getNextMonthlyDate(baseDate)\n break\n case Frequency.EveryOtherMonth:\n nextDate = getNextBiMonthlyDate(baseDate)\n break\n case Frequency.EveryQuarter:\n nextDate = getNextQuarterlyDate(baseDate)\n break\n case Frequency.EveryOtherQuarter:\n nextDate = getNextBiQuarterlyDate(baseDate)\n break\n case Frequency.EveryYear:\n nextDate = getNextYearlyDate(baseDate)\n break\n }\n\n return nextDate\n}\n\nexport const getNextUpcomingDate = (\n recurringTransaction: RepeatingTransaction,\n recurrences: Recurrence[],\n): Date => {\n const nextUpcoming = recurrences.find(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Upcoming,\n )\n if (nextUpcoming) return nextUpcoming.expectedDate\n\n const isPaidNearDate = (date: Date) =>\n recurrences.some(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Paid &&\n Math.abs(differenceInDays(r.expectedDate, date)) <= 5,\n )\n\n const frequencyAdvancers: Partial<Record<Frequency, (d: Date) => Date>> = {\n [Frequency.EveryWeek]: (d) => addWeeks(d, 1),\n [Frequency.EveryOtherWeek]: (d) => addWeeks(d, 2),\n [Frequency.TwiceAMonth]: (d) => {\n const candidates = getTwiceMonthlyDates(\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day ?? 28,\n )\n return candidates.find((c) => isAfter(c, d)) ?? candidates[candidates.length - 1]\n },\n [Frequency.EveryMonth]: (d) => addMonths(d, 1),\n [Frequency.EveryOtherMonth]: (d) => addMonths(d, 2),\n [Frequency.EveryQuarter]: (d) => addMonths(d, 3),\n [Frequency.EveryOtherQuarter]: (d) => addMonths(d, 6),\n [Frequency.EveryYear]: (d) => addYears(d, 1),\n }\n\n const baseNext = getNextPaymentDate(\n recurringTransaction.recurrence_type,\n parseISO(recurringTransaction.predicted_occurs_on),\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day,\n )\n\n if (!isPaidNearDate(baseNext)) return baseNext\n\n const advance = frequencyAdvancers[recurringTransaction.recurrence_type]\n return advance ? advance(baseNext) : baseNext\n}\n\nexport const isEligibleRepeatingTransaction = (transaction: Transaction): boolean => {\n if (transaction.merchant_guid && transaction.merchant_guid.trim() !== '') {\n return true\n }\n\n const categoryGuids = [transaction.category_guid, transaction.top_level_category_guid].filter(\n (guid): guid is string => !!guid,\n )\n if (\n categoryGuids.some((guid) =>\n (ALLOWED_MERCHANTLESS_BILL_CATEGORIES as readonly string[]).includes(guid),\n )\n ) {\n return true\n }\n\n if (\n transaction.main_class_guid &&\n (ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES as readonly string[]).includes(\n transaction.main_class_guid,\n )\n ) {\n return true\n }\n\n return false\n}\n"],"mappings":";;;;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EAAc,KAAA,CAAM,MACjB,EAA2D,SAAS,CAAI,CAC3E,KAMA,EAAY,mBACX,EAA+D,SAC9D,EAAY,eACd"}
|
|
@@ -41,6 +41,7 @@ export declare const buildDetailedTransactions: (transactions: Transaction[], ac
|
|
|
41
41
|
is_void: boolean;
|
|
42
42
|
localized_description?: string | null;
|
|
43
43
|
localized_memo?: string | null;
|
|
44
|
+
main_class_guid?: string | null;
|
|
44
45
|
memo?: string | null;
|
|
45
46
|
metadata?: string | null;
|
|
46
47
|
merchant_guid?: string | null;
|