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 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
- switch (result.device.type.toLowerCase()) {
636
- case "mobile":
637
- deviceType = "Mobile";
638
- break;
639
- case "tablet":
640
- deviceType = "Tablet";
641
- break;
642
- case "smarttv":
643
- deviceType = "Smart TV";
644
- break;
645
- case "wearable":
646
- deviceType = "Wearable";
647
- break;
648
- case "console":
649
- deviceType = "Console";
650
- break;
651
- default:
652
- deviceType = "Desktop";
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: window.screen?.width,
663
- screenHeight: window.screen?.height,
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
- switch (result.device.type.toLowerCase()) {
607
- case "mobile":
608
- deviceType = "Mobile";
609
- break;
610
- case "tablet":
611
- deviceType = "Tablet";
612
- break;
613
- case "smarttv":
614
- deviceType = "Smart TV";
615
- break;
616
- case "wearable":
617
- deviceType = "Wearable";
618
- break;
619
- case "console":
620
- deviceType = "Console";
621
- break;
622
- default:
623
- deviceType = "Desktop";
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: window.screen?.width,
634
- screenHeight: window.screen?.height,
641
+ screenWidth,
642
+ screenHeight,
635
643
  language: navigator.language,
636
644
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
637
645
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aurea-tracking-sdk",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Standalone tracking SDK for Aurea CRM external funnels",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",