mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 13:19:09 +03:00
* Update telemetry calls for docs to support PH * Update telemetry calls for www to support PH * Add ts ignore * Remove use of useRouter for docs * Add credentials include for www and docs for telemetry calls * Update TELEMETRY_CONSENT in common for www and docs to reset telemetry opt in preference * Update common telemetry to use new endpoint and payload, and trigger reset request when opting out of telemetry from ui patterns PrigacySettings * Fix * Fix * Fix * Fix build issue in docs * Fix build issue in docs * I hope this fixes the build issues * once more... * Fix * Add credentials include * Fix
28 lines
768 B
TypeScript
28 lines
768 B
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/compat/router'
|
|
import { isBrowser } from '../helpers'
|
|
|
|
export interface TelemetryProps {
|
|
screenResolution?: string
|
|
page_url: string
|
|
search: string
|
|
language: string
|
|
viewport_height: number
|
|
viewport_width: number
|
|
}
|
|
|
|
export function useTelemetryProps(): TelemetryProps {
|
|
const router = useRouter()
|
|
const locale = router ? router.locale : undefined
|
|
|
|
return {
|
|
screenResolution: isBrowser ? `${window.innerWidth}x${window.innerHeight}` : undefined,
|
|
page_url: isBrowser ? window.location.href : '',
|
|
search: isBrowser ? window.location.search : '',
|
|
viewport_height: isBrowser ? window.innerHeight : 0,
|
|
viewport_width: isBrowser ? window.innerWidth : 0,
|
|
language: locale ?? 'en-US',
|
|
}
|
|
}
|