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

Consolidate accounts onboarding: Set up Google Merchant Center account via the combo card #2639

Conversation

asvinb
Copy link
Collaborator

@asvinb asvinb commented Oct 3, 2024

Changes proposed in this Pull Request:

Closes #2597 .

Replace this with a good description of your changes & reasoning.

Detailed test instructions:

  1. Go through the onboarding process and make sure you have at least one MC account.
  2. The card to connect your MC account should be displayed where you can connect a MC account
  3. The user should also be able to create a new account or disconnect their MC account.
  4. Designs: https://www.figma.com/design/fqR0EHi63lWahRcVTKCcba/Google-Listings-%26-Ads-v2.x?node-id=7447-22280&node-type=frame&t=tKJkit0BKc6985PH-0

Additional details:

  • There are no designs to reclaim a URL and existing components have been used as is.

Changelog entry

@github-actions github-actions bot added the changelog: update Big changes to something that wasn't broken. label Oct 3, 2024
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.7%. Comparing base (4f5bb47) to head (dacbd04).
Report is 88 commits behind head on feature/2509-consolidate-google-account-cards.

Additional details and impacted files

Impacted file tree graph

@@                               Coverage Diff                               @@
##           feature/2509-consolidate-google-account-cards   #2639     +/-   ##
===============================================================================
- Coverage                                           62.7%   62.7%   -0.0%     
===============================================================================
  Files                                                325     325             
  Lines                                               5162    5161      -1     
  Branches                                            1265    1265             
===============================================================================
- Hits                                                3239    3238      -1     
  Misses                                              1746    1746             
  Partials                                             177     177             
Flag Coverage Δ
js-unit-tests 62.7% <100.0%> (-<0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
js/src/hooks/useAutoCreateAdsMCAccounts.js 93.6% <100.0%> (-0.1%) ⬇️

@asvinb asvinb marked this pull request as ready for review October 8, 2024 12:35
@asvinb
Copy link
Collaborator Author

asvinb commented Oct 8, 2024

@joemcgill Can you review PR please? The failing unit tests are from the parent branch.

@joemcgill joemcgill linked an issue Oct 8, 2024 that may be closed by this pull request
5 tasks
Copy link
Collaborator

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @asvinb This is looking pretty good, but I've got a few questions/suggestions inline.

Comment on lines 45 to 90
if ( ! isConnected && resultConnectMC.response?.status === 409 ) {
return (
<SwitchUrlCard
id={ resultConnectMC.error.id }
message={ resultConnectMC.error.message }
claimedUrl={ resultConnectMC.error.claimed_url }
newUrl={ resultConnectMC.error.new_url }
onSelectAnotherAccount={ resultConnectMC.reset }
/>
);
}

if (
! isConnected &&
( resultConnectMC.response?.status === 403 ||
resultCreateAccount.response?.status === 403 )
) {
return (
<ReclaimUrlCard
id={
resultConnectMC.error?.id || resultCreateAccount.error?.id
}
websiteUrl={
resultConnectMC.error?.website_url ||
resultCreateAccount.error?.website_url
}
onSwitchAccount={ () => {
resultConnectMC.reset();
resultCreateAccount.reset();
} }
/>
);
}

if (
! isConnected &&
( resultCreateAccount.loading ||
resultCreateAccount.response?.status === 503 )
) {
return (
<CreatingCard
retryAfter={ resultCreateAccount.error?.retry_after }
onRetry={ handleCreateAccount }
/>
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates a lot of logic directly from js/src/components/google-mc-account-card/connect-mc/index.js. Curious if we could abstract some of this into a shared component and avoid the redundant isConnected check in the process?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicator={ getIndicator() }
/>

<ConnectMC />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than making this a sibling component of the AccountCard above, I would have expected ConnectMC to return a Section.Card.Body component that is passed as a child of the AccountCard above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joemcgill We synced in Slack about that. We'll have a group of cars, so it'll be siblings.

@@ -39,7 +56,7 @@ const ConnectedGoogleComboAccountCard = () => {
<AccountCard
appearance={ APPEARANCE.GOOGLE }
alignIcon="top"
className="gla-google-combo-account-card--connected"
className="gla-google-combo-account-card gla-google-combo-account-card--connected"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the gla-google-combo-account-card to be consistent with the other cards.

js/src/data/resolvers.js Outdated Show resolved Hide resolved
tests/e2e/specs/setup-mc/step-1-accounts.test.js Outdated Show resolved Hide resolved
tests/e2e/specs/setup-mc/step-1-accounts.test.js Outdated Show resolved Hide resolved
tests/e2e/specs/setup-mc/step-1-accounts.test.js Outdated Show resolved Hide resolved
tests/e2e/specs/setup-mc/step-1-accounts.test.js Outdated Show resolved Hide resolved
tests/e2e/utils/pages/setup-mc/step-1-set-up-accounts.js Outdated Show resolved Hide resolved
tests/e2e/specs/setup-mc/step-1-accounts.test.js Outdated Show resolved Hide resolved
tests/e2e/specs/setup-mc/step-1-accounts.test.js Outdated Show resolved Hide resolved
tests/e2e/utils/pages/setup-mc/step-1-set-up-accounts.js Outdated Show resolved Hide resolved
Copy link
Member

@eason9487 eason9487 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the original components under the js/src/components/google-mc-account-card directory are only used for the Onboarding accounts step, except for ConnectedGoogleMCAccountCard which is shared by the Setting page. Given this, extracting some code into shared components or functions and creating another ConnectedMC component would make for unnecessary redundant code and reduce maintainability.

This PR should be able to be done based on the original existing code and minimize code changes to optimally leverage codes that have been run for 2-3 years.

Suggest exploring possibilities in this direction:

  • Adjust the google-mc-account-card/connect-mc/index.js to fulfill the new UI and functionality rather than creating google-combo-account-card/connect-mc/connect-mc.js
  • Revert the extraction of AccountConnectionStatus and hasAccountConnectionIssue
  • ConnectedGoogleMCAccountCard will only be used on the Settings page and its hideAccountSwitch prop will no longer be needed
    • Remove code related to hideAccountSwitch
    • Rename to specify that this component is dedicated to the Settings page

@asvinb
Copy link
Collaborator Author

asvinb commented Nov 4, 2024

@eason9487 I've updated the PR to use the existing ConnectMC component. Let me know what you think.

Copy link
Member

@eason9487 eason9487 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work. LGTM.

There is only one #2639 (comment) left to be confirmed for now. Perhaps it needs a bit of tweaking and I believe that even then, it won't need another review. I will be approving in advance.

@joemcgill
Copy link
Collaborator

I confirmed with @fblascogarma today that the current wording, "Required to sync products so they show on Google." is preferred. Thanks all!

@joemcgill joemcgill merged commit 900d45d into feature/2509-consolidate-google-account-cards Nov 6, 2024
7 checks passed
@joemcgill joemcgill deleted the update/2597-connect-mc-account branch November 6, 2024 16:56
@eason9487 eason9487 changed the title Connect MC Account within combo card Consolidate accounts onboarding: Set up Google Merchant Center account within the combo card Nov 20, 2024
@eason9487 eason9487 changed the title Consolidate accounts onboarding: Set up Google Merchant Center account within the combo card Consolidate accounts onboarding: Set up Google Merchant Center account via the combo card Nov 20, 2024
@ianlin ianlin mentioned this pull request Nov 26, 2024
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: update Big changes to something that wasn't broken.
Projects
None yet
4 participants