@zeniai/client-epic-state 4.19.84-betaVR6 → 4.19.84-betaVR7
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/reducers/missingReceiptsViewReducer.js +12 -4
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +6 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +12 -4
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +7 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
import { MIN_MANUAL_TRANSACTION_SEARCH_LENGTH, } from '../types/missingReceiptsViewState';
|
|
3
4
|
export const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => `completed-${subTab}-${sortKey}-${sortOrder === 'ascending' ? 'asc' : 'desc'}-${periodId}`;
|
|
4
5
|
export const initialBulkUploadState = {
|
|
5
6
|
batchDetailsById: {},
|
|
@@ -386,13 +387,20 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
386
387
|
const isLoadMore = pageToken != null;
|
|
387
388
|
const trimmed = query.trim();
|
|
388
389
|
/**
|
|
389
|
-
* Cleared or too-short query: no API (see epic). Reset fully (no In-Progress)
|
|
390
|
-
*
|
|
390
|
+
* Cleared or too-short query: no API (see epic). Reset fully (no In-Progress).
|
|
391
|
+
* Only bump `manualSearchUiResetKey` when clearing a real search — not when the UI
|
|
392
|
+
* dispatches `""` on every keystroke while length is below MIN (web-components always sends
|
|
393
|
+
* `onSearch("")` in that case), or ReceiptCard remounts and the input loses focus.
|
|
391
394
|
*/
|
|
392
395
|
if (!isLoadMore &&
|
|
393
|
-
trimmed.length <
|
|
396
|
+
trimmed.length < MIN_MANUAL_TRANSACTION_SEARCH_LENGTH) {
|
|
397
|
+
const hadActiveSearch = draft.bulkUpload.manualSearch.searchQuery.trim().length >=
|
|
398
|
+
MIN_MANUAL_TRANSACTION_SEARCH_LENGTH ||
|
|
399
|
+
draft.bulkUpload.manualSearch.results.length > 0;
|
|
394
400
|
draft.bulkUpload.manualSearch = initialBulkUploadState.manualSearch;
|
|
395
|
-
|
|
401
|
+
if (hadActiveSearch) {
|
|
402
|
+
draft.bulkUpload.manualSearchUiResetKey += 1;
|
|
403
|
+
}
|
|
396
404
|
return;
|
|
397
405
|
}
|
|
398
406
|
draft.bulkUpload.manualSearch.searchQuery = query;
|
|
@@ -7,3 +7,9 @@ const MISSING_RECEIPTS_SORT_KEYS = [
|
|
|
7
7
|
'amount',
|
|
8
8
|
];
|
|
9
9
|
export const toMissingReceiptsSortKey = (v) => stringToUnion(v, MISSING_RECEIPTS_SORT_KEYS);
|
|
10
|
+
// -- Bulk Receipt Upload Types --
|
|
11
|
+
/**
|
|
12
|
+
* Minimum trimmed query length before manual-match search calls the expense-automation API.
|
|
13
|
+
* Kept in sync with `ManualSearchInput` in web-components (fires search only when length ≥ this).
|
|
14
|
+
*/
|
|
15
|
+
export const MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = 2;
|