Remove cart2cart option from product task (#37285)
* Remove cart2cart option from add product task * Remove cart2cart link test * Add changelog * Fix unit test * Fix lint
This commit is contained in:
parent
a45b67d390
commit
9ea8b630ee
|
@ -8,7 +8,9 @@
|
||||||
grid-template-columns: auto auto;
|
grid-template-columns: auto auto;
|
||||||
grid-column-gap: 16px;
|
grid-column-gap: 16px;
|
||||||
grid-row-gap: 24px;
|
grid-row-gap: 24px;
|
||||||
justify-content: start;
|
// Set it to center here since we only have one import option.
|
||||||
|
// We can change it to start when we have more import options.
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.woocommerce-list__item {
|
.woocommerce-list__item {
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import PageIcon from 'gridicons/dist/pages';
|
import PageIcon from 'gridicons/dist/pages';
|
||||||
import ReblogIcon from 'gridicons/dist/reblog';
|
|
||||||
import { getAdminLink } from '@woocommerce/settings';
|
import { getAdminLink } from '@woocommerce/settings';
|
||||||
import interpolateComponents from '@automattic/interpolate-components';
|
|
||||||
import { ExternalLink } from '@wordpress/components';
|
|
||||||
import { recordEvent } from '@woocommerce/tracks';
|
import { recordEvent } from '@woocommerce/tracks';
|
||||||
|
|
||||||
export const importTypes = [
|
export const importTypes = [
|
||||||
|
@ -25,32 +22,4 @@ export const importTypes = [
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'from-cart2cart' as const,
|
|
||||||
title: __( 'FROM CART2CART', 'woocommerce' ),
|
|
||||||
content: interpolateComponents( {
|
|
||||||
mixedString: __(
|
|
||||||
'Migrate all store data like products, customers, and orders in no time with this 3rd party plugin. {{link}}Learn more{{/link}}',
|
|
||||||
'woocommerce'
|
|
||||||
),
|
|
||||||
components: {
|
|
||||||
link: (
|
|
||||||
<ExternalLink
|
|
||||||
href="https://woocommerce.com/products/cart2cart/?utm_medium=product"
|
|
||||||
onClickCapture={ ( e ) => e.preventDefault() }
|
|
||||||
></ExternalLink>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
} ),
|
|
||||||
before: <ReblogIcon />,
|
|
||||||
onClick: () => {
|
|
||||||
recordEvent( 'tasklist_add_product', { method: 'migrate' } );
|
|
||||||
window
|
|
||||||
.open(
|
|
||||||
'https://woocommerce.com/products/cart2cart/?utm_medium=product',
|
|
||||||
'_blank'
|
|
||||||
)
|
|
||||||
?.focus();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -57,24 +57,6 @@ describe( 'Products', () => {
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'should fire "tasklist_add_product" event when the cart2cart option clicked', async () => {
|
|
||||||
const { getByRole } = render( <Products /> );
|
|
||||||
|
|
||||||
userEvent.click(
|
|
||||||
getByRole( 'menuitem', {
|
|
||||||
name: 'FROM CART2CART Migrate all store data like products, customers, and orders in no time with this 3rd party plugin. Learn more (opens in a new tab)',
|
|
||||||
} )
|
|
||||||
);
|
|
||||||
await waitFor( () =>
|
|
||||||
expect( recordEvent ).toHaveBeenCalledWith(
|
|
||||||
'tasklist_add_product',
|
|
||||||
{
|
|
||||||
method: 'migrate',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} );
|
|
||||||
|
|
||||||
test( 'should fire "task_completion_time" event when an option clicked', async () => {
|
test( 'should fire "task_completion_time" event when an option clicked', async () => {
|
||||||
Object.defineProperty( window, 'performance', {
|
Object.defineProperty( window, 'performance', {
|
||||||
value: {
|
value: {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import interpolateComponents from '@automattic/interpolate-components';
|
import interpolateComponents from '@automattic/interpolate-components';
|
||||||
import { Text } from '@woocommerce/experimental';
|
import { Text } from '@woocommerce/experimental';
|
||||||
import { ExternalLink } from '@wordpress/components';
|
|
||||||
import { Link } from '@woocommerce/components';
|
import { Link } from '@woocommerce/components';
|
||||||
import { getAdminLink } from '@woocommerce/settings';
|
import { getAdminLink } from '@woocommerce/settings';
|
||||||
import { recordEvent } from '@woocommerce/tracks';
|
import { recordEvent } from '@woocommerce/tracks';
|
||||||
|
@ -25,7 +24,7 @@ const Footer: React.FC = () => {
|
||||||
<Text className="woocommerce-products-footer__import-options">
|
<Text className="woocommerce-products-footer__import-options">
|
||||||
{ interpolateComponents( {
|
{ interpolateComponents( {
|
||||||
mixedString: __(
|
mixedString: __(
|
||||||
'{{importCSVLink}}Import your products from a CSV file{{/importCSVLink}} or {{_3rdLink}}use a 3rd party migration plugin{{/_3rdLink}}.',
|
'{{importCSVLink}}Import your products from a CSV file{{/importCSVLink}}.',
|
||||||
'woocommerce'
|
'woocommerce'
|
||||||
),
|
),
|
||||||
components: {
|
components: {
|
||||||
|
@ -47,20 +46,6 @@ const Footer: React.FC = () => {
|
||||||
<></>
|
<></>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
_3rdLink: (
|
|
||||||
<ExternalLink
|
|
||||||
onClick={ () => {
|
|
||||||
recordEvent( 'tasklist_add_product', {
|
|
||||||
method: 'migrate',
|
|
||||||
} );
|
|
||||||
recordCompletionTime();
|
|
||||||
} }
|
|
||||||
href="https://woocommerce.com/products/cart2cart/?utm_medium=product"
|
|
||||||
type="external"
|
|
||||||
>
|
|
||||||
<></>
|
|
||||||
</ExternalLink>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
} ) }
|
} ) }
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -16,9 +16,9 @@ describe( 'Footer', () => {
|
||||||
beforeEach( () => {
|
beforeEach( () => {
|
||||||
( recordEvent as jest.Mock ).mockClear();
|
( recordEvent as jest.Mock ).mockClear();
|
||||||
} );
|
} );
|
||||||
it( 'should render footer with two links', () => {
|
it( 'should render footer with one links', () => {
|
||||||
const { queryAllByRole } = render( <Footer /> );
|
const { queryAllByRole } = render( <Footer /> );
|
||||||
expect( queryAllByRole( 'link' ) ).toHaveLength( 2 );
|
expect( queryAllByRole( 'link' ) ).toHaveLength( 1 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'clicking on import CSV should fire event tasklist_add_product with method:import and task_completion_time', () => {
|
it( 'clicking on import CSV should fire event tasklist_add_product with method:import and task_completion_time', () => {
|
||||||
|
@ -35,19 +35,4 @@ describe( 'Footer', () => {
|
||||||
{ task_name: 'products', time: '0-2s' }
|
{ task_name: 'products', time: '0-2s' }
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'clicking on start blank should fire event tasklist_add_product with method:migrate and task_completion_time', () => {
|
|
||||||
const { getByText } = render( <Footer /> );
|
|
||||||
userEvent.click( getByText( 'use a 3rd party migration plugin' ) );
|
|
||||||
expect( recordEvent ).toHaveBeenNthCalledWith(
|
|
||||||
1,
|
|
||||||
'tasklist_add_product',
|
|
||||||
{ method: 'migrate' }
|
|
||||||
);
|
|
||||||
expect( recordEvent ).toHaveBeenNthCalledWith(
|
|
||||||
2,
|
|
||||||
'task_completion_time',
|
|
||||||
{ task_name: 'products', time: '0-2s' }
|
|
||||||
);
|
|
||||||
} );
|
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: update
|
||||||
|
|
||||||
|
Remove Cart2Cart option from add product task
|
Loading…
Reference in New Issue