@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 +22 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +22 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/sdk.js +22 -6
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.min.js +1 -1
- package/dist/src/modules/session-replay.d.ts.map +1 -1
- package/package.json +1 -1
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
|
|
6991
|
+
sampleRate: 1.0, // 100% for development/testing
|
|
6992
6992
|
maskSensitiveFields: true,
|
|
6993
6993
|
maxEventBuffer: 1000,
|
|
6994
|
-
batchInterval:
|
|
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, '/
|
|
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(
|
|
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(
|
|
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) {
|