@@ -2,31 +2,29 @@ import { Provider } from 'shared/api/helpers'
22
33import { AmplitudeEventTracker , initAmplitude } from './amplitude/amplitude'
44import { StubbedEventTracker } from './stub'
5+ import { Event } from './types'
56
67const AMPLITUDE_API_KEY = process . env . REACT_APP_AMPLITUDE_API_KEY
78
8- export interface EventTracker {
9+ export abstract class EventTracker {
910 // Identifies the user this session belongs to.
10- identify ( userOwnerId : number , username : string ) : void
11+ identify ( {
12+ userOwnerId : _userOwnerId ,
13+ username : _username ,
14+ } : {
15+ userOwnerId : number
16+ username : string
17+ } ) : void {
18+ throw new Error (
19+ 'EventTracker is abstract. Method identify must be implemented.'
20+ )
21+ }
1122
12- // Add new events as a new overloaded method signature here.
13- // Please keep the `eventType`s very generic as we have a limited number of
14- // them. Instead, add more detail in `eventProperties` where possible.
15- // Adding event types this way provides type safety for event properties.
16- // E.g., every 'Button Clicked' event must have the buttonType property.
17- track (
18- eventType : 'Button Clicked' ,
19- eventProperties : {
20- buttonType : 'Install Github App' | 'Configure Repo'
21- buttonLocation ?: string
22- }
23- ) : void
24- track (
25- eventType : 'Page Viewed' ,
26- eventProperties : {
27- pageName : 'OwnerPage'
28- }
29- ) : void
23+ track ( _event : Event ) : void {
24+ throw new Error (
25+ 'EventTracker is abstract. Method track must be implemented.'
26+ )
27+ }
3028}
3129
3230export function initEventTracker ( ) : void {
0 commit comments