@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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External Scripts Loader
|
|
3
|
+
*
|
|
4
|
+
* Dynamically loads external scripts (like rrweb) from CDN.
|
|
5
|
+
* Based on PostHog's implementation.
|
|
6
|
+
*/
|
|
7
|
+
import type { VTilt } from "../vtilt";
|
|
8
|
+
import { VTiltExtensionKind } from "../utils/globals";
|
|
9
|
+
/**
|
|
10
|
+
* Load a script dynamically
|
|
11
|
+
*/
|
|
12
|
+
declare const loadScript: (vtilt: VTilt, url: string, callback: (error?: string | Event, event?: Event) => void) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Get the URL for an extension script
|
|
15
|
+
*
|
|
16
|
+
* Priority:
|
|
17
|
+
* 1. script_host config (if set) - loads from {script_host}/dist/{kind}.js
|
|
18
|
+
* 2. Default to unpkg CDN for npm package
|
|
19
|
+
*
|
|
20
|
+
* Note: script_host should be the base URL (e.g., "https://cdn.example.com")
|
|
21
|
+
* The /dist/ path is automatically appended to match the npm package structure
|
|
22
|
+
*/
|
|
23
|
+
declare const getExtensionUrl: (vtilt: VTilt, kind: VTiltExtensionKind) => string;
|
|
24
|
+
export { loadScript, getExtensionUrl };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recorder Entrypoint
|
|
3
|
+
*
|
|
4
|
+
* This file is built as a separate bundle (recorder.js) that can be
|
|
5
|
+
* lazy-loaded when session recording is enabled.
|
|
6
|
+
*
|
|
7
|
+
* It exports:
|
|
8
|
+
* - rrweb.record: The rrweb record function
|
|
9
|
+
* - rrwebPlugins: Plugins for console recording
|
|
10
|
+
* - initSessionRecording: Factory function to create LazyLoadedSessionRecording
|
|
11
|
+
*/
|
|
12
|
+
import { record as rrwebRecord } from "@rrweb/record";
|
|
13
|
+
import { LazyLoadedSessionRecordingInterface } from "../utils/globals";
|
|
14
|
+
import type { SessionRecordingConfig } from "../extensions/replay/types";
|
|
15
|
+
import type { VTilt } from "../vtilt";
|
|
16
|
+
/**
|
|
17
|
+
* Factory function to create a LazyLoadedSessionRecording instance
|
|
18
|
+
*
|
|
19
|
+
* Called by SessionRecordingWrapper after the recorder script is loaded
|
|
20
|
+
*/
|
|
21
|
+
declare function initSessionRecording(instance: VTilt, config?: SessionRecordingConfig): LazyLoadedSessionRecordingInterface;
|
|
22
|
+
export { initSessionRecording };
|
|
23
|
+
export default rrwebRecord;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recording Extension
|
|
3
|
+
*
|
|
4
|
+
* Exports for rrweb session recording functionality.
|
|
5
|
+
*
|
|
6
|
+
* Architecture:
|
|
7
|
+
* - SessionRecordingWrapper: Lightweight wrapper in main bundle, handles lazy loading
|
|
8
|
+
* - LazyLoadedSessionRecording: Actual recording logic, loaded on demand via recorder.js
|
|
9
|
+
*/
|
|
10
|
+
export { SessionRecordingWrapper, LAZY_LOADING, type SessionRecordingStatus, type LazyLoadedSessionRecordingInterface, } from "./session-recording-wrapper";
|
|
11
|
+
export { LazyLoadedSessionRecording } from "./session-recording";
|
|
12
|
+
export type { SessionRecordingConfig, SessionStartReason, RecordOptions, RRWebRecord, SnapshotBuffer, CanvasRecordingConfig, NetworkPayloadCaptureConfig, MaskingConfig, TriggerType, } from "./types";
|
|
13
|
+
export { compressEvent, estimateSize, truncateLargeConsoleLogs, splitBuffer, isSessionIdleEvent, isRecordingPausedEvent, isInteractiveEvent, RECORDING_MAX_EVENT_SIZE, RECORDING_BUFFER_TIMEOUT, RECORDING_IDLE_THRESHOLD_MS, } from "./session-recording-utils";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recording Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utility functions for session recording.
|
|
5
|
+
* Based on PostHog's sessionrecording-utils.ts
|
|
6
|
+
*/
|
|
7
|
+
import { EventType, IncrementalSource, eventWithTime } from "@rrweb/types";
|
|
8
|
+
import type { SnapshotBuffer } from "./types";
|
|
9
|
+
export declare const INCREMENTAL_SNAPSHOT_EVENT_TYPE = 3;
|
|
10
|
+
export declare const ONE_KB = 1024;
|
|
11
|
+
export declare const ONE_MB: number;
|
|
12
|
+
export declare const SEVEN_MB: number;
|
|
13
|
+
export declare const PARTIAL_COMPRESSION_THRESHOLD = 1024;
|
|
14
|
+
export declare const RECORDING_MAX_EVENT_SIZE: number;
|
|
15
|
+
export declare const RECORDING_BUFFER_TIMEOUT = 2000;
|
|
16
|
+
export declare const RECORDING_IDLE_THRESHOLD_MS: number;
|
|
17
|
+
/** Active interaction sources */
|
|
18
|
+
export declare const ACTIVE_SOURCES: IncrementalSource[];
|
|
19
|
+
/**
|
|
20
|
+
* Gzip compress data to a base64 string
|
|
21
|
+
*/
|
|
22
|
+
export declare function gzipToString(data: unknown): string;
|
|
23
|
+
/**
|
|
24
|
+
* Estimate the size of an object in bytes
|
|
25
|
+
*/
|
|
26
|
+
export declare function estimateSize(obj: unknown): number;
|
|
27
|
+
export interface CompressedFullSnapshotEvent {
|
|
28
|
+
type: typeof EventType.FullSnapshot;
|
|
29
|
+
data: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CompressedIncrementalSnapshotEvent {
|
|
32
|
+
type: typeof EventType.IncrementalSnapshot;
|
|
33
|
+
data: {
|
|
34
|
+
source: IncrementalSource;
|
|
35
|
+
texts: string;
|
|
36
|
+
attributes: string;
|
|
37
|
+
removes: string;
|
|
38
|
+
adds: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface CompressedIncrementalStyleSnapshotEvent {
|
|
42
|
+
type: typeof EventType.IncrementalSnapshot;
|
|
43
|
+
data: {
|
|
44
|
+
source: typeof IncrementalSource.StyleSheetRule;
|
|
45
|
+
id?: number;
|
|
46
|
+
styleId?: number;
|
|
47
|
+
replace?: string;
|
|
48
|
+
replaceSync?: string;
|
|
49
|
+
adds?: string;
|
|
50
|
+
removes?: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export type CompressedEvent = CompressedFullSnapshotEvent | CompressedIncrementalSnapshotEvent | CompressedIncrementalStyleSnapshotEvent;
|
|
54
|
+
export type CompressedEventWithTime = CompressedEvent & {
|
|
55
|
+
timestamp: number;
|
|
56
|
+
delay?: number;
|
|
57
|
+
cv: "2024-10";
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Compress an rrweb event for transmission
|
|
61
|
+
* Only compresses full snapshots and mutation events above threshold
|
|
62
|
+
*/
|
|
63
|
+
export declare function compressEvent(event: eventWithTime): eventWithTime | CompressedEventWithTime;
|
|
64
|
+
/**
|
|
65
|
+
* Truncate large console log payloads to prevent excessive data
|
|
66
|
+
*/
|
|
67
|
+
export declare function truncateLargeConsoleLogs(event: eventWithTime): eventWithTime;
|
|
68
|
+
/**
|
|
69
|
+
* Split a large buffer into smaller chunks for transmission
|
|
70
|
+
*/
|
|
71
|
+
export declare function splitBuffer(buffer: SnapshotBuffer, sizeLimit?: number): SnapshotBuffer[];
|
|
72
|
+
/**
|
|
73
|
+
* Check if an event is a session idle custom event
|
|
74
|
+
*/
|
|
75
|
+
export declare function isSessionIdleEvent(event: eventWithTime): event is eventWithTime & {
|
|
76
|
+
data: {
|
|
77
|
+
tag: string;
|
|
78
|
+
payload: unknown;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Check if an event is a recording paused custom event
|
|
83
|
+
*/
|
|
84
|
+
export declare function isRecordingPausedEvent(event: eventWithTime): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Check if an event represents user interaction
|
|
87
|
+
*/
|
|
88
|
+
export declare function isInteractiveEvent(event: eventWithTime): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Clamp a value to a range with logging
|
|
91
|
+
*/
|
|
92
|
+
export declare function clampToRange(value: number, min: number, max: number, label: string, defaultValue: number): number;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recording Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Lightweight wrapper that handles the decision of WHEN to load recording.
|
|
5
|
+
* The actual recording logic is in LazyLoadedSessionRecording which is
|
|
6
|
+
* loaded on demand.
|
|
7
|
+
*
|
|
8
|
+
* Based on PostHog's sessionrecording-wrapper.ts
|
|
9
|
+
*/
|
|
10
|
+
import type { VTilt } from "../../vtilt";
|
|
11
|
+
import type { SessionRecordingConfig, SessionStartReason } from "./types";
|
|
12
|
+
import { LazyLoadedSessionRecordingInterface } from "../../utils/globals";
|
|
13
|
+
/** Status when lazy loading is in progress */
|
|
14
|
+
export declare const LAZY_LOADING: "lazy_loading";
|
|
15
|
+
/** Session recording status */
|
|
16
|
+
export type SessionRecordingStatus = "disabled" | "buffering" | "active" | "paused" | "sampled" | "trigger_pending" | typeof LAZY_LOADING;
|
|
17
|
+
export type { LazyLoadedSessionRecordingInterface };
|
|
18
|
+
/**
|
|
19
|
+
* Session Recording Wrapper
|
|
20
|
+
*
|
|
21
|
+
* This is the lightweight class that lives in the main bundle.
|
|
22
|
+
* It handles:
|
|
23
|
+
* - Deciding if recording should be enabled
|
|
24
|
+
* - Lazy loading the actual recording code
|
|
25
|
+
* - Delegating to LazyLoadedSessionRecording
|
|
26
|
+
*/
|
|
27
|
+
export declare class SessionRecordingWrapper {
|
|
28
|
+
private readonly _instance;
|
|
29
|
+
private _lazyLoadedRecording;
|
|
30
|
+
private _config;
|
|
31
|
+
constructor(_instance: VTilt, config?: SessionRecordingConfig);
|
|
32
|
+
get started(): boolean;
|
|
33
|
+
get status(): SessionRecordingStatus;
|
|
34
|
+
get sessionId(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Start recording if enabled, otherwise stop
|
|
37
|
+
*/
|
|
38
|
+
startIfEnabledOrStop(startReason?: SessionStartReason): void;
|
|
39
|
+
/**
|
|
40
|
+
* Stop recording
|
|
41
|
+
*/
|
|
42
|
+
stopRecording(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Log a message to the recording
|
|
45
|
+
*/
|
|
46
|
+
log(message: string, level?: "log" | "warn" | "error"): void;
|
|
47
|
+
/**
|
|
48
|
+
* Update configuration
|
|
49
|
+
*/
|
|
50
|
+
updateConfig(config: Partial<SessionRecordingConfig>): void;
|
|
51
|
+
private get _isRecordingEnabled();
|
|
52
|
+
private get _scriptName();
|
|
53
|
+
/**
|
|
54
|
+
* Lazy load the recording script and start
|
|
55
|
+
*/
|
|
56
|
+
private _lazyLoadAndStart;
|
|
57
|
+
/**
|
|
58
|
+
* Called after the recording script is loaded
|
|
59
|
+
*/
|
|
60
|
+
private _onScriptLoaded;
|
|
61
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Loaded Session Recording
|
|
3
|
+
*
|
|
4
|
+
* The actual rrweb session recording implementation.
|
|
5
|
+
* This is loaded on demand when recording is enabled.
|
|
6
|
+
*
|
|
7
|
+
* Based on PostHog's lazy-loaded-session-recorder.ts
|
|
8
|
+
*/
|
|
9
|
+
import { type eventWithTime } from "@rrweb/types";
|
|
10
|
+
import type { VTilt } from "../../vtilt";
|
|
11
|
+
import { LazyLoadedSessionRecordingInterface } from "../../utils/globals";
|
|
12
|
+
import type { SessionRecordingConfig, SessionRecordingStatus } from "./types";
|
|
13
|
+
export declare const SESSION_RECORDING_BATCH_KEY = "recordings";
|
|
14
|
+
export declare class LazyLoadedSessionRecording implements LazyLoadedSessionRecordingInterface {
|
|
15
|
+
private _instance;
|
|
16
|
+
private _endpoint;
|
|
17
|
+
private _flushBufferTimer?;
|
|
18
|
+
private _fullSnapshotTimer?;
|
|
19
|
+
private _captureStarted;
|
|
20
|
+
private _stopRrweb?;
|
|
21
|
+
private _isIdle;
|
|
22
|
+
private _lastActivityTimestamp;
|
|
23
|
+
private _lastHref?;
|
|
24
|
+
private _sessionId;
|
|
25
|
+
private _windowId;
|
|
26
|
+
private _buffer;
|
|
27
|
+
private _queuedRRWebEvents;
|
|
28
|
+
private _config;
|
|
29
|
+
constructor(instance: VTilt, config?: SessionRecordingConfig);
|
|
30
|
+
get isStarted(): boolean;
|
|
31
|
+
/** @deprecated Use isStarted instead */
|
|
32
|
+
get started(): boolean;
|
|
33
|
+
get sessionId(): string;
|
|
34
|
+
get status(): SessionRecordingStatus;
|
|
35
|
+
/**
|
|
36
|
+
* Start session recording (interface method)
|
|
37
|
+
*/
|
|
38
|
+
start(startReason?: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Stop session recording (interface method)
|
|
41
|
+
*/
|
|
42
|
+
stop(): void;
|
|
43
|
+
/** @deprecated Use stop() instead */
|
|
44
|
+
stopRecording(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Add a custom event to the recording
|
|
47
|
+
*/
|
|
48
|
+
addCustomEvent(tag: string, payload: unknown): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Take a full snapshot
|
|
51
|
+
*/
|
|
52
|
+
takeFullSnapshot(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Log a message to the recording
|
|
55
|
+
*/
|
|
56
|
+
log(message: string, level?: "log" | "warn" | "error"): void;
|
|
57
|
+
/**
|
|
58
|
+
* Update configuration
|
|
59
|
+
*/
|
|
60
|
+
updateConfig(config: Partial<SessionRecordingConfig>): void;
|
|
61
|
+
private _onBeforeUnload;
|
|
62
|
+
private _onOffline;
|
|
63
|
+
private _onOnline;
|
|
64
|
+
private _onVisibilityChange;
|
|
65
|
+
private _isRecordingEnabled;
|
|
66
|
+
private _startCapture;
|
|
67
|
+
private _loadRecorder;
|
|
68
|
+
private _onScriptLoaded;
|
|
69
|
+
private _gatherRRWebPlugins;
|
|
70
|
+
onRRwebEmit(rawEvent: eventWithTime): void;
|
|
71
|
+
private _processQueuedEvents;
|
|
72
|
+
private _updateWindowAndSessionIds;
|
|
73
|
+
private _clearBuffer;
|
|
74
|
+
private _flushBuffer;
|
|
75
|
+
private _captureSnapshotBuffered;
|
|
76
|
+
private _captureSnapshot;
|
|
77
|
+
private _sendSnapshot;
|
|
78
|
+
/**
|
|
79
|
+
* Fetch with exponential backoff retry (PostHog-style)
|
|
80
|
+
* Retries on network errors and 5xx server errors
|
|
81
|
+
*/
|
|
82
|
+
private _fetchWithRetry;
|
|
83
|
+
/**
|
|
84
|
+
* Schedule a retry with exponential backoff and jitter
|
|
85
|
+
*/
|
|
86
|
+
private _scheduleRetry;
|
|
87
|
+
private _scheduleFullSnapshot;
|
|
88
|
+
private _tryRRWebMethod;
|
|
89
|
+
private _tryAddCustomEvent;
|
|
90
|
+
private _tryTakeFullSnapshot;
|
|
91
|
+
private _getCanvasConfig;
|
|
92
|
+
private _getMaskingConfig;
|
|
93
|
+
private _generateId;
|
|
94
|
+
private _reportStarted;
|
|
95
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recording Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for rrweb session recording.
|
|
5
|
+
* Based on PostHog's implementation.
|
|
6
|
+
*/
|
|
7
|
+
import type { blockClass, eventWithTime, hooksParam, KeepIframeSrcFn, maskTextClass, PackFn, RecordPlugin, SamplingStrategy } from "@rrweb/types";
|
|
8
|
+
/** Mask options for input elements */
|
|
9
|
+
export type MaskInputOptions = Partial<{
|
|
10
|
+
color: boolean;
|
|
11
|
+
date: boolean;
|
|
12
|
+
"datetime-local": boolean;
|
|
13
|
+
email: boolean;
|
|
14
|
+
month: boolean;
|
|
15
|
+
number: boolean;
|
|
16
|
+
range: boolean;
|
|
17
|
+
search: boolean;
|
|
18
|
+
tel: boolean;
|
|
19
|
+
text: boolean;
|
|
20
|
+
time: boolean;
|
|
21
|
+
url: boolean;
|
|
22
|
+
week: boolean;
|
|
23
|
+
textarea: boolean;
|
|
24
|
+
select: boolean;
|
|
25
|
+
password: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
/** Function to mask input values */
|
|
28
|
+
export type MaskInputFn = (text: string, element: HTMLElement) => string;
|
|
29
|
+
/** Function to mask text content */
|
|
30
|
+
export type MaskTextFn = (text: string, element: HTMLElement | null) => string;
|
|
31
|
+
/** Options for slim DOM mode */
|
|
32
|
+
export type SlimDOMOptions = Partial<{
|
|
33
|
+
script: boolean;
|
|
34
|
+
comment: boolean;
|
|
35
|
+
headFavicon: boolean;
|
|
36
|
+
headWhitespace: boolean;
|
|
37
|
+
headMetaDescKeywords: boolean;
|
|
38
|
+
headMetaSocial: boolean;
|
|
39
|
+
headMetaRobots: boolean;
|
|
40
|
+
headMetaHttpEquiv: boolean;
|
|
41
|
+
headMetaAuthorship: boolean;
|
|
42
|
+
headMetaVerification: boolean;
|
|
43
|
+
headTitleMutations: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** Options for data URL generation */
|
|
46
|
+
export type DataURLOptions = Partial<{
|
|
47
|
+
type: string;
|
|
48
|
+
quality: number;
|
|
49
|
+
}>;
|
|
50
|
+
/** Error handler type */
|
|
51
|
+
export type ErrorHandler = (error: unknown) => void | boolean;
|
|
52
|
+
/** rrweb record options */
|
|
53
|
+
export interface RecordOptions {
|
|
54
|
+
emit?: (e: eventWithTime, isCheckout?: boolean) => void;
|
|
55
|
+
checkoutEveryNth?: number;
|
|
56
|
+
checkoutEveryNms?: number;
|
|
57
|
+
blockClass?: blockClass;
|
|
58
|
+
blockSelector?: string;
|
|
59
|
+
ignoreClass?: string;
|
|
60
|
+
ignoreSelector?: string;
|
|
61
|
+
maskTextClass?: maskTextClass;
|
|
62
|
+
maskTextSelector?: string;
|
|
63
|
+
maskAllInputs?: boolean;
|
|
64
|
+
maskInputOptions?: MaskInputOptions;
|
|
65
|
+
maskInputFn?: MaskInputFn;
|
|
66
|
+
maskTextFn?: MaskTextFn;
|
|
67
|
+
slimDOMOptions?: SlimDOMOptions | "all" | true;
|
|
68
|
+
ignoreCSSAttributes?: Set<string>;
|
|
69
|
+
inlineStylesheet?: boolean;
|
|
70
|
+
hooks?: hooksParam;
|
|
71
|
+
packFn?: PackFn;
|
|
72
|
+
sampling?: SamplingStrategy;
|
|
73
|
+
dataURLOptions?: DataURLOptions;
|
|
74
|
+
recordDOM?: boolean;
|
|
75
|
+
recordCanvas?: boolean;
|
|
76
|
+
recordCrossOriginIframes?: boolean;
|
|
77
|
+
recordAfter?: "DOMContentLoaded" | "load";
|
|
78
|
+
userTriggeredOnInput?: boolean;
|
|
79
|
+
collectFonts?: boolean;
|
|
80
|
+
inlineImages?: boolean;
|
|
81
|
+
plugins?: RecordPlugin[];
|
|
82
|
+
mousemoveWait?: number;
|
|
83
|
+
keepIframeSrcFn?: KeepIframeSrcFn;
|
|
84
|
+
errorHandler?: ErrorHandler;
|
|
85
|
+
}
|
|
86
|
+
/** rrweb record function type */
|
|
87
|
+
export interface RRWebRecord {
|
|
88
|
+
(options: RecordOptions): () => void;
|
|
89
|
+
addCustomEvent: (tag: string, payload: unknown) => void;
|
|
90
|
+
takeFullSnapshot: () => void;
|
|
91
|
+
mirror: {
|
|
92
|
+
getId(n: Node | undefined | null): number;
|
|
93
|
+
getNode(id: number): Node | null;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Canvas recording configuration */
|
|
97
|
+
export interface CanvasRecordingConfig {
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
fps: number;
|
|
100
|
+
quality: number;
|
|
101
|
+
}
|
|
102
|
+
/** Network payload capture configuration */
|
|
103
|
+
export interface NetworkPayloadCaptureConfig {
|
|
104
|
+
recordHeaders?: boolean;
|
|
105
|
+
recordBody?: boolean;
|
|
106
|
+
recordPerformance?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/** Masking configuration */
|
|
109
|
+
export interface MaskingConfig {
|
|
110
|
+
maskAllInputs?: boolean;
|
|
111
|
+
maskTextSelector?: string;
|
|
112
|
+
blockSelector?: string;
|
|
113
|
+
}
|
|
114
|
+
/** Session recording configuration */
|
|
115
|
+
export interface SessionRecordingConfig {
|
|
116
|
+
/** Enable session recording */
|
|
117
|
+
enabled?: boolean;
|
|
118
|
+
/** Sample rate (0-1, where 1 = 100%) */
|
|
119
|
+
sampleRate?: number;
|
|
120
|
+
/** Minimum session duration in ms before sending */
|
|
121
|
+
minimumDurationMs?: number;
|
|
122
|
+
/** Session idle threshold in ms */
|
|
123
|
+
sessionIdleThresholdMs?: number;
|
|
124
|
+
/** Full snapshot interval in ms */
|
|
125
|
+
fullSnapshotIntervalMs?: number;
|
|
126
|
+
/** Enable console log capture */
|
|
127
|
+
captureConsole?: boolean;
|
|
128
|
+
/** Enable network request capture */
|
|
129
|
+
captureNetwork?: boolean;
|
|
130
|
+
/** Canvas recording settings */
|
|
131
|
+
captureCanvas?: {
|
|
132
|
+
recordCanvas?: boolean;
|
|
133
|
+
canvasFps?: number;
|
|
134
|
+
canvasQuality?: number;
|
|
135
|
+
};
|
|
136
|
+
/** Masking settings */
|
|
137
|
+
masking?: MaskingConfig;
|
|
138
|
+
/** Block class for elements to hide */
|
|
139
|
+
blockClass?: string;
|
|
140
|
+
/** Block selector for elements to hide */
|
|
141
|
+
blockSelector?: string;
|
|
142
|
+
/** Ignore class for input masking */
|
|
143
|
+
ignoreClass?: string;
|
|
144
|
+
/** Mask text class */
|
|
145
|
+
maskTextClass?: string;
|
|
146
|
+
/** Mask text selector */
|
|
147
|
+
maskTextSelector?: string;
|
|
148
|
+
/** Mask all inputs */
|
|
149
|
+
maskAllInputs?: boolean;
|
|
150
|
+
/** Mask input options */
|
|
151
|
+
maskInputOptions?: MaskInputOptions;
|
|
152
|
+
/** Record headers in network requests */
|
|
153
|
+
recordHeaders?: boolean;
|
|
154
|
+
/** Record body in network requests */
|
|
155
|
+
recordBody?: boolean;
|
|
156
|
+
/** Compress events before sending */
|
|
157
|
+
compressEvents?: boolean;
|
|
158
|
+
/** Internal: Mutation throttler refill rate */
|
|
159
|
+
__mutationThrottlerRefillRate?: number;
|
|
160
|
+
/** Internal: Mutation throttler bucket size */
|
|
161
|
+
__mutationThrottlerBucketSize?: number;
|
|
162
|
+
}
|
|
163
|
+
/** Recording status values */
|
|
164
|
+
export type SessionRecordingStatus = "disabled" | "buffering" | "active" | "paused" | "sampled" | "trigger_pending";
|
|
165
|
+
/** Recording start reason */
|
|
166
|
+
export type SessionStartReason = "recording_initialized" | "session_id_changed" | "linked_flag_matched" | "linked_flag_overridden" | "sampling_overridden" | "url_trigger_matched" | "event_trigger_matched" | "sampled";
|
|
167
|
+
/** Trigger type for starting recording */
|
|
168
|
+
export type TriggerType = "url" | "event";
|
|
169
|
+
/** Buffer for snapshot events */
|
|
170
|
+
export interface SnapshotBuffer {
|
|
171
|
+
size: number;
|
|
172
|
+
data: eventWithTime[];
|
|
173
|
+
sessionId: string;
|
|
174
|
+
windowId: string;
|
|
175
|
+
}
|
|
176
|
+
/** Remote configuration for session recording */
|
|
177
|
+
export interface SessionRecordingRemoteConfig {
|
|
178
|
+
enabled?: boolean;
|
|
179
|
+
endpoint?: string;
|
|
180
|
+
sampleRate?: string;
|
|
181
|
+
minimumDurationMilliseconds?: number;
|
|
182
|
+
consoleLogRecordingEnabled?: boolean;
|
|
183
|
+
networkPayloadCapture?: {
|
|
184
|
+
recordHeaders?: boolean;
|
|
185
|
+
recordBody?: boolean;
|
|
186
|
+
capturePerformance?: boolean;
|
|
187
|
+
};
|
|
188
|
+
masking?: MaskingConfig;
|
|
189
|
+
recordCanvas?: boolean;
|
|
190
|
+
canvasFps?: number;
|
|
191
|
+
canvasQuality?: number;
|
|
192
|
+
scriptConfig?: {
|
|
193
|
+
script?: string;
|
|
194
|
+
};
|
|
195
|
+
triggerMatchType?: "any" | "all";
|
|
196
|
+
urlTriggers?: Array<{
|
|
197
|
+
url: string;
|
|
198
|
+
matching: "regex" | "exact" | "contains";
|
|
199
|
+
}>;
|
|
200
|
+
urlBlocklist?: Array<{
|
|
201
|
+
url: string;
|
|
202
|
+
matching: "regex" | "exact" | "contains";
|
|
203
|
+
}>;
|
|
204
|
+
eventTriggers?: string[];
|
|
205
|
+
}
|
|
206
|
+
/** Queued rrweb method call */
|
|
207
|
+
export interface QueuedRRWebEvent {
|
|
208
|
+
rrwebMethod: () => void;
|
|
209
|
+
attempt: number;
|
|
210
|
+
enqueuedAt: number;
|
|
211
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(n){"use strict";var i="undefined"!=typeof window?window:void 0,l="undefined"!=typeof globalThis?globalThis:i,r=null==l?void 0:l.navigator,o=null==l?void 0:l.document;null==l||l.location,null==l||l.fetch,(null==l?void 0:l.XMLHttpRequest)&&"withCredentials"in new l.XMLHttpRequest&&l.XMLHttpRequest,null==l||l.AbortController,null==r||r.userAgent;var t=null!=i?i:{},d=(n,i,l)=>{if(n.getConfig().disable_external_dependency_loading)return console.warn("[ExternalScriptsLoader] "+i+" was requested but loading of external scripts is disabled."),l("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var t,d=function(){if(r[e].src===i){var n=r[e];return n.__vtilt_loading_callback_fired?{v:l()}:(n.addEventListener("load",i=>{n.__vtilt_loading_callback_fired=!0,l(void 0,i)}),n.onerror=n=>l(n),{v:void 0})}},e=0;e<r.length;e++)if(t=d())return t.v;var a=()=>{var n;if(!o)return l("document not found");var r=o.createElement("script");r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=n=>{r.__vtilt_loading_callback_fired=!0,l(void 0,n)},r.onerror=n=>l(n);var t=o.querySelectorAll("body > script");t.length>0?null===(n=t[0].parentNode)||void 0===n||n.insertBefore(r,t[0]):o.body.appendChild(r)};(null==o?void 0:o.body)?a():null==o||o.addEventListener("DOMContentLoaded",a)},e=(n,i)=>{var l=n.getConfig();return l.script_host?l.script_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":"https://unpkg.com/@v-tilt/browser@1.1.5/dist/"+i+".js"};t.__VTiltExtensions__=t.__VTiltExtensions__||{},t.__VTiltExtensions__.loadExternalDependency=(n,i,l)=>{var r=e(n,i);d(n,r,l)},n.getExtensionUrl=e,n.loadScript=d}({});
|
|
2
|
+
//# sourceMappingURL=external-scripts-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-scripts-loader.js","sources":["../src/utils/globals.ts","../src/entrypoints/external-scripts-loader.ts"],"sourcesContent":[null,null],"names":["win","window","undefined","global","globalThis","navigator","document","location","fetch","XMLHttpRequest","AbortController","userAgent","assignableWindow","loadScript","vtilt","url","callback","getConfig","disable_external_dependency_loading","console","warn","LOGGER_PREFIX","existingScripts","querySelectorAll","_ret","_loop","i","src","alreadyExistingScriptTag","__vtilt_loading_callback_fired","v","addEventListener","event","onerror","error","length","addScript","scriptTag","createElement","type","crossOrigin","onload","scripts","_a","parentNode","insertBefore","body","appendChild","getExtensionUrl","kind","config","script_host","replace","__VTiltExtensions__","loadExternalDependency"],"mappings":"0BAaA,IAAMA,EACc,oBAAXC,OAAyBA,YAASC,EA8DrCC,EACkB,oBAAfC,WAA6BA,WAAaJ,EAMtCK,EAAYF,aAAM,EAANA,EAAQE,UACpBC,EAAWH,aAAM,EAANA,EAAQG,SACRH,SAAAA,EAAQI,SACXJ,SAAAA,EAAQK,OAE3BL,aAAM,EAANA,EAAQM,iBAAkB,oBAAqB,IAAIN,EAAOM,gBACtDN,EAAOM,eAEkBN,SAAAA,EAAQO,gBACdL,SAAAA,EAAWM,UAC7B,IAAMC,EAAqCZ,QAAAA,EAAQ,CAAA,EC1EpDa,EAAaA,CACjBC,EACAC,EACAC,KAKA,GAHeF,EAAMG,YAGDC,oCAIlB,OAHAC,QAAQC,KACHC,2BAAiBN,iEAEfC,EAAS,2CAIlB,IAAMM,EAAkBhB,aAAQ,EAARA,EAAUiB,iBAAiB,UACnD,GAAID,EACF,IADmB,IAuBlBE,EAvBkBC,EAAA,WAEjB,GAAIH,EAAgBI,GAAGC,MAAQZ,EAAK,CAClC,IAAMa,EAA2BN,EAC/BI,GAKF,OAAIE,EAAyBC,+BAC3B,CAAAC,EACOd,MAITY,EAAyBG,iBAAiB,OAASC,IACjDJ,EAAyBC,gCAAiC,EAC1Db,OAASd,EAAW8B,KAEtBJ,EAAyBK,QAAWC,GAAUlB,EAASkB,GAAO,CAAAJ,OAAA,GAGhE,CACF,EAtBSJ,EAAI,EAAGA,EAAIJ,EAAgBa,OAAQT,IAAG,GAAAF,EAAAC,IAAA,OAAAD,EAAAM,EAyBjD,IAAMM,EAAYA,WAChB,IAAK9B,EACH,OAAOU,EAAS,sBAGlB,IAAMqB,EAAY/B,EAASgC,cAAc,UAGzCD,EAAUE,KAAO,kBACjBF,EAAUG,YAAc,YACxBH,EAAUV,IAAMZ,EAChBsB,EAAUI,OAAUT,IAClBK,EAAUR,gCAAiC,EAC3Cb,OAASd,EAAW8B,IAEtBK,EAAUJ,QAAWC,GAAUlB,EAASkB,GAExC,IAAMQ,EAAUpC,EAASiB,iBAAiB,iBACtCmB,EAAQP,OAAS,EACE,QAArBQ,EAAAD,EAAQ,GAAGE,kBAAU,IAAAD,GAAAA,EAAEE,aAAaR,EAAWK,EAAQ,IAEvDpC,EAASwC,KAAKC,YAAYV,KAI1B/B,aAAQ,EAARA,EAAUwC,MACZV,IAEA9B,SAAAA,EAAUyB,iBAAiB,mBAAoBK,IAmB7CY,EAAkBA,CAAClC,EAAcmC,KACrC,IAAMC,EAASpC,EAAMG,YAGrB,OAAIiC,EAAOC,YACSD,EAAOC,YAAYC,QAAQ,SAAU,aAC3BH,EAAI,MAKlC,gDAAgEA,EAAI,OAItErC,EAAiByC,oBACfzC,EAAiByC,qBAAuB,CAAA,EAK1CzC,EAAiByC,oBAAoBC,uBAAyB,CAC5DxC,EACAmC,EACAjC,KAEA,IAAMD,EAAMiC,EAAgBlC,EAAOmC,GACnCpC,EAAWC,EAAOC,EAAKC"}
|