/**
* WordPress dependencies
*/
import { ExternalLink, Modal } from '@safe-wordpress/components';
import { useSelect, useDispatch } from '@safe-wordpress/data';
import { _x } from '@safe-wordpress/i18n';
/**
* External dependencies
*/
import clsx from 'clsx';
import { store as NC_DATA } from '@nelio-content/data';
import {
PREMIUM_FEATURES,
getSubscribeLink,
getUnlockLabel,
} from '@nelio-content/utils';
import type { PremiumFeature } from '@nelio-content/types';
/**
* Internal dependencies
*/
import './style.scss';
import NelioContentIcon from '../../../assets/src/images/logo.svg';
export const PremiumDialog = (): JSX.Element | null => {
const {
isSubscribed,
today,
feature,
pluginsUrl,
accountUrl,
premiumStatus,
} = useSelect(
( select ) => ( {
isSubscribed: select( NC_DATA ).isSubscribed(),
today: select( NC_DATA ).getToday(),
feature: select( NC_DATA ).getPremiumDialog(),
pluginsUrl: select( NC_DATA ).getAdminUrl( 'plugins.php' ),
accountUrl: select( NC_DATA ).getAdminUrl(
'admin.php?page=nelio-content-account'
),
premiumStatus: select( NC_DATA ).getPremiumStatus(),
} ),
[]
);
const isUpgrade = 'ready' === premiumStatus;
const isInstalled = 'uninstalled' !== premiumStatus;
if ( 'none' === feature ) {
return null;
}
const banner = FEATURE_BANNERS[ feature ];
const subscribeUrl = getSubscribeLink( today, feature );
const subscribeLabel = getUnlockLabel( today );
const upgradePlanLabel = _x(
'Upgrade Your Subscription',
'user',
'nelio-content'
);
const installPremiumLabel = isInstalled
? _x( 'Activate Nelio Content Premium', 'command', 'nelio-content' )
: _x( 'Install Nelio Content Premium', 'command', 'nelio-content' );
let link = subscribeUrl;
let label = subscribeLabel;
if ( isSubscribed ) {
link = pluginsUrl;
label = installPremiumLabel;
}
if ( isUpgrade ) {
link = accountUrl;
label = upgradePlanLabel;
}
return (
) as unknown as string }
isDismissible={ false }
shouldCloseOnEsc={ false }
shouldCloseOnClickOutside={ false }
onRequestClose={ () => void null }
>
{ banner.subtitle }
{ banner.paragraph }
{ label }
{ ! isSubscribed &&
_x(
'30-day money-back guarantee',
'text',
'nelio-content'
) }
{ ! isSubscribed && (
{ _x(
'Nelio Content Premium also gives you:',
'text',
'nelio-content'
) }
{ PREMIUM_FEATURES.map(
( { name, description }, i ) => (
-
{ name }
{ ` ${ description }` }
)
) }
) }
);
};
// =======
// HELPERS
// =======
const Title = () => {
const { closePremiumDialog } = useDispatch( NC_DATA );
const feature = useSelect(
( select ) => select( NC_DATA ).getPremiumDialog(),
[]
);
const banner = FEATURE_BANNERS[ feature ];
return (
);
};
type FeatureBanner = {
readonly title: string;
readonly subtitle: string;
readonly paragraph: string;
};
const FEATURE_BANNERS: Record< 'none' | PremiumFeature, FeatureBanner > = {
none: { title: '', subtitle: '', paragraph: '' },
'analytics/create-messages': {
title: _x( 'Second Chances', 'text', 'nelio-content' ),
subtitle: _x(
'Discover your most valuable posts and reshare them',
'user',
'nelio-content'
),
paragraph: _x(
'Nelio Content’s Analytics will show you which content is performing the best. Reshare it with your followers and reach newer audiences.',
'user',
'nelio-content'
),
},
'calendar/create-messages': {
title: _x( 'Schedule Social Messages', 'user', 'nelio-content' ),
subtitle: _x(
'Schedule and share your thoughts in a breeze',
'user',
'nelio-content'
),
paragraph: _x(
'Using Nelio’s Editorial Calendar, you can easily schedule all the publications you want on your social profiles.',
'text',
'nelio-content'
),
},
'calendar/create-reusable-messages': {
title: _x( 'Create Reusable Messages', 'user', 'nelio-content' ),
subtitle: _x(
'Evergreen messages at the tip of your fingers',
'text',
'nelio-content'
),
paragraph: _x(
'Write recurring topics once and use them when needed by simply dragging-and-dropping your messages into the calendar.',
'user',
'nelio-content'
),
},
'calendar/create-tasks': {
title: _x( 'Editorial Tasks', 'text', 'nelio-content' ),
subtitle: _x(
'Get things done once and for all',
'user',
'nelio-content'
),
paragraph: _x(
'Keep track of all your tasks by creating them in your calendar and assigning them to your team members.',
'user',
'nelio-content'
),
},
'calendar/edit-reusable-messages': {
title: _x( 'Edit Reusable Messages', 'user', 'nelio-content' ),
subtitle: _x(
'Evergreen messages at the tip of your fingers',
'text',
'nelio-content'
),
paragraph: _x(
'Write recurring topics once and use them when needed by simply dragging-and-dropping your messages into the calendar.',
'user',
'nelio-content'
),
},
'calendar/export': {
title: _x( 'Export Your Calendar', 'user', 'nelio-content' ),
subtitle: _x(
'Export your calendar in multiple formats and take it with you',
'user',
'nelio-content'
),
paragraph: _x(
'Download your calendar as CSV or generate a custom link to integrate your blog posts into external tools like Google Calendar.',
'user',
'nelio-content'
),
},
'calendar/schedule-reusable-messages': {
title: _x( 'Schedule Reusable Messages', 'user', 'nelio-content' ),
subtitle: _x(
'Evergreen messages at the tip of your fingers',
'text',
'nelio-content'
),
paragraph: _x(
'Write recurring topics once and use them when needed by simply dragging-and-dropping your messages into the calendar.',
'user',
'nelio-content'
),
},
'edit-post/create-more-messages': {
title: _x( 'Reach More People', 'user', 'nelio-content' ),
subtitle: _x(
'Write as many social publications as you need',
'user',
'nelio-content'
),
paragraph: _x(
'Make sure the content of your blog is read on social media and send multiple messages that span across multiple days.',
'user',
'nelio-content'
),
},
'edit-post/custom-timeline': {
title: _x( 'Lasting Promotions', 'text', 'nelio-content' ),
subtitle: _x(
'Promote your content upon publication and during the next few days',
'user',
'nelio-content'
),
paragraph: _x(
'Make sure your blog posts reach your audience and share it on multiple social platforms across several days.',
'user',
'nelio-content'
),
},
'feeds/share-post': {
title: _x( 'Share Your Feeds', 'user', 'nelio-content' ),
subtitle: _x(
'Give your readers the value they deserve',
'user',
'nelio-content'
),
paragraph: _x(
'Share posts from your favorite feeds and keep your followers informed with valuable content.',
'user',
'nelio-content'
),
},
'raw/automation-groups': {
title: _x( 'Automate your Social Media', 'user', 'nelio-content' ),
subtitle: _x(
'Customize what you share and how you share it',
'user',
'nelio-content'
),
paragraph: _x(
'Define custom templates for each of your social accounts, select which content should be share, where, and how, and let Nelio Content take care of the rest.',
'user',
'nelio-content'
),
},
'raw/custom-statuses': {
title: _x(
'Custom Statuses for Your Workflow',
'text',
'nelio-content'
),
subtitle: _x(
'Create and assign custom statuses to your WordPress content.',
'user',
'nelio-content'
),
paragraph: _x(
'Tailor your editorial process by defining custom statuses that match your unique workflow. Easily track your content’s progress with statuses that go beyond the default options in WordPress.',
'user',
'nelio-content'
),
},
'raw/editorial-comments': {
title: _x( 'Talk to Your Team', 'user', 'nelio-content' ),
subtitle: _x(
'Discuss with your team the status of your upcoming posts',
'user',
'nelio-content'
),
paragraph: _x(
'Keep track of all the conversations you’ve had and make sure you’re all on the same page.',
'user',
'nelio-content'
),
},
'raw/editorial-tasks': {
title: _x( 'Editorial Tasks', 'text', 'nelio-content' ),
subtitle: _x(
'Keep track of all the important work ahead',
'user',
'nelio-content'
),
paragraph: _x(
'Make sure everyone know what they have to do by creating and assigning editorial tasks and don’t miss any more deadlines.',
'user',
'nelio-content'
),
},
'raw/free-previews': {
title: _x( 'Thorough Sharing Experience', 'text', 'nelio-content' ),
subtitle: _x(
'Let Nelio Content take care of your inbound marketing strategy',
'user',
'nelio-content'
),
paragraph: _x(
'Our plugin can create unique social messages based on the content of your blog post, creating an engaging set of publications that your followers will love.',
'text',
'nelio-content'
),
},
'raw/future-actions': {
title: _x( 'Future Actions', 'text', 'nelio-content' ),
subtitle: _x(
'Automate your workflow with future actions',
'user',
'nelio-content'
),
paragraph: _x(
'Schedule automatic changes to your posts, pages, and other content types.',
'user',
'nelio-content'
),
},
'raw/network-images': {
title: _x( 'Custom Social Images', 'text', 'nelio-content' ),
subtitle: _x(
'Adapt your content better to the particularities of each network.',
'user',
'nelio-content'
),
paragraph: _x(
'Select different versions of the same image to share in each social network, each with a different size. This way, the image is shared with a perfect size for each network, and your followers will enjoy a better user experience.',
'user',
'nelio-content'
),
},
'raw/series': {
title: _x( 'Series', 'text', 'nelio-content' ),
subtitle: _x(
'Group your posts into collections or series',
'user',
'nelio-content'
),
paragraph: _x(
'This is perfect for magazines, newspapers, short-story authors, educators, comic creators, or anyone who produces multiple posts on a similar subject.',
'text',
'nelio-content'
),
},
'raw/task-presets': {
title: _x( 'Standardize Your Workflow', 'user', 'nelio-content' ),
subtitle: _x(
'Create task presets and instantiate them when creating new blog posts',
'user',
'nelio-content'
),
paragraph: _x(
'If you find yourself repeating the same tasks over and over again for each post in your blog, create a simple task preset and save time and energy. Don’t repeat yourself.',
'user',
'nelio-content'
),
},
'settings/more-profiles': {
title: _x( 'All Your Social Accounts', 'text', 'nelio-content' ),
subtitle: _x(
'Let all your followers know about your content',
'user',
'nelio-content'
),
paragraph: _x(
'Connect your social accounts on all supported platforms and let Nelio Content share your blog posts for you.',
'user',
'nelio-content'
),
},
'settings/more-profiles-in-network': {
title: _x( 'Multiple Accounts per Network', 'text', 'nelio-content' ),
subtitle: _x(
'Let all your followers know about your content',
'user',
'nelio-content'
),
paragraph: _x(
'Connect multiple profiles on the same platform and let Nelio Content take care of the rest.',
'user',
'nelio-content'
),
},
};