-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
67 lines (54 loc) · 1.62 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
declare class EventLayerClass {
constructor();
initialize: (config: Config) => void;
isInitialized: () => boolean;
ready: (callback: (ready: string) => {}) => void;
identify: <T>(userId: string, userProperties?: T) => void;
track: <T>(eventName: string, eventProperties?: T) => void;
page: <T>(category: string, name: string, properties?: T) => void;
alias: (userId: string, previousId?: string) => void;
group: <T>(groupId: string, traits?: T) => void;
fbTrack: <T>(eventName: string, eventProperties?: T) => void;
}
type Config = {
[name: string]: ConfigItem
}
interface ConfigItem {
enabled: boolean
transformers: Transformers
}
interface Identity {
userId: String
userProperties?: any
}
interface EventLayerEvent {
eventName: string
eventProperties?: any
}
interface PageEvent {
category: string
name: string
properties?: any
}
interface AliasEvent {
userId: string
previousId: string
}
interface GroupEvent {
groupId: string
traits?: any
}
interface FBEvent {
eventName: string
eventProperties?: any
}
interface Transformers {
identityTransformer?: <T>(userId: string, userProperties?: T) => Identity;
eventTransformer?: <T>(eventName: string, eventProperties?: T) => EventLayerEvent;
pageTransformer: <T>(category: string, name: string, properties?: T) => PageEvent;
aliasTransformer: (userId: string, previousId?: string) => AliasEvent;
groupTransformer: <T>(groupId: string, traits?: T) => GroupEvent;
fbTrackTransformer: <T>(eventName: string, eventProperties?: T) => FBEvent;
}
export const EventLayerFactory: () => EventLayerClass;
export const EventLayer: EventLayerClass;