Skip to content

Commit 38919e9

Browse files
committed
Simplify analytics and delete tests
1 parent 56d5ab6 commit 38919e9

File tree

3 files changed

+4
-393
lines changed

3 files changed

+4
-393
lines changed

common/src/__tests__/analytics-server.test.ts

Lines changed: 0 additions & 315 deletions
This file was deleted.

common/src/analytics-core.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { PostHog } from 'posthog-node'
22

3-
import type { AnalyticsEvent } from './constants/analytics-events'
4-
53
/**
64
* Shared analytics core module.
75
* Provides common interfaces, types, and utilities used by both
@@ -62,32 +60,6 @@ export function createPostHogClient(
6260
return new PostHog(apiKey, options) as AnalyticsClientWithIdentify
6361
}
6462

65-
/**
66-
* Extracts analytics config from client environment variables.
67-
* Returns null if required env vars are missing.
68-
*/
69-
export function getConfigFromEnv(env: {
70-
NEXT_PUBLIC_CB_ENVIRONMENT?: string
71-
NEXT_PUBLIC_POSTHOG_API_KEY?: string
72-
NEXT_PUBLIC_POSTHOG_HOST_URL?: string
73-
}): AnalyticsConfig | null {
74-
const envName = env.NEXT_PUBLIC_CB_ENVIRONMENT as AnalyticsEnvName | undefined
75-
const posthogApiKey = env.NEXT_PUBLIC_POSTHOG_API_KEY
76-
const posthogHostUrl = env.NEXT_PUBLIC_POSTHOG_HOST_URL
77-
78-
if (!envName) return null
79-
if (!posthogApiKey || !posthogHostUrl) return null
80-
81-
return { envName, posthogApiKey, posthogHostUrl }
82-
}
83-
84-
/**
85-
* Checks if the environment is production.
86-
*/
87-
export function isProdEnv(envName: AnalyticsEnvName | undefined): boolean {
88-
return envName === 'prod'
89-
}
90-
9163
/**
9264
* Generates a unique anonymous ID for pre-login tracking.
9365
* Uses crypto.randomUUID() for uniqueness.

0 commit comments

Comments
 (0)