@zeniai/client-epic-state 5.0.25 → 5.0.26
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 +2 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +2 -7
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +5 -5
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -7
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +2 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +4 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -4
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +7 -7
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -7
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -4
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
- package/package.json +1 -1
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -33,15 +33,11 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
33
33
|
const queryPayload = {
|
|
34
34
|
start_date: period.start,
|
|
35
35
|
end_date: period.end,
|
|
36
|
+
sort_by: sortKey,
|
|
37
|
+
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
36
38
|
page_token: action.payload.pageToken ?? null,
|
|
37
39
|
page_size: 25,
|
|
38
40
|
};
|
|
39
|
-
if (sortKey != null) {
|
|
40
|
-
queryPayload.sort_by = sortKey;
|
|
41
|
-
}
|
|
42
|
-
if (sortOrder != null) {
|
|
43
|
-
queryPayload.sort_order = sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
44
|
-
}
|
|
45
41
|
if (completedSubTab !== 'all') {
|
|
46
42
|
queryPayload.match_type = completedSubTab;
|
|
47
43
|
}
|
package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js
CHANGED
|
@@ -35,17 +35,12 @@ const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
|
35
35
|
const state = state$.value;
|
|
36
36
|
const { expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
|
|
37
37
|
const { end, start } = (0, rollingCalendarDateRangeInclusive_1.rollingCalendarDateRangeInclusive)(MANUAL_SEARCH_TRANSACTION_DATE_RANGE_DAYS);
|
|
38
|
-
// Manual search is independent of the Completed tab's optional sort: when the
|
|
39
|
-
// bulk upload sort is neutral (no user-applied sort), fall back to date/desc so
|
|
40
|
-
// search results stay deterministic for the matching UX.
|
|
41
|
-
const manualSearchSortKey = sortKey ?? 'date';
|
|
42
|
-
const manualSearchSortOrder = sortOrder ?? 'descending';
|
|
43
38
|
const queryParam = {
|
|
44
39
|
start_date: start,
|
|
45
40
|
end_date: end,
|
|
46
41
|
auto_categorized: exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
|
|
47
|
-
sort_by: (0, transactionsViewState_1.toTransactionsSortKey)(
|
|
48
|
-
sort_order:
|
|
42
|
+
sort_by: (0, transactionsViewState_1.toTransactionsSortKey)(sortKey),
|
|
43
|
+
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
49
44
|
page_token: pageToken ?? null,
|
|
50
45
|
page_size: manualSearch.pageSize,
|
|
51
46
|
search_text: query,
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts
CHANGED
|
@@ -4,13 +4,11 @@ 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, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, 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 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
|
-
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs)
|
|
11
|
-
* Debounced to reduce duplicate refreshes.
|
|
12
|
-
* (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
|
|
13
|
-
* batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
|
|
10
|
+
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
|
|
11
|
+
* and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
|
|
14
12
|
*/
|
|
15
13
|
export declare const pusherBatchStatusCompletionEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
16
14
|
/**
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
CHANGED
|
@@ -15,16 +15,15 @@ const FALLBACK_FIRST_DELAY_MS = 30000;
|
|
|
15
15
|
const RESTORE_FIRST_DELAY_MS = 5000;
|
|
16
16
|
const FALLBACK_POLL_INTERVAL_MS = 10000;
|
|
17
17
|
/**
|
|
18
|
-
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs)
|
|
19
|
-
* Debounced to reduce duplicate refreshes.
|
|
20
|
-
* (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
|
|
21
|
-
* batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
|
|
18
|
+
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
|
|
19
|
+
* and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
|
|
22
20
|
*/
|
|
23
21
|
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.debounceTime)(300), (0, operators_1.mergeMap)(() => (0, rxjs_1.from)([
|
|
24
22
|
(0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({
|
|
25
23
|
cacheOverride: true,
|
|
26
24
|
invalidateBatchDetailsCache: true,
|
|
27
25
|
}),
|
|
26
|
+
(0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }),
|
|
28
27
|
])));
|
|
29
28
|
exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
|
|
30
29
|
/**
|
|
@@ -82,6 +81,7 @@ const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
82
81
|
}
|
|
83
82
|
actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
84
83
|
actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }));
|
|
84
|
+
actions.push((0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }));
|
|
85
85
|
return (0, rxjs_1.from)(actions);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -7,7 +7,7 @@ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/tra
|
|
|
7
7
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
9
9
|
import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type CompletedSubTab, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
10
|
-
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey
|
|
10
|
+
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey, sortOrder: SortOrder, subTab: CompletedSubTab) => string;
|
|
11
11
|
export declare const initialBulkUploadState: BulkUploadState;
|
|
12
12
|
export declare const initialState: MissingReceiptsViewState;
|
|
13
13
|
/** Epic trigger only; batch-details fetch is handled in epics. */
|
|
@@ -85,8 +85,8 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
85
85
|
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatchSuccess">, confirmBulkUploadMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
86
86
|
error: ZeniAPIStatus;
|
|
87
87
|
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatchFailure">, setBulkUploadResultsTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"completed" | "unmatched", "expenseAutomationMissingReceiptsView/setBulkUploadResultsTab">, setBulkUploadCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"all" | "manual" | "ai_accountant", "expenseAutomationMissingReceiptsView/setBulkUploadCompletedSubTab">, setBulkUploadSortConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
88
|
-
sortKey: BulkUploadSortKey
|
|
89
|
-
sortOrder: SortOrder
|
|
88
|
+
sortKey: BulkUploadSortKey;
|
|
89
|
+
sortOrder: SortOrder;
|
|
90
90
|
}, "expenseAutomationMissingReceiptsView/setBulkUploadSortConfig">, clearBulkUpload: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearBulkUpload">, searchTransactionsForManualMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[query: string, pageToken?: string | null | undefined], {
|
|
91
91
|
query: string;
|
|
92
92
|
pageToken: string | undefined;
|
|
@@ -105,16 +105,16 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
105
105
|
isInitialLoad: boolean;
|
|
106
106
|
nextPageToken: string | null;
|
|
107
107
|
selectedPeriod: MonthYearPeriod;
|
|
108
|
-
sortKey: BulkUploadSortKey
|
|
109
|
-
sortOrder: SortOrder
|
|
108
|
+
sortKey: BulkUploadSortKey;
|
|
109
|
+
sortOrder: SortOrder;
|
|
110
110
|
totalCount: number;
|
|
111
111
|
transactionIds: ID[];
|
|
112
112
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsSuccess">, fetchCompletedTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
113
113
|
completedSubTab: CompletedSubTab;
|
|
114
114
|
error: ZeniAPIStatus;
|
|
115
115
|
selectedPeriod: MonthYearPeriod;
|
|
116
|
-
sortKey: BulkUploadSortKey
|
|
117
|
-
sortOrder: SortOrder
|
|
116
|
+
sortKey: BulkUploadSortKey;
|
|
117
|
+
sortOrder: SortOrder;
|
|
118
118
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsFailure">;
|
|
119
119
|
declare const _default: import("redux").Reducer<MissingReceiptsViewState>;
|
|
120
120
|
export default _default;
|
|
@@ -5,11 +5,7 @@ exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSu
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
8
|
-
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => {
|
|
9
|
-
const sortKeyPart = sortKey ?? 'none';
|
|
10
|
-
const sortOrderPart = sortOrder == null ? 'none' : sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
11
|
-
return `completed-${subTab}-${sortKeyPart}-${sortOrderPart}-${periodId}`;
|
|
12
|
-
};
|
|
8
|
+
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => `completed-${subTab}-${sortKey}-${sortOrder === 'ascending' ? 'asc' : 'desc'}-${periodId}`;
|
|
13
9
|
exports.getCompletedTransactionsCacheKey = getCompletedTransactionsCacheKey;
|
|
14
10
|
exports.initialBulkUploadState = {
|
|
15
11
|
batchDetailsById: {},
|
|
@@ -34,8 +30,8 @@ exports.initialBulkUploadState = {
|
|
|
34
30
|
totalCount: 0,
|
|
35
31
|
},
|
|
36
32
|
phase: 'idle',
|
|
37
|
-
sortKey:
|
|
38
|
-
sortOrder:
|
|
33
|
+
sortKey: 'date',
|
|
34
|
+
sortOrder: 'descending',
|
|
39
35
|
uploadedFileCount: 0,
|
|
40
36
|
uploadProgress: 0,
|
|
41
37
|
uploadStatus: { fetchState: 'Not-Started', error: undefined },
|
|
@@ -48,14 +48,12 @@ export interface BulkUploadSelectorData {
|
|
|
48
48
|
processed: number;
|
|
49
49
|
total: number;
|
|
50
50
|
};
|
|
51
|
-
sortKey: BulkUploadSortKey
|
|
52
|
-
sortOrder: SortOrder
|
|
51
|
+
sortKey: BulkUploadSortKey;
|
|
52
|
+
sortOrder: SortOrder;
|
|
53
53
|
unmatchedFiles: ResolvedBatchFile[];
|
|
54
54
|
uploadedFileCount: number;
|
|
55
55
|
uploadProgress: number;
|
|
56
56
|
uploadStatus: FetchStateAndError;
|
|
57
|
-
/** True iff `batchDetailsById[currentBatchId]` is populated -- signals post-match data is fresh. */
|
|
58
|
-
currentBatchDetailsFetched?: boolean;
|
|
59
57
|
currentBatchId?: ID;
|
|
60
58
|
}
|
|
61
59
|
export interface ResolvedBatchDetails {
|
|
@@ -205,8 +205,6 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
205
205
|
batchDetails: resolvedBatchDetails,
|
|
206
206
|
completedSubTab: bulkUpload.completedSubTab,
|
|
207
207
|
currentBatchId: bulkUpload.currentBatchId,
|
|
208
|
-
currentBatchDetailsFetched: bulkUpload.currentBatchId != null &&
|
|
209
|
-
bulkUpload.batchDetailsById[bulkUpload.currentBatchId] != null,
|
|
210
208
|
completedTransactions: {
|
|
211
209
|
fetchState: completedTransactionsForPeriod?.fetchState ?? {
|
|
212
210
|
fetchState: 'Not-Started',
|
|
@@ -145,8 +145,8 @@ export interface BulkUploadState {
|
|
|
145
145
|
manualSearch: ManualSearchState;
|
|
146
146
|
manualSearchUiResetKey: number;
|
|
147
147
|
phase: BulkUploadPhase;
|
|
148
|
-
sortKey: BulkUploadSortKey
|
|
149
|
-
sortOrder: SortOrder
|
|
148
|
+
sortKey: BulkUploadSortKey;
|
|
149
|
+
sortOrder: SortOrder;
|
|
150
150
|
uploadedFileCount: number;
|
|
151
151
|
uploadProgress: number;
|
|
152
152
|
uploadStatus: FetchStateAndError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.26",
|
|
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",
|