-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subscriptions: Add "Paid newsletter" section to the Newsletter settin…
…gs (#36975)
- Loading branch information
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
projects/plugins/jetpack/_inc/client/newsletter/paid-newsletter.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { __ } from '@wordpress/i18n'; | ||
import Button from 'components/button'; | ||
import { withModuleSettingsFormHelpers } from 'components/module-settings/with-module-settings-form-helpers'; | ||
import SettingsCard from 'components/settings-card'; | ||
import SettingsGroup from 'components/settings-group'; | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { getJetpackCloudUrl } from 'state/initial-state'; | ||
import { SUBSCRIPTIONS_MODULE_NAME } from './constants'; | ||
|
||
/** | ||
* Paid Newsletter component. | ||
* | ||
* @param {object} props - Component props. | ||
* @returns {React.Component} Subscription settings component. | ||
*/ | ||
function PaidNewsletter( props ) { | ||
const { isSubscriptionsActive, setupPaymentPlansUrl } = props; | ||
|
||
const setupPaymentPlansButtonDisabled = ! isSubscriptionsActive; | ||
|
||
return ( | ||
<SettingsCard header={ __( 'Paid Newsletter', 'jetpack' ) } hideButton> | ||
<SettingsGroup> | ||
<p className="jp-settings-card__email-settings"> | ||
{ __( | ||
'Earn money through your Newsletter. Reward your most loyal subscribers with exclusive content or add a paywall to monetize content.', | ||
'jetpack' | ||
) } | ||
</p> | ||
|
||
<Button | ||
href={ ! setupPaymentPlansButtonDisabled ? setupPaymentPlansUrl : undefined } | ||
disabled={ setupPaymentPlansButtonDisabled } | ||
primary | ||
rna | ||
> | ||
{ __( 'Set up', 'jetpack' ) } | ||
</Button> | ||
</SettingsGroup> | ||
</SettingsCard> | ||
); | ||
} | ||
|
||
export default withModuleSettingsFormHelpers( | ||
connect( ( state, ownProps ) => { | ||
return { | ||
isSubscriptionsActive: ownProps.getOptionValue( SUBSCRIPTIONS_MODULE_NAME ), | ||
setupPaymentPlansUrl: getJetpackCloudUrl( state, 'monetize/payments' ), | ||
}; | ||
} )( PaidNewsletter ) | ||
); |
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/update-paid-newsletter-link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: other | ||
|
||
Subscriptions: Add "Paid newsletter" section to the Newsletter settings |