@sessionvision/core 0.2.0 → 0.4.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/README.md +14 -11
- package/dist/react/capture/autocapture.d.ts +2 -1
- package/dist/react/capture/deadclick.d.ts +19 -0
- package/dist/react/capture/formfields.d.ts +53 -0
- package/dist/react/capture/rageclick.d.ts +25 -0
- package/dist/react/core/config.d.ts +14 -1
- package/dist/react/core/init.d.ts +25 -0
- package/dist/react/recorder/chunk.d.ts +59 -0
- package/dist/react/recorder/index.d.ts +46 -0
- package/dist/react/recorder/mask.d.ts +13 -0
- package/dist/react/recorder/rrweb.d.ts +19 -0
- package/dist/react/recorder/upload.d.ts +20 -0
- package/dist/react/types.d.ts +119 -4
- package/dist/sessionvision-recorder.js +13041 -0
- package/dist/sessionvision-recorder.js.map +1 -0
- package/dist/sessionvision-recorder.min.js +7 -0
- package/dist/sessionvision-recorder.min.js.map +1 -0
- package/dist/sessionvision.cjs.js +1084 -262
- package/dist/sessionvision.cjs.js.map +1 -1
- package/dist/sessionvision.esm.js +1084 -262
- package/dist/sessionvision.esm.js.map +1 -1
- package/dist/sessionvision.js +1084 -262
- package/dist/sessionvision.js.map +1 -1
- package/dist/sessionvision.min.js +2 -2
- package/dist/sessionvision.min.js.map +1 -1
- package/dist/types/capture/autocapture.d.ts +2 -1
- package/dist/types/capture/deadclick.d.ts +19 -0
- package/dist/types/capture/formfields.d.ts +53 -0
- package/dist/types/capture/rageclick.d.ts +25 -0
- package/dist/types/core/config.d.ts +14 -1
- package/dist/types/core/init.d.ts +25 -0
- package/dist/types/recorder/chunk.d.ts +59 -0
- package/dist/types/recorder/index.d.ts +46 -0
- package/dist/types/recorder/mask.d.ts +13 -0
- package/dist/types/recorder/rrweb.d.ts +19 -0
- package/dist/types/recorder/upload.d.ts +20 -0
- package/dist/types/types.d.ts +119 -4
- package/dist/vue/capture/autocapture.d.ts +2 -1
- package/dist/vue/capture/deadclick.d.ts +19 -0
- package/dist/vue/capture/formfields.d.ts +53 -0
- package/dist/vue/capture/rageclick.d.ts +25 -0
- package/dist/vue/core/config.d.ts +14 -1
- package/dist/vue/core/init.d.ts +25 -0
- package/dist/vue/recorder/chunk.d.ts +59 -0
- package/dist/vue/recorder/index.d.ts +46 -0
- package/dist/vue/recorder/mask.d.ts +13 -0
- package/dist/vue/recorder/rrweb.d.ts +19 -0
- package/dist/vue/recorder/upload.d.ts +20 -0
- package/dist/vue/types.d.ts +119 -4
- package/package.json +10 -7
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privacy & masking bridge for session recordings
|
|
3
|
+
* Bridges rrweb's masking callbacks with the SDK's existing PII detection
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Mask text content for rrweb's maskTextFn callback
|
|
7
|
+
*/
|
|
8
|
+
export declare function maskTextForRecording(text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Mask input values for rrweb's maskInputFn callback
|
|
11
|
+
* Respects data-sessionvision-unmask attribute
|
|
12
|
+
*/
|
|
13
|
+
export declare function maskInputForRecording(text: string, element: HTMLElement): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rrweb integration module
|
|
3
|
+
* Wraps rrweb with configured capture options and handles events
|
|
4
|
+
*/
|
|
5
|
+
import { RecordingEvent, ResolvedConfig } from '../types';
|
|
6
|
+
type EventCallback = (event: RecordingEvent) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Start rrweb recording
|
|
9
|
+
*/
|
|
10
|
+
export declare function startRrwebRecording(config: ResolvedConfig, onEvent: EventCallback): void;
|
|
11
|
+
/**
|
|
12
|
+
* Stop rrweb recording
|
|
13
|
+
*/
|
|
14
|
+
export declare function stopRrwebRecording(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if rrweb is currently recording
|
|
17
|
+
*/
|
|
18
|
+
export declare function isRrwebRecording(): boolean;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload manager for recording chunks
|
|
3
|
+
* Sends recording chunks to the ingest API as $recording events
|
|
4
|
+
*/
|
|
5
|
+
import { RecordingEvent, ResolvedConfig } from '../types';
|
|
6
|
+
interface ChunkPayload {
|
|
7
|
+
chunkNumber: number;
|
|
8
|
+
startTime: number;
|
|
9
|
+
endTime: number;
|
|
10
|
+
events: RecordingEvent[];
|
|
11
|
+
fullSnapshotIncluded: boolean;
|
|
12
|
+
tags?: Record<string, string>;
|
|
13
|
+
isFirstChunk: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Send a recording chunk to the ingest API
|
|
17
|
+
* Uses the same endpoint as regular events with the $recording event name
|
|
18
|
+
*/
|
|
19
|
+
export declare function sendRecordingChunk(config: ResolvedConfig, chunk: ChunkPayload): Promise<boolean>;
|
|
20
|
+
export {};
|
package/dist/vue/types.d.ts
CHANGED
|
@@ -8,9 +8,15 @@ export interface AutocaptureConfig {
|
|
|
8
8
|
/** Capture $pageview events (default: true) */
|
|
9
9
|
pageview?: boolean;
|
|
10
10
|
/** Capture $click events (default: true) */
|
|
11
|
-
|
|
11
|
+
click?: boolean;
|
|
12
12
|
/** Capture $form_submit events (default: true) */
|
|
13
13
|
formSubmit?: boolean;
|
|
14
|
+
/** Detect rage clicks - rapid repeated clicks indicating frustration (default: true) */
|
|
15
|
+
rageClick?: boolean;
|
|
16
|
+
/** Detect dead clicks - clicks with no DOM response (default: true) */
|
|
17
|
+
deadClick?: boolean;
|
|
18
|
+
/** Track form field interactions for abandonment analysis (default: true) */
|
|
19
|
+
formAbandonment?: boolean;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* SDK configuration options passed to init()
|
|
@@ -30,6 +36,10 @@ export interface SessionVisionConfig {
|
|
|
30
36
|
maskAllInputs?: boolean;
|
|
31
37
|
/** Enable/disable auto-capture (default: true) */
|
|
32
38
|
autocapture?: boolean | AutocaptureConfig;
|
|
39
|
+
/** Override recording behavior. Set false to force-disable regardless of remote config. */
|
|
40
|
+
recording?: false | {
|
|
41
|
+
maskAllInputs?: boolean;
|
|
42
|
+
};
|
|
33
43
|
}
|
|
34
44
|
/**
|
|
35
45
|
* Internal resolved configuration
|
|
@@ -44,12 +54,22 @@ export interface ResolvedConfig {
|
|
|
44
54
|
maskAllInputs: boolean;
|
|
45
55
|
autocapture: {
|
|
46
56
|
pageview: boolean;
|
|
47
|
-
|
|
57
|
+
click: boolean;
|
|
48
58
|
formSubmit: boolean;
|
|
59
|
+
rageClick: boolean;
|
|
60
|
+
deadClick: boolean;
|
|
61
|
+
formAbandonment: boolean;
|
|
62
|
+
};
|
|
63
|
+
recording?: false | {
|
|
64
|
+
maskAllInputs?: boolean;
|
|
49
65
|
};
|
|
50
66
|
}
|
|
51
67
|
/**
|
|
52
68
|
* Remote configuration fetched from server
|
|
69
|
+
*
|
|
70
|
+
* Only recording and session settings are remotely configurable.
|
|
71
|
+
* Autocapture settings (including rage/dead click detection) are
|
|
72
|
+
* configured locally via init() options.
|
|
53
73
|
*/
|
|
54
74
|
export interface RemoteConfig {
|
|
55
75
|
recording?: {
|
|
@@ -59,7 +79,6 @@ export interface RemoteConfig {
|
|
|
59
79
|
session?: {
|
|
60
80
|
timeoutMinutes: number;
|
|
61
81
|
};
|
|
62
|
-
version?: string;
|
|
63
82
|
}
|
|
64
83
|
/**
|
|
65
84
|
* User traits for identify()
|
|
@@ -123,6 +142,65 @@ export interface ClickEventProperties extends EventProperties {
|
|
|
123
142
|
$element_selector: string;
|
|
124
143
|
$element_href: string | null;
|
|
125
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Rage click event properties
|
|
147
|
+
*/
|
|
148
|
+
export interface RageClickEventProperties extends EventProperties {
|
|
149
|
+
$element_tag: string;
|
|
150
|
+
$element_text: string;
|
|
151
|
+
$element_classes: string;
|
|
152
|
+
$element_id: string | null;
|
|
153
|
+
$element_selector: string;
|
|
154
|
+
$element_href: string | null;
|
|
155
|
+
$click_count: number;
|
|
156
|
+
$rage_click_duration_ms: number;
|
|
157
|
+
$click_x: number;
|
|
158
|
+
$click_y: number;
|
|
159
|
+
$element_x: number;
|
|
160
|
+
$element_y: number;
|
|
161
|
+
$click_positions: Array<{
|
|
162
|
+
x: number;
|
|
163
|
+
y: number;
|
|
164
|
+
timestamp: number;
|
|
165
|
+
}>;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Dead click event properties
|
|
169
|
+
*/
|
|
170
|
+
export interface DeadClickEventProperties extends EventProperties {
|
|
171
|
+
$element_tag: string;
|
|
172
|
+
$element_text: string;
|
|
173
|
+
$element_classes: string;
|
|
174
|
+
$element_id: string | null;
|
|
175
|
+
$element_selector: string;
|
|
176
|
+
$element_href: string | null;
|
|
177
|
+
$click_x: number;
|
|
178
|
+
$click_y: number;
|
|
179
|
+
$element_x: number;
|
|
180
|
+
$element_y: number;
|
|
181
|
+
$wait_duration_ms: number;
|
|
182
|
+
$element_is_interactive: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Form start event properties
|
|
186
|
+
*/
|
|
187
|
+
export interface FormStartEventProperties extends EventProperties {
|
|
188
|
+
$form_id: string | null;
|
|
189
|
+
$form_name: string | null;
|
|
190
|
+
$form_selector: string;
|
|
191
|
+
$form_field_count: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Form field change event properties
|
|
195
|
+
*/
|
|
196
|
+
export interface FormFieldChangeEventProperties extends EventProperties {
|
|
197
|
+
$form_selector: string;
|
|
198
|
+
$field_selector: string;
|
|
199
|
+
$field_name: string | null;
|
|
200
|
+
$field_type: string;
|
|
201
|
+
$field_index: number;
|
|
202
|
+
$has_value: boolean;
|
|
203
|
+
}
|
|
126
204
|
/**
|
|
127
205
|
* Form submit event properties
|
|
128
206
|
*/
|
|
@@ -131,6 +209,12 @@ export interface FormSubmitEventProperties extends EventProperties {
|
|
|
131
209
|
$form_action: string;
|
|
132
210
|
$form_method: string;
|
|
133
211
|
$form_name: string | null;
|
|
212
|
+
$form_selector: string;
|
|
213
|
+
$form_field_count: number;
|
|
214
|
+
$form_fields_filled: string[];
|
|
215
|
+
$form_fields_interacted: string[];
|
|
216
|
+
$form_completion_rate: number;
|
|
217
|
+
$form_time_to_submit_ms: number | null;
|
|
134
218
|
}
|
|
135
219
|
/**
|
|
136
220
|
* Pageview event properties
|
|
@@ -185,6 +269,20 @@ export interface SessionVisionAPI {
|
|
|
185
269
|
register(properties: EventProperties): void;
|
|
186
270
|
/** Register properties only if they don't already exist */
|
|
187
271
|
registerOnce(properties: EventProperties): void;
|
|
272
|
+
/** Manually flush the event buffer */
|
|
273
|
+
flushEvents(): Promise<void>;
|
|
274
|
+
/** Subscribe to SDK events (e.g., 'recording:error', 'recording:quota_exceeded') */
|
|
275
|
+
on(event: string, callback: (data?: unknown) => void): void;
|
|
276
|
+
/** Unsubscribe from SDK events */
|
|
277
|
+
off(event: string, callback: (data?: unknown) => void): void;
|
|
278
|
+
/** Manually start recording. Respects remote config — no-op if recording.enabled is false. Bypasses sampling when recording is enabled. */
|
|
279
|
+
startRecording(): void;
|
|
280
|
+
/** Stop recording for this session */
|
|
281
|
+
stopRecording(): void;
|
|
282
|
+
/** Check if recording is active */
|
|
283
|
+
isRecording(): boolean;
|
|
284
|
+
/** Tag the current recording with custom metadata */
|
|
285
|
+
tagRecording(tags: Record<string, string>): void;
|
|
188
286
|
/** SDK version */
|
|
189
287
|
version: string;
|
|
190
288
|
/** Internal: queued method calls before SDK loads */
|
|
@@ -194,6 +292,23 @@ export interface SessionVisionAPI {
|
|
|
194
292
|
/** Internal: SDK version marker */
|
|
195
293
|
__SV?: number;
|
|
196
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Recording event type (rrweb event)
|
|
297
|
+
*/
|
|
298
|
+
export interface RecordingEvent {
|
|
299
|
+
type: number;
|
|
300
|
+
data: unknown;
|
|
301
|
+
timestamp: number;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Recording chunk configuration
|
|
305
|
+
*/
|
|
306
|
+
export declare const RECORDING_CONFIG: {
|
|
307
|
+
readonly FLUSH_INTERVAL_MS: 5000;
|
|
308
|
+
readonly MAX_BUFFER_SIZE_BYTES: number;
|
|
309
|
+
readonly FULL_SNAPSHOT_INTERVAL_MS: number;
|
|
310
|
+
readonly RETRY_DELAY_MS: 2000;
|
|
311
|
+
};
|
|
197
312
|
/**
|
|
198
313
|
* Storage key constants
|
|
199
314
|
*/
|
|
@@ -223,6 +338,6 @@ export declare const BUFFER_CONFIG: {
|
|
|
223
338
|
readonly RETRY_DELAYS_MS: readonly [1000, 2000, 4000];
|
|
224
339
|
};
|
|
225
340
|
/**
|
|
226
|
-
* Config cache TTL in milliseconds (
|
|
341
|
+
* Config cache TTL in milliseconds (4 hours)
|
|
227
342
|
*/
|
|
228
343
|
export declare const CONFIG_CACHE_TTL_MS: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sessionvision/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Session Vision client-side tracking library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/sessionvision.cjs.js",
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
"author": "Session Vision",
|
|
58
58
|
"license": "MIT",
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@testing-library/jest-dom": "^6.5.0",
|
|
61
|
-
"@testing-library/react": "^16.0.1",
|
|
62
|
-
"@testing-library/user-event": "^14.5.2",
|
|
63
60
|
"@eslint/js": "^9.18.0",
|
|
64
|
-
"@playwright/test": "^1.
|
|
61
|
+
"@playwright/test": "^1.56.0",
|
|
65
62
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
66
63
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
67
64
|
"@rollup/plugin-replace": "^5.0.5",
|
|
68
65
|
"@rollup/plugin-terser": "^0.4.4",
|
|
69
66
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
67
|
+
"@testing-library/jest-dom": "^6.5.0",
|
|
68
|
+
"@testing-library/react": "^16.0.1",
|
|
69
|
+
"@testing-library/user-event": "^14.5.2",
|
|
70
70
|
"@types/jest": "^29.5.12",
|
|
71
71
|
"@types/react": "^18.3.12",
|
|
72
72
|
"@types/react-dom": "^18.3.0",
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"jest": "^29.7.0",
|
|
77
77
|
"jest-environment-jsdom": "^29.7.0",
|
|
78
78
|
"prettier": "^3.4.2",
|
|
79
|
-
"rollup": "^4.9.6",
|
|
80
79
|
"react": "^18.3.1",
|
|
81
80
|
"react-dom": "^18.3.1",
|
|
81
|
+
"rollup": "^4.9.6",
|
|
82
82
|
"ts-jest": "^29.1.2",
|
|
83
83
|
"tslib": "^2.6.2",
|
|
84
84
|
"typescript": "^5.3.3",
|
|
@@ -105,5 +105,8 @@
|
|
|
105
105
|
"last 2 Firefox versions",
|
|
106
106
|
"last 2 Safari versions",
|
|
107
107
|
"last 2 Edge versions"
|
|
108
|
-
]
|
|
108
|
+
],
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"rrweb": "^2.0.0-alpha.18"
|
|
111
|
+
}
|
|
109
112
|
}
|