@v-tilt/browser 1.6.0 → 1.7.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 (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,134 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uuidv4 = uuidv4;
4
- exports.isValidUserAgent = isValidUserAgent;
5
- exports.isValidPayload = isValidPayload;
6
- exports.isTestEnvironment = isTestEnvironment;
7
- exports.each = each;
8
- exports.addEventListener = addEventListener;
9
- exports.extend = extend;
10
- exports.extendArray = extendArray;
11
- exports.stripEmptyProperties = stripEmptyProperties;
12
- exports.stripLeadingDollar = stripLeadingDollar;
13
- exports.isNull = isNull;
14
- /**
15
- * Generate uuid to identify the session. Random, not data-derived
16
- */
17
- function uuidv4() {
18
- return `${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`.replace(/[018]/g, (c) => (+c ^
19
- (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));
20
- }
21
- /**
22
- * Validate user agent string
23
- */
24
- function isValidUserAgent(userAgent) {
25
- // empty is fine
26
- if (!userAgent || typeof userAgent !== "string") {
27
- return true;
28
- }
29
- if (userAgent.length > 500) {
30
- return false;
31
- }
32
- return true;
33
- }
34
- /**
35
- * Validate payload string
36
- */
37
- function isValidPayload(payloadStr) {
38
- if (!payloadStr || typeof payloadStr !== "string") {
39
- return false;
40
- }
41
- if (payloadStr.length < 2 || payloadStr.length > 10240) {
42
- return false;
43
- }
44
- return true;
45
- }
46
- /**
47
- * Check if current environment is a test environment
48
- */
49
- function isTestEnvironment() {
50
- return !!("__nightmare" in window ||
51
- window.navigator.webdriver ||
52
- "Cypress" in window);
53
- }
54
- /**
55
- * Iterate over an array or object
56
- */
57
- function each(obj, iterator, thisArg) {
58
- if (!obj) {
59
- return;
60
- }
61
- if (Array.isArray(obj)) {
62
- obj.forEach((value, index) => {
63
- iterator.call(thisArg, value, index);
64
- });
65
- }
66
- else {
67
- for (const key in obj) {
68
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
69
- iterator.call(thisArg, obj[key], key);
70
- }
71
- }
72
- }
73
- }
74
- /**
75
- * Use this instead of element.addEventListener to avoid eslint errors
76
- * This properly implements the default options for passive event listeners
77
- */
78
- function addEventListener(element, event, callback, options) {
79
- const { capture = false, passive = true } = options !== null && options !== void 0 ? options : {};
80
- element === null || element === void 0 ? void 0 : element.addEventListener(event, callback, { capture, passive });
81
- }
82
- /**
83
- * Extend object with properties from another object
84
- */
85
- function extend(target, source) {
86
- if (!source) {
87
- return target;
88
- }
89
- for (const key in source) {
90
- if (Object.prototype.hasOwnProperty.call(source, key)) {
91
- target[key] = source[key];
92
- }
93
- }
94
- return target;
95
- }
96
- /**
97
- * Extend array with additional items
98
- * Mutates the base array and returns it (matches PostHog's behavior)
99
- */
100
- function extendArray(base, ...additional) {
101
- for (const arr of additional) {
102
- for (const item of arr) {
103
- base.push(item);
104
- }
105
- }
106
- return base;
107
- }
108
- /**
109
- * Strip properties with empty values (null, undefined, empty string)
110
- */
111
- function stripEmptyProperties(obj) {
112
- const result = {};
113
- for (const key in obj) {
114
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
115
- const value = obj[key];
116
- if (value !== null && value !== undefined && value !== "") {
117
- result[key] = value;
118
- }
119
- }
120
- }
121
- return result;
122
- }
123
- /**
124
- * Strip leading dollar sign from string
125
- */
126
- function stripLeadingDollar(str) {
127
- return str.startsWith("$") ? str.substring(1) : str;
128
- }
129
- /**
130
- * Check if value is null
131
- */
132
- function isNull(value) {
133
- return value === null;
134
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Patch utility for wrapping native methods
3
- */
4
- export declare function patch(source: {
5
- [key: string]: any;
6
- }, name: string, replacement: (...args: unknown[]) => unknown): () => void;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /**
3
- * Patch utility for wrapping native methods
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.patch = patch;
7
- const type_utils_1 = require("./type-utils");
8
- function patch(source, name, replacement) {
9
- try {
10
- if (!(name in source)) {
11
- return () => {
12
- //
13
- };
14
- }
15
- const original = source[name];
16
- const wrapped = replacement(original);
17
- // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
18
- // otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
19
- if ((0, type_utils_1.isFunction)(wrapped)) {
20
- wrapped.prototype = wrapped.prototype || {};
21
- Object.defineProperties(wrapped, {
22
- __vtilt_wrapped__: {
23
- enumerable: false,
24
- value: true,
25
- },
26
- });
27
- }
28
- source[name] = wrapped;
29
- return () => {
30
- source[name] = original;
31
- };
32
- }
33
- catch (_a) {
34
- return () => {
35
- //
36
- };
37
- // This can throw if multiple fill happens on a global object like XMLHttpRequest
38
- }
39
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Request utilities
3
- * Functions for parsing URLs, query parameters, and masking sensitive data
4
- */
5
- /**
6
- * Convert string URL to HTMLAnchorElement for parsing
7
- * IE11 doesn't support `new URL`, so we use anchor element
8
- */
9
- export declare function convertToURL(url: string): HTMLAnchorElement | null;
10
- /**
11
- * Get query parameter from URL
12
- */
13
- export declare function getQueryParam(url: string, param: string): string;
14
- /**
15
- * Mask query parameters in URL
16
- */
17
- export declare function maskQueryParams<T extends string | undefined>(url: T, maskedParams: string[] | undefined, mask: string): T extends string ? string : undefined;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- /**
3
- * Request utilities
4
- * Functions for parsing URLs, query parameters, and masking sensitive data
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.convertToURL = convertToURL;
8
- exports.getQueryParam = getQueryParam;
9
- exports.maskQueryParams = maskQueryParams;
10
- const globals_1 = require("./globals");
11
- /**
12
- * Convert string URL to HTMLAnchorElement for parsing
13
- * IE11 doesn't support `new URL`, so we use anchor element
14
- */
15
- function convertToURL(url) {
16
- if (!globals_1.document) {
17
- return null;
18
- }
19
- const anchor = globals_1.document.createElement("a");
20
- anchor.href = url;
21
- return anchor;
22
- }
23
- /**
24
- * Get query parameter from URL
25
- */
26
- function getQueryParam(url, param) {
27
- const withoutHash = url.split("#")[0] || "";
28
- const queryParams = withoutHash.split(/\?(.*)/)[1] || "";
29
- const cleanedQueryParams = queryParams.replace(/^\?+/g, "");
30
- const queryParts = cleanedQueryParams.split("&");
31
- for (let i = 0; i < queryParts.length; i++) {
32
- const parts = queryParts[i].split("=");
33
- if (parts[0] === param) {
34
- if (parts.length < 2) {
35
- return "";
36
- }
37
- let result = parts[1];
38
- try {
39
- result = decodeURIComponent(result);
40
- }
41
- catch (_a) {
42
- // Skip decoding for malformed query param
43
- }
44
- return result.replace(/\+/g, " ");
45
- }
46
- }
47
- return "";
48
- }
49
- /**
50
- * Mask query parameters in URL
51
- */
52
- function maskQueryParams(url, maskedParams, mask) {
53
- if (!url || !maskedParams || !maskedParams.length) {
54
- return url;
55
- }
56
- const splitHash = url.split("#");
57
- const withoutHash = splitHash[0] || "";
58
- const hash = splitHash[1];
59
- const splitQuery = withoutHash.split("?");
60
- const queryString = splitQuery[1];
61
- const urlWithoutQueryAndHash = splitQuery[0];
62
- const queryParts = (queryString || "").split("&");
63
- const paramStrings = [];
64
- for (let i = 0; i < queryParts.length; i++) {
65
- const parts = queryParts[i].split("=");
66
- const key = parts[0];
67
- const value = parts.slice(1).join("=");
68
- if (maskedParams.indexOf(key) !== -1) {
69
- paramStrings.push(key + "=" + mask);
70
- }
71
- else if (key) {
72
- paramStrings.push(key + (value ? "=" + value : ""));
73
- }
74
- }
75
- const newQueryString = paramStrings.join("&");
76
- const newUrl = urlWithoutQueryAndHash +
77
- (newQueryString ? "?" + newQueryString : "") +
78
- (hash ? "#" + hash : "");
79
- return newUrl;
80
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Type guard to check if a value is a function
3
- */
4
- export declare function isFunction(value: any): value is (...args: any[]) => any;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFunction = isFunction;
4
- /**
5
- * Type guard to check if a value is a function
6
- */
7
- function isFunction(value) {
8
- return typeof value === "function";
9
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * This function detects which browser is running this script.
3
- * The order of the checks are important since many user agents
4
- * include keywords used in later checks.
5
- */
6
- export declare const detectBrowser: (user_agent: string, vendor: string | undefined) => string;
7
- /**
8
- * This function detects which browser version is running this script,
9
- * parsing major and minor version (e.g., 42.1). User agent strings from:
10
- * http://www.useragentstring.com/pages/useragentstring.php
11
- *
12
- * `navigator.vendor` is passed in and used to help with detecting certain browsers
13
- * NB `navigator.vendor` is deprecated and not present in every browser
14
- */
15
- export declare const detectBrowserVersion: (userAgent: string, vendor: string | undefined) => number | null;
16
- export declare const detectOS: (user_agent: string) => [string, string];
17
- export declare const detectDevice: (user_agent: string) => string;
18
- export declare const detectDeviceType: (user_agent: string) => string;