- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2k
 
Domain Search: Add escape hatch experiment #106836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
89a1839
              33983e8
              39c8dbd
              8a78e58
              3e86ab1
              6b039d9
              35df1c2
              422219c
              56124a2
              866b748
              868c3e8
              119321e
              621550b
              b8dec9b
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1 +1,7 @@ | ||
| export const isDevelopmentMode = process.env.NODE_ENV === 'development'; | ||
| declare const process: { | ||
| env?: { | ||
| NODE_ENV?: string; | ||
| }; | ||
| }; | ||
| 
     | 
||
| export const isDevelopmentMode = process.env?.NODE_ENV === 'development'; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| declare module 'calypso/server/lib/logger' { | ||
| type LoggerMethod = ( ...args: Array< unknown > ) => void; | ||
| 
     | 
||
| export interface Logger { | ||
| trace: LoggerMethod; | ||
| debug: LoggerMethod; | ||
| info: LoggerMethod; | ||
| warn: LoggerMethod; | ||
| error: LoggerMethod; | ||
| fatal: LoggerMethod; | ||
| child( options?: Record< string, unknown > ): Logger; | ||
| } | ||
| 
     | 
||
| export function getLogger(): Logger; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { isOnboardingFlow } from '@automattic/onboarding'; | ||
| import { useMemo } from 'react'; | ||
| import { getFlowFromURL } from 'calypso/landing/stepper/utils/get-flow-from-url'; // eslint-disable-line no-restricted-imports | ||
| import { useExperiment } from 'calypso/lib/explat'; // eslint-disable-line no-restricted-imports | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you had to import the Explat code from Calypso here. I'm not sure if this might have implications for the build process, but everything seems to be working fine, at least in my tests 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I know, this rule is to avoid circular dependencies. Because Explat is so light, I think this won't be an issue, and we'll clean it up after the experiment is done.  | 
||
| 
     | 
||
| export const EXPERIMENT_NAME = | ||
| 'calypso_signup_onboarding_domain_search_results_page_escape_hatch_202510'; | ||
| 
     | 
||
| /** | ||
| * Hook for the domain search escape hatch experiment. | ||
| */ | ||
| export const useDomainSearchEscapeHatch = () => { | ||
| const flow = useMemo( () => getFlowFromURL(), [] ); | ||
| 
     | 
||
| const [ isLoading, experimentAssignment ] = useExperiment( EXPERIMENT_NAME, { | ||
| isEligible: isOnboardingFlow( flow ), | ||
| } ); | ||
| 
     | 
||
| const variationName = experimentAssignment?.variationName ?? 'control'; | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it a valid behaviour to load  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've seen this in another experiment and thought it made sense to have a default. I'm not sure how this makes much difference for the code ahead in this case. Are you suggesting that this is not needed?  | 
||
| 
     | 
||
| return [ isLoading, variationName ]; | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.