@dataxamas/tracker-js 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +256 -0
- package/dist/index.cjs +672 -0
- package/dist/index.d.cts +142 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +672 -0
- package/dist/rrweb-F6UF6U3D.js +17611 -0
- package/dist/rrweb-M7O3D3Q3.cjs +17611 -0
- package/package.json +62 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
type ErrorSource = "CLIENT" | "SERVER";
|
|
2
|
+
type ErrorLevel = "ERROR" | "WARNING" | "FATAL";
|
|
3
|
+
interface ExceptionsConfig {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
environment?: string;
|
|
8
|
+
release?: string;
|
|
9
|
+
}
|
|
10
|
+
declare class DataxamasExceptions {
|
|
11
|
+
private readonly config;
|
|
12
|
+
private installed;
|
|
13
|
+
constructor(config: ExceptionsConfig);
|
|
14
|
+
captureException(error: unknown, context?: unknown): Promise<void>;
|
|
15
|
+
install(): void;
|
|
16
|
+
private send;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type LogLevel = "DEBUG" | "INFO" | "WARN" | "LOG" | "SUCCESS";
|
|
20
|
+
interface LogsConfig {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
baseUrl: string;
|
|
23
|
+
enableLogs: boolean;
|
|
24
|
+
environment?: string;
|
|
25
|
+
}
|
|
26
|
+
declare class DataxamasLogs {
|
|
27
|
+
private readonly config;
|
|
28
|
+
private readonly logger;
|
|
29
|
+
constructor(config: LogsConfig);
|
|
30
|
+
debug(message: string, data?: unknown): Promise<void>;
|
|
31
|
+
info(message: string, data?: unknown): Promise<void>;
|
|
32
|
+
warn(message: string, data?: unknown): Promise<void>;
|
|
33
|
+
log(message: string, data?: unknown): Promise<void>;
|
|
34
|
+
success(message: string, data?: unknown): Promise<void>;
|
|
35
|
+
private emit;
|
|
36
|
+
private send;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface DataxamasTrackingOptions {
|
|
40
|
+
apiKey: string;
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
allowLocalhost?: boolean;
|
|
43
|
+
replayEnabled?: boolean;
|
|
44
|
+
heatMapEnabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
declare class DataxamasTracking {
|
|
47
|
+
private apiKey;
|
|
48
|
+
private baseUrl;
|
|
49
|
+
private allowLocalhost;
|
|
50
|
+
private sessionId;
|
|
51
|
+
private currentPage;
|
|
52
|
+
private heatMapEnabled;
|
|
53
|
+
private replayEnabled;
|
|
54
|
+
private eventQueue;
|
|
55
|
+
private isProcessing;
|
|
56
|
+
private rrwebRecord;
|
|
57
|
+
private stopRrweb;
|
|
58
|
+
private replayBuffer;
|
|
59
|
+
private snapshotFlushed;
|
|
60
|
+
private replayHalted;
|
|
61
|
+
private replayCapped;
|
|
62
|
+
private cutoffPending;
|
|
63
|
+
private replayStarting;
|
|
64
|
+
private lifecycleReady;
|
|
65
|
+
private recordingId;
|
|
66
|
+
private recordingStartedAt;
|
|
67
|
+
private recordingStartedAtMs;
|
|
68
|
+
private recordingSeq;
|
|
69
|
+
private recordingEvents;
|
|
70
|
+
constructor(options: DataxamasTrackingOptions);
|
|
71
|
+
private isLocalhost;
|
|
72
|
+
private getSessionId;
|
|
73
|
+
private createSessionId;
|
|
74
|
+
private processQueue;
|
|
75
|
+
private sendEvent;
|
|
76
|
+
private trackPageChanges;
|
|
77
|
+
private fetchWebsiteConfig;
|
|
78
|
+
private buildHeatMap;
|
|
79
|
+
private safeText;
|
|
80
|
+
private safeString;
|
|
81
|
+
private getTarget;
|
|
82
|
+
private trackClicks;
|
|
83
|
+
private trackScroll;
|
|
84
|
+
private measureReplay;
|
|
85
|
+
/**
|
|
86
|
+
* Sorteio por visitante, não por gravação: quem entrou no sorteio tem a sessão inteira, em vez
|
|
87
|
+
* de um replay picotado que não dá para assistir.
|
|
88
|
+
*/
|
|
89
|
+
private isReplaySampled;
|
|
90
|
+
private isRecording;
|
|
91
|
+
private exceededReplayCaps;
|
|
92
|
+
private rotateRecording;
|
|
93
|
+
private flushReplay;
|
|
94
|
+
/**
|
|
95
|
+
* Um full snapshot com CSS inline passa fácil de 100KB cru, e era isso que tomava 413 no
|
|
96
|
+
* ingest. O servidor aceita os dois formatos, então navegador sem `CompressionStream` manda cru.
|
|
97
|
+
*/
|
|
98
|
+
private compressPayload;
|
|
99
|
+
private sendReplayBatch;
|
|
100
|
+
private stopReplayRecorder;
|
|
101
|
+
/**
|
|
102
|
+
* Bateu o teto: encerra a gravação e fica parado até a próxima pageview, em vez de emendar um
|
|
103
|
+
* clipe atrás do outro enquanto a página só anima sozinha.
|
|
104
|
+
*/
|
|
105
|
+
private scheduleReplayCutoff;
|
|
106
|
+
/**
|
|
107
|
+
* Primeiro gesto da pageview liga o gravador; os seguintes só o religam se ele tiver parado
|
|
108
|
+
* (aba que foi para segundo plano, por exemplo), sempre no mesmo `recordingId`.
|
|
109
|
+
*/
|
|
110
|
+
private markReplayActivity;
|
|
111
|
+
private setupReplayLifecycle;
|
|
112
|
+
private startReplayRecorder;
|
|
113
|
+
private startTracking;
|
|
114
|
+
start(): void;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface DataxamasOptions {
|
|
118
|
+
apiKey: string;
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
allowLocalhost?: boolean;
|
|
121
|
+
environment?: string;
|
|
122
|
+
release?: string;
|
|
123
|
+
enableLogs?: boolean;
|
|
124
|
+
enableErrorTracking?: boolean;
|
|
125
|
+
captureGlobalErrors?: boolean;
|
|
126
|
+
replayEnabled?: boolean;
|
|
127
|
+
heatMapEnabled?: boolean;
|
|
128
|
+
}
|
|
129
|
+
declare class Dataxamas {
|
|
130
|
+
readonly logs: DataxamasLogs;
|
|
131
|
+
readonly exceptions: DataxamasExceptions;
|
|
132
|
+
readonly tracking: DataxamasTracking;
|
|
133
|
+
constructor(options: DataxamasOptions);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare class DataxamasApiError extends Error {
|
|
137
|
+
code: string;
|
|
138
|
+
status: number;
|
|
139
|
+
constructor(code: string, message: string, status: number);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { Dataxamas, DataxamasApiError, DataxamasExceptions, DataxamasLogs, type DataxamasOptions, DataxamasTracking, type DataxamasTrackingOptions, type ErrorLevel, type ErrorSource, type ExceptionsConfig, type LogLevel, type LogsConfig };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
type ErrorSource = "CLIENT" | "SERVER";
|
|
2
|
+
type ErrorLevel = "ERROR" | "WARNING" | "FATAL";
|
|
3
|
+
interface ExceptionsConfig {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
environment?: string;
|
|
8
|
+
release?: string;
|
|
9
|
+
}
|
|
10
|
+
declare class DataxamasExceptions {
|
|
11
|
+
private readonly config;
|
|
12
|
+
private installed;
|
|
13
|
+
constructor(config: ExceptionsConfig);
|
|
14
|
+
captureException(error: unknown, context?: unknown): Promise<void>;
|
|
15
|
+
install(): void;
|
|
16
|
+
private send;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type LogLevel = "DEBUG" | "INFO" | "WARN" | "LOG" | "SUCCESS";
|
|
20
|
+
interface LogsConfig {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
baseUrl: string;
|
|
23
|
+
enableLogs: boolean;
|
|
24
|
+
environment?: string;
|
|
25
|
+
}
|
|
26
|
+
declare class DataxamasLogs {
|
|
27
|
+
private readonly config;
|
|
28
|
+
private readonly logger;
|
|
29
|
+
constructor(config: LogsConfig);
|
|
30
|
+
debug(message: string, data?: unknown): Promise<void>;
|
|
31
|
+
info(message: string, data?: unknown): Promise<void>;
|
|
32
|
+
warn(message: string, data?: unknown): Promise<void>;
|
|
33
|
+
log(message: string, data?: unknown): Promise<void>;
|
|
34
|
+
success(message: string, data?: unknown): Promise<void>;
|
|
35
|
+
private emit;
|
|
36
|
+
private send;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface DataxamasTrackingOptions {
|
|
40
|
+
apiKey: string;
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
allowLocalhost?: boolean;
|
|
43
|
+
replayEnabled?: boolean;
|
|
44
|
+
heatMapEnabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
declare class DataxamasTracking {
|
|
47
|
+
private apiKey;
|
|
48
|
+
private baseUrl;
|
|
49
|
+
private allowLocalhost;
|
|
50
|
+
private sessionId;
|
|
51
|
+
private currentPage;
|
|
52
|
+
private heatMapEnabled;
|
|
53
|
+
private replayEnabled;
|
|
54
|
+
private eventQueue;
|
|
55
|
+
private isProcessing;
|
|
56
|
+
private rrwebRecord;
|
|
57
|
+
private stopRrweb;
|
|
58
|
+
private replayBuffer;
|
|
59
|
+
private snapshotFlushed;
|
|
60
|
+
private replayHalted;
|
|
61
|
+
private replayCapped;
|
|
62
|
+
private cutoffPending;
|
|
63
|
+
private replayStarting;
|
|
64
|
+
private lifecycleReady;
|
|
65
|
+
private recordingId;
|
|
66
|
+
private recordingStartedAt;
|
|
67
|
+
private recordingStartedAtMs;
|
|
68
|
+
private recordingSeq;
|
|
69
|
+
private recordingEvents;
|
|
70
|
+
constructor(options: DataxamasTrackingOptions);
|
|
71
|
+
private isLocalhost;
|
|
72
|
+
private getSessionId;
|
|
73
|
+
private createSessionId;
|
|
74
|
+
private processQueue;
|
|
75
|
+
private sendEvent;
|
|
76
|
+
private trackPageChanges;
|
|
77
|
+
private fetchWebsiteConfig;
|
|
78
|
+
private buildHeatMap;
|
|
79
|
+
private safeText;
|
|
80
|
+
private safeString;
|
|
81
|
+
private getTarget;
|
|
82
|
+
private trackClicks;
|
|
83
|
+
private trackScroll;
|
|
84
|
+
private measureReplay;
|
|
85
|
+
/**
|
|
86
|
+
* Sorteio por visitante, não por gravação: quem entrou no sorteio tem a sessão inteira, em vez
|
|
87
|
+
* de um replay picotado que não dá para assistir.
|
|
88
|
+
*/
|
|
89
|
+
private isReplaySampled;
|
|
90
|
+
private isRecording;
|
|
91
|
+
private exceededReplayCaps;
|
|
92
|
+
private rotateRecording;
|
|
93
|
+
private flushReplay;
|
|
94
|
+
/**
|
|
95
|
+
* Um full snapshot com CSS inline passa fácil de 100KB cru, e era isso que tomava 413 no
|
|
96
|
+
* ingest. O servidor aceita os dois formatos, então navegador sem `CompressionStream` manda cru.
|
|
97
|
+
*/
|
|
98
|
+
private compressPayload;
|
|
99
|
+
private sendReplayBatch;
|
|
100
|
+
private stopReplayRecorder;
|
|
101
|
+
/**
|
|
102
|
+
* Bateu o teto: encerra a gravação e fica parado até a próxima pageview, em vez de emendar um
|
|
103
|
+
* clipe atrás do outro enquanto a página só anima sozinha.
|
|
104
|
+
*/
|
|
105
|
+
private scheduleReplayCutoff;
|
|
106
|
+
/**
|
|
107
|
+
* Primeiro gesto da pageview liga o gravador; os seguintes só o religam se ele tiver parado
|
|
108
|
+
* (aba que foi para segundo plano, por exemplo), sempre no mesmo `recordingId`.
|
|
109
|
+
*/
|
|
110
|
+
private markReplayActivity;
|
|
111
|
+
private setupReplayLifecycle;
|
|
112
|
+
private startReplayRecorder;
|
|
113
|
+
private startTracking;
|
|
114
|
+
start(): void;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface DataxamasOptions {
|
|
118
|
+
apiKey: string;
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
allowLocalhost?: boolean;
|
|
121
|
+
environment?: string;
|
|
122
|
+
release?: string;
|
|
123
|
+
enableLogs?: boolean;
|
|
124
|
+
enableErrorTracking?: boolean;
|
|
125
|
+
captureGlobalErrors?: boolean;
|
|
126
|
+
replayEnabled?: boolean;
|
|
127
|
+
heatMapEnabled?: boolean;
|
|
128
|
+
}
|
|
129
|
+
declare class Dataxamas {
|
|
130
|
+
readonly logs: DataxamasLogs;
|
|
131
|
+
readonly exceptions: DataxamasExceptions;
|
|
132
|
+
readonly tracking: DataxamasTracking;
|
|
133
|
+
constructor(options: DataxamasOptions);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare class DataxamasApiError extends Error {
|
|
137
|
+
code: string;
|
|
138
|
+
status: number;
|
|
139
|
+
constructor(code: string, message: string, status: number);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { Dataxamas, DataxamasApiError, DataxamasExceptions, DataxamasLogs, type DataxamasOptions, DataxamasTracking, type DataxamasTrackingOptions, type ErrorLevel, type ErrorSource, type ExceptionsConfig, type LogLevel, type LogsConfig };
|