@@ -6,7 +6,6 @@ import posthog from 'posthog-js'
66
77import { env } from '@/env'
88import { POSTHOG_EVENT_VERSION } from '@/lib/posthog-events'
9- import { POSTHOG_FEATURE_FLAGS } from '@/lib/posthog-flags'
109import { getErrorKind , sanitizeProperties } from '@/lib/posthog-sanitize'
1110
1211function getBaseProperties ( pathname ?: string , locale ?: string , userRole ?: string ) {
@@ -20,16 +19,10 @@ function getBaseProperties(pathname?: string, locale?: string, userRole?: string
2019 }
2120}
2221
23- export function isPostHogClientEnabled ( ) {
22+ function isPostHogClientEnabled ( ) {
2423 return Boolean ( env . NEXT_PUBLIC_POSTHOG_KEY && env . NEXT_PUBLIC_POSTHOG_HOST )
2524}
2625
27- export function areClientAnalyticsEventsEnabled ( ) {
28- if ( ! isPostHogClientEnabled ( ) ) return false
29-
30- return posthog . isFeatureEnabled ( POSTHOG_FEATURE_FLAGS . analyticsClientEvents ) !== false
31- }
32-
3326export function captureClientEvent <
3427 TEvent extends Extract <
3528 PostHogEventName ,
@@ -43,7 +36,7 @@ export function captureClientEvent<
4336 properties : EventProperties < TEvent > ,
4437 context : { pathname ?: string ; locale ?: string ; userRole ?: string } = { } ,
4538) {
46- if ( ! areClientAnalyticsEventsEnabled ( ) ) return
39+ if ( ! isPostHogClientEnabled ( ) ) return
4740
4841 posthog . capture ( event , {
4942 ...getBaseProperties ( context . pathname , context . locale , context . userRole ) ,
0 commit comments