@@ -32,6 +32,7 @@ import {
3232 Button ,
3333 WarningIcon ,
3434} from 'ui'
35+ import { useCheckEntitlements } from 'hooks/misc/useCheckEntitlements'
3536
3637const logsUpgradeError = 'upgrade to Team or Enterprise Plan to access audit logs.'
3738
@@ -64,6 +65,9 @@ export const AuditLogs = () => {
6465 'notifications'
6566 )
6667
68+ const { hasAccess : hasAccessToAuditLogs , isLoading : isLoadingEntitlements } =
69+ useCheckEntitlements ( 'security.audit_logs_days' )
70+
6771 const { data, error, isLoading, isSuccess, isError, isRefetching, refetch } =
6872 useOrganizationAuditLogsQuery (
6973 {
@@ -79,7 +83,8 @@ export const AuditLogs = () => {
7983 } ,
8084 }
8185 )
82- const isLogsNotAvailableBasedOnPlan = isError && error . message . endsWith ( logsUpgradeError )
86+
87+ const isLogsNotAvailableBasedOnPlan = isError && ! hasAccessToAuditLogs
8388 const isRangeExceededError = isError && error . message . includes ( 'range exceeded' )
8489 const showFilters = ! isLoading && ! isLogsNotAvailableBasedOnPlan
8590
@@ -127,10 +132,10 @@ export const AuditLogs = () => {
127132 }
128133 } )
129134
130- // This feature depends on the subscription tier of the user. Free user can view logs up to 1 day
131- // in the past. The API limits the logs to maximum of 1 day and 5 minutes so when the page is
135+ // This feature depends on the subscription tier of the user.
136+ // The API limits the logs to maximum of 62 days and 5 minutes so when the page is
132137 // viewed for more than 5 minutes, the call parameters needs to be updated. This also works with
133- // higher tiers (7 days of logs) .The user will see a loading shimmer.
138+ // higher tiers.The user will see a loading shimmer.
134139 useEffect ( ( ) => {
135140 const duration = dayjs ( dateRange . from ) . diff ( dayjs ( dateRange . to ) )
136141 const interval = setInterval ( ( ) => {
@@ -160,7 +165,7 @@ export const AuditLogs = () => {
160165 </ AlertTitle_Shadcn_ >
161166 < AlertDescription_Shadcn_ className = "flex flex-row justify-between gap-3" >
162167 < p >
163- Upgrade to Team or Enterprise to view up to 28 days of Audit Logs for your
168+ Upgrade to Team or Enterprise to view up to 62 days of Audit Logs for your
164169 organization.
165170 </ p >
166171 </ AlertDescription_Shadcn_ >
@@ -261,7 +266,7 @@ export const AuditLogs = () => {
261266 </ div >
262267 ) }
263268
264- { isLoading || isLoadingPermissions ? (
269+ { isLoading || isLoadingPermissions || isLoadingEntitlements ? (
265270 < div className = "space-y-2" >
266271 < ShimmeringLoader />
267272 < ShimmeringLoader className = "w-3/4" />
0 commit comments