crexperium-sdk 1.1.0 → 1.1.1

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/index.js CHANGED
@@ -13192,10 +13192,14 @@ class SessionReplayPlugin {
13192
13192
  */
13193
13193
  async init() {
13194
13194
  try {
13195
+ console.log('[SessionReplay] Initializing session replay...');
13195
13196
  // Start session on backend
13196
13197
  await this.startSession();
13198
+ console.log('[SessionReplay] Session started on backend, sessionId:', this.session?.sessionId);
13197
13199
  // Start rrweb recording
13200
+ console.log('[SessionReplay] Starting rrweb recording...');
13198
13201
  this.startRrwebRecording();
13202
+ console.log('[SessionReplay] rrweb recording started');
13199
13203
  // Intercept console methods
13200
13204
  if (this.config.telemetry?.captureConsole) {
13201
13205
  this.interceptConsole();
@@ -13267,9 +13271,18 @@ class SessionReplayPlugin {
13267
13271
  startRrwebRecording() {
13268
13272
  this.stopRecording = record({
13269
13273
  emit: (event) => {
13274
+ // Debug: Log event types
13275
+ if (event.type === 4) {
13276
+ console.log('[SessionReplay] Captured Meta event (type 4)');
13277
+ }
13278
+ else if (event.type === 2) {
13279
+ console.log('[SessionReplay] Captured Full Snapshot event (type 2)');
13280
+ }
13270
13281
  this.eventBuffer.push(event);
13282
+ console.log(`[SessionReplay] Event buffered. Type: ${event.type}, Buffer size: ${this.eventBuffer.length}`);
13271
13283
  // Auto-flush if buffer reaches max size
13272
13284
  if (this.eventBuffer.length >= (this.config.buffering?.maxBufferSize || 100)) {
13285
+ console.log('[SessionReplay] Buffer full, flushing...');
13273
13286
  this.flush();
13274
13287
  }
13275
13288
  },
@@ -13611,9 +13624,16 @@ class SessionReplayPlugin {
13611
13624
  * Flush buffered events to backend
13612
13625
  */
13613
13626
  async flush() {
13614
- if (!this.session || (this.eventBuffer.length === 0 && this.telemetryBuffer.length === 0)) {
13627
+ console.log(`[SessionReplay] flush() called. Session: ${!!this.session}, Event buffer: ${this.eventBuffer.length}, Telemetry buffer: ${this.telemetryBuffer.length}`);
13628
+ if (!this.session) {
13629
+ console.warn('[SessionReplay] flush() skipped - no session yet!');
13630
+ return;
13631
+ }
13632
+ if (this.eventBuffer.length === 0 && this.telemetryBuffer.length === 0) {
13633
+ console.log('[SessionReplay] flush() skipped - buffers empty');
13615
13634
  return;
13616
13635
  }
13636
+ console.log(`[SessionReplay] Flushing ${this.eventBuffer.length} events to backend...`);
13617
13637
  const eventsToSend = [...this.eventBuffer];
13618
13638
  const telemetryToSend = [...this.telemetryBuffer];
13619
13639
  // Clear buffers