@zeniai/client-epic-state 4.11.21 → 4.11.23
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/view/companyHealthMetricView/companyHealthMetricViewSelector.js +4 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewSelector.js +41 -9
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +7 -2
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +2 -1
- package/package.json +2 -2
|
@@ -237,7 +237,10 @@ const applyAdvancedFiltersOnCompaniesList = (allCompanies, filters, filteredComp
|
|
|
237
237
|
: filteredCompanies, index + 1);
|
|
238
238
|
};
|
|
239
239
|
const sortAndFilterCompanies = (sortKey, sortOrder, filterText, filters, companies, userState) => {
|
|
240
|
-
|
|
240
|
+
let sortOrderKey = (0, sortOrderPayload_1.getSortOrder)(sortOrder);
|
|
241
|
+
if (sortKey === 'lastReportSent') {
|
|
242
|
+
sortOrderKey = sortOrderKey === 'asc' ? 'desc' : 'asc';
|
|
243
|
+
}
|
|
241
244
|
let updatedCompanies = [];
|
|
242
245
|
const trimmedFilterText = filterText.trim();
|
|
243
246
|
if (trimmedFilterText) {
|
|
@@ -10,6 +10,7 @@ const values_1 = __importDefault(require("lodash/values"));
|
|
|
10
10
|
const userSelector_1 = require("../../entity/user/userSelector");
|
|
11
11
|
const companySelector_1 = require("../../entity/company/companySelector");
|
|
12
12
|
const userAndRole_1 = require("../companyView/types/userAndRole");
|
|
13
|
+
const sortOrderPayload_1 = require("../../commonPayloadTypes/sortOrderPayload");
|
|
13
14
|
exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) => state, (rootState) => {
|
|
14
15
|
const { filterText, sortKey, sortOrder } = rootState.reviewCompanyViewState.uiState;
|
|
15
16
|
const companies = (0, values_1.default)(rootState.reviewCompanyViewState.reviewCompanyById)
|
|
@@ -36,7 +37,38 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
36
37
|
.map((userId) => (0, userSelector_1.getUserByUserId)(rootState.userState, userId))
|
|
37
38
|
.filter((value) => value != null);
|
|
38
39
|
const orderedZeniUsers = (0, orderBy_1.default)(zeniUsers, (user) => (0, userSelector_1.getUserName)(user), 'asc');
|
|
39
|
-
const
|
|
40
|
+
const companiesWithSortKeyValues = [];
|
|
41
|
+
const companiesWithNoSortKeyValues = [];
|
|
42
|
+
companies.forEach((company) => {
|
|
43
|
+
switch (sortKey) {
|
|
44
|
+
case 'uncategorized':
|
|
45
|
+
if (company.uncategorizedTransactions.income ||
|
|
46
|
+
company.uncategorizedTransactions.expense) {
|
|
47
|
+
companiesWithSortKeyValues.push(company);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
companiesWithNoSortKeyValues.push(company);
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case 'miscategorized':
|
|
54
|
+
if (company.miscategorizedTransactions.income ||
|
|
55
|
+
company.miscategorizedTransactions.expense) {
|
|
56
|
+
companiesWithSortKeyValues.push(company);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
companiesWithNoSortKeyValues.push(company);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 'notes':
|
|
63
|
+
case 'warnings':
|
|
64
|
+
case 'auditScore':
|
|
65
|
+
case 'reviewVendor':
|
|
66
|
+
case 'companyName':
|
|
67
|
+
companiesWithSortKeyValues.push(company);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, (company) => {
|
|
40
72
|
var _a;
|
|
41
73
|
const warningCount = (0, exports.getAuditWarningsCount)(company);
|
|
42
74
|
let primarySortValue;
|
|
@@ -47,14 +79,14 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
47
79
|
primarySortValue = (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
48
80
|
break;
|
|
49
81
|
case 'uncategorized':
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
82
|
+
isSecondarySortApplicable = true;
|
|
83
|
+
primarySortValue = company.uncategorizedTransactions.income ? 1 : 0;
|
|
84
|
+
secondarySortValue = company.uncategorizedTransactions.expense ? 1 : 0;
|
|
53
85
|
break;
|
|
54
86
|
case 'miscategorized':
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
87
|
+
isSecondarySortApplicable = true;
|
|
88
|
+
primarySortValue = company.miscategorizedTransactions.income ? 1 : 0;
|
|
89
|
+
secondarySortValue = company.miscategorizedTransactions.expense ? 1 : 0;
|
|
58
90
|
break;
|
|
59
91
|
case 'warnings':
|
|
60
92
|
primarySortValue = warningCount;
|
|
@@ -75,9 +107,9 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
75
107
|
return isSecondarySortApplicable === true
|
|
76
108
|
? [primarySortValue, secondarySortValue]
|
|
77
109
|
: primarySortValue;
|
|
78
|
-
},
|
|
110
|
+
}, (0, sortOrderPayload_1.getSortOrder)(sortOrder));
|
|
79
111
|
return {
|
|
80
|
-
companies:
|
|
112
|
+
companies: [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValues],
|
|
81
113
|
fetchState: rootState.reviewCompanyViewState.fetchState,
|
|
82
114
|
error: rootState.reviewCompanyViewState.error,
|
|
83
115
|
uiState: rootState.reviewCompanyViewState.uiState,
|
|
@@ -4,6 +4,7 @@ exports.toTransactionUpdatesFromTransactionDetailLocalData = void 0;
|
|
|
4
4
|
const recommendationBase_1 = require("../../../commonStateTypes/recommendationBase");
|
|
5
5
|
const entity_1 = require("../../../entity/genericEntity/entity");
|
|
6
6
|
const customerTransaction_1 = require("../../../entity/transaction/stateTypes/customerTransaction");
|
|
7
|
+
const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
|
|
7
8
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
8
9
|
const recommendationState_1 = require("../../recommendation/recommendationState");
|
|
9
10
|
// This function will extract the data that will determine which all APIs need to be called
|
|
@@ -259,8 +260,12 @@ const isTransactionMiscategorized = (transaction) => {
|
|
|
259
260
|
const lineItem = line;
|
|
260
261
|
if (lineItem.isCategoryMiscategorized ||
|
|
261
262
|
lineItem.isClassMiscategorized ||
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
// This ensures that neither vendor or customer is present at line level, safe to say miscat line due to vendor/customer
|
|
264
|
+
((0, transactionType_1.toVendorTransactionTypeStrict)(transaction.type) &&
|
|
265
|
+
transaction.vendor == null) ||
|
|
266
|
+
((0, transactionType_1.toJEAndDepositTransactionTypeStrict)(transaction.type) &&
|
|
267
|
+
lineItem.vendor == null &&
|
|
268
|
+
lineItem.customer == null)) {
|
|
264
269
|
isTransactionMisCategorized = true;
|
|
265
270
|
}
|
|
266
271
|
}
|
|
@@ -68,7 +68,8 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
68
68
|
if ((0, transactionType_1.toVendorTransactionTypeStrict)(response.data.transaction.transaction_type) != null ||
|
|
69
69
|
(0, transactionType_1.toJEAndDepositTransactionTypeStrict)(response.data.transaction.transaction_type) != null) {
|
|
70
70
|
const isAnyClassMissing = checkIfClassMissingForAnyLineItem(response.data.transaction);
|
|
71
|
-
const isVendorOrCustomerMissingInAnyLine =
|
|
71
|
+
const isVendorOrCustomerMissingInAnyLine = (0, transactionType_1.toJEAndDepositTransactionTypeStrict)(response.data.transaction.transaction_type) != null &&
|
|
72
|
+
checkIfVendorOrCustomerMissingForAnyLineItem(response.data.transaction);
|
|
72
73
|
if (((vendorUpdates === null || vendorUpdates === void 0 ? void 0 : vendorUpdates.id) == null &&
|
|
73
74
|
isVendorOrCustomerMissingInAnyLine == true) ||
|
|
74
75
|
isAnyClassMissing == true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.23",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@reduxjs/toolkit": "^1.6.2",
|
|
51
|
-
"@stripe/stripe-js": "4.
|
|
51
|
+
"@stripe/stripe-js": "^4.1.0",
|
|
52
52
|
"cross-fetch": "^3.1.2",
|
|
53
53
|
"date-holidays": "^3.23.8",
|
|
54
54
|
"dayjs": "^1.10.7",
|