diff --git a/.github/files/generate-ci-matrix.php b/.github/files/generate-ci-matrix.php index 4688293fb60bb..15026f8b28d93 100755 --- a/.github/files/generate-ci-matrix.php +++ b/.github/files/generate-ci-matrix.php @@ -26,6 +26,9 @@ // {string} Name for the job. Required, and must be unique. 'name' => null, + // {string} Runner name as found in https://github.com/actions/runner-images/. + 'runner' => 'ubuntu-latest', + // {string} Composer script for the job. Required. 'script' => null, @@ -68,9 +71,10 @@ ); } -// TODO: When WordPress 6.5 is no longer supported, this can be removed. +// TODO: When WordPress 6.5 is no longer supported, this can be removed. Runs too slow on ubuntu-24.04 (ubuntu-latest). $matrix[] = array( 'name' => 'PHP tests: PHP 7.0 WP previous', + 'runner' => 'ubuntu-22.04', 'script' => 'test-php', 'php' => '7.0', 'wp' => 'previous', diff --git a/.github/workflows/block-performance.yml b/.github/workflows/block-performance.yml index 33d61eeba7658..f8fe67cfe3316 100644 --- a/.github/workflows/block-performance.yml +++ b/.github/workflows/block-performance.yml @@ -36,7 +36,7 @@ jobs: npx playwright install chromium --with-deps npm run build:packages - - name: Setup tools for J + - name: Setup tools for Jetpack uses: ./.github/actions/tool-setup - name: Build Production Jetpack diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index caef4109236b8..65015806bd992 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: run-tests: name: ${{ matrix.name }} - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} needs: create-matrix services: database: diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65d00d631cbc9..d20a403bb87c6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4240,9 +4240,6 @@ importers: clsx: specifier: 2.1.1 version: 2.1.1 - diff: - specifier: ^4.0.2 - version: 4.0.2 moment: specifier: 2.29.4 version: 2.29.4 @@ -4327,6 +4324,9 @@ importers: '@automattic/jetpack-publicize-components': specifier: workspace:* version: link:../../js-packages/publicize-components + '@automattic/jetpack-script-data': + specifier: workspace:* + version: link:../../js-packages/script-data '@automattic/jetpack-shared-extension-utils': specifier: workspace:* version: link:../../js-packages/shared-extension-utils @@ -4759,6 +4759,9 @@ importers: '@slack/web-api': specifier: 7.3.2 version: 7.3.2 + '@types/lodash-es': + specifier: 4.17.12 + version: 4.17.12 allure-playwright: specifier: 2.9.2 version: 2.9.2 @@ -4774,7 +4777,7 @@ importers: localtunnel: specifier: 2.0.2 version: 2.0.2 - lodash: + lodash-es: specifier: 4.17.21 version: 4.17.21 node-fetch: @@ -7374,6 +7377,9 @@ packages: '@types/linkify-it@5.0.0': resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==} + '@types/lodash-es@4.17.12': + resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} + '@types/lodash@4.17.10': resolution: {integrity: sha512-YpS0zzoduEhuOWjAotS6A5AVCva7X4lVlYLF0FYHAY9sdraBfnatttHItlWeZdGhuEkf+OzMNg2ZYAx8t+52uQ==} @@ -11080,6 +11086,9 @@ packages: resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + lodash-es@4.17.21: + resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + lodash._baseiteratee@4.7.0: resolution: {integrity: sha512-nqB9M+wITz0BX/Q2xg6fQ8mLkyfF7MU7eE+MNBNjTHFKeKaZAPEzEg+E8LWxKWf1DQVflNEn9N49yAuqKh2mWQ==} @@ -17309,6 +17318,10 @@ snapshots: '@types/linkify-it@5.0.0': {} + '@types/lodash-es@4.17.12': + dependencies: + '@types/lodash': 4.17.10 + '@types/lodash@4.17.10': {} '@types/markdown-it@14.1.2': @@ -23299,6 +23312,8 @@ snapshots: dependencies: p-locate: 6.0.0 + lodash-es@4.17.21: {} + lodash._baseiteratee@4.7.0: dependencies: lodash._stringtopath: 4.8.0 diff --git a/projects/js-packages/ai-client/CHANGELOG.md b/projects/js-packages/ai-client/CHANGELOG.md index 68b9c5d015438..99bcab06d2685 100644 --- a/projects/js-packages/ai-client/CHANGELOG.md +++ b/projects/js-packages/ai-client/CHANGELOG.md @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.22.0] - 2024-10-21 +### Changed +- AI Client: Add types for AI assistant feature payload data branch featuresControl. [#39826] + +## [0.21.0] - 2024-10-14 +### Added +- AI Client: Add image styles 'auto' and 'none' to the logo generator. Order styles so those are on top in the dropdown selector. [#39689] +- AI Client: Add prompt processing and style guess function for logo generator [#39712] + +### Changed +- AI Client: Change plans limit to use and accept new 3000 value. [#39705] +- AI Client: Change upgrade copy edit and redirect URL. [#39671] +- AI Client: If site details show empty or default, do not trigger a logo generation, use empty placeholders. [#39536] +- AI Client: Remove provision of image styles via flag prop and internal definition, take it from ai-assistant-feature payload now. [#39589] +- Updated package dependencies. [#39669] [#39707] + ## [0.20.1] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -423,6 +439,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. [#31659] - Updated package dependencies. [#31785] +[0.22.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.21.0...v0.22.0 +[0.21.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.20.1...v0.21.0 [0.20.1]: https://github.com/Automattic/jetpack-ai-client/compare/v0.20.0...v0.20.1 [0.20.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.19.0...v0.20.0 [0.19.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.18.1...v0.19.0 diff --git a/projects/js-packages/ai-client/changelog/add-jetpack-ai-image-styles-auto-none b/projects/js-packages/ai-client/changelog/add-jetpack-ai-image-styles-auto-none deleted file mode 100644 index 3986f9d6a5687..0000000000000 --- a/projects/js-packages/ai-client/changelog/add-jetpack-ai-image-styles-auto-none +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -AI Client - Logo generator: add image styles 'auto' and 'none'. Order styles so those are on top in the dropdown selector diff --git a/projects/js-packages/ai-client/changelog/add-jetpack-ai-style-guessing b/projects/js-packages/ai-client/changelog/add-jetpack-ai-style-guessing deleted file mode 100644 index 73062f0e6af4e..0000000000000 --- a/projects/js-packages/ai-client/changelog/add-jetpack-ai-style-guessing +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -AI Client: add prompt processing and style guess function for logo generator diff --git a/projects/js-packages/ai-client/changelog/change-jetpack-ai-fetch-error-retry-optional b/projects/js-packages/ai-client/changelog/change-jetpack-ai-fetch-error-retry-optional new file mode 100644 index 0000000000000..22ca3f2a46ba9 --- /dev/null +++ b/projects/js-packages/ai-client/changelog/change-jetpack-ai-fetch-error-retry-optional @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +AI Client: make reload handler prop optional as it still works in a fuzzy way. The error notice (modal) will instruct to reload the page when the optional prop is not provided diff --git a/projects/js-packages/ai-client/changelog/change-jetpack-ai-first-logo-notice b/projects/js-packages/ai-client/changelog/change-jetpack-ai-first-logo-notice deleted file mode 100644 index 8dc60ddbfdddf..0000000000000 --- a/projects/js-packages/ai-client/changelog/change-jetpack-ai-first-logo-notice +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -AI Client: change plans limit to use and accept new 3000 value diff --git a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-first-generation-condition b/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-first-generation-condition deleted file mode 100644 index 2d9dd476dd3cc..0000000000000 --- a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-first-generation-condition +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -AI Client: if site details show empty or default, do not trigger a logo generation, use empty placeholders diff --git a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-generator-styles-source b/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-generator-styles-source deleted file mode 100644 index 7f35b97fbe921..0000000000000 --- a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-generator-styles-source +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -AI Client: remove provision of image styles via flag prop and internal definition, take it from ai-assistant-feature payload now diff --git a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-generator-upgrade-message b/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-generator-upgrade-message deleted file mode 100644 index ae2b7edeaf3c7..0000000000000 --- a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-generator-upgrade-message +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -AI Client: change upgrade copy edit and redirect URL diff --git a/projects/js-packages/ai-client/changelog/fix-jetpack-ai-default-initial-state-setting b/projects/js-packages/ai-client/changelog/fix-jetpack-ai-default-initial-state-setting new file mode 100644 index 0000000000000..41efeee76f1f9 --- /dev/null +++ b/projects/js-packages/ai-client/changelog/fix-jetpack-ai-default-initial-state-setting @@ -0,0 +1,4 @@ +Significance: minor +Type: fixed + +AI Client: fix initial state being mapped even when fetch fails, making the default state nonsensical diff --git a/projects/js-packages/ai-client/changelog/renovate-storybook-monorepo b/projects/js-packages/ai-client/changelog/renovate-storybook-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/ai-client/changelog/renovate-storybook-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/ai-client/changelog/renovate-wordpress-monorepo b/projects/js-packages/ai-client/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/ai-client/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/ai-client/package.json b/projects/js-packages/ai-client/package.json index 4fb727a7728ce..a35a4e132b951 100644 --- a/projects/js-packages/ai-client/package.json +++ b/projects/js-packages/ai-client/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@automattic/jetpack-ai-client", - "version": "0.20.1", + "version": "0.22.0", "description": "A JS client for consuming Jetpack AI services", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme", "bugs": { diff --git a/projects/js-packages/ai-client/src/logo-generator/components/feature-fetch-failure-screen.tsx b/projects/js-packages/ai-client/src/logo-generator/components/feature-fetch-failure-screen.tsx index cd1f53acdf38c..3404e7c1fbb0b 100644 --- a/projects/js-packages/ai-client/src/logo-generator/components/feature-fetch-failure-screen.tsx +++ b/projects/js-packages/ai-client/src/logo-generator/components/feature-fetch-failure-screen.tsx @@ -10,25 +10,34 @@ import type React from 'react'; export const FeatureFetchFailureScreen: React.FC< { onCancel: () => void; - onRetry: () => void; + onRetry?: () => void; } > = ( { onCancel, onRetry } ) => { const errorMessage = __( 'We are sorry. There was an error loading your Jetpack AI plan data. Please, try again.', 'jetpack-ai-client' ); + const errorMessageWithoutRetry = __( + 'We are sorry. There was an error loading your Jetpack AI plan data. Please, reload the page and try again.', + 'jetpack-ai-client' + ); + return (
- { errorMessage } + + { onRetry ? errorMessage : errorMessageWithoutRetry } +
- + { onRetry && ( + + ) }
); diff --git a/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx b/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx index 518a2014015e7..dfba25feb65fa 100644 --- a/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx +++ b/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx @@ -45,7 +45,7 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { isOpen, onClose, onApplyLogo, - onReload, + onReload = null, siteDetails, context, placement, @@ -73,7 +73,8 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { site, requireUpgrade, } = useLogoGenerator(); - const { featureFetchError, firstLogoPromptFetchError, clearErrors } = useRequestErrors(); + const { featureFetchError, setFeatureFetchError, firstLogoPromptFetchError, clearErrors } = + useRequestErrors(); const siteId = siteDetails?.ID; const [ logoAccepted, setLogoAccepted ] = useState( false ); const { nextTierCheckoutURL: upgradeURL } = useCheckout(); @@ -105,6 +106,15 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { */ const initializeModal = useCallback( async () => { try { + if ( ! siteId ) { + throw new Error( 'Site ID is missing' ); + } + + if ( ! feature?.featuresControl?.[ 'logo-generator' ]?.enabled ) { + setFeatureFetchError( 'Failed to fetch feature data' ); + throw new Error( 'Failed to fetch feature data' ); + } + const hasHistory = ! isLogoHistoryEmpty( String( siteId ) ); const logoCost = feature?.costs?.[ 'jetpack-ai-logo-generator' ]?.logo ?? DEFAULT_LOGO_COST; @@ -125,10 +135,10 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { : currentLimit < currentUsage ); // If the site requires an upgrade, show the upgrade screen immediately. - setNeedsFeature( currentLimit === 0 ); + setNeedsFeature( currentValue === 0 ); setNeedsMoreRequests( siteNeedsMoreRequests ); - if ( currentLimit === 0 || siteNeedsMoreRequests ) { + if ( currentValue === 0 || siteNeedsMoreRequests ) { setLoadingState( null ); return; } @@ -179,6 +189,7 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { isLogoHistoryEmpty, siteId, requireUpgrade, + setFeatureFetchError, ] ); const handleModalOpen = useCallback( async () => { @@ -201,6 +212,15 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { recordTracksEvent( EVENT_MODAL_CLOSE, { context, placement } ); }; + const handleReload = useCallback( () => { + if ( ! onReload ) { + return; + } + closeModal(); + requestedFeatureData.current = false; + onReload(); + }, [ onReload, closeModal ] ); + const handleApplyLogo = ( mediaId: number ) => { setLogoAccepted( true ); onApplyLogo?.( mediaId ); @@ -229,7 +249,7 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { // Handles modal opening logic useEffect( () => { // While the modal is not open, the siteId is not set, or the feature data is not available, do nothing. - if ( ! isOpen || ! siteId || ! feature?.costs ) { + if ( ! isOpen ) { return; } @@ -238,7 +258,7 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { needsToHandleModalOpen.current = false; handleModalOpen(); } - }, [ isOpen, siteId, handleModalOpen, feature ] ); + }, [ isOpen, handleModalOpen ] ); let body: React.ReactNode; @@ -248,10 +268,7 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { body = ( { - closeModal(); - onReload?.(); - } } + onRetry={ onReload ? handleReload : null } /> ); } else if ( needsFeature || needsMoreRequests ) { diff --git a/projects/js-packages/ai-client/src/logo-generator/components/prompt.scss b/projects/js-packages/ai-client/src/logo-generator/components/prompt.scss index 56d94215d5ff5..6a73d069a1bb6 100644 --- a/projects/js-packages/ai-client/src/logo-generator/components/prompt.scss +++ b/projects/js-packages/ai-client/src/logo-generator/components/prompt.scss @@ -69,7 +69,7 @@ color: var(--studio-gray-50, #646970); } - &[data-placeholder]:empty:focus::before { + &[data-placeholder]:empty:focus::before:not([contentEditable="false"]) { content: ""; } } diff --git a/projects/js-packages/ai-client/src/logo-generator/components/prompt.tsx b/projects/js-packages/ai-client/src/logo-generator/components/prompt.tsx index 55b77ae099ece..643bd0e3eb9fa 100644 --- a/projects/js-packages/ai-client/src/logo-generator/components/prompt.tsx +++ b/projects/js-packages/ai-client/src/logo-generator/components/prompt.tsx @@ -107,7 +107,7 @@ export const Prompt = ( { initialPrompt = '' }: PromptProps ) => { }, [ prompt ] ); useEffect( () => { - if ( imageStyles.length > 0 ) { + if ( imageStyles && imageStyles.length > 0 ) { // Sort styles to have "None" and "Auto" first setStyles( [ diff --git a/projects/js-packages/ai-client/src/logo-generator/hooks/use-logo-generator.ts b/projects/js-packages/ai-client/src/logo-generator/hooks/use-logo-generator.ts index cd96cb7a1610d..70acbf3fe98e0 100644 --- a/projects/js-packages/ai-client/src/logo-generator/hooks/use-logo-generator.ts +++ b/projects/js-packages/ai-client/src/logo-generator/hooks/use-logo-generator.ts @@ -92,7 +92,7 @@ const useLogoGenerator = () => { const logoGeneratorControl = aiAssistantFeatureData?.featuresControl?.[ 'logo-generator' ] as LogoGeneratorFeatureControl; - const imageStyles: Array< ImageStyleObject > = logoGeneratorControl?.styles; + const imageStyles: Array< ImageStyleObject > = logoGeneratorControl?.styles || []; const generateFirstPrompt = useCallback( async function (): Promise< string > { diff --git a/projects/js-packages/ai-client/src/logo-generator/store/actions.ts b/projects/js-packages/ai-client/src/logo-generator/store/actions.ts index 4164e5e3ca6f6..497ab74246fc9 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/actions.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/actions.ts @@ -93,6 +93,10 @@ const actions = { query: 'force=wpcom', } ); + if ( response.data ) { + throw new Error( 'Failed to fetch' ); + } + // Store the feature in the store. dispatch( actions.storeAiAssistantFeature( mapAiFeatureResponseToAiFeatureProps( response ) ) diff --git a/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts b/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts index 7b130dc12e31e..d07579e8f9793 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts @@ -34,6 +34,12 @@ const INITIAL_STATE: LogoGeneratorStateProp = { asyncRequestTimerId: 0, isRequestingImage: false, }, + featuresControl: { + 'logo-generator': { + enabled: false, + styles: [], + }, + }, }, }, history: [], diff --git a/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts b/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts index a2cd92c6916f8..9322c3c21a0b4 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts @@ -325,6 +325,16 @@ export default function reducer( case ACTION_SET_FEATURE_FETCH_ERROR: return { ...state, + features: { + ...state.features, + aiAssistantFeature: { + ...state?.features?.aiAssistantFeature, + _meta: { + ...state?.features?.aiAssistantFeature?._meta, + isRequesting: false, + }, + }, + }, _meta: { ...( state._meta ?? {} ), featureFetchError: action.error, diff --git a/projects/js-packages/ai-client/src/logo-generator/store/types.ts b/projects/js-packages/ai-client/src/logo-generator/store/types.ts index c4eb52f9d95da..b34f3b9f8a22e 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/types.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/types.ts @@ -95,11 +95,11 @@ export type LogoGeneratorFeatureControl = FeatureControl & { export type FeatureControl = { enabled: boolean; - 'min-jetpack-version': string; - [ key: string ]: FeatureControl | LogoGeneratorFeatureControl | boolean | string; }; -export type FeaturesControl = { [ key: string ]: FeatureControl }; +export type FeaturesControl = { + [ key: string ]: FeatureControl | LogoGeneratorFeatureControl; +}; export type AiFeatureProps = { hasFeature: boolean; @@ -220,6 +220,7 @@ export type AiAssistantFeatureEndpointResponseProps = { }; }; 'features-control'?: FeaturesControl; + data?: string; // when WP responds with a 200 status code but it's the error wrap }; export type SaveLogo = ( logo: Logo ) => Promise< { mediaId: number; mediaURL: string } >; diff --git a/projects/js-packages/ai-client/src/logo-generator/types.ts b/projects/js-packages/ai-client/src/logo-generator/types.ts index f25e238a9737c..e54cf774ac98e 100644 --- a/projects/js-packages/ai-client/src/logo-generator/types.ts +++ b/projects/js-packages/ai-client/src/logo-generator/types.ts @@ -16,7 +16,7 @@ export interface GeneratorModalProps { isOpen: boolean; onClose: () => void; onApplyLogo: ( mediaId: number ) => void; - onReload: () => void; + onReload?: () => void; context: string; placement: string; } diff --git a/projects/js-packages/components/CHANGELOG.md b/projects/js-packages/components/CHANGELOG.md index b44b7653f6594..4678b332afb84 100644 --- a/projects/js-packages/components/CHANGELOG.md +++ b/projects/js-packages/components/CHANGELOG.md @@ -2,6 +2,16 @@ ### This is a list detailing changes for the Jetpack RNA Components package releases. +## [0.58.0] - 2024-10-15 +### Added +- Add DiffViewer component [#39672] +- Add ThreatSeverityBadge component [#39758] + +## [0.57.0] - 2024-10-14 +### Added +- Add JetpackProtectLogo component. [#39703] +- Add MarkedLines component. [#39674] + ## [0.56.3] - 2024-10-10 ### Changed - Components - getRedirectUrl: use file extension on import for linter to find definitions @@ -1185,6 +1195,8 @@ ### Changed - Update node version requirement to 14.16.1 +[0.58.0]: https://github.com/Automattic/jetpack-components/compare/0.57.0...0.58.0 +[0.57.0]: https://github.com/Automattic/jetpack-components/compare/0.56.3...0.57.0 [0.56.3]: https://github.com/Automattic/jetpack-components/compare/0.56.2...0.56.3 [0.56.2]: https://github.com/Automattic/jetpack-components/compare/0.56.1...0.56.2 [0.56.1]: https://github.com/Automattic/jetpack-components/compare/0.56.0...0.56.1 diff --git a/projects/js-packages/components/changelog/add-eslint-react-jsx-key b/projects/js-packages/components/changelog/add-eslint-react-jsx-key deleted file mode 100644 index 6bb34ab09749d..0000000000000 --- a/projects/js-packages/components/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add `key` to React components in some stories. Should be no change to functionality. - - diff --git a/projects/plugins/protect/src/js/components/diff-viewer/README.md b/projects/js-packages/components/components/diff-viewer/README.md similarity index 75% rename from projects/plugins/protect/src/js/components/diff-viewer/README.md rename to projects/js-packages/components/components/diff-viewer/README.md index 0753deb9a3a53..8cf4a6783431f 100644 --- a/projects/plugins/protect/src/js/components/diff-viewer/README.md +++ b/projects/js-packages/components/components/diff-viewer/README.md @@ -1,6 +1,6 @@ # Unified Diff Viewer -Forked over from [Calypso](https://github.com/Automattic/wp-calypso/tree/b7a4a07/client/components/diff-viewer). +Originally forked over from [Calypso](https://github.com/Automattic/wp-calypso/tree/b7a4a07/client/components/diff-viewer). This component renders the output of a unified diff (`git diff` or `diff -u`) in a visual format recognizable by someone who works with `diff` and comparing files. @@ -29,9 +29,9 @@ export const CommitView = ( { commitHash, description, diff } ) => ( ### Additional usage information The diff output should be the full text produced by the diff command (including newlines). -Internally this component relies on `jsdiff` to parse the output (the patch) and produce -the data structure used to display files, hunks (sections of change in the files), and -the actual lines of change and context. +Internally this component parses the output (the patch) and produces the data structure +used to display files, hunks (sections of change in the files), and the actual lines of +change and context. ``` diff --git a/circle.yml b/circle.yml diff --git a/projects/js-packages/components/components/diff-viewer/index.tsx b/projects/js-packages/components/components/diff-viewer/index.tsx new file mode 100644 index 0000000000000..8e9bd3e76e47c --- /dev/null +++ b/projects/js-packages/components/components/diff-viewer/index.tsx @@ -0,0 +1,97 @@ +import { Fragment } from 'react'; +import parseFilename from './parse-filename'; +import parsePatch from './parse-patch'; +import styles from './styles.module.scss'; + +const filename = ( { + oldFileName, + newFileName, +}: { + oldFileName: string; + newFileName: string; +} ): JSX.Element => { + const { prev, next } = parseFilename( oldFileName, newFileName ); + + if ( prev.prefix + prev.path === next.prefix + next.path ) { + return ( + + { prev.prefix && ( + { prev.prefix } + ) } + { prev.path } + + ); + } + + return ( + + { !! prev.prefix && ( + { prev.prefix } + ) } + { prev.path } + { ' → ' } + { !! next.prefix && ( + { next.prefix } + ) } + { next.path } + + ); +}; + +export const DiffViewer = ( { diff } ) => ( +
+ { parsePatch( diff ).map( ( file, fileIndex ) => ( + +
+ { filename( file ) } +
+
+
+ { file.hunks.map( ( hunk, hunkIndex ) => { + let lineOffset = 0; + return hunk.lines.map( ( line, index ) => ( +
+ { line[ 0 ] === '+' ? '\u00a0' : hunk.oldStart + lineOffset++ } +
+ ) ); + } ) } +
+
+ { file.hunks.map( ( hunk, hunkIndex ) => { + let lineOffset = 0; + return hunk.lines.map( ( line, index ) => ( +
+ { line[ 0 ] === '-' ? '\u00a0' : hunk.newStart + lineOffset++ } +
+ ) ); + } ) } +
+
+ { file.hunks.map( ( hunk, hunkIndex ) => + hunk.lines.map( ( line, index ) => { + const output = line.slice( 1 ).replace( /^\s*$/, '\u00a0' ); + const key = `${ hunkIndex }-${ index }`; + + switch ( line[ 0 ] ) { + case ' ': + return
{ output }
; + + case '-': + return { output }; + + case '+': + return { output }; + + default: + return undefined; + } + } ) + ) } +
+
+
+ ) ) } +
+); + +export default DiffViewer; diff --git a/projects/js-packages/components/components/diff-viewer/parse-filename.ts b/projects/js-packages/components/components/diff-viewer/parse-filename.ts new file mode 100644 index 0000000000000..5e51f8569c06a --- /dev/null +++ b/projects/js-packages/components/components/diff-viewer/parse-filename.ts @@ -0,0 +1,75 @@ +type ParsedFilename = { + prefix: string; + path: string; +}; + +const decompose = ( path: string ): ParsedFilename => { + const lastSlash = path.lastIndexOf( '/' ); + + return lastSlash > -1 + ? { prefix: path.slice( 0, lastSlash ), path: path.slice( lastSlash ) } + : { prefix: '', path }; +}; + +/** + * Parse the filename from a diff + * + * Uses a heuristic to return proper file name indicators + * + * It searches for the longest shared prefix and returns + * whatever remains after that. If the paths are identical + * it only returns a single filename as we have detected + * that the diff compares changes to only one file. + * + * An exception is made for `a/` and `b/` prefixes often + * added by `git` and other utilities to separate the left + * from the right when looking at the contents of a single + * file over time. + * + * @param {string} prev - filename of left contents + * @param {string} next - filename of right contents + * + * @return {object} - parsed filename + */ +export default function ( + prev: string, + next: string +): { prev: ParsedFilename; next: ParsedFilename } { + // Remove 'a/' and 'b/' prefixes if present + const isLikelyPrefixed = prev.startsWith( 'a/' ) && next.startsWith( 'b/' ); + prev = isLikelyPrefixed ? prev.slice( 2 ) : prev; + next = isLikelyPrefixed ? next.slice( 2 ) : next; + + if ( prev === next ) { + // Paths are identical + const { prefix, path } = decompose( prev ); + return { prev: { prefix, path }, next: { prefix, path } }; + } + + // Find longest shared base path ending with a slash + const length = Math.max( prev.length, next.length ); + for ( let i = 0, slash = 0; i < length; i++ ) { + if ( prev[ i ] === '/' && next[ i ] === '/' ) { + slash = i; + } + + if ( prev[ i ] !== next[ i ] ) { + return { + prev: { + prefix: prev.slice( 0, slash ), + path: prev.slice( slash ), + }, + next: { + prefix: next.slice( 0, slash ), + path: next.slice( slash ), + }, + }; + } + } + + // No shared base path + return { + prev: decompose( prev ), + next: decompose( next ), + }; +} diff --git a/projects/js-packages/components/components/diff-viewer/parse-patch.ts b/projects/js-packages/components/components/diff-viewer/parse-patch.ts new file mode 100644 index 0000000000000..69281bbdc63a3 --- /dev/null +++ b/projects/js-packages/components/components/diff-viewer/parse-patch.ts @@ -0,0 +1,212 @@ +type Hunk = { + oldStart: number; + oldLines: number; + newStart: number; + newLines: number; + lines: string[]; +}; + +type Index = { + index?: string; + hunks?: Hunk[]; + oldFileName?: string; + newFileName?: string; + oldHeader?: string; + newHeader?: string; +}; + +/** + * Parse Patch + * + * Adapted from https://github.com/kpdecker/jsdiff/blob/master/src/patch/parse.js + * + * @param {string} uniDiff - diff string + * @return {Array} - array of parsed files + */ +export default function parsePatch( uniDiff: string ) { + const diffstr = uniDiff.split( /\n/ ); + const list = []; + let i = 0; + + /** + * Parse Index + */ + function parseIndex() { + const index: Index = {}; + + list.push( index ); + + // Parse diff metadata + while ( i < diffstr.length ) { + const line = diffstr[ i ]; + + // File header found, end parsing diff metadata + if ( /^(---|\+\+\+|@@)\s/.test( line ) ) { + break; + } + + // Diff index + const header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec( line ); + + if ( header ) { + index.index = header[ 1 ]; + } + + i++; + } + + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader( index ); + parseFileHeader( index ); + + // Parse hunks + index.hunks = []; + + while ( i < diffstr.length ) { + const _line = diffstr[ i ]; + + if ( + /^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test( + _line + ) + ) { + break; + } else if ( /^@@/.test( _line ) ) { + index.hunks.push( parseHunk() ); + } else if ( _line ) { + throw new Error( 'Unknown line ' + ( i + 1 ) + ' ' + JSON.stringify( _line ) ); + } else { + i++; + } + } + } + + /** + * Parse File Header + * + * Parses the --- and +++ headers, if none are found, no lines + * are consumed. + * + * @param {Array} index - array of parsed files + * @param {unknown} index.index - index + * @param {object[]} index.hunks - hunks + */ + function parseFileHeader( index: Index ) { + const fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec( diffstr[ i ] ); + + if ( fileHeader ) { + const keyPrefix = fileHeader[ 1 ] === '---' ? 'old' : 'new'; + + const data = fileHeader[ 2 ].split( '\t', 2 ); + + let fileName = data[ 0 ].replace( /\\\\/g, '\\' ); + + if ( /^".*"$/.test( fileName ) ) { + fileName = fileName.substr( 1, fileName.length - 2 ); + } + + index[ keyPrefix + 'FileName' ] = fileName; + + index[ keyPrefix + 'Header' ] = ( data[ 1 ] || '' ).trim(); + + i++; + } + } + + /** + * Parse Hunk + * This assumes that we are at the start of a hunk. + * + * @return {object} - The parsed hunk. + */ + function parseHunk(): Hunk { + const chunkHeaderIndex = i, + chunkHeaderLine = diffstr[ i++ ], + chunkHeader = chunkHeaderLine.split( /@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/ ); + + const hunk = { + oldStart: +chunkHeader[ 1 ], + oldLines: typeof chunkHeader[ 2 ] === 'undefined' ? 1 : +chunkHeader[ 2 ], + newStart: +chunkHeader[ 3 ], + newLines: typeof chunkHeader[ 4 ] === 'undefined' ? 1 : +chunkHeader[ 4 ], + lines: [], + }; + + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + + if ( hunk.oldLines === 0 ) { + hunk.oldStart += 1; + } + + if ( hunk.newLines === 0 ) { + hunk.newStart += 1; + } + + let addCount = 0, + removeCount = 0, + _diffstr$i; + for ( + ; + i < diffstr.length && + ( removeCount < hunk.oldLines || + addCount < hunk.newLines || + ( ( _diffstr$i = diffstr[ i ] ) !== null && + _diffstr$i !== void 0 && + _diffstr$i.startsWith( '\\' ) ) ); + i++ + ) { + const operation = + diffstr[ i ].length === 0 && i !== diffstr.length - 1 ? ' ' : diffstr[ i ][ 0 ]; + + if ( operation === '+' || operation === '-' || operation === ' ' || operation === '\\' ) { + hunk.lines.push( diffstr[ i ] ); + + if ( operation === '+' ) { + addCount++; + } else if ( operation === '-' ) { + removeCount++; + } else if ( operation === ' ' ) { + addCount++; + removeCount++; + } + } else { + throw new Error( + `Hunk at line ${ chunkHeaderIndex + 1 } contained invalid line ${ diffstr[ i ] }` + ); + } + } + + // Handle the empty block count case + if ( ! addCount && hunk.newLines === 1 ) { + hunk.newLines = 0; + } + + if ( ! removeCount && hunk.oldLines === 1 ) { + hunk.oldLines = 0; + } + + // Perform sanity checking + if ( addCount !== hunk.newLines ) { + throw new Error( + 'Added line count did not match for hunk at line ' + ( chunkHeaderIndex + 1 ) + ); + } + + if ( removeCount !== hunk.oldLines ) { + throw new Error( + 'Removed line count did not match for hunk at line ' + ( chunkHeaderIndex + 1 ) + ); + } + + return hunk; + } + + while ( i < diffstr.length ) { + parseIndex(); + } + + return list; +} diff --git a/projects/js-packages/components/components/diff-viewer/stories/index.stories.tsx b/projects/js-packages/components/components/diff-viewer/stories/index.stories.tsx new file mode 100644 index 0000000000000..4f986981f9761 --- /dev/null +++ b/projects/js-packages/components/components/diff-viewer/stories/index.stories.tsx @@ -0,0 +1,39 @@ +/* eslint-disable react/react-in-jsx-scope */ +import React from 'react'; +import DiffViewer from '..'; + +export default { + title: 'JS Packages/Components/Diff Viewer', + component: DiffViewer, +}; + +const diff = `diff --git a/package.json b/package.json +Index: a31e51f..c3b21a1 100644 +--- a/package.json ++++ b/package.json +@@ -1,7 +1,7 @@ + { + "name": "hello-world", +- "version": "1.0.0", ++ "version": "1.0.1", + "description": "Hello, World!", +- "main": "index.js", ++ "main": "index.ts", + "scripts": { +- "start": "node index.js" ++ "start": "node index.ts" + +diff --git a/src/index.js b/src/index.ts +Index: 17c882a..d3f041b 100644 +--- a/src/index.js ++++ b/src/index.ts +@@ -0,0 +1,1 @@ ++console.log( 'Hello, world!' );`; + +const Template = args => ; + +export const Default = Template.bind( {} ); + +Default.args = { + diff, +}; diff --git a/projects/plugins/protect/src/js/components/diff-viewer/styles.module.scss b/projects/js-packages/components/components/diff-viewer/styles.module.scss similarity index 100% rename from projects/plugins/protect/src/js/components/diff-viewer/styles.module.scss rename to projects/js-packages/components/components/diff-viewer/styles.module.scss diff --git a/projects/js-packages/components/components/jetpack-protect-logo/README.md b/projects/js-packages/components/components/jetpack-protect-logo/README.md new file mode 100644 index 0000000000000..e813dc52f5353 --- /dev/null +++ b/projects/js-packages/components/components/jetpack-protect-logo/README.md @@ -0,0 +1,20 @@ +JetpackProtectLogo +======== + +Component that renders the Jetpack Protect SVG logo. +It consists of the Jetpack symbol followed by the name. +It takes width and height properties but defaults to 42px in height. + +#### How to use: + +```js + +``` + +#### Props + +* `className`: String - (default: `jetpack-logo`) the class name set on the SVG element. +* `height`: Number - (default: 42) set the height of the logo. +* `width`: Number - (optional) set the width of the logo. +* `showText`: Boolean - (default: true) Whether to show text `Jetpack` after the logo. +* `logoColor`: String - (default: '#069e08') The color of the logo symbol. diff --git a/projects/js-packages/components/components/jetpack-protect-logo/index.tsx b/projects/js-packages/components/components/jetpack-protect-logo/index.tsx new file mode 100644 index 0000000000000..1b1729e4f5723 --- /dev/null +++ b/projects/js-packages/components/components/jetpack-protect-logo/index.tsx @@ -0,0 +1,60 @@ +import { __ } from '@wordpress/i18n'; +import clsx from 'clsx'; +import React from 'react'; +import { JetpackProtectLogoProps } from './types'; + +const JetpackProtectLogo: React.FC< JetpackProtectLogoProps > = ( { + logoColor = '#069e08', + showText = true, + className, + height = 42, + ...otherProps +} ) => { + const viewBox = showText ? '0 0 245 41' : '0 0 41 41'; + + return ( + + { __( 'Jetpack Protect Logo', 'jetpack' ) } + + + + + + { showText && ( + <> + + + + + + + + + + + + + + + + + ) } + + ); +}; + +export default JetpackProtectLogo; diff --git a/projects/js-packages/components/components/jetpack-protect-logo/stories/index.stories.tsx b/projects/js-packages/components/components/jetpack-protect-logo/stories/index.stories.tsx new file mode 100644 index 0000000000000..90ec4de809223 --- /dev/null +++ b/projects/js-packages/components/components/jetpack-protect-logo/stories/index.stories.tsx @@ -0,0 +1,21 @@ +import JetpackProtectLogo from '../index'; +import type { StoryFn, Meta } from '@storybook/react'; + +export default { + title: 'JS Packages/Components/Jetpack Protect Logo', + component: JetpackProtectLogo, + argTypes: { + logoColor: { control: 'color' }, + }, +} as Meta< typeof JetpackProtectLogo >; + +const Template: StoryFn< typeof JetpackProtectLogo > = args => ; + +const DefaultArgs = { + width: 150, + className: 'sample-classname', + showText: true, +}; + +export const _default = Template.bind( {} ); +_default.args = DefaultArgs; diff --git a/projects/js-packages/components/components/jetpack-protect-logo/test/component.tsx b/projects/js-packages/components/components/jetpack-protect-logo/test/component.tsx new file mode 100644 index 0000000000000..32deae5d68d01 --- /dev/null +++ b/projects/js-packages/components/components/jetpack-protect-logo/test/component.tsx @@ -0,0 +1,16 @@ +import { render, screen } from '@testing-library/react'; +import JetpackProtectLogo from '../index'; + +describe( 'JetpackProtectLogo', () => { + const testProps = { + className: 'sample-classname', + }; + + describe( 'Render the JetpackProtectLogo component', () => { + it( 'validate the class name', () => { + render( ); + + expect( screen.getByLabelText( 'Jetpack Protect Logo' ) ).toHaveClass( testProps.className ); + } ); + } ); +} ); diff --git a/projects/js-packages/components/components/jetpack-protect-logo/types.ts b/projects/js-packages/components/components/jetpack-protect-logo/types.ts new file mode 100644 index 0000000000000..7060b82637e50 --- /dev/null +++ b/projects/js-packages/components/components/jetpack-protect-logo/types.ts @@ -0,0 +1,7 @@ +export type JetpackProtectLogoProps = { + className?: string; + width?: number; + height?: number; + showText?: boolean; + logoColor?: string; +}; diff --git a/projects/plugins/protect/src/js/components/marked-lines/README.md b/projects/js-packages/components/components/marked-lines/README.md similarity index 93% rename from projects/plugins/protect/src/js/components/marked-lines/README.md rename to projects/js-packages/components/components/marked-lines/README.md index b7994180b197a..a17cb5fe349f9 100644 --- a/projects/plugins/protect/src/js/components/marked-lines/README.md +++ b/projects/js-packages/components/components/marked-lines/README.md @@ -1,6 +1,6 @@ # Marked Lines viewer -Forked over from [Calypso](https://github.com/Automattic/wp-calypso/tree/b7a4a07/client/components/marked-lines). +Originally forked over from [Calypso](https://github.com/Automattic/wp-calypso/tree/b7a4a07/client/components/marked-lines). This component is designed to show contextualized lines from a file with optional highlighting or marks to point out specific parts of one or more lines. diff --git a/projects/plugins/protect/src/js/components/marked-lines/index.jsx b/projects/js-packages/components/components/marked-lines/index.tsx similarity index 100% rename from projects/plugins/protect/src/js/components/marked-lines/index.jsx rename to projects/js-packages/components/components/marked-lines/index.tsx diff --git a/projects/plugins/protect/src/js/components/marked-lines/stories/index.stories.jsx b/projects/js-packages/components/components/marked-lines/stories/index.stories.tsx similarity index 79% rename from projects/plugins/protect/src/js/components/marked-lines/stories/index.stories.jsx rename to projects/js-packages/components/components/marked-lines/stories/index.stories.tsx index 4232cf69be7cb..571d3527220d3 100644 --- a/projects/plugins/protect/src/js/components/marked-lines/stories/index.stories.jsx +++ b/projects/js-packages/components/components/marked-lines/stories/index.stories.tsx @@ -1,9 +1,7 @@ -/* eslint-disable react/react-in-jsx-scope */ -import React from 'react'; -import MarkedLines from '../index.jsx'; +import MarkedLines from '../index.js'; export default { - title: 'Plugins/Protect/Marked Lines', + title: 'JS Packages/Components/Marked Lines', component: MarkedLines, }; @@ -15,6 +13,7 @@ export const Default = args => ( } } /> ); + Default.args = { lines: { 10: 'add :: Num a => a -> a -> a', diff --git a/projects/plugins/protect/src/js/components/marked-lines/styles.module.scss b/projects/js-packages/components/components/marked-lines/styles.module.scss similarity index 100% rename from projects/plugins/protect/src/js/components/marked-lines/styles.module.scss rename to projects/js-packages/components/components/marked-lines/styles.module.scss diff --git a/projects/plugins/protect/src/js/components/severity/index.jsx b/projects/js-packages/components/components/threat-severity-badge/index.tsx similarity index 91% rename from projects/plugins/protect/src/js/components/severity/index.jsx rename to projects/js-packages/components/components/threat-severity-badge/index.tsx index 310cb6e233aa7..0c44edeee7222 100644 --- a/projects/plugins/protect/src/js/components/severity/index.jsx +++ b/projects/js-packages/components/components/threat-severity-badge/index.tsx @@ -12,11 +12,11 @@ const severityClassNames = severity => { const severityText = severity => { if ( severity >= 5 ) { - return _x( 'Critical', 'Severity label for issues rated 5 or higher.', 'jetpack-protect' ); + return _x( 'Critical', 'Severity label for issues rated 5 or higher.', 'jetpack' ); } else if ( severity >= 3 && severity < 5 ) { - return _x( 'High', 'Severity label for issues rated between 3 and 5.', 'jetpack-protect' ); + return _x( 'High', 'Severity label for issues rated between 3 and 5.', 'jetpack' ); } - return _x( 'Low', 'Severity label for issues rated below 3.', 'jetpack-protect' ); + return _x( 'Low', 'Severity label for issues rated below 3.', 'jetpack' ); }; const ThreatSeverityBadge = ( { severity } ) => { diff --git a/projects/plugins/protect/src/js/components/severity/stories/index.stories.jsx b/projects/js-packages/components/components/threat-severity-badge/stories/index.stories.tsx similarity index 78% rename from projects/plugins/protect/src/js/components/severity/stories/index.stories.jsx rename to projects/js-packages/components/components/threat-severity-badge/stories/index.stories.tsx index 0617d1cb3d2aa..eb71cb68b8a4a 100644 --- a/projects/plugins/protect/src/js/components/severity/stories/index.stories.jsx +++ b/projects/js-packages/components/components/threat-severity-badge/stories/index.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import ThreatSeverityBadge from '../index.jsx'; +import ThreatSeverityBadge from '../index.js'; export default { - title: 'Plugins/Protect/Threat Severity Badge', + title: 'JS Packages/Components/Threat Severity Badge', component: ThreatSeverityBadge, }; diff --git a/projects/plugins/protect/src/js/components/severity/styles.module.scss b/projects/js-packages/components/components/threat-severity-badge/styles.module.scss similarity index 100% rename from projects/plugins/protect/src/js/components/severity/styles.module.scss rename to projects/js-packages/components/components/threat-severity-badge/styles.module.scss diff --git a/projects/js-packages/components/components/threat-severity-badge/test/index.test.tsx b/projects/js-packages/components/components/threat-severity-badge/test/index.test.tsx new file mode 100644 index 0000000000000..6489511e21002 --- /dev/null +++ b/projects/js-packages/components/components/threat-severity-badge/test/index.test.tsx @@ -0,0 +1,9 @@ +import { render, screen } from '@testing-library/react'; +import ThreatSeverityBadge from '..'; + +describe( 'ThreatSeverityBadge', () => { + it( 'renders the correct severity label', () => { + render( ); + expect( screen.getByText( 'High' ) ).toBeInTheDocument(); + } ); +} ); diff --git a/projects/js-packages/components/index.ts b/projects/js-packages/components/index.ts index b4740fcff7404..d0a6a683663bf 100644 --- a/projects/js-packages/components/index.ts +++ b/projects/js-packages/components/index.ts @@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. export { default as JetpackLogo } from './components/jetpack-logo'; export { default as JetpackSearchLogo } from './components/jetpack-search-logo'; +export { default as JetpackProtectLogo } from './components/jetpack-protect-logo'; export { default as JetpackVaultPressBackupLogo } from './components/jetpack-vaultpress-backup-logo'; export { default as JetpackVideoPressLogo } from './components/jetpack-videopress-logo'; export { default as getRedirectUrl } from './tools/jp-redirect'; @@ -43,6 +44,7 @@ export { default as CopyToClipboard } from './components/copy-to-clipboard'; export * from './components/icons'; export { default as SplitButton } from './components/split-button'; export { default as ThemeProvider } from './components/theme-provider'; +export { default as ThreatSeverityBadge } from './components/threat-severity-badge'; export { default as Text, H2, H3, Title } from './components/text'; export { default as ToggleControl } from './components/toggle-control'; export { default as numberFormat } from './components/number-format'; @@ -78,4 +80,6 @@ export { default as UpsellBanner } from './components/upsell-banner'; export { getUserLocale, cleanLocale } from './lib/locale'; export { default as RadioControl } from './components/radio-control'; export { default as StatCard } from './components/stat-card'; +export { default as DiffViewer } from './components/diff-viewer'; +export { default as MarkedLines } from './components/marked-lines'; export * from './components/global-notices'; diff --git a/projects/js-packages/components/package.json b/projects/js-packages/components/package.json index f39dadee6456e..2add1cb76864c 100644 --- a/projects/js-packages/components/package.json +++ b/projects/js-packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-components", - "version": "0.56.3", + "version": "0.58.0", "description": "Jetpack Components Package", "author": "Automattic", "license": "GPL-2.0-or-later", diff --git a/projects/js-packages/connection/CHANGELOG.md b/projects/js-packages/connection/CHANGELOG.md index 6478c1f35f497..7ac997d1bbf1b 100644 --- a/projects/js-packages/connection/CHANGELOG.md +++ b/projects/js-packages/connection/CHANGELOG.md @@ -2,6 +2,14 @@ ### This is a list detailing changes for the Jetpack RNA Connection Component releases. +## [0.35.14] - 2024-10-15 +### Changed +- Update dependencies. + +## [0.35.13] - 2024-10-14 +### Changed +- Internal updates. + ## [0.35.12] - 2024-10-10 ### Changed - Updated package dependencies. @@ -867,6 +875,8 @@ - `Main` and `ConnectUser` components added. - `JetpackRestApiClient` API client added. +[0.35.14]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.13...v0.35.14 +[0.35.13]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.12...v0.35.13 [0.35.12]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.11...v0.35.12 [0.35.11]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.10...v0.35.11 [0.35.10]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.9...v0.35.10 diff --git a/projects/js-packages/connection/changelog/add-eslint-react-jsx-key b/projects/js-packages/connection/changelog/add-eslint-react-jsx-key deleted file mode 100644 index 4b72c69123c80..0000000000000 --- a/projects/js-packages/connection/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add `key` to DisconnectSurvey options. Should be no change to functionality. - - diff --git a/projects/js-packages/connection/package.json b/projects/js-packages/connection/package.json index a7d719ec68589..9e750c00c8f2f 100644 --- a/projects/js-packages/connection/package.json +++ b/projects/js-packages/connection/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-connection", - "version": "0.35.12", + "version": "0.35.14", "description": "Jetpack Connection Component", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/connection/#readme", "bugs": { diff --git a/projects/js-packages/idc/CHANGELOG.md b/projects/js-packages/idc/CHANGELOG.md index b26971b0667da..ad0fbc706d310 100644 --- a/projects/js-packages/idc/CHANGELOG.md +++ b/projects/js-packages/idc/CHANGELOG.md @@ -2,6 +2,14 @@ ### This is a list detailing changes for the Jetpack RNA IDC package releases. +## 0.11.17 - 2024-10-15 +### Changed +- Update dependencies. + +## 0.11.16 - 2024-10-14 +### Changed +- Update dependencies. + ## 0.11.15 - 2024-10-10 ### Changed - Updated package dependencies. diff --git a/projects/js-packages/idc/package.json b/projects/js-packages/idc/package.json index 2e76e833c805f..b3028899cd286 100644 --- a/projects/js-packages/idc/package.json +++ b/projects/js-packages/idc/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-idc", - "version": "0.11.15", + "version": "0.11.17", "description": "Jetpack Connection Component", "author": "Automattic", "license": "GPL-2.0-or-later", diff --git a/projects/js-packages/licensing/CHANGELOG.md b/projects/js-packages/licensing/CHANGELOG.md index ef6257f288b86..6a512f4ae6ac5 100644 --- a/projects/js-packages/licensing/CHANGELOG.md +++ b/projects/js-packages/licensing/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.13.5 - 2024-10-15 +### Changed +- Update dependencies. [#37982] + +## 0.13.4 - 2024-10-14 +### Changed +- Update dependencies. [#37982] + ## 0.13.3 - 2024-10-10 ### Changed - Updated package dependencies. [#39707] diff --git a/projects/js-packages/licensing/package.json b/projects/js-packages/licensing/package.json index d55e655a9962d..1dc94d49de484 100644 --- a/projects/js-packages/licensing/package.json +++ b/projects/js-packages/licensing/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-licensing", - "version": "0.13.3", + "version": "0.13.5", "description": "Jetpack licensing flow", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/licensing/#readme", "bugs": { diff --git a/projects/js-packages/partner-coupon/CHANGELOG.md b/projects/js-packages/partner-coupon/CHANGELOG.md index add5f67e3409c..b06983ee66eb5 100644 --- a/projects/js-packages/partner-coupon/CHANGELOG.md +++ b/projects/js-packages/partner-coupon/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.2.93 - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## 0.2.92 - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + ## 0.2.91 - 2024-10-07 ### Changed - Updated package dependencies. [#39594] diff --git a/projects/js-packages/partner-coupon/changelog/renovate-wordpress-monorepo b/projects/js-packages/partner-coupon/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/partner-coupon/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/partner-coupon/package.json b/projects/js-packages/partner-coupon/package.json index b1a6e84b7b1ba..e940ad6672592 100644 --- a/projects/js-packages/partner-coupon/package.json +++ b/projects/js-packages/partner-coupon/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-partner-coupon", - "version": "0.2.91", + "version": "0.2.93", "description": "This package aims to add components to make it easier to redeem partner coupons", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/partner-coupon/#readme", "bugs": { diff --git a/projects/js-packages/publicize-components/CHANGELOG.md b/projects/js-packages/publicize-components/CHANGELOG.md index 9742bffb4b462..a47006d9fe0db 100644 --- a/projects/js-packages/publicize-components/CHANGELOG.md +++ b/projects/js-packages/publicize-components/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.71.3] - 2024-10-21 +### Changed +- Initial state: Migrated URLs in the editor to the new script data. [#39799] [#39797] +- Update dependencies. [#39781] + +### Fixed +- Social: Fixed Bluesky display name when it's not set in Bluesky profile. [#39840] + +## [0.71.2] - 2024-10-14 +### Added +- Social: Added Bluesky to social previews. [#39659] + +### Changed +- Updated package dependencies. [#39707] + +### Fixed +- Add missing deps in calls to the `useSelect` React hook. [#39421] +- Social: Updated the check to see if Bluesky is already connected. [#39661] + ## [0.71.1] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -959,6 +978,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated package dependencies. [#24470] +[0.71.3]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.71.2...v0.71.3 +[0.71.2]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.71.1...v0.71.2 [0.71.1]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.71.0...v0.71.1 [0.71.0]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.70.1...v0.71.0 [0.70.1]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.70.0...v0.70.1 diff --git a/projects/js-packages/publicize-components/changelog/add-bluesky-to-social-previews b/projects/js-packages/publicize-components/changelog/add-bluesky-to-social-previews deleted file mode 100644 index 8ccb859242038..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-bluesky-to-social-previews +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Social: Added Bluesky to social previews diff --git a/projects/js-packages/publicize-components/changelog/add-eslint-more-react-rules b/projects/js-packages/publicize-components/changelog/add-eslint-more-react-rules deleted file mode 100644 index a0fd180cffc88..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-eslint-more-react-rules +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Add missing deps in calls to the `useSelect` React hook. diff --git a/projects/js-packages/publicize-components/changelog/add-eslint-react-jsx-key b/projects/js-packages/publicize-components/changelog/add-eslint-react-jsx-key deleted file mode 100644 index 82cb4f8f842e5..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add `key` to Notice actions. Should be no change to functionality. - - diff --git a/projects/js-packages/publicize-components/changelog/add-eslint-wordpress-no-base-control-with-label-without-id b/projects/js-packages/publicize-components/changelog/add-eslint-wordpress-no-base-control-with-label-without-id deleted file mode 100644 index f19346531047d..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-eslint-wordpress-no-base-control-with-label-without-id +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Clean up `` without `id`. Should be no change in functionality. - - diff --git a/projects/js-packages/publicize-components/changelog/fix-social-bluesky-already-connected b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-already-connected deleted file mode 100644 index ea835c75c17e2..0000000000000 --- a/projects/js-packages/publicize-components/changelog/fix-social-bluesky-already-connected +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Social: Updated the check to see if Bluesky is already connected diff --git a/projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working new file mode 100644 index 0000000000000..5857f3006fd35 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-custom-domain-handles-not-working @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Social: Fixed Bluesky custom domain handle not being accepted diff --git a/projects/js-packages/publicize-components/changelog/fix-social-bluesky-reconnection-for-broken-connections b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-reconnection-for-broken-connections new file mode 100644 index 0000000000000..eb4d17f671962 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/fix-social-bluesky-reconnection-for-broken-connections @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fixed reconnection for broken Bluesky connections diff --git a/projects/js-packages/publicize-components/changelog/fix-social-bsky-profile-name-connection-management b/projects/js-packages/publicize-components/changelog/fix-social-bsky-profile-name-connection-management new file mode 100644 index 0000000000000..c33f654b62b79 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/fix-social-bsky-profile-name-connection-management @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fixed Bsky conneciton management profile name diff --git a/projects/js-packages/publicize-components/changelog/renovate-wordpress-monorepo b/projects/js-packages/publicize-components/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/publicize-components/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/publicize-components/changelog/update-enhances-publishing-feature-check b/projects/js-packages/publicize-components/changelog/update-enhances-publishing-feature-check new file mode 100644 index 0000000000000..e1af3f96c5a7e --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/update-enhances-publishing-feature-check @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Initial state: Migrated isEnhancedPublishingEnabled to feature check diff --git a/projects/js-packages/publicize-components/changelog/update-social-nuke-has-paid-plan b/projects/js-packages/publicize-components/changelog/update-social-nuke-has-paid-plan new file mode 100644 index 0000000000000..59e08c72626b5 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/update-social-nuke-has-paid-plan @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Initial state: Removed unused hasPaidPlan flag + + diff --git a/projects/js-packages/publicize-components/changelog/update-social-replace-has-paid-features-check b/projects/js-packages/publicize-components/changelog/update-social-replace-has-paid-features-check new file mode 100644 index 0000000000000..bf9a130af83ec --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/update-social-replace-has-paid-features-check @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Initial State: Migrated hasPaidFeatures flag with feature check on front-end + + diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json index cb71c7059c602..54856e9583755 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.71.1", + "version": "0.71.3", "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/connection-management/connection-name.tsx b/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx index 5259df0d9ea5b..230366360cc2b 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx @@ -27,10 +27,12 @@ export function ConnectionName( { connection }: ConnectionNameProps ) { return (
{ ! connection.profile_link ? ( - { connection.display_name } + + { connection.display_name || connection.external_name } + ) : ( - { connection.display_name || connection.external_display } + { connection.display_name || connection.external_display || connection.external_name } ) } { isUpdating ? ( diff --git a/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx b/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx index 107fdc5240c10..d6e11e80cf36e 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx @@ -58,11 +58,7 @@ export function Reconnect( { connection, service, variant = 'link' }: ReconnectP return; } - await setReconnectingAccount( - // Join service name and external ID - // just in case the external ID alone is not unique. - `${ connection.service_name }:${ connection.external_id }` - ); + await setReconnectingAccount( connection ); const formData = new FormData(); @@ -70,8 +66,19 @@ export function Reconnect( { connection, service, variant = 'link' }: ReconnectP formData.set( 'instance', connection.external_display ); } - requestAccess( formData ); - }, [ connection, deleteConnectionById, requestAccess, service.ID, setReconnectingAccount ] ); + if ( service.ID === 'bluesky' ) { + openConnectionsModal(); + } else { + requestAccess( formData ); + } + }, [ + connection, + deleteConnectionById, + openConnectionsModal, + requestAccess, + service.ID, + setReconnectingAccount, + ] ); if ( ! connection.can_disconnect ) { return null; diff --git a/projects/js-packages/publicize-components/src/components/form/broken-connections-notice.tsx b/projects/js-packages/publicize-components/src/components/form/broken-connections-notice.tsx index de9db8ac52020..371b847fac919 100644 --- a/projects/js-packages/publicize-components/src/components/form/broken-connections-notice.tsx +++ b/projects/js-packages/publicize-components/src/components/form/broken-connections-notice.tsx @@ -26,7 +26,7 @@ export const BrokenConnectionsNotice: React.FC = () => { ); } ); - const { connectionsAdminUrl } = usePublicizeConfig(); + const { connectionsPageUrl } = usePublicizeConfig(); const { useAdminUiV1 } = getSocialScriptData().feature_flags; @@ -39,7 +39,7 @@ export const BrokenConnectionsNotice: React.FC = () => { className={ styles[ 'broken-connection-btn' ] } /> ) : ( - + ); const getServiceLabel = useServiceLabel(); diff --git a/projects/js-packages/publicize-components/src/components/form/connection-notice.tsx b/projects/js-packages/publicize-components/src/components/form/connection-notice.tsx index f4bedf6763ccb..3d91d085372bb 100644 --- a/projects/js-packages/publicize-components/src/components/form/connection-notice.tsx +++ b/projects/js-packages/publicize-components/src/components/form/connection-notice.tsx @@ -1,3 +1,4 @@ +import { getMyJetpackUrl } from '@automattic/jetpack-script-data'; import { PanelRow } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import usePublicizeConfig from '../../hooks/use-publicize-config'; @@ -7,7 +8,7 @@ import styles from './styles.module.scss'; export const ConnectionNotice: React.FC = () => { const { hasConnections } = useSocialMediaConnections(); - const { needsUserConnection, userConnectionUrl } = usePublicizeConfig(); + const { needsUserConnection } = usePublicizeConfig(); if ( needsUserConnection ) { return ( @@ -18,7 +19,7 @@ export const ConnectionNotice: React.FC = () => { 'jetpack' ) }   - { __( 'Connect now', 'jetpack' ) } + { __( 'Connect now', 'jetpack' ) }

); diff --git a/projects/js-packages/publicize-components/src/components/form/enhanced-features-nudge.tsx b/projects/js-packages/publicize-components/src/components/form/enhanced-features-nudge.tsx index ce90b960e33a2..b66bab3557fad 100644 --- a/projects/js-packages/publicize-components/src/components/form/enhanced-features-nudge.tsx +++ b/projects/js-packages/publicize-components/src/components/form/enhanced-features-nudge.tsx @@ -5,20 +5,17 @@ import { isSimpleSite, } from '@automattic/jetpack-shared-extension-utils'; import { Button, PanelRow } from '@wordpress/components'; -import { useSelect } from '@wordpress/data'; import { _x } from '@wordpress/i18n'; -import { store as socialStore } from '../../social-store'; +import { hasSocialPaidFeatures } from '../../utils'; import styles from './styles.module.scss'; import { useAutoSaveAndRedirect } from './use-auto-save-and-redirect'; export const EnhancedFeaturesNudge: React.FC = () => { - const hasPaidFeatures = useSelect( select => select( socialStore ).hasPaidFeatures(), [] ); - const autosaveAndRedirect = useAutoSaveAndRedirect(); const isWpcom = isSimpleSite() || isAtomicSite(); - if ( isWpcom || hasPaidFeatures ) { + if ( isWpcom || hasSocialPaidFeatures() ) { return null; } diff --git a/projects/js-packages/publicize-components/src/components/form/instagram-no-media-notice.tsx b/projects/js-packages/publicize-components/src/components/form/instagram-no-media-notice.tsx index 2adeb6ceb74b8..87363f4f46077 100644 --- a/projects/js-packages/publicize-components/src/components/form/instagram-no-media-notice.tsx +++ b/projects/js-packages/publicize-components/src/components/form/instagram-no-media-notice.tsx @@ -1,13 +1,12 @@ import { getRedirectUrl } from '@automattic/jetpack-components'; +import { siteHasFeature } from '@automattic/jetpack-script-data'; import { ExternalLink } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { usePublicizeConfig } from '../../..'; +import { features } from '../../utils/constants'; import Notice from '../notice'; export const InstagramNoMediaNotice: React.FC = () => { - const { isEnhancedPublishingEnabled } = usePublicizeConfig(); - - return isEnhancedPublishingEnabled ? ( + return siteHasFeature( features.ENHANCED_PUBLISHING ) ? ( { __( 'To share to Instagram, add an image/video, or enable Social Image Generator.', diff --git a/projects/js-packages/publicize-components/src/components/form/settings-button.tsx b/projects/js-packages/publicize-components/src/components/form/settings-button.tsx index ec3a8d8ccd617..7527379232f5f 100644 --- a/projects/js-packages/publicize-components/src/components/form/settings-button.tsx +++ b/projects/js-packages/publicize-components/src/components/form/settings-button.tsx @@ -33,7 +33,7 @@ export function SettingsButton( { label, variant = 'primary' }: SettingsButtonPr }; }, [] ); const { openConnectionsModal } = useDispatch( store ); - const { connectionsAdminUrl } = usePublicizeConfig(); + const { connectionsPageUrl } = usePublicizeConfig(); const text = label || __( 'Manage connections', 'jetpack' ); const hasConnections = connections.length > 0; @@ -48,7 +48,7 @@ export function SettingsButton( { label, variant = 'primary' }: SettingsButtonPr { text } ) : ( - + { text } ); diff --git a/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx b/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx index 92794ff64f661..11ecd5e45aa23 100644 --- a/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx +++ b/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx @@ -1,5 +1,6 @@ -import { usePublicizeConfig } from '../../..'; +import { siteHasFeature } from '@automattic/jetpack-script-data'; import useSocialMediaMessage from '../../hooks/use-social-media-message'; +import { features } from '../../utils/constants'; import MediaSection from '../media-section'; import MessageBoxControl from '../message-box-control'; @@ -16,8 +17,6 @@ type SharePostFormProps = { export const SharePostForm: React.FC< SharePostFormProps > = ( { analyticsData = null } ) => { const { message, updateMessage, maxLength } = useSocialMediaMessage(); - const { isEnhancedPublishingEnabled } = usePublicizeConfig(); - return ( <> = ( { analyticsData = message={ message } analyticsData={ analyticsData } /> - { isEnhancedPublishingEnabled && } + { siteHasFeature( features.ENHANCED_PUBLISHING ) && ( + + ) } ); }; diff --git a/projects/js-packages/publicize-components/src/components/form/unsupported-connections-notice.tsx b/projects/js-packages/publicize-components/src/components/form/unsupported-connections-notice.tsx index 4118e69964eae..a3ef2edfffd64 100644 --- a/projects/js-packages/publicize-components/src/components/form/unsupported-connections-notice.tsx +++ b/projects/js-packages/publicize-components/src/components/form/unsupported-connections-notice.tsx @@ -9,7 +9,7 @@ import Notice from '../notice'; export const UnsupportedConnectionsNotice: React.FC = () => { const { connections } = useSocialMediaConnections(); - const { connectionsAdminUrl } = usePublicizeConfig(); + const { connectionsPageUrl } = usePublicizeConfig(); const unsupportedConnections = connections.filter( connection => checkConnectionCode( connection, 'unsupported' ) @@ -24,7 +24,7 @@ export const UnsupportedConnectionsNotice: React.FC = () => { 'jetpack' ), { - moreInfo: , + moreInfo: , } ) } diff --git a/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx b/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx index 4eecc6d050a37..6ffc93c8ca59b 100644 --- a/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx +++ b/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx @@ -90,7 +90,7 @@ export function ConfirmationForm( { keyringResult, onComplete, isAdmin }: Confir // If user account is supported, add it to the list if ( ! service.external_users_only ) { options.push( { - label: keyringResult.external_display, + label: keyringResult.external_display || keyringResult.external_name, value: keyringResult.external_ID, profile_picture: keyringResult.external_profile_picture, } ); @@ -150,7 +150,7 @@ export function ConfirmationForm( { keyringResult, onComplete, isAdmin }: Confir ); if ( reconnectingAccount ) { - setReconnectingAccount( '' ); + setReconnectingAccount( undefined ); } // Do not await the connection creation to unblock the UI @@ -215,7 +215,8 @@ export function ConfirmationForm( { keyringResult, onComplete, isAdmin }: Confir // If we are reconnecting an account, preselect it, // otherwise, preselect the first account const defaultChecked = reconnectingAccount - ? reconnectingAccount === `${ service?.ID }:${ option.value }` + ? reconnectingAccount.service_name === service?.ID && + reconnectingAccount.external_id === option.value : index === 0; return ( diff --git a/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx b/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx index 129dcbc54d9ba..336597e2dcaf2 100644 --- a/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx +++ b/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx @@ -24,14 +24,15 @@ export const ManageConnectionsModal = () => { }; }, [] ); - const { setKeyringResult, closeConnectionsModal } = useDispatch( store ); + const { setKeyringResult, closeConnectionsModal, setReconnectingAccount } = useDispatch( store ); const [ isSmall ] = useBreakpointMatch( 'sm' ); const closeModal = useCallback( () => { setKeyringResult( null ); + setReconnectingAccount( undefined ); closeConnectionsModal(); - }, [ closeConnectionsModal, setKeyringResult ] ); + }, [ closeConnectionsModal, setKeyringResult, setReconnectingAccount ] ); const hasKeyringResult = Boolean( keyringResult?.ID ); diff --git a/projects/js-packages/publicize-components/src/components/services/custom-inputs.tsx b/projects/js-packages/publicize-components/src/components/services/custom-inputs.tsx index 4064facfbf9ed..95e02ed8c8729 100644 --- a/projects/js-packages/publicize-components/src/components/services/custom-inputs.tsx +++ b/projects/js-packages/publicize-components/src/components/services/custom-inputs.tsx @@ -1,6 +1,9 @@ +import { Alert } from '@automattic/jetpack-components'; import { ExternalLink } from '@wordpress/components'; +import { useSelect } from '@wordpress/data'; import { createInterpolateElement, useId } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; +import { store } from '../../social-store'; import { SupportedService } from '../services/use-supported-services'; import styles from './style.module.scss'; @@ -17,6 +20,8 @@ type CustomInputsProps = { export function CustomInputs( { service }: CustomInputsProps ) { const id = useId(); + const reconnectingAccount = useSelect( select => select( store ).getReconnectingAccount(), [] ); + if ( 'mastodon' === service.ID ) { return (
@@ -58,6 +63,11 @@ export function CustomInputs( { service }: CustomInputsProps ) { required type="text" name="handle" + defaultValue={ + reconnectingAccount?.service_name === 'bluesky' + ? reconnectingAccount?.external_name + : undefined + } autoComplete="off" autoCapitalize="off" autoCorrect="off" @@ -93,6 +103,11 @@ export function CustomInputs( { service }: CustomInputsProps ) { aria-describedby={ `${ id }-password-description` } placeholder={ 'xxxx-xxxx-xxxx-xxxx' } /> + { reconnectingAccount?.service_name === 'bluesky' && ( + + { __( 'Please provide an app password to fix the connection.', 'jetpack' ) } + + ) }
); diff --git a/projects/js-packages/publicize-components/src/components/services/service-item.tsx b/projects/js-packages/publicize-components/src/components/services/service-item.tsx index 2020e883690a1..00754aa1a1e38 100644 --- a/projects/js-packages/publicize-components/src/components/services/service-item.tsx +++ b/projects/js-packages/publicize-components/src/components/services/service-item.tsx @@ -1,6 +1,6 @@ import { Button, useBreakpointMatch } from '@automattic/jetpack-components'; import { Panel, PanelBody } from '@wordpress/components'; -import { useReducer } from '@wordpress/element'; +import { useEffect, useReducer, useRef } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; import { Icon, chevronDown, chevronUp } from '@wordpress/icons'; import { ConnectForm } from './connect-form'; @@ -8,7 +8,9 @@ import { ServiceItemDetails, ServicesItemDetailsProps } from './service-item-det import { ServiceStatus } from './service-status'; import styles from './style.module.scss'; -export type ServicesItemProps = ServicesItemDetailsProps; +export type ServicesItemProps = ServicesItemDetailsProps & { + isPanelDefaultOpen?: boolean; +}; /** * Service item component @@ -17,10 +19,22 @@ export type ServicesItemProps = ServicesItemDetailsProps; * * @return {import('react').ReactNode} Service item component */ -export function ServiceItem( { service, serviceConnections }: ServicesItemProps ) { +export function ServiceItem( { + service, + serviceConnections, + isPanelDefaultOpen, +}: ServicesItemProps ) { const [ isSmall ] = useBreakpointMatch( 'sm' ); - const [ isPanelOpen, togglePanel ] = useReducer( state => ! state, false ); + const [ isPanelOpen, togglePanel ] = useReducer( state => ! state, isPanelDefaultOpen ); + const panelRef = useRef< HTMLDivElement >( null ); + + useEffect( () => { + if ( isPanelDefaultOpen ) { + panelRef.current?.scrollIntoView( { block: 'center', behavior: 'smooth' } ); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [] ); const areCustomInputsVisible = isPanelOpen && service.needsCustomInputs; @@ -94,7 +108,7 @@ export function ServiceItem( { service, serviceConnections }: ServicesItemProps
- + { diff --git a/projects/js-packages/publicize-components/src/components/services/services-list.tsx b/projects/js-packages/publicize-components/src/components/services/services-list.tsx index c2cdf4c4ac8b9..1a5c030c07820 100644 --- a/projects/js-packages/publicize-components/src/components/services/services-list.tsx +++ b/projects/js-packages/publicize-components/src/components/services/services-list.tsx @@ -27,11 +27,17 @@ export function ServicesList() { }, {} ); }, [] ); + const reconnectingAccount = useSelect( select => select( store ).getReconnectingAccount(), [] ); + return (
    { supportedServices.map( service => (
  • - +
  • ) ) }
diff --git a/projects/js-packages/publicize-components/src/components/services/use-request-access.ts b/projects/js-packages/publicize-components/src/components/services/use-request-access.ts index 18afab50c92d2..5a5ea00117b4a 100644 --- a/projects/js-packages/publicize-components/src/components/services/use-request-access.ts +++ b/projects/js-packages/publicize-components/src/components/services/use-request-access.ts @@ -11,10 +11,10 @@ const isValidMastodonUsername = ( username: string ) => /** * Example valid handles: + * - domain.tld * - username.bsky.social * - user-name.bsky.social - * - my_domain.com.bsky.social - * - my-domain.com.my-own-server.com + * - my-domain.com * * @param {string} handle - Handle to validate * @@ -23,8 +23,8 @@ const isValidMastodonUsername = ( username: string ) => function isValidBlueskyHandle( handle: string ) { const parts = handle.split( '.' ).filter( Boolean ); - // A valid handle should have at least 3 parts - username, domain, and tld - if ( parts.length < 3 ) { + // A valid handle should have at least 2 parts - domain, and tld + if ( parts.length < 2 ) { return false; } @@ -96,7 +96,10 @@ export function useRequestAccess( { service, onConfirm }: RequestAccessOptions ) } url.searchParams.set( 'handle', handle ); - url.searchParams.set( 'app_password', formData.get( 'app_password' ).toString().trim() ); + url.searchParams.set( + 'app_password', + ( formData.get( 'app_password' )?.toString() || '' ).trim() + ); break; } diff --git a/projects/js-packages/publicize-components/src/components/social-previews/instagram.js b/projects/js-packages/publicize-components/src/components/social-previews/instagram.js index 8af81b876c12e..96178d1b6b7c6 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/instagram.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/instagram.js @@ -1,12 +1,13 @@ import { Notice, getRedirectUrl } from '@automattic/jetpack-components'; +import { siteHasFeature } from '@automattic/jetpack-script-data'; import { InstagramPreviews } from '@automattic/social-previews'; import { ExternalLink } from '@wordpress/components'; import { useSelect } from '@wordpress/data'; import { __, _x } from '@wordpress/i18n'; import React from 'react'; -import usePublicizeConfig from '../../hooks/use-publicize-config'; import useSocialMediaMessage from '../../hooks/use-social-media-message'; import { SOCIAL_STORE_ID, CONNECTION_SERVICE_INSTAGRAM_BUSINESS } from '../../social-store'; +import { features } from '../../utils/constants'; /** * The Instagram tab component. @@ -19,7 +20,6 @@ export function Instagram( props ) { const { username: name, profileImage } = useSelect( select => select( SOCIAL_STORE_ID ).getConnectionProfileDetails( CONNECTION_SERVICE_INSTAGRAM_BUSINESS ) ); - const { isEnhancedPublishingEnabled } = usePublicizeConfig(); const { message: text } = useSocialMediaMessage(); @@ -42,7 +42,7 @@ export function Instagram( props ) { , ] } > - { isEnhancedPublishingEnabled + { siteHasFeature( features.ENHANCED_PUBLISHING ) ? __( 'To share to Instagram, add an image/video, or enable Social Image Generator.', 'jetpack' diff --git a/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js b/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js index e958ef3a199f7..e7827d27afd78 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js @@ -1,15 +1,14 @@ import { useConnection } from '@automattic/jetpack-connection'; import { - getJetpackExtensionAvailability, - isUpgradable, getJetpackData, - getSiteFragment, - isSimpleSite, + getJetpackExtensionAvailability, isAtomicSite, + isSimpleSite, + isUpgradable, } from '@automattic/jetpack-shared-extension-utils'; import { useSelect } from '@wordpress/data'; import { store as editorStore } from '@wordpress/editor'; -import { store as socialStore } from '../../social-store'; +import { getSocialScriptData } from '../../utils'; import { usePostMeta } from '../use-post-meta'; const republicizeFeatureName = 'republicize'; @@ -23,16 +22,12 @@ const republicizeFeatureName = 'republicize'; */ export default function usePublicizeConfig() { const isJetpackSite = ! isAtomicSite() && ! isSimpleSite(); - const blogID = getJetpackData()?.wpcomBlogId; const isRePublicizeFeatureAvailable = isJetpackSite || getJetpackExtensionAvailability( republicizeFeatureName )?.available; const isPostPublished = useSelect( select => select( editorStore ).isCurrentPostPublished(), [] ); const currentPostType = useSelect( select => select( editorStore ).getCurrentPostType(), [] ); const { isUserConnected } = useConnection(); - - const connectionsRootUrl = - getJetpackData()?.social?.publicizeConnectionsUrl ?? - 'https://wordpress.com/marketing/connections/'; + const { urls } = getSocialScriptData(); /* * isPublicizeEnabledMeta: @@ -85,19 +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 - * the site has the Advanced plan. - */ - const isEnhancedPublishingEnabled = !! getJetpackData()?.social?.isEnhancedPublishingEnabled; - /**\ * Returns true if the post type is a Jetpack Social Note. */ @@ -105,8 +87,6 @@ export default function usePublicizeConfig() { const needsUserConnection = ! isUserConnected && ! isSimpleSite(); - const userConnectionUrl = useSelect( select => select( socialStore ).userConnectionUrl(), [] ); - return { isPublicizeEnabledMeta, isPublicizeEnabled, @@ -116,16 +96,11 @@ export default function usePublicizeConfig() { isRePublicizeUpgradableViaUpsell, hidePublicizeFeature, isPostAlreadyShared, - hasPaidPlan, - isEnhancedPublishingEnabled, isSocialImageGeneratorAvailable: !! getJetpackData()?.social?.isSocialImageGeneratorAvailable && ! isJetpackSocialNote, isSocialImageGeneratorEnabled: !! getJetpackData()?.social?.isSocialImageGeneratorEnabled, - connectionsAdminUrl: connectionsRootUrl + ( blogID ?? getSiteFragment() ), - adminUrl: getJetpackData()?.social?.adminUrl, - jetpackSharingSettingsUrl: getJetpackData()?.social?.jetpackSharingSettingsUrl, + connectionsPageUrl: urls.connectionsManagementPage, isJetpackSocialNote, needsUserConnection, - userConnectionUrl, }; } diff --git a/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js b/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js index 8c23c207ad21d..78012e39b3db5 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js @@ -441,7 +441,7 @@ export function updatingConnection( connectionId, updating = true ) { /** * Sets the reconnecting account. * - * @param {string} reconnectingAccount - Account being reconnected. + * @param {import('../types').Connection} reconnectingAccount - Account being reconnected. * * @return {object} Reconnecting account action. */ diff --git a/projects/js-packages/publicize-components/src/social-store/reducer/index.js b/projects/js-packages/publicize-components/src/social-store/reducer/index.js index 9f8d335a59bbc..6bae3be245474 100644 --- a/projects/js-packages/publicize-components/src/social-store/reducer/index.js +++ b/projects/js-packages/publicize-components/src/social-store/reducer/index.js @@ -11,9 +11,6 @@ const reducer = combineReducers( { jetpackSettings, socialImageGeneratorSettings, shareStatus, - hasPaidPlan: ( state = false ) => state, - userConnectionUrl: ( state = '' ) => state, - hasPaidFeatures: ( state = false ) => state, } ); export default reducer; diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js b/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js index 7cf7db17aba76..25b675d301c4d 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js +++ b/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js @@ -54,15 +54,6 @@ export function getConnectionsByService( state, serviceName ) { return getConnections( state ).filter( ( { service_name } ) => service_name === serviceName ); } -/** - * Returns the connections admin URL from the store. - * @param {import("../types").SocialStoreState} state - State object. - * @return {string|null} The connections admin URL. - */ -export function getConnectionsAdminUrl( state ) { - return state.connectionData?.adminUrl ?? null; -} - /** * Returns whether there are connections in the store. * @param {import("../types").SocialStoreState} state - State object. @@ -190,7 +181,7 @@ export function getUpdatingConnections( state ) { * @return {import("../types").ConnectionData['reconnectingAccount']} The account being reconnected. */ export function getReconnectingAccount( state ) { - return state.connectionData?.reconnectingAccount ?? ''; + return state.connectionData?.reconnectingAccount; } /** diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/index.js b/projects/js-packages/publicize-components/src/social-store/selectors/index.js index 66d134aee2229..6cf378df068eb 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/index.js +++ b/projects/js-packages/publicize-components/src/social-store/selectors/index.js @@ -10,8 +10,6 @@ const selectors = { ...jetpackSettingSelectors, ...socialImageGeneratorSettingsSelectors, ...shareStatusSelectors, - userConnectionUrl: state => state.userConnectionUrl, - hasPaidFeatures: state => state.hasPaidFeatures, }; export default selectors; diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/jetpack-settings.js b/projects/js-packages/publicize-components/src/social-store/selectors/jetpack-settings.js index 66fd71d5add49..09d99b3937a34 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/jetpack-settings.js +++ b/projects/js-packages/publicize-components/src/social-store/selectors/jetpack-settings.js @@ -3,8 +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, isSocialNotesSettingsUpdating: state => state.jetpackSettings?.social_notes_is_updating, diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/site-data.js b/projects/js-packages/publicize-components/src/social-store/selectors/site-data.js index 5f1d726f3082d..3b4ab1d22a8b4 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/site-data.js +++ b/projects/js-packages/publicize-components/src/social-store/selectors/site-data.js @@ -1,5 +1,4 @@ const siteDataSelectors = { - getAdminUrl: state => state.siteData?.adminUrl ?? null, getAPIRootUrl: state => state.siteData?.apiRoot ?? null, getAPINonce: state => state.siteData?.apiNonce ?? null, getRegistrationNonce: state => state.siteData?.registrationNonce ?? null, diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/test/connection-data.test.js b/projects/js-packages/publicize-components/src/social-store/selectors/test/connection-data.test.js index 61c92970b9325..b73f4d62f1c49 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/test/connection-data.test.js +++ b/projects/js-packages/publicize-components/src/social-store/selectors/test/connection-data.test.js @@ -1,6 +1,5 @@ import { getConnections, - getConnectionsAdminUrl, hasConnections, getFailedConnections, getMustReauthConnections, @@ -11,7 +10,6 @@ import { const state = { connectionData: { - adminUrl: 'https://wordpress.com/some-url', connections: [ { id: '123456789', @@ -64,17 +62,6 @@ describe( 'Social store selectors: connectionData', () => { } ); } ); - describe( 'getConnectionsAdminUrl', () => { - it( 'should return null if no adminUrl', () => { - expect( getConnectionsAdminUrl( {} ) ).toBeNull(); - } ); - - it( 'should return adminUrl', () => { - const adminUrl = getConnectionsAdminUrl( state ); - expect( adminUrl ).toEqual( state.connectionData.adminUrl ); - } ); - } ); - describe( 'hasConnections', () => { it( 'should return false if no connections', () => { expect( hasConnections( {} ) ).toBe( false ); diff --git a/projects/js-packages/publicize-components/src/social-store/types.ts b/projects/js-packages/publicize-components/src/social-store/types.ts index a391f53024082..b0ed6db4cf0c7 100644 --- a/projects/js-packages/publicize-components/src/social-store/types.ts +++ b/projects/js-packages/publicize-components/src/social-store/types.ts @@ -25,7 +25,7 @@ export type ConnectionData = { connections: Connection[]; deletingConnections?: Array< number | string >; updatingConnections?: Array< number | string >; - reconnectingAccount?: string; + reconnectingAccount?: Connection; keyringResult?: KeyringResult; }; @@ -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; diff --git a/projects/js-packages/publicize-components/src/types/types.ts b/projects/js-packages/publicize-components/src/types/types.ts index 44b6c00c8342e..041b0bd18f8f4 100644 --- a/projects/js-packages/publicize-components/src/types/types.ts +++ b/projects/js-packages/publicize-components/src/types/types.ts @@ -1,3 +1,7 @@ +export interface SocialUrls { + connectionsManagementPage: string; +} + export type SharesData = { to_be_publicized_count: number; publicized_count: number; @@ -31,6 +35,7 @@ export interface SocialScriptData { feature_flags: FeatureFlags; supported_services: Array< ConnectionService >; shares_data: SharesData; + urls: SocialUrls; } type JetpackSettingsSelectors = { @@ -42,12 +47,10 @@ type JetpackSettingsSelectors = { isModuleEnabled: () => boolean; showPricingPage: () => boolean; isUpdatingJetpackSettings: () => boolean; - hasPaidPlan: () => boolean; }; type ConnectionDataSelectors = { getConnections: () => Array< object >; - getConnectionsAdminUrl: () => string; hasConnections: () => boolean; }; diff --git a/projects/js-packages/publicize-components/src/utils/constants.ts b/projects/js-packages/publicize-components/src/utils/constants.ts new file mode 100644 index 0000000000000..9ac40038d75b8 --- /dev/null +++ b/projects/js-packages/publicize-components/src/utils/constants.ts @@ -0,0 +1,3 @@ +export const features = { + ENHANCED_PUBLISHING: 'social-enhanced-publishing', +}; diff --git a/projects/js-packages/publicize-components/src/utils/index.js b/projects/js-packages/publicize-components/src/utils/index.js index 65f2dd163c5c5..6e0284f7b9870 100644 --- a/projects/js-packages/publicize-components/src/utils/index.js +++ b/projects/js-packages/publicize-components/src/utils/index.js @@ -2,3 +2,4 @@ export * from './get-share-message-max-length'; export * from './get-supported-additional-connections'; export * from './request-external-access'; export * from './types'; +export * from './script-data'; diff --git a/projects/js-packages/publicize-components/src/utils/script-data.ts b/projects/js-packages/publicize-components/src/utils/script-data.ts index 4db102747a639..25561a8b726f2 100644 --- a/projects/js-packages/publicize-components/src/utils/script-data.ts +++ b/projects/js-packages/publicize-components/src/utils/script-data.ts @@ -1,4 +1,4 @@ -import { getScriptData } from '@automattic/jetpack-script-data'; +import { getScriptData, siteHasFeature } from '@automattic/jetpack-script-data'; import { SocialScriptData } from '../types/types'; /** @@ -9,3 +9,12 @@ import { SocialScriptData } from '../types/types'; export function getSocialScriptData(): SocialScriptData { return getScriptData().social; } + +/** + * Check if the site has social paid features. + * + * @return {boolean} Whether the site has social paid features. + */ +export function hasSocialPaidFeatures() { + return siteHasFeature( 'social-enhanced-publishing' ); +} diff --git a/projects/js-packages/script-data/CHANGELOG.md b/projects/js-packages/script-data/CHANGELOG.md index 483863296910b..d6008bd9ac192 100644 --- a/projects/js-packages/script-data/CHANGELOG.md +++ b/projects/js-packages/script-data/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2024-10-21 +### Fixed +- Fixed the site features for Simple sites. [#39817] + ## [0.1.2] - 2024-08-21 ### Changed - Internal updates. @@ -17,5 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added jetpack-script-data package to consolidate the logic for Jetpack Initial state [#38430] +[0.1.3]: https://github.com/Automattic/jetpack-script-data/compare/v0.1.2...v0.1.3 [0.1.2]: https://github.com/Automattic/jetpack-script-data/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/Automattic/jetpack-script-data/compare/v0.1.0...v0.1.1 diff --git a/projects/js-packages/script-data/package.json b/projects/js-packages/script-data/package.json index 98db58435ae5f..b95ad91379ed9 100644 --- a/projects/js-packages/script-data/package.json +++ b/projects/js-packages/script-data/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-script-data", - "version": "0.1.2", + "version": "0.1.3", "description": "A library to provide data for script handles and the corresponding utility functions for Jetpack.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/script-data/#readme", "bugs": { diff --git a/projects/js-packages/script-data/src/utils.ts b/projects/js-packages/script-data/src/utils.ts index 690b6f4f7c298..667c1618c7b89 100644 --- a/projects/js-packages/script-data/src/utils.ts +++ b/projects/js-packages/script-data/src/utils.ts @@ -57,3 +57,14 @@ export function getMyJetpackUrl( section = '' ) { export function getActiveFeatures() { return getScriptData().site.plan?.features?.active ?? []; } + +/** + * Check if the site has a specific feature. + * + * @param {string} feature - The feature to check. e.g. "republicize". + * + * @return {boolean} Whether the site has the feature. + */ +export function siteHasFeature( feature: string ) { + return getActiveFeatures().includes( feature ); +} diff --git a/projects/js-packages/shared-extension-utils/CHANGELOG.md b/projects/js-packages/shared-extension-utils/CHANGELOG.md index 7df56ff5633b2..b0abeb5df6cdb 100644 --- a/projects/js-packages/shared-extension-utils/CHANGELOG.md +++ b/projects/js-packages/shared-extension-utils/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.15.14] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [0.15.13] - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + +### Fixed +- Add missing deps in calls to the `useSelect` React hook. [#39421] + ## [0.15.12] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -464,6 +475,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Core: prepare utility for release +[0.15.14]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.15.13...0.15.14 +[0.15.13]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.15.12...0.15.13 [0.15.12]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.15.11...0.15.12 [0.15.11]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.15.10...0.15.11 [0.15.10]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.15.9...0.15.10 diff --git a/projects/js-packages/shared-extension-utils/changelog/add-eslint-more-react-rules b/projects/js-packages/shared-extension-utils/changelog/add-eslint-more-react-rules deleted file mode 100644 index a0fd180cffc88..0000000000000 --- a/projects/js-packages/shared-extension-utils/changelog/add-eslint-more-react-rules +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Add missing deps in calls to the `useSelect` React hook. diff --git a/projects/js-packages/shared-extension-utils/changelog/renovate-wordpress-monorepo b/projects/js-packages/shared-extension-utils/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/shared-extension-utils/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/shared-extension-utils/package.json b/projects/js-packages/shared-extension-utils/package.json index 6cfec98271af8..25a832f9b09fa 100644 --- a/projects/js-packages/shared-extension-utils/package.json +++ b/projects/js-packages/shared-extension-utils/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-shared-extension-utils", - "version": "0.15.12", + "version": "0.15.14", "description": "Utility functions used by the block editor extensions", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/shared-extension-utils/#readme", "bugs": { diff --git a/projects/js-packages/social-logos/CHANGELOG.md b/projects/js-packages/social-logos/CHANGELOG.md index bff69d8b1aa8d..fadc43298865a 100644 --- a/projects/js-packages/social-logos/CHANGELOG.md +++ b/projects/js-packages/social-logos/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.1.9] - 2024-10-14 +### Fixed +- Add `key` in React example to make it more correct. [#39709] + ## [3.1.8] - 2024-09-05 ### Fixed - Address React usage issues found by eslint in example.tsx. [#39214] @@ -153,6 +157,7 @@ - Build: Refactored (aligned build system with Gridicons). +[3.1.9]: https://github.com/Automattic/social-logos/compare/v3.1.8...v3.1.9 [3.1.8]: https://github.com/Automattic/social-logos/compare/v3.1.7...v3.1.8 [3.1.7]: https://github.com/Automattic/social-logos/compare/v3.1.6...v3.1.7 [3.1.6]: https://github.com/Automattic/social-logos/compare/v3.1.5...v3.1.6 diff --git a/projects/js-packages/social-logos/changelog/add-eslint-react-jsx-key b/projects/js-packages/social-logos/changelog/add-eslint-react-jsx-key deleted file mode 100644 index 8825282028aaf..0000000000000 --- a/projects/js-packages/social-logos/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Add `key` in React example to make it more correct. diff --git a/projects/js-packages/social-logos/package.json b/projects/js-packages/social-logos/package.json index 889396052a556..c8ed32af63311 100644 --- a/projects/js-packages/social-logos/package.json +++ b/projects/js-packages/social-logos/package.json @@ -1,6 +1,6 @@ { "name": "social-logos", - "version": "3.1.8", + "version": "3.1.9", "description": "A repository of all the social logos used on WordPress.com.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/social-logos/", "bugs": { diff --git a/projects/js-packages/webpack-config/CHANGELOG.md b/projects/js-packages/webpack-config/CHANGELOG.md index 0725ac3a82100..aa1620a89277c 100644 --- a/projects/js-packages/webpack-config/CHANGELOG.md +++ b/projects/js-packages/webpack-config/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 3.5.0 - 2024-10-14 +### Added +- Babel preset: Add default for base `targets` option, replacing default `.presetEnv.targets`. [#39629] +- Babel preset: Add `autoWpPolyfill` option. [#39629] + +### Fixed +- Babel preset: Fix `pluginPreserveI18n` option. [#39629] +- Update documentation for `DependencyExtractionPlugin` after #38877 and #38430. [#39629] + ## 3.4.4 - 2024-10-10 ### Changed - Updated package dependencies. diff --git a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill b/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index 0fa83915d6d58..0000000000000 --- a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Babel preset: Fix `pluginPreserveI18n` option. diff --git a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#2 b/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#2 deleted file mode 100644 index 23be7808ea98a..0000000000000 --- a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Babel preset: Add default for base `targets` option, replacing default `.presetEnv.targets`. diff --git a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#3 b/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#3 deleted file mode 100644 index d79f5888b9a34..0000000000000 --- a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#3 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Babel preset: Add `autoWpPolyfill` option. diff --git a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#4 b/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#4 deleted file mode 100644 index 608cf4e38c846..0000000000000 --- a/projects/js-packages/webpack-config/changelog/add-dependency-extraction-auto-polyfill#4 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Update documentation for `DependencyExtractionPlugin` after #38877 and #38430. diff --git a/projects/js-packages/webpack-config/package.json b/projects/js-packages/webpack-config/package.json index 7aefbf121f6d9..6ba758ec82ef2 100644 --- a/projects/js-packages/webpack-config/package.json +++ b/projects/js-packages/webpack-config/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-webpack-config", - "version": "3.4.4", + "version": "3.5.0", "description": "Library of pieces for webpack config in Jetpack projects.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/webpack-config/#readme", "bugs": { diff --git a/projects/packages/autoloader/CHANGELOG.md b/projects/packages/autoloader/CHANGELOG.md index 184626b2caba2..3889034504875 100644 --- a/projects/packages/autoloader/CHANGELOG.md +++ b/projects/packages/autoloader/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.1.2] - 2024-10-15 +### Changed +- Internal updates. + ## [3.1.1] - 2024-10-10 ### Changed - Internal updates. @@ -381,6 +385,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Custom Autoloader +[3.1.2]: https://github.com/Automattic/jetpack-autoloader/compare/v3.1.1...v3.1.2 [3.1.1]: https://github.com/Automattic/jetpack-autoloader/compare/v3.1.0...v3.1.1 [3.1.0]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.10...v3.1.0 [3.0.10]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.9...v3.0.10 diff --git a/projects/packages/autoloader/README.md b/projects/packages/autoloader/README.md index ec9d2f45c6d08..933cb4abab318 100644 --- a/projects/packages/autoloader/README.md +++ b/projects/packages/autoloader/README.md @@ -45,6 +45,26 @@ During development, you can force the autoloader to use development package vers - `9999999-dev` - Versions with a `dev-` prefix. + +Autoloader Limitations and Caveats +----- + +### Plugin Updates + +When moving a package class file, renaming a package class file, or changing a package class namespace, make sure that the class will not be loaded after a plugin update. + +The autoloader builds the in memory classmap as soon as the autoloader is loaded. The package class file paths in the map are not updated after a plugin update. If a plugins's package class files are moved during a plugin update and a moved file is autoloaded after the update, an error will occur. + +### Moving classes to a different package + +Jetpack Autoloader determines the hierarchy of class versions by package version numbers. It can cause problems if a class is moved to a newer package with a lower version number, it will get overshadowed by the old package. + +For instance, if your newer version of a class comes from a new package versioned 0.1.0, and the older version comes from a different package with a greater version number 2.0.1, the newer class will not get loaded. + +### Jetpack Autoloader uses transient cache + +This is a caveat to be aware of when dealing with issues. The JP Autoloader uses transients to cache a list of available plugins to speed up the lookup process. This can sometimes mask problems that arise when loading code too early. See the [Debugging](#debugging) section for more information on how to detect situations like this. + Debugging ----- @@ -70,13 +90,3 @@ PSR-4 and PSR-0 namespaces are converted to classmaps. Supports PSR-4 autoloading. PSR-0 namespaces are converted to classmaps. - -Autoloader Limitations ------ - -Plugin Updates - -When moving a package class file, renaming a package class file, or changing a package class namespace, make sure that the class will not be loaded after a plugin update. - -The autoloader builds the in memory classmap as soon as the autoloader is loaded. The package class file paths in the map are not updated after a plugin update. If a plugins's package class files are moved during a plugin update and a moved file is autoloaded after the update, an error will occur. - diff --git a/projects/packages/autoloader/src/AutoloadGenerator.php b/projects/packages/autoloader/src/AutoloadGenerator.php index e10b029d172f5..1be2ef82b7815 100644 --- a/projects/packages/autoloader/src/AutoloadGenerator.php +++ b/projects/packages/autoloader/src/AutoloadGenerator.php @@ -21,7 +21,7 @@ */ class AutoloadGenerator { - const VERSION = '3.1.1'; + const VERSION = '3.1.2'; /** * IO object. diff --git a/projects/packages/backup/CHANGELOG.md b/projects/packages/backup/CHANGELOG.md index 21e08f08ad0ba..fa30ee71ad93c 100644 --- a/projects/packages/backup/CHANGELOG.md +++ b/projects/packages/backup/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.4.15] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [3.4.14] - 2024-10-14 +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] +- Updated package dependencies. [#39707] + ## [3.4.13] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -713,6 +722,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add API endpoints and Jetpack Backup package for managing Help… +[3.4.15]: https://github.com/Automattic/jetpack-backup/compare/v3.4.14...v3.4.15 +[3.4.14]: https://github.com/Automattic/jetpack-backup/compare/v3.4.13...v3.4.14 [3.4.13]: https://github.com/Automattic/jetpack-backup/compare/v3.4.12...v3.4.13 [3.4.12]: https://github.com/Automattic/jetpack-backup/compare/v3.4.11...v3.4.12 [3.4.11]: https://github.com/Automattic/jetpack-backup/compare/v3.4.10...v3.4.11 diff --git a/projects/packages/backup/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/backup/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/backup/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/backup/changelog/renovate-wordpress-monorepo b/projects/packages/backup/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/backup/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/backup/src/class-package-version.php b/projects/packages/backup/src/class-package-version.php index 50da02aa62cd5..de8eb1d2e432a 100644 --- a/projects/packages/backup/src/class-package-version.php +++ b/projects/packages/backup/src/class-package-version.php @@ -16,7 +16,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '3.4.13'; + const PACKAGE_VERSION = '3.4.15'; const PACKAGE_SLUG = 'backup'; diff --git a/projects/packages/blaze/CHANGELOG.md b/projects/packages/blaze/CHANGELOG.md index 1893024d274b6..64f62d295a32a 100644 --- a/projects/packages/blaze/CHANGELOG.md +++ b/projects/packages/blaze/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.23.2] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [0.23.1] - 2024-10-14 +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] +- Updated package dependencies. [#39707] + ## [0.23.0] - 2024-10-07 ### Changed - Changes the error Blaze shows during sync to be a warning. [#39515] @@ -461,6 +470,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated package dependencies. [#27906] +[0.23.2]: https://github.com/automattic/jetpack-blaze/compare/v0.23.1...v0.23.2 +[0.23.1]: https://github.com/automattic/jetpack-blaze/compare/v0.23.0...v0.23.1 [0.23.0]: https://github.com/automattic/jetpack-blaze/compare/v0.22.12...v0.23.0 [0.22.12]: https://github.com/automattic/jetpack-blaze/compare/v0.22.11...v0.22.12 [0.22.11]: https://github.com/automattic/jetpack-blaze/compare/v0.22.10...v0.22.11 diff --git a/projects/packages/blaze/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/blaze/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/blaze/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/blaze/changelog/renovate-wordpress-monorepo b/projects/packages/blaze/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/blaze/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/blaze/package.json b/projects/packages/blaze/package.json index 44d034f7791a1..e7552046cf583 100644 --- a/projects/packages/blaze/package.json +++ b/projects/packages/blaze/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-blaze", - "version": "0.23.0", + "version": "0.23.2", "description": "Attract high-quality traffic to your site using Blaze. Using this service, you can advertise a post or page on some of the millions of pages across WordPress.com and Tumblr from just $5 per day.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/blaze/#readme", "bugs": { diff --git a/projects/packages/blaze/src/class-dashboard.php b/projects/packages/blaze/src/class-dashboard.php index a4559a9b69824..110872540a70f 100644 --- a/projects/packages/blaze/src/class-dashboard.php +++ b/projects/packages/blaze/src/class-dashboard.php @@ -21,7 +21,7 @@ class Dashboard { * * @var string */ - const PACKAGE_VERSION = '0.23.0'; + const PACKAGE_VERSION = '0.23.2'; /** * List of dependencies needed to render the dashboard in wp-admin. diff --git a/projects/packages/changelogger/changelog/fix-changelogger-amend-default-link b/projects/packages/changelogger/changelog/fix-changelogger-amend-default-link new file mode 100644 index 0000000000000..09dc0989a5b9c --- /dev/null +++ b/projects/packages/changelogger/changelog/fix-changelogger-amend-default-link @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +When amending, do not preserve a default link. We'll want the link to be updated to the new default. diff --git a/projects/packages/changelogger/src/WriteCommand.php b/projects/packages/changelogger/src/WriteCommand.php index 900167f64d328..1a23cbdf38090 100644 --- a/projects/packages/changelogger/src/WriteCommand.php +++ b/projects/packages/changelogger/src/WriteCommand.php @@ -412,7 +412,11 @@ protected function doAmendChanges( InputInterface $input, OutputInterface $outpu $input->setOption( 'epilogue', $latest->getEpilogue() ); } if ( $input->getOption( 'link' ) === null ) { - $input->setOption( 'link', $latest->getLink() ); + $oldLink = $latest->getLink(); + $defaultLink = $changelog->getLatestEntry() ? Config::link( $changelog->getLatestEntry()->getVersion(), $latest->getVersion() ) : null; + if ( $oldLink !== $defaultLink ) { + $input->setOption( 'link', $latest->getLink() ); + } } } else { $output->writeln( 'No version to amend, ignoring --amend.', OutputInterface::VERBOSITY_DEBUG ); diff --git a/projects/packages/changelogger/tests/php/tests/src/WriteCommandTest.php b/projects/packages/changelogger/tests/php/tests/src/WriteCommandTest.php index ebb2e105351a6..1ea6e7d0c1f6d 100644 --- a/projects/packages/changelogger/tests/php/tests/src/WriteCommandTest.php +++ b/projects/packages/changelogger/tests/php/tests/src/WriteCommandTest.php @@ -749,6 +749,54 @@ public function provideExecute() { true, "# Changelog\n\n## 1.0.1 - $date\n\nPrologue for v1.0.1\n\n### Added\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n", ), + 'Amend, beta to release' => array( + array( '--amend' => true ), + array( + 'composer.json' => array( 'link-template' => 'https://example.org/diff/${old}..${new}' ), + 'changes' => array(), + 'changelog' => "# Changelog\n\n## [1.0.1-beta] - $date\n\nPrologue for v1.0.1\n\n### Added\n- New stuff.\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n\n### Fixed\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n\n[1.0.1-beta]: https://example.org/new-link\n", + ), + array( 'Y' ), + 0, + array( + '{^No changes were found! Proceed\? \[y/N\] $}m', + ), + true, + "# Changelog\n\n## [1.0.1] - $date\n\nPrologue for v1.0.1\n\n### Added\n- New stuff.\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n\n### Fixed\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n\n[1.0.1]: https://example.org/new-link\n", + ), + 'Amend, ignore default link' => array( + array( '--amend' => true ), + array( + 'composer.json' => array( 'link-template' => 'https://example.org/diff/${old}..${new}' ), + 'changes' => array(), + 'changelog' => "# Changelog\n\n## [1.0.1-beta] - $date\n\nPrologue for v1.0.1\n\n### Added\n- New stuff.\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n\n### Fixed\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n\n[1.0.1-beta]: https://example.org/diff/1.0.0..1.0.1-beta\n", + ), + array( 'Y' ), + 0, + array( + '{^No changes were found! Proceed\? \[y/N\] $}m', + ), + true, + "# Changelog\n\n## [1.0.1] - $date\n\nPrologue for v1.0.1\n\n### Added\n- New stuff.\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n\n### Fixed\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n\n[1.0.1]: https://example.org/diff/1.0.0..1.0.1\n", + ), + 'Amend, manually override default link' => array( + array( + '--amend' => true, + '--link' => 'https://example.org/new-link', + ), + array( + 'composer.json' => array( 'link-template' => 'https://example.org/diff/${old}..${new}' ), + 'changes' => array(), + 'changelog' => "# Changelog\n\n## [1.0.1-beta] - $date\n\nPrologue for v1.0.1\n\n### Added\n- New stuff.\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n\n### Fixed\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n\n[1.0.1-beta]: https://example.org/diff/1.0.0..1.0.1-beta\n", + ), + array( 'Y' ), + 0, + array( + '{^No changes were found! Proceed\? \[y/N\] $}m', + ), + true, + "# Changelog\n\n## [1.0.1] - $date\n\nPrologue for v1.0.1\n\n### Added\n- New stuff.\n- Stuff.\n- ZZZ.\n\n### Removed\n- Other stuff.\n\n### Fixed\n- Broken stuff.\n\nEpilogue for v1.0.1\n\n## 1.0.0 - 2021-02-23\n\n- Initial release.\n\n[1.0.1]: https://example.org/new-link\n", + ), '--use-version invalid' => array( array( '--use-version' => '2.0' ), diff --git a/projects/packages/classic-theme-helper/CHANGELOG.md b/projects/packages/classic-theme-helper/CHANGELOG.md index ff8f60b2b848a..6d59408c451c5 100644 --- a/projects/packages/classic-theme-helper/CHANGELOG.md +++ b/projects/packages/classic-theme-helper/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.4] - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + ## [0.6.3] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -130,6 +134,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Add wordpress folder on gitignore. [#37177] +[0.6.4]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.6.3...v0.6.4 [0.6.3]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.6.2...v0.6.3 [0.6.2]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.6.1...v0.6.2 [0.6.1]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.6.0...v0.6.1 diff --git a/projects/packages/classic-theme-helper/changelog/add-dependency-extraction-auto-polyfill#2 b/projects/packages/classic-theme-helper/changelog/add-dependency-extraction-auto-polyfill#2 deleted file mode 100644 index 9e8ffe1ab8734..0000000000000 --- a/projects/packages/classic-theme-helper/changelog/add-dependency-extraction-auto-polyfill#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: removed -Comment: Remove unnecessary JS dep on `@wordpress/dependency-extraction-webpack-plugin` - - diff --git a/projects/packages/classic-theme-helper/changelog/renovate-wordpress-monorepo b/projects/packages/classic-theme-helper/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/classic-theme-helper/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/classic-theme-helper/package.json b/projects/packages/classic-theme-helper/package.json index ba926cdf342a4..6e9427b2d6658 100644 --- a/projects/packages/classic-theme-helper/package.json +++ b/projects/packages/classic-theme-helper/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-classic-theme-helper", - "version": "0.6.3", + "version": "0.6.4", "description": "Features used with classic themes", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/classic-theme-helper/#readme", "bugs": { diff --git a/projects/packages/classic-theme-helper/src/class-main.php b/projects/packages/classic-theme-helper/src/class-main.php index 4ff204f77e24d..6c1004d88ee98 100644 --- a/projects/packages/classic-theme-helper/src/class-main.php +++ b/projects/packages/classic-theme-helper/src/class-main.php @@ -14,7 +14,7 @@ */ class Main { - const PACKAGE_VERSION = '0.6.3'; + const PACKAGE_VERSION = '0.6.4'; /** * Modules to include. diff --git a/projects/packages/connection/CHANGELOG.md b/projects/packages/connection/CHANGELOG.md index b4755a410b998..01ae992f43f27 100644 --- a/projects/packages/connection/CHANGELOG.md +++ b/projects/packages/connection/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.1.4] - 2024-10-21 +### Changed +- SSO: optimize 'admin_notices' action callback. [#39811] + ## [5.1.3] - 2024-10-10 ### Changed - Updated package dependencies. @@ -1226,6 +1230,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Separate the connection library into its own package. +[5.1.4]: https://github.com/Automattic/jetpack-connection/compare/v5.1.3...v5.1.4 [5.1.3]: https://github.com/Automattic/jetpack-connection/compare/v5.1.2...v5.1.3 [5.1.2]: https://github.com/Automattic/jetpack-connection/compare/v5.1.1...v5.1.2 [5.1.1]: https://github.com/Automattic/jetpack-connection/compare/v5.1.0...v5.1.1 diff --git a/projects/packages/connection/changelog/fix-jetpack-story-block-connection-assets b/projects/packages/connection/changelog/fix-jetpack-story-block-connection-assets new file mode 100644 index 0000000000000..4652d98b066f2 --- /dev/null +++ b/projects/packages/connection/changelog/fix-jetpack-story-block-connection-assets @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: PHPDoc comment change. + + diff --git a/projects/packages/connection/src/class-connection-assets.php b/projects/packages/connection/src/class-connection-assets.php index f231aa40b7b9e..93daae1b536f7 100644 --- a/projects/packages/connection/src/class-connection-assets.php +++ b/projects/packages/connection/src/class-connection-assets.php @@ -25,6 +25,9 @@ public static function configure() { /** * Register assets. + * + * NOTICE: Please think twice before including Connection scripts in the frontend. + * Those scripts are intended to be used in WP admin area. */ public static function register_assets() { diff --git a/projects/packages/connection/src/class-package-version.php b/projects/packages/connection/src/class-package-version.php index a11e92bf93e7b..0ed481101c11e 100644 --- a/projects/packages/connection/src/class-package-version.php +++ b/projects/packages/connection/src/class-package-version.php @@ -12,7 +12,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '5.1.3'; + const PACKAGE_VERSION = '5.1.4'; const PACKAGE_SLUG = 'connection'; diff --git a/projects/packages/connection/src/sso/class-user-admin.php b/projects/packages/connection/src/sso/class-user-admin.php index 42c7e045be64b..d194fac2be9e9 100644 --- a/projects/packages/connection/src/sso/class-user-admin.php +++ b/projects/packages/connection/src/sso/class-user-admin.php @@ -59,7 +59,11 @@ public function __construct() { add_filter( 'manage_users_columns', array( $this, 'jetpack_user_connected_th' ) ); add_filter( 'manage_users_custom_column', array( $this, 'jetpack_show_connection_status' ), 10, 3 ); add_action( 'user_row_actions', array( $this, 'jetpack_user_table_row_actions' ), 10, 2 ); - add_action( 'admin_notices', array( $this, 'handle_invitation_results' ) ); + + if ( isset( $_GET['jetpack-sso-invite-user'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended + add_action( 'admin_notices', array( $this, 'handle_invitation_results' ) ); + } + add_action( 'admin_post_jetpack_invite_user_to_wpcom', array( $this, 'invite_user_to_wpcom' ) ); add_action( 'admin_post_jetpack_revoke_invite_user_to_wpcom', array( $this, 'handle_request_revoke_invite' ) ); add_action( 'admin_post_jetpack_resend_invite_user_to_wpcom', array( $this, 'handle_request_resend_invite' ) ); diff --git a/projects/packages/explat/CHANGELOG.md b/projects/packages/explat/CHANGELOG.md index 586205847ce3f..1c24547a6db02 100644 --- a/projects/packages/explat/CHANGELOG.md +++ b/projects/packages/explat/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.12] - 2024-10-14 +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] + ## [0.1.11] - 2024-10-10 ### Changed - Updated package dependencies. [#39649] @@ -60,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ExPlat: add condition to prevent fetching the experiment assignment if there's not anon id (meaning that Tracks is likely disabled) [#38327] - Updated package dependencies. [#38132] +[0.1.12]: https://github.com/Automattic/jetpack-explat/compare/v0.1.11...v0.1.12 [0.1.11]: https://github.com/Automattic/jetpack-explat/compare/v0.1.10...v0.1.11 [0.1.10]: https://github.com/Automattic/jetpack-explat/compare/v0.1.9...v0.1.10 [0.1.9]: https://github.com/Automattic/jetpack-explat/compare/v0.1.8...v0.1.9 diff --git a/projects/packages/explat/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/explat/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/explat/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/explat/package.json b/projects/packages/explat/package.json index 88c5b213328dd..81bcba1611c3a 100644 --- a/projects/packages/explat/package.json +++ b/projects/packages/explat/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-explat", - "version": "0.1.11", + "version": "0.1.12", "description": "A package for running A/B tests on the Experimentation Platform (ExPlat) in the plugin.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/explat/#readme", "bugs": { diff --git a/projects/packages/explat/src/class-explat.php b/projects/packages/explat/src/class-explat.php index 00f953d55761a..f0ac98824778c 100644 --- a/projects/packages/explat/src/class-explat.php +++ b/projects/packages/explat/src/class-explat.php @@ -20,7 +20,7 @@ class ExPlat { * * @var string */ - const PACKAGE_VERSION = '0.1.11'; + const PACKAGE_VERSION = '0.1.12'; /** * Initializer. diff --git a/projects/packages/forms/CHANGELOG.md b/projects/packages/forms/CHANGELOG.md index a0e88e997b786..2357526c70e25 100644 --- a/projects/packages/forms/CHANGELOG.md +++ b/projects/packages/forms/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.33.4] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [0.33.3] - 2024-10-14 +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] +- Updated package dependencies. [#39707] + +### Fixed +- Improve security of the form endpoint. [#39759] + ## [0.33.2] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -681,6 +693,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a new jetpack/forms package [#28409] - Added a public load_contact_form method for initializing the contact form module. [#28416] +[0.33.4]: https://github.com/automattic/jetpack-forms/compare/v0.33.3...v0.33.4 +[0.33.3]: https://github.com/automattic/jetpack-forms/compare/v0.33.2...v0.33.3 [0.33.2]: https://github.com/automattic/jetpack-forms/compare/v0.33.1...v0.33.2 [0.33.1]: https://github.com/automattic/jetpack-forms/compare/v0.33.0...v0.33.1 [0.33.0]: https://github.com/automattic/jetpack-forms/compare/v0.32.16...v0.33.0 diff --git a/projects/packages/forms/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/forms/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/forms/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/forms/changelog/add-eslint-react-jsx-key b/projects/packages/forms/changelog/add-eslint-react-jsx-key deleted file mode 100644 index ad79ea4996f29..0000000000000 --- a/projects/packages/forms/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add `key` in JetpackFieldControls controls. Should be no change to functionality. - - diff --git a/projects/packages/forms/changelog/add-eslint-wordpress-no-base-control-with-label-without-id b/projects/packages/forms/changelog/add-eslint-wordpress-no-base-control-with-label-without-id deleted file mode 100644 index f19346531047d..0000000000000 --- a/projects/packages/forms/changelog/add-eslint-wordpress-no-base-control-with-label-without-id +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Clean up `` without `id`. Should be no change in functionality. - - diff --git a/projects/packages/forms/changelog/fix-phpcompatibility-new-dev-sniff b/projects/packages/forms/changelog/fix-phpcompatibility-new-dev-sniff deleted file mode 100644 index e7852b6f5a08b..0000000000000 --- a/projects/packages/forms/changelog/fix-phpcompatibility-new-dev-sniff +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Explicitly pass `$escape` for `fputcsv` to fix new phpcompatibility-dev sniff. Note we may want to change it once we drop PHP <7.4 compat. - - diff --git a/projects/packages/forms/changelog/renovate-wordpress-monorepo b/projects/packages/forms/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/forms/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/forms/package.json b/projects/packages/forms/package.json index 14f016cae5206..0fbedf955ef9b 100644 --- a/projects/packages/forms/package.json +++ b/projects/packages/forms/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-forms", - "version": "0.33.2", + "version": "0.33.4", "description": "Jetpack Forms", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme", "bugs": { diff --git a/projects/packages/forms/src/class-jetpack-forms.php b/projects/packages/forms/src/class-jetpack-forms.php index c6b3101bc86b1..d056158932ef0 100644 --- a/projects/packages/forms/src/class-jetpack-forms.php +++ b/projects/packages/forms/src/class-jetpack-forms.php @@ -15,7 +15,7 @@ */ class Jetpack_Forms { - const PACKAGE_VERSION = '0.33.2'; + const PACKAGE_VERSION = '0.33.4'; /** * Load the contact form module. diff --git a/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php b/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php index 4338d939f02ee..fc888fc5d5652 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php +++ b/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php @@ -22,6 +22,9 @@ class Contact_Form_Endpoint extends \WP_REST_Posts_Controller { * @return WP_Error|boolean */ public function get_items_permissions_check( $request ) { //phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + if ( ! current_user_can( 'edit_pages' ) ) { + return false; + } if ( ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) { return new WP_Error( 'rest_cannot_view', @@ -40,6 +43,9 @@ public function get_items_permissions_check( $request ) { //phpcs:ignore Variabl * @return WP_Error|boolean */ public function get_item_permissions_check( $request ) { //phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + if ( ! current_user_can( 'edit_pages' ) ) { + return false; + } if ( ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) { return new WP_Error( 'rest_cannot_view', diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-domain-dns-task b/projects/packages/jetpack-mu-wpcom/changelog/add-domain-dns-task new file mode 100644 index 0000000000000..b73c325179447 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-domain-dns-task @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Add new task for domain mapping in migration Launchpad diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-domain-tasks-post-migration b/projects/packages/jetpack-mu-wpcom/changelog/add-domain-tasks-post-migration new file mode 100644 index 0000000000000..6ee08618dca91 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-domain-tasks-post-migration @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Add new task for domain connection to post-migration checklist. diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-help-admin-bar-menu-tooltip b/projects/packages/jetpack-mu-wpcom/changelog/add-help-admin-bar-menu-tooltip new file mode 100644 index 0000000000000..6e8f1b503296d --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-help-admin-bar-menu-tooltip @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Admin bar: Add help icon tooltip diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-reader-admin-bar-menu-title b/projects/packages/jetpack-mu-wpcom/changelog/add-reader-admin-bar-menu-title new file mode 100644 index 0000000000000..b549c878a8d32 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-reader-admin-bar-menu-title @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Admin bar: Add reader icon tooltip diff --git a/projects/packages/videopress/changelog/add-editor-blocks-add-tracks-for-connection-banner b/projects/packages/jetpack-mu-wpcom/changelog/add-ssl-provisioned-task similarity index 50% rename from projects/packages/videopress/changelog/add-editor-blocks-add-tracks-for-connection-banner rename to projects/packages/jetpack-mu-wpcom/changelog/add-ssl-provisioned-task index b4b466d69c05a..6a120468bd1ad 100644 --- a/projects/packages/videopress/changelog/add-editor-blocks-add-tracks-for-connection-banner +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-ssl-provisioned-task @@ -1,4 +1,4 @@ Significance: patch Type: added -Add tracks to connection banner +adding a WPCOM task diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-migration-site-completed-by-default b/projects/packages/jetpack-mu-wpcom/changelog/fix-migration-site-completed-by-default new file mode 100644 index 0000000000000..06b4f49b9037a --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-migration-site-completed-by-default @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Make the Migrating the site task complete by default diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-verbum-comment-gravatar-width b/projects/packages/jetpack-mu-wpcom/changelog/fix-verbum-comment-gravatar-width new file mode 100644 index 0000000000000..2084bdf39d9d4 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-verbum-comment-gravatar-width @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Verbum Comments: fix gravatar width in nested comments diff --git a/projects/packages/jetpack-mu-wpcom/changelog/help-center-prevent-excessive-loading b/projects/packages/jetpack-mu-wpcom/changelog/help-center-prevent-excessive-loading new file mode 100644 index 0000000000000..d95a7ef42d8cf --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/help-center-prevent-excessive-loading @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + + diff --git a/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php b/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php index fd7c87b781605..c35a369d86d2d 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php @@ -52,13 +52,18 @@ private static function is_proxied() { /** * Creates instance. * - * @return \A8C\FSE\Help_Center + * @return void */ public static function init() { + $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; + + if ( str_contains( $request_uri, 'wp-content/plugins/gutenberg-core' ) || str_contains( $request_uri, 'preview=true' ) ) { + return; + } + if ( self::$instance === null ) { self::$instance = new self(); } - return self::$instance; } /** @@ -90,7 +95,7 @@ function ( $wp_admin_bar ) { $wp_admin_bar->add_menu( array( 'id' => 'help-center', - 'title' => self::download_asset( 'widgets.wp.com/help-center/help-icon.svg', false ), + 'title' => '' . self::download_asset( 'widgets.wp.com/help-center/help-icon.svg', false ) . '', 'parent' => 'top-secondary', 'href' => $this->get_help_center_url(), 'meta' => array( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php index cc6d818019963..2d870ff8b8766 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php @@ -806,9 +806,10 @@ function wpcom_launchpad_get_task_definitions() { 'get_title' => function () { return __( 'Migrating the site', 'jetpack-mu-wpcom' ); }, - 'is_complete_callback' => 'wpcom_launchpad_is_task_option_completed', + 'is_complete_callback' => '__return_true', 'is_visible_callback' => '__return_true', ), + // Post-migration tasks. 'review_site' => array( 'get_title' => function () { return __( "Review the site's content", 'jetpack-mu-wpcom' ); @@ -829,6 +830,39 @@ function wpcom_launchpad_get_task_definitions() { return admin_url( 'plugins.php' ); }, ), + 'connect_migration_domain' => array( + 'get_title' => function () { + return __( 'Connect your domain', 'jetpack-mu-wpcom' ); + }, + 'get_calypso_path' => function ( $task, $default, $data ) { + $site_id = get_current_blog_id(); + // Attempt to get the domain from the pre-transfer site option if the function exists, otherwise check the current site option. + // @phan-suppress-next-line PhanUndeclaredFunction -- Being checked before being called. + $domain = function_exists( 'wpcom_get_migration_source_site_domain' ) ? wpcom_get_migration_source_site_domain( $site_id ) : get_option( 'migration_source_site_domain', null ); + $path = $domain ? '/domains/add/use-my-domain/' . $data['site_slug_encoded'] . '/?initialQuery=' . $domain : '/domains/add/use-my-domain/' . $data['site_slug_encoded']; + return $path; + }, + 'is_complete_callback' => 'wpcom_launchpad_is_domain_customize_completed', + 'is_visible_callback' => '__return_true', + ), + 'domain_dns_mapped' => array( + 'get_title' => function () { + return __( "Update your domain's DNS", 'jetpack-mu-wpcom' ); + }, + 'is_complete_callback' => 'wpcom_launchpad_is_task_option_completed', + 'is_visible_callback' => '__return_true', + ), + 'check_ssl_status' => array( + 'get_title' => function () { + return __( 'Provision SSL certificate', 'jetpack-mu-wpcom' ); + }, + 'is_complete_callback' => 'wpcom_launchpad_is_task_option_completed', + 'is_disabled_callback' => 'wpcom_launchpad_is_primary_domain_wpcom', + 'get_calypso_path' => function ( $task, $default, $data ) { + $domain = $data['site_slug_encoded']; + return '/domains/manage/' . $domain . '/edit/' . $domain; + }, + ), ); $extended_task_definitions = apply_filters( 'wpcom_launchpad_extended_task_definitions', array() ); @@ -2780,3 +2814,20 @@ function wpcom_launchpad_get_latest_draft_id() { return $cached_draft_id; } + +/** + * Checks if the current site primary domain is a WPCOM domain. + * + * @return bool Will return true if the primary domain is a WPCOM domain. + */ +function wpcom_launchpad_is_primary_domain_wpcom() { + if ( ! ( new Automattic\Jetpack\Status\Host() )->is_wpcom_platform() ) { + return false; + } + + $url = home_url(); + $host = wp_parse_url( $url, PHP_URL_HOST ); + + // If site_slug ends with .wpcomstaging.com return true + return str_ends_with( $host, '.wpcomstaging.com' ); +} diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php index 67ff55d2b44b5..8c4a999899b69 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php @@ -323,6 +323,9 @@ function wpcom_launchpad_get_task_list_definitions() { 'migrating_site', 'review_site', 'review_plugins', + 'connect_migration_domain', + 'domain_dns_mapped', + 'check_ssl_status', ), ), ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/style.scss b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/style.scss index 9c574227ec179..6e7e4229bd5ba 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/style.scss +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/style.scss @@ -59,8 +59,11 @@ } -/* This prevents images from overflowing the comment area. */ -.comment img { +// This prevents images from overflowing the comment area. The :not() selector +// handles comments in non-block themes, but is too general for block themes, +// breaking flex layouts. +.comment img:not(.wp-block-comment-template .comment img), +.wp-block-comment-content img { max-width: 100%; } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php index 6bd50652ab522..575a7e3218f49 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php @@ -220,7 +220,7 @@ function wpcom_add_reader_menu( $wp_admin_bar ) { $wp_admin_bar->add_menu( array( 'id' => 'reader', - 'title' => '' . + 'title' => '' . /* translators: Hidden accessibility text. */ __( 'Reader', 'jetpack-mu-wpcom' ) . '', diff --git a/projects/packages/jitm/CHANGELOG.md b/projects/packages/jitm/CHANGELOG.md index 9acdfbea5b3ec..ed2a392e7303d 100644 --- a/projects/packages/jitm/CHANGELOG.md +++ b/projects/packages/jitm/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.1.26] - 2024-10-14 +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] + ## [3.1.25] - 2024-10-10 ### Changed - Updated package dependencies. [#39707] @@ -779,6 +783,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update Jetpack to use new JITM package +[3.1.26]: https://github.com/Automattic/jetpack-jitm/compare/v3.1.25...v3.1.26 [3.1.25]: https://github.com/Automattic/jetpack-jitm/compare/v3.1.24...v3.1.25 [3.1.24]: https://github.com/Automattic/jetpack-jitm/compare/v3.1.23...v3.1.24 [3.1.23]: https://github.com/Automattic/jetpack-jitm/compare/v3.1.22...v3.1.23 diff --git a/projects/packages/jitm/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/jitm/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/jitm/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/jitm/src/class-jitm.php b/projects/packages/jitm/src/class-jitm.php index 4d78e5833d2ac..a8c261d6ccfed 100644 --- a/projects/packages/jitm/src/class-jitm.php +++ b/projects/packages/jitm/src/class-jitm.php @@ -20,7 +20,7 @@ */ class JITM { - const PACKAGE_VERSION = '3.1.25'; + const PACKAGE_VERSION = '3.1.26'; /** * The configuration method that is called from the jetpack-config package. diff --git a/projects/packages/masterbar/CHANGELOG.md b/projects/packages/masterbar/CHANGELOG.md index ac4cf07c55540..22c2668c6af53 100644 --- a/projects/packages/masterbar/CHANGELOG.md +++ b/projects/packages/masterbar/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.6] - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + +### Fixed +- Admin bar: Clean up WPCOM_ADMIN_BAR_UNIFICATION feature flag. [#39692] + ## [0.9.5] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -145,6 +152,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. [#37669] - Updated package dependencies. [#37706] +[0.9.6]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.5...v0.9.6 [0.9.5]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.4...v0.9.5 [0.9.4]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.3...v0.9.4 [0.9.3]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.2...v0.9.3 diff --git a/projects/packages/masterbar/changelog/add-dependency-extraction-auto-polyfill#2 b/projects/packages/masterbar/changelog/add-dependency-extraction-auto-polyfill#2 deleted file mode 100644 index 9e8ffe1ab8734..0000000000000 --- a/projects/packages/masterbar/changelog/add-dependency-extraction-auto-polyfill#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: removed -Comment: Remove unnecessary JS dep on `@wordpress/dependency-extraction-webpack-plugin` - - diff --git a/projects/packages/masterbar/changelog/admin-bar-cleanup b/projects/packages/masterbar/changelog/admin-bar-cleanup deleted file mode 100644 index 4f0757c9cf451..0000000000000 --- a/projects/packages/masterbar/changelog/admin-bar-cleanup +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Admin bar: clean up WPCOM_ADMIN_BAR_UNIFICATION feature flag diff --git a/projects/packages/masterbar/changelog/renovate-wordpress-monorepo b/projects/packages/masterbar/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/masterbar/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/masterbar/package.json b/projects/packages/masterbar/package.json index 33efaa34045dc..5c69b3a94be1d 100644 --- a/projects/packages/masterbar/package.json +++ b/projects/packages/masterbar/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-masterbar", - "version": "0.9.5", + "version": "0.9.6", "description": "The WordPress.com Toolbar feature replaces the default admin bar and offers quick links to the Reader, all your sites, your WordPress.com profile, and notifications.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/masterbar/#readme", "bugs": { diff --git a/projects/packages/masterbar/src/class-main.php b/projects/packages/masterbar/src/class-main.php index 93f4732064dd1..4dde203d02fb5 100644 --- a/projects/packages/masterbar/src/class-main.php +++ b/projects/packages/masterbar/src/class-main.php @@ -14,7 +14,7 @@ */ class Main { - const PACKAGE_VERSION = '0.9.5'; + const PACKAGE_VERSION = '0.9.6'; /** * Initializer. diff --git a/projects/packages/my-jetpack/CHANGELOG.md b/projects/packages/my-jetpack/CHANGELOG.md index 6685d60792c7f..17be7eed0cca2 100644 --- a/projects/packages/my-jetpack/CHANGELOG.md +++ b/projects/packages/my-jetpack/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.35.15] - 2024-10-17 +### Fixed +- Fix the "Missing site connection" notice. [#39809] + +## [4.35.14] - 2024-10-15 +### Changed +- Update dependencies. [#38910] + +## [4.35.13] - 2024-10-14 +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] + ## [4.35.12] - 2024-10-10 ### Changed - Update Boost's pricing table to include latest feature list. [#39130] @@ -1772,6 +1784,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Created package +[4.35.15]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.35.14...4.35.15 +[4.35.14]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.35.13...4.35.14 +[4.35.13]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.35.12...4.35.13 [4.35.12]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.35.11...4.35.12 [4.35.11]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.35.10...4.35.11 [4.35.10]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.35.9...4.35.10 diff --git a/projects/packages/my-jetpack/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/my-jetpack/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/my-jetpack/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/my-jetpack/changelog/add-eslint-react-jsx-key b/projects/packages/my-jetpack/changelog/add-eslint-react-jsx-key deleted file mode 100644 index 9c48272a94f90..0000000000000 --- a/projects/packages/my-jetpack/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add `key` to some React `actions` props. Should be no change to functionality. - - diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index 89699b39dad48..39ed4c95969cd 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-my-jetpack", - "version": "4.35.12", + "version": "4.35.15", "description": "WP Admin page with information and configuration shared among all Jetpack stand-alone plugins", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/my-jetpack/#readme", "bugs": { diff --git a/projects/packages/my-jetpack/src/class-initializer.php b/projects/packages/my-jetpack/src/class-initializer.php index 9503cbdc8af06..0fcc2be3e8412 100644 --- a/projects/packages/my-jetpack/src/class-initializer.php +++ b/projects/packages/my-jetpack/src/class-initializer.php @@ -42,7 +42,7 @@ class Initializer { * * @var string */ - const PACKAGE_VERSION = '4.35.12'; + const PACKAGE_VERSION = '4.35.15'; /** * HTML container ID for the IDC screen on My Jetpack page. @@ -940,17 +940,18 @@ public static function alert_if_missing_connection( array $red_bubble_slugs ) { $broken_modules = self::check_for_broken_modules(); $connection = new Connection_Manager(); - if ( ! empty( $broken_modules['needs_user_connection'] ) ) { + // Checking for site connection issues first. + if ( ! empty( $broken_modules['needs_site_connection'] ) ) { $red_bubble_slugs[ self::MISSING_CONNECTION_NOTIFICATION_KEY ] = array( - 'type' => 'user', + 'type' => 'site', 'is_error' => true, ); return $red_bubble_slugs; } - if ( ! empty( $broken_modules['needs_site_connection'] ) ) { + if ( ! empty( $broken_modules['needs_user_connection'] ) ) { $red_bubble_slugs[ self::MISSING_CONNECTION_NOTIFICATION_KEY ] = array( - 'type' => 'site', + 'type' => 'user', 'is_error' => true, ); return $red_bubble_slugs; diff --git a/projects/packages/plans/CHANGELOG.md b/projects/packages/plans/CHANGELOG.md index bdb192c71b67d..1d1d39451f04c 100644 --- a/projects/packages/plans/CHANGELOG.md +++ b/projects/packages/plans/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.12] - 2024-10-21 +### Fixed +- Fixed the site features for Simple sites. [#39817] + ## [0.4.11] - 2024-09-23 ### Changed - Update dependencies. @@ -154,6 +158,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated - Moved the options class into Connection. [#24095] +[0.4.12]: https://github.com/Automattic/jetpack-plans/compare/v0.4.11...v0.4.12 [0.4.11]: https://github.com/Automattic/jetpack-plans/compare/v0.4.10...v0.4.11 [0.4.10]: https://github.com/Automattic/jetpack-plans/compare/v0.4.9...v0.4.10 [0.4.9]: https://github.com/Automattic/jetpack-plans/compare/v0.4.8...v0.4.9 diff --git a/projects/packages/plans/package.json b/projects/packages/plans/package.json index 9b34af05f76c4..5f135800276bc 100644 --- a/projects/packages/plans/package.json +++ b/projects/packages/plans/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-plans", - "version": "0.4.11", + "version": "0.4.12", "description": "Fetch information about Jetpack Plans from wpcom", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/plans/#readme", "bugs": { diff --git a/projects/packages/plans/src/class-current-plan.php b/projects/packages/plans/src/class-current-plan.php index f6e7c6e351c79..cef57d52b3d41 100644 --- a/projects/packages/plans/src/class-current-plan.php +++ b/projects/packages/plans/src/class-current-plan.php @@ -21,6 +21,14 @@ class Current_Plan { */ private static $active_plan_cache; + /** + * Simple Site-specific features available. + * Their calculation can be expensive and slow, so we're caching it for the request. + * + * @var array Site-specific features + */ + private static $simple_site_specific_features = array(); + /** * The name of the option that will store the site's plan. * @@ -374,7 +382,7 @@ function_exists( 'wpcom_feature_exists' ) && return true; } - // As of 05 2023 - all plans support Earn features (minus 'simple-payments') + // As of 05 2023 - all plans support Earn features (minus 'simple-payments'). if ( in_array( $feature, array( 'donations', 'recurring-payments', 'premium-content/container' ), true ) ) { return true; } @@ -390,4 +398,39 @@ function_exists( 'wpcom_feature_exists' ) && return false; } + + /** + * Retrieve site-specific features for Simple sites. + * + * See Jetpack_Gutenberg::get_site_specific_features() + * + * @return array + */ + public static function get_simple_site_specific_features() { + $is_simple_site = defined( 'IS_WPCOM' ) && constant( 'IS_WPCOM' ); + + if ( ! $is_simple_site ) { + return array( + 'active' => array(), + 'available' => array(), + ); + } + + $current_blog_id = get_current_blog_id(); + + // Return the cached value if it exists. + if ( isset( self::$simple_site_specific_features[ $current_blog_id ] ) ) { + return self::$simple_site_specific_features[ $current_blog_id ]; + } + + if ( ! class_exists( '\Store_Product_List' ) ) { + require WP_CONTENT_DIR . '/admin-plugins/wpcom-billing/store-product-list.php'; + } + + $simple_site_specific_features = \Store_Product_List::get_site_specific_features_data( $current_blog_id ); + + self::$simple_site_specific_features[ $current_blog_id ] = $simple_site_specific_features; + + return $simple_site_specific_features; + } } diff --git a/projects/packages/publicize/CHANGELOG.md b/projects/packages/publicize/CHANGELOG.md index ec6b70aecfb87..2e9b7805d534b 100644 --- a/projects/packages/publicize/CHANGELOG.md +++ b/projects/packages/publicize/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.54.4] - 2024-10-21 +### Changed +- Initial State: Migrated URLs to script data. [#39797] + +### Fixed +- Fixed the site features for Simple sites. [#39817] + +## [0.54.3] - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + ## [0.54.2] - 2024-10-07 ### Changed - Updated package dependencies. [#39594] @@ -725,6 +736,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. - Update package.json metadata. +[0.54.4]: https://github.com/Automattic/jetpack-publicize/compare/v0.54.3...v0.54.4 +[0.54.3]: https://github.com/Automattic/jetpack-publicize/compare/v0.54.2...v0.54.3 [0.54.2]: https://github.com/Automattic/jetpack-publicize/compare/v0.54.1...v0.54.2 [0.54.1]: https://github.com/Automattic/jetpack-publicize/compare/v0.54.0...v0.54.1 [0.54.0]: https://github.com/Automattic/jetpack-publicize/compare/v0.53.0...v0.54.0 diff --git a/projects/packages/publicize/changelog/fix-social-bsky-profile-url b/projects/packages/publicize/changelog/fix-social-bsky-profile-url new file mode 100644 index 0000000000000..ebe3332ec44de --- /dev/null +++ b/projects/packages/publicize/changelog/fix-social-bsky-profile-url @@ -0,0 +1,4 @@ +Significance: minor +Type: fixed + +Social: Fix Bsky profile URL diff --git a/projects/packages/publicize/changelog/renovate-wordpress-monorepo b/projects/packages/publicize/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/publicize/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/publicize/package.json b/projects/packages/publicize/package.json index 0ffca2c2cda2c..7df4d2ac41402 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.54.2", + "version": "0.54.4", "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/class-publicize-base.php b/projects/packages/publicize/src/class-publicize-base.php index 5e5964fb64afb..b88bd1a6b12ca 100644 --- a/projects/packages/publicize/src/class-publicize-base.php +++ b/projects/packages/publicize/src/class-publicize-base.php @@ -517,6 +517,10 @@ public function get_profile_link( $service_name, $connection ) { return 'https://twitter.com/' . substr( $cmeta['external_display'], 1 ); // Has a leading '@'. } + if ( 'bluesky' === $service_name ) { + return 'https://bsky.app/profile/' . $cmeta['external_id']; + } + if ( 'linkedin' === $service_name ) { if ( ! isset( $cmeta['connection_data']['meta']['profile_url'] ) ) { return false; diff --git a/projects/packages/publicize/src/class-publicize-script-data.php b/projects/packages/publicize/src/class-publicize-script-data.php index 053ad74a938ee..ff841f2da2545 100644 --- a/projects/packages/publicize/src/class-publicize-script-data.php +++ b/projects/packages/publicize/src/class-publicize-script-data.php @@ -60,6 +60,11 @@ public static function set_admin_script_data( $data ) { $data['site']['plan'] = Current_Plan::get(); } + // Override features for simple sites. + if ( ( new Host() )->is_wpcom_simple() ) { + $data['site']['plan']['features'] = Current_Plan::get_simple_site_specific_features(); + } + return $data; } @@ -86,6 +91,7 @@ public static function get_admin_script_data() { 'feature_flags' => self::get_feature_flags(), 'supported_services' => array(), 'shares_data' => array(), + 'urls' => array(), ); if ( ! Utils::is_publicize_active() ) { @@ -105,9 +111,9 @@ public static function get_admin_script_data() { 'api_paths' => self::get_api_paths(), 'supported_services' => self::get_supported_services(), 'shares_data' => self::get_shares_data(), + 'urls' => self::get_urls(), /** * 'store' => self::get_store_script_data(), - * 'urls' => self::get_urls(), */ ) ); @@ -216,4 +222,23 @@ public static function get_api_paths() { 'resharePost' => '/jetpack/v4/publicize/{postId}', ); } + + /** + * Get the URLs. + * + * @return array + */ + public static function get_urls() { + + $urls = array( + 'connectionsManagementPage' => self::publicize()->publicize_connections_url( + 'jetpack-social-connections-admin-page' + ), + ); + + // Escape the URLs. + array_walk( $urls, 'esc_url_raw' ); + + return $urls; + } } diff --git a/projects/packages/search/CHANGELOG.md b/projects/packages/search/CHANGELOG.md index 827b9145eb47d..2425246b79d41 100644 --- a/projects/packages/search/CHANGELOG.md +++ b/projects/packages/search/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.45.9] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [0.45.8] - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + +### Fixed +- Add `key` to tag and cat lists in `SearchResultMinimal` to improve behavior if lists change at runtime. [#39709] + ## [0.45.7] - 2024-10-07 ### Changed - Updated package dependencies. [#39592] @@ -1060,6 +1071,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. - Update PHPUnit configs to include just what needs coverage rather than include everything then try to exclude stuff that doesn't. +[0.45.9]: https://github.com/Automattic/jetpack-search/compare/v0.45.8...v0.45.9 +[0.45.8]: https://github.com/Automattic/jetpack-search/compare/v0.45.7...v0.45.8 [0.45.7]: https://github.com/Automattic/jetpack-search/compare/v0.45.6...v0.45.7 [0.45.6]: https://github.com/Automattic/jetpack-search/compare/v0.45.5...v0.45.6 [0.45.5]: https://github.com/Automattic/jetpack-search/compare/v0.45.4...v0.45.5 diff --git a/projects/packages/search/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/search/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index 20df2e785f6c5..0000000000000 --- a/projects/packages/search/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Update Babel config to disable new `autoWpPolyfill` option. - - diff --git a/projects/packages/search/changelog/add-eslint-jsx-a11y-label-has-associated-control b/projects/packages/search/changelog/add-eslint-jsx-a11y-label-has-associated-control deleted file mode 100644 index ad25d57c17f30..0000000000000 --- a/projects/packages/search/changelog/add-eslint-jsx-a11y-label-has-associated-control +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add auto-generated id in `MockedFilterOption`. No other change to functionality. - - diff --git a/projects/packages/search/changelog/add-eslint-react-jsx-key b/projects/packages/search/changelog/add-eslint-react-jsx-key deleted file mode 100644 index c52e5a775fa9a..0000000000000 --- a/projects/packages/search/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Add `key` to tag and cat lists in `SearchResultMinimal` to improve behavior if lists change at runtime. diff --git a/projects/packages/search/changelog/renovate-wordpress-monorepo b/projects/packages/search/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/search/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/search/package.json b/projects/packages/search/package.json index 436f94e7cc295..e50483025b55f 100644 --- a/projects/packages/search/package.json +++ b/projects/packages/search/package.json @@ -1,6 +1,6 @@ { "name": "jetpack-search", - "version": "0.45.7", + "version": "0.45.9", "description": "Package for Jetpack Search products", "main": "main.js", "directories": { diff --git a/projects/packages/search/src/class-package.php b/projects/packages/search/src/class-package.php index 9a7bb521a7e73..38fb525e2aa66 100644 --- a/projects/packages/search/src/class-package.php +++ b/projects/packages/search/src/class-package.php @@ -11,7 +11,7 @@ * Search package general information */ class Package { - const VERSION = '0.45.7'; + const VERSION = '0.45.9'; const SLUG = 'search'; /** diff --git a/projects/packages/stats-admin/CHANGELOG.md b/projects/packages/stats-admin/CHANGELOG.md index 63a0b6120387c..fc9c6b475970d 100644 --- a/projects/packages/stats-admin/CHANGELOG.md +++ b/projects/packages/stats-admin/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.22.3 - 2024-10-21 +### Changed +- JITM: Expose function to render message. [#39714] + +## 0.22.2 - 2024-10-14 +### Fixed +- Added missing fields for stats single post endpoint. [#39691] + ## 0.22.1 - 2024-09-23 ### Changed - Update dependencies. [#39303] diff --git a/projects/packages/stats-admin/changelog/fix-add-required-fields-to-stats-single-post-endpiont b/projects/packages/stats-admin/changelog/fix-add-required-fields-to-stats-single-post-endpiont deleted file mode 100644 index cd9766b9205c0..0000000000000 --- a/projects/packages/stats-admin/changelog/fix-add-required-fields-to-stats-single-post-endpiont +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Added missing fields for stats single post endpoint diff --git a/projects/packages/stats-admin/changelog/update-use-option-value-instead-of-transient b/projects/packages/stats-admin/changelog/update-use-option-value-instead-of-transient new file mode 100644 index 0000000000000..6e6660e388644 --- /dev/null +++ b/projects/packages/stats-admin/changelog/update-use-option-value-instead-of-transient @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Odyssey Stats cache busting: use optioin instead of transient diff --git a/projects/packages/stats-admin/package.json b/projects/packages/stats-admin/package.json index 07af18a9f24ef..d0a9302a24fa1 100644 --- a/projects/packages/stats-admin/package.json +++ b/projects/packages/stats-admin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-stats-admin", - "version": "0.22.1", + "version": "0.22.3", "description": "Stats Dashboard", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/stats-admin/#readme", "bugs": { diff --git a/projects/packages/stats-admin/src/class-main.php b/projects/packages/stats-admin/src/class-main.php index 83c2671fcac20..34c931bdb5de8 100644 --- a/projects/packages/stats-admin/src/class-main.php +++ b/projects/packages/stats-admin/src/class-main.php @@ -22,7 +22,7 @@ class Main { /** * Stats version. */ - const VERSION = '0.22.1'; + const VERSION = '0.22.3'; /** * Singleton Main instance. @@ -52,6 +52,19 @@ public static function init() { */ private function __construct() { add_action( 'rest_api_init', array( new REST_Controller(), 'register_rest_routes' ) ); + // Disable JITM assets on the Stats page. + // JITM is handled separately by Stats: https://github.com/Automattic/wp-calypso/pull/95273. + add_filter( + 'jetpack_display_jitms_on_screen', + function ( $show, $screen_id ) { + if ( 'jetpack_page_stats' === $screen_id ) { + return false; + } + return $show; + }, + 10, + 2 + ); } /** diff --git a/projects/packages/stats-admin/src/class-odyssey-assets.php b/projects/packages/stats-admin/src/class-odyssey-assets.php index 8117e650ae5fa..98d59fc3bb3ad 100644 --- a/projects/packages/stats-admin/src/class-odyssey-assets.php +++ b/projects/packages/stats-admin/src/class-odyssey-assets.php @@ -75,36 +75,58 @@ public function load_admin_scripts( $asset_handle, $asset_name, $options = array /** * Returns cache buster string for assets. * Development mode doesn't need this, as it's handled by `Assets` class. + * + * @return string */ protected function get_cdn_asset_cache_buster() { + $now_in_ms = floor( microtime( true ) * 1000 ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( isset( $_GET['force_refresh'] ) ) { - set_transient( self::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, floor( microtime( true ) * 1000 ), 15 * MINUTE_IN_SECONDS ); + update_option( self::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, $this->get_cache_buster_option_value( $now_in_ms ), false ); } // Use cached cache buster in production. - $remote_asset_version = get_transient( self::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY ); + $remote_asset_version = get_option( self::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY ); if ( ! empty( $remote_asset_version ) ) { - return $remote_asset_version; + $remote_asset_version = json_decode( $remote_asset_version, true ); + // If cache buster is cached and not expired (valid in 15 min), return it. + if ( ! empty( $remote_asset_version['cache_buster'] ) && $remote_asset_version['cached_at'] > $now_in_ms - MINUTE_IN_SECONDS * 1000 * 15 ) { + return $remote_asset_version['cache_buster']; + } } // If no cached cache buster, we fetch it from CDN and set to transient. - $response = wp_remote_get( sprintf( self::ODYSSEY_CDN_URL, self::ODYSSEY_STATS_VERSION, 'build_meta.json?t=' . time() ), array( 'timeout' => 5 ) ); + $response = wp_remote_get( sprintf( self::ODYSSEY_CDN_URL, self::ODYSSEY_STATS_VERSION, 'build_meta.json?t=' . $now_in_ms ), array( 'timeout' => 5 ) ); if ( is_wp_error( $response ) ) { - // fallback to the package version. - return Main::VERSION; + // fallback to current timestamp. + return (string) $now_in_ms; } $build_meta = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! empty( $build_meta['cache_buster'] ) ) { // Cache the cache buster for 15 mins. - set_transient( self::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, $build_meta['cache_buster'], 15 * MINUTE_IN_SECONDS ); + update_option( self::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, $this->get_cache_buster_option_value( $build_meta['cache_buster'] ), false ); return $build_meta['cache_buster']; } - // fallback to the package version. - return Main::VERSION; + // fallback to current timestamp. + return (string) $now_in_ms; + } + + /** + * Get the cache buster option value. + * + * @param string|int|float $cache_buster The cache buster. + * @return string|false + */ + protected function get_cache_buster_option_value( $cache_buster ) { + return wp_json_encode( + array( + 'cache_buster' => (string) $cache_buster, + 'cached_at' => floor( microtime( true ) * 1000 ), // milliseconds. + ) + ); } } diff --git a/projects/packages/stats-admin/tests/php/class-test-case.php b/projects/packages/stats-admin/tests/php/class-test-case.php index e6b919b204a4f..0d21e264cf842 100644 --- a/projects/packages/stats-admin/tests/php/class-test-case.php +++ b/projects/packages/stats-admin/tests/php/class-test-case.php @@ -60,6 +60,7 @@ public function set_up() { add_filter( 'jetpack_options', array( $this, 'mock_jetpack_site_connection_options' ), 10, 2 ); add_filter( 'pre_http_request', array( $this, 'plan_http_response_fixture' ), 10, 3 ); + delete_option( Odyssey_Assets::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY ); } /** @@ -76,6 +77,7 @@ public function tear_down() { remove_filter( 'pre_http_request', array( $this, 'plan_http_response_fixture' ) ); remove_filter( 'jetpack_options', array( $this, 'mock_jetpack_site_connection_options' ) ); + delete_option( Odyssey_Assets::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY ); } /** diff --git a/projects/packages/stats-admin/tests/php/test-odyssey-assets.php b/projects/packages/stats-admin/tests/php/test-odyssey-assets.php index f99eca36ad1fe..14e1fb5c3bec9 100644 --- a/projects/packages/stats-admin/tests/php/test-odyssey-assets.php +++ b/projects/packages/stats-admin/tests/php/test-odyssey-assets.php @@ -2,6 +2,7 @@ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats_Admin\Test_Case as Stats_Test_Case; +use WP_Error; /** * Unit tests for the Odyssey_Assets class. @@ -9,13 +10,106 @@ * @package automattic/jetpack-stats-admin */ class Test_Odyssey_Assets extends Stats_Test_Case { + /** * Test remote cache buster. */ public function test_get_cdn_asset_cache_buster() { + $this->assertEquals( 'calypso-4917-8664-g72a154d63a', $this->get_cdn_asset_cache_buster_callable() ); + } + + /** + * Test remote cache buster remote error. + */ + public function test_get_cdn_asset_cache_buster_remote_error() { + add_filter( 'pre_http_request', array( $this, 'break_cdn_cache_buster_request' ), 15, 3 ); + $this->assertEquals( time(), floor( $this->get_cdn_asset_cache_buster_callable() / 1000 ) ); + remove_filter( 'pre_http_request', array( $this, 'break_cdn_cache_buster_request' ), 15 ); + } + + /** + * Test already cached cache buster. + */ + public function test_get_cdn_asset_cache_buster_already_cached() { + update_option( + Odyssey_Assets::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, + wp_json_encode( + array( + 'cache_buster' => 'calypso-4917-8664-123456', + 'cached_at' => floor( microtime( true ) * 1000 ), // milliseconds. + ) + ), + false + ); + $this->assertEquals( 'calypso-4917-8664-123456', $this->get_cdn_asset_cache_buster_callable() ); + } + + /** + * Test already cached cache buster expired. + */ + public function test_get_cdn_asset_cache_buster_already_cached_expired() { + update_option( + Odyssey_Assets::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, + wp_json_encode( + array( + 'cache_buster' => 'calypso-4917-8664-123456', + 'cached_at' => floor( microtime( true ) * 1000 - MINUTE_IN_SECONDS * 1000 * 20 ), // milliseconds. + ) + ), + false + ); + $this->assertEquals( 'calypso-4917-8664-g72a154d63a', $this->get_cdn_asset_cache_buster_callable() ); + } + + /** + * Test already cached cache buster expired and failed to fetch new one. + */ + public function test_get_cdn_asset_cache_buster_failed_to_fetch() { + add_filter( 'pre_http_request', array( $this, 'break_cdn_cache_buster_request' ), 15, 3 ); + update_option( + Odyssey_Assets::ODYSSEY_STATS_CACHE_BUSTER_CACHE_KEY, + wp_json_encode( + array( + 'cache_buster' => 'calypso-4917-8664-123456', + 'cached_at' => floor( microtime( true ) * 1000 - MINUTE_IN_SECONDS * 1000 * 20 ), // milliseconds. + ) + ), + false + ); + $this->assertEquals( time(), floor( $this->get_cdn_asset_cache_buster_callable() / 1000 ) ); + remove_filter( 'pre_http_request', array( $this, 'break_cdn_cache_buster_request' ), 15 ); + } + + /** + * Test force refresh cache buster. + */ + public function test_get_cdn_asset_cache_buster_force_refresh_expired() { + $_GET['force_refresh'] = 1; + $this->assertEquals( time(), floor( $this->get_cdn_asset_cache_buster_callable() / 1000 ) ); + } + + /** + * Test remote cache buster. + * + * @param mixed $response The response array. + * @param mixed $parsed_args The parsed args. + * @param mixed $url The URL. + * @return WP_Error | void + */ + public function break_cdn_cache_buster_request( $response, $parsed_args, $url ) { + if ( strpos( $url, '/build_meta.json' ) !== false ) { + return new WP_Error( 500, 'Internal Server Error' ); + } + } + + /** + * Get CDN asset cache buster. + */ + protected function get_cdn_asset_cache_buster_callable() { $odyssey_assets = new Odyssey_Assets(); $get_cdn_asset_cache_buster = new \ReflectionMethod( $odyssey_assets, 'get_cdn_asset_cache_buster' ); $get_cdn_asset_cache_buster->setAccessible( true ); - $this->assertEquals( 'calypso-4917-8664-g72a154d63a', $get_cdn_asset_cache_buster->invoke( $odyssey_assets ) ); + + return $get_cdn_asset_cache_buster->invoke( $odyssey_assets ); } } diff --git a/projects/packages/sync/CHANGELOG.md b/projects/packages/sync/CHANGELOG.md index 786b596e64558..963e67ed56760 100644 --- a/projects/packages/sync/CHANGELOG.md +++ b/projects/packages/sync/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.14.2] - 2024-10-15 +### Changed +- Jetpack Sync: Update default Post Type Blacklist [#39770] + +### Fixed +- Jetpack Sync: Ensure Full Sync is only triggered on backend admin POST requests [#39747] +- Update plugin action links filter parameter to avoid conflicts with other plugins. [#39681] + +## [3.14.1] - 2024-10-14 +### Changed +- Internal updates. + ## [3.14.0] - 2024-10-10 ### Added - Jetpack Sync: Add 'woocommerce_analytics_first_activation' in options' whitelist @@ -1306,6 +1318,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Packages: Move sync to a classmapped package +[3.14.2]: https://github.com/Automattic/jetpack-sync/compare/v3.14.1...v3.14.2 +[3.14.1]: https://github.com/Automattic/jetpack-sync/compare/v3.14.0...v3.14.1 [3.14.0]: https://github.com/Automattic/jetpack-sync/compare/v3.13.2...v3.14.0 [3.13.2]: https://github.com/Automattic/jetpack-sync/compare/v3.13.1...v3.13.2 [3.13.1]: https://github.com/Automattic/jetpack-sync/compare/v3.13.0...v3.13.1 diff --git a/projects/packages/sync/changelog/revert-39658-update-jetpack-sync-whitelist b/projects/packages/sync/changelog/revert-39658-update-jetpack-sync-whitelist new file mode 100644 index 0000000000000..59df2569689e4 --- /dev/null +++ b/projects/packages/sync/changelog/revert-39658-update-jetpack-sync-whitelist @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Revert "Jetpack Sync: Add 'woocommerce_analytics_first_activation' in options' whitelist" + + diff --git a/projects/packages/sync/changelog/update-hooks-prevent-doing-it-wrong-notice b/projects/packages/sync/changelog/update-hooks-prevent-doing-it-wrong-notice new file mode 100644 index 0000000000000..f319fb6812720 --- /dev/null +++ b/projects/packages/sync/changelog/update-hooks-prevent-doing-it-wrong-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Hooks: Hook init_sync_cron_jobs into init to ensure translation loading within the function is not triggered too early. diff --git a/projects/packages/sync/changelog/update-jetpack-sync-delay-jetpack_plugins_updated-hook b/projects/packages/sync/changelog/update-jetpack-sync-delay-jetpack_plugins_updated-hook deleted file mode 100644 index d0e519dbdb87b..0000000000000 --- a/projects/packages/sync/changelog/update-jetpack-sync-delay-jetpack_plugins_updated-hook +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Jetpack Sync: Move 'jetpack_plugins_updated' action to shutdown to decrease its associated lag - - diff --git a/projects/packages/sync/src/class-actions.php b/projects/packages/sync/src/class-actions.php index f3535cb23265a..fb09385827392 100644 --- a/projects/packages/sync/src/class-actions.php +++ b/projects/packages/sync/src/class-actions.php @@ -116,7 +116,7 @@ public static function init() { } if ( self::sync_via_cron_allowed() ) { - self::init_sync_cron_jobs(); + add_action( 'init', array( __CLASS__, 'init_sync_cron_jobs' ), 1 ); } elseif ( wp_next_scheduled( 'jetpack_sync_cron' ) ) { self::clear_sync_cron_jobs(); } @@ -175,7 +175,9 @@ public static function add_sender_shutdown() { ) ) { self::initialize_sender(); add_action( 'shutdown', array( self::$sender, 'do_sync' ), 9998 ); - add_action( 'shutdown', array( self::$sender, 'do_full_sync' ), 9999 ); + if ( self::should_initialize_sender( true ) ) { + add_action( 'shutdown', array( self::$sender, 'do_full_sync' ), 9999 ); + } } } @@ -212,9 +214,11 @@ public static function mark_sync_read_only() { * @access public * @static * + * @param bool $full_sync Whether the Full Sync sender should run on shutdown for this request. + * * @return bool */ - public static function should_initialize_sender() { + public static function should_initialize_sender( $full_sync = false ) { // Allow for explicit disable of Sync from request param jetpack_sync_read_only. if ( isset( $_REQUEST['jetpack_sync_read_only'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification @@ -227,9 +231,10 @@ public static function should_initialize_sender() { } /** - * For now, if dedicated Sync is enabled we will always initialize send, even for GET and unauthenticated requests. + * For now, if dedicated Sync is enabled we will always initialize send, even for GET and unauthenticated requests + * but not for Full Sync, since it will still happen on shutdown. */ - if ( Settings::is_dedicated_sync_enabled() ) { + if ( false === $full_sync && Settings::is_dedicated_sync_enabled() ) { return true; } diff --git a/projects/packages/sync/src/class-defaults.php b/projects/packages/sync/src/class-defaults.php index 968822ac9a9a6..612b077e4f970 100644 --- a/projects/packages/sync/src/class-defaults.php +++ b/projects/packages/sync/src/class-defaults.php @@ -213,7 +213,6 @@ class Defaults { 'jetpack_waf_share_data', 'jetpack_waf_share_debug_data', 'jetpack_waf_automatic_rules_last_updated_timestamp', - 'woocommerce_analytics_first_activation', ); /** @@ -462,6 +461,11 @@ public static function get_callable_whitelist() { 'wprss_feed_item', 'memberships_coupon', 'memberships_gift', + 'tribe-ea-record', // The Events Calendar Plugin - Store Event Aggregator record information. + 'wphb_minify_group', // Hummingbird Plugin - Used internally to keep data about assets minification. + 'bigcommerce_task', // BigCommerce Plugin - Store import queue. + 'secupress_log_err404', // SecuPress Plugin - Log 404 pages + 'iw_omnibus_price_log', // Omnibus Plugin - Log price changes. ); /** diff --git a/projects/packages/sync/src/class-package-version.php b/projects/packages/sync/src/class-package-version.php index ed129d839efa9..d028b2ae59613 100644 --- a/projects/packages/sync/src/class-package-version.php +++ b/projects/packages/sync/src/class-package-version.php @@ -12,7 +12,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '3.14.0'; + const PACKAGE_VERSION = '3.14.2'; const PACKAGE_SLUG = 'sync'; diff --git a/projects/packages/sync/src/modules/class-callables.php b/projects/packages/sync/src/modules/class-callables.php index 6aceead8a0dc3..c3f132dca687c 100644 --- a/projects/packages/sync/src/modules/class-callables.php +++ b/projects/packages/sync/src/modules/class-callables.php @@ -383,8 +383,8 @@ public function set_plugin_action_links() { if ( ! empty( $plugins_lock ) && ( isset( $current_screeen->id ) && 'plugins' !== $current_screeen->id ) ) { return; } - $plugins = array_keys( Functions::get_plugins() ); - foreach ( $plugins as $plugin_file ) { + $plugins = Functions::get_plugins(); + foreach ( $plugins as $plugin_file => $plugin_data ) { /** * Plugins often like to unset things but things break if they are not able to. */ @@ -396,13 +396,13 @@ public function set_plugin_action_links() { 'edit' => '', ); /** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */ - $action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, null, 'all' ); + $action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, $plugin_data, 'all' ); // Verify $action_links is still an array. if ( ! is_array( $action_links ) ) { $action_links = array(); } /** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */ - $action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, null, 'all' ); + $action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, $plugin_data, 'all' ); // Verify $action_links is still an array to resolve warnings from filters not returning an array. if ( is_array( $action_links ) ) { $action_links = array_filter( $action_links ); diff --git a/projects/packages/transport-helper/CHANGELOG.md b/projects/packages/transport-helper/CHANGELOG.md index f9ea0635cb3fa..18fb66d6661e8 100644 --- a/projects/packages/transport-helper/CHANGELOG.md +++ b/projects/packages/transport-helper/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.5] - 2024-10-15 +### Changed +- Update dependencies. [#39497] + ## [0.2.4] - 2024-09-06 ### Changed - Updated package dependencies. [#39004] @@ -67,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated package dependencies. +[0.2.5]: https://github.com/Automattic/jetpack-transport-helper/compare/v0.2.4...v0.2.5 [0.2.4]: https://github.com/Automattic/jetpack-transport-helper/compare/v0.2.3...v0.2.4 [0.2.3]: https://github.com/Automattic/jetpack-transport-helper/compare/v0.2.2...v0.2.3 [0.2.2]: https://github.com/Automattic/jetpack-transport-helper/compare/v0.2.1...v0.2.2 diff --git a/projects/packages/transport-helper/changelog/force-a-release b/projects/packages/transport-helper/changelog/force-a-release deleted file mode 100644 index d4ad6c7cc3379..0000000000000 --- a/projects/packages/transport-helper/changelog/force-a-release +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Update dependencies. diff --git a/projects/packages/transport-helper/package.json b/projects/packages/transport-helper/package.json index bdfdfd8502d60..13565fecef0aa 100644 --- a/projects/packages/transport-helper/package.json +++ b/projects/packages/transport-helper/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-transport-helper", - "version": "0.2.4", + "version": "0.2.5", "description": "Package to help transport server communication", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/transport-helper/#readme", "bugs": { diff --git a/projects/packages/transport-helper/src/class-package-version.php b/projects/packages/transport-helper/src/class-package-version.php index 9845e1207719e..b4e60b84e0151 100644 --- a/projects/packages/transport-helper/src/class-package-version.php +++ b/projects/packages/transport-helper/src/class-package-version.php @@ -16,7 +16,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '0.2.4'; + const PACKAGE_VERSION = '0.2.5'; const PACKAGE_SLUG = 'transport-helper'; diff --git a/projects/packages/videopress/CHANGELOG.md b/projects/packages/videopress/CHANGELOG.md index fa07e26a24a92..96d1d13f498a4 100644 --- a/projects/packages/videopress/CHANGELOG.md +++ b/projects/packages/videopress/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.24.13] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [0.24.12] - 2024-10-14 +### Added +- Add tracks to connection banner. [#39732] + +### Changed +- Only include `wp-polyfill` as a script dependency when needed. [#39629] +- Updated package dependencies. [#39669] [#39707] + +### Fixed +- Fix bug where connection banner was showing in P2s and other atomic/simple sites [#39667] + ## [0.24.11] - 2024-10-07 ### Changed - Update connection nudge for VideoPress connection banner in blocks. [#39628] @@ -1456,6 +1471,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Created empty package [#24952] +[0.24.13]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.12...v0.24.13 +[0.24.12]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.11...v0.24.12 [0.24.11]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.10...v0.24.11 [0.24.10]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.9...v0.24.10 [0.24.9]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.8...v0.24.9 diff --git a/projects/packages/videopress/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/videopress/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/packages/videopress/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/packages/videopress/changelog/add-eslint-wordpress-no-base-control-with-label-without-id b/projects/packages/videopress/changelog/add-eslint-wordpress-no-base-control-with-label-without-id deleted file mode 100644 index f19346531047d..0000000000000 --- a/projects/packages/videopress/changelog/add-eslint-wordpress-no-base-control-with-label-without-id +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Clean up `` without `id`. Should be no change in functionality. - - diff --git a/projects/packages/videopress/changelog/fix-bug-where-connection-banner-shows-in-p2 b/projects/packages/videopress/changelog/fix-bug-where-connection-banner-shows-in-p2 deleted file mode 100644 index b845dbdbf291a..0000000000000 --- a/projects/packages/videopress/changelog/fix-bug-where-connection-banner-shows-in-p2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Fix bug where connection banner was showing in P2s and other atomic/simple sites diff --git a/projects/packages/videopress/changelog/renovate-storybook-monorepo b/projects/packages/videopress/changelog/renovate-storybook-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/videopress/changelog/renovate-storybook-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/videopress/changelog/renovate-wordpress-monorepo b/projects/packages/videopress/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/videopress/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/videopress/changelog/update-hooks-prevent-doing-it-wrong-notice b/projects/packages/videopress/changelog/update-hooks-prevent-doing-it-wrong-notice new file mode 100644 index 0000000000000..18dbc98c689ab --- /dev/null +++ b/projects/packages/videopress/changelog/update-hooks-prevent-doing-it-wrong-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Admin: Changed initialization load order for menu items to prevent translation error. diff --git a/projects/packages/videopress/package.json b/projects/packages/videopress/package.json index f2a76cb7ea314..13363879be44b 100644 --- a/projects/packages/videopress/package.json +++ b/projects/packages/videopress/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-videopress", - "version": "0.24.11", + "version": "0.24.13", "description": "VideoPress package", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/videopress/#readme", "bugs": { diff --git a/projects/packages/videopress/src/class-admin-ui.php b/projects/packages/videopress/src/class-admin-ui.php index ef5182a691076..e934b7cd4a4ba 100644 --- a/projects/packages/videopress/src/class-admin-ui.php +++ b/projects/packages/videopress/src/class-admin-ui.php @@ -34,6 +34,23 @@ class Admin_UI { * @return void */ public static function init() { + + add_action( 'admin_menu', array( __CLASS__, 'enable_menu' ) ); + + add_action( 'admin_footer-upload.php', array( __CLASS__, 'attachment_details_two_column_template' ) ); + add_action( 'admin_footer-post.php', array( __CLASS__, 'attachment_details_template' ), 20 ); + + add_filter( 'get_edit_post_link', array( __CLASS__, 'edit_video_link' ), 10, 3 ); + + add_action( 'admin_init', array( __CLASS__, 'remove_jetpack_hooks' ) ); + } + + /** + * Enable the menu, separately to init due to translations needing to run early for the page suffix. + * + * @return void + */ + public static function enable_menu() { $page_suffix = Admin_Menu::add_menu( __( 'Jetpack VideoPress', 'jetpack-videopress-pkg' ), _x( 'VideoPress', 'The Jetpack VideoPress product name, without the Jetpack prefix', 'jetpack-videopress-pkg' ), @@ -43,13 +60,6 @@ public static function init() { 3 ); add_action( 'load-' . $page_suffix, array( __CLASS__, 'admin_init' ) ); - - add_action( 'admin_footer-upload.php', array( __CLASS__, 'attachment_details_two_column_template' ) ); - add_action( 'admin_footer-post.php', array( __CLASS__, 'attachment_details_template' ), 20 ); - - add_filter( 'get_edit_post_link', array( __CLASS__, 'edit_video_link' ), 10, 3 ); - - add_action( 'admin_init', array( __CLASS__, 'remove_jetpack_hooks' ) ); } /** diff --git a/projects/packages/videopress/src/class-package-version.php b/projects/packages/videopress/src/class-package-version.php index 1b2854cadc9c0..dc3f8ec1b1335 100644 --- a/projects/packages/videopress/src/class-package-version.php +++ b/projects/packages/videopress/src/class-package-version.php @@ -11,7 +11,7 @@ * The Package_Version class. */ class Package_Version { - const PACKAGE_VERSION = '0.24.11'; + const PACKAGE_VERSION = '0.24.13'; const PACKAGE_SLUG = 'videopress'; diff --git a/projects/packages/waf/CHANGELOG.md b/projects/packages/waf/CHANGELOG.md index f3f85b92ea5cb..dd0ee6e8a2344 100644 --- a/projects/packages/waf/CHANGELOG.md +++ b/projects/packages/waf/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.22.1] - 2024-10-17 +### Fixed +- WAF: Improve backwards compatibility for sites running outdated bootstrap scripts via standalone mode. [#39812] + +## [0.22.0] - 2024-10-14 +### Added +- WAF: Add new properties to the WAF feature's REST API endpoint. [#39511] + +### Fixed +- Improve backwards compatibility for sites running in standalone mode. [#39652] +- WAF: Reduce amount of classes autoloaded during standalone mode execution. [#38944] + ## [0.21.0] - 2024-10-07 ### Added - Firewall Runtime: Added support for rule files to specify body parser type. [#39516] @@ -382,6 +394,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Core: do not ship .phpcs.dir.xml in production builds. +[0.22.1]: https://github.com/Automattic/jetpack-waf/compare/v0.22.0...v0.22.1 +[0.22.0]: https://github.com/Automattic/jetpack-waf/compare/v0.21.0...v0.22.0 [0.21.0]: https://github.com/Automattic/jetpack-waf/compare/v0.20.1...v0.21.0 [0.20.1]: https://github.com/Automattic/jetpack-waf/compare/v0.20.0...v0.20.1 [0.20.0]: https://github.com/Automattic/jetpack-waf/compare/v0.19.0...v0.20.0 diff --git a/projects/packages/waf/changelog/add-waf-api-new-properties b/projects/packages/waf/changelog/add-waf-api-new-properties deleted file mode 100644 index 940ade07a0bba..0000000000000 --- a/projects/packages/waf/changelog/add-waf-api-new-properties +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -WAF: Add new properties to the WAF feature's REST API endpoint. diff --git a/projects/packages/waf/changelog/fix-waf-autoloaded-runner-class-handling b/projects/packages/waf/changelog/fix-waf-autoloaded-runner-class-handling deleted file mode 100644 index d8d7bc0000aff..0000000000000 --- a/projects/packages/waf/changelog/fix-waf-autoloaded-runner-class-handling +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Improve backwards compatibility for sites running in standalone mode. diff --git a/projects/packages/waf/changelog/fix-waf-no-waf-rules-manager-call-in-standalone-mode b/projects/packages/waf/changelog/fix-waf-no-waf-rules-manager-call-in-standalone-mode deleted file mode 100644 index 781cd4af66626..0000000000000 --- a/projects/packages/waf/changelog/fix-waf-no-waf-rules-manager-call-in-standalone-mode +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -WAF: reduce amount of classes autoloaded during standalone mode execution diff --git a/projects/packages/waf/composer.json b/projects/packages/waf/composer.json index 7d041c17013d6..5fd7008faf5b7 100644 --- a/projects/packages/waf/composer.json +++ b/projects/packages/waf/composer.json @@ -61,7 +61,7 @@ "link-template": "https://github.com/Automattic/jetpack-waf/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "0.21.x-dev" + "dev-trunk": "0.22.x-dev" } }, "config": { diff --git a/projects/packages/waf/src/class-compatibility.php b/projects/packages/waf/src/class-compatibility.php index 362543a391fb1..495f71f989bfc 100644 --- a/projects/packages/waf/src/class-compatibility.php +++ b/projects/packages/waf/src/class-compatibility.php @@ -19,7 +19,7 @@ class Waf_Compatibility { /** * Returns the name for the IP allow list enabled/disabled option. * - * @since $$next-version$$ + * @since 0.22.0 * * @return string */ @@ -39,7 +39,7 @@ private static function get_ip_allow_list_enabled_option_name() { /** * Returns the name for the IP block list enabled/disabled option. * - * @since $$next-version$$ + * @since 0.22.0 * * @return string */ diff --git a/projects/packages/waf/src/class-waf-rules-manager.php b/projects/packages/waf/src/class-waf-rules-manager.php index ddfb55f6bfd1a..5303ff353f258 100644 --- a/projects/packages/waf/src/class-waf-rules-manager.php +++ b/projects/packages/waf/src/class-waf-rules-manager.php @@ -46,7 +46,7 @@ class Waf_Rules_Manager { /** * Rules Entrypoint File * - * @deprecated $$next-version$$ Use JETPACK_WAF_ENTRYPOINT instead. + * @deprecated 0.22.0 Use JETPACK_WAF_ENTRYPOINT instead. */ const RULES_ENTRYPOINT_FILE = '/rules/rules.php'; diff --git a/projects/packages/waf/src/class-waf-standalone-bootstrap.php b/projects/packages/waf/src/class-waf-standalone-bootstrap.php index a272b1492cf0a..61a930b2a948d 100644 --- a/projects/packages/waf/src/class-waf-standalone-bootstrap.php +++ b/projects/packages/waf/src/class-waf-standalone-bootstrap.php @@ -120,6 +120,15 @@ public function get_bootstrap_file_path() { return trailingslashit( JETPACK_WAF_DIR ) . 'bootstrap.php'; } + /** + * Gets the entrypoint file. + * + * @return string The entrypoint file. + */ + private function get_entrypoint() { + return defined( 'JETPACK_WAF_ENTRYPOINT' ) ? JETPACK_WAF_ENTRYPOINT : 'rules/rules.php'; + } + /** * Generates the bootstrap file. * @@ -141,6 +150,7 @@ public function generate() { $autoloader_file = $this->locate_autoloader_file(); $bootstrap_file = $this->get_bootstrap_file_path(); + $entrypoint = $this->get_entrypoint(); $mode_option = get_option( Waf_Runner::MODE_OPTION_NAME, false ); $share_data_option = get_option( Waf_Runner::SHARE_DATA_OPTION_NAME, false ); $share_debug_data_option = get_option( Waf_Runner::SHARE_DEBUG_DATA_OPTION_NAME, false ); @@ -154,7 +164,7 @@ public function generate() { . sprintf( "define( 'JETPACK_WAF_SHARE_DEBUG_DATA', %s );\n", var_export( $share_debug_data_option, true ) ) . sprintf( "define( 'JETPACK_WAF_DIR', %s );\n", var_export( JETPACK_WAF_DIR, true ) ) . sprintf( "define( 'JETPACK_WAF_WPCONFIG', %s );\n", var_export( JETPACK_WAF_WPCONFIG, true ) ) - . sprintf( "define( 'JETPACK_WAF_ENTRYPOINT', %s );\n", var_export( JETPACK_WAF_ENTRYPOINT, true ) ) + . sprintf( "define( 'JETPACK_WAF_ENTRYPOINT', %s );\n", var_export( $entrypoint, true ) ) . 'require_once ' . var_export( $autoloader_file, true ) . ";\n" . "Automattic\Jetpack\Waf\Waf_Runner::initialize();\n"; // phpcs:enable diff --git a/projects/packages/wordads/CHANGELOG.md b/projects/packages/wordads/CHANGELOG.md index 7ad27ee128498..d25e4089cd111 100644 --- a/projects/packages/wordads/CHANGELOG.md +++ b/projects/packages/wordads/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.37] - 2024-10-21 +### Changed +- Update dependencies. [#39781] + +## [0.3.36] - 2024-10-14 +### Changed +- Updated package dependencies. [#39707] + ## [0.3.35] - 2024-10-07 ### Changed - Updated package dependencies. [#39592] @@ -422,6 +430,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - PHPCS: Fix `WordPress.Security.ValidatedSanitizedInput` - Updated package dependencies. +[0.3.37]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.36...v0.3.37 +[0.3.36]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.35...v0.3.36 [0.3.35]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.34...v0.3.35 [0.3.34]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.33...v0.3.34 [0.3.33]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.32...v0.3.33 diff --git a/projects/packages/wordads/changelog/add-dependency-extraction-auto-polyfill b/projects/packages/wordads/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index 20df2e785f6c5..0000000000000 --- a/projects/packages/wordads/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Update Babel config to disable new `autoWpPolyfill` option. - - diff --git a/projects/packages/wordads/changelog/add-dependency-extraction-auto-polyfill#2 b/projects/packages/wordads/changelog/add-dependency-extraction-auto-polyfill#2 deleted file mode 100644 index 9e8ffe1ab8734..0000000000000 --- a/projects/packages/wordads/changelog/add-dependency-extraction-auto-polyfill#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: removed -Comment: Remove unnecessary JS dep on `@wordpress/dependency-extraction-webpack-plugin` - - diff --git a/projects/packages/wordads/changelog/renovate-wordpress-monorepo b/projects/packages/wordads/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/wordads/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/wordads/package.json b/projects/packages/wordads/package.json index 099cc9ebdedc6..410b3d6c90e4a 100644 --- a/projects/packages/wordads/package.json +++ b/projects/packages/wordads/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-wordads", - "version": "0.3.35", + "version": "0.3.37", "description": "Earn income by allowing Jetpack to display high quality ads.", "main": "main.js", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/wordads/#readme", diff --git a/projects/packages/wordads/src/class-package.php b/projects/packages/wordads/src/class-package.php index 91a119e2d7f1d..547d26cc1b6d7 100644 --- a/projects/packages/wordads/src/class-package.php +++ b/projects/packages/wordads/src/class-package.php @@ -11,7 +11,7 @@ * WordAds package general information */ class Package { - const VERSION = '0.3.35'; + const VERSION = '0.3.37'; const SLUG = 'wordads'; /** diff --git a/projects/plugins/automattic-for-agencies-client/changelog/fix-sync-filter-null-array b/projects/plugins/automattic-for-agencies-client/changelog/fix-sync-filter-null-array new file mode 100644 index 0000000000000..3f56c90b3a7bf --- /dev/null +++ b/projects/plugins/automattic-for-agencies-client/changelog/fix-sync-filter-null-array @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Sync: update filter parameter to avoid conflicts with other plugins. + + diff --git a/projects/plugins/automattic-for-agencies-client/changelog/update-tested-to-6-7 b/projects/plugins/automattic-for-agencies-client/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/automattic-for-agencies-client/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/automattic-for-agencies-client/readme.txt b/projects/plugins/automattic-for-agencies-client/readme.txt index 4fa7bc1f2a1ba..5601a6fd6bd91 100644 --- a/projects/plugins/automattic-for-agencies-client/readme.txt +++ b/projects/plugins/automattic-for-agencies-client/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, jeherve, njweller, rcanepa Tags: agency, dashboard, management, sites, monitoring Requires at least: 6.5 Requires PHP: 7.0 -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 0.2.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/projects/plugins/backup/changelog/fix-sync-filter-null-array b/projects/plugins/backup/changelog/fix-sync-filter-null-array new file mode 100644 index 0000000000000..3f56c90b3a7bf --- /dev/null +++ b/projects/plugins/backup/changelog/fix-sync-filter-null-array @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Sync: update filter parameter to avoid conflicts with other plugins. + + diff --git a/projects/plugins/backup/changelog/revert-admin_notice_37051 b/projects/plugins/backup/changelog/revert-admin_notice_37051 new file mode 100644 index 0000000000000..772077f2095b5 --- /dev/null +++ b/projects/plugins/backup/changelog/revert-admin_notice_37051 @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +General: ensure the notice displayed when running an old version of WordPress can always be displayed without errors. diff --git a/projects/plugins/backup/changelog/update-tested-to-6-7 b/projects/plugins/backup/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/backup/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/backup/jetpack-backup.php b/projects/plugins/backup/jetpack-backup.php index 9af5e3c19b0a1..b0932ee566591 100644 --- a/projects/plugins/backup/jetpack-backup.php +++ b/projects/plugins/backup/jetpack-backup.php @@ -71,13 +71,15 @@ function jetpack_backup_requirements_check() { add_action( 'admin_notices', function () use ( $jetpack_backup_meets_requirements ) { - wp_admin_notice( - esc_html( $jetpack_backup_meets_requirements->get_error_message() ), - array( - 'type' => 'error', - 'dismissible' => true, - ) - ); + ?> +
+

+ get_error_message() ); + ?> +

+
+ ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDefault', 'PhanUndeclaredClassMethod', 'PhanUndeclaredClassReference', 'PhanUndeclaredConstant'], 'app/lib/minify/functions-service.php' => ['PhanImpossibleTypeComparison', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginNeverReturnFunction', 'PhanPluginUseReturnValueInternalKnown', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal'], 'app/modules/Modules_Setup.php' => ['PhanTypeMismatchPropertyDefault'], - 'app/modules/image-guide/Image_Guide.php' => ['PhanPluginSimplifyExpressionBool'], 'app/modules/image-guide/Image_Guide_Proxy.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'app/modules/image-size-analysis/data-sync/Image_Size_Analysis_Action_Fix.php' => ['PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition'], 'app/modules/optimizations/critical-css/CSS_Proxy.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], diff --git a/projects/plugins/boost/CHANGELOG.md b/projects/plugins/boost/CHANGELOG.md index 4d42b4417e2b9..3069300457b16 100644 --- a/projects/plugins/boost/CHANGELOG.md +++ b/projects/plugins/boost/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.5.2-beta] - 2024-10-10 +## [3.5.2] - 2024-10-15 ### Changed - Deferred JS: Exclude all scripts produced by a shortcode. [#39616] - General: Sync Boost's Getting Started page with My Jetpack's version. [#39130] @@ -524,7 +524,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First public alpha release -[3.5.2-beta]: https://github.com/Automattic/jetpack-boost-production/compare/3.5.1...3.5.2-beta +[3.5.2]: https://github.com/Automattic/jetpack-boost-production/compare/3.5.1...3.5.2 [3.5.1]: https://github.com/Automattic/jetpack-boost-production/compare/3.5.0...3.5.1 [3.5.0]: https://github.com/Automattic/jetpack-boost-production/compare/3.4.9...3.5.0 [3.4.9]: https://github.com/Automattic/jetpack-boost-production/compare/3.4.8...3.4.9 diff --git a/projects/plugins/boost/app/features/setup-prompt/Setup_Prompt.php b/projects/plugins/boost/app/features/setup-prompt/Setup_Prompt.php deleted file mode 100644 index c7c02c6961c25..0000000000000 --- a/projects/plugins/boost/app/features/setup-prompt/Setup_Prompt.php +++ /dev/null @@ -1,61 +0,0 @@ -get() === false || $this->is_banner_dismissed() ) { - return; - } - - add_action( 'admin_notices', array( $this, 'connection_prompt' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); - add_action( 'admin_footer', array( $this, 'add_dismiss_script' ) ); - } - - public function enqueue_scripts() { - wp_enqueue_style( 'jetpack-boost-admin-banner', plugins_url( '../../assets/dist/admin-banner.css', __FILE__ ), array(), JETPACK_BOOST_VERSION ); - } - - public function connection_prompt() { - include __DIR__ . '/_inc/banner.php'; - } - - public function add_dismiss_script() { - include __DIR__ . '/_inc/dismiss-script.php'; - } - - private function is_banner_dismissed() { - return get_option( self::OPTION_KEY, false ); - } - - /** - * Hides the boost promo banner on dismiss - * - * @return never - */ - public function dismiss_setup_banner() { - check_ajax_referer( self::NONCE_ACTION, 'nonce' ); - update_option( self::OPTION_KEY, true, false ); - exit(); - } -} diff --git a/projects/plugins/boost/app/features/setup-prompt/_inc/banner.php b/projects/plugins/boost/app/features/setup-prompt/_inc/banner.php deleted file mode 100644 index 702452062d99b..0000000000000 --- a/projects/plugins/boost/app/features/setup-prompt/_inc/banner.php +++ /dev/null @@ -1,44 +0,0 @@ - -
-
- - -
- -
-
- - -

- -

- -

- -

- - -
- -
- <?php esc_attr_e( 'An image showing a web site with a photo of a time-lapsed watch face. In the foreground is a graph showing a speed score for mobile and desktop in yellow and green with an overall score of B', 'jetpack-boost' ); ?> -
-
-
- diff --git a/projects/plugins/boost/app/features/setup-prompt/_inc/dismiss-script.php b/projects/plugins/boost/app/features/setup-prompt/_inc/dismiss-script.php deleted file mode 100644 index 4f0406eed8a62..0000000000000 --- a/projects/plugins/boost/app/features/setup-prompt/_inc/dismiss-script.php +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/projects/plugins/boost/app/lib/critical-css/source-providers/providers/WP_Core_Provider.php b/projects/plugins/boost/app/lib/critical-css/source-providers/providers/WP_Core_Provider.php index e2b63769a6784..68445b4031fbb 100644 --- a/projects/plugins/boost/app/lib/critical-css/source-providers/providers/WP_Core_Provider.php +++ b/projects/plugins/boost/app/lib/critical-css/source-providers/providers/WP_Core_Provider.php @@ -43,8 +43,8 @@ public static function get_critical_source_urls( $context_posts = array() ) { if ( ! empty( $permalink ) ) { $urls['posts_page'] = array( $permalink ); } - } else { - $urls['posts_page'] = (array) home_url( '/' ); + } elseif ( ! $front_page ) { + $urls['posts_page'] = array( home_url( '/' ) ); } return $urls; diff --git a/projects/plugins/boost/app/modules/image-guide/Image_Guide.php b/projects/plugins/boost/app/modules/image-guide/Image_Guide.php index 9360a6b25efef..ce2e23fe9197e 100644 --- a/projects/plugins/boost/app/modules/image-guide/Image_Guide.php +++ b/projects/plugins/boost/app/modules/image-guide/Image_Guide.php @@ -9,15 +9,12 @@ class Image_Guide implements Pluggable { public function setup() { - // phpcs:ignore WordPress.Security.NonceVerification.Recommended - $override = isset( $_GET['jb-debug-ig'] ); - - if ( is_admin() || is_user_logged_in() || current_user_can( 'manage_options' ) ) { + if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) { Image_Guide_Proxy::init(); } // Show the UI only when the user is logged in, with sufficient permissions and isn't looking at the dashboard. - if ( true !== $override && ( is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) ) { + if ( is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) { return; } diff --git a/projects/plugins/boost/changelog/backport-3.5.2-changes b/projects/plugins/boost/changelog/backport-3.5.2-changes new file mode 100644 index 0000000000000..2dfedd8b13b1f --- /dev/null +++ b/projects/plugins/boost/changelog/backport-3.5.2-changes @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Backport changes from 3.5.2 release. + + diff --git a/projects/plugins/boost/changelog/fix-sync-filter-null-array b/projects/plugins/boost/changelog/fix-sync-filter-null-array new file mode 100644 index 0000000000000..3f56c90b3a7bf --- /dev/null +++ b/projects/plugins/boost/changelog/fix-sync-filter-null-array @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Sync: update filter parameter to avoid conflicts with other plugins. + + diff --git a/projects/plugins/boost/changelog/remove-image-guide-override b/projects/plugins/boost/changelog/remove-image-guide-override new file mode 100644 index 0000000000000..35c10bab98c1a --- /dev/null +++ b/projects/plugins/boost/changelog/remove-image-guide-override @@ -0,0 +1,4 @@ +Significance: minor +Type: removed + +Image Guide: Remove URL parameter based override. diff --git a/projects/plugins/boost/changelog/remove-setup-prompt b/projects/plugins/boost/changelog/remove-setup-prompt new file mode 100644 index 0000000000000..efe8af0a118e6 --- /dev/null +++ b/projects/plugins/boost/changelog/remove-setup-prompt @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Removed unused code + + diff --git a/projects/plugins/boost/changelog/update-ccss-core-providers b/projects/plugins/boost/changelog/update-ccss-core-providers new file mode 100644 index 0000000000000..527e9511c0c8b --- /dev/null +++ b/projects/plugins/boost/changelog/update-ccss-core-providers @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Critical CSS: Make the list of critical CSS URLs more efficient. diff --git a/projects/plugins/boost/changelog/update-tested-to-6-7 b/projects/plugins/boost/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/boost/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/boost/composer.json b/projects/plugins/boost/composer.json index 1f93287f385f9..c07f0a75a493f 100644 --- a/projects/plugins/boost/composer.json +++ b/projects/plugins/boost/composer.json @@ -3,7 +3,7 @@ "description": "Boost your WordPress site's performance, from the creators of Jetpack", "type": "library", "license": "GPL-2.0-or-later", - "version": "3.5.2-beta", + "version": "3.5.2", "authors": [ { "name": "Automattic, Inc.", @@ -74,7 +74,7 @@ "platform": { "ext-intl": "0.0.0" }, - "autoloader-suffix": "b1e77e6231d50e7663f84529b6a3dfda_jetpack_boostⓥ3_5_2_beta", + "autoloader-suffix": "b1e77e6231d50e7663f84529b6a3dfda_jetpack_boostⓥ3_5_2", "allow-plugins": { "roots/wordpress-core-installer": true, "automattic/jetpack-autoloader": true, diff --git a/projects/plugins/boost/composer.lock b/projects/plugins/boost/composer.lock index b16ccf509b8aa..3b6fc7a807989 100644 --- a/projects/plugins/boost/composer.lock +++ b/projects/plugins/boost/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ef9bdede176e9ae0f99bac7c8e4de09a", + "content-hash": "aa37384bded5cf285343140269233ca2", "packages": [ { "name": "automattic/jetpack-a8c-mc-stats", diff --git a/projects/plugins/boost/jetpack-boost.php b/projects/plugins/boost/jetpack-boost.php index d75ac3de43503..72e55cbb4abbc 100644 --- a/projects/plugins/boost/jetpack-boost.php +++ b/projects/plugins/boost/jetpack-boost.php @@ -9,7 +9,7 @@ * Plugin Name: Jetpack Boost * Plugin URI: https://jetpack.com/boost * Description: Boost your WordPress site's performance, from the creators of Jetpack - * Version: 3.5.2-beta + * Version: 3.5.2 * Author: Automattic - Jetpack Site Speed team * Author URI: https://jetpack.com/boost/ * License: GPL-2.0+ @@ -29,7 +29,7 @@ die; } -define( 'JETPACK_BOOST_VERSION', '3.5.2-beta' ); +define( 'JETPACK_BOOST_VERSION', '3.5.2' ); define( 'JETPACK_BOOST_SLUG', 'jetpack-boost' ); if ( ! defined( 'JETPACK_BOOST_CLIENT_NAME' ) ) { diff --git a/projects/plugins/boost/package.json b/projects/plugins/boost/package.json index a4e58afac616e..9c3124c796fab 100644 --- a/projects/plugins/boost/package.json +++ b/projects/plugins/boost/package.json @@ -1,6 +1,6 @@ { "name": "jetpack-boost", - "version": "3.5.2-beta", + "version": "3.5.2", "description": "Boost your WordPress site's performance, from the creators of Jetpack", "directories": { "test": "tests" diff --git a/projects/plugins/boost/readme.txt b/projects/plugins/boost/readme.txt index e359cc797035a..fde356fc07b00 100644 --- a/projects/plugins/boost/readme.txt +++ b/projects/plugins/boost/readme.txt @@ -3,9 +3,9 @@ Contributors: automattic, xwp, adnan007, bjorsch, danwalmsley, davidlonjon, dili Donate link: https://automattic.com Tags: performance, speed, web vitals, critical css, cache Requires at least: 6.5 -Tested up to: 6.6 +Tested up to: 6.7 Requires PHP: 7.0 -Stable tag: 3.5.1 +Stable tag: 3.5.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -183,7 +183,7 @@ If you run into compatibility issues, please do let us know. You can drop us a l 2. Jetpack Boost Speed Improvement == Changelog == -### 3.5.2-beta - 2024-10-10 +### 3.5.2 - 2024-10-15 #### Changed - Deferred JS: Exclude all scripts produced by a shortcode. - General: Sync Boost's Getting Started page with My Jetpack's version. diff --git a/projects/plugins/classic-theme-helper-plugin/changelog/update-tested-to-6-7 b/projects/plugins/classic-theme-helper-plugin/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/classic-theme-helper-plugin/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/classic-theme-helper-plugin/readme.txt b/projects/plugins/classic-theme-helper-plugin/readme.txt index d4c1568fc21a6..ae28b2f61398f 100644 --- a/projects/plugins/classic-theme-helper-plugin/readme.txt +++ b/projects/plugins/classic-theme-helper-plugin/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, Tags: jetpack, stuff Requires at least: 6.5 Requires PHP: 7.0 -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 0.1.0-alpha License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/projects/plugins/crm/changelog/update-tested-to-6-7 b/projects/plugins/crm/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/crm/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/crm/readme.txt b/projects/plugins/crm/readme.txt index fa19d69208f33..85fc40e13a5de 100644 --- a/projects/plugins/crm/readme.txt +++ b/projects/plugins/crm/readme.txt @@ -1,7 +1,7 @@ === Jetpack CRM - Clients, Leads, Invoices, Billing, Email Marketing, & Automation === Contributors: automattic, kallehauge, cleacos, diegogarciarodrigues, bradshawtm, wpkaren, robertf4, woodyhayday, mikemayhem3030 Tags: CRM, Invoice, Woocommerce CRM, Clients, Lead Generation, contacts, customers, billing, email marketing, Marketing Automation, contact form, automations -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 6.4.2 Requires at least: 6.0 Requires PHP: 7.4 diff --git a/projects/plugins/inspect/changelog/update-tested-to-6-7 b/projects/plugins/inspect/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/inspect/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/inspect/readme.txt b/projects/plugins/inspect/readme.txt index 8047dad7d5d0f..d3a735ec12689 100644 --- a/projects/plugins/inspect/readme.txt +++ b/projects/plugins/inspect/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, Tags: jetpack, stuff Requires at least: 6.5 Requires PHP: 7.0 -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 1.0.0-alpha License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index 73b08dec3ed91..7120701294027 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -178,7 +178,7 @@ 'extensions/blocks/blog-stats/blog-stats.php' => ['PhanTypeMismatchReturnProbablyReal'], 'extensions/blocks/blogroll/blogroll-item/blogroll-item.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'extensions/blocks/calendly/calendly.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal'], - 'extensions/blocks/contact-info/class-jetpack-contact-info-block.php' => ['PhanTypeMismatchReturn'], + 'extensions/blocks/contact-info/contact-info.php' => ['PhanTypeMismatchReturn'], 'extensions/blocks/cookie-consent/cookie-consent.php' => ['PhanParamTooMany'], 'extensions/blocks/donations/donations.php' => ['PhanTypeMismatchArgument'], 'extensions/blocks/gif/gif.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], diff --git a/projects/plugins/jetpack/CHANGELOG.md b/projects/plugins/jetpack/CHANGELOG.md index 8382d4c1241cb..69f50357e0587 100644 --- a/projects/plugins/jetpack/CHANGELOG.md +++ b/projects/plugins/jetpack/CHANGELOG.md @@ -2,6 +2,68 @@ ### This is a list detailing changes for all Jetpack releases. +## 14.0-a.7 - 2024-10-21 +### Enhancements +- Newsletters: Add an email preview option to the preview menu. [#39782] +- Newsletters: Allow skipping newsletter modals with a URL query param. [#39644] + +### Improved compatibility +- General: Ensure notice displays without errors when running an old version of WordPress. [#39745] +- Plugin action links filters: Update parameter to avoid conflicts with other plugins. [#39681] + +### Bug fixes +- Map Block: Fix issue where blocks placed underneath would overlap with the map block. [#39744] +- Newsletters: Fix "Use excerpt" setting. [#39815] + +### Other changes +- Map Block: Display a static map image when the block is rendered in a pattern preview. [#39768] +- Map: Remove preview attribute. [#39768] +- Newsletters: Fix 'class Jetpack_Subscriptions_Widget not found' fatal error during REST API. [#39765] +- Slideshow Block: Fix console warning related to images with the same key. [#39821] +- Story Block: Avoid error when previewing block styles in development version of the Gutenberg plugin. [#39807] +- Story Block: Fix console warning related to 'key' not being a prop. [#39822] +- Tests: Fix unit tests. [#39799] +- Update VideoPress notice URL on Media Library. [#39731] + +## 14.0-a.5 - 2024-10-16 +### Other changes +- Related Posts: refine how related posts are made available on singular views in block themes. [#39784] + +## 14.0-a.3 - 2024-10-14 +### Enhancements +- Newsletter: Update the default "reply to" setting value from not allowed to replies being posted as public comments. [#39657] +- Social: Add Bluesky to social previews. [#39659] + +### Improved compatibility +- Image CDN: URL encode image path parts for RSS feed compatibility. [#39560] +- Related Posts: Allow Related Posts on non-post CPTs where the block is already able to be used. [#39730] + +### Bug fixes +- Blocks: Fix rendering of the goodreads block to avoid PHP warnings caused by missing attributes. [#39713] +- Blocks: Render the slideshow block correctly inside an iframe editor. [#39551] +- Contact Form: Ensure that submitted forms can only be accessed by logged in users allowed to view form submissions. [#39759] +- General: Only include `wp-polyfill` as a script dependency when needed. [#39629] +- Newsletter: Ensure `Enable featured image on your new post emails` setting displays the right value. [#39700] +- Sharing: Ensure the sharing settings can be accessed even when a user is not connected to WordPress.com. [#39677] +- Stats: Fix top post card on the Insight page. [#39691] + +### Other changes +- Add connection nudge for blocks that are missing it. [#39647] +- Add missing deps in calls to the `useSelect` React hook. [#39421] +- Add tracks to connection banner. [#39732] +- AI Assistant: Make Breve no longer flag single quotes as spelling errors. [#39735] +- Fix issue where connection banner was showing for simple sites. [#39687] +- Infinite-scroll: Add isset checks to validate input data. [#39618] +- Janitorial: Add siteFragment to JP initial state definition, avoid linter warnings. [#39589] +- Jetpack AI: Change constant value for fair usage, accept both values on type definitions. [#39705] +- JSON Endpoints: Handle null input for update post endpoint. [#39676] +- Optimize the 'admin_init' hook callback for Sharing module. [#39737] +- SAL_Site class: Add null check to posts_status_obj to avoid warnings. [#39727] +- Show connection nudge instead of error if user is not connected on blogroll block. [#39638] +- Update package dependencies. [#39649] [#39653] [#39707] +- Use React setState instead of directly modifying state. [#39421] +- Widget Visibility: Add check to ensure post exists before accesing post_author. [#39746] + ## 14.0-a.1 - 2024-10-07 ### Enhancements - Sitemap: Improve sitemap write efficienty. [#39572] @@ -20,6 +82,10 @@ - Unify connection related CTAs on At A Glance. [#39585] - Updated package dependencies. [#39594] [#39639] +## 13.9.1 - 2024-10-14 +### Bug fixes +- Contact Form: Ensure that submitted forms can only be accessed by logged in users allowed to view form submissions. [#39759] + ## 13.9 - 2024-10-01 ### Major Enhancements - Jetpack plugin: Remove the 'WordPress.com Toolbar' module. [#39406] diff --git a/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx b/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx index 6f12121a00c07..984e585d74163 100644 --- a/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx +++ b/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx @@ -38,6 +38,7 @@ function SubscriptionsSettings( props ) { isStcEnabled, isSmEnabled, isSubscribeOverlayEnabled, + isSubscribeFloatingEnabled, isSubscribePostEndEnabled, isLoginNavigationEnabled, isSubscribeNavigationEnabled, @@ -69,6 +70,15 @@ function SubscriptionsSettings( props ) { } ) : null; + const subscribeFloatingEditorUrl = + siteAdminUrl && themeStylesheet + ? addQueryArgs( `${ siteAdminUrl }site-editor.php`, { + postType: 'wp_template_part', + postId: `${ themeStylesheet }//jetpack-subscribe-floating-button`, + canvas: 'edit', + } ) + : null; + const singlePostTemplateEditorUrl = siteAdminUrl ? addQueryArgs( `${ siteAdminUrl }site-editor.php`, { postType: 'wp_template', @@ -99,6 +109,13 @@ function SubscriptionsSettings( props ) { updateFormStateModuleOption( SUBSCRIPTIONS_MODULE_NAME, 'jetpack_subscribe_overlay_enabled' ); }, [ updateFormStateModuleOption ] ); + const handleSubscribeFloatingToggleChange = useCallback( () => { + updateFormStateModuleOption( + SUBSCRIPTIONS_MODULE_NAME, + 'jetpack_subscribe_floating_button_enabled' + ); + }, [ updateFormStateModuleOption ] ); + const handleSubscribePostEndToggleChange = useCallback( () => { updateFormStateModuleOption( SUBSCRIPTIONS_MODULE_NAME, @@ -202,6 +219,25 @@ function SubscriptionsSettings( props ) {
} /> + + { __( "Floating subscribe button on site's bottom corner", 'jetpack' ) } + { isBlockTheme && subscribeFloatingEditorUrl && ( + <> + { '. ' } + + { __( 'Preview and edit', 'jetpack' ) } + + + ) } + + } + /> { isSubscriptionSiteEditSupported && ( @@ -293,6 +329,9 @@ export default withModuleSettingsFormHelpers( isStcEnabled: ownProps.getOptionValue( 'stc_enabled' ), isSmEnabled: ownProps.getOptionValue( 'sm_enabled' ), isSubscribeOverlayEnabled: ownProps.getOptionValue( 'jetpack_subscribe_overlay_enabled' ), + isSubscribeFloatingEnabled: ownProps.getOptionValue( + 'jetpack_subscribe_floating_button_enabled' + ), isSubscribePostEndEnabled: ownProps.getOptionValue( 'jetpack_subscriptions_subscribe_post_end_enabled' ), diff --git a/projects/plugins/jetpack/_inc/client/sharing/index.jsx b/projects/plugins/jetpack/_inc/client/sharing/index.jsx index 196f8cd178b05..ba0f0e9b64409 100644 --- a/projects/plugins/jetpack/_inc/client/sharing/index.jsx +++ b/projects/plugins/jetpack/_inc/client/sharing/index.jsx @@ -1,4 +1,7 @@ -import { getSocialScriptData } from '@automattic/jetpack-publicize-components'; +import { + getSocialScriptData, + hasSocialPaidFeatures, +} from '@automattic/jetpack-publicize-components'; import { __ } from '@wordpress/i18n'; import QuerySite from 'components/data/query-site'; import React, { Component } from 'react'; @@ -97,7 +100,7 @@ export default connect( state => { blogID: getSiteId( state ), siteAdminUrl: getSiteAdminUrl( state ), activeFeatures: getActiveFeatures( state ), - hasPaidFeatures: siteHasFeature( state, 'social-enhanced-publishing' ), + hasPaidFeatures: hasSocialPaidFeatures(), hasSocialImageGenerator: siteHasFeature( state, 'social-image-generator' ), userCanManageModules: userCanManageModules( state ), isAtomicSite: isAtomicSite( state ), diff --git a/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php b/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php index 8122e2ad76477..e56d427c0c5ea 100644 --- a/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php +++ b/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php @@ -2256,7 +2256,7 @@ public static function get_updateable_data_list( $selector = '' ) { $options = array( // Blocks. - 'jetpack_blocks_disabled' => array( + 'jetpack_blocks_disabled' => array( 'description' => esc_html__( 'Jetpack Blocks disabled.', 'jetpack' ), 'type' => 'boolean', 'default' => false, @@ -2265,7 +2265,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Carousel - 'carousel_background_color' => array( + 'carousel_background_color' => array( 'description' => esc_html__( 'Color scheme.', 'jetpack' ), 'type' => 'string', 'default' => 'black', @@ -2280,7 +2280,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_list_item', 'jp_group' => 'carousel', ), - 'carousel_display_exif' => array( + 'carousel_display_exif' => array( 'description' => wp_kses( sprintf( __( 'Show photo metadata (Exif) in carousel, when available.', 'jetpack' ) ), array( @@ -2295,7 +2295,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'carousel', ), - 'carousel_display_comments' => array( + 'carousel_display_comments' => array( 'description' => esc_html__( 'Show comments area in carousel', 'jetpack' ), 'type' => 'boolean', 'default' => 1, @@ -2304,14 +2304,14 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Comments. - 'highlander_comment_form_prompt' => array( + 'highlander_comment_form_prompt' => array( 'description' => esc_html__( 'Greeting Text', 'jetpack' ), 'type' => 'string', 'default' => esc_html__( 'Leave a Reply', 'jetpack' ), 'sanitize_callback' => 'sanitize_text_field', 'jp_group' => 'comments', ), - 'jetpack_comment_form_color_scheme' => array( + 'jetpack_comment_form_color_scheme' => array( 'description' => esc_html__( 'Color scheme', 'jetpack' ), 'type' => 'string', 'default' => 'light', @@ -2330,28 +2330,28 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Custom Content Types. - 'jetpack_portfolio' => array( + 'jetpack_portfolio' => array( 'description' => esc_html__( 'Enable or disable Jetpack portfolio post type.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'custom-content-types', ), - 'jetpack_portfolio_posts_per_page' => array( + 'jetpack_portfolio_posts_per_page' => array( 'description' => esc_html__( 'Number of entries to show at most in Portfolio pages.', 'jetpack' ), 'type' => 'integer', 'default' => 10, 'validate_callback' => __CLASS__ . '::validate_posint', 'jp_group' => 'custom-content-types', ), - 'jetpack_testimonial' => array( + 'jetpack_testimonial' => array( 'description' => esc_html__( 'Enable or disable Jetpack testimonial post type.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'custom-content-types', ), - 'jetpack_testimonial_posts_per_page' => array( + 'jetpack_testimonial_posts_per_page' => array( 'description' => esc_html__( 'Number of entries to show at most in Testimonial pages.', 'jetpack' ), 'type' => 'integer', 'default' => 10, @@ -2360,21 +2360,21 @@ public static function get_updateable_data_list( $selector = '' ) { ), // WAF. - 'jetpack_waf_automatic_rules' => array( + 'jetpack_waf_automatic_rules' => array( 'description' => esc_html__( 'Enable automatic rules - Protect your site against untrusted traffic sources with automatic security rules.', 'jetpack' ), 'type' => 'boolean', 'default' => Waf_Compatibility::get_default_automatic_rules_option(), 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'waf', ), - 'jetpack_waf_ip_block_list_enabled' => array( + 'jetpack_waf_ip_block_list_enabled' => array( 'description' => esc_html__( 'Block list - Block a specific request IP.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'waf', ), - 'jetpack_waf_ip_block_list' => array( + 'jetpack_waf_ip_block_list' => array( 'description' => esc_html__( 'Blocked IP addresses', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2382,14 +2382,14 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => 'esc_textarea', 'jp_group' => 'waf', ), - 'jetpack_waf_ip_allow_list_enabled' => array( + 'jetpack_waf_ip_allow_list_enabled' => array( 'description' => esc_html__( 'Allow list - Allow a specific request IP.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'settings', ), - 'jetpack_waf_ip_allow_list' => array( + 'jetpack_waf_ip_allow_list' => array( 'description' => esc_html__( 'Always allowed IP addresses', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2397,14 +2397,14 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => 'esc_textarea', 'jp_group' => 'settings', ), - 'jetpack_waf_share_data' => array( + 'jetpack_waf_share_data' => array( 'description' => esc_html__( 'Share basic data with Jetpack.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'waf', ), - 'jetpack_waf_share_debug_data' => array( + 'jetpack_waf_share_debug_data' => array( 'description' => esc_html__( 'Share detailed data with Jetpack.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2412,7 +2412,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'waf', ), // Galleries. - 'tiled_galleries' => array( + 'tiled_galleries' => array( 'description' => esc_html__( 'Display all your gallery pictures in a cool mosaic.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2420,7 +2420,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'tiled-gallery', ), - 'gravatar_disable_hovercards' => array( + 'gravatar_disable_hovercards' => array( 'description' => esc_html__( "View people's profiles when you mouse over their Gravatars", 'jetpack' ), 'type' => 'string', 'default' => 'enabled', @@ -2438,14 +2438,14 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Infinite Scroll. - 'infinite_scroll' => array( + 'infinite_scroll' => array( 'description' => esc_html__( 'To infinity and beyond', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'infinite-scroll', ), - 'infinite_scroll_google_analytics' => array( + 'infinite_scroll_google_analytics' => array( 'description' => esc_html__( 'Use Google Analytics with Infinite Scroll', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2454,7 +2454,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Likes. - 'wpl_default' => array( + 'wpl_default' => array( 'description' => esc_html__( 'WordPress.com Likes are', 'jetpack' ), 'type' => 'string', 'default' => 'on', @@ -2469,7 +2469,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_list_item', 'jp_group' => 'likes', ), - 'social_notifications_like' => array( + 'social_notifications_like' => array( 'description' => esc_html__( 'Send email notification when someone likes a post', 'jetpack' ), 'type' => 'boolean', 'default' => 1, @@ -2478,14 +2478,14 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Markdown. - 'wpcom_publish_comments_with_markdown' => array( + 'wpcom_publish_comments_with_markdown' => array( 'description' => esc_html__( 'Use Markdown for comments.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'markdown', ), - 'wpcom_publish_posts_with_markdown' => array( + 'wpcom_publish_posts_with_markdown' => array( 'description' => esc_html__( 'Use Markdown for posts.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2494,7 +2494,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Monitor. - 'monitor_receive_notifications' => array( + 'monitor_receive_notifications' => array( 'description' => esc_html__( 'Receive Monitor Email Notifications.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2503,7 +2503,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Post by Email. - 'post_by_email_address' => array( + 'post_by_email_address' => array( 'description' => esc_html__( 'Email Address', 'jetpack' ), 'type' => 'string', 'default' => 'noop', @@ -2524,14 +2524,14 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Protect. - 'jetpack_protect_key' => array( + 'jetpack_protect_key' => array( 'description' => esc_html__( 'Protect API key', 'jetpack' ), 'type' => 'string', 'default' => '', 'validate_callback' => __CLASS__ . '::validate_alphanum', 'jp_group' => 'protect', ), - 'jetpack_protect_global_whitelist' => array( + 'jetpack_protect_global_whitelist' => array( 'description' => esc_html__( 'Protect global IP allow list', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2541,7 +2541,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Sharing. - 'sharing_services' => array( + 'sharing_services' => array( 'description' => esc_html__( 'Enabled Services and those hidden behind a button', 'jetpack' ), 'type' => 'object', 'default' => array( @@ -2551,7 +2551,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_services', 'jp_group' => 'sharedaddy', ), - 'button_style' => array( + 'button_style' => array( 'description' => esc_html__( 'Button Style', 'jetpack' ), 'type' => 'string', 'default' => 'icon', @@ -2570,7 +2570,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_list_item', 'jp_group' => 'sharedaddy', ), - 'sharing_label' => array( + 'sharing_label' => array( 'description' => esc_html__( 'Sharing Label', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2578,7 +2578,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => 'esc_html', 'jp_group' => 'sharedaddy', ), - 'show' => array( + 'show' => array( 'description' => esc_html__( 'Views where buttons are shown', 'jetpack' ), 'type' => 'array', 'items' => array( @@ -2588,7 +2588,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_sharing_show', 'jp_group' => 'sharedaddy', ), - 'jetpack-twitter-cards-site-tag' => array( + 'jetpack-twitter-cards-site-tag' => array( 'description' => esc_html__( "The Twitter username of the owner of this site's domain.", 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2596,14 +2596,14 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => 'esc_html', 'jp_group' => 'sharedaddy', ), - 'sharedaddy_disable_resources' => array( + 'sharedaddy_disable_resources' => array( 'description' => esc_html__( 'Disable CSS and JS', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'sharedaddy', ), - 'custom' => array( + 'custom' => array( 'description' => esc_html__( 'Custom sharing services added by user.', 'jetpack' ), 'type' => 'object', 'default' => array( @@ -2615,7 +2615,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'sharedaddy', ), // Not an option, but an action that can be performed on the list of custom services passing the service ID. - 'sharing_delete_service' => array( + 'sharing_delete_service' => array( 'description' => esc_html__( 'Delete custom sharing service.', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2624,14 +2624,14 @@ public static function get_updateable_data_list( $selector = '' ) { ), // SSO. - 'jetpack_sso_require_two_step' => array( + 'jetpack_sso_require_two_step' => array( 'description' => esc_html__( 'Require Two-Step Authentication', 'jetpack' ), 'type' => 'boolean', 'default' => SSO\Helpers::is_require_two_step_checkbox_disabled(), 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'sso', ), - 'jetpack_sso_match_by_email' => array( + 'jetpack_sso_match_by_email' => array( 'description' => esc_html__( 'Match by Email', 'jetpack' ), 'type' => 'boolean', 'default' => 1, @@ -2640,97 +2640,104 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Subscriptions. - 'stb_enabled' => array( + 'stb_enabled' => array( 'description' => esc_html__( "Show a 'follow blog' option in the comment form", 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'stc_enabled' => array( + 'stc_enabled' => array( 'description' => esc_html__( "Show a 'follow comments' option in the comment form", 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'wpcom_newsletter_categories' => array( + 'wpcom_newsletter_categories' => array( 'description' => esc_html__( 'Array of post category ids that are marked as newsletter categories', 'jetpack' ), 'type' => 'array', 'default' => array(), 'validate_callback' => __CLASS__ . '::validate_array', 'jp_group' => 'subscriptions', ), - 'wpcom_newsletter_categories_enabled' => array( + 'wpcom_newsletter_categories_enabled' => array( 'description' => esc_html__( 'Whether the newsletter categories are enabled or not', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'wpcom_featured_image_in_email' => array( + 'wpcom_featured_image_in_email' => array( 'description' => esc_html__( 'Whether to include the featured image in the email or not', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'jetpack_gravatar_in_email' => array( + 'jetpack_gravatar_in_email' => array( 'description' => esc_html__( 'Whether to show author avatar in the email byline', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'jetpack_author_in_email' => array( + 'jetpack_author_in_email' => array( 'description' => esc_html__( 'Whether to show author display name in the email byline', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'jetpack_post_date_in_email' => array( + 'jetpack_post_date_in_email' => array( 'description' => esc_html__( 'Whether to show date in the email byline', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'wpcom_subscription_emails_use_excerpt' => array( + 'wpcom_subscription_emails_use_excerpt' => array( 'description' => esc_html__( 'Whether to use the excerpt in the email or not', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'jetpack_subscriptions_reply_to' => array( + 'jetpack_subscriptions_reply_to' => array( 'description' => esc_html__( 'Reply to email behaviour for newsletters emails', 'jetpack' ), 'type' => 'string', 'default' => Automattic\Jetpack\Modules\Subscriptions\Settings::$default_reply_to, 'validate_callback' => __CLASS__ . '::validate_subscriptions_reply_to', 'jp_group' => 'subscriptions', ), - 'jetpack_subscriptions_from_name' => array( + 'jetpack_subscriptions_from_name' => array( 'description' => esc_html__( 'From name for newsletters emails', 'jetpack' ), 'type' => 'string', 'default' => '', 'validate_callback' => __CLASS__ . '::validate_subscriptions_reply_to_name', 'jp_group' => 'subscriptions', ), - 'sm_enabled' => array( + 'sm_enabled' => array( 'description' => esc_html__( 'Show popup Subscribe modal to readers.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'jetpack_subscribe_overlay_enabled' => array( + 'jetpack_subscribe_overlay_enabled' => array( 'description' => esc_html__( 'Show subscribe overlay on homepage.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), + 'jetpack_subscribe_floating_button_enabled' => array( + 'description' => esc_html__( 'Show a floating subscribe button.', 'jetpack' ), + 'type' => 'boolean', + 'default' => 0, + 'validate_callback' => __CLASS__ . '::validate_boolean', + 'jp_group' => 'subscriptions', + ), 'jetpack_subscriptions_subscribe_post_end_enabled' => array( 'description' => esc_html__( 'Add Subscribe block at the end of each post.', 'jetpack' ), 'type' => 'boolean', @@ -2752,14 +2759,14 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'social_notifications_subscribe' => array( + 'social_notifications_subscribe' => array( 'description' => esc_html__( 'Send email notification when someone subscribes to my blog', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'subscriptions', ), - 'subscription_options' => array( + 'subscription_options' => array( 'description' => esc_html__( 'Three options used in subscription email templates: \'invitation\', \'welcome\' and \'comment_follow\'.', 'jetpack' ), 'type' => 'object', 'default' => array( @@ -2772,14 +2779,14 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Related Posts. - 'show_headline' => array( + 'show_headline' => array( 'description' => esc_html__( 'Highlight related content with a heading', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'related-posts', ), - 'show_thumbnails' => array( + 'show_thumbnails' => array( 'description' => esc_html__( 'Show a thumbnail image where available', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2788,7 +2795,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Search. - 'instant_search_enabled' => array( + 'instant_search_enabled' => array( 'description' => esc_html__( 'Enable Instant Search', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2796,7 +2803,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'search', ), - 'has_jetpack_search_product' => array( + 'has_jetpack_search_product' => array( 'description' => esc_html__( 'Has an active Jetpack Search product purchase', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2804,7 +2811,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'settings', ), - 'search_auto_config' => array( + 'search_auto_config' => array( 'description' => esc_html__( 'Trigger an auto config of instant search', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2813,35 +2820,35 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Verification Tools. - 'google' => array( + 'google' => array( 'description' => esc_html__( 'Google Search Console', 'jetpack' ), 'type' => 'string', 'default' => '', 'validate_callback' => __CLASS__ . '::validate_verification_service', 'jp_group' => 'verification-tools', ), - 'bing' => array( + 'bing' => array( 'description' => esc_html__( 'Bing Webmaster Center', 'jetpack' ), 'type' => 'string', 'default' => '', 'validate_callback' => __CLASS__ . '::validate_verification_service', 'jp_group' => 'verification-tools', ), - 'pinterest' => array( + 'pinterest' => array( 'description' => esc_html__( 'Pinterest Site Verification', 'jetpack' ), 'type' => 'string', 'default' => '', 'validate_callback' => __CLASS__ . '::validate_verification_service', 'jp_group' => 'verification-tools', ), - 'yandex' => array( + 'yandex' => array( 'description' => esc_html__( 'Yandex Site Verification', 'jetpack' ), 'type' => 'string', 'default' => '', 'validate_callback' => __CLASS__ . '::validate_verification_service', 'jp_group' => 'verification-tools', ), - 'facebook' => array( + 'facebook' => array( 'description' => esc_html__( 'Facebook Domain Verification', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2850,70 +2857,70 @@ public static function get_updateable_data_list( $selector = '' ) { ), // WordAds. - 'enable_header_ad' => array( + 'enable_header_ad' => array( 'description' => esc_html__( 'Display an ad unit at the top of each page.', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_approved' => array( + 'wordads_approved' => array( 'description' => esc_html__( 'Is site approved for WordAds?', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_second_belowpost' => array( + 'wordads_second_belowpost' => array( 'description' => esc_html__( 'Display second ad below post?', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_inline_enabled' => array( + 'wordads_inline_enabled' => array( 'description' => esc_html__( 'Display inline ad within post content?', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_display_front_page' => array( + 'wordads_display_front_page' => array( 'description' => esc_html__( 'Display ads on the front page?', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_display_post' => array( + 'wordads_display_post' => array( 'description' => esc_html__( 'Display ads on posts?', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_display_page' => array( + 'wordads_display_page' => array( 'description' => esc_html__( 'Display ads on pages?', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_display_archive' => array( + 'wordads_display_archive' => array( 'description' => esc_html__( 'Display ads on archive pages?', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_custom_adstxt_enabled' => array( + 'wordads_custom_adstxt_enabled' => array( 'description' => esc_html__( 'Custom ads.txt', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_custom_adstxt' => array( + 'wordads_custom_adstxt' => array( 'description' => esc_html__( 'Custom ads.txt entries', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2921,14 +2928,14 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => 'sanitize_textarea_field', 'jp_group' => 'wordads', ), - 'wordads_ccpa_enabled' => array( + 'wordads_ccpa_enabled' => array( 'description' => esc_html__( 'Enable support for California Consumer Privacy Act', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'wordads', ), - 'wordads_ccpa_privacy_policy_url' => array( + 'wordads_ccpa_privacy_policy_url' => array( 'description' => esc_html__( 'Privacy Policy URL', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2936,7 +2943,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => 'sanitize_text_field', 'jp_group' => 'wordads', ), - 'wordads_cmp_enabled' => array( + 'wordads_cmp_enabled' => array( 'description' => esc_html__( 'Enable GDPR Consent Management Banner for WordAds', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -2945,7 +2952,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Google Analytics. - 'google_analytics_tracking_id' => array( + 'google_analytics_tracking_id' => array( 'description' => esc_html__( 'Google Analytics', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -2954,21 +2961,21 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Stats. - 'admin_bar' => array( + 'admin_bar' => array( 'description' => esc_html__( 'Include a small chart in your admin bar with a 48-hour traffic snapshot.', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'stats', ), - 'enable_odyssey_stats' => array( + 'enable_odyssey_stats' => array( 'description' => esc_html__( 'Preview the new Jetpack Stats experience (Experimental).', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'stats', ), - 'roles' => array( + 'roles' => array( 'description' => esc_html__( 'Select the roles that will be able to view stats reports.', 'jetpack' ), 'type' => 'array', 'items' => array( @@ -2979,7 +2986,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'sanitize_callback' => __CLASS__ . '::sanitize_stats_allowed_roles', 'jp_group' => 'stats', ), - 'count_roles' => array( + 'count_roles' => array( 'description' => esc_html__( 'Count the page views of registered users who are logged in.', 'jetpack' ), 'type' => 'array', 'items' => array( @@ -2989,28 +2996,28 @@ public static function get_updateable_data_list( $selector = '' ) { 'validate_callback' => __CLASS__ . '::validate_stats_roles', 'jp_group' => 'stats', ), - 'blog_id' => array( + 'blog_id' => array( 'description' => esc_html__( 'Blog ID.', 'jetpack' ), 'type' => 'boolean', 'default' => 0, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'stats', ), - 'do_not_track' => array( + 'do_not_track' => array( 'description' => esc_html__( 'Do not track.', 'jetpack' ), 'type' => 'boolean', 'default' => 1, 'validate_callback' => __CLASS__ . '::validate_boolean', 'jp_group' => 'stats', ), - 'version' => array( + 'version' => array( 'description' => esc_html__( 'Version.', 'jetpack' ), 'type' => 'integer', 'default' => 9, 'validate_callback' => __CLASS__ . '::validate_posint', 'jp_group' => 'stats', ), - 'collapse_nudges' => array( + 'collapse_nudges' => array( 'description' => esc_html__( 'Collapse upgrade nudges', 'jetpack' ), 'type' => 'boolean', 'default' => 0, @@ -3019,7 +3026,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Whether to share stats views with WordPress.com Reader. - 'wpcom_reader_views_enabled' => array( + 'wpcom_reader_views_enabled' => array( 'description' => esc_html__( 'Show post views in the WordPress.com Reader.', 'jetpack' ), 'type' => 'boolean', 'default' => 1, @@ -3028,7 +3035,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Akismet - Not a module, but a plugin. The options can be passed and handled differently. - 'akismet_show_user_comments_approved' => array( + 'akismet_show_user_comments_approved' => array( 'description' => '', 'type' => 'boolean', 'default' => 0, @@ -3036,7 +3043,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'settings', ), - 'wordpress_api_key' => array( + 'wordpress_api_key' => array( 'description' => '', 'type' => 'string', 'default' => '', @@ -3045,7 +3052,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Empty stats card dismiss. - 'dismiss_empty_stats_card' => array( + 'dismiss_empty_stats_card' => array( 'description' => '', 'type' => 'boolean', 'default' => 0, @@ -3054,7 +3061,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Backup Getting Started card on dashboard. - 'dismiss_dash_backup_getting_started' => array( + 'dismiss_dash_backup_getting_started' => array( 'description' => '', 'type' => 'boolean', 'default' => 0, @@ -3063,7 +3070,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // Agencies Learn More card on dashboard. - 'dismiss_dash_agencies_learn_more' => array( + 'dismiss_dash_agencies_learn_more' => array( 'description' => '', 'type' => 'boolean', 'default' => 0, @@ -3071,7 +3078,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'settings', ), - 'lang_id' => array( + 'lang_id' => array( 'description' => esc_html__( 'Primary language for the site.', 'jetpack' ), 'type' => 'string', 'default' => 'en_US', @@ -3079,7 +3086,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // SEO Tools. - 'advanced_seo_front_page_description' => array( + 'advanced_seo_front_page_description' => array( 'description' => esc_html__( 'Front page meta description.', 'jetpack' ), 'type' => 'string', 'default' => '', @@ -3087,7 +3094,7 @@ public static function get_updateable_data_list( $selector = '' ) { 'jp_group' => 'seo-tools', ), - 'advanced_seo_title_formats' => array( + 'advanced_seo_title_formats' => array( 'description' => esc_html__( 'SEO page title structures.', 'jetpack' ), 'type' => 'object', 'default' => array( @@ -3103,7 +3110,7 @@ public static function get_updateable_data_list( $selector = '' ) { ), // VideoPress. - 'videopress_private_enabled_for_site' => array( + 'videopress_private_enabled_for_site' => array( 'description' => esc_html__( 'Video Privacy: Restrict views to members of this site', 'jetpack' ), 'type' => 'boolean', 'default' => 0, diff --git a/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php b/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php index d6419f99740c6..9aa7ab1f03673 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php @@ -966,6 +966,7 @@ public function update_data( $request ) { case 'stc_enabled': case 'sm_enabled': case 'jetpack_subscribe_overlay_enabled': + case 'jetpack_subscribe_floating_button_enabled': case 'wpcom_newsletter_categories_enabled': case 'wpcom_featured_image_in_email': case 'jetpack_gravatar_in_email': diff --git a/projects/plugins/jetpack/changelog/add-bluesky-to-social-previews b/projects/plugins/jetpack/changelog/add-bluesky-to-social-previews deleted file mode 100644 index d11b991e75edd..0000000000000 --- a/projects/plugins/jetpack/changelog/add-bluesky-to-social-previews +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: enhancement - -Social: Added Bluesky to social previews diff --git a/projects/plugins/jetpack/changelog/add-dependency-extraction-auto-polyfill b/projects/plugins/jetpack/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index 236a792005a69..0000000000000 --- a/projects/plugins/jetpack/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -General: Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/plugins/jetpack/changelog/add-editor-blocks-add-tracks-for-connection-banner b/projects/plugins/jetpack/changelog/add-editor-blocks-add-tracks-for-connection-banner deleted file mode 100644 index 6fd83deb14ec5..0000000000000 --- a/projects/plugins/jetpack/changelog/add-editor-blocks-add-tracks-for-connection-banner +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Add tracks to connection banner diff --git a/projects/plugins/jetpack/changelog/add-eslint-jsx-a11y-label-has-associated-control b/projects/plugins/jetpack/changelog/add-eslint-jsx-a11y-label-has-associated-control deleted file mode 100644 index e377b24a67465..0000000000000 --- a/projects/plugins/jetpack/changelog/add-eslint-jsx-a11y-label-has-associated-control +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Replace eslint:disable for `jsx-a11y/label-has-for` with `jsx-a11y/label-has-associated-control`. - - diff --git a/projects/plugins/jetpack/changelog/add-eslint-more-react-rules b/projects/plugins/jetpack/changelog/add-eslint-more-react-rules deleted file mode 100644 index a040c2353824e..0000000000000 --- a/projects/plugins/jetpack/changelog/add-eslint-more-react-rules +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Add missing deps in calls to the `useSelect` React hook. diff --git a/projects/plugins/jetpack/changelog/add-eslint-more-react-rules#2 b/projects/plugins/jetpack/changelog/add-eslint-more-react-rules#2 deleted file mode 100644 index 0da7382591d63..0000000000000 --- a/projects/plugins/jetpack/changelog/add-eslint-more-react-rules#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Use React `setState` instead of directly modifying `state`. diff --git a/projects/plugins/jetpack/changelog/add-eslint-react-jsx-key b/projects/plugins/jetpack/changelog/add-eslint-react-jsx-key deleted file mode 100644 index dfae4e2edd8c8..0000000000000 --- a/projects/plugins/jetpack/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Add `key` to various React things. Should be no change to functionality. - - diff --git a/projects/plugins/jetpack/changelog/add-eslint-wordpress-no-base-control-with-label-without-id b/projects/plugins/jetpack/changelog/add-eslint-wordpress-no-base-control-with-label-without-id deleted file mode 100644 index 146a89ee3b33a..0000000000000 --- a/projects/plugins/jetpack/changelog/add-eslint-wordpress-no-base-control-with-label-without-id +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Clean up `` without `id`. Should be no change in functionality, other than in a few cases being able to click the label to focus the field now. - - diff --git a/projects/plugins/jetpack/changelog/add-floating-subscribe-button b/projects/plugins/jetpack/changelog/add-floating-subscribe-button new file mode 100644 index 0000000000000..80566f7f8a5b2 --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-floating-subscribe-button @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Subscriptions: add a floating subscribe button diff --git a/projects/plugins/jetpack/changelog/add-jetpack-ai-logo-generator-styles-instructions b/projects/plugins/jetpack/changelog/add-jetpack-ai-logo-generator-styles-instructions new file mode 100644 index 0000000000000..9c813a1ba3abf --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-jetpack-ai-logo-generator-styles-instructions @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Jetpack AI: add instructions on to-test file diff --git a/projects/plugins/jetpack/changelog/add-jetpack-blocks-add-connection-nudge-where-missing b/projects/plugins/jetpack/changelog/add-jetpack-blocks-add-connection-nudge-where-missing deleted file mode 100644 index 35fd26f8a588e..0000000000000 --- a/projects/plugins/jetpack/changelog/add-jetpack-blocks-add-connection-nudge-where-missing +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Add connection nudge for blocks that are missing it diff --git a/projects/plugins/jetpack/changelog/add-rp-support-on-pages b/projects/plugins/jetpack/changelog/add-rp-support-on-pages deleted file mode 100644 index 563217652fa5c..0000000000000 --- a/projects/plugins/jetpack/changelog/add-rp-support-on-pages +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: compat - -Related Posts: allow Related Posts on non-post CPTs where the block is already able to be used. diff --git a/projects/plugins/jetpack/changelog/change-jetpack-ai-fetch-error-retry-optional b/projects/plugins/jetpack/changelog/change-jetpack-ai-fetch-error-retry-optional new file mode 100644 index 0000000000000..38baa75852ac8 --- /dev/null +++ b/projects/plugins/jetpack/changelog/change-jetpack-ai-fetch-error-retry-optional @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Jetpack AI: remove reload handler for logo generator modal call diff --git a/projects/plugins/jetpack/changelog/change-jetpack-ai-first-logo-notice b/projects/plugins/jetpack/changelog/change-jetpack-ai-first-logo-notice deleted file mode 100644 index 7690ffc4c0e60..0000000000000 --- a/projects/plugins/jetpack/changelog/change-jetpack-ai-first-logo-notice +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Jetpack AI: change constant value for fair usage, accept both values on type definitions diff --git a/projects/plugins/jetpack/changelog/change-jetpack-ai-logo-generator-styles-source b/projects/plugins/jetpack/changelog/change-jetpack-ai-logo-generator-styles-source deleted file mode 100644 index 35017e49b64e8..0000000000000 --- a/projects/plugins/jetpack/changelog/change-jetpack-ai-logo-generator-styles-source +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Janitorial: add siteFragment to JP initial state definition, avoid linter warnings diff --git a/projects/plugins/jetpack/changelog/fix-add-required-fields-to-stats-single-post-endpiont b/projects/plugins/jetpack/changelog/fix-add-required-fields-to-stats-single-post-endpiont deleted file mode 100644 index ecc02ea2c2490..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-add-required-fields-to-stats-single-post-endpiont +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Stats: Fix top post card on the Insight page diff --git a/projects/plugins/jetpack/changelog/fix-blogroll-block-unhelpful-error-when-user-not-connected b/projects/plugins/jetpack/changelog/fix-blogroll-block-unhelpful-error-when-user-not-connected deleted file mode 100644 index 7c5157e9f931c..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-blogroll-block-unhelpful-error-when-user-not-connected +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Show connection nudge instead of error if user is not connected on blogroll block diff --git a/projects/plugins/jetpack/changelog/fix-breve-spellcheck-ignore-single-quotes b/projects/plugins/jetpack/changelog/fix-breve-spellcheck-ignore-single-quotes deleted file mode 100644 index c2b7e480c8e3e..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-breve-spellcheck-ignore-single-quotes +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -AI Assistant: Make Breve no longer flag single quotes as spelling errors diff --git a/projects/plugins/jetpack/changelog/fix-empty-video-info-warning b/projects/plugins/jetpack/changelog/fix-empty-video-info-warning deleted file mode 100644 index cb0601cecf6eb..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-empty-video-info-warning +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Add missing check for empty video_info on get_media_item_v1_1 - - diff --git a/projects/plugins/jetpack/changelog/fix-icalendar-reader-warnings b/projects/plugins/jetpack/changelog/fix-icalendar-reader-warnings deleted file mode 100644 index 137eb927f0deb..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-icalendar-reader-warnings +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Jetpack iCalendarReader: Fix Undefined array key Warnings - - diff --git a/projects/plugins/jetpack/changelog/fix-jetpack-slideshow-block-in-iframe-editor b/projects/plugins/jetpack/changelog/fix-jetpack-slideshow-block-in-iframe-editor deleted file mode 100644 index 0a1d0c6411d34..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-jetpack-slideshow-block-in-iframe-editor +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Slideshow block: Render correctly in iframed editor. diff --git a/projects/plugins/jetpack/changelog/fix-jetpack-story-block-connection-assets b/projects/plugins/jetpack/changelog/fix-jetpack-story-block-connection-assets new file mode 100644 index 0000000000000..bbca92108485e --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-jetpack-story-block-connection-assets @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Blocks: initialize connection assets in Story block. diff --git a/projects/plugins/jetpack/changelog/fix-missing-id-args-goodreads-block b/projects/plugins/jetpack/changelog/fix-missing-id-args-goodreads-block deleted file mode 100644 index cbf50937eab07..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-missing-id-args-goodreads-block +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Fixed rendering of goodreads block when there is not id attribute so to not result in a PHP warning diff --git a/projects/plugins/jetpack/changelog/fix-newsletter-featured-image-defaults b/projects/plugins/jetpack/changelog/fix-newsletter-featured-image-defaults deleted file mode 100644 index 813c9f7307e97..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-newsletter-featured-image-defaults +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Newsletter: ensure `Enable featured image on your new post emails` setting displays the right value. diff --git a/projects/plugins/jetpack/changelog/fix-payment-blocks-connection-banner-showing-on-simple-sites b/projects/plugins/jetpack/changelog/fix-payment-blocks-connection-banner-showing-on-simple-sites deleted file mode 100644 index a63139c2eb5d3..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-payment-blocks-connection-banner-showing-on-simple-sites +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Fix issue where connection banner was showing for simple sites diff --git a/projects/plugins/jetpack/changelog/fix-photon-url-encoding b/projects/plugins/jetpack/changelog/fix-photon-url-encoding deleted file mode 100644 index de3a486e45325..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-photon-url-encoding +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: compat - -Image CDN: URL encode image path parts for RSS feed compatibility diff --git a/projects/plugins/jetpack/changelog/fix-phpcompatibility-new-dev-sniff b/projects/plugins/jetpack/changelog/fix-phpcompatibility-new-dev-sniff deleted file mode 100644 index dba5a91f114a9..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-phpcompatibility-new-dev-sniff +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Explicitly pass `$escape` for `str_getcsv` to fix new phpcompatibility-dev sniff. Note we may want to change it once we drop PHP <7.4 compat. - - diff --git a/projects/plugins/jetpack/changelog/fix-phpcompatibility-new-dev-sniff#2 b/projects/plugins/jetpack/changelog/fix-phpcompatibility-new-dev-sniff#2 deleted file mode 100644 index 92fb670058974..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-phpcompatibility-new-dev-sniff#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Replace broken `str_getcsv( $csv, "\n" )` with equally-broken `explode( "\n", $csv )` that at least doesn't pretend like it's not broken. Add a comment noting this too. - - diff --git a/projects/plugins/jetpack/changelog/fix-sharing-module-settings-non-connected-user b/projects/plugins/jetpack/changelog/fix-sharing-module-settings-non-connected-user deleted file mode 100644 index 345bf179bb3d4..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-sharing-module-settings-non-connected-user +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Sharing: ensure the sharing settings can be accessed even when a user is not connected to WordPress.com. diff --git a/projects/plugins/jetpack/changelog/fix-upload-media-endpoint-fatal b/projects/plugins/jetpack/changelog/fix-upload-media-endpoint-fatal new file mode 100644 index 0000000000000..1a93173ded991 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-upload-media-endpoint-fatal @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +WPCOM_JSON_API_Upload_Media_v1_1_Endpoint: Fix Fatals from uploads with invalid media type diff --git a/projects/plugins/jetpack/changelog/prerelease b/projects/plugins/jetpack/changelog/prerelease deleted file mode 100644 index a1c1831fa1ef7..0000000000000 --- a/projects/plugins/jetpack/changelog/prerelease +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Updated composer.lock. - - diff --git a/projects/plugins/jetpack/changelog/renovate-lock-file-maintenance b/projects/plugins/jetpack/changelog/renovate-lock-file-maintenance deleted file mode 100644 index 1eaea6a769e84..0000000000000 --- a/projects/plugins/jetpack/changelog/renovate-lock-file-maintenance +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Updated package dependencies. diff --git a/projects/plugins/jetpack/changelog/renovate-lock-file-maintenance#2 b/projects/plugins/jetpack/changelog/renovate-lock-file-maintenance#2 deleted file mode 100644 index a1c1831fa1ef7..0000000000000 --- a/projects/plugins/jetpack/changelog/renovate-lock-file-maintenance#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Updated composer.lock. - - diff --git a/projects/plugins/jetpack/changelog/renovate-npm-cookie-vulnerability b/projects/plugins/jetpack/changelog/renovate-npm-cookie-vulnerability deleted file mode 100644 index 1eaea6a769e84..0000000000000 --- a/projects/plugins/jetpack/changelog/renovate-npm-cookie-vulnerability +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Updated package dependencies. diff --git a/projects/plugins/jetpack/changelog/renovate-wordpress-monorepo b/projects/plugins/jetpack/changelog/revert-39658-update-jetpack-sync-whitelist similarity index 52% rename from projects/plugins/jetpack/changelog/renovate-wordpress-monorepo rename to projects/plugins/jetpack/changelog/revert-39658-update-jetpack-sync-whitelist index 1eaea6a769e84..760eebb59c7fe 100644 --- a/projects/plugins/jetpack/changelog/renovate-wordpress-monorepo +++ b/projects/plugins/jetpack/changelog/revert-39658-update-jetpack-sync-whitelist @@ -1,4 +1,5 @@ Significance: patch Type: other +Comment: Update unit tests + -Updated package dependencies. diff --git a/projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning b/projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning deleted file mode 100644 index f9153222863f2..0000000000000 --- a/projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: other - -JSON Endpoints: Handle null input for update post endpoint diff --git a/projects/plugins/jetpack/changelog/update-added-null-check-post-status-obj-in-sal-site-class b/projects/plugins/jetpack/changelog/update-added-null-check-post-status-obj-in-sal-site-class deleted file mode 100644 index 84cfd9c0cd835..0000000000000 --- a/projects/plugins/jetpack/changelog/update-added-null-check-post-status-obj-in-sal-site-class +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: other - -SAL_Site class: Added null check to posts_status_obj to avoid Warnings diff --git a/projects/plugins/jetpack/changelog/update-change-default-reply-to-option b/projects/plugins/jetpack/changelog/update-change-default-reply-to-option deleted file mode 100644 index 607764eb6ce78..0000000000000 --- a/projects/plugins/jetpack/changelog/update-change-default-reply-to-option +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: enhancement - -Newsletter: change default reply-to option from "no reply" to "comments" diff --git a/projects/plugins/jetpack/changelog/update-check-post-exists-under-cobntext-in-widget-visibility-module b/projects/plugins/jetpack/changelog/update-check-post-exists-under-cobntext-in-widget-visibility-module deleted file mode 100644 index 5b136b547e556..0000000000000 --- a/projects/plugins/jetpack/changelog/update-check-post-exists-under-cobntext-in-widget-visibility-module +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: other - -Widget Visibility. Added check to ensure post exists before accesing post_author diff --git a/projects/plugins/jetpack/changelog/update-floating-subscribe-button-source b/projects/plugins/jetpack/changelog/update-floating-subscribe-button-source new file mode 100644 index 0000000000000..c31ed74d6a395 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-floating-subscribe-button-source @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +Floating subscribe button: add source attribute for stats diff --git a/projects/plugins/jetpack/changelog/update-hooks-prevent-doing-it-wrong-notice b/projects/plugins/jetpack/changelog/update-hooks-prevent-doing-it-wrong-notice new file mode 100644 index 0000000000000..850d659cbcc69 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-hooks-prevent-doing-it-wrong-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Hooks: Change several action priorities to ensure translation loading is not triggered too early. diff --git a/projects/plugins/jetpack/changelog/update-infinite-scroll-added-checks-to-validate-input b/projects/plugins/jetpack/changelog/update-infinite-scroll-added-checks-to-validate-input deleted file mode 100644 index 2e67749a78c15..0000000000000 --- a/projects/plugins/jetpack/changelog/update-infinite-scroll-added-checks-to-validate-input +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: other - -Infinite-scroll: Added isset checks to validate input data diff --git a/projects/plugins/jetpack/changelog/update-jetpack-sync-delay-jetpack_plugins_updated-hook b/projects/plugins/jetpack/changelog/update-jetpack-sync-delay-jetpack_plugins_updated-hook deleted file mode 100644 index db3ef96ed5686..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-sync-delay-jetpack_plugins_updated-hook +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Jetpack plugin: Update Sync related unit tests - - diff --git a/projects/plugins/jetpack/changelog/update-jetpack-sync-whitelist b/projects/plugins/jetpack/changelog/update-jetpack-sync-whitelist deleted file mode 100644 index 632fd55a1cb3a..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-sync-whitelist +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Update Sync unit test - - diff --git a/projects/plugins/jetpack/changelog/update-narrow-down-stats-bar-hook b/projects/plugins/jetpack/changelog/update-narrow-down-stats-bar-hook new file mode 100644 index 0000000000000..1eff8c83b266e --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-narrow-down-stats-bar-hook @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Optimize the Stats Admin Bar hook by narrowing down the callback. diff --git a/projects/plugins/jetpack/changelog/update-optimize-sharing-init-hook b/projects/plugins/jetpack/changelog/update-optimize-sharing-init-hook deleted file mode 100644 index 2946b9d113be3..0000000000000 --- a/projects/plugins/jetpack/changelog/update-optimize-sharing-init-hook +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Optimize the 'admin_init' hook callback for Sharing module. diff --git a/projects/plugins/jetpack/changelog/update-social-replace-has-paid-features-check b/projects/plugins/jetpack/changelog/update-social-replace-has-paid-features-check new file mode 100644 index 0000000000000..a2339eaccb346 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-social-replace-has-paid-features-check @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Initial State: Migrated hasPaidFeatures flag with feature check on front-end + + diff --git a/projects/plugins/jetpack/changelog/update-tested-to-6-7 b/projects/plugins/jetpack/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..30b22a8d242ae --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index 4f9a306cd26b9..dda2deb3cf61a 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -867,8 +867,7 @@ function ( $methods ) { * @action plugins_loaded */ public function late_initialization() { - add_action( 'plugins_loaded', array( 'Jetpack', 'load_modules' ), 100 ); - + add_action( 'after_setup_theme', array( 'Jetpack', 'load_modules' ), 1 ); My_Jetpack_Initializer::init(); // Initialize Boost Speed Score diff --git a/projects/plugins/jetpack/composer.json b/projects/plugins/jetpack/composer.json index 8f5fe95402674..86d4e58586ca5 100644 --- a/projects/plugins/jetpack/composer.json +++ b/projects/plugins/jetpack/composer.json @@ -102,7 +102,7 @@ "platform": { "ext-intl": "0.0.0" }, - "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ14_0_a_1", + "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ14_0_a_7", "allow-plugins": { "automattic/jetpack-autoloader": true, "automattic/jetpack-composer-plugin": true diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock index 04da6c6708f77..5df2b3221306d 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -2841,7 +2841,7 @@ "dist": { "type": "path", "url": "../../packages/waf", - "reference": "79fb7681c1964694ba0200b2a70e18ed35c14bfe" + "reference": "44068e3c71aa5634458967a6191535ba25c51639" }, "require": { "automattic/jetpack-connection": "@dev", @@ -2868,7 +2868,7 @@ "link-template": "https://github.com/Automattic/jetpack-waf/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "0.21.x-dev" + "dev-trunk": "0.22.x-dev" } }, "autoload": { diff --git a/projects/plugins/jetpack/extensions/blocks/contact-info/class-jetpack-contact-info-block.php b/projects/plugins/jetpack/extensions/blocks/contact-info/class-jetpack-contact-info-block.php deleted file mode 100644 index 9c961dc8e2f2d..0000000000000 --- a/projects/plugins/jetpack/extensions/blocks/contact-info/class-jetpack-contact-info-block.php +++ /dev/null @@ -1,120 +0,0 @@ - $value ) { - if ( ! in_array( $attribute, $omit, true ) && ! empty( $value ) ) { - return true; - } - } - - return false; - } - - /** - * Adds email schema attributes. - * - * @param array $attr Array containing the email block attributes. - * @param string $content String containing the email block content. - * - * @return string - */ - public static function render_email( $attr, $content ) { - $content = self::has_attributes( $attr, array( 'className' ) ) ? - str_replace( 'href="mailto:', 'itemprop="email" href="mailto:', $content ) : - ''; - return $content; - } - - /** - * Adds phone schema attributes. Also wraps the tel link in a span so that - * it's recognized as a telephone number in Google's Structured Data. - * - * @param array $attr Array containing the phone block attributes. - * @param string $content String containing the phone block content. - * - * @return string - */ - public static function render_phone( $attr, $content ) { - if ( self::has_attributes( $attr, array( 'className' ) ) ) { - return str_replace( - array( ' $value ) { + if ( ! in_array( $attribute, $omit, true ) && ! empty( $value ) ) { + return true; + } + } + + return false; +} + +/** + * Adds email schema attributes. + * + * @param array $attr Array containing the email block attributes. + * @param string $content String containing the email block content. + * + * @return string + */ +function render_email( $attr, $content ) { + $content = has_attributes( $attr, array( 'className' ) ) ? + str_replace( 'href="mailto:', 'itemprop="email" href="mailto:', $content ) : + ''; + return $content; +} + +/** + * Adds phone schema attributes. Also wraps the tel link in a span so that + * it's recognized as a telephone number in Google's Structured Data. + * + * @param array $attr Array containing the phone block attributes. + * @param string $content String containing the phone block content. + * + * @return string + */ +function render_phone( $attr, $content ) { + if ( has_attributes( $attr, array( 'className' ) ) ) { + return str_replace( + array( ' diff --git a/projects/plugins/jetpack/extensions/blocks/map/deprecated/v1/index.js b/projects/plugins/jetpack/extensions/blocks/map/deprecated/v1/index.js index f8c69b5889fea..6db6c96f8f530 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/deprecated/v1/index.js +++ b/projects/plugins/jetpack/extensions/blocks/map/deprecated/v1/index.js @@ -40,10 +40,6 @@ const attributes = { type: 'string', default: 'red', }, - preview: { - type: 'boolean', - default: false, - }, scrollToZoom: { type: 'boolean', default: false, diff --git a/projects/plugins/jetpack/extensions/blocks/map/deprecated/v2/index.js b/projects/plugins/jetpack/extensions/blocks/map/deprecated/v2/index.js index 4f10d1c29bf2c..24863901eb331 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/deprecated/v2/index.js +++ b/projects/plugins/jetpack/extensions/blocks/map/deprecated/v2/index.js @@ -41,10 +41,6 @@ const attributes = { type: 'string', default: 'red', }, - preview: { - type: 'boolean', - default: false, - }, scrollToZoom: { type: 'boolean', default: false, diff --git a/projects/plugins/jetpack/extensions/blocks/map/edit.js b/projects/plugins/jetpack/extensions/blocks/map/edit.js index e5758c3475e1f..9d5891bb9e587 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/edit.js +++ b/projects/plugins/jetpack/extensions/blocks/map/edit.js @@ -1,6 +1,11 @@ import { getBlockIconComponent } from '@automattic/jetpack-shared-extension-utils'; import apiFetch from '@wordpress/api-fetch'; -import { BlockControls, InspectorControls, useBlockProps } from '@wordpress/block-editor'; +import { + BlockControls, + InspectorControls, + useBlockProps, + store as blockEditorStore, +} from '@wordpress/block-editor'; import { Button, ExternalLink, @@ -10,7 +15,7 @@ import { ResizableBox, } from '@wordpress/components'; import { compose } from '@wordpress/compose'; -import { withDispatch } from '@wordpress/data'; +import { withDispatch, useSelect } from '@wordpress/data'; import { useEffect, useRef, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { getActiveStyleName } from '../../shared/block-styles'; @@ -62,11 +67,18 @@ const MapEdit = ( { zoom, mapCenter, markerColor, - preview, mapHeight, showFullscreenButton, } = attributes; + const { isPreviewMode } = useSelect( select => { + const { getSettings } = select( blockEditorStore ); + const settings = getSettings(); + return { + isPreviewMode: settings.__unstableIsPreviewMode, + }; + }, [] ); + const [ addPointVisibility, setAddPointVisibility ] = useState( false ); const [ apiState, setApiState ] = useState( API_STATE_LOADING ); const [ apiKey, setApiKey ] = useState( null ); @@ -223,7 +235,7 @@ const MapEdit = ( { let content; - if ( preview ) { + if ( isPreviewMode ) { const mapStyleObject = styles.find( styleObject => styleObject.name === mapStyle ); content = ( @@ -231,6 +243,7 @@ const MapEdit = ( { { ); diff --git a/projects/plugins/jetpack/extensions/blocks/map/editor.scss b/projects/plugins/jetpack/extensions/blocks/map/editor.scss index e482a2e52bb77..91a5291613cef 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/editor.scss +++ b/projects/plugins/jetpack/extensions/blocks/map/editor.scss @@ -44,7 +44,6 @@ } .wp-block-jetpack-map__gm-container { - position: absolute; inset: 0; z-index: 0; } diff --git a/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map.json b/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map.json index ae6191ec05e32..ed5cca43347fc 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map.json +++ b/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map.json @@ -24,7 +24,6 @@ "lat": -43.391304 }, "markerColor": "red", - "preview": false, "scrollToZoom": false, "showFullscreenButton": true }, diff --git a/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-1.json b/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-1.json index 08808d0ba6d41..e549862eab94d 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-1.json +++ b/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-1.json @@ -1,34 +1,33 @@ [ - { - "clientId": "_clientId_0", - "name": "jetpack/map", - "isValid": true, - "attributes": { - "points": [ - { - "placeTitle": "Williams Street", - "title": "Williams Street", - "caption": "15 Williams Street, Kaiapoi, The Pines Beach 7630, New Zealand", - "id": "address.3454160499802812", - "coordinates": { - "longitude": 172.652908, - "latitude": -43.391304 - } - } - ], - "mapDetails": true, - "zoom": 11.765903600711997, - "mapCenter": { - "lng": 172.652908, - "lat": -43.391304 - }, - "markerColor": "red", - "preview": false, - "scrollToZoom": false, - "className": "is-style-black-and-white", - "showFullscreenButton": true - }, - "innerBlocks": [], - "originalContent": "" - } + { + "clientId": "_clientId_0", + "name": "jetpack/map", + "isValid": true, + "attributes": { + "points": [ + { + "placeTitle": "Williams Street", + "title": "Williams Street", + "caption": "15 Williams Street, Kaiapoi, The Pines Beach 7630, New Zealand", + "id": "address.3454160499802812", + "coordinates": { + "longitude": 172.652908, + "latitude": -43.391304 + } + } + ], + "mapDetails": true, + "zoom": 11.765903600711997, + "mapCenter": { + "lng": 172.652908, + "lat": -43.391304 + }, + "markerColor": "red", + "scrollToZoom": false, + "className": "is-style-black-and-white", + "showFullscreenButton": true + }, + "innerBlocks": [], + "originalContent": "" + } ] diff --git a/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-2.json b/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-2.json index c0d4e3407c852..3ce34447e041b 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-2.json +++ b/projects/plugins/jetpack/extensions/blocks/map/test/fixtures/jetpack__map__deprecated-2.json @@ -1,34 +1,33 @@ [ - { - "clientId": "_clientId_0", - "name": "jetpack/map", - "isValid": true, - "attributes": { - "points": [ - { - "placeTitle": "Williams Street", - "title": "Williams Street", - "caption": "15 Williams Street, Kaiapoi, The Pines Beach 7630, New Zealand", - "id": "address.3454160499802812", - "coordinates": { - "longitude": 172.652908, - "latitude": -43.391304 - } - } - ], - "mapDetails": true, - "zoom": 11.765903600711997, - "mapCenter": { - "lng": 172.652908, - "lat": -43.391304 - }, - "markerColor": "red", - "preview": false, - "scrollToZoom": false, - "showFullscreenButton": true, - "className": "is-style-black-and-white" - }, - "innerBlocks": [], - "originalContent": "" - } + { + "clientId": "_clientId_0", + "name": "jetpack/map", + "isValid": true, + "attributes": { + "points": [ + { + "placeTitle": "Williams Street", + "title": "Williams Street", + "caption": "15 Williams Street, Kaiapoi, The Pines Beach 7630, New Zealand", + "id": "address.3454160499802812", + "coordinates": { + "longitude": 172.652908, + "latitude": -43.391304 + } + } + ], + "mapDetails": true, + "zoom": 11.765903600711997, + "mapCenter": { + "lng": 172.652908, + "lat": -43.391304 + }, + "markerColor": "red", + "scrollToZoom": false, + "showFullscreenButton": true, + "className": "is-style-black-and-white" + }, + "innerBlocks": [], + "originalContent": "" + } ] diff --git a/projects/plugins/jetpack/extensions/blocks/slideshow/slideshow.js b/projects/plugins/jetpack/extensions/blocks/slideshow/slideshow.js index 0b231d325fc8c..b3f8575b0f5a8 100644 --- a/projects/plugins/jetpack/extensions/blocks/slideshow/slideshow.js +++ b/projects/plugins/jetpack/extensions/blocks/slideshow/slideshow.js @@ -136,14 +136,14 @@ class Slideshow extends Component { ref={ this.slideshowRef } >
    - { images.map( ( { alt, caption, id, url } ) => ( + { images.map( ( { alt, caption, id, url }, index ) => (
  • { +export const ProgressBullet = ( { + bulletIndex, + playerId, + index, + disabled, + isSelected, + onClick, +} ) => { const progress = useSelect( select => select( 'jetpack/story/player' ).getCurrentSlideProgressPercentage( playerId ), [ playerId ] @@ -10,7 +17,7 @@ export const ProgressBullet = ( { key, playerId, index, disabled, isSelected, on return ( { return isPost; }; -// Registers slot/fill panels defined via settings.render and command palette commands +const useNewsletterPreview = () => { + const [ isPreviewModalOpen, setIsPreviewModalOpen ] = useState( false ); + const postId = select( 'core/editor' ).getCurrentPostId(); + const { tracks } = useAnalytics(); + + const openPreviewModal = useCallback( + source => { + setIsPreviewModalOpen( true ); + tracks.recordEvent( 'jetpack_newsletter_preview_opened', { source } ); + }, + [ tracks ] + ); + + const closePreviewModal = useCallback( () => { + setIsPreviewModalOpen( false ); + }, [] ); + + return { isPreviewModalOpen, openPreviewModal, closePreviewModal, postId }; +}; + +const NewsletterEditor = () => { + const { isPreviewModalOpen, openPreviewModal, closePreviewModal, postId } = + useNewsletterPreview(); + + return ( + <> + + { shouldShowNewsletterMenu() && ( + <> + { PluginPreviewMenuItem ? ( + openPreviewModal( 'preview_menu' ) } + icon={ send } + > + { __( 'Email preview', 'jetpack' ) } + + ) : null } + + openPreviewModal( 'newsletter_menu' ) } /> + + ) } + + + ); +}; + registerJetpackPlugin( blockName, { - render: () => { - return ( - <> - - { shouldShowNewsletterMenu() && } - - - ); - }, + render: () => , icon: shouldShowNewsletterMenu() ? atSymbol : undefined, } ); diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/menu.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/menu.js index 1a59b55f49177..0258842d68005 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/menu.js +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/menu.js @@ -9,11 +9,10 @@ import { META_NAME_FOR_POST_DONT_EMAIL_TO_SUBS } from '../../shared/memberships/ import { useAccessLevel } from '../../shared/memberships/edit'; import { NewsletterEmailDocumentSettings } from '../../shared/memberships/settings'; import SubscribersAffirmation from '../../shared/memberships/subscribers-affirmation'; -import { NewsletterPreviewModal, NewsletterTestEmailModal } from './email-preview'; +import { NewsletterTestEmailModal } from './email-preview'; import { SendIcon } from './icons'; -const NewsletterMenu = () => { - const [ isPreviewModalOpen, setIsPreviewModalOpen ] = useState( false ); +const NewsletterMenu = ( { openPreviewModal } ) => { const [ isTestEmailModalOpen, setIsTestEmailModalOpen ] = useState( false ); const { postId, postType, postStatus, meta } = useSelect( @@ -34,8 +33,6 @@ const NewsletterMenu = () => { const connectUrl = `${ window?.Jetpack_Editor_Initial_State?.adminUrl }admin.php?page=my-jetpack#/connection`; const shouldPromptForConnection = ! isSimpleSite() && ! isUserConnected; - const openPreviewModal = () => setIsPreviewModalOpen( true ); - const closePreviewModal = () => setIsPreviewModalOpen( false ); const openTestEmailModal = () => setIsTestEmailModalOpen( true ); const closeTestEmailModal = () => setIsTestEmailModalOpen( false ); @@ -74,11 +71,6 @@ const NewsletterMenu = () => { { __( 'Send test email', 'jetpack' ) } - { } ); describe( 'Inspector controls', () => { + beforeEach( () => { + window.JetpackScriptData = { + social: { + urls: {}, + }, + }; + } ); describe( 'Gradient settings panel', () => { test( 'displays gradient settings control panel', () => { render( ); diff --git a/projects/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php b/projects/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php index 95b32b92a19a2..1670a7760a1c0 100644 --- a/projects/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php +++ b/projects/plugins/jetpack/extensions/blocks/tiled-gallery/tiled-gallery.php @@ -180,4 +180,4 @@ private static function is_squareish_layout( $attr ) { } } -Tiled_Gallery::register(); +add_action( 'init', array( Tiled_Gallery::class, 'register' ) ); diff --git a/projects/plugins/jetpack/extensions/extended-blocks/core-site-logo/index.tsx b/projects/plugins/jetpack/extensions/extended-blocks/core-site-logo/index.tsx index 233e96aad4a65..6d34c34b5c0ac 100644 --- a/projects/plugins/jetpack/extensions/extended-blocks/core-site-logo/index.tsx +++ b/projects/plugins/jetpack/extensions/extended-blocks/core-site-logo/index.tsx @@ -102,10 +102,10 @@ const siteLogoEditWithAiComponents = createHigherOrderComponent( BlockEdit => { setIsLogoGeneratorModalVisible( false ); }, [] ); - const reloadModal = useCallback( () => { - closeModal(); - showModal(); - }, [ closeModal, showModal ] ); + // const reloadModal = useCallback( () => { + // closeModal(); + // showModal(); + // }, [ closeModal, showModal ] ); const applyLogoHandler = useCallback( ( mediaId: number ) => { @@ -135,7 +135,8 @@ const siteLogoEditWithAiComponents = createHigherOrderComponent( BlockEdit => { isOpen={ isLogoGeneratorModalVisible } onClose={ closeModal } onApplyLogo={ applyLogoHandler } - onReload={ reloadModal } + // reload is not working right and can end up showing a non functional modal + // onReload={ reloadModal } context={ PLACEMENT_CONTEXT } placement={ TOOL_PLACEMENT } siteDetails={ siteDetails } diff --git a/projects/plugins/jetpack/jetpack.php b/projects/plugins/jetpack/jetpack.php index 9c27fbbd94c38..2331d6424dfeb 100644 --- a/projects/plugins/jetpack/jetpack.php +++ b/projects/plugins/jetpack/jetpack.php @@ -4,7 +4,7 @@ * Plugin URI: https://jetpack.com * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. * Author: Automattic - * Version: 14.0-a.1 + * Version: 14.0-a.7 * Author URI: https://jetpack.com * License: GPL2+ * Text Domain: jetpack @@ -34,7 +34,7 @@ define( 'JETPACK__MINIMUM_WP_VERSION', '6.5' ); define( 'JETPACK__MINIMUM_PHP_VERSION', '7.0' ); -define( 'JETPACK__VERSION', '14.0-a.1' ); +define( 'JETPACK__VERSION', '14.0-a.7' ); /** * Constant used to fetch the connection owner token @@ -116,13 +116,11 @@ * @since 7.2.0 */ function jetpack_admin_unsupported_wp_notice() { - wp_admin_notice( - esc_html__( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ), - array( - 'type' => 'error', - 'dismissible' => true, - ) - ); + ?> +
    +

    +
    + array( - 'migration_source_site_domain' => '(string) The source site URL, from the migration flow', - 'in_site_migration_flow' => '(string) The migration flow the site is in', - 'blogname' => '(string) Blog name', - 'blogdescription' => '(string) Blog description', - 'default_pingback_flag' => '(bool) Notify blogs linked from article?', - 'default_ping_status' => '(bool) Allow link notifications from other blogs?', - 'default_comment_status' => '(bool) Allow comments on new articles?', - 'blog_public' => '(string) Site visibility; -1: private, 0: discourage search engines, 1: allow search engines', - 'wpcom_data_sharing_opt_out' => '(bool) Did the site opt out of sharing public content with third parties and research partners?', - 'jetpack_sync_non_public_post_stati' => '(bool) allow sync of post and pages with non-public posts stati', - 'jetpack_relatedposts_enabled' => '(bool) Enable related posts?', - 'jetpack_relatedposts_show_context' => '(bool) Show post\'s tags and category in related posts?', - 'jetpack_relatedposts_show_date' => '(bool) Show date in related posts?', - 'jetpack_relatedposts_show_headline' => '(bool) Show headline in related posts?', - 'jetpack_relatedposts_show_thumbnails' => '(bool) Show thumbnails in related posts?', - 'jetpack_protect_whitelist' => '(array) List of IP addresses to always allow', - 'instant_search_enabled' => '(bool) Enable the new Jetpack Instant Search interface', - 'jetpack_search_enabled' => '(bool) Enable Jetpack Search', - 'jetpack_search_supported' => '(bool) Jetpack Search is supported', - 'infinite_scroll' => '(bool) Support infinite scroll of posts?', - 'default_category' => '(int) Default post category', - 'default_post_format' => '(string) Default post format', - 'require_name_email' => '(bool) Require comment authors to fill out name and email?', - 'comment_registration' => '(bool) Require users to be registered and logged in to comment?', - 'close_comments_for_old_posts' => '(bool) Automatically close comments on old posts?', - 'close_comments_days_old' => '(int) Age at which to close comments', - 'thread_comments' => '(bool) Enable threaded comments?', - 'thread_comments_depth' => '(int) Depth to thread comments', - 'page_comments' => '(bool) Break comments into pages?', - 'comments_per_page' => '(int) Number of comments to display per page', - 'default_comments_page' => '(string) newest|oldest Which page of comments to display first', - 'comment_order' => '(string) asc|desc Order to display comments within page', - 'comments_notify' => '(bool) Email me when someone comments?', - 'moderation_notify' => '(bool) Email me when a comment is helf for moderation?', - 'social_notifications_like' => '(bool) Email me when someone likes my post?', - 'social_notifications_reblog' => '(bool) Email me when someone reblogs my post?', - 'social_notifications_subscribe' => '(bool) Email me when someone subscribes to my blog?', - 'comment_moderation' => '(bool) Moderate comments for manual approval?', - 'comment_previously_approved' => '(bool) Moderate comments unless author has a previously-approved comment?', - 'comment_max_links' => '(int) Moderate comments that contain X or more links', - 'moderation_keys' => '(string) Words or phrases that trigger comment moderation, one per line', - 'disallowed_keys' => '(string) Words or phrases that mark comment spam, one per line', - 'lang_id' => '(int) ID for language blog is written in', - 'wga' => '(array) Google Analytics Settings', - 'disabled_likes' => '(bool) Are likes globally disabled (they can still be turned on per post)?', - 'disabled_reblogs' => '(bool) Are reblogs disabled on posts?', - 'jetpack_comment_likes_enabled' => '(bool) Are comment likes enabled for all comments?', - 'sharing_button_style' => '(string) Style to use for sharing buttons (icon-text, icon, text, or official)', - 'sharing_label' => '(string) Label to use for sharing buttons, e.g. "Share this:"', - 'sharing_show' => '(string|array:string) Post type or array of types where sharing buttons are to be displayed', - 'sharing_open_links' => '(string) Link target for sharing buttons (same or new)', - 'twitter_via' => '(string) Twitter username to include in tweets when people share using the Twitter button', - 'jetpack-twitter-cards-site-tag' => '(string) The Twitter username of the owner of the site\'s domain.', - 'eventbrite_api_token' => '(int) The Keyring token ID for an Eventbrite token to associate with the site', - 'timezone_string' => '(string) PHP-compatible timezone string like \'UTC-5\'', - 'gmt_offset' => '(int) Site offset from UTC in hours', - 'date_format' => '(string) PHP Date-compatible date format', - 'time_format' => '(string) PHP Date-compatible time format', - 'start_of_week' => '(int) Starting day of week (0 = Sunday, 6 = Saturday)', - 'jetpack_testimonial' => '(bool) Whether testimonial custom post type is enabled for the site', - 'jetpack_testimonial_posts_per_page' => '(int) Number of testimonials to show per page', - 'jetpack_portfolio' => '(bool) Whether portfolio custom post type is enabled for the site', - 'jetpack_portfolio_posts_per_page' => '(int) Number of portfolio projects to show per page', - Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION => '(string) The seo meta description for the site.', - Jetpack_SEO_Titles::TITLE_FORMATS_OPTION => '(array) SEO meta title formats. Allowed keys: front_page, posts, pages, groups, archives', - 'verification_services_codes' => '(array) Website verification codes. Allowed keys: google, pinterest, bing, yandex, facebook', - 'markdown_supported' => '(bool) Whether markdown is supported for this site', - 'wpcom_publish_posts_with_markdown' => '(bool) Whether markdown is enabled for posts', - 'wpcom_publish_comments_with_markdown' => '(bool) Whether markdown is enabled for comments', - 'site_icon' => '(int) Media attachment ID to use as site icon. Set to zero or an otherwise empty value to clear', - 'api_cache' => '(bool) Turn on/off the Jetpack JSON API cache', - 'posts_per_page' => '(int) Number of posts to show on blog pages', - 'posts_per_rss' => '(int) Number of posts to show in the RSS feed', - 'rss_use_excerpt' => '(bool) Whether the RSS feed will use post excerpts', - 'launchpad_screen' => '(string) Whether or not launchpad is presented and what size it will be', - 'sm_enabled' => '(bool) Whether the newsletter subscribe modal is enabled', - 'jetpack_subscribe_overlay_enabled' => '(bool) Whether the newsletter subscribe overlay is enabled', + 'migration_source_site_domain' => '(string) The source site URL, from the migration flow', + 'in_site_migration_flow' => '(string) The migration flow the site is in', + 'blogname' => '(string) Blog name', + 'blogdescription' => '(string) Blog description', + 'default_pingback_flag' => '(bool) Notify blogs linked from article?', + 'default_ping_status' => '(bool) Allow link notifications from other blogs?', + 'default_comment_status' => '(bool) Allow comments on new articles?', + 'blog_public' => '(string) Site visibility; -1: private, 0: discourage search engines, 1: allow search engines', + 'wpcom_data_sharing_opt_out' => '(bool) Did the site opt out of sharing public content with third parties and research partners?', + 'jetpack_sync_non_public_post_stati' => '(bool) allow sync of post and pages with non-public posts stati', + 'jetpack_relatedposts_enabled' => '(bool) Enable related posts?', + 'jetpack_relatedposts_show_context' => '(bool) Show post\'s tags and category in related posts?', + 'jetpack_relatedposts_show_date' => '(bool) Show date in related posts?', + 'jetpack_relatedposts_show_headline' => '(bool) Show headline in related posts?', + 'jetpack_relatedposts_show_thumbnails' => '(bool) Show thumbnails in related posts?', + 'jetpack_protect_whitelist' => '(array) List of IP addresses to always allow', + 'instant_search_enabled' => '(bool) Enable the new Jetpack Instant Search interface', + 'jetpack_search_enabled' => '(bool) Enable Jetpack Search', + 'jetpack_search_supported' => '(bool) Jetpack Search is supported', + 'infinite_scroll' => '(bool) Support infinite scroll of posts?', + 'default_category' => '(int) Default post category', + 'default_post_format' => '(string) Default post format', + 'require_name_email' => '(bool) Require comment authors to fill out name and email?', + 'comment_registration' => '(bool) Require users to be registered and logged in to comment?', + 'close_comments_for_old_posts' => '(bool) Automatically close comments on old posts?', + 'close_comments_days_old' => '(int) Age at which to close comments', + 'thread_comments' => '(bool) Enable threaded comments?', + 'thread_comments_depth' => '(int) Depth to thread comments', + 'page_comments' => '(bool) Break comments into pages?', + 'comments_per_page' => '(int) Number of comments to display per page', + 'default_comments_page' => '(string) newest|oldest Which page of comments to display first', + 'comment_order' => '(string) asc|desc Order to display comments within page', + 'comments_notify' => '(bool) Email me when someone comments?', + 'moderation_notify' => '(bool) Email me when a comment is helf for moderation?', + 'social_notifications_like' => '(bool) Email me when someone likes my post?', + 'social_notifications_reblog' => '(bool) Email me when someone reblogs my post?', + 'social_notifications_subscribe' => '(bool) Email me when someone subscribes to my blog?', + 'comment_moderation' => '(bool) Moderate comments for manual approval?', + 'comment_previously_approved' => '(bool) Moderate comments unless author has a previously-approved comment?', + 'comment_max_links' => '(int) Moderate comments that contain X or more links', + 'moderation_keys' => '(string) Words or phrases that trigger comment moderation, one per line', + 'disallowed_keys' => '(string) Words or phrases that mark comment spam, one per line', + 'lang_id' => '(int) ID for language blog is written in', + 'wga' => '(array) Google Analytics Settings', + 'disabled_likes' => '(bool) Are likes globally disabled (they can still be turned on per post)?', + 'disabled_reblogs' => '(bool) Are reblogs disabled on posts?', + 'jetpack_comment_likes_enabled' => '(bool) Are comment likes enabled for all comments?', + 'sharing_button_style' => '(string) Style to use for sharing buttons (icon-text, icon, text, or official)', + 'sharing_label' => '(string) Label to use for sharing buttons, e.g. "Share this:"', + 'sharing_show' => '(string|array:string) Post type or array of types where sharing buttons are to be displayed', + 'sharing_open_links' => '(string) Link target for sharing buttons (same or new)', + 'twitter_via' => '(string) Twitter username to include in tweets when people share using the Twitter button', + 'jetpack-twitter-cards-site-tag' => '(string) The Twitter username of the owner of the site\'s domain.', + 'eventbrite_api_token' => '(int) The Keyring token ID for an Eventbrite token to associate with the site', + 'timezone_string' => '(string) PHP-compatible timezone string like \'UTC-5\'', + 'gmt_offset' => '(int) Site offset from UTC in hours', + 'date_format' => '(string) PHP Date-compatible date format', + 'time_format' => '(string) PHP Date-compatible time format', + 'start_of_week' => '(int) Starting day of week (0 = Sunday, 6 = Saturday)', + 'jetpack_testimonial' => '(bool) Whether testimonial custom post type is enabled for the site', + 'jetpack_testimonial_posts_per_page' => '(int) Number of testimonials to show per page', + 'jetpack_portfolio' => '(bool) Whether portfolio custom post type is enabled for the site', + 'jetpack_portfolio_posts_per_page' => '(int) Number of portfolio projects to show per page', + Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION => '(string) The seo meta description for the site.', + Jetpack_SEO_Titles::TITLE_FORMATS_OPTION => '(array) SEO meta title formats. Allowed keys: front_page, posts, pages, groups, archives', + 'verification_services_codes' => '(array) Website verification codes. Allowed keys: google, pinterest, bing, yandex, facebook', + 'markdown_supported' => '(bool) Whether markdown is supported for this site', + 'wpcom_publish_posts_with_markdown' => '(bool) Whether markdown is enabled for posts', + 'wpcom_publish_comments_with_markdown' => '(bool) Whether markdown is enabled for comments', + 'site_icon' => '(int) Media attachment ID to use as site icon. Set to zero or an otherwise empty value to clear', + 'api_cache' => '(bool) Turn on/off the Jetpack JSON API cache', + 'posts_per_page' => '(int) Number of posts to show on blog pages', + 'posts_per_rss' => '(int) Number of posts to show in the RSS feed', + 'rss_use_excerpt' => '(bool) Whether the RSS feed will use post excerpts', + 'launchpad_screen' => '(string) Whether or not launchpad is presented and what size it will be', + 'sm_enabled' => '(bool) Whether the newsletter subscribe modal is enabled', + 'jetpack_subscribe_overlay_enabled' => '(bool) Whether the newsletter subscribe overlay is enabled', + 'jetpack_subscribe_floating_button_enabled' => '(bool) Whether the newsletter floating subscribe button is enabled', 'jetpack_subscriptions_subscribe_post_end_enabled' => '(bool) Whether the Subscribe block at the end of each post placement is enabled', 'jetpack_subscriptions_login_navigation_enabled' => '(bool) Whether the Subscriber Login block navigation placement is enabled', 'jetpack_subscriptions_subscribe_navigation_enabled' => '(Bool) Whether the Subscribe block navigation placement is enabled', - 'wpcom_ai_site_prompt' => '(string) User input in the AI site prompt', - 'jetpack_waf_automatic_rules' => '(bool) Whether the WAF should enforce automatic firewall rules', - 'jetpack_waf_ip_allow_list' => '(string) List of IP addresses to always allow', - 'jetpack_waf_ip_allow_list_enabled' => '(bool) Whether the IP allow list is enabled', - 'jetpack_waf_ip_block_list' => '(string) List of IP addresses the WAF should always block', - 'jetpack_waf_ip_block_list_enabled' => '(bool) Whether the IP block list is enabled', - 'jetpack_waf_share_data' => '(bool) Whether the WAF should share basic data with Jetpack', - 'jetpack_waf_share_debug_data' => '(bool) Whether the WAF should share debug data with Jetpack', + 'wpcom_ai_site_prompt' => '(string) User input in the AI site prompt', + 'jetpack_waf_automatic_rules' => '(bool) Whether the WAF should enforce automatic firewall rules', + 'jetpack_waf_ip_allow_list' => '(string) List of IP addresses to always allow', + 'jetpack_waf_ip_allow_list_enabled' => '(bool) Whether the IP allow list is enabled', + 'jetpack_waf_ip_block_list' => '(string) List of IP addresses the WAF should always block', + 'jetpack_waf_ip_block_list_enabled' => '(bool) Whether the IP block list is enabled', + 'jetpack_waf_share_data' => '(bool) Whether the WAF should share basic data with Jetpack', + 'jetpack_waf_share_debug_data' => '(bool) Whether the WAF should share debug data with Jetpack', 'jetpack_waf_automatic_rules_last_updated_timestamp' => '(int) Timestamp of the last time the automatic rules were updated', ), @@ -469,12 +470,13 @@ function ( $newsletter_category ) { 'wpcom_newsletter_categories_enabled' => (bool) get_option( 'wpcom_newsletter_categories_enabled' ), 'sm_enabled' => (bool) get_option( 'sm_enabled' ), 'jetpack_subscribe_overlay_enabled' => (bool) get_option( 'jetpack_subscribe_overlay_enabled' ), + 'jetpack_subscribe_floating_button_enabled' => (bool) get_option( 'jetpack_subscribe_floating_button_enabled' ), 'jetpack_subscriptions_subscribe_post_end_enabled' => (bool) get_option( 'jetpack_subscriptions_subscribe_post_end_enabled' ), 'jetpack_subscriptions_login_navigation_enabled' => (bool) get_option( 'jetpack_subscriptions_login_navigation_enabled' ), 'jetpack_subscriptions_subscribe_navigation_enabled' => (bool) get_option( 'jetpack_subscriptions_subscribe_navigation_enabled' ), 'wpcom_gifting_subscription' => (bool) get_option( 'wpcom_gifting_subscription', $this->get_wpcom_gifting_subscription_default() ), 'wpcom_reader_views_enabled' => (bool) get_option( 'wpcom_reader_views_enabled', true ), - 'wpcom_subscription_emails_use_excerpt' => $this->get_wpcom_subscription_emails_use_excerpt_option(), + 'wpcom_subscription_emails_use_excerpt' => (bool) get_option( 'wpcom_subscription_emails_use_excerpt' ), 'jetpack_subscriptions_reply_to' => (string) $this->get_subscriptions_reply_to_option(), 'jetpack_subscriptions_from_name' => (string) get_option( 'jetpack_subscriptions_from_name' ), 'show_on_front' => (string) get_option( 'show_on_front' ), @@ -1092,6 +1094,11 @@ function ( $category_id ) { $updated[ $key ] = (int) (bool) $value; break; + case 'jetpack_subscribe_floating_button_enabled': + update_option( 'jetpack_subscribe_floating_button_enabled', (int) (bool) $value ); + $updated[ $key ] = (int) (bool) $value; + break; + case 'jetpack_subscriptions_subscribe_post_end_enabled': update_option( 'jetpack_subscriptions_subscribe_post_end_enabled', (int) (bool) $value ); $updated[ $key ] = (int) (bool) $value; @@ -1275,23 +1282,6 @@ function ( $category_id ) { ); } - /** - * Get the value of the wpcom_subscription_emails_use_excerpt option. - * When the option is not set, it will return the value of the rss_use_excerpt option. - * - * @return bool - */ - protected function get_wpcom_subscription_emails_use_excerpt_option() { - $wpcom_subscription_emails_use_excerpt = get_option( 'wpcom_subscription_emails_use_excerpt', null ); - - if ( $wpcom_subscription_emails_use_excerpt === null ) { - $rss_use_excerpt = get_option( 'rss_use_excerpt', null ); - $wpcom_subscription_emails_use_excerpt = $rss_use_excerpt === null ? false : $rss_use_excerpt; - } - - return (bool) $wpcom_subscription_emails_use_excerpt; - } - /** * Get the string value of the jetpack_subscriptions_reply_to option. * When the option is not set, it will retun 'no-reply'. diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php index 9c6d1cdd4506b..bb0da75ecd15c 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php @@ -35,117 +35,118 @@ ), 'request_format' => array( - 'migration_source_site_domain' => '(string) The source site URL, from the migration flow', - 'in_site_migration_flow' => '(string) Whether the site is currently in the Site Migration signup flow.', - 'blogname' => '(string) Blog name', - 'blogdescription' => '(string) Blog description', - 'default_pingback_flag' => '(bool) Notify blogs linked from article?', - 'default_ping_status' => '(bool) Allow link notifications from other blogs?', - 'default_comment_status' => '(bool) Allow comments on new articles?', - 'blog_public' => '(string) Site visibility; -1: private, 0: discourage search engines, 1: allow search engines', - 'wpcom_data_sharing_opt_out' => '(bool) Did the site opt out of public content sharing with third parties and research partners?', - 'jetpack_sync_non_public_post_stati' => '(bool) allow sync of post and pages with non-public posts stati', - 'jetpack_relatedposts_enabled' => '(bool) Enable related posts?', - 'jetpack_relatedposts_show_context' => '(bool) Show post\'s tags and category in related posts?', - 'jetpack_relatedposts_show_date' => '(bool) Show date in related posts?', - 'jetpack_relatedposts_show_headline' => '(bool) Show headline in related posts?', - 'jetpack_relatedposts_show_thumbnails' => '(bool) Show thumbnails in related posts?', - 'instant_search_enabled' => '(bool) Enable the new Jetpack Instant Search interface', - 'jetpack_search_enabled' => '(bool) Enable Jetpack Search', - 'jetpack_search_supported' => '(bool) Jetpack Search supported', - 'jetpack_protect_whitelist' => '(array) List of IP addresses to always allow', - 'infinite_scroll' => '(bool) Support infinite scroll of posts?', - 'default_category' => '(int) Default post category', - 'default_post_format' => '(string) Default post format', - 'require_name_email' => '(bool) Require comment authors to fill out name and email?', - 'comment_registration' => '(bool) Require users to be registered and logged in to comment?', - 'close_comments_for_old_posts' => '(bool) Automatically close comments on old posts?', - 'close_comments_days_old' => '(int) Age at which to close comments', - 'thread_comments' => '(bool) Enable threaded comments?', - 'thread_comments_depth' => '(int) Depth to thread comments', - 'page_comments' => '(bool) Break comments into pages?', - 'comments_per_page' => '(int) Number of comments to display per page', - 'default_comments_page' => '(string) newest|oldest Which page of comments to display first', - 'comment_order' => '(string) asc|desc Order to display comments within page', - 'comments_notify' => '(bool) Email me when someone comments?', - 'moderation_notify' => '(bool) Email me when a comment is helf for moderation?', - 'social_notifications_like' => '(bool) Email me when someone likes my post?', - 'social_notifications_reblog' => '(bool) Email me when someone reblogs my post?', - 'social_notifications_subscribe' => '(bool) Email me when someone subscribes to my blog?', - 'comment_moderation' => '(bool) Moderate comments for manual approval?', - 'comment_previously_approved' => '(bool) Moderate comments unless author has a previously-approved comment?', - 'comment_max_links' => '(int) Moderate comments that contain X or more links', - 'moderation_keys' => '(string) Words or phrases that trigger comment moderation, one per line', - 'disallowed_keys' => '(string) Words or phrases that mark comment spam, one per line', - 'lang_id' => '(int) ID for language blog is written in', - 'locale' => '(string) locale code for language blog is written in', - 'site_vertical_id' => '(string) The site vertical ID', - 'wga' => '(array) Google Analytics Settings', - 'jetpack_cloudflare_analytics' => '(array) Cloudflare Analytics Settings', - 'disabled_likes' => '(bool) Are likes globally disabled (they can still be turned on per post)?', - 'disabled_reblogs' => '(bool) Are reblogs disabled on posts?', - 'jetpack_comment_likes_enabled' => '(bool) Are comment likes enabled for all comments?', - 'sharing_button_style' => '(string) Style to use for sharing buttons (icon-text, icon, text, or official)', - 'sharing_label' => '(string) Label to use for sharing buttons, e.g. "Share this:"', - 'sharing_show' => '(string|array:string) Post type or array of types where sharing buttons are to be displayed', - 'sharing_open_links' => '(string) Link target for sharing buttons (same or new)', - 'twitter_via' => '(string) Twitter username to include in tweets when people share using the Twitter button', - 'jetpack-twitter-cards-site-tag' => '(string) The Twitter username of the owner of the site\'s domain.', - 'eventbrite_api_token' => '(int) The Keyring token ID for an Eventbrite token to associate with the site', - 'timezone_string' => '(string) PHP-compatible timezone string like \'UTC-5\'', - 'gmt_offset' => '(int) Site offset from UTC in hours', - 'date_format' => '(string) PHP Date-compatible date format', - 'time_format' => '(string) PHP Date-compatible time format', - 'start_of_week' => '(int) Starting day of week (0 = Sunday, 6 = Saturday)', - 'woocommerce_onboarding_profile' => '(array) woocommerce_onboarding_profile', - 'woocommerce_store_address' => '(string) woocommerce_store_address option', - 'woocommerce_store_address_2' => '(string) woocommerce_store_address_2 option', - 'woocommerce_store_city' => '(string) woocommerce_store_city option', - 'woocommerce_default_country' => '(string) woocommerce_default_country option', - 'woocommerce_store_postcode' => '(string) woocommerce_store_postcode option', - 'jetpack_testimonial' => '(bool) Whether testimonial custom post type is enabled for the site', - 'jetpack_testimonial_posts_per_page' => '(int) Number of testimonials to show per page', - 'jetpack_portfolio' => '(bool) Whether portfolio custom post type is enabled for the site', - 'jetpack_portfolio_posts_per_page' => '(int) Number of portfolio projects to show per page', - Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION => '(string) The SEO meta description for the site.', - Jetpack_SEO_Titles::TITLE_FORMATS_OPTION => '(array) SEO meta title formats. Allowed keys: front_page, posts, pages, groups, archives', - 'verification_services_codes' => '(array) Website verification codes. Allowed keys: google, pinterest, bing, yandex, facebook', - 'podcasting_archive' => '(string) The post category, if any, used for publishing podcasts', - 'site_icon' => '(int) Media attachment ID to use as site icon. Set to zero or an otherwise empty value to clear', - 'api_cache' => '(bool) Turn on/off the Jetpack JSON API cache', - 'posts_per_page' => '(int) Number of posts to show on blog pages', - 'posts_per_rss' => '(int) Number of posts to show in the RSS feed', - 'rss_use_excerpt' => '(bool) Whether the RSS feed will use post excerpts', - 'wpcom_publish_posts_with_markdown' => '(bool) Whether markdown is enabled for posts', - 'wpcom_publish_comments_with_markdown' => '(bool) Whether markdown is enabled for comments', - 'launchpad_screen' => '(string) Whether or not launchpad is presented and what size it will be', - 'wpcom_featured_image_in_email' => '(bool) Whether the Featured image is displayed in the New Post email template or not', - 'jetpack_gravatar_in_email' => '(bool) Whether to show author avatar in the email byline', - 'jetpack_author_in_email' => '(bool) Whether to show author display name in the email byline', - 'jetpack_post_date_in_email' => '(bool) Whether to show date in the email byline', - 'wpcom_newsletter_categories' => '(array) Array of post category ids that are marked as newsletter categories', - 'wpcom_newsletter_categories_enabled' => '(bool) Whether the newsletter categories are enabled or not', - 'sm_enabled' => '(bool) Whether the newsletter Subscribe Modal is enabled or not', - 'jetpack_subscribe_overlay_enabled' => '(bool) Whether the newsletter Subscribe Overlay is enabled or not', + 'migration_source_site_domain' => '(string) The source site URL, from the migration flow', + 'in_site_migration_flow' => '(string) Whether the site is currently in the Site Migration signup flow.', + 'blogname' => '(string) Blog name', + 'blogdescription' => '(string) Blog description', + 'default_pingback_flag' => '(bool) Notify blogs linked from article?', + 'default_ping_status' => '(bool) Allow link notifications from other blogs?', + 'default_comment_status' => '(bool) Allow comments on new articles?', + 'blog_public' => '(string) Site visibility; -1: private, 0: discourage search engines, 1: allow search engines', + 'wpcom_data_sharing_opt_out' => '(bool) Did the site opt out of public content sharing with third parties and research partners?', + 'jetpack_sync_non_public_post_stati' => '(bool) allow sync of post and pages with non-public posts stati', + 'jetpack_relatedposts_enabled' => '(bool) Enable related posts?', + 'jetpack_relatedposts_show_context' => '(bool) Show post\'s tags and category in related posts?', + 'jetpack_relatedposts_show_date' => '(bool) Show date in related posts?', + 'jetpack_relatedposts_show_headline' => '(bool) Show headline in related posts?', + 'jetpack_relatedposts_show_thumbnails' => '(bool) Show thumbnails in related posts?', + 'instant_search_enabled' => '(bool) Enable the new Jetpack Instant Search interface', + 'jetpack_search_enabled' => '(bool) Enable Jetpack Search', + 'jetpack_search_supported' => '(bool) Jetpack Search supported', + 'jetpack_protect_whitelist' => '(array) List of IP addresses to always allow', + 'infinite_scroll' => '(bool) Support infinite scroll of posts?', + 'default_category' => '(int) Default post category', + 'default_post_format' => '(string) Default post format', + 'require_name_email' => '(bool) Require comment authors to fill out name and email?', + 'comment_registration' => '(bool) Require users to be registered and logged in to comment?', + 'close_comments_for_old_posts' => '(bool) Automatically close comments on old posts?', + 'close_comments_days_old' => '(int) Age at which to close comments', + 'thread_comments' => '(bool) Enable threaded comments?', + 'thread_comments_depth' => '(int) Depth to thread comments', + 'page_comments' => '(bool) Break comments into pages?', + 'comments_per_page' => '(int) Number of comments to display per page', + 'default_comments_page' => '(string) newest|oldest Which page of comments to display first', + 'comment_order' => '(string) asc|desc Order to display comments within page', + 'comments_notify' => '(bool) Email me when someone comments?', + 'moderation_notify' => '(bool) Email me when a comment is helf for moderation?', + 'social_notifications_like' => '(bool) Email me when someone likes my post?', + 'social_notifications_reblog' => '(bool) Email me when someone reblogs my post?', + 'social_notifications_subscribe' => '(bool) Email me when someone subscribes to my blog?', + 'comment_moderation' => '(bool) Moderate comments for manual approval?', + 'comment_previously_approved' => '(bool) Moderate comments unless author has a previously-approved comment?', + 'comment_max_links' => '(int) Moderate comments that contain X or more links', + 'moderation_keys' => '(string) Words or phrases that trigger comment moderation, one per line', + 'disallowed_keys' => '(string) Words or phrases that mark comment spam, one per line', + 'lang_id' => '(int) ID for language blog is written in', + 'locale' => '(string) locale code for language blog is written in', + 'site_vertical_id' => '(string) The site vertical ID', + 'wga' => '(array) Google Analytics Settings', + 'jetpack_cloudflare_analytics' => '(array) Cloudflare Analytics Settings', + 'disabled_likes' => '(bool) Are likes globally disabled (they can still be turned on per post)?', + 'disabled_reblogs' => '(bool) Are reblogs disabled on posts?', + 'jetpack_comment_likes_enabled' => '(bool) Are comment likes enabled for all comments?', + 'sharing_button_style' => '(string) Style to use for sharing buttons (icon-text, icon, text, or official)', + 'sharing_label' => '(string) Label to use for sharing buttons, e.g. "Share this:"', + 'sharing_show' => '(string|array:string) Post type or array of types where sharing buttons are to be displayed', + 'sharing_open_links' => '(string) Link target for sharing buttons (same or new)', + 'twitter_via' => '(string) Twitter username to include in tweets when people share using the Twitter button', + 'jetpack-twitter-cards-site-tag' => '(string) The Twitter username of the owner of the site\'s domain.', + 'eventbrite_api_token' => '(int) The Keyring token ID for an Eventbrite token to associate with the site', + 'timezone_string' => '(string) PHP-compatible timezone string like \'UTC-5\'', + 'gmt_offset' => '(int) Site offset from UTC in hours', + 'date_format' => '(string) PHP Date-compatible date format', + 'time_format' => '(string) PHP Date-compatible time format', + 'start_of_week' => '(int) Starting day of week (0 = Sunday, 6 = Saturday)', + 'woocommerce_onboarding_profile' => '(array) woocommerce_onboarding_profile', + 'woocommerce_store_address' => '(string) woocommerce_store_address option', + 'woocommerce_store_address_2' => '(string) woocommerce_store_address_2 option', + 'woocommerce_store_city' => '(string) woocommerce_store_city option', + 'woocommerce_default_country' => '(string) woocommerce_default_country option', + 'woocommerce_store_postcode' => '(string) woocommerce_store_postcode option', + 'jetpack_testimonial' => '(bool) Whether testimonial custom post type is enabled for the site', + 'jetpack_testimonial_posts_per_page' => '(int) Number of testimonials to show per page', + 'jetpack_portfolio' => '(bool) Whether portfolio custom post type is enabled for the site', + 'jetpack_portfolio_posts_per_page' => '(int) Number of portfolio projects to show per page', + Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION => '(string) The SEO meta description for the site.', + Jetpack_SEO_Titles::TITLE_FORMATS_OPTION => '(array) SEO meta title formats. Allowed keys: front_page, posts, pages, groups, archives', + 'verification_services_codes' => '(array) Website verification codes. Allowed keys: google, pinterest, bing, yandex, facebook', + 'podcasting_archive' => '(string) The post category, if any, used for publishing podcasts', + 'site_icon' => '(int) Media attachment ID to use as site icon. Set to zero or an otherwise empty value to clear', + 'api_cache' => '(bool) Turn on/off the Jetpack JSON API cache', + 'posts_per_page' => '(int) Number of posts to show on blog pages', + 'posts_per_rss' => '(int) Number of posts to show in the RSS feed', + 'rss_use_excerpt' => '(bool) Whether the RSS feed will use post excerpts', + 'wpcom_publish_posts_with_markdown' => '(bool) Whether markdown is enabled for posts', + 'wpcom_publish_comments_with_markdown' => '(bool) Whether markdown is enabled for comments', + 'launchpad_screen' => '(string) Whether or not launchpad is presented and what size it will be', + 'wpcom_featured_image_in_email' => '(bool) Whether the Featured image is displayed in the New Post email template or not', + 'jetpack_gravatar_in_email' => '(bool) Whether to show author avatar in the email byline', + 'jetpack_author_in_email' => '(bool) Whether to show author display name in the email byline', + 'jetpack_post_date_in_email' => '(bool) Whether to show date in the email byline', + 'wpcom_newsletter_categories' => '(array) Array of post category ids that are marked as newsletter categories', + 'wpcom_newsletter_categories_enabled' => '(bool) Whether the newsletter categories are enabled or not', + 'sm_enabled' => '(bool) Whether the newsletter Subscribe Modal is enabled or not', + 'jetpack_subscribe_overlay_enabled' => '(bool) Whether the newsletter Subscribe Overlay is enabled or not', + 'jetpack_subscribe_floating_button_enabled' => '(bool) Whether the newsletter floating subscribe button is enabled or not', 'jetpack_subscriptions_subscribe_post_end_enabled' => '(bool) Whether adding Subscribe block at the end of each post is enabled or not', 'jetpack_subscriptions_login_navigation_enabled' => '(bool) Whether the Subscriber Login block navigation placement is enabled or not', 'jetpack_subscriptions_subscribe_navigation_enabled' => '(bool) Whether the Subscribe block navigation placement is enabled or not', - 'wpcom_gifting_subscription' => '(bool) Whether gifting is enabled for non auto-renew sites', - 'wpcom_reader_views_enabled' => '(bool) Whether showing post views in WordPress.com Reader is enabled for the site', - 'wpcom_subscription_emails_use_excerpt' => '(bool) Whether site subscription emails (e.g. New Post email notification) will use post excerpts', - 'jetpack_subscriptions_reply_to' => '(string) The reply to email behaviour for newsletter emails', - 'jetpack_subscriptions_from_name' => '(string) The from name for newsletter emails', - 'show_on_front' => '(string) Whether homepage should display related posts or a static page. The expected value is \'posts\' or \'page\'.', - 'page_on_front' => '(string) The page ID of the page to use as the site\'s homepage. It will apply only if \'show_on_front\' is set to \'page\'.', - 'page_for_posts' => '(string) The page ID of the page to use as the site\'s posts page. It will apply only if \'show_on_front\' is set to \'page\'.', - 'subscription_options' => '(array) Array of three options used in subscription email templates: \'invitation\', \'welcome\' and \'comment_follow\' strings.', - 'jetpack_verbum_subscription_modal' => '(bool) Whether Subscription modal is enabled in Verbum comments', - 'wpcom_ai_site_prompt' => '(string) User input in the AI site prompt', - 'enable_verbum_commenting' => '(bool) Whether Verbum commenting is enabled', - 'enable_blocks_comments' => '(bool) Whether blocks comments are enabled', - 'highlander_comment_form_prompt' => '(string) The prompt for the comment form', - 'jetpack_comment_form_color_scheme' => '(string) The color scheme for the comment form', - 'is_fully_managed_agency_site' => '(bool) Whether the site is a fully managed agency site', + 'wpcom_gifting_subscription' => '(bool) Whether gifting is enabled for non auto-renew sites', + 'wpcom_reader_views_enabled' => '(bool) Whether showing post views in WordPress.com Reader is enabled for the site', + 'wpcom_subscription_emails_use_excerpt' => '(bool) Whether site subscription emails (e.g. New Post email notification) will use post excerpts', + 'jetpack_subscriptions_reply_to' => '(string) The reply to email behaviour for newsletter emails', + 'jetpack_subscriptions_from_name' => '(string) The from name for newsletter emails', + 'show_on_front' => '(string) Whether homepage should display related posts or a static page. The expected value is \'posts\' or \'page\'.', + 'page_on_front' => '(string) The page ID of the page to use as the site\'s homepage. It will apply only if \'show_on_front\' is set to \'page\'.', + 'page_for_posts' => '(string) The page ID of the page to use as the site\'s posts page. It will apply only if \'show_on_front\' is set to \'page\'.', + 'subscription_options' => '(array) Array of three options used in subscription email templates: \'invitation\', \'welcome\' and \'comment_follow\' strings.', + 'jetpack_verbum_subscription_modal' => '(bool) Whether Subscription modal is enabled in Verbum comments', + 'wpcom_ai_site_prompt' => '(string) User input in the AI site prompt', + 'enable_verbum_commenting' => '(bool) Whether Verbum commenting is enabled', + 'enable_blocks_comments' => '(bool) Whether blocks comments are enabled', + 'highlander_comment_form_prompt' => '(string) The prompt for the comment form', + 'jetpack_comment_form_color_scheme' => '(string) The color scheme for the comment form', + 'is_fully_managed_agency_site' => '(bool) Whether the site is a fully managed agency site', ), 'response_format' => array( diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php index 2dd816c37e249..5ea49e7d89ba6 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php @@ -93,7 +93,7 @@ public function callback( $path = '', $blog_id = 0 ) { // We're splitting out videos for Jetpack sites. foreach ( $media_files as $media_item ) { - if ( preg_match( '@^video/@', $media_item['type'] ) && $is_jetpack_site ) { + if ( isset( $media_item['type'] ) && preg_match( '@^video/@', $media_item['type'] ) && $is_jetpack_site ) { if ( defined( 'IS_WPCOM' ) && IS_WPCOM && defined( 'VIDEOPRESS_JETPACK_VIDEO_ENABLED' ) && VIDEOPRESS_JETPACK_VIDEO_ENABLED ) { diff --git a/projects/plugins/jetpack/modules/infinite-scroll/infinity.php b/projects/plugins/jetpack/modules/infinite-scroll/infinity.php index f56fdd98231c4..cd0230308ec87 100644 --- a/projects/plugins/jetpack/modules/infinite-scroll/infinity.php +++ b/projects/plugins/jetpack/modules/infinite-scroll/infinity.php @@ -772,7 +772,7 @@ public function query_time_filter( $where, $query ) { * will always return results prior to (descending sort) * or before (ascending sort) the last post date. * - * @deprecated $$next-version$$ + * @deprecated 14.0 * * @module infinite-scroll * @@ -783,7 +783,7 @@ public function query_time_filter( $where, $query ) { */ $operator = '<'; $last_post_date = isset( $_REQUEST['last_post_date'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['last_post_date'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes to the site - $where .= apply_filters_deprecated( 'infinite_scroll_posts_where', array( $clause, $query, $operator, $last_post_date ), '$$next-version$$', '' ); + $where .= apply_filters_deprecated( 'infinite_scroll_posts_where', array( $clause, $query, $operator, $last_post_date ), '14.0', '' ); } return $where; diff --git a/projects/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/projects/plugins/jetpack/modules/related-posts/jetpack-related-posts.php index 827bffdd56822..fcbb64cefd177 100644 --- a/projects/plugins/jetpack/modules/related-posts/jetpack-related-posts.php +++ b/projects/plugins/jetpack/modules/related-posts/jetpack-related-posts.php @@ -1883,12 +1883,20 @@ protected function log_click( $post_id, $to_post_id, $link_position ) { // phpcs /** * Determines if the current post is able to use related posts. * - * @since $$next-version$$ Checks for singular instead of single to allow usage on non-posts CPTs. + * @since 14.0 Checks for singular instead of single to allow usage on non-posts CPTs in block themes. * @uses self::get_options, is_admin, is_singular, apply_filters * @return bool */ protected function enabled_for_request() { - $enabled = is_singular() + /* + * On block themes, allow usage on any singular view (post, page, CPT). + * On classic themes, only allow usage on single posts by default. + */ + $enabled_on_singular_views = wp_is_block_theme() + ? is_singular() + : is_single(); + + $enabled = $enabled_on_singular_views && ! is_attachment() && ! is_admin() && ! is_embed() diff --git a/projects/plugins/jetpack/modules/stats.php b/projects/plugins/jetpack/modules/stats.php index e306bc9d180e9..224ba4a177d89 100644 --- a/projects/plugins/jetpack/modules/stats.php +++ b/projects/plugins/jetpack/modules/stats.php @@ -54,7 +54,10 @@ function stats_load() { Jetpack::enable_module_configurable( __FILE__ ); - add_action( 'wp_head', 'stats_admin_bar_head', 100 ); + // Only run the callback for those who can see the stats. + if ( is_user_logged_in() && current_user_can( 'view_stats' ) ) { + add_action( 'wp_head', 'stats_admin_bar_head', 100 ); + } add_action( 'jetpack_admin_menu', 'stats_admin_menu' ); @@ -1668,7 +1671,7 @@ function stats_get_remote_csv( $url ) { */ function stats_str_getcsv( $csv ) { // @todo Correctly handle embedded newlines. Note, despite claims online, `str_getcsv( $csv, "\n" )` does not actually work. - $lines = explode( "\n", $csv ); + $lines = explode( "\n", rtrim( $csv, "\n" ) ); return array_map( function ( $line ) { // @todo When we drop support for PHP <7.4, consider passing empty-string for `$escape` here for better spec compatibility. diff --git a/projects/plugins/jetpack/modules/subscriptions.php b/projects/plugins/jetpack/modules/subscriptions.php index 87801f8868919..850f474f00c4f 100644 --- a/projects/plugins/jetpack/modules/subscriptions.php +++ b/projects/plugins/jetpack/modules/subscriptions.php @@ -1047,3 +1047,4 @@ public function track_newsletter_category_creation() { require __DIR__ . '/subscriptions/views.php'; require __DIR__ . '/subscriptions/subscribe-modal/class-jetpack-subscribe-modal.php'; require __DIR__ . '/subscriptions/subscribe-overlay/class-jetpack-subscribe-overlay.php'; +require __DIR__ . '/subscriptions/subscribe-floating-button/class-jetpack-subscribe-floating-button.php'; diff --git a/projects/plugins/jetpack/modules/subscriptions/subscribe-floating-button/class-jetpack-subscribe-floating-button.php b/projects/plugins/jetpack/modules/subscriptions/subscribe-floating-button/class-jetpack-subscribe-floating-button.php new file mode 100644 index 0000000000000..09bb8ec5de85a --- /dev/null +++ b/projects/plugins/jetpack/modules/subscriptions/subscribe-floating-button/class-jetpack-subscribe-floating-button.php @@ -0,0 +1,196 @@ +get_template(); + } + } + + return $block_template; + } + + /** + * Returns a custom template for the floating Subscribe button. + * + * @return WP_Block_Template + */ + public function get_template() { + $template = new WP_Block_Template(); + $template->theme = get_stylesheet(); + $template->slug = self::BLOCK_TEMPLATE_PART_SLUG; + $template->id = self::get_block_template_part_id(); + $template->area = 'uncategorized'; + $template->content = $this->get_floating_subscribe_button_template_content(); + $template->source = 'plugin'; + $template->type = 'wp_template_part'; + $template->title = __( 'Jetpack Subscribe floating button', 'jetpack' ); + $template->status = 'publish'; + $template->has_theme_file = false; + $template->is_custom = true; + $template->description = __( 'A floating subscribe button that shows up when someone visits your site.', 'jetpack' ); + + return $template; + } + + /** + * Returns the initial content of the floating Subscribe button template. + * This can then be edited by the user. + * + * @return string + */ + public function get_floating_subscribe_button_template_content() { + $block_name = esc_attr__( 'Floating subscribe button', 'jetpack' ); + + return ''; + } + + /** + * Enqueues styles. + * + * @return void + */ + public function enqueue_assets() { + if ( $this->should_user_see_floating_button() ) { + wp_enqueue_style( 'subscribe-floating-button-css', plugins_url( 'subscribe-floating-button.css', __FILE__ ), array(), JETPACK__VERSION ); + + // Disables WP.com action bar as the features collide/overlap + add_filter( 'wpcom_disable_logged_out_follow', '__return_true', 10, 1 ); + } + } + + /** + * Adds floating Subscribe button HTML wrapper + * + * @return void + */ + public function add_subscribe_floating_button_to_frontend() { + if ( $this->should_user_see_floating_button() ) { ?> +
    + +
    + { const modal = document.querySelector( '.jetpack-subscribe-modal' ); const modalDismissedCookie = 'jetpack_post_subscribe_modal_dismissed'; + const skipUrlParam = 'jetpack_skip_subscription_popup'; function hasEnoughTimePassed() { const lastDismissed = localStorage.getItem( modalDismissedCookie ); return lastDismissed ? Date.now() - lastDismissed > Jetpack_Subscriptions.modalInterval : true; } - if ( ! modal || ! hasEnoughTimePassed() ) { + // Subscriber ended up here e.g. from emails: + // we won't show the modal to them in future since they most likely are already a subscriber. + function skipModal() { + const url = new URL( window.location.href ); + if ( url.searchParams.has( skipUrlParam ) ) { + url.searchParams.delete( skipUrlParam ); + window.history.replaceState( {}, '', url ); + storeCloseTimestamp(); + return true; + } + + return false; + } + + if ( ! modal || ! hasEnoughTimePassed() || skipModal() ) { return; } diff --git a/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.css b/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.css index 91cf3bf268738..c7ac26616b7c8 100644 --- a/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.css +++ b/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.css @@ -7,7 +7,7 @@ body.jetpack-subscribe-overlay-open { visibility: hidden; position: fixed; - z-index: 50000; /* Same as WP.com Action bar */ + z-index: 50001; /* WP.com Action bar and floating subscribe button are 5000 */ left: 0; top: 0; width: 100%; diff --git a/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.js b/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.js index 936b5840c80fb..83eae23686338 100644 --- a/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.js +++ b/projects/plugins/jetpack/modules/subscriptions/subscribe-overlay/subscribe-overlay.js @@ -3,10 +3,25 @@ const { domReady } = wp; domReady( function () { const overlay = document.querySelector( '.jetpack-subscribe-overlay' ); const overlayDismissedCookie = 'jetpack_post_subscribe_overlay_dismissed'; + const skipUrlParam = 'jetpack_skip_subscription_popup'; const hasOverlayDismissedCookie = document.cookie && document.cookie.indexOf( overlayDismissedCookie ) > -1; - if ( ! overlay || hasOverlayDismissedCookie ) { + // Subscriber ended up here e.g. from emails: + // we won't show the overlay to them in future since they most likely are already a subscriber. + function skipOverlay() { + const url = new URL( window.location.href ); + if ( url.searchParams.has( skipUrlParam ) ) { + url.searchParams.delete( skipUrlParam ); + window.history.replaceState( {}, '', url ); + setOverlayDismissedCookie(); + return true; + } + + return false; + } + + if ( ! overlay || hasOverlayDismissedCookie || skipOverlay() ) { return; } diff --git a/projects/plugins/jetpack/modules/videopress/class.jetpack-videopress.php b/projects/plugins/jetpack/modules/videopress/class.jetpack-videopress.php index 16aaf210242b6..b82d874c7cde0 100644 --- a/projects/plugins/jetpack/modules/videopress/class.jetpack-videopress.php +++ b/projects/plugins/jetpack/modules/videopress/class.jetpack-videopress.php @@ -83,7 +83,7 @@ public function media_new_page_admin_notice() { __( 'VideoPress uploads are not supported here. To upload to VideoPress, add your videos from the Media Library or the block editor using the Video block.', 'jetpack' ), array( 'a' => array( 'href' => array() ) ) ), - esc_url( admin_url( 'upload.php' ) ) + esc_url( admin_url( 'upload.php?mode=grid&action=add-new' ) ) ); wp_admin_notice( $message, diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 894c231112315..97da3db04ed14 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -1,6 +1,6 @@ { "name": "Jetpack", - "version": "14.0.0-a.1", + "version": "14.0.0-a.7", "private": true, "description": "[Jetpack](https://jetpack.com/) is a WordPress plugin that supercharges your self-hosted WordPress site with the awesome cloud power of [WordPress.com](https://wordpress.com).", "homepage": "https://jetpack.com", diff --git a/projects/plugins/jetpack/readme.txt b/projects/plugins/jetpack/readme.txt index 3d7d20c44db07..2ea5b8f05cca1 100644 --- a/projects/plugins/jetpack/readme.txt +++ b/projects/plugins/jetpack/readme.txt @@ -1,10 +1,10 @@ === Jetpack - WP Security, Backup, Speed, & Growth === Contributors: automattic, adamkheckler, adrianmoldovanwp, aduth, akirk, allendav, alternatekev, andy, annamcphee, annezazu, apeatling, arcangelini, arsihasi, azaozz, barry, batmoo, beaulebens, bindlegirl, biskobe, bjorsch, blobaugh, brbrr, brileyhooper, cainm, cena, cfinke, cgastrell, chaselivingston, chellycat, clickysteve, csonnek, danielbachhuber, daniloercoli, davoraltman, delawski, designsimply, dkmyta, dllh, drawmyface, dsmart, dun2mis, dzver, ebinnion, egregor, eliorivero, enej, eoigal, erania-pinnera, ethitter, fgiannar, gcorne, georgestephanis, gibrown, goldsounds, hew, hugobaeta, hypertextranch, iammattthomas, iandunn, joen, jblz, jeffgolenski, jeherve, jenhooks, jenia, jessefriedman, jgs, jkudish, jmdodd, joanrho, johnjamesjacoby, jshreve, kbrownkd, keoshi, koke, kraftbj, lancewillett, leogermani, lhkowalski, lschuyler, macmanx, martinremy, matt, mattwiebe, matveb, maverick3x6, mcsf, mdawaffe, mdbitz, MichaelArestad, migueluy, miguelxavierpenha, mikeyarce, mkaz, nancythanki, nickmomrik, njweller, nunyvega, obenland, oskosk, pento, professor44, rachelsquirrel, rdcoll, renatoagds, retrofox, richardmtl, richardmuscat, robertbpugh, roccotripaldi, ryancowles, samhotchkiss, samiff, scarstocea, scottsweb, sdixon194, sdquirk, sermitr, simison, stephdau, thehenridev, tmoorewp, tyxla, Viper007Bond, westi, williamvianas, wpkaren, yoavf, zinigor Tags: Security, backup, malware, scan, performance -Stable tag: 13.8.1 +Stable tag: 13.9.1 Requires at least: 6.5 Requires PHP: 7.0 -Tested up to: 6.6 +Tested up to: 6.7 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -326,15 +326,18 @@ Jetpack Backup can do a full website migration to a new host, migrate theme file == Changelog == -### 14.0-a.1 - 2024-10-07 +### 14.0-a.7 - 2024-10-21 #### Enhancements -- Sitemap: Improve sitemap write efficienty. -- CSS: Rely esclusively on individual CSS files instead of a combined one for the features used on each page to improve page loading. -- Social: Add support for Bluesky 🎉. -- Scan: Update Jetpack Scan link in the WP Admin menu. +- Newsletters: Add an email preview option to the preview menu. +- Newsletters: Allow skipping newsletter modals with a URL query param. + +#### Improved compatibility +- General: Ensure notice displays without errors when running an old version of WordPress. +- Plugin action links filters: Update parameter to avoid conflicts with other plugins. #### Bug fixes -- Social: Prevent text overflow in the share status tooltip. +- Map Block: Fix issue where blocks placed underneath would overlap with the map block. +- Newsletters: Fix "Use excerpt" setting. -------- diff --git a/projects/plugins/jetpack/tests/php/general/test_jetpack-admin-menu.php b/projects/plugins/jetpack/tests/php/general/test_jetpack-admin-menu.php index 7c26ad0aca3f0..c4d0a6983443a 100644 --- a/projects/plugins/jetpack/tests/php/general/test_jetpack-admin-menu.php +++ b/projects/plugins/jetpack/tests/php/general/test_jetpack-admin-menu.php @@ -87,20 +87,19 @@ public function test_jetpack_admin_menu_order() { // Some sites - multisites / WoA for example - may not have all of the menu items. if ( in_array( 'My Jetpack', $submenu_names, true ) ) { $my_jetpack_submenu_position = array_search( 'My Jetpack', $submenu_names, true ); - $this->assertTrue( $my_jetpack_submenu_position < $stats_submenu_position, 'My Jetpack should be above Stats in the submenu order.' ); + $this->assertLessThan( $stats_submenu_position, $my_jetpack_submenu_position, 'My Jetpack should be above Stats in the submenu order.' ); } if ( in_array( 'Activity Log', $submenu_names, true ) ) { $activity_log_submenu_position = array_search( 'Activity Log', $submenu_names, true ); - $this->assertTrue( $activity_log_submenu_position < $search_submenu_position, 'Activity Log should be above Search in the submenu order.' ); - $this->assertTrue( $backup_submenu_position < $activity_log_submenu_position, 'Jetpack VaultPress Backup should be above Activity Log in the submenu order.' ); + $this->assertLessThan( $search_submenu_position, $activity_log_submenu_position, 'Activity Log should be above Search in the submenu order.' ); + $this->assertLessThan( $activity_log_submenu_position, $backup_submenu_position, 'Jetpack VaultPress Backup should be above Activity Log in the submenu order.' ); } - - $this->assertTrue( $stats_submenu_position < $videopress_submenu_position, 'Stats should be above VideoPress in the submenu order.' ); - $this->assertTrue( $videopress_submenu_position < $backup_submenu_position, 'Jetpack VideoPress should be above Jetpack VaultPress Backup in the submenu order.' ); - $this->assertTrue( $backup_submenu_position < $search_submenu_position, 'Jetpack VaultPress Backup should be above Search in the submenu order.' ); - $this->assertTrue( $search_submenu_position < $wordads_submenu_position, 'Search should be above WordAds in the submenu order.' ); - $this->assertTrue( $wordads_submenu_position < $settings_submenu_position, 'WordAds should be above Settings in the submenu order.' ); - $this->assertTrue( $settings_submenu_position < $dashboard_submenu_position, 'Settings should be above Dashboard in the submenu order.' ); + $this->assertLessThan( $videopress_submenu_position, $stats_submenu_position, 'Stats should be above VideoPress in the submenu order.' ); + $this->assertLessThan( $backup_submenu_position, $videopress_submenu_position, 'Jetpack VideoPress should be above Jetpack VaultPress Backup in the submenu order.' ); + $this->assertLessThan( $search_submenu_position, $backup_submenu_position, 'Jetpack VaultPress Backup should be above Search in the submenu order.' ); + $this->assertLessThan( $wordads_submenu_position, $search_submenu_position, 'Search should be above WordAds in the submenu order.' ); + $this->assertLessThan( $settings_submenu_position, $wordads_submenu_position, 'WordAds should be above Settings in the submenu order.' ); + $this->assertLessThan( $dashboard_submenu_position, $settings_submenu_position, 'Settings should be above Dashboard in the submenu order.' ); } } diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php index 75282db8c96e8..e7c4cd66c1a03 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php @@ -91,6 +91,7 @@ public function test_sync_default_options() { 'stc_enabled' => false, 'sm_enabled' => false, 'jetpack_subscribe_overlay_enabled' => false, + 'jetpack_subscribe_floating_button_enabled' => false, 'jetpack_subscriptions_subscribe_post_end_enabled' => false, 'jetpack_subscriptions_login_navigation_enabled' => false, 'jetpack_subscriptions_subscribe_navigation_enabled' => false, @@ -277,7 +278,6 @@ public function test_sync_default_options() { 'jetpack_waf_share_data' => true, 'jetpack_waf_share_debug_data' => false, 'jetpack_waf_automatic_rules_last_updated_timestamp' => 0, - 'woocommerce_analytics_first_activation' => false, ); $theme_mod_key = 'theme_mods_' . get_option( 'stylesheet' ); diff --git a/projects/plugins/jetpack/to-test.md b/projects/plugins/jetpack/to-test.md index 17612f968e23d..0b898396b9eb5 100644 --- a/projects/plugins/jetpack/to-test.md +++ b/projects/plugins/jetpack/to-test.md @@ -10,9 +10,33 @@ - Or add the following to something like a code snippet plugin: `add_filter( 'jetpack_blocks_variation', function () { return 'beta'; } );` - To test Breve further in the document please enable the feature with the following snippet: `add_filter( 'breve_enabled', '__return_true' );` -### Your Feature +### AI Logo Generator -Add testing instructions below. +On top of the already available AI Logo generator, we've now added a styles dropdown to allow more control for the user without depending entirely on the provided prompt. + +The logo generator is not available for free users, test with a plan or subscription. Also, it's currenlty available for a12s (and will soon be open to public), but if you need to test with another account and have access to a sandbox, you can add a filter to enable the styles on your 0-sandbox.php file: `add_filter( 'jetpack_ai_logo_style_selector_enabled', '__return_true' );` + +- Load the editor and add a Logo block. +- On the network tab you should see a request to `ai-assistant-feature` + - If using an a11n account (or focing the filter to `true`), the response should include `featuresControl['logo-generator'].styles` as a collection of style objects. + - If NOT using an a11n account, the `styles` property should be an empty array. +``` +{ + ... + featuresControl: { + 'logo-generator': { + enabled: true, + styles: [ COLLECTION OF SYLES HERE ] + } + } +} +``` +- Use the block's AI toolbar button to open the Logo generator modal, you should see a style dropdown on the top-right corner +- Feel free to play with the styles to achieve different results +- Confirm that using style "Auto" will try to guess the style based on the prompt (AI query request) and set the style prior to sending the image generation request +- If possible, try different combinations of plans and cases: + - use `add_filter( 'jetpack_ai_tier_licensed_quantity', function() { return 0 | 100 | 1; } );` filter to mock free/tier100/unlimited plans + - sandbox the API, but then don't connect to sandbox to mock a disconnected situation ### And More! diff --git a/projects/plugins/migration/changelog/fix-sync-filter-null-array b/projects/plugins/migration/changelog/fix-sync-filter-null-array new file mode 100644 index 0000000000000..3f56c90b3a7bf --- /dev/null +++ b/projects/plugins/migration/changelog/fix-sync-filter-null-array @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Sync: update filter parameter to avoid conflicts with other plugins. + + diff --git a/projects/plugins/migration/changelog/update-tested-to-6-7 b/projects/plugins/migration/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/migration/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/migration/readme.txt b/projects/plugins/migration/readme.txt index e841038dff934..0b5da1d9329a0 100644 --- a/projects/plugins/migration/readme.txt +++ b/projects/plugins/migration/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic Tags: migrate, migration, backup, restore, transfer, move, copy, wordpress.com, automattic, import, importer, hosting Requires at least: 6.5 Requires PHP: 7.0 -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 2.0.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/projects/plugins/mu-wpcom-plugin/changelog/fix-sync-filter-null-array b/projects/plugins/mu-wpcom-plugin/changelog/fix-sync-filter-null-array new file mode 100644 index 0000000000000..3f56c90b3a7bf --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/fix-sync-filter-null-array @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Sync: update filter parameter to avoid conflicts with other plugins. + + diff --git a/projects/plugins/protect/CHANGELOG.md b/projects/plugins/protect/CHANGELOG.md index 2d62a2704ea7c..5d28f47c723b4 100644 --- a/projects/plugins/protect/CHANGELOG.md +++ b/projects/plugins/protect/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 3.1.1 - 2024-10-17 +### Changed +- Firewall: Fix backwards compatibility for sites running standalone mode with outdated packages autoloaded. + +## 3.1.0 - 2024-10-15 +### Added +- Firewall: Adds stat cards showing recent block counts [#35739] +- Auto-Fixers: Adds handling for long-running fixers [#39301] + +### Changed +- Firewall: added help text for IP list formatting rules [#39448] +- Updated package dependencies. [#39707] + +### Removed +- Security Scanning: disabled database threat category [#39467] + +### Fixed +- Minor fixes and improvements. + ## 3.0.2 - 2024-09-06 ### Changed - Internal updates. diff --git a/projects/plugins/protect/changelog/add-dependency-extraction-auto-polyfill b/projects/plugins/protect/changelog/add-dependency-extraction-auto-polyfill deleted file mode 100644 index f4cd286e166af..0000000000000 --- a/projects/plugins/protect/changelog/add-dependency-extraction-auto-polyfill +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Only include `wp-polyfill` as a script dependency when needed. diff --git a/projects/plugins/protect/changelog/add-enable-eslint-wordpress-no-unused-vars-before-return b/projects/plugins/protect/changelog/add-enable-eslint-wordpress-no-unused-vars-before-return deleted file mode 100644 index 7f30b15d5fb4c..0000000000000 --- a/projects/plugins/protect/changelog/add-enable-eslint-wordpress-no-unused-vars-before-return +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Rearranged some variable assignments for new eslint `@wordpress/no-unused-vars-before-return` rule. Should be no changes to functionality. - - diff --git a/projects/plugins/protect/changelog/add-enable-eslint-wordpress-no-unused-vars-before-return#2 b/projects/plugins/protect/changelog/add-enable-eslint-wordpress-no-unused-vars-before-return#2 deleted file mode 100644 index d004f38abd24f..0000000000000 --- a/projects/plugins/protect/changelog/add-enable-eslint-wordpress-no-unused-vars-before-return#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Something was needed to avoid optimization breaking the i18n with the rearranged code, and these seemed like they could use some context anyway. - -Added context to i18n messages "Low", "High", and "Critical". diff --git a/projects/plugins/protect/changelog/add-eslint-react-jsx-key b/projects/plugins/protect/changelog/add-eslint-react-jsx-key deleted file mode 100644 index 9c48272a94f90..0000000000000 --- a/projects/plugins/protect/changelog/add-eslint-react-jsx-key +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Add `key` to some React `actions` props. Should be no change to functionality. - - diff --git a/projects/plugins/protect/changelog/add-features-enabled-rest-endpoint b/projects/plugins/protect/changelog/add-features-enabled-rest-endpoint deleted file mode 100644 index 57cf25c290a35..0000000000000 --- a/projects/plugins/protect/changelog/add-features-enabled-rest-endpoint +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: removed - -Connection: Removed features_enabled deprecated method diff --git a/projects/plugins/protect/changelog/add-protect-firewall-stat-cards b/projects/plugins/protect/changelog/add-protect-firewall-stat-cards deleted file mode 100644 index 244645fa6ebd6..0000000000000 --- a/projects/plugins/protect/changelog/add-protect-firewall-stat-cards +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Added WAF StatCards for blocked requests diff --git a/projects/plugins/protect/changelog/add-protect-firewall-stat-cards#2 b/projects/plugins/protect/changelog/add-protect-firewall-stat-cards#2 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/add-protect-firewall-stat-cards#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/add-protect-fixer-status-to-initial-state b/projects/plugins/protect/changelog/add-protect-fixer-status-to-initial-state deleted file mode 100644 index 460c195f87dad..0000000000000 --- a/projects/plugins/protect/changelog/add-protect-fixer-status-to-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -Adds fixer status to the initial state diff --git a/projects/plugins/protect/changelog/add-protect-header-component b/projects/plugins/protect/changelog/add-protect-header-component new file mode 100644 index 0000000000000..6276c489253c7 --- /dev/null +++ b/projects/plugins/protect/changelog/add-protect-header-component @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Adds and applies a shared Header component diff --git a/projects/plugins/protect/changelog/add-protect-ip-list-formatting-description b/projects/plugins/protect/changelog/add-protect-ip-list-formatting-description deleted file mode 100644 index e735fbfc9161d..0000000000000 --- a/projects/plugins/protect/changelog/add-protect-ip-list-formatting-description +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Firewall: added help text for IP list formatting rules diff --git a/projects/plugins/protect/changelog/add-protect-tanstack-query b/projects/plugins/protect/changelog/add-protect-tanstack-query deleted file mode 100644 index 8499ce03ae272..0000000000000 --- a/projects/plugins/protect/changelog/add-protect-tanstack-query +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: added -Comment: Added react query, no user-facing impact. - - diff --git a/projects/plugins/protect/changelog/add-restful-features-available b/projects/plugins/protect/changelog/add-restful-features-available deleted file mode 100644 index 152ef1efc4b7f..0000000000000 --- a/projects/plugins/protect/changelog/add-restful-features-available +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: removed - -Connection: Removed deprecated method features_available diff --git a/projects/plugins/protect/changelog/fix-protect-credentials-refetch-interval b/projects/plugins/protect/changelog/fix-protect-credentials-refetch-interval new file mode 100644 index 0000000000000..3ae06ab163288 --- /dev/null +++ b/projects/plugins/protect/changelog/fix-protect-credentials-refetch-interval @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Fixed background refreshing of data when credentials modal opened. + + diff --git a/projects/plugins/protect/changelog/fix-protect-last-checked-conversions b/projects/plugins/protect/changelog/fix-protect-last-checked-conversions deleted file mode 100644 index e2a903b5304db..0000000000000 --- a/projects/plugins/protect/changelog/fix-protect-last-checked-conversions +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Fixes lastChecked conversions diff --git a/projects/plugins/protect/changelog/fix-protect-overwritten-waf-subheading-updates b/projects/plugins/protect/changelog/fix-protect-overwritten-waf-subheading-updates deleted file mode 100644 index 16b7e542600bd..0000000000000 --- a/projects/plugins/protect/changelog/fix-protect-overwritten-waf-subheading-updates +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Reapplies overwritten FirewallSubheading component updates diff --git a/projects/plugins/protect/changelog/fix-protect-stats-property-naming b/projects/plugins/protect/changelog/fix-protect-stats-property-naming deleted file mode 100644 index 7988ecde8d81b..0000000000000 --- a/projects/plugins/protect/changelog/fix-protect-stats-property-naming +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Fixes blockedRequests destructuring fallback diff --git a/projects/plugins/protect/changelog/prerelease b/projects/plugins/protect/changelog/prerelease deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#2 b/projects/plugins/protect/changelog/prerelease#2 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#3 b/projects/plugins/protect/changelog/prerelease#3 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#3 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#4 b/projects/plugins/protect/changelog/prerelease#4 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#4 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#5 b/projects/plugins/protect/changelog/prerelease#5 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#5 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#6 b/projects/plugins/protect/changelog/prerelease#6 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#6 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#7 b/projects/plugins/protect/changelog/prerelease#7 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#7 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#8 b/projects/plugins/protect/changelog/prerelease#8 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#8 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/prerelease#9 b/projects/plugins/protect/changelog/prerelease#9 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/prerelease#9 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/remove-protect-database-results b/projects/plugins/protect/changelog/remove-protect-database-results deleted file mode 100644 index ff0dc3ea3a23c..0000000000000 --- a/projects/plugins/protect/changelog/remove-protect-database-results +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: removed - -Security Scanning: disabled database threat category diff --git a/projects/plugins/protect/changelog/renovate-lock-file-maintenance b/projects/plugins/protect/changelog/renovate-lock-file-maintenance deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/plugins/protect/changelog/renovate-lock-file-maintenance +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/plugins/protect/changelog/renovate-lock-file-maintenance#2 b/projects/plugins/protect/changelog/renovate-lock-file-maintenance#2 deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/plugins/protect/changelog/renovate-lock-file-maintenance#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/plugins/protect/changelog/renovate-lock-file-maintenance#3 b/projects/plugins/protect/changelog/renovate-lock-file-maintenance#3 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/protect/changelog/renovate-lock-file-maintenance#3 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/protect/changelog/renovate-wordpress-monorepo b/projects/plugins/protect/changelog/renovate-wordpress-monorepo deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/plugins/protect/changelog/renovate-wordpress-monorepo +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/plugins/protect/changelog/renovate-wordpress-monorepo#2 b/projects/plugins/protect/changelog/renovate-wordpress-monorepo#2 deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/plugins/protect/changelog/renovate-wordpress-monorepo#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/plugins/protect/changelog/renovate-wordpress-monorepo#3 b/projects/plugins/protect/changelog/renovate-wordpress-monorepo#3 deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/plugins/protect/changelog/renovate-wordpress-monorepo#3 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/plugins/protect/changelog/update-my-jetpack-notice-mobile-style b/projects/plugins/protect/changelog/update-my-jetpack-notice-mobile-style deleted file mode 100644 index c740afea846ef..0000000000000 --- a/projects/plugins/protect/changelog/update-my-jetpack-notice-mobile-style +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -My Jetpack: visual update to the GlobalNotice component look better on mobile. diff --git a/projects/plugins/protect/changelog/update-protect-fixer-ui-to-handle-long-running-fixers b/projects/plugins/protect/changelog/update-protect-fixer-ui-to-handle-long-running-fixers deleted file mode 100644 index d8f2fd52d4ce2..0000000000000 --- a/projects/plugins/protect/changelog/update-protect-fixer-ui-to-handle-long-running-fixers +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Adds handling for long running fixers diff --git a/projects/plugins/protect/changelog/update-protect-minor-component-refactors b/projects/plugins/protect/changelog/update-protect-minor-component-refactors deleted file mode 100644 index 81a8cf4144ea1..0000000000000 --- a/projects/plugins/protect/changelog/update-protect-minor-component-refactors +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Minor refactoring of JS organization. - - diff --git a/projects/plugins/protect/changelog/update-protect-optimistically-scanning b/projects/plugins/protect/changelog/update-protect-optimistically-scanning deleted file mode 100644 index 35a9a6afb5f74..0000000000000 --- a/projects/plugins/protect/changelog/update-protect-optimistically-scanning +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -Improves optimistic scanning diff --git a/projects/plugins/protect/changelog/update-protect-use-fixers-response-error-prop-handling b/projects/plugins/protect/changelog/update-protect-use-fixers-response-error-prop-handling deleted file mode 100644 index 75eea85cd389a..0000000000000 --- a/projects/plugins/protect/changelog/update-protect-use-fixers-response-error-prop-handling +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Adds handling for FixerStatus error props diff --git a/projects/plugins/protect/changelog/update-tested-to-6-7 b/projects/plugins/protect/changelog/update-tested-to-6-7 new file mode 100644 index 0000000000000..9c1d5b4fabb5f --- /dev/null +++ b/projects/plugins/protect/changelog/update-tested-to-6-7 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: indicate compatibility with the upcoming version of WordPress - 6.7. diff --git a/projects/plugins/protect/changelog/update-wordpress-eslint-plugin b/projects/plugins/protect/changelog/update-wordpress-eslint-plugin deleted file mode 100644 index e832c1048f84f..0000000000000 --- a/projects/plugins/protect/changelog/update-wordpress-eslint-plugin +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Move leading and trailing spaces out of i18n messages. diff --git a/projects/plugins/protect/composer.json b/projects/plugins/protect/composer.json index 2a97ac6fd86dc..f596dd2a423e3 100644 --- a/projects/plugins/protect/composer.json +++ b/projects/plugins/protect/composer.json @@ -79,6 +79,6 @@ "automattic/jetpack-autoloader": true, "automattic/jetpack-composer-plugin": true }, - "autoloader-suffix": "c4802e05bbcf59fd3b6350e8d3e5482c_protectⓥ3_0_2" + "autoloader-suffix": "c4802e05bbcf59fd3b6350e8d3e5482c_protectⓥ3_1_1" } } diff --git a/projects/plugins/protect/composer.lock b/projects/plugins/protect/composer.lock index 9fa2d9b26c0d0..b78911016670e 100644 --- a/projects/plugins/protect/composer.lock +++ b/projects/plugins/protect/composer.lock @@ -1803,7 +1803,7 @@ "dist": { "type": "path", "url": "../../packages/waf", - "reference": "79fb7681c1964694ba0200b2a70e18ed35c14bfe" + "reference": "44068e3c71aa5634458967a6191535ba25c51639" }, "require": { "automattic/jetpack-connection": "@dev", @@ -1830,7 +1830,7 @@ "link-template": "https://github.com/Automattic/jetpack-waf/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "0.21.x-dev" + "dev-trunk": "0.22.x-dev" } }, "autoload": { diff --git a/projects/plugins/protect/jetpack-protect.php b/projects/plugins/protect/jetpack-protect.php index dda7f1891ccb3..b46915aa11def 100644 --- a/projects/plugins/protect/jetpack-protect.php +++ b/projects/plugins/protect/jetpack-protect.php @@ -3,7 +3,7 @@ * Plugin Name: Jetpack Protect * Plugin URI: https://wordpress.org/plugins/jetpack-protect * Description: Security tools that keep your site safe and sound, from posts to plugins. - * Version: 3.0.2 + * Version: 3.1.1 * Author: Automattic - Jetpack Security team * Author URI: https://jetpack.com/protect/ * License: GPLv2 or later @@ -32,7 +32,7 @@ exit; } -define( 'JETPACK_PROTECT_VERSION', '3.0.2' ); +define( 'JETPACK_PROTECT_VERSION', '3.1.1' ); define( 'JETPACK_PROTECT_DIR', plugin_dir_path( __FILE__ ) ); define( 'JETPACK_PROTECT_ROOT_FILE', __FILE__ ); define( 'JETPACK_PROTECT_ROOT_FILE_RELATIVE_PATH', plugin_basename( __FILE__ ) ); diff --git a/projects/plugins/protect/package.json b/projects/plugins/protect/package.json index a2c54875837ba..257979fa86ad8 100644 --- a/projects/plugins/protect/package.json +++ b/projects/plugins/protect/package.json @@ -41,7 +41,6 @@ "@wordpress/url": "4.9.0", "camelize": "1.0.1", "clsx": "2.1.1", - "diff": "^4.0.2", "moment": "2.29.4", "prop-types": "15.8.1", "react": "18.3.1", diff --git a/projects/plugins/protect/readme.txt b/projects/plugins/protect/readme.txt index f56092fdc102f..7d2253fff1a8c 100644 --- a/projects/plugins/protect/readme.txt +++ b/projects/plugins/protect/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, retrofox, leogermani, renatoagds, bjorsch, ebinnion, f Tags: jetpack, protect, security, malware, scan Requires at least: 6.5 Requires PHP: 7.0 -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 1.4.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -178,7 +178,7 @@ The new Jetpack Protect plugin is different from the Jetpack feature formerly kn 4. The Jetpack Firewall is a web application firewall (known as WAF) designed to protect your WordPress site from malicious requests. == Changelog == -### 3.0.2 - 2024-09-06 +### 3.1.1 - 2024-10-17 #### Changed -- Internal updates. +- Firewall: Fix backwards compatibility for sites running standalone mode with outdated packages autoloaded. diff --git a/projects/plugins/protect/src/class-scan-history.php b/projects/plugins/protect/src/class-scan-history.php index 1533402ea9c79..de88b135778cc 100644 --- a/projects/plugins/protect/src/class-scan-history.php +++ b/projects/plugins/protect/src/class-scan-history.php @@ -182,7 +182,10 @@ public static function fetch_from_api() { $response = Client::wpcom_json_api_request_as_blog( $api_url, '2', - array( 'method' => 'GET' ), + array( + 'method' => 'GET', + 'timeout' => 30, + ), null, 'wpcom' ); diff --git a/projects/plugins/protect/src/js/api.ts b/projects/plugins/protect/src/js/api.ts index 6bcef53838e09..9d95ab07279fc 100644 --- a/projects/plugins/protect/src/js/api.ts +++ b/projects/plugins/protect/src/js/api.ts @@ -49,11 +49,11 @@ const API = { data: { step_ids: stepIds }, } ), - getScanHistory: (): Promise< ScanStatus > => + getScanHistory: (): Promise< ScanStatus | false > => apiFetch( { path: 'jetpack-protect/v1/scan-history', method: 'GET', - } ).then( camelize ) as Promise< ScanStatus >, + } ).then( camelize ), scan: () => apiFetch( { diff --git a/projects/plugins/protect/src/js/components/admin-page/index.jsx b/projects/plugins/protect/src/js/components/admin-page/index.jsx index bdeee21f24b77..b4ef8c24bad6d 100644 --- a/projects/plugins/protect/src/js/components/admin-page/index.jsx +++ b/projects/plugins/protect/src/js/components/admin-page/index.jsx @@ -1,11 +1,14 @@ -import { AdminPage as JetpackAdminPage, Container } from '@automattic/jetpack-components'; +import { + AdminPage as JetpackAdminPage, + Container, + JetpackProtectLogo, +} from '@automattic/jetpack-components'; import { useConnection } from '@automattic/jetpack-connection'; import { __ } from '@wordpress/i18n'; import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import useNotices from '../../hooks/use-notices'; import useWafData from '../../hooks/use-waf-data'; -import Logo from '../logo'; import Notice from '../notice'; import Tabs, { Tab } from '../tabs'; import styles from './styles.module.scss'; @@ -28,7 +31,10 @@ const AdminPage = ( { children } ) => { } return ( - }> + } + > { notice && } diff --git a/projects/plugins/protect/src/js/routes/scan/scan-section-notices.tsx b/projects/plugins/protect/src/js/components/admin-section-hero/admin-section-hero-notices.tsx similarity index 55% rename from projects/plugins/protect/src/js/routes/scan/scan-section-notices.tsx rename to projects/plugins/protect/src/js/components/admin-section-hero/admin-section-hero-notices.tsx index c29b5fb36b677..6ca6a33c1cc78 100644 --- a/projects/plugins/protect/src/js/routes/scan/scan-section-notices.tsx +++ b/projects/plugins/protect/src/js/components/admin-section-hero/admin-section-hero-notices.tsx @@ -1,15 +1,8 @@ -import { Col, Container } from '@automattic/jetpack-components'; -import { ConnectionError, useConnectionErrorNotice } from '@automattic/jetpack-connection'; +import { Container, Col } from '@automattic/jetpack-components'; +import { useConnectionErrorNotice, ConnectionError } from '@automattic/jetpack-connection'; import styles from './styles.module.scss'; -/** - * Scan Section Notices - * - * Component that renders the connection error notice and the Jetpack admin notices. - * - * @return {Component} The component. - */ -export default function ScanSectionNotices() { +const AdminSectionHeroNotices: React.FC = () => { const { hasConnectionError } = useConnectionErrorNotice(); return ( @@ -24,4 +17,6 @@ export default function ScanSectionNotices() { ); -} +}; + +export default AdminSectionHeroNotices; diff --git a/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx b/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx new file mode 100644 index 0000000000000..1f9f812c83e02 --- /dev/null +++ b/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx @@ -0,0 +1,64 @@ +import { + AdminSectionHero as JetpackAdminSectionHero, + H3, + getIconBySlug, +} from '@automattic/jetpack-components'; +import SeventyFiveLayout from '../seventy-five-layout'; +import AdminSectionHeroNotices from './admin-section-hero-notices'; +import styles from './styles.module.scss'; + +interface AdminSectionHeroProps { + main: React.ReactNode; + secondary?: React.ReactNode; + preserveSecondaryOnMobile?: boolean; +} + +interface AdminSectionHeroComponent extends React.FC< AdminSectionHeroProps > { + Heading: React.FC< { children: React.ReactNode; showIcon?: boolean } >; + Subheading: React.FC< { children: React.ReactNode } >; +} + +const AdminSectionHero: AdminSectionHeroComponent = ( { + main, + secondary, + preserveSecondaryOnMobile = true, +} ) => { + return ( + + + + + ); +}; + +AdminSectionHero.Heading = ( { + children, + showIcon = false, +}: { + children: React.ReactNode; + showIcon?: boolean; +} ) => { + const Icon = getIconBySlug( 'protect' ); + + return ( +

    + { children } + { showIcon && } +

    + ); +}; + +AdminSectionHero.Subheading = ( { children }: { children: React.ReactNode } ) => { + return
    { children }
    ; +}; + +export default AdminSectionHero; diff --git a/projects/plugins/protect/src/js/components/admin-section-hero/stories/index.stories.jsx b/projects/plugins/protect/src/js/components/admin-section-hero/stories/index.stories.jsx new file mode 100644 index 0000000000000..df9da6ce02d5e --- /dev/null +++ b/projects/plugins/protect/src/js/components/admin-section-hero/stories/index.stories.jsx @@ -0,0 +1,22 @@ +import { Status, Text } from '@automattic/jetpack-components'; +import AdminSectionHero from '..'; +import inProgressImage from '../../../../../assets/images/in-progress.png'; + +export default { + title: 'Plugins/Protect/AdminSectionHero', + component: AdminSectionHero, +}; + +export const Default = args => ; +Default.args = { + main: ( + <> + + { 'No threats found' } + + { 'Most recent results' } + + + ), + secondary: , +}; diff --git a/projects/plugins/protect/src/js/components/admin-section-hero/styles.module.scss b/projects/plugins/protect/src/js/components/admin-section-hero/styles.module.scss new file mode 100644 index 0000000000000..5881bcd910045 --- /dev/null +++ b/projects/plugins/protect/src/js/components/admin-section-hero/styles.module.scss @@ -0,0 +1,26 @@ +.header-main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; +} + +.header-secondary { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; +} + +.heading-icon { + margin-left: var( --spacing-base ); // 8px + margin-bottom: calc( var( --spacing-base ) / 2 * -1 ); // -4px +} + +.subheading { + width: fit-content; +} + +.connection-error-col { + margin-top: calc( var( --spacing-base ) * 3 + 1px ); // 25px +} \ No newline at end of file diff --git a/projects/plugins/protect/src/js/components/diff-viewer/index.jsx b/projects/plugins/protect/src/js/components/diff-viewer/index.jsx deleted file mode 100644 index 2f26a4ae9c19b..0000000000000 --- a/projects/plugins/protect/src/js/components/diff-viewer/index.jsx +++ /dev/null @@ -1,156 +0,0 @@ -import { parsePatch } from 'diff/lib/patch/parse'; -import { Fragment } from 'react'; -import styles from './styles.module.scss'; - -const decompose = path => { - const lastSlash = path.lastIndexOf( '/' ); - - return lastSlash > -1 ? [ path.slice( 0, lastSlash ), path.slice( lastSlash ) ] : [ '', path ]; -}; - -/** - * Uses a heuristic to return proper file name indicators - * - * This function lists the filenames for the left and right - * side of the diff in a single string. - * - * It searches for the longest shared prefix and returns - * whatever remains after that. If the paths are identical - * it only returns a single filename as we have detected - * that the diff compares changes to only one file. - * - * An exception is made for `a/` and `b/` prefixes often - * added by `git` and other utilities to separate the left - * from the right when looking at the contents of a single - * file over time. - * - * @param {object} options - deconstructed argument - * @param {string} options.oldFileName - filename of left contents - * @param {string} options.newFileName - filename of right contents - * @return {window.Element} description of the file or files in the diff - */ -const filename = ( { oldFileName, newFileName } ) => { - // if we think the diff utility added a bogus - // prefix then cut it off - const isLikelyPrefixed = - 'a' === oldFileName[ 0 ] && - '/' === oldFileName[ 1 ] && - 'b' === newFileName[ 0 ] && - '/' === newFileName[ 1 ]; - - const [ prev, next ] = isLikelyPrefixed - ? [ oldFileName.slice( 2 ), newFileName.slice( 2 ) ] - : [ oldFileName, newFileName ]; - - if ( prev === next ) { - const [ base, name ] = decompose( prev ); - - // it's the same file, return the single name - return ( - - { base && { base } } - { name } - - ); - } - - // find the longest shared path prefix - const length = Math.max( prev.length, next.length ); - for ( let i = 0, slash = 0; i < length; i++ ) { - if ( prev[ i ] === '/' && next[ i ] === '/' ) { - slash = i; - } - - if ( prev[ i ] !== next[ i ] ) { - return ( - - { slash !== 0 && ( - - { prev.slice( 0, slash ) } - - ) } - { prev.slice( slash ) } - { ' → ' } - { slash !== 0 && ( - - { next.slice( 0, slash ) } - - ) } - { next.slice( slash ) } - - ); - } - } - - // otherwise we have no shared prefix - const [ prevBase, prevName ] = decompose( prev ); - const [ nextBase, nextName ] = decompose( next ); - - return ( - - { prevBase && { prevBase } } - { prevName } - { ' → ' } - { nextBase && { nextBase } } - { nextName } - - ); -}; - -export const DiffViewer = ( { diff } ) => ( -
    - { parsePatch( diff ).map( ( file, fileIndex ) => ( - -
    - { filename( file ) } -
    -
    -
    - { file.hunks.map( ( hunk, hunkIndex ) => { - let lineOffset = 0; - return hunk.lines.map( ( line, index ) => ( -
    - { line[ 0 ] === '+' ? '\u00a0' : hunk.oldStart + lineOffset++ } -
    - ) ); - } ) } -
    -
    - { file.hunks.map( ( hunk, hunkIndex ) => { - let lineOffset = 0; - return hunk.lines.map( ( line, index ) => ( -
    - { line[ 0 ] === '-' ? '\u00a0' : hunk.newStart + lineOffset++ } -
    - ) ); - } ) } -
    -
    - { file.hunks.map( ( hunk, hunkIndex ) => - hunk.lines.map( ( line, index ) => { - const output = line.slice( 1 ).replace( /^\s*$/, '\u00a0' ); - const key = `${ hunkIndex }-${ index }`; - - switch ( line[ 0 ] ) { - case ' ': - return
    { output }
    ; - - case '-': - return { output }; - - case '+': - return { output }; - - default: - return undefined; - } - } ) - ) } -
    -
    -
    - ) ) } -
    -); - -export default DiffViewer; diff --git a/projects/plugins/protect/src/js/components/diff-viewer/stories/index.stories.jsx b/projects/plugins/protect/src/js/components/diff-viewer/stories/index.stories.jsx deleted file mode 100644 index 22968cb1e33f8..0000000000000 --- a/projects/plugins/protect/src/js/components/diff-viewer/stories/index.stories.jsx +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable react/react-in-jsx-scope */ -import React from 'react'; -import DiffViewer from '../index.jsx'; - -export default { - title: 'Plugins/Protect/Diff Viewer', - component: DiffViewer, -}; - -const diff = `index 51455bdb14..bc0622d001 100644 ---- a/circle.yml -+++ b/circle.yml -@@ -1,6 +1,6 @@ - machine: - node: -- version: 8.9.4 -+ version: 8.11.0 - test: - pre: - - ? |`; - -export const Default = args => ; -Default.args = { - diff, -}; diff --git a/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx b/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx new file mode 100644 index 0000000000000..f199fa92d9f29 --- /dev/null +++ b/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx @@ -0,0 +1,51 @@ +import { Text } from '@automattic/jetpack-components'; +import { __ } from '@wordpress/i18n'; +import { Icon, warning } from '@wordpress/icons'; +import inProgressImage from '../../../../assets/images/in-progress.png'; +import AdminSectionHero from '../admin-section-hero'; +import ScanNavigation from '../scan-navigation'; +import styles from './styles.module.scss'; + +interface ErrorAdminSectionHeroProps { + baseErrorMessage: string; + errorMessage?: string; + errorCode?: string; +} + +const ErrorAdminSectionHero: React.FC< ErrorAdminSectionHeroProps > = ( { + baseErrorMessage, + errorMessage, + errorCode, +} ) => { + let displayErrorMessage = errorMessage ? `${ errorMessage } (${ errorCode }).` : baseErrorMessage; + displayErrorMessage += ' ' + __( 'Try again in a few minutes.', 'jetpack-protect' ); + + return ( + + +
    + + { __( 'An error occurred', 'jetpack-protect' ) } +
    +
    + + { displayErrorMessage } + +
    + +
    + + } + secondary={ +
    + +
    + } + preserveSecondaryOnMobile={ false } + /> + ); +}; + +export default ErrorAdminSectionHero; diff --git a/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss b/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss new file mode 100644 index 0000000000000..3ab653757619a --- /dev/null +++ b/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss @@ -0,0 +1,27 @@ +.heading { + display: flex; + align-items: center; +} + +.warning { + width: 54px; + height: 54px; + fill: var( --jp-red ); + margin-left: -8px; + margin-right: var( --spacing-base ); // 8px +} + +.illustration { + display: flex; + align-items: center; + height: 100%; + img { + // let's fit images + object-fit: cover; + width: 100%; + } +} + +.scan-navigation { + margin-top: calc( var( --spacing-base ) * 3 ); // 24px +} \ No newline at end of file diff --git a/projects/plugins/protect/src/js/components/error-section/index.tsx b/projects/plugins/protect/src/js/components/error-section/index.tsx deleted file mode 100644 index b94c0e80a17db..0000000000000 --- a/projects/plugins/protect/src/js/components/error-section/index.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { H3, Text } from '@automattic/jetpack-components'; -import { __ } from '@wordpress/i18n'; -import React from 'react'; -import inProgressImage from '../../../../assets/images/in-progress.png'; -import AlertSVGIcon from '../alert-icon'; -import SeventyFiveLayout from '../seventy-five-layout'; -import styles from './styles.module.scss'; - -type ErrorScreenProps = { - baseErrorMessage: string; - errorMessage: string; - errorCode: string; -}; - -/** - * Protect Logo component - * - * @param {object} props - Component props - * @param {string} props.baseErrorMessage - Base error message. - * @param {string} props.errorMessage - Error message. - * @param {string} props.errorCode - Error code. - * @return {React.ReactElement} Component template - */ -export default function ErrorScreen( { - baseErrorMessage = '', - errorMessage = '', - errorCode = '', -}: ErrorScreenProps ): React.ReactElement { - let displayErrorMessage = errorMessage ? `${ errorMessage } (${ errorCode }).` : baseErrorMessage; - displayErrorMessage += ' ' + __( 'Try again in a few minutes.', 'jetpack-protect' ); - - return ( - - -

    { baseErrorMessage }

    - { displayErrorMessage } - - } - secondary={ -
    - -
    - } - preserveSecondaryOnMobile={ false } - >
    - ); -} diff --git a/projects/plugins/protect/src/js/components/error-section/stories/index.stories.tsx b/projects/plugins/protect/src/js/components/error-section/stories/index.stories.tsx deleted file mode 100644 index aeb721ca7cf07..0000000000000 --- a/projects/plugins/protect/src/js/components/error-section/stories/index.stories.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import ErrorScreen from '..'; - -export default { - title: 'Plugins/Protect/ErrorScreen', - component: ErrorScreen, -}; - -const Template = args => ; - -export const _default = Template.bind( {} ); -_default.args = { - baseErrorMessage: 'An error occurred', - errorMessage: 'Error message', - errorCode: '500', -}; diff --git a/projects/plugins/protect/src/js/components/error-section/styles.module.scss b/projects/plugins/protect/src/js/components/error-section/styles.module.scss deleted file mode 100644 index 66f9763154bdc..0000000000000 --- a/projects/plugins/protect/src/js/components/error-section/styles.module.scss +++ /dev/null @@ -1,3 +0,0 @@ -.main-content { - padding: calc( var( --spacing-base ) * 7 ) 0; // 56px | 0px -} \ No newline at end of file diff --git a/projects/plugins/protect/src/js/components/firewall-footer/stories/broken/index.stories.jsx b/projects/plugins/protect/src/js/components/firewall-footer/stories/broken/index.stories.jsx deleted file mode 100644 index 89294777ff51d..0000000000000 --- a/projects/plugins/protect/src/js/components/firewall-footer/stories/broken/index.stories.jsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import FirewallFooter from '../index.jsx'; - -export default { - title: 'Plugins/Protect/Firewall Footer', - component: FirewallFooter, -}; - -export const Default = args => { - return ; -}; diff --git a/projects/plugins/protect/src/js/components/firewall-footer/styles.module.scss b/projects/plugins/protect/src/js/components/firewall-footer/styles.module.scss deleted file mode 100644 index 000cc085e7763..0000000000000 --- a/projects/plugins/protect/src/js/components/firewall-footer/styles.module.scss +++ /dev/null @@ -1,30 +0,0 @@ -.footer-checkbox { - display: flex; - align-items: center; - - & input[type=checkbox]:checked { - background: var( --jp-green-40 ); - border-color: var( --jp-green-40 ); - } - - & input[type=checkbox]:indeterminate { - background: var( --jp-green-40 ); - border-color: var( --jp-green-40 ); - } - - & input[type=checkbox]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var( --jp-green-40 ); - } -} - -.standalone-mode-section, .share-data-section { - margin-top: calc( var( --spacing-base ) * 7 ); // 56px - margin-bottom: calc( var( --spacing-base ) * 7 ); // 56px -} - -@media ( max-width: 599px ) { - - .share-data-section { - margin-top: 0; - } -} diff --git a/projects/plugins/protect/src/js/components/firewall-header/firewall-subheading.jsx b/projects/plugins/protect/src/js/components/firewall-header/firewall-subheading.jsx deleted file mode 100644 index 51cc0cefd9c01..0000000000000 --- a/projects/plugins/protect/src/js/components/firewall-header/firewall-subheading.jsx +++ /dev/null @@ -1,115 +0,0 @@ -import { Text, Button } from '@automattic/jetpack-components'; -import { __ } from '@wordpress/i18n'; -import { help } from '@wordpress/icons'; -import { useCallback } from 'react'; -import useAnalyticsTracks from '../../hooks/use-analytics-tracks'; -import usePlan from '../../hooks/use-plan'; -import useWafData from '../../hooks/use-waf-data'; -import IconTooltip from '../icon-tooltip'; -import styles from './styles.module.scss'; - -const UpgradePrompt = () => { - const { recordEvent } = useAnalyticsTracks(); - const { adminUrl } = window.jetpackProtectInitialState || {}; - const firewallUrl = adminUrl + '#/firewall'; - const { upgradePlan } = usePlan( { redirectUrl: firewallUrl } ); - - const { - config: { automaticRulesAvailable }, - } = useWafData(); - - const getScan = useCallback( () => { - recordEvent( 'jetpack_protect_waf_header_get_scan_link_click' ); - upgradePlan(); - }, [ recordEvent, upgradePlan ] ); - - return ( - - ); -}; - -const FirewallSubheadingContent = ( { className, text = '', popover = false } ) => { - return ( -
    - - { text } - - { popover && ( - - ) } -
    - ); -}; - -const FirewallSubheading = ( { - jetpackWafIpBlockListEnabled, - jetpackWafIpAllowListEnabled, - hasPlan, - automaticRulesAvailable, - jetpackWafAutomaticRules, - bruteForceProtectionIsEnabled, - wafSupported, -} ) => { - const allowOrBlockListEnabled = jetpackWafIpBlockListEnabled || jetpackWafIpAllowListEnabled; - const allRules = wafSupported && jetpackWafAutomaticRules && allowOrBlockListEnabled; - const automaticRules = wafSupported && jetpackWafAutomaticRules && ! allowOrBlockListEnabled; - const manualRules = wafSupported && ! jetpackWafAutomaticRules && allowOrBlockListEnabled; - const noRules = wafSupported && ! jetpackWafAutomaticRules && ! allowOrBlockListEnabled; - - return ( - <> -
    - { wafSupported && bruteForceProtectionIsEnabled && ( - - ) } - { noRules && ( - - ) } - { automaticRules && ( - - ) } - { manualRules && ( - - ) } - { allRules && ( - - ) } -
    - { ! hasPlan && wafSupported && } - - ); -}; - -export default FirewallSubheading; diff --git a/projects/plugins/protect/src/js/components/firewall-header/index.jsx b/projects/plugins/protect/src/js/components/firewall-header/index.jsx deleted file mode 100644 index 09ee0eb92074a..0000000000000 --- a/projects/plugins/protect/src/js/components/firewall-header/index.jsx +++ /dev/null @@ -1,155 +0,0 @@ -import { AdminSectionHero, Container, Col, Text, H3, Status } from '@automattic/jetpack-components'; -import { Spinner } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; -import usePlan from '../../hooks/use-plan'; -import useWafData from '../../hooks/use-waf-data'; -import FirewallStatCards from './firewall-statcards'; -import FirewallSubheading from './firewall-subheading'; -import styles from './styles.module.scss'; - -const FirewallHeader = ( { - status, - hasPlan, - automaticRulesAvailable, - jetpackWafIpBlockListEnabled, - jetpackWafIpAllowListEnabled, - jetpackWafAutomaticRules, - bruteForceProtectionIsEnabled, - wafSupported, - currentDayStats, - thirtyDaysStats, - standaloneMode, -} ) => { - return ( - - - - { 'on' === status && ( - <> - { ' ' } -

    - { ! wafSupported && __( 'Brute force protection is active', 'jetpack-protect' ) } - { wafSupported && - ( jetpackWafAutomaticRules - ? __( 'Automatic firewall is on', 'jetpack-protect' ) - : __( - 'Firewall is on', - 'jetpack-protect', - /* dummy arg to avoid bad minification */ 0 - ) ) } -

    - - - ) } - { 'off' === status && ( - <> - -

    - { ! wafSupported && __( 'Brute force protection is disabled', 'jetpack-protect' ) } - { wafSupported && - ( automaticRulesAvailable - ? __( 'Automatic firewall is off', 'jetpack-protect' ) - : __( - 'Firewall is off', - 'jetpack-protect', - /* dummy arg to avoid bad minification */ 0 - ) ) } -

    - - - ) } - { 'loading' === status && ( - <> - -

    - { __( 'Automatic firewall is being set up', 'jetpack-protect' ) } -

    - - { __( 'Please wait…', 'jetpack-protect' ) } - - - ) } - - - { wafSupported && ( - - ) } - -
    -
    - ); -}; - -const ConnectedFirewallHeader = () => { - const { - config: { - jetpackWafAutomaticRules, - jetpackWafIpBlockListEnabled, - jetpackWafIpAllowListEnabled, - standaloneMode, - automaticRulesAvailable, - bruteForceProtection, - }, - isToggling, - wafSupported, - stats, - isEnabled, - } = useWafData(); - const { hasPlan } = usePlan(); - const isSupportedWafFeatureEnabled = wafSupported ? isEnabled : bruteForceProtection; - const currentStatus = isSupportedWafFeatureEnabled ? 'on' : 'off'; - const { currentDay: currentDayBlockCount = 0, thirtyDays: thirtyDaysBlockCounts = 0 } = - stats?.blockedRequests || {}; - - return ( - - ); -}; - -export { FirewallHeader }; - -export default ConnectedFirewallHeader; diff --git a/projects/plugins/protect/src/js/components/firewall-header/stories/broken/index.stories.jsx b/projects/plugins/protect/src/js/components/firewall-header/stories/broken/index.stories.jsx deleted file mode 100644 index 7012e9c02321c..0000000000000 --- a/projects/plugins/protect/src/js/components/firewall-header/stories/broken/index.stories.jsx +++ /dev/null @@ -1,93 +0,0 @@ -import React from 'react'; -import { FirewallHeader } from '../../index.jsx'; - -export default { - title: 'Plugins/Protect/Firewall Header', - component: FirewallHeader, -}; - -const Template = args => ; - -export const FirewallOnFree = Template.bind( {} ); -FirewallOnFree.args = { - status: 'on', - hasPlan: false, - automaticRulesAvailable: false, - jetpackWafIpList: true, - jetpackWafAutomaticRules: false, - bruteForceProtectionIsEnabled: true, - wafSupported: true, - currentDayStats: 0, - thirtyDaysStats: 0, - standaloneMode: false, -}; - -export const FirewallOffFree = Template.bind( {} ); -FirewallOffFree.args = { - status: 'off', - hasPlan: false, - automaticRulesAvailable: false, - jetpackWafIpList: false, - jetpackWafAutomaticRules: false, - bruteForceProtectionIsEnabled: false, - wafSupported: true, - currentDayStats: 0, - thirtyDaysStats: 0, - standaloneMode: false, -}; - -export const FirewallOnPaid = Template.bind( {} ); -FirewallOnPaid.args = { - status: 'on', - hasPlan: true, - automaticRulesAvailable: true, - jetpackWafIpList: true, - jetpackWafAutomaticRules: true, - bruteForceProtectionIsEnabled: true, - wafSupported: true, - currentDayStats: 100, - thirtyDaysStats: 30000, - standaloneMode: false, -}; - -export const FirewallOffPaid = Template.bind( {} ); -FirewallOffPaid.args = { - status: 'off', - hasPlan: true, - automaticRulesAvailable: true, - jetpackWafIpList: false, - jetpackWafAutomaticRules: false, - bruteForceProtectionIsEnabled: false, - wafSupported: true, - currentDayStats: 0, - thirtyDaysStats: 0, - standaloneMode: false, -}; - -export const FirewallOnStandalone = Template.bind( {} ); -FirewallOnStandalone.args = { - status: 'on', - hasPlan: true, - automaticRulesAvailable: true, - jetpackWafIpList: true, - jetpackWafAutomaticRules: true, - bruteForceProtectionIsEnabled: true, - wafSupported: true, - currentDayStats: 100, - thirtyDaysStats: 30000, - standaloneMode: true, -}; - -export const FirewallLoading = Template.bind( {} ); -FirewallLoading.args = { - status: 'loading', - hasPlan: true, - automaticRulesAvailable: true, - jetpackWafIpList: false, - jetpackWafAutomaticRules: false, - bruteForceProtectionIsEnabled: false, - wafSupported: true, - currentDayStats: 0, - thirtyDaysStats: 0, - standaloneMode: false, -}; diff --git a/projects/plugins/protect/src/js/components/firewall-header/styles.module.scss b/projects/plugins/protect/src/js/components/firewall-header/styles.module.scss deleted file mode 100644 index ef16a23602243..0000000000000 --- a/projects/plugins/protect/src/js/components/firewall-header/styles.module.scss +++ /dev/null @@ -1,96 +0,0 @@ -svg.spinner { - width: 32px; - height: 32px; - margin: 0; - color: var( --jp-black ); -} - -.popover-text { - width: 250px; - padding: calc( var( --spacing-base ) * 2 ); // 16px -} - -.loading-text { - font-size: 18px; -} - -.firewall-header { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - align-items: center; -} - -.firewall-subheading { - display: flex; - justify-content: flex-start; - flex-wrap: wrap; - align-items: center; - - .brute-force-protection-subheading { - margin-right: calc( var( --spacing-base ) / 2 ); // 4px - } - - &__content { - display: flex; - } -} - -.upgrade-button { - margin-top: calc( var( --spacing-base ) * 4 ); // 32px -} - -.stat-card-wrapper { - display: flex; - margin-left: auto; - flex-wrap: wrap; - - >:first-child { - margin-right: calc( var( --spacing-base ) * 3 ); // 24px - } - - .disabled { - opacity: 0.5; - } -} - -.stat-card-icon { - width: 100%; - margin-bottom: calc( var( --spacing-base ) * 3 ); // 24px - display: flex; - justify-content: space-between; - align-items: center; -} - -.stat-card-label { - white-space: nowrap; -} - -@media ( max-width: 1115px ) { - .firewall-header { - display: inline-block; - } - - .stat-card-wrapper { - margin-top: calc( var( --spacing-base ) * 3 ); // 24px - } -} - -@media ( max-width: 599px ) { - .firewall-heading { - width: 90%; - } - - .stat-card-wrapper { - margin-top: calc( var( --spacing-base ) * 3 ); // 24px - - >:first-child { - margin-right: 0; - margin-bottom: var( --spacing-base ); // 8px - } - } - - .stat-card-icon { - margin-bottom: 0; - } -} diff --git a/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx b/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx index 67d5f9894d9a2..7e8113b6f38ab 100644 --- a/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx +++ b/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx @@ -1,10 +1,9 @@ -import { Button, getRedirectUrl, Text } from '@automattic/jetpack-components'; +import { Button, getRedirectUrl, Text, ThreatSeverityBadge } from '@automattic/jetpack-components'; import { createInterpolateElement, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import useIgnoreThreatMutation from '../../data/scan/use-ignore-threat-mutation'; import useModal from '../../hooks/use-modal'; -import ThreatSeverityBadge from '../severity'; import UserConnectionGate from '../user-connection-gate'; import styles from './styles.module.scss'; diff --git a/projects/plugins/protect/src/js/components/logo/index.tsx b/projects/plugins/protect/src/js/components/logo/index.tsx deleted file mode 100644 index 3e02acf06aa5b..0000000000000 --- a/projects/plugins/protect/src/js/components/logo/index.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { Path, SVG } from '@wordpress/components'; -import React from 'react'; - -type HEXColorType = `#${ string }`; - -type LogoProps = { - iconColor: HEXColorType; - color: HEXColorType; -}; - -/** - * Protect Logo component - * - * @param {object} props - Component props - * @param {HEXColorType} props.color - Text color. - * @param {HEXColorType} props.iconColor - Icon color - * @return {React.ReactElement} Component template - */ -export default function Logo( { - iconColor = '#069E08', - color = '#000', -}: LogoProps ): React.ReactElement { - return ( - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/projects/plugins/protect/src/js/components/logo/stories/index.stories.tsx b/projects/plugins/protect/src/js/components/logo/stories/index.stories.tsx deleted file mode 100644 index 164640e03eaec..0000000000000 --- a/projects/plugins/protect/src/js/components/logo/stories/index.stories.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import Logo from '..'; - -export default { - title: 'Plugins/Protect/Logo', - component: Logo, - argTypes: { - iconColor: { - control: { - type: 'color', - }, - }, - color: { - control: { - type: 'color', - }, - }, - }, -}; - -const Template = args => ; - -export const _default = Template.bind( {} ); -_default.args = { - iconColor: '#069E08', - color: '#000', -}; diff --git a/projects/plugins/protect/src/js/components/navigation/badge.jsx b/projects/plugins/protect/src/js/components/navigation/badge.jsx index 2552e5a719940..93ebecf7235ef 100644 --- a/projects/plugins/protect/src/js/components/navigation/badge.jsx +++ b/projects/plugins/protect/src/js/components/navigation/badge.jsx @@ -1,9 +1,10 @@ import { Text } from '@automattic/jetpack-components'; -import { Popover } from '@wordpress/components'; +import { Popover, Spinner } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { Icon, check, info } from '@wordpress/icons'; import PropTypes from 'prop-types'; -import React, { useState, useCallback } from 'react'; +import React, { useState, useCallback, useMemo } from 'react'; +import useScanStatusQuery, { isScanInProgress } from '../../data/scan/use-scan-status-query'; import styles from './styles.module.scss'; /** @@ -50,12 +51,20 @@ const getBadgeElement = ( count, checked ) => { }; const ItemBadge = ( { count, checked } ) => { + const { data: status } = useScanStatusQuery(); + const { popoverText, badgeElement } = getBadgeElement( count, checked ); const [ showPopover, setShowPopover ] = useState( false ); + const inProgress = useMemo( () => isScanInProgress( status ), [ status ] ); + const handleEnter = useCallback( () => { + if ( inProgress ) { + return; + } + setShowPopover( true ); - }, [] ); + }, [ inProgress ] ); const handleOut = useCallback( () => { setShowPopover( false ); @@ -70,7 +79,7 @@ const ItemBadge = ( { count, checked } ) => { onBlur={ popoverText ? handleOut : null } role="presentation" > - { badgeElement } + { ! inProgress ? badgeElement : } { showPopover && ( diff --git a/projects/plugins/protect/src/js/components/navigation/stories/index.stories.jsx b/projects/plugins/protect/src/js/components/navigation/stories/index.stories.jsx deleted file mode 100644 index 8b9d7765da4fb..0000000000000 --- a/projects/plugins/protect/src/js/components/navigation/stories/index.stories.jsx +++ /dev/null @@ -1,64 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { wordpress, plugins, warning, color } from '@wordpress/icons'; -import React, { useState } from 'react'; -import Navigation, { NavigationItem, NavigationGroup } from '..'; - -export default { - title: 'Plugins/Protect/Navigation', - component: Navigation, - parameters: { - layout: 'centered', - }, - decorators: [ - Story => ( -
    - -
    - ), - ], -}; - -export const Default = args => { - const [ selected, setSelectedItem ] = useState( args.selected ); - - return ( - - - - - - - - - - - - - ); -}; -Default.args = { - selected: 'all', -}; diff --git a/projects/plugins/protect/src/js/components/navigation/styles.module.scss b/projects/plugins/protect/src/js/components/navigation/styles.module.scss index c533ae1429600..df9e3ef1f8a25 100644 --- a/projects/plugins/protect/src/js/components/navigation/styles.module.scss +++ b/projects/plugins/protect/src/js/components/navigation/styles.module.scss @@ -1,6 +1,5 @@ .navigation { background-color: var( --jp-white ); - padding: var( --spacing-base ) 0; // 8px box-shadow: 0px 0px 40px rgba(0, 0, 0, 0.08); border-radius: var( --jp-border-radius ); margin: 0; diff --git a/projects/plugins/protect/src/js/components/paid-accordion/index.jsx b/projects/plugins/protect/src/js/components/paid-accordion/index.jsx index e1c612f339afc..d4a6fa5d3f0ba 100644 --- a/projects/plugins/protect/src/js/components/paid-accordion/index.jsx +++ b/projects/plugins/protect/src/js/components/paid-accordion/index.jsx @@ -1,4 +1,9 @@ -import { Spinner, Text, useBreakpointMatch } from '@automattic/jetpack-components'; +import { + Spinner, + Text, + ThreatSeverityBadge, + useBreakpointMatch, +} from '@automattic/jetpack-components'; import { ExternalLink } from '@wordpress/components'; import { dateI18n } from '@wordpress/date'; import { createInterpolateElement } from '@wordpress/element'; @@ -9,7 +14,6 @@ import React, { useState, useCallback, useContext, useMemo } from 'react'; import { PAID_PLUGIN_SUPPORT_URL } from '../../constants'; import useFixers from '../../hooks/use-fixers'; import IconTooltip from '../icon-tooltip'; -import ThreatSeverityBadge from '../severity'; import styles from './styles.module.scss'; // Extract context provider for clarity and reusability diff --git a/projects/plugins/protect/src/js/components/progress-bar/index.jsx b/projects/plugins/protect/src/js/components/progress-bar/index.jsx index 056da369be6eb..5a7393905b885 100644 --- a/projects/plugins/protect/src/js/components/progress-bar/index.jsx +++ b/projects/plugins/protect/src/js/components/progress-bar/index.jsx @@ -10,11 +10,7 @@ import styles from './style.module.scss'; * @param {number} props.value - Progress integer * @return {object} ProgressBar React component. */ -const ProgressBar = ( { className, total = 100, value } ) => { - if ( value == null ) { - return null; - } - +const ProgressBar = ( { className, total = 100, value = 0 } ) => { // The percentage should not be allowed to be more than 100 const progress = Math.min( Math.round( ( value / total ) * 100 ), 100 ); diff --git a/projects/plugins/protect/src/js/components/progress-bar/style.module.scss b/projects/plugins/protect/src/js/components/progress-bar/style.module.scss index c26fc6001cba6..a21649a8c3e83 100644 --- a/projects/plugins/protect/src/js/components/progress-bar/style.module.scss +++ b/projects/plugins/protect/src/js/components/progress-bar/style.module.scss @@ -2,7 +2,7 @@ display: flex; justify-content: space-between; align-items: center; - margin-bottom: calc( var( --spacing-base ) * 3 ); // 24px + margin-bottom: calc( var( --spacing-base ) * 2 ); // 16px &__wrapper { width: 100%; diff --git a/projects/plugins/protect/src/js/components/scan-button/index.jsx b/projects/plugins/protect/src/js/components/scan-button/index.jsx index 4844d9e4c060c..9df71f5984cf1 100644 --- a/projects/plugins/protect/src/js/components/scan-button/index.jsx +++ b/projects/plugins/protect/src/js/components/scan-button/index.jsx @@ -1,10 +1,16 @@ import { Button } from '@automattic/jetpack-components'; import { __ } from '@wordpress/i18n'; -import React, { forwardRef } from 'react'; +import React, { forwardRef, useMemo } from 'react'; +import useScanStatusQuery, { isScanInProgress } from '../../data/scan/use-scan-status-query'; import useStartScanMutator from '../../data/scan/use-start-scan-mutation'; const ScanButton = forwardRef( ( { variant = 'secondary', children, ...props }, ref ) => { const startScanMutation = useStartScanMutator(); + const { data: status } = useScanStatusQuery(); + + const disabled = useMemo( () => { + return startScanMutation.isPending || isScanInProgress( status ); + }, [ startScanMutation.isPending, status ] ); const handleScanClick = () => { return event => { @@ -14,7 +20,13 @@ const ScanButton = forwardRef( ( { variant = 'secondary', children, ...props }, }; return ( - ); diff --git a/projects/plugins/protect/src/js/components/scan-footer/stories/broken/index.stories.jsx b/projects/plugins/protect/src/js/components/scan-footer/stories/broken/index.stories.jsx deleted file mode 100644 index 8d43d7daeec49..0000000000000 --- a/projects/plugins/protect/src/js/components/scan-footer/stories/broken/index.stories.jsx +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable react/react-in-jsx-scope */ -import React from 'react'; -import ScanFooter from '../index.jsx'; - -export default { - title: 'Plugins/Protect/Scan Footer', - component: ScanFooter, -}; - -const FooterTemplate = args => ; -export const Default = FooterTemplate.bind( {} ); diff --git a/projects/plugins/protect/src/js/components/scan-footer/styles.module.scss b/projects/plugins/protect/src/js/components/scan-footer/styles.module.scss deleted file mode 100644 index d4249719742ca..0000000000000 --- a/projects/plugins/protect/src/js/components/scan-footer/styles.module.scss +++ /dev/null @@ -1,4 +0,0 @@ -.product-section, .info-section { - margin-top: calc( var( --spacing-base ) * 7 ); // 56px - margin-bottom: calc( var( --spacing-base ) * 7 ); // 56px -} diff --git a/projects/plugins/protect/src/js/routes/scan/scan-section-navigation.jsx b/projects/plugins/protect/src/js/components/scan-navigation/index.jsx similarity index 61% rename from projects/plugins/protect/src/js/routes/scan/scan-section-navigation.jsx rename to projects/plugins/protect/src/js/components/scan-navigation/index.jsx index 400652f9a248d..e626b6af066c7 100644 --- a/projects/plugins/protect/src/js/routes/scan/scan-section-navigation.jsx +++ b/projects/plugins/protect/src/js/components/scan-navigation/index.jsx @@ -1,36 +1,44 @@ import { __ } from '@wordpress/i18n'; import React, { useCallback } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; -import ButtonGroup from '../../components/button-group'; +import usePlan from '../../hooks/use-plan'; +import ButtonGroup from '../button-group'; /** * Navigation for scan sections. * * @return {React.Element} The React Component. */ -export default function ScanSectionNavigation() { +export default function ScanNavigation() { const navigate = useNavigate(); const location = useLocation(); + const { hasPlan } = usePlan(); + const viewingScanPage = location.pathname === '/scan'; + const viewingHistoryPage = location.pathname.includes( '/scan/history' ); const navigateToScanPage = useCallback( () => navigate( '/scan' ), [ navigate ] ); const navigateToHistoryPage = useCallback( () => navigate( '/scan/history' ), [ navigate ] ); + if ( ! hasPlan || ( ! viewingScanPage && ! viewingHistoryPage ) ) { + return null; + } + return ( -
    + <> { __( 'Scanner', 'jetpack-protect' ) } { __( 'History', 'jetpack-protect' ) } -
    + ); } diff --git a/projects/plugins/protect/src/js/components/seventy-five-layout/index.jsx b/projects/plugins/protect/src/js/components/seventy-five-layout/index.tsx similarity index 56% rename from projects/plugins/protect/src/js/components/seventy-five-layout/index.jsx rename to projects/plugins/protect/src/js/components/seventy-five-layout/index.tsx index 3848d09864ec3..19ee4309e55a5 100644 --- a/projects/plugins/protect/src/js/components/seventy-five-layout/index.jsx +++ b/projects/plugins/protect/src/js/components/seventy-five-layout/index.tsx @@ -1,6 +1,18 @@ import { Container, Col, useBreakpointMatch } from '@automattic/jetpack-components'; import React from 'react'; +// Define the props interface for the SeventyFiveLayout component +interface SeventyFiveLayoutProps { + spacing?: number; + gap?: number; + main: React.ReactNode; + mainClassName?: string; + secondary: React.ReactNode; + secondaryClassName?: string; + preserveSecondaryOnMobile?: boolean; + fluid?: boolean; +} + /** * SeventyFive layout meta component * The component name references to @@ -10,13 +22,27 @@ import React from 'react'; * in large lg viewport size. * * @param {object} props - Component props + * @param {number} props.spacing - Horizontal spacing + * @param {number} props.gap - Horizontal gap * @param {React.ReactNode} props.main - Main section component + * @param {string} props.mainClassName - Main section class name * @param {React.ReactNode} props.secondary - Secondary section component + * @param {string} props.secondaryClassName - Secondary section class name * @param {boolean} props.preserveSecondaryOnMobile - Whether to show secondary section on mobile * @param {boolean} props.fluid - Whether to use fluid layout * @return {React.ReactNode} - React meta-component */ -const SeventyFiveLayout = ( { main, secondary, preserveSecondaryOnMobile = false, fluid } ) => { +const SeventyFiveLayout: React.FC< SeventyFiveLayoutProps > = ( { + spacing = 0, + gap = 0, + main, + mainClassName, + secondary, + secondaryClassName, + preserveSecondaryOnMobile = false, + fluid, +} ) => { + // Ensure the correct typing for useBreakpointMatch const [ isSmall, isLarge ] = useBreakpointMatch( [ 'sm', 'lg' ] ); /* @@ -27,14 +53,14 @@ const SeventyFiveLayout = ( { main, secondary, preserveSecondaryOnMobile = false const hideSecondarySection = ! preserveSecondaryOnMobile && isSmall; return ( - + { ! hideSecondarySection && ( <> - + { main } { isLarge && } - + { secondary } diff --git a/projects/plugins/protect/src/js/components/summary/index.jsx b/projects/plugins/protect/src/js/components/summary/index.jsx deleted file mode 100644 index 3cfa665084fc4..0000000000000 --- a/projects/plugins/protect/src/js/components/summary/index.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import { useBreakpointMatch } from '@automattic/jetpack-components'; -import { dateI18n } from '@wordpress/date'; -import { __, sprintf } from '@wordpress/i18n'; -import React, { useState } from 'react'; -import usePlan from '../../hooks/use-plan'; -import useProtectData from '../../hooks/use-protect-data'; -import ScanSectionHeader from '../../routes/scan/scan-section-header'; -import OnboardingPopover from '../onboarding-popover'; - -const Summary = () => { - const [ isSm ] = useBreakpointMatch( 'sm' ); - const { - counts: { - current: { threats: numThreats }, - }, - lastChecked, - } = useProtectData(); - const { hasPlan } = usePlan(); - - // Convert the last checked UTC date to a local timestamp - const lastCheckedLocalTimestamp = new Date( lastChecked + ' UTC' ).getTime(); - - // Popover anchors - const [ dailyScansPopoverAnchor, setDailyScansPopoverAnchor ] = useState( null ); - - return ( - 0 - ? sprintf( - /* translators: %s: Total number of threats */ - __( '%1$s %2$s found', 'jetpack-protect' ), - numThreats, - numThreats === 1 ? 'threat' : 'threats' - ) - : undefined - } - subtitle={ - <> -
    - { sprintf( - /* translators: %s: Latest check date */ - __( 'Latest results as of %s', 'jetpack-protect' ), - dateI18n( 'F jS', lastCheckedLocalTimestamp ) - ) } -
    - { ! hasPlan && ( - - ) } - - } - /> - ); -}; - -export default Summary; diff --git a/projects/plugins/protect/src/js/components/summary/stories/broken/index.stories.jsx b/projects/plugins/protect/src/js/components/summary/stories/broken/index.stories.jsx deleted file mode 100644 index 45a1779b2468b..0000000000000 --- a/projects/plugins/protect/src/js/components/summary/stories/broken/index.stories.jsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import Summary from '..'; - -export default { - title: 'Plugins/Protect/Summary', - component: Summary, -}; - -export const Default = args => ; diff --git a/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx b/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx index df748f31c2d06..bc5e0107cea80 100644 --- a/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx +++ b/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx @@ -1,8 +1,7 @@ -import { Text } from '@automattic/jetpack-components'; +import { Text, ThreatSeverityBadge } from '@automattic/jetpack-components'; import { __, sprintf } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import React, { useState, useCallback } from 'react'; -import ThreatSeverityBadge from '../severity'; import styles from './styles.module.scss'; //TODO: Move this to WPCom like we did the other messages? diff --git a/projects/plugins/protect/src/js/components/threats-list/empty.jsx b/projects/plugins/protect/src/js/components/threats-list/empty.jsx index 71053bf4dc92c..2d493b11e64a4 100644 --- a/projects/plugins/protect/src/js/components/threats-list/empty.jsx +++ b/projects/plugins/protect/src/js/components/threats-list/empty.jsx @@ -2,6 +2,7 @@ import { H3, Text } from '@automattic/jetpack-components'; import { createInterpolateElement } from '@wordpress/element'; import { sprintf, __, _n } from '@wordpress/i18n'; import { useMemo, useState } from 'react'; +import useScanStatusQuery, { isScanInProgress } from '../../data/scan/use-scan-status-query'; import usePlan from '../../hooks/use-plan'; import useProtectData from '../../hooks/use-protect-data'; import OnboardingPopover from '../onboarding-popover'; @@ -88,6 +89,7 @@ const timeSince = date => { const EmptyList = () => { const { lastChecked } = useProtectData(); const { hasPlan } = usePlan(); + const { data: status } = useScanStatusQuery(); const [ dailyAndManualScansPopoverAnchor, setDailyAndManualScansPopoverAnchor ] = useState( null ); @@ -103,28 +105,32 @@ const EmptyList = () => { { __( "Don't worry about a thing", 'jetpack-protect' ) } - { createInterpolateElement( - sprintf( - // translators: placeholder is the amount of time since the last scan, i.e. "5 minutes ago". - __( - 'The last Protect scan ran %s and everything looked great.', - 'jetpack-protect' - ), - timeSinceLastScan - ), - { - strong: , - } - ) } + { timeSinceLastScan + ? createInterpolateElement( + sprintf( + // translators: placeholder is the amount of time since the last scan, i.e. "5 minutes ago". + __( + 'The last Protect scan ran %s and everything looked great.', + 'jetpack-protect' + ), + timeSinceLastScan + ), + { + strong: , + } + ) + : __( 'No threats have been detected by the current scan.', 'jetpack-protect' ) } { hasPlan && ( <> -