@monoscopetech/browser 0.5.6 → 0.5.7

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/dist/replay.d.ts CHANGED
@@ -13,9 +13,6 @@ export declare class MonoscopeReplay {
13
13
  private handleVisibilityChange;
14
14
  configure(): void;
15
15
  save(forceSynchronous?: boolean): Promise<void>;
16
- /**
17
- * Stop recording and clean up
18
- */
19
16
  stop(): void;
20
17
  getEventCount(): number;
21
18
  getSessionId(): string;
package/dist/replay.js CHANGED
@@ -42,21 +42,13 @@ export class MonoscopeReplay {
42
42
  try {
43
43
  this.stopRecording = rrweb.record({
44
44
  emit: (event) => {
45
- // Don't record if we're in a weird state
46
- if (!event || typeof event !== "object") {
47
- console.warn("Invalid event received:", event);
48
- return;
49
- }
50
45
  this.events.push(event);
51
46
  // Auto-save when batch size reached
52
47
  if (this.events.length >= MAX_EVENT_BATCH) {
53
48
  this.save();
54
49
  }
55
50
  },
56
- // Prevent recording replay UI elements
57
51
  blockClass: "rr-block",
58
- blockSelector: "#replay-container, .replay-ui, [data-rrweb-ignore]",
59
- // Privacy settings
60
52
  maskAllInputs: true,
61
53
  maskInputOptions: {
62
54
  password: true,
@@ -83,7 +75,6 @@ export class MonoscopeReplay {
83
75
  media: 800,
84
76
  input: "last", // Only capture final input value
85
77
  },
86
- // Console plugin
87
78
  plugins: [
88
79
  getRecordConsolePlugin({
89
80
  level: ["info", "log", "warn", "error"],
@@ -96,7 +87,6 @@ export class MonoscopeReplay {
96
87
  }),
97
88
  ],
98
89
  });
99
- // Setup periodic save
100
90
  this.saveInterval = setInterval(() => {
101
91
  this.save();
102
92
  }, SAVE_INTERVAL);
@@ -109,15 +99,12 @@ export class MonoscopeReplay {
109
99
  }
110
100
  }
111
101
  async save(forceSynchronous = false) {
112
- // Prevent concurrent saves
113
102
  if (this.isSaving && !forceSynchronous) {
114
103
  return;
115
104
  }
116
- // Nothing to save
117
105
  if (this.events.length === 0) {
118
106
  return;
119
107
  }
120
- // Prevent event array from growing too large during failed saves
121
108
  if (this.events.length > MAX_RETRY_EVENTS) {
122
109
  console.warn(`Event queue exceeded ${MAX_RETRY_EVENTS}, dropping oldest events`);
123
110
  this.events = this.events.slice(-MAX_RETRY_EVENTS);
@@ -138,7 +125,6 @@ export class MonoscopeReplay {
138
125
  };
139
126
  try {
140
127
  if (forceSynchronous && navigator.sendBeacon) {
141
- // Use sendBeacon for unload events (more reliable)
142
128
  const blob = new Blob([JSON.stringify(payload)], {
143
129
  type: "application/json",
144
130
  });
@@ -155,7 +141,7 @@ export class MonoscopeReplay {
155
141
  "Content-Type": "application/json",
156
142
  },
157
143
  body: JSON.stringify(payload),
158
- keepalive: true, // Important for unload scenarios
144
+ keepalive: true,
159
145
  });
160
146
  if (!response.ok) {
161
147
  throw new Error(`Failed to save replay events: ${response.status} ${response.statusText}`);
@@ -174,9 +160,6 @@ export class MonoscopeReplay {
174
160
  this.isSaving = false;
175
161
  }
176
162
  }
177
- /**
178
- * Stop recording and clean up
179
- */
180
163
  stop() {
181
164
  this.save(true);
182
165
  if (this.stopRecording) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoscopetech/browser",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",