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

Update/enable frontend upgrade nudges #18239

Merged
merged 16 commits into from
Jan 22, 2021

Conversation

stacimc
Copy link
Contributor

@stacimc stacimc commented Jan 7, 2021

Fixes 158-gh-Automattic/view-design and 157-gh-Automattic/view-design and 175-gh-Automattic/view-design.

Changes proposed in this Pull Request:

  • re-enables frontend previews for paid blocks requiring an upgrade. If a block is unavailable due to not meeting plan requirements and the current user is an admin, the block will still be rendered on the frontend with an upgrade banner identical to the one that appears in the editor.
  • refactors the existing UpgradePlanBanner used in the editor to pull out as much common code as possible into a generic Nudge component that can be server-side-rendered
  • adds a frontend Stripe nudge for the Premium Block specifically, unless the upgrade nudge is already being displayed.

Upgrade nudge
Screen Shot 2021-01-07 at 7 22 40 PM

Stripe nudge
Screen Shot 2021-01-07 at 7 05 33 PM

On Atomic sites, the Stripe nudge redirects the user back to the post in the editor in order to edit the block/connect Stripe, rather than connecting directly to Stripe checkout

Jetpack product discussion

Internal reference: pcjTuq-8U-p2

Does this pull request change what data or activity we track or use?

  • TBD

Testing instructions:

This requires re-testing across all the scenarios: wpcom and Jetpack, with and without the required plan, and with and without Stripe connected.

Test setup notes
  • the wp-env scripts will not sync changes to class.jetpack-gutenberg.php, components.php, or class-blocks.php. These may need to be manually synced to their respective files in the sandbox.
  • before syncing, re-run npm run build from within the Jetpack dir in order to build the SSR templates.
Test scenarios

Jetpack

  • Simply verify that you cannot add a Premium Content block.

Wpcom

  1. On a wpcom site with a free plan, add a Premium Content block.
  2. Preview the block in the frontend and verify that the block is displayed with an Upgrade nudge (no Stripe nudge).
  3. View the post in an incognito window and verify that you cannot see the block.
  4. Upgrade the site to a Personal plan.
  5. View the post on the frontend again and verify that you now see the Stripe nudge.
  6. Open the post in an incognito window and verify that you cannot see the block or the nudge.
  7. Go back to the editor and connect Stripe.
  8. Preview the block and verify that it is displayed with no nudges.
  9. Revisit the post in an incognito window and verify that you can now see the block.

Atomic (need to use business site so Stripe access works)

  • Create a WordPress.com business site and install a plugin so it becomes an Atomic site.
  • Access the site via FTP
  • Upload the Jetpack Beta plugin
  • Delete the symlink to "Full Site Editing" in plugins
  • Via wp-admin search for an install "Editing Toolkit"
  • Activate both the Jetpack beta and editing toolkit plugins
  • Via FTP edit wp-content/plugins/full-site-editing/full-site-editing.php and comment out line 304.
  • Select this branch in the Jetpack beta plugin.
  • Follow the same steps as for wpcom (minus free site), but note that the Stripe nudge's CTA should take you back to the editor.

Other Paid Blocks (Wpcom)
(Pay with Paypal, Donations, Payments, Video, WhatsApp, Open Table, Calendly)

  1. On a wpcom site with a free plan, add the paid block
  2. Preview the block in the frontend and verify that it is displayed with an Upgrade nudge
  3. View the post in an incognito window and verify that you cannot see the block.
  4. Upgrade the site to the necessary plan level for that block
  5. View the post on the frontend and verify that you can see the block with no upgrade nudge
  6. View the post in an incognito window and verify that you can now see the block.

Proposed changelog entry for your changes:

  • TBD

@jetpackbot
Copy link

jetpackbot commented Jan 7, 2021

Scheduled Jetpack release: February 2, 2021.
Scheduled code freeze: January 25, 2021

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.

Generated by 🚫 dangerJS against b6ad067

@stacimc stacimc self-assigned this Jan 8, 2021
@stacimc stacimc marked this pull request as ready for review January 8, 2021 03:03
@stacimc stacimc force-pushed the update/enable-frontend-upgrade-nudges branch 2 times, most recently from 4366d18 to 5387648 Compare January 11, 2021 21:59
@apeatling apeatling force-pushed the update/enable-frontend-upgrade-nudges branch from 6332b89 to 3039f1e Compare January 13, 2021 18:51
@apeatling
Copy link
Member

