@v-tilt/browser 1.1.1 → 1.1.2
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.map +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +8 -8
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +8 -8
- package/dist/module.no-external.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/lib/config.js +4 -1
- package/lib/constants.d.ts +2 -2
- package/lib/constants.js +510 -510
- package/lib/types.d.ts +8 -8
- package/lib/vtilt.js +4 -2
- package/package.json +1 -1
package/lib/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Type definitions for the VTilt tracking SDK.
|
|
5
5
|
* Following PostHog's patterns where applicable.
|
|
6
6
|
*/
|
|
7
|
-
import type { PersonProfilesMode } from
|
|
7
|
+
import type { PersonProfilesMode } from "./constants";
|
|
8
8
|
export interface VTiltConfig {
|
|
9
9
|
/** Project identifier (required) */
|
|
10
10
|
token: string;
|
|
@@ -42,9 +42,9 @@ export interface VTiltConfig {
|
|
|
42
42
|
/** Enable web vitals tracking */
|
|
43
43
|
capture_performance?: boolean;
|
|
44
44
|
/** Enable page view tracking */
|
|
45
|
-
capture_pageview?: boolean |
|
|
45
|
+
capture_pageview?: boolean | "auto";
|
|
46
46
|
/** Enable page leave tracking */
|
|
47
|
-
capture_pageleave?: boolean |
|
|
47
|
+
capture_pageleave?: boolean | "if_capture_pageview";
|
|
48
48
|
/** Disable compression */
|
|
49
49
|
disable_compression?: boolean;
|
|
50
50
|
/** Whether to stringify payload before sending */
|
|
@@ -124,7 +124,7 @@ export interface SessionData {
|
|
|
124
124
|
* - 'sessionStorage': Stores all data in sessionStorage
|
|
125
125
|
* - 'memory': Stores all data in memory only (no persistence)
|
|
126
126
|
*/
|
|
127
|
-
export type PersistenceMethod =
|
|
127
|
+
export type PersistenceMethod = "localStorage+cookie" | "cookie" | "localStorage" | "sessionStorage" | "memory";
|
|
128
128
|
/** User identity state */
|
|
129
129
|
export interface UserIdentity {
|
|
130
130
|
/** Current distinct ID (null if anonymous) */
|
|
@@ -136,7 +136,7 @@ export interface UserIdentity {
|
|
|
136
136
|
/** User properties */
|
|
137
137
|
properties: Properties;
|
|
138
138
|
/** Identity state */
|
|
139
|
-
user_state:
|
|
139
|
+
user_state: "anonymous" | "identified";
|
|
140
140
|
}
|
|
141
141
|
export interface UserProperties {
|
|
142
142
|
[key: string]: any;
|
|
@@ -149,7 +149,7 @@ export interface WebVitalMetric {
|
|
|
149
149
|
name: string;
|
|
150
150
|
value: number;
|
|
151
151
|
delta: number;
|
|
152
|
-
rating:
|
|
152
|
+
rating: "good" | "needs-improvement" | "poor";
|
|
153
153
|
id: string;
|
|
154
154
|
navigationType: string;
|
|
155
155
|
}
|
|
@@ -164,10 +164,10 @@ export interface FeatureFlagsConfig {
|
|
|
164
164
|
[flagKey: string]: boolean | string;
|
|
165
165
|
}
|
|
166
166
|
export type SessionIdChangedCallback = (newSessionId: string, previousSessionId: string | null, changeInfo: {
|
|
167
|
-
reason:
|
|
167
|
+
reason: "timeout" | "new_session" | "reset";
|
|
168
168
|
}) => void;
|
|
169
169
|
export interface RequestOptions {
|
|
170
|
-
method?:
|
|
170
|
+
method?: "POST" | "GET";
|
|
171
171
|
headers?: Record<string, string>;
|
|
172
172
|
timeout?: number;
|
|
173
173
|
retry?: boolean;
|
package/lib/vtilt.js
CHANGED
|
@@ -388,7 +388,8 @@ class VTilt {
|
|
|
388
388
|
// and cause unnecessary server processing for identity creation/updates.
|
|
389
389
|
const setOnce = {};
|
|
390
390
|
// Only include initial props if we haven't sent them yet this page load
|
|
391
|
-
if (!this._set_once_properties_sent &&
|
|
391
|
+
if (!this._set_once_properties_sent &&
|
|
392
|
+
Object.keys(initialProps).length > 0) {
|
|
392
393
|
Object.assign(setOnce, initialProps);
|
|
393
394
|
}
|
|
394
395
|
// Always merge with user-provided $set_once if present
|
|
@@ -410,7 +411,8 @@ class VTilt {
|
|
|
410
411
|
...payload, // User-provided payload (can override base and person properties)
|
|
411
412
|
};
|
|
412
413
|
// Mark that $set_once with initial props has been sent (only do this once per page load)
|
|
413
|
-
if (!this._set_once_properties_sent &&
|
|
414
|
+
if (!this._set_once_properties_sent &&
|
|
415
|
+
Object.keys(initialProps).length > 0) {
|
|
414
416
|
this._set_once_properties_sent = true;
|
|
415
417
|
}
|
|
416
418
|
// Add title only to $pageview events
|