diff --git a/client/my-sites/stats/constants.ts b/client/my-sites/stats/constants.ts index 3db41107b59a16..7e753d75d6d37a 100644 --- a/client/my-sites/stats/constants.ts +++ b/client/my-sites/stats/constants.ts @@ -49,6 +49,8 @@ export const STATS_TYPE_DEVICE_STATS = 'stats_devices_module'; // stats feature are for more granular control, string value is based on component name export const STATS_FEATURE_DATE_CONTROL = 'StatsDateControl'; +export const STATS_FEATURE_DATE_CONTROL_TODAY = 'StatsDateControl/today'; +export const STATS_FEATURE_DATE_CONTROL_YESTERDAY = 'StatsDateControl/yesterday'; export const STATS_FEATURE_DATE_CONTROL_LAST_7_DAYS = 'StatsDateControl/last_7_days'; export const STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS = 'StatsDateControl/last_30_days'; export const STATS_FEATURE_DATE_CONTROL_LAST_90_DAYS = 'StatsDateControl/last_3_months'; diff --git a/client/my-sites/stats/hooks/use-should-gate-stats.ts b/client/my-sites/stats/hooks/use-should-gate-stats.ts index 0a023d4ba5f55b..601c6f94119e27 100644 --- a/client/my-sites/stats/hooks/use-should-gate-stats.ts +++ b/client/my-sites/stats/hooks/use-should-gate-stats.ts @@ -30,6 +30,8 @@ import { STATS_TYPE_DEVICE_STATS, STATS_FEATURE_UTM_STATS, STATS_FEATURE_DATE_CONTROL, + STATS_FEATURE_DATE_CONTROL_TODAY, + STATS_FEATURE_DATE_CONTROL_YESTERDAY, STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS, STATS_FEATURE_DATE_CONTROL_LAST_90_DAYS, STATS_FEATURE_DATE_CONTROL_CUSTOM_DATE_RANGE, @@ -49,6 +51,16 @@ import { shouldShowPaywallAfterGracePeriod, } from './use-stats-purchases'; +const defaultDateControlGates = [ + STATS_FEATURE_DATE_CONTROL, + STATS_FEATURE_DATE_CONTROL_TODAY, + STATS_FEATURE_DATE_CONTROL_YESTERDAY, + STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS, + STATS_FEATURE_DATE_CONTROL_LAST_90_DAYS, + STATS_FEATURE_DATE_CONTROL_LAST_YEAR, + STATS_FEATURE_DATE_CONTROL_CUSTOM_DATE_RANGE, +]; + // If Jetpack sites don't have any purchase that supports commercial use, gate advanced modules accordingly. const jetpackStatsAdvancedPaywall = [ STATS_TYPE_DEVICE_STATS, STATS_FEATURE_UTM_STATS ]; @@ -75,10 +87,7 @@ const jetpackStatsCommercialPaywall = [ // If Jetpack commerical sites don't have any purchase that supports commercial use, // gate controls accordingly. const granularControlForJetpackStatsCommercialPaywall = [ - STATS_FEATURE_DATE_CONTROL, - STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS, - STATS_FEATURE_DATE_CONTROL_LAST_90_DAYS, - STATS_FEATURE_DATE_CONTROL_LAST_YEAR, + ...defaultDateControlGates, STATS_FEATURE_INTERVAL_DROPDOWN_WEEK, STATS_FEATURE_INTERVAL_DROPDOWN_MONTH, STATS_FEATURE_INTERVAL_DROPDOWN_YEAR, @@ -97,11 +106,7 @@ const gatedStats = [ // Paid Stats STAT_TYPE_REFERRERS, STAT_TYPE_CLICKS, - STATS_FEATURE_DATE_CONTROL, - STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS, - STATS_FEATURE_DATE_CONTROL_LAST_90_DAYS, - STATS_FEATURE_DATE_CONTROL_LAST_YEAR, - STATS_FEATURE_DATE_CONTROL_CUSTOM_DATE_RANGE, + ...defaultDateControlGates, STATS_FEATURE_DOWNLOAD_CSV, STATS_FEATURE_INTERVAL_DROPDOWN_WEEK, STATS_FEATURE_INTERVAL_DROPDOWN_MONTH, @@ -134,11 +139,7 @@ const basicStats = [ // Paid stats STAT_TYPE_REFERRERS, STAT_TYPE_CLICKS, - STATS_FEATURE_DATE_CONTROL, - STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS, - STATS_FEATURE_DATE_CONTROL_LAST_90_DAYS, - STATS_FEATURE_DATE_CONTROL_LAST_YEAR, - STATS_FEATURE_DATE_CONTROL_CUSTOM_DATE_RANGE, + ...defaultDateControlGates, STATS_FEATURE_DOWNLOAD_CSV, STATS_FEATURE_INTERVAL_DROPDOWN_WEEK, STATS_FEATURE_INTERVAL_DROPDOWN_MONTH,