Testing Instructions for Atomic (so Stripe connecting works):

  • Create a WordPress.com business site and install a plugin so it becomes an Atomic site.
  • Access the site via FTP
  • Upload the Jetpack Beta plugin
  • Delete the symlink to "Full Site Editing" in plugins
  • Via wp-admin search for an install "Editing Toolkit"
  • Activate both the Jetpack beta and editing toolkit plugins
  • Via FTP edit wp-content/plugins/full-site-editing/full-site-editing.php and comment out line 304.
  • Select this branch in the Jetpack beta plugin.
  • Test.

@apeatling
Copy link
Member

apeatling commented Jan 13, 2021

I've gone through a simple site, atomic site, free and paid. I've checked all existing paid blocks. Nice work!

This all worked very well except for one thing -- the Payments block seems to not display the notice on the front end. It also shows up in an incognito window, but that's also the case on master.

apeatling
apeatling previously approved these changes Jan 13, 2021
Copy link
Member

@apeatling apeatling left a comment

Choose a reason for hiding this comment

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

This looks good, the only thing I see is to clean up the missing period marks at the end of comments that the linter is complaining about.

@apeatling apeatling added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Team Review labels Jan 13, 2021
@apeatling apeatling requested a review from a team January 13, 2021 21:03
@apeatling apeatling added the [Block] Paid Content aka Premium Content label Jan 13, 2021
@stacimc
Copy link
Contributor Author

stacimc commented Jan 13, 2021

the Payments block seems to not display the notice on the front end. It also shows up in an incognito window, but that's also the case on master.

@apeatling Thanks for pointing this out. Do you mean the Recurring Payments block? That block is unfortunately different because it does not use the plan_check attribute (all of its nudges are custom handled, in order to handle the jetpack_block_editor_enable_upgrade_nudge being false on jetpack). It will not get the frontend nudges for free.

I've crossed that block out in the list of paid blocks to test. Do you think it's worth a follow-up to add this to Payments for consistency? This is yet another annoying sticking point caused by that block's custom registration.

@apeatling
Copy link
Member

@stacimc Can you make an issue as a follow up? No need to work on it for this PR.

@apeatling apeatling added this to the 9.4 milestone Jan 18, 2021
@stacimc stacimc force-pushed the update/enable-frontend-upgrade-nudges branch from 3039f1e to 13ab974 Compare January 19, 2021 18:15
@jeherve
Copy link
Member

jeherve commented Jan 20, 2021

Do you think we could merge #17907 first, and then focus on this one? I think it would help, as the original Premium content block is getting a bit unwieldy.

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jan 20, 2021
An error occurred while trying to automatically change base from add/premium-content-block to master January 20, 2021 18:56
@stacimc stacimc force-pushed the update/enable-frontend-upgrade-nudges branch from 863d9ed to c66d30a Compare January 21, 2021 00:42
@jeherve jeherve added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jan 22, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello stacimc! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D55853-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This looks good. I pushed a few changes, tested, this should be good to merge. I spotted some minor issues, but nothing blocking.

On WordPress.com Simple

I tested with D55853-code, in Chrome.

  • On Free sites, I think we could do with some extra padding in the upgrade nudge for the Payments button inside the Premium Content block:

image

  • Once I've paid for a plan and connected to Stripe, I did not see the Payment button on the frontend, only in the editor. The problem disappeared when I created a Payment button outside of the Premium Content block and assigned a plan to the button. I suppose that's because the subscription plan was saved.
  • The same thing happened in Atomic.

On Atomic

I didn't spot any issues.

On Jetpack

I can't see the block when only using the production bundle. 👍

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jan 22, 2021
@jeherve
Copy link
Member

jeherve commented Jan 22, 2021

Going to merge this now. I'll let you handle the WordPress.com counterpart with the other related diffs later :)

Do you want me to create issues for the comments I left above?

@jeherve jeherve merged commit 83241db into master Jan 22, 2021
@jeherve jeherve deleted the update/enable-frontend-upgrade-nudges branch January 22, 2021 16:31
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jan 22, 2021
@jeherve jeherve added [Status] Needs Testing We need to add this change to the testing call for this month's release and removed [Status] Needs Changelog labels Jan 22, 2021
jeherve added a commit that referenced this pull request Jan 22, 2021
@stacimc
Copy link
Contributor Author

stacimc commented Jan 22, 2021

Do you want me to create issues for the comments I left above?

@jeherve If you don't mind that would be great; I'm not positive I understand exactly how to repro. Thank you!

@jeherve
Copy link
Member

jeherve commented Jan 25, 2021

create issues for the comments I left above

I created #18521 and #18522 to track things.

@jeherve
Copy link
Member

jeherve commented Feb 3, 2021

r220427-wpcom

@jeherve jeherve removed the [Status] Needs Testing We need to add this change to the testing call for this month's release label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paid Content aka Premium Content Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants