@v-tilt/browser 1.0.11 → 1.1.1
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 +172 -10
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +230 -46
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +230 -46
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/rate-limiter.d.ts +52 -0
- package/dist/request-queue.d.ts +78 -0
- package/dist/request.d.ts +54 -0
- package/dist/retry-queue.d.ts +64 -0
- package/dist/session.d.ts +2 -2
- package/dist/types.d.ts +154 -37
- package/dist/user-manager.d.ts +2 -2
- package/dist/vtilt.d.ts +51 -12
- package/lib/config.js +6 -13
- package/lib/constants.d.ts +172 -10
- package/lib/constants.js +644 -439
- package/lib/rate-limiter.d.ts +52 -0
- package/lib/rate-limiter.js +80 -0
- package/lib/request-queue.d.ts +78 -0
- package/lib/request-queue.js +156 -0
- package/lib/request.d.ts +54 -0
- package/lib/request.js +265 -0
- package/lib/retry-queue.d.ts +64 -0
- package/lib/retry-queue.js +182 -0
- package/lib/session.d.ts +2 -2
- package/lib/session.js +3 -3
- package/lib/types.d.ts +154 -37
- package/lib/types.js +6 -0
- package/lib/user-manager.d.ts +2 -2
- package/lib/user-manager.js +38 -11
- package/lib/utils/event-utils.js +88 -82
- package/lib/utils/index.js +2 -2
- package/lib/utils/request-utils.js +21 -19
- package/lib/vtilt.d.ts +51 -12
- package/lib/vtilt.js +199 -40
- package/lib/web-vitals.js +1 -1
- package/package.json +2 -1
package/lib/constants.d.ts
CHANGED
|
@@ -1,12 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Constants
|
|
3
|
+
*
|
|
4
|
+
* Following PostHog's pattern for constant definitions.
|
|
5
|
+
* These are used throughout the SDK for:
|
|
6
|
+
* - Storage keys
|
|
7
|
+
* - Property names
|
|
8
|
+
* - Event names
|
|
9
|
+
* - Configuration defaults
|
|
10
|
+
*/
|
|
11
|
+
/** @deprecated Use DISTINCT_ID instead */
|
|
12
|
+
export declare const PEOPLE_DISTINCT_ID_KEY = "$people_distinct_id";
|
|
13
|
+
/** Current distinct_id */
|
|
14
|
+
export declare const DISTINCT_ID = "distinct_id";
|
|
15
|
+
/** Alias ID for aliasing operations */
|
|
16
|
+
export declare const ALIAS_ID_KEY = "__alias";
|
|
17
|
+
/** Event timers storage key */
|
|
18
|
+
export declare const EVENT_TIMERS_KEY = "__timers";
|
|
19
|
+
/** Session ID storage key */
|
|
20
|
+
export declare const SESSION_ID = "$sesid";
|
|
21
|
+
/** Session storage key (for session manager) */
|
|
22
|
+
export declare const STORAGE_KEY = "__vt_session";
|
|
23
|
+
/** Window ID storage key */
|
|
24
|
+
export declare const WINDOW_ID = "$windowid";
|
|
25
|
+
/** Window ID key (for session storage) */
|
|
26
|
+
export declare const WINDOW_ID_KEY = "__vt_window_id";
|
|
27
|
+
/** Primary window exists key (for tab duplication detection) */
|
|
28
|
+
export declare const PRIMARY_WINDOW_EXISTS_KEY = "__vt_primary_window";
|
|
29
|
+
/** User state (anonymous/identified) */
|
|
30
|
+
export declare const USER_STATE = "$user_state";
|
|
31
|
+
/** User state storage key */
|
|
32
|
+
export declare const USER_STATE_KEY = "__vt_user_state";
|
|
33
|
+
/** Device ID storage key */
|
|
34
|
+
export declare const DEVICE_ID = "$device_id";
|
|
35
|
+
/** Device ID key (for storage) */
|
|
36
|
+
export declare const DEVICE_ID_KEY = "__vt_device_id";
|
|
37
|
+
/** Anonymous ID storage key */
|
|
38
|
+
export declare const ANONYMOUS_ID = "$anonymous_id";
|
|
39
|
+
/** Anonymous ID key (for storage) */
|
|
40
|
+
export declare const ANONYMOUS_ID_KEY = "__vt_anonymous_id";
|
|
41
|
+
/** Distinct ID key (for storage) */
|
|
42
|
+
export declare const DISTINCT_ID_KEY = "__vt_distinct_id";
|
|
43
|
+
/** User properties storage key */
|
|
44
|
+
export declare const USER_PROPERTIES_KEY = "__vt_user_properties";
|
|
45
|
+
/**
|
|
46
|
+
* Persistence methods object
|
|
47
|
+
* Following PostHog's approach for storage/persistence configuration
|
|
48
|
+
*/
|
|
49
|
+
export declare const PERSISTENCE_METHODS: {
|
|
50
|
+
cookie: "cookie";
|
|
51
|
+
localStorage: "localStorage";
|
|
52
|
+
localStoragePlusCookie: "localStorage+cookie";
|
|
53
|
+
sessionStorage: "sessionStorage";
|
|
54
|
+
memory: "memory";
|
|
55
|
+
};
|
|
56
|
+
/** @deprecated Use PERSISTENCE_METHODS instead */
|
|
57
|
+
export declare const STORAGE_METHODS: {
|
|
58
|
+
cookie: "cookie";
|
|
59
|
+
localStorage: "localStorage";
|
|
60
|
+
localStoragePlusCookie: "localStorage+cookie";
|
|
61
|
+
sessionStorage: "sessionStorage";
|
|
62
|
+
memory: "memory";
|
|
63
|
+
};
|
|
64
|
+
/** Enable person processing flag */
|
|
65
|
+
export declare const ENABLE_PERSON_PROCESSING = "$epp";
|
|
66
|
+
/** Initial person info (referrer, URL, UTM params) */
|
|
10
67
|
export declare const INITIAL_PERSON_INFO = "$initial_person_info";
|
|
11
|
-
|
|
68
|
+
/** @deprecated Use INITIAL_PERSON_INFO */
|
|
69
|
+
export declare const INITIAL_CAMPAIGN_PARAMS = "$initial_campaign_params";
|
|
70
|
+
/** @deprecated Use INITIAL_PERSON_INFO */
|
|
71
|
+
export declare const INITIAL_REFERRER_INFO = "$initial_referrer_info";
|
|
72
|
+
/** Stored person properties for feature flags */
|
|
73
|
+
export declare const STORED_PERSON_PROPERTIES_KEY = "$stored_person_properties";
|
|
74
|
+
/** Stored group properties for feature flags */
|
|
75
|
+
export declare const STORED_GROUP_PROPERTIES_KEY = "$stored_group_properties";
|
|
76
|
+
export declare const AUTOCAPTURE_DISABLED_SERVER_SIDE = "$autocapture_disabled_server_side";
|
|
77
|
+
export declare const WEB_VITALS_ENABLED_SERVER_SIDE = "$web_vitals_enabled_server_side";
|
|
78
|
+
export declare const SESSION_RECORDING_ENABLED_SERVER_SIDE = "$session_recording_enabled_server_side";
|
|
79
|
+
/** Pageview event */
|
|
80
|
+
export declare const EVENT_PAGEVIEW = "$pageview";
|
|
81
|
+
/** Pageleave event */
|
|
82
|
+
export declare const EVENT_PAGELEAVE = "$pageleave";
|
|
83
|
+
/** Identify event */
|
|
84
|
+
export declare const EVENT_IDENTIFY = "$identify";
|
|
85
|
+
/** Alias event */
|
|
86
|
+
export declare const EVENT_ALIAS = "$create_alias";
|
|
87
|
+
/** Set person properties event */
|
|
88
|
+
export declare const EVENT_SET = "$set";
|
|
89
|
+
/** Group identify event */
|
|
90
|
+
export declare const EVENT_GROUP_IDENTIFY = "$groupidentify";
|
|
91
|
+
/** Performance event */
|
|
92
|
+
export declare const EVENT_PERFORMANCE = "$performance_event";
|
|
93
|
+
/** Snapshot event (session recording) */
|
|
94
|
+
export declare const EVENT_SNAPSHOT = "$snapshot";
|
|
95
|
+
/** Rate limit warning event */
|
|
96
|
+
export declare const EVENT_RATE_LIMIT_WARNING = "$$client_ingestion_warning";
|
|
97
|
+
/** Process person profile flag */
|
|
98
|
+
export declare const PROP_PROCESS_PERSON_PROFILE = "$process_person_profile";
|
|
99
|
+
/** Is identified flag */
|
|
100
|
+
export declare const PROP_IS_IDENTIFIED = "$is_identified";
|
|
101
|
+
/** Anonymous distinct ID */
|
|
102
|
+
export declare const PROP_ANON_DISTINCT_ID = "$anon_distinct_id";
|
|
103
|
+
/** Session ID property */
|
|
104
|
+
export declare const PROP_SESSION_ID = "$session_id";
|
|
105
|
+
/** Window ID property */
|
|
106
|
+
export declare const PROP_WINDOW_ID = "$window_id";
|
|
107
|
+
/** Current URL */
|
|
108
|
+
export declare const PROP_CURRENT_URL = "$current_url";
|
|
109
|
+
/** Hostname */
|
|
110
|
+
export declare const PROP_HOST = "$host";
|
|
111
|
+
/** Pathname */
|
|
112
|
+
export declare const PROP_PATHNAME = "$pathname";
|
|
113
|
+
/** Referrer URL */
|
|
114
|
+
export declare const PROP_REFERRER = "$referrer";
|
|
115
|
+
/** Referring domain */
|
|
116
|
+
export declare const PROP_REFERRING_DOMAIN = "$referring_domain";
|
|
117
|
+
/** Browser */
|
|
118
|
+
export declare const PROP_BROWSER = "$browser";
|
|
119
|
+
/** Browser version */
|
|
120
|
+
export declare const PROP_BROWSER_VERSION = "$browser_version";
|
|
121
|
+
/** Operating system */
|
|
122
|
+
export declare const PROP_OS = "$os";
|
|
123
|
+
/** OS version */
|
|
124
|
+
export declare const PROP_OS_VERSION = "$os_version";
|
|
125
|
+
/** Device type */
|
|
126
|
+
export declare const PROP_DEVICE_TYPE = "$device_type";
|
|
127
|
+
/** Screen height */
|
|
128
|
+
export declare const PROP_SCREEN_HEIGHT = "$screen_height";
|
|
129
|
+
/** Screen width */
|
|
130
|
+
export declare const PROP_SCREEN_WIDTH = "$screen_width";
|
|
131
|
+
/** Viewport height */
|
|
132
|
+
export declare const PROP_VIEWPORT_HEIGHT = "$viewport_height";
|
|
133
|
+
/** Viewport width */
|
|
134
|
+
export declare const PROP_VIEWPORT_WIDTH = "$viewport_width";
|
|
135
|
+
/** Library name */
|
|
136
|
+
export declare const PROP_LIB = "$lib";
|
|
137
|
+
/** Library version */
|
|
138
|
+
export declare const PROP_LIB_VERSION = "$lib_version";
|
|
139
|
+
export declare const PROP_GEOIP_COUNTRY_CODE = "$geoip_country_code";
|
|
140
|
+
export declare const PROP_GEOIP_COUNTRY_NAME = "$geoip_country_name";
|
|
141
|
+
export declare const PROP_GEOIP_CITY_NAME = "$geoip_city_name";
|
|
142
|
+
export declare const PROP_GEOIP_REGION_NAME = "$geoip_region_name";
|
|
143
|
+
export declare const PROP_GEOIP_CONTINENT_CODE = "$geoip_continent_code";
|
|
144
|
+
export declare const PROP_GEOIP_TIMEZONE = "$geoip_timezone";
|
|
145
|
+
export declare const PROP_GEOIP_LATITUDE = "$geoip_latitude";
|
|
146
|
+
export declare const PROP_GEOIP_LONGITUDE = "$geoip_longitude";
|
|
147
|
+
/** Initial GeoIP properties (set once) */
|
|
148
|
+
export declare const PROP_INITIAL_GEOIP_PREFIX = "$initial_geoip_";
|
|
149
|
+
export declare const UTM_PARAMS: readonly ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gclid", "gad_source", "gbraid", "wbraid", "fbclid", "msclkid", "twclid", "li_fat_id", "mc_cid", "igshid", "ttclid"];
|
|
150
|
+
export type UTMParam = typeof UTM_PARAMS[number];
|
|
151
|
+
export declare const PERSISTENCE_RESERVED_PROPERTIES: string[];
|
|
152
|
+
/**
|
|
153
|
+
* Person profiles configuration mode
|
|
154
|
+
* - 'always': Always create person profiles (default)
|
|
155
|
+
* - 'identified_only': Only create profiles when user is identified
|
|
156
|
+
* - 'never': Never create person profiles (events only)
|
|
157
|
+
*/
|
|
158
|
+
export type PersonProfilesMode = 'always' | 'identified_only' | 'never';
|
|
159
|
+
/** Default API host */
|
|
160
|
+
export declare const DEFAULT_API_HOST = "https://api.vtilt.io";
|
|
161
|
+
/** Default flush interval (ms) */
|
|
162
|
+
export declare const DEFAULT_FLUSH_INTERVAL_MS = 5000;
|
|
163
|
+
/** Default batch size */
|
|
164
|
+
export declare const DEFAULT_BATCH_SIZE = 10;
|
|
165
|
+
/** Session timeout (30 minutes in ms) */
|
|
166
|
+
export declare const SESSION_TIMEOUT_MS: number;
|
|
167
|
+
/** Session ID change threshold (ms) */
|
|
168
|
+
export declare const SESSION_CHANGE_THRESHOLD_MS: number;
|
|
169
|
+
/** Maximum event properties size (bytes) */
|
|
170
|
+
export declare const MAX_PROPERTIES_SIZE = 65535;
|
|
171
|
+
/** Maximum property value length */
|
|
172
|
+
export declare const MAX_PROPERTY_VALUE_LENGTH = 8192;
|
|
173
|
+
/** Timezone to country code mapping */
|
|
12
174
|
export declare const TIMEZONES: Record<string, string>;
|