Skip to content

Conversation

@getdave
Copy link
Contributor

@getdave getdave commented Aug 5, 2020

Builds on #16633 to address the need to make Social Previews a paid feature on WordPress.com.

This PR will address the frontend aspect of this by creating a new "Gutenberg Plugin" social-previews-upgrade-nudge (note this is not a WordPress Plugin in the traditional sense - see here) which will be registered only when the social-previews feature is not available on the current plan.

It will show the exact same UI as the main social-previews Plugin but include an upgrade prompt instead of a link to display the "Preview" modal.

Note: the reason this is required is because registerJetpackPlugin checks whether the social-previews feature is available on the current plan. If it is not available then the social-previews Gutenberg Plugin is never registered. Therefore in order to show our "Upgrade Nudge" we need to circumvent this check and ensure that our Plugin is always registered to the Jetpack sidebar, even if the current Plan does not support the social-previews feature.

As a complementary note, recall that Social Previews is to be:

  • free for Jetpack users.
  • require a paid plan for WPCom users.

This ensures it meets the WP Plugin guidelines as the Social Previews feature doesn't meet the definition of SaaS.

Fixes #16616

Changes proposed in this Pull Request:

  • Adds a new Gutenberg Plugin to the Jetpack Sidebar which is identical to the social-previews Plugin bar the inclusion of an "Upgrade Nudge".
  • Check to ensure that the above Plugin is only registered if the social-previews extension is not available on the current Plan.

Jetpack product discussion

See 84-gh-dotcom-manage.

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

No

Testing instructions:

Same setup as #16633 .

Note: a followup PR will work to allow you to switch between Plans to view the different variations of the extension. But for the purposes of this incremental PR we are having to manually flip a variable in the code to force show the version with the upgrade nudge.

  • Create a new Post using the Block Editor.
  • Toggle the Jetpack sidebar open using the Jetpack icon (top left of editor).
  • See the Social Previews feature without any form of "upgrade" notice.
  • In the code in extensions/blocks/social-previews/editor.js set extensionAvailableOnPlan = false and rebuild using yarn build-extensions.
  • Reload your Post in the Block Editor. You should now see x2 "Social Previews" panels in the Jetpack sidebar. The first is the one you've already seen. Then second is one which contains the upgrade nudge as per the design in (13P) Social Previews: Configure server-side plan checks #16616 (comment) (note the modal is not being addressed in this PR only the addition of the sidebar with the nudge!).

Proposed changelog entry for your changes:

  • Social Previews [beta] - adds a new Gutenberg Plugin to the Jetpack Sidebar which is identical to the social-previews Plugin bar the inclusion of an "Upgrade Nudge".

@getdave getdave requested review from a team, marekhrabe and retrofox August 5, 2020 11:51
@getdave getdave self-assigned this Aug 5, 2020
@jetpackbot
Copy link
Collaborator

jetpackbot commented Aug 5, 2020

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.

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16724

Scheduled Jetpack release: September 1, 2020.
Scheduled code freeze: August 25, 2020

Generated by 🚫 dangerJS against 6e1b5f6

@getdave getdave added the [Status] Needs Team Review Obsolete. Use Needs Review instead. label Aug 5, 2020
@getdave getdave marked this pull request as ready for review August 5, 2020 12:25
@getdave getdave requested review from marekhrabe and retrofox August 5, 2020 14:02
@getdave getdave force-pushed the add/plan-feature-gate-to-social-previews branch from 3fa252d to 6e1b5f6 Compare August 5, 2020 14:28
Copy link
Contributor

@marekhrabe marekhrabe left a comment

Choose a reason for hiding this comment

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

Let's do it! I've tested by switching the availability manually and things work as expected in both paid and unpaid variants.

Screenshot 2020-08-05 at 16 54 12

@marekhrabe marekhrabe added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Aug 5, 2020
@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 5, 2020
@jeherve jeherve added this to the 8.9 milestone Aug 5, 2020
@jeherve
Copy link
Member

jeherve commented Aug 5, 2020

As discussed in p1596637160315500-slack-CJS75TX3R, let's make sure we document this implementation (why plan_check isn't enough with extensions that are not your typical blocks) in extensions/README.md, or in the file itself, for our futureselves.

@getdave
Copy link
Contributor Author

getdave commented Aug 5, 2020

Thanks all. Will merge tomorrow morning UTC. I'll also follow up with #16728.

@getdave getdave marked this pull request as draft August 6, 2020 09:19
@getdave getdave marked this pull request as ready for review August 6, 2020 09:19
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello getdave! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D47689-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

@getdave
Copy link
Contributor Author

getdave commented Aug 6, 2020

Gardening / Manage labels and assignees (pull_request)

Merging as this is being blocked by '@actions/[email protected]' is not in the npm registry. which is likely related to current problem on NPM registry

Screen Shot 2020-08-06 at 10 35 48

@getdave getdave merged commit 11f81f1 into master Aug 6, 2020
@getdave getdave deleted the add/plan-feature-gate-to-social-previews branch August 6, 2020 09:36
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Aug 6, 2020
davidlonjon added a commit that referenced this pull request Aug 6, 2020
* master:
  UI changes to prepare to make Social Previews a gated feature on WPCom (#16724)
  Donations: Save block content (#16705)
@getdave
Copy link
Contributor Author

getdave commented Aug 6, 2020

r211736-wpcom

pereirinha pushed a commit that referenced this pull request Sep 10, 2020
…feature on WPCom (#16724)

* Add basic scaffold for premium nudge

* Add documentation to code.

* Remove testing check and use check for avaiabiliity

* Update extensions/blocks/social-previews/editor.js

Co-authored-by: Damián Suárez <[email protected]>

* Update extensions/blocks/social-previews/editor.js

Co-authored-by: Damián Suárez <[email protected]>

* Remove testing comment

* Normalize to a single button and onClick action

Co-authored-by: Damián Suárez <[email protected]>
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.

(13P) Social Previews: Configure server-side plan checks

7 participants