@@ -8,7 +8,7 @@ import type DotLottieAnimation from '@components/LottieAnimations/types';
88import type { MenuItemWithLink } from '@components/MenuItemList' ;
99import type { MultiSelectItem } from '@components/Search/FilterDropdowns/MultiSelectPopup' ;
1010import type { SingleSelectItem } from '@components/Search/FilterDropdowns/SingleSelectPopup' ;
11- import type { SearchColumnType , SearchGroupBy , SearchQueryJSON , SearchStatus , SingularSearchStatus , SortOrder } from '@components/Search/types' ;
11+ import type { SearchColumnType , SearchDateFilterKeys , SearchDatePreset , SearchGroupBy , SearchQueryJSON , SearchStatus , SingularSearchStatus , SortOrder } from '@components/Search/types' ;
1212import ChatListItem from '@components/SelectionList/ChatListItem' ;
1313import TaskListItem from '@components/SelectionList/Search/TaskListItem' ;
1414import TransactionGroupListItem from '@components/SelectionList/Search/TransactionGroupListItem' ;
@@ -51,7 +51,6 @@ import type {CardFeedForDisplay} from './CardFeedUtils';
5151import { getCardFeedsForDisplay } from './CardFeedUtils' ;
5252import { convertToDisplayString } from './CurrencyUtils' ;
5353import DateUtils from './DateUtils' ;
54- import { isDevelopment } from './Environment/Environment' ;
5554import interceptAnonymousUser from './interceptAnonymousUser' ;
5655import { formatPhoneNumber } from './LocalePhoneNumber' ;
5756import { translateLocal } from './Localize' ;
@@ -366,8 +365,8 @@ function getSuggestedSearchesVisibility(
366365 let shouldShowApproveSuggestion = false ;
367366 let shouldShowExportSuggestion = false ;
368367 let shouldShowStatementsSuggestion = false ;
369- let showShowUnapprovedCashSuggestion = false ;
370- let showShowUnapprovedCardSuggestion = false ;
368+ let shouldShowUnapprovedCashSuggestion = false ;
369+ let shouldShowUnapprovedCardSuggestion = false ;
371370 let shouldShowReconciliationSuggestion = false ;
372371
373372 Object . values ( policies ?? { } ) . some ( ( policy ) => {
@@ -400,8 +399,8 @@ function getSuggestedSearchesVisibility(
400399 shouldShowApproveSuggestion ||= isEligibleForApproveSuggestion ;
401400 shouldShowExportSuggestion ||= isEligibleForExportSuggestion ;
402401 shouldShowStatementsSuggestion ||= isEligibleForStatementsSuggestion ;
403- showShowUnapprovedCashSuggestion ||= isEligibleForUnapprovedCashSuggestion ;
404- showShowUnapprovedCardSuggestion ||= isEligibleForUnapprovedCardSuggestion ;
402+ shouldShowUnapprovedCashSuggestion ||= isEligibleForUnapprovedCashSuggestion ;
403+ shouldShowUnapprovedCardSuggestion ||= isEligibleForUnapprovedCardSuggestion ;
405404 shouldShowReconciliationSuggestion ||= isEligibleForReconciliationSuggestion ;
406405
407406 // We don't need to check the rest of the policies if we already determined that all suggestions should be displayed
@@ -411,8 +410,8 @@ function getSuggestedSearchesVisibility(
411410 shouldShowApproveSuggestion &&
412411 shouldShowExportSuggestion &&
413412 shouldShowStatementsSuggestion &&
414- showShowUnapprovedCashSuggestion &&
415- showShowUnapprovedCardSuggestion &&
413+ shouldShowUnapprovedCashSuggestion &&
414+ shouldShowUnapprovedCardSuggestion &&
416415 shouldShowReconciliationSuggestion
417416 ) ;
418417 } ) ;
@@ -425,10 +424,9 @@ function getSuggestedSearchesVisibility(
425424 [ CONST . SEARCH . SEARCH_KEYS . PAY ] : shouldShowPaySuggestion ,
426425 [ CONST . SEARCH . SEARCH_KEYS . APPROVE ] : shouldShowApproveSuggestion ,
427426 [ CONST . SEARCH . SEARCH_KEYS . EXPORT ] : shouldShowExportSuggestion ,
428- // s77rt remove DEV lock
429- [ CONST . SEARCH . SEARCH_KEYS . STATEMENTS ] : shouldShowStatementsSuggestion && isDevelopment ( ) ,
430- [ CONST . SEARCH . SEARCH_KEYS . UNAPPROVED_CASH ] : showShowUnapprovedCashSuggestion ,
431- [ CONST . SEARCH . SEARCH_KEYS . UNAPPROVED_CARD ] : showShowUnapprovedCardSuggestion ,
427+ [ CONST . SEARCH . SEARCH_KEYS . STATEMENTS ] : shouldShowStatementsSuggestion ,
428+ [ CONST . SEARCH . SEARCH_KEYS . UNAPPROVED_CASH ] : shouldShowUnapprovedCashSuggestion ,
429+ [ CONST . SEARCH . SEARCH_KEYS . UNAPPROVED_CARD ] : shouldShowUnapprovedCardSuggestion ,
432430 } ;
433431}
434432
@@ -1857,6 +1855,17 @@ function getFeedOptions(allCardFeeds: OnyxCollection<OnyxTypes.CardFeeds>, allCa
18571855 } ) ) ;
18581856}
18591857
1858+ function getDatePresets ( filterKey : SearchDateFilterKeys , hasFeed : boolean ) : SearchDatePreset [ ] | undefined {
1859+ switch ( filterKey ) {
1860+ case CONST . SEARCH . SYNTAX_FILTER_KEYS . POSTED :
1861+ return [ ...( hasFeed ? [ CONST . SEARCH . DATE_PRESETS . LAST_STATEMENT ] : [ ] ) , CONST . SEARCH . DATE_PRESETS . LAST_MONTH ] ;
1862+ case CONST . SEARCH . SYNTAX_FILTER_KEYS . EXPORTED :
1863+ return [ CONST . SEARCH . DATE_PRESETS . NEVER ] ;
1864+ default :
1865+ return undefined ;
1866+ }
1867+ }
1868+
18601869export {
18611870 getSuggestedSearches ,
18621871 getListItem ,
@@ -1890,5 +1899,6 @@ export {
18901899 getWideAmountIndicators ,
18911900 isTransactionAmountTooLong ,
18921901 isTransactionTaxAmountTooLong ,
1902+ getDatePresets ,
18931903} ;
18941904export type { SavedSearchMenuItem , SearchTypeMenuSection , SearchTypeMenuItem , SearchDateModifier , SearchDateModifierLower , SearchKey , ArchivedReportsIDSet } ;
0 commit comments