@watchforge/browser 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@watchforge/browser",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "main": "./src/index.js",
5
5
  "types": "./src/index.d.ts",
6
6
  "description": "WatchForge JavaScript SDK for browser JavaScript, Next.js, React, Node.js, and Express.js",
package/src/contexts.js CHANGED
@@ -7,7 +7,7 @@ const isNode =
7
7
  typeof process !== "undefined" && process.versions && process.versions.node;
8
8
 
9
9
  export const SDK_NAME = "@watchforge/browser";
10
- export const SDK_VERSION = "0.1.12";
10
+ export const SDK_VERSION = "0.1.24";
11
11
 
12
12
  export function getSdkMetadata() {
13
13
  return {
package/src/replay.js CHANGED
@@ -41,17 +41,11 @@ function shouldSample(rate) {
41
41
  }
42
42
 
43
43
  function trimBuffer(now = Date.now()) {
44
- events = events.filter((event) => now - event.timestamp <= MAX_BUFFER_MS);
45
- if (events.length <= MAX_EVENTS) return;
46
-
47
- const tail = events.slice(-MAX_EVENTS);
48
- if (tail.some((event) => event.type === RRWEB_FULL_SNAPSHOT)) {
49
- events = tail;
50
- return;
51
- }
52
-
53
44
  const fullSnapshotIndex = findLastEventIndex(events, RRWEB_FULL_SNAPSHOT);
54
45
  if (fullSnapshotIndex === -1) {
46
+ events = events.filter((event) => now - event.timestamp <= MAX_BUFFER_MS);
47
+ if (events.length <= MAX_EVENTS) return;
48
+ const tail = events.slice(-MAX_EVENTS);
55
49
  events = tail;
56
50
  return;
57
51
  }
@@ -65,8 +59,10 @@ function trimBuffer(now = Date.now()) {
65
59
  events[fullSnapshotIndex],
66
60
  ];
67
61
  const remainingSlots = Math.max(MAX_EVENTS - anchorEvents.length, 0);
62
+
68
63
  const recentEvents = events
69
64
  .slice(fullSnapshotIndex + 1)
65
+ .filter((event) => now - event.timestamp <= MAX_BUFFER_MS)
70
66
  .slice(-remainingSlots);
71
67
 
72
68
  events = [...anchorEvents, ...recentEvents].sort(
@@ -178,7 +174,7 @@ export function flushReplayForEvent(dsn, eventId) {
178
174
  events,
179
175
  sdk: {
180
176
  name: "@watchforge/browser",
181
- version: "0.1.22",
177
+ version: "0.1.24",
182
178
  },
183
179
  };
184
180
 
package/src/tracing.js CHANGED
@@ -135,7 +135,7 @@ class Transaction {
135
135
  request: this.request,
136
136
  platform: typeof window !== "undefined" ? "javascript" : "node",
137
137
  sdk_name: "watchforge-javascript",
138
- sdk_version: "0.1.12",
138
+ sdk_version: "0.1.24",
139
139
  };
140
140
 
141
141
  if (DEBUG) {