@v-tilt/browser 1.6.0 → 1.7.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.
Files changed (107) hide show
  1. package/dist/array.full.js +1 -1
  2. package/dist/array.full.js.map +1 -1
  3. package/dist/array.js +1 -1
  4. package/dist/array.js.map +1 -1
  5. package/dist/array.no-external.js +1 -1
  6. package/dist/array.no-external.js.map +1 -1
  7. package/dist/chat.js +1 -1
  8. package/dist/chat.js.map +1 -1
  9. package/dist/constants.d.ts +1 -1
  10. package/dist/entrypoints/server.es.d.ts +12 -0
  11. package/dist/external-scripts-loader.js +1 -1
  12. package/dist/main.js +1 -1
  13. package/dist/main.js.map +1 -1
  14. package/dist/module.d.ts +6 -3
  15. package/dist/module.js +1 -1
  16. package/dist/module.js.map +1 -1
  17. package/dist/module.no-external.d.ts +6 -3
  18. package/dist/module.no-external.js +1 -1
  19. package/dist/module.no-external.js.map +1 -1
  20. package/dist/server.d.ts +105 -0
  21. package/dist/server.js +2 -0
  22. package/dist/server.js.map +1 -0
  23. package/dist/types.d.ts +3 -1
  24. package/dist/vtilt.d.ts +3 -2
  25. package/package.json +1 -2
  26. package/lib/config.d.ts +0 -17
  27. package/lib/config.js +0 -76
  28. package/lib/constants.d.ts +0 -178
  29. package/lib/constants.js +0 -656
  30. package/lib/entrypoints/all-external-dependencies.d.ts +0 -8
  31. package/lib/entrypoints/all-external-dependencies.js +0 -10
  32. package/lib/entrypoints/array.d.ts +0 -2
  33. package/lib/entrypoints/array.full.d.ts +0 -17
  34. package/lib/entrypoints/array.full.js +0 -19
  35. package/lib/entrypoints/array.js +0 -4
  36. package/lib/entrypoints/array.no-external.d.ts +0 -1
  37. package/lib/entrypoints/array.no-external.js +0 -4
  38. package/lib/entrypoints/chat.d.ts +0 -22
  39. package/lib/entrypoints/chat.js +0 -32
  40. package/lib/entrypoints/external-scripts-loader.d.ts +0 -24
  41. package/lib/entrypoints/external-scripts-loader.js +0 -104
  42. package/lib/entrypoints/main.cjs.d.ts +0 -4
  43. package/lib/entrypoints/main.cjs.js +0 -29
  44. package/lib/entrypoints/module.es.d.ts +0 -4
  45. package/lib/entrypoints/module.es.js +0 -23
  46. package/lib/entrypoints/module.no-external.es.d.ts +0 -4
  47. package/lib/entrypoints/module.no-external.es.js +0 -23
  48. package/lib/entrypoints/recorder.d.ts +0 -23
  49. package/lib/entrypoints/recorder.js +0 -42
  50. package/lib/entrypoints/web-vitals.d.ts +0 -14
  51. package/lib/entrypoints/web-vitals.js +0 -29
  52. package/lib/extensions/chat/chat-wrapper.d.ts +0 -196
  53. package/lib/extensions/chat/chat-wrapper.js +0 -545
  54. package/lib/extensions/chat/chat.d.ts +0 -99
  55. package/lib/extensions/chat/chat.js +0 -1891
  56. package/lib/extensions/chat/index.d.ts +0 -10
  57. package/lib/extensions/chat/index.js +0 -27
  58. package/lib/extensions/chat/types.d.ts +0 -159
  59. package/lib/extensions/chat/types.js +0 -22
  60. package/lib/extensions/history-autocapture.d.ts +0 -17
  61. package/lib/extensions/history-autocapture.js +0 -105
  62. package/lib/extensions/replay/index.d.ts +0 -13
  63. package/lib/extensions/replay/index.js +0 -31
  64. package/lib/extensions/replay/session-recording-utils.d.ts +0 -92
  65. package/lib/extensions/replay/session-recording-utils.js +0 -212
  66. package/lib/extensions/replay/session-recording-wrapper.d.ts +0 -61
  67. package/lib/extensions/replay/session-recording-wrapper.js +0 -149
  68. package/lib/extensions/replay/session-recording.d.ts +0 -95
  69. package/lib/extensions/replay/session-recording.js +0 -700
  70. package/lib/extensions/replay/types.d.ts +0 -211
  71. package/lib/extensions/replay/types.js +0 -8
  72. package/lib/geolocation.d.ts +0 -5
  73. package/lib/geolocation.js +0 -31
  74. package/lib/rate-limiter.d.ts +0 -52
  75. package/lib/rate-limiter.js +0 -80
  76. package/lib/request-queue.d.ts +0 -78
  77. package/lib/request-queue.js +0 -156
  78. package/lib/request.d.ts +0 -54
  79. package/lib/request.js +0 -265
  80. package/lib/retry-queue.d.ts +0 -64
  81. package/lib/retry-queue.js +0 -182
  82. package/lib/session.d.ts +0 -66
  83. package/lib/session.js +0 -191
  84. package/lib/storage.d.ts +0 -117
  85. package/lib/storage.js +0 -438
  86. package/lib/types.d.ts +0 -350
  87. package/lib/types.js +0 -24
  88. package/lib/user-manager.d.ts +0 -154
  89. package/lib/user-manager.js +0 -589
  90. package/lib/utils/event-utils.d.ts +0 -52
  91. package/lib/utils/event-utils.js +0 -305
  92. package/lib/utils/globals.d.ts +0 -235
  93. package/lib/utils/globals.js +0 -30
  94. package/lib/utils/index.d.ts +0 -46
  95. package/lib/utils/index.js +0 -134
  96. package/lib/utils/patch.d.ts +0 -6
  97. package/lib/utils/patch.js +0 -39
  98. package/lib/utils/request-utils.d.ts +0 -17
  99. package/lib/utils/request-utils.js +0 -80
  100. package/lib/utils/type-utils.d.ts +0 -4
  101. package/lib/utils/type-utils.js +0 -9
  102. package/lib/utils/user-agent-utils.d.ts +0 -18
  103. package/lib/utils/user-agent-utils.js +0 -411
  104. package/lib/vtilt.d.ts +0 -359
  105. package/lib/vtilt.js +0 -1188
  106. package/lib/web-vitals.d.ts +0 -95
  107. package/lib/web-vitals.js +0 -380
