diff --git a/js/src/setup-mc/setup-stepper/setup-paid-ads/clientSession.js b/js/src/setup-mc/setup-stepper/setup-paid-ads/clientSession.js index 6cd0ca8a9a..67aeae5d96 100644 --- a/js/src/setup-mc/setup-stepper/setup-paid-ads/clientSession.js +++ b/js/src/setup-mc/setup-stepper/setup-paid-ads/clientSession.js @@ -6,29 +6,11 @@ * @property {Array} countryCodes Audience country codes of the paid ads campaign. Example: 'US'. */ -const KEY_SHOW_PAID_ADS_SETUP = 'gla-onboarding-show-paid-ads-setup'; const KEY_PAID_ADS = 'gla-onboarding-paid-ads'; const { sessionStorage } = window; const clientSession = { - /** - * @param {boolean} isShowing Whether the paid ads setup is showing. - */ - setShowPaidAdsSetup( isShowing ) { - const showing = Boolean( isShowing ).toString(); - sessionStorage.setItem( KEY_SHOW_PAID_ADS_SETUP, showing ); - }, - - /** - * @param {boolean} defaultValue The default value to be returned if stored value is not available. - * @return {boolean} Returns the stored value. It will return `defaultValue` if stored value is not available. - */ - getShowPaidAdsSetup( defaultValue ) { - const showing = sessionStorage.getItem( KEY_SHOW_PAID_ADS_SETUP ); - return showing === null ? defaultValue : showing === 'true'; - }, - /** * @param {CampaignData} data Campaign data to be stored. * @param {number|undefined} data.amount Daily average cost of the campaign. diff --git a/js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-features-section.js b/js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-features-section.js index 3be1cd6664..23d81af90f 100644 --- a/js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-features-section.js +++ b/js/src/setup-mc/setup-stepper/setup-paid-ads/paid-ads-features-section.js @@ -58,16 +58,8 @@ function FeatureList( { hideBudgetContent } ) { * * @param {Object} props React props. * @param {boolean} props.hideBudgetContent Whether to hide the content about the ad budget. - * @param {boolean} props.hideFooterButtons Whether to hide the buttons at the card footer. - * @param {JSX.Element} props.skipButton Button to skip paid ads setup. - * @param {JSX.Element} props.continueButton Button to continue paid ads setup. */ -export default function PaidAdsFeaturesSection( { - hideBudgetContent, - hideFooterButtons, - skipButton, - continueButton, -} ) { +export default function PaidAdsFeaturesSection( { hideBudgetContent } ) { return (
-
); diff --git a/js/src/setup-mc/setup-stepper/setup-paid-ads/setup-paid-ads.js b/js/src/setup-mc/setup-stepper/setup-paid-ads/setup-paid-ads.js index e2b7881c75..ede40b2af9 100644 --- a/js/src/setup-mc/setup-stepper/setup-paid-ads/setup-paid-ads.js +++ b/js/src/setup-mc/setup-stepper/setup-paid-ads/setup-paid-ads.js @@ -6,7 +6,7 @@ import apiFetch from '@wordpress/api-fetch'; import { select } from '@wordpress/data'; import { useState } from '@wordpress/element'; import { Flex } from '@wordpress/components'; -import { noop, merge } from 'lodash'; +import { noop } from 'lodash'; /** * Internal dependencies @@ -24,7 +24,6 @@ import PaidAdsFeaturesSection from './paid-ads-features-section'; import PaidAdsSetupSections from './paid-ads-setup-sections'; import SkipPaidAdsConfirmationModal from './skip-paid-ads-confirmation-modal'; import { getProductFeedUrl } from '.~/utils/urls'; -import clientSession from './clientSession'; import { API_NAMESPACE, STORE_KEY } from '.~/data/constants'; import { GUIDE_NAMES } from '.~/constants'; import { ACTION_COMPLETE, ACTION_SKIP } from './constants'; @@ -47,14 +46,12 @@ import { recordGlaEvent } from '.~/utils/tracks'; /** * Clicking on the skip paid ads button to complete the onboarding flow. * The 'unknown' value of properties may means: - * - the paid ads setup is not opened * - the final status has not yet been resolved when recording this event * - the status is not available, for example, the billing status is unknown if Google Ads account is not yet connected * * @event gla_onboarding_complete_button_click - * @property {string} opened_paid_ads_setup Whether the paid ads setup is opened, e.g. 'yes', 'no' * @property {string} google_ads_account_status The connection status of merchant's Google Ads addcount, e.g. 'connected', 'disconnected', 'incomplete' - * @property {string} billing_method_status aaa, The status of billing method of merchant's Google Ads addcount e.g. 'unknown', 'pending', 'approved', 'cancelled' + * @property {string} billing_method_status The status of billing method of merchant's Google Ads addcount e.g. 'unknown', 'pending', 'approved', 'cancelled' * @property {string} campaign_form_validation Whether the entered paid campaign form data are valid, e.g. 'unknown', 'valid', 'invalid' */ @@ -71,9 +68,6 @@ export default function SetupPaidAds() { const { createNotice } = useDispatchCoreNotices(); const { googleAdsAccount, hasGoogleAdsConnection } = useGoogleAdsAccount(); const [ handleSetupComplete ] = useAdsSetupCompleteCallback(); - const [ showPaidAdsSetup, setShowPaidAdsSetup ] = useState( () => - clientSession.getShowPaidAdsSetup( false ) - ); const [ paidAds, setPaidAds ] = useState( {} ); const [ completing, setCompleting ] = useState( null ); const [ @@ -81,11 +75,6 @@ export default function SetupPaidAds() { setShowSkipPaidAdsConfirmationModal, ] = useState( false ); - const handleContinuePaidAdsSetupClick = () => { - setShowPaidAdsSetup( true ); - clientSession.setShowPaidAdsSetup( true ); - }; - const finishOnboardingSetup = async ( event, onBeforeFinish = noop ) => { setCompleting( event.target.dataset.action ); @@ -122,27 +111,17 @@ export default function SetupPaidAds() { }; const handleSkipCreatePaidAds = async ( event ) => { + const selector = select( STORE_KEY ); + const billing = selector.getGoogleAdsAccountBillingStatus(); + setShowSkipPaidAdsConfirmationModal( false ); const eventProps = { - opened_paid_ads_setup: 'no', google_ads_account_status: googleAdsAccount?.status, - billing_method_status: 'unknown', - campaign_form_validation: 'unknown', + billing_method_status: billing?.status || 'unknown', + campaign_form_validation: paidAds.isValid ? 'valid' : 'invalid', }; - // TODO: Review once https://github.com/woocommerce/google-listings-and-ads/issues/2500 is merged - if ( showPaidAdsSetup ) { - const selector = select( STORE_KEY ); - const billing = selector.getGoogleAdsAccountBillingStatus(); - - merge( eventProps, { - opened_paid_ads_setup: 'yes', - billing_method_status: billing?.status, - campaign_form_validation: paidAds.isValid ? 'valid' : 'invalid', - } ); - } - recordGlaEvent( 'gla_onboarding_complete_button_click', eventProps ); await finishOnboardingSetup( event ); @@ -189,28 +168,8 @@ export default function SetupPaidAds() { /> - } /> - { showPaidAdsSetup && ( - - ) } + { showSkipPaidAdsConfirmationModal && ( @@ -220,7 +179,7 @@ export default function SetupPaidAds() { /> ) } -