@zeniai/client-epic-state 4.19.37-betaVR13 → 4.19.37-betaVR14
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/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +7 -3
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +10 -9
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +6 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +6 -2
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +4 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +12 -10
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +6 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/package.json +1 -1
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -4,7 +4,7 @@ import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTy
|
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
-
import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
+
import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, getCompletedTransactionsCacheKey, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
8
|
export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchCompletedTransactions.match), switchMap((action) => {
|
|
9
9
|
const state = state$.value;
|
|
10
10
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
@@ -12,8 +12,12 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
|
|
|
12
12
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
13
13
|
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
14
14
|
const isInitialLoad = action.payload.pageToken == null;
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab);
|
|
16
|
+
const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
17
|
+
if (isInitialLoad &&
|
|
18
|
+
action.payload.cacheOverride !== true &&
|
|
19
|
+
existingData != null &&
|
|
20
|
+
existingData.transactionIds.length > 0) {
|
|
17
21
|
return from([]);
|
|
18
22
|
}
|
|
19
23
|
const period = convertToPeriod(selectedPeriod);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
export const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => `completed-${subTab}-${sortKey}-${sortOrder === 'ascending' ? 'asc' : 'desc'}-${periodId}`;
|
|
3
4
|
export const initialBulkUploadState = {
|
|
4
5
|
batchDetailsById: {},
|
|
5
6
|
batchDetailsPaginationState: { fetchState: 'Not-Started', error: undefined },
|
|
@@ -210,7 +211,6 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
210
211
|
error: undefined,
|
|
211
212
|
};
|
|
212
213
|
},
|
|
213
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
214
214
|
fetchMoreBatchDetails(_draft) {
|
|
215
215
|
_draft.bulkUpload.batchDetailsPaginationState = {
|
|
216
216
|
fetchState: 'In-Progress',
|
|
@@ -302,7 +302,6 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
302
302
|
},
|
|
303
303
|
setBulkUploadCompletedSubTab(draft, action) {
|
|
304
304
|
draft.bulkUpload.completedSubTab = action.payload;
|
|
305
|
-
draft.bulkUpload.completedTransactionsByPeriod = {};
|
|
306
305
|
},
|
|
307
306
|
setBulkUploadSortConfig(draft, action) {
|
|
308
307
|
draft.bulkUpload.sortKey = action.payload.sortKey;
|
|
@@ -357,15 +356,16 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
358
|
},
|
|
360
|
-
prepare(pageToken) {
|
|
361
|
-
return { payload: { pageToken } };
|
|
359
|
+
prepare(pageToken, cacheOverride) {
|
|
360
|
+
return { payload: { pageToken, cacheOverride } };
|
|
362
361
|
},
|
|
363
362
|
},
|
|
364
363
|
fetchCompletedTransactionsSuccess(draft, action) {
|
|
365
364
|
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad } = action.payload;
|
|
366
365
|
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
366
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
|
|
367
367
|
if (isInitialLoad) {
|
|
368
|
-
draft.bulkUpload.completedTransactionsByPeriod[
|
|
368
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
369
369
|
transactionIds,
|
|
370
370
|
nextPageToken,
|
|
371
371
|
totalCount,
|
|
@@ -373,7 +373,7 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
else {
|
|
376
|
-
const existing = draft.bulkUpload.completedTransactionsByPeriod[
|
|
376
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
377
377
|
if (existing != null) {
|
|
378
378
|
existing.transactionIds.push(...transactionIds);
|
|
379
379
|
existing.nextPageToken = nextPageToken;
|
|
@@ -381,7 +381,7 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
381
381
|
existing.fetchState = { fetchState: 'Completed', error: undefined };
|
|
382
382
|
}
|
|
383
383
|
else {
|
|
384
|
-
draft.bulkUpload.completedTransactionsByPeriod[
|
|
384
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
385
385
|
transactionIds,
|
|
386
386
|
nextPageToken,
|
|
387
387
|
totalCount,
|
|
@@ -392,7 +392,8 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
392
392
|
},
|
|
393
393
|
fetchCompletedTransactionsFailure(draft, action) {
|
|
394
394
|
const periodId = toMonthYearPeriodId(action.payload.selectedPeriod);
|
|
395
|
-
const
|
|
395
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
|
|
396
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
396
397
|
if (existing != null) {
|
|
397
398
|
existing.fetchState = {
|
|
398
399
|
fetchState: 'Error',
|
|
@@ -400,7 +401,7 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
400
401
|
};
|
|
401
402
|
}
|
|
402
403
|
else {
|
|
403
|
-
draft.bulkUpload.completedTransactionsByPeriod[
|
|
404
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
404
405
|
fetchState: { fetchState: 'Error', error: action.payload.error },
|
|
405
406
|
nextPageToken: null,
|
|
406
407
|
totalCount: 0,
|
|
@@ -3,6 +3,7 @@ import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
|
3
3
|
import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
|
|
4
4
|
import { getSupportedTransactionById, getSupportedTransactionsByIds, } from '../../../entity/transaction/transactionSelector';
|
|
5
5
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
6
|
+
import { getCompletedTransactionsCacheKey } from '../reducers/missingReceiptsViewReducer';
|
|
6
7
|
export function getExpenseAutomationMissingReceiptsView(state) {
|
|
7
8
|
const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
8
9
|
const currentTenant = getCurrentTenant(state);
|
|
@@ -111,8 +112,11 @@ export function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
111
112
|
.filter((f) => f.status === 'un_matched' || f.status === 'no_match')
|
|
112
113
|
.map((f) => resolveBatchFile(f, b.batchId, transactionState));
|
|
113
114
|
});
|
|
114
|
-
const
|
|
115
|
-
? bulkUpload.
|
|
115
|
+
const completedTransactionsCacheKey = monthYearPeriodId != null
|
|
116
|
+
? getCompletedTransactionsCacheKey(monthYearPeriodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab)
|
|
117
|
+
: undefined;
|
|
118
|
+
const completedTransactionsForPeriod = completedTransactionsCacheKey != null
|
|
119
|
+
? bulkUpload.completedTransactionsByPeriod[completedTransactionsCacheKey]
|
|
116
120
|
: undefined;
|
|
117
121
|
const completedTransactionIds = completedTransactionsForPeriod?.transactionIds ?? [];
|
|
118
122
|
const resolvedCompletedTransactions = getSupportedTransactionsByIds(transactionState, completedTransactionIds);
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -15,8 +15,12 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
15
15
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
16
16
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
17
17
|
const isInitialLoad = action.payload.pageToken == null;
|
|
18
|
-
const
|
|
19
|
-
|
|
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) {
|
|
20
24
|
return (0, rxjs_1.from)([]);
|
|
21
25
|
}
|
|
22
26
|
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
@@ -6,6 +6,8 @@ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/tra
|
|
|
6
6
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
7
7
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
8
8
|
import type { BatchDetails, BatchListItem, BatchStatus, BulkUploadResultsTab, BulkUploadSortKey, BulkUploadState, CompletedSubTab, ManualSearchResult, MissingReceiptsViewState, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
9
|
+
import type { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
10
|
+
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey, sortOrder: SortOrder, subTab: CompletedSubTab) => string;
|
|
9
11
|
export declare const initialBulkUploadState: BulkUploadState;
|
|
10
12
|
export declare const initialState: MissingReceiptsViewState;
|
|
11
13
|
export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, minimumTransactionAmount: Amount, cacheOverride?: any, refreshViewInBackground?: any], {
|
|
@@ -67,8 +69,9 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
67
69
|
query: string;
|
|
68
70
|
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatch", never, never>, searchTransactionsForManualMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<ManualSearchResult[], "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchSuccess">, searchTransactionsForManualMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
69
71
|
error: ZeniAPIStatus;
|
|
70
|
-
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchFailure">, clearManualSearchResults: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearManualSearchResults">, fetchCompletedTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[pageToken?: string | undefined], {
|
|
72
|
+
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchFailure">, clearManualSearchResults: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearManualSearchResults">, fetchCompletedTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[pageToken?: string | undefined, cacheOverride?: boolean | undefined], {
|
|
71
73
|
pageToken: string | undefined;
|
|
74
|
+
cacheOverride: boolean | undefined;
|
|
72
75
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactions", never, never>, fetchCompletedTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
73
76
|
isInitialLoad: boolean;
|
|
74
77
|
nextPageToken: string | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = 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.fetchBulkUploadBatchDetails = exports.pusherBatchStatusUpdate = 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.initialState = exports.initialBulkUploadState = void 0;
|
|
4
|
+
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = 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.fetchBulkUploadBatchDetails = exports.pusherBatchStatusUpdate = 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.initialState = exports.initialBulkUploadState = exports.getCompletedTransactionsCacheKey = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
|
+
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => `completed-${subTab}-${sortKey}-${sortOrder === 'ascending' ? 'asc' : 'desc'}-${periodId}`;
|
|
8
|
+
exports.getCompletedTransactionsCacheKey = getCompletedTransactionsCacheKey;
|
|
7
9
|
exports.initialBulkUploadState = {
|
|
8
10
|
batchDetailsById: {},
|
|
9
11
|
batchDetailsPaginationState: { fetchState: 'Not-Started', error: undefined },
|
|
@@ -214,7 +216,6 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
214
216
|
error: undefined,
|
|
215
217
|
};
|
|
216
218
|
},
|
|
217
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
218
219
|
fetchMoreBatchDetails(_draft) {
|
|
219
220
|
_draft.bulkUpload.batchDetailsPaginationState = {
|
|
220
221
|
fetchState: 'In-Progress',
|
|
@@ -306,7 +307,6 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
306
307
|
},
|
|
307
308
|
setBulkUploadCompletedSubTab(draft, action) {
|
|
308
309
|
draft.bulkUpload.completedSubTab = action.payload;
|
|
309
|
-
draft.bulkUpload.completedTransactionsByPeriod = {};
|
|
310
310
|
},
|
|
311
311
|
setBulkUploadSortConfig(draft, action) {
|
|
312
312
|
draft.bulkUpload.sortKey = action.payload.sortKey;
|
|
@@ -361,15 +361,16 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
},
|
|
364
|
-
prepare(pageToken) {
|
|
365
|
-
return { payload: { pageToken } };
|
|
364
|
+
prepare(pageToken, cacheOverride) {
|
|
365
|
+
return { payload: { pageToken, cacheOverride } };
|
|
366
366
|
},
|
|
367
367
|
},
|
|
368
368
|
fetchCompletedTransactionsSuccess(draft, action) {
|
|
369
369
|
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad } = action.payload;
|
|
370
370
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
371
|
+
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
|
|
371
372
|
if (isInitialLoad) {
|
|
372
|
-
draft.bulkUpload.completedTransactionsByPeriod[
|
|
373
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
373
374
|
transactionIds,
|
|
374
375
|
nextPageToken,
|
|
375
376
|
totalCount,
|
|
@@ -377,7 +378,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
377
378
|
};
|
|
378
379
|
}
|
|
379
380
|
else {
|
|
380
|
-
const existing = draft.bulkUpload.completedTransactionsByPeriod[
|
|
381
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
381
382
|
if (existing != null) {
|
|
382
383
|
existing.transactionIds.push(...transactionIds);
|
|
383
384
|
existing.nextPageToken = nextPageToken;
|
|
@@ -385,7 +386,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
385
386
|
existing.fetchState = { fetchState: 'Completed', error: undefined };
|
|
386
387
|
}
|
|
387
388
|
else {
|
|
388
|
-
draft.bulkUpload.completedTransactionsByPeriod[
|
|
389
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
389
390
|
transactionIds,
|
|
390
391
|
nextPageToken,
|
|
391
392
|
totalCount,
|
|
@@ -396,7 +397,8 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
396
397
|
},
|
|
397
398
|
fetchCompletedTransactionsFailure(draft, action) {
|
|
398
399
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
|
|
399
|
-
const
|
|
400
|
+
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, draft.bulkUpload.sortKey, draft.bulkUpload.sortOrder, draft.bulkUpload.completedSubTab);
|
|
401
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
400
402
|
if (existing != null) {
|
|
401
403
|
existing.fetchState = {
|
|
402
404
|
fetchState: 'Error',
|
|
@@ -404,7 +406,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
404
406
|
};
|
|
405
407
|
}
|
|
406
408
|
else {
|
|
407
|
-
draft.bulkUpload.completedTransactionsByPeriod[
|
|
409
|
+
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
408
410
|
fetchState: { fetchState: 'Error', error: action.payload.error },
|
|
409
411
|
nextPageToken: null,
|
|
410
412
|
totalCount: 0,
|
|
@@ -9,6 +9,7 @@ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
|
9
9
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
10
10
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
11
11
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
12
|
+
const missingReceiptsViewReducer_1 = require("../reducers/missingReceiptsViewReducer");
|
|
12
13
|
function getExpenseAutomationMissingReceiptsView(state) {
|
|
13
14
|
const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
14
15
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
@@ -117,8 +118,11 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
117
118
|
.filter((f) => f.status === 'un_matched' || f.status === 'no_match')
|
|
118
119
|
.map((f) => resolveBatchFile(f, b.batchId, transactionState));
|
|
119
120
|
});
|
|
120
|
-
const
|
|
121
|
-
? bulkUpload.
|
|
121
|
+
const completedTransactionsCacheKey = monthYearPeriodId != null
|
|
122
|
+
? (0, missingReceiptsViewReducer_1.getCompletedTransactionsCacheKey)(monthYearPeriodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab)
|
|
123
|
+
: undefined;
|
|
124
|
+
const completedTransactionsForPeriod = completedTransactionsCacheKey != null
|
|
125
|
+
? bulkUpload.completedTransactionsByPeriod[completedTransactionsCacheKey]
|
|
122
126
|
: undefined;
|
|
123
127
|
const completedTransactionIds = completedTransactionsForPeriod?.transactionIds ?? [];
|
|
124
128
|
const resolvedCompletedTransactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, completedTransactionIds);
|
|
@@ -106,7 +106,7 @@ export interface BulkUploadState {
|
|
|
106
106
|
batchListFetchState: FetchStateAndError;
|
|
107
107
|
batchStatusById: Record<ID, BatchStatus>;
|
|
108
108
|
completedSubTab: CompletedSubTab;
|
|
109
|
-
completedTransactionsByPeriod: Record<
|
|
109
|
+
completedTransactionsByPeriod: Record<string, CompletedTransactionsState>;
|
|
110
110
|
confirmMatchStatus: FetchStateAndError;
|
|
111
111
|
currentResultsTab: BulkUploadResultsTab;
|
|
112
112
|
failedBatchDetailIds: ID[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.37-
|
|
3
|
+
"version": "4.19.37-betaVR14",
|
|
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",
|