@zeniai/client-epic-state 5.0.55-betaAR4 → 5.0.55-betaAR6
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/esm/index.js +7 -2
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +4 -3
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +186 -0
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +17 -185
- package/lib/index.d.ts +4 -2
- package/lib/index.js +20 -18
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +4 -3
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +64 -0
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +190 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +4 -45
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +18 -186
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -332,7 +332,8 @@ import { acceptEmployeeRemiTerms, acceptRemiTerms, clearRemiSetupView, fetchRemi
|
|
|
332
332
|
import { getRemiBusinessVerificationDetails, getRemiSetupViewDetails, } from './view/spendManagement/reimbursement/remiSetupView/remiSetupViewSelector';
|
|
333
333
|
import { approveOrRejectRemisBulkAction, autoReviewPendingApprovalRemis, cancelOrDeleteRemisBulkAction, clearAllRemisFromBulkActionList, clearRemiBulkActionView, incrementRemiBulkActionProcessedCount, removeRemiFromBulkActionList, reviewDraftRemisBulkAction, submitDraftRemisBulkAction, updateRemisBulkActionList, } from './view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer';
|
|
334
334
|
import { getRemisBulkOperationProgress, getRemisBulkReviewView, } from './view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewSelector';
|
|
335
|
-
import {
|
|
335
|
+
import { hideCreatedByFilter, } from './view/spendManagement/spendManagementFilterHelpers';
|
|
336
|
+
import { TRANSACTION_FILTER_CATEGORIES, applyTransactionFilters, } from './view/expenseAutomationView/transactionFilterHelpers';
|
|
336
337
|
import { acceptTreasuryTerms, clearTreasurySetupView, fetchPortfolioAllocation, fetchTreasuryFunds, fetchTreasurySetupView, updateFundAllocationLocalData, updatePortfolioAllocation, updateTreasuryVideoViewed, } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer';
|
|
337
338
|
import { getTreasuryBusinessVerificationDetails, getTreasurySetupViewDetails, } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewSelector';
|
|
338
339
|
import { getTreasuryFundsMaximumYield, } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewState';
|
|
@@ -552,7 +553,11 @@ export { toOutsideZeniPaymentModeType, checkShowMarkAsPaidButton, };
|
|
|
552
553
|
export { toRemiSubTabType, toRemiSubTabTypeStrict, toRemiTabType, toRemiTabTypeStrict, toReimbursementTypeCode, getRemiList, getRemiDownloadList, fetchRemiList, fetchRemiListPerTab, updateRemiListTab, updateRemiListSubTab, updateRemiDetailSaveRemiCode, updateRemiListUIState, updateRemiListSearchResult, updateBillListFilterResult, updateRemiListFilterResult, REIMBURSEMENT_FILTER_CATEGORIES, REIMBURSEMENT_FILTER_CATEGORIES_RESTRICTED, updateRemiListDownloadUIState, updateBillListDownloadUIState, updateBillsBulkActionList, removeBillFromBulkActionList, clearAllBillsFromBulkActionList, getBillsBulkReviewView, validateBillsBulkAction, approveOrRejectBillsBulkAction, cancelOrDeleteBillsBulkAction, submitDraftBillsBulkAction, autoReviewPendingApprovalBills, incrementBulkActionProcessedCount, getBillsBulkOperationProgress, clearBillPayBulkActionView, isBillConditionallyValid, getRemisBulkReviewView, getRemisBulkOperationProgress, updateRemisBulkActionList, removeRemiFromBulkActionList, clearAllRemisFromBulkActionList, reviewDraftRemisBulkAction, approveOrRejectRemisBulkAction, cancelOrDeleteRemisBulkAction, submitDraftRemisBulkAction, autoReviewPendingApprovalRemis, clearRemiBulkActionView, incrementRemiBulkActionProcessedCount, updateOutsideZeniPaymentLocalData, discardOutsideZeniPaymentLocalData, checkIfCreatorIsApprover, };
|
|
553
554
|
export { getClassList, fetchClassList, getProjectList, fetchProjectList, };
|
|
554
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, };
|
|
555
|
-
export { hideCreatedByFilter,
|
|
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, };
|
|
556
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, };
|
|
557
562
|
export { getApprovalRuleViewDetails, getBankConnectionsSetupViewDetails, getIntegrationsView, };
|
|
558
563
|
export { fetchUserFinancialAccount };
|
|
@@ -4,7 +4,7 @@ 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 {
|
|
7
|
+
import { applyTransactionFilters, } from '../transactionFilterHelpers';
|
|
8
8
|
import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
|
|
9
9
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
10
10
|
import { getProjectList } from '../../projectList/projectListSelector';
|
|
@@ -66,8 +66,9 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
66
66
|
const localData = transactionLocalDataMap.get(transaction.id);
|
|
67
67
|
return toTransactionView(transaction, localData);
|
|
68
68
|
});
|
|
69
|
-
// Apply
|
|
70
|
-
|
|
69
|
+
// Apply TC-specific filters (lives under expenseAutomationView, independent
|
|
70
|
+
// of the Spend Management filter pipeline).
|
|
71
|
+
const filteredTransactionViews = applyTransactionFilters(transactionViews, filters);
|
|
71
72
|
// Convert back to TransactionWithCOT for return
|
|
72
73
|
const filteredTransactionsWithCOT = filteredTransactionViews.map((view) => view.transaction);
|
|
73
74
|
// Get transactionLocalData for filtered transactions
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
export const TRANSACTION_FILTER_CATEGORIES = [
|
|
2
|
+
{ value: 'payment_account_name', type: 'dropdown' },
|
|
3
|
+
{ value: 'payment_account_type', type: 'dropdown' },
|
|
4
|
+
{ value: 'payee', type: 'searchAutocomplete' },
|
|
5
|
+
{ value: 'category', type: 'dropdown' },
|
|
6
|
+
{ value: 'class', type: 'dropdown' },
|
|
7
|
+
{ value: 'amount', type: 'numberRange' },
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the comparable value for a transaction against a given filter field.
|
|
11
|
+
* Returns undefined when the transaction doesn't carry the field — callers
|
|
12
|
+
* decide whether absence counts as a match (for 'not-equal' it does).
|
|
13
|
+
*/
|
|
14
|
+
const getCategoryValueForTransaction = (key, transaction) => {
|
|
15
|
+
switch (key) {
|
|
16
|
+
case 'amount': {
|
|
17
|
+
// Prefer transactionLocalData line items (sum). Fall back to lines on
|
|
18
|
+
// the transaction itself. Final fallback: transaction-level amount.
|
|
19
|
+
const localDataForAmount = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
20
|
+
if (localDataForAmount?.lineItemById) {
|
|
21
|
+
const lineItems = Object.values(localDataForAmount.lineItemById);
|
|
22
|
+
if (lineItems.length > 0) {
|
|
23
|
+
return lineItems.reduce((sum, lineItem) => sum + (lineItem.amount?.amount ?? 0), 0);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (transaction.transaction.lines &&
|
|
27
|
+
transaction.transaction.lines.length > 0) {
|
|
28
|
+
return transaction.transaction.lines.reduce((sum, line) => sum + (line.amount?.amount ?? 0), 0);
|
|
29
|
+
}
|
|
30
|
+
return transaction.amount.amount;
|
|
31
|
+
}
|
|
32
|
+
case 'payee': {
|
|
33
|
+
if (transaction.vendorName) {
|
|
34
|
+
return transaction.vendorName;
|
|
35
|
+
}
|
|
36
|
+
if (transaction.customerName) {
|
|
37
|
+
return transaction.customerName;
|
|
38
|
+
}
|
|
39
|
+
const localData = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
40
|
+
if (localData?.vendor?.name) {
|
|
41
|
+
return localData.vendor.name;
|
|
42
|
+
}
|
|
43
|
+
if (localData?.customer?.name) {
|
|
44
|
+
return localData.customer.name;
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
case 'payment_account_name': {
|
|
49
|
+
// Match what TransactionCategorizationListRow renders for the cell.
|
|
50
|
+
return transaction.transaction.account?.accountName;
|
|
51
|
+
}
|
|
52
|
+
case 'payment_account_type': {
|
|
53
|
+
// Raw `paymentType` enum ("credit_card" / "check" / "cash"). Dropdown
|
|
54
|
+
// option values use the same enum; row uses `paymentTypeName` for the
|
|
55
|
+
// human label.
|
|
56
|
+
return transaction.transaction.paymentType;
|
|
57
|
+
}
|
|
58
|
+
case 'category': {
|
|
59
|
+
const localDataForCategory = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
60
|
+
if (localDataForCategory) {
|
|
61
|
+
const firstLineItem = Object.values(localDataForCategory.lineItemById)[0];
|
|
62
|
+
if (firstLineItem?.account?.accountId) {
|
|
63
|
+
return firstLineItem.account.accountId;
|
|
64
|
+
}
|
|
65
|
+
if (firstLineItem?.account?.qboId) {
|
|
66
|
+
return firstLineItem.account.qboId;
|
|
67
|
+
}
|
|
68
|
+
if (firstLineItem?.account?.accountName) {
|
|
69
|
+
return firstLineItem.account.accountName;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const firstLineForCategory = transaction.transaction.lines?.[0];
|
|
73
|
+
if (firstLineForCategory?.type ===
|
|
74
|
+
'transaction_with_account_and_class_line' ||
|
|
75
|
+
firstLineForCategory?.type ===
|
|
76
|
+
'transaction_with_product_or_service_line' ||
|
|
77
|
+
firstLineForCategory?.type === 'journal_entry_transaction_line') {
|
|
78
|
+
const account = firstLineForCategory.account;
|
|
79
|
+
return account?.accountId ?? account?.qboId ?? account?.accountName;
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
case 'class': {
|
|
84
|
+
const localDataForClass = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
85
|
+
if (localDataForClass) {
|
|
86
|
+
const firstLineItemForClass = Object.values(localDataForClass.lineItemById)[0];
|
|
87
|
+
if (firstLineItemForClass?.class?.classId) {
|
|
88
|
+
return firstLineItemForClass.class.classId;
|
|
89
|
+
}
|
|
90
|
+
if (firstLineItemForClass?.class?.qboId) {
|
|
91
|
+
return firstLineItemForClass.class.qboId;
|
|
92
|
+
}
|
|
93
|
+
if (firstLineItemForClass?.class?.className) {
|
|
94
|
+
return firstLineItemForClass.class.className;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const firstLineForClass = transaction.transaction.lines?.[0];
|
|
98
|
+
if (firstLineForClass?.type === 'transaction_with_account_and_class_line' ||
|
|
99
|
+
firstLineForClass?.type ===
|
|
100
|
+
'transaction_with_product_or_service_line' ||
|
|
101
|
+
firstLineForClass?.type === 'journal_entry_transaction_line') {
|
|
102
|
+
const classData = firstLineForClass.class;
|
|
103
|
+
return classData?.classId ?? classData?.qboId ?? classData?.className;
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
default:
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* TC-only amount matcher. Supports all five operators TC defines, including
|
|
113
|
+
* the legacy "1000<->5000" range-string form (kept for backward compatibility
|
|
114
|
+
* with persisted filter state that may still contain that encoding).
|
|
115
|
+
*/
|
|
116
|
+
const matchAmount = (amount, category) => {
|
|
117
|
+
const op = category.matchingOperator;
|
|
118
|
+
const values = category.values;
|
|
119
|
+
let matched = false;
|
|
120
|
+
if (op === 'inBetween') {
|
|
121
|
+
if (values.length >= 2) {
|
|
122
|
+
const min = Number(values[0]);
|
|
123
|
+
const max = Number(values[1]);
|
|
124
|
+
matched = amount >= min && amount <= max;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (op === 'lessThan') {
|
|
128
|
+
if (values.length >= 1) {
|
|
129
|
+
matched = amount < Number(values[0]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else if (op === 'greaterThan') {
|
|
133
|
+
if (values.length >= 1) {
|
|
134
|
+
matched = amount > Number(values[0]);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else if (op === 'equal' &&
|
|
138
|
+
values.length === 1 &&
|
|
139
|
+
String(values[0]).includes('<->')) {
|
|
140
|
+
// Backward compatibility: ["1000<->5000"] with matchingOperator "equal".
|
|
141
|
+
const parts = String(values[0]).split('<->');
|
|
142
|
+
matched =
|
|
143
|
+
amount >= Number(parts[0] ?? '') && amount <= Number(parts[1] ?? '');
|
|
144
|
+
}
|
|
145
|
+
else if (op === 'equal' && values.length === 1) {
|
|
146
|
+
matched = amount === Number(values[0]);
|
|
147
|
+
}
|
|
148
|
+
return op === 'not-equal' ? !matched : matched;
|
|
149
|
+
};
|
|
150
|
+
const transactionMatchesCategory = (transaction, category) => {
|
|
151
|
+
const value = getCategoryValueForTransaction(category.field, transaction);
|
|
152
|
+
if (value == null) {
|
|
153
|
+
// Absent values count as a match only under 'not-equal'.
|
|
154
|
+
return category.matchingOperator === 'not-equal';
|
|
155
|
+
}
|
|
156
|
+
if (category.field === 'amount') {
|
|
157
|
+
return matchAmount(Number(value), category);
|
|
158
|
+
}
|
|
159
|
+
const valueStr = value.toString();
|
|
160
|
+
const valueInList = category.values.some((v) => v.toString() === valueStr);
|
|
161
|
+
return category.matchingOperator === 'not-equal' ? !valueInList : valueInList;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* TC-only equivalent of `applyAdvancedFiltersOnList`. Filters a list of
|
|
165
|
+
* `TransactionView` items against a `TransactionFilters` object using the
|
|
166
|
+
* AND/OR combination semantics from `categoryCombinationOperator`.
|
|
167
|
+
*
|
|
168
|
+
* Independent of `view/spendManagement` — keeps the TC filter pipeline cleanly
|
|
169
|
+
* inside the Expense Automation feature group.
|
|
170
|
+
*/
|
|
171
|
+
export const applyTransactionFilters = (transactions, filters) => {
|
|
172
|
+
if (filters?.categories == null || filters.categories.length === 0) {
|
|
173
|
+
return transactions;
|
|
174
|
+
}
|
|
175
|
+
const activeCategories = filters.categories.filter((c) => c.field != null && c.values.length > 0);
|
|
176
|
+
if (activeCategories.length === 0) {
|
|
177
|
+
return transactions;
|
|
178
|
+
}
|
|
179
|
+
const op = filters.categoryCombinationOperator;
|
|
180
|
+
return transactions.filter((txn) => {
|
|
181
|
+
if (op === 'AND') {
|
|
182
|
+
return activeCategories.every((cat) => transactionMatchesCategory(txn, cat));
|
|
183
|
+
}
|
|
184
|
+
return activeCategories.some((cat) => transactionMatchesCategory(txn, cat));
|
|
185
|
+
});
|
|
186
|
+
};
|
|
@@ -7,81 +7,30 @@ import { ALL_BILL_TABS, getBillListKey, } from './billPay/billList/billListState
|
|
|
7
7
|
import { getActualPaymentDate } from './helpers';
|
|
8
8
|
import { getApproversOrRejectors as getApproversOrRejectorsForReimbursement, } from './reimbursement/remiListView/remiListSelector';
|
|
9
9
|
import { ALL_REMI_TABS, getRemiListKey, } from './reimbursement/remiListView/remiListState';
|
|
10
|
-
export const TRANSACTION_FILTER_CATEGORIES = [
|
|
11
|
-
{ value: 'payment_account_name', type: 'dropdown' },
|
|
12
|
-
{ value: 'payment_account_type', type: 'dropdown' },
|
|
13
|
-
{ value: 'payee', type: 'searchAutocomplete' },
|
|
14
|
-
{ value: 'category', type: 'dropdown' },
|
|
15
|
-
{ value: 'class', type: 'dropdown' },
|
|
16
|
-
{ value: 'amount', type: 'numberRange' },
|
|
17
|
-
];
|
|
18
10
|
//filters items against filter values representing a range. ex: date (from-to), amount(1k<-->5k)
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// Other entities (bill_pay, reimbursement, etc.) use only equal/not-equal and are unchanged.
|
|
11
|
+
// Spend Management uses only equal/not-equal — TC amount operators
|
|
12
|
+
// (inBetween, lessThan, greaterThan) live in the TC filter pipeline.
|
|
22
13
|
const filterItemOnRangeCategoryType = (valueForItem, currentFilter) => {
|
|
23
14
|
let doesItemFallInValueRange = false;
|
|
24
15
|
const filterField = currentFilter.field;
|
|
25
16
|
if (filterField === 'amount') {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const min = Number(values[0]);
|
|
33
|
-
const max = Number(values[1]);
|
|
34
|
-
doesItemFallInValueRange = currentValue >= min && currentValue <= max;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else if (op === 'lessThan') {
|
|
38
|
-
if (values.length >= 1) {
|
|
39
|
-
const threshold = Number(values[0]);
|
|
40
|
-
doesItemFallInValueRange = currentValue < threshold;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else if (op === 'greaterThan') {
|
|
44
|
-
if (values.length >= 1) {
|
|
45
|
-
const threshold = Number(values[0]);
|
|
46
|
-
doesItemFallInValueRange = currentValue > threshold;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (op === 'equal' &&
|
|
50
|
-
values.length === 1 &&
|
|
51
|
-
String(values[0]).includes('<->')) {
|
|
52
|
-
// Backward compatibility: old format ["1000<->5000"] with matchingOperator "equal"
|
|
53
|
-
const parts = String(values[0]).split('<->');
|
|
54
|
-
const lowerValue = Number(parts[0] ?? '');
|
|
55
|
-
const higherValue = Number(parts[1] ?? '');
|
|
56
|
-
doesItemFallInValueRange =
|
|
57
|
-
currentValue >= lowerValue && currentValue <= higherValue;
|
|
58
|
-
}
|
|
59
|
-
else if (op === 'equal' && values.length === 1) {
|
|
60
|
-
// New format: exact match on single value (expense automation)
|
|
61
|
-
const val = Number(values[0]);
|
|
62
|
-
doesItemFallInValueRange = currentValue === val;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
// Existing logic for equal/not-equal (bill_pay, reimbursement, etc. or multiple range values)
|
|
66
|
-
for (const filterValue of values) {
|
|
67
|
-
const lowerValue = Number.parseInt(filterValue?.toString()?.split('<->')[0] ?? '', 10);
|
|
68
|
-
const higherValue = Number.parseInt(filterValue?.toString()?.split('<->')[1] ?? '', 10);
|
|
69
|
-
if (currentValue >= lowerValue && currentValue <= higherValue) {
|
|
70
|
-
doesItemFallInValueRange = true;
|
|
71
|
-
}
|
|
17
|
+
for (const filterValue of currentFilter.values) {
|
|
18
|
+
const currentValue = parseInt(valueForItem.toString());
|
|
19
|
+
const lowerValue = parseInt(filterValue?.toString()?.split('<->')[0] ?? '');
|
|
20
|
+
const higherValue = parseInt(filterValue?.toString()?.split('<->')[1] ?? '');
|
|
21
|
+
if (currentValue >= lowerValue && currentValue <= higherValue) {
|
|
22
|
+
doesItemFallInValueRange = true;
|
|
72
23
|
}
|
|
73
24
|
}
|
|
74
|
-
return op === 'not-equal'
|
|
75
|
-
? !doesItemFallInValueRange
|
|
76
|
-
: doesItemFallInValueRange;
|
|
77
25
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
26
|
+
else {
|
|
27
|
+
const currentValue = valueForItem;
|
|
28
|
+
const lowerValue = currentFilter.values[0];
|
|
29
|
+
const higherValue = currentFilter.values[1];
|
|
30
|
+
if (currentValue.isSameOrAfter(lowerValue) &&
|
|
31
|
+
currentValue.isSameOrBefore(higherValue)) {
|
|
32
|
+
doesItemFallInValueRange = true;
|
|
33
|
+
}
|
|
85
34
|
}
|
|
86
35
|
return currentFilter.matchingOperator === 'equal'
|
|
87
36
|
? doesItemFallInValueRange
|
|
@@ -166,11 +115,7 @@ export const applyAdvancedFiltersOnList = (entity, allItems, filters, filteredIt
|
|
|
166
115
|
? getCategoryValueForReimbursement(key, item)
|
|
167
116
|
: entity === 'task_management'
|
|
168
117
|
? getCategoryValueForTaskList(key, item)
|
|
169
|
-
:
|
|
170
|
-
? getCategoryValueForTransaction(key, item)
|
|
171
|
-
: entity === 'charge_card_payment_history'
|
|
172
|
-
? getCategoryValueForPaymentHistory(key, item)
|
|
173
|
-
: undefined;
|
|
118
|
+
: getCategoryValueForPaymentHistory(key, item);
|
|
174
119
|
if (categoryValue == null) {
|
|
175
120
|
if (currentFilter.matchingOperator === 'not-equal') {
|
|
176
121
|
return true;
|
|
@@ -291,119 +236,6 @@ const getCategoryValueForReimbursement = (key, reimbursement) => {
|
|
|
291
236
|
return undefined;
|
|
292
237
|
}
|
|
293
238
|
};
|
|
294
|
-
const getCategoryValueForTransaction = (key, transaction) => {
|
|
295
|
-
switch (key) {
|
|
296
|
-
case 'amount': {
|
|
297
|
-
// Get from transactionLocalData line items (preferred) - sum all line item amounts
|
|
298
|
-
const localDataForAmount = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
299
|
-
if (localDataForAmount?.lineItemById) {
|
|
300
|
-
const lineItems = Object.values(localDataForAmount.lineItemById);
|
|
301
|
-
if (lineItems.length > 0) {
|
|
302
|
-
// Sum all line item amounts
|
|
303
|
-
const totalAmount = lineItems.reduce((sum, lineItem) => sum + (lineItem.amount?.amount ?? 0), 0);
|
|
304
|
-
return totalAmount;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
// Fallback to transaction-level amount or sum from transaction lines
|
|
308
|
-
if (transaction.transaction.lines &&
|
|
309
|
-
transaction.transaction.lines.length > 0) {
|
|
310
|
-
const totalAmount = transaction.transaction.lines.reduce((sum, line) => sum + (line.amount?.amount ?? 0), 0);
|
|
311
|
-
return totalAmount;
|
|
312
|
-
}
|
|
313
|
-
// Final fallback to transaction amount
|
|
314
|
-
return transaction.amount.amount;
|
|
315
|
-
}
|
|
316
|
-
case 'payee': {
|
|
317
|
-
// Priority: vendorName > customerName > from transactionLocalData
|
|
318
|
-
if (transaction.vendorName) {
|
|
319
|
-
return transaction.vendorName;
|
|
320
|
-
}
|
|
321
|
-
if (transaction.customerName) {
|
|
322
|
-
return transaction.customerName;
|
|
323
|
-
}
|
|
324
|
-
// Check transactionLocalData for vendor/customer
|
|
325
|
-
const localData = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
326
|
-
if (localData?.vendor?.name) {
|
|
327
|
-
return localData.vendor.name;
|
|
328
|
-
}
|
|
329
|
-
if (localData?.customer?.name) {
|
|
330
|
-
return localData.customer.name;
|
|
331
|
-
}
|
|
332
|
-
return undefined;
|
|
333
|
-
}
|
|
334
|
-
case 'payment_account_name': {
|
|
335
|
-
// Match the value the row renders: TransactionCategorizationListRow reads
|
|
336
|
-
// `currentTransaction?.account?.accountName` for the Payment Account Name
|
|
337
|
-
// column. Returning the same field here keeps filter-match parity with the
|
|
338
|
-
// visible cell, so any row a user can see is also a row the filter can match.
|
|
339
|
-
return transaction.transaction.account?.accountName;
|
|
340
|
-
}
|
|
341
|
-
case 'payment_account_type': {
|
|
342
|
-
// Compare against the raw `paymentType` enum (e.g. "credit_card", "check",
|
|
343
|
-
// "cash"). The same enum is what TransactionCategorizationListRow uses for
|
|
344
|
-
// its icon switch on line ~1675, and it's what the dropdown options emit
|
|
345
|
-
// as `value`. Display labels come from each account's `paymentTypeName`
|
|
346
|
-
// field (populated by mapAccountBasePayloadToAccountBase from the backend
|
|
347
|
-
// payload) — no client-side label map required.
|
|
348
|
-
return transaction.transaction.paymentType;
|
|
349
|
-
}
|
|
350
|
-
case 'category': {
|
|
351
|
-
// Get from transactionLocalData (preferred) or from transaction lines
|
|
352
|
-
const localDataForCategory = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
353
|
-
if (localDataForCategory) {
|
|
354
|
-
// Get category from first line item or most common
|
|
355
|
-
const firstLineItem = Object.values(localDataForCategory.lineItemById)[0];
|
|
356
|
-
if (firstLineItem?.account?.accountId) {
|
|
357
|
-
return firstLineItem.account.accountId;
|
|
358
|
-
}
|
|
359
|
-
if (firstLineItem?.account?.qboId) {
|
|
360
|
-
return firstLineItem.account.qboId;
|
|
361
|
-
}
|
|
362
|
-
if (firstLineItem?.account?.accountName) {
|
|
363
|
-
return firstLineItem.account.accountName;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// Fallback to transaction lines
|
|
367
|
-
const firstLineForCategory = transaction.transaction.lines?.[0];
|
|
368
|
-
if (firstLineForCategory?.type ===
|
|
369
|
-
'transaction_with_account_and_class_line' ||
|
|
370
|
-
firstLineForCategory?.type ===
|
|
371
|
-
'transaction_with_product_or_service_line' ||
|
|
372
|
-
firstLineForCategory?.type === 'journal_entry_transaction_line') {
|
|
373
|
-
const account = firstLineForCategory.account;
|
|
374
|
-
return account?.accountId ?? account?.qboId ?? account?.accountName;
|
|
375
|
-
}
|
|
376
|
-
return undefined;
|
|
377
|
-
}
|
|
378
|
-
case 'class': {
|
|
379
|
-
// Similar to category but for class
|
|
380
|
-
const localDataForClass = transaction.transactionLocalData?.transactionReviewLocalData;
|
|
381
|
-
if (localDataForClass) {
|
|
382
|
-
const firstLineItemForClass = Object.values(localDataForClass.lineItemById)[0];
|
|
383
|
-
if (firstLineItemForClass?.class?.classId) {
|
|
384
|
-
return firstLineItemForClass.class.classId;
|
|
385
|
-
}
|
|
386
|
-
if (firstLineItemForClass?.class?.qboId) {
|
|
387
|
-
return firstLineItemForClass.class.qboId;
|
|
388
|
-
}
|
|
389
|
-
if (firstLineItemForClass?.class?.className) {
|
|
390
|
-
return firstLineItemForClass.class.className;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
const firstLineForClass = transaction.transaction.lines?.[0];
|
|
394
|
-
if (firstLineForClass?.type === 'transaction_with_account_and_class_line' ||
|
|
395
|
-
firstLineForClass?.type ===
|
|
396
|
-
'transaction_with_product_or_service_line' ||
|
|
397
|
-
firstLineForClass?.type === 'journal_entry_transaction_line') {
|
|
398
|
-
const classData = firstLineForClass.class;
|
|
399
|
-
return classData?.classId ?? classData?.qboId ?? classData?.className;
|
|
400
|
-
}
|
|
401
|
-
return undefined;
|
|
402
|
-
}
|
|
403
|
-
default:
|
|
404
|
-
return undefined;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
239
|
const getCategoryValueForPaymentHistory = (key, repayment) => {
|
|
408
240
|
switch (key) {
|
|
409
241
|
case 'repaymentDate':
|
package/lib/index.d.ts
CHANGED
|
@@ -503,7 +503,8 @@ import { RemiBusinessVerificationDetails, RemiSetupView, getRemiBusinessVerifica
|
|
|
503
503
|
import { MileageDenomination, MileageDetailsLocalData, RemiSetupViewLocalData, RemiSetupViewState } from './view/spendManagement/reimbursement/remiSetupView/remiSetupViewState';
|
|
504
504
|
import { approveOrRejectRemisBulkAction, autoReviewPendingApprovalRemis, cancelOrDeleteRemisBulkAction, clearAllRemisFromBulkActionList, clearRemiBulkActionView, incrementRemiBulkActionProcessedCount, removeRemiFromBulkActionList, reviewDraftRemisBulkAction, submitDraftRemisBulkAction, updateRemisBulkActionList } from './view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer';
|
|
505
505
|
import { RemisBulkReviewView, getRemisBulkOperationProgress, getRemisBulkReviewView } from './view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewSelector';
|
|
506
|
-
import { BillPayFilterCategoryDropdownOption, CategoryCombinationOperator, FilterCategoryType, MatchingOperatorDropdownOption, ReimbursementFilterCategoryDropdownOption, SpendManagementFilterCategoryDropdownOption, SpendManagementFilterEntityType, SpendManagementFiltersType,
|
|
506
|
+
import { BillPayFilterCategoryDropdownOption, CategoryCombinationOperator, FilterCategoryType, MatchingOperatorDropdownOption, ReimbursementFilterCategoryDropdownOption, SpendManagementFilterCategoryDropdownOption, SpendManagementFilterEntityType, SpendManagementFiltersType, TaskFilterCategoryDropdownOption, hideCreatedByFilter } from './view/spendManagement/spendManagementFilterHelpers';
|
|
507
|
+
import { TRANSACTION_FILTER_CATEGORIES, TransactionFilterCategory, TransactionFilterCategoryDropdownOption, TransactionFilterCategoryField, TransactionFilterEntityType, TransactionFilters, applyTransactionFilters } from './view/expenseAutomationView/transactionFilterHelpers';
|
|
507
508
|
import { acceptTreasuryTerms, clearTreasurySetupView, fetchPortfolioAllocation, fetchTreasuryFunds, fetchTreasurySetupView, updateFundAllocationLocalData, updatePortfolioAllocation, updateTreasuryVideoViewed } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer';
|
|
508
509
|
import { TreasuryBusinessVerificationDetails, TreasurySetupView, getTreasuryBusinessVerificationDetails, getTreasurySetupViewDetails } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewSelector';
|
|
509
510
|
import { FundAllocationOption, FundComposition, FundData, getTreasuryFundsMaximumYield } from './view/spendManagement/treasury/treasurySetUp/treasurySetupViewState';
|
|
@@ -793,7 +794,8 @@ export { BillTransaction, BillPayInfo, BillStage, BillStageCodeType, BillTransac
|
|
|
793
794
|
export { MilageReimbursementLine, OutofPocketReimbursementLine, ReimbursementLine, ReimbursementTypeCode, Reimbursement, RemiTabType, toRemiSubTabType, toRemiSubTabTypeStrict, toRemiTabType, toRemiTabTypeStrict, toReimbursementTypeCode, RemiSubTabType, ReimbursementViewSortKey, RemiListUIState, RemiListReport, RemiListDownloadReport, ReimbursementView, ReimbursementFilters, ReimbursementFilterCategory, RemiListViewFilterCategoryField, getRemiList, getRemiDownloadList, fetchRemiList, fetchRemiListPerTab, updateRemiListTab, updateRemiListSubTab, updateRemiDetailSaveRemiCode, updateRemiListUIState, updateRemiListSearchResult, updateBillListFilterResult, updateRemiListFilterResult, REIMBURSEMENT_FILTER_CATEGORIES, REIMBURSEMENT_FILTER_CATEGORIES_RESTRICTED, updateRemiListDownloadUIState, updateBillListDownloadUIState, updateBillsBulkActionList, removeBillFromBulkActionList, clearAllBillsFromBulkActionList, getBillsBulkReviewView, BillsBulkReviewView, validateBillsBulkAction, approveOrRejectBillsBulkAction, cancelOrDeleteBillsBulkAction, submitDraftBillsBulkAction, autoReviewPendingApprovalBills, incrementBulkActionProcessedCount, getBillsBulkOperationProgress, BulkOperationProgress, clearBillPayBulkActionView, isBillConditionallyValid, getRemisBulkReviewView, RemisBulkReviewView, getRemisBulkOperationProgress, updateRemisBulkActionList, removeRemiFromBulkActionList, clearAllRemisFromBulkActionList, reviewDraftRemisBulkAction, approveOrRejectRemisBulkAction, cancelOrDeleteRemisBulkAction, submitDraftRemisBulkAction, autoReviewPendingApprovalRemis, clearRemiBulkActionView, incrementRemiBulkActionProcessedCount, RemiBulkSelectExceptionInfoType, OutsideZeniPaymentLocalData, updateOutsideZeniPaymentLocalData, discardOutsideZeniPaymentLocalData, checkIfCreatorIsApprover, };
|
|
794
795
|
export { AccountListSelectorView, ClassListSelectorView, getClassList, fetchClassList, ProjectListSelectorView, getProjectList, fetchProjectList, };
|
|
795
796
|
export { BillTab, BillsSubTabType, SaveBillStageCode, BillPayReviewSelectorView, DuplicateBillsSelectorView, EditBillDetailSelectorView, LineItemRecommendationsLocalData, EditBillInitialDetails, BillableStatus, PaymentDetailsSection, BillListReport, BillListDownloadReport, WhatForSection, fetchBillList, fetchBillListPerTab, updateTab, updateSubTab, updateSelectedBillId, updateBillDetailSaveBillCode, fetchVendorByNameAndParseInvoice, saveBillUpdatesToLocalStore, discardBillUpdatesInLocalStore, saveBillDetail, approveOrRejectBill, updateApprovalStatusOnSuccess, deleteBill, cancelAndDeleteBill, retryOrRefundBill, getBillList, getBillDownloadList, BillDetailViewSelector, ActorActivityWithUser, BillActivity, StepWithStatus, getBillDetailView, checkApproveRejectBtnShowForBill, BillDetailView, getBillTransactionDetailKey, fetchBillDetail, fetchEditBillDetailPage, fetchAndUpdateVendorRecommendations, fetchDuplicateBill, clearBillPayReview, EditBillDetail, EditBillDetailViewState, getEditBillDetail, getReviewPageBillDetail, BillDetailLocalData, PaymentDetailsSectionView, fetchBillAndInitializeLocalStore, updateShowAutofill, saveVendorSuccessOrFailure, BillPaymentStatus, BillPaymentStatusCodeType, BillPaymentRefundStatus, BillPaymentRefundStatusCodeType, BillStatus, BillStatusCodeType, BillApprovalType, updateBillListUIState, BillListUIState, BillPayViewSortKey, BillPayFilters, BillPayFilterCategory, BillListViewFilterCategoryField, BILL_PAY_FILTER_CATEGORIES, updateVendorDetailLocalData, resetVendorDetailLocalData, resetVendorSaveStatus, updateContactsInVendorDetailLocalData, updateVendorTabDetailUIState, updateContactsInVendorTabDetailLocalData, updateBillUploadFetchState, updateBillListSearchResult, fetchUserDetails, verifyUser, updateVendorContact, PaymentToOption, toPaymentToOption, convertAmountToHomeCurrency, RecurringBillInstance, RecurringBillConfigLocalData, EditRecurringBillType, fetchVendorAndUpdateBillLocalData, markBillForRetry, updateWithdrawFromAccountId, removeBillFileFromLocalStore, replaceBillFileInLocalStore, updateShouldReplaceBillData, };
|
|
796
|
-
export { SpendManagementFiltersType, SpendManagementFilterEntityType, FilterCategoryType, BillPayFilterCategoryDropdownOption, ReimbursementFilterCategoryDropdownOption, TaskFilterCategoryDropdownOption, SpendManagementFilterCategoryDropdownOption, MatchingOperatorDropdownOption, CategoryCombinationOperator, hideCreatedByFilter,
|
|
797
|
+
export { SpendManagementFiltersType, SpendManagementFilterEntityType, FilterCategoryType, BillPayFilterCategoryDropdownOption, ReimbursementFilterCategoryDropdownOption, TaskFilterCategoryDropdownOption, SpendManagementFilterCategoryDropdownOption, MatchingOperatorDropdownOption, CategoryCombinationOperator, hideCreatedByFilter, };
|
|
798
|
+
export { TRANSACTION_FILTER_CATEGORIES, TransactionFilterCategory, TransactionFilterCategoryDropdownOption, TransactionFilterCategoryField, TransactionFilterEntityType, TransactionFilters, applyTransactionFilters, };
|
|
797
799
|
export { BillPaySetupViewState, ZeniAccountSetupViewState, BillPaySetupViewLocalData, ZeniAccountSetupViewLocalData, PlaidAccountState, 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, CompanyDetails, CompanyOfficersDetails, BillPaySetupView, ZeniAccountSetupView, BillPayBusinessVerificationDetails, ZeniAccountBusinessVerificationDetails, TreasuryBusinessVerificationDetails, SetupViewState, SetupViewLocalData, SetupView, BusinessVerificationDetails, getBillPaySetupViewDetails, getPlaidAccountDetails, getZeniAccountSetupViewDetails, getBusinessVerificationDetails, getBillPayBusinessVerificationDetails, getZeniAccountBusinessVerificationDetails, getTreasuryBusinessVerificationDetails, getCommonSetupViewDetails, PlaidConnectionDetails, PlaidLinkTokenType, PlaidAccountKeyType, Token, FundingAccount, getTwoFactorAuthenticationView, getTwoFactorAuthenticationViewForCardUserOnboarding, getTwoFactorAuthenticationViewForChargeCardHolder, TwoFactorAuthenticationView, };
|
|
798
800
|
export { BankConnectionsSetupView, IntegrationsView, getApprovalRuleViewDetails, getBankConnectionsSetupViewDetails, getIntegrationsView, };
|
|
799
801
|
export { fetchUserFinancialAccount };
|