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

Premium blocks: Add plan param to redirect URL - take 2 - simple sites #13281

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

chriskmnds
Copy link
Contributor

@chriskmnds chriskmnds commented Aug 21, 2019

Fixes #13003 (partially)

Related: Automattic/wp-calypso#35697

Changes proposed in this Pull Request:

Handles adding the plan_upgraded=1 query param to simple site urls passed from the "upgrade nudge" in the redirect_to param. We (@simison primarily) spotted that in #13218 we were only handling jetpack self-hosted sites. Effectively this will be passed on redirection once a plan has been upgraded successfully after clicking on the "upgrade nudge".


The result after these changes is the user landing on the calypso block editor with a url of the form https://wordpress.com/block-editor/post/chriskmnds.wordpress.com/3?plan_upgraded=1


Is this a new feature or does it add/remove features to an existing part of Jetpack?

  • It adds the foundation for showing a notification when the redirection happens after clicking an upgrade nudge.

Testing instructions:

  • Apply the underlying diff to your sandbox.
  • Load a non-premium non-jetpack wpcom site that is linked to your sandbox.
  • Open a post and add the "simple payments" block.
  • Click on the upgrade nudge and purchase a premium plan to enable simple payments.
  • On redirection back to the editor, confirm that the URL contains the parameter &plan_upgraded=1.

Proposed changelog entry for your changes:

  • Doesn't need one I think?

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello chriskmnds! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D31758-code before merging this PR. Thank you!

@jetpackbot
Copy link
Collaborator

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: September 3, 2019.
Scheduled code freeze: August 27, 2019

Generated by 🚫 dangerJS against 0bfb7ba

Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

I am sent back to the editor with plan_upgraded=1 after purchase

@ockham
Copy link
Contributor

ockham commented Aug 23, 2019

Just noting that we'll also need to update the frontend nudge (both for Simple Sites, and Jetpack) 😬
(fine to do in a separate PR)

$redirect_to = ( defined( 'IS_WPCOM' ) && IS_WPCOM )
? '/' . implode( '/', array_filter( array( $post_type_editor_route_prefix, $post_type, $site_slug, $post_id ) ) )
: add_query_arg(
array(
'action' => 'edit',
'post' => $post_id,
),
admin_url( 'post.php' )
);

@chriskmnds
Copy link
Contributor Author

Just noting that we'll also need to update the frontend nudge (both for Simple Sites, and Jetpack) 😬

Can you tell me a little more about that? What is it and why are you referring to it explicitly as "frontend nudge"? 😀

@simison
Copy link
Member

simison commented Aug 26, 2019

"Frontend nudge" in this case means when the block is added and saved to the content, on the public-facing website there's a nudge visible only to admins. You can test it with simple payments block currently.

@ockham
Copy link
Contributor

ockham commented Aug 26, 2019

What Mikael said :) "Frontend" as in HTML rendered for site visitors (vs "backend" as in wp-admin). We're using some magic to render our React component to some static HTML (that we actually turn into PHP to include translation calls, such as __()) -- see #13070. However, in order to replicate some of the logic (e.g. needed for the redirect targets), we have to provide some data through PHP.

In this case, the required change should be fairly straight-forward 🤞

@jeherve jeherve added this to the 7.7 milestone Aug 26, 2019
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Aug 26, 2019
@simison
Copy link
Member

simison commented Aug 26, 2019

The "Frontend" URLs update would be fine to do in separate PR btw!

@chriskmnds chriskmnds merged commit ac55ffc into master Aug 26, 2019
@chriskmnds chriskmnds deleted the add/notification-on-plan-upgrade-url-arg-wpcom branch August 26, 2019 09:02
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Aug 26, 2019
@jeherve jeherve added the [Block] Pay With Paypal aka Simple Payments label Feb 12, 2021
@jeherve jeherve added the [Feature] Pay with PayPal aka Simple Payments label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Premium block flows: post checkout confirmation / thank you
7 participants