@@ -2,31 +2,29 @@ import { Provider } from 'shared/api/helpers'
2
2
3
3
import { AmplitudeEventTracker , initAmplitude } from './amplitude/amplitude'
4
4
import { StubbedEventTracker } from './stub'
5
+ import { Event } from './types'
5
6
6
7
const AMPLITUDE_API_KEY = process . env . REACT_APP_AMPLITUDE_API_KEY
7
8
8
- export interface EventTracker {
9
+ export abstract class EventTracker {
9
10
// 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
+ }
11
22
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
+ }
30
28
}
31
29
32
30
export function initEventTracker ( ) : void {
0 commit comments