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

Feature: Streamline the campaign setup #2632

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
320 commits
Select commit Hold shift + click to select a range
5200727
Remove unecessary isCreation prop.
asvinb Sep 9, 2024
d93bc1d
Add countryCodes field.
asvinb Sep 9, 2024
057ff88
Merge pull request #2563 from woocommerce/add/2504-skip-confirmation-…
joemcgill Sep 9, 2024
f6b0fd2
Merge branch 'feature/2459-campaign-creation-flow' into feature/2500-…
asvinb Sep 10, 2024
0d73263
Fix merge conflict.
asvinb Sep 10, 2024
10adcf0
Merge branch 'feature/2500-show-campaign-fields' of github.com:woocom…
asvinb Sep 10, 2024
068f4c4
Revert changes.
asvinb Sep 10, 2024
a66a23e
Merge branch 'feature/2459-campaign-creation-flow' into feature/2501-…
asvinb Sep 10, 2024
72b5e76
Check for undefined countryCodes prop.
asvinb Sep 10, 2024
4bf8bea
Updated JSDoc.
asvinb Sep 10, 2024
76328ea
Fix: network error for budget recommendation.
ankitrox Sep 10, 2024
8d9358d
Remove redundant code.
ankitrox Sep 10, 2024
ea68ee8
Update js doc.
ankitrox Sep 10, 2024
dcc6f73
Resolve conflicts and fix tests.
ankitrox Sep 10, 2024
ac68177
Fix: lint issues.
ankitrox Sep 10, 2024
052783e
Remove unused code.
ankitrox Sep 10, 2024
8e95434
Remove country code from edit screen.
asvinb Sep 10, 2024
5ac539f
Merge pull request #2533 from woocommerce/feature/2500-show-campaign-…
joemcgill Sep 10, 2024
ac7753c
Merge branch 'feature/2459-campaign-creation-flow' into update/2459-a…
dsawardekar Sep 11, 2024
beb3700
Adds e2e tests
dsawardekar Sep 11, 2024
5d5ed13
Merge branch 'feature/2459-campaign-creation-flow' into feature/2501-…
asvinb Sep 11, 2024
08d0c25
Merge pull request #2551 from woocommerce/feature/2501-remove-ads-aud…
asvinb Sep 11, 2024
779eac3
sert default submitButtonText
kt-12 Sep 11, 2024
c7f5a36
Merge branch 'feature/2459-campaign-creation-flow' into update/2459-a…
dsawardekar Sep 12, 2024
c2fbf1a
Resolve conflict with base branch.
ankitrox Sep 12, 2024
61d73eb
use fetch budget hook in paid-ads-setup-sections.
ankitrox Sep 12, 2024
f15bfb9
Remove redundant code.
ankitrox Sep 12, 2024
85f5b35
Display spinner till data gets loaded.
ankitrox Sep 12, 2024
0b38575
if google connection is present show only step 2
kt-12 Sep 12, 2024
6d50d16
Merge branch 'feature/2534-remove-accounts-connection-page' of https:…
kt-12 Sep 12, 2024
46fca31
restore accounts file
kt-12 Sep 12, 2024
2bf96b3
add spinner when page loads
kt-12 Sep 12, 2024
1d41c1b
Uses form opts instead of values
dsawardekar Sep 13, 2024
585bbbd
Update countryCodes and validation callback
dsawardekar Sep 13, 2024
f35ac9d
Updates unit tests
dsawardekar Sep 13, 2024
6804415
Fixes linter warnings
dsawardekar Sep 13, 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
dc08372
E2E test for with ad account.
kt-12 Sep 16, 2024
d62bc02
Do not pass uneeded props.
asvinb Sep 16, 2024
566476d
Add hook for code resuse.
ankitrox Sep 16, 2024
dc7a4ac
Use hook.
ankitrox Sep 16, 2024
9ddfef4
Stick to old UI/UX.
ankitrox Sep 16, 2024
4af37a3
Remove redundant code.
ankitrox Sep 16, 2024
1b92ecb
Pass recommendations prop.
ankitrox Sep 16, 2024
ab2db99
Remove redundant code.
ankitrox Sep 16, 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
603d9c4
Format currency for recommended budget.
asvinb Sep 17, 2024
f73150b
Update E2E test.
asvinb Sep 17, 2024
f1fd765
Fix E2E test.
asvinb Sep 17, 2024
7adc092
Fix e2e test.
asvinb Sep 17, 2024
9081d20
Merge branch 'feature/2459-campaign-creation-flow' into feature/2499-…
asvinb Sep 18, 2024
9a612d3
Wait for ads connection response.
asvinb Sep 18, 2024
90e8d95
Add useValidateCampaignWithCountryCodes hook.
asvinb Sep 18, 2024
811461f
Fix unit test.
asvinb Sep 18, 2024
eb70d33
Do not trigger fetch if there are no countryCodes.
asvinb Sep 19, 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
a502b7a
Add loading property to know when the hook is ready.
asvinb Sep 19, 2024
34c58a9
Remove condition to display PaidAdsSetupSections.
asvinb Sep 19, 2024
188983d
Merge pull request #2558 from woocommerce/feature/2499-banner-coupon
joemcgill Sep 22, 2024
2fa2bdb
Merge branch 'feature/2459-campaign-creation-flow' into update/2535-c…
asvinb Sep 23, 2024
5d794ed
Merge branch 'feature/2459-campaign-creation-flow' into update/2459-a…
asvinb Sep 23, 2024
a40f273
check from global
kt-12 Sep 23, 2024
2651814
remove function.
kt-12 Sep 23, 2024
c26a029
remove new line.
kt-12 Sep 23, 2024
4d80b45
Add getAdsBudgetRecommendations selector.
asvinb Sep 23, 2024
44d9eed
Update hooks.
asvinb Sep 23, 2024
29b6920
Add JSDocs.
asvinb Sep 23, 2024
a1a5cf4
More descriptive JSDocs.
asvinb Sep 23, 2024
a7a2eba
Fix linting errors.
asvinb Sep 23, 2024
684fd02
Apply change.
asvinb Sep 24, 2024
447bff0
Add JSdocs for returned value.
asvinb Sep 24, 2024
c85bdf1
Fix JS errors.
asvinb Sep 24, 2024
74e0dd8
Fix e2e test.
asvinb Sep 24, 2024
6fc4a6b
Address CR feedback.
asvinb Sep 24, 2024
716581b
Add JSDocs.
asvinb Sep 24, 2024
2c4f863
Simplify hooks.
asvinb Sep 24, 2024
2d51b4a
Fix JS tests.
asvinb Sep 24, 2024
ab6a397
Rename function.
asvinb Sep 24, 2024
edccd57
Delete unused file.
asvinb Sep 24, 2024
7f7261a
Review comments.
asvinb Sep 24, 2024
330697c
Update minimum amount displayed to the user.
asvinb Sep 24, 2024
6dd25e8
Add modal changes.
asvinb Sep 25, 2024
2f91ae8
Show paid ads sections by default.
asvinb Sep 25, 2024
3418caa
Simplify forms more.
asvinb Sep 25, 2024
7f25ff7
Move setup paid ads component.
asvinb Sep 25, 2024
7db2664
Remove unused braces.
asvinb Sep 25, 2024
892c016
Revert debugging changes.
asvinb Sep 25, 2024
9ba6eed
Fix tests for setup paid ads.
asvinb Sep 25, 2024
d7d5c6a
Remove unused args.
asvinb Sep 25, 2024
9c576b0
Fix hook return value.
asvinb Sep 25, 2024
c790719
Revert change.
asvinb Sep 25, 2024
35fed8a
Revert change.
asvinb Sep 25, 2024
fbce5c6
Set up events correctly.
asvinb Sep 25, 2024
814e353
Updated JSDocs.
asvinb Sep 25, 2024
17a869d
Remove unused files.
asvinb Sep 25, 2024
ca3dc21
Check for approval notice.
asvinb Sep 25, 2024
d4b6a8d
Update condition to show campaign preview card.
asvinb Sep 25, 2024
d053b77
fix billing e2e
kt-12 Sep 26, 2024
84b1ed0
address review comment.
kt-12 Sep 26, 2024
0d8c6bd
Make sure country codes are loaded.
asvinb Sep 26, 2024
5f2f291
Fix e2e test.
asvinb Sep 26, 2024
bd47567
remvoe comment
kt-12 Sep 26, 2024
c8ee77f
ads campaign request
kt-12 Sep 26, 2024
03b1167
Take precision settings into consideration.
asvinb Sep 27, 2024
7432760
Fix e2e tests.
asvinb Sep 27, 2024
f23a52c
Convert to float.
asvinb Sep 27, 2024
38d255a
Use CampaignAssetsForm within SetupPaidAds.
asvinb Sep 27, 2024
1b31ca9
change mock
kt-12 Sep 27, 2024
e7da33a
move billing page to bottom
kt-12 Sep 27, 2024
5343963
Do not load amount from local storage all the time except during onbo…
asvinb Sep 27, 2024
face49e
Merge branch 'feature/2458-streamline-onboarding' into update/2535-co…
asvinb Sep 27, 2024
b3e3b2a
Fix merge conflict for AdsCampaign.
asvinb Sep 27, 2024
d4c376d
Fix merge conflict for audienceSection test.
asvinb Sep 27, 2024
7cd8c5b
Delete unused file.
asvinb Sep 27, 2024
5d727ba
fix linting issues.
asvinb 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
0f52790
fix step value
kt-12 Sep 30, 2024
c84fa6f
fix e2e
kt-12 Sep 30, 2024
bfec773
remove additional test
kt-12 Sep 30, 2024
15baeb2
Merge branch 'feature/2458-streamline-onboarding' into feature/2459-c…
asvinb Sep 30, 2024
aa4329c
Fix linting errors.
asvinb Sep 30, 2024
b90f77c
e2e cr fixes
kt-12 Sep 30, 2024
0c6d250
remove title button component
kt-12 Sep 30, 2024
3d38d91
Merge pull request #2630 from woocommerce/feature/2459-campaign-creat…
joemcgill Sep 30, 2024
ab1f837
Merge pull request #2627 from woocommerce/update/2535-consolidate-ad-…
joemcgill Sep 30, 2024
34c53d7
Merge branch 'feature/2459-campaign-creation-flow' into update/2535-c…
joemcgill Sep 30, 2024
fdd3aae
Merge branch 'feature/2459-campaign-creation-flow' into feature/2536-…
joemcgill Sep 30, 2024
df07674
Merge branch 'feature/2459-campaign-creation-flow' into update/2459-a…
asvinb Oct 1, 2024
d1ed9cf
Merge branch 'update/2535-consolidate-ad-creation-ccf-merged' into up…
asvinb Oct 1, 2024
dfb1bc9
Fix bad merge.
asvinb Oct 1, 2024
c89ac46
Simplify code where countryCodes is needed.
asvinb Oct 1, 2024
6d7a287
Remove unused props.
asvinb Oct 1, 2024
3ff8276
Fix loaded value
asvinb Oct 1, 2024
78fc8bb
Fix e2e test
asvinb Oct 1, 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
983438b
Merge branch 'update/2535-consolidate-ad-creation-ccf-merged' into up…
asvinb Oct 2, 2024
eb18178
Try not to use the useBudgetRecommendationData hook.
asvinb Oct 2, 2024
35716f0
Add useFetchBudgetRecommendation hook.
asvinb Oct 2, 2024
0cafdb2
Make use of new hook and add loading indicator.
asvinb Oct 2, 2024
79ccefa
Remove unused hook.
asvinb Oct 2, 2024
fbde5f4
Move clientSession.
asvinb Oct 2, 2024
3ea1c12
Restore complete campaign data from client session.
asvinb Oct 2, 2024
f6f7ac3
Merge pull request #2637 from woocommerce/update/2502-budget-setup-ca…
joemcgill Oct 2, 2024
eadc445
Ensure Ads account is claimed before skipping step 1
joemcgill Oct 4, 2024
49ae5da
Speed up E2E test case
joemcgill Oct 4, 2024
3fb0832
Use Math.ceil.
asvinb Oct 4, 2024
ce9ad99
Fix failing test.
asvinb Oct 4, 2024
7aaa968
Set minimum amount to always be the recommended budget.
asvinb Oct 7, 2024
b581d13
update county specific ads
kt-12 Oct 7, 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
ec5d05a
check if google account is not ready
kt-12 Oct 8, 2024
c7ad7f5
check if google account is not disconnected instead
kt-12 Oct 8, 2024
64051b6
Adjust isGoogleRead logic and fix linting issues
joemcgill Oct 8, 2024
f3d74f2
Add continueButton and skipButton props.
asvinb Oct 8, 2024
8258b28
Use continueButton props.
asvinb Oct 8, 2024
d74087c
Save WIP.
asvinb 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
b405e9c
Add ContinueButton component.
asvinb Oct 9, 2024
94cbe5f
Fix unit tests.
asvinb Oct 9, 2024
dd44feb
Only show BillingCard component during onboarding or Ads setup flow.
asvinb Oct 9, 2024
95d6452
Remove unused files.
asvinb Oct 9, 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
d6ed5cf
Merge pull request #2577 from woocommerce/feature/2536-remove-billing
joemcgill Oct 10, 2024
caa4540
Merge branch 'feature/2459-campaign-creation-flow' into feature/2534-…
kt-12 Oct 10, 2024
229b41c
Address CR feedback.
asvinb Oct 11, 2024
6ce4cd2
Remove PaidAdsSetupSections component.
asvinb Oct 11, 2024
c239114
Restore campaign property.
asvinb Oct 11, 2024
bb710b3
Merge branch 'feature/2459-campaign-creation-flow' into update/2535-c…
asvinb Oct 11, 2024
db509b4
Fix unit tests.
asvinb Oct 11, 2024
7c958ad
Remove unused imports.
asvinb Oct 11, 2024
5ee5437
Fix condition to disable buttton.
asvinb Oct 11, 2024
4da52c5
Update E2E tests.
asvinb Oct 11, 2024
25ed467
Remove unused imports.
asvinb Oct 11, 2024
c064183
remove google account check
kt-12 Oct 14, 2024
106c325
Merge branch 'update/2535-consolidate-ad-creation-ccf-merged' into up…
asvinb Oct 14, 2024
8bf78f1
Simplify setting up minimum budget recommendation.
asvinb Oct 14, 2024
d7f0d51
Simplify setting default value.
asvinb Oct 14, 2024
bfb1021
Update tests.
asvinb Oct 14, 2024
1e156ff
Address CR feedback.
asvinb Oct 15, 2024
dedbb2c
Country code is no longer part of the form.
asvinb Oct 15, 2024
cd5be55
Remove optional chaining operator.
asvinb Oct 15, 2024
3482bcb
Final changes.
asvinb Oct 15, 2024
906a205
Revert import order
asvinb Oct 15, 2024
6b89299
Revert import order.
asvinb Oct 15, 2024
b655b88
Merge branch 'update/2535-consolidate-ad-creation-ccf-merged' into up…
asvinb Oct 15, 2024
9fe042d
Merge branch 'update/2502-budget-setup-card' into update/2459-add-min…
asvinb Oct 15, 2024
7bf1198
Add minimumAmount prop to CampaignAssetsForm.
asvinb Oct 15, 2024
631252d
Add validation function.
asvinb Oct 15, 2024
2ff822d
Revert changes.
asvinb Oct 15, 2024
e471d55
Fix E2E tests.
asvinb Oct 15, 2024
0dbcec2
Fix JSDocs and move variable.
asvinb Oct 16, 2024
52ba585
Introduce SetupPaidAds component.
asvinb Oct 16, 2024
76060e6
Merge branch 'update/2535-consolidate-ad-creation-ccf-merged' into up…
asvinb Oct 16, 2024
e56b6f2
Merge branch 'update/2535-consolidate-ad-creation-ccf-merged' into up…
asvinb Oct 16, 2024
e716b5a
Merge pull request #2623 from woocommerce/update/2535-consolidate-ad-…
asvinb Oct 16, 2024
69381e3
Merge branch 'feature/2459-campaign-creation-flow' into update/2502-b…
asvinb Oct 16, 2024
425c6e3
Merge pull request #2629 from woocommerce/enhancement/2600-update-bud…
joemcgill Oct 16, 2024
bb6fd03
update condition again
kt-12 Oct 17, 2024
e712a2c
Merge branch 'feature/2459-campaign-creation-flow' into update/2502-b…
asvinb Oct 17, 2024
200938c
Merge branch 'feature/2459-campaign-creation-flow' into feature/2534-…
kt-12 Oct 17, 2024
82d6a33
introduce wait for for the button to appear
kt-12 Oct 17, 2024
48aeec3
Address CR feedback.
asvinb Oct 17, 2024
4bb48b1
spinner
kt-12 Oct 17, 2024
ac52735
remvoe googleAdsAccount null check
kt-12 Oct 18, 2024
110f48c
test work independetly
kt-12 Oct 18, 2024
95cabc9
remove defnition
kt-12 Oct 18, 2024
fb79ef6
Add invalidation condition.
asvinb Oct 18, 2024
ede72e3
Set value in BudgetSection.
asvinb Oct 18, 2024
fc07258
Add comment.
asvinb Oct 18, 2024
121fc29
Pass props.
asvinb Oct 18, 2024
f194da1
Add extra condition.
asvinb Oct 18, 2024
2ce27c1
Revert changes.
asvinb Oct 18, 2024
f4631e9
Remove unused import.
asvinb Oct 18, 2024
9eaff54
replace with findbyrole
kt-12 Oct 21, 2024
8c074a4
Revert changes.
asvinb Oct 22, 2024
0495e18
Re order components.
asvinb Oct 22, 2024
9067960
Remove check for Google Ads account.
asvinb Oct 22, 2024
a560e90
Add missing JSDoc.
asvinb Oct 22, 2024
02889ea
Merge branch 'update/2502-budget-setup-card' into update/2459-add-min…
asvinb Oct 22, 2024
958dc38
Updated JSDocs,
asvinb Oct 22, 2024
1626f8a
Merge pull request #2552 from woocommerce/update/2502-budget-setup-card
asvinb Oct 22, 2024
19ec4a0
Merge branch 'feature/2459-campaign-creation-flow' into update/2459-a…
asvinb Oct 22, 2024
99a5e2c
Add minimum amount.
asvinb Oct 22, 2024
3ec5948
Address CR feedback.
asvinb Oct 23, 2024
95ae707
Remove debugging code.
asvinb Oct 23, 2024
bb9ad4b
Restore line.
asvinb Oct 23, 2024
e756955
Remove space.
asvinb Oct 23, 2024
9dd2744
Rename prop to recommendedDailyBudget.
asvinb Oct 23, 2024
266009c
Merge pull request #2583 from woocommerce/update/2459-add-minimum-bud…
asvinb Oct 24, 2024
f957fa4
Merge branch 'feature/2459-campaign-creation-flow' into feature/2534-…
joemcgill Oct 24, 2024
355487b
Merge pull request #2595 from woocommerce/feature/2534-remove-account…
joemcgill Oct 24, 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
2 changes: 2 additions & 0 deletions js/src/components/app-input-control/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
color: $gray-700;
}

&.has-error .components-input-control__backdrop,
&--error-character-count .components-input-control .components-input-control__container .components-input-control__backdrop {
border-color: $alert-red;
box-shadow: none;
}

&.has-error .components-base-control__help,
&--error-character-count &__character-count {
color: $alert-red;
}
Expand Down
43 changes: 0 additions & 43 deletions js/src/components/audience-country-select.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ exports[`validateCampaign When the amount is not a number, should not pass 4`] =
exports[`validateCampaign When the amount is ≤ 0, should not pass 1`] = `"Please make sure daily average cost is greater than 0."`;

exports[`validateCampaign When the amount is ≤ 0, should not pass 2`] = `"Please make sure daily average cost is greater than 0."`;

exports[`validateCampaign When the country codes array is empty, should not pass 1`] = `"Please select at least one country for your ads campaign."`;
116 changes: 0 additions & 116 deletions js/src/components/paid-ads/ads-campaign.js

This file was deleted.

122 changes: 122 additions & 0 deletions js/src/components/paid-ads/ads-campaign/ads-campaign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';

/**
* Internal dependencies
*/
import StepContent from '.~/components/stepper/step-content';
import StepContentHeader from '.~/components/stepper/step-content-header';
import StepContentFooter from '.~/components/stepper/step-content-footer';
import StepContentActions from '.~/components/stepper/step-content-actions';
import AppDocumentationLink from '.~/components/app-documentation-link';
import { useAdaptiveFormContext } from '.~/components/adaptive-form';
import BillingCard from '.~/components/paid-ads/billing-card';
import BudgetSection from '../budget-section';
import { CampaignPreviewCard } from '../campaign-preview';
import PaidAdsFaqsPanel from './faqs-panel';
import PaidAdsFeaturesSection from './paid-ads-features-section';
import useTargetAudienceFinalCountryCodes from '.~/hooks/useTargetAudienceFinalCountryCodes';

