@zeniai/client-epic-state 5.2.14 → 5.2.16
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/accountRecon/accountReconReducer.d.ts +2 -1
- package/lib/entity/accountRecon/accountReconReducer.js +22 -10
- package/lib/entity/accountRecon/accountReconSelector.d.ts +1 -0
- package/lib/entity/accountRecon/accountReconSelector.js +1 -0
- package/lib/entity/approvalRule/approvalRuleConflict.d.ts +13 -0
- package/lib/entity/approvalRule/approvalRuleConflict.js +16 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +78 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +183 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +123 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +96 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +10 -1
- package/lib/epic.js +18 -0
- package/lib/esm/entity/accountRecon/accountReconReducer.js +22 -10
- package/lib/esm/entity/accountRecon/accountReconSelector.js +1 -0
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +16 -1
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +183 -5
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +86 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +18 -0
- package/lib/esm/index.js +16 -10
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +54 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +138 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +28 -0
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/helpers/reconciliationHelpers.js +12 -0
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +20 -2
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +327 -22
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
- package/lib/index.d.ts +18 -13
- package/lib/index.js +92 -47
- package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.d.ts +10 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +58 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +142 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +32 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +6 -0
- package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +13 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +4 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +6 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +22 -4
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +41 -7
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +335 -21
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +3 -0
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +3 -0
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
3
3
|
import { RootState } from '../../../../rootStateTypes';
|
|
4
4
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { confirmStatementMapping, confirmStatementMappingFailure, confirmStatementMappingSuccess } from '../../reducers/reconciliationViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof confirmStatementMapping> | ReturnType<typeof confirmStatementMappingSuccess> | ReturnType<typeof confirmStatementMappingFailure> | ReturnType<typeof openSnackbar>;
|
|
5
|
+
import { confirmStatementMapping, confirmStatementMappingFailure, confirmStatementMappingSuccess, fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof confirmStatementMapping> | ReturnType<typeof confirmStatementMappingSuccess> | ReturnType<typeof confirmStatementMappingFailure> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof openSnackbar>;
|
|
7
7
|
export declare const confirmStatementMappingEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
8
|
payload: {
|
|
9
9
|
messageSection: import("../../../..").SnackbarMessageSections;
|
|
@@ -31,4 +31,12 @@ export declare const confirmStatementMappingEpic: (actions$: ActionsObservable<A
|
|
|
31
31
|
mappingConflict?: import("../../types/reconciliationViewState").ConfirmStatementMappingConflict | null;
|
|
32
32
|
};
|
|
33
33
|
type: "expenseAutomationReconciliationView/confirmStatementMappingFailure";
|
|
34
|
+
} | {
|
|
35
|
+
payload: {
|
|
36
|
+
selectedPeriod: import("../../../..").MonthYearPeriod;
|
|
37
|
+
accountId: string | undefined;
|
|
38
|
+
cacheOverride: any;
|
|
39
|
+
refreshViewInBackground: any;
|
|
40
|
+
};
|
|
41
|
+
type: "expenseAutomationReconciliationView/fetchReconciliation";
|
|
34
42
|
}>;
|
|
@@ -42,7 +42,7 @@ const confirmStatementMappingEpic = (actions$, _state$, zeniAPI) => actions$.pip
|
|
|
42
42
|
accountId,
|
|
43
43
|
selectedPeriod,
|
|
44
44
|
statementUploads: (0, reconciliationPayload_1.transformConfirmStatementMappingPayloadToState)(response.data),
|
|
45
|
-
}));
|
|
45
|
+
}), (0, reconciliationViewReducer_1.fetchReconciliation)(selectedPeriod, undefined, true, true));
|
|
46
46
|
}
|
|
47
47
|
const mappingConflict = (0, reconciliationPayload_1.isConfirmStatementMappingConflictResponse)(response)
|
|
48
48
|
? (0, reconciliationPayload_1.transformConfirmStatementMappingConflictToState)(response)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateAccountReconDeleteStatement } from '../../../../entity/accountRecon/accountReconReducer';
|
|
4
|
+
import { removeFiles } from '../../../../entity/file/fileReducer';
|
|
5
|
+
import { RootState } from '../../../../rootStateTypes';
|
|
6
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
+
import { deleteAccountStatementFailure, deleteAccountStatementSuccess, deleteCombinedStatement, fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof deleteCombinedStatement> | ReturnType<typeof removeFiles> | ReturnType<typeof updateAccountReconDeleteStatement> | ReturnType<typeof deleteAccountStatementFailure> | ReturnType<typeof deleteAccountStatementSuccess> | ReturnType<typeof fetchReconciliation>;
|
|
9
|
+
export declare const deleteCombinedStatementEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteCombinedStatementEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
8
|
+
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
9
|
+
const fileReducer_1 = require("../../../../entity/file/fileReducer");
|
|
10
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
+
const reconciliationHelpers_1 = require("../../helpers/reconciliationHelpers");
|
|
12
|
+
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
13
|
+
const deleteCombinedStatementEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.deleteCombinedStatement.match), (0, operators_1.switchMap)((action) => {
|
|
14
|
+
const { accountId, selectedPeriod, fileId } = action.payload;
|
|
15
|
+
let combinedStatementGroupId = action.payload.combinedStatementGroupId;
|
|
16
|
+
if (combinedStatementGroupId === '') {
|
|
17
|
+
const accountRecon = state$.value.expenseAutomationReconciliationViewState
|
|
18
|
+
.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
|
|
19
|
+
combinedStatementGroupId =
|
|
20
|
+
(0, reconciliationHelpers_1.resolveCombinedStatementGroupId)(accountRecon);
|
|
21
|
+
}
|
|
22
|
+
if (combinedStatementGroupId === '') {
|
|
23
|
+
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.deleteAccountStatementFailure)({
|
|
24
|
+
accountId,
|
|
25
|
+
selectedPeriod,
|
|
26
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Missing Data', 'No combined statement group id found for delete'),
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
const deleteUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/2.0/statement-uploads/combined-statement-groups/${combinedStatementGroupId}`;
|
|
30
|
+
return zeniAPI
|
|
31
|
+
.deleteAndGetJSON(deleteUrl)
|
|
32
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
33
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) === true) {
|
|
34
|
+
const actions = [];
|
|
35
|
+
if (fileId != null && fileId !== '') {
|
|
36
|
+
actions.push((0, fileReducer_1.removeFiles)([fileId]));
|
|
37
|
+
}
|
|
38
|
+
if (response.data != null) {
|
|
39
|
+
actions.push((0, accountReconReducer_1.updateAccountReconDeleteStatement)((0, accountReconState_1.toAccountReconKey)(accountId, selectedPeriod), {
|
|
40
|
+
statement_upload: response.data.statement_upload,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
actions.push((0, reconciliationViewReducer_1.deleteAccountStatementSuccess)({ accountId, selectedPeriod }), (0, reconciliationViewReducer_1.fetchReconciliation)(selectedPeriod, undefined, true, true));
|
|
44
|
+
return (0, rxjs_1.of)(...actions);
|
|
45
|
+
}
|
|
46
|
+
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.deleteAccountStatementFailure)({
|
|
47
|
+
accountId,
|
|
48
|
+
selectedPeriod,
|
|
49
|
+
error: response.status,
|
|
50
|
+
}));
|
|
51
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.deleteAccountStatementFailure)({
|
|
52
|
+
accountId,
|
|
53
|
+
selectedPeriod,
|
|
54
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete Combined Statement REST API call errored out ' +
|
|
55
|
+
(error instanceof Error ? error.message : String(error))),
|
|
56
|
+
}))));
|
|
57
|
+
}));
|
|
58
|
+
exports.deleteCombinedStatementEpic = deleteCombinedStatementEpic;
|
|
@@ -60,7 +60,7 @@ const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
60
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)({
|
|
61
61
|
users: response.data.users ?? [],
|
|
62
62
|
updateType: 'merge',
|
|
63
|
-
}), (0, fileReducer_1.updateFiles)({ files: response.data.files ?? [] }), (0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'), (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, accountId == null));
|
|
64
64
|
const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)(response.data.reconciliation[0]?.transactions?.review ?? []);
|
|
65
65
|
if (accountId != null) {
|
|
66
66
|
const selectedTransactionIds = (0, saveReconciliationDetailEpic_1.getTransactionIdFromCheckedMatchedTransactionPayload)(response.data.reconciliation[0].transactions.reconcile);
|
package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js
CHANGED
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
8
|
const mapStatementUpdateLocalDataToRequestBody_1 = require("../../helpers/mapStatementUpdateLocalDataToRequestBody");
|
|
9
|
+
const reconciliationHelpers_1 = require("../../helpers/reconciliationHelpers");
|
|
9
10
|
const reconciliationPayload_1 = require("../../payload/reconciliationPayload");
|
|
10
11
|
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
11
12
|
const statementParseViewSelector_1 = require("../../selectors/statementParseViewSelector");
|
|
@@ -26,12 +27,8 @@ const updateCombinedStatementInfoEpic = (actions$, state$, zeniAPI) => actions$.
|
|
|
26
27
|
error: (0, responsePayload_1.createZeniAPIStatus)('Missing Data', 'No statement update data found for combined accounts'),
|
|
27
28
|
}));
|
|
28
29
|
}
|
|
29
|
-
const combinedStatementGroupId = accountRecon
|
|
30
|
-
|
|
31
|
-
.combinedStatementGroupId ??
|
|
32
|
-
parsedStatementData.statementUpload.combinedStatementDetails
|
|
33
|
-
?.combinedStatementGroupId;
|
|
34
|
-
if (combinedStatementGroupId == null || combinedStatementGroupId === '') {
|
|
30
|
+
const combinedStatementGroupId = (0, reconciliationHelpers_1.resolveCombinedStatementGroupId)(accountRecon);
|
|
31
|
+
if (combinedStatementGroupId === '') {
|
|
35
32
|
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.submitStatementUpdateFailure)({
|
|
36
33
|
accountId,
|
|
37
34
|
selectedPeriod,
|
|
@@ -11,6 +11,7 @@ const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer"
|
|
|
11
11
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
12
12
|
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
13
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
14
|
+
const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
14
15
|
const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
|
|
15
16
|
const { cacheOverride, refreshViewInBackground } = action.payload;
|
|
16
17
|
const state = state$.value;
|
|
@@ -62,14 +63,16 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
62
63
|
state.expenseAutomationFluxAnalysisViewState.groupsBySelectedPeriod[monthYearPeriodId] == null)) {
|
|
63
64
|
fetchActions.push((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null));
|
|
64
65
|
}
|
|
66
|
+
// The two JE tabs cache separately, so only the tab actually being shown decides whether a
|
|
67
|
+
// fetch is still needed.
|
|
68
|
+
const jeSchedulesPeriodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab, monthYearPeriodId);
|
|
65
69
|
if (state.expenseAutomationJESchedulesViewState.fetchState !==
|
|
66
70
|
'In-Progress' &&
|
|
67
71
|
(!state.expenseAutomationJESchedulesViewState.hasValidState() ||
|
|
68
72
|
state.expenseAutomationJESchedulesViewState
|
|
69
|
-
.
|
|
73
|
+
.jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
|
|
70
74
|
state.expenseAutomationJESchedulesViewState
|
|
71
|
-
.
|
|
72
|
-
null)) {
|
|
75
|
+
.failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
|
|
73
76
|
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
74
77
|
}
|
|
75
78
|
if (state.expenseAutomationReconciliationViewState.fetchState !==
|
|
@@ -17,7 +17,15 @@ const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
17
17
|
jeSchedulePageActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
18
18
|
}
|
|
19
19
|
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, refreshViewInBackground));
|
|
20
|
-
|
|
20
|
+
// Only on the first page load. Account settings cannot change from a tab switch or a
|
|
21
|
+
// refresh, and re-initializing puts accountSettingsView back to 'In-Progress' -- which the
|
|
22
|
+
// page reads as "still loading" and answers with a full skeleton over rows it already has.
|
|
23
|
+
// The action also resets localData, so re-dispatching it blindly would empty the settings
|
|
24
|
+
// form until the refetch lands. Saving account settings still re-initializes explicitly.
|
|
25
|
+
if (!state$.value.expenseAutomationJESchedulesViewState.accountSettings
|
|
26
|
+
.hasLoadedAccountSettings) {
|
|
27
|
+
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.initializeAccountSettingsView)());
|
|
28
|
+
}
|
|
21
29
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(jeSchedulePageActions));
|
|
22
30
|
}));
|
|
23
31
|
exports.fetchJeSchedulesPageEpic = fetchJeSchedulesPageEpic;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
3
|
+
import { updateAccruedJESchedules, updateAccruedJESchedulesDetails, updateJEOneTimeAccruals, updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
4
|
import { RootState } from '../../../../rootStateTypes';
|
|
5
|
+
import { clearAll } from '../../../../rootActions';
|
|
5
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
7
|
import { fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesSuccess, initializeJeScheduleLocalData } from '../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesFailure> | ReturnType<typeof fetchJeSchedulesSuccess> | ReturnType<typeof initializeJeScheduleLocalData> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails>;
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesFailure> | ReturnType<typeof fetchJeSchedulesSuccess> | ReturnType<typeof initializeJeScheduleLocalData> | ReturnType<typeof updateAccruedJESchedules> | ReturnType<typeof updateAccruedJESchedulesDetails> | ReturnType<typeof updateJEOneTimeAccruals> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails>;
|
|
8
9
|
export declare const fetchJeSchedulesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,9 +4,12 @@ exports.fetchJeSchedulesEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const timePeriod_2 = require("../../../../commonStateTypes/timePeriod");
|
|
7
8
|
const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
8
9
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
9
10
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
+
const rootActions_1 = require("../../../../rootActions");
|
|
12
|
+
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
10
13
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
11
14
|
const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedules.match), (0, operators_1.mergeMap)((action) => {
|
|
12
15
|
const state = state$.value;
|
|
@@ -14,27 +17,54 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
14
17
|
const { period, refreshViewInBackground } = action.payload;
|
|
15
18
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
16
19
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
20
|
+
const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
|
|
21
|
+
const isClosePeriodTab = selectedPageTab === 'schedules';
|
|
22
|
+
const existingEndDate = (0, timePeriod_2.toAbsoluteDay)((0, zeniDayJS_1.date)((0, timePeriod_2.toString)(period.start))
|
|
23
|
+
.subtract(1, 'month')
|
|
24
|
+
.endOf('month')
|
|
25
|
+
.format(timePeriod_1.DEFAULT_DATE_FORMAT));
|
|
17
26
|
const queryParam = {
|
|
18
|
-
start_date: (0,
|
|
19
|
-
end_date:
|
|
27
|
+
start_date: (0, timePeriod_2.toString)(period.start),
|
|
28
|
+
end_date: isClosePeriodTab || existingEndDate == null
|
|
29
|
+
? (0, timePeriod_2.toString)(period.end)
|
|
30
|
+
: (0, timePeriod_2.toString)(existingEndDate),
|
|
31
|
+
include_accrued: true,
|
|
32
|
+
...(isClosePeriodTab
|
|
33
|
+
? { close_period_start_date: (0, timePeriod_2.toString)(period.start) }
|
|
34
|
+
: {}),
|
|
20
35
|
};
|
|
21
36
|
return zeniAPI
|
|
22
37
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expenses_automation/je_schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
23
38
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
39
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
40
|
const updateActions = [];
|
|
41
|
+
const accruedJeSchedules = response.data.accrued_je_schedules?.je_schedules ?? [];
|
|
42
|
+
const oneTimeAccruals = response.data.one_time_accruals ?? [];
|
|
26
43
|
updateActions.push((0, jeSchedulesReducer_1.updateJESchedules)([
|
|
27
44
|
...response.data.je_schedules,
|
|
28
45
|
...response.data.failed_je_postings.je_schedules,
|
|
29
46
|
]), (0, jeSchedulesReducer_1.updateJESchedulesDetails)([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), (0, jeSchedulesViewReducer_1.initializeJeScheduleLocalData)([
|
|
30
47
|
...response.data.failed_je_postings.je_schedules,
|
|
31
48
|
]));
|
|
49
|
+
if (accruedJeSchedules.length > 0) {
|
|
50
|
+
updateActions.push((0, jeSchedulesReducer_1.updateAccruedJESchedules)(accruedJeSchedules), (0, jeSchedulesReducer_1.updateAccruedJESchedulesDetails)(accruedJeSchedules, response.data.accrued_je_schedules
|
|
51
|
+
?.scheduled_journal_entries));
|
|
52
|
+
}
|
|
53
|
+
if (oneTimeAccruals.length > 0) {
|
|
54
|
+
// Single action, unlike the accrued pair above: this one writes the entity
|
|
55
|
+
// directly because an accrual denormalizes its vendor, accounts and classes, so
|
|
56
|
+
// there is no fan-out fetch to trigger.
|
|
57
|
+
updateActions.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(oneTimeAccruals));
|
|
58
|
+
}
|
|
32
59
|
updateActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesSuccess)({
|
|
33
60
|
jeSchedules: [...response.data.je_schedules],
|
|
34
61
|
failedJeSchedules: [
|
|
35
62
|
...response.data.failed_je_postings.je_schedules,
|
|
36
63
|
],
|
|
64
|
+
accruedJeSchedules: accruedJeSchedules,
|
|
65
|
+
oneTimeAccruals: oneTimeAccruals,
|
|
37
66
|
selectedPeriod: selectedPeriod,
|
|
67
|
+
selectedPageTab: selectedPageTab,
|
|
38
68
|
refreshViewInBackground: refreshViewInBackground,
|
|
39
69
|
}));
|
|
40
70
|
return (0, rxjs_1.from)(updateActions);
|
|
@@ -43,12 +73,18 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
43
73
|
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesFailure)({
|
|
44
74
|
status: response.status,
|
|
45
75
|
selectedPeriod,
|
|
76
|
+
selectedPageTab,
|
|
46
77
|
}));
|
|
47
78
|
}
|
|
48
79
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesFailure)({
|
|
49
80
|
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch JE schedules REST API call errored out' +
|
|
50
81
|
JSON.stringify(error)),
|
|
51
82
|
selectedPeriod,
|
|
52
|
-
|
|
83
|
+
selectedPageTab,
|
|
84
|
+
}))),
|
|
85
|
+
// A tenant switch clears the store while this request is still in flight. Without this
|
|
86
|
+
// the old tenant's rows are written back into the freshly cleared store and stay on
|
|
87
|
+
// screen under the new tenant until a manual refresh.
|
|
88
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
53
89
|
}));
|
|
54
90
|
exports.fetchJeSchedulesEpic = fetchJeSchedulesEpic;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { clearAll } from '../../../../rootActions';
|
|
6
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
+
import { fetchOneTimeAccrual, fetchOneTimeAccrualFailure, fetchOneTimeAccrualSuccess } from '../../reducers/jeSchedulesViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchOneTimeAccrual> | ReturnType<typeof fetchOneTimeAccrualFailure> | ReturnType<typeof fetchOneTimeAccrualSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
|
|
9
|
+
/**
|
|
10
|
+
* Read one accrual by id so its detail page can render from a URL alone.
|
|
11
|
+
*
|
|
12
|
+
* Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
|
|
13
|
+
* to render only from what that list had already put in the store -- so opening its URL directly, on
|
|
14
|
+
* a refresh or a shared link, had nothing to render and showed not-found. This is the read that
|
|
15
|
+
* makes the URL self-sufficient.
|
|
16
|
+
*
|
|
17
|
+
* The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
|
|
18
|
+
* the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
|
|
19
|
+
* through the list holds.
|
|
20
|
+
*/
|
|
21
|
+
export declare const fetchOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchOneTimeAccrualEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const rootActions_1 = require("../../../../rootActions");
|
|
9
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
10
|
+
/**
|
|
11
|
+
* Read one accrual by id so its detail page can render from a URL alone.
|
|
12
|
+
*
|
|
13
|
+
* Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
|
|
14
|
+
* to render only from what that list had already put in the store -- so opening its URL directly, on
|
|
15
|
+
* a refresh or a shared link, had nothing to render and showed not-found. This is the read that
|
|
16
|
+
* makes the URL self-sufficient.
|
|
17
|
+
*
|
|
18
|
+
* The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
|
|
19
|
+
* the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
|
|
20
|
+
* through the list holds.
|
|
21
|
+
*/
|
|
22
|
+
const fetchOneTimeAccrualEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
|
|
23
|
+
const { accrualId } = action.payload;
|
|
24
|
+
return zeniAPI
|
|
25
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`)
|
|
26
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
+
return (0, rxjs_1.from)([
|
|
29
|
+
(0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
|
|
30
|
+
(0, jeSchedulesViewReducer_1.fetchOneTimeAccrualSuccess)({ accrualId }),
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
// A deleted or ignored accrual answers 404 here, the same as an id that never existed.
|
|
34
|
+
// Both end as an error state the page turns into not-found, rather than a spinner that
|
|
35
|
+
// never resolves.
|
|
36
|
+
return (0, rxjs_1.from)([
|
|
37
|
+
(0, jeSchedulesViewReducer_1.fetchOneTimeAccrualFailure)({ accrualId, status: response.status }),
|
|
38
|
+
]);
|
|
39
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
40
|
+
(0, jeSchedulesViewReducer_1.fetchOneTimeAccrualFailure)({
|
|
41
|
+
accrualId,
|
|
42
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Fetch one-time accrual REST API call errored out ${JSON.stringify(error)}`),
|
|
43
|
+
}),
|
|
44
|
+
])),
|
|
45
|
+
// A tenant switch clears the store while this request is in flight. Without this the old
|
|
46
|
+
// tenant's accrual is written back into the freshly cleared store.
|
|
47
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
48
|
+
}));
|
|
49
|
+
exports.fetchOneTimeAccrualEpic = fetchOneTimeAccrualEpic;
|
|
@@ -14,13 +14,25 @@ const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer"
|
|
|
14
14
|
const ignoreRecommendedJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.ignoreRecommendedJeSchedule.match), (0, operators_1.mergeMap)((action) => {
|
|
15
15
|
const state = state$.value;
|
|
16
16
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
17
|
-
const { scheduleType, jeScheduleTransactionKey } = action.payload;
|
|
17
|
+
const { scheduleType, jeScheduleTransactionKey, reason, note } = action.payload;
|
|
18
18
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
19
19
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
20
20
|
const actions = [];
|
|
21
21
|
const jeScheduleTransactionState = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleTransactionKey, state);
|
|
22
|
+
const ignorePayload = (0, jeSchedulesPayload_1.prepareIgnoreSchedulePayload)(scheduleType, jeScheduleTransactionState, state);
|
|
23
|
+
// The gateway reads reason/note from je_schedules[0].feedback and nowhere else, and rejects
|
|
24
|
+
// anything but those two keys inside it — `action` is stamped server-side.
|
|
22
25
|
const payload = {
|
|
23
|
-
...
|
|
26
|
+
...ignorePayload,
|
|
27
|
+
je_schedules: ignorePayload.je_schedules.map((schedule, index) => index === 0
|
|
28
|
+
? {
|
|
29
|
+
...schedule,
|
|
30
|
+
feedback: {
|
|
31
|
+
reason,
|
|
32
|
+
...(note != null && note !== '' ? { note } : {}),
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
: schedule),
|
|
24
36
|
};
|
|
25
37
|
const queryParam = {
|
|
26
38
|
je_schedule_type: scheduleType,
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { updateJEOneTimeAccruals } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
3
|
+
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { RootState } from '../../../../../reducer';
|
|
5
|
+
import { clearAll } from '../../../../../rootActions';
|
|
6
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
7
|
+
import { createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedules } from '../../../reducers/jeSchedulesViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof createOneTimeAccrual> | ReturnType<typeof createOneTimeAccrualSuccess> | ReturnType<typeof createOneTimeAccrualFailure> | ReturnType<typeof updateJEOneTimeAccruals> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof openSnackbar>;
|
|
9
|
+
export declare const createOneTimeAccrualEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOneTimeAccrualEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const timePeriod_1 = require("../../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const jeSchedulesReducer_1 = require("../../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
|
|
10
|
+
const rootActions_1 = require("../../../../../rootActions");
|
|
11
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
12
|
+
const jeSchedulesPayload_1 = require("../../../payload/jeSchedulesPayload");
|
|
13
|
+
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
14
|
+
const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.createOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
|
|
15
|
+
const state = state$.value;
|
|
16
|
+
const { localData } = action.payload;
|
|
17
|
+
/*
|
|
18
|
+
* Idempotency for the create. agent-je dedupes on this: the same key again returns the
|
|
19
|
+
* existing accrual rather than posting a second JE to QBO.
|
|
20
|
+
*
|
|
21
|
+
* Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
|
|
22
|
+
* call (2026-08-24). The header cannot reach the service from a browser -- common's
|
|
23
|
+
* Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
|
|
24
|
+
* request. Same meaning either way; the header simply wins when both are sent.
|
|
25
|
+
*
|
|
26
|
+
* Minted here, per create action, and deliberately not held in local data or the form: a new
|
|
27
|
+
* Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
|
|
28
|
+
* retries today -- if a retry operator is ever added below, it has to sit inside this
|
|
29
|
+
* mergeMap so the key is not re-minted, or the guarantee is silently lost.
|
|
30
|
+
*/
|
|
31
|
+
const requestId = crypto.randomUUID();
|
|
32
|
+
const payload = {
|
|
33
|
+
...(0, jeSchedulesPayload_1.prepareCreateOneTimeAccrualPayload)(state, localData),
|
|
34
|
+
request_id: requestId,
|
|
35
|
+
};
|
|
36
|
+
// convertToPeriod destructures, so an unset period would throw here and take the epic
|
|
37
|
+
// subscription down for the whole session — a missed refresh is the cheaper failure.
|
|
38
|
+
const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
|
|
39
|
+
const selectedPeriod = selectedMonthYear != null
|
|
40
|
+
? (0, timePeriod_1.convertToPeriod)(selectedMonthYear)
|
|
41
|
+
: undefined;
|
|
42
|
+
const periodStart = selectedPeriod != null
|
|
43
|
+
? (0, timePeriod_1.toAbsoluteDay)(selectedPeriod.start)
|
|
44
|
+
: undefined;
|
|
45
|
+
const periodEnd = selectedPeriod != null ? (0, timePeriod_1.toAbsoluteDay)(selectedPeriod.end) : undefined;
|
|
46
|
+
return zeniAPI
|
|
47
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals`, payload)
|
|
48
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
49
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
50
|
+
const successActions = [
|
|
51
|
+
(0, jeSchedulesReducer_1.updateJEOneTimeAccruals)([response.data.accrual]),
|
|
52
|
+
(0, jeSchedulesViewReducer_1.createOneTimeAccrualSuccess)(),
|
|
53
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
54
|
+
messageSection: 'create_schedule',
|
|
55
|
+
messageText: 'success',
|
|
56
|
+
type: 'success',
|
|
57
|
+
variables: [
|
|
58
|
+
{
|
|
59
|
+
variableName: '_vendor_name_',
|
|
60
|
+
variableValue: localData.vendorName,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
];
|
|
65
|
+
// The tab buckets (jeScheduleOneTimeAccrualKeysByPeriodAndTab) are rebuilt wholesale
|
|
66
|
+
// per fetch, and the backend decides whether a freshly posted accrual belongs to
|
|
67
|
+
// Review or Existing — so refetch rather than guess which bucket to insert into.
|
|
68
|
+
if (periodStart != null && periodEnd != null) {
|
|
69
|
+
successActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)({ start: periodStart, end: periodEnd }, true));
|
|
70
|
+
}
|
|
71
|
+
return (0, rxjs_1.from)(successActions);
|
|
72
|
+
}
|
|
73
|
+
return (0, rxjs_1.from)([
|
|
74
|
+
(0, jeSchedulesViewReducer_1.createOneTimeAccrualFailure)({ status: response.status }),
|
|
75
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
76
|
+
messageSection: 'create_schedule',
|
|
77
|
+
messageText: 'failed',
|
|
78
|
+
type: 'error',
|
|
79
|
+
variables: [
|
|
80
|
+
{
|
|
81
|
+
variableName: '_api-error_',
|
|
82
|
+
variableValue: response.status.message,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
}),
|
|
86
|
+
]);
|
|
87
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
88
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
89
|
+
messageSection: 'create_schedule',
|
|
90
|
+
messageText: 'failed',
|
|
91
|
+
type: 'error',
|
|
92
|
+
variables: [
|
|
93
|
+
{
|
|
94
|
+
variableName: '_api-error_',
|
|
95
|
+
variableValue: JSON.stringify(error),
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
}),
|
|
99
|
+
(0, jeSchedulesViewReducer_1.createOneTimeAccrualFailure)({
|
|
100
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create One Time Accrual REST API call errored out ${JSON.stringify(error)}`),
|
|
101
|
+
}),
|
|
102
|
+
])),
|
|
103
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
104
|
+
// Without this the old tenant's response is written back into the freshly
|
|
105
|
+
// cleared store and stays on screen under the new tenant.
|
|
106
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
107
|
+
}));
|
|
108
|
+
exports.createOneTimeAccrualEpic = createOneTimeAccrualEpic;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { fetchAccountList } from '../../../../accountList/accountListReducer';
|
|
5
|
+
import { fetchClassList } from '../../../../classList/classListReducer';
|
|
6
|
+
import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof clearSearchTransactionsForNewSchedule> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof initializeNewSchedule> | ReturnType<typeof resetNewScheduleLocalData>;
|
|
8
|
+
export declare const initializeNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initializeNewScheduleEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const accountListReducer_1 = require("../../../../accountList/accountListReducer");
|
|
7
|
+
const classListReducer_1 = require("../../../../classList/classListReducer");
|
|
8
|
+
const scheduleListHelper_1 = require("../../../../scheduleView/scheduleListView/scheduleListHelper");
|
|
9
|
+
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
10
|
+
const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.initializeNewSchedule.match), (0, operators_1.mergeMap)((action) => {
|
|
11
|
+
const newScheduleActions = [];
|
|
12
|
+
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
13
|
+
const { accountListState, classListState } = state$.value;
|
|
14
|
+
if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
|
|
15
|
+
'Not-Started') {
|
|
16
|
+
newScheduleActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
17
|
+
}
|
|
18
|
+
if (classListState.fetchState === 'Not-Started') {
|
|
19
|
+
newScheduleActions.push((0, classListReducer_1.fetchClassList)());
|
|
20
|
+
}
|
|
21
|
+
// The account and class fetches above are idempotent (both guard on 'Not-Started'), so they
|
|
22
|
+
// can run on every open. Clearing what the user entered cannot, so it is opt-in.
|
|
23
|
+
if (action.payload.shouldResetEnteredData) {
|
|
24
|
+
newScheduleActions.push((0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType: action.payload.scheduleType }));
|
|
25
|
+
newScheduleActions.push((0, jeSchedulesViewReducer_1.clearSearchTransactionsForNewSchedule)());
|
|
26
|
+
}
|
|
27
|
+
return (0, rxjs_1.from)(newScheduleActions);
|
|
28
|
+
}));
|
|
29
|
+
exports.initializeNewScheduleEpic = initializeNewScheduleEpic;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { clearAll } from '../../../../../rootActions';
|
|
3
|
+
import { updateJESchedules, updateJESchedulesDetails } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
+
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
+
import { RootState } from '../../../../../reducer';
|
|
6
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
7
|
+
import { fetchJeSchedules, resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess } from '../../../reducers/jeSchedulesViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof saveNewSchedule> | ReturnType<typeof saveNewScheduleSuccess> | ReturnType<typeof saveNewScheduleFailure> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof resetNewScheduleLocalData> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof clearAll> | ReturnType<typeof openSnackbar>;
|
|
9
|
+
export declare const saveNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|