Skip to content

Commit

Permalink
Initial State: Nuke hasPaidPlan flag
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Oct 21, 2024
1 parent cc5911c commit 077a9b0
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Initial state: Removed unused hasPaidPlan flag


Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ export default function usePublicizeConfig() {
*/
const hidePublicizeFeature = isPostPublished && ! isRePublicizeFeatureAvailable;

/**
* hasPaidPlan:
* Whether the site has a paid plan. This could be either the Basic or the Advanced plan.
*/
const hasPaidPlan = !! getJetpackData()?.social?.hasPaidPlan;

/**
* isEnhancedPublishingEnabled:
* Whether the site has the enhanced publishing feature enabled. If true, it means that
Expand All @@ -109,7 +103,6 @@ export default function usePublicizeConfig() {
isRePublicizeUpgradableViaUpsell,
hidePublicizeFeature,
isPostAlreadyShared,
hasPaidPlan,
isEnhancedPublishingEnabled,
isSocialImageGeneratorAvailable:
!! getJetpackData()?.social?.isSocialImageGeneratorAvailable && ! isJetpackSocialNote,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const reducer = combineReducers( {
jetpackSettings,
socialImageGeneratorSettings,
shareStatus,
hasPaidPlan: ( state = false ) => state,
hasPaidFeatures: ( state = false ) => state,
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const jetpackSettingSelectors = {
isModuleEnabled: state => state.jetpackSettings.publicize_active,
showPricingPage: state => state.jetpackSettings.show_pricing_page,
isUpdatingJetpackSettings: state => state.jetpackSettings.is_updating,
hasPaidPlan: state => ! ( state.jetpackSettings?.showNudge ?? true ),
isEnhancedPublishingEnabled: state => state.jetpackSettings?.isEnhancedPublishingEnabled ?? false,
getDismissedNotices: state => state.jetpackSettings?.dismissedNotices,
isSocialNotesEnabled: state => state.jetpackSettings?.social_notes_enabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export type ShareStatus = {
// TODO we should have a consistent structure across all the pages - editor, dashboard, admin page etc.
export type SocialStoreState = {
connectionData: ConnectionData;
// on post editor
hasPaidPlan?: boolean;
// on Jetack Social admin page
jetpackSettings?: JetpackSettings;
shareStatus?: ShareStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type JetpackSettingsSelectors = {
isModuleEnabled: () => boolean;
showPricingPage: () => boolean;
isUpdatingJetpackSettings: () => boolean;
hasPaidPlan: () => boolean;
};

type ConnectionDataSelectors = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Initial state: Removed unused hasPaidPlan flag


Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe( 'load the app', () => {
let storeSelect;
renderHook( () => useSelect( select => ( storeSelect = select( SOCIAL_STORE_ID ) ) ) );
jest.spyOn( storeSelect, 'showPricingPage' ).mockReset().mockReturnValue( true );
jest.spyOn( storeSelect, 'hasPaidPlan' ).mockReset().mockReturnValue( true );
jest.spyOn( storeSelect, 'getPluginVersion' ).mockReset().mockReturnValue( version );
render( <Admin /> );
expect( screen.getByText( `Jetpack Social ${ version }` ) ).toBeInTheDocument();
Expand Down
1 change: 0 additions & 1 deletion projects/plugins/social/src/js/components/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type JetpackSettingsSelectors = {
isModuleEnabled: () => boolean;
showPricingPage: () => boolean;
isUpdatingJetpackSettings: () => boolean;
hasPaidPlan: () => boolean;
hasPaidFeatures: () => boolean;
};

Expand Down

0 comments on commit 077a9b0

Please sign in to comment.