diff --git a/_inc/client/components/settings-card/index.jsx b/_inc/client/components/settings-card/index.jsx
index 8a1b276fe431e..547a39bf1edd9 100644
--- a/_inc/client/components/settings-card/index.jsx
+++ b/_inc/client/components/settings-card/index.jsx
@@ -2,27 +2,135 @@
* External dependencies
*/
import React from 'react';
+import { connect } from 'react-redux';
import { translate as __ } from 'i18n-calypso';
/**
* Internal dependencies
*/
+import {
+ PLAN_JETPACK_PREMIUM,
+ PLAN_JETPACK_BUSINESS,
+ FEATURE_SECURITY_SCANNING_JETPACK,
+ FEATURE_SEO_TOOLS_JETPACK,
+ FEATURE_VIDEO_HOSTING_JETPACK,
+ getPlanClass
+} from 'lib/plans/constants';
+import { getSiteRawUrl } from 'state/initial-state';
+import {
+ getSitePlan,
+ isFetchingSiteData
+} from 'state/site';
import SectionHeader from 'components/section-header';
+import Banner from 'components/banner';
import Button from 'components/button';
-const SettingsCard = props => {
+export const SettingsCard = props => {
let module = props.module
? props.getModule( props.module )
: false,
header = props.header
? props.header
: '',
- isSaving = props.isSavingAnyOption();
+ isSaving = props.isSavingAnyOption(),
+ feature = props.feature
+ ? props.feature
+ : false,
+ siteRawUrl = props.siteRawUrl;
if ( '' === header && module ) {
header = module.name;
}
+ let getBanner = ( feature ) => {
+ let planClass = getPlanClass( props.sitePlan.product_slug );
+ let list;
+ let commonProps = {
+ feature: feature,
+ href: 'https://jetpack.com/redirect/?source=plans-compare-personal&site=' + siteRawUrl
+ };
+
+ switch( feature ) {
+ case FEATURE_VIDEO_HOSTING_JETPACK:
+ if (
+ 'is-premium-plan' === planClass
+ || 'is-business-plan' === planClass
+ ) {
+ return '';
+ }
+
+ return (
+
+ );
+
+ case FEATURE_SECURITY_SCANNING_JETPACK:
+ if ( 'is-business-plan' === planClass ) {
+ return '';
+ }
+
+ list = [
+ __( 'Automatic backups of every single aspect of your site' ),
+ __( 'Comprehensive and automated scanning for any security vulnerabilites or threats' ),
+ ];
+
+ if ( 'is-premium-plan' !== planClass ) {
+ list.unshift(
+ __( 'State-of-the-art spam defence powered by Akismet' )
+ );
+ }
+
+ return (
+
+ );
+
+ case FEATURE_SEO_TOOLS_JETPACK:
+ if ( 'is-business-plan' === planClass ) {
+ return '';
+ }
+
+ list = [
+ __( 'SEO tools to optimize your site for search engines and social media sharing' ),
+ __( 'Google Analytics tracking settings to complement WordPress.com stats' ),
+ ];
+
+ if ( 'is-premium-plan' !== planClass ) {
+ list.unshift(
+ __( 'Enable advertisements on your site to earn money from impressions' )
+ );
+ }
+
+ return (
+
+ );
+
+ default:
+ return '';
+ }
+ };
+
return (
);
};
-export default SettingsCard;
+export default connect(
+ ( state ) => {
+ return {
+ sitePlan: getSitePlan( state ),
+ fetchingSiteData: isFetchingSiteData( state ),
+ siteRawUrl: getSiteRawUrl( state ),
+ };
+ }
+)( SettingsCard );
diff --git a/_inc/client/components/settings-card/test/component.js b/_inc/client/components/settings-card/test/component.js
index 0ab7d9a4a984d..c171437f9694b 100644
--- a/_inc/client/components/settings-card/test/component.js
+++ b/_inc/client/components/settings-card/test/component.js
@@ -9,7 +9,7 @@ import sinon from 'sinon';
/**
* Internal dependencies
*/
-import SettingsCard from '../index';
+import { SettingsCard } from '../index';
describe( 'SettingsCard', () => {
@@ -25,7 +25,10 @@ describe( 'SettingsCard', () => {
isSavingAnyOption: () => false,
isDirty: () => true,
header: '',
- support: ''
+ support: '',
+ sitePlan: {
+ product_slug: 'jetpack_free'
+ }
};
const wrapper = shallow( );
diff --git a/_inc/client/security/backups-scan.jsx b/_inc/client/security/backups-scan.jsx
index e5cca3dfb3e12..25776bdc38d62 100644
--- a/_inc/client/security/backups-scan.jsx
+++ b/_inc/client/security/backups-scan.jsx
@@ -7,6 +7,7 @@ import { translate as __ } from 'i18n-calypso';
/**
* Internal dependencies
*/
+import { FEATURE_SECURITY_SCANNING_JETPACK } from 'lib/plans/constants';
import ExternalLink from 'components/external-link';
import { ModuleSettingsForm as moduleSettingsForm } from 'components/module-settings/module-settings-form';
import SettingsCard from 'components/settings-card';
@@ -22,6 +23,7 @@ export const BackupsScan = moduleSettingsForm(
render() {
return (
diff --git a/_inc/client/traffic/seo.jsx b/_inc/client/traffic/seo.jsx
index fca20a58206e6..ebf2fbf5f3126 100644
--- a/_inc/client/traffic/seo.jsx
+++ b/_inc/client/traffic/seo.jsx
@@ -8,6 +8,7 @@ import ExternalLink from 'components/external-link';
/**
* Internal dependencies
*/
+import { FEATURE_SEO_TOOLS_JETPACK } from 'lib/plans/constants';
import { ModuleSettingsForm as moduleSettingsForm } from 'components/module-settings/module-settings-form';
import SettingsCard from 'components/settings-card';
import SettingsGroup from 'components/settings-group';
@@ -20,6 +21,7 @@ export const SEO = moduleSettingsForm(
diff --git a/_inc/client/writing/media.jsx b/_inc/client/writing/media.jsx
index 5a334179adf9e..70189b14187b8 100644
--- a/_inc/client/writing/media.jsx
+++ b/_inc/client/writing/media.jsx
@@ -9,6 +9,7 @@ import CompactFormToggle from 'components/form/form-toggle/compact';
/**
* Internal dependencies
*/
+import { FEATURE_VIDEO_HOSTING_JETPACK } from 'lib/plans/constants';
import {
FormFieldset,
FormLegend,
@@ -77,7 +78,10 @@ const Media = moduleSettingsForm(
isCarouselActive = this.props.getOptionValue( 'carousel' );
let photonSettings = (
-
+
+ header={ __( 'Media' ) }
+ feature={ FEATURE_VIDEO_HOSTING_JETPACK }>
{ this.props.isModuleFound( 'photon' ) && photonSettings }
{ this.props.isModuleFound( 'carousel' ) && carouselSettings }
diff --git a/webpack.config.js b/webpack.config.js
index a69bdc629231d..e1f2cdd4ef5d7 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -60,6 +60,10 @@ var webpackConfig = {
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract( 'style-loader', 'css!sass' )
+ },
+ {
+ test: /\.svg/,
+ loader: 'url-loader'
}
]
},