@v-tilt/browser 1.1.5 → 1.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.
Files changed (72) hide show
  1. package/dist/all-external-dependencies.js +2 -0
  2. package/dist/all-external-dependencies.js.map +1 -0
  3. package/dist/array.full.js +2 -0
  4. package/dist/array.full.js.map +1 -0
  5. package/dist/array.js +1 -1
  6. package/dist/array.js.map +1 -1
  7. package/dist/array.no-external.js +1 -1
  8. package/dist/array.no-external.js.map +1 -1
  9. package/dist/entrypoints/all-external-dependencies.d.ts +8 -0
  10. package/dist/entrypoints/array.d.ts +1 -0
  11. package/dist/entrypoints/array.full.d.ts +17 -0
  12. package/dist/entrypoints/external-scripts-loader.d.ts +24 -0
  13. package/dist/entrypoints/module.es.d.ts +1 -0
  14. package/dist/entrypoints/recorder.d.ts +23 -0
  15. package/dist/entrypoints/web-vitals.d.ts +14 -0
  16. package/dist/extensions/replay/index.d.ts +13 -0
  17. package/dist/extensions/replay/session-recording-utils.d.ts +92 -0
  18. package/dist/extensions/replay/session-recording-wrapper.d.ts +61 -0
  19. package/dist/extensions/replay/session-recording.d.ts +95 -0
  20. package/dist/extensions/replay/types.d.ts +211 -0
  21. package/dist/external-scripts-loader.js +2 -0
  22. package/dist/external-scripts-loader.js.map +1 -0
  23. package/dist/main.js +1 -1
  24. package/dist/main.js.map +1 -1
  25. package/dist/module.d.ts +297 -8
  26. package/dist/module.js +1 -1
  27. package/dist/module.js.map +1 -1
  28. package/dist/module.no-external.d.ts +297 -8
  29. package/dist/module.no-external.js +1 -1
  30. package/dist/module.no-external.js.map +1 -1
  31. package/dist/recorder.js +2 -0
  32. package/dist/recorder.js.map +1 -0
  33. package/dist/types.d.ts +116 -6
  34. package/dist/utils/globals.d.ts +69 -0
  35. package/dist/vtilt.d.ts +36 -0
  36. package/dist/web-vitals.d.ts +89 -5
  37. package/dist/web-vitals.js +2 -0
  38. package/dist/web-vitals.js.map +1 -0
  39. package/lib/config.js +7 -3
  40. package/lib/entrypoints/all-external-dependencies.d.ts +8 -0
  41. package/lib/entrypoints/all-external-dependencies.js +10 -0
  42. package/lib/entrypoints/array.d.ts +1 -0
  43. package/lib/entrypoints/array.full.d.ts +17 -0
  44. package/lib/entrypoints/array.full.js +19 -0
  45. package/lib/entrypoints/array.js +1 -0
  46. package/lib/entrypoints/external-scripts-loader.d.ts +24 -0
  47. package/lib/entrypoints/external-scripts-loader.js +107 -0
  48. package/lib/entrypoints/module.es.d.ts +1 -0
  49. package/lib/entrypoints/module.es.js +1 -0
  50. package/lib/entrypoints/recorder.d.ts +23 -0
  51. package/lib/entrypoints/recorder.js +42 -0
  52. package/lib/entrypoints/web-vitals.d.ts +14 -0
  53. package/lib/entrypoints/web-vitals.js +29 -0
  54. package/lib/extensions/replay/index.d.ts +13 -0
  55. package/lib/extensions/replay/index.js +31 -0
  56. package/lib/extensions/replay/session-recording-utils.d.ts +92 -0
  57. package/lib/extensions/replay/session-recording-utils.js +212 -0
  58. package/lib/extensions/replay/session-recording-wrapper.d.ts +61 -0
  59. package/lib/extensions/replay/session-recording-wrapper.js +149 -0
  60. package/lib/extensions/replay/session-recording.d.ts +95 -0
  61. package/lib/extensions/replay/session-recording.js +700 -0
  62. package/lib/extensions/replay/types.d.ts +211 -0
  63. package/lib/extensions/replay/types.js +8 -0
  64. package/lib/types.d.ts +116 -6
  65. package/lib/types.js +16 -0
  66. package/lib/utils/globals.d.ts +69 -0
  67. package/lib/utils/globals.js +2 -0
  68. package/lib/vtilt.d.ts +36 -0
  69. package/lib/vtilt.js +106 -0
  70. package/lib/web-vitals.d.ts +89 -5
  71. package/lib/web-vitals.js +354 -46
  72. package/package.json +4 -1
