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