@zeniai/client-epic-state 5.0.64-beta1ND → 5.0.64-betaAR1
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/lib/entity/account/accountSelector.d.ts +20 -1
- package/lib/entity/account/accountSelector.js +35 -1
- package/lib/entity/account/accountState.d.ts +5 -0
- package/lib/entity/account/accountState.js +11 -4
- package/lib/entity/class/classSelector.d.ts +5 -0
- package/lib/entity/class/classSelector.js +8 -0
- package/lib/esm/entity/account/accountSelector.js +33 -1
- package/lib/esm/entity/account/accountState.js +7 -1
- package/lib/esm/entity/class/classSelector.js +7 -0
- package/lib/esm/index.js +10 -4
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +11 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +58 -8
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +186 -0
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +2 -0
- package/lib/index.d.ts +7 -5
- package/lib/index.js +41 -33
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +12 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +4 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +60 -8
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +65 -0
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +190 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -0
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -0
- package/package.json +3 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AccountsViewParentID } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { ClassesViewParentID } from '../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
-
import { ProjectsViewParentID } from '../../commonStateTypes/projectView/projectViewParentID';
|
|
4
3
|
import { AdditionalBalancesOptions } from '../../commonStateTypes/coaBalance/additionalBalances/getAdditionalBalances';
|
|
5
4
|
import { COABalancesFilter } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
6
5
|
import { ID } from '../../commonStateTypes/common';
|
|
6
|
+
import { ProjectsViewParentID } from '../../commonStateTypes/projectView/projectViewParentID';
|
|
7
7
|
import { EntityOrder } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
8
8
|
import { ReportIDPlusForecastID } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
9
9
|
import { Account, AccountBase, AccountState, AccountType } from './accountState';
|
|
@@ -123,3 +123,22 @@ export declare const getAccountsOrdered: (filter: COABalancesFilter, accountStat
|
|
|
123
123
|
export declare const getAccountsByType: (accountState: AccountState, accountTypes: AccountType[]) => Partial<Record<AccountType, Account[]>>;
|
|
124
124
|
export declare const getAccountIdsForTypes: (accountState: AccountState, accountTypes: AccountType[]) => ID[];
|
|
125
125
|
export declare const getAccountIdsForLabels: (accountState: AccountState, labels: string[]) => ID[];
|
|
126
|
+
/**
|
|
127
|
+
* Returns all accounts currently in state (single pass over accountsByKey).
|
|
128
|
+
* Use for dropdowns that need account names and types; map to
|
|
129
|
+
* { accountId, accountName, accountType } as needed.
|
|
130
|
+
*/
|
|
131
|
+
export declare const getAllAccounts: (accountState: AccountState) => Account[];
|
|
132
|
+
export interface AccountFilterOption {
|
|
133
|
+
accountId: ID;
|
|
134
|
+
accountName: string;
|
|
135
|
+
accountType: AccountType;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
|
|
139
|
+
* all other account types → categoryOptions. Use for payment_account_name and category filter options.
|
|
140
|
+
*/
|
|
141
|
+
export declare const getTransactionFilterAccountOptions: (accountState: AccountState) => {
|
|
142
|
+
categoryOptions: AccountFilterOption[];
|
|
143
|
+
paymentAccountNames: AccountFilterOption[];
|
|
144
|
+
};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAccountIdsForLabels = exports.getAccountIdsForTypes = exports.getAccountsByType = exports.getAccountsOrdered = exports.getAccountBase = void 0;
|
|
6
|
+
exports.getTransactionFilterAccountOptions = exports.getAllAccounts = exports.getAccountIdsForLabels = exports.getAccountIdsForTypes = exports.getAccountsByType = exports.getAccountsOrdered = exports.getAccountBase = void 0;
|
|
7
7
|
exports.getAccount = getAccount;
|
|
8
8
|
exports.getAccountWithBalance = getAccountWithBalance;
|
|
9
9
|
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
@@ -192,3 +192,37 @@ const getAccountIdsForLabels = (accountState, labels) => {
|
|
|
192
192
|
return allAccountIdsForLabels;
|
|
193
193
|
};
|
|
194
194
|
exports.getAccountIdsForLabels = getAccountIdsForLabels;
|
|
195
|
+
/**
|
|
196
|
+
* Returns all accounts currently in state (single pass over accountsByKey).
|
|
197
|
+
* Use for dropdowns that need account names and types; map to
|
|
198
|
+
* { accountId, accountName, accountType } as needed.
|
|
199
|
+
*/
|
|
200
|
+
const getAllAccounts = (accountState) => Object.values(accountState.accountsByKey);
|
|
201
|
+
exports.getAllAccounts = getAllAccounts;
|
|
202
|
+
/**
|
|
203
|
+
* Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
|
|
204
|
+
* all other account types → categoryOptions. Use for payment_account_name and category filter options.
|
|
205
|
+
*/
|
|
206
|
+
const getTransactionFilterAccountOptions = (accountState) => {
|
|
207
|
+
const accounts = (0, exports.getAllAccounts)(accountState);
|
|
208
|
+
const paymentAccountNames = [];
|
|
209
|
+
const categoryOptions = [];
|
|
210
|
+
for (const account of accounts) {
|
|
211
|
+
if (account.accountType == null) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const option = {
|
|
215
|
+
accountId: account.accountId,
|
|
216
|
+
accountName: account.accountName,
|
|
217
|
+
accountType: account.accountType,
|
|
218
|
+
};
|
|
219
|
+
if ((0, accountState_1.isPaymentAccountType)(account.accountType)) {
|
|
220
|
+
paymentAccountNames.push(option);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
categoryOptions.push(option);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return { categoryOptions, paymentAccountNames };
|
|
227
|
+
};
|
|
228
|
+
exports.getTransactionFilterAccountOptions = getTransactionFilterAccountOptions;
|
|
@@ -8,9 +8,14 @@ import { RecommendationBase } from '../../commonStateTypes/recommendationBase';
|
|
|
8
8
|
import { Status } from '../../commonStateTypes/status';
|
|
9
9
|
import { ReportIDPlusForecastID } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
10
10
|
import { ZeniUrl } from '../../zeniUrl';
|
|
11
|
+
export declare const ALL_ACCOUNT_TYPES: readonly ["bank", "credit_card", "expenses", "cogs", "income", "cash_in", "cash_out", "cash_position", "other_income", "other_expense", "accounts_receivable", "other_current_assets", "fixed_assets", "other_assets", "accounts_payable", "other_current_liabilities", "long_term_liabilities", "equity", "current_liabilities", "current_assets"];
|
|
11
12
|
export declare const toAccountType: (v: string) => "cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets";
|
|
12
13
|
export type AccountType = ReturnType<typeof toAccountType>;
|
|
13
14
|
export declare const toAccountTypeStrict: (v: string | null | undefined) => AccountType | undefined;
|
|
15
|
+
/** Account types used for payment-account filters (e.g. transaction filter "payment account name"). */
|
|
16
|
+
export declare const PAYMENT_ACCOUNT_TYPES: readonly ["bank", "credit_card"];
|
|
17
|
+
export type PaymentAccountType = (typeof PAYMENT_ACCOUNT_TYPES)[number];
|
|
18
|
+
export declare function isPaymentAccountType(accountType: AccountType | undefined): accountType is PaymentAccountType;
|
|
14
19
|
export type UncategorizedAccountTypes = 'expense' | 'income';
|
|
15
20
|
declare const toAccountLabel: (v: string) => "prepaid_expenses" | "fixed_assets" | "uncategorized_income" | "uncategorized_expense" | "bank_charges_and_fees" | "travel_transportation" | "accrued_expenses";
|
|
16
21
|
export type AccountLabel = ReturnType<typeof toAccountLabel>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toReconciliationAccountSourceStrict = exports.toReconciliationAccountSource = exports.toAccountLabelStrict = exports.toAccountTypeStrict = exports.toAccountType = void 0;
|
|
3
|
+
exports.toReconciliationAccountSourceStrict = exports.toReconciliationAccountSource = exports.toAccountLabelStrict = exports.PAYMENT_ACCOUNT_TYPES = exports.toAccountTypeStrict = exports.toAccountType = exports.ALL_ACCOUNT_TYPES = void 0;
|
|
4
|
+
exports.isPaymentAccountType = isPaymentAccountType;
|
|
4
5
|
exports.getAccountKey = getAccountKey;
|
|
5
6
|
const nestedAccountID_1 = require("../../commonStateTypes/accountView/nestedAccountID");
|
|
6
7
|
const nestedClassID_1 = require("../../commonStateTypes/classesView/nestedClassID");
|
|
7
8
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
8
|
-
|
|
9
|
+
exports.ALL_ACCOUNT_TYPES = [
|
|
9
10
|
'bank',
|
|
10
11
|
'credit_card',
|
|
11
12
|
'expenses',
|
|
@@ -27,10 +28,16 @@ const ALL_ACCOUNT_TYPES = [
|
|
|
27
28
|
'current_liabilities',
|
|
28
29
|
'current_assets',
|
|
29
30
|
];
|
|
30
|
-
const toAccountType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_ACCOUNT_TYPES);
|
|
31
|
+
const toAccountType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ACCOUNT_TYPES);
|
|
31
32
|
exports.toAccountType = toAccountType;
|
|
32
|
-
const toAccountTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v ?? '', ALL_ACCOUNT_TYPES);
|
|
33
|
+
const toAccountTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v ?? '', exports.ALL_ACCOUNT_TYPES);
|
|
33
34
|
exports.toAccountTypeStrict = toAccountTypeStrict;
|
|
35
|
+
/** Account types used for payment-account filters (e.g. transaction filter "payment account name"). */
|
|
36
|
+
exports.PAYMENT_ACCOUNT_TYPES = ['bank', 'credit_card'];
|
|
37
|
+
function isPaymentAccountType(accountType) {
|
|
38
|
+
return (accountType != null &&
|
|
39
|
+
exports.PAYMENT_ACCOUNT_TYPES.includes(accountType));
|
|
40
|
+
}
|
|
34
41
|
const ALL_ACCOUNT_LABELS = [
|
|
35
42
|
'uncategorized_income',
|
|
36
43
|
'uncategorized_expense',
|
|
@@ -20,3 +20,8 @@ export declare function getClassReport(classState: ClassState, accountState: Acc
|
|
|
20
20
|
reportId: ReportID;
|
|
21
21
|
classesViewParentId?: ClassesViewParentID;
|
|
22
22
|
}, filter: COABalancesFilter): ClassReport | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Returns all classes currently in state (single pass over classesByKey).
|
|
25
|
+
* Use for dropdowns that need class names; map to { classId, className } as needed.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getAllClasses(classState: ClassState): Class[];
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getClassesByIds = getClassesByIds;
|
|
7
7
|
exports.getClassById = getClassById;
|
|
8
8
|
exports.getClassReport = getClassReport;
|
|
9
|
+
exports.getAllClasses = getAllClasses;
|
|
9
10
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
11
|
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
11
12
|
const accountSelector_1 = require("../account/accountSelector");
|
|
@@ -58,3 +59,10 @@ function getClassReport(classState, accountState, id, filter) {
|
|
|
58
59
|
accounts: accountReport,
|
|
59
60
|
};
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns all classes currently in state (single pass over classesByKey).
|
|
64
|
+
* Use for dropdowns that need class names; map to { classId, className } as needed.
|
|
65
|
+
*/
|
|
66
|
+
function getAllClasses(classState) {
|
|
67
|
+
return Object.values(classState.classesByKey);
|
|
68
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import flatMap from 'lodash/flatMap';
|
|
2
2
|
import { getCOABalances } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
3
3
|
import { sortComparator } from '../../commonStateTypes/coaBalance/sortBalancesByFreeRangeTotal';
|
|
4
|
-
import { getAccountKey, } from './accountState';
|
|
4
|
+
import { getAccountKey, isPaymentAccountType, } from './accountState';
|
|
5
5
|
function getCommonAccountFields(accountState, id) {
|
|
6
6
|
const key = getAccountKey(id.reportId, id.accountId, id.classesViewParentId, id.accountsViewParentId, id.projectsViewParentId);
|
|
7
7
|
const account = accountState.accountsByKey[key];
|
|
@@ -179,3 +179,35 @@ export const getAccountIdsForLabels = (accountState, labels) => {
|
|
|
179
179
|
});
|
|
180
180
|
return allAccountIdsForLabels;
|
|
181
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* Returns all accounts currently in state (single pass over accountsByKey).
|
|
184
|
+
* Use for dropdowns that need account names and types; map to
|
|
185
|
+
* { accountId, accountName, accountType } as needed.
|
|
186
|
+
*/
|
|
187
|
+
export const getAllAccounts = (accountState) => Object.values(accountState.accountsByKey);
|
|
188
|
+
/**
|
|
189
|
+
* Partitions accounts for transaction filter dropdowns: bank/credit_card → paymentAccountNames,
|
|
190
|
+
* all other account types → categoryOptions. Use for payment_account_name and category filter options.
|
|
191
|
+
*/
|
|
192
|
+
export const getTransactionFilterAccountOptions = (accountState) => {
|
|
193
|
+
const accounts = getAllAccounts(accountState);
|
|
194
|
+
const paymentAccountNames = [];
|
|
195
|
+
const categoryOptions = [];
|
|
196
|
+
for (const account of accounts) {
|
|
197
|
+
if (account.accountType == null) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const option = {
|
|
201
|
+
accountId: account.accountId,
|
|
202
|
+
accountName: account.accountName,
|
|
203
|
+
accountType: account.accountType,
|
|
204
|
+
};
|
|
205
|
+
if (isPaymentAccountType(account.accountType)) {
|
|
206
|
+
paymentAccountNames.push(option);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
categoryOptions.push(option);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return { categoryOptions, paymentAccountNames };
|
|
213
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getNestedAccountIDStr, } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { getNestedClassIDStr, } from '../../commonStateTypes/classesView/nestedClassID';
|
|
3
3
|
import { stringToUnion, stringToUnionStrict, } from '../../commonStateTypes/stringToUnion';
|
|
4
|
-
const ALL_ACCOUNT_TYPES = [
|
|
4
|
+
export const ALL_ACCOUNT_TYPES = [
|
|
5
5
|
'bank',
|
|
6
6
|
'credit_card',
|
|
7
7
|
'expenses',
|
|
@@ -25,6 +25,12 @@ const ALL_ACCOUNT_TYPES = [
|
|
|
25
25
|
];
|
|
26
26
|
export const toAccountType = (v) => stringToUnion(v, ALL_ACCOUNT_TYPES);
|
|
27
27
|
export const toAccountTypeStrict = (v) => stringToUnionStrict(v ?? '', ALL_ACCOUNT_TYPES);
|
|
28
|
+
/** Account types used for payment-account filters (e.g. transaction filter "payment account name"). */
|
|
29
|
+
export const PAYMENT_ACCOUNT_TYPES = ['bank', 'credit_card'];
|
|
30
|
+
export function isPaymentAccountType(accountType) {
|
|
31
|
+
return (accountType != null &&
|
|
32
|
+
PAYMENT_ACCOUNT_TYPES.includes(accountType));
|
|
33
|
+
}
|
|
28
34
|
const ALL_ACCOUNT_LABELS = [
|
|
29
35
|
'uncategorized_income',
|
|
30
36
|
'uncategorized_expense',
|
|
@@ -50,3 +50,10 @@ export function getClassReport(classState, accountState, id, filter) {
|
|
|
50
50
|
accounts: accountReport,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns all classes currently in state (single pass over classesByKey).
|
|
55
|
+
* Use for dropdowns that need class names; map to { classId, className } as needed.
|
|
56
|
+
*/
|
|
57
|
+
export function getAllClasses(classState) {
|
|
58
|
+
return Object.values(classState.classesByKey);
|
|
59
|
+
}
|
package/lib/esm/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import { mapTimePeriodtoTimeframeTick, toTimePeriod, toTimeframeTick, } from './
|
|
|
23
23
|
import { isAgingReport, isCashFlowOrBalanceSheetReport, isDashboardClassesViewReport, isDashboardReport, isFluxAnalysisOpExReport, isOpExByVendorReport, isPAndLClassesViewReport, isPAndLProjectViewReport, isPAndLReport, } from './commonStateTypes/viewAndReport/reportIDHelper';
|
|
24
24
|
import { toReportFormatStrict, toReportID, } from './commonStateTypes/viewAndReport/viewAndReport';
|
|
25
25
|
import { PAYMENT_BUSINESS_DAYS, filterDays, getNextNthWorkingDay, getPreviousNthWorkingDay, getYearsList, holidaysFormatted, isHoliday, isHolidayToday, } from './commonStateTypes/workingDayHelper';
|
|
26
|
+
import { getAllAccounts, getTransactionFilterAccountOptions, } from './entity/account/accountSelector';
|
|
26
27
|
import { toAccountType, toReconciliationAccountSource, } from './entity/account/accountState';
|
|
27
28
|
import { getAccountGroupKey, toAccountGroupType, } from './entity/accountGroup/accountGroupState';
|
|
28
29
|
/**
|
|
@@ -167,7 +168,7 @@ import { clearExpenseAutomationFluxAnalysisView, fetchFluxAnalysisView, reviewFl
|
|
|
167
168
|
import { clearJeScheduleLocalData as clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, fetchJeSchedulesPage as fetchExpenseAutomationJESchedulesPage, ignoreRecommendedJeSchedule as ignoreExpenseAutomationJESchedule, initializeAccountSettingsView as initializeJeAccountSettingsView, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, retryJeSchedule as retryExpenseAutomationJESchedule, saveAccountSettings as saveJeAccountSettings, saveAccountSettingsLocalData as saveJeAccountSettingsLocalData, updateJESchedulesUIState as updateExpenseAutomationJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
|
|
168
169
|
import { acknowledgeBulkUploadConfirmMatchComplete, bulkUploadAutomatchingTimedOut, bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, clearBulkUpload, clearManualSearchResults, clearMissingReceiptsTabNavigation, confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, fetchMissingReceipts as fetchExpenseAutomationMissingReceipts, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, markMissingReceiptAsDone as markExpenseAutomationMissingReceiptAsDone, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, setBulkUploadCompletedSubTab, setBulkUploadResultsTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, storeBatchDetails, updateBulkUploadProgress, updateMissingReceiptUploadState as updateExpenseAutomationMissingReceiptUploadState, updateMissingReceiptsUIState as updateExpenseAutomationMissingReceiptsUIState, uploadMissingReceiptSuccess as uploadExpenseAutomationMissingReceiptSuccess, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
|
|
169
170
|
import { deleteAccountStatement, excludeAccountFromReconciliation, fetchReconciliation as fetchReconciliationView, includeAccountInReconciliation, saveReconciliationDetail as saveExpenseAutomationReconciliationDetail, saveReconciliationReview as saveExpenseAutomationReconciliationReview, setConnectionInProgressForAccount as setConnectionInProgressForAccountReconciliation, setStatementParseInProgress, updateAccountReconciliationLocalData as updateExpenseAutomationAccountReconciliationLocalData, updateSelectedAccountId as updateExpenseAutomationAccountReconciliationSelectedAccountId, updateSelectedTab as updateExpenseAutomationAccountReconciliationSelectedTab, updateReconListScrollPosition as updateExpenseAutomationReconListScrollPosition, updateReviewTabSortState as updateExpenseAutomationReconReviewTabListSortState, updateReviewTabLocalData as updateExpenseAutomationReconReviewTabLocalData, updateReconcileTabListScrollState as updateExpenseAutomationReconcileTabListScrollState, updateReconcileTabListSortState as updateExpenseAutomationReconcileTabListSortState, updateReconcileTabLocalData as updateExpenseAutomationReconcileTabLocalData, updateSelectedDrawerAccountId as updateExpenseAutomationSelectedDrawerAccountId, updateNodeCollapseState, updateStatementUploadChosen, uploadAccountStatement, } from './view/expenseAutomationView/reducers/reconciliationViewReducer';
|
|
170
|
-
import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markTransactionAsNotMiscategorized, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
171
|
+
import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markTransactionAsNotMiscategorized, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, updateTransactionFilters, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
171
172
|
import { getExpenseAutomationFluxAnalysisView } from './view/expenseAutomationView/selectors/fluxAnalysisViewSelector';
|
|
172
173
|
import { getExpenseAutomationReconciliationView, isAccountReconReport, } from './view/expenseAutomationView/selectors/reconciliationViewSelector';
|
|
173
174
|
import { getExpenseAutomationTransactionView } from './view/expenseAutomationView/selectors/transactionCategorizationSelector';
|
|
@@ -332,6 +333,7 @@ import { getRemiBusinessVerificationDetails, getRemiSetupViewDetails, } from './
|
|
|
332
333
|
import { approveOrRejectRemisBulkAction, autoReviewPendingApprovalRemis, cancelOrDeleteRemisBulkAction, clearAllRemisFromBulkActionList, clearRemiBulkActionView, incrementRemiBulkActionProcessedCount, removeRemiFromBulkActionList, reviewDraftRemisBulkAction, submitDraftRemisBulkAction, updateRemisBulkActionList, } from './view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer';
|
|
333
334
|
import { getRemisBulkOperationProgress, getRemisBulkReviewView, } from './view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewSelector';
|
|
334
335
|
import { hideCreatedByFilter, } from './view/spendManagement/spendManagementFilterHelpers';
|
|
336
|
+
import { TRANSACTION_FILTER_CATEGORIES, applyTransactionFilters, } from './view/expenseAutomationView/transactionFilterHelpers';
|
|
335
337
|
import { acceptTreasuryTerms, clearTreasurySetupView, fetchPortfolioAllocation, fetchTreasuryFunds, fetchTreasurySetupView, updateFundAllocationLocalData, updatePortfolioAllocation, updateTreasuryVideoViewed, } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer';
|
|
336
338
|
import { getTreasuryBusinessVerificationDetails, getTreasurySetupViewDetails, } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewSelector';
|
|
337
339
|
import { getTreasuryFundsMaximumYield, } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewState';
|
|
@@ -444,15 +446,15 @@ export {
|
|
|
444
446
|
BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, toExpenseAutomationJEScheduleMainTab, toExpenseAutomationJEScheduleSortKey, getExpenseAutomationView, toExpenseAutomationMissingReceiptsSortKey, toExpenseAutomationTransactionsTabKey, toExpenseAutomationViewType, uploadExpenseAutomationMissingReceiptSuccess, markExpenseAutomationMissingReceiptAsDone, fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedTransactionCategorizationTab, fetchExpenseAutomationMissingReceipts,
|
|
445
447
|
// Bulk Upload Actions
|
|
446
448
|
bulkUploadReceipts, bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, updateBulkUploadProgress, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, confirmBulkUploadMatch, confirmBulkUploadMatchSuccess, confirmBulkUploadMatchFailure, setBulkUploadResultsTab, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, clearBulkUpload, searchTransactionsForManualMatch, searchTransactionsForManualMatchSuccess, searchTransactionsForManualMatchFailure, clearManualSearchResults, acknowledgeBulkUploadConfirmMatchComplete, fetchCompletedTransactions, fetchCompletedTransactionsSuccess, fetchCompletedTransactionsFailure, fetchFluxAnalysisView, clearExpenseAutomationFluxAnalysisView, updateOperatingExpensesIdsForReview as updateFluxOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview as updateFluxAnalysisSelectedSectionIdsForReview, reviewFluxAnalysisView, updateExpenseAutomationMissingReceiptUploadState, updateExpenseAutomationMissingReceiptsUIState, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, getExpenseAutomationFluxAnalysisView, updateCurrentSelectedView, updateCurrentSelectedPeriod, getExpenseAutomationTransactionView, updateFluxAnalysisViewUIState, updateFluxAnalysisViewPageMetaData, MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, excludeAccountFromReconciliation, includeAccountInReconciliation, saveExpenseAutomationReconciliationDetail, updateExpenseAutomationReconcileTabListScrollState, updateExpenseAutomationReconReviewTabListSortState, updateExpenseAutomationReconcileTabListSortState, updateExpenseAutomationReconcileTabLocalData, updateExpenseAutomationAccountReconciliationSelectedTab, updateExpenseAutomationAccountReconciliationSelectedAccountId, getExpenseAutomationReconciliationView, fetchReconciliationView, uploadAccountStatementIntoDocumentAI, updateExpenseAutomationReconListScrollPosition, setConnectionInProgressForAccountReconciliation, getAccountReconByAccountIdAndSelectedPeriod, toReconciliationTabsType, isAccountReconReport, updateExpenseAutomationReconReviewTabLocalData, updateExpenseAutomationSelectedDrawerAccountId, saveExpenseAutomationReconciliationReview, updateExpenseAutomationAccountReconciliationLocalData, toReconciliationAccountSource, deleteAccountStatement, uploadAccountStatement, updateNodeCollapseState, updateStatementUploadChosen, isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, isReviewTransactionCreditCardCreditType, setStatementParseInProgress, };
|
|
447
|
-
export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateSelectedCheckboxTransactionIds, setEntityRecommendationForLineIdsForCategorization, initializeTransactionCategorizationViewLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, toTransactionsSortKey, };
|
|
449
|
+
export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateTransactionFilters, updateSelectedCheckboxTransactionIds, setEntityRecommendationForLineIdsForCategorization, initializeTransactionCategorizationViewLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, toTransactionsSortKey, };
|
|
448
450
|
export { TOP_EX_TIME_PERIODS };
|
|
449
451
|
export { toTimeframeTick, mapTimePeriodtoTimeframeTick, toTimePeriod, toAbsoluteDay, toMonthYearPeriodId, convertToPeriod, };
|
|
450
452
|
export { toVendorSpendTrendFilterTabsTypeStrict, } from './entity/vendorExpense/vendorExpenseSelector';
|
|
451
453
|
export { getNumberOfPeriods };
|
|
452
454
|
export { SCHEDULE_DAYS_OF_MONTH, toScheduleDaysOfMonth, toMonth, toMonthStrict, toQuarter, toQuarterStrict, };
|
|
453
455
|
export { getTenantBaseById, getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, getTenantsByCheckInDateSelector, getTenantsBaseByCheckInDateSelector, getTenantsCoreDetailsByCheckInDateSelector, toTenantCoreDetailsView, getTenantBaseViewForTenantView, getTenantBaseViewForTenantId, isZeniDomainTenant, isTenantUsingZeniCOA, fetchActiveTenant, fetchAllTenants, updateCurrentTenant, clearAll, doMagicLinkSignIn, verifyDeviceWithTwoFA, resendVerifyDeviceOTP, sendEmailMagicLinkToUser, doSignIn, updateSignInState, doSignOut, sendSessionHeartbeat, resetSignInState, fetchExcludedResourcesForTenant, fetchExternalConnectionsForTenant, saveExternalConnectionForTenant, deleteConnection, saveAPIKeyConnection, saveConnectorCredentials, saveOAuthConnection, toExternalIntegrationType, toExternalSupportedTool, fetchSubscriptionSummaryForTenant, isTenantBankingOnly, isTenantCardsOnly, isTenantBookkeepingEnabled, isOtherProductsEnabledForTenant, };
|
|
454
|
-
export { toAccountType, toAccountGroupType, getAccountGroupKey, };
|
|
455
|
-
export { getClassById } from './entity/class/classSelector';
|
|
456
|
+
export { toAccountType, toAccountGroupType, getAccountGroupKey, getAllAccounts, getTransactionFilterAccountOptions, };
|
|
457
|
+
export { getAllClasses, getClassById } from './entity/class/classSelector';
|
|
456
458
|
export { getForecast };
|
|
457
459
|
export { getUserName, getUserByUserId, getUsersByUserIds, getAllZeniUsersFromState, } from './entity/user/userSelector';
|
|
458
460
|
export { toUserRoleType, toUserRoleTypeStrict, isFinOpsUserRoleType, hasAdminLevelAccess, hasFullOrAdminLevelAccess, hasReimbursementUserAccess, hasEmployeeLevelAccess, hasBookKeepingAdminLevelAccess, hasBookKeepingUserLevelAccess, isNonZeniRole, hasInvestorBankerLevelAccess, getUserRoleMap, hasOnlyBillPayAccess, hasZeniRoleOrCompanyOfficerAccess, hasSuperAdminLevelAccess, hasBillPayFallbackAdminLevelAccess, hasRemiFallbackAdminLevelAccess, hasOnlyReimbursementAccess, hasOnlyChargeCardAccess, hasOnlyZeniAccountsAccess, isZeniSignedInUser, getUserRoleByUserId, getUserRoleByUserIds, hasChargeCardAccess, hasZeniAccountsAccess, hasTreasuryAccess, hasTreasuryAdminLevelAccess, hasBillPayAccess, hasReimbursementAccess, hasReimbursementAdminLevelAccess, hasBillPayAdminLevelAccess, hasChargeCardAdminLevelAccess, hasSpendManagementAccess, hasSpendManagementAdminLevelAccess, hasZeniAccountsAdminLevelAccess, hasAnyCompanyRole, hasAnyFinOpRole, hasBillPayAccessible, hasReimbursementAccessible, hasZeniAccountsAccessible, hasChargeCardAccessible, hasTreasuryAccessible, hasAICFOAccess, };
|
|
@@ -552,6 +554,10 @@ export { toRemiSubTabType, toRemiSubTabTypeStrict, toRemiTabType, toRemiTabTypeS
|
|
|
552
554
|
export { getClassList, fetchClassList, getProjectList, fetchProjectList, };
|
|
553
555
|
export { fetchBillList, fetchBillListPerTab, updateTab, updateSubTab, updateSelectedBillId, updateBillDetailSaveBillCode, fetchVendorByNameAndParseInvoice, saveBillUpdatesToLocalStore, discardBillUpdatesInLocalStore, saveBillDetail, approveOrRejectBill, updateApprovalStatusOnSuccess, deleteBill, cancelAndDeleteBill, retryOrRefundBill, getBillList, getBillDownloadList, getBillDetailView, checkApproveRejectBtnShowForBill, getBillTransactionDetailKey, fetchBillDetail, fetchEditBillDetailPage, fetchAndUpdateVendorRecommendations, fetchDuplicateBill, clearBillPayReview, getEditBillDetail, getReviewPageBillDetail, fetchBillAndInitializeLocalStore, updateShowAutofill, saveVendorSuccessOrFailure, updateBillListUIState, BILL_PAY_FILTER_CATEGORIES, updateVendorDetailLocalData, resetVendorDetailLocalData, resetVendorSaveStatus, updateContactsInVendorDetailLocalData, updateVendorTabDetailUIState, updateContactsInVendorTabDetailLocalData, updateBillUploadFetchState, updateBillListSearchResult, fetchUserDetails, verifyUser, updateVendorContact, toPaymentToOption, convertAmountToHomeCurrency, fetchVendorAndUpdateBillLocalData, markBillForRetry, updateWithdrawFromAccountId, removeBillFileFromLocalStore, replaceBillFileInLocalStore, updateShouldReplaceBillData, };
|
|
554
556
|
export { hideCreatedByFilter, };
|
|
557
|
+
// Transaction Categorization filter API — lives under Expense Automation,
|
|
558
|
+
// not Spend Management. Kept in a separate re-export block to make the
|
|
559
|
+
// separation visible at the barrel level.
|
|
560
|
+
export { TRANSACTION_FILTER_CATEGORIES, applyTransactionFilters, };
|
|
555
561
|
export { fetchBillPaySetupView, fetchZeniAccountSetupView, enableSetup, getPaymentAccounts, getPlaidLinkToken, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, updateBusinessVerificationDetails, updatePaymentAccount, updatePaymentAccountLoginStatus, updatePaymentAccountStatus, establishPlaidConnection, updateMappedCashAccount, updatePrimaryFundingAccount, acceptBillPayTerms, acceptZeniAccountTerms, acceptBillPayUpdatedTerms, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearBillPaySetupView, clearZeniAccountSetupView, sendOtp, resendOtp, verifyOtp, getBillPaySetupViewDetails, getPlaidAccountDetails, getZeniAccountSetupViewDetails, getBusinessVerificationDetails, getBillPayBusinessVerificationDetails, getZeniAccountBusinessVerificationDetails, getTreasuryBusinessVerificationDetails, getCommonSetupViewDetails, getTwoFactorAuthenticationView, getTwoFactorAuthenticationViewForCardUserOnboarding, getTwoFactorAuthenticationViewForChargeCardHolder, };
|
|
556
562
|
export { getApprovalRuleViewDetails, getBankConnectionsSetupViewDetails, getIntegrationsView, };
|
|
557
563
|
export { fetchUserFinancialAccount };
|
|
@@ -27,6 +27,10 @@ export const initialTransactionTabViewState = {
|
|
|
27
27
|
totalCount: {},
|
|
28
28
|
limit: 10,
|
|
29
29
|
},
|
|
30
|
+
filters: {
|
|
31
|
+
categoryCombinationOperator: 'AND',
|
|
32
|
+
categories: [],
|
|
33
|
+
},
|
|
30
34
|
fetchState: 'Not-Started',
|
|
31
35
|
error: undefined,
|
|
32
36
|
hasValidState() {
|
|
@@ -236,6 +240,12 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
236
240
|
uiState.totalCount;
|
|
237
241
|
}
|
|
238
242
|
},
|
|
243
|
+
updateTransactionFilters(draft, action) {
|
|
244
|
+
const { selectedTab, filters } = action.payload;
|
|
245
|
+
if (filters != null) {
|
|
246
|
+
draft.transactionCategorizationView[selectedTab].filters = filters;
|
|
247
|
+
}
|
|
248
|
+
},
|
|
239
249
|
saveTransactionCategorization: {
|
|
240
250
|
prepare(selectedTab, transactionIds, cotTrackingByTransactionId, isUncategorizedExpenseCategoryEnabled) {
|
|
241
251
|
return {
|
|
@@ -803,5 +813,5 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
803
813
|
},
|
|
804
814
|
},
|
|
805
815
|
});
|
|
806
|
-
export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
|
|
816
|
+
export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, updateTransactionFilters, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
|
|
807
817
|
export default expenseAutomationTransactionsView.reducer;
|
|
@@ -4,14 +4,33 @@ import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
|
4
4
|
import { getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, } from '../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
|
|
6
6
|
import { getSupportedTransactionsByIds } from '../../../entity/transaction/transactionSelector';
|
|
7
|
+
import { applyTransactionFilters, } from '../transactionFilterHelpers';
|
|
7
8
|
import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
|
|
8
9
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
9
10
|
import { getProjectList } from '../../projectList/projectListSelector';
|
|
10
11
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
12
|
+
export const toTransactionView = (transaction, transactionLocalData) => {
|
|
13
|
+
return {
|
|
14
|
+
id: transaction.id,
|
|
15
|
+
date: transaction.date,
|
|
16
|
+
amount: transaction.amount,
|
|
17
|
+
vendorName: transaction.vendorName,
|
|
18
|
+
customerName: transaction.customerName,
|
|
19
|
+
vendorId: transaction.vendorId,
|
|
20
|
+
customerId: transaction.customerId,
|
|
21
|
+
description: transaction.description,
|
|
22
|
+
memo: transaction.memo,
|
|
23
|
+
type: transaction.type,
|
|
24
|
+
typeName: transaction.typeName,
|
|
25
|
+
createTime: transaction.createTime,
|
|
26
|
+
transaction: transaction,
|
|
27
|
+
transactionLocalData,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
11
30
|
export function getExpenseAutomationTransactionView(state) {
|
|
12
31
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
13
32
|
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
14
|
-
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
33
|
+
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, filters, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
15
34
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
|
|
16
35
|
const accountList = getAccountList(accountState, accountListState, 'accountList');
|
|
17
36
|
const classList = getClassList(classState, classListState);
|
|
@@ -30,10 +49,43 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
30
49
|
? transactionIdsBySelectedPeriod[monthYearPeriodId]
|
|
31
50
|
: null;
|
|
32
51
|
const transactionIds = transactionIdsForSelectedPeriod ?? [];
|
|
33
|
-
const
|
|
34
|
-
|
|
52
|
+
const transactions = getSupportedTransactionsByIds(transactionState, transactionIds);
|
|
53
|
+
const transactionsWithCOT = transactions.map((transaction) => getTransactionWithCOT(transaction));
|
|
54
|
+
const transactionLocalDataMap = new Map();
|
|
55
|
+
transactionIds.forEach((transactionId) => {
|
|
35
56
|
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
36
57
|
if (transactionData != null) {
|
|
58
|
+
transactionLocalDataMap.set(transactionId, {
|
|
59
|
+
transactionId,
|
|
60
|
+
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// Step 2: Convert to TransactionView and apply advanced filters
|
|
65
|
+
const transactionViews = transactionsWithCOT.map((transaction) => {
|
|
66
|
+
const localData = transactionLocalDataMap.get(transaction.id);
|
|
67
|
+
return toTransactionView(transaction, localData);
|
|
68
|
+
});
|
|
69
|
+
// Apply TC-specific filters (lives under expenseAutomationView, independent
|
|
70
|
+
// of the Spend Management filter pipeline).
|
|
71
|
+
const filteredTransactionViews = applyTransactionFilters(transactionViews, filters);
|
|
72
|
+
// Convert back to TransactionWithCOT for return
|
|
73
|
+
const filteredTransactionsWithCOT = filteredTransactionViews.map((view) => view.transaction);
|
|
74
|
+
// Get transactionLocalData for filtered transactions
|
|
75
|
+
// Also include transactionLocalData for transactions that don't exist in transactionState
|
|
76
|
+
// but have local data (to match original behavior)
|
|
77
|
+
const filteredTransactionIds = new Set(filteredTransactionViews.map((view) => view.id));
|
|
78
|
+
const filteredTransactionLocalData = transactionIds
|
|
79
|
+
.map((transactionId) => {
|
|
80
|
+
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
81
|
+
if (transactionData == null) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
// Include if transaction is in filtered results, or if transaction doesn't exist in state
|
|
85
|
+
// (to maintain backward compatibility with tests)
|
|
86
|
+
const transactionExists = transactions.some((t) => t.id === transactionId);
|
|
87
|
+
if (filteredTransactionIds.has(transactionId) ||
|
|
88
|
+
!transactionExists) {
|
|
37
89
|
return {
|
|
38
90
|
transactionId,
|
|
39
91
|
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
@@ -41,9 +93,7 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
41
93
|
}
|
|
42
94
|
return null;
|
|
43
95
|
})
|
|
44
|
-
.filter((
|
|
45
|
-
const transactions = getSupportedTransactionsByIds(transactionState, transactionIds);
|
|
46
|
-
const transactionsWithCOT = transactions.map((transaction) => getTransactionWithCOT(transaction));
|
|
96
|
+
.filter((data) => data != null);
|
|
47
97
|
const monthEndFetchState = monthYearPeriodId != null
|
|
48
98
|
? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
|
|
49
99
|
: { fetchState: 'Not-Started', error: undefined };
|
|
@@ -90,7 +140,7 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
90
140
|
version: 0,
|
|
91
141
|
fetchState: fetchStatus.fetchState,
|
|
92
142
|
error: fetchStatus.error,
|
|
93
|
-
transactions:
|
|
143
|
+
transactions: filteredTransactionsWithCOT,
|
|
94
144
|
selectedCheckBoxTransactionIds,
|
|
95
145
|
transactionIdsWithUnsavedData,
|
|
96
146
|
uncategorizedAccounts: uncategorizedIncomeExpense,
|
|
@@ -101,7 +151,7 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
101
151
|
classHierarchyList,
|
|
102
152
|
isAccountingProjectsEnabled,
|
|
103
153
|
projectList,
|
|
104
|
-
transactionLocalData,
|
|
154
|
+
transactionLocalData: filteredTransactionLocalData,
|
|
105
155
|
uiState,
|
|
106
156
|
refreshStatus,
|
|
107
157
|
saveStatus,
|