@devskin/browser-sdk 1.0.46 → 1.0.48
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 +14 -28
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +14 -28
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +14 -28
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +4 -4
- package/dist/devskin.umd.min.js.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.cjs.js
CHANGED
|
@@ -13625,37 +13625,21 @@ class Transport {
|
|
|
13625
13625
|
}
|
|
13626
13626
|
sendRecordingEvents(sessionId, events) {
|
|
13627
13627
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
13628
|
-
// Calculate payload size
|
|
13629
|
-
const payload = {
|
|
13630
|
-
session_id: sessionId,
|
|
13631
|
-
events,
|
|
13632
|
-
timestamp: new Date().toISOString(),
|
|
13633
|
-
apiKey: this.config.apiKey,
|
|
13634
|
-
appId: this.config.appId,
|
|
13635
|
-
};
|
|
13636
|
-
const payloadSize = new Blob([JSON.stringify(payload)]).size;
|
|
13637
13628
|
// Check if this batch contains FullSnapshot (type 2)
|
|
13638
13629
|
const hasFullSnapshot = events.some(e => e.type === 2);
|
|
13639
|
-
const maxRetries = hasFullSnapshot ? 3 : 1;
|
|
13640
|
-
//
|
|
13630
|
+
const maxRetries = hasFullSnapshot ? 3 : 1;
|
|
13631
|
+
// ALWAYS use XHR for recording events to avoid fetch keepalive 64KB limit
|
|
13632
|
+
// The browser silently drops fetch requests with keepalive:true when body > 64KB
|
|
13633
|
+
// FullSnapshot + Meta events commonly fall in the 64KB-100KB range,
|
|
13634
|
+
// causing them to be silently lost while smaller IncrementalSnapshot batches succeed
|
|
13641
13635
|
let lastError = null;
|
|
13642
13636
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
13643
13637
|
try {
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
timestamp: new Date().toISOString(),
|
|
13650
|
-
});
|
|
13651
|
-
}
|
|
13652
|
-
else {
|
|
13653
|
-
yield this.sendToBackend('/v1/rum/recordings', {
|
|
13654
|
-
session_id: sessionId,
|
|
13655
|
-
events,
|
|
13656
|
-
timestamp: new Date().toISOString(),
|
|
13657
|
-
});
|
|
13658
|
-
}
|
|
13638
|
+
yield this.sendToBackendXHR('/v1/rum/recordings', {
|
|
13639
|
+
session_id: sessionId,
|
|
13640
|
+
events,
|
|
13641
|
+
timestamp: new Date().toISOString(),
|
|
13642
|
+
});
|
|
13659
13643
|
return; // Success, exit
|
|
13660
13644
|
}
|
|
13661
13645
|
catch (error) {
|
|
@@ -13779,7 +13763,8 @@ class Transport {
|
|
|
13779
13763
|
const xhr = new XMLHttpRequest();
|
|
13780
13764
|
xhr.open('POST', url, true);
|
|
13781
13765
|
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
13782
|
-
xhr.setRequestHeader('
|
|
13766
|
+
xhr.setRequestHeader('X-API-Key', this.config.apiKey);
|
|
13767
|
+
xhr.setRequestHeader('X-App-Id', this.config.appId);
|
|
13783
13768
|
xhr.onload = () => {
|
|
13784
13769
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
13785
13770
|
if (this.config.debug) {
|
|
@@ -13839,7 +13824,8 @@ class Transport {
|
|
|
13839
13824
|
method: 'POST',
|
|
13840
13825
|
headers: {
|
|
13841
13826
|
'Content-Type': 'application/json',
|
|
13842
|
-
|
|
13827
|
+
'X-API-Key': this.config.apiKey,
|
|
13828
|
+
'X-App-Id': this.config.appId,
|
|
13843
13829
|
},
|
|
13844
13830
|
body: JSON.stringify(payload),
|
|
13845
13831
|
// Use keepalive for better reliability during page unload
|