jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

My Jetpack: Siteless checkout breaks plugin activation flows that rely on post checkout URLs from product data

Open nateweller opened this issue 1 year ago • 7 comments

Impacted plugin

Protect

Quick summary

When activating Jetpack Protect via My Jetpack, the use of connectAfterCheckout: true in useProductCheckoutWorkflow() causes the provided redirectUrl to be ignored by the Calypso.

Steps to reproduce

  1. Start with a fresh disconnected Jetpack install, running this branch if not merged yet: https://github.com/Automattic/jetpack/pull/38704
  2. Navigate to My Jetpack and click the "Activate" button on the Protect card.
  3. Purchase the paid plan and run through the checkout process.

A clear and concise description of what you expected to happen.

User should be redirected to the Jetpack Protect dashboard after purchasing the plan.

What actually happened

User is shown a thank you message, and presented with a button linking to the Scan section of Jetpack Cloud.

Impact

Some (< 50%)

Available workarounds?

No but the platform is still usable

If the above answer is "Yes...", outline the workaround.

No response

Platform (Simple and/or Atomic)

No response

Logs or notes

  • The checkout URL used by the My Jetpack pricing interstitial page includes from_site_slug, redirect_to, and unlinked params.
  • Calypso does not use the redirect_to parameter when from_site_slug is present. I am not sure if the issue is on the Jetpack side (providing both params) or the Calypso side (ignoring the provided redirect param)?

nateweller avatar Aug 14 '24 21:08 nateweller

👋 Hey @nateweller - I was triaging and trying to reproduce this issue. After purchasing, I'm getting redirected to the Protect dashboard. I used the same branch, as it was not merged when I was testing. Am I missing any steps? You may check here:

https://github.com/user-attachments/assets/d5cf0db1-f6b9-4126-ad55-3ac78f5ce8dd

bizanimesh avatar Aug 15 '24 13:08 bizanimesh

@bizanimesh I was able to reproduce this way:

https://github.com/user-attachments/assets/8b8c2c56-bee6-4684-b7a6-fc41d781f23a

@nateweller Can you confirm this is the issue you're referring to?

vykes-mac avatar Aug 21 '24 20:08 vykes-mac

@vykes-mac I believe that is the same issue I'm referring to! Apologies for the delay in response. This seems to only happen when the site is in a disconnected state prior to starting the checkout process. I'm just checking now to see if there is a difference in behaviour between a disconnected site, and a site-only connected site.

nateweller avatar Aug 21 '24 20:08 nateweller

To confirm, the issue is present if you attempt to purchase a plan via /wp-admin/admin.php?page=my-jetpack#/add-protect with either a disconnected or site-only connected state.

If the user already has a site connection, the redirect works as expected :+1:

nateweller avatar Aug 21 '24 20:08 nateweller

It seems showing the authorization modal after the checkout breaks the redirection.

vykes-mac avatar Aug 21 '24 21:08 vykes-mac

I updated the siteless checkout logic in Calypso to redirect to the jetpack protect page however the license is not activated as seen here.

Image

The license is auto activated in the Thank you page.

Image

What would be the best option here? to redirect and allow user to manually activate the license or to modify the Thank You page so that the Go to dashboard page goes back to the provided redirect_to uri? Or was going to Jetpack Cloud deliberate in the first place?

@nateweller @bizanimesh @Automattic/jetpack-martech

vykes-mac avatar Aug 23 '24 00:08 vykes-mac

What would be the best option here? to redirect and allow user to manually activate the license or to modify the Thank You page so that the Go to dashboard page goes back to the provided redirect_to uri? Or was going to Jetpack Cloud deliberate in the first place?

At least for this particular case, the user entered the checkout flow (1) from their site, with (2) a single specific plan to purchase. Due to that, ideally I think we would auto-activate their license key and then redirect them back to their site automatically (i.e. to the provided redirect_to parameter).

I know that technically we are buying a license key before connecting the site, and then need to activate the license (currently in the thank you page). However, also IMO, we shouldn't need to show the user anything about the license key process at all.

The "link to cloud" approach is existing from before we had a standalone plugin (Protect) for the Scan plan, which is why it just links to Cloud - that used to be the only place to access features for that plan.

nateweller avatar Aug 23 '24 20:08 nateweller

@nateweller Just wondering if it would make sense to assign this issue to you or someone else on your team? I think it could be helpful to have a DRI.

donnapep avatar Oct 08 '24 17:10 donnapep

This issue is currently being worked on and resolved in PR https://github.com/Automattic/wp-calypso/pull/94831 (in progress)

elliottprogrammer avatar Oct 09 '24 02:10 elliottprogrammer