/**
* @typedef {import('.~/components/adaptive-form/adaptive-form-context').AdaptiveFormContext} AdaptiveFormContext
*/

/**
* @typedef {import('.~/data/actions').Campaign} Campaign
*/

/**
* Renders the container of the form content for campaign management.
*
* 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. The displayCountries property will be used to fetch budget recommendation data.
* @param {string} props.headerTitle The title of the step.
* @param {'create-ads'|'edit-ads'|'setup-ads'|'setup-mc'} props.context A context indicating which page this component is used on. This will be the value of `context` in the track event properties.
* @param {(formContext: AdaptiveFormContext) => JSX.Element | JSX.Element} [props.skipButton] A React element or function to render the "Skip" button. If a function is passed, it receives the form context and returns the button element.
* @param {(formContext: AdaptiveFormContext) => JSX.Element | JSX.Element} [props.continueButton] A React element or function to render the "Continue" button. If a function is passed, it receives the form context and returns the button element.
*/
export default function AdsCampaign( {
campaign,
headerTitle,
context,
skipButton,
continueButton,
} ) {
const formContext = useAdaptiveFormContext();
const { data: countryCodes } = useTargetAudienceFinalCountryCodes();
const isOnboardingFlow = context === 'setup-mc';

Check warning on line 54 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L51-L54

Added lines #L51 - L54 were not covered by tests
const showCampaignPreviewCard =
context === 'setup-ads' ||
context === 'create-ads' ||
context === 'edit-ads';

Check warning on line 58 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L57-L58

Added lines #L57 - L58 were not covered by tests
// only show the billing card during onboarding or setup Ads flow.
// For creating/editing a campaign, we assume billing is already set up.
const showBillingCard = context === 'setup-mc' || context === 'setup-ads';

let description = createInterpolateElement(

Check warning on line 63 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L63

Added line #L63 was not covered by tests
__(
'Paid Performance Max campaigns are automatically optimized for you by Google. <link>See what your ads will look like.</link>',
'google-listings-and-ads'
),
{
link: (
<AppDocumentationLink
context={ context }
linkId="see-what-ads-look-like"
href="https://support.google.com/google-ads/answer/6275294"
/>
),
}
);

if ( isOnboardingFlow ) {
description = __(

Check warning on line 80 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L80

Added line #L80 was not covered by tests
'You’re ready to set up a Performance Max campaign to drive more sales with ads. Your products will be included in the campaign after they’re approved.',
'google-listings-and-ads'
);
}

return (

Check warning on line 86 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L86

Added line #L86 was not covered by tests
<StepContent>
<StepContentHeader
title={ headerTitle }
description={ description }
/>

{ isOnboardingFlow && <PaidAdsFeaturesSection /> }

Check warning on line 93 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L93

Added line #L93 was not covered by tests

<BudgetSection
formProps={ formContext }
countryCodes={
context === 'edit-ads'
? campaign.displayCountries
: countryCodes

Check warning on line 100 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L99-L100

Added lines #L99 - L100 were not covered by tests
}
>
{ showBillingCard && <BillingCard /> }

Check warning on line 103 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L103

Added line #L103 was not covered by tests

{ showCampaignPreviewCard && <CampaignPreviewCard /> }

Check warning on line 105 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L105

Added line #L105 was not covered by tests
</BudgetSection>

<StepContentFooter>
<StepContentActions>
{ typeof skipButton === 'function'
? skipButton( formContext )
: skipButton }

Check warning on line 112 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L111-L112

Added lines #L111 - L112 were not covered by tests

{ typeof continueButton === 'function'
? continueButton( formContext )
: continueButton }

Check warning on line 116 in js/src/components/paid-ads/ads-campaign/ads-campaign.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/ads-campaign/ads-campaign.js#L115-L116

Added lines #L115 - L116 were not covered by tests
</StepContentActions>
<PaidAdsFaqsPanel />
</StepContentFooter>
</StepContent>
);
}
1 change: 1 addition & 0 deletions js/src/components/paid-ads/ads-campaign/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ads-campaign';
Loading
Loading