Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social | Initial State: Get rid of unused hasPaidPlan flag #39839

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading