RemoteFreeExtension hide bundle when all of its plugins are not visible (https://github.com/woocommerce/woocommerce-admin/pull/7182)
* Filter bundle for cases when all of its plugins are not visible * Update changelog
This commit is contained in:
parent
dae2abad2d
commit
8fbda8f572
|
@ -328,6 +328,34 @@ const getVisiblePlugins = ( plugins, country, industry, productTypes ) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns bundles that have at least 1 visible plugin.
|
||||||
|
*
|
||||||
|
* @param {Array} bundles list of bundles
|
||||||
|
* @param {string} country Woo store country
|
||||||
|
* @param {Array} industry List of selected industries
|
||||||
|
* @param {Array} productTypes List of selected product types
|
||||||
|
*
|
||||||
|
* @return {Array} Array of visible bundles
|
||||||
|
*/
|
||||||
|
const getVisibleBundles = ( bundles, country, industry, productTypes ) => {
|
||||||
|
return bundles
|
||||||
|
.map( ( bundle ) => {
|
||||||
|
return {
|
||||||
|
...bundle,
|
||||||
|
plugins: getVisiblePlugins(
|
||||||
|
bundle.plugins,
|
||||||
|
country,
|
||||||
|
industry,
|
||||||
|
productTypes
|
||||||
|
),
|
||||||
|
};
|
||||||
|
} )
|
||||||
|
.filter( ( bundle ) => {
|
||||||
|
return bundle.plugins.length;
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
const transformRemoteExtensions = ( extensionData ) => {
|
const transformRemoteExtensions = ( extensionData ) => {
|
||||||
return extensionData.map( ( section ) => {
|
return extensionData.map( ( section ) => {
|
||||||
const plugins = section.plugins.map( ( plugin ) => {
|
const plugins = section.plugins.map( ( plugin ) => {
|
||||||
|
@ -400,7 +428,14 @@ export const SelectiveExtensionsBundle = ( {
|
||||||
industry,
|
industry,
|
||||||
productTypes
|
productTypes
|
||||||
);
|
);
|
||||||
setInstallableExtensions( installableExtensionsData );
|
setInstallableExtensions(
|
||||||
|
getVisibleBundles(
|
||||||
|
installableExtensionsData,
|
||||||
|
country,
|
||||||
|
industry,
|
||||||
|
productTypes
|
||||||
|
)
|
||||||
|
);
|
||||||
setValues( initialValues );
|
setValues( initialValues );
|
||||||
setIsFetching( false );
|
setIsFetching( false );
|
||||||
};
|
};
|
||||||
|
@ -428,7 +463,14 @@ export const SelectiveExtensionsBundle = ( {
|
||||||
industry,
|
industry,
|
||||||
productTypes
|
productTypes
|
||||||
);
|
);
|
||||||
setInstallableExtensions( transformedExtensions );
|
setInstallableExtensions(
|
||||||
|
getVisibleBundles(
|
||||||
|
transformedExtensions,
|
||||||
|
country,
|
||||||
|
industry,
|
||||||
|
productTypes
|
||||||
|
)
|
||||||
|
);
|
||||||
setValues( initialValues );
|
setValues( initialValues );
|
||||||
setIsFetching( false );
|
setIsFetching( false );
|
||||||
} )
|
} )
|
||||||
|
@ -520,12 +562,8 @@ export const SelectiveExtensionsBundle = ( {
|
||||||
{ isFetching ? (
|
{ isFetching ? (
|
||||||
<Spinner />
|
<Spinner />
|
||||||
) : (
|
) : (
|
||||||
getVisiblePlugins(
|
plugins.map(
|
||||||
plugins,
|
( { description, key } ) => (
|
||||||
country,
|
|
||||||
industry,
|
|
||||||
productTypes
|
|
||||||
).map( ( { description, key } ) => (
|
|
||||||
<BundleExtensionCheckbox
|
<BundleExtensionCheckbox
|
||||||
key={ key }
|
key={ key }
|
||||||
description={ description }
|
description={ description }
|
||||||
|
@ -534,7 +572,8 @@ export const SelectiveExtensionsBundle = ( {
|
||||||
key
|
key
|
||||||
) }
|
) }
|
||||||
/>
|
/>
|
||||||
) )
|
)
|
||||||
|
)
|
||||||
) }
|
) }
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -79,6 +79,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
|
||||||
- Add: Add unit tests around extended payment gateway controller #7133
|
- Add: Add unit tests around extended payment gateway controller #7133
|
||||||
- Fix: WCPay not working in local payments task #7151
|
- Fix: WCPay not working in local payments task #7151
|
||||||
- Fix: Include onboarding settings on the analytic pages #7109
|
- Fix: Include onboarding settings on the analytic pages #7109
|
||||||
|
- Fix: RemoteFreeExtension hide bundle when all of its plugins are not visible #7182
|
||||||
- Tweak: Revert Card component removal #7167
|
- Tweak: Revert Card component removal #7167
|
||||||
|
|
||||||
== 2.4.0 6/10/2021 ==
|
== 2.4.0 6/10/2021 ==
|
||||||
|
|
Loading…
Reference in New Issue