Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Premium Content: Remove premium content block placeholder #47068

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import { useEffect, useState, useRef } from '@wordpress/element';
import {
Placeholder,
Button,
ExternalLink,
withNotices,
Spinner,
ToolbarGroup,
Expand All @@ -22,7 +20,6 @@ import apiFetch from '@wordpress/api-fetch';
/**
* Internal dependencies
*/
import Tabs from './tabs';
import Blocks from './blocks';
import Controls from './controls';
import Inspector from './inspector';
Expand Down Expand Up @@ -97,7 +94,6 @@ function Edit( props ) {
const [ connectURL, setConnectURL ] = useState( defaultString );
const [ apiState, setApiState ] = useState( API_STATE_LOADING );
const [ shouldUpgrade, setShouldUpgrade ] = useState( false );
const [ upgradeURL, setUpgradeURL ] = useState( '' );
// @ts-ignore needed in some upgrade flows - depending how we implement this
const [ siteSlug, setSiteSlug ] = useState( '' ); // eslint-disable-line

Expand Down Expand Up @@ -242,7 +238,6 @@ function Edit( props ) {

setConnectURL( result.connect_url );
setShouldUpgrade( result.should_upgrade_to_access_memberships );
setUpgradeURL( result.upgrade_url );
setSiteSlug( result.site_slug );

if (
Expand Down Expand Up @@ -304,41 +299,6 @@ function Edit( props ) {
);
}

if ( shouldUpgrade ) {
return (
<div className={ className } ref={ wrapperRef }>
{ props.noticeUI }
<Placeholder
icon="lock"
label={ __( 'Premium Content', 'full-site-editing' ) }
instructions={ __(
"You'll need to upgrade your plan to use the Premium Content block.",
'full-site-editing'
) }
>
<Button
/**
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42883
*/
// @ts-ignore isSecondary is missing from the type definition
isSecondary
isLarge
href={ upgradeURL }
target="_blank"
className="premium-content-block-nudge__button plan-nudge__button"
>
{ __( 'Upgrade Your Plan', 'full-site-editing' ) }
</Button>
<div className="membership-button__disclaimer">
<ExternalLink href="https://wordpress.com/support/premium-content-block/">
{ __( 'Read more about Premium Content and related fees.', 'full-site-editing' ) }
</ExternalLink>
</div>
</Placeholder>
</div>
);
}

const shouldShowConnectButton = () => {
if ( ! shouldUpgrade && apiState !== API_STATE_CONNECTED && connectURL ) {
return true;
Expand Down