Use feature flag for the MSS Pitch feature
[MAILPOET-2142]
This commit is contained in:
committed by
Jack Kitterhing
parent
a222d91d71
commit
4154d0b928
@@ -4,8 +4,10 @@ import PropTypes from 'prop-types';
|
||||
import MSSUserSuccess from './success_for_mss_users.jsx';
|
||||
import PitchMss from './success_pitch_mss.jsx';
|
||||
|
||||
function Success(props) {
|
||||
if (!window.has_premium_key) {
|
||||
import FeaturesContext from '../../../features/context.jsx';
|
||||
|
||||
function SuccessContent(props) {
|
||||
if (!window.has_premium_key && props.isSupported('display-mss-pitch')) {
|
||||
return (
|
||||
<PitchMss
|
||||
MSSPitchIllustrationUrl={props.MSSPitchIllustrationUrl}
|
||||
@@ -25,6 +27,19 @@ function Success(props) {
|
||||
);
|
||||
}
|
||||
|
||||
function Success(props) {
|
||||
return (
|
||||
<FeaturesContext.Consumer>
|
||||
{(FeaturesController) => (
|
||||
<SuccessContent
|
||||
{...props}
|
||||
isSupported={FeaturesController.isSupported}
|
||||
/>
|
||||
)}
|
||||
</FeaturesContext.Consumer>
|
||||
);
|
||||
}
|
||||
|
||||
Success.propTypes = {
|
||||
successClicked: PropTypes.func.isRequired,
|
||||
illustrationImageUrl: PropTypes.string.isRequired,
|
||||
@@ -38,5 +53,18 @@ Success.propTypes = {
|
||||
mailpoetAccountUrl: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
SuccessContent.propTypes = {
|
||||
successClicked: PropTypes.func.isRequired,
|
||||
illustrationImageUrl: PropTypes.string.isRequired,
|
||||
MSSPitchIllustrationUrl: PropTypes.string.isRequired,
|
||||
newsletter: PropTypes.shape({
|
||||
status: PropTypes.string.isRequired,
|
||||
type: PropTypes.string.isRequired,
|
||||
}).isRequired,
|
||||
isWoocommerceActive: PropTypes.bool.isRequired,
|
||||
subscribersCount: PropTypes.number.isRequired,
|
||||
mailpoetAccountUrl: PropTypes.string.isRequired,
|
||||
isSupported: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default Success;
|
||||
|
@@ -1,10 +1,11 @@
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
export const getStepsCount = () => {
|
||||
let stepsCount = 3;
|
||||
if (window.is_woocommerce_active) {
|
||||
stepsCount += 1;
|
||||
}
|
||||
if (!window.has_premium_key) {
|
||||
if (!window.has_premium_key && MailPoet.FeaturesController.isSupported('display-mss-pitch')) {
|
||||
stepsCount += 1;
|
||||
}
|
||||
return stepsCount;
|
||||
|
Reference in New Issue
Block a user