@mx-cartographer/experiences 9.5.0 → 9.5.2
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 +8 -1
- package/dist/accounts/components/AccountListItem.es.js +1 -1
- package/dist/accounts/components/AccountsList.es.js +1 -1
- package/dist/accounts/components/detailsdrawer/Accounts/AccountConnection.es.js +3 -3
- package/dist/accounts/components/detailsdrawer/Accounts/ConnectionErrorMessage.es.js +3 -3
- package/dist/accounts/utils/AccountFields.es.js +11 -11
- package/dist/budgets/BubbleBudgetsMiniWidget.es.js +1 -1
- package/dist/budgets/components/Overview.es.js +1 -1
- package/dist/budgets/components/addbudget/UnbudgetedRow.es.js +4 -4
- package/dist/budgets/components/shared/BudgetDetailsTopSection.es.js +1 -1
- package/dist/cashflow/CashflowOnboarding.es.js +57 -55
- package/dist/cashflow/CashflowOnboarding.es.js.map +1 -1
- package/dist/cashflow/CashflowWidget.es.js +1 -1
- package/dist/cashflow/components/SummaryTab.es.js +1 -1
- package/dist/common/hooks/index.d.ts +1 -0
- package/dist/common/hooks/useRepeatingTransactionEligibility.d.ts +6 -0
- package/dist/common/hooks/useRepeatingTransactionEligibility.es.js +12 -0
- package/dist/common/hooks/useRepeatingTransactionEligibility.es.js.map +1 -0
- package/dist/common/index.es.js +114 -112
- package/dist/core/constants/repeatingTransactions.d.ts +5 -2
- package/dist/core/constants/repeatingTransactions.es.js +24 -9
- package/dist/core/constants/repeatingTransactions.es.js.map +1 -1
- package/dist/core/index.es.js +79 -79
- package/dist/core/stores/AccountStore.es.js +1 -1
- package/dist/core/stores/CashflowStore.es.js +1 -1
- package/dist/core/stores/CategoryStore.es.js +1 -1
- package/dist/core/stores/FinstrongStore.es.js +4 -4
- package/dist/core/stores/GoalStore.es.js +1 -1
- package/dist/core/stores/RecurringTransactionsStore.es.js +9 -9
- package/dist/core/stores/SettingsStore.es.js +7 -7
- package/dist/core/stores/TransactionStore.es.js +13 -13
- package/dist/core/utils/BudgetUtil.es.js +1 -1
- package/dist/core/utils/DateUtil.es.js +5 -5
- package/dist/core/utils/DebtUtils.es.js +6 -6
- package/dist/core/utils/RecurringTransactionsUtil.d.ts +13 -1
- package/dist/core/utils/RecurringTransactionsUtil.es.js +111 -106
- package/dist/core/utils/RecurringTransactionsUtil.es.js.map +1 -1
- package/dist/core/utils/TransactionUtils.es.js +6 -6
- package/dist/debts/DebtsWidget.es.js +1 -1
- package/dist/debts/components/DebtsChart.es.js +4 -4
- package/dist/debts/components/DebtsTable.es.js +6 -6
- package/dist/debts/components/actions/ExtraPaymentAction.es.js +4 -4
- package/dist/debts/components/actions/InterestRateAction.es.js +4 -4
- package/dist/debts/components/actions/MonthlyPaymentAction.es.js +4 -4
- package/dist/debts/components/actions/OriginalBalanceAction.es.js +4 -4
- package/dist/debts/components/debtsdrawer/DebtScheduleTab.es.js +1 -1
- package/dist/finstrong/components/MaintainingEmergencySavings/MaintainingEmergencySavingsContent.es.js +4 -4
- package/dist/finstrong/components/ProfileDrawer.es.js +1 -1
- package/dist/finstrong/components/SaveEnoughToLiveOn/AvailableTabContent.es.js +1 -1
- package/dist/finstrong/components/onboarding/OnboardingStepsDrawer.es.js +106 -104
- package/dist/finstrong/components/onboarding/OnboardingStepsDrawer.es.js.map +1 -1
- package/dist/finstrong/components/shared/Accounts.es.js +4 -4
- package/dist/finstrong/components/shared/Transactions.es.js +4 -4
- package/dist/goals/GoalsWidget.es.js +7 -7
- package/dist/goals/components/AccountSelectionDrawer.es.js +4 -4
- package/dist/goals/components/AddGoal.es.js +1 -1
- package/dist/goals/components/GoalDetailsDrawer.es.js +1 -1
- package/dist/goals/components/ManageGoals.es.js +1 -1
- package/dist/goals/components/actions/ChangeAccountAction.es.js +1 -1
- package/dist/goals/components/managegoals/OngoingListItem.es.js +4 -4
- package/dist/insights/components/shared/DrillDownCalculation/DrillDownCalculation.es.js +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +1 -1
- package/dist/investments/InvestmentsWidget.es.js +7 -7
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +10 -10
- package/dist/recurringtransactions/components/RecurringTransactionDetailsDrawer.es.js +4 -4
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js +10 -10
- package/dist/recurringtransactions/components/actions/LinkTransactionDrawer.es.js +4 -4
- package/dist/recurringtransactions/components/actions/PaymentScheduleAction.es.js +6 -6
- package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js +45 -43
- package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js.map +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/ManageExpenses.es.js +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/ManageIncome.es.js +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/RecurringRow.es.js +6 -6
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.d.ts +7 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js +15 -16
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js.map +1 -1
- package/dist/settings/components/devices/DeviceList.es.js +1 -1
- package/dist/settings/components/devices/DeviceTable.es.js +1 -1
- package/dist/settings/components/notifications/AccountProfileListItem.es.js +5 -5
- package/dist/settings/components/notifications/NotificationSettings.es.js +1 -1
- package/dist/spending/components/SpendingDonut.es.js +1 -1
- package/dist/transactions/components/shared/TransactionDetails.es.js +8 -8
- package/dist/transactions/components/shared/TransactionList.es.js +4 -4
- package/dist/transactions/components/shared/transactiondetails/actions/AddMerchantBudgetAction.es.js +1 -1
- package/dist/transactions/components/shared/transactiondetails/actions/DateAction.es.js +6 -6
- package/dist/transactions/components/splitmanager/SplitManager.es.js +4 -4
- package/dist/transactions/utils/Transactions.es.js +1 -1
- package/dist/trends/components/CategoriesListItem.es.js +4 -4
- package/dist/trends/components/CategoryDetails.es.js +6 -6
- package/dist/trends/components/TrendsChart.es.js +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildDynamicCopy as B } from "../../core/utils/Localization.es.js";
|
|
2
2
|
import { useAccountStore as K, useGlobalCopyStore as M, useGoalStore as O, useUserStore as P } from "../../common/context/hooks.es.js";
|
|
3
|
+
import { TrackType as r } from "../../core/types/Goal.es.js";
|
|
3
4
|
import V from "../../common/components/dialog/Dialog.es.js";
|
|
4
5
|
import j from "../../common/components/drawer/Drawer.es.js";
|
|
5
|
-
import { TrackType as r } from "../../core/types/Goal.es.js";
|
|
6
6
|
import { GoalDetails as L } from "./GoalDetails.es.js";
|
|
7
7
|
import _ from "react";
|
|
8
8
|
import { observer as U } from "mobx-react-lite";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGlobalCopyStore as w, useGoalStore as y } from "../../common/context/hooks.es.js";
|
|
2
|
-
import k from "../../common/components/drawer/Drawer.es.js";
|
|
3
2
|
import { TrackType as n } from "../../core/types/Goal.es.js";
|
|
3
|
+
import k from "../../common/components/drawer/Drawer.es.js";
|
|
4
4
|
import { ContributionAction as E } from "./actions/ContributionAction.es.js";
|
|
5
5
|
import { OngoingListItem as K } from "./managegoals/OngoingListItem.es.js";
|
|
6
6
|
import { CompleteListItem as L } from "./managegoals/CompleteListItem.es.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildDynamicCopy as w } from "../../../core/utils/Localization.es.js";
|
|
2
2
|
import { useAccountStore as L, useAppConfig as B, useGlobalCopyStore as j, useGoalStore as D } from "../../../common/context/hooks.es.js";
|
|
3
|
-
import O from "../../../common/components/drawer/Drawer.es.js";
|
|
4
3
|
import { formatCurrency as b } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import O from "../../../common/components/drawer/Drawer.es.js";
|
|
5
5
|
import { ConnectCard as R } from "../../../common/components/ConnectCard.es.js";
|
|
6
6
|
import T from "react";
|
|
7
7
|
import c from "@mui/material/Stack";
|
|
@@ -8,8 +8,8 @@ import p from "@mui/material/Stack";
|
|
|
8
8
|
import { Text as o } from "@mxenabled/mxui";
|
|
9
9
|
import { ArrowUpwardAlt as x } from "@mxenabled/mx-icons";
|
|
10
10
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
11
|
-
import T from "
|
|
12
|
-
import
|
|
11
|
+
import { fromUnixTime as T } from "date-fns/fromUnixTime";
|
|
12
|
+
import b from "@mui/material/IconButton";
|
|
13
13
|
import A from "@mui/material/ListItem";
|
|
14
14
|
import I from "@mui/material/Avatar";
|
|
15
15
|
import v from "@mui/material/ListItemAvatar";
|
|
@@ -33,7 +33,7 @@ var W = ({ goal: t, index: a, onUpClick: c }) => {
|
|
|
33
33
|
width: "16px"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
children: t.track_type === n.SAVINGS_TRACK ? /* @__PURE__ */ r(
|
|
36
|
+
children: t.track_type === n.SAVINGS_TRACK ? /* @__PURE__ */ r(b, {
|
|
37
37
|
onClick: () => c?.(t),
|
|
38
38
|
children: /* @__PURE__ */ r(x, {
|
|
39
39
|
color: "primary",
|
|
@@ -65,7 +65,7 @@ var W = ({ goal: t, index: a, onUpClick: c }) => {
|
|
|
65
65
|
children: t.name
|
|
66
66
|
}), /* @__PURE__ */ r(o, {
|
|
67
67
|
variant: "caption",
|
|
68
|
-
children: t.is_complete ? l : m(e.goal_projection, f(
|
|
68
|
+
children: t.is_complete ? l : m(e.goal_projection, f(T(t.projected_to_complete_at || 0), d.MONTH_SHORT_YEAR))
|
|
69
69
|
})]
|
|
70
70
|
}), /* @__PURE__ */ r(o, {
|
|
71
71
|
bold: !0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildDynamicCopy as O } from "../../../../core/utils/Localization.es.js";
|
|
2
|
-
import V from "../../../../common/components/drawer/Drawer.es.js";
|
|
3
2
|
import { formatCurrency as o } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import V from "../../../../common/components/drawer/Drawer.es.js";
|
|
4
4
|
import N from "../SaveEnoughToLiveOnBottomSection.es.js";
|
|
5
5
|
import { BalanceStepper as S } from "./BalanceStepper.es.js";
|
|
6
6
|
import u from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGlobalCopyStore as Q, useGlobalUiStore as W, useInsightsV2Store as X } from "../../../common/context/hooks.es.js";
|
|
2
|
-
import Y from "../../../
|
|
3
|
-
import
|
|
2
|
+
import { formatCurrency as Y } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import Z from "../../../common/components/drawer/Drawer.es.js";
|
|
4
4
|
import tt from "../../../common/components/Loader.es.js";
|
|
5
5
|
import { BarChartV2 as et } from "../../components/chartblocks/BarchartV2.es.js";
|
|
6
6
|
import { EmptyBarChart as at } from "../../components/chartblocks/EmptyBarChart.es.js";
|
|
@@ -63,7 +63,7 @@ var It = mt(({ beat: a }) => {
|
|
|
63
63
|
const P = [l.general.monthly_amount, l.general.trend], [U, $] = e?.legends?.length ? e.legends.map((t) => t.label) : P, q = c === "local" ? (t) => D(t).custom ?? (() => !0) : void 0, z = c === "local" ? s : void 0, J = g === "singleBar" || g === "upcomingBill" ? r.length ? /* @__PURE__ */ o(et, {
|
|
64
64
|
amounts: {
|
|
65
65
|
average: e?.average_amount,
|
|
66
|
-
formattedAverage:
|
|
66
|
+
formattedAverage: Y(e?.average_amount ?? 0, "0,0.00")
|
|
67
67
|
},
|
|
68
68
|
color: N[0] ?? h.palette.primary.main,
|
|
69
69
|
data: r,
|
|
@@ -98,7 +98,7 @@ var It = mt(({ beat: a }) => {
|
|
|
98
98
|
onEachRowClick: (t) => {
|
|
99
99
|
C({ transaction_guid: t }), T(!0);
|
|
100
100
|
}
|
|
101
|
-
}), /* @__PURE__ */ o(
|
|
101
|
+
}), /* @__PURE__ */ o(Z, {
|
|
102
102
|
ariaLabelClose: B.close_aria,
|
|
103
103
|
isOpen: I,
|
|
104
104
|
onClose: () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildDynamicCopy as i } from "../../../../core/utils/Localization.es.js";
|
|
2
2
|
import { DATE_FORMATS_INTL as u, formatDate as _ } from "../../../../core/constants/DateFormats.es.js";
|
|
3
|
-
import { getCategoryColor as c } from "../../../../core/utils/CategoryUtil.es.js";
|
|
4
3
|
import { formatCurrency as m } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { getCategoryColor as c } from "../../../../core/utils/CategoryUtil.es.js";
|
|
5
5
|
import { getLayoutConfig as C } from "./layout.es.js";
|
|
6
6
|
import { parseISO as p } from "date-fns/parseISO";
|
|
7
7
|
var l = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildDynamicCopy as a } from "../../../../core/utils/Localization.es.js";
|
|
2
|
-
import { getCategoryColor as h } from "../../../../core/utils/CategoryUtil.es.js";
|
|
3
2
|
import { formatCurrency as r } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { getCategoryColor as h } from "../../../../core/utils/CategoryUtil.es.js";
|
|
4
4
|
import C from "../../../components/ComponentBlocks/StatusIndicator.es.js";
|
|
5
5
|
import { getColorByBudgetTier as x } from "./util.es.js";
|
|
6
6
|
import { CategoryIcon as B, MerchantLogo as T, Text as k } from "@mxenabled/mxui";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AccountType as O } from "../core/types/Account.es.js";
|
|
2
|
+
import { useAccountStore as k, useEvent as F, useGlobalCopyStore as K, useGlobalUiStore as V, useHoldingStore as y } from "../common/context/hooks.es.js";
|
|
3
|
+
import { useScreenSize as H } from "../common/hooks/useScreenSize.es.js";
|
|
4
|
+
import { useWidgetLoadTimer as U } from "../common/hooks/useWidgetLoadTimer.es.js";
|
|
4
5
|
import { ANALYTICS_EVENTS as s } from "../common/constants/Analytics.es.js";
|
|
5
|
-
import { AccountType as U } from "../core/types/Account.es.js";
|
|
6
6
|
import j from "../common/components/Loader.es.js";
|
|
7
7
|
import { WidgetContainer as z } from "../common/components/WidgetContainer.es.js";
|
|
8
8
|
import { EmptyState as B } from "../common/components/EmptyState.es.js";
|
|
@@ -19,8 +19,8 @@ import Z from "@mui/material/Tab";
|
|
|
19
19
|
import tt from "@mui/material/Tabs";
|
|
20
20
|
import et from "@mui/material/Tooltip";
|
|
21
21
|
var It = P(({ onBackClick: I, onMenuClick: S, sx: g }) => {
|
|
22
|
-
const { onEvent: c } =
|
|
23
|
-
|
|
22
|
+
const { onEvent: c } = F(), { isMobile: v } = H(), { isAccountDataLoaded: A, loadAccountData: N, visibleInvestmentAccounts: L } = k(), { visibleHoldings: x, hasAllocationData: m, hasAnalysisData: d, setShowConnectionsWidget: _, showConnectionsWidget: D } = y(), { investments: e, accounts: W } = K(), { isInitialized: p } = V(), [o, f] = l.useState(0), { loadHoldings: w, holdingsLoaded: n } = y();
|
|
23
|
+
U({
|
|
24
24
|
widgetName: "InvestmentsWidget",
|
|
25
25
|
isLoaded: n
|
|
26
26
|
}), l.useEffect(() => {
|
|
@@ -61,7 +61,7 @@ var It = P(({ onBackClick: I, onMenuClick: S, sx: g }) => {
|
|
|
61
61
|
}
|
|
62
62
|
];
|
|
63
63
|
return /* @__PURE__ */ T(z, {
|
|
64
|
-
allowedAccountTypes: [
|
|
64
|
+
allowedAccountTypes: [O.INVESTMENT],
|
|
65
65
|
onAccountsFilterClick: M,
|
|
66
66
|
onBackClick: I,
|
|
67
67
|
onMenuClick: S,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useAccountStore as et, useEvent as ot, useGlobalCopyStore as at, useGlobalUiStore as nt, useRecurringTransactionsStore as it, useTransactionStore as st } from "../../common/context/hooks.es.js";
|
|
2
|
-
import rt from "../../
|
|
3
|
-
import
|
|
2
|
+
import { RecurrenceStatus as rt, RepeatingType as ct } from "../../core/types/RepeatingTransaction.es.js";
|
|
3
|
+
import { formatCurrency as lt } from "../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { getNextUpcomingDate as mt } from "../../core/utils/RecurringTransactionsUtil.es.js";
|
|
5
|
+
import dt from "../../common/components/dialog/Dialog.es.js";
|
|
6
|
+
import ut from "../../common/components/drawer/Drawer.es.js";
|
|
4
7
|
import { ANALYTICS_EVENTS as h } from "../../common/constants/Analytics.es.js";
|
|
5
|
-
import { RecurrenceStatus as lt, RepeatingType as mt } from "../../core/types/RepeatingTransaction.es.js";
|
|
6
|
-
import { formatCurrency as dt } from "../../core/utils/NumberFormatting.es.js";
|
|
7
|
-
import { getNextUpcomingDate as ut } from "../../core/utils/RecurringTransactionsUtil.es.js";
|
|
8
8
|
import T from "../../common/components/DataRow.es.js";
|
|
9
9
|
import { useAccountUiStore as pt } from "../../accounts/hooks/useUiStore.es.js";
|
|
10
10
|
import ft from "../../transactions/components/shared/TransactionDetails.es.js";
|
|
@@ -39,7 +39,7 @@ var ie = Dt(({ onDeleted: M, recurringTransaction: e, selectedRecurrence: i }) =
|
|
|
39
39
|
custom: (o) => o.repeating_transaction_guid === e.guid
|
|
40
40
|
});
|
|
41
41
|
}, [e.guid]);
|
|
42
|
-
const s = n.useMemo(() => k.find((o) => o.guid === f), [f, k]), r = e.repeating_transaction_type ===
|
|
42
|
+
const s = n.useMemo(() => k.find((o) => o.guid === f), [f, k]), r = e.repeating_transaction_type === ct.Income, H = n.useMemo(() => m.filter((o) => o.repeating_transaction_guid === e.guid), [m, e.guid]), J = mt(e, v), Q = () => {
|
|
43
43
|
if (e.account) {
|
|
44
44
|
G(e.account);
|
|
45
45
|
const o = P.find((_) => _.guid === e.account?.member_guid) || {};
|
|
@@ -86,11 +86,11 @@ var ie = Dt(({ onDeleted: M, recurringTransaction: e, selectedRecurrence: i }) =
|
|
|
86
86
|
mb: 16
|
|
87
87
|
},
|
|
88
88
|
variant: "h1",
|
|
89
|
-
children: [r ? "+" : "",
|
|
89
|
+
children: [r ? "+" : "", lt(K, "0,0.00")]
|
|
90
90
|
}),
|
|
91
91
|
/* @__PURE__ */ t(gt, {
|
|
92
92
|
expectedDate: i?.occurredOnDate || i?.expectedDate || J,
|
|
93
|
-
onMarkAsPaidClick: i?.status ===
|
|
93
|
+
onMarkAsPaidClick: i?.status === rt.Paid && i.transaction?.guid ? () => R(i.transaction.guid) : y,
|
|
94
94
|
status: i?.status
|
|
95
95
|
})
|
|
96
96
|
]
|
|
@@ -133,14 +133,14 @@ var ie = Dt(({ onDeleted: M, recurringTransaction: e, selectedRecurrence: i }) =
|
|
|
133
133
|
recurringTransaction: e,
|
|
134
134
|
transactions: H
|
|
135
135
|
}),
|
|
136
|
-
/* @__PURE__ */ t(
|
|
136
|
+
/* @__PURE__ */ t(ut, {
|
|
137
137
|
ariaLabelClose: a.close_drawer_aria,
|
|
138
138
|
isOpen: !!f && !!s,
|
|
139
139
|
onClose: () => D(""),
|
|
140
140
|
title: a.transaction_details_drawer_title,
|
|
141
141
|
children: s && /* @__PURE__ */ t(ft, { transaction: s })
|
|
142
142
|
}),
|
|
143
|
-
/* @__PURE__ */ t(
|
|
143
|
+
/* @__PURE__ */ t(dt, {
|
|
144
144
|
copy: {
|
|
145
145
|
title: r ? a.delete_income_title : a.delete_expense_title,
|
|
146
146
|
close_aria: a.close_drawer_aria
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGlobalCopyStore as s, useRecurringTransactionsStore as c } from "../../common/context/hooks.es.js";
|
|
2
|
-
import l from "../../
|
|
3
|
-
import
|
|
2
|
+
import { RepeatingType as l } from "../../core/types/RepeatingTransaction.es.js";
|
|
3
|
+
import p from "../../common/components/drawer/Drawer.es.js";
|
|
4
4
|
import { RecurringTransactionDetails as m } from "./RecurringTransactionDetails.es.js";
|
|
5
5
|
import { observer as u } from "mobx-react-lite";
|
|
6
6
|
import { jsx as t } from "react/jsx-runtime";
|
|
@@ -8,11 +8,11 @@ var D = u(() => {
|
|
|
8
8
|
const { recurring: r } = s(), { selectedRecurrence: o, selectedRepeatingTransaction: e, setSelectedRecurrence: a, setSelectedRepeatingTransactionGuid: i } = c(), n = () => {
|
|
9
9
|
i(null), a(null);
|
|
10
10
|
};
|
|
11
|
-
return /* @__PURE__ */ t(
|
|
11
|
+
return /* @__PURE__ */ t(p, {
|
|
12
12
|
ariaLabelClose: r.close_drawer_aria,
|
|
13
13
|
isOpen: !!e,
|
|
14
14
|
onClose: n,
|
|
15
|
-
title: e?.repeating_transaction_type ===
|
|
15
|
+
title: e?.repeating_transaction_type === l.Income ? r.income_details : r.expense_details,
|
|
16
16
|
children: e && /* @__PURE__ */ t(m, {
|
|
17
17
|
onDeleted: n,
|
|
18
18
|
recurringTransaction: e,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DATE_FORMATS_INTL as A, formatDate as E } from "../../core/constants/DateFormats.es.js";
|
|
2
2
|
import { useEvent as N, useGlobalCopyStore as O, useRecurringTransactionsStore as z } from "../../common/context/hooks.es.js";
|
|
3
|
-
import { ANALYTICS_EVENTS as D } from "../../common/constants/Analytics.es.js";
|
|
4
3
|
import { RecurrenceStatus as o } from "../../core/types/RepeatingTransaction.es.js";
|
|
5
|
-
import { formatCurrency as
|
|
4
|
+
import { formatCurrency as D } from "../../core/utils/NumberFormatting.es.js";
|
|
5
|
+
import { ANALYTICS_EVENTS as j } from "../../common/constants/Analytics.es.js";
|
|
6
6
|
import { ListItemWrapper as w } from "../../common/components/ListItemWrapper.es.js";
|
|
7
7
|
import c from "react";
|
|
8
8
|
import l from "@mui/material/Stack";
|
|
9
9
|
import { MerchantLogo as P, Text as a } from "@mxenabled/mxui";
|
|
10
10
|
import { Cancel as U, CheckCircle as B, Icon as Y } from "@mxenabled/mx-icons";
|
|
11
11
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
12
|
-
import F from "
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
12
|
+
import { fromUnixTime as F } from "date-fns/fromUnixTime";
|
|
13
|
+
import { getUnixTime as H } from "date-fns/getUnixTime";
|
|
14
|
+
import W from "@mui/material/IconButton";
|
|
15
15
|
import $ from "@mui/material/Divider";
|
|
16
16
|
import K from "@mui/material/List";
|
|
17
17
|
import V from "@mui/material/ListItemAvatar";
|
|
@@ -33,7 +33,7 @@ var X = (d, u) => {
|
|
|
33
33
|
key: `missed-${e.expectedDate.getTime()}`,
|
|
34
34
|
name: e.name,
|
|
35
35
|
amount: e.amount,
|
|
36
|
-
date:
|
|
36
|
+
date: H(e.expectedDate),
|
|
37
37
|
merchantGuid: e.merchantGuid || "",
|
|
38
38
|
categoryGuid: e.categoryGuid,
|
|
39
39
|
category: "",
|
|
@@ -44,7 +44,7 @@ var X = (d, u) => {
|
|
|
44
44
|
const { recurring: n } = O(), { onEvent: T } = N(), { recurrences: y } = z(), [x, _] = c.useState(null), [s, v] = c.useState(null), M = c.useMemo(() => y.filter((t) => t.repeatingTransactionGuid === e.guid && t.status === o.Missed), [y, e.guid]), C = c.useMemo(() => X(m, M), [m, M]), G = (t) => {
|
|
45
45
|
t.transactionGuid && h(t.transactionGuid);
|
|
46
46
|
}, R = (t, f) => {
|
|
47
|
-
t.stopPropagation(), _(t.currentTarget), v(f), T(
|
|
47
|
+
t.stopPropagation(), _(t.currentTarget), v(f), T(j.RECURRING_TRANSACTIONS_LIST_CLICK_MORE_MENU);
|
|
48
48
|
}, b = () => {
|
|
49
49
|
_(null), v(null);
|
|
50
50
|
}, L = () => {
|
|
@@ -88,7 +88,7 @@ var X = (d, u) => {
|
|
|
88
88
|
justifyContent: "space-between",
|
|
89
89
|
children: [/* @__PURE__ */ r(a, {
|
|
90
90
|
variant: "caption",
|
|
91
|
-
children: E(
|
|
91
|
+
children: E(F(t.date), A.MONTH_DAY_YEAR)
|
|
92
92
|
}), /* @__PURE__ */ i(l, {
|
|
93
93
|
alignItems: "center",
|
|
94
94
|
direction: "row",
|
|
@@ -127,11 +127,11 @@ var X = (d, u) => {
|
|
|
127
127
|
color: d ? "success.main" : "text.primary",
|
|
128
128
|
sx: { flexShrink: 0 },
|
|
129
129
|
variant: "body1",
|
|
130
|
-
children: [d ? "+" : "",
|
|
130
|
+
children: [d ? "+" : "", D(t.amount, "0,0.00")]
|
|
131
131
|
})]
|
|
132
132
|
})
|
|
133
133
|
}),
|
|
134
|
-
/* @__PURE__ */ r(
|
|
134
|
+
/* @__PURE__ */ r(W, {
|
|
135
135
|
"aria-label": n.more_menu_aria,
|
|
136
136
|
onClick: (k) => R(k, t),
|
|
137
137
|
size: "small",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGlobalCopyStore as _, useRecurringTransactionsStore as h, useTransactionStore as F } from "../../../common/context/hooks.es.js";
|
|
2
|
-
import b from "../../../
|
|
3
|
-
import
|
|
2
|
+
import { RepeatingType as b } from "../../../core/types/RepeatingTransaction.es.js";
|
|
3
|
+
import g from "../../../common/components/drawer/Drawer.es.js";
|
|
4
4
|
import { useTransactionsUiStore as y } from "../../../transactions/context/hooks.es.js";
|
|
5
5
|
import { expenseFilter as w, expenseFilterSearch as x, incomeFilter as R, incomeFilterSearch as k } from "../../../transactions/utils/Filters.es.js";
|
|
6
6
|
import { SelectTransaction as v } from "../shared/recurringsettings/SelectTransaction.es.js";
|
|
@@ -9,7 +9,7 @@ import { observer as D } from "mobx-react-lite";
|
|
|
9
9
|
import { jsx as s } from "react/jsx-runtime";
|
|
10
10
|
var m = (t, r) => (e) => {
|
|
11
11
|
if (e.repeating_transaction_guid) return !1;
|
|
12
|
-
const o = t.repeating_transaction_type ===
|
|
12
|
+
const o = t.repeating_transaction_type === b.Income;
|
|
13
13
|
return r ? o ? k(e, r) : x(e, r) : o ? R(e) : w(e);
|
|
14
14
|
}, q = D(({ isOpen: t, onClose: r, recurringTransaction: e }) => {
|
|
15
15
|
const { recurring: o } = _(), { markRecurrenceAsPaid: l } = h(), { filter: n, setFilter: a, transactions: f } = F(), { setSearchValue: p } = y();
|
|
@@ -28,7 +28,7 @@ var m = (t, r) => (e) => {
|
|
|
28
28
|
const c = f.find((S) => S.guid === i);
|
|
29
29
|
c && (await l(e.guid, c), r());
|
|
30
30
|
};
|
|
31
|
-
return /* @__PURE__ */ s(
|
|
31
|
+
return /* @__PURE__ */ s(g, {
|
|
32
32
|
ariaLabelClose: o.close_drawer_aria,
|
|
33
33
|
isOpen: t,
|
|
34
34
|
onClose: r,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEvent as p, useGlobalCopyStore as f, useRecurringTransactionsStore as C } from "../../../common/context/hooks.es.js";
|
|
2
|
-
import h from "../../../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import { getFrequencyLabel as h } from "../../../core/utils/RecurringTransactionsUtil.es.js";
|
|
3
|
+
import D from "../../../common/components/drawer/Drawer.es.js";
|
|
4
|
+
import { ANALYTICS_EVENTS as E } from "../../../common/constants/Analytics.es.js";
|
|
5
5
|
import v from "../../../common/components/DataRow.es.js";
|
|
6
6
|
import { PaymentSchedule as A } from "../PaymentSchedule.es.js";
|
|
7
7
|
import t from "react";
|
|
@@ -16,15 +16,15 @@ var x = R(({ repeatingTransaction: e }) => {
|
|
|
16
16
|
second_recurrence_day: s
|
|
17
17
|
}), o(!1);
|
|
18
18
|
}, S = () => {
|
|
19
|
-
o(!0), m(
|
|
19
|
+
o(!0), m(E.RECURRING_TRANSACTIONS_DETAILS_CLICK_PAYMENT_SCHEDULE);
|
|
20
20
|
};
|
|
21
21
|
return /* @__PURE__ */ N(F, { children: [/* @__PURE__ */ n(v, {
|
|
22
22
|
iconName: "sync",
|
|
23
23
|
label: r.activity_schedule,
|
|
24
24
|
onClick: S,
|
|
25
25
|
showChevron: !1,
|
|
26
|
-
value: `${
|
|
27
|
-
}), /* @__PURE__ */ n(
|
|
26
|
+
value: `${h(r, e, !0)}`
|
|
27
|
+
}), /* @__PURE__ */ n(D, {
|
|
28
28
|
ariaLabelClose: r.close_drawer_aria,
|
|
29
29
|
isOpen: y,
|
|
30
30
|
onClose: () => o(!1),
|
package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import S from "../../../../
|
|
3
|
-
import { Frequency as L, RepeatingType as T } from "../../../../core/types/RepeatingTransaction.es.js";
|
|
1
|
+
import { useGlobalCopyStore as B, useRecurringTransactionsStore as G, useTransactionStore as j, useUserStore as E } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { Frequency as L, RepeatingType as S } from "../../../../core/types/RepeatingTransaction.es.js";
|
|
4
3
|
import { getNextPaymentDate as M } from "../../../../core/utils/RecurringTransactionsUtil.es.js";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
4
|
+
import { useRepeatingTransactionEligibility as P } from "../../../../common/hooks/useRepeatingTransactionEligibility.es.js";
|
|
5
|
+
import T from "../../../../common/components/drawer/Drawer.es.js";
|
|
6
|
+
import { expenseFilter as F, expenseFilterSearch as U, incomeFilter as h, incomeFilterSearch as k } from "../../../../transactions/utils/Filters.es.js";
|
|
7
|
+
import { SelectTransaction as z } from "./SelectTransaction.es.js";
|
|
8
|
+
import { AddRecurringTransactionDetails as N } from "./AddRecurringTransactionDetails.es.js";
|
|
8
9
|
import o from "react";
|
|
9
|
-
import { observer as
|
|
10
|
-
import
|
|
11
|
-
import { Add as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
var
|
|
16
|
-
const { recurring: r } =
|
|
17
|
-
d(!0), c(
|
|
10
|
+
import { observer as $ } from "mobx-react-lite";
|
|
11
|
+
import H from "@mui/material/Button";
|
|
12
|
+
import { Add as I } from "@mxenabled/mx-icons";
|
|
13
|
+
import { Fragment as J, jsx as i, jsxs as K } from "react/jsx-runtime";
|
|
14
|
+
import { formatISO as Q } from "date-fns/formatISO";
|
|
15
|
+
import { fromUnixTime as W } from "date-fns/fromUnixTime";
|
|
16
|
+
var le = $(({ isIncome: a = !1, label: _, onAddRecurringTransaction: x = () => null }) => {
|
|
17
|
+
const { recurring: r } = B(), { filter: s, setFilter: c, transactions: g } = j(), { addRepeatingTransaction: D } = G(), { user: C } = E(), R = P(), [O, d] = o.useState(!1), [u, l] = o.useState(""), [m, b] = o.useState(L.EveryMonth), [p, A] = o.useState(1), [f, q] = o.useState(15), e = o.useMemo(() => g.find((t) => t.guid === u), [u, g]), v = () => {
|
|
18
|
+
d(!0), c(a ? {
|
|
18
19
|
...s,
|
|
19
|
-
custom:
|
|
20
|
+
custom: h
|
|
20
21
|
} : {
|
|
21
22
|
...s,
|
|
22
|
-
custom:
|
|
23
|
+
custom: F
|
|
23
24
|
});
|
|
24
|
-
},
|
|
25
|
+
}, w = async () => {
|
|
25
26
|
if (!e) {
|
|
26
27
|
y();
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
x();
|
|
30
|
-
const t = M(
|
|
31
|
+
const t = M(m, W(e.date), p), n = {
|
|
31
32
|
account_guid: e.account_guid,
|
|
32
33
|
amount: e.amount,
|
|
33
34
|
category_guid: e.category_guid ?? null,
|
|
@@ -35,61 +36,62 @@ var ce = E(({ isIncome: i = !1, label: _, onAddRecurringTransaction: x = () => n
|
|
|
35
36
|
main_class_guid: e.main_class_guid ?? null,
|
|
36
37
|
merchant_guid: e.merchant_guid,
|
|
37
38
|
description: e.payee || e.description || e.feed_description,
|
|
38
|
-
predicted_occurs_on:
|
|
39
|
+
predicted_occurs_on: Q(t, { representation: "date" }),
|
|
39
40
|
recurrence_day: p,
|
|
40
|
-
recurrence_type:
|
|
41
|
-
repeating_transaction_type:
|
|
42
|
-
second_recurrence_day:
|
|
41
|
+
recurrence_type: m,
|
|
42
|
+
repeating_transaction_type: a ? S.Income : S.Bill,
|
|
43
|
+
second_recurrence_day: f,
|
|
43
44
|
transaction_type: e.transaction_type,
|
|
44
45
|
user_guid: C.guid
|
|
45
46
|
};
|
|
46
47
|
await D(n, e), y();
|
|
47
48
|
}, y = () => {
|
|
48
|
-
|
|
49
|
+
l(""), d(!1);
|
|
49
50
|
};
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
onClick:
|
|
53
|
-
startIcon: /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ K(J, { children: [
|
|
52
|
+
/* @__PURE__ */ i(H, {
|
|
53
|
+
onClick: v,
|
|
54
|
+
startIcon: /* @__PURE__ */ i(I, { size: 24 }),
|
|
54
55
|
variant: "contained",
|
|
55
56
|
children: _
|
|
56
57
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ i(T, {
|
|
58
59
|
ariaLabelClose: r.close_drawer_aria,
|
|
59
60
|
isOpen: O,
|
|
60
61
|
onClose: () => d(!1),
|
|
61
62
|
title: _,
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
description:
|
|
63
|
+
children: /* @__PURE__ */ i(z, {
|
|
64
|
+
description: a ? r.add_income_description : r.add_expense_description,
|
|
65
|
+
eligibilityFilter: R,
|
|
64
66
|
onSearch: (t) => {
|
|
65
67
|
c({
|
|
66
68
|
...s,
|
|
67
|
-
custom: (n) =>
|
|
69
|
+
custom: (n) => a ? t ? k(n, t) : h(n) : t ? U(n, t) : F(n)
|
|
68
70
|
});
|
|
69
71
|
},
|
|
70
|
-
onSelected: (t) =>
|
|
72
|
+
onSelected: (t) => l(t)
|
|
71
73
|
})
|
|
72
74
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ i(T, {
|
|
74
76
|
ariaLabelClose: r.close_drawer_aria,
|
|
75
77
|
isOpen: !!u,
|
|
76
|
-
onClose: () =>
|
|
77
|
-
onPrimaryAction:
|
|
78
|
-
title:
|
|
79
|
-
children: e && /* @__PURE__ */
|
|
78
|
+
onClose: () => l(""),
|
|
79
|
+
onPrimaryAction: w,
|
|
80
|
+
title: a ? r.income_details : r.expense_details,
|
|
81
|
+
children: e && /* @__PURE__ */ i(N, {
|
|
80
82
|
firstDay: p,
|
|
81
|
-
frequency:
|
|
83
|
+
frequency: m,
|
|
82
84
|
onFirstDayChange: A,
|
|
83
|
-
onFrequencyChange:
|
|
84
|
-
onSecondDayChange:
|
|
85
|
-
secondDay:
|
|
85
|
+
onFrequencyChange: b,
|
|
86
|
+
onSecondDayChange: q,
|
|
87
|
+
secondDay: f,
|
|
86
88
|
transaction: e
|
|
87
89
|
})
|
|
88
90
|
})
|
|
89
91
|
] });
|
|
90
92
|
});
|
|
91
93
|
export {
|
|
92
|
-
|
|
94
|
+
le as AddRecurringTransaction
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
//# sourceMappingURL=AddRecurringTransaction.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddRecurringTransaction.es.js","names":[],"sources":["../../../../../src/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { formatISO } from 'date-fns/formatISO'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\n\nimport Button from '@mui/material/Button'\n\nimport { Add } from '@mxenabled/mx-icons'\n\nimport {\n Drawer,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n useTransactionStore,\n useUserStore,\n} from '../../../../common'\nimport {\n type RepeatingTransaction,\n type Transaction,\n Frequency,\n RepeatingType,\n} from '../../../../core'\n\nimport { SelectTransaction } from './SelectTransaction'\nimport { AddRecurringTransactionDetails } from './AddRecurringTransactionDetails'\n\nimport {\n expenseFilter,\n expenseFilterSearch,\n incomeFilter,\n incomeFilterSearch,\n} from '../../../../transactions/utils/Filters'\n\nimport { getNextPaymentDate } from '../../../../core/utils/RecurringTransactionsUtil'\n\ninterface AddRecurringTransactionProps {\n isIncome?: boolean\n label: string\n onAddRecurringTransaction?: () => void\n}\n\nexport const AddRecurringTransaction = observer(\n ({\n isIncome = false,\n label,\n onAddRecurringTransaction = () => null,\n }: AddRecurringTransactionProps) => {\n const { recurring: copy } = useGlobalCopyStore()\n const { filter, setFilter, transactions } = useTransactionStore()\n const { addRepeatingTransaction } = useRecurringTransactionsStore()\n const { user } = useUserStore()\n\n const [isSelectTransactionOpen, setIsSelectTransactionOpen] = React.useState(false)\n const [transactionGuid, setTransactionGuid] = React.useState('')\n const [frequency, setFrequency] = React.useState(Frequency.EveryMonth)\n const [firstDay, setFirstDay] = React.useState(1)\n const [secondDay, setSecondDay] = React.useState(15)\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const handleOpen = () => {\n setIsSelectTransactionOpen(true)\n\n if (isIncome) {\n setFilter({ ...filter, custom: incomeFilter })\n } else {\n setFilter({ ...filter, custom: expenseFilter })\n }\n }\n\n const handleAddRecurringTransaction = async () => {\n if (!transaction) {\n closeOnAdd()\n return\n }\n onAddRecurringTransaction()\n\n const nextDate = getNextPaymentDate(frequency, fromUnixTime(transaction.date), firstDay)\n\n const repeatingTransaction = {\n account_guid: transaction.account_guid,\n amount: transaction.amount,\n category_guid: transaction.category_guid ?? null,\n created_by: 0, // User\n main_class_guid: transaction.main_class_guid ?? null,\n merchant_guid: transaction.merchant_guid,\n description: transaction.payee || transaction.description || transaction.feed_description,\n predicted_occurs_on: formatISO(nextDate, { representation: 'date' }),\n recurrence_day: firstDay,\n recurrence_type: frequency,\n repeating_transaction_type: isIncome ? RepeatingType.Income : RepeatingType.Bill,\n second_recurrence_day: secondDay,\n transaction_type: transaction.transaction_type,\n user_guid: user.guid,\n } as RepeatingTransaction\n\n await addRepeatingTransaction(repeatingTransaction, transaction)\n closeOnAdd()\n }\n\n const closeOnAdd = () => {\n setTransactionGuid('')\n setIsSelectTransactionOpen(false)\n }\n\n return (\n <>\n <Button onClick={handleOpen} startIcon={<Add size={24} />} variant=\"contained\">\n {label}\n </Button>\n\n <Drawer\n ariaLabelClose={copy.close_drawer_aria}\n isOpen={isSelectTransactionOpen}\n onClose={() => setIsSelectTransactionOpen(false)}\n title={label}\n >\n <SelectTransaction\n description={isIncome ? copy.add_income_description : copy.add_expense_description}\n onSearch={(searchValue) => {\n setFilter({\n ...filter,\n custom: (transaction: Transaction) => {\n if (isIncome) {\n return searchValue\n ? incomeFilterSearch(transaction, searchValue)\n : incomeFilter(transaction)\n } else {\n return searchValue\n ? expenseFilterSearch(transaction, searchValue)\n : expenseFilter(transaction)\n }\n },\n })\n }}\n onSelected={(guid) => setTransactionGuid(guid)}\n />\n </Drawer>\n\n <Drawer\n ariaLabelClose={copy.close_drawer_aria}\n isOpen={Boolean(transactionGuid)}\n onClose={() => setTransactionGuid('')}\n onPrimaryAction={handleAddRecurringTransaction}\n title={isIncome ? copy.income_details : copy.expense_details}\n >\n {transaction && (\n <AddRecurringTransactionDetails\n firstDay={firstDay}\n frequency={frequency}\n onFirstDayChange={setFirstDay}\n onFrequencyChange={setFrequency}\n onSecondDayChange={setSecondDay}\n secondDay={secondDay}\n transaction={transaction}\n />\n )}\n </Drawer>\n </>\n )\n },\n)\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddRecurringTransaction.es.js","names":[],"sources":["../../../../../src/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { formatISO } from 'date-fns/formatISO'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\n\nimport Button from '@mui/material/Button'\n\nimport { Add } from '@mxenabled/mx-icons'\n\nimport {\n Drawer,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n useRepeatingTransactionEligibility,\n useTransactionStore,\n useUserStore,\n} from '../../../../common'\nimport {\n type RepeatingTransaction,\n type Transaction,\n Frequency,\n RepeatingType,\n} from '../../../../core'\n\nimport { SelectTransaction } from './SelectTransaction'\nimport { AddRecurringTransactionDetails } from './AddRecurringTransactionDetails'\n\nimport {\n expenseFilter,\n expenseFilterSearch,\n incomeFilter,\n incomeFilterSearch,\n} from '../../../../transactions/utils/Filters'\n\nimport { getNextPaymentDate } from '../../../../core/utils/RecurringTransactionsUtil'\n\ninterface AddRecurringTransactionProps {\n isIncome?: boolean\n label: string\n onAddRecurringTransaction?: () => void\n}\n\nexport const AddRecurringTransaction = observer(\n ({\n isIncome = false,\n label,\n onAddRecurringTransaction = () => null,\n }: AddRecurringTransactionProps) => {\n const { recurring: copy } = useGlobalCopyStore()\n const { filter, setFilter, transactions } = useTransactionStore()\n const { addRepeatingTransaction } = useRecurringTransactionsStore()\n const { user } = useUserStore()\n const eligibilityFilter = useRepeatingTransactionEligibility()\n\n const [isSelectTransactionOpen, setIsSelectTransactionOpen] = React.useState(false)\n const [transactionGuid, setTransactionGuid] = React.useState('')\n const [frequency, setFrequency] = React.useState(Frequency.EveryMonth)\n const [firstDay, setFirstDay] = React.useState(1)\n const [secondDay, setSecondDay] = React.useState(15)\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const handleOpen = () => {\n setIsSelectTransactionOpen(true)\n\n if (isIncome) {\n setFilter({ ...filter, custom: incomeFilter })\n } else {\n setFilter({ ...filter, custom: expenseFilter })\n }\n }\n\n const handleAddRecurringTransaction = async () => {\n if (!transaction) {\n closeOnAdd()\n return\n }\n onAddRecurringTransaction()\n\n const nextDate = getNextPaymentDate(frequency, fromUnixTime(transaction.date), firstDay)\n\n const repeatingTransaction = {\n account_guid: transaction.account_guid,\n amount: transaction.amount,\n category_guid: transaction.category_guid ?? null,\n created_by: 0, // User\n main_class_guid: transaction.main_class_guid ?? null,\n merchant_guid: transaction.merchant_guid,\n description: transaction.payee || transaction.description || transaction.feed_description,\n predicted_occurs_on: formatISO(nextDate, { representation: 'date' }),\n recurrence_day: firstDay,\n recurrence_type: frequency,\n repeating_transaction_type: isIncome ? RepeatingType.Income : RepeatingType.Bill,\n second_recurrence_day: secondDay,\n transaction_type: transaction.transaction_type,\n user_guid: user.guid,\n } as RepeatingTransaction\n\n await addRepeatingTransaction(repeatingTransaction, transaction)\n closeOnAdd()\n }\n\n const closeOnAdd = () => {\n setTransactionGuid('')\n setIsSelectTransactionOpen(false)\n }\n\n return (\n <>\n <Button onClick={handleOpen} startIcon={<Add size={24} />} variant=\"contained\">\n {label}\n </Button>\n\n <Drawer\n ariaLabelClose={copy.close_drawer_aria}\n isOpen={isSelectTransactionOpen}\n onClose={() => setIsSelectTransactionOpen(false)}\n title={label}\n >\n <SelectTransaction\n description={isIncome ? copy.add_income_description : copy.add_expense_description}\n eligibilityFilter={eligibilityFilter}\n onSearch={(searchValue) => {\n setFilter({\n ...filter,\n custom: (transaction: Transaction) => {\n if (isIncome) {\n return searchValue\n ? incomeFilterSearch(transaction, searchValue)\n : incomeFilter(transaction)\n } else {\n return searchValue\n ? expenseFilterSearch(transaction, searchValue)\n : expenseFilter(transaction)\n }\n },\n })\n }}\n onSelected={(guid) => setTransactionGuid(guid)}\n />\n </Drawer>\n\n <Drawer\n ariaLabelClose={copy.close_drawer_aria}\n isOpen={Boolean(transactionGuid)}\n onClose={() => setTransactionGuid('')}\n onPrimaryAction={handleAddRecurringTransaction}\n title={isIncome ? copy.income_details : copy.expense_details}\n >\n {transaction && (\n <AddRecurringTransactionDetails\n firstDay={firstDay}\n frequency={frequency}\n onFirstDayChange={setFirstDay}\n onFrequencyChange={setFrequency}\n onSecondDayChange={setSecondDay}\n secondDay={secondDay}\n transaction={transaction}\n />\n )}\n </Drawer>\n </>\n )\n },\n)\n"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEvent as d, useGlobalCopyStore as f, useRecurringTransactionsStore as u } from "../../../../common/context/hooks.es.js";
|
|
2
|
-
import { ANALYTICS_EVENTS as a } from "../../../../common/constants/Analytics.es.js";
|
|
3
2
|
import { Frequency as x, RepeatingType as h } from "../../../../core/types/RepeatingTransaction.es.js";
|
|
3
|
+
import { ANALYTICS_EVENTS as a } from "../../../../common/constants/Analytics.es.js";
|
|
4
4
|
import { RecurringRow as R } from "./RecurringRow.es.js";
|
|
5
5
|
import { AddRecurringTransaction as E } from "./AddRecurringTransaction.es.js";
|
|
6
6
|
import { RecurringSettingsZeroState as S } from "./RecurringSettingsZeroState.es.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEvent as u, useGlobalCopyStore as f, useRecurringTransactionsStore as h } from "../../../../common/context/hooks.es.js";
|
|
2
|
-
import { ANALYTICS_EVENTS as m } from "../../../../common/constants/Analytics.es.js";
|
|
3
2
|
import { Frequency as x, RepeatingType as R } from "../../../../core/types/RepeatingTransaction.es.js";
|
|
3
|
+
import { ANALYTICS_EVENTS as m } from "../../../../common/constants/Analytics.es.js";
|
|
4
4
|
import { RecurringRow as C } from "./RecurringRow.es.js";
|
|
5
5
|
import { AddRecurringTransaction as T } from "./AddRecurringTransaction.es.js";
|
|
6
6
|
import { RecurringSettingsZeroState as _ } from "./RecurringSettingsZeroState.es.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useGlobalCopyStore as h } from "../../../../common/context/hooks.es.js";
|
|
2
|
-
import y from "../../../../common/components/drawer/Drawer.es.js";
|
|
3
2
|
import { RepeatingType as l } from "../../../../core/types/RepeatingTransaction.es.js";
|
|
4
|
-
import { formatCurrency as
|
|
5
|
-
import { getFrequencyLabel as
|
|
3
|
+
import { formatCurrency as y } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { getFrequencyLabel as x } from "../../../../core/utils/RecurringTransactionsUtil.es.js";
|
|
5
|
+
import b from "../../../../common/components/drawer/Drawer.es.js";
|
|
6
6
|
import { RecurringTransactionDetails as I } from "../../RecurringTransactionDetails.es.js";
|
|
7
7
|
import m from "react";
|
|
8
8
|
import { observer as _ } from "mobx-react-lite";
|
|
@@ -15,7 +15,7 @@ import v from "@mui/material/ListItemButton";
|
|
|
15
15
|
import D from "@mui/material/ListItemText";
|
|
16
16
|
var H = _(({ onClick: d = () => {
|
|
17
17
|
}, repeatingTransaction: t }) => {
|
|
18
|
-
const { recurring: i } = h(), [u, c] = m.useState(!1), a = m.useMemo(() => t.transactions.length === 0 ? "" : t.transactions[0].category_guid || "", [t]), p = t.account?.displayName || "", s = t.repeating_transaction_type === l.Income, f =
|
|
18
|
+
const { recurring: i } = h(), [u, c] = m.useState(!1), a = m.useMemo(() => t.transactions.length === 0 ? "" : t.transactions[0].category_guid || "", [t]), p = t.account?.displayName || "", s = t.repeating_transaction_type === l.Income, f = x(i, t, !0);
|
|
19
19
|
return /* @__PURE__ */ r(C, {
|
|
20
20
|
disableGutters: !0,
|
|
21
21
|
disablePadding: !0,
|
|
@@ -57,7 +57,7 @@ var H = _(({ onClick: d = () => {
|
|
|
57
57
|
bold: !0,
|
|
58
58
|
color: s ? "success.main" : "text.primary",
|
|
59
59
|
variant: "body1",
|
|
60
|
-
children: [s ? "+" : "",
|
|
60
|
+
children: [s ? "+" : "", y(t.amount, "0,0.00")]
|
|
61
61
|
}), /* @__PURE__ */ e(o, {
|
|
62
62
|
direction: "row",
|
|
63
63
|
sx: {
|
|
@@ -76,7 +76,7 @@ var H = _(({ onClick: d = () => {
|
|
|
76
76
|
})]
|
|
77
77
|
})]
|
|
78
78
|
}) })]
|
|
79
|
-
}), /* @__PURE__ */ e(
|
|
79
|
+
}), /* @__PURE__ */ e(b, {
|
|
80
80
|
ariaLabelClose: i.close_drawer_aria,
|
|
81
81
|
isOpen: u,
|
|
82
82
|
onClose: () => c(!1),
|
package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { Transaction } from '../../../../core';
|
|
1
2
|
interface SelectTransactionProps {
|
|
2
3
|
bgcolor?: string;
|
|
3
4
|
description?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Restricts the selectable transactions. Create flows pass the Sherlock-aligned eligibility
|
|
7
|
+
* filter; flows that may select any transaction (Mark as Paid) omit it.
|
|
8
|
+
*/
|
|
9
|
+
eligibilityFilter?: (transaction: Transaction) => boolean;
|
|
4
10
|
onSearch: (value: string) => void;
|
|
5
11
|
onSelected: (guid: string) => void;
|
|
6
12
|
}
|
|
7
|
-
export declare const SelectTransaction: (({ bgcolor, description, onSearch, onSelected, }: SelectTransactionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
13
|
+
export declare const SelectTransaction: (({ bgcolor, description, eligibilityFilter, onSearch, onSelected, }: SelectTransactionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
8
14
|
displayName: string;
|
|
9
15
|
};
|
|
10
16
|
export {};
|