@zaplier/sdk 1.2.4 → 1.2.5

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.esm.js CHANGED
@@ -6988,10 +6988,10 @@ class SessionReplayEngine {
6988
6988
  this.sessionId = sessionId;
6989
6989
  this.config = {
6990
6990
  enabled: true,
6991
- sampleRate: 0.1,
6991
+ sampleRate: 1.0, // 100% for development/testing
6992
6992
  maskSensitiveFields: true,
6993
6993
  maxEventBuffer: 1000,
6994
- batchInterval: 5000,
6994
+ batchInterval: 2000, // Send every 2 seconds for faster testing
6995
6995
  captureClicks: true,
6996
6996
  captureScrolls: true,
6997
6997
  captureInputs: true,
@@ -7276,19 +7276,35 @@ class SessionReplayEngine {
7276
7276
  try {
7277
7277
  // Try WebRTC first if anti-adblock manager is available
7278
7278
  if (this.antiAdblockManager) {
7279
- const result = await this.antiAdblockManager.send(payload, '/api/replay/record');
7279
+ const result = await this.antiAdblockManager.send(payload, '/replays/record');
7280
7280
  if (result.success) {
7281
7281
  return; // Success via WebRTC
7282
7282
  }
7283
7283
  }
7284
+ // Get API endpoint from global config
7285
+ const apiEndpoint = window.zaplier_config?.apiEndpoint || 'http://localhost:3001';
7286
+ const token = window.zaplier_config?.token || '';
7284
7287
  // Fallback to standard fetch
7285
- const response = await fetch('/api/replay/record', {
7288
+ const response = await fetch(`${apiEndpoint}/replays/record?token=${token}`, {
7286
7289
  method: 'POST',
7287
7290
  headers: { 'Content-Type': 'application/json' },
7288
- body: JSON.stringify(payload)
7291
+ body: JSON.stringify({
7292
+ sessionId: payload.sessionId,
7293
+ events: payload.events,
7294
+ metadata: {
7295
+ startUrl: window.location.href,
7296
+ duration: Date.now() - (performance.timeOrigin || Date.now()),
7297
+ funnelSteps: [],
7298
+ hasConversion: false,
7299
+ ...payload.metadata
7300
+ }
7301
+ })
7289
7302
  });
7290
7303
  if (!response.ok) {
7291
- console.warn('[Zaplier] Session replay batch failed to send');
7304
+ console.warn('[Zaplier] Session replay batch failed to send:', response.status);
7305
+ }
7306
+ else {
7307
+ console.log('[Zaplier] Session replay batch sent successfully');
7292
7308
  }
7293
7309
  }
7294
7310
  catch (error) {