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

WIP Donations block: Update donations block to use inner blocks #22470

Closed
wants to merge 169 commits into from

Conversation

rcrdortiz
Copy link
Contributor

Fixes #17232, it also fixes other issues. I'll update this message when the PR is ready for review.

Changes proposed in this Pull Request:

  • Ported the current Donations block from using RichText components to use InnerBlocks instead.

Jetpack product discussion

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

Testing instructions:

  • Edit or create a post.
  • Search for the Donations Editable Blocks (beta) component and add it.

…xed components. We can now edit the presentation of the individual components of the donations block. Save is not working, some styles are missing, and other basic behaviours and checks are also missing.
@matticbot
Copy link
Contributor

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

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Block] Donations Editable Blocks labels Jan 24, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 24, 2022

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: March 1, 2022.
  • Scheduled code freeze: February 22, 2022.

anomiex and others added 2 commits January 25, 2022 05:18
The coverage report started taking an extra 10 minutes after
packages/my-jetpack added JS tests because it was reporting coverage for
all of WordPress that was brought in via WorDBless. Exclude that by
default.

Also exclude the `jetpack_vendor/` directory from
packages/composer-plugin for good measure.
Co-authored-by: Brandon Kraft <public@brandonkraft.com>
@Copons
Copy link
Contributor

Copons commented Jan 24, 2022

This is super interesting already @rcrdortiz!
I'm really looking forward to seeing this with the save functions! ✨

Please keep in mind that we don't need all the requested features at once.
The original Donations block has no customization options, so even just refactoring it into inner blocks should be enough for a first PR.
We can add (or fine-tune) all the design tools in follow-ups.

At a glance, I've got a few general comments about the tabs!


Is there a reason why they are three different child blocks rather than one generic tab block with different attributes and inner blocks?

They seem to be practically identical, aside from the initial heading label and the payment cadence; we should be able to address them both through attributes and inner blocks.

Something like this:

<!-- wp:jetpack/donations-view { "type": "annual" } /-->
    <!-- wp:heading {"level":3} -->
    <h3>Make a yearly donation</h3>
    <!-- /wp:heading -->
<!-- /wp:jetpack/donations-view /-->

The structure of the block becomes like this (which is reasonable):

Screenshot 2022-01-24 at 19 08 53

Please make sure also to add appropriate icons to the tabs.
For lack of better ones, reuse the Donations' heart icon — Premium Content does the same for visitor/subscriber views.

And speaking of Premium Content, with this new format, the Donations block would have the same issue outlined here: #22426.

We can address it in a follow-up, though, so there's no need to sweat over it right now. 👍


Note that the original Donations block has this in its sidebar settings:

Screenshot 2022-01-24 at 19 11 51

When working on inner blocks templates, keep in mind that:

  • Monthly and annual views are optional and can be togglable (via sidebar settings, unless we have a better idea).
  • The custom amount button is optional as well (this comes for free with inner blocks, just make sure it can be deleted and re-added).

Also, a bonus comment about folder structure nitpicking! 😄

