From 4b02e0850d4d586c652aed9a206cdd7dbf778700 Mon Sep 17 00:00:00 2001 From: Joshua T Flowers Date: Wed, 22 Jan 2020 16:37:05 +0800 Subject: [PATCH] Onboarding: Allow Jetpack connection to be skipped in tax task (https://github.com/woocommerce/woocommerce-admin/pull/3589) * Add skip action to Connect component * Add skip button to tax connect step * Record event when tax Jetpack connection is skipped --- .../task-list/tasks/steps/connect.js | 31 +++++++++++++------ .../client/dashboard/task-list/tasks/tax.js | 9 +++++- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/plugins/woocommerce-admin/client/dashboard/task-list/tasks/steps/connect.js b/plugins/woocommerce-admin/client/dashboard/task-list/tasks/steps/connect.js index ccf0bafcd65..067339b2785 100644 --- a/plugins/woocommerce-admin/client/dashboard/task-list/tasks/steps/connect.js +++ b/plugins/woocommerce-admin/client/dashboard/task-list/tasks/steps/connect.js @@ -38,17 +38,22 @@ class Connect extends Component { } render() { - const { hasErrors, isRequesting } = this.props; + const { hasErrors, isRequesting, onSkip, skipText } = this.props; - return hasErrors ? ( - - ) : ( + return ( - + { hasErrors ? ( + + ) : ( + + ) } + { onSkip && ( + + ) } ); } @@ -75,10 +80,18 @@ Connect.propTypes = { * Generated Jetpack connection URL. */ jetpackConnectUrl: PropTypes.string, + /** + * Called when the plugin connection is skipped. + */ + onSkip: PropTypes.func, /** * Redirect URL to encode as a URL param for the connection path. */ redirectUrl: PropTypes.string, + /** + * Text used for the skip connection button. + */ + skipText: PropTypes.string, }; export default compose( diff --git a/plugins/woocommerce-admin/client/dashboard/task-list/tasks/tax.js b/plugins/woocommerce-admin/client/dashboard/task-list/tasks/tax.js index 266eacc6cae..3ad5375b2c0 100644 --- a/plugins/woocommerce-admin/client/dashboard/task-list/tasks/tax.js +++ b/plugins/woocommerce-admin/client/dashboard/task-list/tasks/tax.js @@ -239,8 +239,15 @@ class Tax extends Component { { - recordEvent( 'tasklist_tax_connect_store' ); + recordEvent( 'tasklist_tax_connect_store', { connect: true } ); } } + onSkip={ () => { + queueRecordEvent( 'tasklist_tax_connect_store', { connect: false } ); + window.location.href = getAdminLink( + 'admin.php?page=wc-settings&tab=tax§ion=standard' + ); + } } + skipText={ __( 'Set up tax rates manually', 'woocommerce-admin' ) } /> ), visible: ! isJetpackConnected && this.isTaxJarSupported(),