@zeniai/client-epic-state 4.20.4 → 4.20.6
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/commonStateTypes/coaBalance/additionalBalances/getSummationBalance.d.ts +1 -1
- package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +0 -2
- package/lib/commonStateTypes/coaBalance/coaBalanceType.js +0 -6
- package/lib/commonStateTypes/currencyHelper.d.ts +0 -3
- package/lib/commonStateTypes/currencyHelper.js +1 -6
- package/lib/commonStateTypes/reduceFetchState.d.ts +0 -9
- package/lib/commonStateTypes/reduceFetchState.js +0 -26
- package/lib/entity/account/accountPayload.d.ts +0 -2
- package/lib/entity/account/accountPayload.js +0 -2
- package/lib/entity/account/accountState.d.ts +0 -2
- package/lib/entity/customer/customerState.d.ts +2 -0
- package/lib/entity/customer/customerState.js +5 -0
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +1 -8
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +0 -2
- package/lib/entity/reimbursement/reimbursementPayload.js +0 -7
- package/lib/entity/reimbursement/reimbursementState.d.ts +0 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/entity/task/taskPayload.d.ts +0 -1
- package/lib/entity/task/taskPayload.js +0 -1
- package/lib/entity/task/taskState.d.ts +0 -1
- package/lib/epic.d.ts +1 -12
- package/lib/epic.js +1 -12
- package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +0 -5
- package/lib/esm/commonStateTypes/currencyHelper.js +0 -5
- package/lib/esm/commonStateTypes/reduceFetchState.js +0 -25
- package/lib/esm/entity/account/accountPayload.js +0 -2
- package/lib/esm/entity/customer/customerState.js +4 -1
- package/lib/esm/entity/depositAccount/depositAccount.js +1 -8
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +0 -7
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/entity/task/taskPayload.js +0 -1
- package/lib/esm/epic.js +1 -12
- package/lib/esm/index.js +10 -19
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +1 -189
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -433
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -23
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +1 -244
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -44
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +1 -2
- package/lib/esm/view/financeStatement/financeStatementReducer.js +8 -11
- package/lib/esm/view/financeStatement/financeStatementSelector.js +9 -24
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +1 -6
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +29 -2
- package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +5 -7
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +7 -9
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +1 -3
- package/lib/esm/view/twoFactorAuthentication/resendOtpEpic.js +16 -2
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +0 -11
- package/lib/esm/zeniAPI.js +2 -0
- package/lib/index.d.ts +12 -20
- package/lib/index.js +34 -94
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +0 -118
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -201
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +3 -76
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -434
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -11
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -24
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -69
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -243
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -142
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -54
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -2
- package/lib/view/financeStatement/financeStatementReducer.js +8 -11
- package/lib/view/financeStatement/financeStatementSelector.d.ts +0 -2
- package/lib/view/financeStatement/financeStatementSelector.js +9 -24
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +2 -4
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +2 -7
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +29 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +0 -4
- package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +5 -7
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +6 -8
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +0 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +0 -2
- package/lib/view/taskManager/taskListView/taskListSelector.js +1 -3
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +1 -1
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +15 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +1 -3
- package/lib/view/userListView/fetchUserListByTypeEpic.js +0 -11
- package/lib/view/userListView/userListViewPayload.d.ts +0 -2
- package/lib/zeniAPI.js +2 -0
- package/package.json +3 -3
- package/lib/entity/userGroups/userGroupsPayload.d.ts +0 -7
- package/lib/entity/userGroups/userGroupsPayload.js +0 -10
- package/lib/entity/userGroups/userGroupsReducer.d.ts +0 -8
- package/lib/entity/userGroups/userGroupsReducer.js +0 -29
- package/lib/entity/userGroups/userGroupsSelector.d.ts +0 -4
- package/lib/entity/userGroups/userGroupsSelector.js +0 -12
- package/lib/entity/userGroups/userGroupsState.d.ts +0 -9
- package/lib/entity/userGroups/userGroupsState.js +0 -2
- package/lib/esm/entity/userGroups/userGroupsPayload.js +0 -7
- package/lib/esm/entity/userGroups/userGroupsReducer.js +0 -25
- package/lib/esm/entity/userGroups/userGroupsSelector.js +0 -8
- package/lib/esm/entity/userGroups/userGroupsState.js +0 -1
- package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +0 -10
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -29
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -49
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -40
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -47
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -61
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -33
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -56
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -77
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -24
- package/lib/esm/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +0 -17
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -331
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +0 -9
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -262
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +0 -65
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +0 -16
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +0 -1
- package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +0 -10
- package/lib/view/expenseAutomationView/bulkUploadTiming.js +0 -13
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +0 -18
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -33
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -53
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -44
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -51
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -65
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -37
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -61
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -14
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -81
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +0 -25
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -85
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -28
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.d.ts +0 -9
- package/lib/view/profitAndLossClassesView/horizontalSectionEmptyBalancesSlice.js +0 -20
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +0 -15
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -335
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +0 -111
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +0 -13
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +0 -6
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -265
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +0 -23
- package/lib/view/userGroupListView/userGroupListViewReducer.js +0 -69
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +0 -7
- package/lib/view/userGroupListView/userGroupListViewSelector.js +0 -20
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +0 -8
- package/lib/view/userGroupListView/userGroupListViewState.js +0 -2
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* After upload API success, hold the bar at 100% this long before transitioning to matching,
|
|
3
|
-
* so the fill animation can complete without an abrupt swap to the auto-matching banner.
|
|
4
|
-
*/
|
|
5
|
-
export declare const BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = 400;
|
|
6
|
-
/**
|
|
7
|
-
* Max wall-clock wait for Pusher + batch-details resolution after upload. If exceeded, we stop
|
|
8
|
-
* fallback polling, clear the automatching banner (`phase` → completed), and refresh batch list.
|
|
9
|
-
*/
|
|
10
|
-
export declare const BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = 300000;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = exports.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* After upload API success, hold the bar at 100% this long before transitioning to matching,
|
|
6
|
-
* so the fill animation can complete without an abrupt swap to the auto-matching banner.
|
|
7
|
-
*/
|
|
8
|
-
exports.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = 400;
|
|
9
|
-
/**
|
|
10
|
-
* Max wall-clock wait for Pusher + batch-details resolution after upload. If exceeded, we stop
|
|
11
|
-
* fallback polling, clear the automatching banner (`phase` → completed), and refresh batch list.
|
|
12
|
-
*/
|
|
13
|
-
exports.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = 300000;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
2
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
3
|
-
import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
4
|
-
export type ActionType = ReturnType<typeof bulkUploadReceipts> | ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof bulkUploadReceiptsFailure>;
|
|
5
|
-
export declare const bulkUploadReceiptsEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
6
|
-
payload: {
|
|
7
|
-
batchId: import("../../../..").ID;
|
|
8
|
-
};
|
|
9
|
-
type: "expenseAutomationMissingReceiptsView/bulkUploadReceiptsSuccess";
|
|
10
|
-
} | {
|
|
11
|
-
payload: {
|
|
12
|
-
error: import("../../../../responsePayload").ZeniAPIStatus;
|
|
13
|
-
};
|
|
14
|
-
type: "expenseAutomationMissingReceiptsView/bulkUploadReceiptsFailure";
|
|
15
|
-
} | {
|
|
16
|
-
payload: number;
|
|
17
|
-
type: "expenseAutomationMissingReceiptsView/updateBulkUploadProgress";
|
|
18
|
-
}>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bulkUploadReceiptsEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
-
const bulkUploadTiming_1 = require("../../bulkUploadTiming");
|
|
8
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
-
const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceipts.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
-
const { files } = action.payload;
|
|
11
|
-
const formData = new FormData();
|
|
12
|
-
for (const file of files) {
|
|
13
|
-
formData.append('files', file, file.name);
|
|
14
|
-
}
|
|
15
|
-
return zeniAPI
|
|
16
|
-
.postFormData(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`, formData)
|
|
17
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
-
const batchId = String(response.data.batch_id ?? '').trim();
|
|
20
|
-
if (batchId === '') {
|
|
21
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.bulkUploadReceiptsFailure)({
|
|
22
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Bulk upload succeeded but batch_id was missing or empty.'),
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
return (0, rxjs_1.concat)((0, rxjs_1.of)((0, missingReceiptsViewReducer_1.updateBulkUploadProgress)(100)), (0, rxjs_1.timer)(bulkUploadTiming_1.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS).pipe((0, operators_1.mergeMap)(() => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess)({ batchId })))));
|
|
26
|
-
}
|
|
27
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.bulkUploadReceiptsFailure)({ error: response.status }));
|
|
28
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.bulkUploadReceiptsFailure)({
|
|
29
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Bulk upload receipts API call errored out: ' +
|
|
30
|
-
JSON.stringify(error)),
|
|
31
|
-
}))));
|
|
32
|
-
}));
|
|
33
|
-
exports.bulkUploadReceiptsEpic = bulkUploadReceiptsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof confirmBulkUploadMatch> | ReturnType<typeof confirmBulkUploadMatchSuccess> | ReturnType<typeof confirmBulkUploadMatchFailure> | ReturnType<typeof openSnackbar>;
|
|
7
|
-
export declare const confirmBulkUploadMatchEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.confirmBulkUploadMatchEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
-
const confirmBulkUploadMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.confirmBulkUploadMatch.match), (0, operators_1.exhaustMap)((action) => {
|
|
10
|
-
const { batchId, attachmentId, transactionId, transactionType, fileName } = action.payload;
|
|
11
|
-
return zeniAPI
|
|
12
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/manual-match`, {
|
|
13
|
-
attachment_id: attachmentId,
|
|
14
|
-
transaction_id: transactionId,
|
|
15
|
-
transaction_type: transactionType,
|
|
16
|
-
file_name: fileName,
|
|
17
|
-
})
|
|
18
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
19
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
20
|
-
return (0, rxjs_1.from)([
|
|
21
|
-
(0, missingReceiptsViewReducer_1.confirmBulkUploadMatchSuccess)({
|
|
22
|
-
batchId,
|
|
23
|
-
attachmentId,
|
|
24
|
-
transactionId,
|
|
25
|
-
}),
|
|
26
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
27
|
-
messageSection: 'receipt_match',
|
|
28
|
-
messageText: 'success',
|
|
29
|
-
type: 'success',
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
}
|
|
33
|
-
return (0, rxjs_1.from)([
|
|
34
|
-
(0, missingReceiptsViewReducer_1.confirmBulkUploadMatchFailure)({ error: response.status }),
|
|
35
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
36
|
-
messageSection: 'receipt_match',
|
|
37
|
-
messageText: 'failed',
|
|
38
|
-
type: 'error',
|
|
39
|
-
}),
|
|
40
|
-
]);
|
|
41
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
42
|
-
(0, missingReceiptsViewReducer_1.confirmBulkUploadMatchFailure)({
|
|
43
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Confirm bulk upload match errored out: ' +
|
|
44
|
-
JSON.stringify(error)),
|
|
45
|
-
}),
|
|
46
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
47
|
-
messageSection: 'receipt_match',
|
|
48
|
-
messageText: 'failed',
|
|
49
|
-
type: 'error',
|
|
50
|
-
}),
|
|
51
|
-
])));
|
|
52
|
-
}));
|
|
53
|
-
exports.confirmBulkUploadMatchEpic = confirmBulkUploadMatchEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof updateTransactions> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatchDetailsFailure> | ReturnType<typeof fetchBulkUploadBatches>;
|
|
8
|
-
export declare const fetchBulkUploadBatchDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchBulkUploadBatchDetailsEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
9
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
10
|
-
const fetchBulkUploadBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails.match), (0, operators_1.mergeMap)(() => {
|
|
11
|
-
const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
12
|
-
const { currentBatchId } = bulkUpload;
|
|
13
|
-
if (currentBatchId == null) {
|
|
14
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsFailure)({
|
|
15
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'No current batch ID available'),
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
if (!(0, missingReceiptsPayload_1.shouldFetchBatchDetailsForBatchId)(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentBatchId)) {
|
|
19
|
-
return rxjs_1.EMPTY;
|
|
20
|
-
}
|
|
21
|
-
return zeniAPI
|
|
22
|
-
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${currentBatchId}`)
|
|
23
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
|
-
if (!(0, responsePayload_1.isSuccessResponse)(response) ||
|
|
25
|
-
response.data == null ||
|
|
26
|
-
!(0, missingReceiptsPayload_1.isBatchDetailsApiStatusCompleted)(response.data.status)) {
|
|
27
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
-
return rxjs_1.EMPTY;
|
|
29
|
-
}
|
|
30
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsFailure)({ error: response.status }));
|
|
31
|
-
}
|
|
32
|
-
const actions = [];
|
|
33
|
-
const transactionPayloads = (0, missingReceiptsPayload_1.extractTransactionPayloadsFromBatchFiles)(response.data.files);
|
|
34
|
-
if (transactionPayloads.length > 0) {
|
|
35
|
-
actions.push((0, transactionReducer_1.updateTransactions)(transactionPayloads, (value) => value.transaction_id));
|
|
36
|
-
}
|
|
37
|
-
actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
38
|
-
actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }));
|
|
39
|
-
return (0, rxjs_1.from)(actions);
|
|
40
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsFailure)({
|
|
41
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)),
|
|
42
|
-
}))));
|
|
43
|
-
}));
|
|
44
|
-
exports.fetchBulkUploadBatchDetailsEpic = fetchBulkUploadBatchDetailsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof fetchBulkUploadBatchesFailure>;
|
|
7
|
-
export declare const fetchBulkUploadBatchesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchBulkUploadBatchesEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
10
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
-
const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatches.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { cacheOverride } = action.payload;
|
|
13
|
-
const state = state$.value;
|
|
14
|
-
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
15
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
16
|
-
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
17
|
-
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
18
|
-
const existingBatches = bulkUpload.batchListByPeriod[periodId] ?? [];
|
|
19
|
-
if (cacheOverride !== true && existingBatches.length > 0) {
|
|
20
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess)({
|
|
21
|
-
batchList: existingBatches,
|
|
22
|
-
selectedPeriod,
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
26
|
-
const queryParam = {
|
|
27
|
-
start_date: period.start,
|
|
28
|
-
end_date: period.end,
|
|
29
|
-
sort_order: 'desc',
|
|
30
|
-
};
|
|
31
|
-
return zeniAPI
|
|
32
|
-
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
33
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
34
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
35
|
-
/** Full list (all statuses) for UI; batch-details epics filter to `completed` only. */
|
|
36
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess)({
|
|
37
|
-
batchList: response.data.batches.map(missingReceiptsPayload_1.toBatchListItem),
|
|
38
|
-
selectedPeriod,
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesFailure)({
|
|
42
|
-
error: response.status,
|
|
43
|
-
selectedPeriod,
|
|
44
|
-
}));
|
|
45
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesFailure)({
|
|
46
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch bulk upload batches errored out: ' +
|
|
47
|
-
JSON.stringify(error)),
|
|
48
|
-
selectedPeriod,
|
|
49
|
-
}))));
|
|
50
|
-
}));
|
|
51
|
-
exports.fetchBulkUploadBatchesEpic = fetchBulkUploadBatchesEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchCompletedTransactions> | ReturnType<typeof updateTransactions> | ReturnType<typeof fetchCompletedTransactionsSuccess> | ReturnType<typeof fetchCompletedTransactionsFailure>;
|
|
8
|
-
export declare const fetchCompletedTransactionsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchCompletedTransactionsEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
9
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
10
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
-
const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchCompletedTransactions.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const state = state$.value;
|
|
13
|
-
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
14
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
15
|
-
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
16
|
-
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
17
|
-
const isInitialLoad = action.payload.pageToken == null;
|
|
18
|
-
const cacheKey = (0, missingReceiptsViewReducer_1.getCompletedTransactionsCacheKey)(periodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab);
|
|
19
|
-
const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
20
|
-
if (isInitialLoad &&
|
|
21
|
-
action.payload.cacheOverride !== true &&
|
|
22
|
-
existingData != null &&
|
|
23
|
-
existingData.transactionIds.length > 0) {
|
|
24
|
-
return (0, rxjs_1.from)([]);
|
|
25
|
-
}
|
|
26
|
-
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
27
|
-
const queryPayload = {
|
|
28
|
-
start_date: period.start,
|
|
29
|
-
end_date: period.end,
|
|
30
|
-
sort_by: bulkUpload.sortKey,
|
|
31
|
-
sort_order: bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
32
|
-
page_token: action.payload.pageToken ?? null,
|
|
33
|
-
page_size: 25,
|
|
34
|
-
};
|
|
35
|
-
if (bulkUpload.completedSubTab !== 'all') {
|
|
36
|
-
queryPayload.match_type = bulkUpload.completedSubTab;
|
|
37
|
-
}
|
|
38
|
-
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
39
|
-
return zeniAPI
|
|
40
|
-
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipt-agent/transactions/completed?query=${encodedQuery}`)
|
|
41
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
42
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
43
|
-
const transactionIds = response.data.transactions.map((t) => t.transaction_id);
|
|
44
|
-
const updateActions = [];
|
|
45
|
-
updateActions.push((0, transactionReducer_1.updateTransactions)(response.data.transactions, (value) => value.transaction_id));
|
|
46
|
-
updateActions.push((0, missingReceiptsViewReducer_1.fetchCompletedTransactionsSuccess)({
|
|
47
|
-
isInitialLoad,
|
|
48
|
-
transactionIds,
|
|
49
|
-
nextPageToken: response.data.next_page_token,
|
|
50
|
-
totalCount: response.data.total_count,
|
|
51
|
-
selectedPeriod,
|
|
52
|
-
}));
|
|
53
|
-
return (0, rxjs_1.from)(updateActions);
|
|
54
|
-
}
|
|
55
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchCompletedTransactionsFailure)({
|
|
56
|
-
error: response.status,
|
|
57
|
-
selectedPeriod,
|
|
58
|
-
}));
|
|
59
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchCompletedTransactionsFailure)({
|
|
60
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch completed transactions errored: ' +
|
|
61
|
-
JSON.stringify(error)),
|
|
62
|
-
selectedPeriod,
|
|
63
|
-
}))));
|
|
64
|
-
}));
|
|
65
|
-
exports.fetchCompletedTransactionsEpic = fetchCompletedTransactionsEpic;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { batchDetailFetchFailed, fetchBulkUploadBatchDetails, fetchBulkUploadBatchesSuccess, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, setInitialBatchDetailsLoading, storeBatchDetails } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof fetchMoreBatchDetails> | ReturnType<typeof fetchMoreBatchDetailsComplete> | ReturnType<typeof fetchMoreBatchDetailsFailure> | ReturnType<typeof batchDetailFetchFailed> | ReturnType<typeof setInitialBatchDetailsLoading> | ReturnType<typeof storeBatchDetails> | ReturnType<typeof updateTransactions>;
|
|
8
|
-
export declare const fetchMoreBatchDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchMoreBatchDetailsEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
10
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
-
const fetchMultipleBatchDetailsEpic_1 = require("./fetchMultipleBatchDetailsEpic");
|
|
12
|
-
const MORE_BATCH_PAGE_SIZE = 5;
|
|
13
|
-
const fetchMoreBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchMoreBatchDetails.match),
|
|
14
|
-
/** One page at a time — avoids duplicate loads if IO + scroll fallback both fire. */
|
|
15
|
-
(0, operators_1.exhaustMap)(() => {
|
|
16
|
-
const state = state$.value;
|
|
17
|
-
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
18
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
19
|
-
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
20
|
-
if (selectedPeriod == null) {
|
|
21
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)());
|
|
22
|
-
}
|
|
23
|
-
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
24
|
-
const batchList = bulkUpload.batchListByPeriod[periodId] ?? [];
|
|
25
|
-
const failedIds = new Set(bulkUpload.failedBatchDetailIds);
|
|
26
|
-
const unfetchedBatches = (0, missingReceiptsPayload_1.filterBatchListItemsForBatchDetailsFetch)(batchList).filter((batch) => bulkUpload.batchDetailsById[batch.batchId] == null &&
|
|
27
|
-
!failedIds.has(batch.batchId));
|
|
28
|
-
const unfetchedBatchIds = unfetchedBatches.map((batch) => batch.batchId);
|
|
29
|
-
if (unfetchedBatchIds.length === 0) {
|
|
30
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)());
|
|
31
|
-
}
|
|
32
|
-
const nextPage = unfetchedBatchIds.slice(0, MORE_BATCH_PAGE_SIZE);
|
|
33
|
-
return (0, rxjs_1.concat)((0, fetchMultipleBatchDetailsEpic_1.fetchBatchDetailsByIds)(nextPage, zeniAPI), (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)())).pipe((0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsFailure)({
|
|
34
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch more batch details errored out: ' + JSON.stringify(error)),
|
|
35
|
-
}))));
|
|
36
|
-
}));
|
|
37
|
-
exports.fetchMoreBatchDetailsEpic = fetchMoreBatchDetailsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { batchDetailFetchFailed, fetchBulkUploadBatchDetails, fetchBulkUploadBatchesSuccess, fetchMoreBatchDetailsComplete, setInitialBatchDetailsLoading, storeBatchDetails } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof updateTransactions> | ReturnType<typeof storeBatchDetails> | ReturnType<typeof batchDetailFetchFailed> | ReturnType<typeof setInitialBatchDetailsLoading> | ReturnType<typeof fetchMoreBatchDetailsComplete>;
|
|
8
|
-
export declare function fetchBatchDetailsByIds(batchIds: string[], zeniAPI: ZeniAPI): Observable<ActionType>;
|
|
9
|
-
export declare const fetchMultipleBatchDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchMultipleBatchDetailsEpic = void 0;
|
|
4
|
-
exports.fetchBatchDetailsByIds = fetchBatchDetailsByIds;
|
|
5
|
-
const rxjs_1 = require("rxjs");
|
|
6
|
-
const operators_1 = require("rxjs/operators");
|
|
7
|
-
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
8
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
10
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
-
const INITIAL_BATCH_PAGE_SIZE = 5;
|
|
12
|
-
function fetchBatchDetailsByIds(batchIds, zeniAPI) {
|
|
13
|
-
if (batchIds.length === 0) {
|
|
14
|
-
return rxjs_1.EMPTY;
|
|
15
|
-
}
|
|
16
|
-
return (0, rxjs_1.from)(batchIds).pipe((0, operators_1.mergeMap)((batchId) => zeniAPI
|
|
17
|
-
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
|
|
18
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
19
|
-
if (!(0, responsePayload_1.isSuccessResponse)(response) ||
|
|
20
|
-
response.data == null ||
|
|
21
|
-
!(0, missingReceiptsPayload_1.isBatchDetailsApiStatusCompleted)(response.data.status)) {
|
|
22
|
-
return rxjs_1.EMPTY;
|
|
23
|
-
}
|
|
24
|
-
const actions = [];
|
|
25
|
-
const transactionPayloads = (0, missingReceiptsPayload_1.extractTransactionPayloadsFromBatchFiles)(response.data.files);
|
|
26
|
-
if (transactionPayloads.length > 0) {
|
|
27
|
-
actions.push((0, transactionReducer_1.updateTransactions)(transactionPayloads, (value) => value.transaction_id));
|
|
28
|
-
}
|
|
29
|
-
actions.push((0, missingReceiptsViewReducer_1.storeBatchDetails)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
30
|
-
return (0, rxjs_1.from)(actions);
|
|
31
|
-
}), (0, operators_1.catchError)((error) => {
|
|
32
|
-
console.error(`Failed to fetch batch details for ${batchId}:`, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)));
|
|
33
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.batchDetailFetchFailed)({ batchId }));
|
|
34
|
-
})), 5));
|
|
35
|
-
}
|
|
36
|
-
const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess.match), (0, operators_1.mergeMap)((action) => {
|
|
37
|
-
const batchList = action.payload.batchList;
|
|
38
|
-
const { batchDetailsById } = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
39
|
-
/** Only completed list rows may trigger batch-details API; preserve platform order. */
|
|
40
|
-
const completedBatchesMissingDetails = (0, missingReceiptsPayload_1.filterBatchListItemsForBatchDetailsFetch)(batchList).filter((batch) => batchDetailsById[batch.batchId] == null);
|
|
41
|
-
const completedBatchIds = completedBatchesMissingDetails.map((batch) => batch.batchId);
|
|
42
|
-
const batchIdsToFetch = completedBatchIds.slice(0, INITIAL_BATCH_PAGE_SIZE);
|
|
43
|
-
if (batchIdsToFetch.length === 0) {
|
|
44
|
-
/**
|
|
45
|
-
* List refresh can complete while no row is `completed` yet (multi-fetch skips), or
|
|
46
|
-
* `currentBatchId` may not appear in the filtered list but still needs `GET /batches/:id`.
|
|
47
|
-
* Fall back to the single-batch-details epic so `phase` and details can resolve.
|
|
48
|
-
*/
|
|
49
|
-
const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
50
|
-
const currentId = bulkUpload.currentBatchId;
|
|
51
|
-
if (currentId != null &&
|
|
52
|
-
bulkUpload.phase === 'matching' &&
|
|
53
|
-
bulkUpload.batchDetailsById[currentId] == null &&
|
|
54
|
-
(0, missingReceiptsPayload_1.shouldFetchBatchDetailsForBatchId)(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentId)) {
|
|
55
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails)());
|
|
56
|
-
}
|
|
57
|
-
return rxjs_1.EMPTY;
|
|
58
|
-
}
|
|
59
|
-
return (0, rxjs_1.concat)((0, rxjs_1.of)((0, missingReceiptsViewReducer_1.setInitialBatchDetailsLoading)()), fetchBatchDetailsByIds(batchIdsToFetch, zeniAPI), (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)()));
|
|
60
|
-
}));
|
|
61
|
-
exports.fetchMultipleBatchDetailsEpic = fetchMultipleBatchDetailsEpic;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
-
/**
|
|
8
|
-
* `auto_categorized` for manual transaction search (Unmatched).
|
|
9
|
-
* Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
|
|
10
|
-
* when the expense-automation API documents the intended filter for this flow.
|
|
11
|
-
*/
|
|
12
|
-
export declare const MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
|
|
13
|
-
export type ActionType = ReturnType<typeof searchTransactionsForManualMatch> | ReturnType<typeof searchTransactionsForManualMatchSuccess> | ReturnType<typeof searchTransactionsForManualMatchFailure> | ReturnType<typeof updateTransactions>;
|
|
14
|
-
export declare const searchTransactionsForManualMatchEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchTransactionsForManualMatchEpic = exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
9
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
10
|
-
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
11
|
-
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
12
|
-
const transactionsViewState_1 = require("../../types/transactionsViewState");
|
|
13
|
-
/**
|
|
14
|
-
* `auto_categorized` for manual transaction search (Unmatched).
|
|
15
|
-
* Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
|
|
16
|
-
* when the expense-automation API documents the intended filter for this flow.
|
|
17
|
-
*/
|
|
18
|
-
exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
|
|
19
|
-
const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
20
|
-
const searchActions$ = actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.searchTransactionsForManualMatch.match));
|
|
21
|
-
const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
|
|
22
|
-
/**
|
|
23
|
-
* No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
|
|
24
|
-
*/
|
|
25
|
-
const newSearchTooShortOrClear$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null &&
|
|
26
|
-
action.payload.query.trim().length < 2));
|
|
27
|
-
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null &&
|
|
28
|
-
action.payload.query.trim().length >= 2), (0, operators_1.debounceTime)(300));
|
|
29
|
-
return (0, rxjs_1.merge)(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
30
|
-
const { query, pageToken } = action.payload;
|
|
31
|
-
if (pageToken == null && query.trim().length < 2) {
|
|
32
|
-
return rxjs_1.EMPTY;
|
|
33
|
-
}
|
|
34
|
-
const state = state$.value;
|
|
35
|
-
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
|
|
36
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
37
|
-
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
38
|
-
if (selectedPeriod == null) {
|
|
39
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchFailure)({
|
|
40
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Manual search requires a selected accounting period.'),
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
44
|
-
const queryParam = {
|
|
45
|
-
start_date: period.start,
|
|
46
|
-
end_date: period.end,
|
|
47
|
-
auto_categorized: exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
|
|
48
|
-
sort_by: (0, transactionsViewState_1.toTransactionsSortKey)(sortKey),
|
|
49
|
-
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
50
|
-
page_token: pageToken ?? null,
|
|
51
|
-
page_size: manualSearch.pageSize,
|
|
52
|
-
search_text: query,
|
|
53
|
-
};
|
|
54
|
-
return zeniAPI
|
|
55
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
56
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
57
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
58
|
-
const { transactions, next_page_token, total_count } = response.data;
|
|
59
|
-
const append = pageToken != null;
|
|
60
|
-
const results = transactions.map(missingReceiptsPayload_1.supportedTransactionPayloadToManualSearchResult);
|
|
61
|
-
const actionsOut = [
|
|
62
|
-
(0, transactionReducer_1.updateTransactions)(transactions, (value) => value.transaction_id, 'merge'),
|
|
63
|
-
(0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchSuccess)({
|
|
64
|
-
append,
|
|
65
|
-
nextPageToken: next_page_token ?? null,
|
|
66
|
-
results,
|
|
67
|
-
totalCount: total_count,
|
|
68
|
-
}),
|
|
69
|
-
];
|
|
70
|
-
return (0, rxjs_1.from)(actionsOut);
|
|
71
|
-
}
|
|
72
|
-
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchFailure)({
|
|
73
|
-
error: response.status,
|
|
74
|
-
}));
|
|
75
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchFailure)({
|
|
76
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search transactions for manual match errored: ' +
|
|
77
|
-
JSON.stringify(error)),
|
|
78
|
-
}))));
|
|
79
|
-
}));
|
|
80
|
-
};
|
|
81
|
-
exports.searchTransactionsForManualMatchEpic = searchTransactionsForManualMatchEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
5
|
-
import { RootState } from '../../../../reducer';
|
|
6
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
-
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof requestMissingReceiptsTabNavigation> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
|
|
9
|
-
/**
|
|
10
|
-
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
|
|
11
|
-
* and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
|
|
12
|
-
*/
|
|
13
|
-
export declare const pusherBatchStatusCompletionEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
14
|
-
/**
|
|
15
|
-
* If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
|
|
16
|
-
* force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
|
|
17
|
-
* Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
|
|
18
|
-
*/
|
|
19
|
-
export declare const bulkUploadAutomatchingTimeoutEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
20
|
-
/**
|
|
21
|
-
* Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
|
|
22
|
-
* error snackbar per upload session (first failure only) so the user is not spammed every
|
|
23
|
-
* interval; Pusher or a later successful poll still completes the flow.
|
|
24
|
-
*/
|
|
25
|
-
export declare const pollBulkUploadBatchStatusEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|