2021-09-21 19:33:44 +00:00
/ * *
* External dependencies
* /
import { _ _ } from '@wordpress/i18n' ;
import { useState } from '@wordpress/element' ;
import { getQuery , updateQueryString } from '@woocommerce/navigation' ;
2022-02-21 02:34:25 +00:00
import interpolateComponents from '@automattic/interpolate-components' ;
2021-09-21 19:33:44 +00:00
import { Link } from '@woocommerce/components' ;
/ * *
* Internal dependencies
* /
import Modal from '~/profile-wizard/steps/usage-modal' ;
export const UsageModal = ( ) => {
const query = getQuery ( ) ;
const shouldDisplayModal = query [ 'wcpay-connection-success' ] === '1' ;
const [ isOpen , setIsOpen ] = useState ( shouldDisplayModal ) ;
if ( ! isOpen ) {
return null ;
}
const closeModal = ( ) => {
setIsOpen ( false ) ;
updateQueryString ( { 'wcpay-connection-success' : undefined } ) ;
} ;
const title = _ _ (
'Help us build a better WooCommerce Payments experience' ,
2022-03-30 09:00:04 +00:00
'woocommerce'
2021-09-21 19:33:44 +00:00
) ;
const trackingMessage = interpolateComponents ( {
mixedString : _ _ (
'By agreeing to share non-sensitive {{link}}usage data{{/link}}, you’ ll help us improve features and optimize the WooCommerce Payments experience. You can opt out at any time.' ,
2022-03-30 09:00:04 +00:00
'woocommerce'
2021-09-21 19:33:44 +00:00
) ,
components : {
link : (
< Link
href = "https://woocommerce.com/usage-tracking?utm_medium=product"
target = "_blank"
type = "external"
/ >
) ,
} ,
} ) ;
return (
< Modal
isDismissible = { false }
title = { title }
message = { trackingMessage }
2022-03-30 09:00:04 +00:00
acceptActionText = { _ _ ( 'I agree' , 'woocommerce' ) }
dismissActionText = { _ _ ( 'No thanks' , 'woocommerce' ) }
2021-09-21 19:33:44 +00:00
onContinue = { closeModal }
onClose = { closeModal }
/ >
) ;
} ;
export default UsageModal ;