@@ -75,15 +75,14 @@ class Tax extends Component {
7575 }
7676
7777 isTaxJarSupported ( ) {
78- const { countryCode, tosAccepted } = this . props ;
78+ const { countryCode } = this . props ;
7979 const {
8080 automatedTaxSupportedCountries = [ ] ,
8181 taxJarActivated,
8282 } = getSetting ( 'onboarding' , { } ) ;
8383
8484 return (
8585 ! taxJarActivated && // WCS integration doesn't work with the official TaxJar plugin.
86- tosAccepted &&
8786 automatedTaxSupportedCountries . includes ( countryCode )
8887 ) ;
8988 }
@@ -181,7 +180,13 @@ class Tax extends Component {
181180 }
182181
183182 getSteps ( ) {
184- const { generalSettings, isJetpackConnected, isPending } = this . props ;
183+ const {
184+ generalSettings,
185+ isJetpackConnected,
186+ isPending,
187+ tosAccepted,
188+ updateOptions,
189+ } = this . props ;
185190 const { cachedPluginsToActivate } = this . state ;
186191
187192 const steps = [
@@ -221,30 +226,60 @@ class Tax extends Component {
221226 'woocommerce-admin'
222227 ) ,
223228 content : (
224- < Plugins
225- onComplete = { ( ) => {
226- recordEvent ( 'tasklist_tax_install_extensions' , {
227- install_extensions : true ,
228- } ) ;
229- this . completeStep ( ) ;
230- } }
231- onSkip = { ( ) => {
232- queueRecordEvent (
233- 'tasklist_tax_install_extensions' ,
234- {
235- install_extensions : false ,
236- }
237- ) ;
238- this . redirectToTaxSettings ( ) ;
239- } }
240- skipText = { __ (
241- 'Set up tax rates manually' ,
242- 'woocommerce-admin'
229+ < Fragment >
230+ < Plugins
231+ onComplete = { ( ) => {
232+ recordEvent (
233+ 'tasklist_tax_install_extensions' ,
234+ {
235+ install_extensions : true ,
236+ }
237+ ) ;
238+ updateOptions ( {
239+ woocommerce_setup_jetpack_opted_in : true ,
240+ } ) ;
241+ this . completeStep ( ) ;
242+ } }
243+ onSkip = { ( ) => {
244+ queueRecordEvent (
245+ 'tasklist_tax_install_extensions' ,
246+ {
247+ install_extensions : false ,
248+ }
249+ ) ;
250+ this . redirectToTaxSettings ( ) ;
251+ } }
252+ skipText = { __ (
253+ 'Set up tax rates manually' ,
254+ 'woocommerce-admin'
255+ ) }
256+ />
257+ { ! tosAccepted && (
258+ < p >
259+ { interpolateComponents ( {
260+ mixedString : __ (
261+ 'By installing Jetpack and WooCommerce Services you agree to the {{link}}Terms of Service{{/link}}.' ,
262+ 'woocommerce-admin'
263+ ) ,
264+ components : {
265+ link : (
266+ < Link
267+ href = {
268+ 'https://wordpress.com/tos/'
269+ }
270+ target = "_blank"
271+ type = "external"
272+ />
273+ ) ,
274+ } ,
275+ } ) }
276+ </ p >
243277 ) }
244- / >
278+ </ Fragment >
245279 ) ,
246280 visible :
247- cachedPluginsToActivate . length && this . isTaxJarSupported ( ) ,
281+ ( cachedPluginsToActivate . length || ! tosAccepted ) &&
282+ this . isTaxJarSupported ( ) ,
248283 } ,
249284 {
250285 key : 'connect' ,
@@ -461,13 +496,15 @@ export default compose(
461496 } ) ,
462497 withDispatch ( ( dispatch ) => {
463498 const { createNotice } = dispatch ( 'core/notices' ) ;
499+ const { updateOptions } = dispatch ( OPTIONS_STORE_NAME ) ;
464500 const { updateAndPersistSettingsForGroup } = dispatch (
465501 SETTINGS_STORE_NAME
466502 ) ;
467503
468504 return {
469505 createNotice,
470506 updateAndPersistSettingsForGroup,
507+ updateOptions,
471508 } ;
472509 } )
473510) ( Tax ) ;
0 commit comments