Business features uncheck creative mail by default (https://github.com/woocommerce/woocommerce-admin/pull/7139)

* Add default selected value for free extensions, uncheck creative mail by default

* Add test

* Add changelog and testing instructions
This commit is contained in:
Ilyas Foo 2021-06-09 11:29:45 +08:00 committed by GitHub
parent a942fa4f99
commit 4dfaf44539
4 changed files with 57 additions and 3 deletions

View File

@ -44,6 +44,13 @@
7. Click Continue, before the page redirects click Continue again
8. Confirm no error has been recorded in your browser console.
### Business features uncheck creative mail by default #7139
2. Complete the OBW until you get to the business details step.
2. Continue setup until the Business Detail step.
3. Open `Free Features` tab and toggle dropdown for `Add recommended business features to my site`.
4. Observe that the list have `Creative Mail` unchecked by default.
### Fix an issue with OBW when wc-pay and Jetpack are both being installed. #6957
- Complete the OBW until you get to the business details step.

View File

@ -194,6 +194,7 @@ const installableExtensionsData = [
),
'creative-mail-for-woocommerce'
),
selected: false,
},
],
},
@ -311,6 +312,8 @@ const BundleExtensionCheckbox = ( { onChange, description, isChecked } ) => {
* @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 plugins
*/
const getVisiblePlugins = ( plugins, country, industry, productTypes ) => {
const countryCode = getCountryCode( country );
@ -342,15 +345,20 @@ const transformRemoteExtensions = ( extensionData ) => {
};
const baseValues = { install_extensions: true };
const createInitialValues = ( extensions, country, industry, productTypes ) => {
export const createInitialValues = (
extensions,
country,
industry,
productTypes
) => {
return extensions.reduce( ( acc, curr ) => {
const plugins = getVisiblePlugins(
curr.plugins,
country,
industry,
productTypes
).reduce( ( pluginAcc, { key } ) => {
return { ...pluginAcc, [ key ]: true };
).reduce( ( pluginAcc, { key, selected } ) => {
return { ...pluginAcc, [ key ]: selected ?? true };
}, {} );
return {

View File

@ -2,6 +2,7 @@
* Internal dependencies
*/
import { filterBusinessExtensions } from '../flows/selective-bundle';
import { createInitialValues } from '../flows/selective-bundle/selective-extensions-bundle';
describe( 'BusinessDetails', () => {
test( 'filtering extensions', () => {
@ -31,4 +32,41 @@ describe( 'BusinessDetails', () => {
expect( filteredExtensions ).toEqual( expectedExtensions );
} );
describe( 'createInitialValues', () => {
test( 'selected by default', () => {
const extensions = [
{
plugins: [
{
key: 'visible-and-not-selected',
selected: false,
isVisible: () => true,
},
{
key: 'visible-and-selected',
selected: true,
isVisible: () => true,
},
{
key: 'this-should-not-show-at-all',
selected: true,
isVisible: () => false,
},
],
},
];
const values = createInitialValues( extensions, 'US', '', [] );
expect( values ).toEqual(
expect.objectContaining( {
'visible-and-not-selected': false,
'visible-and-selected': true,
} )
);
expect( values ).not.toContain( 'this-should-not-show-at-all' );
} );
} );
} );

View File

@ -121,6 +121,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Dev: Add source param support for notes query. #6979
- Dev: Remove the use of Dashicons and replace with @wordpress/icons or gridicons. #7020
- Dev: Refactor inbox panel components and moved to experimental package. #7006
- Dev: Business features uncheck creative mail by default #7139
- Enhancement: Add expand/collapse to extendable task list. #6910
- Enhancement: Add task hierarchy support to extended task list. #6916
- Enhancement: Add remind me later option to task list. #6923