Skip to content

Commit

Permalink
Revert "Help Center: Support Experience to 50% of ALL users (#97119)"
Browse files Browse the repository at this point in the history
This reverts commit c13354e.
  • Loading branch information
escapemanuele authored Dec 6, 2024
1 parent c13354e commit e14e1b3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@ import { HelpCenter } from '@automattic/data-stores';
import { useDispatch } from '@wordpress/data';
import { useCallback } from 'react';
import AsyncLoad from 'calypso/components/async-load';
import { useExperiment } from 'calypso/lib/explat';

const HELP_CENTER_STORE = HelpCenter.register();

const AsyncHelpCenter = () => {
const { setShowHelpCenter } = useDispatch( HELP_CENTER_STORE );
const [ isLoading, experimentAssignment ] = useExperiment(
'calypso_helpcenter_new_support_flow'
);

const handleClose = useCallback( () => {
setShowHelpCenter( false );
}, [ setShowHelpCenter ] );

return (
<AsyncLoad require="@automattic/help-center" placeholder={ null } handleClose={ handleClose } />
<AsyncLoad
require="@automattic/help-center"
placeholder={ null }
handleClose={ handleClose }
shouldUseHelpCenterExperience={
! isLoading && experimentAssignment?.variationName === 'treatment'
}
/>
);
};

Expand Down
7 changes: 7 additions & 0 deletions client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import EmptyMasterbar from 'calypso/layout/masterbar/empty';
import MasterbarLoggedIn from 'calypso/layout/masterbar/logged-in';
import OfflineStatus from 'calypso/layout/offline-status';
import isA8CForAgencies from 'calypso/lib/a8c-for-agencies/is-a8c-for-agencies';
import { useExperiment } from 'calypso/lib/explat';
import { getGoogleMailServiceFamily } from 'calypso/lib/gsuite';
import isJetpackCloud from 'calypso/lib/jetpack/is-jetpack-cloud';
import { isWcMobileApp, isWpMobileApp } from 'calypso/lib/mobile-app';
Expand Down Expand Up @@ -149,6 +150,9 @@ function HelpCenterLoader( { sectionName, loadHelpCenter, currentRoute } ) {
const selectedSite = useSelector( getSelectedSite );
const primarySiteSlug = useSelector( getPrimarySiteSlug );
const primarySite = useSelector( ( state ) => getSiteBySlug( state, primarySiteSlug ) );
const [ isLoading, experimentAssignment ] = useExperiment(
'calypso_helpcenter_new_support_flow'
);

if ( ! loadHelpCenter ) {
return null;
Expand All @@ -169,6 +173,9 @@ function HelpCenterLoader( { sectionName, loadHelpCenter, currentRoute } ) {
hidden={ sectionName === 'gutenberg-editor' && isDesktop }
onboardingUrl={ onboardingUrl() }
googleMailServiceFamily={ getGoogleMailServiceFamily() }
shouldUseHelpCenterExperience={
! isLoading && experimentAssignment?.variationName === 'treatment'
}
/>
);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/help-center/src/components/help-center.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { HELP_CENTER_STORE } from '../stores';
import { Container } from '../types';
import HelpCenterContainer from './help-center-container';
import HelpCenterSmooch from './help-center-smooch';
import { isUseHelpCenterExperienceEnabled } from './utils';
import type { HelpCenterSelect } from '@automattic/data-stores';
import '../styles.scss';

Expand Down Expand Up @@ -93,8 +92,7 @@ export default function ContextualizedHelpCenter(
props: Container & HelpCenterRequiredInformation
) {
const shouldUseHelpCenterExperience =
config.isEnabled( 'help-center-experience' ) ||
isUseHelpCenterExperienceEnabled( props.currentUser?.ID );
config.isEnabled( 'help-center-experience' ) || props.shouldUseHelpCenterExperience;

return (
<HelpCenterRequiredContextProvider value={ { ...props, shouldUseHelpCenterExperience } }>
Expand Down
7 changes: 0 additions & 7 deletions packages/help-center/src/components/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,3 @@ export const matchSupportInteractionId = (
return foundMatch;
}
};

export const isUseHelpCenterExperienceEnabled = ( userId: number ): boolean => {
if ( ! userId || userId % 100 > 50 ) {
return false;
}
return true;
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import wpcomRequest, { canAccessWpcomApis } from 'wpcom-proxy-request';
*/
import type { APIFetchOptions, MessagingAuth, ZendeskAuthType } from './types';

/**
* Bump me when the API response structure goes through a breaking change.
*/
const VERSION = 'v1';

let isLoggedIn = false;

export function useAuthenticateZendeskMessaging(
Expand All @@ -26,7 +21,7 @@ export function useAuthenticateZendeskMessaging(
const isTestMode = currentEnvironment !== 'production';

return useQuery( {
queryKey: [ 'getMessagingAuth', VERSION, type, isTestMode ],
queryKey: [ 'getMessagingAuth', type, isTestMode ],
queryFn: () => {
const params = { type, test_mode: String( isTestMode ) };
const wpcomParams = new URLSearchParams( params );
Expand Down

0 comments on commit e14e1b3

Please sign in to comment.