luzzi-analytics 0.1.0 → 0.1.1
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 +12 -10
- package/dist/index.mjs +12 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -278,16 +278,18 @@ var LuzziCore = class {
|
|
|
278
278
|
collectDeviceInfo() {
|
|
279
279
|
const info = {};
|
|
280
280
|
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
281
|
-
const ua = navigator.userAgent;
|
|
282
|
-
if (ua
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
281
|
+
const ua = navigator.userAgent || "";
|
|
282
|
+
if (ua && typeof ua === "string") {
|
|
283
|
+
if (ua.includes("Windows")) info.os = "windows";
|
|
284
|
+
else if (ua.includes("Mac")) info.os = "macos";
|
|
285
|
+
else if (ua.includes("Linux")) info.os = "linux";
|
|
286
|
+
else if (ua.includes("Android")) info.os = "android";
|
|
287
|
+
else if (ua.includes("iPhone") || ua.includes("iPad")) info.os = "ios";
|
|
288
|
+
if (ua.includes("Chrome") && !ua.includes("Edg")) info.browser = "chrome";
|
|
289
|
+
else if (ua.includes("Firefox")) info.browser = "firefox";
|
|
290
|
+
else if (ua.includes("Safari") && !ua.includes("Chrome")) info.browser = "safari";
|
|
291
|
+
else if (ua.includes("Edg")) info.browser = "edge";
|
|
292
|
+
}
|
|
291
293
|
info.screen_width = window.screen?.width;
|
|
292
294
|
info.screen_height = window.screen?.height;
|
|
293
295
|
info.language = navigator.language;
|
package/dist/index.mjs
CHANGED
|
@@ -245,16 +245,18 @@ var LuzziCore = class {
|
|
|
245
245
|
collectDeviceInfo() {
|
|
246
246
|
const info = {};
|
|
247
247
|
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
248
|
-
const ua = navigator.userAgent;
|
|
249
|
-
if (ua
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
248
|
+
const ua = navigator.userAgent || "";
|
|
249
|
+
if (ua && typeof ua === "string") {
|
|
250
|
+
if (ua.includes("Windows")) info.os = "windows";
|
|
251
|
+
else if (ua.includes("Mac")) info.os = "macos";
|
|
252
|
+
else if (ua.includes("Linux")) info.os = "linux";
|
|
253
|
+
else if (ua.includes("Android")) info.os = "android";
|
|
254
|
+
else if (ua.includes("iPhone") || ua.includes("iPad")) info.os = "ios";
|
|
255
|
+
if (ua.includes("Chrome") && !ua.includes("Edg")) info.browser = "chrome";
|
|
256
|
+
else if (ua.includes("Firefox")) info.browser = "firefox";
|
|
257
|
+
else if (ua.includes("Safari") && !ua.includes("Chrome")) info.browser = "safari";
|
|
258
|
+
else if (ua.includes("Edg")) info.browser = "edge";
|
|
259
|
+
}
|
|
258
260
|
info.screen_width = window.screen?.width;
|
|
259
261
|
info.screen_height = window.screen?.height;
|
|
260
262
|
info.language = navigator.language;
|