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

Show Ads value prop in Paid Campaign performance card #2650

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d544759
remove free credits
kt-12 Oct 22, 2024
62d124c
add paid-features.js
kt-12 Oct 22, 2024
19ef7b1
remove translations
kt-12 Oct 22, 2024
90ea27a
e2e
kt-12 Oct 22, 2024
2a7af58
style fixes and e2e
kt-12 Oct 22, 2024
1ed56b8
fix e2e button clicking
kt-12 Oct 22, 2024
cd2521c
fix old e2e
kt-12 Oct 22, 2024
d8cb4cc
address review feedback.
kt-12 Oct 28, 2024
cd58bca
doc updated.
kt-12 Oct 28, 2024
cfa279c
Update js/src/dashboard/summary-section/paid-features/free-ad-credit.js
kt-12 Nov 1, 2024
96e4162
Update js/src/dashboard/summary-section/paid-features/free-ad-credit.js
kt-12 Nov 1, 2024
d5d1d2f
remove usage of sections, fix styling
kt-12 Nov 1, 2024
e4fa585
Merge branch 'feature/2538-performance-card-sep' of https://github.co…
kt-12 Nov 1, 2024
d043e81
remove margin
kt-12 Nov 1, 2024
b77f18e
seperate file for paid-features test
kt-12 Nov 1, 2024
cd7ec9f
fix button name
kt-12 Nov 1, 2024
6fe5003
update variable names and cleanup
kt-12 Nov 1, 2024
51d5187
cleanup
kt-12 Nov 1, 2024
ccc7edc
Merge branch 'feature/2460-google-ads-value-prop' into feature/2538-p…
kt-12 Nov 1, 2024
2d77db8
check when ads complete is set
kt-12 Nov 1, 2024
0fcba0f
change variable name
kt-12 Nov 1, 2024
38318b2
avoide flakyness
kt-12 Nov 1, 2024
2297982
change variable name
kt-12 Nov 4, 2024
f8f9c4a
remove additional assignement
kt-12 Nov 4, 2024
d7d17ad
style changes
kt-12 Nov 4, 2024
311a850
update E2E
kt-12 Nov 4, 2024
f899c31
jest update
kt-12 Nov 5, 2024
ff4376e
fix review changes.
kt-12 Nov 5, 2024
f46e880
fix jest
kt-12 Nov 5, 2024
f0ab0f6
fix unused variable
kt-12 Nov 5, 2024
9caf01d
remove only
kt-12 Nov 5, 2024
5a27b75
fix jest
kt-12 Nov 6, 2024
f8c3339
remove unnecessary typecasting.
kt-12 Nov 6, 2024
0e80569
css changes
kt-12 Nov 6, 2024
64eaab6
div -> component
kt-12 Nov 6, 2024
b0c712e
Style fixes
joemcgill Nov 7, 2024
64eb3b4
More style adjustments
joemcgill Nov 7, 2024
d1fe9eb
add new Fulfill for ad report.
kt-12 Nov 7, 2024
c7bbc72
check for text content in Summary+ mock add empty campaign.
kt-12 Nov 7, 2024
0f809f3
update variable name.
kt-12 Nov 7, 2024
c724767
remove margin
kt-12 Nov 7, 2024
1a516c7
remove size attribute.
kt-12 Nov 7, 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
17 changes: 14 additions & 3 deletions js/src/dashboard/summary-section/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SummaryNumber } from '@woocommerce/components';
* Internal dependencies
*/
import { glaData, REPORT_SOURCE_PAID, REPORT_SOURCE_FREE } from '.~/constants';
import useAdsCampaigns from '.~/hooks/useAdsCampaigns';
import useAdsCurrency from '.~/hooks/useAdsCurrency';
import useCurrencyFormat from '.~/hooks/useCurrencyFormat';
import usePerformance from './usePerformance';
Expand Down Expand Up @@ -106,17 +107,27 @@ const PaidPerformanceCard = () => {
};

