Skip to content

Commit

Permalink
Update Ads module setup for PAX users.
Browse files Browse the repository at this point in the history
  • Loading branch information
benbowler committed Oct 11, 2024
1 parent 2a774c3 commit a2a1a35
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions assets/js/modules/ads/components/setup/SetupMainPAX.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
createInterpolateElement,
Fragment,
useCallback,
useEffect,
useRef,
} from '@wordpress/element';
import { __, _x } from '@wordpress/i18n';
Expand All @@ -37,7 +38,7 @@ import { addQueryArgs } from '@wordpress/url';
* Internal dependencies
*/
import { useSelect, useDispatch, useRegistry } from 'googlesitekit-data';
import { SpinnerButton } from 'googlesitekit-components';
import { ProgressBar, SpinnerButton } from 'googlesitekit-components';
import AdsIcon from '../../../../../svg/graphics/ads.svg';
import SetupForm from './SetupForm';
import SupportLink from '../../../../components/SupportLink';
Expand All @@ -57,6 +58,7 @@ import {
PAX_SETUP_STEP,
PAX_SETUP_SUCCESS_NOTIFICATION,
} from '../../pax/constants';
import { useFeature } from '../../../../hooks/useFeature';

export default function SetupMainPAX( { finishSetup } ) {
const [ showPaxAppQueryParam, setShowPaxAppQueryParam ] =
Expand Down Expand Up @@ -155,6 +157,14 @@ export default function SetupMainPAX( { finishSetup } ) {
paxAppRef.current = app;
}, [] );

const isAdsPaxEnabled = useFeature( 'adsPax' );

useEffect( () => {
if ( isAdsPaxEnabled ) {
createAccount();
}
}, [ isAdsPaxEnabled, createAccount ] );

return (
<div className="googlesitekit-setup-module googlesitekit-setup-module--ads">
<div className="googlesitekit-setup-module__step">
Expand All @@ -169,6 +179,8 @@ export default function SetupMainPAX( { finishSetup } ) {
<div className="googlesitekit-setup-module__step">
<AdBlockerWarning moduleSlug="ads" />

{ isAdsPaxEnabled && ! showPaxAppStep && <ProgressBar /> }

{ ! isAdBlockerActive &&
PAX_SETUP_STEP.LAUNCH === showPaxAppStep &&
hasAdwordsScope && (
Expand All @@ -180,7 +192,8 @@ export default function SetupMainPAX( { finishSetup } ) {
/>
) }

{ ! isAdBlockerActive &&
{ ! isAdsPaxEnabled &&
! isAdBlockerActive &&
( ! showPaxAppStep || ! hasAdwordsScope ) && (
<Fragment>
<p>
Expand Down

0 comments on commit a2a1a35

Please sign in to comment.