2023-05-03 07:54:28 +00:00
/ * *
* External dependencies
* /
import { __ } from '@wordpress/i18n' ;
import { Button , CheckboxControl } from '@wordpress/components' ;
import { useState } from '@wordpress/element' ;
import interpolateComponents from '@automattic/interpolate-components' ;
import { Link } from '@woocommerce/components' ;
2023-04-24 02:08:24 +00:00
/ * *
* Internal dependencies
* /
2023-07-24 12:34:38 +00:00
import { IntroOptInEvent } from '../index' ;
2023-05-03 07:54:28 +00:00
import { Heading } from '../components/heading/heading' ;
import { Navigation } from '../components/navigation/navigation' ;
2023-04-24 02:08:24 +00:00
export const IntroOptIn = ( {
sendEvent ,
2023-05-03 07:54:28 +00:00
navigationProgress ,
2023-04-24 02:08:24 +00:00
} : {
sendEvent : ( event : IntroOptInEvent ) = > void ;
2023-05-03 07:54:28 +00:00
navigationProgress : number ;
2023-04-24 02:08:24 +00:00
} ) = > {
2023-06-14 05:10:43 +00:00
const [ iOptInDataSharing , setIsOptInDataSharing ] =
useState < boolean > ( true ) ;
2023-05-03 07:54:28 +00:00
2023-04-24 02:08:24 +00:00
return (
2023-05-16 00:56:39 +00:00
< div
className = "woocommerce-profiler-intro-opt-in"
data - testid = "core-profiler-intro-opt-in-screen"
>
2023-05-03 07:54:28 +00:00
< Navigation
percentage = { navigationProgress }
skipText = { __ ( 'Skip guided setup' , 'woocommerce' ) }
onSkip = { ( ) = >
2023-04-24 02:08:24 +00:00
sendEvent ( {
type : 'INTRO_SKIPPED' ,
payload : { optInDataSharing : false } ,
} )
}
2023-05-03 07:54:28 +00:00
/ >
< div className = "woocommerce-profiler-page__content woocommerce-profiler-intro-opt-in__content" >
< div className = "woocommerce-profiler-welcome-image" / >
< Heading
title = { __ ( 'Welcome to Woo!' , 'woocommerce' ) }
subTitle = { interpolateComponents ( {
mixedString : __ (
"It's great to have you here with us! We'll be guiding you through the setup process – first, answer a few questions to tailor your experience." ,
'woocommerce'
) ,
components : {
br : < br / > ,
} ,
} ) }
/ >
< Button
className = "woocommerce-profiler-setup-store__button"
variant = "primary"
onClick = { ( ) = >
sendEvent ( {
type : 'INTRO_COMPLETED' ,
payload : { optInDataSharing : iOptInDataSharing } ,
} )
}
>
{ __ ( 'Set up my store' , 'woocommerce' ) }
< / Button >
< div className = "woocommerce-profiler-intro-opt-in__footer" >
< CheckboxControl
2023-06-17 05:14:13 +00:00
className = "core-profiler__checkbox"
2023-05-03 07:54:28 +00:00
label = { interpolateComponents ( {
mixedString : __ (
'I agree to share my data to tailor my store setup experience and get more relevant content. WooCommerce never rent or sell your data and you can opt out at any time in WooCommerce settings. {{link}}Learn more about usage tracking{{/link}}.' ,
'woocommerce'
) ,
components : {
link : (
< Link
href = "https://woocommerce.com/usage-tracking?utm_medium=product"
target = "_blank"
type = "external"
/ >
) ,
} ,
} ) }
checked = { iOptInDataSharing }
onChange = { setIsOptInDataSharing }
/ >
< / div >
< / div >
< / div >
2023-04-24 02:08:24 +00:00
) ;
} ;