From c6b2c65e26c92c4fc99b7d496e31194a39d2f716 Mon Sep 17 00:00:00 2001 From: Louis Laugesen Date: Sat, 21 Dec 2024 01:30:49 +1100 Subject: [PATCH] Paid stats: sync wpcom site features (#40421) * Sync wpcom site features for paid stats * changelog * Sync with D167647-code * Re-sync after deploy * Fix constant declaration --------- Co-authored-by: Rafael Agostini --- .../changelog/update-stats-wpcom-features | 5 +++ .../wpcom-features/class-wpcom-features.php | 36 ++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 projects/plugins/wpcomsh/changelog/update-stats-wpcom-features diff --git a/projects/plugins/wpcomsh/changelog/update-stats-wpcom-features b/projects/plugins/wpcomsh/changelog/update-stats-wpcom-features new file mode 100644 index 0000000000000..6ea8667450618 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/update-stats-wpcom-features @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Sync changes from D167647 + + diff --git a/projects/plugins/wpcomsh/wpcom-features/class-wpcom-features.php b/projects/plugins/wpcomsh/wpcom-features/class-wpcom-features.php index 94cb012d150b3..d6ee7cf00c60f 100644 --- a/projects/plugins/wpcomsh/wpcom-features/class-wpcom-features.php +++ b/projects/plugins/wpcomsh/wpcom-features/class-wpcom-features.php @@ -432,6 +432,8 @@ class WPCOM_Features { public const SPACE_UPGRADED_STORAGE = 'space-upgraded-storage'; public const SSH = 'ssh'; public const STAGING_SITES = 'staging-sites'; + public const STATS_BASIC_TEMP = 'stats-basic'; + public const STATS_COMMERCIAL = 'stats-commercial'; public const STATS_FREE = 'stats-free'; public const STATS_PAID = 'stats-paid'; public const STUDIO_SYNC = 'studio-sync'; @@ -1146,23 +1148,49 @@ class WPCOM_Features { self::WPCOM_ECOMMERCE_TRIAL_PLANS, ), ), + // Gives near full access to all stats features. All features except new commercial level modules like UTM and device stats. self::STATS_FREE => array( self::JETPACK_STATS_PLANS, self::JETPACK_GROWTH_PLANS, - ), - self::STATS_PAID => array( + // Provides legacy access for free and personal sites created before 2024-01-09. + // Can be removed once we are ready to paywall all free and/or old personal sites. array( 'before' => '2024-01-09', - self::WPCOM_PERSONAL_PLANS, + self::WPCOM_PERSONAL_AND_HIGHER_PLANS, + self::WPCOM_ALL_SITES, + ), + ), + // Provides limited stats for free and personal sites created before 2024-12-06. + // Features: Posts/Locations/Emails/File downloads + // Can be removed once we are ready to paywall all free sites. + self::STATS_BASIC_TEMP => array( + array( + 'before' => '2024-12-12', self::WPCOM_ALL_SITES, ), + ), + // Provides personal sites and higher access to all stats features except commercial level modules. + // Features: Posts/Locations/Emails/File downloads/Referrers/Clicks + self::STATS_PAID => array( + self::WPCOM_PERSONAL_AND_HIGHER_PLANS, self::WP_P2_PLUS_MONTHLY, - self::WPCOM_PREMIUM_AND_HIGHER_PLANS, self::JETPACK_STATS_PWYW, self::JETPACK_STATS_MONTHLY, self::JETPACK_STATS_BI_YEARLY, self::JETPACK_STATS_YEARLY, self::JETPACK_COMPLETE_PLANS, + self::JETPACK_BUSINESS_PLANS, + self::JETPACK_GROWTH_PLANS, + ), + // Provides premium sites and higher access to all stats features. + // Features: STATS_PAID + UTM & Devices modules + self::STATS_COMMERCIAL => array( + self::WPCOM_PREMIUM_AND_HIGHER_PLANS, + self::JETPACK_STATS_MONTHLY, + self::JETPACK_STATS_BI_YEARLY, + self::JETPACK_STATS_YEARLY, + self::JETPACK_COMPLETE_PLANS, + self::JETPACK_BUSINESS_PLANS, self::JETPACK_GROWTH_PLANS, ), self::STUDIO_SYNC => array(