Skip to content

Commit

Permalink
Remove/creator recommendation on dashboard (#40212)
Browse files Browse the repository at this point in the history
* Remove Creator recommendation from dashboard

* changelog

* Edit changelog

* Fix a few bugs

* Update copy of stats feature

* changelog
  • Loading branch information
CodeyGuyDylan authored Nov 21, 2024
1 parent 24a8e6b commit 48e0e23
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Just a copy change


2 changes: 1 addition & 1 deletion projects/packages/my-jetpack/src/products/class-growth.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function get_long_description() {
public static function get_features() {
return array(
_x( 'Jetpack Social', 'Growth Product Feature', 'jetpack-my-jetpack' ),
_x( 'Jetpack Stats (up to 100K site views)', 'Growth Product Feature', 'jetpack-my-jetpack' ),
_x( 'Jetpack Stats (100K site views, upgradeable)', 'Growth Product Feature', 'jetpack-my-jetpack' ),
_x( 'Unlimited subscriber imports', 'Growth Product Feature', 'jetpack-my-jetpack' ),
_x( 'Earn more from your content', 'Growth Product Feature', 'jetpack-my-jetpack' ),
_x( 'Accept payments with PayPal', 'Growth Product Feature', 'jetpack-my-jetpack' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
PLAN_JETPACK_VIDEOPRESS,
PLAN_JETPACK_ANTI_SPAM,
PLAN_JETPACK_BACKUP_T1_YEARLY,
PLAN_JETPACK_CREATOR_YEARLY,
PLAN_JETPACK_GROWTH_YEARLY,
} from 'lib/plans/constants';
import {
getSiteAdminUrl,
Expand Down Expand Up @@ -806,17 +806,16 @@ export const getProductCardData = ( state, productSlug ) => {
productCardList: products.security ? products.security.features : [],
productCardIcon: '/recommendations/cloud-icon.svg',
};
// Creator Plan
case PLAN_JETPACK_CREATOR_YEARLY:
// Growth Plan
case PLAN_JETPACK_GROWTH_YEARLY:
return {
productCardTitle: __( 'Grow and monetize your audience', 'jetpack' ),
productCardTitle: __( 'Grow and track your audience effortlessly', 'jetpack' ),
productCardCtaLink: getRedirectUrl( 'jetpack-recommendations-product-checkout', {
site: siteRawUrl,
path: productSlug,
} ),
productCardCtaText: __( 'Get Jetpack Creator', 'jetpack' ),
productCardList: products.creator ? products.creator.features : [],
productCardIcon: '/recommendations/creator-icon.svg',
productCardCtaText: __( 'Get Jetpack Growth', 'jetpack' ),
productCardList: products.growth ? products.growth.features : [],
};
case PLAN_JETPACK_ANTI_SPAM:
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const PromptLayoutComponent = props => {

PromptLayoutComponent.propTypes = {
answer: PropTypes.element.isRequired,
description: PropTypes.oneOfType( [ PropTypes.string, PropTypes.element ] ).isRequired,
description: PropTypes.oneOfType( [ PropTypes.string, PropTypes.element ] ),
illustration: PropTypes.string,
illustrationClassName: PropTypes.string,
progressBar: PropTypes.element,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ const ProductSpotlightComponent = props => {
<div className="jp-recommendations-discount-card__container">
<div className="jp-recommendations-discount-card__card">
<div className="jp-recommendations-discount-card__card-header">
<img
className="jp-recommendations-discount-card__header-icon"
src={ imagePath + productCardIcon }
alt=""
/>
{ productCardIcon && (
<img
className="jp-recommendations-discount-card__header-icon"
src={ imagePath + productCardIcon }
alt=""
/>
) }
</div>
<div className="jp-recommendations-discount-card__card-body">
<h3 className="jp-recommendations-discount-card__heading">{ productCardTitle }</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
PLAN_JETPACK_VIDEOPRESS,
PLAN_JETPACK_ANTI_SPAM,
PLAN_JETPACK_BACKUP_T1_YEARLY,
PLAN_JETPACK_CREATOR_YEARLY,
getPlanClass,
PLAN_JETPACK_GROWTH_YEARLY,
} from 'lib/plans/constants';
import { assign, difference, get, isArray, isEmpty, mergeWith, union } from 'lodash';
import {
Expand Down Expand Up @@ -65,7 +65,7 @@ import {
getSitePurchases,
hasActiveProductPurchase,
hasActiveSecurityPurchase,
hasActiveCreatorPurchase,
hasActiveGrowthPurchase,
siteHasFeature,
isFetchingSiteData,
hasActiveAntiSpamPurchase,
Expand Down Expand Up @@ -575,8 +575,8 @@ export const getProductSlugForStep = ( state, step ) => {
}
break;
case 'newsletter':
if ( ! hasActiveCreatorPurchase( state ) ) {
return PLAN_JETPACK_CREATOR_YEARLY;
if ( ! hasActiveGrowthPurchase( state ) ) {
return PLAN_JETPACK_GROWTH_YEARLY;
}
break;
case 'anti-spam':
Expand Down
26 changes: 26 additions & 0 deletions projects/plugins/jetpack/_inc/client/state/site/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isJetpackProduct,
isJetpackSearch,
isJetpackCreator,
isJetpackGrowth,
isJetpackSecurityBundle,
isJetpackAntiSpam,
isSecurityComparableJetpackLegacyPlan,
Expand Down Expand Up @@ -471,6 +472,18 @@ export function getActiveCreatorPurchase( state ) {
);
}

/**
* Searches active products for Growth product
*
* @param {object} state - Global state tree
* @return {object} An active Growth product if one was found, undefined otherwise.
*/
export function getActiveGrowthPurchase( state ) {
return find( getActiveProductPurchases( state ), product =>
isJetpackGrowth( product.product_slug )
);
}

/**
* Determines if the site has an active Creator product purchase
*
Expand All @@ -484,6 +497,19 @@ export function hasActiveCreatorPurchase( state ) {
);
}

/**
* Determines if the site has an active Growth product purchase
*
* @param {object} state - Global state tree
* @return {boolean} True if the site has an active Growth product purchase, false otherwise.
*/
export function hasActiveGrowthPurchase( state ) {
return (
!! getActiveGrowthPurchase( state ) ||
'is-complete-plan' === getPlanClass( getSitePlan( state ).product_slug )
);
}

/**
* Searches active products for an active Anti-Spam product.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Replace Creator recommendation with Growth in Dashboard
17 changes: 17 additions & 0 deletions projects/plugins/jetpack/class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5928,6 +5928,23 @@ public static function get_products_for_purchase( $show_legacy = false ) {
),
);

$products['growth'] = array(
'title' => __( 'Jetpack Growth', 'jetpack' ),
'slug' => 'jetpack_growth_yearly',
'description' => __( 'Essential tools to help you grow your audience, track visitor engagement, and turn leads into loyal customers and advocates.', 'jetpack' ),
'show_promotion' => true,
'discount_percent' => 50,
'included_in_plans' => array( 'complete' ),
'features' => array(
_x( 'Jetpack Social', 'Growth Product Feature', 'jetpack' ),
_x( 'Jetpack Stats (100K site views, upgradeable)', 'Growth Product Feature', 'jetpack' ),
_x( 'Unlimited subscriber imports', 'Growth Product Feature', 'jetpack' ),
_x( 'Earn more from your content', 'Growth Product Feature', 'jetpack' ),
_x( 'Accept payments with PayPal', 'Growth Product Feature', 'jetpack' ),
_x( 'Increase earnings with WordAds', 'Growth Product Feature', 'jetpack' ),
),
);

$products['scan'] = array(
'title' => __( 'Jetpack Scan', 'jetpack' ),
'slug' => 'jetpack_scan',
Expand Down

0 comments on commit 48e0e23

Please sign in to comment.