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