@@ -3,8 +3,10 @@ import {useMemo, type ReactNode} from 'react';
33import HookOrDefault from 'sentry/components/hookOrDefault' ;
44import type { DatePageFilterProps } from 'sentry/components/organizations/datePageFilter' ;
55import { t } from 'sentry/locale' ;
6+ import HookStore from 'sentry/stores/hookStore' ;
67import { DataCategory } from 'sentry/types/core' ;
78import type { Organization } from 'sentry/types/organization' ;
9+ import useOrganization from 'sentry/utils/useOrganization' ;
810
911export interface MaxPickableDaysOptions {
1012 /**
@@ -19,15 +21,20 @@ export interface MaxPickableDaysOptions {
1921 upsellFooter ?: ReactNode ;
2022}
2123
22- interface UseMaxPickableDaysProps {
24+ export interface UseMaxPickableDaysProps {
2325 dataCategories : readonly [ DataCategory , ...DataCategory [ ] ] ;
24- organization : Organization ;
2526}
2627
2728export function useMaxPickableDays ( {
2829 dataCategories,
29- organization,
3030} : UseMaxPickableDaysProps ) : MaxPickableDaysOptions {
31+ const useMaxPickableDaysHook =
32+ HookStore . get ( 'react-hook:use-max-pickable-days' ) [ 0 ] ?? useMaxPickableDaysImpl ;
33+ return useMaxPickableDaysHook ( { dataCategories} ) ;
34+ }
35+
36+ function useMaxPickableDaysImpl ( { dataCategories} : UseMaxPickableDaysProps ) {
37+ const organization = useOrganization ( ) ;
3138 return useMemo ( ( ) => {
3239 function getMaxPickableDaysFor ( dataCategory : DataCategory ) {
3340 return getMaxPickableDays ( dataCategory , organization ) ;
@@ -37,7 +44,7 @@ export function useMaxPickableDays({
3744 } , [ dataCategories , organization ] ) ;
3845}
3946
40- function getBestMaxPickableDays (
47+ export function getBestMaxPickableDays (
4148 dataCategories : readonly [ DataCategory , ...DataCategory [ ] ] ,
4249 getMaxPickableDaysFor : ( dataCategory : DataCategory ) => MaxPickableDaysOptions
4350) {
@@ -69,7 +76,7 @@ function max(
6976
7077const DESCRIPTION = t ( 'To query over longer time ranges, upgrade to Business' ) ;
7178
72- function getMaxPickableDays (
79+ export function getMaxPickableDays (
7380 dataCategory : DataCategory ,
7481 organization : Organization
7582) : MaxPickableDaysOptions {
@@ -84,7 +91,7 @@ function getMaxPickableDays(
8491 return {
8592 maxPickableDays,
8693 maxUpgradableDays : 90 ,
87- upsellFooter : < UpsellFooterHook description = { DESCRIPTION } source = "spans" /> ,
94+ upsellFooter : SpansUpsellFooter ,
8895 } ;
8996 }
9097 case DataCategory . TRACE_METRICS :
@@ -106,3 +113,7 @@ const UpsellFooterHook = HookOrDefault({
106113 hookName : 'component:header-date-page-filter-upsell-footer' ,
107114 defaultComponent : ( ) => null ,
108115} ) ;
116+
117+ export const SpansUpsellFooter = (
118+ < UpsellFooterHook description = { DESCRIPTION } source = "spans" />
119+ ) ;
0 commit comments