Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80ceab3
New class to handle async XML-RPC requests (#16674)
leogermani Aug 5, 2020
c07b42b
Lodash: Revert to previous version (#16735)
kraftbj Aug 5, 2020
e3860aa
Donations: Save block content (#16705)
mmtr Aug 6, 2020
11f81f1
UI changes to prepare to make Social Previews a gated feature on WPCo…
getdave Aug 6, 2020
dbc8291
Jetpack Monitor: Switch from `user_token` to `blog_token`. (#16736)
sergeymitr Aug 7, 2020
b96e08f
Jetpack Protect: Replace `user_token` with `blog_token`. (#16758)
sergeymitr Aug 7, 2020
12f82ed
adds tracking for deleted but active master users (#16750)
leogermani Aug 7, 2020
10d037a
Add Slim SEO to list of SEO plugins (#16778)
rilwis Aug 10, 2020
c2ea60d
Donations: Remove feature from Personal plans (#16742)
mmtr Aug 10, 2020
917261a
avoid warning on wp cli (#16760)
leogermani Aug 10, 2020
abc6741
Update jest monorepo to v26 (#16774)
renovate[bot] Aug 10, 2020
ae5f858
Update dependency url-loader to v4 (#16772)
renovate[bot] Aug 10, 2020
60fbb28
CC me only on master failures; (#16780)
brbrr Aug 10, 2020
b4e342d
E2E test job will fail CI builds from now (#16757)
brbrr Aug 10, 2020
b0348d5
E2E tests: Add retry to .org login method (#16756)
brbrr Aug 10, 2020
3204915
Donations: Avoid using buttons elements in block output (#16743)
mmtr Aug 10, 2020
f0ce304
Update dependency css-loader to v4 (#16771)
renovate[bot] Aug 10, 2020
e711bda
Update dependency sass-loader to v9.0.3 (#16769)
renovate[bot] Aug 10, 2020
f75e498
add email marketing consent field
Aug 5, 2020
1ebef75
remove the conditional text
Aug 6, 2020
c170c7c
add the consent field to the contact from in preview and live.
Aug 6, 2020
2f6808e
Add default values
Aug 10, 2020
3cb9b52
Add news letter variation
Aug 10, 2020
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
Prev Previous commit
Next Next commit
UI changes to prepare to make Social Previews a gated feature on WPCom (
#16724)

* Add basic scaffold for premium nudge

* Add documentation to code.

* Remove testing check and use check for avaiabiliity

* Update extensions/blocks/social-previews/editor.js

Co-authored-by: Damián Suárez <rdsuarez@gmail.com>

* Update extensions/blocks/social-previews/editor.js

Co-authored-by: Damián Suárez <rdsuarez@gmail.com>

* Remove testing comment

* Normalize to a single button and onClick action

Co-authored-by: Damián Suárez <rdsuarez@gmail.com>
  • Loading branch information
getdave and retrofox authored Aug 6, 2020
commit 11f81f14bb3df0b8c561981574106a1c2646206a
27 changes: 26 additions & 1 deletion extensions/blocks/social-previews/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
/**
* Internal dependencies
*/
import { name, settings } from '.';
import { name, settings, SocialPreviews } from '.';
import registerJetpackPlugin from '../../shared/register-jetpack-plugin';
import { registerPlugin } from '@wordpress/plugins';
import getJetpackExtensionAvailability from '../../shared/get-jetpack-extension-availability';

/*
* Register the main "social-previews" extension if the feature is available
* on the current plan.
*/
registerJetpackPlugin( name, settings );

/*
* If the social previews extension is **not** available on this plan (WP.com only)
* then manually register a near identical Plugin which shows the upgrade nudge.
* Note this is necessary because the official `registerJetpackPlugin` checks the
* extension availability so will not render the Plugin if the extension is not
* availabile.
*/
const extensionAvailableOnPlan = getJetpackExtensionAvailability( 'social-previews' );

if ( ! extensionAvailableOnPlan ) {
registerPlugin( `jetpack-${name}-upgrade-nudge`, {
render: () => {
return (
<SocialPreviews showUpgradeNudge={ true } />
);
}
} );
}
4 changes: 2 additions & 2 deletions extensions/blocks/social-previews/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export const settings = {
render: () => <SocialPreviews />,
};

const SocialPreviews = function SocialPreviews() {
export const SocialPreviews = function SocialPreviews( { showUpgradeNudge } ) {
return (
<JetpackPluginSidebar>
<PanelBody title={ __( 'Social Previews', 'jetpack' ) }>
<SocialPreviewsPanel />
<SocialPreviewsPanel showUpgradeNudge={ showUpgradeNudge } />
</PanelBody>
</JetpackPluginSidebar>
);
Expand Down
15 changes: 12 additions & 3 deletions extensions/blocks/social-previews/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import { Button } from '@wordpress/components';
import { AVAILABLE_SERVICES } from './constants';
import { SocialServiceIcon } from '../../shared/icons';

const SocialPreviewsPanel = function SocialPreviewsPanel( { openModal } ) {
const SocialPreviewsPanel = function SocialPreviewsPanel( { openModal, showUpgradeNudge } ) {
const buttonText = showUpgradeNudge ? __( 'Learn more', 'jetpack' ) : __( 'Preview', 'jetpack' );
const buttonLabel = showUpgradeNudge ? __( 'Learn more about paid plans', 'jetpack' ) : __( 'Open Social Previews', 'jetpack' );

return (
<div className="jetpack-social-previews__panel">
<p>
Expand All @@ -25,6 +28,11 @@ const SocialPreviewsPanel = function SocialPreviewsPanel( { openModal } ) {
'jetpack'
) }
</p>

{ showUpgradeNudge && (
<p>{ __( 'Business or eCommerce plan required.', 'jetpack' ) }</p>
)}

<div className="jetpack-gutenberg-social-icons">
{ AVAILABLE_SERVICES.map( service => (
<SocialServiceIcon
Expand All @@ -34,8 +42,9 @@ const SocialPreviewsPanel = function SocialPreviewsPanel( { openModal } ) {
/>
) ) }
</div>
<Button isSecondary onClick={ openModal } label={ __( 'Open Social Previews', 'jetpack' ) }>
{ __( 'Preview', 'jetpack' ) }

<Button isSecondary onClick={ openModal } label={ buttonLabel }>
{ buttonText }
</Button>
</div>
);
Expand Down