-
Notifications
You must be signed in to change notification settings - Fork 800
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 Content Block: Move to Jetpack #17907
Conversation
This is an automated check which relies on |
Do you think you could post on +jetpackp2 about the feature, so Product can weigh in on whether this would be a good fit for the Jetpack plugin or not? This may help us decide where to ship the block, even when developed in the Jetpack monorepo. If there is already a discussion about this somewhere, I may have missed it, sorry! Could you add a link to it in the PR description? Thank you! |
Caution: This PR has changes that must be merged to WordPress.com |
Functionality looks to be working correctly now, and it is set up to seamlessly transition from the existing code in Editing Toolkit. Still some polishing to do. |
5b1e516
to
da52549
Compare
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.
Nice work @apeatling ! 👍
The code looks good, the structural and organisational improvements are nice.
I created diffs between the editing toolkit version and the code in this PR. Everything stacked up and made seeing what had to be tweaked for use in Jetpack much easier.
Unfortunately, I ran into some troubles with my dev environment this afternoon so I'll have to do the actual hands-on testing first thing next week.
There were a few minor things that came up while reviewing the code, most of which are already the case in the editing toolkit version.
Linting Errors
There are quite a few linting errors that might be good to address while we are bringing this across to Jetpack. In particular, on the PHP side of things, there are some PHP 5.6 compatibility issues.
I've also taken the liberty of pushing a commit to fix some minor linting errors with icon.js
Deprecations
With what we've learnt recently about block deprecations, it looks like the version numbers of the logged-out-view
deprecations are out. This is already the case in the editing toolkit so not something that has been introduced. As deprecations are attempted in reverse chronological order, trying v1
before v2
would, by the names, be back to front for me.
Continuing with the nitpicking, the subscriber-view
deprecation array is actually within the subscriber-view/deprecated/v1/index.js
file. I think it would make more sense if the deprecated/v1
file only contained the v1 deprecation and the array done via a deprecated/index.js
file or in the block's index.js
settings.
Keywords
In the editing toolkit version, the premium content block's keywords contained premium content
, the keywords in Jetpack don't. Should we add that back?
Dashicons
In wp-calypso, the linter provides a warning against importing Dashicon
. In Jetpack, that warning doesn't occur. Should we take the opportunity to update that while we are here?
'Dashicon' import from '@wordpress/components' is restricted. Please use `@wordpress/icons` instead
0941573
to
e44cbf4
Compare
Yes I think we'd want the nudge, I'm not sure exactly how this works though. I do see on my local site that the unavailability reason is "missing_plan_no_upgrade_nudge". There must be a way to enable the nudge. |
Lint errors from the moved over code fixed up. 👍 |
This mostly tested as advertised for me. The only issue I encountered, not raised already, was related to an edge case where there were no subscription plans previously created. I came across this when I had the store sandboxed. The result was the subscribe (payments) button displaying a nudge but then showing a This can be ignored if it has been addressed already in other PRs or isn't a scenario that can be encountered in production. |
This was on a WordPress.com site? |
Because this is in the title, we shouldn't need it in the keywords. |
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.
I really appreciate some of the restructuring of the block -- it's now much easier/more intuitive to navigate the code 👏
When testing on a jetpack site with a free plan, I believe both Premium Content and Payments should render but with upgrade nudges. I'm seeing Premium Content render without the upgrade nudge, although there is a nudge on the nested payments button:
The nudge on the Payments button should disappear when #17702 is merged, but I think the missing nudge on Premium Content needs to be added back in. There is already a shouldUpgrade
boolean correctly being populated on the container which we can use.
Previously this wasn't an issue because the Premium Content block was in ETK and wasn't even available on Jetpack sites unless there was a sufficient plan.
return false; | ||
} | ||
return true; | ||
} |
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.
There is an edge case here where the site (Jetpack or wpcom) does not have a sufficient plan ugprade, but does have a Stripe account connected. The user will get the upgrade nudge in the edtior, but since we only check for the Stripe account in the pre_render_checks
, the block will render just fine on the frontend. I believe this is a pre-existing problem.
It was a sandboxed WordPress.com site. My apologies for leaving out crucial info 🙁 |
0d76064
to
1ea502e
Compare
All of @stacimc's work in Automattic/wp-calypso#47388 has now been integrated into this PR. |
This one is ready for a crew review now. |
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.
I've done another pass at this. I pushed a few commits to try to fix some of the issues I saw, I hope that's okay.
It does seem to work for me at the moment, but with the size of this PR it's entirely possible that I missed something. At this point, I think it would be nice to merge this as it is, and then get a few people to test all this to catch every possible issue before the release.
In the future, I think it would be nice to use our own Button block for those buttons, and take the opportunity to improve our own block with the color editing features we're adding to the Premium Content buttons in this PR.
@@ -0,0 +1,85 @@ | |||
/** |
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.
I believe it's already in progress in another PR, but just taking note of it here just in case; it would be nice to get rid of this in favor of the existing nudge in the future.
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.
It looks like my approval may not be enough; there are some linting problems that will need to be fixed it seems:
https://github.com/Automattic/jetpack/pull/17907/checks?check_run_id=1729352685
…iew is disarmed The fix was originally merged into wp-calypso in: Automattic/wp-calypso#48988
This reverts commit f1498e9.
I've taken the opportunity to suppress some of those warnings for all extensions, as I do not think they can be realistically all filled for all our blocks at the moment.
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.
Let's merge this! 💥
r220419-wpcom |
Changes proposed in this Pull Request:
This PR moves the Premium Content block code from Editing toolkit into Jetpack. It reformats the block code to match the Jetpack block organization and removes any duplicate functionality.
Note: In order for users to seamlessly transition from the editing toolkit version to the Jetpack version of this block, the namespace has to remain as
premium-content/container
and not include/jetpack
(this is handled in this PR). Doing this means we do not have to maintain the old code in Editing Toolkit forever.Fixes https://github.com/Automattic/view-design/issues/144
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Please test this on a local Jetpack install using Jurassic.tube, and on WordPress.com.
Testing a Jetpack Site:
npm run start
, and DO NOT include Editing Toolkit (just use Gutenberg, and Jetpack).npm run tube:init
ryan.ray
test stripe account in the secret store. Confirm this connection works.Testing a WordPress.com Site:
npm run sync
and select Jetpacknpm run sync
and select Editing Toolkitwp-calypso/apps/editing-toolkit/editing-toolkit-plugin/full-site-editing-plugin.php
and removeadd_action( 'plugins_loaded', __NAMESPACE__ . '\load_premium_content' );
on line 297 so the block doesn't load from Editing Toolkit.Some other tests to note:
Privacy Changes:
Proposed changelog entry for your changes: