@v-tilt/browser 1.0.8 → 1.0.10

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 (48) hide show
  1. package/dist/array.js +1 -1
  2. package/dist/array.js.map +1 -1
  3. package/dist/array.no-external.js +1 -1
  4. package/dist/array.no-external.js.map +1 -1
  5. package/dist/constants.d.ts +0 -1
  6. package/dist/extensions/history-autocapture.d.ts +0 -2
  7. package/dist/main.js +1 -1
  8. package/dist/main.js.map +1 -1
  9. package/dist/module.d.ts +53 -133
  10. package/dist/module.js +1 -1
  11. package/dist/module.js.map +1 -1
  12. package/dist/module.no-external.d.ts +53 -133
  13. package/dist/module.no-external.js +1 -1
  14. package/dist/module.no-external.js.map +1 -1
  15. package/dist/session.d.ts +5 -5
  16. package/dist/types.d.ts +2 -1
  17. package/dist/user-manager.d.ts +30 -20
  18. package/dist/utils/event-utils.d.ts +7 -8
  19. package/dist/utils/index.d.ts +0 -5
  20. package/dist/utils/patch.d.ts +0 -1
  21. package/dist/vtilt.d.ts +54 -14
  22. package/dist/web-vitals.d.ts +3 -3
  23. package/lib/constants.d.ts +0 -1
  24. package/lib/constants.js +1 -23
  25. package/lib/extensions/history-autocapture.d.ts +0 -2
  26. package/lib/extensions/history-autocapture.js +3 -5
  27. package/lib/session.d.ts +5 -5
  28. package/lib/session.js +8 -8
  29. package/lib/types.d.ts +2 -1
  30. package/lib/user-manager.d.ts +30 -20
  31. package/lib/user-manager.js +103 -94
  32. package/lib/utils/event-utils.d.ts +7 -8
  33. package/lib/utils/event-utils.js +8 -9
  34. package/lib/utils/index.d.ts +0 -5
  35. package/lib/utils/index.js +0 -13
  36. package/lib/utils/patch.d.ts +0 -1
  37. package/lib/utils/patch.js +0 -1
  38. package/lib/vtilt.d.ts +54 -14
  39. package/lib/vtilt.js +323 -41
  40. package/lib/web-vitals.d.ts +3 -3
  41. package/lib/web-vitals.js +3 -3
  42. package/package.json +1 -1
  43. package/dist/tracking.d.ts +0 -120
  44. package/dist/utils/is-function.d.ts +0 -4
  45. package/lib/tracking.d.ts +0 -120
  46. package/lib/tracking.js +0 -338
  47. package/lib/utils/is-function.d.ts +0 -4
  48. package/lib/utils/is-function.js +0 -9
@@ -5,7 +5,7 @@ const constants_1 = require("./constants");
5
5
  const utils_1 = require("./utils");
