@@ -21,6 +21,7 @@ import { ProgressiveEnhancementContextProvider } from '@dailydotdev/shared/src/c
2121import { SubscriptionContextProvider } from '@dailydotdev/shared/src/contexts/SubscriptionContext' ;
2222import { ShortcutsProvider } from '@dailydotdev/shared/src/features/shortcuts/contexts/ShortcutsProvider' ;
2323import { canonicalFromRouter } from '@dailydotdev/shared/src/lib/canonical' ;
24+ import { featureInlineLogin } from '@dailydotdev/shared/src/lib/featureManagement' ;
2425import '@dailydotdev/shared/src/styles/globals.css' ;
2526import useLogPageView from '@dailydotdev/shared/src/hooks/log/useLogPageView' ;
2627import { BootDataProvider } from '@dailydotdev/shared/src/contexts/BootProvider' ;
@@ -36,7 +37,10 @@ import { LazyModal } from '@dailydotdev/shared/src/components/modals/common/type
3637import { defaultQueryClientConfig } from '@dailydotdev/shared/src/lib/query' ;
3738import { useWebVitals } from '@dailydotdev/shared/src/hooks/useWebVitals' ;
3839import { LazyModalElement } from '@dailydotdev/shared/src/components/modals/LazyModalElement' ;
39- import { useManualScrollRestoration } from '@dailydotdev/shared/src/hooks' ;
40+ import {
41+ useConditionalFeature ,
42+ useManualScrollRestoration ,
43+ } from '@dailydotdev/shared/src/hooks' ;
4044import { useScrollbarWidth } from '@dailydotdev/shared/src/hooks/useScrollbarWidth' ;
4145import { PushNotificationContextProvider } from '@dailydotdev/shared/src/contexts/PushNotificationContext' ;
4246import { SerwistProvider } from '@serwist/turbopack/react' ;
@@ -102,9 +106,8 @@ const onboardingExcludedPaths = [
102106 '/jobs' ,
103107 '/settings' ,
104108] ;
105- // Once auth intent assigns the user to inline_login, only force the rest of
106- // onboarding when they land on the main feed. Everywhere else they can keep
107- // browsing after the inline first step.
109+ // While inline_login is active for an auth intent, only force the rest of
110+ // onboarding when the user lands on the main feed.
108111const mainFeedPathnames = new Set ( [
109112 '/' ,
110113 '/popular' ,
@@ -165,6 +168,7 @@ function InternalApp({ Component, pageProps, router }: AppProps): ReactElement {
165168 const { isOnboardingActionsReady, isOnboardingComplete } =
166169 useOnboardingActions ( ) ;
167170 const openedHotAndColdFromQueryRef = useRef ( false ) ;
171+ const [ hasSeenLoginIntent , setHasSeenLoginIntent ] = useState ( false ) ;
168172
169173 const { unreadCount } = useNotificationContext ( ) ;
170174 const unreadText = getUnreadText ( unreadCount ) ;
@@ -175,8 +179,11 @@ function InternalApp({ Component, pageProps, router }: AppProps): ReactElement {
175179 shouldShowLogin,
176180 closeLogin,
177181 loginState,
178- inlineLoginEnabled,
179182 } = useAuthContext ( ) ;
183+ const { value : inlineLoginEnabled } = useConditionalFeature ( {
184+ feature : featureInlineLogin ,
185+ shouldEvaluate : shouldShowLogin || hasSeenLoginIntent ,
186+ } ) ;
180187 const { showBanner, onAcceptCookies, onOpenBanner, onHideBanner } =
181188 useCookieBanner ( ) ;
182189 useWebVitals ( ) ;
@@ -197,6 +204,14 @@ function InternalApp({ Component, pageProps, router }: AppProps): ReactElement {
197204 ( hotAndColdModalQuery . includes ( hotAndColdModalQueryValue ) ||
198205 hotAndColdModalQuery . includes ( hotAndColdModalLegacyQueryValue ) ) ) ;
199206
207+ useEffect ( ( ) => {
208+ if ( ! shouldShowLogin ) {
209+ return ;
210+ }
211+
212+ setHasSeenLoginIntent ( true ) ;
213+ } , [ shouldShowLogin ] ) ;
214+
200215 useEffect ( ( ) => {
201216 if ( ! shouldOpenHotAndColdFromQuery ) {
202217 openedHotAndColdFromQueryRef . current = false ;
@@ -238,9 +253,8 @@ function InternalApp({ Component, pageProps, router }: AppProps): ReactElement {
238253 return ;
239254 }
240255
241- // Inline login experiment: after auth intent enrolls the user, defer the
242- // rest of onboarding until they navigate to the main feed; otherwise let
243- // them keep browsing.
256+ // Inline login experiment: while the auth intent is active, defer the rest
257+ // of onboarding until they navigate to the main feed.
244258 if ( inlineLoginEnabled && ! mainFeedPathnames . has ( router . pathname ) ) {
245259 return ;
246260 }
0 commit comments