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

Edit combo accounts #2660

Draft
wants to merge 174 commits into
base: feature/2509-consolidate-google-account-cards
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
874ef00
Save WIP.
asvinb Oct 3, 2024
1ead7f9
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 3, 2024
4428639
Extract DisconnectAccount button.
asvinb Oct 3, 2024
bebfaed
Add ConnectAccountCard component.
asvinb Oct 4, 2024
872787e
Add ConnectMCBody and ConnectMCFooter component.
asvinb Oct 4, 2024
9475ec2
Save WIP.
asvinb Oct 7, 2024
3965234
Check for non connected state.
asvinb Oct 7, 2024
8a4ba4c
Add preConditionReady check.
asvinb Oct 7, 2024
8b850fd
Revert dev temp changes.
asvinb Oct 7, 2024
176a4a8
Save E2E tests,
asvinb Oct 7, 2024
b4b4347
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Oct 7, 2024
e9626f0
Save WIP.
asvinb Oct 8, 2024
57c4693
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 8, 2024
e86de9b
Review class names.
asvinb Oct 8, 2024
9ad469a
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 8, 2024
75723e2
Fix e2e tests.
asvinb Oct 8, 2024
9923f70
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 8, 2024
406f028
Use mock functions available.
asvinb Oct 8, 2024
26ec13a
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 9, 2024
acedda6
Address CR feedback.
asvinb Oct 9, 2024
13d8d2b
Cast googleMCAccount?.id to a boolean.
asvinb Oct 9, 2024
9e8649b
Add description when connecting extra account.
asvinb Oct 9, 2024
2981067
Fix card when reclaiming URL.
asvinb Oct 9, 2024
e03f3c3
Fix E2E tests.
asvinb Oct 9, 2024
3b096ff
Add isConnected property to useGoogleMCAccount hook.
asvinb Oct 10, 2024
deaa836
Removed unused constant.
asvinb Oct 10, 2024
66d6eb9
Wrap all cards together.
asvinb Oct 10, 2024
94867fe
Claim New Ads Accounts in the Google Combo Accounts Card.
ankitrox Oct 10, 2024
fa5b3ea
Add more properties to useAutoCreateAdsMCAccounts.js hook.
asvinb Oct 10, 2024
8707fea
Use useState.
asvinb Oct 10, 2024
14a08e8
Add isConnected check.
asvinb Oct 10, 2024
d3c2a36
Use single hook.
asvinb Oct 10, 2024
9455bde
Basic function of the claim card.
ankitrox Oct 15, 2024
a4c75d4
Display conversion action notice.
ankitrox Oct 15, 2024
fae4010
Setup conversion action once invite accepted.
ankitrox Oct 16, 2024
02a607a
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 16, 2024
ba2b3ca
Trigger simgle request for conversion action.
ankitrox Oct 16, 2024
d1260bf
code comment.
ankitrox Oct 16, 2024
e5bb120
Add E2E tests.
ankitrox Oct 16, 2024
53e1c37
Remove test code.
ankitrox Oct 16, 2024
ed8efb1
Remove test code.
ankitrox Oct 16, 2024
6deaf04
Fix css lint.
ankitrox Oct 16, 2024
25d2ff3
Save WIP.
asvinb Oct 16, 2024
a8d5db1
Save WIP
asvinb Oct 16, 2024
87a2046
Changes to how we manage the state.
asvinb Oct 16, 2024
06960d9
Fix select rendering.
asvinb Oct 16, 2024
8b06ef7
Revert changes
asvinb Oct 16, 2024
96c11a2
Update JSDocs.
asvinb Oct 17, 2024
3102597
Set width for claim card.
asvinb Oct 17, 2024
f4e7edf
Resolve conflicts and merge base branch.
ankitrox Oct 18, 2024
b33484d
Add editing mode.
asvinb Oct 21, 2024
1b52069
Add placeholder text.
asvinb Oct 21, 2024
3b1fe26
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 22, 2024
cc623e5
Resolve conflicts and merge base branch.
ankitrox Oct 22, 2024
cd62e71
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 23, 2024
b582447
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 23, 2024
4eb41ac
Do not use template literals.
asvinb Oct 23, 2024
eb0bfc1
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 23, 2024
6696ee6
Update hooks.
asvinb Oct 23, 2024
d2e4b57
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 23, 2024
67b8d3b
Revert change.
asvinb Oct 23, 2024
ba5c054
Revert change.
asvinb Oct 23, 2024
6fd6dc4
Remove unused file.
asvinb Oct 23, 2024
c13c524
Review changes.
asvinb Oct 23, 2024
c808e9d
Resolve conflicts and merge base branch.
ankitrox Oct 24, 2024
e845ece
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 24, 2024
b64bba7
Show ID only when connected.
asvinb Oct 24, 2024
841bb90
Make app select control non interactive.
asvinb Oct 24, 2024
dc6ea40
Fix failing test.
asvinb Oct 24, 2024
881ee8c
Fix linting error.
asvinb Oct 24, 2024
b9809e1
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 24, 2024
f41df99
Fix E2E tests.
asvinb Oct 24, 2024
2cadd89
Invalidate resolution for existing accounts when reclaiming url.
asvinb Oct 24, 2024
5dc7506
Resolve conflicts and merge base branch.
ankitrox Oct 24, 2024
604c5c8
Invalidate existing accounts.
asvinb Oct 24, 2024
9ea122a
CR feedback.
ankitrox Oct 24, 2024
d1bb555
Arrange module imports.
ankitrox Oct 24, 2024
d3dfdf4
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
ankitrox Oct 25, 2024
bb57a8c
Add ConnectedAccountsActions component.
ankitrox Oct 25, 2024
5f4435a
Add hasAccountConnectionIssue utility function.
asvinb Oct 25, 2024
8875a28
Connected select control.
asvinb Oct 25, 2024
5b64b6b
Create new ads account.
ankitrox Oct 25, 2024
fdccdfb
Fix: lint css.
ankitrox Oct 25, 2024
49f51ca
Add MerchantCenterSelect component.
asvinb Oct 25, 2024
4d41762
No need to wait for data.
asvinb Oct 25, 2024
c117be7
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
asvinb Oct 25, 2024
d9a7a86
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
ankitrox Oct 25, 2024
c5c0187
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
ankitrox Oct 25, 2024
f4e2377
E2E tests improvements.
ankitrox Oct 25, 2024
7ba9a51
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
ankitrox Oct 28, 2024
761c227
Remove redundant css rules.
ankitrox Oct 28, 2024
ab8984e
Merge branch 'update/2596-connect-ads-account' into update/2603-creat…
ankitrox Oct 28, 2024
d4e0142
Add css.
ankitrox Oct 28, 2024
fa72d4e
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Oct 28, 2024
7a4e40d
Add JS Docs.
asvinb Oct 28, 2024
1584e33
Do not show card if account is in unclaimed status.
ankitrox Oct 28, 2024
3691fdc
CR feedback.
ankitrox Oct 28, 2024
ec0b1c5
Remove ConversionMeasurementNotice component.
ankitrox Oct 28, 2024
a00d42c
Merge branch 'update/2596-connect-ads-account' into update/2603-creat…
ankitrox Oct 28, 2024
54fdfc8
Add E2E tests.
ankitrox Oct 28, 2024
3b25965
Fix: E2E issues.
ankitrox Oct 29, 2024
86a174e
Resolve conflicts in E2E.
ankitrox Oct 29, 2024
e76f617
Await till conversion measurement is setup.
ankitrox Oct 29, 2024
78e235e
Do not render the claim card conditionally.
ankitrox Oct 29, 2024
5bca5d1
Prevent continous polling.
ankitrox Oct 29, 2024
e1fca96
Resolve conflicts.
ankitrox Oct 29, 2024
073b04f
CR feedback.
ankitrox Oct 29, 2024
c2b05be
Add bottom padding for conversion measurement notice.
ankitrox Oct 29, 2024
42ba79f
Add bottom padding for conversion measurement notice.
ankitrox Oct 29, 2024
7b284bf
Reduce padding bottom.
ankitrox Oct 29, 2024
44605f0
Revert redundant code.
ankitrox Oct 29, 2024
863a71c
Resolve conflicts.
ankitrox Oct 29, 2024
e9a071b
Merge branch 'update/2596-connect-ads-account' into update/2603-creat…
ankitrox Oct 29, 2024
b6c1bf4
Remove redundant files.
ankitrox Oct 29, 2024
3e2dcbe
Show correct text when creating an account.
asvinb Oct 30, 2024
db10842
Revert change.
asvinb Oct 30, 2024
3e4249c
Prevent complete re rendering of the card.
asvinb Oct 30, 2024
0c3f1c7
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Oct 30, 2024
f31dcc4
Fix error.
asvinb Oct 30, 2024
46aef1c
Fetch existing accounts again.
asvinb Oct 30, 2024
b93f3aa
Display updating text only when clicking the claim button.
asvinb Oct 30, 2024
53c80c5
Update AccountCard component
joemcgill Oct 30, 2024
a9ea1b1
Incorporate new AccountCard into ConnectMC
joemcgill Oct 30, 2024
cb667fd
Update docblocks to AccountCard
joemcgill Oct 30, 2024
14c653c
JSLint fix
joemcgill Oct 30, 2024
a9c8839
Delete ConnectAccountCard
joemcgill Oct 30, 2024
a8b4f8c
Remove todo
joemcgill Oct 30, 2024
d3dae92
Save WIP.
asvinb Oct 31, 2024
9c55a39
Add missing styles.
asvinb Oct 31, 2024
c40800b
Use correct button variant.
asvinb Oct 31, 2024
7a757a2
Merge pull request #2657 from woocommerce/update/2597-connect-mc-refa…
asvinb Oct 31, 2024
cc3e804
Sync changes.
asvinb Oct 31, 2024
8c4cd7a
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Oct 31, 2024
a3040fe
Update JSDocs.
asvinb Oct 31, 2024
e75a930
Fix E2E tests.
asvinb Oct 31, 2024
8fba3e4
Remove unused functions.
asvinb Oct 31, 2024
4c493a0
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Oct 31, 2024
f63e731
REmove unused component.
asvinb Oct 31, 2024
78e18b9
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Oct 31, 2024
9f335dd
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Oct 31, 2024
3c19aa9
Save WIP.
asvinb Oct 31, 2024
17e7c84
Address CR feedback.
asvinb Nov 1, 2024
0e15813
Add MerchantCenterAccountInfoCard component.
asvinb Nov 4, 2024
4e201c1
Fix linting errors.
asvinb Nov 4, 2024
65e6854
Remove unused component.
asvinb Nov 4, 2024
4b777bc
Reorder imports.
asvinb Nov 4, 2024
9a368f1
Use correcct prop name.
asvinb Nov 4, 2024
90db787
UX improvements.
asvinb Nov 4, 2024
797ea87
Review comments.
asvinb Nov 4, 2024
74ff220
Use single quotes.
asvinb Nov 4, 2024
3dd73fc
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Nov 4, 2024
d34aed4
Port over changes.
asvinb Nov 4, 2024
e6222de
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 4, 2024
2d9c2cf
Use correct class name.
asvinb Nov 4, 2024
5638687
Improve 'Connect Google account' E2E tests
joemcgill Nov 4, 2024
6bb4318
Update title and indicator label.
asvinb Nov 5, 2024
d46d6ca
Merge branch 'update/2603-create-ads-account' of github.com:woocommer…
asvinb Nov 5, 2024
866410d
Rename label.
asvinb Nov 5, 2024
e90aaca
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Nov 5, 2024
66de193
Address CR feedback.
asvinb Nov 5, 2024
b9f41b1
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Nov 5, 2024
05580c3
Fix linting errors.
asvinb Nov 5, 2024
0a6c386
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 5, 2024
dacbd04
Add condition to not render the claim components if there's no connec…
asvinb Nov 5, 2024
10cdd81
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Nov 5, 2024
19b076a
Show conversion notice when account is being updated.
asvinb Nov 5, 2024
50e36fd
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 5, 2024
218149d
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 5, 2024
4656f74
Add callback.
asvinb Nov 5, 2024
59d586f
Simplify loading for ClaimAccountsButton
joemcgill Nov 5, 2024
960008b
Use useEffect to toggleconversion notice state
joemcgill Nov 5, 2024
8fa757e
Fix jest tests
joemcgill Nov 5, 2024
b42286d
Update E2E tests.
asvinb Nov 6, 2024
ad78ecb
Merge branch 'update/2582-claim-ads-account' into update/2605-edit-ac…
asvinb Nov 6, 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: 1 addition & 1 deletion js/src/components/account-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const appearanceDict = {
// The `center` is the default alignment, and no need to append any additional class name.
const alignStyleName = {
center: false,
top: `gla-account-card__styled--align-top`,
top: 'gla-account-card__styled--align-top',
};

const indicatorAlignStyleName = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import AccountCard, { APPEARANCE } from '.~/components/account-card';
import AppButton from '.~/components/app-button';
import ConnectedIconLabel from '.~/components/connected-icon-label';
import Section from '.~/wcdl/section';
import useSwitchGoogleAccount from './useSwitchGoogleAccount';

/**
* Clicking on the "connect to a different Google account" button.
*
* @event gla_google_account_connect_different_account_button_click
*/
import SwitchAccountButton from './switch-account-button';

/**
* Renders a Google account card UI with connected account information.
Expand All @@ -26,16 +14,12 @@ import useSwitchGoogleAccount from './useSwitchGoogleAccount';
* @param {{ email: string }} props.googleAccount A data payload object containing the user's Google account email.
* @param {JSX.Element} [props.helper] Helper content below the Google account email.
* @param {boolean} [props.hideAccountSwitch=false] Indicate whether hide the account switch block at the card footer.
*
* @fires gla_google_account_connect_different_account_button_click
*/
const ConnectedGoogleAccountCard = ( {
googleAccount,
helper,
hideAccountSwitch = false,
} ) => {
const [ handleSwitch, { loading } ] = useSwitchGoogleAccount();

return (
<AccountCard
appearance={ APPEARANCE.GOOGLE }
Expand All @@ -45,16 +29,7 @@ const ConnectedGoogleAccountCard = ( {
>
{ ! hideAccountSwitch && (
<Section.Card.Footer>
<AppButton
isLink
disabled={ loading }
text={ __(
'Or, connect to a different Google account',
'google-listings-and-ads'
) }
eventName="gla_google_account_connect_different_account_button_click"
onClick={ handleSwitch }
/>
<SwitchAccountButton />
</Section.Card.Footer>
) }
</AccountCard>
Expand Down
44 changes: 44 additions & 0 deletions js/src/components/google-account-card/switch-account-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import AppButton from '.~/components/app-button';
import useSwitchGoogleAccount from './useSwitchGoogleAccount';

/**
* Clicking on the "connect to a different Google account" button.
*
* @event gla_google_account_connect_different_account_button_click
*/

/**
* Renders a switch button that lets user connect with another Google account.
*
* @fires gla_google_account_connect_different_account_button_click
* @param {Object} props React props
* @param {string} [props.text="Or, connect to a different Google account"] Text to display on the button
*/
const SwitchAccountButton = ( {
text = __(
'Or, connect to a different Google account',
'google-listings-and-ads'
),
} ) => {
const [ handleSwitch, { loading } ] = useSwitchGoogleAccount();

return (
<AppButton
isLink
disabled={ loading }
text={ text }
eventName="gla_google_account_connect_different_account_button_click"
onClick={ handleSwitch }
/>
);
};

export default SwitchAccountButton;
14 changes: 12 additions & 2 deletions js/src/components/google-ads-account-card/claim-account-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@
*
* @param {Object} props React props.
* @param {Function} [props.onClick] Function called back when the button is clicked.
* @param {boolean} [props.loading] Whether the button is in a loading state.
* @param {Object} props.restProps Props to be forwarded to AppButton.
*/
const ClaimAccountButton = ( { onClick = noop, ...restProps } ) => {
const { inviteLink } = useGoogleAdsAccountStatus();
const ClaimAccountButton = ( {
onClick = noop,
loading = false,
...restProps
} ) => {
const { inviteLink, hasFinishedResolution } = useGoogleAdsAccountStatus();
const getEventProps = useEventPropertiesFilter( FILTER_ONBOARDING );

const handleClaimAccountClick = ( event ) => {
Expand All @@ -42,12 +47,17 @@
onClick( event );
};

if ( ! hasFinishedResolution ) {
return null;

Check warning on line 51 in js/src/components/google-ads-account-card/claim-account-button.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/google-ads-account-card/claim-account-button.js#L51

Added line #L51 was not covered by tests
}

return (
<AppButton
{ ...restProps }
eventName="gla_open_ads_account_claim_invitation_button_click"
eventProps={ getEventProps() }
onClick={ handleClaimAccountClick }
loading={ loading }
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe( 'ClaimAccountButton', () => {

useGoogleAdsAccountStatus.mockReturnValue( {
inviteLink: 'https://example.com',
hasFinishedResolution: true,
} );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import useGoogleMCAccount from '.~/hooks/useGoogleMCAccount';
const AccountDetails = () => {
const { google } = useGoogleAccount();
const { googleAdsAccount } = useGoogleAdsAccount();
const { googleMCAccount } = useGoogleMCAccount();
const { googleMCAccount, isReady: isGoogleMCReady } = useGoogleMCAccount();

return (
<>
<p>{ google.email }</p>
<p>
{ googleMCAccount?.id > 0 &&
{ isGoogleMCReady &&
sprintf(
// Translators: %s is the Merchant Center ID
__(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* External dependencies
*/
import { useCallback, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import ClaimAccountButton from '.~/components/google-ads-account-card/claim-account-button';
import Section from '.~/wcdl/section';
import useGoogleAdsAccountStatus from '.~/hooks/useGoogleAdsAccountStatus';
import { useAppDispatch } from '.~/data';
import useGoogleAdsAccount from '.~/hooks/useGoogleAdsAccount';
import useWindowFocusCallbackIntervalEffect from '.~/hooks/useWindowFocusCallbackIntervalEffect';
import './claim-ads-account.scss';

/**
* ClaimAdsAccount component.
*
* @return {JSX.Element} ClaimAdsAccount component.
*/
const ClaimAdsAccount = () => {
const [ updating, setUpdating ] = useState( false );
const { googleAdsAccount } = useGoogleAdsAccount();
const { hasAccess } = useGoogleAdsAccountStatus();
const { fetchGoogleAdsAccountStatus } = useAppDispatch();

const shouldClaimGoogleAdsAccount = Boolean(
googleAdsAccount?.id && hasAccess === false
);

const checkUpdatedAdsAccountStatus = useCallback( async () => {
if ( ! shouldClaimGoogleAdsAccount ) {
return;
}

await fetchGoogleAdsAccountStatus();
}, [ fetchGoogleAdsAccountStatus, shouldClaimGoogleAdsAccount ] );

useWindowFocusCallbackIntervalEffect( checkUpdatedAdsAccountStatus, 30 );

const handleOnClick = () => {
setUpdating( true );
};

return (
<Section.Card.Body className="gla-claim-ads-account-section">
<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
loading={ updating }
text={
updating
? __( 'Waiting…', 'google-listings-and-ads' )
: __(
'Claim your Google Ads account',
'google-listings-and-ads'
)
}
isPrimary={ ! updating }
onClick={ handleOnClick }
/>
</div>
</Section.Card.Body>
);
};

export default ClaimAdsAccount;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.gla-claim-ads-account-section {
padding-top: 0;
}

.gla-claim-ads-account-box {
border: 1px solid $gray-300;
font-size: $gla-font-small;
padding: $grid-unit-30;

> * + * {
margin: $grid-unit-10 0 0;
}

h4 {
font-size: $gla-font-small;
margin-top: 0;
}

.gla-ads-post-claim-instructions {
color: $gray-700;
font-style: italic;
}

button,
.gla-loading-label {
display: flex;
margin-left: auto;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './claim-ads-account';
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import AppModal from '.~/components/app-modal';
import AppButton from '.~/components/app-button';
import WarningIcon from '.~/components/warning-icon';
import './confirm-create-modal.scss';

/**
* Google Ads account creation confirmation modal.
* This modal is shown when the user tries to create a new Google Ads account.
*
* @param {Object} props Component props.
* @param {Function} props.onContinue Callback to continue with account creation.
* @param {Function} props.onRequestClose Callback to close the modal.
* @return {JSX.Element} Confirmation modal.
*/
const ConfirmCreateModal = ( { onContinue, onRequestClose } ) => {
return (
<AppModal
className="gla-ads-warning-modal"
title={ __(
'Create Google Ads Account',
'google-listings-and-ads'
) }
buttons={ [
<AppButton key="confirm" isSecondary onClick={ onContinue }>
{ __(
'Yes, I want a new account',
'google-listings-and-ads'
) }
</AppButton>,
<AppButton key="cancel" isPrimary onClick={ onRequestClose }>
{ __( 'Cancel', 'google-listings-and-ads' ) }
</AppButton>,
] }
onRequestClose={ onRequestClose }
>
<p className="gla-ads-warning-modal__warning-text">
<WarningIcon />
<span>
{ __(
'Are you sure you want to create a new Google Ads account?',
'google-listings-and-ads'
) }
</span>
</p>
<p>
{ __(
'You already have another Ads account associated with this Google account.',
'google-listings-and-ads'
) }
</p>
<p>
{ __(
'If you create a new Google Ads account, you will need to accept an invite to the account before it can be used.',
'google-listings-and-ads'
) }
</p>
</AppModal>
);
};

export default ConfirmCreateModal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gla-ads-warning-modal {

.gla-ads-warning-modal__warning-text {
display: flex;
align-items: center;
gap: calc(var(--main-gap) / 3);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ import DisconnectAccount from '.~/components/google-ads-account-card/disconnect-
*
* @param {Object} props Props.
* @param {boolean} props.isConnected Whether the account is connected.
* @param {Function} props.onCreateNew Callback to create a new account.
* @param {Object} props.restProps Rest props. Passed to AppButton.
* @return {JSX.Element} Footer component.
*/
const ConnectAdsFooter = ( { isConnected, ...restProps } ) => {
// If the account is connected, show the disconnect button.
const ConnectAdsFooter = ( { isConnected, onCreateNew, ...restProps } ) => {
if ( isConnected ) {
return <DisconnectAccount />;
}

return (
<AppButton isTertiary { ...restProps }>
<AppButton isTertiary onClick={ onCreateNew } { ...restProps }>
{ __(
'Or, create a new Google Ads account',
'google-listings-and-ads'
Expand Down
Loading