/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createInterpolateElement, useState } from '@wordpress/element';
import { Button, Notice } from '@wordpress/components';
import { PLUGINS_STORE_NAME } from '@woocommerce/data';
import { useDispatch } from '@wordpress/data';
import { recordEvent } from '@woocommerce/tracks';
/**
* Internal dependencies
*/
import unconnectedImage from './subscriptions-empty-state-unconnected.svg';
import './style.scss';
declare global {
interface Window {
wcWcpaySubscriptions: {
newSubscriptionProductUrl: string;
onboardingUrl: string;
};
}
}
const {
newSubscriptionProductUrl,
onboardingUrl,
} = window.wcWcpaySubscriptions;
const ErrorNotice = ( { isError }: { isError: boolean } ) => {
if ( ! isError ) {
return null;
}
return (
{ createInterpolateElement( __( 'By clicking "Get started", you agree to the Terms of Service', 'woocommerce-payments' ), { a: ( // eslint-disable-next-line jsx-a11y/anchor-has-content ), } ) }
); // eslint-disable-next-line @typescript-eslint/ban-types const GetStartedButton = ( { setIsError }: { setIsError: Function } ) => { const [ isGettingStarted, setIsGettingStarted ] = useState( false ); const { installAndActivatePlugins } = useDispatch( PLUGINS_STORE_NAME ); return ({ __( 'Track recurring revenue and manage active subscriptions directly from your store’s dashboard — powered by WooCommerce Payments.', 'woocommerce-payments' ) }