import { recordTracksEvent } from '@automattic/calypso-analytics'; import { BackButton, NextButton, SubTitle, Title } from '@automattic/onboarding'; import { useI18n } from '@wordpress/react-i18n'; import React, { useEffect } from 'react'; import { HintJetpackConnection } from './hint-jetpack-connection'; import { HintJetpackConnectionMovePlugin } from './hint-jetpack-connection-move-plugin'; import './style.scss'; export type NotAuthorizedType = | 'generic' | 'target-site-staging' | 'source-site-not-connected' | 'source-site-not-connected-move-plugin'; interface Props { type?: NotAuthorizedType; sourceSiteUrl?: string; targetSiteUrl?: string; startImport?: () => void; onBackToStart?: () => void; onStartBuilding?: () => void; onStartBuildingText?: string; } const NotAuthorized: React.FunctionComponent< Props > = ( props ) => { const { __ } = useI18n(); const { type = 'generic', sourceSiteUrl, targetSiteUrl, startImport, onBackToStart, onStartBuilding, onStartBuildingText, } = props; const startBuildingText = onStartBuildingText ?? __( 'Start building' ); useEffect( () => { recordTracksEvent( 'calypso_site_importer_unauthorized' ); }, [] ); return (
{ type === 'generic' && ( <> { __( 'You are not authorized to import content' ) } { __( 'Please check with your site admin.' ) }
{ onStartBuilding && ( { startBuildingText } ) } { onBackToStart && (
{ __( 'Back to start' ) }
) }
) } { type === 'target-site-staging' && ( <> { __( 'You are not authorized to perform migration on the staging site' ) }
{ onStartBuilding && ( { startBuildingText } ) }
) } { type === 'source-site-not-connected' && ( <> { __( "We couldn't start the migration" ) }
{ startImport && ( { __( 'Try again' ) } ) }
) } { type === 'source-site-not-connected-move-plugin' && ( <> { __( "We couldn't start the migration" ) }
{ startImport && ( { __( 'Try again' ) } ) }
) }
); }; export default NotAuthorized;