aurea-tracking-sdk 1.3.1 → 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.d.mts CHANGED
@@ -9,6 +9,7 @@ interface EventCategoryConfig {
9
9
  value?: number;
10
10
  description?: string;
11
11
  trackOnce?: boolean;
12
+ color?: string;
12
13
  }
13
14
  interface AureaConfig {
14
15
  apiKey: string;
@@ -202,6 +203,7 @@ declare class AureaSDK {
202
203
  value?: number;
203
204
  advanceTo?: FunnelStage;
204
205
  description?: string;
206
+ color?: string;
205
207
  }): void;
206
208
  /**
207
209
  * Get current event category statistics
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ interface EventCategoryConfig {
9
9
  value?: number;
10
10
  description?: string;
11
11
  trackOnce?: boolean;
12
+ color?: string;
12
13
  }
13
14
  interface AureaConfig {
14
15
  apiKey: string;
@@ -202,6 +203,7 @@ declare class AureaSDK {
202
203
  value?: number;
203
204
  advanceTo?: FunnelStage;
204
205
  description?: string;
206
+ color?: string;
205
207
  }): void;
206
208
  /**
207
209
  * Get current event category statistics
package/dist/index.js CHANGED
@@ -252,6 +252,7 @@ var AureaSDK = class {
252
252
  const value = options?.value ?? categoryConfig?.value ?? 50;
253
253
  const advanceTo = options?.advanceTo || categoryConfig?.advanceTo;
254
254
  const description = options?.description || categoryConfig?.description;
255
+ const color = options?.color || categoryConfig?.color;
255
256
  const trackOnce = categoryConfig?.trackOnce ?? false;
256
257
  if (trackOnce) {
257
258
  if (this.trackedOnceEvents.has(eventName)) {
@@ -276,6 +277,8 @@ var AureaSDK = class {
276
277
  _category: category,
277
278
  _value: value,
278
279
  _description: description,
280
+ _color: color,
281
+ // Custom color (e.g., 'fuchsia' or full Tailwind classes)
279
282
  _currentStage: this.currentStage,
280
283
  _categoryStats: Object.fromEntries(this.eventCategoryStats),
281
284
  _trackedOnce: trackOnce
@@ -627,26 +630,30 @@ var AureaSDK = class {
627
630
  if (typeof navigator === "undefined") return void 0;
628
631
  const parser = new import_ua_parser_js.UAParser(navigator.userAgent);
629
632
  const result = parser.getResult();
633
+ const screenWidth = window.screen?.width || 0;
634
+ const screenHeight = window.screen?.height || 0;
630
635
  let deviceType = "Desktop";
631
636
  if (result.device.type) {
632
- switch (result.device.type.toLowerCase()) {
633
- case "mobile":
634
- deviceType = "Mobile";
635
- break;
636
- case "tablet":
637
- deviceType = "Tablet";
638
- break;
639
- case "smarttv":
640
- deviceType = "Smart TV";
641
- break;
642
- case "wearable":
643
- deviceType = "Wearable";
644
- break;
645
- case "console":
646
- deviceType = "Console";
647
- break;
648
- default:
649
- 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";
650
657
  }
651
658
  }
652
659
  return {
@@ -656,8 +663,8 @@ var AureaSDK = class {
656
663
  browserVersion: result.browser.version || "Unknown",
657
664
  osName: result.os.name || "Unknown",
658
665
  osVersion: result.os.version || "Unknown",
659
- screenWidth: window.screen?.width,
660
- screenHeight: window.screen?.height,
666
+ screenWidth,
667
+ screenHeight,
661
668
  language: navigator.language,
662
669
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
663
670
  };
package/dist/index.mjs CHANGED
@@ -223,6 +223,7 @@ var AureaSDK = class {
223
223
  const value = options?.value ?? categoryConfig?.value ?? 50;
224
224
  const advanceTo = options?.advanceTo || categoryConfig?.advanceTo;
225
225
  const description = options?.description || categoryConfig?.description;
226
+ const color = options?.color || categoryConfig?.color;
226
227
  const trackOnce = categoryConfig?.trackOnce ?? false;
227
228
  if (trackOnce) {
228
229
  if (this.trackedOnceEvents.has(eventName)) {
@@ -247,6 +248,8 @@ var AureaSDK = class {
247
248
  _category: category,
248
249
  _value: value,
249
250
  _description: description,
251
+ _color: color,
252
+ // Custom color (e.g., 'fuchsia' or full Tailwind classes)
250
253
  _currentStage: this.currentStage,
251
254
  _categoryStats: Object.fromEntries(this.eventCategoryStats),
252
255
  _trackedOnce: trackOnce
@@ -598,26 +601,30 @@ var AureaSDK = class {
598
601
  if (typeof navigator === "undefined") return void 0;
599
602
  const parser = new UAParser(navigator.userAgent);
600
603
  const result = parser.getResult();
604
+ const screenWidth = window.screen?.width || 0;
605
+ const screenHeight = window.screen?.height || 0;
601
606
  let deviceType = "Desktop";
602
607
  if (result.device.type) {
603
- switch (result.device.type.toLowerCase()) {
604
- case "mobile":
605
- deviceType = "Mobile";
606
- break;
607
- case "tablet":
608
- deviceType = "Tablet";
609
- break;
610
- case "smarttv":
611
- deviceType = "Smart TV";
612
- break;
613
- case "wearable":
614
- deviceType = "Wearable";
615
- break;
616
- case "console":
617
- deviceType = "Console";
618
- break;
619
- default:
620
- 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";
621
628
  }
622
629
  }
623
630
  return {
@@ -627,8 +634,8 @@ var AureaSDK = class {
627
634
  browserVersion: result.browser.version || "Unknown",
628
635
  osName: result.os.name || "Unknown",
629
636
  osVersion: result.os.version || "Unknown",
630
- screenWidth: window.screen?.width,
631
- screenHeight: window.screen?.height,
637
+ screenWidth,
638
+ screenHeight,
632
639
  language: navigator.language,
633
640
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
634
641
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aurea-tracking-sdk",
3
- "version": "1.3.1",
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",