6
6
  class UserManager {
7
7
  constructor(storageMethod = "localStorage", domain) {
8
- this._cachedPersonProperties = null; // PostHog behavior: cache for deduplication
8
+ this._cachedPersonProperties = null; // Cache for deduplication
9
9
  this.storageMethod = storageMethod;
10
10
  this.domain = domain;
11
11
  this.userIdentity = this.loadUserIdentity();
@@ -41,35 +41,32 @@ class UserManager {
41
41
  }
42
42
  /**
43
43
  * Identify a user with distinct ID and properties
44
- * Copied from PostHog's identify method implementation
45
44
  */
46
45
  identify(newDistinctId, userPropertiesToSet, userPropertiesToSetOnce) {
47
- // PostHog validation: Convert number to string
46
+ // Validation: Convert number to string
48
47
  if (typeof newDistinctId === "number") {
49
48
  newDistinctId = newDistinctId.toString();
50
49
  console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.");
51
50
  }
52
- // PostHog validation: Check if distinct_id is provided
51
+ // Validation: Check if distinct_id is provided
53
52
  if (!newDistinctId) {
54
53
  console.error("Unique user id has not been set in vTilt.identify");
55
54
  return;
56
55
  }
57
- // PostHog validation: Check for hardcoded strings
56
+ // Validation: Check for hardcoded strings
58
57
  if (this.isDistinctIdStringLike(newDistinctId)) {
59
58
  console.error(`The string "${newDistinctId}" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`);
60
59
  return;
61
60
  }
62
- // PostHog validation: Check for cookieless sentinel value
61
+ // Validation: Check for cookieless sentinel value
63
62
  if (newDistinctId === "COOKIELESS_SENTINEL_VALUE") {
64
63
  console.error(`The string "${newDistinctId}" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.`);
65
64
  return;
66
65
  }
67
66
  const previousDistinctId = this.userIdentity.distinct_id;
68
- const anonymousId = this.userIdentity.anonymous_id;
69
- const deviceId = this.userIdentity.device_id;
70
- // PostHog behavior: Register user ID
67
+ // Register user ID
71
68
  this.userIdentity.distinct_id = newDistinctId;
72
- // PostHog behavior: Handle device ID if not already set
69
+ // Handle device ID if not already set
73
70
  if (!this.userIdentity.device_id) {
74
71
  // The persisted distinct id might not actually be a device id at all
75
72
  // it might be a distinct id of the user from before
@@ -81,14 +78,14 @@ class UserManager {
81
78
  $device_id: device_id,
82
79
  };
83
80
  }
84
- // PostHog behavior: Clear alias if distinct_id is changing
81
+ // Clear alias if distinct_id is changing
85
82
  if (newDistinctId !== previousDistinctId) {
86
- // Clear any stored alias (we don't have alias support yet, but keeping PostHog structure)
83
+ // Clear any stored alias
87
84
  this.userIdentity.distinct_id = newDistinctId;
88
85
  }
89
- // PostHog behavior: Check if user was anonymous
86
+ // Check if user was anonymous
90
87
  const isKnownAnonymous = this.userIdentity.user_state === "anonymous";
91
- // PostHog behavior: Send $identify event only when distinct_id is changing AND user was anonymous
88
+ // Send $identify event only when distinct_id is changing AND user was anonymous
92
89
  // - logic on the server will determine whether or not to do anything with it.
93
90
  if (newDistinctId !== previousDistinctId && isKnownAnonymous) {
94
91
  // Update user state to identified
@@ -110,14 +107,11 @@ class UserManager {
110
107
  }
111
108
  // Save to storage
112
109
  this.saveUserIdentity();
113
- // PostHog behavior: Send $identify event for session merging
114
- this.sendIdentifyEvent(newDistinctId, anonymousId, deviceId, {
115
- $set: userPropertiesToSet || {},
116
- $set_once: userPropertiesToSetOnce || {},
117
- });
110
+ // Note: Event sending is now handled by VTilt.identify()
111
+ // This method is kept for backward compatibility but should not be called directly
118
112
  }
119
113
  else if (userPropertiesToSet || userPropertiesToSetOnce) {
120
- // PostHog behavior: If distinct_id is not changing but we have properties to set
114
+ // If distinct_id is not changing but we have properties to set
121
115
  // Update user state if not already identified
122
116
  if (this.userIdentity.user_state === "anonymous") {
123
117
  this.userIdentity.user_state = "identified";
@@ -139,10 +133,8 @@ class UserManager {
139
133
  }
140
134
  // Save to storage
141
135
  this.saveUserIdentity();
142
- // PostHog behavior: Send $set event to notify server of property updates
143
- // This allows Tinybird to track property changes when identify() is called with properties
144
- // but no $identify event is sent (user was already identified)
145
- this.sendSetEvent(userPropertiesToSet || {}, userPropertiesToSetOnce || {});
136
+ // Note: Event sending is now handled by VTilt.identify()
137
+ // This method is kept for backward compatibility but should not be called directly
146
138
  }
147
139
  else {
148
140
  // If distinct_id is changing but user was already identified, just update the distinct_id
@@ -153,7 +145,7 @@ class UserManager {
153
145
  }
154
146
  }
155
147
  /**
156
- * Set user properties without changing distinct ID (PostHog-style)
148
+ * Set user properties without changing distinct ID
157
149
  * Sets properties on the person profile associated with the current distinct_id
158
150
  *
159
151
  * @example
@@ -175,26 +167,26 @@ class UserManager {
175
167
  * @param userPropertiesToSetOnce Optional: Properties to set once (preserves first value)
176
168
  */
177
169
  setUserProperties(userPropertiesToSet, userPropertiesToSetOnce) {
178
- // PostHog behavior: Return early if no properties provided
170
+ // Return early if no properties provided
179
171
  if (!userPropertiesToSet && !userPropertiesToSetOnce) {
180
- return;
172
+ return false;
181
173
  }
182
- // PostHog behavior: Create hash for deduplication
174
+ // Create hash for deduplication
183
175
  const distinctId = this.userIdentity.distinct_id || this.userIdentity.anonymous_id;
184
176
  const hash = this.getPersonPropertiesHash(distinctId, userPropertiesToSet, userPropertiesToSetOnce);
185
- // PostHog behavior: Skip if exactly this $set call has been sent before
177
+ // Skip if exactly this $set call has been sent before
186
178
  if (this._cachedPersonProperties === hash) {
187
179
  console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored.");
188
- return;
180
+ return false;
189
181
  }
190
- // PostHog behavior: Handle $set properties (update existing)
182
+ // Handle $set properties (update existing)
191
183
  if (userPropertiesToSet) {
192
184
  this.userIdentity.properties = {
193
185
  ...this.userIdentity.properties,
194
186
  ...userPropertiesToSet,
195
187
  };
196
188
  }
197
- // PostHog behavior: Handle $set_once properties (preserve first value)
189
+ // Handle $set_once properties (preserve first value)
198
190
  if (userPropertiesToSetOnce) {
199
191
  Object.keys(userPropertiesToSetOnce).forEach((key) => {
200
192
  if (!(key in this.userIdentity.properties)) {
@@ -204,45 +196,31 @@ class UserManager {
204
196
  }
205
197
  // Save to storage
206
198
  this.saveUserIdentity();
207
- // PostHog behavior: Send $set event to notify server of property updates
208
- this.sendSetEvent(userPropertiesToSet || {}, userPropertiesToSetOnce || {});
209
- // PostHog behavior: Cache the hash to prevent duplicate sends
199
+ // Cache the hash to prevent duplicate sends
210
200
  this._cachedPersonProperties = hash;
201
+ // Note: Event sending is now handled by VTilt.setUserProperties()
202
+ return true;
211
203
  }
212
204
  /**
213
- * Get hash for person properties (PostHog behavior)
205
+ * Get hash for person properties
214
206
  * Used for deduplication of identical setUserProperties calls
215
207
  */
216
208
  getPersonPropertiesHash(distinctId, userPropertiesToSet, userPropertiesToSetOnce) {
217
- // PostHog behavior: Create deterministic hash from distinct_id and properties
209
+ // Create deterministic hash from distinct_id and properties
218
210
  return JSON.stringify({
219
211
  distinct_id: distinctId,
220
212
  userPropertiesToSet,
221
213
  userPropertiesToSetOnce,
222
214
  });
223
215
  }
224
- /**
225
- * Send $set event for property updates (PostHog behavior)
226
- * This notifies the server when user properties are updated
227
- */
228
- sendSetEvent(userPropertiesToSet, userPropertiesToSetOnce) {
229
- // Emit a custom event that TrackingManager can listen to
230
- const setEvent = new CustomEvent("vtilt:set", {
231
- detail: {
232
- $set: userPropertiesToSet || {},
233
- $set_once: userPropertiesToSetOnce || {},
234
- },
235
- });
236
- window.dispatchEvent(setEvent);
237
- }
238
216
  /**
239
217
  * Reset user identity (logout)
240
- * PostHog behavior: Generates new anonymous ID, clears user data, optionally resets device ID
218
+ * Generates new anonymous ID, clears user data, optionally resets device ID
241
219
  *
242
220
  * @param reset_device_id - If true, also resets device_id. Default: false (preserves device_id)
243
221
  */
244
222
  reset(reset_device_id) {
245
- // PostHog behavior: Generate completely new anonymous ID (don't revert to original)
223
+ // Generate completely new anonymous ID (don't revert to original)
246
224
  const newAnonymousId = this.generateAnonymousId();
247
225
  const device_id = this.userIdentity.device_id;
248
226
  // Generate new device ID if reset_device_id is true
@@ -254,14 +232,14 @@ class UserManager {
254
232
  properties: {},
255
233
  user_state: "anonymous",
256
234
  };
257
- // PostHog behavior: Clear cached person properties on reset
235
+ // Clear cached person properties on reset
258
236
  this._cachedPersonProperties = null;
259
237
  this.saveUserIdentity();
260
- // PostHog behavior: Set $last_posthog_reset property
238
+ // Set $last_vtilt_reset property
261
239
  // Store it in properties, it will be sent on the next event
262
240
  this.userIdentity.properties = {
263
241
  ...this.userIdentity.properties,
264
- $last_posthog_reset: new Date().toISOString(),
242
+ $last_vtilt_reset: new Date().toISOString(),
265
243
  };
266
244
  this.saveUserIdentity();
267
245
  }
@@ -283,53 +261,105 @@ class UserManager {
283
261
  getUserState() {
284
262
  return this.userIdentity.user_state;
285
263
  }
264
+ /**
265
+ * Update distinct ID (internal use - for VTilt)
266
+ */
267
+ setDistinctId(distinctId) {
268
+ this.userIdentity.distinct_id = distinctId;
269
+ this.saveUserIdentity();
270
+ }
271
+ /**
272
+ * Update user state (internal use - for VTilt)
273
+ */
274
+ setUserState(state) {
275
+ this.userIdentity.user_state = state;
276
+ this.saveUserIdentity();
277
+ }
278
+ /**
279
+ * Update user properties (internal use - for VTilt)
280
+ */
281
+ updateUserProperties(userPropertiesToSet, userPropertiesToSetOnce) {
282
+ // Handle $set properties (update existing)
283
+ if (userPropertiesToSet) {
284
+ this.userIdentity.properties = {
285
+ ...this.userIdentity.properties,
286
+ ...userPropertiesToSet,
287
+ };
288
+ }
289
+ // Handle $set_once properties (preserve first value)
290
+ if (userPropertiesToSetOnce) {
291
+ Object.keys(userPropertiesToSetOnce).forEach((key) => {
292
+ if (!(key in this.userIdentity.properties)) {
293
+ this.userIdentity.properties[key] = userPropertiesToSetOnce[key];
294
+ }
295
+ });
296
+ }
297
+ this.saveUserIdentity();
298
+ }
299
+ /**
300
+ * Set device ID if not already set (internal use - for VTilt)
301
+ */
302
+ ensureDeviceId(deviceId) {
303
+ if (!this.userIdentity.device_id) {
304
+ this.userIdentity.device_id = deviceId;
305
+ this.userIdentity.properties = {
306
+ ...this.userIdentity.properties,
307
+ $had_persisted_distinct_id: true,
308
+ $device_id: deviceId,
309
+ };
310
+ this.saveUserIdentity();
311
+ }
312
+ }
313
+ /**
314
+ * Check if distinct ID is string-like (hardcoded string) - public for validation
315
+ * This is a wrapper to expose the private method
316
+ */
317
+ isDistinctIdStringLikePublic(distinctId) {
318
+ return this.isDistinctIdStringLike(distinctId);
319
+ }
286
320
  /**
287
321
  * Create an alias to link two distinct IDs
288
- * PostHog behavior: If original is not provided, uses current distinct_id
289
- * If alias matches original, just calls identify instead
322
+ * If original is not provided, uses current distinct_id
323
+ * If alias matches original, returns null (caller should use identify instead)
290
324
  *
291
325
  * @param alias - A unique identifier that you want to use for this user in the future
292
326
  * @param original - The current identifier being used for this user (optional, defaults to current distinct_id)
327
+ * @returns AliasEvent if alias was created, null if alias matches original or invalid
293
328
  */
294
329
  createAlias(alias, original) {
295
330
  if (!this.isValidDistinctId(alias)) {
296
331
  console.warn("Invalid alias provided");
297
- return;
332
+ return null;
298
333
  }
299
- // PostHog behavior: If original is not provided, use current distinct_id
334
+ // If original is not provided, use current distinct_id
300
335
  if (original === undefined) {
301
336
  original = this.getDistinctId() || this.getAnonymousId();
302
337
  }
303
338
  if (!this.isValidDistinctId(original)) {
304
339
  console.warn("Invalid original distinct ID");
305
- return;
340
+ return null;
306
341
  }
307
- // PostHog behavior: If alias matches original, just call identify instead
342
+ // If alias matches original, return null (caller should use identify)
308
343
  if (alias === original) {
309
- console.warn("alias matches current distinct_id - calling identify instead");
310
- this.identify(alias);
311
- return;
344
+ console.warn("alias matches current distinct_id - should use identify instead");
345
+ return null;
312
346
  }
313
347
  // { distinct_id: alias, original: original }
314
348
  const aliasEvent = {
315
349
  distinct_id: alias,
316
350
  original,
317
351
  };
318
- // Emit alias event
319
- const customEvent = new CustomEvent("vtilt:alias", {
320
- detail: aliasEvent,
321
- });
322
- window.dispatchEvent(customEvent);
352
+ // Note: Event sending is now handled by VTilt.createAlias()
353
+ return aliasEvent;
323
354
  }
324
355
  /**
325
356
  * Validate distinct ID to prevent hardcoded strings
326
- * Copied from PostHog's validation logic
327
357
  */
328
358
  isValidDistinctId(distinctId) {
329
359
  if (!distinctId || typeof distinctId !== "string") {
330
360
  return false;
331
361
  }
332
- // PostHog's validation patterns
362
+ // Validation patterns
333
363
  const invalidPatterns = [
334
364
  "null",
335
365
  "undefined",
@@ -356,13 +386,12 @@ class UserManager {
356
386
  }
357
387
  /**
358
388
  * Check if distinct ID is string-like (hardcoded string)
359
- * Copied from PostHog's isDistinctIdStringLike function
360
389
  */
361
390
  isDistinctIdStringLike(distinctId) {
362
391
  if (!distinctId || typeof distinctId !== "string") {
363
392
  return false;
364
393
  }
365
- // PostHog's hardcoded string patterns
394
+ // Hardcoded string patterns
366
395
  const hardcodedPatterns = [
367
396
  "null",
368
397
  "undefined",
@@ -432,26 +461,6 @@ class UserManager {
432
461
  generateDeviceId() {
433
462
  return `device_${(0, utils_1.uuidv4)()}`;
434
463
  }
435
- /**
436
- * Send identify event for session merging
437
- */
438
- sendIdentifyEvent(distinctId, anonymousId, deviceId, propertyOperations) {
439
- // This will be handled by the TrackingManager
440
- // We'll emit a custom event that the TrackingManager can listen to
441
- const identifyEvent = new CustomEvent("vtilt:identify", {
442
- detail: {
443
- distinct_id: distinctId,
444
- anonymous_id: anonymousId,
445
- device_id: deviceId,
446
- properties: {
447
- $anon_distinct_id: anonymousId,
448
- $device_id: deviceId,
449
- ...propertyOperations,
450
- },
451
- },
452
- });
453
- window.dispatchEvent(identifyEvent);
454
- }
455
464
  /**
456
465
  * Get stored value from storage
457
466
  */
@@ -1,35 +1,34 @@
1
1
  /**
2
- * Get browser language (PostHog-style)
2
+ * Get browser language
3
3
  * Returns the browser's language setting (e.g., "en-US")
4
4
  */
5
5
  export declare function getBrowserLanguage(): string | undefined;
6
6
  /**
7
- * Get browser language prefix (PostHog-style)
7
+ * Get browser language prefix
8
8
  * Returns the language code without region (e.g., "en" from "en-US")
9
9
  */
10
10
  export declare function getBrowserLanguagePrefix(): string | undefined;
11
11
  /**
12
- * Get referrer (PostHog-style)
12
+ * Get referrer
13
13
  * Returns document.referrer or '$direct' if no referrer
14
14
  */
15
15
  export declare function getReferrer(): string;
16
16
  /**
17
- * Get referring domain (PostHog-style)
17
+ * Get referring domain
18
18
  * Returns the hostname of the referrer URL or '$direct' if no referrer
19
19
  */
20
20
  export declare function getReferringDomain(): string;
21
21
  /**
22
- * Get timezone (PostHog-style)
22
+ * Get timezone
23
23
  * Returns the timezone (e.g., "America/New_York")
24
24
  */
25
25
  export declare function getTimezone(): string | undefined;
26
26
  /**
27
- * Get timezone offset (PostHog-style)
27
+ * Get timezone offset
28
28
  * Returns the timezone offset in minutes
29
29
  */
30
30
  export declare function getTimezoneOffset(): number | undefined;
31
31
  /**
32
- * Get event properties that should be added to all events (PostHog-style)
33
- * Matches PostHog's getEventProperties() implementation
32
+ * Get event properties that should be added to all events
34
33
  */
35
34
  export declare function getEventProperties(): Record<string, any>;
@@ -12,7 +12,7 @@ const user_agent_utils_1 = require("./user-agent-utils");
12
12
  // Library version - should match package.json version
13
13
  const LIB_VERSION = "1.0.7"; // TODO: Auto-import from package.json
14
14
  /**
15
- * Get browser language (PostHog-style)
15
+ * Get browser language
16
16
  * Returns the browser's language setting (e.g., "en-US")
17
17
  */
18
18
  function getBrowserLanguage() {
@@ -24,7 +24,7 @@ function getBrowserLanguage() {
24
24
  );
25
25
  }
26
26
  /**
27
- * Get browser language prefix (PostHog-style)
27
+ * Get browser language prefix
28
28
  * Returns the language code without region (e.g., "en" from "en-US")
29
29
  */
30
30
  function getBrowserLanguagePrefix() {
@@ -32,14 +32,14 @@ function getBrowserLanguagePrefix() {
32
32
  return typeof lang === "string" ? lang.split("-")[0] : undefined;
33
33
  }
34
34
  /**
35
- * Get referrer (PostHog-style)
35
+ * Get referrer
36
36
  * Returns document.referrer or '$direct' if no referrer
37
37
  */
38
38
  function getReferrer() {
39
39
  return (globals_1.document === null || globals_1.document === void 0 ? void 0 : globals_1.document.referrer) || "$direct";
40
40
  }
41
41
  /**
42
- * Get referring domain (PostHog-style)
42
+ * Get referring domain
43
43
  * Returns the hostname of the referrer URL or '$direct' if no referrer
44
44
  */
45
45
  function getReferringDomain() {
@@ -55,7 +55,7 @@ function getReferringDomain() {
55
55
  }
56
56
  }
57
57
  /**
58
- * Get timezone (PostHog-style)
58
+ * Get timezone
59
59
  * Returns the timezone (e.g., "America/New_York")
60
60
  */
61
61
  function getTimezone() {
@@ -67,7 +67,7 @@ function getTimezone() {
67
67
  }
68
68
  }
69
69
  /**
70
- * Get timezone offset (PostHog-style)
70
+ * Get timezone offset
71
71
  * Returns the timezone offset in minutes
72
72
  */
73
73
  function getTimezoneOffset() {
@@ -79,15 +79,14 @@ function getTimezoneOffset() {
79
79
  }
80
80
  }
81
81
  /**
82
- * Generate insert ID for deduplication (PostHog-style)
82
+ * Generate insert ID for deduplication
83
83
  */
84
84
  function generateInsertId() {
85
85
  return (Math.random().toString(36).substring(2, 10) +
86
86
  Math.random().toString(36).substring(2, 10));
87
87
  }
88
88
  /**
89
- * Get event properties that should be added to all events (PostHog-style)
90
- * Matches PostHog's getEventProperties() implementation
89
+ * Get event properties that should be added to all events
91
90
  */
92
91
  function getEventProperties() {
93
92
  const props = {};
@@ -1,4 +1,3 @@
1
- import { EventPayload } from "../types";
2
1
  /**
3
2
  * Generate uuid to identify the session. Random, not data-derived
4
3
  */
@@ -11,10 +10,6 @@ export declare function isValidUserAgent(userAgent: string): boolean;
11
10
  * Validate payload string
12
11
  */
13
12
  export declare function isValidPayload(payloadStr: string): boolean;
14
- /**
15
- * Try to mask PPI and potential sensible attributes
16
- */
17
- export declare function maskSuspiciousAttributes(payload: EventPayload): string;
18
13
  /**
19
14
  * Check if current environment is a test environment
20
15
  */
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uuidv4 = uuidv4;
4
4
  exports.isValidUserAgent = isValidUserAgent;
5
5
  exports.isValidPayload = isValidPayload;
6
- exports.maskSuspiciousAttributes = maskSuspiciousAttributes;
7
6
  exports.isTestEnvironment = isTestEnvironment;
8
7
  exports.each = each;
9
8
  exports.addEventListener = addEventListener;
10
- const constants_1 = require("../constants");
11
9
  /**
12
10
  * Generate uuid to identify the session. Random, not data-derived
13
11
  */
@@ -40,17 +38,6 @@ function isValidPayload(payloadStr) {
40
38
  }
41
39
  return true;
42
40
  }
43
- /**
44
- * Try to mask PPI and potential sensible attributes
45
- */
46
- function maskSuspiciousAttributes(payload) {
47
- // Deep copy
48
- let _payload = JSON.stringify(payload);
49
- constants_1.ATTRIBUTES_TO_MASK.forEach((attr) => {
50
- _payload = _payload.replace(new RegExp(`("${attr}"):(".+?"|\\d+)`, "gmi"), '$1:"********"');
51
- });
52
- return _payload;
53
- }
54
41
  /**
55
42
  * Check if current environment is a test environment
56
43
  */
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Patch utility for wrapping native methods
3
- * Based on PostHog's patch implementation from rrweb
4
3
  */
5
4
  export declare function patch(source: {
6
5
  [key: string]: any;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
3
  * Patch utility for wrapping native methods
4
- * Based on PostHog's patch implementation from rrweb
5
4
  */
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  exports.patch = patch;