11import React , { useMemo , useRef , useState } from 'react' ;
22// eslint-disable-next-line no-restricted-imports
33import type { GestureResponderEvent , ImageStyle , Text as RNText , TextStyle , ViewStyle } from 'react-native' ;
4- import { InteractionManager , Linking , View } from 'react-native' ;
4+ import { Linking , View } from 'react-native' ;
55import type { OnyxCollection } from 'react-native-onyx' ;
66import type { ValueOf } from 'type-fest' ;
77import BookTravelButton from '@components/BookTravelButton' ;
@@ -28,10 +28,10 @@ import useThemeStyles from '@hooks/useThemeStyles';
2828import { startMoneyRequest } from '@libs/actions/IOU' ;
2929import { openOldDotLink } from '@libs/actions/Link' ;
3030import { createNewReport } from '@libs/actions/Report' ;
31- import { completeTestDriveTask } from '@libs/actions/Task ' ;
31+ import { startTestDrive } from '@libs/actions/Tour ' ;
3232import interceptAnonymousUser from '@libs/interceptAnonymousUser' ;
3333import Navigation from '@libs/Navigation/Navigation' ;
34- import { hasSeenTourSelector } from '@libs/onboardingSelectors' ;
34+ import { hasSeenTourSelector , tryNewDotOnyxSelector } from '@libs/onboardingSelectors' ;
3535import { areAllGroupPoliciesExpenseChatDisabled , getGroupPaidPoliciesWithExpenseChatEnabled , isPaidGroupPolicy } from '@libs/PolicyUtils' ;
3636import { generateReportID } from '@libs/ReportUtils' ;
3737import { shouldRestrictUserBillableActions } from '@libs/SubscriptionUtils' ;
@@ -90,6 +90,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
9090 const [ transactions ] = useOnyx ( ONYXKEYS . COLLECTION . TRANSACTION , {
9191 canBeMissing : true ,
9292 } ) ;
93+ const [ tryNewDot ] = useOnyx ( ONYXKEYS . NVP_TRY_NEW_DOT , { selector : tryNewDotOnyxSelector , canBeMissing : true } ) ;
9394
9495 const groupPoliciesWithChatEnabled = getGroupPaidPoliciesWithExpenseChatEnabled ( ) ;
9596
@@ -194,20 +195,8 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
194195 }
195196 }
196197
197- const startTestDrive = ( ) => {
198- InteractionManager . runAfterInteractions ( ( ) => {
199- if (
200- introSelected ?. choice === CONST . ONBOARDING_CHOICES . MANAGE_TEAM ||
201- introSelected ?. choice === CONST . ONBOARDING_CHOICES . TEST_DRIVE_RECEIVER ||
202- introSelected ?. choice === CONST . ONBOARDING_CHOICES . TRACK_WORKSPACE ||
203- ( introSelected ?. choice === CONST . ONBOARDING_CHOICES . SUBMIT && introSelected . inviteType === CONST . ONBOARDING_INVITE_TYPES . WORKSPACE )
204- ) {
205- completeTestDriveTask ( ) ;
206- Navigation . navigate ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
207- } else {
208- Navigation . navigate ( ROUTES . TEST_DRIVE_MODAL_ROOT . route ) ;
209- }
210- } ) ;
198+ const startTestDriveAction = ( ) => {
199+ startTestDrive ( introSelected , false , tryNewDot ?. hasBeenAddedToNudgeMigration ) ;
211200 } ;
212201
213202 // If we are grouping by reports, show a custom message rather than a type-specific message
@@ -229,7 +218,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
229218 ? [
230219 {
231220 buttonText : translate ( 'emptySearchView.takeATestDrive' ) ,
232- buttonAction : startTestDrive ,
221+ buttonAction : startTestDriveAction ,
233222 } ,
234223 ]
235224 : [ ] ) ,
@@ -296,7 +285,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
296285 ? [
297286 {
298287 buttonText : translate ( 'emptySearchView.takeATestDrive' ) ,
299- buttonAction : startTestDrive ,
288+ buttonAction : startTestDriveAction ,
300289 } ,
301290 ]
302291 : [ ] ) ,
@@ -327,7 +316,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
327316 ? [
328317 {
329318 buttonText : translate ( 'emptySearchView.takeATestDrive' ) ,
330- buttonAction : startTestDrive ,
319+ buttonAction : startTestDriveAction ,
331320 } ,
332321 ]
333322 : [ ] ) ,
@@ -369,8 +358,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
369358 styles . emptyStateFolderWebStyles ,
370359 styles . textAlignLeft ,
371360 styles . tripEmptyStateLottieWebView ,
372- introSelected ?. choice ,
373- introSelected ?. inviteType ,
361+ introSelected ,
374362 hasResults ,
375363 defaultViewItemHeader ,
376364 hasSeenTour ,
@@ -381,6 +369,7 @@ function EmptySearchView({hash, type, groupBy, hasResults}: EmptySearchViewProps
381369 tripViewChildren ,
382370 shouldRedirectToExpensifyClassic ,
383371 transactions ,
372+ tryNewDot ?. hasBeenAddedToNudgeMigration ,
384373 ] ) ;
385374
386375 return (
0 commit comments