@bbearai/core 0.5.2 → 0.5.4
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/index.js +15 -12
- package/dist/index.mjs +15 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -114,7 +114,7 @@ var ContextCaptureManager = class {
|
|
|
114
114
|
if (this.navigationHistory.length > 0) {
|
|
115
115
|
return this.navigationHistory[this.navigationHistory.length - 1];
|
|
116
116
|
}
|
|
117
|
-
if (typeof window !== "undefined") {
|
|
117
|
+
if (typeof window !== "undefined" && window.location) {
|
|
118
118
|
return window.location.pathname;
|
|
119
119
|
}
|
|
120
120
|
return "unknown";
|
|
@@ -226,7 +226,7 @@ var ContextCaptureManager = class {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
captureNavigation() {
|
|
229
|
-
if (typeof window === "undefined" || typeof history === "undefined") return;
|
|
229
|
+
if (typeof window === "undefined" || typeof history === "undefined" || !window.location) return;
|
|
230
230
|
this.trackNavigation(window.location.pathname);
|
|
231
231
|
const self = this;
|
|
232
232
|
this.originalPushState = history.pushState;
|
|
@@ -264,13 +264,13 @@ var ContextCaptureManager = class {
|
|
|
264
264
|
return Object.keys(metrics).length > 0 ? metrics : void 0;
|
|
265
265
|
}
|
|
266
266
|
getEnvironmentInfo() {
|
|
267
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return void 0;
|
|
267
|
+
if (typeof window === "undefined" || typeof navigator === "undefined" || typeof document === "undefined") return void 0;
|
|
268
268
|
return {
|
|
269
269
|
language: navigator.language,
|
|
270
270
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
271
|
-
cookiesEnabled: navigator.cookieEnabled,
|
|
271
|
+
cookiesEnabled: navigator.cookieEnabled ?? false,
|
|
272
272
|
localStorage: typeof localStorage !== "undefined",
|
|
273
|
-
online: navigator.onLine
|
|
273
|
+
online: navigator.onLine ?? true
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
};
|
|
@@ -1621,15 +1621,18 @@ var BugBearClient = class {
|
|
|
1621
1621
|
* Get device info (override in platform-specific implementations)
|
|
1622
1622
|
*/
|
|
1623
1623
|
getDeviceInfo() {
|
|
1624
|
-
if (typeof window !== "undefined") {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
userAgent
|
|
1628
|
-
|
|
1624
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
1625
|
+
const info = { platform: "web" };
|
|
1626
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
1627
|
+
info.userAgent = navigator.userAgent;
|
|
1628
|
+
}
|
|
1629
|
+
if (window.screen) {
|
|
1630
|
+
info.screenSize = {
|
|
1629
1631
|
width: window.screen.width,
|
|
1630
1632
|
height: window.screen.height
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
return info;
|
|
1633
1636
|
}
|
|
1634
1637
|
return { platform: "web" };
|
|
1635
1638
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -80,7 +80,7 @@ var ContextCaptureManager = class {
|
|
|
80
80
|
if (this.navigationHistory.length > 0) {
|
|
81
81
|
return this.navigationHistory[this.navigationHistory.length - 1];
|
|
82
82
|
}
|
|
83
|
-
if (typeof window !== "undefined") {
|
|
83
|
+
if (typeof window !== "undefined" && window.location) {
|
|
84
84
|
return window.location.pathname;
|
|
85
85
|
}
|
|
86
86
|
return "unknown";
|
|
@@ -192,7 +192,7 @@ var ContextCaptureManager = class {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
captureNavigation() {
|
|
195
|
-
if (typeof window === "undefined" || typeof history === "undefined") return;
|
|
195
|
+
if (typeof window === "undefined" || typeof history === "undefined" || !window.location) return;
|
|
196
196
|
this.trackNavigation(window.location.pathname);
|
|
197
197
|
const self = this;
|
|
198
198
|
this.originalPushState = history.pushState;
|
|
@@ -230,13 +230,13 @@ var ContextCaptureManager = class {
|
|
|
230
230
|
return Object.keys(metrics).length > 0 ? metrics : void 0;
|
|
231
231
|
}
|
|
232
232
|
getEnvironmentInfo() {
|
|
233
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return void 0;
|
|
233
|
+
if (typeof window === "undefined" || typeof navigator === "undefined" || typeof document === "undefined") return void 0;
|
|
234
234
|
return {
|
|
235
235
|
language: navigator.language,
|
|
236
236
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
237
|
-
cookiesEnabled: navigator.cookieEnabled,
|
|
237
|
+
cookiesEnabled: navigator.cookieEnabled ?? false,
|
|
238
238
|
localStorage: typeof localStorage !== "undefined",
|
|
239
|
-
online: navigator.onLine
|
|
239
|
+
online: navigator.onLine ?? true
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
};
|
|
@@ -1587,15 +1587,18 @@ var BugBearClient = class {
|
|
|
1587
1587
|
* Get device info (override in platform-specific implementations)
|
|
1588
1588
|
*/
|
|
1589
1589
|
getDeviceInfo() {
|
|
1590
|
-
if (typeof window !== "undefined") {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
userAgent
|
|
1594
|
-
|
|
1590
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
1591
|
+
const info = { platform: "web" };
|
|
1592
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
1593
|
+
info.userAgent = navigator.userAgent;
|
|
1594
|
+
}
|
|
1595
|
+
if (window.screen) {
|
|
1596
|
+
info.screenSize = {
|
|
1595
1597
|
width: window.screen.width,
|
|
1596
1598
|
height: window.screen.height
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
return info;
|
|
1599
1602
|
}
|
|
1600
1603
|
return { platform: "web" };
|
|
1601
1604
|
}
|