@zeniai/client-epic-state 5.0.3-betaRD1 → 5.0.3-betaVR10
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/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +1 -9
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -16
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -16
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +22 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +22 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +8 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +6 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -3
- package/package.json +1 -1
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -15,7 +15,15 @@ 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
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Snapshot sort config + subTab at request time so success/failure write
|
|
20
|
+
* into the same cache key the request was made under, even if the user
|
|
21
|
+
* toggles sort while the request is in flight.
|
|
22
|
+
*/
|
|
23
|
+
const sortKey = bulkUpload.sortKey;
|
|
24
|
+
const sortOrder = bulkUpload.sortOrder;
|
|
25
|
+
const completedSubTab = bulkUpload.completedSubTab;
|
|
26
|
+
const cacheKey = (0, missingReceiptsViewReducer_1.getCompletedTransactionsCacheKey)(periodId, sortKey, sortOrder, completedSubTab);
|
|
19
27
|
const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
20
28
|
if (isInitialLoad &&
|
|
21
29
|
action.payload.cacheOverride !== true &&
|
|
@@ -27,13 +35,13 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
27
35
|
const queryPayload = {
|
|
28
36
|
start_date: period.start,
|
|
29
37
|
end_date: period.end,
|
|
30
|
-
sort_by:
|
|
31
|
-
sort_order:
|
|
38
|
+
sort_by: sortKey,
|
|
39
|
+
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
32
40
|
page_token: action.payload.pageToken ?? null,
|
|
33
41
|
page_size: 25,
|
|
34
42
|
};
|
|
35
|
-
if (
|
|
36
|
-
queryPayload.match_type =
|
|
43
|
+
if (completedSubTab !== 'all') {
|
|
44
|
+
queryPayload.match_type = completedSubTab;
|
|
37
45
|
}
|
|
38
46
|
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
39
47
|
return zeniAPI
|
|
@@ -49,17 +57,26 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
49
57
|
nextPageToken: response.data.next_page_token,
|
|
50
58
|
totalCount: response.data.total_count,
|
|
51
59
|
selectedPeriod,
|
|
60
|
+
sortKey,
|
|
61
|
+
sortOrder,
|
|
62
|
+
completedSubTab,
|
|
52
63
|
}));
|
|
53
64
|
return (0, rxjs_1.from)(updateActions);
|
|
54
65
|
}
|
|
55
66
|
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchCompletedTransactionsFailure)({
|
|
56
67
|
error: response.status,
|
|
57
68
|
selectedPeriod,
|
|
69
|
+
sortKey,
|
|
70
|
+
sortOrder,
|
|
71
|
+
completedSubTab,
|
|
58
72
|
}));
|
|
59
73
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchCompletedTransactionsFailure)({
|
|
60
74
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch completed transactions errored: ' +
|
|
61
75
|
JSON.stringify(error)),
|
|
62
76
|
selectedPeriod,
|
|
77
|
+
sortKey,
|
|
78
|
+
sortOrder,
|
|
79
|
+
completedSubTab,
|
|
63
80
|
}))));
|
|
64
81
|
}));
|
|
65
82
|
exports.fetchCompletedTransactionsEpic = fetchCompletedTransactionsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
4
4
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
5
5
|
import { RootState } from '../../../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
-
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof restoreBulkUploadMatchingState> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof requestMissingReceiptsTabNavigation> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
|
|
7
|
+
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof restoreBulkUploadMatchingState> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof requestMissingReceiptsTabNavigation> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
|
|
9
9
|
/**
|
|
10
10
|
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
|
|
11
11
|
* and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
CHANGED
|
@@ -39,9 +39,17 @@ const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe((0
|
|
|
39
39
|
if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
|
|
40
40
|
return rxjs_1.EMPTY;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Also request the single-batch details directly so the "X out of Y Receipts Matched"
|
|
44
|
+
* toast still fires when the backend actually completed between the last Pusher ping
|
|
45
|
+
* and this timeout. If Pusher already tagged the batch as still `processing`,
|
|
46
|
+
* `fetchBulkUploadBatchDetailsEpic`'s guard will skip the call and we simply rely on
|
|
47
|
+
* the list refresh to eventually populate details via `fetchMultipleBatchDetailsEpic`.
|
|
48
|
+
*/
|
|
42
49
|
return (0, rxjs_1.from)([
|
|
43
50
|
(0, missingReceiptsViewReducer_1.bulkUploadAutomatchingTimedOut)(batchId),
|
|
44
51
|
(0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }),
|
|
52
|
+
(0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails)(),
|
|
45
53
|
]);
|
|
46
54
|
}), (0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((a) => a.payload.batchId === batchId &&
|
|
47
55
|
a.payload.status === 'completed')), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match), (0, operators_1.filter)((a) => a.payload.batchId === batchId)))));
|
|
@@ -101,14 +101,20 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
101
101
|
pageToken: string | undefined;
|
|
102
102
|
cacheOverride: boolean | undefined;
|
|
103
103
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactions", never, never>, fetchCompletedTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
104
|
+
completedSubTab: CompletedSubTab;
|
|
104
105
|
isInitialLoad: boolean;
|
|
105
106
|
nextPageToken: string | null;
|
|
106
107
|
selectedPeriod: MonthYearPeriod;
|
|
108
|
+
sortKey: BulkUploadSortKey;
|
|
109
|
+
sortOrder: SortOrder;
|
|
107
110
|
totalCount: number;
|
|
108
111
|
transactionIds: ID[];
|
|
109
112
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsSuccess">, fetchCompletedTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
113
|
+
completedSubTab: CompletedSubTab;
|
|
110
114
|
error: ZeniAPIStatus;
|
|
111
115
|
selectedPeriod: MonthYearPeriod;
|
|
116
|
+
sortKey: BulkUploadSortKey;
|
|
117
|
+
sortOrder: SortOrder;
|
|
112
118
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsFailure">;
|
|
113
119
|
declare const _default: import("redux").Reducer<MissingReceiptsViewState>;
|
|
114
120
|
export default _default;
|
|
@@ -527,9 +527,9 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
527
527
|
},
|
|
528
528
|
},
|
|
529
529
|
fetchCompletedTransactionsSuccess(draft, action) {
|
|
530
|
-
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad, } = action.payload;
|
|
530
|
+
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad, sortKey, sortOrder, completedSubTab, } = action.payload;
|
|
531
531
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
532
|
-
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId,
|
|
532
|
+
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, sortKey, sortOrder, completedSubTab);
|
|
533
533
|
if (isInitialLoad) {
|
|
534
534
|
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
535
535
|
transactionIds,
|
|
@@ -558,7 +558,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
558
558
|
},
|
|
559
559
|
fetchCompletedTransactionsFailure(draft, action) {
|
|
560
560
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
|
|
561
|
-
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId,
|
|
561
|
+
const cacheKey = (0, exports.getCompletedTransactionsCacheKey)(periodId, action.payload.sortKey, action.payload.sortOrder, action.payload.completedSubTab);
|
|
562
562
|
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
563
563
|
if (existing != null) {
|
|
564
564
|
existing.fetchState = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.3-
|
|
3
|
+
"version": "5.0.3-betaVR10",
|
|
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",
|