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