@devskin/browser-sdk 1.0.27 → 1.0.29
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 +41 -20
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +41 -20
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +41 -20
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +3 -3
- 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/dist/types.d.ts +21 -20
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.cjs.js
CHANGED
|
@@ -515,7 +515,7 @@ class ErrorCollector {
|
|
|
515
515
|
stack: error.stack,
|
|
516
516
|
type: error.name || 'Error',
|
|
517
517
|
timestamp: new Date().toISOString(),
|
|
518
|
-
|
|
518
|
+
sessionId: '', // Will be set by transport
|
|
519
519
|
url: window.location.href,
|
|
520
520
|
breadcrumbs: [...this.breadcrumbs],
|
|
521
521
|
context: Object.assign(Object.assign({}, context), { userAgent: navigator.userAgent, viewport: {
|
|
@@ -538,7 +538,7 @@ class ErrorCollector {
|
|
|
538
538
|
message: String(error),
|
|
539
539
|
type: 'Error',
|
|
540
540
|
timestamp: new Date().toISOString(),
|
|
541
|
-
|
|
541
|
+
sessionId: '',
|
|
542
542
|
url: window.location.href,
|
|
543
543
|
breadcrumbs: [...this.breadcrumbs],
|
|
544
544
|
context,
|
|
@@ -13714,9 +13714,12 @@ class Transport {
|
|
|
13714
13714
|
}
|
|
13715
13715
|
}
|
|
13716
13716
|
enqueue(type, data) {
|
|
13717
|
+
// Add applicationId to RUM events (event, error, network, performance)
|
|
13718
|
+
// Heatmap uses apiKey/appId in payload root instead
|
|
13719
|
+
const enrichedData = type !== 'heatmap' ? Object.assign(Object.assign({}, data), { applicationId: this.config.appId }) : data;
|
|
13717
13720
|
this.queue.push({
|
|
13718
13721
|
type,
|
|
13719
|
-
data,
|
|
13722
|
+
data: enrichedData,
|
|
13720
13723
|
timestamp: Date.now(),
|
|
13721
13724
|
});
|
|
13722
13725
|
// Flush if queue is full
|
|
@@ -13748,7 +13751,7 @@ class Transport {
|
|
|
13748
13751
|
sendToBackendXHR(endpoint, data) {
|
|
13749
13752
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
13750
13753
|
const url = `${this.apiUrl}${endpoint}`;
|
|
13751
|
-
const payload = Object.assign(Object.assign({}, data), { apiKey: this.config.apiKey,
|
|
13754
|
+
const payload = Object.assign(Object.assign({}, data), { apiKey: this.config.apiKey, applicationId: this.config.appId, environment: this.config.environment, release: this.config.release });
|
|
13752
13755
|
// Apply beforeSend hook if provided
|
|
13753
13756
|
if (this.config.beforeSend) {
|
|
13754
13757
|
const processed = this.config.beforeSend(payload);
|
|
@@ -13798,7 +13801,7 @@ class Transport {
|
|
|
13798
13801
|
sendToBackend(endpoint_1, data_1) {
|
|
13799
13802
|
return __awaiter$1(this, arguments, void 0, function* (endpoint, data, useBeacon = false) {
|
|
13800
13803
|
const url = `${this.apiUrl}${endpoint}`;
|
|
13801
|
-
const payload = Object.assign(Object.assign({}, data), { apiKey: this.config.apiKey,
|
|
13804
|
+
const payload = Object.assign(Object.assign({}, data), { apiKey: this.config.apiKey, applicationId: this.config.appId, environment: this.config.environment, release: this.config.release });
|
|
13802
13805
|
// Apply beforeSend hook if provided
|
|
13803
13806
|
if (this.config.beforeSend) {
|
|
13804
13807
|
const processed = this.config.beforeSend(payload);
|
|
@@ -13982,15 +13985,15 @@ class DevSkinSDK {
|
|
|
13982
13985
|
return;
|
|
13983
13986
|
}
|
|
13984
13987
|
const eventData = {
|
|
13985
|
-
|
|
13986
|
-
|
|
13988
|
+
eventName: eventName,
|
|
13989
|
+
eventType: 'track',
|
|
13987
13990
|
timestamp: new Date().toISOString(),
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
+
sessionId: this.sessionId,
|
|
13992
|
+
userId: this.userId || undefined,
|
|
13993
|
+
anonymousId: this.anonymousId || undefined,
|
|
13991
13994
|
properties: Object.assign(Object.assign({}, properties), this.getContextData()),
|
|
13992
|
-
|
|
13993
|
-
|
|
13995
|
+
pageUrl: window.location.href,
|
|
13996
|
+
pageTitle: document.title,
|
|
13994
13997
|
};
|
|
13995
13998
|
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendEvent(eventData);
|
|
13996
13999
|
if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.debug) {
|
|
@@ -14031,10 +14034,10 @@ class DevSkinSDK {
|
|
|
14031
14034
|
}
|
|
14032
14035
|
this.userId = userId;
|
|
14033
14036
|
const userData = {
|
|
14034
|
-
|
|
14035
|
-
|
|
14037
|
+
userId: userId,
|
|
14038
|
+
anonymousId: this.anonymousId || undefined,
|
|
14036
14039
|
traits: Object.assign(Object.assign({}, traits), this.getContextData()),
|
|
14037
|
-
|
|
14040
|
+
sessionId: this.sessionId,
|
|
14038
14041
|
timestamp: new Date().toISOString(),
|
|
14039
14042
|
};
|
|
14040
14043
|
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.identifyUser(userData);
|
|
@@ -14108,22 +14111,40 @@ class DevSkinSDK {
|
|
|
14108
14111
|
// Store in sessionStorage (persists across page navigations in same tab)
|
|
14109
14112
|
sessionStorage.setItem('devskin_session_id', this.sessionId);
|
|
14110
14113
|
sessionStorage.setItem('devskin_session_start', this.sessionStartTime.toString());
|
|
14111
|
-
const sessionData = Object.assign({
|
|
14114
|
+
const sessionData = Object.assign({ sessionId: this.sessionId, userId: this.userId || undefined, anonymousId: this.anonymousId, startedAt: new Date().toISOString(), platform: 'web' }, this.getContextData());
|
|
14112
14115
|
(_b = this.transport) === null || _b === void 0 ? void 0 : _b.startSession(sessionData);
|
|
14113
14116
|
if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.debug) {
|
|
14114
14117
|
console.log('[DevSkin] New session created:', this.sessionId);
|
|
14115
14118
|
}
|
|
14116
14119
|
}
|
|
14117
14120
|
getContextData() {
|
|
14121
|
+
var _a, _b, _c, _d;
|
|
14118
14122
|
const context = {};
|
|
14123
|
+
// Flatten device data to match backend schema
|
|
14119
14124
|
if (this.deviceCollector) {
|
|
14120
|
-
|
|
14125
|
+
const device = this.deviceCollector.collect();
|
|
14126
|
+
context.deviceType = device.type;
|
|
14127
|
+
context.deviceModel = device.model;
|
|
14128
|
+
context.osName = (_a = device.os) === null || _a === void 0 ? void 0 : _a.name;
|
|
14129
|
+
context.osVersion = (_b = device.os) === null || _b === void 0 ? void 0 : _b.version;
|
|
14130
|
+
context.screenWidth = (_c = device.screen) === null || _c === void 0 ? void 0 : _c.width;
|
|
14131
|
+
context.screenHeight = (_d = device.screen) === null || _d === void 0 ? void 0 : _d.height;
|
|
14132
|
+
context.viewportWidth = window.innerWidth;
|
|
14133
|
+
context.viewportHeight = window.innerHeight;
|
|
14121
14134
|
}
|
|
14135
|
+
// Flatten browser data to match backend schema
|
|
14122
14136
|
if (this.browserCollector) {
|
|
14123
|
-
|
|
14137
|
+
const browser = this.browserCollector.collect();
|
|
14138
|
+
context.browserName = browser.name;
|
|
14139
|
+
context.browserVersion = browser.version;
|
|
14140
|
+
context.userAgent = browser.userAgent;
|
|
14124
14141
|
}
|
|
14142
|
+
// Flatten location data to match backend schema
|
|
14125
14143
|
if (this.locationCollector) {
|
|
14126
|
-
|
|
14144
|
+
const location = this.locationCollector.collect();
|
|
14145
|
+
context.country = location.country;
|
|
14146
|
+
context.city = location.city;
|
|
14147
|
+
context.ipAddress = undefined; // Will be set by backend from request
|
|
14127
14148
|
}
|
|
14128
14149
|
return context;
|
|
14129
14150
|
}
|
|
@@ -14169,7 +14190,7 @@ class DevSkinSDK {
|
|
|
14169
14190
|
if (this.sessionId && this.sessionStartTime) {
|
|
14170
14191
|
const endedAt = new Date();
|
|
14171
14192
|
const durationMs = Date.now() - this.sessionStartTime;
|
|
14172
|
-
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.startSession(Object.assign({
|
|
14193
|
+
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.startSession(Object.assign({ sessionId: this.sessionId, userId: this.userId || undefined, anonymousId: this.anonymousId, endedAt: endedAt.toISOString(), durationMs: durationMs, platform: 'web' }, this.getContextData()));
|
|
14173
14194
|
// Clear session storage since session is ending
|
|
14174
14195
|
sessionStorage.removeItem('devskin_session_id');
|
|
14175
14196
|
sessionStorage.removeItem('devskin_session_start');
|