@zeniai/client-epic-state 5.1.37 → 5.1.38
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/index.js +3 -2
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +5 -3
- package/lib/esm/view/expenseAutomationView/helpers/mapStatementUpdateLocalDataToRequestBody.js +32 -0
- package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +1 -0
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +163 -21
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +30 -26
- package/lib/esm/view/expenseAutomationView/selectors/statementParseViewSelector.js +295 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +44 -38
- package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +4 -2
- package/lib/view/expenseAutomationView/helpers/mapStatementUpdateLocalDataToRequestBody.d.ts +2 -0
- package/lib/view/expenseAutomationView/helpers/mapStatementUpdateLocalDataToRequestBody.js +36 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +1 -0
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +14 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +165 -23
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +10 -2
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +30 -26
- package/lib/view/expenseAutomationView/selectors/statementParseViewSelector.d.ts +25 -0
- package/lib/view/expenseAutomationView/selectors/statementParseViewSelector.js +313 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +52 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.updateNodeCollapseState = exports.updateStatementUploadChosen = exports.clearStatementDateConflict = exports.submitStatementUpdateFailure = exports.submitStatementUpdateSuccess = void 0;
|
|
4
|
+
exports.updateParsedStatementData = exports.resetReparseStatementStatus = exports.reparseStatementFailure = exports.reparseStatementSuccess = exports.reparseStatement = exports.parseStatementFailure = exports.parseStatementSuccess = exports.parseStatement = exports.uploadAccountStatementFailure = exports.uploadAccountStatementSuccess = exports.uploadAccountStatement = exports.includeAccountInReconciliationFailure = exports.includeAccountInReconciliationSuccess = exports.includeAccountInReconciliation = exports.excludeAccountFromReconciliationFailure = exports.excludeAccountFromReconciliationSuccess = exports.excludeAccountFromReconciliation = exports.deleteAccountStatementFailure = exports.deleteAccountStatementSuccess = exports.deleteAccountStatement = exports.updateAccountReconciliationLocalData = exports.updateReconListScrollPosition = exports.updateSaveReconciliationReviewFetchStatus = exports.saveReconciliationReview = exports.updateReviewTabLocalData = exports.initializeReconciliationReviewTabLocalData = exports.updateReviewTabSortState = exports.updateStatementProcessingFailed = exports.updateSelectedDrawerAccountId = exports.clearExpenseAutomationReconciliationView = exports.initialiseLocalDataForSelectedAccountId = exports.updateBalancesLocalData = exports.updateSelectedTab = exports.saveReconciliationDetailSuccess = exports.updateReconcileTabListScrollState = exports.updateReconcileTabListSortState = exports.updateReconcileTabLocalData = exports.updateStatementProcessingBackgroundCompletedSteps = exports.setStatementProcessingDismissedToBackground = exports.setStatementParseInProgress = exports.setConnectionInProgressForAccount = exports.updateSelectedAccountId = exports.saveReconciliationDetailFailure = exports.saveReconciliationDetail = exports.fetchReconciliationSuccess = exports.fetchReconciliationFailure = exports.fetchReconciliation = exports.initialState = exports.initialActionFetchState = exports.initialReconciliationTabsState = void 0;
|
|
5
|
+
exports.updateNodeCollapseState = exports.updateStatementUploadChosen = exports.clearStatementDateConflict = exports.submitStatementUpdateFailure = exports.submitStatementUpdateSuccess = exports.submitStatementUpdate = exports.updateStatementUpdateLocalData = void 0;
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
8
8
|
const accountState_1 = require("../../../entity/account/accountState");
|
|
@@ -73,7 +73,6 @@ exports.initialState = {
|
|
|
73
73
|
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
74
74
|
actionFetchState: exports.initialActionFetchState,
|
|
75
75
|
selectedAccountId: undefined,
|
|
76
|
-
statementProcessingFailed: false,
|
|
77
76
|
statementUploadChosen: false,
|
|
78
77
|
reconListUIState: {
|
|
79
78
|
nodeCollapseState: {},
|
|
@@ -296,8 +295,19 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
296
295
|
draft.selectedDrawerAccountId = action.payload.selectedDrawerAccountId;
|
|
297
296
|
},
|
|
298
297
|
updateStatementProcessingFailed: (draft, action) => {
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
const { accountId, selectedPeriod, statementProcessingFailed } = action.payload;
|
|
299
|
+
const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
300
|
+
if (accountRecon == null) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
accountRecon.statementProcessingFailed = statementProcessingFailed;
|
|
304
|
+
if (statementProcessingFailed === true) {
|
|
305
|
+
accountRecon.statementProcessingDismissedToBackground = false;
|
|
306
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = 0;
|
|
307
|
+
accountRecon.statementProcessingStartedAtMs = undefined;
|
|
308
|
+
accountRecon.statementProcessingTotalDurationSeconds = undefined;
|
|
309
|
+
accountRecon.statementParseInProgress = false;
|
|
310
|
+
}
|
|
301
311
|
},
|
|
302
312
|
initialiseLocalDataForSelectedAccountId: () => { },
|
|
303
313
|
updateSelectedTab: (draft, action) => {
|
|
@@ -388,6 +398,41 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
388
398
|
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress =
|
|
389
399
|
statementParseInProgress;
|
|
390
400
|
},
|
|
401
|
+
setStatementProcessingDismissedToBackground: (draft, action) => {
|
|
402
|
+
const { accountId, selectedPeriod, dismissedToBackground } = action.payload;
|
|
403
|
+
const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
404
|
+
if (accountRecon != null) {
|
|
405
|
+
accountRecon.statementProcessingDismissedToBackground =
|
|
406
|
+
dismissedToBackground;
|
|
407
|
+
if (dismissedToBackground === true) {
|
|
408
|
+
accountRecon.statementProcessingBackgroundCompletedSteps =
|
|
409
|
+
action.payload.backgroundCompletedSteps ??
|
|
410
|
+
accountRecon.statementProcessingBackgroundCompletedSteps;
|
|
411
|
+
if (action.payload.startedAtMs != null) {
|
|
412
|
+
accountRecon.statementProcessingStartedAtMs =
|
|
413
|
+
action.payload.startedAtMs;
|
|
414
|
+
}
|
|
415
|
+
if (action.payload.totalDurationSeconds != null) {
|
|
416
|
+
accountRecon.statementProcessingTotalDurationSeconds =
|
|
417
|
+
action.payload.totalDurationSeconds;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
updateStatementProcessingBackgroundCompletedSteps: (draft, action) => {
|
|
423
|
+
const { accountId, selectedPeriod, backgroundCompletedSteps } = action.payload;
|
|
424
|
+
const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
425
|
+
if (accountRecon != null) {
|
|
426
|
+
if (backgroundCompletedSteps === 0) {
|
|
427
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = 0;
|
|
428
|
+
accountRecon.statementProcessingStartedAtMs = undefined;
|
|
429
|
+
accountRecon.statementProcessingTotalDurationSeconds = undefined;
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = Math.max(accountRecon.statementProcessingBackgroundCompletedSteps ?? 0, backgroundCompletedSteps);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
},
|
|
391
436
|
uploadAccountStatement: (draft, action) => {
|
|
392
437
|
const { accountId, selectedPeriod } = action.payload;
|
|
393
438
|
const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
@@ -401,6 +446,15 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
401
446
|
fetchState: 'Not-Started',
|
|
402
447
|
error: undefined,
|
|
403
448
|
};
|
|
449
|
+
accountRecon.statementUpdateStatus = {
|
|
450
|
+
fetchState: 'Not-Started',
|
|
451
|
+
error: undefined,
|
|
452
|
+
};
|
|
453
|
+
accountRecon.statementProcessingDismissedToBackground = false;
|
|
454
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = 0;
|
|
455
|
+
accountRecon.statementProcessingStartedAtMs = undefined;
|
|
456
|
+
accountRecon.statementProcessingTotalDurationSeconds = undefined;
|
|
457
|
+
accountRecon.statementProcessingFailed = false;
|
|
404
458
|
accountRecon.reparseStatementStatus = {
|
|
405
459
|
fetchState: 'Not-Started',
|
|
406
460
|
error: undefined,
|
|
@@ -431,10 +485,22 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
431
485
|
},
|
|
432
486
|
deleteAccountStatementSuccess: (draft, action) => {
|
|
433
487
|
const { accountId, selectedPeriod } = action.payload;
|
|
434
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
488
|
+
const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
489
|
+
if (accountRecon != null) {
|
|
490
|
+
accountRecon.statementDeleteStatus = {
|
|
491
|
+
fetchState: 'Completed',
|
|
492
|
+
error: undefined,
|
|
493
|
+
};
|
|
494
|
+
accountRecon.parsedStatementData = undefined;
|
|
495
|
+
accountRecon.statementProcessingDismissedToBackground = false;
|
|
496
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = 0;
|
|
497
|
+
accountRecon.statementProcessingStartedAtMs = undefined;
|
|
498
|
+
accountRecon.statementProcessingTotalDurationSeconds = undefined;
|
|
499
|
+
accountRecon.statementUpdateStatus = {
|
|
500
|
+
fetchState: 'Not-Started',
|
|
501
|
+
error: undefined,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
438
504
|
},
|
|
439
505
|
deleteAccountStatementFailure: (draft, action) => {
|
|
440
506
|
const { accountId, selectedPeriod } = action.payload;
|
|
@@ -461,7 +527,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
461
527
|
error: undefined,
|
|
462
528
|
};
|
|
463
529
|
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
|
|
464
|
-
draft.statementProcessingFailed = false;
|
|
530
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = false;
|
|
465
531
|
},
|
|
466
532
|
parseStatementFailure: (draft, action) => {
|
|
467
533
|
const { accountId, selectedPeriod } = action.payload;
|
|
@@ -470,7 +536,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
470
536
|
error: action.payload.error,
|
|
471
537
|
};
|
|
472
538
|
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
|
|
473
|
-
draft.statementProcessingFailed = true;
|
|
539
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = true;
|
|
474
540
|
},
|
|
475
541
|
reparseStatement: (draft, action) => {
|
|
476
542
|
const { accountId, selectedPeriod } = action.payload;
|
|
@@ -485,21 +551,38 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
485
551
|
fetchState: 'Not-Started',
|
|
486
552
|
error: undefined,
|
|
487
553
|
};
|
|
488
|
-
accountRecon.
|
|
554
|
+
accountRecon.statementUpdateStatus = {
|
|
555
|
+
fetchState: 'Not-Started',
|
|
556
|
+
error: undefined,
|
|
557
|
+
};
|
|
558
|
+
accountRecon.statementProcessingDismissedToBackground = false;
|
|
559
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = 0;
|
|
560
|
+
accountRecon.statementProcessingStartedAtMs = undefined;
|
|
561
|
+
accountRecon.statementProcessingTotalDurationSeconds = undefined;
|
|
562
|
+
accountRecon.statementProcessingFailed = false;
|
|
563
|
+
accountRecon.statementParseInProgress = true;
|
|
489
564
|
}
|
|
490
565
|
},
|
|
491
566
|
reparseStatementSuccess: (draft, action) => {
|
|
492
567
|
const { accountId, selectedPeriod } = action.payload;
|
|
493
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]
|
|
568
|
+
const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
569
|
+
if (accountRecon == null) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
accountRecon.reparseStatementStatus = {
|
|
494
573
|
fetchState: 'Completed',
|
|
495
574
|
error: undefined,
|
|
496
575
|
};
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
576
|
+
const parseFetchState = accountRecon.statementParseStatus.fetchState;
|
|
577
|
+
if (parseFetchState !== 'In-Progress' &&
|
|
578
|
+
parseFetchState !== 'Completed') {
|
|
579
|
+
accountRecon.statementParseStatus = {
|
|
580
|
+
fetchState: 'Not-Started',
|
|
581
|
+
error: undefined,
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
accountRecon.statementParseInProgress = true;
|
|
585
|
+
accountRecon.statementProcessingFailed = false;
|
|
503
586
|
},
|
|
504
587
|
reparseStatementFailure: (draft, action) => {
|
|
505
588
|
const { accountId, selectedPeriod } = action.payload;
|
|
@@ -507,7 +590,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
507
590
|
fetchState: 'Error',
|
|
508
591
|
error: action.payload.error,
|
|
509
592
|
};
|
|
510
|
-
draft.statementProcessingFailed = true;
|
|
593
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = true;
|
|
511
594
|
},
|
|
512
595
|
resetReparseStatementStatus: (draft, action) => {
|
|
513
596
|
const { accountId, selectedPeriod } = action.payload;
|
|
@@ -557,6 +640,10 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
557
640
|
error: undefined,
|
|
558
641
|
};
|
|
559
642
|
accountRecon.statementDateConflict = null;
|
|
643
|
+
accountRecon.statementProcessingDismissedToBackground = false;
|
|
644
|
+
accountRecon.statementProcessingBackgroundCompletedSteps = 0;
|
|
645
|
+
accountRecon.statementProcessingStartedAtMs = undefined;
|
|
646
|
+
accountRecon.statementProcessingTotalDurationSeconds = undefined;
|
|
560
647
|
if (accountRecon.localData != null) {
|
|
561
648
|
accountRecon.localData.statementUpdateLocalData = undefined;
|
|
562
649
|
}
|
|
@@ -685,9 +772,56 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
685
772
|
},
|
|
686
773
|
});
|
|
687
774
|
// Export actions
|
|
688
|
-
_a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.setStatementParseInProgress = _a.setStatementParseInProgress, exports.updateReconcileTabLocalData = _a.updateReconcileTabLocalData, exports.updateReconcileTabListSortState = _a.updateReconcileTabListSortState, exports.updateReconcileTabListScrollState = _a.updateReconcileTabListScrollState, exports.saveReconciliationDetailSuccess = _a.saveReconciliationDetailSuccess, exports.updateSelectedTab = _a.updateSelectedTab, exports.updateBalancesLocalData = _a.updateBalancesLocalData, exports.initialiseLocalDataForSelectedAccountId = _a.initialiseLocalDataForSelectedAccountId, exports.clearExpenseAutomationReconciliationView = _a.clearExpenseAutomationReconciliationView, exports.updateSelectedDrawerAccountId = _a.updateSelectedDrawerAccountId, exports.updateStatementProcessingFailed = _a.updateStatementProcessingFailed, exports.updateReviewTabSortState = _a.updateReviewTabSortState, exports.initializeReconciliationReviewTabLocalData = _a.initializeReconciliationReviewTabLocalData, exports.updateReviewTabLocalData = _a.updateReviewTabLocalData, exports.saveReconciliationReview = _a.saveReconciliationReview, exports.updateSaveReconciliationReviewFetchStatus = _a.updateSaveReconciliationReviewFetchStatus, exports.updateReconListScrollPosition = _a.updateReconListScrollPosition, exports.updateAccountReconciliationLocalData = _a.updateAccountReconciliationLocalData, exports.deleteAccountStatement = _a.deleteAccountStatement, exports.deleteAccountStatementSuccess = _a.deleteAccountStatementSuccess, exports.deleteAccountStatementFailure = _a.deleteAccountStatementFailure, exports.excludeAccountFromReconciliation = _a.excludeAccountFromReconciliation, exports.excludeAccountFromReconciliationSuccess = _a.excludeAccountFromReconciliationSuccess, exports.excludeAccountFromReconciliationFailure = _a.excludeAccountFromReconciliationFailure, exports.includeAccountInReconciliation = _a.includeAccountInReconciliation, exports.includeAccountInReconciliationSuccess = _a.includeAccountInReconciliationSuccess, exports.includeAccountInReconciliationFailure = _a.includeAccountInReconciliationFailure, exports.uploadAccountStatement = _a.uploadAccountStatement, exports.uploadAccountStatementSuccess = _a.uploadAccountStatementSuccess, exports.uploadAccountStatementFailure = _a.uploadAccountStatementFailure, exports.parseStatement = _a.parseStatement, exports.parseStatementSuccess = _a.parseStatementSuccess, exports.parseStatementFailure = _a.parseStatementFailure, exports.reparseStatement = _a.reparseStatement, exports.reparseStatementSuccess = _a.reparseStatementSuccess, exports.reparseStatementFailure = _a.reparseStatementFailure, exports.resetReparseStatementStatus = _a.resetReparseStatementStatus, exports.updateParsedStatementData = _a.updateParsedStatementData, exports.updateStatementUpdateLocalData = _a.updateStatementUpdateLocalData, exports.submitStatementUpdate = _a.submitStatementUpdate, exports.submitStatementUpdateSuccess = _a.submitStatementUpdateSuccess, exports.submitStatementUpdateFailure = _a.submitStatementUpdateFailure, exports.clearStatementDateConflict = _a.clearStatementDateConflict, exports.updateStatementUploadChosen = _a.updateStatementUploadChosen, exports.updateNodeCollapseState = _a.updateNodeCollapseState;
|
|
775
|
+
_a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.setStatementParseInProgress = _a.setStatementParseInProgress, exports.setStatementProcessingDismissedToBackground = _a.setStatementProcessingDismissedToBackground, exports.updateStatementProcessingBackgroundCompletedSteps = _a.updateStatementProcessingBackgroundCompletedSteps, exports.updateReconcileTabLocalData = _a.updateReconcileTabLocalData, exports.updateReconcileTabListSortState = _a.updateReconcileTabListSortState, exports.updateReconcileTabListScrollState = _a.updateReconcileTabListScrollState, exports.saveReconciliationDetailSuccess = _a.saveReconciliationDetailSuccess, exports.updateSelectedTab = _a.updateSelectedTab, exports.updateBalancesLocalData = _a.updateBalancesLocalData, exports.initialiseLocalDataForSelectedAccountId = _a.initialiseLocalDataForSelectedAccountId, exports.clearExpenseAutomationReconciliationView = _a.clearExpenseAutomationReconciliationView, exports.updateSelectedDrawerAccountId = _a.updateSelectedDrawerAccountId, exports.updateStatementProcessingFailed = _a.updateStatementProcessingFailed, exports.updateReviewTabSortState = _a.updateReviewTabSortState, exports.initializeReconciliationReviewTabLocalData = _a.initializeReconciliationReviewTabLocalData, exports.updateReviewTabLocalData = _a.updateReviewTabLocalData, exports.saveReconciliationReview = _a.saveReconciliationReview, exports.updateSaveReconciliationReviewFetchStatus = _a.updateSaveReconciliationReviewFetchStatus, exports.updateReconListScrollPosition = _a.updateReconListScrollPosition, exports.updateAccountReconciliationLocalData = _a.updateAccountReconciliationLocalData, exports.deleteAccountStatement = _a.deleteAccountStatement, exports.deleteAccountStatementSuccess = _a.deleteAccountStatementSuccess, exports.deleteAccountStatementFailure = _a.deleteAccountStatementFailure, exports.excludeAccountFromReconciliation = _a.excludeAccountFromReconciliation, exports.excludeAccountFromReconciliationSuccess = _a.excludeAccountFromReconciliationSuccess, exports.excludeAccountFromReconciliationFailure = _a.excludeAccountFromReconciliationFailure, exports.includeAccountInReconciliation = _a.includeAccountInReconciliation, exports.includeAccountInReconciliationSuccess = _a.includeAccountInReconciliationSuccess, exports.includeAccountInReconciliationFailure = _a.includeAccountInReconciliationFailure, exports.uploadAccountStatement = _a.uploadAccountStatement, exports.uploadAccountStatementSuccess = _a.uploadAccountStatementSuccess, exports.uploadAccountStatementFailure = _a.uploadAccountStatementFailure, exports.parseStatement = _a.parseStatement, exports.parseStatementSuccess = _a.parseStatementSuccess, exports.parseStatementFailure = _a.parseStatementFailure, exports.reparseStatement = _a.reparseStatement, exports.reparseStatementSuccess = _a.reparseStatementSuccess, exports.reparseStatementFailure = _a.reparseStatementFailure, exports.resetReparseStatementStatus = _a.resetReparseStatementStatus, exports.updateParsedStatementData = _a.updateParsedStatementData, exports.updateStatementUpdateLocalData = _a.updateStatementUpdateLocalData, exports.submitStatementUpdate = _a.submitStatementUpdate, exports.submitStatementUpdateSuccess = _a.submitStatementUpdateSuccess, exports.submitStatementUpdateFailure = _a.submitStatementUpdateFailure, exports.clearStatementDateConflict = _a.clearStatementDateConflict, exports.updateStatementUploadChosen = _a.updateStatementUploadChosen, exports.updateNodeCollapseState = _a.updateNodeCollapseState;
|
|
689
776
|
// Export reducer
|
|
690
777
|
exports.default = expenseAutomationReconciliationView.reducer;
|
|
778
|
+
function isEntityStatementParsing(reconciliation) {
|
|
779
|
+
return reconciliation.statement_data_status?.code === 'parsing';
|
|
780
|
+
}
|
|
781
|
+
function resolveStatementParseInProgressAfterFetch(oldRecord, reconciliation) {
|
|
782
|
+
if (isEntityStatementParsing(reconciliation)) {
|
|
783
|
+
return true;
|
|
784
|
+
}
|
|
785
|
+
if (oldRecord?.statementParseInProgress === true) {
|
|
786
|
+
return true;
|
|
787
|
+
}
|
|
788
|
+
if (oldRecord?.statementParseStatus.fetchState === 'In-Progress') {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
if (oldRecord?.reparseStatementStatus.fetchState === 'In-Progress') {
|
|
792
|
+
return true;
|
|
793
|
+
}
|
|
794
|
+
if (oldRecord?.statementUploadStatus.fetchState === 'In-Progress') {
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
// Reparse POST returned; async parse may not be on entity yet.
|
|
798
|
+
if (oldRecord?.reparseStatementStatus.fetchState === 'Completed' &&
|
|
799
|
+
oldRecord.statementParseStatus.fetchState !== 'Completed' &&
|
|
800
|
+
oldRecord.statementParseStatus.fetchState !== 'Error') {
|
|
801
|
+
return true;
|
|
802
|
+
}
|
|
803
|
+
// Continue-in-background while parse flow has not finished.
|
|
804
|
+
if (oldRecord?.statementProcessingDismissedToBackground === true &&
|
|
805
|
+
oldRecord.statementParseStatus.fetchState !== 'Completed' &&
|
|
806
|
+
oldRecord.statementParseStatus.fetchState !== 'Error' &&
|
|
807
|
+
(oldRecord.statementProcessingBackgroundCompletedSteps ?? 0) > 0) {
|
|
808
|
+
return true;
|
|
809
|
+
}
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
function preserveStatementUploadStatusAfterFetch(oldRecord) {
|
|
813
|
+
const oldUploadStatus = oldRecord?.statementUploadStatus;
|
|
814
|
+
if (oldUploadStatus?.fetchState === 'In-Progress') {
|
|
815
|
+
return oldUploadStatus;
|
|
816
|
+
}
|
|
817
|
+
const parseFetchState = oldRecord?.statementParseStatus.fetchState;
|
|
818
|
+
if (oldUploadStatus?.fetchState === 'Completed' &&
|
|
819
|
+
parseFetchState !== 'Completed' &&
|
|
820
|
+
parseFetchState !== 'Error') {
|
|
821
|
+
return oldUploadStatus;
|
|
822
|
+
}
|
|
823
|
+
return { fetchState: 'Not-Started', error: undefined };
|
|
824
|
+
}
|
|
691
825
|
function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground, excludedAccounts, summary) {
|
|
692
826
|
draft.excludedAccountIDs = excludedAccounts.map((ea) => ea.account_id);
|
|
693
827
|
draft.excludedAccountExclusionInfo = {};
|
|
@@ -748,12 +882,17 @@ function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliation
|
|
|
748
882
|
transactionFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
749
883
|
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
750
884
|
statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
|
|
751
|
-
statementUploadStatus:
|
|
885
|
+
statementUploadStatus: preserveStatementUploadStatusAfterFetch(oldRecord),
|
|
752
886
|
statementUpdateStatus: oldRecord?.statementUpdateStatus ?? {
|
|
753
887
|
fetchState: 'Not-Started',
|
|
754
888
|
error: undefined,
|
|
755
889
|
},
|
|
756
|
-
statementParseInProgress: reconciliation
|
|
890
|
+
statementParseInProgress: resolveStatementParseInProgressAfterFetch(oldRecord, reconciliation),
|
|
891
|
+
statementProcessingDismissedToBackground: oldRecord?.statementProcessingDismissedToBackground ?? false,
|
|
892
|
+
statementProcessingBackgroundCompletedSteps: oldRecord?.statementProcessingBackgroundCompletedSteps ?? 0,
|
|
893
|
+
statementProcessingStartedAtMs: oldRecord?.statementProcessingStartedAtMs,
|
|
894
|
+
statementProcessingTotalDurationSeconds: oldRecord?.statementProcessingTotalDurationSeconds,
|
|
895
|
+
statementProcessingFailed: oldRecord?.statementProcessingFailed ?? false,
|
|
757
896
|
statementParseStatus: oldRecord?.statementParseStatus ?? {
|
|
758
897
|
fetchState: 'Not-Started',
|
|
759
898
|
error: undefined,
|
|
@@ -857,6 +996,9 @@ const updateReconciliationByAccountIDOnIncludeAccount = (draft, accountId, recon
|
|
|
857
996
|
statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
|
|
858
997
|
statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
859
998
|
statementParseInProgress: reconciliation.bank_status.code === 'parsing',
|
|
999
|
+
statementProcessingDismissedToBackground: false,
|
|
1000
|
+
statementProcessingBackgroundCompletedSteps: 0,
|
|
1001
|
+
statementProcessingFailed: false,
|
|
860
1002
|
statementParseStatus: { fetchState: 'Not-Started', error: undefined },
|
|
861
1003
|
reparseStatementStatus: { fetchState: 'Not-Started', error: undefined },
|
|
862
1004
|
statementDateConflict: null,
|
|
@@ -9,7 +9,7 @@ import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconSta
|
|
|
9
9
|
import { ClassBase } from '../../../entity/class/classState';
|
|
10
10
|
import { Vendor } from '../../../entity/vendor/vendorState';
|
|
11
11
|
import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
|
|
12
|
-
import { AccountReconciliationLocalData, ActionFetchStates, ParsedStatementData, ReconListUIState, ReconciliationTabsState, ReconciliationViewSummary, ReconciliationViewTabType, StatementDateConflict } from '../types/reconciliationViewState';
|
|
12
|
+
import { AccountReconciliationLocalData, ActionFetchStates, ParsedStatementData, ReconListUIState, ReconciliationTabsState, ReconciliationViewSummary, ReconciliationViewTabType, StatementDateConflict, StatementTransaction } from '../types/reconciliationViewState';
|
|
13
13
|
export declare const ALL_ACCOUNT_RECON_SECTION_IDS: readonly ["assets", "liabilities"];
|
|
14
14
|
export declare const toAccountReconSectionID: (v: string) => "assets" | "liabilities";
|
|
15
15
|
export type AccountReconSectionID = ReturnType<typeof toAccountReconSectionID>;
|
|
@@ -37,7 +37,6 @@ export interface ExpenseAutomationReconciliationViewSelector {
|
|
|
37
37
|
refreshStatus: FetchStateAndError;
|
|
38
38
|
reviewTabSelectedVendorByTransactionId: Record<ID, Vendor>;
|
|
39
39
|
selectedTab: ReconciliationViewTabType;
|
|
40
|
-
statementProcessingFailed: boolean;
|
|
41
40
|
statementUploadChosen: boolean;
|
|
42
41
|
selectedAccountId?: ID;
|
|
43
42
|
selectedDrawerAccountId?: ID;
|
|
@@ -64,10 +63,19 @@ export interface AccountReconciliationByAccount {
|
|
|
64
63
|
statementDeleteStatus: FetchStateAndError;
|
|
65
64
|
statementParseInProgress: boolean;
|
|
66
65
|
statementParseStatus: FetchStateAndError;
|
|
66
|
+
statementProcessingBackgroundCompletedSteps: number;
|
|
67
|
+
statementProcessingDismissedToBackground: boolean;
|
|
68
|
+
statementProcessingFailed: boolean;
|
|
67
69
|
statementUpdateStatus: FetchStateAndError;
|
|
68
70
|
statementUploadStatus: FetchStateAndError;
|
|
69
71
|
transactionFetchState: FetchStateAndError;
|
|
70
72
|
accountDetectionReason?: string;
|
|
73
|
+
/** Unfiltered parsed transactions for PDF citation highlights. */
|
|
74
|
+
allCitationTransactions?: StatementTransaction[];
|
|
71
75
|
parsedStatementData?: ParsedStatementData;
|
|
72
76
|
paymentAccountId?: ID;
|
|
77
|
+
statementProcessingStartedAtMs?: number;
|
|
78
|
+
statementProcessingTotalDurationSeconds?: number;
|
|
79
|
+
/** Whether each parsed transaction falls in the effective statement period. */
|
|
80
|
+
statementTransactionPeriodById?: Record<string, boolean>;
|
|
73
81
|
}
|
|
@@ -19,6 +19,7 @@ const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
|
19
19
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
20
20
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
21
21
|
const reconciliationViewReducer_1 = require("../reducers/reconciliationViewReducer");
|
|
22
|
+
const statementParseViewSelector_1 = require("./statementParseViewSelector");
|
|
22
23
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
23
24
|
exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((state) => state, (state) => (0, tenantSelector_1.getCurrentTenant)(state), (state) => state.expenseAutomationReconciliationViewState, (state) => state.expenseAutomationViewState, (state) => state.plaidAccountViewState, (state) => state.accountListState, (state) => state.accountState, (state) => state.classListState, (state) => state.classState, (state) => state.monthEndCloseChecksState, (state) => state.vendorState, (state) => state.monthEndCloseChecksViewState, (state, currentTenant, reconciliationViewState, expenseAutomationViewState, plaidAccountViewState, accountListState, accountState, classListState, classState, monthEndCloseChecksState, vendorState, monthEndCloseChecksViewState) => {
|
|
24
25
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
@@ -83,7 +84,6 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
83
84
|
selectedTab: reconciliationViewState.selectedTab,
|
|
84
85
|
monthYearPeriod: selectedPeriod,
|
|
85
86
|
selectedAccountId: reconciliationViewState.selectedAccountId,
|
|
86
|
-
statementProcessingFailed: reconciliationViewState.statementProcessingFailed,
|
|
87
87
|
statementUploadChosen: reconciliationViewState.statementUploadChosen,
|
|
88
88
|
accountReconciliationsByAccountID: {},
|
|
89
89
|
reconciliationTabsState: reconciliationViewReducer_1.initialReconciliationTabsState,
|
|
@@ -249,38 +249,40 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
249
249
|
liabilityTotals.varianceTotal = total.varianceTotal;
|
|
250
250
|
liabilityTotals.variancePercentage = total.variancePercentage;
|
|
251
251
|
}
|
|
252
|
+
const accountReconState = accountReconForMonthYearPeriod.reconciliationByAccountID[accountID];
|
|
253
|
+
const rawParsedStatementData = accountReconState.parsedStatementData;
|
|
254
|
+
const statementUpdateLocalData = accountReconState.localData?.statementUpdateLocalData;
|
|
255
|
+
const parsedStatementDataForView = (0, statementParseViewSelector_1.getParsedStatementDataForView)(rawParsedStatementData, statementUpdateLocalData);
|
|
252
256
|
reconList[accountID] = {
|
|
253
257
|
accountConnectionStatus: accountConnectionStatus.status,
|
|
254
258
|
paymentAccountId: accountConnectionStatus.paymentAccountId,
|
|
255
259
|
connectionInProgress: accountConnectionStatus.connectionInProgress,
|
|
256
260
|
accountReconEntity: accountRecon,
|
|
257
|
-
refreshStatus:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
.
|
|
275
|
-
|
|
276
|
-
|
|
261
|
+
refreshStatus: accountReconState.refreshStatus,
|
|
262
|
+
statementDeleteStatus: accountReconState.statementDeleteStatus,
|
|
263
|
+
statementParseStatus: accountReconState.statementParseStatus,
|
|
264
|
+
reparseStatementStatus: accountReconState.reparseStatementStatus,
|
|
265
|
+
statementDateConflict: accountReconState.statementDateConflict,
|
|
266
|
+
statementUpdateStatus: accountReconState.statementUpdateStatus,
|
|
267
|
+
statementUploadStatus: accountReconState.statementUploadStatus,
|
|
268
|
+
localData: accountReconState.localData,
|
|
269
|
+
statementParseInProgress: accountReconState.statementParseInProgress,
|
|
270
|
+
statementProcessingDismissedToBackground: accountReconState.statementProcessingDismissedToBackground,
|
|
271
|
+
statementProcessingBackgroundCompletedSteps: accountReconState.statementProcessingBackgroundCompletedSteps,
|
|
272
|
+
statementProcessingStartedAtMs: accountReconState.statementProcessingStartedAtMs,
|
|
273
|
+
statementProcessingTotalDurationSeconds: accountReconState.statementProcessingTotalDurationSeconds,
|
|
274
|
+
statementProcessingFailed: accountReconState.statementProcessingFailed,
|
|
275
|
+
parsedStatementData: parsedStatementDataForView,
|
|
276
|
+
allCitationTransactions: rawParsedStatementData?.statementUpload?.statementTransactions,
|
|
277
|
+
statementTransactionPeriodById: rawParsedStatementData?.statementUpload != null
|
|
278
|
+
? (0, statementParseViewSelector_1.getStatementTransactionPeriodById)(rawParsedStatementData.statementUpload.statementTransactions, rawParsedStatementData.statementUpload.statementMeta, accountReconState.localData?.statementUpdateLocalData
|
|
279
|
+
?.statementMeta)
|
|
280
|
+
: undefined,
|
|
277
281
|
transactionFetchState: (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
278
|
-
|
|
279
|
-
.transactionFetchState,
|
|
282
|
+
accountReconState.transactionFetchState,
|
|
280
283
|
accountListState.byReportId.accountList,
|
|
281
284
|
]),
|
|
282
|
-
accountDetectionReason:
|
|
283
|
-
.accountDetectionReason,
|
|
285
|
+
accountDetectionReason: accountReconState.accountDetectionReason,
|
|
284
286
|
};
|
|
285
287
|
});
|
|
286
288
|
const accountReconciliationBySectionID = {
|
|
@@ -348,6 +350,9 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
348
350
|
localData: {},
|
|
349
351
|
connectionInProgress: false,
|
|
350
352
|
statementParseInProgress: false,
|
|
353
|
+
statementProcessingDismissedToBackground: false,
|
|
354
|
+
statementProcessingBackgroundCompletedSteps: 0,
|
|
355
|
+
statementProcessingFailed: false,
|
|
351
356
|
accountConnectionStatus: 'not_connected',
|
|
352
357
|
transactionFetchState: { fetchState: 'Not-Started' },
|
|
353
358
|
accountReconEntity: {
|
|
@@ -433,7 +438,6 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
433
438
|
refreshStatus: reconciliationViewState.refreshStatus,
|
|
434
439
|
selectedTab: reconciliationViewState.selectedTab,
|
|
435
440
|
selectedDrawerAccountId: reconciliationViewState.selectedDrawerAccountId,
|
|
436
|
-
statementProcessingFailed: reconciliationViewState.statementProcessingFailed,
|
|
437
441
|
statementUploadChosen: reconciliationViewState.statementUploadChosen,
|
|
438
442
|
monthYearPeriod: selectedPeriod,
|
|
439
443
|
accountReconciliationBySectionID,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApplyStatementParseFormChangeInput, ApplyStatementParseFormChangeResult, GetStatementParseFormViewInput, ParsedStatementData, StatementMeta, StatementParseFormView, StatementParseManualBalanceField, StatementTransaction, StatementUpdateLocalData, ToStatementUpdateLocalDataFromFormViewInput } from '../types/reconciliationViewState';
|
|
2
|
+
export interface StatementPeriod {
|
|
3
|
+
statementEndDate: string;
|
|
4
|
+
statementStartDate: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const getEffectiveStatementPeriod: (parsedMeta: StatementMeta, localMeta: StatementMeta | undefined) => StatementPeriod;
|
|
7
|
+
export declare const isStatementTransactionInPeriod: (transactionDate: string, statementStartDate: string, statementEndDate: string) => boolean;
|
|
8
|
+
export declare const filterStatementTransactionsByPeriod: (transactions: StatementTransaction[], statementPeriod: StatementPeriod) => StatementTransaction[];
|
|
9
|
+
export declare const getParsedStatementDataForView: (parsedStatementData: ParsedStatementData | undefined, statementUpdateLocalData: StatementUpdateLocalData | undefined) => ParsedStatementData | undefined;
|
|
10
|
+
export declare const getStatementTransactionPeriodById: (allParsedTransactions: StatementTransaction[], parsedMeta: StatementMeta, localMeta: StatementMeta | undefined) => Record<string, boolean>;
|
|
11
|
+
export declare const getDateFilteredDeletedTransactionIds: (allParsedTransactions: StatementTransaction[], statementPeriod: StatementPeriod) => string[];
|
|
12
|
+
export declare const isStatementParseTransactionFieldChange: (changedField: string | undefined) => boolean;
|
|
13
|
+
export declare const isStatementParseManualBalanceField: (field: string | undefined) => field is StatementParseManualBalanceField;
|
|
14
|
+
export declare const shouldRecalculateStatementParseBalances: (changedField: string | undefined) => boolean;
|
|
15
|
+
export declare const resolveStatementParseBalanceFields: (formView: StatementParseFormView, changedField: string | undefined) => {
|
|
16
|
+
closingBalance: number;
|
|
17
|
+
openingBalance: number;
|
|
18
|
+
totalDeposits: number;
|
|
19
|
+
totalPayments: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const areStatementParseBalancesConsistent: (formView: StatementParseFormView) => boolean;
|
|
22
|
+
export declare const mergeStatementParseDeletedTransactionIds: (originalTransactions: StatementTransaction[], statementPeriod: StatementPeriod, currentTransactionIds: Set<string>) => string[];
|
|
23
|
+
export declare const getStatementParseFormView: ({ parsedStatementMeta, originalTransactions, statementUpdateLocalData, }: GetStatementParseFormViewInput) => StatementParseFormView;
|
|
24
|
+
export declare const toStatementUpdateLocalDataFromFormView: ({ formView, parsedStatementMeta, originalTransactions, changedField, }: ToStatementUpdateLocalDataFromFormViewInput) => StatementUpdateLocalData;
|
|
25
|
+
export declare const applyStatementParseFormChange: ({ formView, changedField, parsedStatementMeta, originalTransactions, }: ApplyStatementParseFormChangeInput) => ApplyStatementParseFormChangeResult;
|