forked from snowplow/snowplow-javascript-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemata.ts
More file actions
107 lines (94 loc) · 2.71 KB
/
schemata.ts
File metadata and controls
107 lines (94 loc) · 2.71 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { SelfDescribingJson } from '@snowplow/tracker-core';
import type { AttributeList } from './types';
export enum Events {
ELEMENT_CREATE = 'iglu:com.snowplowanalytics.snowplow/create_element/jsonschema/1-0-0',
ELEMENT_DESTROY = 'iglu:com.snowplowanalytics.snowplow/destroy_element/jsonschema/1-0-0',
ELEMENT_EXPOSE = 'iglu:com.snowplowanalytics.snowplow/expose_element/jsonschema/1-0-0',
ELEMENT_OBSCURE = 'iglu:com.snowplowanalytics.snowplow/obscure_element/jsonschema/1-0-0',
}
export enum Entities {
ELEMENT_DETAILS = 'iglu:com.snowplowanalytics.snowplow/element/jsonschema/1-0-0',
ELEMENT_CONTENT = 'iglu:com.snowplowanalytics.snowplow/element_content/jsonschema/1-0-0',
ELEMENT_STATISTICS = 'iglu:com.snowplowanalytics.snowplow/element_statistics/jsonschema/1-0-0',
COMPONENT_PARENTS = 'iglu:com.snowplowanalytics.snowplow/component_parents/jsonschema/1-0-0',
}
export type SDJ<S extends Entities | Events, D = Record<string, unknown>> = SelfDescribingJson<D> & {
schema: S;
};
export type Event<S extends Events = Events, D = Record<string, unknown>> = SDJ<S, D>;
export type Entity<S extends Entities = Entities, D = Record<string, unknown>> = SDJ<S, D>;
export type ElementCreateEvent = SDJ<
Events.ELEMENT_CREATE,
{
element_name: string;
}
>;
export type ElementDestroyEvent = SDJ<
Events.ELEMENT_DESTROY,
{
element_name: string;
}
>;
export type ElementExposeEvent = SDJ<
Events.ELEMENT_EXPOSE,
{
element_name: string;
}
>;
export type ElementObscureEvent = SDJ<
Events.ELEMENT_OBSCURE,
{
element_name: string;
}
>;
export type ElementContentEntity = SDJ<
Entities.ELEMENT_CONTENT,
{
parent_name: string;
parent_index: number;
element_name: string;
element_index: number;
attributes?: AttributeList;
}
>;
export type ElementDetailsEntity = SDJ<
Entities.ELEMENT_DETAILS,
{
element_name: string;
height: number;
width: number;
position_x: number;
position_y: number;
doc_position_x: number;
doc_position_y: number;
element_index?: number;
element_matches?: number;
originating_page_view: string;
attributes?: AttributeList;
}
>;
export type ComponentsEntity = SDJ<
Entities.COMPONENT_PARENTS,
{
element_name?: string;
component_list: string[];
}
>;
export type ElementStatisticsEntity = SDJ<
Entities.ELEMENT_STATISTICS,
{
element_name: string;
element_index: number;
element_matches: number;
current_state: string;
min_size: string;
current_size: string;
max_size: string;
y_depth_ratio: number | null;
max_y_depth_ratio: number | null;
max_y_depth: string;
element_age_ms: number;
times_in_view: number;
total_time_visible_ms: number;
}
>;