@v-tilt/browser 1.0.7 → 1.0.9
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/constants.d.ts +0 -1
- package/dist/extensions/history-autocapture.d.ts +0 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +52 -132
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +52 -132
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/session.d.ts +5 -5
- package/dist/types.d.ts +1 -0
- package/dist/user-manager.d.ts +30 -20
- package/dist/utils/event-utils.d.ts +7 -8
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/patch.d.ts +0 -2
- package/dist/utils/type-utils.d.ts +4 -0
- package/dist/vtilt.d.ts +54 -14
- package/dist/web-vitals.d.ts +3 -3
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +1 -23
- package/lib/extensions/history-autocapture.d.ts +0 -2
- package/lib/extensions/history-autocapture.js +3 -5
- package/lib/session.d.ts +5 -5
- package/lib/session.js +8 -8
- package/lib/types.d.ts +1 -0
- package/lib/user-manager.d.ts +30 -20
- package/lib/user-manager.js +103 -92
- package/lib/utils/event-utils.d.ts +7 -8
- package/lib/utils/event-utils.js +8 -9
- package/lib/utils/index.d.ts +0 -5
- package/lib/utils/index.js +0 -13
- package/lib/utils/patch.d.ts +0 -2
- package/lib/utils/patch.js +2 -7
- package/lib/utils/type-utils.d.ts +4 -0
- package/lib/utils/type-utils.js +9 -0
- package/lib/utils/user-agent-utils.js +5 -17
- package/lib/vtilt.d.ts +54 -14
- package/lib/vtilt.js +328 -45
- package/lib/web-vitals.d.ts +3 -3
- package/lib/web-vitals.js +3 -3
- package/package.json +13 -12
- package/LICENSE +0 -21
- package/dist/tracking.d.ts +0 -120
- package/lib/tracking.d.ts +0 -120
- package/lib/tracking.js +0 -338
package/lib/vtilt.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { VTiltConfig, EventPayload } from "./types";
|
|
2
|
-
import { TrackingManager } from "./tracking";
|
|
3
2
|
import { HistoryAutocapture } from "./extensions/history-autocapture";
|
|
3
|
+
interface QueuedRequest {
|
|
4
|
+
url: string;
|
|
5
|
+
event: any;
|
|
6
|
+
}
|
|
4
7
|
export declare class VTilt {
|
|
5
8
|
private configManager;
|
|
6
|
-
|
|
9
|
+
private sessionManager;
|
|
10
|
+
private userManager;
|
|
7
11
|
private webVitalsManager;
|
|
8
12
|
historyAutocapture?: HistoryAutocapture;
|
|
9
13
|
__loaded: boolean;
|
|
10
14
|
private _initialPageviewCaptured;
|
|
11
15
|
private _visibilityStateListener;
|
|
16
|
+
__request_queue: QueuedRequest[];
|
|
17
|
+
private _hasWarnedAboutConfig;
|
|
12
18
|
constructor(config?: Partial<VTiltConfig>);
|
|
13
19
|
/**
|
|
14
20
|
* Initializes a new instance of the VTilt tracking object.
|
|
@@ -44,23 +50,57 @@ export declare class VTilt {
|
|
|
44
50
|
/**
|
|
45
51
|
* Handles the actual initialization logic for a VTilt instance.
|
|
46
52
|
* This internal method should only be called by `init()`.
|
|
47
|
-
* Follows the PostHog convention of using a private `_init()` method for instance setup.
|
|
48
53
|
*/
|
|
49
54
|
private _init;
|
|
50
55
|
/**
|
|
51
|
-
* Returns a string representation of the instance name
|
|
56
|
+
* Returns a string representation of the instance name
|
|
52
57
|
* Used for debugging and logging
|
|
53
58
|
*
|
|
54
59
|
* @internal
|
|
55
60
|
*/
|
|
56
61
|
toString(): string;
|
|
57
62
|
/**
|
|
58
|
-
*
|
|
63
|
+
* Get current domain from location
|
|
64
|
+
* Returns full URL format for consistency with dashboard
|
|
65
|
+
*/
|
|
66
|
+
private getCurrentDomain;
|
|
67
|
+
/**
|
|
68
|
+
* Check if tracking is properly configured
|
|
69
|
+
* Returns true if projectId and token are present, false otherwise
|
|
70
|
+
* Logs a warning only once per instance if not configured
|
|
71
|
+
*/
|
|
72
|
+
private _isConfigured;
|
|
73
|
+
/**
|
|
74
|
+
* Build the tracking URL with token in query parameters
|
|
75
|
+
*/
|
|
76
|
+
private buildUrl;
|
|
77
|
+
/**
|
|
78
|
+
* Send HTTP request
|
|
79
|
+
* This is the central entry point for all tracking requests
|
|
80
|
+
*/
|
|
81
|
+
private sendRequest;
|
|
82
|
+
/**
|
|
83
|
+
* Send a queued request (called after DOM is loaded)
|
|
84
|
+
*/
|
|
85
|
+
_send_retriable_request(item: QueuedRequest): void;
|
|
86
|
+
/**
|
|
87
|
+
* Capture an event
|
|
88
|
+
* Automatically adds common properties to all events
|
|
89
|
+
* ($current_url, $host, $pathname, $referrer, $referring_domain, $browser_language, etc.)
|
|
90
|
+
* Also adds title property for $pageview events only
|
|
91
|
+
*
|
|
92
|
+
* @param name - Event name
|
|
93
|
+
* @param payload - Event payload
|
|
94
|
+
*/
|
|
95
|
+
capture(name: string, payload: EventPayload): void;
|
|
96
|
+
/**
|
|
97
|
+
* Track a custom event (alias for capture)
|
|
59
98
|
*/
|
|
60
99
|
trackEvent(name: string, payload?: EventPayload): void;
|
|
61
100
|
/**
|
|
62
|
-
* Identify a user with
|
|
63
|
-
*
|
|
101
|
+
* Identify a user with property operations
|
|
102
|
+
* Sends $identify event when transitioning from anonymous to identified
|
|
103
|
+
* Event's distinct_id is the previous/anonymous ID, new distinct_id is in payload
|
|
64
104
|
*
|
|
65
105
|
* @example
|
|
66
106
|
* ```js
|
|
@@ -77,9 +117,9 @@ export declare class VTilt {
|
|
|
77
117
|
* vTilt.identify('user_123', { name: 'John Doe', email: 'john@example.com' })
|
|
78
118
|
* ```
|
|
79
119
|
*/
|
|
80
|
-
identify(
|
|
120
|
+
identify(newDistinctId?: string, userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
|
|
81
121
|
/**
|
|
82
|
-
* Set user properties
|
|
122
|
+
* Set user properties
|
|
83
123
|
* Sets properties on the person profile associated with the current distinct_id
|
|
84
124
|
*
|
|
85
125
|
* @example
|
|
@@ -103,7 +143,7 @@ export declare class VTilt {
|
|
|
103
143
|
setUserProperties(userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
|
|
104
144
|
/**
|
|
105
145
|
* Reset user identity (logout)
|
|
106
|
-
*
|
|
146
|
+
* Clears all user data, generates new anonymous ID, resets session
|
|
107
147
|
*
|
|
108
148
|
* @param reset_device_id - If true, also resets device_id. Default: false
|
|
109
149
|
*
|
|
@@ -130,7 +170,7 @@ export declare class VTilt {
|
|
|
130
170
|
getUserState(): "anonymous" | "identified";
|
|
131
171
|
/**
|
|
132
172
|
* Create an alias to link two distinct IDs
|
|
133
|
-
*
|
|
173
|
+
* Links anonymous session to account on signup
|
|
134
174
|
*
|
|
135
175
|
* @param alias - A unique identifier that you want to use for this user in the future
|
|
136
176
|
* @param original - The current identifier being used for this user (optional, defaults to current distinct_id)
|
|
@@ -146,7 +186,6 @@ export declare class VTilt {
|
|
|
146
186
|
createAlias(alias: string, original?: string): void;
|
|
147
187
|
/**
|
|
148
188
|
* Capture initial pageview with visibility check
|
|
149
|
-
* Based on PostHog's _captureInitialPageview implementation
|
|
150
189
|
*/
|
|
151
190
|
private _captureInitialPageview;
|
|
152
191
|
/**
|
|
@@ -179,12 +218,12 @@ export declare class VTilt {
|
|
|
179
218
|
_dom_loaded(): void;
|
|
180
219
|
}
|
|
181
220
|
/**
|
|
182
|
-
* Initialize vTilt as a module
|
|
221
|
+
* Initialize vTilt as a module
|
|
183
222
|
* Returns an uninitialized vTilt instance that the user must call init() on
|
|
184
223
|
*/
|
|
185
224
|
export declare function init_as_module(): VTilt;
|
|
186
225
|
/**
|
|
187
|
-
* Initialize vTilt from snippet
|
|
226
|
+
* Initialize vTilt from snippet
|
|
188
227
|
* Processes queued calls from the snippet stub and replaces it with real instance
|
|
189
228
|
*
|
|
190
229
|
* The snippet uses some clever tricks to allow deferred loading of array.js (this code)
|
|
@@ -214,3 +253,4 @@ export declare function init_as_module(): VTilt;
|
|
|
214
253
|
* ]
|
|
215
254
|
*/
|
|
216
255
|
export declare function init_from_snippet(): void;
|
|
256
|
+
export {};
|