@sessionvision/core 0.2.0 → 0.3.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/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/types.d.ts +82 -3
- package/dist/sessionvision.cjs.js +801 -251
- package/dist/sessionvision.cjs.js.map +1 -1
- package/dist/sessionvision.esm.js +801 -251
- package/dist/sessionvision.esm.js.map +1 -1
- package/dist/sessionvision.js +801 -251
- 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/types.d.ts +82 -3
- 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/types.d.ts +82 -3
- package/package.json +6 -6
package/dist/types/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()
|
|
@@ -44,12 +50,19 @@ export interface ResolvedConfig {
|
|
|
44
50
|
maskAllInputs: boolean;
|
|
45
51
|
autocapture: {
|
|
46
52
|
pageview: boolean;
|
|
47
|
-
|
|
53
|
+
click: boolean;
|
|
48
54
|
formSubmit: boolean;
|
|
55
|
+
rageClick: boolean;
|
|
56
|
+
deadClick: boolean;
|
|
57
|
+
formAbandonment: boolean;
|
|
49
58
|
};
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
52
61
|
* Remote configuration fetched from server
|
|
62
|
+
*
|
|
63
|
+
* Only recording and session settings are remotely configurable.
|
|
64
|
+
* Autocapture settings (including rage/dead click detection) are
|
|
65
|
+
* configured locally via init() options.
|
|
53
66
|
*/
|
|
54
67
|
export interface RemoteConfig {
|
|
55
68
|
recording?: {
|
|
@@ -59,7 +72,6 @@ export interface RemoteConfig {
|
|
|
59
72
|
session?: {
|
|
60
73
|
timeoutMinutes: number;
|
|
61
74
|
};
|
|
62
|
-
version?: string;
|
|
63
75
|
}
|
|
64
76
|
/**
|
|
65
77
|
* User traits for identify()
|
|
@@ -123,6 +135,65 @@ export interface ClickEventProperties extends EventProperties {
|
|
|
123
135
|
$element_selector: string;
|
|
124
136
|
$element_href: string | null;
|
|
125
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Rage click event properties
|
|
140
|
+
*/
|
|
141
|
+
export interface RageClickEventProperties extends EventProperties {
|
|
142
|
+
$element_tag: string;
|
|
143
|
+
$element_text: string;
|
|
144
|
+
$element_classes: string;
|
|
145
|
+
$element_id: string | null;
|
|
146
|
+
$element_selector: string;
|
|
147
|
+
$element_href: string | null;
|
|
148
|
+
$click_count: number;
|
|
149
|
+
$rage_click_duration_ms: number;
|
|
150
|
+
$click_x: number;
|
|
151
|
+
$click_y: number;
|
|
152
|
+
$element_x: number;
|
|
153
|
+
$element_y: number;
|
|
154
|
+
$click_positions: Array<{
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
timestamp: number;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Dead click event properties
|
|
162
|
+
*/
|
|
163
|
+
export interface DeadClickEventProperties extends EventProperties {
|
|
164
|
+
$element_tag: string;
|
|
165
|
+
$element_text: string;
|
|
166
|
+
$element_classes: string;
|
|
167
|
+
$element_id: string | null;
|
|
168
|
+
$element_selector: string;
|
|
169
|
+
$element_href: string | null;
|
|
170
|
+
$click_x: number;
|
|
171
|
+
$click_y: number;
|
|
172
|
+
$element_x: number;
|
|
173
|
+
$element_y: number;
|
|
174
|
+
$wait_duration_ms: number;
|
|
175
|
+
$element_is_interactive: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Form start event properties
|
|
179
|
+
*/
|
|
180
|
+
export interface FormStartEventProperties extends EventProperties {
|
|
181
|
+
$form_id: string | null;
|
|
182
|
+
$form_name: string | null;
|
|
183
|
+
$form_selector: string;
|
|
184
|
+
$form_field_count: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Form field change event properties
|
|
188
|
+
*/
|
|
189
|
+
export interface FormFieldChangeEventProperties extends EventProperties {
|
|
190
|
+
$form_selector: string;
|
|
191
|
+
$field_selector: string;
|
|
192
|
+
$field_name: string | null;
|
|
193
|
+
$field_type: string;
|
|
194
|
+
$field_index: number;
|
|
195
|
+
$has_value: boolean;
|
|
196
|
+
}
|
|
126
197
|
/**
|
|
127
198
|
* Form submit event properties
|
|
128
199
|
*/
|
|
@@ -131,6 +202,12 @@ export interface FormSubmitEventProperties extends EventProperties {
|
|
|
131
202
|
$form_action: string;
|
|
132
203
|
$form_method: string;
|
|
133
204
|
$form_name: string | null;
|
|
205
|
+
$form_selector: string;
|
|
206
|
+
$form_field_count: number;
|
|
207
|
+
$form_fields_filled: string[];
|
|
208
|
+
$form_fields_interacted: string[];
|
|
209
|
+
$form_completion_rate: number;
|
|
210
|
+
$form_time_to_submit_ms: number | null;
|
|
134
211
|
}
|
|
135
212
|
/**
|
|
136
213
|
* Pageview event properties
|
|
@@ -185,6 +262,8 @@ export interface SessionVisionAPI {
|
|
|
185
262
|
register(properties: EventProperties): void;
|
|
186
263
|
/** Register properties only if they don't already exist */
|
|
187
264
|
registerOnce(properties: EventProperties): void;
|
|
265
|
+
/** Manually flush the event buffer */
|
|
266
|
+
flushEvents(): Promise<void>;
|
|
188
267
|
/** SDK version */
|
|
189
268
|
version: string;
|
|
190
269
|
/** Internal: queued method calls before SDK loads */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dead Click Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects clicks that produce no visible DOM changes.
|
|
5
|
+
* Emits $dead_click events when no response is detected.
|
|
6
|
+
*/
|
|
7
|
+
import { ResolvedConfig } from '../types';
|
|
8
|
+
export declare function shouldExcludeFromDeadClick(element: Element): boolean;
|
|
9
|
+
export declare class DeadClickDetector {
|
|
10
|
+
private static readonly DEFAULT_TIMEOUT_MS;
|
|
11
|
+
private pendingClick;
|
|
12
|
+
private timeoutMs;
|
|
13
|
+
constructor(_config: ResolvedConfig);
|
|
14
|
+
monitorClick(event: MouseEvent, element: Element, properties: Record<string, unknown>): void;
|
|
15
|
+
private cancelPending;
|
|
16
|
+
private isMeaningfulMutation;
|
|
17
|
+
private emitDeadClick;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form Field Tracking
|
|
3
|
+
*
|
|
4
|
+
* Tracks form field interactions for abandonment analysis.
|
|
5
|
+
* Emits $form_start when user begins filling a form,
|
|
6
|
+
* $form_field_change when fields are modified.
|
|
7
|
+
*/
|
|
8
|
+
import { ResolvedConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* State for a form that has been started
|
|
11
|
+
*/
|
|
12
|
+
interface FormState {
|
|
13
|
+
startTime: number;
|
|
14
|
+
fieldCount: number;
|
|
15
|
+
interactedFields: Set<string>;
|
|
16
|
+
filledFields: Set<string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the current state for a form
|
|
20
|
+
*/
|
|
21
|
+
export declare function getFormState(formSelector: string): FormState | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Reset tracking for a specific form (called after submit)
|
|
24
|
+
*/
|
|
25
|
+
export declare function resetForm(formSelector: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get form tracking data for enhanced submit event
|
|
28
|
+
*/
|
|
29
|
+
export declare function getFormTrackingData(form: HTMLFormElement): {
|
|
30
|
+
formSelector: string;
|
|
31
|
+
formFieldCount: number;
|
|
32
|
+
formFieldsFilled: string[];
|
|
33
|
+
formFieldsInteracted: string[];
|
|
34
|
+
formCompletionRate: number;
|
|
35
|
+
formTimeToSubmitMs: number | null;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Initialize form field tracking
|
|
39
|
+
*/
|
|
40
|
+
export declare function initFormFieldTracking(_cfg: ResolvedConfig): void;
|
|
41
|
+
/**
|
|
42
|
+
* Stop form field tracking
|
|
43
|
+
*/
|
|
44
|
+
export declare function stopFormFieldTracking(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check if form field tracking is active
|
|
47
|
+
*/
|
|
48
|
+
export declare function isFormFieldTrackingEnabled(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Reset for testing
|
|
51
|
+
*/
|
|
52
|
+
export declare function _reset(): void;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rage Click Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects rapid repeated clicks indicating user frustration.
|
|
5
|
+
* Emits a single $rage_click event after the click sequence ends.
|
|
6
|
+
*/
|
|
7
|
+
import { ResolvedConfig } from '../types';
|
|
8
|
+
export declare function shouldExcludeFromRageClick(element: Element): boolean;
|
|
9
|
+
export declare class RageClickDetector {
|
|
10
|
+
private clicks;
|
|
11
|
+
private emitTimeout;
|
|
12
|
+
private threshold;
|
|
13
|
+
private windowMs;
|
|
14
|
+
private radiusPx;
|
|
15
|
+
private static readonly DEFAULT_THRESHOLD;
|
|
16
|
+
private static readonly DEFAULT_WINDOW_MS;
|
|
17
|
+
private static readonly DEFAULT_RADIUS_PX;
|
|
18
|
+
constructor(_config: ResolvedConfig);
|
|
19
|
+
recordClick(event: MouseEvent, element: Element, properties: Record<string, unknown>): void;
|
|
20
|
+
private scheduleEmit;
|
|
21
|
+
private maybeEmitRageClick;
|
|
22
|
+
private isClickCluster;
|
|
23
|
+
private emitRageClick;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
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()
|
|
@@ -44,12 +50,19 @@ export interface ResolvedConfig {
|
|
|
44
50
|
maskAllInputs: boolean;
|
|
45
51
|
autocapture: {
|
|
46
52
|
pageview: boolean;
|
|
47
|
-
|
|
53
|
+
click: boolean;
|
|
48
54
|
formSubmit: boolean;
|
|
55
|
+
rageClick: boolean;
|
|
56
|
+
deadClick: boolean;
|
|
57
|
+
formAbandonment: boolean;
|
|
49
58
|
};
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
52
61
|
* Remote configuration fetched from server
|
|
62
|
+
*
|
|
63
|
+
* Only recording and session settings are remotely configurable.
|
|
64
|
+
* Autocapture settings (including rage/dead click detection) are
|
|
65
|
+
* configured locally via init() options.
|
|
53
66
|
*/
|
|
54
67
|
export interface RemoteConfig {
|
|
55
68
|
recording?: {
|
|
@@ -59,7 +72,6 @@ export interface RemoteConfig {
|
|
|
59
72
|
session?: {
|
|
60
73
|
timeoutMinutes: number;
|
|
61
74
|
};
|
|
62
|
-
version?: string;
|
|
63
75
|
}
|
|
64
76
|
/**
|
|
65
77
|
* User traits for identify()
|
|
@@ -123,6 +135,65 @@ export interface ClickEventProperties extends EventProperties {
|
|
|
123
135
|
$element_selector: string;
|
|
124
136
|
$element_href: string | null;
|
|
125
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Rage click event properties
|
|
140
|
+
*/
|
|
141
|
+
export interface RageClickEventProperties extends EventProperties {
|
|
142
|
+
$element_tag: string;
|
|
143
|
+
$element_text: string;
|
|
144
|
+
$element_classes: string;
|
|
145
|
+
$element_id: string | null;
|
|
146
|
+
$element_selector: string;
|
|
147
|
+
$element_href: string | null;
|
|
148
|
+
$click_count: number;
|
|
149
|
+
$rage_click_duration_ms: number;
|
|
150
|
+
$click_x: number;
|
|
151
|
+
$click_y: number;
|
|
152
|
+
$element_x: number;
|
|
153
|
+
$element_y: number;
|
|
154
|
+
$click_positions: Array<{
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
timestamp: number;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Dead click event properties
|
|
162
|
+
*/
|
|
163
|
+
export interface DeadClickEventProperties extends EventProperties {
|
|
164
|
+
$element_tag: string;
|
|
165
|
+
$element_text: string;
|
|
166
|
+
$element_classes: string;
|
|
167
|
+
$element_id: string | null;
|
|
168
|
+
$element_selector: string;
|
|
169
|
+
$element_href: string | null;
|
|
170
|
+
$click_x: number;
|
|
171
|
+
$click_y: number;
|
|
172
|
+
$element_x: number;
|
|
173
|
+
$element_y: number;
|
|
174
|
+
$wait_duration_ms: number;
|
|
175
|
+
$element_is_interactive: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Form start event properties
|
|
179
|
+
*/
|
|
180
|
+
export interface FormStartEventProperties extends EventProperties {
|
|
181
|
+
$form_id: string | null;
|
|
182
|
+
$form_name: string | null;
|
|
183
|
+
$form_selector: string;
|
|
184
|
+
$form_field_count: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Form field change event properties
|
|
188
|
+
*/
|
|
189
|
+
export interface FormFieldChangeEventProperties extends EventProperties {
|
|
190
|
+
$form_selector: string;
|
|
191
|
+
$field_selector: string;
|
|
192
|
+
$field_name: string | null;
|
|
193
|
+
$field_type: string;
|
|
194
|
+
$field_index: number;
|
|
195
|
+
$has_value: boolean;
|
|
196
|
+
}
|
|
126
197
|
/**
|
|
127
198
|
* Form submit event properties
|
|
128
199
|
*/
|
|
@@ -131,6 +202,12 @@ export interface FormSubmitEventProperties extends EventProperties {
|
|
|
131
202
|
$form_action: string;
|
|
132
203
|
$form_method: string;
|
|
133
204
|
$form_name: string | null;
|
|
205
|
+
$form_selector: string;
|
|
206
|
+
$form_field_count: number;
|
|
207
|
+
$form_fields_filled: string[];
|
|
208
|
+
$form_fields_interacted: string[];
|
|
209
|
+
$form_completion_rate: number;
|
|
210
|
+
$form_time_to_submit_ms: number | null;
|
|
134
211
|
}
|
|
135
212
|
/**
|
|
136
213
|
* Pageview event properties
|
|
@@ -185,6 +262,8 @@ export interface SessionVisionAPI {
|
|
|
185
262
|
register(properties: EventProperties): void;
|
|
186
263
|
/** Register properties only if they don't already exist */
|
|
187
264
|
registerOnce(properties: EventProperties): void;
|
|
265
|
+
/** Manually flush the event buffer */
|
|
266
|
+
flushEvents(): Promise<void>;
|
|
188
267
|
/** SDK version */
|
|
189
268
|
version: string;
|
|
190
269
|
/** Internal: queued method calls before SDK loads */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sessionvision/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|