aurea-tracking-sdk 1.3.2 → 1.3.3

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,30 @@ 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
+ if (screenWidth >= 2560 || aspectRatio >= 2.2) {
652
+ deviceType = "Ultrawide";
653
+ } else if (screenWidth < 1920) {
654
+ deviceType = "Laptop";
655
+ } else {
656
+ deviceType = "Desktop";
653
657
  }
654
658
  }
655
659
  return {
@@ -659,8 +663,8 @@ var AureaSDK = class {
659
663
  browserVersion: result.browser.version || "Unknown",
660
664
  osName: result.os.name || "Unknown",
661
665
  osVersion: result.os.version || "Unknown",
662
- screenWidth: window.screen?.width,
663
- screenHeight: window.screen?.height,
666
+ screenWidth,
667
+ screenHeight,
664
668
  language: navigator.language,
665
669
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
666
670
  };
package/dist/index.mjs CHANGED
@@ -601,26 +601,30 @@ 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
+ if (screenWidth >= 2560 || aspectRatio >= 2.2) {
623
+ deviceType = "Ultrawide";
624
+ } else if (screenWidth < 1920) {
625
+ deviceType = "Laptop";
626
+ } else {
627
+ deviceType = "Desktop";
624
628
  }
625
629
  }
626
630
  return {
@@ -630,8 +634,8 @@ var AureaSDK = class {
630
634
  browserVersion: result.browser.version || "Unknown",
631
635
  osName: result.os.name || "Unknown",
632
636
  osVersion: result.os.version || "Unknown",
633
- screenWidth: window.screen?.width,
634
- screenHeight: window.screen?.height,
637
+ screenWidth,
638
+ screenHeight,
635
639
  language: navigator.language,
636
640
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
637
641
  };
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.3",
4
4
  "description": "Standalone tracking SDK for Aurea CRM external funnels",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",