sitepong 0.0.1 → 0.0.4
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/dist/index.d.mts +596 -3
- package/dist/index.d.ts +596 -3
- package/dist/index.js +4507 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4455 -10
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +409 -0
- package/dist/react/index.d.ts +409 -0
- package/dist/react/index.js +5922 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +5839 -0
- package/dist/react/index.mjs.map +1 -0
- package/package.json +66 -54
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,381 @@
|
|
|
1
|
+
interface CoreSignals {
|
|
2
|
+
userAgent: string;
|
|
3
|
+
language: string;
|
|
4
|
+
languages: string[];
|
|
5
|
+
platform: string;
|
|
6
|
+
screenWidth: number;
|
|
7
|
+
screenHeight: number;
|
|
8
|
+
screenColorDepth: number;
|
|
9
|
+
devicePixelRatio: number;
|
|
10
|
+
timezoneOffset: number;
|
|
11
|
+
timezone: string;
|
|
12
|
+
sessionStorage: boolean;
|
|
13
|
+
localStorage: boolean;
|
|
14
|
+
indexedDB: boolean;
|
|
15
|
+
cookieEnabled: boolean;
|
|
16
|
+
hardwareConcurrency: number;
|
|
17
|
+
maxTouchPoints: number;
|
|
18
|
+
deviceMemory?: number;
|
|
19
|
+
}
|
|
20
|
+
interface ExtendedSignals {
|
|
21
|
+
canvasFingerprint?: string;
|
|
22
|
+
webglVendor?: string;
|
|
23
|
+
webglRenderer?: string;
|
|
24
|
+
audioFingerprint?: string;
|
|
25
|
+
}
|
|
26
|
+
interface SmartSignals {
|
|
27
|
+
incognito?: boolean;
|
|
28
|
+
bot?: boolean;
|
|
29
|
+
/** Browser timezone differs from what's expected for this IP location (computed server-side) */
|
|
30
|
+
timezoneMismatch?: boolean;
|
|
31
|
+
/** Browser language doesn't match expected language for IP location (computed server-side) */
|
|
32
|
+
languageMismatch?: boolean;
|
|
33
|
+
/** First time this device was seen (from localStorage) */
|
|
34
|
+
deviceFirstSeen?: string;
|
|
35
|
+
/** Number of times this device has been seen (incremented per session) */
|
|
36
|
+
deviceVisitCount?: number;
|
|
37
|
+
/** Whether the device appears to be using a privacy-focused browser */
|
|
38
|
+
privacyBrowser?: boolean;
|
|
39
|
+
/** Whether developer tools appear to be open */
|
|
40
|
+
devToolsOpen?: boolean;
|
|
41
|
+
/** Connection type (if available) */
|
|
42
|
+
connectionType?: string;
|
|
43
|
+
/** Whether the browser supports notifications */
|
|
44
|
+
notificationsEnabled?: boolean;
|
|
45
|
+
/** Whether do-not-track is enabled */
|
|
46
|
+
doNotTrack?: boolean;
|
|
47
|
+
/** Browser UA/fingerprint appears spoofed */
|
|
48
|
+
browserTampered?: boolean;
|
|
49
|
+
/** Canvas fingerprint noise/blocking detected */
|
|
50
|
+
canvasTampered?: boolean;
|
|
51
|
+
/** WebGL fingerprint spoofing detected */
|
|
52
|
+
webglTampered?: boolean;
|
|
53
|
+
/** Virtual machine environment detected */
|
|
54
|
+
vmDetected?: boolean;
|
|
55
|
+
/** VM indicator details */
|
|
56
|
+
vmIndicators?: string[];
|
|
57
|
+
}
|
|
58
|
+
interface BehaviorScore {
|
|
59
|
+
score: number;
|
|
60
|
+
mouseMovements: number;
|
|
61
|
+
keystrokes: number;
|
|
62
|
+
scrolls: number;
|
|
63
|
+
clicks: number;
|
|
64
|
+
isHuman: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface DeviceSignals extends CoreSignals {
|
|
67
|
+
extended?: ExtendedSignals;
|
|
68
|
+
smart?: SmartSignals;
|
|
69
|
+
behavior?: BehaviorScore;
|
|
70
|
+
/** @deprecated Use smart.incognito */
|
|
71
|
+
incognito?: boolean;
|
|
72
|
+
/** @deprecated Use smart.bot */
|
|
73
|
+
bot?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface VisitorIdResult {
|
|
76
|
+
visitorId: string;
|
|
77
|
+
confidence: number;
|
|
78
|
+
firstSeenAt?: string;
|
|
79
|
+
lastSeenAt?: string;
|
|
80
|
+
}
|
|
81
|
+
interface FraudCheckResult {
|
|
82
|
+
visitorId: string;
|
|
83
|
+
riskScore: number;
|
|
84
|
+
signals: DeviceSignals;
|
|
85
|
+
flags?: {
|
|
86
|
+
incognito?: boolean;
|
|
87
|
+
bot?: boolean;
|
|
88
|
+
vpn?: boolean;
|
|
89
|
+
tampered?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface RecaptchaV3 {
|
|
94
|
+
ready: (cb: () => void) => void;
|
|
95
|
+
execute: (siteKey: string, options: {
|
|
96
|
+
action: string;
|
|
97
|
+
}) => Promise<string>;
|
|
98
|
+
}
|
|
99
|
+
interface HCaptcha {
|
|
100
|
+
execute: (siteKey: string, options?: {
|
|
101
|
+
async: boolean;
|
|
102
|
+
}) => Promise<{
|
|
103
|
+
response: string;
|
|
104
|
+
}>;
|
|
105
|
+
render: (container: string | HTMLElement, options: object) => string;
|
|
106
|
+
}
|
|
107
|
+
declare global {
|
|
108
|
+
interface Window {
|
|
109
|
+
grecaptcha?: RecaptchaV3;
|
|
110
|
+
hcaptcha?: HCaptcha;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface TrackProperties {
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
interface UserTraits {
|
|
118
|
+
email?: string;
|
|
119
|
+
name?: string;
|
|
120
|
+
firstName?: string;
|
|
121
|
+
lastName?: string;
|
|
122
|
+
phone?: string;
|
|
123
|
+
avatar?: string;
|
|
124
|
+
createdAt?: string;
|
|
125
|
+
[key: string]: unknown;
|
|
126
|
+
}
|
|
127
|
+
interface GroupTraits {
|
|
128
|
+
name?: string;
|
|
129
|
+
industry?: string;
|
|
130
|
+
employees?: number;
|
|
131
|
+
plan?: string;
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface PerformanceConfig {
|
|
136
|
+
apiKey: string;
|
|
137
|
+
endpoint?: string;
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
/** Collect Web Vitals (default: true) */
|
|
140
|
+
webVitals?: boolean;
|
|
141
|
+
/** Report navigation timing (default: true) */
|
|
142
|
+
navigationTiming?: boolean;
|
|
143
|
+
/** Report resource timing (default: false) */
|
|
144
|
+
resourceTiming?: boolean;
|
|
145
|
+
/** Custom endpoint for performance data */
|
|
146
|
+
performanceEndpoint?: string;
|
|
147
|
+
/** Flush interval in ms (default: 10000) */
|
|
148
|
+
flushInterval?: number;
|
|
149
|
+
/** Sample rate 0-1 (default: 1.0) */
|
|
150
|
+
sampleRate?: number;
|
|
151
|
+
debug?: boolean;
|
|
152
|
+
}
|
|
153
|
+
interface WebVitals {
|
|
154
|
+
lcp?: number;
|
|
155
|
+
fid?: number;
|
|
156
|
+
cls?: number;
|
|
157
|
+
fcp?: number;
|
|
158
|
+
ttfb?: number;
|
|
159
|
+
inp?: number;
|
|
160
|
+
}
|
|
161
|
+
interface PerformanceSpan {
|
|
162
|
+
id: string;
|
|
163
|
+
name: string;
|
|
164
|
+
startTime: number;
|
|
165
|
+
endTime?: number;
|
|
166
|
+
duration?: number;
|
|
167
|
+
status: 'ok' | 'error' | 'running';
|
|
168
|
+
data?: Record<string, unknown>;
|
|
169
|
+
}
|
|
170
|
+
interface PerformanceTransaction {
|
|
171
|
+
id: string;
|
|
172
|
+
name: string;
|
|
173
|
+
startTime: number;
|
|
174
|
+
endTime?: number;
|
|
175
|
+
duration?: number;
|
|
176
|
+
status: 'ok' | 'error' | 'running';
|
|
177
|
+
spans: PerformanceSpan[];
|
|
178
|
+
data?: Record<string, unknown>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface TraceContext {
|
|
182
|
+
traceId: string;
|
|
183
|
+
spanId: string;
|
|
184
|
+
parentSpanId: string | null;
|
|
185
|
+
sampled: boolean;
|
|
186
|
+
}
|
|
187
|
+
declare function generateTraceId(): string;
|
|
188
|
+
declare function generateSpanId(): string;
|
|
189
|
+
declare function createTraceContext(): TraceContext;
|
|
190
|
+
declare function propagateTrace(context: TraceContext): Record<string, string>;
|
|
191
|
+
declare function extractTrace(headers: Record<string, string>): TraceContext | null;
|
|
192
|
+
declare class TracePropagator {
|
|
193
|
+
private targets;
|
|
194
|
+
private originalFetch;
|
|
195
|
+
constructor(targets: string[]);
|
|
196
|
+
shouldPropagate(url: string): boolean;
|
|
197
|
+
injectHeaders(url: string, headers: Record<string, string>, context: TraceContext): Record<string, string>;
|
|
198
|
+
start(): void;
|
|
199
|
+
stop(): void;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Cron Job Monitoring SDK Module
|
|
204
|
+
*
|
|
205
|
+
* Usage:
|
|
206
|
+
* import { cronMonitor } from '@sitepong/sdk';
|
|
207
|
+
*
|
|
208
|
+
* // Simple check-in
|
|
209
|
+
* await cronMonitor.checkin('my-job-slug');
|
|
210
|
+
*
|
|
211
|
+
* // With duration tracking
|
|
212
|
+
* const done = cronMonitor.start('my-job-slug');
|
|
213
|
+
* try { await doWork(); done.ok(); }
|
|
214
|
+
* catch (e) { done.error(e.message); }
|
|
215
|
+
*/
|
|
216
|
+
interface CronCheckinOptions {
|
|
217
|
+
status?: 'ok' | 'error' | 'in_progress';
|
|
218
|
+
duration_ms?: number;
|
|
219
|
+
message?: string;
|
|
220
|
+
environment?: string;
|
|
221
|
+
}
|
|
222
|
+
interface CronHandle {
|
|
223
|
+
ok: (message?: string) => Promise<void>;
|
|
224
|
+
error: (message?: string) => Promise<void>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Custom Metrics SDK Module
|
|
229
|
+
*
|
|
230
|
+
* Usage:
|
|
231
|
+
* import { metrics } from '@sitepong/sdk';
|
|
232
|
+
*
|
|
233
|
+
* // Counter
|
|
234
|
+
* metrics.increment('api.requests', 1, { endpoint: '/users' });
|
|
235
|
+
*
|
|
236
|
+
* // Gauge
|
|
237
|
+
* metrics.gauge('memory.usage', process.memoryUsage().heapUsed, { unit: 'bytes' });
|
|
238
|
+
*
|
|
239
|
+
* // Distribution (for percentile calculations)
|
|
240
|
+
* metrics.distribution('api.latency', responseTime, { unit: 'ms' });
|
|
241
|
+
*
|
|
242
|
+
* // Histogram
|
|
243
|
+
* metrics.histogram('request.size', bodySize, { unit: 'bytes' });
|
|
244
|
+
*/
|
|
245
|
+
interface MetricOptions {
|
|
246
|
+
tags?: Record<string, string>;
|
|
247
|
+
unit?: string;
|
|
248
|
+
timestamp?: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Production Profiling SDK Module
|
|
253
|
+
*
|
|
254
|
+
* Usage:
|
|
255
|
+
* import { profiler } from '@sitepong/sdk';
|
|
256
|
+
*
|
|
257
|
+
* // Profile a function
|
|
258
|
+
* const result = await profiler.profile('processOrder', async () => {
|
|
259
|
+
* return await processOrder(orderId);
|
|
260
|
+
* });
|
|
261
|
+
*
|
|
262
|
+
* // Get flame graph data
|
|
263
|
+
* const profile = profiler.getProfile();
|
|
264
|
+
*/
|
|
265
|
+
interface ProfileFrame {
|
|
266
|
+
name: string;
|
|
267
|
+
duration_ms: number;
|
|
268
|
+
start_ms: number;
|
|
269
|
+
children: ProfileFrame[];
|
|
270
|
+
metadata?: Record<string, unknown>;
|
|
271
|
+
}
|
|
272
|
+
interface ProfileData {
|
|
273
|
+
id: string;
|
|
274
|
+
name: string;
|
|
275
|
+
startTime: number;
|
|
276
|
+
duration_ms: number;
|
|
277
|
+
frames: ProfileFrame[];
|
|
278
|
+
metadata?: Record<string, unknown>;
|
|
279
|
+
}
|
|
280
|
+
interface ProfilerConfig {
|
|
281
|
+
apiKey: string;
|
|
282
|
+
endpoint: string;
|
|
283
|
+
debug?: boolean;
|
|
284
|
+
/** Sample rate for profiling (0-1, default 0.1 = 10%) */
|
|
285
|
+
sampleRate?: number;
|
|
286
|
+
/** Maximum profile duration in ms (default 30000) */
|
|
287
|
+
maxDuration?: number;
|
|
288
|
+
/** Flush interval for sending profiles (default 30000) */
|
|
289
|
+
flushInterval?: number;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Anonymous ID Management
|
|
294
|
+
* Generates and persists a unique ID for consistent flag evaluation
|
|
295
|
+
*/
|
|
296
|
+
declare function getAnonymousId(): string;
|
|
297
|
+
/**
|
|
298
|
+
* Clear the anonymous ID
|
|
299
|
+
* Useful for testing or when user wants to reset their identity
|
|
300
|
+
*/
|
|
301
|
+
declare function clearAnonymousId(): void;
|
|
302
|
+
/**
|
|
303
|
+
* Set a custom anonymous ID
|
|
304
|
+
* Useful when you want to use your own user identifier
|
|
305
|
+
*/
|
|
306
|
+
declare function setAnonymousId(id: string): void;
|
|
307
|
+
|
|
308
|
+
interface ReplayConfig {
|
|
309
|
+
apiKey: string;
|
|
310
|
+
endpoint?: string;
|
|
311
|
+
enabled?: boolean;
|
|
312
|
+
/** Mask all text input values (default: true) */
|
|
313
|
+
maskInputs?: boolean;
|
|
314
|
+
/** CSS selector for elements to block from recording */
|
|
315
|
+
blockSelector?: string;
|
|
316
|
+
/** CSS selector for elements to mask content */
|
|
317
|
+
maskSelector?: string;
|
|
318
|
+
/** Maximum session duration in ms (default: 60 minutes) */
|
|
319
|
+
maxSessionDuration?: number;
|
|
320
|
+
/** Flush interval in ms (default: 5000) */
|
|
321
|
+
flushInterval?: number;
|
|
322
|
+
/** Maximum events per batch (default: 100) */
|
|
323
|
+
maxBatchSize?: number;
|
|
324
|
+
/** Sample rate 0-1 (default: 1.0 = record all sessions) */
|
|
325
|
+
sampleRate?: number;
|
|
326
|
+
/** Custom endpoint for replay data */
|
|
327
|
+
replayEndpoint?: string;
|
|
328
|
+
/** Record network requests (XHR/fetch) */
|
|
329
|
+
recordNetwork?: boolean;
|
|
330
|
+
/** Capture request/response headers in network recording */
|
|
331
|
+
captureNetworkHeaders?: boolean;
|
|
332
|
+
/** Record console logs */
|
|
333
|
+
recordConsole?: boolean;
|
|
334
|
+
/** Console levels to record (default: all) */
|
|
335
|
+
consoleLevels?: Array<'log' | 'info' | 'warn' | 'error' | 'debug'>;
|
|
336
|
+
debug?: boolean;
|
|
337
|
+
}
|
|
338
|
+
type ReplayEventType = 'snapshot' | 'mutation' | 'mouse_move' | 'mouse_click' | 'mouse_leave' | 'touch' | 'scroll' | 'input' | 'resize' | 'focus' | 'blur' | 'network' | 'console' | 'custom';
|
|
339
|
+
interface ReplayEvent {
|
|
340
|
+
type: ReplayEventType;
|
|
341
|
+
timestamp: number;
|
|
342
|
+
data: unknown;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Database Query Tracking SDK Module
|
|
347
|
+
*
|
|
348
|
+
* Usage (Node.js):
|
|
349
|
+
* import { dbTracker } from '@sitepong/sdk';
|
|
350
|
+
*
|
|
351
|
+
* // Wrap a database query
|
|
352
|
+
* const result = await dbTracker.track('SELECT * FROM users WHERE id = ?', async () => {
|
|
353
|
+
* return await db.query('SELECT * FROM users WHERE id = ?', [userId]);
|
|
354
|
+
* });
|
|
355
|
+
*
|
|
356
|
+
* // Integration with ORMs
|
|
357
|
+
* dbTracker.patchKnex(knex); // Auto-tracks all Knex queries
|
|
358
|
+
*/
|
|
359
|
+
interface DatabaseQueryEvent {
|
|
360
|
+
query: string;
|
|
361
|
+
duration_ms: number;
|
|
362
|
+
timestamp: string;
|
|
363
|
+
source?: string;
|
|
364
|
+
rows_affected?: number;
|
|
365
|
+
error?: string;
|
|
366
|
+
is_slow?: boolean;
|
|
367
|
+
}
|
|
368
|
+
interface DatabaseTrackerConfig {
|
|
369
|
+
apiKey: string;
|
|
370
|
+
endpoint: string;
|
|
371
|
+
debug?: boolean;
|
|
372
|
+
slowQueryThreshold?: number;
|
|
373
|
+
maxBatchSize?: number;
|
|
374
|
+
flushInterval?: number;
|
|
375
|
+
/** Redact query parameters for security */
|
|
376
|
+
redactParams?: boolean;
|
|
377
|
+
}
|
|
378
|
+
|
|
1
379
|
interface SitePongConfig {
|
|
2
380
|
apiKey: string;
|
|
3
381
|
endpoint?: string;
|
|
@@ -28,6 +406,91 @@ interface CapturedError {
|
|
|
28
406
|
release?: string;
|
|
29
407
|
context?: ErrorContext;
|
|
30
408
|
fingerprint?: string;
|
|
409
|
+
/** Replay session ID if session recording is active */
|
|
410
|
+
replaySessionId?: string;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
interface SitePongInitConfig extends SitePongConfig {
|
|
414
|
+
/** Enable feature flags (default: false) */
|
|
415
|
+
enableFlags?: boolean;
|
|
416
|
+
/** Custom endpoint for flags API (default: uses main endpoint) */
|
|
417
|
+
flagsEndpoint?: string;
|
|
418
|
+
/** Analytics configuration */
|
|
419
|
+
analytics?: {
|
|
420
|
+
enabled?: boolean;
|
|
421
|
+
autocapturePageviews?: boolean;
|
|
422
|
+
autocaptureClicks?: boolean;
|
|
423
|
+
autocaptureForms?: boolean;
|
|
424
|
+
/** Full autocapture configuration (overrides individual autocapture flags) */
|
|
425
|
+
autocapture?: {
|
|
426
|
+
clicks?: boolean;
|
|
427
|
+
forms?: boolean;
|
|
428
|
+
pageviews?: boolean;
|
|
429
|
+
blockSelectors?: string[];
|
|
430
|
+
allowSelectors?: string[];
|
|
431
|
+
} | boolean;
|
|
432
|
+
maxBatchSize?: number;
|
|
433
|
+
flushInterval?: number;
|
|
434
|
+
eventsEndpoint?: string;
|
|
435
|
+
};
|
|
436
|
+
/** Fingerprint / device intelligence configuration */
|
|
437
|
+
fingerprint?: {
|
|
438
|
+
enabled?: boolean;
|
|
439
|
+
extendedSignals?: boolean;
|
|
440
|
+
visitorEndpoint?: string;
|
|
441
|
+
};
|
|
442
|
+
/** Performance monitoring configuration */
|
|
443
|
+
performance?: {
|
|
444
|
+
enabled?: boolean;
|
|
445
|
+
webVitals?: boolean;
|
|
446
|
+
navigationTiming?: boolean;
|
|
447
|
+
resourceTiming?: boolean;
|
|
448
|
+
sampleRate?: number;
|
|
449
|
+
flushInterval?: number;
|
|
450
|
+
performanceEndpoint?: string;
|
|
451
|
+
};
|
|
452
|
+
/** Session replay configuration */
|
|
453
|
+
replay?: {
|
|
454
|
+
enabled?: boolean;
|
|
455
|
+
maskInputs?: boolean;
|
|
456
|
+
blockSelector?: string;
|
|
457
|
+
maskSelector?: string;
|
|
458
|
+
sampleRate?: number;
|
|
459
|
+
maxSessionDuration?: number;
|
|
460
|
+
flushInterval?: number;
|
|
461
|
+
replayEndpoint?: string;
|
|
462
|
+
/** Record network requests (XHR/fetch) in the replay timeline */
|
|
463
|
+
recordNetwork?: boolean;
|
|
464
|
+
/** Include request/response headers in network recording */
|
|
465
|
+
captureNetworkHeaders?: boolean;
|
|
466
|
+
/** Record console logs in the replay timeline */
|
|
467
|
+
recordConsole?: boolean;
|
|
468
|
+
/** Which console levels to record (default: all) */
|
|
469
|
+
consoleLevels?: Array<'log' | 'info' | 'warn' | 'error' | 'debug'>;
|
|
470
|
+
};
|
|
471
|
+
/** Cron monitoring configuration */
|
|
472
|
+
crons?: {
|
|
473
|
+
enabled?: boolean;
|
|
474
|
+
};
|
|
475
|
+
/** Custom metrics configuration */
|
|
476
|
+
metrics?: {
|
|
477
|
+
enabled?: boolean;
|
|
478
|
+
flushInterval?: number;
|
|
479
|
+
maxBatchSize?: number;
|
|
480
|
+
};
|
|
481
|
+
/** Database query tracking configuration */
|
|
482
|
+
database?: {
|
|
483
|
+
enabled?: boolean;
|
|
484
|
+
slowQueryThreshold?: number;
|
|
485
|
+
redactParams?: boolean;
|
|
486
|
+
};
|
|
487
|
+
/** Production profiling configuration */
|
|
488
|
+
profiling?: {
|
|
489
|
+
enabled?: boolean;
|
|
490
|
+
sampleRate?: number;
|
|
491
|
+
maxDuration?: number;
|
|
492
|
+
flushInterval?: number;
|
|
493
|
+
};
|
|
31
494
|
}
|
|
32
495
|
declare class SitePongClient {
|
|
33
496
|
private config;
|
|
@@ -35,8 +498,89 @@ declare class SitePongClient {
|
|
|
35
498
|
private flushTimer;
|
|
36
499
|
private context;
|
|
37
500
|
private initialized;
|
|
501
|
+
private flagManager;
|
|
502
|
+
private analyticsManager;
|
|
503
|
+
private fingerprintManager;
|
|
504
|
+
private replayManager;
|
|
505
|
+
private performanceManager;
|
|
506
|
+
private cronManager;
|
|
507
|
+
private metricsManager;
|
|
508
|
+
private databaseTracker;
|
|
509
|
+
private profiler;
|
|
38
510
|
constructor();
|
|
39
|
-
init(config:
|
|
511
|
+
init(config: SitePongInitConfig): void;
|
|
512
|
+
/**
|
|
513
|
+
* Get a feature flag value
|
|
514
|
+
* Returns the cached evaluated result or default value
|
|
515
|
+
*/
|
|
516
|
+
getFlag(key: string, defaultValue?: boolean): boolean;
|
|
517
|
+
/**
|
|
518
|
+
* Get all feature flag values
|
|
519
|
+
*/
|
|
520
|
+
getAllFlags(): Record<string, boolean>;
|
|
521
|
+
/**
|
|
522
|
+
* Wait for flags to be initialized
|
|
523
|
+
*/
|
|
524
|
+
waitForFlags(): Promise<void>;
|
|
525
|
+
/**
|
|
526
|
+
* Check if flags are ready
|
|
527
|
+
*/
|
|
528
|
+
areFlagsReady(): boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Get a multivariate flag variant
|
|
531
|
+
* Returns the assigned variant key or the default value
|
|
532
|
+
*/
|
|
533
|
+
getVariant(key: string, defaultValue?: string | null): string | null;
|
|
534
|
+
/**
|
|
535
|
+
* Get the payload for a multivariate flag's assigned variant
|
|
536
|
+
*/
|
|
537
|
+
getVariantPayload<T = unknown>(key: string, defaultValue?: T | null): T | null;
|
|
538
|
+
/**
|
|
539
|
+
* Force refresh flags from the server
|
|
540
|
+
*/
|
|
541
|
+
refreshFlags(): Promise<void>;
|
|
542
|
+
track(eventName: string, properties?: TrackProperties): void;
|
|
543
|
+
trackPageView(url?: string, properties?: TrackProperties): void;
|
|
544
|
+
identify(userId: string, traits?: UserTraits): void;
|
|
545
|
+
group(groupId: string, traits?: GroupTraits): void;
|
|
546
|
+
resetAnalytics(): void;
|
|
547
|
+
getVisitorId(): Promise<VisitorIdResult>;
|
|
548
|
+
getDeviceSignals(): Promise<DeviceSignals>;
|
|
549
|
+
getFraudCheck(): Promise<FraudCheckResult>;
|
|
550
|
+
startReplay(): boolean;
|
|
551
|
+
stopReplay(): void;
|
|
552
|
+
isReplayRecording(): boolean;
|
|
553
|
+
getReplaySessionId(): string | null;
|
|
554
|
+
startTransaction(name: string, data?: Record<string, unknown>): string;
|
|
555
|
+
endTransaction(id: string, status?: 'ok' | 'error'): void;
|
|
556
|
+
startSpan(transactionId: string, name: string, data?: Record<string, unknown>): string;
|
|
557
|
+
endSpan(transactionId: string, spanId: string, status?: 'ok' | 'error'): void;
|
|
558
|
+
getWebVitals(): WebVitals;
|
|
559
|
+
cronCheckin(slug: string, options?: CronCheckinOptions): Promise<void>;
|
|
560
|
+
cronStart(slug: string, environment?: string): CronHandle;
|
|
561
|
+
cronWrap<T>(slug: string, fn: () => Promise<T>, environment?: string): Promise<T>;
|
|
562
|
+
metricIncrement(name: string, value?: number, options?: MetricOptions): void;
|
|
563
|
+
metricGauge(name: string, value: number, options?: MetricOptions): void;
|
|
564
|
+
metricHistogram(name: string, value: number, options?: MetricOptions): void;
|
|
565
|
+
metricDistribution(name: string, value: number, options?: MetricOptions): void;
|
|
566
|
+
metricTime<T>(name: string, fn: () => Promise<T>, options?: MetricOptions): Promise<T>;
|
|
567
|
+
metricStartTimer(name: string, options?: MetricOptions): {
|
|
568
|
+
stop: () => void;
|
|
569
|
+
};
|
|
570
|
+
flushMetrics(): Promise<void>;
|
|
571
|
+
dbTrack<T>(query: string, fn: () => Promise<T>, source?: string): Promise<T>;
|
|
572
|
+
dbTrackSync<T>(query: string, fn: () => T, source?: string): T;
|
|
573
|
+
getDbQueryCount(): number;
|
|
574
|
+
resetDbQueryCount(): void;
|
|
575
|
+
getDbNPlusOnePatterns(): Array<{
|
|
576
|
+
query: string;
|
|
577
|
+
count: number;
|
|
578
|
+
}>;
|
|
579
|
+
profile<T>(name: string, fn: () => Promise<T>, metadata?: Record<string, unknown>): Promise<T>;
|
|
580
|
+
startProfileSpan(name: string, metadata?: Record<string, unknown>): () => void;
|
|
581
|
+
getProfiles(): ProfileData[];
|
|
582
|
+
getLatestProfile(): ProfileData | null;
|
|
583
|
+
flushProfiles(): Promise<void>;
|
|
40
584
|
setContext(context: ErrorContext): void;
|
|
41
585
|
setUser(user: ErrorContext['user']): void;
|
|
42
586
|
setTags(tags: Record<string, string>): void;
|
|
@@ -53,12 +597,61 @@ declare class SitePongClient {
|
|
|
53
597
|
private log;
|
|
54
598
|
}
|
|
55
599
|
declare const sitepong: SitePongClient;
|
|
56
|
-
declare const init: (config:
|
|
600
|
+
declare const init: (config: SitePongInitConfig) => void;
|
|
57
601
|
declare const captureError: (error: Error | string, additionalContext?: ErrorContext) => void;
|
|
58
602
|
declare const captureMessage: (message: string, level?: "info" | "warning" | "error", additionalContext?: ErrorContext) => void;
|
|
59
603
|
declare const setContext: (context: ErrorContext) => void;
|
|
60
604
|
declare const setUser: (user: ErrorContext["user"]) => void;
|
|
61
605
|
declare const setTags: (tags: Record<string, string>) => void;
|
|
62
606
|
declare const flush: () => Promise<void>;
|
|
607
|
+
declare const getFlag: (key: string, defaultValue?: boolean) => boolean;
|
|
608
|
+
declare const getAllFlags: () => Record<string, boolean>;
|
|
609
|
+
declare const getVariant: (key: string, defaultValue?: string | null) => string | null;
|
|
610
|
+
declare const getVariantPayload: <T = unknown>(key: string, defaultValue?: T | null) => T | null;
|
|
611
|
+
declare const waitForFlags: () => Promise<void>;
|
|
612
|
+
declare const areFlagsReady: () => boolean;
|
|
613
|
+
declare const refreshFlags: () => Promise<void>;
|
|
614
|
+
declare const track: (eventName: string, properties?: TrackProperties) => void;
|
|
615
|
+
declare const trackPageView: (url?: string, properties?: TrackProperties) => void;
|
|
616
|
+
declare const identify: (userId: string, traits?: UserTraits) => void;
|
|
617
|
+
declare const group: (groupId: string, traits?: GroupTraits) => void;
|
|
618
|
+
declare const resetAnalytics: () => void;
|
|
619
|
+
declare const getVisitorId: () => Promise<VisitorIdResult>;
|
|
620
|
+
declare const getDeviceSignals: () => Promise<DeviceSignals>;
|
|
621
|
+
declare const getFraudCheck: () => Promise<FraudCheckResult>;
|
|
622
|
+
declare const startReplay: () => boolean;
|
|
623
|
+
declare const stopReplay: () => void;
|
|
624
|
+
declare const isReplayRecording: () => boolean;
|
|
625
|
+
declare const getReplaySessionId: () => string | null;
|
|
626
|
+
declare const startTransaction: (name: string, data?: Record<string, unknown>) => string;
|
|
627
|
+
declare const endTransaction: (id: string, status?: "ok" | "error") => void;
|
|
628
|
+
declare const startSpan: (transactionId: string, name: string, data?: Record<string, unknown>) => string;
|
|
629
|
+
declare const endSpan: (transactionId: string, spanId: string, status?: "ok" | "error") => void;
|
|
630
|
+
declare const getWebVitals: () => WebVitals;
|
|
631
|
+
declare const dbTrack: <T>(query: string, fn: () => Promise<T>, source?: string) => Promise<T>;
|
|
632
|
+
declare const dbTrackSync: <T>(query: string, fn: () => T, source?: string) => T;
|
|
633
|
+
declare const getDbQueryCount: () => number;
|
|
634
|
+
declare const resetDbQueryCount: () => void;
|
|
635
|
+
declare const getDbNPlusOnePatterns: () => Array<{
|
|
636
|
+
query: string;
|
|
637
|
+
count: number;
|
|
638
|
+
}>;
|
|
639
|
+
declare const cronCheckin: (slug: string, options?: CronCheckinOptions) => Promise<void>;
|
|
640
|
+
declare const cronStart: (slug: string, environment?: string) => CronHandle;
|
|
641
|
+
declare const cronWrap: <T>(slug: string, fn: () => Promise<T>, environment?: string) => Promise<T>;
|
|
642
|
+
declare const metricIncrement: (name: string, value?: number, options?: MetricOptions) => void;
|
|
643
|
+
declare const metricGauge: (name: string, value: number, options?: MetricOptions) => void;
|
|
644
|
+
declare const metricHistogram: (name: string, value: number, options?: MetricOptions) => void;
|
|
645
|
+
declare const metricDistribution: (name: string, value: number, options?: MetricOptions) => void;
|
|
646
|
+
declare const metricTime: <T>(name: string, fn: () => Promise<T>, options?: MetricOptions) => Promise<T>;
|
|
647
|
+
declare const metricStartTimer: (name: string, options?: MetricOptions) => {
|
|
648
|
+
stop: () => void;
|
|
649
|
+
};
|
|
650
|
+
declare const flushMetrics: () => Promise<void>;
|
|
651
|
+
declare const profile: <T>(name: string, fn: () => Promise<T>, metadata?: Record<string, unknown>) => Promise<T>;
|
|
652
|
+
declare const startProfileSpan: (name: string, metadata?: Record<string, unknown>) => () => void;
|
|
653
|
+
declare const getProfiles: () => ProfileData[];
|
|
654
|
+
declare const getLatestProfile: () => ProfileData | null;
|
|
655
|
+
declare const flushProfiles: () => Promise<void>;
|
|
63
656
|
|
|
64
|
-
export { type CapturedError, type ErrorContext, type SitePongConfig, captureError, captureMessage, sitepong as default, flush, init, setContext, setTags, setUser };
|
|
657
|
+
export { type CapturedError, type CronCheckinOptions, type CronHandle, type DatabaseQueryEvent, type DatabaseTrackerConfig, type DeviceSignals, type ErrorContext, type FraudCheckResult, type GroupTraits, type MetricOptions, type PerformanceConfig, type PerformanceSpan, type PerformanceTransaction, type ProfileData, type ProfileFrame, type ProfilerConfig, type ReplayConfig, type ReplayEvent, type SitePongConfig, type SitePongInitConfig, type TraceContext, TracePropagator, type TrackProperties, type UserTraits, type VisitorIdResult, type WebVitals, areFlagsReady, captureError, captureMessage, clearAnonymousId, createTraceContext, cronCheckin, cronStart, cronWrap, dbTrack, dbTrackSync, sitepong as default, endSpan, endTransaction, extractTrace, flush, flushMetrics, flushProfiles, generateSpanId, generateTraceId, getAllFlags, getAnonymousId, getDbNPlusOnePatterns, getDbQueryCount, getDeviceSignals, getFlag, getFraudCheck, getLatestProfile, getProfiles, getReplaySessionId, getVariant, getVariantPayload, getVisitorId, getWebVitals, group, identify, init, isReplayRecording, metricDistribution, metricGauge, metricHistogram, metricIncrement, metricStartTimer, metricTime, profile, propagateTrace, refreshFlags, resetAnalytics, resetDbQueryCount, setAnonymousId, setContext, setTags, setUser, startProfileSpan, startReplay, startSpan, startTransaction, stopReplay, track, trackPageView, waitForFlags };
|