@zeniai/client-epic-state 5.0.12-betaVR1 → 5.0.12

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.
@@ -30,15 +30,11 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
30
30
  const queryPayload = {
31
31
  start_date: period.start,
32
32
  end_date: period.end,
33
+ sort_by: sortKey,
34
+ sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
33
35
  page_token: action.payload.pageToken ?? null,
34
36
  page_size: 25,
35
37
  };
36
- if (sortKey != null) {
37
- queryPayload.sort_by = sortKey;
38
- }
39
- if (sortOrder != null) {
40
- queryPayload.sort_order = sortOrder === 'ascending' ? 'asc' : 'desc';
41
- }
42
38
  if (completedSubTab !== 'all') {
43
39
  queryPayload.match_type = completedSubTab;
44
40
  }
@@ -32,17 +32,12 @@ export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI)
32
32
  const state = state$.value;
33
33
  const { expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
34
34
  const { end, start } = rollingCalendarDateRangeInclusive(MANUAL_SEARCH_TRANSACTION_DATE_RANGE_DAYS);
35
- // Manual search is independent of the Completed tab's optional sort: when the
36
- // bulk upload sort is neutral (no user-applied sort), fall back to date/desc so
37
- // search results stay deterministic for the matching UX.
38
- const manualSearchSortKey = sortKey ?? 'date';
39
- const manualSearchSortOrder = sortOrder ?? 'descending';
40
35
  const queryParam = {
41
36
  start_date: start,
42
37
  end_date: end,
43
38
  auto_categorized: MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
44
- sort_by: toTransactionsSortKey(manualSearchSortKey),
45
- sort_order: manualSearchSortOrder === 'ascending' ? 'asc' : 'desc',
39
+ sort_by: toTransactionsSortKey(sortKey),
40
+ sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
46
41
  page_token: pageToken ?? null,
47
42
  page_size: manualSearch.pageSize,
48
43
  search_text: query,
@@ -1,11 +1,7 @@
1
1
  import { createAction, createSlice } from '@reduxjs/toolkit';
2
2
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
3
3
  import { MIN_MANUAL_TRANSACTION_SEARCH_LENGTH, } from '../types/missingReceiptsViewState';
4
- export const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => {
5
- const sortKeyPart = sortKey ?? 'none';
6
- const sortOrderPart = sortOrder == null ? 'none' : sortOrder === 'ascending' ? 'asc' : 'desc';
7
- return `completed-${subTab}-${sortKeyPart}-${sortOrderPart}-${periodId}`;
8
- };
4
+ export const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => `completed-${subTab}-${sortKey}-${sortOrder === 'ascending' ? 'asc' : 'desc'}-${periodId}`;
9
5
  export const initialBulkUploadState = {
10
6
  batchDetailsById: {},
11
7
  batchDetailsPaginationState: { fetchState: 'Not-Started', error: undefined },
@@ -29,8 +25,8 @@ export const initialBulkUploadState = {
29
25
  totalCount: 0,
30
26
  },
31
27
  phase: 'idle',
32
- sortKey: undefined,
33
- sortOrder: undefined,
28
+ sortKey: 'date',
29
+ sortOrder: 'descending',
34
30
  uploadedFileCount: 0,
35
31
  uploadProgress: 0,
36
32
  uploadStatus: { fetchState: 'Not-Started', error: undefined },