@zeniai/client-epic-state 4.19.37-betaVR1 → 4.19.37-betaVR11
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.
Potentially problematic release.
This version of @zeniai/client-epic-state might be problematic. Click here for more details.
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/epic.js +3 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +4 -8
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +37 -13
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +3 -3
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +41 -11
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +23 -14
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +31 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +39 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +35 -27
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +12 -80
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +79 -44
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +25 -5
- package/lib/index.d.ts +3 -3
- package/lib/index.js +35 -32
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +2 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +3 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +36 -12
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +3 -3
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +40 -10
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +22 -13
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +35 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +3 -10
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +33 -25
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +19 -84
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +12 -82
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +15 -5
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +80 -45
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +5 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +25 -5
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +7 -3
- package/package.json +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
3
4
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
5
|
import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
5
6
|
export type ActionType = ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof fetchBulkUploadBatchesFailure>;
|
|
6
|
-
export declare const fetchBulkUploadBatchesEpic: (actions$: ActionsObservable<ActionType>,
|
|
7
|
+
export declare const fetchBulkUploadBatchesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,18 +3,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchBulkUploadBatchesEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
6
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
9
|
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
8
10
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
-
const fetchBulkUploadBatchesEpic = (actions$,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
}));
|
|
14
24
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess)({
|
|
36
|
+
batchList: response.data.batches.map(missingReceiptsPayload_1.toBatchListItem),
|
|
37
|
+
selectedPeriod,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesFailure)({
|
|
41
|
+
error: response.status,
|
|
42
|
+
selectedPeriod,
|
|
43
|
+
}));
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesFailure)({
|
|
45
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch bulk upload batches errored out: ' +
|
|
46
|
+
JSON.stringify(error)),
|
|
47
|
+
selectedPeriod,
|
|
48
|
+
}))));
|
|
49
|
+
}));
|
|
20
50
|
exports.fetchBulkUploadBatchesEpic = fetchBulkUploadBatchesEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -4,34 +4,43 @@ exports.fetchCompletedTransactionsEpic = 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 tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
7
8
|
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
8
9
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
10
10
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
11
|
const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchCompletedTransactions.match), (0, operators_1.switchMap)((action) => {
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const { expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
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 existingData = bulkUpload.completedTransactionsByPeriod[periodId];
|
|
19
|
+
if (isInitialLoad && existingData != null && existingData.transactionIds.length > 0) {
|
|
20
|
+
return (0, rxjs_1.from)([]);
|
|
18
21
|
}
|
|
19
22
|
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
20
|
-
queryPayload
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const queryPayload = {
|
|
24
|
+
start_date: period.start,
|
|
25
|
+
end_date: period.end,
|
|
26
|
+
sort_by: bulkUpload.sortKey,
|
|
27
|
+
sort_order: bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
28
|
+
page_token: action.payload.pageToken ?? null,
|
|
29
|
+
page_size: 25,
|
|
30
|
+
};
|
|
31
|
+
if (bulkUpload.completedSubTab !== 'all') {
|
|
32
|
+
queryPayload.match_type = bulkUpload.completedSubTab;
|
|
24
33
|
}
|
|
25
34
|
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
26
35
|
return zeniAPI
|
|
27
|
-
.getJSON(`${zeniAPI.apiEndPoints.
|
|
36
|
+
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipt-agent/transactions/completed?query=${encodedQuery}`)
|
|
28
37
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
29
38
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
30
|
-
const transactionPayloads = response.data.transactions.map(missingReceiptsPayload_1.completedTransactionPayloadToSupportedTransactionPayload);
|
|
31
39
|
const transactionIds = response.data.transactions.map((t) => t.transaction_id);
|
|
32
40
|
const updateActions = [];
|
|
33
|
-
updateActions.push((0, transactionReducer_1.updateTransactions)(
|
|
41
|
+
updateActions.push((0, transactionReducer_1.updateTransactions)(response.data.transactions, (value) => value.transaction_id));
|
|
34
42
|
updateActions.push((0, missingReceiptsViewReducer_1.fetchCompletedTransactionsSuccess)({
|
|
43
|
+
isInitialLoad,
|
|
35
44
|
transactionIds,
|
|
36
45
|
nextPageToken: response.data.next_page_token,
|
|
37
46
|
totalCount: response.data.total_count,
|
|
@@ -0,0 +1,8 @@
|
|
|
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 { fetchBulkUploadBatchesSuccess, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, storeBatchDetails } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof fetchMoreBatchDetails> | ReturnType<typeof fetchMoreBatchDetailsComplete> | ReturnType<typeof fetchMoreBatchDetailsFailure> | ReturnType<typeof storeBatchDetails> | ReturnType<typeof updateTransactions>;
|
|
8
|
+
export declare const fetchMoreBatchDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
10
|
+
const fetchMultipleBatchDetailsEpic_1 = require("./fetchMultipleBatchDetailsEpic");
|
|
11
|
+
const MORE_BATCH_PAGE_SIZE = 4;
|
|
12
|
+
const fetchMoreBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchMoreBatchDetails.match), (0, operators_1.mergeMap)(() => {
|
|
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
|
+
if (selectedPeriod == null) {
|
|
18
|
+
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)());
|
|
19
|
+
}
|
|
20
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
21
|
+
const batchList = bulkUpload.batchListByPeriod[periodId] ?? [];
|
|
22
|
+
const unfetchedBatchIds = batchList
|
|
23
|
+
.filter((batch) => batch.status === 'completed' &&
|
|
24
|
+
bulkUpload.batchDetailsById[batch.batchId] == null)
|
|
25
|
+
.map((batch) => batch.batchId);
|
|
26
|
+
if (unfetchedBatchIds.length === 0) {
|
|
27
|
+
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)());
|
|
28
|
+
}
|
|
29
|
+
const nextPage = unfetchedBatchIds.slice(0, MORE_BATCH_PAGE_SIZE);
|
|
30
|
+
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)({
|
|
31
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch more batch details errored out: ' +
|
|
32
|
+
JSON.stringify(error)),
|
|
33
|
+
}))));
|
|
34
|
+
}));
|
|
35
|
+
exports.fetchMoreBatchDetailsEpic = fetchMoreBatchDetailsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
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 { fetchBulkUploadBatchesSuccess, storeBatchDetails } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof updateTransactions> | ReturnType<typeof storeBatchDetails>;
|
|
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>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 = 4;
|
|
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) && response.data != null) {
|
|
20
|
+
const actions = [];
|
|
21
|
+
const transactionPayloads = (0, missingReceiptsPayload_1.extractTransactionPayloadsFromBatchFiles)(response.data.files);
|
|
22
|
+
if (transactionPayloads.length > 0) {
|
|
23
|
+
actions.push((0, transactionReducer_1.updateTransactions)(transactionPayloads, (value) => value.transaction_id));
|
|
24
|
+
}
|
|
25
|
+
actions.push((0, missingReceiptsViewReducer_1.storeBatchDetails)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
26
|
+
return (0, rxjs_1.from)(actions);
|
|
27
|
+
}
|
|
28
|
+
return rxjs_1.EMPTY;
|
|
29
|
+
}), (0, operators_1.catchError)((error) => {
|
|
30
|
+
console.error(`Failed to fetch batch details for ${batchId}:`, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch batch details errored out: ' +
|
|
31
|
+
JSON.stringify(error)));
|
|
32
|
+
return rxjs_1.EMPTY;
|
|
33
|
+
})), 5));
|
|
34
|
+
}
|
|
35
|
+
const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess.match), (0, operators_1.mergeMap)((action) => {
|
|
36
|
+
const batchList = action.payload.batchList;
|
|
37
|
+
const { batchDetailsById } = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
38
|
+
const completedBatchIds = batchList
|
|
39
|
+
.filter((batch) => batch.status === 'completed' &&
|
|
40
|
+
batchDetailsById[batch.batchId] == null)
|
|
41
|
+
.map((batch) => batch.batchId);
|
|
42
|
+
return fetchBatchDetailsByIds(completedBatchIds.slice(0, INITIAL_BATCH_PAGE_SIZE), zeniAPI);
|
|
43
|
+
}));
|
|
44
|
+
exports.fetchMultipleBatchDetailsEpic = fetchMultipleBatchDetailsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts
CHANGED
|
@@ -2,14 +2,7 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../reducer';
|
|
4
4
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails,
|
|
6
|
-
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof
|
|
7
|
-
/**
|
|
8
|
-
* Watches batch status using two strategies:
|
|
9
|
-
* 1. Pusher (primary): Reacts to `pusherBatchStatusUpdate` dispatched by the UI layer
|
|
10
|
-
* when a Pusher event arrives. Immediately fetches full details on completion.
|
|
11
|
-
* 2. Polling (fallback): Starts a relaxed 10s poll after upload success as a safety net
|
|
12
|
-
* in case the Pusher event is missed. Stops on completion or `clearBulkUpload`.
|
|
13
|
-
*/
|
|
5
|
+
import { bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchesSuccess, pusherBatchStatusUpdate } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchesSuccess> | ReturnType<typeof clearBulkUpload>;
|
|
14
7
|
export declare const pusherBatchStatusCompletionEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
15
|
-
export declare const pollBulkUploadBatchStatusEpic: (actions$: ActionsObservable<ActionType>,
|
|
8
|
+
export declare const pollBulkUploadBatchStatusEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
CHANGED
|
@@ -3,41 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.pollBulkUploadBatchStatusEpic = exports.pusherBatchStatusCompletionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
6
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
9
|
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
8
10
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
-
/**
|
|
10
|
-
* Watches batch status using two strategies:
|
|
11
|
-
* 1. Pusher (primary): Reacts to `pusherBatchStatusUpdate` dispatched by the UI layer
|
|
12
|
-
* when a Pusher event arrives. Immediately fetches full details on completion.
|
|
13
|
-
* 2. Polling (fallback): Starts a relaxed 10s poll after upload success as a safety net
|
|
14
|
-
* in case the Pusher event is missed. Stops on completion or `clearBulkUpload`.
|
|
15
|
-
*/
|
|
16
|
-
// Pusher-driven: when Pusher delivers a completed status, fetch details
|
|
17
11
|
const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.status === 'completed'), (0, operators_1.mergeMap)(() => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails)())));
|
|
18
12
|
exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
|
|
19
|
-
// Polling fallback: relaxed interval as safety net
|
|
20
13
|
const FALLBACK_POLL_INTERVAL_MS = 10000;
|
|
21
|
-
const pollBulkUploadBatchStatusEpic = (actions$,
|
|
14
|
+
const pollBulkUploadBatchStatusEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.switchMap)((action) => {
|
|
22
15
|
const { batchId } = action.payload;
|
|
23
16
|
return (0, rxjs_1.timer)(0, FALLBACK_POLL_INTERVAL_MS).pipe((0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)((a) => missingReceiptsViewReducer_1.clearBulkUpload.match(a) ||
|
|
24
17
|
(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match(a) &&
|
|
25
|
-
a.payload.status === 'completed')))), (0, operators_1.switchMap)(() =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
a.payload.status === 'completed')))), (0, operators_1.switchMap)(() => {
|
|
19
|
+
const state = state$.value;
|
|
20
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
21
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
22
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
23
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
24
|
+
const queryParam = {
|
|
25
|
+
start_date: period.start,
|
|
26
|
+
end_date: period.end,
|
|
27
|
+
sort_order: 'desc',
|
|
28
|
+
};
|
|
29
|
+
return zeniAPI
|
|
30
|
+
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
31
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
32
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
33
|
+
const batchList = response.data.batches.map(missingReceiptsPayload_1.toBatchListItem);
|
|
34
|
+
const currentBatch = batchList.find((b) => b.batchId === batchId);
|
|
35
|
+
if (currentBatch?.status === 'completed') {
|
|
36
|
+
return [
|
|
37
|
+
(0, missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess)({
|
|
38
|
+
batchList,
|
|
39
|
+
selectedPeriod,
|
|
40
|
+
}),
|
|
41
|
+
(0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails)(),
|
|
42
|
+
];
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails.match(action)) {
|
|
45
|
+
return [];
|
|
46
|
+
}), (0, operators_1.catchError)(() => (0, rxjs_1.of)()));
|
|
47
|
+
}), (0, operators_1.takeWhile)((emittedAction) => {
|
|
48
|
+
if (missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails.match(emittedAction)) {
|
|
41
49
|
return false;
|
|
42
50
|
}
|
|
43
51
|
return true;
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
|
|
|
20
20
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
21
21
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
22
22
|
export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
|
|
23
|
-
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipts_upload" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed";
|
|
23
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed";
|
|
24
24
|
messageText: "notification" | "success" | "failed";
|
|
25
25
|
type: "error" | "success" | "info";
|
|
26
26
|
variables: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { URLPayload } from '../../../commonPayloadTypes/urlPayload';
|
|
1
2
|
import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
|
|
2
3
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
3
4
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
4
|
-
import type { BatchDetails, BatchFile, BatchListItem,
|
|
5
|
+
import type { BatchDetails, BatchFile, BatchListItem, BatchSummary, ManualSearchResult } from '../types/missingReceiptsViewState';
|
|
5
6
|
export interface MissingReceiptsQueryPayload {
|
|
6
7
|
end_date: string;
|
|
7
8
|
is_attachment_missing_only: boolean;
|
|
@@ -15,21 +16,17 @@ interface MissingReceiptsPayload {
|
|
|
15
16
|
transactions: TransactionPayload[];
|
|
16
17
|
}
|
|
17
18
|
export type MissingReceiptsResponse = ZeniAPIResponse<MissingReceiptsPayload>;
|
|
19
|
+
export interface BatchListQueryPayload {
|
|
20
|
+
end_date: string;
|
|
21
|
+
sort_order: string;
|
|
22
|
+
start_date: string;
|
|
23
|
+
}
|
|
18
24
|
export interface BulkUploadResponsePayload {
|
|
19
25
|
batch_id: string;
|
|
20
26
|
status: string;
|
|
21
27
|
total_files: number;
|
|
22
28
|
}
|
|
23
29
|
export type BulkUploadResponse = ZeniAPIResponse<BulkUploadResponsePayload>;
|
|
24
|
-
export interface BatchStatusResponsePayload {
|
|
25
|
-
batch_id: string;
|
|
26
|
-
progress: {
|
|
27
|
-
processed: number;
|
|
28
|
-
total: number;
|
|
29
|
-
};
|
|
30
|
-
status: string;
|
|
31
|
-
}
|
|
32
|
-
export type BatchStatusResponse = ZeniAPIResponse<BatchStatusResponsePayload>;
|
|
33
30
|
export interface BatchListResponsePayload {
|
|
34
31
|
batches: BatchListItemPayload[];
|
|
35
32
|
}
|
|
@@ -47,10 +44,11 @@ export type BatchListResponse = ZeniAPIResponse<BatchListResponsePayload>;
|
|
|
47
44
|
export interface MatchedTransactionPayload {
|
|
48
45
|
amount: number;
|
|
49
46
|
currency_code: string;
|
|
50
|
-
transaction_date: string;
|
|
47
|
+
transaction_date: string | null;
|
|
51
48
|
transaction_id: string;
|
|
52
49
|
vendor_name: string;
|
|
53
|
-
|
|
50
|
+
transaction_type?: string;
|
|
51
|
+
vendor_logo?: URLPayload | null;
|
|
54
52
|
}
|
|
55
53
|
export interface MatchCandidatePayload extends MatchedTransactionPayload {
|
|
56
54
|
match_score: number;
|
|
@@ -58,10 +56,11 @@ export interface MatchCandidatePayload extends MatchedTransactionPayload {
|
|
|
58
56
|
export interface BatchFilePayload {
|
|
59
57
|
attachment_id: string;
|
|
60
58
|
file_id: string;
|
|
61
|
-
file_preview_url: string;
|
|
59
|
+
file_preview_url: string | null;
|
|
62
60
|
filename: string;
|
|
63
61
|
status: string;
|
|
64
62
|
candidates?: MatchCandidatePayload[];
|
|
63
|
+
match_source?: string;
|
|
65
64
|
matched_transaction?: MatchedTransactionPayload;
|
|
66
65
|
}
|
|
67
66
|
export interface BatchDetailsResponsePayload {
|
|
@@ -78,11 +77,10 @@ export interface BatchDetailsResponsePayload {
|
|
|
78
77
|
};
|
|
79
78
|
}
|
|
80
79
|
export type BatchDetailsResponse = ZeniAPIResponse<BatchDetailsResponsePayload>;
|
|
81
|
-
export declare function toBatchFile(payload: BatchFilePayload): BatchFile;
|
|
80
|
+
export declare function toBatchFile(payload: BatchFilePayload, filesEndPoint?: string): BatchFile;
|
|
82
81
|
export declare function extractTransactionPayloadsFromBatchFiles(files: BatchFilePayload[]): SupportedTransactionPayload[];
|
|
83
82
|
export declare function toBatchSummary(payload: BatchDetailsResponsePayload['summary']): BatchSummary;
|
|
84
|
-
export declare function
|
|
85
|
-
export declare function toBatchDetails(payload: BatchDetailsResponsePayload): BatchDetails;
|
|
83
|
+
export declare function toBatchDetails(payload: BatchDetailsResponsePayload, filesEndPoint?: string): BatchDetails;
|
|
86
84
|
export declare function toBatchListItem(payload: BatchListItemPayload): BatchListItem;
|
|
87
85
|
export interface TransactionSearchQueryPayload {
|
|
88
86
|
search_text: string;
|
|
@@ -106,79 +104,16 @@ export declare function toManualSearchResult(payload: TransactionSearchItemPaylo
|
|
|
106
104
|
export interface CompletedTransactionsQueryPayload {
|
|
107
105
|
end_date?: string;
|
|
108
106
|
match_type?: string;
|
|
109
|
-
|
|
107
|
+
page_size?: number;
|
|
108
|
+
page_token?: string | null;
|
|
109
|
+
sort_by?: string;
|
|
110
|
+
sort_order?: string;
|
|
110
111
|
start_date?: string;
|
|
111
112
|
}
|
|
112
|
-
export interface CompletedTransactionAttachmentPayload {
|
|
113
|
-
attachment_id: string;
|
|
114
|
-
content_type: string;
|
|
115
|
-
file_download_url: string;
|
|
116
|
-
file_name: string;
|
|
117
|
-
file_size: number;
|
|
118
|
-
attachment_create_time?: string;
|
|
119
|
-
attachment_update_time?: string;
|
|
120
|
-
}
|
|
121
|
-
export interface CompletedTransactionLineDetailPayload {
|
|
122
|
-
account?: {
|
|
123
|
-
account_id: string;
|
|
124
|
-
account_name: string;
|
|
125
|
-
coa_id?: string;
|
|
126
|
-
qbo_id?: string;
|
|
127
|
-
};
|
|
128
|
-
class?: {
|
|
129
|
-
accounting_class_id: string;
|
|
130
|
-
accounting_class_name: string;
|
|
131
|
-
accounting_class_number?: string;
|
|
132
|
-
fully_qualified_accounting_class_name?: string;
|
|
133
|
-
qbo_id?: string;
|
|
134
|
-
};
|
|
135
|
-
customer?: {
|
|
136
|
-
customer_id: string;
|
|
137
|
-
customer_name: string;
|
|
138
|
-
logo?: Record<string, unknown>;
|
|
139
|
-
qbo_id?: string;
|
|
140
|
-
};
|
|
141
|
-
posting_type?: string;
|
|
142
|
-
posting_type_name?: string;
|
|
143
|
-
vendor?: {
|
|
144
|
-
vendor_id: string;
|
|
145
|
-
vendor_name: string;
|
|
146
|
-
logo?: Record<string, unknown>;
|
|
147
|
-
qbo_id?: string;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
export interface CompletedTransactionLinePayload {
|
|
151
|
-
amount: number;
|
|
152
|
-
categorization_status: string;
|
|
153
|
-
line_description: string;
|
|
154
|
-
line_detail: CompletedTransactionLineDetailPayload;
|
|
155
|
-
line_detail_type: string;
|
|
156
|
-
line_id: string;
|
|
157
|
-
line_type: string;
|
|
158
|
-
receipt_matched_source?: string;
|
|
159
|
-
}
|
|
160
|
-
export interface CompletedTransactionPayload {
|
|
161
|
-
attachments: CompletedTransactionAttachmentPayload[];
|
|
162
|
-
currency_code: string;
|
|
163
|
-
is_deleted: boolean;
|
|
164
|
-
lines: CompletedTransactionLinePayload[];
|
|
165
|
-
total_amount: number;
|
|
166
|
-
transaction_date: string;
|
|
167
|
-
transaction_id: string;
|
|
168
|
-
account_id?: string;
|
|
169
|
-
account_name?: string;
|
|
170
|
-
currency_symbol?: string;
|
|
171
|
-
logo?: Record<string, unknown>;
|
|
172
|
-
transaction_type?: string;
|
|
173
|
-
transaction_type_name?: string;
|
|
174
|
-
vendor_id?: string;
|
|
175
|
-
vendor_name?: string;
|
|
176
|
-
}
|
|
177
113
|
export interface CompletedTransactionsResponsePayload {
|
|
178
114
|
next_page_token: string | null;
|
|
179
115
|
total_count: number;
|
|
180
|
-
transactions:
|
|
116
|
+
transactions: SupportedTransactionPayload[];
|
|
181
117
|
}
|
|
182
118
|
export type CompletedTransactionsResponse = ZeniAPIResponse<CompletedTransactionsResponsePayload>;
|
|
183
|
-
export declare function completedTransactionPayloadToSupportedTransactionPayload(payload: CompletedTransactionPayload): SupportedTransactionPayload;
|
|
184
119
|
export {};
|