export default function SummarySection() {
const { loaded, data: adsCampaignsData } = useAdsCampaigns();
const { adsSetupComplete } = glaData;
let showCampaignPromotionCard = true;
if ( adsSetupComplete ) {
if ( ! loaded ) {
return null;
}
if ( adsCampaignsData?.length > 0 ) {
showCampaignPromotionCard = false;
}
}
kt-12 marked this conversation as resolved.
Show resolved Hide resolved

return (
<>
<SummaryCard
title={ __( 'Google Ads', 'google-listings-and-ads' ) }
>
{ adsSetupComplete ? (
<PaidPerformanceCard />
) : (
{ showCampaignPromotionCard ? (
<PaidCampaignPromotionCard />
) : (
<PaidPerformanceCard />
) }
</SummaryCard>
<SummaryCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { createInterpolateElement } from '@wordpress/element';
import AppDocumentationLink from '.~/components/app-documentation-link';

/**
* Render the Free Ads Credit div inside the Paid Features div.
* Render the Free Ads Credit inside the Paid Features component.
*
kt-12 marked this conversation as resolved.
Show resolved Hide resolved
* @fires gla_documentation_link_click with `{ context: 'dashboard', link_id: 'free-ad-credit-terms', href: 'https://www.google.com/ads/coupons/terms/' }`
* @return {JSX.Element} Free Ads Credit div.
* @return {JSX.Element} Free Ads Credit component.
*/
const FreeAdCredit = () => {
return (
<div className="gla-free-ad-credit-div">
<div className="gla-free-ad-credit-claim">
<GridiconGift />
<div>
{ createInterpolateElement(
Expand Down
8 changes: 4 additions & 4 deletions js/src/dashboard/summary-section/paid-features/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function FeatureList() {
];

return (
<div className="gla-paid-features-div__feature-list">
<div className="gla-paid-features__feature-list">
{ featuresItems.map( ( { Icon, content }, idx ) => (
<Flex key={ idx } align="flex-start">
<Icon size="18" />
Expand All @@ -66,15 +66,15 @@ function FeatureList() {
/**
* Returns a div with paid features content.
*
* @return {JSX.Element} Paid Features div.
* @return {JSX.Element} Paid Features component.
*/
const PaidFeatures = () => {
return (
<VerticalGapLayout size="medium" className="gla-paid-features-div">
<VerticalGapLayout size="medium" className="gla-paid-features">
<Flex
align="center"
gap={ 9 }
className="gla-paid-features-div__content"
className="gla-paid-features__content"
>
<FlexItem>
<CampaignPreview />
Expand Down
11 changes: 6 additions & 5 deletions js/src/dashboard/summary-section/paid-features/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.gla-paid-features-div {
.gla-paid-features {
@media (max-width: $break-small) {
&__content {
flex-direction: column;
Expand All @@ -19,14 +19,15 @@
}
}

.gla-free-ad-credit-div {
.gla-free-ad-credit-claim {
text-align: left;
background-color: #fff;
background-color: $white;
display: flex;
align-items: center;
gap: calc(var(--main-gap) / 3 * 2);
padding: calc(var(--main-gap) / 3 * 2);
color: $black;
padding: 16px 12px;
color: #1e1e1e;
font-size: $gla-font-base;
kt-12 marked this conversation as resolved.
Show resolved Hide resolved

eason9487 marked this conversation as resolved.
Show resolved Hide resolved
.gridicon {
fill: #5ec862;
Expand Down
27 changes: 23 additions & 4 deletions tests/e2e/specs/dashboard/paid-features.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ test.describe( 'Paid Feature Listing', () => {
'Google Ads'
);

await expect( dashboardPage.paidFeaturesDiv ).toContainText(
await expect( dashboardPage.paidFeatures ).toContainText(
'Reach more customer by advertising your products across Google Ads channels like Search, YouTube and Discover.'
);

// FreeAdCredit div content visible.
await expect( dashboardPage.paidFeaturesDiv ).toContainText(
await expect( dashboardPage.paidFeatures ).toContainText(
'Claim $500 in ads credit when you spend your first $500 with Google Ads.'
);

Expand All @@ -76,13 +76,32 @@ test.describe( 'Paid Feature Listing', () => {
await clearCompletedAdsSetup();
await page.close();
} );
test( 'Paid Features listing is complete', async () => {
test( 'When no campaign present', async () => {
eason9487 marked this conversation as resolved.
Show resolved Hide resolved
await dashboardPage.goto();
await expect( dashboardPage.googleAdsSummaryCard ).toContainText(
'Google Ads'
);

await expect( dashboardPage.paidFeaturesDiv ).not.toBeVisible();
await expect( dashboardPage.paidFeatures ).toBeVisible();
} );
test( 'When atleast one campaign present', async () => {
kt-12 marked this conversation as resolved.
Show resolved Hide resolved
await dashboardPage.fulfillAdsCampaignsRequest( [
{
id: 111111111,
name: 'Test Campaign',
status: 'enabled',
type: 'performance_max',
amount: 1,
country: 'US',
targeted_locations: [ 'US' ],
},
] );
await dashboardPage.goto();
await expect( dashboardPage.googleAdsSummaryCard ).toContainText(
'Google Ads'
);

await expect( dashboardPage.paidFeatures ).not.toBeVisible();
eason9487 marked this conversation as resolved.
Show resolved Hide resolved
} );
} );
} );
7 changes: 3 additions & 4 deletions tests/e2e/utils/pages/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ export default class DashboardPage extends MockRequests {
this.googleAdsSummaryCard = this.page.locator(
'.gla-dashboard__performance .gla-summary-card:nth-child(1)'
);
this.paidFeaturesDiv = this.googleAdsSummaryCard.locator(
'.gla-paid-features-div'
);
this.createCampaignButton = this.paidFeaturesDiv.locator( 'button', {
this.paidFeatures =
this.googleAdsSummaryCard.locator( '.gla-paid-features' );
this.createCampaignButton = this.paidFeatures.locator( 'button', {
hasText: 'Create Campaign',
} );
this.addPaidCampaignButton = this.page.locator(
Expand Down
Loading