Skip to content
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

Remove the billing setup page from the Ads setup flow #2577

Merged
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
40ea4eb
remove ads campaign steps
kt-12 Sep 4, 2024
8a9a10a
cs fixes
kt-12 Sep 4, 2024
94c8208
e2e support
kt-12 Sep 4, 2024
39a2090
cs fixes
kt-12 Sep 4, 2024
09871a5
cs fixes
kt-12 Sep 4, 2024
5b14c07
fix cs issue
kt-12 Sep 4, 2024
9728b03
address review comments and also add submitbuttontext
kt-12 Sep 7, 2024
f06b5d2
fix doc block
kt-12 Sep 7, 2024
3409919
cs fixes
kt-12 Sep 7, 2024
0c74f98
cs fixes
kt-12 Sep 9, 2024
779eac3
sert default submitButtonText
kt-12 Sep 11, 2024
ef31827
update doc block and remove unused files
kt-12 Sep 13, 2024
e7afe1e
Update tests/e2e/specs/add-paid-campaigns/add-paid-campaigns.test.js
kt-12 Sep 13, 2024
daa483a
fix e2e
kt-12 Sep 13, 2024
71c81ec
Merge branch 'feature/2536-remove-billing' of https://github.com/wooc…
kt-12 Sep 13, 2024
b5a2467
Update js/src/components/paid-ads/ads-campaign.js
kt-12 Sep 13, 2024
0ca45f1
clear jest files
kt-12 Sep 17, 2024
98cd72d
Update js/src/components/paid-ads/ads-campaign.js
kt-12 Sep 17, 2024
52ca19d
conditional enabling continue button
kt-12 Sep 19, 2024
b8178b4
remove file
kt-12 Sep 19, 2024
c5be7e0
update disabled button logic
kt-12 Sep 19, 2024
1833363
only to check in setup-ads context
kt-12 Sep 19, 2024
d053b77
fix billing e2e
kt-12 Sep 26, 2024
c8ee77f
ads campaign request
kt-12 Sep 26, 2024
1b31ca9
change mock
kt-12 Sep 27, 2024
e7da33a
move billing page to bottom
kt-12 Sep 27, 2024
a6d79a0
create a new mock for campaign creation.
kt-12 Sep 27, 2024
7edeb3b
Merge branch 'feature/2536-remove-billing' of https://github.com/wooc…
kt-12 Sep 27, 2024
4ff5165
move budget to top.
kt-12 Sep 27, 2024
b90f77c
e2e cr fixes
kt-12 Sep 30, 2024
0c6d250
remove title button component
kt-12 Sep 30, 2024
fdd3aae
Merge branch 'feature/2459-campaign-creation-flow' into feature/2536-…
joemcgill Sep 30, 2024
104b368
remove accidently functions
kt-12 Oct 1, 2024
2c84851
remove newly introduced function
kt-12 Oct 2, 2024
fe7bab6
Add ContinueButton component.
asvinb Oct 2, 2024
659f560
seperate continue button
kt-12 Oct 8, 2024
836d1a6
continue button component
kt-12 Oct 8, 2024
fdfedba
fix continue button logic on edit and create page
kt-12 Oct 8, 2024
88ba4e8
fix continue button
kt-12 Oct 8, 2024
c82396b
change text
kt-12 Oct 8, 2024
ed886d8
Omit the billing status check for now
joemcgill Oct 8, 2024
cfd7879
Add inline note about the need to update for billing
joemcgill Oct 8, 2024
2564a42
fix review feedback
kt-12 Oct 10, 2024
dc716ec
change prop name
kt-12 Oct 10, 2024
6b85d4d
handleContinueClick to onClick and return type
kt-12 Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions js/src/components/paid-ads/ads-campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import StepContentActions from '.~/components/stepper/step-content-actions';
import AppDocumentationLink from '.~/components/app-documentation-link';
import AppButton from '.~/components/app-button';
import { useAdaptiveFormContext } from '.~/components/adaptive-form';
import useGoogleAdsAccountBillingStatus from '.~/hooks/useGoogleAdsAccountBillingStatus';
import AudienceSection from './audience-section';
import BudgetSection from './budget-section';
import { CampaignPreviewCard } from './campaign-preview';
import { GOOGLE_ADS_BILLING_STATUS } from '.~/constants';
import PaidAdsFaqsPanel from './faqs-panel';