@@ -1,10 +0,0 @@
1
- /**
2
- * Chat Extension
3
- *
4
- * Exports for the chat widget extension.
5
- * The main export is ChatWrapper which is included in the main bundle.
6
- * The actual implementation (LazyLoadedChat) is loaded on demand.
7
- */
8
- export { ChatWrapper } from "./chat-wrapper";
9
- export * from "./types";
10
- export type { ChatMessage, ChatChannel, ChatConfig, ChatTheme, LazyLoadedChatInterface, } from "../../utils/globals";
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /**
3
- * Chat Extension
4
- *
5
- * Exports for the chat widget extension.
6
- * The main export is ChatWrapper which is included in the main bundle.
7
- * The actual implementation (LazyLoadedChat) is loaded on demand.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.ChatWrapper = void 0;
25
- var chat_wrapper_1 = require("./chat-wrapper");
26
- Object.defineProperty(exports, "ChatWrapper", { enumerable: true, get: function () { return chat_wrapper_1.ChatWrapper; } });
27
- __exportStar(require("./types"), exports);
@@ -1,159 +0,0 @@
1
- /**
2
- * Chat Extension Types
3
- *
4
- * Type definitions for the chat widget extension.
5
- * Core types are re-exported from globals.ts for consistency.
6
- */
7
- export type { ChatMessage, ChatChannel, ChatChannelSummary, ChatConfig, ChatTheme, ChatWidgetView, LazyLoadedChatInterface, } from "../../utils/globals";
8
- /**
9
- * Sender types for chat messages
10
- */
11
- export type SenderType = "user" | "agent" | "ai" | "system";
12
- /**
13
- * Channel status
14
- */
15
- export type ChannelStatus = "open" | "closed" | "snoozed";
16
- /**
17
- * Content types for messages
18
- */
19
- export type ContentType = "text" | "html" | "attachment";
20
- /**
21
- * Widget position options
22
- */
23
- export type WidgetPosition = "bottom-right" | "bottom-left";
24
- /**
25
- * Connection state for realtime
26
- */
27
- export type ConnectionState = "connecting" | "connected" | "disconnected" | "error";
28
- /**
29
- * Typing status event
30
- */
31
- export interface TypingStatus {
32
- channel_id: string;
33
- sender_type: SenderType;
34
- sender_id: string;
35
- is_typing: boolean;
36
- timestamp: number;
37
- }
38
- /**
39
- * Presence status for users
40
- */
41
- export interface PresenceStatus {
42
- distinct_id: string;
43
- status: "online" | "away" | "offline";
44
- last_seen_at: string;
45
- current_page_url?: string;
46
- }
47
- /**
48
- * Chat event names for analytics tracking
49
- */
50
- export declare const CHAT_EVENTS: {
51
- readonly STARTED: "$chat_started";
52
- readonly MESSAGE_SENT: "$chat_message_sent";
53
- readonly MESSAGE_RECEIVED: "$chat_message_received";
54
- readonly AI_HANDOFF: "$chat_ai_handoff";
55
- readonly CLOSED: "$chat_closed";
56
- readonly READ: "$chat_read";
57
- readonly WIDGET_OPENED: "$chat_widget_opened";
58
- readonly WIDGET_CLOSED: "$chat_widget_closed";
59
- };
60
- /**
61
- * Chat event properties for $chat_message_sent
62
- */
63
- export interface ChatMessageSentEventProperties {
64
- $channel_id: string;
65
- $message_id: string;
66
- $content_preview: string;
67
- $sender_type: SenderType;
68
- $ai_mode: boolean;
69
- $word_count: number;
70
- }
71
- /**
72
- * Chat event properties for $chat_message_received
73
- */
74
- export interface ChatMessageReceivedEventProperties {
75
- $channel_id: string;
76
- $message_id: string;
77
- $content_preview: string;
78
- $sender_type: SenderType;
79
- $response_time_ms?: number;
80
- }
81
- /**
82
- * Chat event properties for $chat_started
83
- */
84
- export interface ChatStartedEventProperties {
85
- $channel_id: string;
86
- $initiated_by: "user" | "agent";
87
- $ai_mode: boolean;
88
- }
89
- /**
90
- * Chat event properties for $chat_closed
91
- */
92
- export interface ChatClosedEventProperties {
93
- $channel_id: string;
94
- $resolved_by: "agent" | "user" | "system" | "auto";
95
- $resolution: "resolved" | "unresolved" | "abandoned";
96
- $message_count: number;
97
- $duration_seconds: number;
98
- $ai_only: boolean;
99
- }
100
- /**
101
- * Internal widget state
102
- */
103
- export interface ChatWidgetState {
104
- isOpen: boolean;
105
- isVisible: boolean;
106
- isConnected: boolean;
107
- isLoading: boolean;
108
- unreadCount: number;
109
- currentView: import("../../utils/globals").ChatWidgetView;
110
- channels: import("../../utils/globals").ChatChannelSummary[];
111
- channel: import("../../utils/globals").ChatChannel | null;
112
- messages: import("../../utils/globals").ChatMessage[];
113
- isTyping: boolean;
114
- typingSender: string | null;
115
- typingSenderType: "user" | "agent" | "ai" | null;
116
- agentLastReadAt: string | null;
117
- }
118
- /**
119
- * Message callback type
120
- */
121
- export type MessageCallback = (message: import("../../utils/globals").ChatMessage) => void;
122
- /**
123
- * Typing callback type
124
- */
125
- export type TypingCallback = (isTyping: boolean, senderType: string) => void;
126
- /**
127
- * Connection callback type
128
- */
129
- export type ConnectionCallback = (connected: boolean) => void;
130
- /**
131
- * Unsubscribe function type
132
- */
133
- export type Unsubscribe = () => void;
134
- /**
135
- * API response for creating a channel
136
- */
137
- export interface CreateChannelResponse {
138
- channel: import("../../utils/globals").ChatChannel;
139
- config: {
140
- ai_enabled: boolean;
141
- ai_greeting: string | null;
142
- widget_greeting: string | null;
143
- };
144
- }
145
- /**
146
- * API response for sending a message
147
- */
148
- export interface SendMessageResponse {
149
- message: import("../../utils/globals").ChatMessage;
150
- ai_response?: import("../../utils/globals").ChatMessage;
151
- }
152
- /**
153
- * Ably realtime channel for chat
154
- */
155
- export interface AblyChannel {
156
- subscribe: (event: string, callback: (message: unknown) => void) => void;
157
- unsubscribe: () => void;
158
- publish: (event: string, data: unknown) => Promise<void>;
159
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /**
3
- * Chat Extension Types
4
- *
5
- * Type definitions for the chat widget extension.
6
- * Core types are re-exported from globals.ts for consistency.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CHAT_EVENTS = void 0;
10
- /**
11
- * Chat event names for analytics tracking
12
- */
13
- exports.CHAT_EVENTS = {
14
- STARTED: "$chat_started",
15
- MESSAGE_SENT: "$chat_message_sent",
16
- MESSAGE_RECEIVED: "$chat_message_received",
17
- AI_HANDOFF: "$chat_ai_handoff",
18
- CLOSED: "$chat_closed",
19
- READ: "$chat_read",
20
- WIDGET_OPENED: "$chat_widget_opened",
21
- WIDGET_CLOSED: "$chat_widget_closed",
22
- };
@@ -1,17 +0,0 @@
1
- import { VTilt } from "../vtilt";
2
- /**
3
- * This class is used to capture pageview events when the user navigates using the history API (pushState, replaceState)
4
- * and when the user navigates using the browser's back/forward buttons.
5
- */
6
- export declare class HistoryAutocapture {
7
- private _instance;
8
- private _popstateListener;
9
- private _lastPathname;
10
- constructor(instance: VTilt);
11
- get isEnabled(): boolean;
12
- startIfEnabled(): void;
13
- stop(): void;
14
- monitorHistoryChanges(): void;
15
- private _capturePageview;
16
- private _setupPopstateListener;
17
- }
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HistoryAutocapture = void 0;
4
- const globals_1 = require("../utils/globals");
5
- const utils_1 = require("../utils");
6
- const patch_1 = require("../utils/patch");
7
- /**
8
- * This class is used to capture pageview events when the user navigates using the history API (pushState, replaceState)
9
- * and when the user navigates using the browser's back/forward buttons.
10
- */
11
- class HistoryAutocapture {
12
- constructor(instance) {
13
- var _a;
14
- this._instance = instance;
15
- this._lastPathname = ((_a = globals_1.window === null || globals_1.window === void 0 ? void 0 : globals_1.window.location) === null || _a === void 0 ? void 0 : _a.pathname) || "";
16
- }
17
- get isEnabled() {
18
- // For now, always enabled (vTilt always tracks pageviews)
19
- // Can be made conditional based on config in the future
20
- return true;
21
- }
22
- startIfEnabled() {
23
- if (this.isEnabled) {
24
- this.monitorHistoryChanges();
25
- }
26
- }
27
- stop() {
28
- if (this._popstateListener) {
29
- this._popstateListener();
30
- }
31
- this._popstateListener = undefined;
32
- }
33
- monitorHistoryChanges() {
34
- var _a, _b;
35
- // Only setup page tracking in browser environment (not SSR)
36
- if (!globals_1.window || !globals_1.location) {
37
- return;
38
- }
39
- // Initialize last pathname
40
- this._lastPathname = globals_1.location.pathname || "";
41
- // Track history API changes using patch
42
- if (globals_1.window.history) {
43
- // Old fashioned, we could also use arrow functions but I think the closure for a patch is more reliable
44
- // eslint-disable-next-line @typescript-eslint/no-this-alias
45
- const self = this;
46
- // Only patch if not already wrapped
47
- if (!((_a = globals_1.window.history.pushState) === null || _a === void 0 ? void 0 : _a.__vtilt_wrapped__)) {
48
- (0, patch_1.patch)(globals_1.window.history, "pushState", (originalPushState) => {
49
- return function patchedPushState(state, title, url) {
50
- originalPushState.call(this, state, title, url);
51
- self._capturePageview("pushState");
52
- };
53
- });
54
- }
55
- // Only patch if not already wrapped
56
- if (!((_b = globals_1.window.history.replaceState) === null || _b === void 0 ? void 0 : _b.__vtilt_wrapped__)) {
57
- (0, patch_1.patch)(globals_1.window.history, "replaceState", (originalReplaceState) => {
58
- return function patchedReplaceState(state, title, url) {
59
- originalReplaceState.call(this, state, title, url);
60
- self._capturePageview("replaceState");
61
- };
62
- });
63
- }
64
- // For popstate we need to listen to the event instead of overriding a method
65
- this._setupPopstateListener();
66
- }
67
- }
68
- _capturePageview(navigationType) {
69
- var _a;
70
- try {
71
- const currentPathname = (_a = globals_1.window === null || globals_1.window === void 0 ? void 0 : globals_1.window.location) === null || _a === void 0 ? void 0 : _a.pathname;
72
- if (!currentPathname || !globals_1.location || !globals_1.document) {
73
- return;
74
- }
75
- // Only capture pageview if the pathname has changed and the feature is enabled
76
- if (currentPathname !== this._lastPathname && this.isEnabled) {
77
- // Note: $current_url, $host, $pathname, $referrer, $referring_domain, title
78
- // are automatically added by capture() for all events (title only for $pageview)
79
- const payload = {
80
- navigation_type: navigationType,
81
- };
82
- this._instance.capture("$pageview", payload);
83
- }
84
- this._lastPathname = currentPathname;
85
- }
86
- catch (error) {
87
- console.error(`Error capturing ${navigationType} pageview`, error);
88
- }
89
- }
90
- _setupPopstateListener() {
91
- if (this._popstateListener || !globals_1.window) {
92
- return;
93
- }
94
- const handler = () => {
95
- this._capturePageview("popstate");
96
- };
97
- (0, utils_1.addEventListener)(globals_1.window, "popstate", handler);
98
- this._popstateListener = () => {
99
- if (globals_1.window) {
100
- globals_1.window.removeEventListener("popstate", handler);
101
- }
102
- };
103
- }
104
- }
105
- exports.HistoryAutocapture = HistoryAutocapture;
@@ -1,13 +0,0 @@
1
- /**
2
- * Session Recording Extension
3
- *
4
- * Exports for rrweb session recording functionality.
5
- *
6
- * Architecture:
7
- * - SessionRecordingWrapper: Lightweight wrapper in main bundle, handles lazy loading
8
- * - LazyLoadedSessionRecording: Actual recording logic, loaded on demand via recorder.js
9
- */
10
- export { SessionRecordingWrapper, LAZY_LOADING, type SessionRecordingStatus, type LazyLoadedSessionRecordingInterface, } from "./session-recording-wrapper";
11
- export { LazyLoadedSessionRecording } from "./session-recording";
12
- export type { SessionRecordingConfig, SessionStartReason, RecordOptions, RRWebRecord, SnapshotBuffer, CanvasRecordingConfig, NetworkPayloadCaptureConfig, MaskingConfig, TriggerType, } from "./types";
13
- export { compressEvent, estimateSize, truncateLargeConsoleLogs, splitBuffer, isSessionIdleEvent, isRecordingPausedEvent, isInteractiveEvent, RECORDING_MAX_EVENT_SIZE, RECORDING_BUFFER_TIMEOUT, RECORDING_IDLE_THRESHOLD_MS, } from "./session-recording-utils";
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /**
3
- * Session Recording Extension
4
- *
5
- * Exports for rrweb session recording functionality.
6
- *
7
- * Architecture:
8
- * - SessionRecordingWrapper: Lightweight wrapper in main bundle, handles lazy loading
9
- * - LazyLoadedSessionRecording: Actual recording logic, loaded on demand via recorder.js
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RECORDING_IDLE_THRESHOLD_MS = exports.RECORDING_BUFFER_TIMEOUT = exports.RECORDING_MAX_EVENT_SIZE = exports.isInteractiveEvent = exports.isRecordingPausedEvent = exports.isSessionIdleEvent = exports.splitBuffer = exports.truncateLargeConsoleLogs = exports.estimateSize = exports.compressEvent = exports.LazyLoadedSessionRecording = exports.LAZY_LOADING = exports.SessionRecordingWrapper = void 0;
13
- // Main export - the wrapper that lives in the main bundle
14
- var session_recording_wrapper_1 = require("./session-recording-wrapper");
15
- Object.defineProperty(exports, "SessionRecordingWrapper", { enumerable: true, get: function () { return session_recording_wrapper_1.SessionRecordingWrapper; } });
16
- Object.defineProperty(exports, "LAZY_LOADING", { enumerable: true, get: function () { return session_recording_wrapper_1.LAZY_LOADING; } });
17
- // Lazy-loaded implementation (only used in recorder.js bundle)
18
- var session_recording_1 = require("./session-recording");
19
- Object.defineProperty(exports, "LazyLoadedSessionRecording", { enumerable: true, get: function () { return session_recording_1.LazyLoadedSessionRecording; } });
20
- // Utilities
21
- var session_recording_utils_1 = require("./session-recording-utils");
22
- Object.defineProperty(exports, "compressEvent", { enumerable: true, get: function () { return session_recording_utils_1.compressEvent; } });
23
- Object.defineProperty(exports, "estimateSize", { enumerable: true, get: function () { return session_recording_utils_1.estimateSize; } });
24
- Object.defineProperty(exports, "truncateLargeConsoleLogs", { enumerable: true, get: function () { return session_recording_utils_1.truncateLargeConsoleLogs; } });
25
- Object.defineProperty(exports, "splitBuffer", { enumerable: true, get: function () { return session_recording_utils_1.splitBuffer; } });
26
- Object.defineProperty(exports, "isSessionIdleEvent", { enumerable: true, get: function () { return session_recording_utils_1.isSessionIdleEvent; } });
27
- Object.defineProperty(exports, "isRecordingPausedEvent", { enumerable: true, get: function () { return session_recording_utils_1.isRecordingPausedEvent; } });
28
- Object.defineProperty(exports, "isInteractiveEvent", { enumerable: true, get: function () { return session_recording_utils_1.isInteractiveEvent; } });
29
- Object.defineProperty(exports, "RECORDING_MAX_EVENT_SIZE", { enumerable: true, get: function () { return session_recording_utils_1.RECORDING_MAX_EVENT_SIZE; } });
30
- Object.defineProperty(exports, "RECORDING_BUFFER_TIMEOUT", { enumerable: true, get: function () { return session_recording_utils_1.RECORDING_BUFFER_TIMEOUT; } });
31
- Object.defineProperty(exports, "RECORDING_IDLE_THRESHOLD_MS", { enumerable: true, get: function () { return session_recording_utils_1.RECORDING_IDLE_THRESHOLD_MS; } });
@@ -1,92 +0,0 @@
1
- /**
2
- * Session Recording Utilities
3
- *
4
- * Utility functions for session recording.
5
- * Based on PostHog's sessionrecording-utils.ts
6
- */
7
- import { EventType, IncrementalSource, eventWithTime } from "@rrweb/types";
8
- import type { SnapshotBuffer } from "./types";
9
- export declare const INCREMENTAL_SNAPSHOT_EVENT_TYPE = 3;
10
- export declare const ONE_KB = 1024;
11
- export declare const ONE_MB: number;
12
- export declare const SEVEN_MB: number;
13
- export declare const PARTIAL_COMPRESSION_THRESHOLD = 1024;
14
- export declare const RECORDING_MAX_EVENT_SIZE: number;
15
- export declare const RECORDING_BUFFER_TIMEOUT = 2000;
16
- export declare const RECORDING_IDLE_THRESHOLD_MS: number;
17
- /** Active interaction sources */
18
- export declare const ACTIVE_SOURCES: IncrementalSource[];
19
- /**
20
- * Gzip compress data to a base64 string
21
- */
22
- export declare function gzipToString(data: unknown): string;
23
- /**
24
- * Estimate the size of an object in bytes
25
- */
26
- export declare function estimateSize(obj: unknown): number;
27
- export interface CompressedFullSnapshotEvent {
28
- type: typeof EventType.FullSnapshot;
29
- data: string;
30
- }
31
- export interface CompressedIncrementalSnapshotEvent {
32
- type: typeof EventType.IncrementalSnapshot;
33
- data: {
34
- source: IncrementalSource;
35
- texts: string;
36
- attributes: string;
37
- removes: string;
38
- adds: string;
39
- };
40
- }
41
- export interface CompressedIncrementalStyleSnapshotEvent {
42
- type: typeof EventType.IncrementalSnapshot;
43
- data: {
44
- source: typeof IncrementalSource.StyleSheetRule;
45
- id?: number;
46
- styleId?: number;
47
- replace?: string;
48
- replaceSync?: string;
49
- adds?: string;
50
- removes?: string;
51
- };
52
- }
53
- export type CompressedEvent = CompressedFullSnapshotEvent | CompressedIncrementalSnapshotEvent | CompressedIncrementalStyleSnapshotEvent;
54
- export type CompressedEventWithTime = CompressedEvent & {
55
- timestamp: number;
56
- delay?: number;
57
- cv: "2024-10";
58
- };
59
- /**
60
- * Compress an rrweb event for transmission
61
- * Only compresses full snapshots and mutation events above threshold
62
- */
63
- export declare function compressEvent(event: eventWithTime): eventWithTime | CompressedEventWithTime;
64
- /**
65
- * Truncate large console log payloads to prevent excessive data
66
- */
67
- export declare function truncateLargeConsoleLogs(event: eventWithTime): eventWithTime;
68
- /**
69
- * Split a large buffer into smaller chunks for transmission
70
- */
71
- export declare function splitBuffer(buffer: SnapshotBuffer, sizeLimit?: number): SnapshotBuffer[];
72
- /**
73
- * Check if an event is a session idle custom event
74
- */
75
- export declare function isSessionIdleEvent(event: eventWithTime): event is eventWithTime & {
76
- data: {
77
- tag: string;
78
- payload: unknown;
79
- };
80
- };
81
- /**
82
- * Check if an event is a recording paused custom event
83
- */
84
- export declare function isRecordingPausedEvent(event: eventWithTime): boolean;
85
- /**
86
- * Check if an event represents user interaction
87
- */
88
- export declare function isInteractiveEvent(event: eventWithTime): boolean;
89
- /**
90
- * Clamp a value to a range with logging
91
- */
92
- export declare function clampToRange(value: number, min: number, max: number, label: string, defaultValue: number): number;