diff --git a/projects/js-packages/publicize-components/index.ts b/projects/js-packages/publicize-components/index.ts index 2cac7bb3fb79c..06748d4548053 100644 --- a/projects/js-packages/publicize-components/index.ts +++ b/projects/js-packages/publicize-components/index.ts @@ -17,7 +17,6 @@ export { default as TemplatePickerButton } from './src/components/social-image-g export { default as PublicizePanel } from './src/components/panel'; export { default as ReviewPrompt } from './src/components/review-prompt'; export { default as PostPublishPanels } from './src/components/post-publish-panels'; -export { default as RefreshJetpackSocialSettingsWrapper } from './src/components/refresh-jetpack-social-settings'; export { default as ConnectionManagement } from './src/components/connection-management'; export { default as useSocialMediaConnections } from './src/hooks/use-social-media-connections'; diff --git a/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js b/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js deleted file mode 100644 index 16726c614650b..0000000000000 --- a/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import { useDispatch } from '@wordpress/data'; -import { SOCIAL_STORE_ID } from '../../social-store'; - -/** - * HOC that refreshes all of the Jetpack Social settings in the store, to be used in class components. - * - * @param {object} props - The component props. - * @param {boolean} props.shouldRefresh - Whether or not to refresh the settings. - * @param {object} props.children - The children to render. - * @return { object } The refreshJetpackSocialSettings function. - */ -export default function RefreshJetpackSocialSettingsWrapper( { shouldRefresh, children } ) { - const refreshOptions = useDispatch( SOCIAL_STORE_ID ).refreshJetpackSocialSettings; - - if ( shouldRefresh ) { - refreshOptions(); - } - - return children; -} diff --git a/projects/js-packages/publicize-components/src/social-store/actions/index.js b/projects/js-packages/publicize-components/src/social-store/actions/index.js index 0176bc4a45f58..79d3c41f1926c 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/index.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/index.js @@ -1,13 +1,11 @@ import * as connectionData from './connection-data'; import siteSettingActions from './jetpack-settings'; -import jetpackSocialSettings from './jetpack-social-settings'; import * as shareStatus from './share-status'; import socialNotesSettings from './social-notes-settings'; const actions = { ...shareStatus, ...siteSettingActions, - ...jetpackSocialSettings, ...connectionData, ...socialNotesSettings, }; diff --git a/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js b/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js deleted file mode 100644 index 6b0b7e727b8f7..0000000000000 --- a/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Yield actions to refresh all of the Jetpack Social registered settings. - * - * @return {object} - an action object. - */ -export function refreshJetpackSocialSettings() { - return async function ( { dispatch } ) { - await dispatch.fetchSocialImageGeneratorConfig(); - }; -} - -export default { - refreshJetpackSocialSettings, -}; diff --git a/projects/plugins/jetpack/_inc/client/sharing/publicize.jsx b/projects/plugins/jetpack/_inc/client/sharing/publicize.jsx index 75770e57ed1be..38863f5c6fde8 100644 --- a/projects/plugins/jetpack/_inc/client/sharing/publicize.jsx +++ b/projects/plugins/jetpack/_inc/client/sharing/publicize.jsx @@ -1,9 +1,5 @@ import { getRedirectUrl } from '@automattic/jetpack-components'; -import { - ConnectionManagement, - RefreshJetpackSocialSettingsWrapper, - features, -} from '@automattic/jetpack-publicize-components'; +import { ConnectionManagement, features } from '@automattic/jetpack-publicize-components'; import { siteHasFeature } from '@automattic/jetpack-script-data'; import { createInterpolateElement } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; @@ -151,21 +147,17 @@ export const Publicize = withModuleSettingsFormHelpers( { __( 'Automatically share your posts to social networks', 'jetpack' ) } - - { shouldShowChildElements && hasSocialImageGenerator && ( - - ) } - { isActive && - isLinked && - useAdminUiV1 && - ! this.props.isSavingAnyOption( 'publicize' ) ? ( - - - - ) : null } - + { shouldShowChildElements && hasSocialImageGenerator && ( + + ) } + { isActive && + isLinked && + useAdminUiV1 && + ! this.props.isSavingAnyOption( 'publicize' ) ? ( + + + + ) : null } ) } { isActive && ! useAdminUiV1 && configCard() } diff --git a/projects/plugins/social/src/js/components/admin-page/index.jsx b/projects/plugins/social/src/js/components/admin-page/index.jsx index 466fd6342cda9..070053d2b2ed5 100644 --- a/projects/plugins/social/src/js/components/admin-page/index.jsx +++ b/projects/plugins/social/src/js/components/admin-page/index.jsx @@ -13,8 +13,8 @@ import { features, } from '@automattic/jetpack-publicize-components'; import { siteHasFeature } from '@automattic/jetpack-script-data'; -import { useSelect, useDispatch } from '@wordpress/data'; -import { useState, useCallback, useEffect, useRef } from '@wordpress/element'; +import { useSelect } from '@wordpress/data'; +import { useState, useCallback } from '@wordpress/element'; import React from 'react'; import PricingPage from '../pricing-page'; import SocialImageGeneratorToggle from '../social-image-generator-toggle'; @@ -32,8 +32,6 @@ const Admin = () => { const showConnectionCard = ! isRegistered || ! isUserConnected; const [ forceDisplayPricingPage, setForceDisplayPricingPage ] = useState( false ); - const refreshJetpackSocialSettings = useDispatch( socialStore ).refreshJetpackSocialSettings; - const onPricingPageDismiss = useCallback( () => setForceDisplayPricingPage( false ), [] ); const { isModuleEnabled, showPricingPage, pluginVersion, isUpdatingJetpackSettings } = useSelect( @@ -48,19 +46,6 @@ const Admin = () => { } ); - const hasEnabledModule = useRef( isModuleEnabled ); - - useEffect( () => { - if ( - isModuleEnabled && - ! hasEnabledModule.current && - siteHasFeature( features.IMAGE_GENERATOR ) - ) { - hasEnabledModule.current = true; - refreshJetpackSocialSettings(); - } - }, [ isModuleEnabled, refreshJetpackSocialSettings ] ); - const moduleName = `Jetpack Social ${ pluginVersion }`; if ( showConnectionCard ) {