@zeniai/client-epic-state 4.20.2-betaJK1 → 4.20.2-betaJK2
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 +0 -1
- package/lib/entity/account/accountSelector.js +1 -8
- package/lib/esm/entity/account/accountSelector.js +0 -6
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +4 -1
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +4 -2
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +9 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +1 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +4 -1
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +3 -1
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -0
- package/lib/view/transactionDetail/transactionDetailSelector.js +9 -2
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ import { ID } from '../../commonStateTypes/common';
|
|
|
6
6
|
import { EntityOrder } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
7
7
|
import { ReportIDPlusForecastID } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
8
8
|
import { Account, AccountBase, AccountState, AccountType } from './accountState';
|
|
9
|
-
export declare const getAccountByAccountId: (accountState: AccountState, accountId: ID) => Account | undefined;
|
|
10
9
|
export declare const getAccountBase: (accountState: AccountState, accountId: ID, reportId: ReportIDPlusForecastID) => AccountBase | undefined;
|
|
11
10
|
export declare function getAccount(accountState: AccountState, id: {
|
|
12
11
|
accountId: ID;
|
|
@@ -3,20 +3,13 @@ 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 =
|
|
6
|
+
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"));
|
|
10
10
|
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
11
11
|
const sortBalancesByFreeRangeTotal_1 = require("../../commonStateTypes/coaBalance/sortBalancesByFreeRangeTotal");
|
|
12
12
|
const accountState_1 = require("./accountState");
|
|
13
|
-
// create a selector to get the account by accountId
|
|
14
|
-
const getAccountByAccountId = (accountState, accountId) => {
|
|
15
|
-
const accounts = Object.values(accountState.accountsByKey);
|
|
16
|
-
const account = accounts.find((account) => account.accountId === accountId);
|
|
17
|
-
return account;
|
|
18
|
-
};
|
|
19
|
-
exports.getAccountByAccountId = getAccountByAccountId;
|
|
20
13
|
function getCommonAccountFields(accountState, id) {
|
|
21
14
|
const key = (0, accountState_1.getAccountKey)(id.reportId, id.accountId, id.classesViewParentId, id.accountsViewParentId);
|
|
22
15
|
const account = accountState.accountsByKey[key];
|
|
@@ -2,12 +2,6 @@ import flatMap from 'lodash/flatMap';
|
|
|
2
2
|
import { getCOABalances } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
3
3
|
import { sortComparator } from '../../commonStateTypes/coaBalance/sortBalancesByFreeRangeTotal';
|
|
4
4
|
import { getAccountKey, } from './accountState';
|
|
5
|
-
// create a selector to get the account by accountId
|
|
6
|
-
export const getAccountByAccountId = (accountState, accountId) => {
|
|
7
|
-
const accounts = Object.values(accountState.accountsByKey);
|
|
8
|
-
const account = accounts.find((account) => account.accountId === accountId);
|
|
9
|
-
return account;
|
|
10
|
-
};
|
|
11
5
|
function getCommonAccountFields(accountState, id) {
|
|
12
6
|
const key = getAccountKey(id.reportId, id.accountId, id.classesViewParentId, id.accountsViewParentId);
|
|
13
7
|
const account = accountState.accountsByKey[key];
|
|
@@ -18,7 +18,7 @@ export const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI)
|
|
|
18
18
|
cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
|
|
19
19
|
variance: reconciliationData?.variance?.amount ?? null,
|
|
20
20
|
};
|
|
21
|
-
const apiUrl =
|
|
21
|
+
const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts`;
|
|
22
22
|
return zeniAPI
|
|
23
23
|
.postAndGetJSON(apiUrl, payload)
|
|
24
24
|
.pipe(mergeMap((response) => {
|
package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js
CHANGED
|
@@ -48,8 +48,8 @@ export const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => action
|
|
|
48
48
|
queryParam.is_force_refresh = true;
|
|
49
49
|
}
|
|
50
50
|
const apiUrl = reconciliationId != null
|
|
51
|
-
?
|
|
52
|
-
:
|
|
51
|
+
? `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/${reconciliationId}?query=${encodeURIComponent(JSON.stringify(queryParam))}`
|
|
52
|
+
: `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
|
|
53
53
|
return zeniAPI.getJSON(apiUrl).pipe(mergeMap((response) => {
|
|
54
54
|
if (isSuccessResponse(response) && response.data != null) {
|
|
55
55
|
const updateActions = [];
|
package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js
CHANGED
|
@@ -17,7 +17,7 @@ export const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) =>
|
|
|
17
17
|
start_date: period.start,
|
|
18
18
|
end_date: period.end,
|
|
19
19
|
});
|
|
20
|
-
const apiUrl =
|
|
20
|
+
const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
|
|
21
21
|
return zeniAPI
|
|
22
22
|
.deleteAndGetJSON(apiUrl)
|
|
23
23
|
.pipe(mergeMap((response) => {
|
|
@@ -476,7 +476,10 @@ const expenseAutomationReconciliationView = createSlice({
|
|
|
476
476
|
: undefined,
|
|
477
477
|
};
|
|
478
478
|
const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
|
|
479
|
-
|
|
479
|
+
if (draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId]
|
|
480
|
+
?.accountIDs != null) {
|
|
481
|
+
draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs.filter((id) => id !== account.account_id);
|
|
482
|
+
}
|
|
480
483
|
}
|
|
481
484
|
},
|
|
482
485
|
excludeAccountFromReconciliationFailure: (draft, action) => {
|
|
@@ -5,7 +5,7 @@ import omit from 'lodash/omit';
|
|
|
5
5
|
import orderBy from 'lodash/orderBy';
|
|
6
6
|
import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
|
|
7
7
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
8
|
-
import {
|
|
8
|
+
import { getAccountsByType } from '../../../entity/account/accountSelector';
|
|
9
9
|
import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../entity/accountRecon/accountReconSelector';
|
|
10
10
|
import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
|
|
11
11
|
import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
|
|
@@ -301,8 +301,10 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
301
301
|
},
|
|
302
302
|
};
|
|
303
303
|
const excludedAccountReconciliationByAccountID = {};
|
|
304
|
+
const accountsInState = Object.values(accountState.accountsByKey);
|
|
305
|
+
const accountsInStateMap = new Map(accountsInState.map((a) => [a.accountId, a]));
|
|
304
306
|
reconciliationViewState.excludedAccountIDs.forEach((excludedAccountID) => {
|
|
305
|
-
const account =
|
|
307
|
+
const account = accountsInStateMap.get(excludedAccountID);
|
|
306
308
|
const exclusionInfo = reconciliationViewState.excludedAccountExclusionInfo[excludedAccountID];
|
|
307
309
|
if (account != null) {
|
|
308
310
|
excludedAccountReconciliationByAccountID[excludedAccountID] = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import recordGet from 'lodash/get';
|
|
2
2
|
import { reduceFetchState } from '../../commonStateTypes/reduceFetchState';
|
|
3
|
+
import { getIsAccountingClassesEnabled } from '../../entity/tenant/tenantSelector';
|
|
3
4
|
import { toTransactionTypeStrict } from '../../entity/transaction/stateTypes/transactionType';
|
|
4
5
|
import { getTransactionWithCOT } from '../../entity/transaction/transactionHelper';
|
|
5
6
|
import { getSupportedTransactionById } from '../../entity/transaction/transactionSelector';
|
|
@@ -51,9 +52,14 @@ export const getTransactionDetail = (state, transactionId, fetchLinkedTransactio
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
const accountsList = getAccountList(accountState, accountListState, 'accountList');
|
|
54
|
-
const
|
|
55
|
+
const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
|
|
56
|
+
const classList = isAccountingClassesEnabled
|
|
57
|
+
? getClassList(classState, classListState)
|
|
58
|
+
: { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
|
|
55
59
|
const accountsHierarchyList = getNestedAccountListHierarchy(accountListState, 'accountList');
|
|
56
|
-
const classHierarchyList =
|
|
60
|
+
const classHierarchyList = isAccountingClassesEnabled
|
|
61
|
+
? getNestedClassListHierarchy(classListState)
|
|
62
|
+
: [];
|
|
57
63
|
const transactionDetailAnyUpdateStatus = reduceUpdateFetchStates(transactionDetail);
|
|
58
64
|
const vendors = getVendorsByVendorIds(vendorState, vendorListState.vendorIds);
|
|
59
65
|
return {
|
|
@@ -71,6 +77,7 @@ export const getTransactionDetail = (state, transactionId, fetchLinkedTransactio
|
|
|
71
77
|
classHierarchyList,
|
|
72
78
|
accountsHierarchyList,
|
|
73
79
|
classList: classList,
|
|
80
|
+
isAccountingClassesEnabled,
|
|
74
81
|
isUpdateNotAllowed: transactionDetail?.isUpdateNotAllowed,
|
|
75
82
|
transactionDetailLocalData: transactionDetail?.transactionDetailLocalData ??
|
|
76
83
|
initialSupportedTransactionDetail.transactionDetailLocalData,
|
package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js
CHANGED
|
@@ -21,7 +21,7 @@ const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => acti
|
|
|
21
21
|
cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
|
|
22
22
|
variance: reconciliationData?.variance?.amount ?? null,
|
|
23
23
|
};
|
|
24
|
-
const apiUrl =
|
|
24
|
+
const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts`;
|
|
25
25
|
return zeniAPI
|
|
26
26
|
.postAndGetJSON(apiUrl, payload)
|
|
27
27
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
@@ -51,8 +51,8 @@ const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
51
51
|
queryParam.is_force_refresh = true;
|
|
52
52
|
}
|
|
53
53
|
const apiUrl = reconciliationId != null
|
|
54
|
-
?
|
|
55
|
-
:
|
|
54
|
+
? `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/${reconciliationId}?query=${encodeURIComponent(JSON.stringify(queryParam))}`
|
|
55
|
+
: `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
|
|
56
56
|
return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.mergeMap)((response) => {
|
|
57
57
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
58
58
|
const updateActions = [];
|
package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js
CHANGED
|
@@ -20,7 +20,7 @@ const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) => action
|
|
|
20
20
|
start_date: period.start,
|
|
21
21
|
end_date: period.end,
|
|
22
22
|
});
|
|
23
|
-
const apiUrl =
|
|
23
|
+
const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
|
|
24
24
|
return zeniAPI
|
|
25
25
|
.deleteAndGetJSON(apiUrl)
|
|
26
26
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
@@ -480,7 +480,10 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
480
480
|
: undefined,
|
|
481
481
|
};
|
|
482
482
|
const monthYearPeriodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
483
|
-
|
|
483
|
+
if (draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId]
|
|
484
|
+
?.accountIDs != null) {
|
|
485
|
+
draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs.filter((id) => id !== account.account_id);
|
|
486
|
+
}
|
|
484
487
|
}
|
|
485
488
|
},
|
|
486
489
|
excludeAccountFromReconciliationFailure: (draft, action) => {
|
|
@@ -307,8 +307,10 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
307
307
|
},
|
|
308
308
|
};
|
|
309
309
|
const excludedAccountReconciliationByAccountID = {};
|
|
310
|
+
const accountsInState = Object.values(accountState.accountsByKey);
|
|
311
|
+
const accountsInStateMap = new Map(accountsInState.map((a) => [a.accountId, a]));
|
|
310
312
|
reconciliationViewState.excludedAccountIDs.forEach((excludedAccountID) => {
|
|
311
|
-
const account =
|
|
313
|
+
const account = accountsInStateMap.get(excludedAccountID);
|
|
312
314
|
const exclusionInfo = reconciliationViewState.excludedAccountExclusionInfo[excludedAccountID];
|
|
313
315
|
if (account != null) {
|
|
314
316
|
excludedAccountReconciliationByAccountID[excludedAccountID] = {
|
|
@@ -17,6 +17,7 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
17
17
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
18
18
|
classList: ClassListSelectorView;
|
|
19
19
|
deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
|
|
20
|
+
isAccountingClassesEnabled: boolean;
|
|
20
21
|
linkedTransactions: SupportedTransactionWithCOT[];
|
|
21
22
|
transactionDetailLocalData: TransactionDetailLocalData;
|
|
22
23
|
transactionDetailUpdateStatus: FetchStateAndError;
|
|
@@ -7,6 +7,7 @@ exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTra
|
|
|
7
7
|
exports.getTransactionDetailForTransaction = getTransactionDetailForTransaction;
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
10
|
+
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
10
11
|
const transactionType_1 = require("../../entity/transaction/stateTypes/transactionType");
|
|
11
12
|
const transactionHelper_1 = require("../../entity/transaction/transactionHelper");
|
|
12
13
|
const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
|
|
@@ -58,9 +59,14 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
const accountsList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
61
|
-
const
|
|
62
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
63
|
+
const classList = isAccountingClassesEnabled
|
|
64
|
+
? (0, classListSelector_1.getClassList)(classState, classListState)
|
|
65
|
+
: { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
|
|
62
66
|
const accountsHierarchyList = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList');
|
|
63
|
-
const classHierarchyList =
|
|
67
|
+
const classHierarchyList = isAccountingClassesEnabled
|
|
68
|
+
? (0, classListSelector_1.getNestedClassListHierarchy)(classListState)
|
|
69
|
+
: [];
|
|
64
70
|
const transactionDetailAnyUpdateStatus = reduceUpdateFetchStates(transactionDetail);
|
|
65
71
|
const vendors = (0, vendorSelector_1.getVendorsByVendorIds)(vendorState, vendorListState.vendorIds);
|
|
66
72
|
return {
|
|
@@ -78,6 +84,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
78
84
|
classHierarchyList,
|
|
79
85
|
accountsHierarchyList,
|
|
80
86
|
classList: classList,
|
|
87
|
+
isAccountingClassesEnabled,
|
|
81
88
|
isUpdateNotAllowed: transactionDetail?.isUpdateNotAllowed,
|
|
82
89
|
transactionDetailLocalData: transactionDetail?.transactionDetailLocalData ??
|
|
83
90
|
transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.20.2-
|
|
3
|
+
"version": "4.20.2-betaJK2",
|
|
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
|
"module": "lib/esm/index.js",
|