/**
Expand All @@ -26,24 +28,29 @@ import PaidAdsFaqsPanel from './faqs-panel';
/**
* Renders the container of the form content for campaign management.
*
* Please note that this component relies on an CampaignAssetsForm's context and custom adapter,
* so it expects a `CampaignAssetsForm` to existing in its parents.
* Please note that this component relies on a CampaignAssetsForm's context and custom adapter,
* so it expects a `CampaignAssetsForm` to exist in its parents.
*
* @fires gla_documentation_link_click with `{ context: 'create-ads' | 'edit-ads' | 'setup-ads', link_id: 'see-what-ads-look-like', href: 'https://support.google.com/google-ads/answer/6275294' }`
*
* @param {Object} props React props.
* @param {Campaign} [props.campaign] Campaign data to be edited. If not provided, this component will show campaign creation UI.
* @param {() => void} props.onContinue Callback called once continue button is clicked.
* @param {boolean} [props.isLoading] If true, the Continue button will display a loading spinner .
* @param {string} [props.submitButtonText] Text to display on submit button.
* @param {'create-ads'|'edit-ads'|'setup-ads'} props.trackingContext A context indicating which page this component is used on. This will be the value of `context` in the track event properties.
*/
export default function AdsCampaign( {
campaign,
onContinue,
isLoading,
submitButtonText = __( 'Continue', 'google-listings-and-ads' ),
trackingContext,
} ) {
const isCreation = ! campaign;
const formContext = useAdaptiveFormContext();
const { isValidForm } = formContext;
const { billingStatus } = useGoogleAdsAccountBillingStatus();

const disabledBudgetSection = ! formContext.values.countryCodes.length;
const helperText = isCreation
Expand Down Expand Up @@ -104,10 +111,16 @@ export default function AdsCampaign( {
<StepContentActions>
<AppButton
isPrimary
disabled={ ! isValidForm }
disabled={
! isValidForm ||
( trackingContext === 'setup-ads' &&
billingStatus?.status !==
GOOGLE_ADS_BILLING_STATUS.APPROVED )
}
loading={ isLoading }
onClick={ onContinue }
>
{ __( 'Continue', 'google-listings-and-ads' ) }
{ submitButtonText }
</AppButton>
</StepContentActions>
<PaidAdsFaqsPanel />
Expand Down
19 changes: 0 additions & 19 deletions js/src/components/title-button-layout/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions js/src/components/title-button-layout/index.scss

This file was deleted.

22 changes: 8 additions & 14 deletions js/src/setup-ads/ads-stepper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useState } from '@wordpress/element';
*/
import SetupAccounts from './setup-accounts';
import AdsCampaign from '.~/components/paid-ads/ads-campaign';
import SetupBilling from './setup-billing';
asvinb marked this conversation as resolved.
Show resolved Hide resolved
import useEventPropertiesFilter from '.~/hooks/useEventPropertiesFilter';
import {
recordStepperChangeEvent,
Expand All @@ -22,8 +21,8 @@ import {
/**
* @param {Object} props React props
* @param {Object} props.formProps Form props forwarded from `Form` component.
* @fires gla_setup_ads with `{ triggered_by: 'step1-continue-button' | 'step2-continue-button' , action: 'go-to-step2' | 'go-to-step3' }`.
* @fires gla_setup_ads with `{ triggered_by: 'stepper-step1-button' | 'stepper-step2-button', action: 'go-to-step1' | 'go-to-step2' }`.
* @fires gla_setup_ads with `{ triggered_by: 'step1-continue-button', action: 'go-to-step2' }`.
* @fires gla_setup_ads with `{ triggered_by: 'stepper-step1-button', action: 'go-to-step1'}`.
*/
const AdsStepper = ( { formProps } ) => {
const [ step, setStep ] = useState( '1' );
Expand Down Expand Up @@ -58,10 +57,6 @@ const AdsStepper = ( { formProps } ) => {
continueStep( '2' );
};

const handleCreateCampaignContinue = () => {
continueStep( '3' );
};

return (
// This Stepper with this class name
// should be refactored into separate shared component.
Expand Down Expand Up @@ -92,17 +87,16 @@ const AdsStepper = ( { formProps } ) => {
content: (
<AdsCampaign
trackingContext="setup-ads"
onContinue={ handleCreateCampaignContinue }
onContinue={ formProps.handleSubmit }
isLoading={ formProps.isSubmitting }
submitButtonText={ __(
'Launch paid campaign',
'google-listings-and-ads'
) }
/>
),
onClick: handleStepClick,
},
{
key: '3',
label: __( 'Set up billing', 'google-listings-and-ads' ),
content: <SetupBilling formProps={ formProps } />,
onClick: handleStepClick,
},
] }
/>
);
Expand Down
4 changes: 0 additions & 4 deletions js/src/setup-ads/ads-stepper/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
jest.mock( '.~/components/paid-ads/ads-campaign', () =>
jest.fn().mockName( 'AdsCampaign' )
);
jest.mock( './setup-billing', () => jest.fn().mockName( 'SetupBilling' ) );

/**
* External dependencies
Expand All @@ -23,7 +22,6 @@
import AdsStepper from './';
import SetupAccounts from './setup-accounts';
import AdsCampaign from '.~/components/paid-ads/ads-campaign';
import SetupBilling from './setup-billing';

describe( 'AdsStepper', () => {
let continueToStep2;
Expand All @@ -39,8 +37,6 @@
continueToStep3 = onContinue;
return null;
} );

SetupBilling.mockReturnValue( null );
} );

afterEach( () => {
Expand Down Expand Up @@ -91,7 +87,7 @@
await user.click( step2 );
await user.click( step1 );

expect( recordEvent ).toHaveBeenCalledTimes( 2 );

Check failure on line 90 in js/src/setup-ads/ads-stepper/index.test.js

View workflow job for this annotation

GitHub Actions / JavaScript unit tests

TypeError: Cannot read properties of undefined (reading 'handleSubmit') at handleSubmit (/home/runner/work/google-listings-and-ads/google-listings-and-ads/js/src/setup-ads/ads-stepper/index.js:90:31) at renderWithHooks (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:15486:18) at mountIndeterminateComponent (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:20103:13) at beginWork (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:21626:16) at beginWork$1 (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:27465:14) at performUnitOfWork (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:26599:12) at workLoopSync (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:26505:5) at renderRootSync (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:26473:7) at recoverFromConcurrentError (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:25889:20) at performConcurrentWorkOnRoot (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:25789:22) at flushActQueue (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react/cjs/react.development.js:2667:24) at act (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react/cjs/react.development.js:2582:11) at /home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/@testing-library/react/dist/act-compat.js:47:25 at renderRoot (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/@testing-library/react/dist/pure.js:180:26) at render (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/@testing-library/react/dist/pure.js:271:10) at Object.<anonymous> (/home/runner/work/google-listings-and-ads/google-listings-and-ads/js/src/setup-ads/ads-stepper/index.test.js:59:10) at Promise.then.completed (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/utils.js:298:28) at new Promise (<anonymous>) at callAsyncCircusFn (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/utils.js:231:10) at _callCircusTest (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:316:40) at processTicksAndRejections (node:internal/process/task_queues:95:5) at _runTest (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:252:3) at _runTestsForDescribeBlock (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:126:9) at _runTestsForDescribeBlock (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:121:9) at _runTestsForDescribeBlock (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:121:9) at run (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:71:3) at runAndTransformResultsToJestFormat (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21) at jestAdapter (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19) at runTestInternal (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/je

Check failure on line 90 in js/src/setup-ads/ads-stepper/index.test.js

View workflow job for this annotation

GitHub Actions / JavaScript unit tests

TypeError: Cannot read properties of undefined (reading 'handleSubmit') at handleSubmit (/home/runner/work/google-listings-and-ads/google-listings-and-ads/js/src/setup-ads/ads-stepper/index.js:90:31) at renderWithHooks (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:15486:18) at mountIndeterminateComponent (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:20103:13) at beginWork (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:21626:16) at beginWork$1 (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:27465:14) at performUnitOfWork (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:26599:12) at workLoopSync (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:26505:5) at renderRootSync (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:26473:7) at recoverFromConcurrentError (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:25889:20) at performConcurrentWorkOnRoot (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react-dom/cjs/react-dom.development.js:25789:22) at flushActQueue (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react/cjs/react.development.js:2667:24) at act (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/react/cjs/react.development.js:2582:11) at /home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/@testing-library/react/dist/act-compat.js:47:25 at renderRoot (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/@testing-library/react/dist/pure.js:180:26) at render (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/@testing-library/react/dist/pure.js:271:10) at Object.<anonymous> (/home/runner/work/google-listings-and-ads/google-listings-and-ads/js/src/setup-ads/ads-stepper/index.test.js:77:10) at Promise.then.completed (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/utils.js:298:28) at new Promise (<anonymous>) at callAsyncCircusFn (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/utils.js:231:10) at _callCircusTest (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:316:40) at processTicksAndRejections (node:internal/process/task_queues:95:5) at _runTest (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:252:3) at _runTestsForDescribeBlock (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:126:9) at _runTestsForDescribeBlock (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:121:9) at _runTestsForDescribeBlock (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:121:9) at run (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/run.js:71:3) at runAndTransformResultsToJestFormat (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21) at jestAdapter (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19) at runTestInternal (/home/runner/work/google-listings-and-ads/google-listings-and-ads/node_modules/je
expect( recordEvent ).toHaveBeenNthCalledWith( 1, 'gla_setup_ads', {
action: 'go-to-step2',
triggered_by: 'stepper-step2-button',
Expand Down

This file was deleted.

This file was deleted.

91 changes: 0 additions & 91 deletions js/src/setup-ads/ads-stepper/setup-billing/index.js

This file was deleted.

Loading
Loading