package/dist/types.d.ts CHANGED
@@ -12,6 +12,13 @@ export interface VTiltConfig {
12
12
  api_host?: string;
13
13
  /** UI host for dashboard links */
14
14
  ui_host?: string | null;
15
+ /**
16
+ * Host for loading extension scripts (recorder.js, etc.)
17
+ * Defaults to unpkg CDN: https://unpkg.com/@v-tilt/browser@{version}/dist
18
+ * Can also use jsdelivr: https://cdn.jsdelivr.net/npm/@v-tilt/browser@{version}/dist
19
+ * Or self-hosted: https://your-domain.com/static
20
+ */
21
+ script_host?: string;
15
22
  /** Proxy domain for tracking requests */
16
23
  proxy?: string;
17
24
  /** Full proxy URL for tracking requests */
@@ -44,8 +51,11 @@ export interface VTiltConfig {
44
51
  person_profiles?: PersonProfilesMode;
45
52
  /** Enable autocapture */
46
53
  autocapture?: boolean;
47
- /** Enable web vitals tracking */
48
- capture_performance?: boolean;
54
+ /**
55
+ * Enable web vitals tracking.
56
+ * Can be a boolean or an object with detailed configuration.
57
+ */
58
+ capture_performance?: boolean | CapturePerformanceConfig;
49
59
  /** Enable page view tracking */
50
60
  capture_pageview?: boolean | "auto";
51
61
  /** Enable page leave tracking */
@@ -64,6 +74,10 @@ export interface VTiltConfig {
64
74
  respect_dnt?: boolean;
65
75
  /** Opt users out by default */
66
76
  opt_out_capturing_by_default?: boolean;
77
+ /** Session recording configuration */
78
+ session_recording?: SessionRecordingOptions;
79
+ /** Disable session recording (convenience flag) */
80
+ disable_session_recording?: boolean;
67
81
  /** Global attributes added to all events */
68
82
  globalAttributes?: Record<string, string>;
69
83
  /** Bootstrap data for initialization */
@@ -149,6 +163,29 @@ export interface AliasEvent {
149
163
  distinct_id: string;
150
164
  original: string;
151
165
  }
166
+ /** Supported Web Vitals metrics */
167
+ export type SupportedWebVitalsMetric = "LCP" | "CLS" | "FCP" | "INP" | "TTFB";
168
+ /** All supported Web Vitals metrics */
169
+ export declare const ALL_WEB_VITALS_METRICS: SupportedWebVitalsMetric[];
170
+ /** Default Web Vitals metrics (matches PostHog defaults) */
171
+ export declare const DEFAULT_WEB_VITALS_METRICS: SupportedWebVitalsMetric[];
172
+ /**
173
+ * Web Vitals capture configuration
174
+ */
175
+ export interface CapturePerformanceConfig {
176
+ /** Enable or disable web vitals capture */
177
+ web_vitals?: boolean;
178
+ /** Which metrics to capture (default: LCP, CLS, FCP, INP) */
179
+ web_vitals_allowed_metrics?: SupportedWebVitalsMetric[];
180
+ /** Delay before flushing metrics in ms (default: 5000) */
181
+ web_vitals_delayed_flush_ms?: number;
182
+ /**
183
+ * Maximum allowed metric value in ms (default: 900000 = 15 minutes)
184
+ * Values above this are considered anomalies and ignored.
185
+ * Set to 0 to disable this check.
186
+ */
187
+ __web_vitals_max_value?: number;
188
+ }
152
189
  export interface WebVitalMetric {
153
190
  name: string;
154
191
  value: number;
@@ -156,6 +193,10 @@ export interface WebVitalMetric {
156
193
  rating: "good" | "needs-improvement" | "poor";
157
194
  id: string;
158
195
  navigationType: string;
196
+ /** Timestamp when the metric was captured (added internally) */
197
+ timestamp?: number;
198
+ /** Attribution data from web-vitals library */
199
+ attribution?: Record<string, unknown>;
159
200
  }
160
201
  export interface GeolocationData {
161
202
  country?: string;
@@ -176,14 +217,83 @@ export interface RequestOptions {
176
217
  timeout?: number;
177
218
  retry?: boolean;
178
219
  }
220
+ /** Mask options for input elements in session recording */
221
+ export interface SessionRecordingMaskInputOptions {
222
+ color?: boolean;
223
+ date?: boolean;
224
+ "datetime-local"?: boolean;
225
+ email?: boolean;
226
+ month?: boolean;
227
+ number?: boolean;
228
+ range?: boolean;
229
+ search?: boolean;
230
+ tel?: boolean;
231
+ text?: boolean;
232
+ time?: boolean;
233
+ url?: boolean;
234
+ week?: boolean;
235
+ textarea?: boolean;
236
+ select?: boolean;
237
+ password?: boolean;
238
+ }
239
+ /** Session recording configuration */
240
+ export interface SessionRecordingOptions {
241
+ /** Enable session recording */
242
+ enabled?: boolean;
243
+ /** Sample rate (0-1, where 1 = 100%) */
244
+ sampleRate?: number;
245
+ /** Minimum session duration in ms before sending */
246
+ minimumDurationMs?: number;
247
+ /** Session idle threshold in ms (default: 5 minutes) */
248
+ sessionIdleThresholdMs?: number;
249
+ /** Full snapshot interval in ms (default: 5 minutes) */
250
+ fullSnapshotIntervalMs?: number;
251
+ /** Enable console log capture */
252
+ captureConsole?: boolean;
253
+ /** Enable network request capture */
254
+ captureNetwork?: boolean;
255
+ /** Canvas recording settings */
256
+ captureCanvas?: {
257
+ recordCanvas?: boolean;
258
+ canvasFps?: number;
259
+ canvasQuality?: number;
260
+ };
261
+ /** Block class for elements to hide (default: 'vt-no-capture') */
262
+ blockClass?: string;
263
+ /** Block selector for elements to hide */
264
+ blockSelector?: string;
265
+ /** Ignore class for input masking (default: 'vt-ignore-input') */
266
+ ignoreClass?: string;
267
+ /** Mask text class (default: 'vt-mask') */
268
+ maskTextClass?: string;
269
+ /** Mask text selector */
270
+ maskTextSelector?: string;
271
+ /** Mask all inputs (default: true) */
272
+ maskAllInputs?: boolean;
273
+ /** Mask input options */
274
+ maskInputOptions?: SessionRecordingMaskInputOptions;
275
+ /** Masking configuration */
276
+ masking?: {
277
+ maskAllInputs?: boolean;
278
+ maskTextSelector?: string;
279
+ blockSelector?: string;
280
+ };
281
+ /** Record headers in network requests */
282
+ recordHeaders?: boolean;
283
+ /** Record body in network requests */
284
+ recordBody?: boolean;
285
+ /** Compress events before sending (default: true) */
286
+ compressEvents?: boolean;
287
+ /** Internal: Mutation throttler refill rate */
288
+ __mutationThrottlerRefillRate?: number;
289
+ /** Internal: Mutation throttler bucket size */
290
+ __mutationThrottlerBucketSize?: number;
291
+ }
179
292
  export interface RemoteConfig {
180
293
  /** Default to identified_only mode */
181
294
  defaultIdentifiedOnly?: boolean;
182
295
  /** Feature flags */
183
296
  featureFlags?: FeatureFlagsConfig;
184
297
  /** Session recording config */
185
- sessionRecording?: {
186
- enabled?: boolean;
187
- sampleRate?: number;
188
- };
298
+ sessionRecording?: SessionRecordingOptions;
189
299
  }
@@ -1,6 +1,75 @@
1
1
  declare const win: (Window & typeof globalThis) | undefined;
2
+ /**
3
+ * Extension kinds that can be lazy loaded
4
+ */
5
+ export type VTiltExtensionKind = "recorder" | "web-vitals";
6
+ /**
7
+ * Interface for lazy-loaded session recording (set by recorder.ts)
8
+ * Matches LazyLoadedSessionRecordingInterface in session-recording-wrapper.ts
9
+ */
10
+ export interface LazyLoadedSessionRecordingInterface {
11
+ start: (startReason?: string) => void;
12
+ stop: () => void;
13
+ sessionId: string;
14
+ status: string;
15
+ isStarted: boolean;
16
+ onRemoteConfig?: (response: any) => void;
17
+ log: (message: string, level: "log" | "warn" | "error") => void;
18
+ updateConfig: (config: any) => void;
19
+ }
20
+ /**
21
+ * Web Vitals metric callback type
22
+ */
23
+ export type WebVitalsMetricCallback = (metric: any) => void;
24
+ /**
25
+ * Options for web vitals callbacks
26
+ */
27
+ export interface WebVitalsCallbackOptions {
28
+ /** Report all changes (useful for CLS which updates over time) */
29
+ reportAllChanges?: boolean;
30
+ }
31
+ /**
32
+ * Web Vitals callback function type (with optional options)
33
+ */
34
+ export type WebVitalsCallbackFn = (callback: WebVitalsMetricCallback, options?: WebVitalsCallbackOptions) => void;
35
+ /**
36
+ * Web Vitals callbacks interface (set by web-vitals.ts entrypoint)
37
+ */
38
+ export interface WebVitalsCallbacks {
39
+ onLCP: WebVitalsCallbackFn;
40
+ onCLS: WebVitalsCallbackFn;
41
+ onFCP: WebVitalsCallbackFn;
42
+ onINP: WebVitalsCallbackFn;
43
+ onTTFB?: WebVitalsCallbackFn;
44
+ }
45
+ /**
46
+ * VTilt Extensions interface for dynamically loaded modules
47
+ * This is the contract between lazily loaded extensions and the SDK
48
+ */
49
+ export interface VTiltExtensions {
50
+ /** Load an external dependency script */
51
+ loadExternalDependency?: (instance: any, // VTilt instance - using any to avoid circular imports
52
+ kind: VTiltExtensionKind, callback: (error?: string | Event, event?: Event) => void) => void;
53
+ /** rrweb record function (set by recorder.ts) */
54
+ rrweb?: {
55
+ record: any;
56
+ version?: string;
57
+ };
58
+ /** rrweb plugins (set by recorder.ts) */
59
+ rrwebPlugins?: {
60
+ getRecordConsolePlugin?: () => any;
61
+ getRecordNetworkPlugin?: (options: any) => any;
62
+ };
63
+ /** Factory to create LazyLoadedSessionRecording (set by recorder.ts) */
64
+ initSessionRecording?: (instance: any, config?: any) => LazyLoadedSessionRecordingInterface;
65
+ /** Web Vitals callbacks (set by web-vitals.ts entrypoint) */
66
+ webVitalsCallbacks?: WebVitalsCallbacks;
67
+ }
2
68
  export type AssignableWindow = Window & typeof globalThis & {
69
+ /** Main VTilt instance */
3
70
  vt: any;
71
+ /** VTilt Extensions for dynamically loaded modules */
72
+ __VTiltExtensions__?: VTiltExtensions;
4
73
  };
5
74
  export declare const ArrayProto: any[];
6
75
  export declare const nativeForEach: (callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any) => void;
package/dist/vtilt.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { VTiltConfig, EventPayload } from "./types";
2
2
  import { HistoryAutocapture } from "./extensions/history-autocapture";
3
+ import { SessionRecordingWrapper } from "./extensions/replay";
3
4
  import { type QueuedRequest } from "./request-queue";
4
5
  export declare class VTilt {
6
+ readonly version = "1.1.5";
5
7
  private configManager;
6
8
  private sessionManager;
7
9
  private userManager;
@@ -10,6 +12,7 @@ export declare class VTilt {
10
12
  private retryQueue;
11
13
  private rateLimiter;
12
14
  historyAutocapture?: HistoryAutocapture;
15
+ sessionRecording?: SessionRecordingWrapper;
13
16
  __loaded: boolean;
14
17
  private _initial_pageview_captured;
15
18
  private _visibility_state_listener;
@@ -236,10 +239,43 @@ export declare class VTilt {
236
239
  * Get current session ID
237
240
  */
238
241
  getSessionId(): string | null;
242
+ /**
243
+ * Get current distinct ID
244
+ */
245
+ getDistinctId(): string;
246
+ /**
247
+ * Get anonymous ID
248
+ */
249
+ getAnonymousId(): string;
239
250
  /**
240
251
  * Update configuration
241
252
  */
242
253
  updateConfig(config: Partial<VTiltConfig>): void;
254
+ /**
255
+ * Initialize session recording
256
+ */
257
+ private _initSessionRecording;
258
+ /**
259
+ * Build session recording config from VTiltConfig
260
+ */
261
+ private _buildSessionRecordingConfig;
262
+ /**
263
+ * Start session recording
264
+ * Call this to manually start recording if it wasn't enabled initially
265
+ */
266
+ startSessionRecording(): void;
267
+ /**
268
+ * Stop session recording
269
+ */
270
+ stopSessionRecording(): void;
271
+ /**
272
+ * Check if session recording is active
273
+ */
274
+ isSessionRecordingActive(): boolean;
275
+ /**
276
+ * Get session recording ID
277
+ */
278
+ getSessionRecordingId(): string | null;
243
279
  /**
244
280
  * _execute_array() deals with processing any vTilt function
245
281
  * calls that were called before the vTilt library was loaded
@@ -1,11 +1,95 @@
1
- import { VTiltConfig } from "./types";
1
+ import { VTiltConfig, SupportedWebVitalsMetric } from "./types";
2
2
  import { VTilt } from "./vtilt";
3
+ /**
4
+ * Web Vitals Manager
5
+ *
6
+ * Captures Core Web Vitals (LCP, CLS, FCP, INP, TTFB) and sends them
7
+ * as batched $web_vitals events. Follows PostHog's approach with:
8
+ *
9
+ * 1. Extension pattern - checks for callbacks registered on __VTiltExtensions__
10
+ * 2. Lazy loading - loads web-vitals.js on demand if not bundled
11
+ * 3. Configurable metrics - choose which metrics to capture
12
+ * 4. Smart buffering - collects metrics per page, flushes on navigation or timeout
13
+ * 5. Session context - includes session_id and window_id for correlation
14
+ *
15
+ * Event structure:
16
+ * - event: "$web_vitals"
17
+ * - properties:
18
+ * - $web_vitals_LCP_value: number
19
+ * - $web_vitals_LCP_event: { name, value, delta, rating, ... }
20
+ * - $pathname: string
21
+ * - $current_url: string
22
+ */
3
23
  export declare class WebVitalsManager {
4
24
  private instance;
5
- private webVitals;
6
- constructor(config: VTiltConfig, instance: VTilt);
25
+ private buffer;
26
+ private flushTimer;
27
+ private initialized;
28
+ private config;
29
+ constructor(vtiltConfig: VTiltConfig, instance: VTilt);
7
30
  /**
8
- * Initialize web vitals tracking
31
+ * Parse capture_performance config (boolean or object)
9
32
  */
10
- private initializeWebVitals;
33
+ private parseConfig;
34
+ /**
35
+ * Check if web vitals capture is enabled
36
+ */
37
+ get isEnabled(): boolean;
38
+ /**
39
+ * Get the list of metrics to capture
40
+ */
41
+ get allowedMetrics(): SupportedWebVitalsMetric[];
42
+ /**
43
+ * Get flush timeout in ms
44
+ */
45
+ get flushTimeoutMs(): number;
46
+ /**
47
+ * Get maximum allowed metric value
48
+ */
49
+ get maxAllowedValue(): number;
50
+ private createEmptyBuffer;
51
+ /**
52
+ * Check if web vitals callbacks are available
53
+ */
54
+ private getWebVitalsCallbacks;
55
+ /**
56
+ * Start capturing if enabled and callbacks are available
57
+ */
58
+ startIfEnabled(): void;
59
+ /**
60
+ * Lazy load web-vitals extension
61
+ */
62
+ private loadWebVitals;
63
+ /**
64
+ * Start capturing web vitals using the provided callbacks
65
+ */
66
+ private startCapturing;
67
+ /**
68
+ * Get current URL
69
+ */
70
+ private getCurrentUrl;
71
+ /**
72
+ * Get current pathname
73
+ */
74
+ private getCurrentPathname;
75
+ /**
76
+ * Add a metric to the buffer
77
+ */
78
+ private addToBuffer;
79
+ /**
80
+ * Clean attribution data by removing large elements
81
+ */
82
+ private cleanAttribution;
83
+ /**
84
+ * Get window ID from instance
85
+ */
86
+ private getWindowId;
87
+ /**
88
+ * Schedule a delayed flush
89
+ */
90
+ private scheduleFlush;
91
+ /**
92
+ * Flush buffered metrics as a single event
93
+ */
94
+ private flush;
11
95
  }
@@ -0,0 +1,2 @@
1
+ !function(){"use strict";var n,e=-1,t=function(n){addEventListener("pageshow",function(t){t.persisted&&(e=t.timeStamp,n(t))},!0)},i=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},r=function(){var n=i();return n&&n.activationStart||0},o=function(n,t){var o=i(),u="navigate";return e>=0?u="back-forward-cache":o&&(document.prerendering||r()>0?u="prerender":document.wasDiscarded?u="restore":o.type&&(u=o.type.replace(/_/g,"-"))),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:u}},u=function(n,e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var i=new PerformanceObserver(function(n){Promise.resolve().then(function(){e(n.getEntries())})});return i.observe(Object.assign({type:n,buffered:!0},t||{})),i}}catch(n){}},c=function(n,e,t,i){var r,o;return function(u){e.value>=0&&(u||i)&&((o=e.value-(r||0))||void 0===r)&&(r=e.value,e.delta=o,e.rating=function(n,e){return n>e[1]?"poor":n>e[0]?"needs-improvement":"good"}(e.value,t),n(e))}},f=function(n){requestAnimationFrame(function(){return requestAnimationFrame(function(){return n()})})},a=function(n){var e=function(e){"pagehide"!==e.type&&"hidden"!==document.visibilityState||n(e)};addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0)},d=function(n){var e=!1;return function(t){e||(n(t),e=!0)}},v=-1,s=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},l=function(n){"hidden"===document.visibilityState&&v>-1&&(v="visibilitychange"===n.type?n.timeStamp:0,h())},m=function(){addEventListener("visibilitychange",l,!0),addEventListener("prerenderingchange",l,!0)},h=function(){removeEventListener("visibilitychange",l,!0),removeEventListener("prerenderingchange",l,!0)},p=function(){return v<0&&(v=s(),m(),t(function(){setTimeout(function(){v=s(),m()},0)})),{get firstHiddenTime(){return v}}},g=function(n){document.prerendering?addEventListener("prerenderingchange",function(){return n()},!0):n()},T=[1800,3e3],L=function(n,e){e=e||{},g(function(){var i,a=p(),d=o("FCP"),v=u("paint",function(n){n.forEach(function(n){"first-contentful-paint"===n.name&&(v.disconnect(),n.startTime<a.firstHiddenTime&&(d.value=Math.max(n.startTime-r(),0),d.entries.push(n),i(!0)))})});v&&(i=c(n,d,T,e.reportAllChanges),t(function(t){d=o("FCP"),i=c(n,d,T,e.reportAllChanges),f(function(){d.value=performance.now()-t.timeStamp,i(!0)})}))})},w=[.1,.25],y=0,P=1/0,b=0,E=function(n){n.forEach(function(n){n.interactionId&&(P=Math.min(P,n.interactionId),b=Math.max(b,n.interactionId),y=b?(b-P)/7+1:0)})},C=function(){return n?y:performance.interactionCount||0},M=function(){"interactionCount"in performance||n||(n=u("event",E,{type:"event",buffered:!0,durationThreshold:0}))},F=[200,500],I=0,k=function(){return C()-I},B=[],N={},O=function(n){var e=B[B.length-1],t=N[n.interactionId];if(t||B.length<10||n.duration>e.latency){if(t)t.entries.push(n),t.latency=Math.max(t.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};N[i.id]=i,B.push(i)}B.sort(function(n,e){return e.latency-n.latency}),B.splice(10).forEach(function(n){delete N[n.id]})}},S=[2500,4e3],q={},A=[800,1800],j=function n(e){document.prerendering?g(function(){return n(e)}):"complete"!==document.readyState?addEventListener("load",function(){return n(e)},!0):setTimeout(e,0)},D="undefined"!=typeof window?window:void 0,H="undefined"!=typeof globalThis?globalThis:D,_=null==H?void 0:H.navigator;null==H||H.document,null==H||H.location,null==H||H.fetch,(null==H?void 0:H.XMLHttpRequest)&&"withCredentials"in new H.XMLHttpRequest&&H.XMLHttpRequest,null==H||H.AbortController,null==_||_.userAgent;var x=null!=D?D:{},z={onLCP:function(n,e){e=e||{},g(function(){var i,v=p(),s=o("LCP"),l=function(n){var e=n[n.length-1];e&&e.startTime<v.firstHiddenTime&&(s.value=Math.max(e.startTime-r(),0),s.entries=[e],i())},m=u("largest-contentful-paint",l);if(m){i=c(n,s,S,e.reportAllChanges);var h=d(function(){q[s.id]||(l(m.takeRecords()),m.disconnect(),q[s.id]=!0,i(!0))});["keydown","click"].forEach(function(n){addEventListener(n,function(){return setTimeout(h,0)},!0)}),a(h),t(function(t){s=o("LCP"),i=c(n,s,S,e.reportAllChanges),f(function(){s.value=performance.now()-t.timeStamp,q[s.id]=!0,i(!0)})})}})},onCLS:function(n,e){e=e||{},L(d(function(){var i,r=o("CLS",0),d=0,v=[],s=function(n){n.forEach(function(n){if(!n.hadRecentInput){var e=v[0],t=v[v.length-1];d&&n.startTime-t.startTime<1e3&&n.startTime-e.startTime<5e3?(d+=n.value,v.push(n)):(d=n.value,v=[n])}}),d>r.value&&(r.value=d,r.entries=v,i())},l=u("layout-shift",s);l&&(i=c(n,r,w,e.reportAllChanges),a(function(){s(l.takeRecords()),i(!0)}),t(function(){d=0,r=o("CLS",0),i=c(n,r,w,e.reportAllChanges),f(function(){return i()})}),setTimeout(i,0))}))},onFCP:L,onINP:function(n,e){e=e||{},g(function(){var i;M();var r,f=o("INP"),d=function(n){n.forEach(function(n){n.interactionId&&O(n),"first-input"===n.entryType&&!B.some(function(e){return e.entries.some(function(e){return n.duration===e.duration&&n.startTime===e.startTime})})&&O(n)});var e,t=(e=Math.min(B.length-1,Math.floor(k()/50)),B[e]);t&&t.latency!==f.value&&(f.value=t.latency,f.entries=t.entries,r())},v=u("event",d,{durationThreshold:null!==(i=e.durationThreshold)&&void 0!==i?i:40});r=c(n,f,F,e.reportAllChanges),v&&("PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&v.observe({type:"first-input",buffered:!0}),a(function(){d(v.takeRecords()),f.value<0&&k()>0&&(f.value=0,f.entries=[]),r(!0)}),t(function(){B=[],I=C(),f=o("INP"),r=c(n,f,F,e.reportAllChanges)}))})},onTTFB:function(n,e){e=e||{};var u=o("TTFB"),f=c(n,u,A,e.reportAllChanges);j(function(){var a=i();if(a){var d=a.responseStart;if(d<=0||d>performance.now())return;u.value=Math.max(d-r(),0),u.entries=[a],f(!0),t(function(){u=o("TTFB",0),(f=c(n,u,A,e.reportAllChanges))(!0)})}})}};x.__VTiltExtensions__=x.__VTiltExtensions__||{},x.__VTiltExtensions__.webVitalsCallbacks=z}();
2
+ //# sourceMappingURL=web-vitals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-vitals.js","sources":["../../../../node_modules/.pnpm/web-vitals@3.5.2/node_modules/web-vitals/dist/web-vitals.js","../src/utils/globals.ts","../src/entrypoints/web-vitals.ts"],"sourcesContent":["var e,n,t,i,r,a=-1,o=function(e){addEventListener(\"pageshow\",(function(n){n.persisted&&(a=n.timeStamp,e(n))}),!0)},c=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType(\"navigation\")[0]},u=function(){var e=c();return e&&e.activationStart||0},f=function(e,n){var t=c(),i=\"navigate\";a>=0?i=\"back-forward-cache\":t&&(document.prerendering||u()>0?i=\"prerender\":document.wasDiscarded?i=\"restore\":t.type&&(i=t.type.replace(/_/g,\"-\")));return{name:e,value:void 0===n?-1:n,rating:\"good\",delta:0,entries:[],id:\"v3-\".concat(Date.now(),\"-\").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},s=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},d=function(e,n,t,i){var r,a;return function(o){n.value>=0&&(o||i)&&((a=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=a,n.rating=function(e,n){return e>n[1]?\"poor\":e>n[0]?\"needs-improvement\":\"good\"}(n.value,t),e(n))}},l=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},p=function(e){var n=function(n){\"pagehide\"!==n.type&&\"hidden\"!==document.visibilityState||e(n)};addEventListener(\"visibilitychange\",n,!0),addEventListener(\"pagehide\",n,!0)},v=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},m=-1,h=function(){return\"hidden\"!==document.visibilityState||document.prerendering?1/0:0},g=function(e){\"hidden\"===document.visibilityState&&m>-1&&(m=\"visibilitychange\"===e.type?e.timeStamp:0,T())},y=function(){addEventListener(\"visibilitychange\",g,!0),addEventListener(\"prerenderingchange\",g,!0)},T=function(){removeEventListener(\"visibilitychange\",g,!0),removeEventListener(\"prerenderingchange\",g,!0)},E=function(){return m<0&&(m=h(),y(),o((function(){setTimeout((function(){m=h(),y()}),0)}))),{get firstHiddenTime(){return m}}},C=function(e){document.prerendering?addEventListener(\"prerenderingchange\",(function(){return e()}),!0):e()},L=[1800,3e3],w=function(e,n){n=n||{},C((function(){var t,i=E(),r=f(\"FCP\"),a=s(\"paint\",(function(e){e.forEach((function(e){\"first-contentful-paint\"===e.name&&(a.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-u(),0),r.entries.push(e),t(!0)))}))}));a&&(t=d(e,r,L,n.reportAllChanges),o((function(i){r=f(\"FCP\"),t=d(e,r,L,n.reportAllChanges),l((function(){r.value=performance.now()-i.timeStamp,t(!0)}))})))}))},b=[.1,.25],S=function(e,n){n=n||{},w(v((function(){var t,i=f(\"CLS\",0),r=0,a=[],c=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=a[0],t=a[a.length-1];r&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(r+=e.value,a.push(e)):(r=e.value,a=[e])}})),r>i.value&&(i.value=r,i.entries=a,t())},u=s(\"layout-shift\",c);u&&(t=d(e,i,b,n.reportAllChanges),p((function(){c(u.takeRecords()),t(!0)})),o((function(){r=0,i=f(\"CLS\",0),t=d(e,i,b,n.reportAllChanges),l((function(){return t()}))})),setTimeout(t,0))})))},A={passive:!0,capture:!0},I=new Date,P=function(i,r){e||(e=r,n=i,t=new Date,k(removeEventListener),F())},F=function(){if(n>=0&&n<t-I){var r={entryType:\"first-input\",name:e.type,target:e.target,cancelable:e.cancelable,startTime:e.timeStamp,processingStart:e.timeStamp+n};i.forEach((function(e){e(r)})),i=[]}},M=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;\"pointerdown\"==e.type?function(e,n){var t=function(){P(e,n),r()},i=function(){r()},r=function(){removeEventListener(\"pointerup\",t,A),removeEventListener(\"pointercancel\",i,A)};addEventListener(\"pointerup\",t,A),addEventListener(\"pointercancel\",i,A)}(n,e):P(n,e)}},k=function(e){[\"mousedown\",\"keydown\",\"touchstart\",\"pointerdown\"].forEach((function(n){return e(n,M,A)}))},D=[100,300],x=function(t,r){r=r||{},C((function(){var a,c=E(),u=f(\"FID\"),l=function(e){e.startTime<c.firstHiddenTime&&(u.value=e.processingStart-e.startTime,u.entries.push(e),a(!0))},m=function(e){e.forEach(l)},h=s(\"first-input\",m);a=d(t,u,D,r.reportAllChanges),h&&p(v((function(){m(h.takeRecords()),h.disconnect()}))),h&&o((function(){var o;u=f(\"FID\"),a=d(t,u,D,r.reportAllChanges),i=[],n=-1,e=null,k(addEventListener),o=l,i.push(o),F()}))}))},B=0,R=1/0,H=0,N=function(e){e.forEach((function(e){e.interactionId&&(R=Math.min(R,e.interactionId),H=Math.max(H,e.interactionId),B=H?(H-R)/7+1:0)}))},O=function(){return r?B:performance.interactionCount||0},q=function(){\"interactionCount\"in performance||r||(r=s(\"event\",N,{type:\"event\",buffered:!0,durationThreshold:0}))},j=[200,500],_=0,z=function(){return O()-_},G=[],J={},K=function(e){var n=G[G.length-1],t=J[e.interactionId];if(t||G.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};J[i.id]=i,G.push(i)}G.sort((function(e,n){return n.latency-e.latency})),G.splice(10).forEach((function(e){delete J[e.id]}))}},Q=function(e,n){n=n||{},C((function(){var t;q();var i,r=f(\"INP\"),a=function(e){e.forEach((function(e){(e.interactionId&&K(e),\"first-input\"===e.entryType)&&(!G.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&K(e))}));var n,t=(n=Math.min(G.length-1,Math.floor(z()/50)),G[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},c=s(\"event\",a,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=d(e,r,j,n.reportAllChanges),c&&(\"PerformanceEventTiming\"in window&&\"interactionId\"in PerformanceEventTiming.prototype&&c.observe({type:\"first-input\",buffered:!0}),p((function(){a(c.takeRecords()),r.value<0&&z()>0&&(r.value=0,r.entries=[]),i(!0)})),o((function(){G=[],_=O(),r=f(\"INP\"),i=d(e,r,j,n.reportAllChanges)})))}))},U=[2500,4e3],V={},W=function(e,n){n=n||{},C((function(){var t,i=E(),r=f(\"LCP\"),a=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(r.value=Math.max(n.startTime-u(),0),r.entries=[n],t())},c=s(\"largest-contentful-paint\",a);if(c){t=d(e,r,U,n.reportAllChanges);var m=v((function(){V[r.id]||(a(c.takeRecords()),c.disconnect(),V[r.id]=!0,t(!0))}));[\"keydown\",\"click\"].forEach((function(e){addEventListener(e,(function(){return setTimeout(m,0)}),!0)})),p(m),o((function(i){r=f(\"LCP\"),t=d(e,r,U,n.reportAllChanges),l((function(){r.value=performance.now()-i.timeStamp,V[r.id]=!0,t(!0)}))}))}}))},X=[800,1800],Y=function e(n){document.prerendering?C((function(){return e(n)})):\"complete\"!==document.readyState?addEventListener(\"load\",(function(){return e(n)}),!0):setTimeout(n,0)},Z=function(e,n){n=n||{};var t=f(\"TTFB\"),i=d(e,t,X,n.reportAllChanges);Y((function(){var r=c();if(r){var a=r.responseStart;if(a<=0||a>performance.now())return;t.value=Math.max(a-u(),0),t.entries=[r],i(!0),o((function(){t=f(\"TTFB\",0),(i=d(e,t,X,n.reportAllChanges))(!0)}))}}))};export{b as CLSThresholds,L as FCPThresholds,D as FIDThresholds,j as INPThresholds,U as LCPThresholds,X as TTFBThresholds,S as getCLS,w as getFCP,x as getFID,Q as getINP,W as getLCP,Z as getTTFB,S as onCLS,w as onFCP,x as onFID,Q as onINP,W as onLCP,Z as onTTFB};\n",null,null],"names":["r","a","o","e","addEventListener","n","persisted","timeStamp","c","window","performance","getEntriesByType","u","activationStart","f","t","i","document","prerendering","wasDiscarded","type","replace","name","value","rating","delta","entries","id","concat","Date","now","Math","floor","random","navigationType","s","PerformanceObserver","supportedEntryTypes","includes","Promise","resolve","then","getEntries","observe","Object","assign","buffered","d","l","requestAnimationFrame","p","visibilityState","v","m","h","g","T","y","removeEventListener","E","setTimeout","firstHiddenTime","C","L","w","forEach","disconnect","startTime","max","push","reportAllChanges","b","B","R","H","N","interactionId","min","O","interactionCount","q","durationThreshold","j","_","z","G","J","K","length","duration","latency","sort","splice","U","V","X","Y","readyState","win","undefined","global","globalThis","navigator","location","fetch","XMLHttpRequest","AbortController","userAgent","assignableWindow","vtiltWebVitalsCallbacks","take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BW,oBACfX,EAAiBW,qBAAuB,CAAA,EAG1CX,EAAiBW,oBAAoBC,mBACnCX","x_google_ignoreList":[0]}
package/lib/config.js CHANGED
@@ -25,6 +25,8 @@ class ConfigManager {
25
25
  script.getAttribute("data-api-host") ||
26
26
  script.getAttribute("data-host") ||
27
27
  initialConfig.api_host;
28
+ config.script_host =
29
+ script.getAttribute("data-script-host") || initialConfig.script_host;
28
30
  config.proxy = script.getAttribute("data-proxy") || initialConfig.proxy;
29
31
  config.proxyUrl =
30
32
  script.getAttribute("data-proxy-url") || initialConfig.proxyUrl;
@@ -37,9 +39,11 @@ class ConfigManager {
37
39
  script.getAttribute("data-storage") || initialConfig.storage;
38
40
  config.stringifyPayload =
39
41
  script.getAttribute("data-stringify-payload") !== "false";
40
- config.capture_performance =
41
- script.getAttribute("data-capture-performance") === "true" ||
42
- initialConfig.capture_performance;
42
+ // Handle capture_performance: data attribute is boolean, initialConfig can be boolean or object
43
+ const dataAttrPerformance = script.getAttribute("data-capture-performance") === "true";
44
+ config.capture_performance = dataAttrPerformance
45
+ ? true
46
+ : initialConfig.capture_performance;
43
47
  // Check for conflicting proxy configurations
44
48
  if (config.proxy && config.proxyUrl) {
45
49
  console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them.");
@@ -0,0 +1,8 @@
1
+ /**
2
+ * All External Dependencies
3
+ *
4
+ * This file imports all external dependency entrypoints.
5
+ * Used by array.full.ts for the full bundle that includes everything.
6
+ */
7
+ import "./recorder";
8
+ import "./web-vitals";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * All External Dependencies
4
+ *
5
+ * This file imports all external dependency entrypoints.
6
+ * Used by array.full.ts for the full bundle that includes everything.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ require("./recorder");
10
+ require("./web-vitals");
@@ -1 +1,2 @@
1
+ import "./external-scripts-loader";
1
2
  import "./array.no-external";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Full Bundle Entrypoint
3
+ *
4
+ * Same as array.ts but includes all external dependencies bundled in.
5
+ * This is useful for users who want a single script tag without lazy loading.
6
+ *
7
+ * Usage:
8
+ * <script src="https://cdn.example.com/dist/array.full.js"></script>
9
+ *
10
+ * This bundle includes:
11
+ * - Core SDK (array.no-external.ts)
12
+ * - External scripts loader
13
+ * - Session recording (rrweb)
14
+ * - Web Vitals tracking
15
+ */
16
+ import "./all-external-dependencies";
17
+ import "./array";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Full Bundle Entrypoint
4
+ *
5
+ * Same as array.ts but includes all external dependencies bundled in.
6
+ * This is useful for users who want a single script tag without lazy loading.
7
+ *
8
+ * Usage:
9
+ * <script src="https://cdn.example.com/dist/array.full.js"></script>
10
+ *
11
+ * This bundle includes:
12
+ * - Core SDK (array.no-external.ts)
13
+ * - External scripts loader
14
+ * - Session recording (rrweb)
15
+ * - Web Vitals tracking
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ require("./all-external-dependencies");
19
+ require("./array");
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./external-scripts-loader");
3
4
  require("./array.no-external");
@@ -0,0 +1,24 @@
1
+ /**
2
+ * External Scripts Loader
3
+ *
4
+ * Dynamically loads external scripts (like rrweb) from CDN.
5
+ * Based on PostHog's implementation.
6
+ */
7
+ import type { VTilt } from "../vtilt";
8
+ import { VTiltExtensionKind } from "../utils/globals";
9
+ /**
10
+ * Load a script dynamically
11
+ */
12
+ declare const loadScript: (vtilt: VTilt, url: string, callback: (error?: string | Event, event?: Event) => void) => void;
13
+ /**
14
+ * Get the URL for an extension script
15
+ *
16
+ * Priority:
17
+ * 1. script_host config (if set) - loads from {script_host}/dist/{kind}.js
18
+ * 2. Default to unpkg CDN for npm package
19
+ *
20
+ * Note: script_host should be the base URL (e.g., "https://cdn.example.com")
21
+ * The /dist/ path is automatically appended to match the npm package structure
22
+ */
23
+ declare const getExtensionUrl: (vtilt: VTilt, kind: VTiltExtensionKind) => string;
24
+ export { loadScript, getExtensionUrl };