-
Notifications
You must be signed in to change notification settings - Fork 799
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
Add production blocks metadata #32497
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c5dcb98
add part of blocks metadata
andrii-lysenko 74cbc87
add: changelog
andrii-lysenko a5d5e2d
add additional blocks
andrii-lysenko 3de4e0e
Merge branch 'trunk' into add/prod-blocks-metadata
andrii-lysenko cf4a81b
add suggested changes
andrii-lysenko 6a0d00e
update: fix tabulation
andrii-lysenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: enhancement | ||
|
||
Add block.json metadata file to part of production blocks |
45 changes: 45 additions & 0 deletions
45
projects/plugins/jetpack/extensions/blocks/payment-buttons/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/payment-buttons", | ||
"title": "Payment Buttons", | ||
"description": "Prompt visitors to purchase your products and subscriptions with a group of buttons.", | ||
"keywords": [ | ||
"buy", "contribution", "commerce", "credit card", "debit card", "donate", "Donations", | ||
"earn", "ecommerce", "gofundme", "memberships", "money", "paid", "patreon", "pay", | ||
"payments", "products", "purchase", "recurring", "sell", "shop", "stripe", "subscribe", | ||
"subscriptions", "sponsor", "square", "toast", "venmo" | ||
], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "earn", | ||
"icon": "block-default", | ||
"supports": { | ||
"__experimentalExposeControlsToChildren": true, | ||
"align": [ "wide", "full" ], | ||
"spacing": { | ||
"blockGap": true, | ||
"margin": [ "vertical" ], | ||
"__experimentalDefaultControls": { | ||
"blockGap": true | ||
} | ||
}, | ||
"__experimentalLayout": { | ||
"allowSwitching": false, | ||
"allowInheriting": false, | ||
"default": { | ||
"type": "flex" | ||
} | ||
}, | ||
"typography": { | ||
"fontSize": true, | ||
"__experimentalFontFamily": true, | ||
"__experimentalTextTransform": true, | ||
"__experimentalDefaultControls": { | ||
"fontSize": true | ||
} | ||
} | ||
}, | ||
"attributes":{ }, | ||
"editorScript": "file:../editor.js" | ||
} |
21 changes: 21 additions & 0 deletions
21
projects/plugins/jetpack/extensions/blocks/payments-intro/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/payments-intro", | ||
"title": "Payments", | ||
"description": "Sell products and services or receive donations on your website.", | ||
"keywords": [ "donations", "paid", "pay", "money", "checkout", "pay", "checkout" ], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "earn", | ||
"icon": "money-alt", | ||
"supports": { | ||
"alignWide": false, | ||
"className": true, | ||
"customClassName": false, | ||
"html": false, | ||
"reusable": false | ||
}, | ||
"attributes":{}, | ||
"editorScript": "file:../editor.js" | ||
} |
27 changes: 27 additions & 0 deletions
27
projects/plugins/jetpack/extensions/blocks/pinterest/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/pinterest", | ||
"title": "Pinterest", | ||
"description": "Embed a Pinterest pin, board, or user.", | ||
"keywords": [ "social", "pinboard", "pins" ], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "embed", | ||
"icon": "pinterest", | ||
"supports": { | ||
"html": false, | ||
"align": false | ||
}, | ||
"attributes":{ | ||
"url": { | ||
"type": "string" | ||
} | ||
}, | ||
"example": { | ||
"attributes": { | ||
"url": "https://pinterest.com/anapinskywalker/" | ||
} | ||
}, | ||
"editorScript": "file:../editor.js" | ||
} |
110 changes: 110 additions & 0 deletions
110
projects/plugins/jetpack/extensions/blocks/podcast-player/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/podcast-player", | ||
"title": "Podcast Player", | ||
"description": "Select and play episodes from a single podcast.", | ||
"keywords": [ "audio", "embed"], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "embed", | ||
"icon": "playlist-audio", | ||
"supports": { | ||
"align": [ "wide", "full" ], | ||
"spacing": { | ||
"padding": true, | ||
"margin": true | ||
}, | ||
"anchor": false, | ||
"customClassName": true, | ||
"className": true, | ||
"html": false, | ||
"multiple": true, | ||
"reusable": true | ||
}, | ||
"attributes": { | ||
"url": { | ||
"type": "string", | ||
"validator": "isUrl" | ||
}, | ||
"selectedEpisodes": { | ||
"type": "array", | ||
"default": [] | ||
}, | ||
"itemsToShow": { | ||
"type": "integer", | ||
"default": 5 | ||
}, | ||
"showCoverArt": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"showEpisodeTitle": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"showEpisodeDescription": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"primaryColor": { | ||
"type": "string" | ||
}, | ||
"customPrimaryColor": { | ||
"type": "string" | ||
}, | ||
"hexPrimaryColor": { | ||
"type": "string" | ||
}, | ||
"secondaryColor": { | ||
"type": "string" | ||
}, | ||
"customSecondaryColor": { | ||
"type": "string" | ||
}, | ||
"hexSecondaryColor": { | ||
"type": "string" | ||
}, | ||
"backgroundColor": { | ||
"type": "string" | ||
}, | ||
"customBackgroundColor": { | ||
"type": "string" | ||
}, | ||
"hexBackgroundColor": { | ||
"type": "string" | ||
}, | ||
"exampleFeedData": { | ||
"type": "object" | ||
} | ||
}, | ||
"example": { | ||
"attributes": { | ||
"customPrimaryColor": "GREEN", | ||
"hexPrimaryColor": "GREEN", | ||
"exampleFeedData": { | ||
"title": "Jetpack Example Podcast", | ||
"link": "https://jetpack.com", | ||
"cover": "https://jetpackme.files.wordpress.com/2020/05/jetpack-example-podcast-cover.png?w=160", | ||
"tracks": [ | ||
{ | ||
"id": "3", | ||
"title": "3. Our third episode", | ||
"duration": "14:58" | ||
}, | ||
{ | ||
"id": "2", | ||
"title": "2. Interview with a special guest", | ||
"duration": "19:17" | ||
}, | ||
{ | ||
"id": "1", | ||
"title": "1. Welcome to Example Podcast", | ||
"duration": "11:25" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"editorScript": "file:../editor.js" | ||
} |
56 changes: 56 additions & 0 deletions
56
projects/plugins/jetpack/extensions/blocks/premium-content/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/premium-content", | ||
"title": "Paid Content", | ||
"description": "Restrict access to your content for paying subscribers.", | ||
"keywords": [ "buy", "credit card", "debit card", "earn", "exclusive", "gated", "gofundme", "memberships", "money", "newsletter", "paid", "patreon", "pay", "payments", "paywall", "premium content", "purchase", "recurring", "repeat", "signin", "stripe", "subscribe", "subscriptions", "support", "sponsor", "square", "toast", "venmo", "stripe", "substack"], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "grow", | ||
"icon": "yes-alt", | ||
"supports": { | ||
"html": false | ||
}, | ||
"providesContext": { | ||
"premium-content/planId": "selectedPlanId", | ||
"premium-content/isPreview": "isPreview", | ||
"isPremiumContentChild": "isPremiumContentChild" | ||
}, | ||
"attributes": { | ||
"newPlanName": { | ||
"type": "string", | ||
"default": "Monthly Subscription" | ||
}, | ||
"newPlanCurrency": { | ||
"type": "string", | ||
"default": "USD" | ||
}, | ||
"newPlanPrice": { | ||
"type": "number", | ||
"default": 5 | ||
}, | ||
"newPlanInterval": { | ||
"type": "string", | ||
"default": "1 month" | ||
}, | ||
"selectedPlanId": { | ||
"type": "number", | ||
"default": 0 | ||
}, | ||
"isPreview": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"isPremiumContentChild": { | ||
"type": "boolean", | ||
"default": true | ||
} | ||
}, | ||
"example": { | ||
"attributes": { | ||
"isPreview": true | ||
} | ||
}, | ||
"editorScript": "file:../editor.js" | ||
} |
44 changes: 44 additions & 0 deletions
44
projects/plugins/jetpack/extensions/blocks/rating-star/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/rating-star", | ||
"title": "Star Rating", | ||
"description": "Rate movies, books, songs, recipes — anything you can put a number on.", | ||
"keywords": ["star", "rating", "review"], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "widgets", | ||
"icon": "star-half", | ||
"supports": { | ||
"html": false | ||
}, | ||
"styles": [ | ||
{ | ||
"name": "filled", | ||
"label": "Filled", | ||
"isDefault": true | ||
}, | ||
{ | ||
"name": "outlined", | ||
"label": "Outlined" | ||
} | ||
], | ||
"attributes": { | ||
"rating": { | ||
"type": "number", | ||
"default": 1 | ||
}, | ||
"maxRating": { | ||
"type": "number", | ||
"default": 5 | ||
}, | ||
"color": { | ||
"type": "string" | ||
}, | ||
"align": { | ||
"type": "string", | ||
"default": "left" | ||
} | ||
}, | ||
"editorScript": "file:../editor.js" | ||
} |
45 changes: 45 additions & 0 deletions
45
projects/plugins/jetpack/extensions/blocks/recurring-payments/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "jetpack/recurring-payments", | ||
"title": "Payment Button", | ||
"description": "Button allowing you to sell products and subscriptions.", | ||
"keywords": [ | ||
"buy", "contribution", "commerce", "credit card", "debit card", "donate", "Donations", | ||
"earn", "ecommerce", "gofundme", "memberships", "money", "paid", "patreon", "pay", | ||
"payments", "products", "purchase", "recurring", "sell", "shop", "stripe", "subscribe", | ||
"subscriptions", "sponsor", "square", "toast", "venmo" | ||
], | ||
"version": "12.5.0", | ||
"textdomain": "jetpack", | ||
"category": "earn", | ||
"icon": "cart", | ||
"supports": { | ||
"html": false, | ||
"__experimentalExposeControlsToChildren": true, | ||
}, | ||
"usesContext": [ "isPremiumContentChild" ], | ||
"providesContext": { | ||
"jetpack/parentBlockWidth": "width", | ||
}, | ||
"attributes": { | ||
"planId": { | ||
"type": "integer" | ||
}, | ||
"align": { | ||
"type": "string" | ||
}, | ||
"url": { | ||
"type": "string", | ||
"default": "#" | ||
}, | ||
"uniqueId": { | ||
"type": "string", | ||
"default": "id" | ||
}, | ||
"width": { | ||
"type": "string" | ||
} | ||
}, | ||
"editorScript": "file:../editor.js" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't know if we need this one, since that's just a parent block for the Payments button, Donations, and Paid content blocks?
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.
jetpack/payments-intro
is a block like any other: it's registered withregister_block_type
, can be inserted from the inserter, and is serialized as<!-- wp:jetpack/payments-intro /-->
. What is special about is that it's meant to be a temporary placeholder, to be quickly replaced by one of the "real" payment blocks. But that's just semantics, formally it's a block.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.
Right, but I'm not sure it's one that we must publicize on W.org, given that we already publicize the "real" payment blocks. It may create more confusion than anything else.
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.
Having a
block.json
file should be useful and preferred for all blocks. For example, they are then properly visible in the/block-types
REST endpoint. If we don't want to publicize them on W.org, maybe there is ablock.json
flag for that? @gziolo will know.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.
You don't need
block.json
to expose the block in the REST endpoint. All you need is to register it withregister_block_type
so it's available in the block type registry.I don't know precisely how W.org scans the code of the plugin when looking for block types. I bet though, that when you alias the function with something else, it won't list it.
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.
Jetpack currently doesn't do server-side block registration with the
block.json
. The subset of fields that it passes toregister_block_type
is a very small subset, and it's duplicated. So, the info available in the REST endpoint will be very limited. It would be a nice follow-up to improve this.That would be nice to know, especially if there is any "opt-out from public registry listing" flag. It would be very useful for cases like this one.