Products by Rating: Add Filter by Rating to the Feature Plugin (https://github.com/woocommerce/woocommerce-blocks/pull/7384)
* Products by Rating: Move the Filter by Ratings block to the feature plugin build * Products by Rating: Update the internal doc * Products by Rating: Include a Feature Plugin check before loading the Rating filter variation
This commit is contained in:
parent
e24e70adc6
commit
d6fecf28a3
|
@ -12,6 +12,7 @@ import {
|
||||||
box,
|
box,
|
||||||
starEmpty,
|
starEmpty,
|
||||||
} from '@wordpress/icons';
|
} from '@wordpress/icons';
|
||||||
|
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
@ -136,29 +137,31 @@ registerBlockType( metadata, {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rating-filter',
|
...( isFeaturePluginBuild() && {
|
||||||
title: __( 'Filter by Rating', 'woo-gutenberg-products-block' ),
|
name: 'rating-filter',
|
||||||
description: __(
|
title: __( 'Filter by Rating', 'woo-gutenberg-products-block' ),
|
||||||
'Enable customers to filter the product grid by rating.',
|
description: __(
|
||||||
'woo-gutenberg-products-block'
|
'Enable customers to filter the product grid by rating.',
|
||||||
),
|
|
||||||
isActive: ( attributes ) =>
|
|
||||||
attributes.filterType === 'rating-filter',
|
|
||||||
attributes: {
|
|
||||||
filterType: 'rating-filter',
|
|
||||||
heading: __(
|
|
||||||
'Filter by rating',
|
|
||||||
'woo-gutenberg-products-block'
|
'woo-gutenberg-products-block'
|
||||||
),
|
),
|
||||||
},
|
isActive: ( attributes ) =>
|
||||||
icon: {
|
attributes.filterType === 'rating-filter',
|
||||||
src: (
|
attributes: {
|
||||||
<Icon
|
filterType: 'rating-filter',
|
||||||
icon={ starEmpty }
|
heading: __(
|
||||||
className="wc-block-editor-components-block-icon"
|
'Filter by rating',
|
||||||
/>
|
'woo-gutenberg-products-block'
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
icon: {
|
||||||
|
src: (
|
||||||
|
<Icon
|
||||||
|
icon={ starEmpty }
|
||||||
|
className="wc-block-editor-components-block-icon"
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
} ),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { isExperimentalBuild } from '@woocommerce/block-settings';
|
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
||||||
import { createBlock, registerBlockType } from '@wordpress/blocks';
|
import { createBlock, registerBlockType } from '@wordpress/blocks';
|
||||||
import { Icon, starEmpty } from '@wordpress/icons';
|
import { Icon, starEmpty } from '@wordpress/icons';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
@ -14,7 +14,7 @@ import edit from './edit';
|
||||||
import metadata from './block.json';
|
import metadata from './block.json';
|
||||||
import type { Attributes } from './types';
|
import type { Attributes } from './types';
|
||||||
|
|
||||||
if ( isExperimentalBuild() ) {
|
if ( isFeaturePluginBuild() ) {
|
||||||
registerBlockType( metadata, {
|
registerBlockType( metadata, {
|
||||||
icon: {
|
icon: {
|
||||||
src: (
|
src: (
|
||||||
|
|
|
@ -47,7 +47,6 @@ The majority of our feature flagging is blocks, this is a list of them:
|
||||||
- Single Product block ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/9b76ea7a1680e68cc20bfee01078e43ccfc996bd/assets/js/blocks/single-product/index.js#L43) | [PHP flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/4a1ee97eb97011458174e93e44a9b7ad2f10ca36/src/BlockTypesController.php#L181) | [webpack flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/341be1f56071fbd4b5ff975e8788d65a09512df2/bin/webpack-entries.js#L57-L59)).
|
- Single Product block ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/9b76ea7a1680e68cc20bfee01078e43ccfc996bd/assets/js/blocks/single-product/index.js#L43) | [PHP flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/4a1ee97eb97011458174e93e44a9b7ad2f10ca36/src/BlockTypesController.php#L181) | [webpack flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/341be1f56071fbd4b5ff975e8788d65a09512df2/bin/webpack-entries.js#L57-L59)).
|
||||||
- Product Query ([JS flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/assets/js/blocks/product-query/variations/product-query.tsx/#L21-L22) | [webpack flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/bin/webpack-entries.js/#L62-L63)).
|
- Product Query ([JS flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/assets/js/blocks/product-query/variations/product-query.tsx/#L21-L22) | [webpack flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/bin/webpack-entries.js/#L62-L63)).
|
||||||
- Products on Sale ([JS flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/assets/js/blocks/product-query/variations/products-on-sale.tsx/#L22-L23)).
|
- Products on Sale ([JS flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/assets/js/blocks/product-query/variations/products-on-sale.tsx/#L22-L23)).
|
||||||
- Filter by Rating ([JS flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/assets/js/blocks/rating-filter/index.tsx/#L19-L20)).
|
|
||||||
- ⚛️ Add to cart ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/add-to-cart/index.js#L29-L32)).
|
- ⚛️ Add to cart ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/add-to-cart/index.js#L29-L32)).
|
||||||
- ⚛️ Product category list ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/category-list/index.js#L29-L32)).
|
- ⚛️ Product category list ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/category-list/index.js#L29-L32)).
|
||||||
- ⚛️ Product SKU ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/sku/index.js#L29-L33)).
|
- ⚛️ Product SKU ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/sku/index.js#L29-L33)).
|
||||||
|
@ -63,6 +62,7 @@ We also have individual features or code blocks behind a feature flag, this is a
|
||||||
- ⚛️ Product Price new controls ([JS flag 1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/price/attributes.js#L13-L44) | [JS flag 2-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L116) | [JS flag 2-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L114) | [JS flag 2-3](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L91) | [JS flag 2-4](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L95) | [JS flag 2-5](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L106) | [JS flag 3-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/price/edit.js#L59-L108) | [JS flag 3-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/price/edit.js#L114-L131)).
|
- ⚛️ Product Price new controls ([JS flag 1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/price/attributes.js#L13-L44) | [JS flag 2-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L116) | [JS flag 2-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L114) | [JS flag 2-3](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L91) | [JS flag 2-4](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L95) | [JS flag 2-5](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/8d2f0ad8ade2c7217769b431f93de76d6cfacf6e/assets/js/atomic/blocks/product-elements/price/block.js#L106) | [JS flag 3-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/price/edit.js#L59-L108) | [JS flag 3-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/price/edit.js#L114-L131)).
|
||||||
- ⚛️ Product Title new controls ([JS flag 1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/attributes.js#L21-L40) | [JS flag 2-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/block.js#L70-L72) | [JS flag 2-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/block.js#L94-L95) | [JS flag 2-3](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/block.js#L104) | [JS flag 3-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/edit.js#L47-L54) | [JS flag 3-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/edit.js#L77-L107) | [JS flag 3-3](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/edit.js#L116-L129)).
|
- ⚛️ Product Title new controls ([JS flag 1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/attributes.js#L21-L40) | [JS flag 2-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/block.js#L70-L72) | [JS flag 2-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/block.js#L94-L95) | [JS flag 2-3](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/block.js#L104) | [JS flag 3-1](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/edit.js#L47-L54) | [JS flag 3-2](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/edit.js#L77-L107) | [JS flag 3-3](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b3a9753d8b7dae18b36025d09fbff835b8365de0/assets/js/atomic/blocks/product-elements/title/edit.js#L116-L129)).
|
||||||
- Utility function to pass styles to a block ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/9ebddbc5d21eb3cc67fedddbccbd86453313eb64/assets/js/atomic/utils/block-styling.js#L6-L12)).
|
- Utility function to pass styles to a block ([JS flag](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/9ebddbc5d21eb3cc67fedddbccbd86453313eb64/assets/js/atomic/utils/block-styling.js#L6-L12)).
|
||||||
|
- Filter by Rating ([JS flag](https://github.com/woocommerce/woocommerce-blocks/blob/6547881939b1aa4825562d05fb06808515bf33c2/assets/js/blocks/rating-filter/index.tsx/#L19-L20)).
|
||||||
|
|
||||||
### Experimental plugin flag
|
### Experimental plugin flag
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue