@v-tilt/browser 1.1.5 → 1.2.0
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/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/entrypoints/array.d.ts +1 -0
- package/dist/entrypoints/external-scripts-loader.d.ts +24 -0
- package/dist/entrypoints/module.es.d.ts +1 -0
- package/dist/entrypoints/recorder.d.ts +23 -0
- package/dist/extensions/replay/index.d.ts +13 -0
- package/dist/extensions/replay/session-recording-utils.d.ts +92 -0
- package/dist/extensions/replay/session-recording-wrapper.d.ts +61 -0
- package/dist/extensions/replay/session-recording.d.ts +95 -0
- package/dist/extensions/replay/types.d.ts +211 -0
- package/dist/external-scripts-loader.js +2 -0
- package/dist/external-scripts-loader.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +264 -5
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +264 -5
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/recorder.js +2 -0
- package/dist/recorder.js.map +1 -0
- package/dist/types.d.ts +84 -4
- package/dist/utils/globals.d.ts +42 -0
- package/dist/vtilt.d.ts +36 -0
- package/lib/config.js +2 -0
- package/lib/entrypoints/array.d.ts +1 -0
- package/lib/entrypoints/array.js +1 -0
- package/lib/entrypoints/external-scripts-loader.d.ts +24 -0
- package/lib/entrypoints/external-scripts-loader.js +107 -0
- package/lib/entrypoints/module.es.d.ts +1 -0
- package/lib/entrypoints/module.es.js +1 -0
- package/lib/entrypoints/recorder.d.ts +23 -0
- package/lib/entrypoints/recorder.js +42 -0
- package/lib/extensions/replay/index.d.ts +13 -0
- package/lib/extensions/replay/index.js +31 -0
- package/lib/extensions/replay/session-recording-utils.d.ts +92 -0
- package/lib/extensions/replay/session-recording-utils.js +212 -0
- package/lib/extensions/replay/session-recording-wrapper.d.ts +61 -0
- package/lib/extensions/replay/session-recording-wrapper.js +149 -0
- package/lib/extensions/replay/session-recording.d.ts +95 -0
- package/lib/extensions/replay/session-recording.js +700 -0
- package/lib/extensions/replay/types.d.ts +211 -0
- package/lib/extensions/replay/types.js +8 -0
- package/lib/types.d.ts +84 -4
- package/lib/utils/globals.d.ts +42 -0
- package/lib/utils/globals.js +2 -0
- package/lib/vtilt.d.ts +36 -0
- package/lib/vtilt.js +106 -0
- package/package.json +4 -1
package/dist/module.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ interface VTiltConfig {
|
|
|
20
20
|
api_host?: string;
|
|
21
21
|
/** UI host for dashboard links */
|
|
22
22
|
ui_host?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Host for loading extension scripts (recorder.js, etc.)
|
|
25
|
+
* Defaults to unpkg CDN: https://unpkg.com/@v-tilt/browser@{version}/dist
|
|
26
|
+
* Can also use jsdelivr: https://cdn.jsdelivr.net/npm/@v-tilt/browser@{version}/dist
|
|
27
|
+
* Or self-hosted: https://your-domain.com/static
|
|
28
|
+
*/
|
|
29
|
+
script_host?: string;
|
|
23
30
|
/** Proxy domain for tracking requests */
|
|
24
31
|
proxy?: string;
|
|
25
32
|
/** Full proxy URL for tracking requests */
|
|
@@ -72,6 +79,10 @@ interface VTiltConfig {
|
|
|
72
79
|
respect_dnt?: boolean;
|
|
73
80
|
/** Opt users out by default */
|
|
74
81
|
opt_out_capturing_by_default?: boolean;
|
|
82
|
+
/** Session recording configuration */
|
|
83
|
+
session_recording?: SessionRecordingOptions;
|
|
84
|
+
/** Disable session recording (convenience flag) */
|
|
85
|
+
disable_session_recording?: boolean;
|
|
75
86
|
/** Global attributes added to all events */
|
|
76
87
|
globalAttributes?: Record<string, string>;
|
|
77
88
|
/** Bootstrap data for initialization */
|
|
@@ -184,16 +195,85 @@ interface RequestOptions {
|
|
|
184
195
|
timeout?: number;
|
|
185
196
|
retry?: boolean;
|
|
186
197
|
}
|
|
198
|
+
/** Mask options for input elements in session recording */
|
|
199
|
+
interface SessionRecordingMaskInputOptions {
|
|
200
|
+
color?: boolean;
|
|
201
|
+
date?: boolean;
|
|
202
|
+
"datetime-local"?: boolean;
|
|
203
|
+
email?: boolean;
|
|
204
|
+
month?: boolean;
|
|
205
|
+
number?: boolean;
|
|
206
|
+
range?: boolean;
|
|
207
|
+
search?: boolean;
|
|
208
|
+
tel?: boolean;
|
|
209
|
+
text?: boolean;
|
|
210
|
+
time?: boolean;
|
|
211
|
+
url?: boolean;
|
|
212
|
+
week?: boolean;
|
|
213
|
+
textarea?: boolean;
|
|
214
|
+
select?: boolean;
|
|
215
|
+
password?: boolean;
|
|
216
|
+
}
|
|
217
|
+
/** Session recording configuration */
|
|
218
|
+
interface SessionRecordingOptions {
|
|
219
|
+
/** Enable session recording */
|
|
220
|
+
enabled?: boolean;
|
|
221
|
+
/** Sample rate (0-1, where 1 = 100%) */
|
|
222
|
+
sampleRate?: number;
|
|
223
|
+
/** Minimum session duration in ms before sending */
|
|
224
|
+
minimumDurationMs?: number;
|
|
225
|
+
/** Session idle threshold in ms (default: 5 minutes) */
|
|
226
|
+
sessionIdleThresholdMs?: number;
|
|
227
|
+
/** Full snapshot interval in ms (default: 5 minutes) */
|
|
228
|
+
fullSnapshotIntervalMs?: number;
|
|
229
|
+
/** Enable console log capture */
|
|
230
|
+
captureConsole?: boolean;
|
|
231
|
+
/** Enable network request capture */
|
|
232
|
+
captureNetwork?: boolean;
|
|
233
|
+
/** Canvas recording settings */
|
|
234
|
+
captureCanvas?: {
|
|
235
|
+
recordCanvas?: boolean;
|
|
236
|
+
canvasFps?: number;
|
|
237
|
+
canvasQuality?: number;
|
|
238
|
+
};
|
|
239
|
+
/** Block class for elements to hide (default: 'vt-no-capture') */
|
|
240
|
+
blockClass?: string;
|
|
241
|
+
/** Block selector for elements to hide */
|
|
242
|
+
blockSelector?: string;
|
|
243
|
+
/** Ignore class for input masking (default: 'vt-ignore-input') */
|
|
244
|
+
ignoreClass?: string;
|
|
245
|
+
/** Mask text class (default: 'vt-mask') */
|
|
246
|
+
maskTextClass?: string;
|
|
247
|
+
/** Mask text selector */
|
|
248
|
+
maskTextSelector?: string;
|
|
249
|
+
/** Mask all inputs (default: true) */
|
|
250
|
+
maskAllInputs?: boolean;
|
|
251
|
+
/** Mask input options */
|
|
252
|
+
maskInputOptions?: SessionRecordingMaskInputOptions;
|
|
253
|
+
/** Masking configuration */
|
|
254
|
+
masking?: {
|
|
255
|
+
maskAllInputs?: boolean;
|
|
256
|
+
maskTextSelector?: string;
|
|
257
|
+
blockSelector?: string;
|
|
258
|
+
};
|
|
259
|
+
/** Record headers in network requests */
|
|
260
|
+
recordHeaders?: boolean;
|
|
261
|
+
/** Record body in network requests */
|
|
262
|
+
recordBody?: boolean;
|
|
263
|
+
/** Compress events before sending (default: true) */
|
|
264
|
+
compressEvents?: boolean;
|
|
265
|
+
/** Internal: Mutation throttler refill rate */
|
|
266
|
+
__mutationThrottlerRefillRate?: number;
|
|
267
|
+
/** Internal: Mutation throttler bucket size */
|
|
268
|
+
__mutationThrottlerBucketSize?: number;
|
|
269
|
+
}
|
|
187
270
|
interface RemoteConfig {
|
|
188
271
|
/** Default to identified_only mode */
|
|
189
272
|
defaultIdentifiedOnly?: boolean;
|
|
190
273
|
/** Feature flags */
|
|
191
274
|
featureFlags?: FeatureFlagsConfig;
|
|
192
275
|
/** Session recording config */
|
|
193
|
-
sessionRecording?:
|
|
194
|
-
enabled?: boolean;
|
|
195
|
-
sampleRate?: number;
|
|
196
|
-
};
|
|
276
|
+
sessionRecording?: SessionRecordingOptions;
|
|
197
277
|
}
|
|
198
278
|
|
|
199
279
|
/**
|
|
@@ -213,6 +293,150 @@ declare class HistoryAutocapture {
|
|
|
213
293
|
private _setupPopstateListener;
|
|
214
294
|
}
|
|
215
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Session Recording Types
|
|
298
|
+
*
|
|
299
|
+
* Type definitions for rrweb session recording.
|
|
300
|
+
* Based on PostHog's implementation.
|
|
301
|
+
*/
|
|
302
|
+
|
|
303
|
+
/** Mask options for input elements */
|
|
304
|
+
type MaskInputOptions = Partial<{
|
|
305
|
+
color: boolean;
|
|
306
|
+
date: boolean;
|
|
307
|
+
"datetime-local": boolean;
|
|
308
|
+
email: boolean;
|
|
309
|
+
month: boolean;
|
|
310
|
+
number: boolean;
|
|
311
|
+
range: boolean;
|
|
312
|
+
search: boolean;
|
|
313
|
+
tel: boolean;
|
|
314
|
+
text: boolean;
|
|
315
|
+
time: boolean;
|
|
316
|
+
url: boolean;
|
|
317
|
+
week: boolean;
|
|
318
|
+
textarea: boolean;
|
|
319
|
+
select: boolean;
|
|
320
|
+
password: boolean;
|
|
321
|
+
}>;
|
|
322
|
+
/** Masking configuration */
|
|
323
|
+
interface MaskingConfig {
|
|
324
|
+
maskAllInputs?: boolean;
|
|
325
|
+
maskTextSelector?: string;
|
|
326
|
+
blockSelector?: string;
|
|
327
|
+
}
|
|
328
|
+
/** Session recording configuration */
|
|
329
|
+
interface SessionRecordingConfig {
|
|
330
|
+
/** Enable session recording */
|
|
331
|
+
enabled?: boolean;
|
|
332
|
+
/** Sample rate (0-1, where 1 = 100%) */
|
|
333
|
+
sampleRate?: number;
|
|
334
|
+
/** Minimum session duration in ms before sending */
|
|
335
|
+
minimumDurationMs?: number;
|
|
336
|
+
/** Session idle threshold in ms */
|
|
337
|
+
sessionIdleThresholdMs?: number;
|
|
338
|
+
/** Full snapshot interval in ms */
|
|
339
|
+
fullSnapshotIntervalMs?: number;
|
|
340
|
+
/** Enable console log capture */
|
|
341
|
+
captureConsole?: boolean;
|
|
342
|
+
/** Enable network request capture */
|
|
343
|
+
captureNetwork?: boolean;
|
|
344
|
+
/** Canvas recording settings */
|
|
345
|
+
captureCanvas?: {
|
|
346
|
+
recordCanvas?: boolean;
|
|
347
|
+
canvasFps?: number;
|
|
348
|
+
canvasQuality?: number;
|
|
349
|
+
};
|
|
350
|
+
/** Masking settings */
|
|
351
|
+
masking?: MaskingConfig;
|
|
352
|
+
/** Block class for elements to hide */
|
|
353
|
+
blockClass?: string;
|
|
354
|
+
/** Block selector for elements to hide */
|
|
355
|
+
blockSelector?: string;
|
|
356
|
+
/** Ignore class for input masking */
|
|
357
|
+
ignoreClass?: string;
|
|
358
|
+
/** Mask text class */
|
|
359
|
+
maskTextClass?: string;
|
|
360
|
+
/** Mask text selector */
|
|
361
|
+
maskTextSelector?: string;
|
|
362
|
+
/** Mask all inputs */
|
|
363
|
+
maskAllInputs?: boolean;
|
|
364
|
+
/** Mask input options */
|
|
365
|
+
maskInputOptions?: MaskInputOptions;
|
|
366
|
+
/** Record headers in network requests */
|
|
367
|
+
recordHeaders?: boolean;
|
|
368
|
+
/** Record body in network requests */
|
|
369
|
+
recordBody?: boolean;
|
|
370
|
+
/** Compress events before sending */
|
|
371
|
+
compressEvents?: boolean;
|
|
372
|
+
/** Internal: Mutation throttler refill rate */
|
|
373
|
+
__mutationThrottlerRefillRate?: number;
|
|
374
|
+
/** Internal: Mutation throttler bucket size */
|
|
375
|
+
__mutationThrottlerBucketSize?: number;
|
|
376
|
+
}
|
|
377
|
+
/** Recording start reason */
|
|
378
|
+
type SessionStartReason = "recording_initialized" | "session_id_changed" | "linked_flag_matched" | "linked_flag_overridden" | "sampling_overridden" | "url_trigger_matched" | "event_trigger_matched" | "sampled";
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Session Recording Wrapper
|
|
382
|
+
*
|
|
383
|
+
* Lightweight wrapper that handles the decision of WHEN to load recording.
|
|
384
|
+
* The actual recording logic is in LazyLoadedSessionRecording which is
|
|
385
|
+
* loaded on demand.
|
|
386
|
+
*
|
|
387
|
+
* Based on PostHog's sessionrecording-wrapper.ts
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
/** Status when lazy loading is in progress */
|
|
391
|
+
declare const LAZY_LOADING: "lazy_loading";
|
|
392
|
+
/** Session recording status */
|
|
393
|
+
type SessionRecordingStatus = "disabled" | "buffering" | "active" | "paused" | "sampled" | "trigger_pending" | typeof LAZY_LOADING;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Session Recording Wrapper
|
|
397
|
+
*
|
|
398
|
+
* This is the lightweight class that lives in the main bundle.
|
|
399
|
+
* It handles:
|
|
400
|
+
* - Deciding if recording should be enabled
|
|
401
|
+
* - Lazy loading the actual recording code
|
|
402
|
+
* - Delegating to LazyLoadedSessionRecording
|
|
403
|
+
*/
|
|
404
|
+
declare class SessionRecordingWrapper {
|
|
405
|
+
private readonly _instance;
|
|
406
|
+
private _lazyLoadedRecording;
|
|
407
|
+
private _config;
|
|
408
|
+
constructor(_instance: VTilt, config?: SessionRecordingConfig);
|
|
409
|
+
get started(): boolean;
|
|
410
|
+
get status(): SessionRecordingStatus;
|
|
411
|
+
get sessionId(): string;
|
|
412
|
+
/**
|
|
413
|
+
* Start recording if enabled, otherwise stop
|
|
414
|
+
*/
|
|
415
|
+
startIfEnabledOrStop(startReason?: SessionStartReason): void;
|
|
416
|
+
/**
|
|
417
|
+
* Stop recording
|
|
418
|
+
*/
|
|
419
|
+
stopRecording(): void;
|
|
420
|
+
/**
|
|
421
|
+
* Log a message to the recording
|
|
422
|
+
*/
|
|
423
|
+
log(message: string, level?: "log" | "warn" | "error"): void;
|
|
424
|
+
/**
|
|
425
|
+
* Update configuration
|
|
426
|
+
*/
|
|
427
|
+
updateConfig(config: Partial<SessionRecordingConfig>): void;
|
|
428
|
+
private get _isRecordingEnabled();
|
|
429
|
+
private get _scriptName();
|
|
430
|
+
/**
|
|
431
|
+
* Lazy load the recording script and start
|
|
432
|
+
*/
|
|
433
|
+
private _lazyLoadAndStart;
|
|
434
|
+
/**
|
|
435
|
+
* Called after the recording script is loaded
|
|
436
|
+
*/
|
|
437
|
+
private _onScriptLoaded;
|
|
438
|
+
}
|
|
439
|
+
|
|
216
440
|
/**
|
|
217
441
|
* Request Queue - Event Batching (PostHog-style)
|
|
218
442
|
*
|
|
@@ -234,6 +458,7 @@ interface QueuedRequest {
|
|
|
234
458
|
}
|
|
235
459
|
|
|
236
460
|
declare class VTilt {
|
|
461
|
+
readonly version = "1.1.5";
|
|
237
462
|
private configManager;
|
|
238
463
|
private sessionManager;
|
|
239
464
|
private userManager;
|
|
@@ -242,6 +467,7 @@ declare class VTilt {
|
|
|
242
467
|
private retryQueue;
|
|
243
468
|
private rateLimiter;
|
|
244
469
|
historyAutocapture?: HistoryAutocapture;
|
|
470
|
+
sessionRecording?: SessionRecordingWrapper;
|
|
245
471
|
__loaded: boolean;
|
|
246
472
|
private _initial_pageview_captured;
|
|
247
473
|
private _visibility_state_listener;
|
|
@@ -468,10 +694,43 @@ declare class VTilt {
|
|
|
468
694
|
* Get current session ID
|
|
469
695
|
*/
|
|
470
696
|
getSessionId(): string | null;
|
|
697
|
+
/**
|
|
698
|
+
* Get current distinct ID
|
|
699
|
+
*/
|
|
700
|
+
getDistinctId(): string;
|
|
701
|
+
/**
|
|
702
|
+
* Get anonymous ID
|
|
703
|
+
*/
|
|
704
|
+
getAnonymousId(): string;
|
|
471
705
|
/**
|
|
472
706
|
* Update configuration
|
|
473
707
|
*/
|
|
474
708
|
updateConfig(config: Partial<VTiltConfig>): void;
|
|
709
|
+
/**
|
|
710
|
+
* Initialize session recording
|
|
711
|
+
*/
|
|
712
|
+
private _initSessionRecording;
|
|
713
|
+
/**
|
|
714
|
+
* Build session recording config from VTiltConfig
|
|
715
|
+
*/
|
|
716
|
+
private _buildSessionRecordingConfig;
|
|
717
|
+
/**
|
|
718
|
+
* Start session recording
|
|
719
|
+
* Call this to manually start recording if it wasn't enabled initially
|
|
720
|
+
*/
|
|
721
|
+
startSessionRecording(): void;
|
|
722
|
+
/**
|
|
723
|
+
* Stop session recording
|
|
724
|
+
*/
|
|
725
|
+
stopSessionRecording(): void;
|
|
726
|
+
/**
|
|
727
|
+
* Check if session recording is active
|
|
728
|
+
*/
|
|
729
|
+
isSessionRecordingActive(): boolean;
|
|
730
|
+
/**
|
|
731
|
+
* Get session recording ID
|
|
732
|
+
*/
|
|
733
|
+
getSessionRecordingId(): string | null;
|
|
475
734
|
/**
|
|
476
735
|
* _execute_array() deals with processing any vTilt function
|
|
477
736
|
* calls that were called before the vTilt library was loaded
|
|
@@ -494,4 +753,4 @@ declare class VTilt {
|
|
|
494
753
|
declare const vt: VTilt;
|
|
495
754
|
|
|
496
755
|
export { VTilt, vt as default, vt };
|
|
497
|
-
export type { AliasEvent, CaptureOptions, CaptureResult, EventPayload, FeatureFlagsConfig, GeolocationData, GroupsConfig, PersistenceMethod, Properties, Property, PropertyOperations, RemoteConfig, RequestOptions, SessionData, SessionIdChangedCallback, TrackingEvent, UserIdentity, UserProperties, VTiltConfig, WebVitalMetric };
|
|
756
|
+
export type { AliasEvent, CaptureOptions, CaptureResult, EventPayload, FeatureFlagsConfig, GeolocationData, GroupsConfig, PersistenceMethod, Properties, Property, PropertyOperations, RemoteConfig, RequestOptions, SessionData, SessionIdChangedCallback, SessionRecordingMaskInputOptions, SessionRecordingOptions, TrackingEvent, UserIdentity, UserProperties, VTiltConfig, WebVitalMetric };
|