@zeniai/client-epic-state 4.19.96-betaJK16 → 4.19.96-betaJK17
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 +1 -0
- package/lib/entity/account/accountSelector.js +8 -1
- package/lib/esm/entity/account/accountSelector.js +6 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +4 -1
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +30 -2
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +8 -9
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +4 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +12 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +3 -2
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +30 -2
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +2 -3
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +7 -8
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ 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;
|
|
9
10
|
export declare const getAccountBase: (accountState: AccountState, accountId: ID, reportId: ReportIDPlusForecastID) => AccountBase | undefined;
|
|
10
11
|
export declare function getAccount(accountState: AccountState, id: {
|
|
11
12
|
accountId: ID;
|
|
@@ -3,13 +3,20 @@ 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.getAccountIdsForLabels = exports.getAccountIdsForTypes = exports.getAccountsByType = exports.getAccountsOrdered = exports.getAccountBase = exports.getAccountByAccountId = 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;
|
|
13
20
|
function getCommonAccountFields(accountState, id) {
|
|
14
21
|
const key = (0, accountState_1.getAccountKey)(id.reportId, id.accountId, id.classesViewParentId, id.accountsViewParentId);
|
|
15
22
|
const account = accountState.accountsByKey[key];
|
|
@@ -2,6 +2,12 @@ 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
|
+
};
|
|
5
11
|
function getCommonAccountFields(accountState, id) {
|
|
6
12
|
const key = getAccountKey(id.reportId, id.accountId, id.classesViewParentId, id.accountsViewParentId);
|
|
7
13
|
const account = accountState.accountsByKey[key];
|
|
@@ -21,7 +21,10 @@ export const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI)
|
|
|
21
21
|
.postAndGetJSON(apiUrl, payload)
|
|
22
22
|
.pipe(mergeMap((response) => {
|
|
23
23
|
if (isSuccessResponse(response)) {
|
|
24
|
-
return of(excludeAccountFromReconciliationSuccess({
|
|
24
|
+
return of(excludeAccountFromReconciliationSuccess({
|
|
25
|
+
account: response.data?.excluded_account ?? undefined,
|
|
26
|
+
selectedPeriod,
|
|
27
|
+
}));
|
|
25
28
|
}
|
|
26
29
|
else {
|
|
27
30
|
return of(excludeAccountFromReconciliationFailure({
|
|
@@ -443,8 +443,36 @@ const expenseAutomationReconciliationView = createSlice({
|
|
|
443
443
|
fetchState: 'Completed',
|
|
444
444
|
error: undefined,
|
|
445
445
|
};
|
|
446
|
-
|
|
447
|
-
|
|
446
|
+
const { account, selectedPeriod } = action.payload;
|
|
447
|
+
if (account != null) {
|
|
448
|
+
if (!draft.excludedAccountIDs.includes(account.account_id)) {
|
|
449
|
+
draft.excludedAccountIDs.push(account.account_id);
|
|
450
|
+
}
|
|
451
|
+
draft.excludedAccountExclusionInfo[account.account_id] = {
|
|
452
|
+
bankBalance: account.bank_balance != null
|
|
453
|
+
? {
|
|
454
|
+
amount: account.bank_balance,
|
|
455
|
+
currencyCode: account.currency_code ?? 'USD',
|
|
456
|
+
currencySymbol: account.currency_symbol ?? '$',
|
|
457
|
+
}
|
|
458
|
+
: undefined,
|
|
459
|
+
clearedBalance: account.cleared_balance != null
|
|
460
|
+
? {
|
|
461
|
+
amount: account.cleared_balance,
|
|
462
|
+
currencyCode: account.currency_code ?? 'USD',
|
|
463
|
+
currencySymbol: account.currency_symbol ?? '$',
|
|
464
|
+
}
|
|
465
|
+
: undefined,
|
|
466
|
+
variance: account.variance != null
|
|
467
|
+
? {
|
|
468
|
+
amount: account.variance,
|
|
469
|
+
currencyCode: account.currency_code ?? 'USD',
|
|
470
|
+
currencySymbol: account.currency_symbol ?? '$',
|
|
471
|
+
}
|
|
472
|
+
: undefined,
|
|
473
|
+
};
|
|
474
|
+
const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
|
|
475
|
+
draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs.filter((id) => id !== account.account_id);
|
|
448
476
|
}
|
|
449
477
|
},
|
|
450
478
|
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 { getAccountByAccountId, 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';
|
|
@@ -290,15 +290,14 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
290
290
|
};
|
|
291
291
|
const excludedAccountReconciliationByAccountID = {};
|
|
292
292
|
reconciliationViewState.excludedAccountIDs.forEach((excludedAccountID) => {
|
|
293
|
-
const account =
|
|
294
|
-
accountId: excludedAccountID,
|
|
295
|
-
reportId: 'excluded_account_reconciliation',
|
|
296
|
-
});
|
|
293
|
+
const account = getAccountByAccountId(accountState, excludedAccountID);
|
|
297
294
|
const exclusionInfo = reconciliationViewState.excludedAccountExclusionInfo[excludedAccountID];
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
295
|
+
if (account != null) {
|
|
296
|
+
excludedAccountReconciliationByAccountID[excludedAccountID] = {
|
|
297
|
+
...account,
|
|
298
|
+
...exclusionInfo,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
302
301
|
});
|
|
303
302
|
const accountListNestedAccountHierarchy = getNestedAccountListHierarchy(accountListState, 'accountList');
|
|
304
303
|
const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
|
package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js
CHANGED
|
@@ -24,7 +24,10 @@ const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => acti
|
|
|
24
24
|
.postAndGetJSON(apiUrl, payload)
|
|
25
25
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
26
26
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
27
|
-
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.excludeAccountFromReconciliationSuccess)({
|
|
27
|
+
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.excludeAccountFromReconciliationSuccess)({
|
|
28
|
+
account: response.data?.excluded_account ?? undefined,
|
|
29
|
+
selectedPeriod,
|
|
30
|
+
}));
|
|
28
31
|
}
|
|
29
32
|
else {
|
|
30
33
|
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.excludeAccountFromReconciliationFailure)({
|
|
@@ -45,7 +45,18 @@ export interface ExcludeAccountFromReconciliationRequestPayload {
|
|
|
45
45
|
cleared_balance: number;
|
|
46
46
|
variance: number;
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export interface ExcludedAccountFromReconciliationPayload {
|
|
49
|
+
account_id: ID;
|
|
50
|
+
bank_balance: number | null;
|
|
51
|
+
cleared_balance: number | null;
|
|
52
|
+
variance: number | null;
|
|
53
|
+
currency_code?: string;
|
|
54
|
+
currency_symbol?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ExcludeAccountFromReconciliationResponsePayload {
|
|
57
|
+
excluded_account: ExcludedAccountFromReconciliationPayload;
|
|
58
|
+
}
|
|
59
|
+
export type ExcludeAccountFromReconciliationResponse = ZeniAPIResponse<ExcludeAccountFromReconciliationResponsePayload>;
|
|
49
60
|
export interface DeleteStatementResponsePayload {
|
|
50
61
|
statement_upload: {
|
|
51
62
|
statement_data_status: StatusCodeWithLabelPayload;
|
|
@@ -3,7 +3,7 @@ import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
|
3
3
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
4
4
|
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
5
5
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
6
|
-
import { ReconciliationPayload, UploadStatementDocumentAIPayload } from '../payload/reconciliationPayload';
|
|
6
|
+
import { ExcludedAccountFromReconciliationPayload, ReconciliationPayload, UploadStatementDocumentAIPayload } from '../payload/reconciliationPayload';
|
|
7
7
|
import { AccountReconciliationLocalData, ActionFetchStates, ExcludeAccountFromReconciliationPayload, ReconReconcileSortKey, ReconReviewSortKey, ReconciliationReviewTabLocalData, ReconciliationTabsState, ReconciliationViewState, ReconciliationViewTabType, SaveReconcileDetailActionPayload, SaveReconciliationDetailFailurePayload, TransactionSummary } from '../types/reconciliationViewState';
|
|
8
8
|
export declare const initialReconciliationTabsState: ReconciliationTabsState;
|
|
9
9
|
export declare const initialActionFetchState: ActionFetchStates;
|
|
@@ -87,7 +87,8 @@ export declare const fetchReconciliation: import("@reduxjs/toolkit").ActionCreat
|
|
|
87
87
|
error: ZeniAPIStatus;
|
|
88
88
|
selectedPeriod: MonthYearPeriod;
|
|
89
89
|
}, "expenseAutomationReconciliationView/deleteAccountStatementFailure">, excludeAccountFromReconciliation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: ExcludeAccountFromReconciliationPayload], ExcludeAccountFromReconciliationPayload, "expenseAutomationReconciliationView/excludeAccountFromReconciliation", never, never>, excludeAccountFromReconciliationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
90
|
-
|
|
90
|
+
selectedPeriod: MonthYearPeriod;
|
|
91
|
+
account?: ExcludedAccountFromReconciliationPayload;
|
|
91
92
|
}, "expenseAutomationReconciliationView/excludeAccountFromReconciliationSuccess">, excludeAccountFromReconciliationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
92
93
|
error: ZeniAPIStatus;
|
|
93
94
|
}, "expenseAutomationReconciliationView/excludeAccountFromReconciliationFailure">, uploadAccountStatement: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -447,8 +447,36 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
447
447
|
fetchState: 'Completed',
|
|
448
448
|
error: undefined,
|
|
449
449
|
};
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
const { account, selectedPeriod } = action.payload;
|
|
451
|
+
if (account != null) {
|
|
452
|
+
if (!draft.excludedAccountIDs.includes(account.account_id)) {
|
|
453
|
+
draft.excludedAccountIDs.push(account.account_id);
|
|
454
|
+
}
|
|
455
|
+
draft.excludedAccountExclusionInfo[account.account_id] = {
|
|
456
|
+
bankBalance: account.bank_balance != null
|
|
457
|
+
? {
|
|
458
|
+
amount: account.bank_balance,
|
|
459
|
+
currencyCode: account.currency_code ?? 'USD',
|
|
460
|
+
currencySymbol: account.currency_symbol ?? '$',
|
|
461
|
+
}
|
|
462
|
+
: undefined,
|
|
463
|
+
clearedBalance: account.cleared_balance != null
|
|
464
|
+
? {
|
|
465
|
+
amount: account.cleared_balance,
|
|
466
|
+
currencyCode: account.currency_code ?? 'USD',
|
|
467
|
+
currencySymbol: account.currency_symbol ?? '$',
|
|
468
|
+
}
|
|
469
|
+
: undefined,
|
|
470
|
+
variance: account.variance != null
|
|
471
|
+
? {
|
|
472
|
+
amount: account.variance,
|
|
473
|
+
currencyCode: account.currency_code ?? 'USD',
|
|
474
|
+
currencySymbol: account.currency_symbol ?? '$',
|
|
475
|
+
}
|
|
476
|
+
: undefined,
|
|
477
|
+
};
|
|
478
|
+
const monthYearPeriodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
479
|
+
draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs.filter((id) => id !== account.account_id);
|
|
452
480
|
}
|
|
453
481
|
},
|
|
454
482
|
excludeAccountFromReconciliationFailure: (draft, action) => {
|
|
@@ -3,8 +3,7 @@ import { Amount } from '../../../commonStateTypes/amount';
|
|
|
3
3
|
import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
|
|
4
4
|
import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
5
5
|
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
6
|
-
import {
|
|
7
|
-
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
|
+
import { Account, AccountBase } from '../../../entity/account/accountState';
|
|
8
7
|
import { AccountReconciliationEntity } from '../../../entity/accountRecon/accountReconSelector';
|
|
9
8
|
import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconState';
|
|
10
9
|
import { ClassBase } from '../../../entity/class/classState';
|
|
@@ -14,7 +13,7 @@ import { AccountReconciliationLocalData, ActionFetchStates, ReconListUIState, Re
|
|
|
14
13
|
export declare const ALL_ACCOUNT_RECON_SECTION_IDS: readonly ["assets", "liabilities"];
|
|
15
14
|
declare const toAccountReconSectionID: (v: string) => "assets" | "liabilities";
|
|
16
15
|
export type AccountReconSectionID = ReturnType<typeof toAccountReconSectionID>;
|
|
17
|
-
export interface ExcludedAccountReconciliation extends
|
|
16
|
+
export interface ExcludedAccountReconciliation extends Account {
|
|
18
17
|
bankBalance?: Amount;
|
|
19
18
|
clearedBalance?: Amount;
|
|
20
19
|
variance?: Amount;
|
|
@@ -296,15 +296,14 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
296
296
|
};
|
|
297
297
|
const excludedAccountReconciliationByAccountID = {};
|
|
298
298
|
reconciliationViewState.excludedAccountIDs.forEach((excludedAccountID) => {
|
|
299
|
-
const account = (0, accountSelector_1.
|
|
300
|
-
accountId: excludedAccountID,
|
|
301
|
-
reportId: 'excluded_account_reconciliation',
|
|
302
|
-
});
|
|
299
|
+
const account = (0, accountSelector_1.getAccountByAccountId)(accountState, excludedAccountID);
|
|
303
300
|
const exclusionInfo = reconciliationViewState.excludedAccountExclusionInfo[excludedAccountID];
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
301
|
+
if (account != null) {
|
|
302
|
+
excludedAccountReconciliationByAccountID[excludedAccountID] = {
|
|
303
|
+
...account,
|
|
304
|
+
...exclusionInfo,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
308
307
|
});
|
|
309
308
|
const accountListNestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList');
|
|
310
309
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.96-
|
|
3
|
+
"version": "4.19.96-betaJK17",
|
|
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",
|