diff --git a/src/hooks/useOnboardingFlow.ts b/src/hooks/useOnboardingFlow.ts index dd6fec1bbde7..51d33f40b59c 100644 --- a/src/hooks/useOnboardingFlow.ts +++ b/src/hooks/useOnboardingFlow.ts @@ -33,8 +33,6 @@ function useOnboardingFlowRouter() { const {canUsePrivateDomainOnboardingCheck} = usePermissions(); - const [allBetas, allBetasMetadata] = useOnyx(ONYXKEYS.BETAS); - useEffect(() => { // This should delay opening the onboarding modal so it does not interfere with the ongoing ReportScreen params changes InteractionManager.runAfterInteractions(() => { @@ -89,6 +87,7 @@ function useOnboardingFlowRouter() { dismissedProductTraining?.migratedUserWelcomeModal, dismissedProductTraining, isPrivateDomain, + canUsePrivateDomainOnboardingCheck, ]); return {isOnboardingCompleted, isHybridAppOnboardingCompleted}; diff --git a/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx index 1412926f1a2b..a4f9500dbc27 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx @@ -38,7 +38,7 @@ function OnboardingModalNavigator() { const styles = useThemeStyles(); const {onboardingIsMediumOrLargerScreenWidth} = useResponsiveLayout(); const outerViewRef = React.useRef(null); - const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID ?? 0}); + const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID ?? CONST.DEFAULT_NUMBER_ID}); // Publish a sign_up event when we start the onboarding flow. This should track basic sign ups // as well as Google and Apple SSO. diff --git a/src/libs/actions/Welcome/OnboardingFlow.ts b/src/libs/actions/Welcome/OnboardingFlow.ts index aefd860e513c..32a932eb27b0 100644 --- a/src/libs/actions/Welcome/OnboardingFlow.ts +++ b/src/libs/actions/Welcome/OnboardingFlow.ts @@ -38,7 +38,6 @@ Onyx.connect({ * Start a new onboarding flow or continue from the last visited onboarding page. */ function startOnboardingFlow(isPrivateDomain?: boolean, canUsePrivateDomainOnboardingCheck?: boolean) { - console.log('canUsePrivateDomainOnboardingCheck', canUsePrivateDomainOnboardingCheck); const currentRoute = navigationRef.getCurrentRoute(); const {adaptedState} = getAdaptedStateFromPath(getOnboardingInitialPath(isPrivateDomain, canUsePrivateDomainOnboardingCheck), linkingConfig.config, false); const focusedRoute = findFocusedRoute(adaptedState as PartialState>); diff --git a/src/pages/OnboardingWorkEmail/BaseOnboardingWorkEmail.tsx b/src/pages/OnboardingWorkEmail/BaseOnboardingWorkEmail.tsx index f4667cc75784..a85a60e7ca36 100644 --- a/src/pages/OnboardingWorkEmail/BaseOnboardingWorkEmail.tsx +++ b/src/pages/OnboardingWorkEmail/BaseOnboardingWorkEmail.tsx @@ -23,20 +23,19 @@ import Navigation from '@libs/Navigation/Navigation'; import * as Session from '@userActions/Session'; import * as Welcome from '@userActions/Welcome'; import CONST from '@src/CONST'; -import {TranslationPaths} from '@src/languages/types'; +import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/OnboardingWorkEmailForm'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; import type {BaseOnboardingWorkEmailProps} from './types'; -function BaseOnboardingWorkEmail({shouldUseNativeStyles, route}: BaseOnboardingWorkEmailProps) { +function BaseOnboardingWorkEmail({shouldUseNativeStyles}: BaseOnboardingWorkEmailProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const [onboardingValues] = useOnyx(ONYXKEYS.NVP_ONBOARDING); const [formValue] = useOnyx(ONYXKEYS.FORMS.ONBOARDING_WORK_EMAIL_FORM); const workEmail = formValue?.[INPUT_IDS.ONBOARDING_WORK_EMAIL]; - console.log('workEmailworkEmail', workEmail); const isVsb = onboardingValues && 'signupQualifier' in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB; // We need to use isSmallScreenWidth, see navigateAfterOnboarding function comment // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth @@ -44,25 +43,29 @@ function BaseOnboardingWorkEmail({shouldUseNativeStyles, route}: BaseOnboardingW const {inputCallbackRef} = useAutoFocusInput(); const [shouldValidateOnChange, setShouldValidateOnChange] = useState(false); const {isOffline} = useNetwork(); + const ICON_SIZE = 48; useEffect(() => { Welcome.setOnboardingErrorMessage(''); }, []); - const validatePrivateDomain = useCallback((values: FormOnyxValues<'onboardingWorkEmailForm'>) => { - Session.AddWorkEmail(values[INPUT_IDS.ONBOARDING_WORK_EMAIL]); + const validatePrivateDomain = useCallback( + (values: FormOnyxValues<'onboardingWorkEmailForm'>) => { + Session.AddWorkEmail(values[INPUT_IDS.ONBOARDING_WORK_EMAIL]); - if (onboardingValues && 'shouldValidate' in onboardingValues && onboardingValues.shouldValidate) { - return; - } + if (onboardingValues && 'shouldValidate' in onboardingValues && onboardingValues.shouldValidate) { + return; + } - if (isVsb) { - Navigation.navigate(ROUTES.ONBOARDING_ACCOUNTING.getRoute()); - return; - } + if (isVsb) { + Navigation.navigate(ROUTES.ONBOARDING_ACCOUNTING.getRoute()); + return; + } - Navigation.navigate(ROUTES.ONBOARDING_PURPOSE.getRoute()); - }, []); + Navigation.navigate(ROUTES.ONBOARDING_PURPOSE.getRoute()); + }, + [isVsb, onboardingValues], + ); const validate = (values: FormOnyxValues<'onboardingWorkEmailForm'>) => { if (!shouldValidateOnChange) { @@ -96,26 +99,24 @@ function BaseOnboardingWorkEmail({shouldUseNativeStyles, route}: BaseOnboardingW items: Item[]; }; - const section: SectionObject[] = [ - { - titleTranslationKey: 'onboarding.workEmail.title', - subtitleTranslationKey: 'onboarding.workEmail.subtitle', - items: [ - { - icon: Illustrations.EnvelopeReceipt, - titleTranslationKey: 'onboarding.workEmail.explanationModal.descriptionOne', - }, - { - icon: Illustrations.Profile, - titleTranslationKey: 'onboarding.workEmail.explanationModal.descriptionTwo', - }, - { - icon: Illustrations.Gears, - titleTranslationKey: 'onboarding.workEmail.explanationModal.descriptionThree', - }, - ], - }, - ]; + const section: SectionObject = { + titleTranslationKey: 'onboarding.workEmail.title', + subtitleTranslationKey: 'onboarding.workEmail.subtitle', + items: [ + { + icon: Illustrations.EnvelopeReceipt, + titleTranslationKey: 'onboarding.workEmail.explanationModal.descriptionOne', + }, + { + icon: Illustrations.Profile, + titleTranslationKey: 'onboarding.workEmail.explanationModal.descriptionTwo', + }, + { + icon: Illustrations.Gears, + titleTranslationKey: 'onboarding.workEmail.explanationModal.descriptionThree', + }, + ], + }; const renderItem = useCallback( (item: Item) => ( @@ -139,23 +140,6 @@ function BaseOnboardingWorkEmail({shouldUseNativeStyles, route}: BaseOnboardingW [styles, translate], ); - const renderSection = useCallback( - (section: SectionObject) => ( - - - {translate('onboarding.workEmail.title')} - - - {translate('onboarding.workEmail.subtitle')} - - {section.items.map(renderItem)} - - ), - [shouldUseNarrowLayout, styles, renderItem, translate, onboardingIsMediumOrLargerScreenWidth], - ); - - const ICON_SIZE = 48; - return ( - {section.map(renderSection)} + + + {translate('onboarding.workEmail.title')} + + + {translate('onboarding.workEmail.subtitle')} + + {section.items.map(renderItem)} +