mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
I removed the Studio Privacy Policy update notice that #50397 added on 2026-09-16, when Privacy Policy v4 took effect. It has been up for almost three weeks, and the ToS v4 banner (#51109) goes out next. I did the same in #44380, removing the March 2026 privacy notice after 15 days. This is the exact inverse of #50397: the banner component and its test, the banner ID, the dismissal local storage key, and the org-landing path helper that only this notice used. ## To test Tested on Vercel preview: - [ ] In a fresh browser profile (no `privacy-policy-update-2026-09-16-dismissed` key), open `/organizations`: expect no Privacy Policy notice - [ ] Open `/org/<slug>`: expect no Privacy Policy notice and the project list renders normally - [ ] Open a project's Logs page: expect the logs deprecation banner behavior unchanged (only shows before its expiry) ## Linear - fixes GROWTH-1322
106 lines
3.6 KiB
TypeScript
106 lines
3.6 KiB
TypeScript
import { IS_PLATFORM, LOCAL_STORAGE_KEYS, useFlag } from 'common'
|
|
import dayjs from 'dayjs'
|
|
import { usePathname } from 'next/navigation'
|
|
import { PropsWithChildren, useEffect, useRef, useState } from 'react'
|
|
|
|
import { OrganizationResourceBanner } from '../Organization/HeaderBanner'
|
|
import { isLogsOrObservabilityPath } from './AppBannerWrapper.utils'
|
|
import { ClockSkewBanner } from '@/components/layouts/AppLayout/ClockSkewBanner'
|
|
import { NoticeBanner } from '@/components/layouts/AppLayout/NoticeBanner'
|
|
import { StatusBanner } from '@/components/layouts/AppLayout/StatusBanner'
|
|
import { StatusPageBanner } from '@/components/layouts/AppLayout/StatusPageBanner'
|
|
import { BannerLogsAllDeprecation } from '@/components/ui/BannerStack/Banners/BannerLogsAllDeprecation'
|
|
import { BANNER_ID, useBannerStack } from '@/components/ui/BannerStack/BannerStackProvider'
|
|
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
|
|
import { useTrack } from '@/lib/telemetry/track'
|
|
|
|
// Update this whenever the banner content changes so old client bundles stop
|
|
// displaying the notice after the removal date passes.
|
|
const LogsAllDeprecationExpiry = dayjs('2026-09-24T00:00:00Z')
|
|
|
|
// setTimeout overflows above ~24.8 days; re-arm until the real expiry.
|
|
const MAX_TIMEOUT_MS = 2_147_483_647
|
|
|
|
export const AppBannerWrapper = ({ children }: PropsWithChildren<{}>) => {
|
|
const showNoticeBanner = useFlag('showNoticeBanner')
|
|
const clockSkewBanner = useFlag('clockSkewBanner')
|
|
const useStatusPageWidget = useFlag('incidentIoStatusPage')
|
|
|
|
const { addBanner, dismissBanner } = useBannerStack()
|
|
const pathname = usePathname()
|
|
const track = useTrack()
|
|
|
|
const [isLogsAllDeprecationDismissed, , { isSuccess: isLogsAllDeprecationLoaded }] =
|
|
useLocalStorageQuery(LOCAL_STORAGE_KEYS.LOGS_ALL_DEPRECATION_2026_09_23, false)
|
|
|
|
const [isLogsAllDeprecationExpired, setIsLogsAllDeprecationExpired] = useState(
|
|
() => !dayjs().isBefore(LogsAllDeprecationExpiry)
|
|
)
|
|
|
|
useEffect(() => {
|
|
if (isLogsAllDeprecationExpired) return
|
|
|
|
let timeoutId: ReturnType<typeof setTimeout> | undefined
|
|
|
|
const armExpiryTimer = () => {
|
|
const msUntilExpiry = LogsAllDeprecationExpiry.diff(dayjs())
|
|
if (msUntilExpiry <= 0) {
|
|
setIsLogsAllDeprecationExpired(true)
|
|
return
|
|
}
|
|
timeoutId = setTimeout(armExpiryTimer, Math.min(msUntilExpiry, MAX_TIMEOUT_MS))
|
|
}
|
|
|
|
armExpiryTimer()
|
|
return () => clearTimeout(timeoutId)
|
|
}, [isLogsAllDeprecationExpired])
|
|
|
|
const hasTrackedLogsAllExposure = useRef(false)
|
|
useEffect(() => {
|
|
if (!isLogsAllDeprecationLoaded || pathname == null) return
|
|
|
|
const shouldShow =
|
|
IS_PLATFORM &&
|
|
!isLogsAllDeprecationExpired &&
|
|
isLogsOrObservabilityPath(pathname) &&
|
|
!isLogsAllDeprecationDismissed
|
|
|
|
if (!shouldShow) {
|
|
dismissBanner(BANNER_ID.LOGS_ALL_DEPRECATION)
|
|
return
|
|
}
|
|
|
|
addBanner({
|
|
id: BANNER_ID.LOGS_ALL_DEPRECATION,
|
|
isDismissed: false,
|
|
content: <BannerLogsAllDeprecation />,
|
|
priority: 4,
|
|
})
|
|
|
|
if (!hasTrackedLogsAllExposure.current) {
|
|
hasTrackedLogsAllExposure.current = true
|
|
track('logs_all_deprecation_banner_exposed')
|
|
}
|
|
}, [
|
|
pathname,
|
|
isLogsAllDeprecationLoaded,
|
|
isLogsAllDeprecationDismissed,
|
|
isLogsAllDeprecationExpired,
|
|
addBanner,
|
|
dismissBanner,
|
|
track,
|
|
])
|
|
|
|
return (
|
|
<div className="flex flex-col">
|
|
<div className="shrink-0">
|
|
{useStatusPageWidget ? <StatusBanner /> : <StatusPageBanner />}
|
|
{showNoticeBanner && <NoticeBanner />}
|
|
<OrganizationResourceBanner />
|
|
{clockSkewBanner && <ClockSkewBanner />}
|
|
</div>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|