import { isFreePlanProduct } from '@automattic/calypso-products';
import page from '@automattic/calypso-router';
import { Button } from '@automattic/components';
import { localize, translate } from 'i18n-calypso';
import PropTypes from 'prop-types';
import { Component } from 'react';
import { connect } from 'react-redux';
import QuerySitePurchases from 'calypso/components/data/query-site-purchases';
import FormTextInput from 'calypso/components/forms/form-text-input';
import InlineSupportLink from 'calypso/components/inline-support-link';
import NavigationHeader from 'calypso/components/navigation-header';
import { Panel, PanelCard, PanelCardHeading } from 'calypso/components/panel';
import withP2HubP2Count from 'calypso/data/p2/with-p2-hub-p2-count';
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
import { resetBreadcrumbs, updateBreadcrumbs } from 'calypso/state/breadcrumb/actions';
import { hasLoadedSitePurchasesFromServer } from 'calypso/state/purchases/selectors';
import hasCancelableSitePurchases from 'calypso/state/selectors/has-cancelable-site-purchases';
import isSiteAutomatedTransfer from 'calypso/state/selectors/is-site-automated-transfer';
import { deleteSite } from 'calypso/state/sites/actions';
import { isTrialSite } from 'calypso/state/sites/plans/selectors';
import { getSite, getSiteDomain } from 'calypso/state/sites/selectors';
import { hasSitesAsLandingPage } from 'calypso/state/sites/selectors/has-sites-as-landing-page';
import { setSelectedSiteId } from 'calypso/state/ui/actions';
import { getSelectedSiteId, getSelectedSiteSlug } from 'calypso/state/ui/selectors';
import { FeatureBreadcrumb } from '../../../../hooks/breadcrumbs/use-set-feature-breadcrumb';
import ExportNotice from '../export-notice';
import DeleteSiteWarnings from './delete-site-warnings';
import './style.scss';
class DeleteSite extends Component {
static propTypes = {
deleteSite: PropTypes.func.isRequired,
hasLoadedSitePurchasesFromServer: PropTypes.bool,
siteDomain: PropTypes.string,
siteExists: PropTypes.bool,
siteId: PropTypes.number,
siteSlug: PropTypes.string,
translate: PropTypes.func.isRequired,
isTrialSite: PropTypes.bool,
};
state = {
confirmDomain: '',
isDeletingSite: false,
};
renderNotice() {
const { siteDomain, siteId } = this.props;
if ( ! siteDomain ) {
return null;
}
return (
{ translate( 'Type {{strong}}%(siteDomain)s{{/strong}} below to confirm you want to delete the site:', { components: { strong: , }, args: { siteDomain: this.props.siteDomain, }, } ) }
<>{ translate( 'Deletion is {{strong}}irreversible and will permanently remove all site content{{/strong}} — posts, pages, media, users, authors, domains, purchased upgrades, and premium themes.', { components: { strong: , }, } ) }
{ translate( 'Once deleted, your domain {{strong}}%(siteDomain)s{{/strong}} will also become unavailable.', { components: { strong: , }, args: { siteDomain: this.props.siteDomain, }, } ) }