@zeniai/client-epic-state 4.19.96-betaJK7 → 4.19.96-betaJK8
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/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -10
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +29 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -10
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +29 -2
- package/package.json +1 -1
package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js
CHANGED
|
@@ -53,23 +53,17 @@ export const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => action
|
|
|
53
53
|
return zeniAPI.getJSON(apiUrl).pipe(mergeMap((response) => {
|
|
54
54
|
if (isSuccessResponse(response) && response.data != null) {
|
|
55
55
|
const updateActions = [];
|
|
56
|
-
|
|
57
|
-
updateActions.push(updateAccounts(response.data.excluded_accounts, 'excluded_account_reconciliation')
|
|
58
|
-
updateActions.push(updateAllUsers({
|
|
56
|
+
const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
|
|
57
|
+
updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'), updateAccounts(response.data.excluded_accounts, 'excluded_account_reconciliation'), updateAllUsers({
|
|
59
58
|
users: response.data.users ?? [],
|
|
60
59
|
updateType: 'merge',
|
|
61
|
-
}));
|
|
62
|
-
updateActions.push(updateFiles({ files: response.data.files ?? [] }));
|
|
63
|
-
const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
|
|
64
|
-
updateActions.push(updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'));
|
|
65
|
-
updateActions.push(updateAccountRecon(selectedPeriod, response.data.reconciliation));
|
|
60
|
+
}), updateFiles({ files: response.data.files ?? [] }), updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'), updateAccountRecon(selectedPeriod, response.data.reconciliation));
|
|
66
61
|
const reviewTabLocalData = prepareReviewTabLocalData(response.data.reconciliation[0]?.transactions?.review ?? []);
|
|
67
62
|
if (accountId != null) {
|
|
68
63
|
const selectedTransactionIds = getTransactionIdFromCheckedMatchedTransactionPayload(response.data.reconciliation[0].transactions.reconcile);
|
|
69
64
|
updateActions.push(updateReconcileTabLocalData({
|
|
70
65
|
selectedTransactionIds: selectedTransactionIds,
|
|
71
|
-
}));
|
|
72
|
-
updateActions.push(initializeReconciliationReviewTabLocalData(reviewTabLocalData));
|
|
66
|
+
}), initializeReconciliationReviewTabLocalData(reviewTabLocalData));
|
|
73
67
|
}
|
|
74
68
|
updateActions.push(fetchReconciliationSuccess(selectedPeriod, response.data, refreshViewInBackground, accountId));
|
|
75
69
|
return from(updateActions);
|
|
@@ -60,6 +60,7 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
60
60
|
reconciliationTabsState: initialReconciliationTabsState,
|
|
61
61
|
actionFetchStates: initialActionFetchState,
|
|
62
62
|
reviewTabSelectedVendorByTransactionId: {},
|
|
63
|
+
excludedAccountReconciliationByAccountID: {},
|
|
63
64
|
accountReconciliationBySectionID: {
|
|
64
65
|
assets: {
|
|
65
66
|
sectionId: 'assets',
|
|
@@ -259,6 +260,7 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
259
260
|
totalVariancePercentage: liabilityTotals.variancePercentage,
|
|
260
261
|
},
|
|
261
262
|
};
|
|
263
|
+
const excludedReconList = {};
|
|
262
264
|
const excludedAssetAccountIDs = [];
|
|
263
265
|
const excludedLiabilityAccountIDs = [];
|
|
264
266
|
const excludedAssetTotals = {};
|
|
@@ -315,8 +317,7 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
315
317
|
if (accountRecon?.clearedBalance != null && clearedTotal != null) {
|
|
316
318
|
clearedTotal = clearedTotal.plus(accountRecon.clearedBalance.amount);
|
|
317
319
|
}
|
|
318
|
-
else if (accountRecon?.clearedBalance != null &&
|
|
319
|
-
clearedTotal == null) {
|
|
320
|
+
else if (accountRecon?.clearedBalance != null && clearedTotal == null) {
|
|
320
321
|
clearedTotal = Big(accountRecon.clearedBalance.amount);
|
|
321
322
|
}
|
|
322
323
|
const currency = accountRecon?.currency;
|
|
@@ -367,6 +368,31 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
367
368
|
excludedLiabilityTotals.varianceTotal = total.varianceTotal;
|
|
368
369
|
excludedLiabilityTotals.variancePercentage = total.variancePercentage;
|
|
369
370
|
}
|
|
371
|
+
if (accountRecon != null) {
|
|
372
|
+
const excludedAccountConnectionStatus = reconciliationViewState.accountConnectionStatusByAccountID[accountID];
|
|
373
|
+
const excludedReconciliationRecord = accountReconForMonthYearPeriod?.reconciliationByAccountID[accountID];
|
|
374
|
+
const defaultFetchState = {
|
|
375
|
+
error: undefined,
|
|
376
|
+
fetchState: 'Not-Started',
|
|
377
|
+
};
|
|
378
|
+
excludedReconList[accountID] = {
|
|
379
|
+
accountConnectionStatus: excludedAccountConnectionStatus?.status ?? 'not_connected',
|
|
380
|
+
paymentAccountId: excludedAccountConnectionStatus?.paymentAccountId,
|
|
381
|
+
connectionInProgress: excludedAccountConnectionStatus?.connectionInProgress ?? false,
|
|
382
|
+
accountReconEntity: accountRecon,
|
|
383
|
+
refreshStatus: excludedReconciliationRecord?.refreshStatus ?? defaultFetchState,
|
|
384
|
+
statementDeleteStatus: excludedReconciliationRecord?.statementDeleteStatus ??
|
|
385
|
+
defaultFetchState,
|
|
386
|
+
statementUpdateStatus: excludedReconciliationRecord?.statementUpdateStatus ??
|
|
387
|
+
defaultFetchState,
|
|
388
|
+
statementUploadStatus: excludedReconciliationRecord?.statementUploadStatus ??
|
|
389
|
+
defaultFetchState,
|
|
390
|
+
localData: excludedReconciliationRecord?.localData ?? {},
|
|
391
|
+
statementParseInProgress: excludedReconciliationRecord?.statementParseInProgress ?? false,
|
|
392
|
+
transactionFetchState: excludedReconciliationRecord?.transactionFetchState ??
|
|
393
|
+
defaultFetchState,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
370
396
|
});
|
|
371
397
|
const excludedAccountReconciliationBySectionID = {
|
|
372
398
|
assets: {
|
|
@@ -433,6 +459,7 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
|
|
|
433
459
|
statementUploadChosen: reconciliationViewState.statementUploadChosen,
|
|
434
460
|
monthYearPeriod: selectedPeriod,
|
|
435
461
|
accountReconciliationBySectionID,
|
|
462
|
+
excludedAccountReconciliationByAccountID: excludedReconList,
|
|
436
463
|
excludedAccountReconciliationBySectionID,
|
|
437
464
|
selectedAccountId: reconciliationViewState.selectedAccountId,
|
|
438
465
|
selectedReconAccount: reconciliationViewState.selectedAccountId != null &&
|
|
@@ -56,23 +56,17 @@ const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
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 = [];
|
|
59
|
-
|
|
60
|
-
updateActions.push((0, accountReducer_1.updateAccounts)(response.data.excluded_accounts, 'excluded_account_reconciliation'))
|
|
61
|
-
updateActions.push((0, userReducer_1.updateAllUsers)({
|
|
59
|
+
const allTransactionsPerRecon = (0, reconciliationHelpers_1.getAllReviewTransactionsFromReconcilePayload)(response.data.reconciliation);
|
|
60
|
+
updateActions.push((0, accountReducer_1.updateAccounts)(response.data.accounts, 'account_reconciliation'), (0, accountReducer_1.updateAccounts)(response.data.excluded_accounts, 'excluded_account_reconciliation'), (0, userReducer_1.updateAllUsers)({
|
|
62
61
|
users: response.data.users ?? [],
|
|
63
62
|
updateType: 'merge',
|
|
64
|
-
}));
|
|
65
|
-
updateActions.push((0, fileReducer_1.updateFiles)({ files: response.data.files ?? [] }));
|
|
66
|
-
const allTransactionsPerRecon = (0, reconciliationHelpers_1.getAllReviewTransactionsFromReconcilePayload)(response.data.reconciliation);
|
|
67
|
-
updateActions.push((0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'));
|
|
68
|
-
updateActions.push((0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation));
|
|
63
|
+
}), (0, fileReducer_1.updateFiles)({ files: response.data.files ?? [] }), (0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'), (0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation));
|
|
69
64
|
const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)(response.data.reconciliation[0]?.transactions?.review ?? []);
|
|
70
65
|
if (accountId != null) {
|
|
71
66
|
const selectedTransactionIds = (0, saveReconciliationDetailEpic_1.getTransactionIdFromCheckedMatchedTransactionPayload)(response.data.reconciliation[0].transactions.reconcile);
|
|
72
67
|
updateActions.push((0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
|
|
73
68
|
selectedTransactionIds: selectedTransactionIds,
|
|
74
|
-
}));
|
|
75
|
-
updateActions.push((0, reconciliationViewReducer_1.initializeReconciliationReviewTabLocalData)(reviewTabLocalData));
|
|
69
|
+
}), (0, reconciliationViewReducer_1.initializeReconciliationReviewTabLocalData)(reviewTabLocalData));
|
|
76
70
|
}
|
|
77
71
|
updateActions.push((0, reconciliationViewReducer_1.fetchReconciliationSuccess)(selectedPeriod, response.data, refreshViewInBackground, accountId));
|
|
78
72
|
return (0, rxjs_1.from)(updateActions);
|
|
@@ -24,6 +24,7 @@ export interface ExpenseAutomationReconciliationViewSelector {
|
|
|
24
24
|
classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
|
|
25
25
|
completionStatus: CompletionStatusType;
|
|
26
26
|
creditCards: AccountBase[];
|
|
27
|
+
excludedAccountReconciliationByAccountID: Record<ID, AccountReconciliationByAccount>;
|
|
27
28
|
excludedAccountReconciliationBySectionID: Record<AccountReconSectionID, AccountReconciliationBySection>;
|
|
28
29
|
fetchStatus: FetchStateAndError;
|
|
29
30
|
monthYearPeriod: MonthYearPeriod;
|
|
@@ -66,6 +66,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
66
66
|
reconciliationTabsState: reconciliationViewReducer_1.initialReconciliationTabsState,
|
|
67
67
|
actionFetchStates: reconciliationViewReducer_1.initialActionFetchState,
|
|
68
68
|
reviewTabSelectedVendorByTransactionId: {},
|
|
69
|
+
excludedAccountReconciliationByAccountID: {},
|
|
69
70
|
accountReconciliationBySectionID: {
|
|
70
71
|
assets: {
|
|
71
72
|
sectionId: 'assets',
|
|
@@ -265,6 +266,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
265
266
|
totalVariancePercentage: liabilityTotals.variancePercentage,
|
|
266
267
|
},
|
|
267
268
|
};
|
|
269
|
+
const excludedReconList = {};
|
|
268
270
|
const excludedAssetAccountIDs = [];
|
|
269
271
|
const excludedLiabilityAccountIDs = [];
|
|
270
272
|
const excludedAssetTotals = {};
|
|
@@ -321,8 +323,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
321
323
|
if (accountRecon?.clearedBalance != null && clearedTotal != null) {
|
|
322
324
|
clearedTotal = clearedTotal.plus(accountRecon.clearedBalance.amount);
|
|
323
325
|
}
|
|
324
|
-
else if (accountRecon?.clearedBalance != null &&
|
|
325
|
-
clearedTotal == null) {
|
|
326
|
+
else if (accountRecon?.clearedBalance != null && clearedTotal == null) {
|
|
326
327
|
clearedTotal = (0, big_js_1.default)(accountRecon.clearedBalance.amount);
|
|
327
328
|
}
|
|
328
329
|
const currency = accountRecon?.currency;
|
|
@@ -373,6 +374,31 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
373
374
|
excludedLiabilityTotals.varianceTotal = total.varianceTotal;
|
|
374
375
|
excludedLiabilityTotals.variancePercentage = total.variancePercentage;
|
|
375
376
|
}
|
|
377
|
+
if (accountRecon != null) {
|
|
378
|
+
const excludedAccountConnectionStatus = reconciliationViewState.accountConnectionStatusByAccountID[accountID];
|
|
379
|
+
const excludedReconciliationRecord = accountReconForMonthYearPeriod?.reconciliationByAccountID[accountID];
|
|
380
|
+
const defaultFetchState = {
|
|
381
|
+
error: undefined,
|
|
382
|
+
fetchState: 'Not-Started',
|
|
383
|
+
};
|
|
384
|
+
excludedReconList[accountID] = {
|
|
385
|
+
accountConnectionStatus: excludedAccountConnectionStatus?.status ?? 'not_connected',
|
|
386
|
+
paymentAccountId: excludedAccountConnectionStatus?.paymentAccountId,
|
|
387
|
+
connectionInProgress: excludedAccountConnectionStatus?.connectionInProgress ?? false,
|
|
388
|
+
accountReconEntity: accountRecon,
|
|
389
|
+
refreshStatus: excludedReconciliationRecord?.refreshStatus ?? defaultFetchState,
|
|
390
|
+
statementDeleteStatus: excludedReconciliationRecord?.statementDeleteStatus ??
|
|
391
|
+
defaultFetchState,
|
|
392
|
+
statementUpdateStatus: excludedReconciliationRecord?.statementUpdateStatus ??
|
|
393
|
+
defaultFetchState,
|
|
394
|
+
statementUploadStatus: excludedReconciliationRecord?.statementUploadStatus ??
|
|
395
|
+
defaultFetchState,
|
|
396
|
+
localData: excludedReconciliationRecord?.localData ?? {},
|
|
397
|
+
statementParseInProgress: excludedReconciliationRecord?.statementParseInProgress ?? false,
|
|
398
|
+
transactionFetchState: excludedReconciliationRecord?.transactionFetchState ??
|
|
399
|
+
defaultFetchState,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
376
402
|
});
|
|
377
403
|
const excludedAccountReconciliationBySectionID = {
|
|
378
404
|
assets: {
|
|
@@ -439,6 +465,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
439
465
|
statementUploadChosen: reconciliationViewState.statementUploadChosen,
|
|
440
466
|
monthYearPeriod: selectedPeriod,
|
|
441
467
|
accountReconciliationBySectionID,
|
|
468
|
+
excludedAccountReconciliationByAccountID: excludedReconList,
|
|
442
469
|
excludedAccountReconciliationBySectionID,
|
|
443
470
|
selectedAccountId: reconciliationViewState.selectedAccountId,
|
|
444
471
|
selectedReconAccount: reconciliationViewState.selectedAccountId != null &&
|
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-betaJK8",
|
|
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",
|