@devskin/browser-sdk 1.0.5 → 1.0.7
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/devskin.cjs.js +8 -11
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +8 -11
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +8 -11
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +2 -2
- package/dist/devskin.umd.min.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/recorder/rrweb.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.cjs.js
CHANGED
|
@@ -5005,15 +5005,16 @@ class RRWebRecorder {
|
|
|
5005
5005
|
console.log('[RRWeb] Starting session recording:', this.sessionId);
|
|
5006
5006
|
this.stopFn = record({
|
|
5007
5007
|
emit: (event) => {
|
|
5008
|
+
this.events.push(event);
|
|
5008
5009
|
// Check if this is a FullSnapshot (type 2)
|
|
5009
5010
|
if (event.type === 2) {
|
|
5010
5011
|
this.hasFullSnapshot = true;
|
|
5011
|
-
console.log('[RRWeb] FullSnapshot captured!
|
|
5012
|
+
console.log('[RRWeb] FullSnapshot captured! Sending immediately...');
|
|
5013
|
+
// Send immediately to ensure FullSnapshot reaches backend first
|
|
5014
|
+
this.flush();
|
|
5012
5015
|
}
|
|
5013
|
-
this.events.
|
|
5014
|
-
|
|
5015
|
-
// This ensures the first batch always contains the full DOM
|
|
5016
|
-
if (this.hasFullSnapshot && this.events.length >= 50) {
|
|
5016
|
+
else if (this.hasFullSnapshot && this.events.length >= 50) {
|
|
5017
|
+
// After FullSnapshot, batch other events
|
|
5017
5018
|
this.flush();
|
|
5018
5019
|
}
|
|
5019
5020
|
},
|
|
@@ -5517,15 +5518,11 @@ class DevSkinSDK {
|
|
|
5517
5518
|
window.addEventListener('beforeunload', () => {
|
|
5518
5519
|
var _a, _b;
|
|
5519
5520
|
this.track('page_unload');
|
|
5520
|
-
// Send session end update with duration
|
|
5521
|
+
// Send session end update with duration AND context data
|
|
5521
5522
|
if (this.sessionId && this.sessionStartTime) {
|
|
5522
5523
|
const endedAt = new Date();
|
|
5523
5524
|
const durationMs = Date.now() - this.sessionStartTime;
|
|
5524
|
-
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.startSession({
|
|
5525
|
-
session_id: this.sessionId,
|
|
5526
|
-
ended_at: endedAt.toISOString(),
|
|
5527
|
-
duration_ms: durationMs,
|
|
5528
|
-
});
|
|
5525
|
+
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.startSession(Object.assign({ session_id: this.sessionId, user_id: this.userId || undefined, anonymous_id: this.anonymousId, ended_at: endedAt.toISOString(), duration_ms: durationMs }, this.getContextData()));
|
|
5529
5526
|
}
|
|
5530
5527
|
// Send any pending data
|
|
5531
5528
|
(_b = this.transport) === null || _b === void 0 ? void 0 : _b.flush(true); // Use beacon for reliability
|