Skip to content

Commit

Permalink
Initial State: Nuke hasPaidPlan flag (#39839)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk authored Oct 24, 2024
1 parent cf5f21b commit 2431e96
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;

/**\
* Returns true if the post type is a Jetpack Social Note.
*/
Expand All @@ -102,7 +96,6 @@ export default function usePublicizeConfig() {
isRePublicizeUpgradableViaUpsell,
hidePublicizeFeature,
isPostAlreadyShared,
hasPaidPlan,
isSocialImageGeneratorAvailable:
!! getJetpackData()?.social?.isSocialImageGeneratorAvailable && ! isJetpackSocialNote,
isSocialImageGeneratorEnabled: !! getJetpackData()?.social?.isSocialImageGeneratorEnabled,
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,
} );

export default reducer;
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 ),
getDismissedNotices: state => state.jetpackSettings?.dismissedNotices,
isSocialNotesEnabled: state => state.jetpackSettings?.social_notes_enabled,
isSocialNotesSettingsUpdating: state => state.jetpackSettings?.social_notes_is_updating,
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;
};

type ConnectionDataSelectors = {
Expand Down

0 comments on commit 2431e96

Please sign in to comment.