Blocks typically have a flatter structure, so feel free to:

  • Move all from common to the root.
  • donations-context.js can be just context.js, which is consistent with both JP and Core Guten blocks.
  • factory.js is a bit uncommon in a8c; better utils.js or spread into single-function files (although, if we manage to unify the three view blocks, we wouldn't need these functions anymore 🙂 ).
  • Move the child blocks folders into the root as well, as it's fairly obvious what they are and IMHO there's no need for the additional specificity of the child-blocks folder.

jwebbdev and others added 4 commits January 24, 2022 21:19
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
When creating a JS package, the CLI is pre-filling the test-coverage
script with a call to `nyc`. But it wasn't also pre-adding a dependency
on nyc, resulting in coverage not working for several packages.

Also, add the missing dep to those packages.
* fix issue with output folder creation

* [not verified] Add API and scripts

* add changelog

* [not verified] Add presisting Model class and use it all over the API

* Exclude from PHPCS for now

* Remove package from exclude list

* Require PHP 8.0

* minor additions

* Use the correct composer.json rules for requiring php 8

* Update projects/packages/analyzer/scripts/jp-analyze-parallel.php

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

* address feedback

* some more feedback

* update result generation logic

* Add generic query params parser class

* Add plugin downloader class

* use query params in analyze controller

* download requested versions of a plugins for scan

* Update projects/packages/analyzer/scripts/jp-analyze-parallel.php

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

* Update projects/packages/analyzer/src/api/class-plugin-downloader.php

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

* update error message

* Some changes to address issues on linux

* improve not implemented output

* fix an issue with empty $folder_name

* Address racing issue

* implement missing deserialization routines

* Update projects/packages/analyzer/scripts/jp-analyze-parallel.php

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

* move phpcs rule definitions around

* Use a PHP way to remove folders

* replace only first occurance of the folder in zip

* Fix PHPCS configuration 🤦

* Introduce load_differences() API

Co-authored-by: Brandon Kraft <public@brandonkraft.com>
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
@rcrdortiz rcrdortiz changed the title Update/donations block to inner blocks Donations block: Update donations block to use inner blocks Jan 25, 2022
jsnmoon and others added 6 commits January 25, 2022 13:52
* my-jetpack: check user connectivity before to hit wpcom

* changelog
…ntime (#22265)

Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
…nspector. Refactored directory structure. Added controls for the donations block. Merged all the views into a single view.
@rcrdortiz
Copy link
Contributor Author

@Copons Implemented all your suggestions. Thanks!
You will notice that the custom amount field toggle isn't working, I'm aware of it.

ivan-ottinger and others added 24 commits February 5, 2022 04:26
#22659)

* [not verified] my-jetpack: extract go-back-link from connection

* [not verified] my-jetpack: introduce Layout component

* [not verified] my-jetpack: remove duplicated go back link from connection

* [not verified] my-jetpack: tweak product interstitial layout

* [not verified] my-jetpack: tweak connection-screen top margin

* [not verified] changelog
… not allowed to be saved now on the custom amount field. Custom Amount block controls are now working and style the custom amount block accordingly.
Until now, the endpoint was available to anyone, and one could pass any Twitter Thread to that endpoint to make a blog-authenticated request to WordPress.com, and then, in turn, an authenticated request to the Twitter API using our app credentials.

Here is an example:
https://jeremy.hu/wp-json/wpcom/v2/tweetstorm/gather?url=https://twitter.com/KieranBinchy/status/1488812175372267526

That endpoint is currently used in the block editor (so only by folks with contributing capabilities on a given site) to "unroll" a Twitter Thread, i.e. pull all tweets from a thread based off a single tweet.

I think it would be fine to limit that endpoint to contributors.

- Related post: p3btAN-1Fc-p2
- This merges r239582-wpcom from WordPress.com (D74346-code).
)

* Add has_required_plan info and implement in Search

* updating lock files

* monorepo gardening

* create needs_purchase status
* [not verified] my-jetpack: add data for search product

* changelog
* Remove previous rule and exclude by file.
…em CTA when a partner coupon is detected (#22602)

Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
* [not verified] my-jetpack: mock Boost princing data

* [not verified] my-jetpack: camelcasly pricingForUi

* [not verified] my-jetpack: implement Free for product detail

* [not verified] my-jetpack: tweak Icon in product detail

* [not verified] changelog

* my-jetpack: add pricing mock data for backup
* [not verified] my-jetpack: add data for search product

* changelog

* my-jetpack: add SearchInterstitial component

* my-jetpack: change status logic, checking plan at top

* mu-jetpack: register NEEDS_PURCHASE status

* my-jetpack: register /add-search route connected to SearchInterstitial component

* my-jetpack: lead to /add-search on search card Add

* changelog
…True (#22608)

* add deprecation for `useAverageColor` default change

* added changelog entry

* Update deprecated v4 to match blocks without useAverageColor property

Co-authored-by: thedebian <thedebian@users.noreply.github.com>
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
Co-authored-by: Siobhan <siobhan@automattic.com>
Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
…s instead of fixed components. We can now edit the presentation of the individual components of the donations block. Save is not working, some styles are missing, and other basic behaviours and checks are also missing.
… in the block inspector. Refactored directory structure. Added controls for the donations block. Merged all the views into a single view.
…tially rendered on the front end of the site.
…he actual donations block. The block is working asexxpected. The deprecation strategy is partially implemented, the previous version block will not break the editor but the data is not migrated yet.
… block. Text is not allowed to be saved now on the custom amount field. Custom Amount block controls are now working and style the custom amount block accordingly.
…isplayed properly and works as expected on the FE when it has not been updated to the new version. Fixed an issue that caused the Amount block to not show the decimal places correctly
…utomattic/jetpack into update/donations-block-to-inner-blocks
@rcrdortiz rcrdortiz requested a review from a team as a code owner February 7, 2022 17:07
@rcrdortiz rcrdortiz removed the request for review from a team February 7, 2022 17:15
@rcrdortiz rcrdortiz closed this Feb 7, 2022
@rcrdortiz rcrdortiz changed the title Donations block: Update donations block to use inner blocks WIP Donations block: Update donations block to use inner blocks Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Donations block: Feature parity for headings, paragraphs, and button