-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Jetpack Partner Coupon: prioritise coupon redirect #58552
Conversation
The current implementation of the partner coupon URL is supposed to just take over the entire flow and send directly to checkout. This will happen by the partnerCouponRedirects controller logic if we just redirect the customer without any special conditions. The reason we have to do this is because e.g. "shouldRedirectJetpackStart" has logic that will always go straight to the redirect URI after authorization which means we never hit the "plans" page where our partner coupon logic takes over.
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-20558 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~76 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
Just a note about the failing |
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.
LGTM.
Code changes look reasonable and work as per instructions.
Aside: I would consider this a pretty low risk change since we require the "from" property to specifically be jetpack-partner-coupon, so I'm not too worried about actually messing with existing flows.
I agree with this statement so I think we can safely ship this.
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.
After the last commit, I gave this PR a second review, and I can confirm that everything still works as expected. I appreciate the simplification introduced in the last commit.
✅
* Jetpack Partner Coupon: prioritise coupon redirect The current implementation of the partner coupon URL is supposed to just take over the entire flow and send directly to checkout. This will happen by the partnerCouponRedirects controller logic if we just redirect the customer without any special conditions. The reason we have to do this is because e.g. "shouldRedirectJetpackStart" has logic that will always go straight to the redirect URI after authorization which means we never hit the "plans" page where our partner coupon logic takes over. * Correct copy+paste comment error * Support sites with unattached licenses by bypassing "getRedirectionTarget"
Summary
The current implementation of catching a Jetpack partner coupon and redirecting users directly to checkout is having some issues. Specifically with sites that have a partner ID.
We would expect all
from: jetpack-partner-coupon
flows to be send over to the plans page after authorisation.We specifically catch users on the plans page and redirect them because we expect to make special upsell offers on the plan page in the future, so we might as well make sure the flow works now - which will also allow us to do it async of Jetpack plugin releases.
An issue we currently face is that some redirect conditions take over the normal flow like; is it a partner hosted site? (the
shouldRedirectJetpackStart
redirect condition).We should prioritise the coupon redirect over these conditions because the customer has specifically entered the partner coupon flow and is expected to "Go straight to checkout".
Aside: I would consider this a pretty low risk change since we require the "from" property to specifically be
jetpack-partner-coupon
, so I'm not too worried about actually messing with existing flows.Changes proposed in this Pull Request
Testing instructions
Verify failing flow
Include Jetpack Beta
add/partner-coupon-connection
as the Jetpack branchfree
plan with Jetpack Start API./wp-admin/admin.php?jetpack-partner-coupon=JPTST_JPTA_123AB
.Verify fixed flow
This assumes that you've just completed Verify failing flow and continues in the same flow.
/wp-admin/admin.php?page=jetpack#/dashboard
http://calypso.localhost:3000
.https://wordpress.com
withhttp://calypso.localhost:3000
/the PR link
.Filters snippet
Related to Automattic/jetpack#21813