-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2644 from woocommerce/update/2582-claim-ads-account
Onboarding: Claim New Ads Accounts in the Google Combo Accounts Card
- Loading branch information
Showing
12 changed files
with
287 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
js/src/components/google-combo-account-card/claim-ads-account/claim-ads-account.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ClaimAccountButton from '.~/components/google-ads-account-card/claim-account-button'; | ||
import { useAppDispatch } from '.~/data'; | ||
import useWindowFocusCallbackIntervalEffect from '.~/hooks/useWindowFocusCallbackIntervalEffect'; | ||
import './claim-ads-account.scss'; | ||
|
||
/** | ||
* ClaimAdsAccount component. | ||
* | ||
* @return {JSX.Element} ClaimAdsAccount component. | ||
*/ | ||
const ClaimAdsAccount = () => { | ||
const { fetchGoogleAdsAccountStatus } = useAppDispatch(); | ||
useWindowFocusCallbackIntervalEffect( fetchGoogleAdsAccountStatus, 30 ); | ||
|
||
return ( | ||
<div className="gla-claim-ads-account-box"> | ||
<h4> | ||
{ __( | ||
'Claim your Google Ads account', | ||
'google-listings-and-ads' | ||
) } | ||
</h4> | ||
<p> | ||
{ __( | ||
'You need to accept the invitation to the Google Ads account we created for you. This gives you access to Google Ads and sets up conversion measurement. You must claim your account in the next 20 days.', | ||
'google-listings-and-ads' | ||
) } | ||
</p> | ||
<p className="gla-ads-post-claim-instructions"> | ||
{ __( | ||
'After accepting the invitation, you’ll be prompted to set up billing. We highly recommend doing this to avoid having to do it later on.', | ||
'google-listings-and-ads' | ||
) } | ||
</p> | ||
<ClaimAccountButton | ||
text={ __( | ||
'Claim account in Google Ads', | ||
'google-listings-and-ads' | ||
) } | ||
isPrimary | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ClaimAdsAccount; |
25 changes: 25 additions & 0 deletions
25
js/src/components/google-combo-account-card/claim-ads-account/claim-ads-account.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.gla-claim-ads-account-box { | ||
border: 1px solid $gray-300; | ||
display: flex; | ||
flex-direction: column; | ||
gap: $grid-unit-10; | ||
padding: $grid-unit-30; | ||
|
||
h4 { | ||
font-size: $gla-font-small; | ||
margin: 0; | ||
} | ||
|
||
p { | ||
margin: 0; | ||
} | ||
|
||
.gla-ads-post-claim-instructions { | ||
color: $gray-700; | ||
font-style: italic; | ||
} | ||
|
||
.app-button { | ||
align-self: flex-end; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
js/src/components/google-combo-account-card/claim-ads-account/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './claim-ads-account'; |
43 changes: 43 additions & 0 deletions
43
js/src/components/google-combo-account-card/connected-ads-account-detail.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Notice } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ClaimAdsAccount from './claim-ads-account'; | ||
import './connected-ads-account-detail.scss'; | ||
|
||
/** | ||
* Renders details related to a connected Google Ads account, including the option to claim the account and a notice indicating whether conversion measurement has been set up. | ||
* @param {Object} props Component props. | ||
* @param {boolean} props.claimGoogleAdsAccount Whether the user should claim the Google Ads account. | ||
* @param {boolean} props.showConversionMeasurementNotice Whether to show the conversion measurement notice. | ||
*/ | ||
const ConnectedAdsAccountDetail = ( { | ||
claimGoogleAdsAccount, | ||
showConversionMeasurementNotice, | ||
} ) => { | ||
if ( ! claimGoogleAdsAccount && ! showConversionMeasurementNotice ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="gla-connected-ads-account-detail"> | ||
{ claimGoogleAdsAccount && <ClaimAdsAccount /> } | ||
|
||
{ showConversionMeasurementNotice && ( | ||
<Notice status="success" isDismissible={ false }> | ||
{ __( | ||
'Google Ads conversion measurement has been set up for your store.', | ||
'google-listings-and-ads' | ||
) } | ||
</Notice> | ||
) } | ||
</div> | ||
); | ||
}; | ||
|
||
export default ConnectedAdsAccountDetail; |
6 changes: 6 additions & 0 deletions
6
js/src/components/google-combo-account-card/connected-ads-account-detail.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.gla-connected-ads-account-detail { | ||
|
||
.components-notice.is-success { | ||
margin: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { GOOGLE_ADS_ACCOUNT_STATUS } from '.~/constants'; | ||
|
||
/** | ||
* Helper for determining whether to show the ads conversion notice based on the | ||
* Google Ads account status and step. | ||
* | ||
* @param {Object} googleAdsAccount A Google Ads account object. | ||
* @return {boolean} Whether to show the ads conversion notice. | ||
*/ | ||
export default function showAdsConversionNotice( googleAdsAccount ) { | ||
return ( | ||
googleAdsAccount?.status === GOOGLE_ADS_ACCOUNT_STATUS.CONNECTED || | ||
[ 'link_merchant', 'billing' ].includes( googleAdsAccount?.step ) | ||
); | ||
} |
Oops, something went wrong.