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

Onboarding: Create new MC account when there are existing accounts in Google Accounts Card #2604

Open
7 tasks
Tracked by #2509
joemcgill opened this issue Sep 11, 2024 · 10 comments · Fixed by #2639
Open
7 tasks
Tracked by #2509
Assignees

Comments

@joemcgill
Copy link
Collaborator

joemcgill commented Sep 11, 2024

Caution

Depends on #2597

Part of #2509

While connecting the store to Merchant Center, a merchant may want to create a new account, even if they already have existing accounts associated with their Google account.

To support this, we will add a link below the account selector to kick off account creation.

Image

Clicking this link should show the same "Are you sure" modal that is shown today, which lets them initiate account creation or cancel.

Image

Once they confirm they want a new account, the account selector will replaced with a message that reads:

Creating a new Google Merchant Center account
This may take a few minutes, please wait a moment...

And the Connect button will be replaced by a loading spinner with the word "Creating..."

If the merchant needs to reclaim their URL, we'll display the reclaim UI in the card as shown:

Image

Once the new account is created and reclaimed, the card will show the new account as connected

Image

Background

In the current GoogleMCAccountCard, when there are already MC accounts associated with the Google account, we show a link below the account selector that allows them to create a new account instead of selecting an existing one.

Image

Clicking this link shows a modal to confirm they want to create an account.

Image

Once they've confirmed they want a new account and have accepted terms and conditions (not applicable, since they now accept terms and conditions when connecting their Google account), we show this UI while the account is being connected.

Image

After the new account is created, the user is shown the UI to reclaim their URL if applicable:

Image

Acceptance Criteria

  • When the MC account selector panel is visible, the user can see the link to create a new account
  • Clicking the create link, displays the "Are you sure..." modal
  • If the user cancels, the modal closes and the account selector is still shown
  • If the user confirms they want to create a new account, the panel is replaced by the UI showing that the account is being connected
  • Once the account is created, if the URL needs to be reclaimed, the reclaim UI is shown.
  • Once the account is created and reclaimed, the plugin finishes setting up the account and shows MC as connected
  • Once an account is connected, the create new link is replaced with a link to disconnect and connect a different account

Implementation Brief

  • Using the ConnectMC component created in Onboarding: Connect to existing MC account in Google Accounts Card #2597,
    • Add a new callback when clicking the "Or, create a new Merchant Center account". The WarningModal from js/src/components/google-mc-account-card/warning-modal/index.js should be rendered, prompting the user's confirmation.
    • If the user confirms, start the creation of a new Google MC account using the handleCreateAccount function from the useCreateMCAccount hook.
      • Inspiration can be taken from js/src/components/google-mc-account-card/create-account.js
      • While the creation is in progress,
        • the dropdown to select an existing account is replaced by a message (refer to the AC)
        • The "Connect" button label changes to "Creating..." with a loading spinner.
      • Appropriate states should be added to the component to cater for the above.
    • Once an account has been created, the merchant might need to reclaim the URL.
      • Render the ReclaimUrlCard if the URL needs to be reclaimed.
      • Use the following code js/src/components/google-mc-account-card/connect-mc/index.js as inspiration.
    • Once the account has been created and URL claimed (if needed),
      • Set the newly created account to be connected by calling the handleConnectMC function via the useConnectMCAccount hook.
        • Refer to the implementation in js/src/components/google-mc-account-card/connect-mc/index.js on how to pass the new Google MC ID to useConnectMCAccount
        • To get the newly created MC ID, check the result of the useCreateMCAccount hook.
    • Once we have a connected the MC account, display the accounts dropdown again along with the connected state button.
    • Within the connected state,
      • the "Or, create a new Merchant Center account" button should be replaced by "Or, connect to a different Google Merchant Center account".
        • Refer to the implementation for handleSwitch in js/src/components/google-mc-account-card/connected-google-mc-account-card.js
          • Look into the possibility of extracting the button into a separate component to reduce code duplication which can be used both, in js/src/components/google-mc-account-card/connected-google-mc-account-card.js and current component.

Test Coverage

  • Relevant E2E tests should be added to confirm what's in the AC.

Definition Questions

@joemcgill joemcgill added the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Sep 11, 2024
@asvinb asvinb self-assigned this Sep 13, 2024
@asvinb
Copy link
Collaborator

asvinb commented Sep 13, 2024

@joemcgill Can you kindly check the proposed IB please?

@joemcgill
Copy link
Collaborator Author

This looks good to me.

Render the ReclaimUrlCard if the URL needs to be reclaimed.

We could split this off to a separate ticket or make it a part of #2597. Seems like we should have the UI and logic for that in place before picking this up.

@asvinb and @eason9487, would be curious to get your thoughts on this ☝

@eason9487
Copy link
Member

eason9487 commented Sep 25, 2024

Once the new account is created and reclaimed, the card will show the new account as connected

image

The first suggestion is similar to #2603 (comment).

The second one is if this consolidated component will be used in this plugin's Settings or Ads-onboarding page as well, it needs to take care of they don't offer the functionality to disconnect Merchant account.

@asvinb
Copy link
Collaborator

asvinb commented Sep 26, 2024

@joemcgill Can you confirm that for now the component will be used for the onboarding flow only?

@joemcgill
Copy link
Collaborator Author

@asvinb this component will only be used in the onboarding flow. The original GoogleMCAccountCard will still be used in the settings screen.

@joemcgill
Copy link
Collaborator Author

Similar to #2603, we'll need to update this link once the component is updated so that it reads "Or, connect to a different Google Merchant Center account". See how this looks in the current single account component:

image

When that link is clicked we should fire off the DELETE request to the wp-json/wc/gla/mc/connection endpoint. See how this is handled here.

@asvinb
Copy link
Collaborator

asvinb commented Oct 1, 2024

Thanks @joemcgill . IB has been updated!

@joemcgill
Copy link
Collaborator Author

Thanks @asvinb. The updates look good to me. @eason9487 does this satisfy your concerns?

@joemcgill joemcgill assigned eason9487 and unassigned joemcgill Oct 1, 2024
@macka61 macka61 removed the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Oct 1, 2024
@eason9487
Copy link
Member

eason9487 commented Oct 1, 2024

Thanks for the update! Looks good.

@joemcgill joemcgill added the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Oct 1, 2024
@asvinb asvinb assigned joemcgill and asvinb and unassigned asvinb and joemcgill Oct 24, 2024
@joemcgill joemcgill removed the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Oct 25, 2024
@asvinb asvinb assigned joemcgill and unassigned asvinb Oct 25, 2024
@joemcgill joemcgill linked a pull request Oct 25, 2024 that will close this issue
@joemcgill joemcgill assigned eason9487 and ankitrox and unassigned joemcgill Oct 26, 2024
@asvinb asvinb assigned ankitguptaindia and unassigned ankitrox and eason9487 Oct 28, 2024
@eason9487 eason9487 assigned asvinb and unassigned eason9487 Nov 1, 2024
@asvinb asvinb assigned eason9487 and unassigned asvinb Nov 4, 2024
@asvinb
Copy link
Collaborator

asvinb commented Nov 4, 2024

@eason9487 Tackled as part of the PR for #2597
PR: #2639

@eason9487 eason9487 assigned asvinb and unassigned eason9487 Nov 5, 2024
@asvinb asvinb assigned eason9487 and unassigned asvinb Nov 5, 2024
@eason9487 eason9487 assigned asvinb and unassigned eason9487 Nov 6, 2024
@joemcgill joemcgill assigned fblascogarma and unassigned asvinb Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants