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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +27 -20
- package/dist/index.mjs +27 -20
- package/package.json +1 -1
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
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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
|
|
660
|
-
screenHeight
|
|
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
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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
|
|
631
|
-
screenHeight
|
|
637
|
+
screenWidth,
|
|
638
|
+
screenHeight,
|
|
632
639
|
language: navigator.language,
|
|
633
640
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
634
641
|
};
|