From 0728499e74d33ca402421fcffd836fa452d7e875 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gergely=20M=C3=A1rk=20Juh=C3=A1sz?=
<36671565+gmjuhasz@users.noreply.github.com>
Date: Thu, 22 Aug 2024 15:16:41 +0200
Subject: [PATCH] Social: Add share status feature flag (#39015)
* Add feature flag
* changelog
* Fixup versions
---
.../add-social-share-status-feature-flag | 4 ++++
.../js-packages/publicize-components/package.json | 2 +-
.../src/components/panel/index.jsx | 15 ++++++++++++++-
.../post-publish-manual-sharing/index.jsx | 9 +++++++++
.../add-social-share-status-feature-flag | 4 ++++
projects/packages/publicize/composer.json | 2 +-
projects/packages/publicize/package.json | 2 +-
.../jetpack-social-settings/class-settings.php | 5 +++++
.../add-social-share-status-feature-flag | 5 +++++
projects/plugins/jetpack/composer.lock | 4 ++--
.../add-social-share-status-feature-flag | 5 +++++
projects/plugins/social/composer.lock | 4 ++--
12 files changed, 53 insertions(+), 8 deletions(-)
create mode 100644 projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag
create mode 100644 projects/packages/publicize/changelog/add-social-share-status-feature-flag
create mode 100644 projects/plugins/jetpack/changelog/add-social-share-status-feature-flag
create mode 100644 projects/plugins/social/changelog/add-social-share-status-feature-flag
diff --git a/projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag b/projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag
new file mode 100644
index 0000000000000..b7fe45d10716a
--- /dev/null
+++ b/projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag
@@ -0,0 +1,4 @@
+Significance: minor
+Type: added
+
+Added the new feature flag for the social share status
diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json
index 02d42a3d48542..7d8aa9c16e324 100644
--- a/projects/js-packages/publicize-components/package.json
+++ b/projects/js-packages/publicize-components/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-publicize-components",
- "version": "0.62.1-alpha",
+ "version": "0.63.0-alpha",
"description": "A library of JS components required by the Publicize editor plugin",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/publicize-components/#readme",
"bugs": {
diff --git a/projects/js-packages/publicize-components/src/components/panel/index.jsx b/projects/js-packages/publicize-components/src/components/panel/index.jsx
index c96cff189deb1..d9d348228bb38 100644
--- a/projects/js-packages/publicize-components/src/components/panel/index.jsx
+++ b/projects/js-packages/publicize-components/src/components/panel/index.jsx
@@ -12,6 +12,7 @@ import usePublicizeConfig from '../../hooks/use-publicize-config';
import useRefreshConnections from '../../hooks/use-refresh-connections';
import { usePostJustPublished } from '../../hooks/use-saving-post';
import useSelectSocialMediaConnections from '../../hooks/use-social-media-connections';
+import { store as socialStore } from '../../social-store';
import PublicizeForm from '../form';
import { ManualSharing } from '../manual-sharing';
import { SharePostRow } from '../share-post';
@@ -25,6 +26,13 @@ const PublicizePanel = ( { prePublish, children } ) => {
const { isPublicizeEnabled, hidePublicizeFeature, togglePublicizeFeature } = usePublicizeConfig();
+ const { featureFlags } = useSelect( select => {
+ const store = select( socialStore );
+ return {
+ featureFlags: store.featureFlags(),
+ };
+ }, [] );
+
// Refresh connections when the post is just published.
usePostJustPublished(
function () {
@@ -71,7 +79,12 @@ const PublicizePanel = ( { prePublish, children } ) => {
) }
- { isPostPublished && }
+ { isPostPublished && (
+ <>
+
+ { featureFlags?.useShareStatus && 'Share status modal comes here' }
+ >
+ ) }
);
};
diff --git a/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx b/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx
index 15212154fd7a8..cc9d57440d7e0 100644
--- a/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx
+++ b/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx
@@ -4,6 +4,7 @@ import { useSelect } from '@wordpress/data';
import { PluginPostPublishPanel } from '@wordpress/edit-post';
import { store as editorStore } from '@wordpress/editor';
import { __ } from '@wordpress/i18n';
+import { store as socialStore } from '../../social-store';
import { ManualSharingInfo } from '../manual-sharing/info';
import { ShareButtons } from '../share-buttons/share-buttons';
import styles from './styles.module.scss';
@@ -15,6 +16,13 @@ import styles from './styles.module.scss';
export default function PostPublishManualSharing() {
const { isCurrentPostPublished } = useSelect( select => select( editorStore ), [] );
+ const { featureFlags } = useSelect( select => {
+ const store = select( socialStore );
+ return {
+ featureFlags: store.featureFlags(),
+ };
+ }, [] );
+
if ( ! isCurrentPostPublished() ) {
return null;
}
@@ -29,6 +37,7 @@ export default function PostPublishManualSharing() {
+ { featureFlags?.useShareStatus && 'Share status modal comes here' }
);
diff --git a/projects/packages/publicize/changelog/add-social-share-status-feature-flag b/projects/packages/publicize/changelog/add-social-share-status-feature-flag
new file mode 100644
index 0000000000000..b7fe45d10716a
--- /dev/null
+++ b/projects/packages/publicize/changelog/add-social-share-status-feature-flag
@@ -0,0 +1,4 @@
+Significance: minor
+Type: added
+
+Added the new feature flag for the social share status
diff --git a/projects/packages/publicize/composer.json b/projects/packages/publicize/composer.json
index fe6097cc13fca..326578c1a8e53 100644
--- a/projects/packages/publicize/composer.json
+++ b/projects/packages/publicize/composer.json
@@ -68,7 +68,7 @@
"link-template": "https://github.com/Automattic/jetpack-publicize/compare/v${old}...v${new}"
},
"branch-alias": {
- "dev-trunk": "0.49.x-dev"
+ "dev-trunk": "0.50.x-dev"
}
},
"config": {
diff --git a/projects/packages/publicize/package.json b/projects/packages/publicize/package.json
index 9a19f906db2f4..200674f4d81d6 100644
--- a/projects/packages/publicize/package.json
+++ b/projects/packages/publicize/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-publicize",
- "version": "0.49.3-alpha",
+ "version": "0.50.0-alpha",
"description": "Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/publicize/#readme",
"bugs": {
diff --git a/projects/packages/publicize/src/jetpack-social-settings/class-settings.php b/projects/packages/publicize/src/jetpack-social-settings/class-settings.php
index 800de227aae1b..c6ede04471f17 100644
--- a/projects/packages/publicize/src/jetpack-social-settings/class-settings.php
+++ b/projects/packages/publicize/src/jetpack-social-settings/class-settings.php
@@ -52,6 +52,11 @@ class Settings {
'feature_name' => 'editor-preview',
'variable_name' => 'useEditorPreview',
),
+ array(
+ 'flag_name' => 'share_status',
+ 'feature_name' => 'share-status',
+ 'variable_name' => 'useShareStatus',
+ ),
);
/**
diff --git a/projects/plugins/jetpack/changelog/add-social-share-status-feature-flag b/projects/plugins/jetpack/changelog/add-social-share-status-feature-flag
new file mode 100644
index 0000000000000..a1c1831fa1ef7
--- /dev/null
+++ b/projects/plugins/jetpack/changelog/add-social-share-status-feature-flag
@@ -0,0 +1,5 @@
+Significance: patch
+Type: other
+Comment: Updated composer.lock.
+
+
diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock
index fec67ac330acd..ac8274133911e 100644
--- a/projects/plugins/jetpack/composer.lock
+++ b/projects/plugins/jetpack/composer.lock
@@ -2222,7 +2222,7 @@
"dist": {
"type": "path",
"url": "../../packages/publicize",
- "reference": "da20bd94a839a28d9d718d79246f35edf5e33567"
+ "reference": "a93a6a56a70e7f1aa7fc965efaecd0000804f0f4"
},
"require": {
"automattic/jetpack-assets": "@dev",
@@ -2250,7 +2250,7 @@
"link-template": "https://github.com/Automattic/jetpack-publicize/compare/v${old}...v${new}"
},
"branch-alias": {
- "dev-trunk": "0.49.x-dev"
+ "dev-trunk": "0.50.x-dev"
}
},
"autoload": {
diff --git a/projects/plugins/social/changelog/add-social-share-status-feature-flag b/projects/plugins/social/changelog/add-social-share-status-feature-flag
new file mode 100644
index 0000000000000..9aa70e3ec1f75
--- /dev/null
+++ b/projects/plugins/social/changelog/add-social-share-status-feature-flag
@@ -0,0 +1,5 @@
+Significance: patch
+Type: changed
+Comment: Updated composer.lock.
+
+
diff --git a/projects/plugins/social/composer.lock b/projects/plugins/social/composer.lock
index 2f97cd948c205..0a8f9cdfec08a 100644
--- a/projects/plugins/social/composer.lock
+++ b/projects/plugins/social/composer.lock
@@ -1494,7 +1494,7 @@
"dist": {
"type": "path",
"url": "../../packages/publicize",
- "reference": "da20bd94a839a28d9d718d79246f35edf5e33567"
+ "reference": "a93a6a56a70e7f1aa7fc965efaecd0000804f0f4"
},
"require": {
"automattic/jetpack-assets": "@dev",
@@ -1522,7 +1522,7 @@
"link-template": "https://github.com/Automattic/jetpack-publicize/compare/v${old}...v${new}"
},
"branch-alias": {
- "dev-trunk": "0.49.x-dev"
+ "dev-trunk": "0.50.x-dev"
}
},
"autoload": {