From 9ea8b630eed18028ed826b40540a9950321f28b4 Mon Sep 17 00:00:00 2001 From: Chi-Hsuan Huang Date: Fri, 17 Mar 2023 20:15:31 +0800 Subject: [PATCH] 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 --- .../tasks/fills/import-products/cards.scss | 4 ++- .../fills/import-products/importTypes.tsx | 31 ------------------- .../fills/import-products/test/index.tsx | 18 ----------- .../client/tasks/fills/products/footer.tsx | 17 +--------- .../tasks/fills/products/test/footer.tsx | 19 ++---------- .../changelog/update-remove-cart2cart | 4 +++ 6 files changed, 10 insertions(+), 83 deletions(-) create mode 100644 plugins/woocommerce/changelog/update-remove-cart2cart diff --git a/plugins/woocommerce-admin/client/tasks/fills/import-products/cards.scss b/plugins/woocommerce-admin/client/tasks/fills/import-products/cards.scss index 715d2bd6eaf..29e15f6cdb8 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/import-products/cards.scss +++ b/plugins/woocommerce-admin/client/tasks/fills/import-products/cards.scss @@ -8,7 +8,9 @@ grid-template-columns: auto auto; grid-column-gap: 16px; 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 { diff --git a/plugins/woocommerce-admin/client/tasks/fills/import-products/importTypes.tsx b/plugins/woocommerce-admin/client/tasks/fills/import-products/importTypes.tsx index abb15efd783..dd8a3cd77b0 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/import-products/importTypes.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/import-products/importTypes.tsx @@ -3,10 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import PageIcon from 'gridicons/dist/pages'; -import ReblogIcon from 'gridicons/dist/reblog'; import { getAdminLink } from '@woocommerce/settings'; -import interpolateComponents from '@automattic/interpolate-components'; -import { ExternalLink } from '@wordpress/components'; import { recordEvent } from '@woocommerce/tracks'; 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: ( - e.preventDefault() } - > - ), - }, - } ), - before: , - onClick: () => { - recordEvent( 'tasklist_add_product', { method: 'migrate' } ); - window - .open( - 'https://woocommerce.com/products/cart2cart/?utm_medium=product', - '_blank' - ) - ?.focus(); - }, - }, ]; diff --git a/plugins/woocommerce-admin/client/tasks/fills/import-products/test/index.tsx b/plugins/woocommerce-admin/client/tasks/fills/import-products/test/index.tsx index 981543421f5..6bf835fea08 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/import-products/test/index.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/import-products/test/index.tsx @@ -57,24 +57,6 @@ describe( 'Products', () => { ); } ); - test( 'should fire "tasklist_add_product" event when the cart2cart option clicked', async () => { - const { getByRole } = render( ); - - 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 () => { Object.defineProperty( window, 'performance', { value: { diff --git a/plugins/woocommerce-admin/client/tasks/fills/products/footer.tsx b/plugins/woocommerce-admin/client/tasks/fills/products/footer.tsx index 2538012b50b..86dba20973c 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/products/footer.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/products/footer.tsx @@ -4,7 +4,6 @@ import { __ } from '@wordpress/i18n'; import interpolateComponents from '@automattic/interpolate-components'; import { Text } from '@woocommerce/experimental'; -import { ExternalLink } from '@wordpress/components'; import { Link } from '@woocommerce/components'; import { getAdminLink } from '@woocommerce/settings'; import { recordEvent } from '@woocommerce/tracks'; @@ -25,7 +24,7 @@ const Footer: React.FC = () => { { interpolateComponents( { 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' ), components: { @@ -47,20 +46,6 @@ const Footer: React.FC = () => { <> ), - _3rdLink: ( - { - recordEvent( 'tasklist_add_product', { - method: 'migrate', - } ); - recordCompletionTime(); - } } - href="https://woocommerce.com/products/cart2cart/?utm_medium=product" - type="external" - > - <> - - ), }, } ) } diff --git a/plugins/woocommerce-admin/client/tasks/fills/products/test/footer.tsx b/plugins/woocommerce-admin/client/tasks/fills/products/test/footer.tsx index f042aa61be2..b75e20d3107 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/products/test/footer.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/products/test/footer.tsx @@ -16,9 +16,9 @@ describe( 'Footer', () => { beforeEach( () => { ( recordEvent as jest.Mock ).mockClear(); } ); - it( 'should render footer with two links', () => { + it( 'should render footer with one links', () => { const { queryAllByRole } = render(