aurea-tracking-sdk 1.3.2 → 1.3.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 +28 -20
- package/dist/index.mjs +28 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -630,26 +630,34 @@ var AureaSDK = class {
|
|
|
630
630
|
if (typeof navigator === "undefined") return void 0;
|
|
631
631
|
const parser = new import_ua_parser_js.UAParser(navigator.userAgent);
|
|
632
632
|
const result = parser.getResult();
|
|
633
|
+
const screenWidth = window.screen?.width || 0;
|
|
634
|
+
const screenHeight = window.screen?.height || 0;
|
|
633
635
|
let deviceType = "Desktop";
|
|
634
636
|
if (result.device.type) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
637
|
+
const type = result.device.type.toLowerCase();
|
|
638
|
+
if (type === "mobile") {
|
|
639
|
+
deviceType = "Mobile";
|
|
640
|
+
} else if (type === "tablet") {
|
|
641
|
+
deviceType = "Tablet";
|
|
642
|
+
} else if (type === "smarttv") {
|
|
643
|
+
deviceType = "Smart TV";
|
|
644
|
+
} else if (type === "wearable") {
|
|
645
|
+
deviceType = "Wearable";
|
|
646
|
+
} else if (type === "console") {
|
|
647
|
+
deviceType = "Console";
|
|
648
|
+
}
|
|
649
|
+
} else {
|
|
650
|
+
const aspectRatio = screenWidth / screenHeight;
|
|
651
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
652
|
+
const isLaptopUA = userAgent.includes("macintosh") || // MacBooks
|
|
653
|
+
userAgent.includes("mac os x") || userAgent.includes("laptop") || userAgent.includes("windows") && userAgent.includes("touch") || // Windows laptops with touch
|
|
654
|
+
userAgent.includes("chromebook");
|
|
655
|
+
if (screenWidth >= 2560 || aspectRatio >= 2.2) {
|
|
656
|
+
deviceType = "Ultrawide";
|
|
657
|
+
} else if (screenWidth <= 2048 && (isLaptopUA || screenWidth < 1920)) {
|
|
658
|
+
deviceType = "Laptop";
|
|
659
|
+
} else {
|
|
660
|
+
deviceType = "Desktop";
|
|
653
661
|
}
|
|
654
662
|
}
|
|
655
663
|
return {
|
|
@@ -659,8 +667,8 @@ var AureaSDK = class {
|
|
|
659
667
|
browserVersion: result.browser.version || "Unknown",
|
|
660
668
|
osName: result.os.name || "Unknown",
|
|
661
669
|
osVersion: result.os.version || "Unknown",
|
|
662
|
-
screenWidth
|
|
663
|
-
screenHeight
|
|
670
|
+
screenWidth,
|
|
671
|
+
screenHeight,
|
|
664
672
|
language: navigator.language,
|
|
665
673
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
666
674
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -601,26 +601,34 @@ var AureaSDK = class {
|
|
|
601
601
|
if (typeof navigator === "undefined") return void 0;
|
|
602
602
|
const parser = new UAParser(navigator.userAgent);
|
|
603
603
|
const result = parser.getResult();
|
|
604
|
+
const screenWidth = window.screen?.width || 0;
|
|
605
|
+
const screenHeight = window.screen?.height || 0;
|
|
604
606
|
let deviceType = "Desktop";
|
|
605
607
|
if (result.device.type) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
608
|
+
const type = result.device.type.toLowerCase();
|
|
609
|
+
if (type === "mobile") {
|
|
610
|
+
deviceType = "Mobile";
|
|
611
|
+
} else if (type === "tablet") {
|
|
612
|
+
deviceType = "Tablet";
|
|
613
|
+
} else if (type === "smarttv") {
|
|
614
|
+
deviceType = "Smart TV";
|
|
615
|
+
} else if (type === "wearable") {
|
|
616
|
+
deviceType = "Wearable";
|
|
617
|
+
} else if (type === "console") {
|
|
618
|
+
deviceType = "Console";
|
|
619
|
+
}
|
|
620
|
+
} else {
|
|
621
|
+
const aspectRatio = screenWidth / screenHeight;
|
|
622
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
623
|
+
const isLaptopUA = userAgent.includes("macintosh") || // MacBooks
|
|
624
|
+
userAgent.includes("mac os x") || userAgent.includes("laptop") || userAgent.includes("windows") && userAgent.includes("touch") || // Windows laptops with touch
|
|
625
|
+
userAgent.includes("chromebook");
|
|
626
|
+
if (screenWidth >= 2560 || aspectRatio >= 2.2) {
|
|
627
|
+
deviceType = "Ultrawide";
|
|
628
|
+
} else if (screenWidth <= 2048 && (isLaptopUA || screenWidth < 1920)) {
|
|
629
|
+
deviceType = "Laptop";
|
|
630
|
+
} else {
|
|
631
|
+
deviceType = "Desktop";
|
|
624
632
|
}
|
|
625
633
|
}
|
|
626
634
|
return {
|
|
@@ -630,8 +638,8 @@ var AureaSDK = class {
|
|
|
630
638
|
browserVersion: result.browser.version || "Unknown",
|
|
631
639
|
osName: result.os.name || "Unknown",
|
|
632
640
|
osVersion: result.os.version || "Unknown",
|
|
633
|
-
screenWidth
|
|
634
|
-
screenHeight
|
|
641
|
+
screenWidth,
|
|
642
|
+
screenHeight,
|
|
635
643
|
language: navigator.language,
|
|
636
644
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
637
645
|
};
|