@zeniai/client-epic-state 4.20.9 → 4.20.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/epic.d.ts +1 -4
- package/lib/epic.js +1 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/epic.js +1 -4
- package/lib/esm/index.js +3 -3
- package/lib/esm/view/expenseAutomationView/{helpers/bulkUploadTiming.js → bulkUploadTiming.js} +0 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +4 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +13 -7
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +5 -12
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -9
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -26
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
- package/lib/index.d.ts +3 -3
- package/lib/index.js +33 -36
- package/lib/view/expenseAutomationView/{helpers/bulkUploadTiming.d.ts → bulkUploadTiming.d.ts} +0 -6
- package/lib/view/expenseAutomationView/{helpers/bulkUploadTiming.js → bulkUploadTiming.js} +1 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +3 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +13 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -11
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +0 -5
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -10
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -12
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +4 -27
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -4
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +0 -33
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +0 -12
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +0 -98
- package/lib/esm/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +0 -13
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.d.ts +0 -13
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +0 -37
- package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.d.ts +0 -10
- package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +0 -16
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.d.ts +0 -18
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +0 -102
- package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.d.ts +0 -7
- package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +0 -16
|
@@ -40,7 +40,6 @@ export interface BatchListItemPayload {
|
|
|
40
40
|
possible_matches_count: number;
|
|
41
41
|
status: string;
|
|
42
42
|
total_files: number;
|
|
43
|
-
user_id: string;
|
|
44
43
|
}
|
|
45
44
|
export type BatchListResponse = ZeniAPIResponse<BatchListResponsePayload>;
|
|
46
45
|
export interface MatchedTransactionPayload {
|
|
@@ -82,8 +81,6 @@ export interface BatchDetailsResponsePayload {
|
|
|
82
81
|
possible_matches: number;
|
|
83
82
|
total: number;
|
|
84
83
|
};
|
|
85
|
-
/** Uploader — used to scope automatching UI to the user who submitted the batch. */
|
|
86
|
-
user_id?: string;
|
|
87
84
|
}
|
|
88
85
|
export type BatchDetailsResponse = ZeniAPIResponse<BatchDetailsResponsePayload>;
|
|
89
86
|
/**
|
|
@@ -96,8 +93,6 @@ export declare function toBatchFile(payload: BatchFilePayload, filesEndPoint?: s
|
|
|
96
93
|
export declare function extractTransactionPayloadsFromBatchFiles(files: BatchFilePayload[]): SupportedTransactionPayload[];
|
|
97
94
|
export declare function toBatchSummary(payload: BatchDetailsResponsePayload['summary']): BatchSummary;
|
|
98
95
|
export declare function toBatchDetails(payload: BatchDetailsResponsePayload, filesEndPoint?: string): BatchDetails;
|
|
99
|
-
/** Batch is still in-flight for automatching (GET /batches/:id while not completed). */
|
|
100
|
-
export declare function isBatchDetailsStatusPendingOrProcessing(status: string): boolean;
|
|
101
96
|
/** Batch list `status` is a string from the API — compare case-insensitively. */
|
|
102
97
|
export declare function isBatchListStatusCompleted(status: string): boolean;
|
|
103
98
|
/**
|
|
@@ -5,7 +5,6 @@ exports.toBatchFile = toBatchFile;
|
|
|
5
5
|
exports.extractTransactionPayloadsFromBatchFiles = extractTransactionPayloadsFromBatchFiles;
|
|
6
6
|
exports.toBatchSummary = toBatchSummary;
|
|
7
7
|
exports.toBatchDetails = toBatchDetails;
|
|
8
|
-
exports.isBatchDetailsStatusPendingOrProcessing = isBatchDetailsStatusPendingOrProcessing;
|
|
9
8
|
exports.isBatchListStatusCompleted = isBatchListStatusCompleted;
|
|
10
9
|
exports.filterBatchListItemsForBatchDetailsFetch = filterBatchListItemsForBatchDetailsFetch;
|
|
11
10
|
exports.isBatchDetailsApiStatusCompleted = isBatchDetailsApiStatusCompleted;
|
|
@@ -114,16 +113,8 @@ function toBatchDetails(payload, filesEndPoint) {
|
|
|
114
113
|
files: payload.files.map((file) => toBatchFile(file, filesEndPoint)),
|
|
115
114
|
status: (0, missingReceiptsViewState_1.toBatchStatusValue)(payload.status),
|
|
116
115
|
summary: toBatchSummary(payload.summary),
|
|
117
|
-
...(payload.user_id != null && payload.user_id !== ''
|
|
118
|
-
? { userId: payload.user_id }
|
|
119
|
-
: {}),
|
|
120
116
|
};
|
|
121
117
|
}
|
|
122
|
-
/** Batch is still in-flight for automatching (GET /batches/:id while not completed). */
|
|
123
|
-
function isBatchDetailsStatusPendingOrProcessing(status) {
|
|
124
|
-
const s = status.toLowerCase();
|
|
125
|
-
return s === 'processing' || s === 'pending';
|
|
126
|
-
}
|
|
127
118
|
/** Batch list `status` is a string from the API — compare case-insensitively. */
|
|
128
119
|
function isBatchListStatusCompleted(status) {
|
|
129
120
|
return status.toLowerCase() === 'completed';
|
|
@@ -181,7 +172,6 @@ function toBatchListItem(payload) {
|
|
|
181
172
|
possibleMatchesCount: payload.possible_matches_count,
|
|
182
173
|
status: payload.status,
|
|
183
174
|
totalFiles: payload.total_files,
|
|
184
|
-
userId: payload.user_id,
|
|
185
175
|
};
|
|
186
176
|
}
|
|
187
177
|
/**
|
|
@@ -12,12 +12,6 @@ export declare const initialBulkUploadState: BulkUploadState;
|
|
|
12
12
|
export declare const initialState: MissingReceiptsViewState;
|
|
13
13
|
/** Epic trigger only; batch-details fetch is handled in epics. */
|
|
14
14
|
export declare const fetchBulkUploadBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetails">;
|
|
15
|
-
/**
|
|
16
|
-
* Epic trigger only. Dispatched from the screen on missing-receipts entry / period switch so the
|
|
17
|
-
* automatching banner is restored for the logged-in user even when they sit on the Missing tab
|
|
18
|
-
* after a hard refresh. The epic owns the list + details API calls end-to-end.
|
|
19
|
-
*/
|
|
20
|
-
export declare const restoreBulkUploadAutomatchingOnMount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/restoreBulkUploadAutomatchingOnMount">;
|
|
21
15
|
export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, minimumTransactionAmount: Amount, cacheOverride?: any, refreshViewInBackground?: any], {
|
|
22
16
|
period: TimePeriod;
|
|
23
17
|
minimumTransactionAmount: Amount;
|
|
@@ -40,15 +34,11 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
40
34
|
selectedPeriod: MonthYearPeriod;
|
|
41
35
|
}, "expenseAutomationMissingReceiptsView/markMissingReceiptAsDone", never, never>, clearExpenseAutomationMissingReceiptsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearExpenseAutomationMissingReceiptsView">, bulkUploadReceipts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[files: File[]], {
|
|
42
36
|
files: File[];
|
|
43
|
-
|
|
44
|
-
}, "expenseAutomationMissingReceiptsView/bulkUploadReceipts", never, never>, updateBulkUploadProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "expenseAutomationMissingReceiptsView/updateBulkUploadProgress">, setBulkUploadUploadedFileCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "expenseAutomationMissingReceiptsView/setBulkUploadUploadedFileCount">, bulkUploadReceiptsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
37
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadReceipts", never, never>, updateBulkUploadProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "expenseAutomationMissingReceiptsView/updateBulkUploadProgress">, bulkUploadReceiptsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
45
38
|
batchId: ID;
|
|
46
39
|
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsSuccess">, bulkUploadReceiptsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
40
|
error: ZeniAPIStatus;
|
|
48
|
-
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsFailure">,
|
|
49
|
-
batchId: ID;
|
|
50
|
-
totalFiles: number;
|
|
51
|
-
}, "expenseAutomationMissingReceiptsView/restoreBulkUploadMatchingState">, bulkUploadAutomatchingTimedOut: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[batchId: string], {
|
|
41
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsFailure">, bulkUploadAutomatchingTimedOut: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[batchId: string], {
|
|
52
42
|
batchId: string;
|
|
53
43
|
}, "expenseAutomationMissingReceiptsView/bulkUploadAutomatchingTimedOut", never, never>, pusherBatchStatusUpdate: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchStatus, "expenseAutomationMissingReceiptsView/pusherBatchStatusUpdate">, requestMissingReceiptsTabNavigation: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
54
44
|
tab: BulkUploadResultsTab;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.acknowledgeBulkUploadConfirmMatchComplete = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.fetchMoreBatchDetailsFailure = exports.fetchMoreBatchDetailsComplete = exports.fetchMoreBatchDetails = exports.setInitialBatchDetailsLoading = exports.batchDetailFetchFailed = exports.storeBatchDetails = exports.fetchBulkUploadBatchDetailsFailure = exports.fetchBulkUploadBatchDetailsSuccess = exports.clearMissingReceiptsTabNavigation = exports.requestMissingReceiptsTabNavigation = exports.pusherBatchStatusUpdate = exports.bulkUploadAutomatchingTimedOut = exports.
|
|
4
|
+
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.acknowledgeBulkUploadConfirmMatchComplete = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.fetchMoreBatchDetailsFailure = exports.fetchMoreBatchDetailsComplete = exports.fetchMoreBatchDetails = exports.setInitialBatchDetailsLoading = exports.batchDetailFetchFailed = exports.storeBatchDetails = exports.fetchBulkUploadBatchDetailsFailure = exports.fetchBulkUploadBatchDetailsSuccess = exports.clearMissingReceiptsTabNavigation = exports.requestMissingReceiptsTabNavigation = exports.pusherBatchStatusUpdate = exports.bulkUploadAutomatchingTimedOut = exports.bulkUploadReceiptsFailure = exports.bulkUploadReceiptsSuccess = exports.updateBulkUploadProgress = exports.bulkUploadReceipts = exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.fetchBulkUploadBatchDetails = exports.initialState = exports.initialBulkUploadState = exports.getCompletedTransactionsCacheKey = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
@@ -32,7 +32,6 @@ exports.initialBulkUploadState = {
|
|
|
32
32
|
phase: 'idle',
|
|
33
33
|
sortKey: 'date',
|
|
34
34
|
sortOrder: 'descending',
|
|
35
|
-
uploadedFileCount: 0,
|
|
36
35
|
uploadProgress: 0,
|
|
37
36
|
uploadStatus: { fetchState: 'Not-Started', error: undefined },
|
|
38
37
|
};
|
|
@@ -59,12 +58,6 @@ exports.initialState = {
|
|
|
59
58
|
};
|
|
60
59
|
/** Epic trigger only; batch-details fetch is handled in epics. */
|
|
61
60
|
exports.fetchBulkUploadBatchDetails = (0, toolkit_1.createAction)('expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetails');
|
|
62
|
-
/**
|
|
63
|
-
* Epic trigger only. Dispatched from the screen on missing-receipts entry / period switch so the
|
|
64
|
-
* automatching banner is restored for the logged-in user even when they sit on the Missing tab
|
|
65
|
-
* after a hard refresh. The epic owns the list + details API calls end-to-end.
|
|
66
|
-
*/
|
|
67
|
-
exports.restoreBulkUploadAutomatchingOnMount = (0, toolkit_1.createAction)('expenseAutomationMissingReceiptsView/restoreBulkUploadAutomatchingOnMount');
|
|
68
61
|
const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
69
62
|
name: 'expenseAutomationMissingReceiptsView',
|
|
70
63
|
initialState: exports.initialState,
|
|
@@ -168,29 +161,21 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
168
161
|
},
|
|
169
162
|
// -- Bulk Upload Actions --
|
|
170
163
|
bulkUploadReceipts: {
|
|
171
|
-
reducer(draft
|
|
164
|
+
reducer(draft) {
|
|
172
165
|
draft.bulkUpload.phase = 'uploading';
|
|
173
166
|
draft.bulkUpload.uploadProgress = 0;
|
|
174
|
-
draft.bulkUpload.uploadedFileCount = action.payload.fileCount;
|
|
175
167
|
draft.bulkUpload.uploadStatus = {
|
|
176
168
|
fetchState: 'In-Progress',
|
|
177
169
|
error: undefined,
|
|
178
170
|
};
|
|
179
171
|
},
|
|
180
172
|
prepare(files) {
|
|
181
|
-
return { payload: { files
|
|
173
|
+
return { payload: { files } };
|
|
182
174
|
},
|
|
183
175
|
},
|
|
184
176
|
updateBulkUploadProgress(draft, action) {
|
|
185
177
|
draft.bulkUpload.uploadProgress = action.payload;
|
|
186
178
|
},
|
|
187
|
-
/**
|
|
188
|
-
* Sync file count when bulk upload uses direct HTTP (`bulkUploadReceipts` Redux action is not
|
|
189
|
-
* dispatched, so `bulkUploadReceipts` reducer never runs).
|
|
190
|
-
*/
|
|
191
|
-
setBulkUploadUploadedFileCount(draft, action) {
|
|
192
|
-
draft.bulkUpload.uploadedFileCount = action.payload;
|
|
193
|
-
},
|
|
194
179
|
bulkUploadReceiptsSuccess(draft, action) {
|
|
195
180
|
draft.bulkUpload.currentBatchId = action.payload.batchId;
|
|
196
181
|
draft.bulkUpload.uploadProgress = 100;
|
|
@@ -207,14 +192,6 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
207
192
|
};
|
|
208
193
|
draft.bulkUpload.phase = 'idle';
|
|
209
194
|
},
|
|
210
|
-
restoreBulkUploadMatchingState(draft, action) {
|
|
211
|
-
if (draft.bulkUpload.phase !== 'idle') {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
draft.bulkUpload.currentBatchId = action.payload.batchId;
|
|
215
|
-
draft.bulkUpload.uploadedFileCount = action.payload.totalFiles;
|
|
216
|
-
draft.bulkUpload.phase = 'matching';
|
|
217
|
-
},
|
|
218
195
|
bulkUploadAutomatchingTimedOut: {
|
|
219
196
|
reducer(draft, action) {
|
|
220
197
|
if (draft.bulkUpload.phase !== 'matching' ||
|
|
@@ -579,7 +556,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
579
556
|
});
|
|
580
557
|
_a = expenseAutomationMissingReceiptsView.actions, exports.fetchMissingReceipts = _a.fetchMissingReceipts, exports.fetchMissingReceiptsSuccess = _a.fetchMissingReceiptsSuccess, exports.fetchMissingReceiptsFailure = _a.fetchMissingReceiptsFailure, exports.uploadMissingReceiptSuccess = _a.uploadMissingReceiptSuccess, exports.updateMissingReceiptUploadState = _a.updateMissingReceiptUploadState, exports.updateMissingReceiptsUIState = _a.updateMissingReceiptsUIState, exports.markMissingReceiptAsDone = _a.markMissingReceiptAsDone, exports.clearExpenseAutomationMissingReceiptsView = _a.clearExpenseAutomationMissingReceiptsView,
|
|
581
558
|
// Bulk Upload
|
|
582
|
-
exports.bulkUploadReceipts = _a.bulkUploadReceipts, exports.updateBulkUploadProgress = _a.updateBulkUploadProgress, exports.
|
|
559
|
+
exports.bulkUploadReceipts = _a.bulkUploadReceipts, exports.updateBulkUploadProgress = _a.updateBulkUploadProgress, exports.bulkUploadReceiptsSuccess = _a.bulkUploadReceiptsSuccess, exports.bulkUploadReceiptsFailure = _a.bulkUploadReceiptsFailure, exports.bulkUploadAutomatchingTimedOut = _a.bulkUploadAutomatchingTimedOut, exports.pusherBatchStatusUpdate = _a.pusherBatchStatusUpdate, exports.requestMissingReceiptsTabNavigation = _a.requestMissingReceiptsTabNavigation, exports.clearMissingReceiptsTabNavigation = _a.clearMissingReceiptsTabNavigation, exports.fetchBulkUploadBatchDetailsSuccess = _a.fetchBulkUploadBatchDetailsSuccess, exports.fetchBulkUploadBatchDetailsFailure = _a.fetchBulkUploadBatchDetailsFailure, exports.storeBatchDetails = _a.storeBatchDetails, exports.batchDetailFetchFailed = _a.batchDetailFetchFailed, exports.setInitialBatchDetailsLoading = _a.setInitialBatchDetailsLoading, exports.fetchMoreBatchDetails = _a.fetchMoreBatchDetails, exports.fetchMoreBatchDetailsComplete = _a.fetchMoreBatchDetailsComplete, exports.fetchMoreBatchDetailsFailure = _a.fetchMoreBatchDetailsFailure, exports.fetchBulkUploadBatches = _a.fetchBulkUploadBatches, exports.fetchBulkUploadBatchesSuccess = _a.fetchBulkUploadBatchesSuccess, exports.fetchBulkUploadBatchesFailure = _a.fetchBulkUploadBatchesFailure, exports.confirmBulkUploadMatch = _a.confirmBulkUploadMatch, exports.confirmBulkUploadMatchSuccess = _a.confirmBulkUploadMatchSuccess, exports.confirmBulkUploadMatchFailure = _a.confirmBulkUploadMatchFailure, exports.setBulkUploadResultsTab = _a.setBulkUploadResultsTab, exports.setBulkUploadCompletedSubTab = _a.setBulkUploadCompletedSubTab, exports.setBulkUploadSortConfig = _a.setBulkUploadSortConfig, exports.clearBulkUpload = _a.clearBulkUpload, exports.searchTransactionsForManualMatch = _a.searchTransactionsForManualMatch, exports.searchTransactionsForManualMatchSuccess = _a.searchTransactionsForManualMatchSuccess, exports.searchTransactionsForManualMatchFailure = _a.searchTransactionsForManualMatchFailure, exports.clearManualSearchResults = _a.clearManualSearchResults, exports.acknowledgeBulkUploadConfirmMatchComplete = _a.acknowledgeBulkUploadConfirmMatchComplete,
|
|
583
560
|
// Completed Transactions
|
|
584
561
|
exports.fetchCompletedTransactions = _a.fetchCompletedTransactions, exports.fetchCompletedTransactionsSuccess = _a.fetchCompletedTransactionsSuccess, exports.fetchCompletedTransactionsFailure = _a.fetchCompletedTransactionsFailure;
|
|
585
562
|
exports.default = expenseAutomationMissingReceiptsView.reducer;
|
|
@@ -51,10 +51,8 @@ export interface BulkUploadSelectorData {
|
|
|
51
51
|
sortKey: BulkUploadSortKey;
|
|
52
52
|
sortOrder: SortOrder;
|
|
53
53
|
unmatchedFiles: ResolvedBatchFile[];
|
|
54
|
-
uploadedFileCount: number;
|
|
55
54
|
uploadProgress: number;
|
|
56
55
|
uploadStatus: FetchStateAndError;
|
|
57
|
-
currentBatchId?: ID;
|
|
58
56
|
}
|
|
59
57
|
export interface ResolvedBatchDetails {
|
|
60
58
|
batchId: ID;
|
|
@@ -196,7 +196,6 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
196
196
|
batchStatus: currentBatchStatus,
|
|
197
197
|
batchDetails: resolvedBatchDetails,
|
|
198
198
|
completedSubTab: bulkUpload.completedSubTab,
|
|
199
|
-
currentBatchId: bulkUpload.currentBatchId,
|
|
200
199
|
completedTransactions: {
|
|
201
200
|
fetchState: completedTransactionsForPeriod?.fetchState ?? {
|
|
202
201
|
fetchState: 'Not-Started',
|
|
@@ -224,7 +223,6 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
224
223
|
...bulkUpload.manualSearch,
|
|
225
224
|
results: manualSearchResults,
|
|
226
225
|
},
|
|
227
|
-
uploadedFileCount: bulkUpload.uploadedFileCount,
|
|
228
226
|
uploadProgress: bulkUpload.uploadProgress,
|
|
229
227
|
},
|
|
230
228
|
};
|
|
@@ -83,8 +83,6 @@ export interface BatchDetails {
|
|
|
83
83
|
files: BatchFile[];
|
|
84
84
|
status: BatchStatusValue;
|
|
85
85
|
summary: BatchSummary;
|
|
86
|
-
/** Present when batch-details API includes `user_id` (uploader). */
|
|
87
|
-
userId?: ID;
|
|
88
86
|
}
|
|
89
87
|
export interface BatchListItem {
|
|
90
88
|
batchId: ID;
|
|
@@ -95,7 +93,6 @@ export interface BatchListItem {
|
|
|
95
93
|
possibleMatchesCount: number;
|
|
96
94
|
status: string;
|
|
97
95
|
totalFiles: number;
|
|
98
|
-
userId: ID;
|
|
99
96
|
}
|
|
100
97
|
export interface ManualSearchResult {
|
|
101
98
|
amount: number;
|
|
@@ -147,7 +144,6 @@ export interface BulkUploadState {
|
|
|
147
144
|
phase: BulkUploadPhase;
|
|
148
145
|
sortKey: BulkUploadSortKey;
|
|
149
146
|
sortOrder: SortOrder;
|
|
150
|
-
uploadedFileCount: number;
|
|
151
147
|
uploadProgress: number;
|
|
152
148
|
uploadStatus: FetchStateAndError;
|
|
153
149
|
currentBatchId?: ID;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.11",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { merge, of } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap, switchMap, take, takeUntil } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, restoreBulkUploadMatchingState, storeBatchDetails, } from '../../reducers/missingReceiptsViewReducer';
|
|
5
|
-
/**
|
|
6
|
-
* Show a success toast when batch details arrive for the current upload batch,
|
|
7
|
-
* e.g. "17 out of 20 Receipts Matched". Scoped per upload session so it fires
|
|
8
|
-
* only once: starts on `bulkUploadReceiptsSuccess` (or `restoreBulkUploadMatchingState`
|
|
9
|
-
* for a restored session), waits for the first batch-details action for that batch,
|
|
10
|
-
* emits the toast, then stops. `clearBulkUpload` cancels the in-flight wait.
|
|
11
|
-
*/
|
|
12
|
-
export const bulkUploadMatchResultToastEpic = (actions$) => actions$.pipe(filter((action) => bulkUploadReceiptsSuccess.match(action) ||
|
|
13
|
-
restoreBulkUploadMatchingState.match(action)), switchMap((uploadAction) => {
|
|
14
|
-
const { batchId } = uploadAction.payload;
|
|
15
|
-
return merge(actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match)), actions$.pipe(filter(storeBatchDetails.match))).pipe(filter((a) => a.payload.batchId === batchId), take(1), mergeMap((action) => {
|
|
16
|
-
const { summary } = action.payload;
|
|
17
|
-
return of(openSnackbar({
|
|
18
|
-
messageSection: 'receipts_bulk_match',
|
|
19
|
-
messageText: 'success',
|
|
20
|
-
type: 'success',
|
|
21
|
-
variables: [
|
|
22
|
-
{
|
|
23
|
-
variableName: '_matched_',
|
|
24
|
-
variableValue: String(summary.matched),
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
variableName: '_total_',
|
|
28
|
-
variableValue: String(summary.total),
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
}));
|
|
32
|
-
}), takeUntil(actions$.pipe(filter(clearBulkUpload.match))));
|
|
33
|
-
}));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { fetchCompletedTransactions, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, } from '../../reducers/missingReceiptsViewReducer';
|
|
4
|
-
/**
|
|
5
|
-
* Completed transactions are cached per sort key/order/sub-tab. After a sort or sub-tab
|
|
6
|
-
* change, the fetch epic would otherwise skip the network when that cache entry already
|
|
7
|
-
* exists — dispatch a cache-bypassing initial fetch whenever either changes from the UI.
|
|
8
|
-
*/
|
|
9
|
-
export const refetchCompletedTransactionsOnBulkUploadSortEpic = (actions$) => {
|
|
10
|
-
return actions$.pipe(filter((action) => setBulkUploadSortConfig.match(action) ||
|
|
11
|
-
setBulkUploadCompletedSubTab.match(action)), mergeMap(() => of(fetchCompletedTransactions(undefined, true))));
|
|
12
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { EMPTY, concat, from, of } from 'rxjs';
|
|
2
|
-
import { catchError, concatMap, filter, mergeMap, take } from 'rxjs/operators';
|
|
3
|
-
import { isSuccessResponse } from '../../../../responsePayload';
|
|
4
|
-
import { isBatchDetailsStatusPendingOrProcessing, toBatchListItem, } from '../../payload/missingReceiptsPayload';
|
|
5
|
-
import { fetchBulkUploadBatchesSuccess, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
-
import { BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS } from '../../helpers/bulkUploadTiming';
|
|
7
|
-
import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
|
|
8
|
-
import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
|
|
9
|
-
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
10
|
-
/**
|
|
11
|
-
* On missing-receipts entry / period switch, hydrate the automatching banner for the logged-in
|
|
12
|
-
* user without relying on UI-driven list fetches (the Missing tab does not fetch the batch list
|
|
13
|
-
* while `phase === 'idle'`). Flow:
|
|
14
|
-
* 1. Call `GET /1.0/batches` (rolling 30-day window).
|
|
15
|
-
* 2. Emit `fetchBulkUploadBatchesSuccess` so `batchListByPeriod` is populated for the selected
|
|
16
|
-
* period (prevents a duplicate list fetch when the user switches to the Unmatched tab).
|
|
17
|
-
* 3. For each `processing|pending` row, call `GET /1.0/batches/:id` in order; for the first row
|
|
18
|
-
* whose details `user_id` matches the logged-in user and whose status is still
|
|
19
|
-
* pending/processing, dispatch `restoreBulkUploadMatchingState` and stop.
|
|
20
|
-
*/
|
|
21
|
-
export const restoreBulkUploadAutomatchingOnMountEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(restoreBulkUploadAutomatchingOnMount.match), mergeMap(() => {
|
|
22
|
-
const state = state$.value;
|
|
23
|
-
const { expenseAutomationMissingReceiptsViewState: { bulkUpload }, expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
24
|
-
if (bulkUpload.phase !== 'idle') {
|
|
25
|
-
return EMPTY;
|
|
26
|
-
}
|
|
27
|
-
if (bulkUpload.batchListFetchState.fetchState === 'In-Progress') {
|
|
28
|
-
return EMPTY;
|
|
29
|
-
}
|
|
30
|
-
const loggedInUserId = state.tenantState.loggedInUser?.userId;
|
|
31
|
-
if (loggedInUserId == null) {
|
|
32
|
-
return EMPTY;
|
|
33
|
-
}
|
|
34
|
-
const currentTenant = getCurrentTenant(state);
|
|
35
|
-
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
36
|
-
if (selectedPeriod == null) {
|
|
37
|
-
return EMPTY;
|
|
38
|
-
}
|
|
39
|
-
const { end, start } = rollingCalendarDateRangeInclusive(BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS);
|
|
40
|
-
const queryParam = {
|
|
41
|
-
start_date: start,
|
|
42
|
-
end_date: end,
|
|
43
|
-
sort_order: 'desc',
|
|
44
|
-
};
|
|
45
|
-
const listUrl = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
|
|
46
|
-
const detailsBaseUrl = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/`;
|
|
47
|
-
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
48
|
-
const alreadyCached = (bulkUpload.batchListByPeriod[periodId] ?? []).length > 0 &&
|
|
49
|
-
bulkUpload.batchListFetchState.fetchState === 'Completed';
|
|
50
|
-
const listSource = alreadyCached
|
|
51
|
-
? of(null)
|
|
52
|
-
: zeniAPI.getJSON(listUrl).pipe(catchError(() => of(null)));
|
|
53
|
-
return listSource.pipe(mergeMap((listResponse) => {
|
|
54
|
-
const batchList = alreadyCached
|
|
55
|
-
? bulkUpload.batchListByPeriod[periodId] ?? []
|
|
56
|
-
: listResponse != null &&
|
|
57
|
-
isSuccessResponse(listResponse) &&
|
|
58
|
-
listResponse.data != null
|
|
59
|
-
? listResponse.data.batches.map(toBatchListItem)
|
|
60
|
-
: null;
|
|
61
|
-
if (batchList == null) {
|
|
62
|
-
return EMPTY;
|
|
63
|
-
}
|
|
64
|
-
const successAction = alreadyCached
|
|
65
|
-
? null
|
|
66
|
-
: fetchBulkUploadBatchesSuccess({
|
|
67
|
-
batchList,
|
|
68
|
-
selectedPeriod,
|
|
69
|
-
});
|
|
70
|
-
const processingBatches = batchList.filter((b) => {
|
|
71
|
-
const status = b.status.toLowerCase();
|
|
72
|
-
return status === 'processing' || status === 'pending';
|
|
73
|
-
});
|
|
74
|
-
const restoreStream = from(processingBatches).pipe(concatMap((batch) => zeniAPI
|
|
75
|
-
.getJSON(`${detailsBaseUrl}${batch.batchId}`)
|
|
76
|
-
.pipe(mergeMap((response) => {
|
|
77
|
-
if (!isSuccessResponse(response) || response.data == null) {
|
|
78
|
-
return EMPTY;
|
|
79
|
-
}
|
|
80
|
-
const data = response.data;
|
|
81
|
-
const detailsUserId = data.user_id;
|
|
82
|
-
if (detailsUserId == null ||
|
|
83
|
-
detailsUserId !== loggedInUserId) {
|
|
84
|
-
return EMPTY;
|
|
85
|
-
}
|
|
86
|
-
if (!isBatchDetailsStatusPendingOrProcessing(data.status)) {
|
|
87
|
-
return EMPTY;
|
|
88
|
-
}
|
|
89
|
-
return of(restoreBulkUploadMatchingState({
|
|
90
|
-
batchId: batch.batchId,
|
|
91
|
-
totalFiles: batch.totalFiles,
|
|
92
|
-
}));
|
|
93
|
-
}), catchError(() => EMPTY))), take(1));
|
|
94
|
-
return successAction != null
|
|
95
|
-
? concat(of(successAction), restoreStream)
|
|
96
|
-
: restoreStream;
|
|
97
|
-
}));
|
|
98
|
-
}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
2
|
-
import { dateNow } from '../../../zeniDayJS';
|
|
3
|
-
/**
|
|
4
|
-
* Local calendar dates from (end − (days − 1)) through end, inclusive.
|
|
5
|
-
*/
|
|
6
|
-
export function rollingCalendarDateRangeInclusive(days) {
|
|
7
|
-
const end = dateNow().startOf('day');
|
|
8
|
-
const start = end.subtract(days - 1, 'day');
|
|
9
|
-
return {
|
|
10
|
-
end: end.format(DEFAULT_DATE_FORMAT),
|
|
11
|
-
start: start.format(DEFAULT_DATE_FORMAT),
|
|
12
|
-
};
|
|
13
|
-
}
|