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