@devskin/browser-sdk 1.0.28 → 1.0.30
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 +42 -8
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +42 -8
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +42 -8
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +1 -1
- package/dist/devskin.umd.min.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.esm.js
CHANGED
|
@@ -13692,7 +13692,7 @@ class Transport {
|
|
|
13692
13692
|
}
|
|
13693
13693
|
const items = [...this.queue];
|
|
13694
13694
|
this.queue = [];
|
|
13695
|
-
// Group
|
|
13695
|
+
// Group by type
|
|
13696
13696
|
const grouped = {};
|
|
13697
13697
|
items.forEach((item) => {
|
|
13698
13698
|
if (!grouped[item.type]) {
|
|
@@ -13700,19 +13700,35 @@ class Transport {
|
|
|
13700
13700
|
}
|
|
13701
13701
|
grouped[item.type].push(item.data);
|
|
13702
13702
|
});
|
|
13703
|
-
// Send each
|
|
13704
|
-
Object.entries(grouped).forEach(([type,
|
|
13703
|
+
// Send each type appropriately
|
|
13704
|
+
Object.entries(grouped).forEach(([type, dataArray]) => {
|
|
13705
13705
|
const endpoint = this.getEndpointForType(type);
|
|
13706
|
-
|
|
13706
|
+
if (type === 'event' && dataArray.length > 1) {
|
|
13707
|
+
// Events with batch support
|
|
13708
|
+
this.sendToBackend('/v1/rum/events/batch', { events: dataArray }, useBeacon);
|
|
13709
|
+
}
|
|
13710
|
+
else if (type === 'heatmap') {
|
|
13711
|
+
// Heatmap expects array format
|
|
13712
|
+
this.sendToBackend(endpoint, { heatmaps: dataArray }, useBeacon);
|
|
13713
|
+
}
|
|
13714
|
+
else {
|
|
13715
|
+
// Send each item individually (network, performance, error)
|
|
13716
|
+
dataArray.forEach((data) => {
|
|
13717
|
+
this.sendToBackend(endpoint, data, useBeacon);
|
|
13718
|
+
});
|
|
13719
|
+
}
|
|
13707
13720
|
});
|
|
13708
13721
|
if (this.config.debug) {
|
|
13709
13722
|
console.log(`[DevSkin] Flushed ${items.length} items to backend`);
|
|
13710
13723
|
}
|
|
13711
13724
|
}
|
|
13712
13725
|
enqueue(type, data) {
|
|
13726
|
+
// Add applicationId to RUM events (event, error, network, performance)
|
|
13727
|
+
// Heatmap uses apiKey/appId in payload root instead
|
|
13728
|
+
const enrichedData = type !== 'heatmap' ? Object.assign(Object.assign({}, data), { applicationId: this.config.appId }) : data;
|
|
13713
13729
|
this.queue.push({
|
|
13714
13730
|
type,
|
|
13715
|
-
data,
|
|
13731
|
+
data: enrichedData,
|
|
13716
13732
|
timestamp: Date.now(),
|
|
13717
13733
|
});
|
|
13718
13734
|
// Flush if queue is full
|
|
@@ -14111,15 +14127,33 @@ class DevSkinSDK {
|
|
|
14111
14127
|
}
|
|
14112
14128
|
}
|
|
14113
14129
|
getContextData() {
|
|
14130
|
+
var _a, _b, _c, _d;
|
|
14114
14131
|
const context = {};
|
|
14132
|
+
// Flatten device data to match backend schema
|
|
14115
14133
|
if (this.deviceCollector) {
|
|
14116
|
-
|
|
14134
|
+
const device = this.deviceCollector.collect();
|
|
14135
|
+
context.deviceType = device.type;
|
|
14136
|
+
context.deviceModel = device.model;
|
|
14137
|
+
context.osName = (_a = device.os) === null || _a === void 0 ? void 0 : _a.name;
|
|
14138
|
+
context.osVersion = (_b = device.os) === null || _b === void 0 ? void 0 : _b.version;
|
|
14139
|
+
context.screenWidth = (_c = device.screen) === null || _c === void 0 ? void 0 : _c.width;
|
|
14140
|
+
context.screenHeight = (_d = device.screen) === null || _d === void 0 ? void 0 : _d.height;
|
|
14141
|
+
context.viewportWidth = window.innerWidth;
|
|
14142
|
+
context.viewportHeight = window.innerHeight;
|
|
14117
14143
|
}
|
|
14144
|
+
// Flatten browser data to match backend schema
|
|
14118
14145
|
if (this.browserCollector) {
|
|
14119
|
-
|
|
14146
|
+
const browser = this.browserCollector.collect();
|
|
14147
|
+
context.browserName = browser.name;
|
|
14148
|
+
context.browserVersion = browser.version;
|
|
14149
|
+
context.userAgent = browser.userAgent;
|
|
14120
14150
|
}
|
|
14151
|
+
// Flatten location data to match backend schema
|
|
14121
14152
|
if (this.locationCollector) {
|
|
14122
|
-
|
|
14153
|
+
const location = this.locationCollector.collect();
|
|
14154
|
+
context.country = location.country;
|
|
14155
|
+
context.city = location.city;
|
|
14156
|
+
context.ipAddress = undefined; // Will be set by backend from request
|
|
14123
14157
|
}
|
|
14124
14158
|
return context;
|
|
14125
14159
|
}
|