Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.18% covered (success)
96.18%
126 / 131
83.33% covered (warning)
83.33%
10 / 12
CRAP
0.00% covered (danger)
0.00%
0 / 1
WPCOM_Features
96.18% covered (success)
96.18%
126 / 131
83.33% covered (warning)
83.33%
10 / 12
82
0.00% covered (danger)
0.00%
0 / 1
 feature_exists
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 in_array_recursive
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
5
 has_feature
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
8
 add_free_plan_purchase
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 resolve_blog_id
60.00% covered (warning)
60.00%
3 / 5
0.00% covered (danger)
0.00%
0 / 1
3.58
 site_has_sticker
40.00% covered (danger)
40.00%
2 / 5
0.00% covered (danger)
0.00%
0 / 1
10.40
 is_legacy_gating_site
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
1 / 1
8
 get_map_sticker_slugs
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
1 / 1
7
 get_cohort_sensitive_features
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
6
 get_site_gating_cache_suffix
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
4
 purchase_in_products_map
100.00% covered (success)
100.00%
51 / 51
100.00% covered (success)
100.00%
1 / 1
33
 get_feature_slugs
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * THIS FILE EXISTS VERBATIM IN WPCOM AND WPCOMSH.
4 *
5 * DANGER DANGER DANGER!!!
6 * If you make any changes to this class you must MANUALLY update this file in both WPCOM and WPCOMSH.
7 *
8 * @package WPCOM_Features
9 */
10
11/**
12 * Map features to purchases.
13 */
14class WPCOM_Features {
15
16    /**
17     * Key used to exclude plans from features.
18     */
19    public const EXCLUDE_PLANS = 'exclude_plans';
20
21    /**
22     * Sticker marking a site that has switched from legacy features to 2026 feature gating
23     * after plan upgrade/downgrade. One-way change.
24     */
25    public const STICKER_FEATURE_GATING_2026 = 'feature-gating-2026';
26
27    /**
28     * Sticker marking a site that stays on the pre-2026 feature gating regardless of its blog ID.
29     * Only needed for staging sites since they could be created after the cutoff.
30     */
31    public const STICKER_PRE_FEATURE_GATING_2026 = 'pre-feature-gating-2026';
32
33    /**
34     * The original pricing-differentiation sticker. Used for identifying sites with new features
35     * which were created before the cutoff, as part of an experiment.
36     */
37    public const STICKER_GATING_BUSINESS_Q1 = 'gating-business-q1';
38
39    /**
40     * Sticker marking a site in the Woo bundle pricing experiment. Its paid Business or Commerce
41     * plan then includes the bundled Woo extensions.
42     */
43    public const STICKER_WOO_BUNDLE_EXPERIMENT = 'woo-bundle-experiment';
44
45    /**
46     * First blog ID guaranteed to carry `gating-business-q1` from creation, after the universal
47     * creation hook was deployed. Using blog ID since we can't get
48     * the blog creation date on WPCloud sites.
49     */
50    public const FEATURE_GATING_2026_CUTOFF_BLOG_ID = 256966305;
51
52    /*
53     * Private const for every mapped purchase, sorted by product_id.
54     */
55    private const SPACE_1GB                                   = 'wordpress_com_1gb_space_addon_yearly';
56    private const SPACE_10GB                                  = '1gb_space_upgrade'; // 9
57    private const SPACE_25GB                                  = '5gb_space_upgrade'; // 10
58    private const SPACE_50GB                                  = '10gb_space_upgrade'; // 11
59    private const NO_ADS                                      = 'no-adverts/no-adverts.php'; // 12
60    private const WPCOM_VIDEOPRESS                            = 'videopress'; // 15
61    private const SPACE_100GB                                 = '50gb_space_upgrade'; // 19
62    private const SPACE_200GB                                 = '100gb_space_upgrade'; // 20
63    private const SPACE_3GB                                   = '3gb_space_upgrade'; // 21
64    private const WPCOM_CUSTOM_DESIGN                         = 'custom-design'; // 45
65    private const WPCOM_VIDEOPRESS_PRO                        = 'videopress-pro'; // 47
66    private const WPCOM_UNLIMITED_THEMES                      = 'unlimited_themes'; // 49
67    private const GAPPS                                       = 'gapps'; // 69
68    private const GAPPS_UNLIMITED                             = 'gapps_unlimited'; // 70
69    private const WP_TITAN_MAIL_MONTHLY                       = 'wp_titan_mail_monthly'; // 400
70    private const WP_TITAN_MAIL_YEARLY                        = 'wp_titan_mail_yearly'; // 401
71    private const WP_TITAN_MAIL_PREMIUM_MONTHLY               = 'wp_titan_mail_premium_monthly'; // 402
72    private const WP_TITAN_MAIL_PREMIUM_YEARLY                = 'wp_titan_mail_premium_yearly'; // 403
73    private const WP_TITAN_MAIL_ULTRA_MONTHLY                 = 'wp_titan_mail_ultra_monthly'; // 404
74    private const WP_TITAN_MAIL_ULTRA_YEARLY                  = 'wp_titan_mail_ultra_yearly'; // 405
75    private const WP_GOOGLE_WORKSPACE_BUSINESS_STARTER_YEARLY = 'wp_google_workspace_business_starter_yearly'; // 690
76    private const WPCOM_SEARCH                                = 'wpcom_search'; // 800
77    private const WPCOM_SEARCH_MONTHLY                        = 'wpcom_search_monthly'; // 801
78    private const YOAST_PREMIUM                               = 'yoast_premium'; // 900
79    private const VALUE_BUNDLE                                = 'value_bundle'; // 1003
80    private const BUNDLE_PRO                                  = 'bundle_pro'; // 1004
81    private const BUNDLE_SUPER                                = 'bundle_super'; // 1005
82    private const BUNDLE_ENTERPRISE                           = 'wpcom-enterprise'; // 1007
83    private const BUSINESS_BUNDLE                             = 'business-bundle'; // 1008
84    private const PERSONAL_BUNDLE                             = 'personal-bundle'; // 1009
85    private const BLOGGER_BUNDLE                              = 'blogger-bundle'; // 1010
86    private const ECOMMERCE_BUNDLE                            = 'ecommerce-bundle'; // 1011
87    private const VALUE_BUNDLE_MONTHLY                        = 'value_bundle_monthly'; // 1013
88    private const PRO_PLAN_MONTHLY                            = 'pro-plan-monthly'; // 1034
89    private const BUSINESS_BUNDLE_MONTHLY                     = 'business-bundle-monthly'; // 1018
90    private const PERSONAL_BUNDLE_MONTHLY                     = 'personal-bundle-monthly'; // 1019
91    private const ECOMMERCE_BUNDLE_MONTHLY                    = 'ecommerce-bundle-monthly'; // 1021
92    private const VALUE_BUNDLE_2Y                             = 'value_bundle-2y'; // 1023
93    private const BUSINESS_BUNDLE_2Y                          = 'business-bundle-2y'; // 1028
94    private const PERSONAL_BUNDLE_2Y                          = 'personal-bundle-2y'; // 1029
95    private const BLOGGER_BUNDLE_2Y                           = 'blogger-bundle-2y'; // 1030
96    private const ECOMMERCE_BUNDLE_2Y                         = 'ecommerce-bundle-2y'; // 1031
97    private const VALUE_BUNDLE_3Y                             = 'value_bundle-3y'; // 1043
98    private const BUSINESS_BUNDLE_3Y                          = 'business-bundle-3y'; // 1048
99    private const PERSONAL_BUNDLE_3Y                          = 'personal-bundle-3y'; // 1049
100    private const ECOMMERCE_BUNDLE_3Y                         = 'ecommerce-bundle-3y'; // 1051
101    private const PRO_PLAN_2Y                                 = 'pro-plan-2y'; // 1035
102    private const PRO_PLAN                                    = 'pro-plan'; // 1032
103    private const STARTER_PLAN                                = 'starter-plan'; // 1033
104    private const WP_P2_PLUS_MONTHLY                          = 'wp_p2_plus_monthly'; // 1040
105    private const ECOMMERCE_TRIAL_BUNDLE_MONTHLY              = 'ecommerce-trial-bundle-monthly'; // 1052
106    private const WPCOM_WOOEXPRESS_MEDIUM_BUNDLE_MONTHLY      = 'wooexpress-medium-bundle-monthly'; // 1053
107    private const WPCOM_WOOEXPRESS_MEDIUM_BUNDLE_YEARLY       = 'wooexpress-medium-bundle-yearly'; // 1055
108    private const WPCOM_WOOEXPRESS_SMALL_BUNDLE_MONTHLY       = 'wooexpress-small-bundle-monthly'; // 1054
109    private const WPCOM_WOOEXPRESS_SMALL_BUNDLE_YEARLY        = 'wooexpress-small-bundle-yearly'; // 1056
110    private const WPCOM_MIGRATION_TRIAL_BUNDLE_MONTHLY        = 'wp_bundle_migration_trial_monthly'; // 1057
111    private const WPCOM_HOSTING_TRIAL_BUNDLE_MONTHLY          = 'wp_bundle_hosting_trial_monthly'; // 1058
112    private const WPCOM_STAGING_PRODUCT                       = 'wp_staging_site_lifetime'; // 1060
113    private const WPCOM_HUNDRED_YEAR_BUNDLE                   = 'wp_com_hundred_year_bundle_centennially'; // 1061
114    private const STUDENT_BUNDLE                              = 'wp_bundle_student_yearly'; // 1090
115    private const JETPACK_PREMIUM                             = 'jetpack_premium'; // 2000
116    private const JETPACK_BUSINESS                            = 'jetpack_business'; // 2001
117    private const JETPACK_FREE                                = 'jetpack_free'; // 2002
118    private const JETPACK_PREMIUM_MONTHLY                     = 'jetpack_premium_monthly'; // 2003
119    private const JETPACK_BUSINESS_MONTHLY                    = 'jetpack_business_monthly'; // 2004
120    private const JETPACK_PERSONAL                            = 'jetpack_personal'; // 2005
121    private const JETPACK_PERSONAL_MONTHLY                    = 'jetpack_personal_monthly'; // 2006
122    private const JETPACK_SECURITY_DAILY                      = 'jetpack_security_daily'; // 2010
123    private const JETPACK_SECURITY_DAILY_MONTHLY              = 'jetpack_security_daily_monthly'; // 2011
124    private const JETPACK_SECURITY_REALTIME                   = 'jetpack_security_realtime'; // 2012
125    private const JETPACK_SECURITY_REALTIME_MONTHLY           = 'jetpack_security_realtime_monthly'; // 2013
126    private const JETPACK_GROWTH_BI_YEARLY                    = 'jetpack_growth_bi_yearly'; // 2023
127    private const JETPACK_GROWTH_YEARLY                       = 'jetpack_growth_yearly'; // 2022
128    private const JETPACK_GROWTH_MONTHLY                      = 'jetpack_growth_monthly'; // 2021
129    private const JETPACK_COMPLETE_BI_YEARLY                  = 'jetpack_complete_bi_yearly'; // 2035
130    private const JETPACK_COMPLETE                            = 'jetpack_complete'; // 2014
131    private const JETPACK_COMPLETE_MONTHLY                    = 'jetpack_complete_monthly'; // 2015
132    private const JETPACK_PRO_BI_YEARLY                       = 'jetpack_pro_bi_yearly'; // 2026
133    private const JETPACK_PRO_YEARLY                          = 'jetpack_pro_yearly'; // 2025
134    private const JETPACK_PRO_MONTHLY                         = 'jetpack_pro_monthly'; // 2024
135    private const JETPACK_SECURITY_T0_YEARLY                  = 'jetpack_security_t0_yearly'; // 10237
136    private const JETPACK_SECURITY_T0_MONTHLY                 = 'jetpack_security_t0_monthly'; // 10238
137    private const JETPACK_SECURITY_T1_BI_YEARLY               = 'jetpack_security_t1_bi_yearly'; // 2034
138    private const JETPACK_SECURITY_T1_YEARLY                  = 'jetpack_security_t1_yearly'; // 2016
139    private const JETPACK_SECURITY_T1_MONTHLY                 = 'jetpack_security_t1_monthly'; // 2017
140    private const JETPACK_SECURITY_T2_YEARLY                  = 'jetpack_security_t2_yearly'; // 2019
141    private const JETPACK_SECURITY_T2_MONTHLY                 = 'jetpack_security_t2_monthly'; // 2020
142    private const JETPACK_STARTER_YEARLY                      = 'jetpack_starter_yearly'; // 2030
143    private const JETPACK_STARTER_MONTHLY                     = 'jetpack_starter_monthly'; // 2031
144    private const JETPACK_BACKUP_DAILY                        = 'jetpack_backup_daily'; // 2100
145    private const JETPACK_BACKUP_DAILY_MONTHLY                = 'jetpack_backup_daily_monthly'; // 2101
146    private const JETPACK_BACKUP_REALTIME                     = 'jetpack_backup_realtime'; // 2102
147    private const JETPACK_BACKUP_REALTIME_MONTHLY             = 'jetpack_backup_realtime_monthly'; // 2103
148    private const JETPACK_SEARCH_BI_YEARLY                    = 'jetpack_search_bi_yearly'; // 2031
149    private const JETPACK_SEARCH                              = 'jetpack_search'; // 2104
150    private const JETPACK_SEARCH_MONTHLY                      = 'jetpack_search_monthly'; // 2105
151    private const JETPACK_SCAN_BI_YEARLY                      = 'jetpack_scan_bi_yearly'; // 2038
152    private const JETPACK_SCAN                                = 'jetpack_scan'; // 2106
153    private const JETPACK_SCAN_MONTHLY                        = 'jetpack_scan_monthly'; // 2107
154    private const JETPACK_SCAN_REALTIME                       = 'jetpack_scan_realtime'; // 2108
155    private const JETPACK_SCAN_REALTIME_MONTHLY               = 'jetpack_scan_realtime_monthly'; // 2109
156    private const JETPACK_ANTI_SPAM_BI_YEARLY                 = 'jetpack_anti_spam_bi_yearly'; // 2039
157    private const JETPACK_ANTI_SPAM                           = 'jetpack_anti_spam'; // 2110
158    private const JETPACK_ANTI_SPAM_MONTHLY                   = 'jetpack_anti_spam_monthly'; // 2111
159    private const JETPACK_BACKUP_T1_BI_YEARLY                 = 'jetpack_backup_t1_bi_yearly'; // 2123
160    private const JETPACK_BACKUP_T1_YEARLY                    = 'jetpack_backup_t1_yearly'; // 2112
161    private const JETPACK_BACKUP_T1_MONTHLY                   = 'jetpack_backup_t1_monthly'; // 2113
162    private const JETPACK_BACKUP_T2_YEARLY                    = 'jetpack_backup_t2_yearly'; // 2114
163    private const JETPACK_BACKUP_T2_MONTHLY                   = 'jetpack_backup_t2_monthly'; // 2115
164    private const JETPACK_BACKUP_ADDON_STORAGE_10GB_MONTHLY   = 'jetpack_backup_addon_storage_10gb_monthly'; // 2040
165    private const JETPACK_BACKUP_ADDON_STORAGE_100GB_MONTHLY  = 'jetpack_backup_addon_storage_100gb_monthly'; // 2044
166    private const JETPACK_BACKUP_ADDON_STORAGE_1TB_MONTHLY    = 'jetpack_backup_addon_storage_1tb_monthly'; // 2048
167    private const JETPACK_BACKUP_ADDON_STORAGE_3TB_MONTHLY    = 'jetpack_backup_addon_storage_3tb_monthly'; // 2052
168    private const JETPACK_BACKUP_ADDON_STORAGE_5TB_MONTHLY    = 'jetpack_backup_addon_storage_5tb_monthly'; // 2056
169    private const JETPACK_VIDEOPRESS_BI_YEARLY                = 'jetpack_videopress_bi_yearly'; // 2119
170    private const JETPACK_VIDEOPRESS                          = 'jetpack_videopress'; // 2116
171    private const JETPACK_VIDEOPRESS_MONTHLY                  = 'jetpack_videopress_monthly'; // 2117
172    private const JETPACK_BACKUP_T0_YEARLY                    = 'jetpack_backup_t0_yearly'; // 2120
173    private const JETPACK_BACKUP_T0_MONTHLY                   = 'jetpack_backup_t0_monthly'; // 2121
174    private const JETPACK_SEARCH_FREE                         = 'jetpack_search_free'; // 2130
175    private const JETPACK_BACKUP_ONE_TIME                     = 'jetpack_backup_one_time'; // 2201
176    private const JETPACK_STATS_FREE                          = 'jetpack_stats_free_yearly'; // 2221
177    private const JETPACK_STATS_PWYW                          = 'jetpack_stats_pwyw_yearly'; // 2222
178    private const JETPACK_STATS_MONTHLY                       = 'jetpack_stats_monthly'; // 2220
179    private const JETPACK_STATS_YEARLY                        = 'jetpack_stats_yearly'; // 2219
180    private const JETPACK_STATS_BI_YEARLY                     = 'jetpack_stats_bi_yearly'; // 2223
181    private const JETPACK_MONITOR_MONTHLY                     = 'jetpack_monitor_monthly'; // 2241
182    private const JETPACK_MONITOR_YEARLY                      = 'jetpack_monitor_yearly'; // 2242
183    private const AKISMET_FREE                                = 'ak_free_yearly'; // 2300
184    private const AKISMET_PERSONAL_MONTHLY                    = 'ak_personal_monthly'; // 2309
185    private const AKISMET_PERSONAL_YEARLY                     = 'ak_personal_yearly'; // 2310
186    private const AKISMET_PLUS_BI_YEARLY                      = 'ak_plus_bi_yearly_1'; // 2327
187    private const AKISMET_PLUS_YEARLY                         = 'ak_plus_yearly_1'; // 2311
188    private const AKISMET_PLUS_MONTHLY                        = 'ak_plus_monthly_1'; // 2312
189    private const AKISMET_PLUS_20K_BI_YEARLY                  = 'ak_plus_bi_yearly_2'; // 2328
190    private const AKISMET_PLUS_20K_YEARLY                     = 'ak_plus_yearly_2'; // 2313
191    private const AKISMET_PLUS_20K_MONTHLY                    = 'ak_plus_monthly_2'; // 2314
192    private const AKISMET_PLUS_30K_BI_YEARLY                  = 'ak_plus_bi_yearly_3'; // 2329
193    private const AKISMET_PLUS_30K_YEARLY                     = 'ak_plus_yearly_3'; // 2315
194    private const AKISMET_PLUS_30K_MONTHLY                    = 'ak_plus_monthly_3'; // 2316
195    private const AKISMET_PLUS_40K_BI_YEARLY                  = 'ak_plus_bi_yearly_4'; // 2330
196    private const AKISMET_PLUS_40K_YEARLY                     = 'ak_plus_yearly_4'; // 2317
197    private const AKISMET_PLUS_40K_MONTHLY                    = 'ak_plus_monthly_4'; // 2318
198    private const AKISMET_ENTERPRISE_BI_YEARLY                = 'ak_ent_bi_yearly_1'; // 2331
199    private const AKISMET_ENTERPRISE_YEARLY                   = 'ak_ent_yearly_1'; // 2319
200    private const AKISMET_ENTERPRISE_MONTHLY                  = 'ak_ent_monthly_1'; // 2320
201    private const AKISMET_ENTERPRISE_350K_YEARLY              = 'ak_ep350k_yearly_1'; // 2321
202    private const AKISMET_ENTERPRISE_350K_MONTHLY             = 'ak_ep350k_monthly_1'; // 2322
203    private const AKISMET_ENTERPRISE_2M_YEARLY                = 'ak_ep2m_yearly_1'; // 2323
204    private const AKISMET_ENTERPRISE_2M_MONTHLY               = 'ak_ep2m_monthly_1'; // 2324
205    private const AKISMET_ENTERPRISE_GT2M_YEARLY              = 'ak_epgt2m_yearly_1'; // 2325
206    private const AKISMET_ENTERPRISE_GT2M_MONTHLY             = 'ak_epgt2m_monthly_1'; // 2326
207    private const AKISMET_PRO_500_MONTHLY                     = 'ak_pro5h_monthly'; // 2332
208    private const AKISMET_PRO_500_YEARLY                      = 'ak_pro5h_yearly'; // 2333
209    private const AKISMET_PRO_500_BI_YEARLY                   = 'ak_pro5h_bi_yearly'; // 2334
210    private const AKISMET_BUSINESS_5K_MONTHLY                 = 'ak_bus5k_monthly'; // 2335
211    private const AKISMET_BUSINESS_5K_YEARLY                  = 'ak_bus5k_yearly'; // 2336
212    private const AKISMET_BUSINESS_5K_BI_YEARLY               = 'ak_bus5k_bi_yearly'; // 2337
213    private const AKISMET_ENTERPRISE_15K_MONTHLY              = 'ak_ep15k_monthly'; // 2338
214    private const AKISMET_ENTERPRISE_15K_YEARLY               = 'ak_ep15k_yearly'; // 2339
215    private const AKISMET_ENTERPRISE_15K_BI_YEARLY            = 'ak_ep15k_bi_yearly'; // 2340
216    private const AKISMET_ENTERPRISE_25K_MONTHLY              = 'ak_ep25k_monthly'; // 2341
217    private const AKISMET_ENTERPRISE_25K_YEARLY               = 'ak_ep25k_yearly'; // 2342
218    private const AKISMET_ENTERPRISE_25K_BI_YEARLY            = 'ak_ep25k_bi_yearly'; // 2343
219    private const JETPACK_BOOST_BI_YEARLY                     = 'jetpack_boost_bi_yearly'; // 2036
220    private const JETPACK_BOOST                               = 'jetpack_boost_yearly'; // 2401
221    private const JETPACK_BOOST_MONTHLY                       = 'jetpack_boost_monthly'; // 2400
222    private const JETPACK_AI_MONTHLY                          = 'jetpack_ai_monthly'; // 2450
223    private const JETPACK_AI_YEARLY                           = 'jetpack_ai_yearly'; // 2451
224    private const JETPACK_AI_BI_YEARLY                        = 'jetpack_ai_bi_yearly'; // 2452
225    private const JETPACK_SOCIAL_BASIC_MONTHLY_LEGACY         = 'jetpack_social_monthly'; // 2500
226    private const JETPACK_SOCIAL_BASIC_BI_YEARLY              = 'jetpack_social_basic_bi_yearly'; // 2037
227    private const JETPACK_SOCIAL_BASIC                        = 'jetpack_social_basic_yearly'; // 2503
228    private const JETPACK_SOCIAL_BASIC_MONTHLY                = 'jetpack_social_basic_monthly'; // 2504
229    private const JETPACK_SOCIAL_ADVANCED_BI_YEARLY           = 'jetpack_social_advanced_bi_yearly'; // 2604
230    private const JETPACK_SOCIAL_ADVANCED                     = 'jetpack_social_advanced_yearly'; // 2602
231    private const JETPACK_SOCIAL_ADVANCED_MONTHLY             = 'jetpack_social_advanced_monthly'; // 2603
232    private const JETPACK_GOLDEN_TOKEN                        = 'jetpack_golden_token_lifetime'; // 2900
233    private const JETPACK_CREATOR_MONTHLY                     = 'jetpack_creator_monthly'; // 2610
234    private const JETPACK_CREATOR_YEARLY                      = 'jetpack_creator_yearly'; // 2611
235    private const JETPACK_CREATOR_BI_YEARLY                   = 'jetpack_creator_bi_yearly'; // 2612
236    private const JETPACK_SOCIAL_V1_MONTHLY                   = 'jetpack_social_v1_monthly'; // 2606
237    private const JETPACK_SOCIAL_V1_YEARLY                    = 'jetpack_social_v1_yearly'; // 2605
238    private const JETPACK_SOCIAL_V1_BI_YEARLY                 = 'jetpack_social_v1_bi_yearly'; // 2607
239    private const A4A_WPCOM_BUSINESS_BUNDLE_YEARLY            = 'a4a_wp_bundle_business_yearly'; // 3300
240    private const A4A_WPCOM_BUSINESS_BUNDLE_MONTHLY           = 'a4a_wp_bundle_business_monthly'; // 3301
241    private const A4A_JETPACK_COMPLETE_YEARLY                 = 'a4a_jetpack_complete_yearly'; // 3302
242    private const A4A_JETPACK_COMPLETE_MONTHLY                = 'a4a_jetpack_complete_monthly'; // 3303
243    private const A4A_JETPACK_SECURITY_TIER_1_YEARLY          = 'a4a_jetpack_security_t1_yearly'; // 3304
244    private const A4A_JETPACK_SECURITY_TIER_1_MONTHLY         = 'a4a_jetpack_security_t1_monthly'; // 3305
245    private const A4A_JETPACK_SECURITY_TIER_2_YEARLY          = 'a4a_jetpack_security_t2_yearly'; // 3306
246    private const A4A_JETPACK_SECURITY_TIER_2_MONTHLY         = 'a4a_jetpack_security_t2_monthly'; // 3307
247    private const A4A_JETPACK_SEARCH_YEARLY                   = 'a4a_jetpack_search_yearly'; // 3318
248    private const A4A_JETPACK_SEARCH_MONTHLY                  = 'a4a_jetpack_search_monthly'; // 3319
249    private const A4A_JETPACK_SCAN_YEARLY                     = 'a4a_jetpack_scan_yearly'; // 3320
250    private const A4A_JETPACK_SCAN_MONTHLY                    = 'a4a_jetpack_scan_monthly'; // 3321
251    private const A4A_JETPACK_ANTI_SPAM_YEARLY                = 'a4a_jetpack_anti_spam_yearly'; // 3322
252    private const A4A_JETPACK_ANTI_SPAM_MONTHLY               = 'a4a_jetpack_anti_spam_monthly'; // 3323
253    private const A4A_JETPACK_BACKUP_TIER_1_YEARLY            = 'a4a_jetpack_backup_t1_yearly'; // 3324
254    private const A4A_JETPACK_BACKUP_TIER_1_MONTHLY           = 'a4a_jetpack_backup_t1_monthly'; // 3325
255    private const A4A_JETPACK_BACKUP_TIER_2_YEARLY            = 'a4a_jetpack_backup_t2_yearly'; // 3326
256    private const A4A_JETPACK_BACKUP_TIER_2_MONTHLY           = 'a4a_jetpack_backup_t2_monthly'; // 3327
257    private const A4A_JETPACK_VIDEOPRESS_YEARLY               = 'a4a_jetpack_videopress_yearly'; // 3328
258    private const A4A_JETPACK_VIDEOPRESS_MONTHLY              = 'a4a_jetpack_videopress_monthly'; // 3329
259    private const A4A_JETPACK_STATS_YEARLY                    = 'a4a_jetpack_stats_yearly'; // 3330
260    private const A4A_JETPACK_STATS_MONTHLY                   = 'a4a_jetpack_stats_monthly'; // 3331
261    private const A4A_JETPACK_MONITOR_YEARLY                  = 'a4a_jetpack_monitor_yearly'; // 3332
262    private const A4A_JETPACK_MONITOR_MONTHLY                 = 'a4a_jetpack_monitor_monthly'; // 3333
263    private const A4A_JETPACK_BOOST_YEARLY                    = 'a4a_jetpack_boost_yearly'; // 3334
264    private const A4A_JETPACK_BOOST_MONTHLY                   = 'a4a_jetpack_boost_monthly'; // 3335
265    private const A4A_JETPACK_AI_YEARLY                       = 'a4a_jetpack_ai_yearly'; // 3336
266    private const A4A_JETPACK_AI_MONTHLY                      = 'a4a_jetpack_ai_monthly'; // 3337
267    private const A4A_JETPACK_SOCIAL_V1_YEARLY                = 'a4a_jetpack_social_v1_yearly'; // 3338
268    private const A4A_JETPACK_SOCIAL_V1_MONTHLY               = 'a4a_jetpack_social_v1_monthly'; // 3339
269    private const A4A_JETPACK_CREATOR_YEARLY                  = 'a4a_jetpack_creator_yearly'; // 3340
270    private const A4A_JETPACK_CREATOR_MONTHLY                 = 'a4a_jetpack_creator_monthly'; // 3341
271    private const WOO_HOSTED_BASIC_PLAN_MONTHLY               = 'woo_hosted_basic_plan_monthly'; // 4001
272    private const WOO_HOSTED_BASIC_PLAN_YEARLY                = 'woo_hosted_basic_plan_yearly'; // 4002
273    private const WOO_HOSTED_PRO_PLAN_MONTHLY                 = 'woo_hosted_pro_plan_monthly'; // 4003
274    private const WOO_HOSTED_PRO_PLAN_YEARLY                  = 'woo_hosted_pro_plan_yearly'; // 4004
275
276    // WPCOM "Level 2": Groups of level 1s.
277    private const WPCOM_BLOGGER_PLANS           = array( self::BLOGGER_BUNDLE, self::BLOGGER_BUNDLE_2Y );
278    private const WPCOM_PERSONAL_PLANS          = array( self::PERSONAL_BUNDLE, self::PERSONAL_BUNDLE_MONTHLY, self::PERSONAL_BUNDLE_2Y, self::PERSONAL_BUNDLE_3Y );
279    private const WPCOM_STARTER_PLANS           = array( self::STARTER_PLAN );
280    private const WPCOM_PREMIUM_PLANS           = array( self::BUNDLE_PRO, self::VALUE_BUNDLE, self::VALUE_BUNDLE_MONTHLY, self::VALUE_BUNDLE_2Y, self::VALUE_BUNDLE_3Y );
281    private const WPCOM_PRO_PLANS               = array( self::PRO_PLAN, self::PRO_PLAN_MONTHLY, self::PRO_PLAN_2Y );
282    private const WPCOM_MIGRATION_TRIAL_PLANS   = array( self::WPCOM_MIGRATION_TRIAL_BUNDLE_MONTHLY );
283    private const WPCOM_HOSTING_TRIAL_PLANS     = array( self::WPCOM_HOSTING_TRIAL_BUNDLE_MONTHLY );
284    private const WPCOM_STUDENT_PLANS           = array( self::STUDENT_BUNDLE );
285    private const WPCOM_BUSINESS_PLANS          = array( self::BUSINESS_BUNDLE, self::BUSINESS_BUNDLE_MONTHLY, self::BUSINESS_BUNDLE_2Y, self::BUSINESS_BUNDLE_3Y, self::WPCOM_MIGRATION_TRIAL_PLANS, self::WPCOM_HUNDRED_YEAR_BUNDLE, self::WPCOM_HOSTING_TRIAL_BUNDLE_MONTHLY, self::A4A_WPCOM_BUSINESS_BUNDLE_YEARLY, self::A4A_WPCOM_BUSINESS_BUNDLE_MONTHLY, self::WPCOM_STUDENT_PLANS );
286    private const WPCOM_ECOMMERCE_PLANS         = array( self::ECOMMERCE_BUNDLE, self::ECOMMERCE_BUNDLE_MONTHLY, self::ECOMMERCE_BUNDLE_2Y, self::ECOMMERCE_BUNDLE_3Y );
287    private const WPCOM_ECOMMERCE_TRIAL_PLANS   = array( self::ECOMMERCE_TRIAL_BUNDLE_MONTHLY );
288    private const WPCOM_WOOEXPRESS_MEDIUM_PLANS = array( self::WPCOM_WOOEXPRESS_MEDIUM_BUNDLE_MONTHLY, self::WPCOM_WOOEXPRESS_MEDIUM_BUNDLE_YEARLY );
289    private const WPCOM_WOOEXPRESS_SMALL_PLANS  = array( self::WPCOM_WOOEXPRESS_SMALL_BUNDLE_MONTHLY, self::WPCOM_WOOEXPRESS_SMALL_BUNDLE_YEARLY );
290    private const WOO_HOSTED_PLANS              = array( self::WOO_HOSTED_BASIC_PLAN_MONTHLY, self::WOO_HOSTED_BASIC_PLAN_YEARLY, self::WOO_HOSTED_PRO_PLAN_MONTHLY, self::WOO_HOSTED_PRO_PLAN_YEARLY );
291    private const GOOGLE_WORKSPACE_PRODUCTS     = array( self::WP_GOOGLE_WORKSPACE_BUSINESS_STARTER_YEARLY );
292    private const GSUITE_PRODUCTS               = array( self::GAPPS, self::GAPPS_UNLIMITED );
293    private const WPCOM_TITAN_MAIL_PRODUCTS     = array( self::WP_TITAN_MAIL_MONTHLY, self::WP_TITAN_MAIL_YEARLY, self::WP_TITAN_MAIL_PREMIUM_MONTHLY, self::WP_TITAN_MAIL_PREMIUM_YEARLY, self::WP_TITAN_MAIL_ULTRA_MONTHLY, self::WP_TITAN_MAIL_ULTRA_YEARLY );
294
295    private const WPCOM_PERSONAL_AND_PREMIUM_PLANS = array( self::WPCOM_PERSONAL_PLANS, self::WPCOM_PREMIUM_PLANS );
296    // Unlock Business-gated features for sites with the flex-cache-site sticker via the free plan.
297    private const WPCOM_FLEX_CACHE_SITE_FREE_PLANS = array(
298        'required_sticker' => 'flex-cache-site',
299        self::JETPACK_ALL_SITES,
300    );
301
302    // WPCOM "Level 3" A: Groups of level 2s.
303    private const WPCOM_BLOGGER_AND_HIGHER_PLANS  = array( self::WPCOM_BLOGGER_PLANS, self::WPCOM_PERSONAL_PLANS, self::WPCOM_STARTER_PLANS, self::WPCOM_PREMIUM_PLANS, self::WPCOM_PRO_PLANS, self::WPCOM_BUSINESS_PLANS, self::WPCOM_ECOMMERCE_PLANS, self::WPCOM_ECOMMERCE_TRIAL_PLANS, self::WPCOM_WOOEXPRESS_PLANS );
304    private const WPCOM_PERSONAL_AND_HIGHER_PLANS = array( self::WPCOM_PERSONAL_PLANS, self::WPCOM_STARTER_PLANS, self::WPCOM_PREMIUM_PLANS, self::WPCOM_PRO_PLANS, self::WPCOM_BUSINESS_PLANS, self::WPCOM_ECOMMERCE_PLANS, self::WPCOM_ECOMMERCE_TRIAL_PLANS, self::WPCOM_WOOEXPRESS_PLANS );
305    private const WPCOM_STARTER_AND_HIGHER_PLANS  = array( self::WPCOM_STARTER_PLANS, self::WPCOM_PREMIUM_PLANS, self::WPCOM_PRO_PLANS, self::WPCOM_BUSINESS_PLANS, self::WPCOM_ECOMMERCE_PLANS, self::WPCOM_ECOMMERCE_TRIAL_PLANS, self::WPCOM_WOOEXPRESS_PLANS );
306    private const WPCOM_PREMIUM_AND_HIGHER_PLANS  = array( self::WPCOM_PREMIUM_PLANS, self::WPCOM_PRO_PLANS, self::WPCOM_BUSINESS_PLANS, self::WPCOM_ECOMMERCE_PLANS, self::WPCOM_ECOMMERCE_TRIAL_PLANS, self::WPCOM_WOOEXPRESS_PLANS );
307    private const WPCOM_BUSINESS_AND_HIGHER_PLANS = array( self::WPCOM_BUSINESS_PLANS, self::WPCOM_ECOMMERCE_PLANS, self::WPCOM_ECOMMERCE_TRIAL_PLANS, self::WPCOM_WOOEXPRESS_PLANS );
308    private const WPCOM_WOOEXPRESS_PLANS          = array( self::WPCOM_WOOEXPRESS_MEDIUM_PLANS, self::WPCOM_WOOEXPRESS_SMALL_PLANS );
309    // Business terms are listed one by one because WPCOM_BUSINESS_PLANS also nests the trial, Student, A4A and hundred-year plans.
310    private const WPCOM_PAID_BUSINESS_AND_COMMERCE_PLANS = array( self::BUSINESS_BUNDLE, self::BUSINESS_BUNDLE_MONTHLY, self::BUSINESS_BUNDLE_2Y, self::BUSINESS_BUNDLE_3Y, self::WPCOM_ECOMMERCE_PLANS );
311
312    // WPCOM "Level 3" C: Misc product groupings unrelated to free plan trials.
313    private const WPCOM_EMAIL_PRODUCTS = array( self::GOOGLE_WORKSPACE_PRODUCTS, self::GSUITE_PRODUCTS, self::WPCOM_TITAN_MAIL_PRODUCTS );
314
315    // Jetpack "Level 2": Groups of level 1s.
316    private const JETPACK_BUSINESS_PLANS = array( self::JETPACK_BUSINESS, self::JETPACK_BUSINESS_MONTHLY );
317    private const JETPACK_PREMIUM_PLANS  = array( self::JETPACK_PREMIUM, self::JETPACK_PREMIUM_MONTHLY );
318    private const JETPACK_PERSONAL_PLANS = array( self::JETPACK_PERSONAL, self::JETPACK_PERSONAL_MONTHLY );
319    private const JETPACK_GROWTH_PLANS   = array( self::JETPACK_GROWTH_BI_YEARLY, self::JETPACK_GROWTH_YEARLY, self::JETPACK_GROWTH_MONTHLY );
320    private const JETPACK_COMPLETE_PLANS = array( self::JETPACK_COMPLETE_BI_YEARLY, self::JETPACK_COMPLETE, self::JETPACK_COMPLETE_MONTHLY, self::A4A_JETPACK_COMPLETE_YEARLY, self::A4A_JETPACK_COMPLETE_MONTHLY );
321    private const JETPACK_STARTER_PLANS  = array( self::JETPACK_STARTER_YEARLY, self::JETPACK_STARTER_MONTHLY );
322    private const JETPACK_PRO_PLANS      = array( self::JETPACK_PRO_BI_YEARLY, self::JETPACK_PRO_YEARLY, self::JETPACK_PRO_MONTHLY );
323
324    private const JETPACK_SECURITY_DAILY_PLANS    = array( self::JETPACK_SECURITY_DAILY, self::JETPACK_SECURITY_DAILY_MONTHLY );
325    private const JETPACK_SECURITY_REALTIME_PLANS = array( self::JETPACK_SECURITY_REALTIME, self::JETPACK_SECURITY_REALTIME_MONTHLY );
326    private const JETPACK_SECURITY_T0_PLANS       = array( self::JETPACK_SECURITY_T0_MONTHLY, self::JETPACK_SECURITY_T0_YEARLY );
327    private const JETPACK_SECURITY_T1_PLANS       = array( self::JETPACK_SECURITY_T1_MONTHLY, self::JETPACK_SECURITY_T1_YEARLY, self::JETPACK_SECURITY_T1_BI_YEARLY, self::A4A_JETPACK_SECURITY_TIER_1_MONTHLY, self::A4A_JETPACK_SECURITY_TIER_1_YEARLY );
328    private const JETPACK_SECURITY_T2_PLANS       = array( self::JETPACK_SECURITY_T2_MONTHLY, self::JETPACK_SECURITY_T2_YEARLY, self::A4A_JETPACK_SECURITY_TIER_2_MONTHLY, self::A4A_JETPACK_SECURITY_TIER_2_YEARLY );
329
330    private const JETPACK_SCAN_PLANS = array( self::JETPACK_SCAN_BI_YEARLY, self::JETPACK_SCAN, self::JETPACK_SCAN_MONTHLY, self::JETPACK_SCAN_REALTIME, self::JETPACK_SCAN_REALTIME_MONTHLY, self::A4A_JETPACK_SCAN_YEARLY, self::A4A_JETPACK_SCAN_MONTHLY );
331
332    private const JETPACK_SOCIAL_PLANS          = array( self::JETPACK_SOCIAL_BASIC_BI_YEARLY, self::JETPACK_SOCIAL_BASIC, self::JETPACK_SOCIAL_BASIC_MONTHLY, self::JETPACK_SOCIAL_BASIC_MONTHLY_LEGACY );
333    private const JETPACK_SOCIAL_ADVANCED_PLANS = array( self::JETPACK_SOCIAL_ADVANCED_BI_YEARLY, self::JETPACK_SOCIAL_ADVANCED, self::JETPACK_SOCIAL_ADVANCED_MONTHLY );
334    private const JETPACK_SOCIAL_V1_PLANS       = array( self::JETPACK_SOCIAL_V1_YEARLY, self::JETPACK_SOCIAL_V1_MONTHLY, self::JETPACK_SOCIAL_V1_BI_YEARLY, self::A4A_JETPACK_SOCIAL_V1_YEARLY, self::A4A_JETPACK_SOCIAL_V1_MONTHLY );
335
336    private const JETPACK_STATS_PLANS = array( self::JETPACK_STATS_BI_YEARLY, self::JETPACK_STATS_YEARLY, self::JETPACK_STATS_MONTHLY, self::JETPACK_STATS_PWYW, self::JETPACK_STATS_FREE, self::A4A_JETPACK_STATS_YEARLY, self::A4A_JETPACK_STATS_MONTHLY );
337
338    private const JETPACK_VIDEOPRESS_PLANS = array( self::JETPACK_VIDEOPRESS_BI_YEARLY, self::JETPACK_VIDEOPRESS, self::JETPACK_VIDEOPRESS_MONTHLY, self::A4A_JETPACK_VIDEOPRESS_YEARLY, self::A4A_JETPACK_VIDEOPRESS_MONTHLY );
339
340    private const JETPACK_SEARCH_PLANS = array( self::JETPACK_SEARCH_FREE, self::JETPACK_SEARCH_BI_YEARLY, self::JETPACK_SEARCH, self::JETPACK_SEARCH_MONTHLY, self::A4A_JETPACK_SEARCH_YEARLY, self::A4A_JETPACK_SEARCH_MONTHLY );
341
342    private const JETPACK_AI_PLANS = array( self::JETPACK_AI_BI_YEARLY, self::JETPACK_AI_YEARLY, self::JETPACK_AI_MONTHLY, self::A4A_JETPACK_AI_YEARLY, self::A4A_JETPACK_AI_MONTHLY );
343
344    private const JETPACK_BOOST_PLANS = array( self::JETPACK_BOOST_BI_YEARLY, self::JETPACK_BOOST, self::JETPACK_BOOST_MONTHLY, self::A4A_JETPACK_BOOST_YEARLY, self::A4A_JETPACK_BOOST_MONTHLY );
345
346    private const JETPACK_BACKUP_DAILY_PLANS    = array( self::JETPACK_BACKUP_DAILY, self::JETPACK_BACKUP_DAILY_MONTHLY );
347    private const JETPACK_BACKUP_REALTIME_PLANS = array( self::JETPACK_BACKUP_REALTIME, self::JETPACK_BACKUP_REALTIME_MONTHLY );
348    private const JETPACK_BACKUP_T0_PLANS       = array( self::JETPACK_BACKUP_T0_MONTHLY, self::JETPACK_BACKUP_T0_YEARLY );
349    private const JETPACK_BACKUP_T1_PLANS       = array( self::JETPACK_BACKUP_T1_MONTHLY, self::JETPACK_BACKUP_T1_YEARLY, self::JETPACK_BACKUP_T1_BI_YEARLY, self::A4A_JETPACK_BACKUP_TIER_1_YEARLY, self::A4A_JETPACK_BACKUP_TIER_1_MONTHLY );
350    private const JETPACK_BACKUP_T2_PLANS       = array( self::JETPACK_BACKUP_T2_MONTHLY, self::JETPACK_BACKUP_T2_YEARLY, self::A4A_JETPACK_BACKUP_TIER_2_YEARLY, self::A4A_JETPACK_BACKUP_TIER_2_MONTHLY );
351
352    private const JETPACK_CREATOR_PLANS = array( self::JETPACK_CREATOR_MONTHLY, self::JETPACK_CREATOR_YEARLY, self::JETPACK_CREATOR_BI_YEARLY, self::A4A_JETPACK_CREATOR_YEARLY, self::A4A_JETPACK_CREATOR_MONTHLY );
353
354    // Jetpack "Level 3": Groups of level 2.
355    private const JETPACK_PERSONAL_AND_HIGHER = array(
356        self::JETPACK_PERSONAL_PLANS,
357        self::JETPACK_PREMIUM_PLANS,
358        self::JETPACK_BUSINESS_PLANS,
359        self::JETPACK_COMPLETE_PLANS,
360        self::JETPACK_PRO_PLANS,
361        self::JETPACK_SECURITY_DAILY_PLANS,
362        self::JETPACK_SECURITY_REALTIME_PLANS,
363        self::JETPACK_SECURITY_T0_PLANS,
364        self::JETPACK_SECURITY_T1_PLANS,
365        self::JETPACK_SECURITY_T2_PLANS,
366        self::JETPACK_STARTER_PLANS,
367    );
368    private const JETPACK_PREMIUM_AND_HIGHER  = array(
369        self::JETPACK_PREMIUM_PLANS,
370        self::JETPACK_BUSINESS_PLANS,
371        self::JETPACK_COMPLETE_PLANS,
372        self::JETPACK_PRO_PLANS,
373        self::JETPACK_SECURITY_DAILY_PLANS,
374        self::JETPACK_SECURITY_REALTIME_PLANS,
375        self::JETPACK_SECURITY_T0_PLANS,
376        self::JETPACK_SECURITY_T1_PLANS,
377        self::JETPACK_SECURITY_T2_PLANS,
378    );
379
380    private const AKISMET_PLANS = array(
381        self::AKISMET_FREE,
382        self::AKISMET_PERSONAL_MONTHLY,
383        self::AKISMET_PERSONAL_YEARLY,
384        self::AKISMET_PLUS_MONTHLY,
385        self::AKISMET_PLUS_YEARLY,
386        self::AKISMET_PLUS_BI_YEARLY,
387        self::AKISMET_PLUS_20K_MONTHLY,
388        self::AKISMET_PLUS_20K_YEARLY,
389        self::AKISMET_PLUS_20K_BI_YEARLY,
390        self::AKISMET_PLUS_30K_MONTHLY,
391        self::AKISMET_PLUS_30K_YEARLY,
392        self::AKISMET_PLUS_30K_BI_YEARLY,
393        self::AKISMET_PLUS_40K_MONTHLY,
394        self::AKISMET_PLUS_40K_YEARLY,
395        self::AKISMET_PLUS_40K_BI_YEARLY,
396        self::AKISMET_ENTERPRISE_MONTHLY,
397        self::AKISMET_ENTERPRISE_YEARLY,
398        self::AKISMET_ENTERPRISE_BI_YEARLY,
399        self::AKISMET_ENTERPRISE_350K_MONTHLY,
400        self::AKISMET_ENTERPRISE_350K_YEARLY,
401        self::AKISMET_ENTERPRISE_2M_MONTHLY,
402        self::AKISMET_ENTERPRISE_2M_YEARLY,
403        self::AKISMET_PRO_500_MONTHLY,
404        self::AKISMET_PRO_500_YEARLY,
405        self::AKISMET_PRO_500_BI_YEARLY,
406        self::AKISMET_BUSINESS_5K_MONTHLY,
407        self::AKISMET_BUSINESS_5K_YEARLY,
408        self::AKISMET_BUSINESS_5K_BI_YEARLY,
409        self::AKISMET_ENTERPRISE_15K_MONTHLY,
410        self::AKISMET_ENTERPRISE_15K_YEARLY,
411        self::AKISMET_ENTERPRISE_15K_BI_YEARLY,
412        self::AKISMET_ENTERPRISE_25K_MONTHLY,
413        self::AKISMET_ENTERPRISE_25K_YEARLY,
414        self::AKISMET_ENTERPRISE_25K_BI_YEARLY,
415    );
416
417    // Features automatically granted to all sites regardless of their purchases are mapped to these constants.
418    private const WPCOM_ALL_SITES   = 'wpcom-all-sites';
419    private const JETPACK_ALL_SITES = 'jetpack-all-sites';
420
421    /*
422     * Public const for every mapped feature, sorted alphabetically.
423     */
424    public const AI_ASSISTANT                      = 'ai-assistant';
425    public const AI_CREDITS_WPCOM_BUSINESS         = 'ai-credits-wpcom-business';
426    public const AI_CREDITS_WPCOM_COMMERCE         = 'ai-credits-wpcom-commerce';
427    public const AI_CREDITS_WPCOM_PERSONAL         = 'ai-credits-wpcom-personal';
428    public const AI_CREDITS_WPCOM_PREMIUM          = 'ai-credits-wpcom-premium';
429    public const AI_SEO_ENHANCER                   = 'ai-seo-enhancer';
430    public const AD_CREDIT_VOUCHERS                = 'ad-credit';
431    public const ADVANCED_SEO                      = 'advanced-seo';
432    public const AKISMET                           = 'akismet';
433    public const ANTISPAM                          = 'antispam';
434    public const ARCHIVE_CONTENT                   = 'archive-content';
435    public const ATOMIC                            = 'atomic';
436    public const BACKUPS                           = 'backups';
437    public const BACKUPS_DAILY                     = 'backups-daily';
438    public const BACKUPS_RESTORE                   = 'restore';
439    public const BIG_SKY                           = 'big-sky';
440    public const BACKUPS_SELF_SERVE                = 'backups-self-serve';
441    public const BACKUP_ONE_TIME                   = 'backup-one-time';
442    public const BLAZE_CREDITS_VOUCHER             = 'blaze-credits-voucher';
443    public const BLOG_DOMAIN_ONLY                  = 'blog-domain-only';
444    public const CALENDLY                          = 'calendly';
445    public const CDN                               = 'cdn';
446    public const CLASSIC_SEARCH                    = 'search';
447    public const CLOUD_CRITICAL_CSS                = 'cloud-critical-css';
448    public const CORNERSTONE_TEN_PAGES             = 'cornerstone-10-pages';
449    public const CLOUDFLARE_ANALYTICS              = 'cloudflare-analytics';
450    public const CLOUDFLARE_CDN                    = 'cloudflare-cdn';
451    public const CONCIERGE                         = 'concierge';
452    public const CONCIERGE_BUSINESS                = 'concierge-business';
453    public const COPY_SITE                         = 'copy-site';
454    public const CORE_AUDIO                        = 'core/audio';
455    public const CORE_COVER                        = 'core/cover';
456    public const CORE_VIDEO                        = 'core/video';
457    public const CREDIT_VOUCHERS                   = 'credit-vouchers';
458    public const CUSTOM_DESIGN                     = 'custom-design';
459    public const CUSTOM_DOMAIN                     = 'custom-domain';
460    public const DOMAIN_MAPPING                    = 'domain-mapping';
461    public const DONATIONS                         = 'donations';
462    public const ECOMMERCE_MANAGED_PLUGINS         = 'ecommerce-managed-plugins';
463    public const ECOMMERCE_MANAGED_PLUGINS_SMALL   = 'ecommerce-managed-plugins-small';
464    public const ECOMMERCE_MANAGED_PLUGINS_MEDIUM  = 'ecommerce-managed-plugins-medium';
465    public const ECOMMERCE_MANAGED_PLUGINS_TRIAL   = 'ecommerce-managed-plugins-trial';
466    public const EDGE_RULES                        = 'edge-rules';
467    public const EDIT_PLUGINS                      = 'edit-plugins';
468    public const EDIT_THEMES                       = 'edit-themes';
469    public const EMAIL_PROFESSIONAL                = 'email-professional';
470    public const EMAIL_SUBSCRIPTION                = 'email-subscription';
471    public const EMAIL_FORWARDS_EXTENDED_LIMIT     = 'email-forwards-extended-limit';
472    public const FIELD_FILE                        = 'field-file';
473    public const FORM_CONDITIONAL_LOGIC            = 'form-conditional-logic';
474    public const FORM_INTEGRATIONS                 = 'form-integrations';
475    public const FORM_WEBHOOKS                     = 'form-webhooks';
476    public const FREE_BLOG                         = 'free-blog';
477    public const FULL_ACTIVITY_LOG                 = 'full-activity-log';
478    public const GITHUB_DEPLOYMENTS                = 'github-deployments';
479    public const GLOBAL_STYLES                     = 'global-styles';
480    public const GOOGLE_ANALYTICS                  = 'google-analytics';
481    public const GOOGLE_MY_BUSINESS                = 'google-my-business';
482    public const IMAGE_CDN_LIAR                    = 'image-cdn-liar';
483    public const IMAGE_CDN_QUALITY                 = 'image-cdn-quality';
484    public const IMAGE_SIZE_ANALYSIS               = 'image-size-analysis';
485    public const INSTALL_PLUGINS                   = 'install-plugins';
486    public const INSTALL_PURCHASED_PLUGINS         = 'install-purchased-plugins';
487    public const INSTALL_THEMES                    = 'install-themes';
488    public const INSTALL_WOO_ONBOARDING_PLUGINS    = 'install-woo-onboarding-plugins';
489    public const INSTANT_SEARCH                    = 'instant-search';
490    public const JETPACK_DASHBOARD                 = 'jetpack-dashboard';
491    public const LEGACY_CONTACT                    = 'legacy-contact';
492    public const LIST_INSTALLED_PLUGINS            = 'list-installed-plugins';
493    public const LIVE_SUPPORT                      = 'live_support';
494    public const LOCKED_MODE                       = 'locked-mode';
495    public const LOGS                              = 'logs';
496    public const MAILPOET_BUSINESS                 = 'mailpoet-business';
497    public const MANAGE_PLUGINS                    = 'manage-plugins';
498    public const MONITORING                        = 'monitoring';
499    public const MONITOR_1_MINUTE_CHECK_INTERVAL   = 'monitor-1-minute-check-interval';
500    public const MONITOR_MULTIPLE_EMAIL_RECIPIENTS = 'monitor-multiple-email-recipients';
501    public const MONITOR_SMS_NOTIFICATIONS         = 'monitor-sms-notifications';
502    public const MULTISTEP_FORM                    = 'multistep-form';
503    public const NO_ADVERTS_NO_ADVERTS_PHP         = 'no-adverts/no-adverts.php';
504    public const NO_WPCOM_BRANDING                 = 'no-wpcom-branding';
505    public const OPENTABLE                         = 'opentable';
506    public const PAYMENTS                          = 'payments';
507    public const PAYMENT_BUTTONS                   = 'payment-buttons';
508    public const PAYPAL_PAYMENT_BUTTONS            = 'paypal-payment-buttons';
509    public const PERFORMANCE                       = 'performance';
510    public const PERFORMANCE_HISTORY               = 'performance-history';
511    public const PODCASTING                        = 'podcasting';
512    public const POLLDADDY                         = 'polldaddy';
513    public const POSTS_TO_PODCAST_TIER_1           = 'posts-to-podcast-tier-1';
514    public const POSTS_TO_PODCAST_TIER_2           = 'posts-to-podcast-tier-2';
515    public const POSTS_TO_PODCAST_TIER_3           = 'posts-to-podcast-tier-3';
516    public const PREMIUM_CONTENT_CONTAINER         = 'premium-content/container';
517    public const PERSONAL_THEMES                   = 'personal-themes';
518    public const PREMIUM_THEMES                    = 'premium-themes';
519    public const PARTNER_THEMES                    = 'partner-themes';
520    public const COMMUNITY_THEMES                  = 'community-themes';
521    public const WOOCOMMERCE_THEMES                = 'woocommerce-themes';
522    public const SENSEI_THEMES                     = 'sensei-themes';
523    public const PRIORITY_SUPPORT                  = 'priority_support';
524    public const PRIVATE_WHOIS                     = 'private_whois';
525    public const REAL_TIME_BACKUPS                 = 'real-time-backups';
526    public const REAL_TIME_COLLABORATION           = 'real-time-collaboration';
527    public const RECURRING_PAYMENTS                = 'recurring-payments';
528    public const REDUCED_ATOMIC_EMAIL_PRIORITY     = 'reduced-email-priority';
529    public const REPUBLICIZE                       = 'republicize';
530    public const SCAN                              = 'scan';
531    public const SCAN_MANAGED                      = 'scan-managed';
532    public const SCAN_SELF_SERVE                   = 'scan-self-serve';
533    public const SCHEDULED_UPDATES                 = 'scheduled-updates';
534    public const SECURITY_SETTINGS                 = 'security-settings';
535    public const SEO_ADMIN_UI                      = 'seo-admin-ui';
536    public const SEO_PREVIEW_TOOLS                 = 'seo-preview-tools';
537    public const SEND_A_MESSAGE                    = 'send-a-message';
538    public const SET_PRIMARY_CUSTOM_DOMAIN         = 'set-primary-custom-domain';
539    public const SFTP                              = 'sftp';
540    public const SIMPLE_PAYMENTS                   = 'simple-payments';
541    public const SITE_PREVIEW_LINKS                = 'site-preview-links';
542    public const SOCIAL_ADMIN_UI_V2                = 'social-admin-ui-v2';
543    public const SOCIAL_IMAGE_FOCAL_POINT          = 'social-image-focal-point';
544    public const SOCIAL_IMAGE_GENERATOR            = 'social-image-generator';
545    public const SOCIAL_MESSAGE_TEMPLATES          = 'social-message-templates';
546    public const SOCIAL_SHARES_1000                = 'social-shares-1000';
547    public const SOCIAL_ENHANCED_PUBLISHING        = 'social-enhanced-publishing';
548    public const SOCIAL_IMAGE_AUTO_CONVERT         = 'social-image-auto-convert';
549    public const SPACE                             = 'space';
550    public const SPACE_UPGRADED_STORAGE            = 'space-upgraded-storage';
551    public const SSH                               = 'ssh';
552    public const STAGING_SITES                     = 'staging-sites';
553    public const STATS_BASIC_TEMP                  = 'stats-basic';
554    public const STATS_COMMERCIAL                  = 'stats-commercial';
555    public const STATS_FREE                        = 'stats-free';
556    public const STATS_PAID                        = 'stats-paid';
557    public const STUDIO_SYNC                       = 'studio-sync';
558    public const SUBSCRIBER_UNLIMITED_IMPORTS      = 'subscriber-unlimited-imports';
559    public const SUBSCRIPTION_GIFTING              = 'subscription-gifting';
560    public const SUPPORT                           = 'support';
561    public const TITAN_MAIL_1YEAR_TRIAL            = 'titan_mail_1year_trial';
562    public const UPGRADED_UPLOAD_FILETYPES         = 'upgraded_upload_filetypes';
563    public const UPLOAD_AUDIO_FILES                = 'upload-audio-files';
564    public const UPLOAD_PLUGINS                    = 'upload-plugins';
565    public const UPLOAD_SPACE_1GB                  = 'upload-space-1gb-addon';
566    public const UPLOAD_SPACE_3GB                  = 'upload-space-3gb';
567    public const UPLOAD_SPACE_10GB                 = 'upload-space-10gb';
568    public const UPLOAD_SPACE_25GB                 = 'upload-space-25gb';
569    public const UPLOAD_SPACE_50GB                 = 'upload-space-50gb';
570    public const UPLOAD_SPACE_100GB                = 'upload-space-100gb';
571    public const UPLOAD_SPACE_200GB                = 'upload-space-200gb';
572    public const UPLOAD_SPACE_UNLIMITED            = 'upload-space-unlimited';
573    public const UPLOAD_THEMES                     = 'upload-themes';
574    public const UPLOAD_VIDEO_FILES                = 'upload-video-files';
575    public const VAULTPRESS_AUTOMATED_RESTORES     = 'vaultpress-automated-restores';
576    public const VAULTPRESS_BACKUP_ARCHIVE         = 'vaultpress-backup-archive';
577    public const VAULTPRESS_BACKUPS                = 'vaultpress-backups';
578    public const VAULTPRESS_SECURITY_SCANNING      = 'vaultpress-security-scanning';
579    public const VAULTPRESS_STORAGE_SPACE          = 'vaultpress-storage-space';
580    public const VIDEO_HOSTING                     = 'video-hosting';
581    public const VIDEOPRESS                        = 'videopress';
582    public const VIDEOPRESS_1TB_STORAGE            = 'videopress-1tb-storage';
583    public const VIDEOPRESS_VIDEO                  = 'videopress/video';
584    public const VIDEOPRESS_UNLIMITED_STORAGE      = 'videopress-unlimited-storage';
585    public const WHATSAPP_BUTTON                   = 'whatsapp-button';
586    public const WOO_BUNDLE_EXTENSIONS             = 'woo-bundle-extensions';
587    public const WOOP                              = 'woop';
588    public const WORDADS                           = 'wordads';
589    public const WORDADS_JETPACK                   = 'wordads-jetpack';
590
591    /*
592     * Private const array of features with sub-array of purchases that include that feature. Sorted alphabetically.
593     */
594    private const FEATURES_MAP = array(
595        self::AI_ASSISTANT                      => array(
596            self::JETPACK_AI_PLANS,
597            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
598            self::JETPACK_COMPLETE_PLANS,
599            self::JETPACK_PRO_PLANS,
600        ),
601        // AI_CREDITS_WPCOM_* - the WordPress Agent's monthly AI credit allowance tier. Trials get no credits.
602        self::AI_CREDITS_WPCOM_BUSINESS         => array(
603            self::WPCOM_BUSINESS_PLANS,
604            self::EXCLUDE_PLANS => array(
605                self::WPCOM_MIGRATION_TRIAL_PLANS,
606                self::WPCOM_HOSTING_TRIAL_PLANS,
607            ),
608        ),
609        self::AI_CREDITS_WPCOM_COMMERCE         => array(
610            self::WPCOM_ECOMMERCE_PLANS,
611        ),
612        self::AI_CREDITS_WPCOM_PERSONAL         => array(
613            self::WPCOM_BLOGGER_PLANS,
614            self::WPCOM_PERSONAL_PLANS,
615            self::WPCOM_STARTER_PLANS,
616        ),
617        self::AI_CREDITS_WPCOM_PREMIUM          => array(
618            self::WPCOM_PREMIUM_PLANS,
619            self::WPCOM_PRO_PLANS,
620        ),
621        self::AI_SEO_ENHANCER                   => array(
622            self::WPCOM_PREMIUM_PLANS,
623            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
624            self::JETPACK_COMPLETE_PLANS,
625            self::JETPACK_PRO_PLANS,
626        ),
627        self::AD_CREDIT_VOUCHERS                => array(
628            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
629            self::WPCOM_PRO_PLANS,
630        ),
631
632        /*
633         * ADVANCED_SEO - Called seo-tools in Jetpack.
634         *
635         * Active for:
636         * - Simple and Atomic sites with Premium or up plan.
637         * - Jetpack sites with any plan.
638         * - Not VIP sites.
639         */
640        self::ADVANCED_SEO                      => array(
641            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
642            self::JETPACK_ALL_SITES,
643        ),
644        self::AKISMET                           => array(
645            self::AKISMET_PLANS,
646            self::JETPACK_PERSONAL_AND_HIGHER,
647            self::WPCOM_ALL_SITES,
648        ),
649        self::ANTISPAM                          => array(
650            self::JETPACK_ANTI_SPAM_BI_YEARLY,
651            self::JETPACK_ANTI_SPAM,
652            self::JETPACK_ANTI_SPAM_MONTHLY,
653            self::A4A_JETPACK_ANTI_SPAM_YEARLY,
654            self::A4A_JETPACK_ANTI_SPAM_MONTHLY,
655            self::JETPACK_PERSONAL_AND_HIGHER,
656            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
657            self::WPCOM_PRO_PLANS,
658        ),
659
660        // Automatically syncs content to the Internet Archive on publish and update.
661        self::ARCHIVE_CONTENT                   => array(
662            self::WPCOM_HUNDRED_YEAR_BUNDLE,
663        ),
664
665        self::ATOMIC                            => array(
666            self::WPCOM_PRO_PLANS,
667            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
668            self::WPCOM_STAGING_PRODUCT,
669            array( 'product_type' => array( 'marketplace_plugin', 'saas_plugin' ) ),
670            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
671        ),
672        // BACKUPS - Site has *any* kind of backups.
673        self::BACKUPS                           => array(
674            self::JETPACK_BACKUP_DAILY_PLANS,
675            self::JETPACK_BACKUP_ONE_TIME,
676            self::JETPACK_BACKUP_REALTIME_PLANS,
677            self::JETPACK_BACKUP_T0_PLANS,
678            self::JETPACK_BACKUP_T1_PLANS,
679            self::JETPACK_BACKUP_T2_PLANS,
680            self::JETPACK_PERSONAL_AND_HIGHER,
681            self::JETPACK_PRO_PLANS,
682            self::JETPACK_GOLDEN_TOKEN,
683            self::WPCOM_PRO_PLANS,
684            self::WPCOM_STAGING_PRODUCT,
685            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
686            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
687        ),
688        // BACKUPS_DAILY - Site has product that includes daily backups.
689        self::BACKUPS_DAILY                     => array(
690            self::JETPACK_BACKUP_DAILY_PLANS,
691            self::JETPACK_PERSONAL_AND_HIGHER,
692            self::JETPACK_SECURITY_DAILY_PLANS,
693        ),
694        self::BACKUPS_RESTORE                   => array(
695            self::WPCOM_PRO_PLANS,
696            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
697            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
698        ),
699        self::BACKUPS_SELF_SERVE                => array(
700            self::JETPACK_BACKUP_DAILY_PLANS,
701            self::JETPACK_BACKUP_ONE_TIME,
702            self::JETPACK_BACKUP_REALTIME_PLANS,
703            self::JETPACK_BACKUP_T0_PLANS,
704            self::JETPACK_BACKUP_T1_PLANS,
705            self::JETPACK_BACKUP_T2_PLANS,
706            self::JETPACK_PERSONAL_AND_HIGHER,
707            self::JETPACK_PRO_PLANS,
708            self::JETPACK_GOLDEN_TOKEN,
709            self::WPCOM_PRO_PLANS,
710            self::WPCOM_STAGING_PRODUCT,
711            // Business and higher can self serve restoring backups.
712            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
713            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
714        ),
715
716        /*
717         * BACKUP_ONE_TIME - Site has purchased a one-time backup.
718         * Note the jetpack_backup_one_time product never expires. So any feature gated with BACKUP_ONE_TIME will
719         * likewise, never expire.
720         */
721        self::BACKUP_ONE_TIME                   => array(
722            self::JETPACK_BACKUP_ONE_TIME,
723        ),
724        // Plans that grant unlimited Big Sky usage and exit the Big Sky free trial.
725        self::BIG_SKY                           => array(
726            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
727        ),
728        self::BLAZE_CREDITS_VOUCHER             => array(
729            array(
730                // Business.
731                self::BUSINESS_BUNDLE,
732                self::BUSINESS_BUNDLE_MONTHLY,
733                self::BUSINESS_BUNDLE_2Y,
734                self::BUSINESS_BUNDLE_3Y,
735                // Ecommerce.
736                self::ECOMMERCE_BUNDLE,
737                self::ECOMMERCE_BUNDLE_MONTHLY,
738                self::ECOMMERCE_BUNDLE_2Y,
739                self::ECOMMERCE_BUNDLE_3Y,
740            ),
741        ),
742        // BLOG_DOMAIN_ONLY - Users on Blogger plan can only purchase .blog domains.
743        self::BLOG_DOMAIN_ONLY                  => array(
744            self::WPCOM_BLOGGER_PLANS,
745        ),
746        self::CALENDLY                          => array(
747            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
748            self::JETPACK_BUSINESS_PLANS,
749            self::JETPACK_PREMIUM_PLANS,
750            self::WP_P2_PLUS_MONTHLY,
751        ),
752        self::CDN                               => array(
753            self::JETPACK_ALL_SITES,
754            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
755            self::WPCOM_PRO_PLANS,
756        ),
757        self::CLASSIC_SEARCH                    => array(
758            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
759            self::WPCOM_PRO_PLANS,
760            self::JETPACK_SEARCH_PLANS,
761            self::JETPACK_COMPLETE_PLANS,
762            self::JETPACK_PRO_PLANS,
763            self::JETPACK_BUSINESS_PLANS,
764            self::WPCOM_SEARCH,
765            self::WPCOM_SEARCH_MONTHLY,
766            self::WP_P2_PLUS_MONTHLY,
767        ),
768        self::CLOUD_CRITICAL_CSS                => array(
769            self::JETPACK_BOOST_PLANS,
770            self::JETPACK_COMPLETE_PLANS,
771            self::JETPACK_PRO_PLANS,
772        ),
773        self::CORNERSTONE_TEN_PAGES             => array(
774            self::JETPACK_BOOST_PLANS,
775            self::JETPACK_COMPLETE_PLANS,
776            self::JETPACK_PRO_PLANS,
777        ),
778        self::CLOUDFLARE_ANALYTICS              => array(
779            self::JETPACK_PREMIUM_AND_HIGHER,
780            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
781            self::WPCOM_PRO_PLANS,
782        ),
783        self::CLOUDFLARE_CDN                    => array(
784            self::JETPACK_PREMIUM_AND_HIGHER,
785            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
786            self::WPCOM_PRO_PLANS,
787        ),
788        self::CONCIERGE                         => array(
789            self::WPCOM_BUSINESS_PLANS,
790            self::WPCOM_ECOMMERCE_PLANS,
791        ),
792        self::CONCIERGE_BUSINESS                => array(
793            self::WPCOM_BUSINESS_PLANS,
794        ),
795        self::COPY_SITE                         => array(
796            self::WPCOM_PRO_PLANS,
797            self::EXCLUDE_PLANS => array(
798                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
799            ),
800            // Copy a site requires an Atomic site, so this mirrors the plans that can be
801            // Atomic: Personal, Premium, and Business or higher plans (not all paid plans).
802            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
803            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
804            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
805        ),
806        // CORE_AUDIO - core/audio requires a paid plan for uploading audio files.
807        self::CORE_AUDIO                        => array(
808            self::WP_P2_PLUS_MONTHLY,
809            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
810            self::JETPACK_PERSONAL_AND_HIGHER,
811        ),
812        // CORE_COVER - core/cover requires a paid plan for uploading video files.
813        self::CORE_COVER                        => array(
814            self::WP_P2_PLUS_MONTHLY,
815            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
816            self::JETPACK_BUSINESS_PLANS,
817            self::JETPACK_PREMIUM_PLANS,
818        ),
819        // CORE_VIDEO - core/video requires a paid plan.
820        self::CORE_VIDEO                        => array(
821            self::WP_P2_PLUS_MONTHLY,
822            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
823            self::JETPACK_BUSINESS_PLANS,
824            self::JETPACK_PREMIUM_PLANS,
825        ),
826        self::CREDIT_VOUCHERS                   => array(
827            self::BUNDLE_PRO,
828            self::BUNDLE_SUPER,
829            self::BUNDLE_ENTERPRISE,
830            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
831        ),
832        self::CUSTOM_DESIGN                     => array(
833            self::WPCOM_CUSTOM_DESIGN,
834            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
835        ),
836        self::CUSTOM_DOMAIN                     => array(
837            self::WPCOM_BLOGGER_AND_HIGHER_PLANS,
838            self::WOO_HOSTED_PLANS,
839        ),
840        self::DOMAIN_MAPPING                    => array(
841            self::WPCOM_BLOGGER_AND_HIGHER_PLANS,
842            self::WPCOM_PRO_PLANS,
843            self::WOO_HOSTED_PLANS,
844        ),
845        self::DONATIONS                         => array(
846            array(
847                'before_feature_gating_2026' => true,
848                self::WPCOM_ALL_SITES,
849            ),
850            array(
851                'before_feature_gating_2026' => true,
852                self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
853            ),
854            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
855            self::JETPACK_ALL_SITES,
856        ),
857        // ECOMMERCE_MANAGED_PLUGINS - Can install the plugin bundle that comes with eCommerce plans.
858        self::ECOMMERCE_MANAGED_PLUGINS         => array(
859            self::WPCOM_ECOMMERCE_PLANS,
860            self::WPCOM_ECOMMERCE_TRIAL_PLANS,
861            self::WPCOM_WOOEXPRESS_PLANS,
862        ),
863        // ECOMMERCE_MANAGED_PLUGINS_SMALL - Can install the plugin bundle that comes with eCommerce Small plans.
864        self::ECOMMERCE_MANAGED_PLUGINS_SMALL   => array(
865            self::WPCOM_WOOEXPRESS_SMALL_PLANS,
866        ),
867        // ECOMMERCE_MANAGED_PLUGINS_MEDIUM - Can install the plugin bundle that comes with eCommerce Medium plans.
868        self::ECOMMERCE_MANAGED_PLUGINS_MEDIUM  => array(
869            self::WPCOM_ECOMMERCE_PLANS,
870            self::WPCOM_WOOEXPRESS_MEDIUM_PLANS,
871        ),
872        // ECOMMERCE_MANAGED_PLUGINS_TRIAL - Can install the plugin bundle that comes with eCommerce Trial plans.
873        self::ECOMMERCE_MANAGED_PLUGINS_TRIAL   => array(
874            self::WPCOM_ECOMMERCE_TRIAL_PLANS,
875        ),
876        self::EDGE_RULES                        => array(
877            self::WPCOM_PAID_BUSINESS_AND_COMMERCE_PLANS,
878        ),
879        // EDIT_PLUGINS - Provides the edit_plugins capability on atomic sites, does nothing on simple sites.
880        self::EDIT_PLUGINS                      => array(
881            self::WPCOM_PRO_PLANS,
882            self::EXCLUDE_PLANS => array(
883                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
884            ),
885            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
886            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
887        ),
888        // EDIT_THEMES - Provides the edit_themes capability on atomic sites, does nothing on simple sites.
889        self::EDIT_THEMES                       => array(
890            self::WPCOM_PRO_PLANS,
891            self::EXCLUDE_PLANS => array(
892                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
893            ),
894            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
895            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
896        ),
897        // EMAIL_PROFESSIONAL - Access to Titan email hosting, often referred to as WordPress.com "Professional Email".
898        self::EMAIL_PROFESSIONAL                => array(
899            self::WPCOM_TITAN_MAIL_PRODUCTS,
900        ),
901        // EMAIL_SUBSCRIPTION - Represents having at least one product providing email.
902        self::EMAIL_SUBSCRIPTION                => array(
903            self::WPCOM_EMAIL_PRODUCTS,
904        ),
905        self::EMAIL_FORWARDS_EXTENDED_LIMIT     => array(
906            self::BUNDLE_ENTERPRISE,
907            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
908            self::WPCOM_PRO_PLANS,
909        ),
910        // FIELD_FILE - Premium block/feature (jetpack/field-file) for uploading files with cloud backend.
911        // See: https://github.com/Automattic/jetpack/pull/43177 / https://github.a8c.com/Automattic/wpcom/pull/179247
912        self::FIELD_FILE                        => array(
913            array(
914                'before_feature_gating_2026' => true,
915                self::WPCOM_PERSONAL_PLANS,
916                self::WPCOM_PREMIUM_PLANS,
917            ),
918            self::WPCOM_PRO_PLANS,
919            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
920            self::JETPACK_COMPLETE_PLANS,
921            self::JETPACK_PRO_PLANS,
922        ),
923        self::FORM_CONDITIONAL_LOGIC            => array(
924            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
925            self::JETPACK_ALL_SITES,
926        ),
927        self::FORM_INTEGRATIONS                 => array(
928            array(
929                'before_feature_gating_2026' => true,
930                self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
931            ),
932            self::WPCOM_PRO_PLANS,
933            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
934            self::JETPACK_ALL_SITES,
935        ),
936        self::FORM_WEBHOOKS                     => array(
937            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
938            self::JETPACK_ALL_SITES,
939        ),
940        self::FREE_BLOG                         => array(
941            self::WPCOM_ALL_SITES,
942        ),
943        self::FULL_ACTIVITY_LOG                 => array(
944            self::JETPACK_BACKUP_DAILY_PLANS,
945            self::JETPACK_BACKUP_REALTIME_PLANS,
946            self::JETPACK_BACKUP_T0_PLANS,
947            self::JETPACK_BACKUP_T1_PLANS,
948            self::JETPACK_BACKUP_T2_PLANS,
949            self::JETPACK_PERSONAL_AND_HIGHER,
950            self::JETPACK_GOLDEN_TOKEN,
951            self::WPCOM_BLOGGER_AND_HIGHER_PLANS,
952            self::WPCOM_PRO_PLANS,
953        ),
954        self::GITHUB_DEPLOYMENTS                => array(
955            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
956            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
957            self::WPCOM_PRO_PLANS,
958            self::EXCLUDE_PLANS => array(
959                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
960            ),
961        ),
962        self::GLOBAL_STYLES                     => array(
963            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
964        ),
965        self::GOOGLE_ANALYTICS                  => array(
966            self::JETPACK_PREMIUM_AND_HIGHER,
967            self::WPCOM_STARTER_AND_HIGHER_PLANS,
968        ),
969        self::GOOGLE_MY_BUSINESS                => array(
970            self::WPCOM_PRO_PLANS,
971            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
972            self::JETPACK_BUSINESS_PLANS,
973            self::JETPACK_SECURITY_REALTIME_PLANS,
974            self::JETPACK_COMPLETE_PLANS,
975            self::JETPACK_PRO_PLANS,
976            self::JETPACK_SECURITY_T1_PLANS,
977            self::JETPACK_SECURITY_T2_PLANS,
978        ),
979        self::IMAGE_CDN_LIAR                    => array(
980            self::JETPACK_BOOST_PLANS,
981            self::JETPACK_COMPLETE_PLANS,
982            self::JETPACK_PRO_PLANS,
983        ),
984        self::IMAGE_CDN_QUALITY                 => array(
985            self::JETPACK_BOOST_PLANS,
986            self::JETPACK_COMPLETE_PLANS,
987            self::JETPACK_PRO_PLANS,
988        ),
989        self::IMAGE_SIZE_ANALYSIS               => array(
990            self::JETPACK_BOOST_PLANS,
991            self::JETPACK_COMPLETE_PLANS,
992            self::JETPACK_PRO_PLANS,
993        ),
994        self::INSTALL_PLUGINS                   => array(
995            self::WPCOM_PRO_PLANS,
996            self::EXCLUDE_PLANS => array(
997                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
998            ),
999            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1000            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1001        ),
1002        self::INSTALL_PURCHASED_PLUGINS         => array(
1003            self::WPCOM_PRO_PLANS,
1004            self::WPCOM_STARTER_PLANS,
1005            self::EXCLUDE_PLANS => array(
1006                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1007            ),
1008            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1009            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1010        ),
1011        self::INSTALL_THEMES                    => array(
1012            self::WPCOM_PRO_PLANS,
1013            self::JETPACK_ALL_SITES,
1014            self::EXCLUDE_PLANS => array(
1015                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1016            ),
1017            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1018            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1019        ),
1020        self::INSTALL_WOO_ONBOARDING_PLUGINS    => array(
1021            self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1022        ),
1023        self::INSTANT_SEARCH                    => array(
1024            self::WPCOM_SEARCH,
1025            self::WPCOM_SEARCH_MONTHLY,
1026            self::WP_P2_PLUS_MONTHLY,
1027            self::JETPACK_SEARCH_PLANS,
1028            self::JETPACK_COMPLETE_PLANS,
1029            self::JETPACK_PRO_PLANS,
1030        ),
1031        self::JETPACK_DASHBOARD                 => array(
1032            self::WPCOM_PRO_PLANS,
1033            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1034            self::JETPACK_ALL_SITES,
1035        ),
1036
1037        // Allows sites to designate a contact person to look after their site after they pass away.
1038        self::LEGACY_CONTACT                    => array(
1039            self::WPCOM_HUNDRED_YEAR_BUNDLE,
1040        ),
1041        self::LIST_INSTALLED_PLUGINS            => array(
1042            self::WPCOM_PRO_PLANS,
1043            self::WPCOM_STARTER_PLANS,
1044            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1045            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1046        ),
1047        // LIVE_SUPPORT - Monthly plans do not get live support. p7DVsv-a9N-p2.
1048        self::LIVE_SUPPORT                      => array(
1049            // Premium (Excluding Monthly).
1050            self::BUNDLE_PRO,
1051            self::VALUE_BUNDLE,
1052            self::VALUE_BUNDLE_2Y,
1053            self::VALUE_BUNDLE_3Y,
1054            // Pro.
1055            self::PRO_PLAN,
1056            self::PRO_PLAN_2Y,
1057            // Business (Excluding Monthly).
1058            self::BUSINESS_BUNDLE,
1059            self::BUSINESS_BUNDLE_2Y,
1060            self::BUSINESS_BUNDLE_3Y,
1061            // Student (yearly).
1062            self::STUDENT_BUNDLE,
1063            // Ecommerce (Excluding Monthly).
1064            self::ECOMMERCE_BUNDLE,
1065            self::ECOMMERCE_BUNDLE_2Y,
1066            self::ECOMMERCE_BUNDLE_3Y,
1067            // Woo Express (Small and Medium plans), excluding monthly.
1068            self::WPCOM_WOOEXPRESS_MEDIUM_BUNDLE_YEARLY,
1069            self::WPCOM_WOOEXPRESS_SMALL_BUNDLE_YEARLY,
1070        ),
1071
1072        // Enables a setting to lock the site content to prevent changes (incl. disabling comments site-wide).
1073        self::LOCKED_MODE                       => array(
1074            self::WPCOM_HUNDRED_YEAR_BUNDLE,
1075        ),
1076        self::LOGS                              => array(
1077            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1078            self::WPCOM_PRO_PLANS,
1079            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1080            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1081        ),
1082        self::MAILPOET_BUSINESS                 => array(
1083            self::WPCOM_BUSINESS_PLANS,
1084            self::WPCOM_ECOMMERCE_PLANS,
1085            self::WPCOM_WOOEXPRESS_PLANS,
1086            self::WOO_HOSTED_PLANS,
1087        ),
1088        // MANAGE_PLUGINS - Atomic only feature. Can upload, install, and activate any 3rd party plugin.
1089        self::MANAGE_PLUGINS                    => array(
1090            self::WPCOM_PRO_PLANS,
1091            self::EXCLUDE_PLANS => array(
1092                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1093            ),
1094            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1095            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1096        ),
1097        self::MONITORING                        => array(
1098            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1099            self::WPCOM_PRO_PLANS,
1100        ),
1101
1102        // MONITOR_1_MINUTE_CHECK_INTERVAL - Jetpack Monitor checks site uptime once per minute
1103        self::MONITOR_1_MINUTE_CHECK_INTERVAL   => array(
1104            self::JETPACK_MONITOR_MONTHLY,
1105            self::JETPACK_MONITOR_YEARLY,
1106            self::A4A_JETPACK_MONITOR_MONTHLY,
1107            self::A4A_JETPACK_MONITOR_YEARLY,
1108        ),
1109        // MONITOR_MULTIPLE_EMAIL_RECIPIENTS - Jetpack Monitor can email more than one recipient when a site goes down
1110        self::MONITOR_MULTIPLE_EMAIL_RECIPIENTS => array(
1111            self::JETPACK_MONITOR_MONTHLY,
1112            self::JETPACK_MONITOR_YEARLY,
1113            self::A4A_JETPACK_MONITOR_MONTHLY,
1114            self::A4A_JETPACK_MONITOR_YEARLY,
1115        ),
1116        // MONITOR_SMS_NOTIFICATIONS - Jetpack Monitor can send notifications via SMS when a site goes down
1117        self::MONITOR_SMS_NOTIFICATIONS         => array(
1118            self::JETPACK_MONITOR_MONTHLY,
1119            self::JETPACK_MONITOR_YEARLY,
1120            self::A4A_JETPACK_MONITOR_MONTHLY,
1121            self::A4A_JETPACK_MONITOR_YEARLY,
1122        ),
1123        self::MULTISTEP_FORM                    => array(
1124            array(
1125                'before_feature_gating_2026' => true,
1126                self::WPCOM_PERSONAL_PLANS,
1127                self::WPCOM_PREMIUM_PLANS,
1128            ),
1129            self::WPCOM_PRO_PLANS,
1130            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1131            self::JETPACK_ALL_SITES,
1132        ),
1133        self::NO_ADVERTS_NO_ADVERTS_PHP         => array(
1134            self::NO_ADS,
1135            // Deliberately leaves out the Starter plan.
1136            self::WPCOM_BLOGGER_PLANS,
1137            self::WPCOM_PERSONAL_PLANS,
1138            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1139        ),
1140        // NO_WPCOM_BRANDING - Enable the ability to hide the WP.com branding in the site footer.
1141        self::NO_WPCOM_BRANDING                 => array(
1142            self::WPCOM_PRO_PLANS,
1143            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1144            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1145        ),
1146        self::OPENTABLE                         => array(
1147            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1148            self::JETPACK_BUSINESS_PLANS,
1149            self::JETPACK_PREMIUM_PLANS,
1150        ),
1151        self::PAYMENTS                          => array(
1152            array(
1153                'before_feature_gating_2026' => true,
1154                self::WPCOM_PERSONAL_PLANS,
1155            ),
1156            self::WPCOM_STARTER_PLANS,
1157            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1158        ),
1159        self::PAYMENT_BUTTONS                   => array(
1160            array(
1161                'before_feature_gating_2026' => true,
1162                self::WPCOM_ALL_SITES,
1163            ),
1164            array(
1165                'before_feature_gating_2026' => true,
1166                self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1167            ),
1168            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1169            self::JETPACK_ALL_SITES,
1170        ),
1171        self::PAYPAL_PAYMENT_BUTTONS            => array(
1172            array(
1173                'before_feature_gating_2026' => true,
1174                self::WPCOM_ALL_SITES,
1175            ),
1176            array(
1177                'before_feature_gating_2026' => true,
1178                self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1179            ),
1180            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1181            self::JETPACK_ALL_SITES,
1182        ),
1183        self::PERFORMANCE                       => array(
1184            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1185            self::WPCOM_PRO_PLANS,
1186        ),
1187        self::PERFORMANCE_HISTORY               => array(
1188            self::JETPACK_BOOST_PLANS,
1189            self::JETPACK_COMPLETE_PLANS,
1190            self::JETPACK_PRO_PLANS,
1191        ),
1192        self::PODCASTING                        => array(
1193            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1194            self::JETPACK_ALL_SITES,
1195        ),
1196        self::POLLDADDY                         => array(
1197            self::JETPACK_BUSINESS_PLANS,
1198        ),
1199        // POSTS_TO_PODCAST_TIER_{1,2,3} â€” generates a podcast-style episode
1200        // from recent posts. Monthly quotas: TIER_1 = 5, TIER_2 = 10,
1201        // TIER_3 = 20. Sites accumulate tiers via the _AND_HIGHER cascades;
1202        // the lib's quota helper takes the highest tier present.
1203        self::POSTS_TO_PODCAST_TIER_1           => array(
1204            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1205        ),
1206        self::POSTS_TO_PODCAST_TIER_2           => array(
1207            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1208        ),
1209        self::POSTS_TO_PODCAST_TIER_3           => array(
1210            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1211        ),
1212        // PREMIUM_CONTENT_CONTAINER - premium-content requires a paid wpcom plan.
1213        self::PREMIUM_CONTENT_CONTAINER         => array(
1214            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1215            self::WP_P2_PLUS_MONTHLY,
1216        ),
1217        self::PERSONAL_THEMES                   => array(
1218            self::WPCOM_UNLIMITED_THEMES,
1219            self::BUNDLE_ENTERPRISE,
1220            self::WPCOM_PRO_PLANS,
1221            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1222            self::JETPACK_BUSINESS_PLANS,
1223        ),
1224        self::PREMIUM_THEMES                    => array(
1225            self::WPCOM_UNLIMITED_THEMES,
1226            self::BUNDLE_ENTERPRISE,
1227            self::WPCOM_PRO_PLANS,
1228            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1229            self::JETPACK_BUSINESS_PLANS,
1230        ),
1231        self::PARTNER_THEMES                    => array(
1232            // We do not want all paid plans to have the feature, just Personal, Premium, and Business or higher plans.
1233            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1234            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1235            self::WPCOM_PRO_PLANS,
1236            self::EXCLUDE_PLANS => array(
1237                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1238            ),
1239        ),
1240        self::COMMUNITY_THEMES                  => array(
1241            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1242            self::WPCOM_PRO_PLANS,
1243            self::EXCLUDE_PLANS => array(
1244                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1245            ),
1246            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1247        ),
1248        self::WOOCOMMERCE_THEMES                => array(
1249            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1250            self::WPCOM_PRO_PLANS,
1251            self::EXCLUDE_PLANS => array(
1252                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1253            ),
1254            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1255        ),
1256        self::SENSEI_THEMES                     => array(
1257            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1258            self::WPCOM_PRO_PLANS,
1259            self::EXCLUDE_PLANS => array(
1260                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1261            ),
1262        ),
1263        self::PRIORITY_SUPPORT                  => array(
1264            self::JETPACK_BACKUP_T1_PLANS,
1265            self::JETPACK_BACKUP_T2_PLANS,
1266            self::JETPACK_PERSONAL_AND_HIGHER,
1267            self::JETPACK_GOLDEN_TOKEN,
1268            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1269            self::WPCOM_PRO_PLANS,
1270        ),
1271        self::PRIVATE_WHOIS                     => array(
1272            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1273        ),
1274        self::REAL_TIME_BACKUPS                 => array(
1275            self::JETPACK_BACKUP_REALTIME_PLANS,
1276            self::JETPACK_BACKUP_T0_PLANS,
1277            self::JETPACK_BACKUP_T1_PLANS,
1278            self::JETPACK_BACKUP_T2_PLANS,
1279            self::JETPACK_BUSINESS_PLANS,
1280            self::JETPACK_COMPLETE_PLANS,
1281            self::JETPACK_PRO_PLANS,
1282            self::JETPACK_SECURITY_REALTIME_PLANS,
1283            self::JETPACK_SECURITY_T0_PLANS,
1284            self::JETPACK_SECURITY_T1_PLANS,
1285            self::JETPACK_SECURITY_T2_PLANS,
1286            self::JETPACK_STARTER_PLANS,
1287            self::JETPACK_GOLDEN_TOKEN,
1288            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1289            self::WPCOM_PRO_PLANS,
1290            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1291        ),
1292
1293        self::REAL_TIME_COLLABORATION           => array(
1294            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1295        ),
1296
1297        self::RECURRING_PAYMENTS                => array(
1298            self::WPCOM_ALL_SITES,
1299            self::WPCOM_STARTER_PLANS,
1300            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1301            self::JETPACK_ALL_SITES,
1302        ),
1303
1304        /*
1305         * Reduced email priority when sending emails via SMTP via the Atomic platform.
1306         */
1307        self::REDUCED_ATOMIC_EMAIL_PRIORITY     => array(
1308            self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1309            self::WPCOM_MIGRATION_TRIAL_PLANS,
1310            self::WPCOM_HOSTING_TRIAL_PLANS,
1311        ),
1312
1313        /*
1314         * REPUBLICIZE
1315         *
1316         * Active for:
1317         * - Simple and Atomic sites with Premium or up plan.
1318         * - Jetpack sites with Premium or up plan, or a Jetpack Social plan.
1319         */
1320        self::REPUBLICIZE                       => array(
1321            self::WP_P2_PLUS_MONTHLY,
1322            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1323            self::JETPACK_ALL_SITES,
1324        ),
1325        self::SCAN                              => array(
1326            self::JETPACK_PREMIUM_AND_HIGHER,
1327            self::JETPACK_SCAN_PLANS,
1328            self::JETPACK_GOLDEN_TOKEN,
1329            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1330            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1331            self::WPCOM_PRO_PLANS,
1332            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1333        ),
1334
1335        /*
1336         * SCAN_MANAGED - Scan results are managed internally by Atomic guild HEs and not shown in user UI.
1337         * See D57207-code.
1338         */
1339        self::SCAN_MANAGED                      => array(
1340            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1341            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1342            self::WPCOM_PRO_PLANS,
1343            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1344        ),
1345
1346        // This governs UI access to Jetpack Scan.
1347        // All WoW sites should perform scans, however we don't want to expose the UI to sites on lower wpcom plans.
1348        // It's not completely clear how this differs from SCAN_MANAGED.
1349        self::SCAN_SELF_SERVE                   => array(
1350            self::JETPACK_PREMIUM_AND_HIGHER,
1351            self::JETPACK_SCAN_PLANS,
1352            self::JETPACK_GOLDEN_TOKEN,
1353            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1354            self::WPCOM_PRO_PLANS,
1355            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1356        ),
1357
1358        /*
1359         * SCHEDULED_UPDATES - Allows users to schedule plugin and (eventually) theme updates for their sites.
1360         *
1361         * @see pcmemI-2O3-p2
1362         */
1363        self::SCHEDULED_UPDATES                 => array(
1364            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1365            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1366        ),
1367
1368        /*
1369         * SECURITY_SETTINGS - Initially added to determine whether to show /settings/security.
1370         * More info: https://github.com/Automattic/wp-calypso/issues/51820
1371         *
1372         * Active for:
1373         * - Simple and Atomic sites with Business or up plan.
1374         * - Jetpack sites with any plan.
1375         */
1376        self::SECURITY_SETTINGS                 => array(
1377            self::WPCOM_PRO_PLANS,
1378            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1379            self::JETPACK_ALL_SITES,
1380            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1381        ),
1382        self::SEO_ADMIN_UI                      => array(
1383            // For now, this is controlled via a blog sticker in Store_Product_List.
1384            array(
1385                'before' => '2004-12-12',
1386                self::WPCOM_ALL_SITES,
1387            ),
1388        ),
1389        self::SEO_PREVIEW_TOOLS                 => array(
1390            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1391            self::BUNDLE_ENTERPRISE,
1392            self::JETPACK_ALL_SITES,
1393            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1394        ),
1395        self::SEND_A_MESSAGE                    => array(
1396            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1397            self::JETPACK_ALL_SITES,
1398        ),
1399
1400        /*
1401         * SET_PRIMARY_CUSTOM_DOMAIN - Set custom domain as primary.
1402         * It allows to set a custom domain of the site as primary.
1403         *
1404         * Active for:
1405         * - Simple and Atomic sites with any standard WordPress.com plan
1406         */
1407        self::SET_PRIMARY_CUSTOM_DOMAIN         => array(
1408            self::WPCOM_BLOGGER_AND_HIGHER_PLANS,
1409            self::WOO_HOSTED_PLANS,
1410            self::YOAST_PREMIUM,
1411        ),
1412        // Hosting Configuration.
1413        self::SFTP                              => array(
1414            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1415            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1416            self::WPCOM_PRO_PLANS,
1417            self::EXCLUDE_PLANS => array(
1418                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1419            ),
1420            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1421        ),
1422
1423        self::SSH                               => array(
1424            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1425            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1426            self::WPCOM_PRO_PLANS,
1427            self::EXCLUDE_PLANS => array(
1428                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1429            ),
1430            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1431        ),
1432        self::SIMPLE_PAYMENTS                   => array(
1433            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1434            self::JETPACK_PREMIUM_AND_HIGHER,
1435            self::JETPACK_CREATOR_PLANS,
1436            self::JETPACK_GROWTH_PLANS,
1437        ),
1438        self::SITE_PREVIEW_LINKS                => array(
1439            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1440        ),
1441
1442        /*
1443         * SOCIAL_SHARES_1000 - This feature is linked to the ability to share upto 1000 social media shares on the Jetpack Social Plugin.
1444         *
1445         */
1446        self::SOCIAL_SHARES_1000                => array(
1447            self::JETPACK_ALL_SITES,
1448            self::BUNDLE_ENTERPRISE,
1449        ),
1450
1451        self::SOCIAL_ENHANCED_PUBLISHING        => array(
1452            self::JETPACK_SOCIAL_ADVANCED_PLANS,
1453            self::JETPACK_COMPLETE_PLANS,
1454            self::JETPACK_PRO_PLANS,
1455            self::BUNDLE_ENTERPRISE,
1456            self::JETPACK_SOCIAL_V1_PLANS,
1457            self::JETPACK_SOCIAL_PLANS,
1458            self::JETPACK_GROWTH_PLANS,
1459            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1460        ),
1461        self::SOCIAL_ADMIN_UI_V2                => array(
1462            // For now, this is controlled via a blog sticker in Store_Product_List.
1463            array(
1464                'before' => '2004-12-12',
1465                self::WPCOM_ALL_SITES,
1466            ),
1467        ),
1468        self::SOCIAL_IMAGE_FOCAL_POINT          => array(
1469            // For now, this is controlled via a blog sticker in Store_Product_List.
1470            array(
1471                'before' => '2004-12-12',
1472                self::WPCOM_ALL_SITES,
1473            ),
1474        ),
1475        self::SOCIAL_IMAGE_GENERATOR            => array(
1476            self::JETPACK_SOCIAL_ADVANCED_PLANS,
1477            self::JETPACK_COMPLETE_PLANS,
1478            self::JETPACK_PRO_PLANS,
1479            self::BUNDLE_ENTERPRISE,
1480            self::JETPACK_SOCIAL_V1_PLANS,
1481            self::JETPACK_SOCIAL_PLANS,
1482            self::JETPACK_GROWTH_PLANS,
1483            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1484        ),
1485        self::SOCIAL_MESSAGE_TEMPLATES          => array(
1486            // Gated on the paid social plans, matching SOCIAL_ENHANCED_PUBLISHING.
1487            self::JETPACK_SOCIAL_ADVANCED_PLANS,
1488            self::JETPACK_COMPLETE_PLANS,
1489            self::JETPACK_PRO_PLANS,
1490            self::BUNDLE_ENTERPRISE,
1491            self::JETPACK_SOCIAL_V1_PLANS,
1492            self::JETPACK_SOCIAL_PLANS,
1493            self::JETPACK_GROWTH_PLANS,
1494            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1495        ),
1496        self::SOCIAL_IMAGE_AUTO_CONVERT         => array(
1497            self::WPCOM_ALL_SITES,
1498        ),
1499        self::SPACE                             => array(
1500            self::WPCOM_ALL_SITES,
1501        ),
1502
1503        /*
1504         * Products that have upgraded storage space on WordPress.com, beyond
1505         * the bare minimum advertised for free sites. This list includes all
1506         * WordPress.com plans and space upgrade products.
1507         */
1508        self::SPACE_UPGRADED_STORAGE            => array(
1509            self::WPCOM_BLOGGER_AND_HIGHER_PLANS,
1510            self::BUNDLE_SUPER,
1511            self::BUNDLE_ENTERPRISE,
1512            self::WP_P2_PLUS_MONTHLY,
1513            self::SPACE_1GB,
1514            self::SPACE_3GB,
1515            self::SPACE_10GB,
1516            self::SPACE_25GB,
1517            self::SPACE_50GB,
1518            self::SPACE_100GB,
1519            self::SPACE_200GB,
1520            self::EXCLUDE_PLANS => array(
1521                self::WPCOM_HOSTING_TRIAL_PLANS,
1522            ),
1523        ),
1524        self::STAGING_SITES                     => array(
1525            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1526            self::EXCLUDE_PLANS => array(
1527                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1528            ),
1529            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1530        ),
1531        // Gives near full access to all stats features. All features except new commercial level modules like UTM and device stats.
1532        self::STATS_FREE                        => array(
1533            self::JETPACK_STATS_PLANS,
1534            self::JETPACK_GROWTH_PLANS,
1535            // Provides legacy access for free and personal sites created before 2024-01-09.
1536            // Can be removed once we are ready to paywall all free and/or old personal sites.
1537            array(
1538                'before' => '2024-01-09',
1539                self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1540                self::WPCOM_ALL_SITES,
1541            ),
1542        ),
1543        // Provides limited stats for free and personal sites created before 2024-12-06.
1544        // Features: Posts/Locations/Emails/File downloads
1545        // Can be removed once we are ready to paywall all free sites.
1546        self::STATS_BASIC_TEMP                  => array(
1547            array(
1548                'before' => '2024-12-12',
1549                self::WPCOM_ALL_SITES,
1550            ),
1551        ),
1552        // Provides personal sites and higher access to all stats features except commercial level modules.
1553        // Features: Posts/Locations/Emails/File downloads/Referrers/Clicks
1554        self::STATS_PAID                        => array(
1555            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1556            self::WP_P2_PLUS_MONTHLY,
1557            self::JETPACK_STATS_PWYW,
1558            self::JETPACK_STATS_MONTHLY,
1559            self::JETPACK_STATS_BI_YEARLY,
1560            self::JETPACK_STATS_YEARLY,
1561            self::JETPACK_COMPLETE_PLANS,
1562            self::JETPACK_PRO_PLANS,
1563            self::JETPACK_BUSINESS_PLANS,
1564            self::JETPACK_GROWTH_PLANS,
1565        ),
1566        // Provides premium sites and higher access to all stats features.
1567        // Features: STATS_PAID + UTM & Devices modules
1568        self::STATS_COMMERCIAL                  => array(
1569            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1570            self::JETPACK_STATS_MONTHLY,
1571            self::JETPACK_STATS_BI_YEARLY,
1572            self::JETPACK_STATS_YEARLY,
1573            self::JETPACK_COMPLETE_PLANS,
1574            self::JETPACK_PRO_PLANS,
1575            self::JETPACK_BUSINESS_PLANS,
1576            self::JETPACK_GROWTH_PLANS,
1577            // A4A Jetpack Stats plans
1578            self::A4A_JETPACK_STATS_MONTHLY,
1579            self::A4A_JETPACK_STATS_YEARLY,
1580        ),
1581        self::STUDIO_SYNC                       => array(
1582            self::WPCOM_PRO_PLANS,
1583            self::WPCOM_PERSONAL_AND_PREMIUM_PLANS,
1584            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1585            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1586        ),
1587
1588        // Importing subscribers to the site without limits.
1589        self::SUBSCRIBER_UNLIMITED_IMPORTS      => array(
1590            self::WP_P2_PLUS_MONTHLY,
1591            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1592            self::JETPACK_PERSONAL_AND_HIGHER,
1593            self::JETPACK_SOCIAL_PLANS,
1594            self::JETPACK_SOCIAL_ADVANCED_PLANS,
1595            self::JETPACK_SOCIAL_V1_PLANS,
1596            self::JETPACK_CREATOR_PLANS,
1597            self::JETPACK_GROWTH_PLANS,
1598            self::EXCLUDE_PLANS => array(
1599                self::WPCOM_MIGRATION_TRIAL_PLANS,
1600                self::WPCOM_HOSTING_TRIAL_PLANS,
1601            ),
1602            // A4A Jetpack Stats plans
1603            self::A4A_JETPACK_STATS_MONTHLY,
1604            self::A4A_JETPACK_STATS_YEARLY,
1605        ),
1606
1607        self::SUBSCRIPTION_GIFTING              => array(
1608            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1609            self::EXCLUDE_PLANS => array(
1610                self::WPCOM_MIGRATION_TRIAL_PLANS,
1611                self::WPCOM_HOSTING_TRIAL_PLANS,
1612                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1613            ),
1614        ),
1615
1616        // SUPPORT - Everybody needs somebody.
1617        self::SUPPORT                           => array(
1618            self::WPCOM_ALL_SITES,
1619            self::JETPACK_PERSONAL_AND_HIGHER,
1620            self::JETPACK_GOLDEN_TOKEN,
1621        ),
1622        self::TITAN_MAIL_1YEAR_TRIAL            => array(
1623            array(
1624                self::WPCOM_BUSINESS_PLANS,
1625                self::WPCOM_ECOMMERCE_PLANS,
1626            ),
1627            self::EXCLUDE_PLANS => array(
1628                self::BUSINESS_BUNDLE_MONTHLY,
1629                self::ECOMMERCE_BUNDLE_MONTHLY,
1630                self::A4A_WPCOM_BUSINESS_BUNDLE_MONTHLY,
1631                self::WPCOM_MIGRATION_TRIAL_PLANS,
1632                self::WPCOM_HOSTING_TRIAL_PLANS,
1633            ),
1634        ),
1635        self::UPGRADED_UPLOAD_FILETYPES         => array(
1636            self::SPACE_1GB,
1637            self::SPACE_3GB,
1638            self::SPACE_10GB,
1639            self::SPACE_25GB,
1640            self::SPACE_50GB,
1641            self::SPACE_100GB,
1642            self::SPACE_200GB,
1643            self::WPCOM_BLOGGER_AND_HIGHER_PLANS,
1644            self::WP_P2_PLUS_MONTHLY,
1645        ),
1646        self::UPLOAD_AUDIO_FILES                => array(
1647            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1648            self::JETPACK_ALL_SITES,
1649        ),
1650        self::UPLOAD_PLUGINS                    => array(
1651            self::WPCOM_PRO_PLANS,
1652            self::EXCLUDE_PLANS => array(
1653                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1654            ),
1655            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1656            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1657        ),
1658        self::UPLOAD_SPACE_1GB                  => array(
1659            self::SPACE_1GB,
1660        ),
1661        self::UPLOAD_SPACE_3GB                  => array(
1662            self::SPACE_3GB,
1663        ),
1664        self::UPLOAD_SPACE_10GB                 => array(
1665            self::SPACE_10GB,
1666        ),
1667        self::UPLOAD_SPACE_25GB                 => array(
1668            self::SPACE_25GB,
1669        ),
1670        self::UPLOAD_SPACE_50GB                 => array(
1671            self::SPACE_50GB,
1672        ),
1673        self::UPLOAD_SPACE_100GB                => array(
1674            self::SPACE_100GB,
1675        ),
1676        self::UPLOAD_SPACE_200GB                => array(
1677            self::SPACE_200GB,
1678            array(
1679                'before' => LEGACY_200GB_CUTOFF_DATE,
1680                self::WPCOM_BUSINESS_PLANS,
1681                self::WPCOM_ECOMMERCE_PLANS,
1682            ),
1683            array(
1684                'required_sticker' => 'legacy-200gb-storage',
1685                self::WPCOM_BUSINESS_PLANS,
1686                self::WPCOM_ECOMMERCE_PLANS,
1687            ),
1688        ),
1689        self::UPLOAD_SPACE_UNLIMITED            => array(
1690            array(
1691                'before' => '2019-08-01',
1692                self::WPCOM_BUSINESS_PLANS,
1693                self::WPCOM_ECOMMERCE_PLANS,
1694            ),
1695        ),
1696        self::UPLOAD_THEMES                     => array(
1697            self::WPCOM_PRO_PLANS,
1698            self::EXCLUDE_PLANS => array(
1699                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1700            ),
1701            self::WPCOM_PERSONAL_AND_HIGHER_PLANS,
1702            self::WPCOM_FLEX_CACHE_SITE_FREE_PLANS,
1703        ),
1704
1705        /*
1706         * UPLOAD_VIDEO_FILES - This feature is linked to the ability to upload video files to the website.
1707         *
1708         * Active for:
1709         * - Simple and Atomic sites with Premium or up plan.
1710         * - Jetpack sites with any plan.
1711         */
1712        self::UPLOAD_VIDEO_FILES                => array(
1713            self::WP_P2_PLUS_MONTHLY,
1714            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1715            self::JETPACK_ALL_SITES,
1716        ),
1717
1718        self::VAULTPRESS_AUTOMATED_RESTORES     => array(
1719            self::JETPACK_PREMIUM_PLANS,
1720            self::JETPACK_BUSINESS_PLANS,
1721        ),
1722        self::VAULTPRESS_BACKUP_ARCHIVE         => array(
1723            self::JETPACK_PREMIUM_PLANS,
1724            self::JETPACK_BUSINESS_PLANS,
1725        ),
1726        self::VAULTPRESS_BACKUPS                => array(
1727            self::JETPACK_PERSONAL_AND_HIGHER,
1728        ),
1729        self::VAULTPRESS_SECURITY_SCANNING      => array(
1730            self::JETPACK_BUSINESS_PLANS,
1731        ),
1732        self::VAULTPRESS_STORAGE_SPACE          => array(
1733            self::JETPACK_PREMIUM_PLANS,
1734            self::JETPACK_BUSINESS_PLANS,
1735        ),
1736
1737        /*
1738         * VIDEO_HOSTING - Host video effortlessly and deliver it at high speeds to your viewers.
1739         * https://jetpack.com/features/design/video-hosting/
1740         *
1741         * Active for:
1742         * - Simple and Atomic sites with Premium or up plan.
1743         * - Jetpack sites with Premium or up plan.
1744         */
1745        self::VIDEO_HOSTING                     => array(
1746            array(
1747                'before_feature_gating_2026' => true,
1748                self::WPCOM_PREMIUM_PLANS,
1749            ),
1750            self::WPCOM_PRO_PLANS,
1751            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1752            self::JETPACK_PREMIUM_AND_HIGHER,
1753            self::EXCLUDE_PLANS => array(
1754                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1755            ),
1756        ),
1757        self::VIDEOPRESS                        => array(
1758            self::JETPACK_BUSINESS_PLANS,
1759            self::JETPACK_COMPLETE_PLANS,
1760            self::JETPACK_PRO_PLANS,
1761            self::JETPACK_PERSONAL_PLANS,
1762            self::JETPACK_PREMIUM_PLANS,
1763            self::JETPACK_VIDEOPRESS_PLANS,
1764            array(
1765                'before_feature_gating_2026' => true,
1766                self::WPCOM_PREMIUM_PLANS,
1767            ),
1768            // Provisioned VideoPress channels keep VideoPress on current Premium plans.
1769            array(
1770                'required_sticker' => 'videopress-channel',
1771                self::WPCOM_PREMIUM_PLANS,
1772            ),
1773            self::WPCOM_PRO_PLANS,
1774            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1775            self::WPCOM_VIDEOPRESS,
1776            self::WPCOM_VIDEOPRESS_PRO,
1777            self::WP_P2_PLUS_MONTHLY,
1778            array(
1779                'before' => '2021-10-07',
1780                self::JETPACK_SECURITY_DAILY_PLANS,
1781                self::JETPACK_SECURITY_REALTIME_PLANS,
1782                self::JETPACK_SECURITY_T0_PLANS,
1783                self::JETPACK_SECURITY_T1_PLANS,
1784                self::JETPACK_SECURITY_T2_PLANS,
1785            ),
1786        ),
1787
1788        /*
1789         * Note: VIDEOPRESS_1TB_STORAGE and VIDEOPRESS_UNLIMITED_STORAGE are
1790         * currently only checked on standalone Jetpack sites.
1791         * For example, adding VIDEOPRESS_UNLIMITED_STORAGE to a WP.com plan
1792         * will not provide it with unlimited VideoPress storage.
1793         *
1794         * All WoA VIDEOPRESS sites currently get 2TB storage on their cache
1795         * site for VideoPress.
1796         */
1797        self::VIDEOPRESS_1TB_STORAGE            => array(
1798            array(
1799                self::JETPACK_COMPLETE_PLANS,
1800                self::JETPACK_PRO_PLANS,
1801                self::JETPACK_VIDEOPRESS_PLANS,
1802                self::JETPACK_PREMIUM_PLANS,
1803                self::JETPACK_BUSINESS_PLANS,
1804            ),
1805        ),
1806        // VIDEOPRESS_VIDEO - videopress/video requires a paid plan.
1807        self::VIDEOPRESS_VIDEO                  => array(
1808            self::WP_P2_PLUS_MONTHLY,
1809            array(
1810                'before_feature_gating_2026' => true,
1811                self::WPCOM_PREMIUM_PLANS,
1812            ),
1813            self::WPCOM_PRO_PLANS,
1814            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1815            self::JETPACK_BUSINESS_PLANS,
1816            self::JETPACK_PREMIUM_PLANS,
1817            self::EXCLUDE_PLANS => array(
1818                self::WPCOM_ECOMMERCE_TRIAL_PLANS,
1819            ),
1820        ),
1821        self::VIDEOPRESS_UNLIMITED_STORAGE      => array(
1822            array(
1823                'before' => '2021-10-07',
1824                self::JETPACK_COMPLETE_PLANS,
1825                self::JETPACK_SECURITY_DAILY_PLANS,
1826                self::JETPACK_SECURITY_REALTIME_PLANS,
1827                self::JETPACK_SECURITY_T0_PLANS,
1828                self::JETPACK_SECURITY_T1_PLANS,
1829                self::JETPACK_SECURITY_T2_PLANS,
1830                self::JETPACK_PREMIUM_PLANS,
1831                self::JETPACK_BUSINESS_PLANS,
1832            ),
1833        ),
1834        self::WHATSAPP_BUTTON                   => array(
1835            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1836            self::JETPACK_ALL_SITES,
1837        ),
1838        // Woo bundle pricing experiment: the sticker is required on every plan, Commerce included.
1839        self::WOO_BUNDLE_EXTENSIONS             => array(
1840            array(
1841                'required_sticker' => self::STICKER_WOO_BUNDLE_EXPERIMENT,
1842                self::WPCOM_PAID_BUSINESS_AND_COMMERCE_PLANS,
1843            ),
1844        ),
1845
1846        /*
1847         * WOOP - WooCommerce on all Plans is available to install.
1848         *
1849         * Active for:
1850         * - Simple and Atomic sites with Business or up plan.
1851         * - Not Jetpack sites
1852         */
1853        self::WOOP                              => array(
1854            self::WPCOM_PRO_PLANS,
1855            self::WPCOM_BUSINESS_AND_HIGHER_PLANS,
1856        ),
1857        self::WORDADS                           => array(
1858            self::JETPACK_STARTER_PLANS,
1859            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1860            self::JETPACK_PREMIUM_AND_HIGHER,
1861            self::JETPACK_CREATOR_PLANS,
1862            self::JETPACK_GROWTH_PLANS,
1863        ),
1864
1865        /*
1866         * WORDADS_JETPACK - `wordads-jetpack` is maintained as a legacy alias of `wordads` which was used to gate
1867         * the feature in old versions of Jetpack.
1868         * @see https://github.com/Automattic/jetpack/blob/c4f8fe120e1286e85f49e20e0f7fe22e44641449/projects/plugins/jetpack/class.jetpack-plan.php#L330.
1869         */
1870        self::WORDADS_JETPACK                   => array(
1871            self::WPCOM_PREMIUM_AND_HIGHER_PLANS,
1872            self::JETPACK_PREMIUM_AND_HIGHER,
1873        ),
1874    );
1875    /**
1876     * Some A8C owned sites have additional features enabled. e.g. Jetpack SEO.
1877     * This is an array of blog IDs where these features are enabled.
1878     */
1879    public const A8C_SITES_WITH_ADDITIONAL_SEO_FEATURES = array(
1880        1, // https://wordpress.com/
1881        69197545, // br.support.wordpress.com
1882        69197545, // br.support.wordpress.com
1883        12084301, // he.support.wordpress.com
1884        12358344, // pt.support.wordpress.com
1885        20614491, // de.support.wordpress.com
1886        110643074, // es.support.wordpress.com
1887        9619154, // en.support.wordpress.com
1888        9620355, // fr.support.wordpress.com
1889        22718864, // ru.support.wordpress.com
1890        26068228, // ja.support.wordpress.com
1891        151395884, // ko.support.wordpress.com
1892        151398260, // sv.support.wordpress.com
1893        151398564, // ar.support.wordpress.com
1894        150300509, // it.support.wordpress.com
1895        150381433, // nl.support.wordpress.com
1896        150645278, // id.support.wordpress.com
1897        150881074, // tr.support.wordpress.com
1898        151397720, // zh-cn.support.wordpress.com
1899        151397956, // zh-tw.support.wordpress.com
1900        3584907, // en.blog.wordpress.com
1901        7944537, // ja.blog.wordpress.com
1902        11241806, // es.blog.wordpress.com
1903        8181651, // pt.blog.wordpress.com
1904        8994420, // fr.blog.wordpress.com
1905        66243751, // br.blog.wordpress.com
1906        196931530, // enwpgo.wordpress.com
1907        173323553, // eswpgo.wordpress.com
1908        173331416, // dewpgo.wordpress.com
1909        162814143, // frwpgo.wordpress.com
1910        173328699, // itwpgo.wordpress.com
1911        163161552, // brwpgo.wordpress.com
1912        53424024, // discover.wordpress.com
1913        489937, // dailypost.wordpress.com
1914        33534099,  // developer.wordpress.com
1915        233643880, // eswpcomdeveloper.wordpress.com
1916        244311505, // jawpcomdeveloper.wordpress.com
1917        244447807, // frwpcomdeveloper.wordpress.com
1918        244448116, // dewpcomdeveloper.wordpress.com
1919        244448279, // ptbrwpcomdeveloper.wordpress.com
1920        244517526, // idwpcomdeveloper.wordpress.com
1921        244516213, // itwpcomdeveloper.wordpress.com
1922        244518337, // nlwpcomdeveloper.wordpress.com
1923        22994, // theme.wordpress.com
1924        16390, // learn.wordpress.com
1925        54117, // automattic.wordpress.com
1926    );
1927
1928    /**
1929     * Checks whether the given feature is declared in our map.
1930     *
1931     * @param string $feature The feature to check.
1932     *
1933     * @return bool Whether the given feature exists.
1934     */
1935    public static function feature_exists( $feature ) {
1936        return ! empty( self::FEATURES_MAP[ $feature ] );
1937    }
1938
1939    /**
1940     * Given a primitive type $needle, and an array $haystack, recursively
1941     * search $haystack for an instance of $needle. If arrays are encountered,
1942     * they will also be searched. Only strict comparisons are used.
1943     *
1944     * @param mixed $needle   What to look for.
1945     * @param array $haystack Array of items to check, may contain other arrays.
1946     *
1947     * @return bool Is the needle in the haystack somewhere?
1948     */
1949    public static function in_array_recursive( $needle, $haystack ) {
1950        foreach ( $haystack as $item ) {
1951            if ( is_array( $item ) ) {
1952                if ( self::in_array_recursive( $needle, $item ) ) {
1953                    return true;
1954                }
1955            } elseif ( $item === $needle ) {
1956                return true;
1957            }
1958        }
1959        return false;
1960    }
1961
1962    /**
1963     * Given an array of $purchases and a single feature name, consult the FEATURES_MAP to determine if the feature
1964     * is included in one of the $purchases.
1965     *
1966     * Use the function wpcom_site_has_feature( $feature ) to determine if a site has access to a certain feature.
1967     *
1968     * @param string    $feature       A singular feature.
1969     * @param array     $purchases     A collection of purchases.
1970     * @param string    $site_type     Site type to check. Can be 'wpcom' or 'jetpack'. Default empty string.
1971     * @param int|null  $blog_id       The blog ID to check. Default null.
1972     * @param bool|null $assume_legacy Cohort to assume instead of the site's own; null reads it from the site.
1973     *
1974     * @return bool Is the feature included in one of the purchases.
1975     */
1976    public static function has_feature( $feature, $purchases, $site_type = '', $blog_id = null, $assume_legacy = null ) {
1977        if ( ! self::feature_exists( $feature ) ) {
1978            return false;
1979        }
1980
1981        $products_map = self::FEATURES_MAP[ $feature ];
1982
1983        // Automatically grant features that don't require any purchase.
1984        if (
1985            ( 'wpcom' === $site_type && in_array( self::WPCOM_ALL_SITES, $products_map, true ) ) ||
1986            ( 'jetpack' === $site_type && in_array( self::JETPACK_ALL_SITES, $products_map, true ) )
1987        ) {
1988            return true;
1989        }
1990
1991        foreach ( $purchases as $purchase ) {
1992            if ( self::purchase_in_products_map( $purchase, $products_map, $blog_id, $assume_legacy ) ) {
1993                return true;
1994            }
1995        }
1996        return false;
1997    }
1998
1999    /**
2000     * Treat free plan as a purchase so the logic for purchase_in_products_map are applied when checking for legacy features.
2001     * As the free plan isn't actually a purchase, there is no subscribed_date, so we use the blog_registered_date instead.
2002     *
2003     * @param array  $purchases Reference to an array of purchases, this function adds a free plan to the end of the array passed in.
2004     * @param string $site_type Site type to check. Can be 'wpcom' or 'jetpack'.
2005     * @param string $blog_registered_date The date the blog was registered.
2006     */
2007    public static function add_free_plan_purchase( &$purchases, $site_type, $blog_registered_date ) {
2008        $free_purchase_object                  = new stdClass();
2009        $free_purchase_object->product_slug    = "{$site_type}-all-sites";
2010        $free_purchase_object->subscribed_date = $blog_registered_date;
2011
2012        $purchases[] = $free_purchase_object;
2013    }
2014
2015    /**
2016     * Resolve the WordPress.com blog ID to check stickers and the gating cutoff against.
2017     *
2018     * @param int|null $blog_id Blog ID, or null to resolve from the environment.
2019     *
2020     * @return int
2021     */
2022    private static function resolve_blog_id( $blog_id = null ) {
2023        if ( null !== $blog_id ) {
2024            return (int) $blog_id;
2025        }
2026
2027        if ( function_exists( '_wpcom_get_current_blog_id' ) ) {
2028            return (int) _wpcom_get_current_blog_id();
2029        }
2030
2031        return (int) get_current_blog_id();
2032    }
2033
2034    /**
2035     * Whether a site carries a blog sticker, on Simple or in WPCOMSH.
2036     *
2037     * `$blog_id` is ignored on WoW, WPCOMSH reads Atomic Persistent Data, there is no way to read
2038     * another site's from there. A caller that needs a specific site's stickers has to establish
2039     * that it is the current site first, e.g `is_legacy_gating_site()`.
2040     *
2041     * @param string   $sticker Sticker slug.
2042     * @param int|null $blog_id Blog ID, or null to resolve from the environment. Ignored on Atomic.
2043     *
2044     * @return bool
2045     */
2046    private static function site_has_sticker( $sticker, $blog_id = null ) {
2047        if ( defined( 'IS_ATOMIC' ) && IS_ATOMIC && function_exists( 'wpcomsh_is_site_sticker_active' ) ) {
2048            return (bool) wpcomsh_is_site_sticker_active( $sticker );
2049        }
2050
2051        if ( function_exists( 'has_blog_sticker' ) ) {
2052            return (bool) has_blog_sticker( $sticker, self::resolve_blog_id( $blog_id ) );
2053        }
2054
2055        return false;
2056    }
2057
2058    /**
2059     * Whether a site is still on the pre-2026 feature gating.
2060     *
2061     * 1. A legacy site that switches to new features is never legacy again.
2062     * 2. `pre-feature-gating-2026` wins over `gating-business-q1`, because a staging site cloned
2063     *    from a legacy production site could have both: the creation hook stickers every new blog,
2064     *    and the staging hook then marks it as mirroring a legacy site.
2065     * 3. `gating-business-q1` covers the ~2.0M sites below the cutoff that are already on the new
2066     *    gating -- the Jan-Jun experiment cohort plus everything `POST /sites/new` stickered
2067     *    between June and August 2026. "No sticker" is not the same as "old site".
2068     * 4. Otherwise the blog ID decides.
2069     *
2070     * @param int $blog_id Blog ID. Required: pass the site being asked about, never a guess.
2071     *
2072     * @return bool
2073     */
2074    public static function is_legacy_gating_site( $blog_id ) {
2075        $blog_id = (int) $blog_id;
2076
2077        // On WoW the sticker checks read the current site's persistent data.
2078        if ( defined( 'IS_ATOMIC' ) && IS_ATOMIC && $blog_id !== self::resolve_blog_id() ) {
2079            if ( function_exists( '_doing_it_wrong' ) ) {
2080                _doing_it_wrong(
2081                    __METHOD__,
2082                    'Atomic sites cannot resolve stickers for a site other than the current one.',
2083                    '' // No version.
2084                );
2085            }
2086
2087            return true;
2088        }
2089
2090        if ( self::site_has_sticker( self::STICKER_FEATURE_GATING_2026, $blog_id ) ) {
2091            return false;
2092        }
2093
2094        if ( self::site_has_sticker( self::STICKER_PRE_FEATURE_GATING_2026, $blog_id ) ) {
2095            return true;
2096        }
2097
2098        if ( self::site_has_sticker( self::STICKER_GATING_BUSINESS_Q1, $blog_id ) ) {
2099            return false;
2100        }
2101
2102        return $blog_id < self::FEATURE_GATING_2026_CUTOFF_BLOG_ID;
2103    }
2104
2105    /**
2106     * Every blog sticker the products map gates on, in a stable order.
2107     *
2108     * @return string[]
2109     */
2110    private static function get_map_sticker_slugs() {
2111        static $slugs = null;
2112
2113        if ( null !== $slugs ) {
2114            return $slugs;
2115        }
2116
2117        $found = array();
2118        $walk  = static function ( $node ) use ( &$walk, &$found ) {
2119            foreach ( $node as $key => $value ) {
2120                if ( 'required_sticker' === $key || 'sticker_not_present' === $key ) {
2121                    foreach ( (array) $value as $slug ) {
2122                        $found[ $slug ] = true;
2123                    }
2124                } elseif ( is_array( $value ) ) {
2125                    $walk( $value );
2126                }
2127            }
2128        };
2129        $walk( self::FEATURES_MAP );
2130
2131        $slugs = array_keys( $found );
2132        sort( $slugs );
2133
2134        return $slugs;
2135    }
2136
2137    /**
2138     * Features whose grant depends on which side of the 2026 flip a site is on.
2139     *
2140     * These are the only features a plan change can take away from a site still on the pre-2026
2141     * gating, so a caller comparing before and after only has to evaluate these. Derived from the map
2142     * so a new `before_feature_gating_2026` branch is covered without an edit here.
2143     *
2144     * @return string[]
2145     */
2146    public static function get_cohort_sensitive_features() {
2147        static $features = null;
2148
2149        if ( null !== $features ) {
2150            return $features;
2151        }
2152
2153        $features = array();
2154
2155        foreach ( self::FEATURES_MAP as $feature => $products_map ) {
2156            foreach ( $products_map as $branch ) {
2157                if ( is_array( $branch ) && isset( $branch['before_feature_gating_2026'] ) ) {
2158                    $features[] = $feature;
2159                    continue 2;
2160                }
2161            }
2162        }
2163
2164        return $features;
2165    }
2166
2167    /**
2168     * A cache-key fragment covering every per-site input the products map consults.
2169     *
2170     * Feature resolution for a given product is not the same for every site, so anything caching it
2171     * outside a per-site key has to vary on this. The inputs are: before_feature_gating_2026 and
2172     * required_sticker / sticker_not_present.
2173     *
2174     * @param int $blog_id Blog ID to describe.
2175     *
2176     * @return string
2177     */
2178    public static function get_site_gating_cache_suffix( $blog_id ) {
2179        $suffix = self::is_legacy_gating_site( $blog_id ) ? '_pre_gating_2026' : '_gating_2026';
2180
2181        foreach ( self::get_map_sticker_slugs() as $slug ) {
2182            if ( self::site_has_sticker( $slug, $blog_id ) ) {
2183                $suffix .= '_' . $slug;
2184            }
2185        }
2186
2187        return $suffix;
2188    }
2189
2190    /**
2191     * The products definition array ($products_map) may contain 1st-level sub-arrays with 'before' and/or 'after' keys
2192     * used to restrict access to a feature based on when the purchase was made. If the $purchase is included in
2193     * $products_map, and it was purchased within the defined date range (if a date range is defined), return true.
2194     *
2195     * Additionally, the 1st level of the array may contain the key 'excluded_plans' which is an array of plans that
2196     * should be excluded from the feature. This is useful for when there are very specific exceptions that would
2197     * otherwise require a lot of configuration to be added. If a plan is excluded, no further checks will be done.
2198     *
2199     * @param object    $purchase A single purchase.
2200     * @param array     $products_map A feature map definition array.
2201     * @param int|null  $blog_id The blog ID to check. Default null.
2202     * @param bool|null $assume_legacy Cohort to assume instead of the site's own; null reads it from the site.
2203     *
2204     * @return bool If the purchase is included in $products_map and meets any purchase date-range rules.
2205     */
2206    public static function purchase_in_products_map( $purchase, $products_map, $blog_id = null, $assume_legacy = null ) {
2207
2208        // First check if the current purchase is excluded in the product definition.
2209        if ( isset( $products_map[ self::EXCLUDE_PLANS ] ) ) {
2210            $excluded_plans = $products_map[ self::EXCLUDE_PLANS ] ?? array();
2211            if ( ! empty( $excluded_plans ) && self::in_array_recursive( $purchase->product_slug, array( $excluded_plans ) ) ) {
2212                return false;
2213            }
2214            unset( $products_map[ self::EXCLUDE_PLANS ] );
2215        }
2216
2217        // Loop through the first level of the $products_map array to identify potential legacy feature date ranges.
2218        foreach ( $products_map as $product_definition ) {
2219
2220            if ( ! empty( $product_definition['product_type'] ) ) {
2221                if ( ! empty( $purchase->product_type ) && in_array( $purchase->product_type, $product_definition['product_type'], true ) ) {
2222                    return true;
2223                }
2224                continue;
2225            }
2226
2227            $purchase_eligible_by_date    = false;
2228            $purchase_eligible_by_sticker = false;
2229
2230            // Check if sticker requirement exists.
2231            $required_sticker = $product_definition['required_sticker'] ?? null;
2232            if ( $required_sticker ) {
2233                $purchase_eligible_by_sticker = self::site_has_sticker( $required_sticker, $blog_id );
2234                // Remove the sticker key so $product_definition is clean for in_array_recursive search.
2235                unset( $product_definition['required_sticker'] );
2236            } else {
2237                $purchase_eligible_by_sticker = true; // No sticker requirement, so eligible by default.
2238            }
2239
2240            // Check if sticker_not_present requirement exists (feature only available when sticker is NOT present).
2241            $sticker_not_present = $product_definition['sticker_not_present'] ?? null;
2242            if ( $sticker_not_present ) {
2243                $has_sticker = self::site_has_sticker( $sticker_not_present, $blog_id );
2244                // Only eligible if the sticker is NOT present.
2245                $purchase_eligible_by_sticker = $purchase_eligible_by_sticker && ! $has_sticker;
2246                // Remove the sticker key so $product_definition is clean for in_array_recursive search.
2247                unset( $product_definition['sticker_not_present'] );
2248            }
2249
2250            // Check if the site has legacy/current features, previously use gating-business-q1 sticker
2251            if ( isset( $product_definition['before_feature_gating_2026'] ) ) {
2252                $purchase_eligible_by_sticker = $purchase_eligible_by_sticker
2253                    && (bool) $product_definition['before_feature_gating_2026'] === (
2254                        null === $assume_legacy
2255                            ? self::is_legacy_gating_site( self::resolve_blog_id( $blog_id ) )
2256                            : (bool) $assume_legacy
2257                    );
2258                // Remove the key so $product_definition is clean for in_array_recursive search.
2259                unset( $product_definition['before_feature_gating_2026'] );
2260            }
2261
2262            // If 'before' & 'after' are empty, this is not a legacy feature.
2263            if ( empty( $product_definition['before'] ) && empty( $product_definition['after'] ) ) {
2264                $purchase_eligible_by_date = true;
2265            } else {
2266                // If the date key is defined, set its variable to its Unix timestamp, else set invalid or undefined dates to false.
2267                $before          = isset( $product_definition['before'] ) ? strtotime( $product_definition['before'] ) : false;
2268                $after           = isset( $product_definition['after'] ) ? strtotime( $product_definition['after'] ) : false;
2269                $subscribed_date = isset( $purchase->subscribed_date ) ? strtotime( $purchase->subscribed_date ) : false;
2270
2271                // Remove the date keys so $product_definition is clean for in_array_recursive search.
2272                unset( $product_definition['before'], $product_definition['after'] );
2273
2274                // If 'before' or 'after', & the subscribed_date are valid, check if the legacy feature is available.
2275                if ( ( false !== $before || false !== $after ) && false !== $subscribed_date ) {
2276                    if ( false !== $before && false !== $after ) {
2277                        if (
2278                            $subscribed_date >= $after &&
2279                            $subscribed_date <= $before ) {
2280                            $purchase_eligible_by_date = true;
2281                        }
2282                    } elseif ( false !== $before ) {
2283                        if ( $subscribed_date <= $before ) {
2284                            $purchase_eligible_by_date = true;
2285                        }
2286                    } elseif ( false !== $after ) {
2287                        if ( $subscribed_date >= $after ) {
2288                            $purchase_eligible_by_date = true;
2289                        }
2290                    }
2291                }
2292            }
2293
2294            // If the date range and sticker requirements are cleared, check if the purchase is included in the $product_definition.
2295            if ( $purchase_eligible_by_date && $purchase_eligible_by_sticker ) {
2296                if ( self::in_array_recursive( $purchase->product_slug ?? null, array( $product_definition ) ) ) {
2297                    return true;
2298                }
2299            }
2300        }
2301
2302        return false;
2303    }
2304
2305    /**
2306     * Return a list of all possible feature slugs.
2307     *
2308     * @return array An array of strings like 'premium-themes', one for each possible feature slug.
2309     */
2310    public static function get_feature_slugs() {
2311        return array_keys( self::FEATURES_MAP );
2312    }
2313}