-
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 #2640 from woocommerce/update/2596-connect-ads-acc…
…ount Onboarding: Connect to existing Ads account in Google Accounts Card
- Loading branch information
Showing
15 changed files
with
437 additions
and
62 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
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
49 changes: 49 additions & 0 deletions
49
js/src/components/google-ads-account-card/connect-ads/connect-button.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,49 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import AppButton from '.~/components/app-button'; | ||
import useEventPropertiesFilter from '.~/hooks/useEventPropertiesFilter'; | ||
import { FILTER_ONBOARDING } from '.~/utils/tracks'; | ||
|
||
/** | ||
* Clicking on the button to connect an existing Google Ads account. | ||
* | ||
* @event gla_ads_account_connect_button_click | ||
* @property {number} id The account ID to be connected. | ||
* @property {string} [context] Indicates the place where the button is located. | ||
* @property {string} [step] Indicates the step in the onboarding process. | ||
*/ | ||
|
||
/** | ||
* Google Ads account connection button. | ||
* | ||
* @param {Object} props Props. | ||
* @param {number} props.accountID The Google Ads account ID to be connected. | ||
* @param {Object} props.restProps Rest props. Forwarded to AppButton. | ||
* @fires gla_ads_account_connect_button_click when "Connect" button is clicked. | ||
* @return {JSX.Element} Google Ads connect button component. | ||
*/ | ||
const ConnectButton = ( { accountID, ...restProps } ) => { | ||
const getEventProps = useEventPropertiesFilter( FILTER_ONBOARDING ); | ||
|
||
return ( | ||
<AppButton | ||
isSecondary | ||
disabled={ ! accountID } | ||
eventName="gla_ads_account_connect_button_click" | ||
eventProps={ getEventProps( { | ||
id: Number( accountID ), | ||
} ) } | ||
{ ...restProps } | ||
> | ||
{ __( 'Connect', 'google-listings-and-ads' ) } | ||
</AppButton> | ||
); | ||
}; | ||
|
||
export default ConnectButton; |
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
Oops, something went wrong.