@zeniai/client-epic-state 4.19.84-betaVR4 → 4.19.84-betaVR6
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/searchTransactionsForManualMatchEpic.js +10 -5
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +4 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +10 -5
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +4 -3
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +4 -0
- package/package.json +1 -1
package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js
CHANGED
|
@@ -19,12 +19,17 @@ exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
|
|
|
19
19
|
const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
20
20
|
const searchActions$ = actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.searchTransactionsForManualMatch.match));
|
|
21
21
|
const pagination$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken != null));
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/**
|
|
23
|
+
* No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
|
|
24
|
+
*/
|
|
25
|
+
const newSearchTooShortOrClear$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null &&
|
|
26
|
+
a.payload.query.trim().length < 2));
|
|
27
|
+
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null &&
|
|
28
|
+
a.payload.query.trim().length >= 2), (0, operators_1.debounceTime)(300));
|
|
29
|
+
return (0, rxjs_1.merge)(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
26
30
|
const { query, pageToken } = action.payload;
|
|
27
|
-
if (pageToken == null &&
|
|
31
|
+
if (pageToken == null &&
|
|
32
|
+
query.trim().length < 2) {
|
|
28
33
|
return rxjs_1.EMPTY;
|
|
29
34
|
}
|
|
30
35
|
const state = state$.value;
|
|
@@ -5,7 +5,7 @@ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePerio
|
|
|
5
5
|
import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
|
|
6
6
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
7
7
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
8
|
-
import type
|
|
8
|
+
import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type CompletedSubTab, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
9
9
|
import type { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
10
10
|
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey, sortOrder: SortOrder, subTab: CompletedSubTab) => string;
|
|
11
11
|
export declare const initialBulkUploadState: BulkUploadState;
|
|
@@ -391,10 +391,11 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
391
391
|
const isLoadMore = pageToken != null;
|
|
392
392
|
const trimmed = query.trim();
|
|
393
393
|
/**
|
|
394
|
-
* Cleared
|
|
395
|
-
*
|
|
394
|
+
* Cleared or too-short query: no API (see epic). Reset fully (no In-Progress) so loading
|
|
395
|
+
* UI never shows; bump key so inputs remount.
|
|
396
396
|
*/
|
|
397
|
-
if (!isLoadMore &&
|
|
397
|
+
if (!isLoadMore &&
|
|
398
|
+
trimmed.length < 2) {
|
|
398
399
|
draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
|
|
399
400
|
draft.bulkUpload.manualSearchUiResetKey += 1;
|
|
400
401
|
return;
|
|
@@ -13,6 +13,10 @@ export interface MissingReceiptsViewUIState {
|
|
|
13
13
|
sortKey: MissingReceiptsSortKey;
|
|
14
14
|
sortOrder: SortOrder;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Minimum trimmed query length before manual-match search calls the expense-automation API.
|
|
18
|
+
* Kept in sync with `ManualSearchInput` in web-components (fires search only when length ≥ this).
|
|
19
|
+
*/
|
|
16
20
|
export type BatchStatusValue = 'pending' | 'processing' | 'completed';
|
|
17
21
|
export type BatchFileStatus = 'matched' | 'un_matched' | 'no_match' | 'failed';
|
|
18
22
|
export type BulkUploadPhase = 'idle' | 'uploading' | 'matching' | 'completed';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.84-
|
|
3
|
+
"version": "4.19.84-betaVR6",
|
|
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",
|