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
This commit is contained in:
parent
c4b1d552d4
commit
4b02e0850d
|
@ -38,17 +38,22 @@ class Connect extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { hasErrors, isRequesting } = this.props;
|
const { hasErrors, isRequesting, onSkip, skipText } = this.props;
|
||||||
|
|
||||||
return hasErrors ? (
|
return (
|
||||||
<Button isPrimary onClick={ () => location.reload() }>
|
|
||||||
{ __( 'Retry', 'woocommerce-admin' ) }
|
|
||||||
</Button>
|
|
||||||
) : (
|
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Button isBusy={ isRequesting } isPrimary onClick={ this.connectJetpack }>
|
{ hasErrors ? (
|
||||||
{ __( 'Connect', 'woocommerce-admin' ) }
|
<Button isPrimary onClick={ () => location.reload() }>
|
||||||
</Button>
|
{ __( 'Retry', 'woocommerce-admin' ) }
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Button isBusy={ isRequesting } isPrimary onClick={ this.connectJetpack }>
|
||||||
|
{ __( 'Connect', 'woocommerce-admin' ) }
|
||||||
|
</Button>
|
||||||
|
) }
|
||||||
|
{ onSkip && (
|
||||||
|
<Button onClick={ onSkip }>{ skipText || __( 'No thanks', 'woocommerce-admin' ) }</Button>
|
||||||
|
) }
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -75,10 +80,18 @@ Connect.propTypes = {
|
||||||
* Generated Jetpack connection URL.
|
* Generated Jetpack connection URL.
|
||||||
*/
|
*/
|
||||||
jetpackConnectUrl: PropTypes.string,
|
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.
|
* Redirect URL to encode as a URL param for the connection path.
|
||||||
*/
|
*/
|
||||||
redirectUrl: PropTypes.string,
|
redirectUrl: PropTypes.string,
|
||||||
|
/**
|
||||||
|
* Text used for the skip connection button.
|
||||||
|
*/
|
||||||
|
skipText: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
|
|
|
@ -239,8 +239,15 @@ class Tax extends Component {
|
||||||
<Connect
|
<Connect
|
||||||
{ ...this.props }
|
{ ...this.props }
|
||||||
onConnect={ () => {
|
onConnect={ () => {
|
||||||
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(),
|
visible: ! isJetpackConnected && this.isTaxJarSupported(),
|
||||||
|
|
Loading…
Reference in New Issue