Remove not used feature flags (#47150)

* Remove product-virtual-downloadable

* Remove product-variation-management

* Remove product-external-affiliate

* Remove product-grouped

* Remove product-linked

* Remove customer-effort-score-tracks

* Add beta tester changelog

* Add changelogs
This commit is contained in:
Fernando Marichal 2024-05-13 15:05:47 -03:00 committed by GitHub
parent 7c1da8129d
commit fdb4069566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 316 additions and 390 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Remove not used feature flags #47150

View File

@ -63,9 +63,6 @@ export function ShippingMenuItem( {
renderContent={ () => (
<div className="components-dropdown-menu__menu">
<MenuGroup>
{ window.wcAdminFeatures[
'product-virtual-downloadable'
] && (
<MenuItem
onClick={ () => {
recordEvent(
@ -77,12 +74,10 @@ export function ShippingMenuItem( {
}
);
onChange(
selection.map(
( { id, virtual } ) => ( {
selection.map( ( { id, virtual } ) => ( {
id,
virtual: ! virtual,
} )
)
} ) )
);
recordEvent(
'product_variations_menu_shipping_update',
@ -97,7 +92,6 @@ export function ShippingMenuItem( {
>
{ __( 'Toggle shipping', 'woocommerce' ) }
</MenuItem>
) }
<MenuItem
onClick={ () => {
recordEvent(

View File

@ -120,14 +120,12 @@ export function VariationActions( {
onClose={ onClose }
supportsMultipleSelection={ supportsMultipleSelection }
/>
{ window.wcAdminFeatures[ 'product-virtual-downloadable' ] && (
<DownloadsMenuItem
selection={ selection }
onChange={ onChange }
onClose={ onClose }
supportsMultipleSelection={ supportsMultipleSelection }
/>
) }
</MenuGroup>
<VariationQuickUpdateMenuItem.Slot
group={ 'secondary' }

View File

@ -4,10 +4,6 @@
import { Product } from '@woocommerce/data';
export const getDerivedProductType = ( product: Partial< Product > ) => {
if ( ! window.wcAdminFeatures[ 'product-variation-management' ] ) {
return 'simple';
}
const hasOptions = !! product.attributes?.find(
( attribute ) => attribute.options.length && attribute.variation
);

View File

@ -97,19 +97,11 @@ if ( appRoot ) {
}
}
// Render the CustomerEffortScoreTracksContainer only if
// the feature flag is enabled.
if (
window.wcAdminFeatures &&
window.wcAdminFeatures[ 'customer-effort-score-tracks' ] === true
) {
// Set up customer effort score survey.
( function () {
const root = appRoot || embeddedRoot;
render(
<CustomerEffortScoreTracksContainer />,
root.insertBefore( document.createElement( 'div' ), null )
);
} )();
}

View File

@ -273,7 +273,6 @@ export const getPages = () => {
} );
}
if ( window.wcAdminFeatures[ 'product-variation-management' ] ) {
pages.push( {
container: ProductVariationPage,
layout: {
@ -290,7 +289,6 @@ export const getPages = () => {
wpOpenMenu: 'menu-posts-product',
capability: 'edit_products',
} );
}
if ( window.wcAdminFeatures.onboarding ) {
if ( ! window.wcAdminFeatures[ 'core-profiler' ] ) {

View File

@ -134,9 +134,7 @@ const EditProductPage: React.FC = () => {
</div>
</ProductFormLayout>
) }
{ window.wcAdminFeatures[ 'product-variation-management' ] &&
productVariation &&
product && (
{ productVariation && product && (
<ProductVariationForm
product={ product }
productVariation={ productVariation }

View File

@ -104,7 +104,6 @@ const Tabs = () => {
fillProps={ { product } }
/>
</WooProductTabItem>
{ window.wcAdminFeatures[ 'product-variation-management' ] ? (
<WooProductTabItem
id={ TAB_OPTIONS_ID }
templates={ [ { name: TAB_GENERAL_ID, order: 9 } ] }
@ -115,7 +114,6 @@ const Tabs = () => {
<ProductVariationsSection />
</>
</WooProductTabItem>
) : null }
</>
);
};

View File

@ -29,7 +29,6 @@ declare global {
'activity-panels': boolean;
analytics: boolean;
coupons: boolean;
'customer-effort-score-tracks': boolean;
homescreen: boolean;
marketing: boolean;
'minified-js': boolean;
@ -39,11 +38,6 @@ declare global {
onboarding: boolean;
'onboarding-tasks': boolean;
'payment-gateway-suggestions': boolean;
'product-variation-management': boolean;
'product-virtual-downloadable': boolean;
'product-external-affiliate': boolean;
'product-grouped': boolean;
'product-linked': boolean;
'product-pre-publish-modal': boolean;
'product-custom-fields': boolean;
'remote-inbox-notifications': boolean;

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Remove not used feature flags #47150

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Remove not used feature flags #47150

View File

@ -6,7 +6,6 @@
"coupons": true,
"core-profiler": true,
"customize-store": true,
"customer-effort-score-tracks": true,
"import-products-task": true,
"experimental-fashion-sample-products": true,
"shipping-smart-defaults": true,
@ -20,11 +19,6 @@
"onboarding": true,
"onboarding-tasks": true,
"pattern-toolkit-full-composability": false,
"product-variation-management": true,
"product-virtual-downloadable": true,
"product-external-affiliate": true,
"product-grouped": true,
"product-linked": true,
"product-pre-publish-modal": true,
"product-custom-fields": true,
"remote-inbox-notifications": true,

View File

@ -6,7 +6,6 @@
"coupons": true,
"core-profiler": true,
"customize-store": true,
"customer-effort-score-tracks": true,
"import-products-task": true,
"experimental-fashion-sample-products": true,
"shipping-smart-defaults": true,
@ -21,11 +20,6 @@
"onboarding-tasks": true,
"pattern-toolkit-full-composability": false,
"payment-gateway-suggestions": true,
"product-variation-management": true,
"product-virtual-downloadable": true,
"product-external-affiliate": true,
"product-grouped": true,
"product-linked": true,
"product-pre-publish-modal": true,
"product-custom-fields": true,
"remote-inbox-notifications": true,

View File

@ -49,17 +49,9 @@ class Init {
* Constructor
*/
public function __construct() {
if ( Features::is_enabled( 'product-variation-management' ) ) {
array_push( $this->supported_product_types, 'variable' );
}
if ( Features::is_enabled( 'product-external-affiliate' ) ) {
array_push( $this->supported_product_types, 'external' );
}
if ( Features::is_enabled( 'product-grouped' ) ) {
array_push( $this->supported_product_types, 'grouped' );
}
$this->redirection_controller = new RedirectionController();

View File

@ -86,11 +86,8 @@ class RedirectionController {
}
if ( isset( $product_data_type ) ) {
if ( Features::is_enabled( 'product-virtual-downloadable' ) ) {
return true;
}
return ! $digital_product;
}
}
return false;
@ -176,5 +173,4 @@ class RedirectionController {
exit();
}
}
}

View File

@ -19,7 +19,6 @@ trait DownloadableProductTrait {
*/
private function add_downloadable_product_blocks( $parent_block ) {
// Downloads section.
if ( Features::is_enabled( 'product-virtual-downloadable' ) ) {
$product_downloads_section_group = $parent_block->add_section(
array(
'id' => 'product-downloads-section-group',
@ -45,7 +44,6 @@ trait DownloadableProductTrait {
'label' => __( 'Include downloads', 'woocommerce' ),
'checkedHelp' => __( 'Add any files you\'d like to make available for the customer to download after purchasing, such as instructions or warranty info.', 'woocommerce' ),
'uncheckedHelp' => __( 'Add any files you\'d like to make available for the customer to download after purchasing, such as instructions or warranty info.', 'woocommerce' ),
),
)
);
@ -78,4 +76,3 @@ trait DownloadableProductTrait {
);
}
}
}

View File

@ -441,7 +441,6 @@ class ProductVariationTemplate extends AbstractProductFormTemplate implements Pr
)
);
// Virtual section.
if ( Features::is_enabled( 'product-virtual-downloadable' ) ) {
$shipping_group->add_section(
array(
'id' => 'product-variation-virtual-section',
@ -461,7 +460,6 @@ class ProductVariationTemplate extends AbstractProductFormTemplate implements Pr
),
)
);
}
// Product Shipping Section.
$product_fee_and_dimensions_section = $shipping_group->add_section(
array(

View File

@ -78,18 +78,13 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
);
// Variations tab.
if ( Features::is_enabled( 'product-variation-management' ) ) {
$variations_hide_conditions = array();
if ( Features::is_enabled( 'product-grouped' ) ) {
$variations_hide_conditions[] = array(
'expression' => 'editedProduct.type === "grouped"',
);
}
if ( Features::is_enabled( 'product-external-affiliate' ) ) {
$variations_hide_conditions[] = array(
'expression' => 'editedProduct.type === "external"',
);
}
$this->add_group(
array(
@ -101,7 +96,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'hideConditions' => $variations_hide_conditions,
)
);
}
$this->add_group(
array(
@ -119,11 +113,11 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'attributes' => array(
'title' => __( 'Pricing', 'woocommerce' ),
),
'hideConditions' => Features::is_enabled( 'product-grouped' ) ? array(
'hideConditions' => array(
array(
'expression' => 'editedProduct.type === "grouped"',
),
) : null,
),
)
);
$this->add_group(
@ -136,16 +130,12 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
)
);
$shipping_hide_conditions = array();
if ( Features::is_enabled( 'product-grouped' ) ) {
$shipping_hide_conditions[] = array(
'expression' => 'editedProduct.type === "grouped"',
);
}
if ( Features::is_enabled( 'product-external-affiliate' ) ) {
$shipping_hide_conditions[] = array(
'expression' => 'editedProduct.type === "external"',
);
}
$this->add_group(
array(
@ -159,7 +149,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
);
// Linked Products tab.
if ( Features::is_enabled( 'product-linked' ) ) {
$this->add_group(
array(
'id' => $this::GROUP_IDS['LINKED_PRODUCTS'],
@ -170,7 +159,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
)
);
}
}
/**
* Adds the general group blocks to the template.
@ -279,7 +267,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
);
// External/Affiliate section.
if ( Features::is_enabled( 'product-external-affiliate' ) ) {
$buy_button_section = $general_group->add_section(
array(
'id' => 'product-buy-button-section',
@ -347,10 +334,8 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'order' => 20,
)
);
}
// Product list section.
if ( Features::is_enabled( 'product-grouped' ) ) {
$product_list_section = $general_group->add_section(
array(
'id' => 'product-list-section',
@ -377,7 +362,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
),
)
);
}
// Images section.
$images_section = $general_group->add_section(
@ -827,11 +811,11 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'</a>'
) : null,
),
'hideConditions' => Features::is_enabled( 'product-external-affiliate' ) || Features::is_enabled( 'product-grouped' ) ? array(
'hideConditions' => array(
array(
'expression' => 'editedProduct.type === "external" || editedProduct.type === "grouped"',
),
) : null,
),
'disableConditions' => array(
array(
'expression' => 'editedProduct.type === "variable"',
@ -844,11 +828,9 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'expression' => 'editedProduct.manage_stock === false',
),
);
if ( Features::is_enabled( 'product-grouped' ) ) {
$product_inventory_quantity_hide_conditions[] = array(
'expression' => 'editedProduct.type === "grouped"',
);
}
$product_inventory_inner_section->add_block(
array(
'id' => 'product-inventory-quantity',
@ -862,11 +844,9 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'expression' => 'editedProduct.manage_stock === true',
),
);
if ( Features::is_enabled( 'product-grouped' ) ) {
$product_stock_status_hide_conditions[] = array(
'expression' => 'editedProduct.type === "grouped"',
);
}
$product_inventory_section->add_block(
array(
'id' => 'product-stock-status',
@ -922,11 +902,11 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'initialCollapsed' => true,
'persistRender' => true,
),
'hideConditions' => Features::is_enabled( 'product-grouped' ) ? array(
'hideConditions' => array(
array(
'expression' => 'editedProduct.type === "grouped"',
),
) : null,
),
)
);
$product_inventory_advanced_wrapper = $product_inventory_advanced->add_block(
@ -1026,7 +1006,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
)
);
// Virtual section.
if ( Features::is_enabled( 'product-virtual-downloadable' ) ) {
$shipping_group->add_section(
array(
'id' => 'product-virtual-section',
@ -1051,7 +1030,6 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
),
)
);
}
// Product Shipping Section.
$product_fee_and_dimensions_section = $shipping_group->add_section(
array(

View File

@ -73,9 +73,6 @@ function reset_feature_flags() {
function enable_experimental_features( $features ) {
$stored_features = get_option( 'e2e_feature_flags', array() );
// We always enable this for tests at the moment.
$features['product-variation-management'] = true;
return array_merge( $features, $stored_features );
}