-
Notifications
You must be signed in to change notification settings - Fork 21
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
Consolidate accounts onboarding: Set up Google Merchant Center account via the combo card #2639
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ate/2597-connect-mc-account
…te/2597-connect-mc-account
…te/2597-connect-mc-account
…te/2597-connect-mc-account
@joemcgill Can you review PR please? The failing unit tests are from the parent branch. |
There was a problem hiding this 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.
js/src/components/google-combo-account-card/connect-mc/connect-mc.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connect-mc/connect-mc.js
Outdated
Show resolved
Hide resolved
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 } | ||
/> | ||
); | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joemcgill I've introduced a new AccountConnectionStatus
where we have this logic.
https://github.com/woocommerce/google-listings-and-ads/pull/2639/files#diff-398198aee87feb6f89983540431ac7e76d24a4d36793dd440d8758a287e190bbR1
However am not sure if there's an easier way to have the conditions to render that component:
https://github.com/woocommerce/google-listings-and-ads/pull/2639/files#diff-adf83b7ae2454ff433c2f50eb0f115c58b3a97776516764ef0ec88707353d177R45-R51
indicator={ getIndicator() } | ||
/> | ||
|
||
<ConnectMC /> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
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.
…ctor 2597: Refactor ConnectMC with updated AccountCard
…ate/2597-connect-mc-account
@@ -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" |
There was a problem hiding this comment.
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/components/google-combo-account-card/connect-mc/merchant-center-select.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 creatinggoogle-combo-account-card/connect-mc/connect-mc.js
- Revert the extraction of
AccountConnectionStatus
andhasAccountConnectionIssue
ConnectedGoogleMCAccountCard
will only be used on the Settings page and itshideAccountSwitch
prop will no longer be needed- Remove code related to
hideAccountSwitch
- Rename to specify that this component is dedicated to the Settings page
- Remove code related to
@eason9487 I've updated the PR to use the existing |
js/src/components/google-mc-account-card/disconnect-account-button.js
Outdated
Show resolved
Hide resolved
js/src/components/google-mc-account-card/disconnect-account-button.js
Outdated
Show resolved
Hide resolved
js/src/components/google-mc-account-card/disconnect-account-button.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
I confirmed with @fblascogarma today that the current wording, "Required to sync products so they show on Google." is preferred. Thanks all! |
900d45d
into
feature/2509-consolidate-google-account-cards
Changes proposed in this Pull Request:
Closes #2597 .
Replace this with a good description of your changes & reasoning.
Detailed test instructions:
Additional details:
Changelog entry