Skip to content

Commit

Permalink
Revert "Customize Woo Express and free trial themes screen (#78570)"
Browse files Browse the repository at this point in the history
This reverts commit be324ec.
  • Loading branch information
ilyasfoo committed Jun 28, 2023
1 parent cc9692c commit cd807dc
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 83 deletions.
12 changes: 2 additions & 10 deletions client/blocks/upsell-nudge/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ import isSiteAutomatedTransfer from 'calypso/state/selectors/is-site-automated-t
import isSiteWPForTeams from 'calypso/state/selectors/is-site-wpforteams';
import isVipSite from 'calypso/state/selectors/is-vip-site';
import siteHasFeature from 'calypso/state/selectors/site-has-feature';
import {
getCurrentPlan,
isSiteOnECommerceTrial,
isSiteOnWooExpress,
} from 'calypso/state/sites/plans/selectors';
import { getCurrentPlan } from 'calypso/state/sites/plans/selectors';
import { getSite, isJetpackSite } from 'calypso/state/sites/selectors';
import { getSelectedSiteId, getSelectedSiteSlug } from 'calypso/state/ui/selectors';

Expand Down Expand Up @@ -79,7 +75,6 @@ export const UpsellNudge = ( {
tracksImpressionName,
tracksImpressionProperties,
displayAsLink,
isSiteWooExpressOrEcomFreeTrial,
} ) => {
const shouldNotDisplay =
isVip ||
Expand Down Expand Up @@ -118,8 +113,7 @@ export const UpsellNudge = ( {
{ 'is-upgrade-business': plan && isBusinessPlan( plan ) },
{ 'is-upgrade-ecommerce': plan && isEcommercePlan( plan ) },
{ 'is-jetpack-plan': plan && planMatches( plan, { group: GROUP_JETPACK } ) },
{ 'is-wpcom-plan': plan && planMatches( plan, { group: GROUP_WPCOM } ) },
{ 'is-wooexpress-or-free-trial-plan': isSiteWooExpressOrEcomFreeTrial }
{ 'is-wpcom-plan': plan && planMatches( plan, { group: GROUP_WPCOM } ) }
);

if ( dismissPreferenceName && forceHref && href ) {
Expand Down Expand Up @@ -182,8 +176,6 @@ export default connect( ( state, ownProps ) => {
isJetpack: isJetpackSite( state, siteId ),
isAtomic: isSiteAutomatedTransfer( state, siteId ),
isVip: isVipSite( state, siteId ),
isSiteWooExpressOrEcomFreeTrial:
isSiteOnECommerceTrial( state, siteId ) || isSiteOnWooExpress( state, siteId ),
currentPlan: getCurrentPlan( state, siteId ),
siteSlug: ownProps.disableHref ? null : getSelectedSiteSlug( state ),
canUserUpgrade: canCurrentUser( state, getSelectedSiteId( state ), 'manage_options' ),
Expand Down
48 changes: 12 additions & 36 deletions client/my-sites/themes/theme-showcase.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { isUserLoggedIn } from 'calypso/state/current-user/selectors';
import getSiteFeaturesById from 'calypso/state/selectors/get-site-features';
import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer';
import siteHasFeature from 'calypso/state/selectors/site-has-feature';
import { isSiteOnWooExpress, isSiteOnECommerceTrial } from 'calypso/state/sites/plans/selectors';
import { getSiteSlug } from 'calypso/state/sites/selectors';
import { setBackPath } from 'calypso/state/themes/actions';
import {
Expand Down Expand Up @@ -376,27 +375,14 @@ class ThemeShowcase extends Component {
};

renderBanner = () => {
const {
loggedOutComponent,
isExpertBannerDissmissed,
upsellBanner,
isUpsellCardDisplayed,
isSiteECommerceFreeTrial,
} = this.props;
const { loggedOutComponent, isExpertBannerDissmissed, upsellBanner, isUpsellCardDisplayed } =
this.props;

// Don't show the banner if there is already an upsell card displayed
if ( isUpsellCardDisplayed ) {
return null;
}

// In ecommerce trial sites, we only want to show upsell banner.
if ( isSiteECommerceFreeTrial ) {
if ( upsellBanner ) {
return upsellBanner;
}
return null;
}

const tabKey = this.state.tabFilter.key;

const staticFilters = this.getStaticFilters();
Expand Down Expand Up @@ -447,11 +433,8 @@ class ThemeShowcase extends Component {
isMultisite,
locale,
premiumThemesEnabled,
isSiteECommerceFreeTrial,
isSiteWooExpress,
} = this.props;
const tier = this.props.tier || '';
const isSiteWooExpressOrEcomFreeTrial = isSiteECommerceFreeTrial || isSiteWooExpress;

const canonicalUrl = 'https://wordpress.com' + pathName;

Expand Down Expand Up @@ -553,9 +536,6 @@ class ThemeShowcase extends Component {
</ThemesHeader>
<div className="themes__content" ref={ this.scrollRef }>
<QueryThemeFilters />
{ isSiteWooExpressOrEcomFreeTrial && (
<div className="themes__showcase">{ this.renderBanner() }</div>
) }
<div className="themes__controls">
<SearchThemes
query={ filterString + search }
Expand All @@ -564,17 +544,15 @@ class ThemeShowcase extends Component {
/>
{ tabFilters && (
<div className="theme__filters">
{ ! isSiteWooExpressOrEcomFreeTrial && (
<ThemesToolbarGroup
items={ Object.values( tabFilters ) }
selectedKey={ this.state.tabFilter.key }
onSelect={ ( key ) =>
this.onFilterClick(
Object.values( tabFilters ).find( ( tabFilter ) => tabFilter.key === key )
)
}
/>
) }
<ThemesToolbarGroup
items={ Object.values( tabFilters ) }
selectedKey={ this.state.tabFilter.key }
onSelect={ ( key ) =>
this.onFilterClick(
Object.values( tabFilters ).find( ( tabFilter ) => tabFilter.key === key )
)
}
/>
{ premiumThemesEnabled && ! isMultisite && (
<SimplifiedSegmentedControl
key={ tier }
Expand All @@ -587,7 +565,7 @@ class ThemeShowcase extends Component {
) }
</div>
<div className="themes__showcase">
{ ! isSiteWooExpressOrEcomFreeTrial && this.renderBanner() }
{ this.renderBanner() }
{ this.renderThemes( themeProps ) }
</div>
{ siteId && <QuerySitePlans siteId={ siteId } /> }
Expand Down Expand Up @@ -619,8 +597,6 @@ const mapStateToProps = ( state, { siteId, filter, tier, vertical } ) => {
filterToTermTable: getThemeFilterToTermTable( state ),
themesBookmark: getThemesBookmark( state ),
isUpsellCardDisplayed: isUpsellCardDisplayedSelector( state ),
isSiteECommerceFreeTrial: isSiteOnECommerceTrial( state, siteId ),
isSiteWooExpress: isSiteOnWooExpress( state, siteId ),
};
};

Expand Down
4 changes: 0 additions & 4 deletions client/my-sites/themes/theme-showcase.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@
padding: 24px 30px;
border-radius: 4px;

&.is-wooexpress-or-free-trial-plan {
margin-bottom: 32px;
}

&.is-dismissible {
.dismissible-card__close-button {
height: 16px;
Expand Down
4 changes: 1 addition & 3 deletions client/my-sites/themes/themes-selection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
isInstallingTheme,
prependThemeFilterKeys,
} from 'calypso/state/themes/selectors';
import { getThemeHiddenFilters } from 'calypso/state/themes/selectors/get-theme-hidden-filters';
import { addStyleVariation, trackClick, interlaceThemes } from './helpers';
import SearchThemesTracks from './search-themes-tracks';
import './themes-selection.scss';
Expand Down Expand Up @@ -314,7 +313,6 @@ export const ConnectedThemesSelection = connect(
const isJetpack = isJetpackSite( state, siteId );
const isAtomic = isSiteAutomatedTransfer( state, siteId );
const premiumThemesEnabled = arePremiumThemesEnabled( state, siteId );
const hiddenFilters = getThemeHiddenFilters( state, siteId );
const hasUnlimitedPremiumThemes = siteHasFeature(
state,
siteId,
Expand Down Expand Up @@ -342,7 +340,7 @@ export const ConnectedThemesSelection = connect(
search,
page,
tier: premiumThemesEnabled ? tier : 'free',
filter: compact( [ filter, vertical ] ).concat( hiddenFilters ).join( ',' ),
filter: compact( [ filter, vertical ] ).join( ',' ),
number,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PLAN_ECOMMERCE_TRIAL_MONTHLY } from '@automattic/calypso-products';
import { getSite } from 'calypso/state/sites/selectors';
import { getCurrentPlan } from '.';
import type { AppState } from 'calypso/types';

Expand All @@ -12,8 +11,10 @@ import type { AppState } from 'calypso/types';
*/
export default function isSiteOnECommerceTrial( state: AppState, siteId: number ) {
const currentPlan = getCurrentPlan( state, siteId );
const site = getSite( state, siteId );
const productSlug = currentPlan?.productSlug || site?.plan?.product_slug;

return productSlug === PLAN_ECOMMERCE_TRIAL_MONTHLY;
if ( ! currentPlan ) {
return false;
}

return currentPlan.productSlug === PLAN_ECOMMERCE_TRIAL_MONTHLY;
}
8 changes: 2 additions & 6 deletions client/state/sites/plans/selectors/is-site-on-woo-express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
PLAN_WOOEXPRESS_SMALL,
PLAN_WOOEXPRESS_SMALL_MONTHLY,
} from '@automattic/calypso-products';
import { getSite } from 'calypso/state/sites/selectors';
import { getCurrentPlan } from '.';
import type { AppState } from 'calypso/types';

Expand All @@ -17,19 +16,16 @@ import type { AppState } from 'calypso/types';
*/
export default function isSiteOnWooExpress( state: AppState, siteId: number ) {
const currentPlan = getCurrentPlan( state, siteId );
const site = getSite( state, siteId );
const wooExpressPlans = [
PLAN_WOOEXPRESS_MEDIUM,
PLAN_WOOEXPRESS_SMALL,
PLAN_WOOEXPRESS_MEDIUM_MONTHLY,
PLAN_WOOEXPRESS_SMALL_MONTHLY,
];

const productSlug = currentPlan?.productSlug || site?.plan?.product_slug;

if ( ! productSlug ) {
if ( ! currentPlan ) {
return false;
}

return wooExpressPlans.includes( productSlug );
return wooExpressPlans.includes( currentPlan.productSlug );
}
18 changes: 0 additions & 18 deletions client/state/themes/selectors/get-theme-hidden-filters.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'calypso/state/themes/init';

import { getTheme, isExternallyManagedTheme } from '.';
import { getTheme, doesThemeBundleSoftwareSet, isExternallyManagedTheme } from '.';

/**
* Returns whether it should redirect to thank you page
Expand All @@ -11,7 +11,8 @@ import { getTheme, isExternallyManagedTheme } from '.';
* @returns {boolean}
*/
export function shouldRedirectToThankYouPage( state, themeId ) {
const isWooTheme = doesThemeBundleSoftwareSet( state, themeId );
const isDotComTheme = !! getTheme( state, 'wpcom', themeId );
const isExternallyManaged = isExternallyManagedTheme( state, themeId );
return isDotComTheme && ! isExternallyManaged;
return isDotComTheme && ! isWooTheme && ! isExternallyManaged;
}

0 comments on commit cd807dc

Please sign in to comment.