@stacksee/analytics 0.13.0 → 0.13.1
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/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/{bento-node-sdk.esm-CWEAoj97.js → bento-node-sdk.esm-CT4oS3Kp.js} +1 -1
- package/dist/providers/client.js +8 -7
- package/dist/providers/emitkit/server.d.ts +5 -0
- package/dist/providers/pirsch/client.d.ts +5 -0
- package/dist/providers/pirsch/server.d.ts +38 -4
- package/dist/providers/server.js +344 -271
- package/dist/web-D-ZwlgeQ.js +2034 -0
- package/package.json +1 -1
- package/dist/_commonjsHelpers-B4e78b8K.js +0 -28
- package/dist/axios-0_CwElpL.js +0 -1820
- package/dist/index-zS7gy63J.js +0 -829
- package/dist/web-imCcOhDC.js +0 -220
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function l(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as c,
|
|
7
|
+
l as g
|
|
8
|
+
};
|
package/dist/providers/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
|
-
var p = (
|
|
3
|
-
var r = (
|
|
2
|
+
var p = (o, h, e) => h in o ? f(o, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[h] = e;
|
|
3
|
+
var r = (o, h, e) => p(o, typeof h != "symbol" ? h + "" : h, e);
|
|
4
4
|
import { B as u } from "../base.provider-AfFL5W_P.js";
|
|
5
5
|
import { i as a } from "../client-DTHZYkxx.js";
|
|
6
6
|
import { P as z } from "../client-DTHZYkxx.js";
|
|
@@ -296,10 +296,11 @@ class m extends u {
|
|
|
296
296
|
if (!this.config.identificationCode || typeof this.config.identificationCode != "string")
|
|
297
297
|
throw new Error("Pirsch requires an identificationCode");
|
|
298
298
|
try {
|
|
299
|
-
const { Pirsch: e } = await import("../web-
|
|
299
|
+
const { Pirsch: e } = await import("../web-D-ZwlgeQ.js").then((i) => i.w);
|
|
300
300
|
this.client = new e({
|
|
301
301
|
identificationCode: this.config.identificationCode,
|
|
302
|
-
...this.config.hostname && { hostname: this.config.hostname }
|
|
302
|
+
...this.config.hostname && { hostname: this.config.hostname },
|
|
303
|
+
...this.config.timeout && { timeout: this.config.timeout }
|
|
303
304
|
}), this.initialized = !0, this.log("Initialized successfully", this.config);
|
|
304
305
|
} catch (e) {
|
|
305
306
|
throw console.error(
|
|
@@ -347,15 +348,15 @@ class m extends u {
|
|
|
347
348
|
return;
|
|
348
349
|
const s = e && Object.keys(e).length > 0 ? Object.fromEntries(
|
|
349
350
|
Object.entries(e).filter(
|
|
350
|
-
([,
|
|
351
|
+
([, d]) => typeof d == "string" || typeof d == "number" || typeof d == "boolean"
|
|
351
352
|
)
|
|
352
353
|
) : void 0, t = {
|
|
353
354
|
...((l = i == null ? void 0 : i.page) == null ? void 0 : l.url) && { url: i.page.url },
|
|
354
355
|
...((g = i == null ? void 0 : i.page) == null ? void 0 : g.title) && { title: i.page.title },
|
|
355
356
|
...s && { tags: s }
|
|
356
357
|
}, n = Object.keys(t).length > 0 ? t : void 0;
|
|
357
|
-
this.client.hit(n).catch((
|
|
358
|
-
console.error("[Pirsch-Client] Failed to track page view:",
|
|
358
|
+
this.client.hit(n).catch((d) => {
|
|
359
|
+
console.error("[Pirsch-Client] Failed to track page view:", d);
|
|
359
360
|
}), this.log("Tracked page view", { properties: e, context: i });
|
|
360
361
|
}
|
|
361
362
|
pageLeave(e, i) {
|
|
@@ -8,6 +8,11 @@ export interface EmitKitServerConfig {
|
|
|
8
8
|
* Your EmitKit API key (starts with emitkit_)
|
|
9
9
|
*/
|
|
10
10
|
apiKey: string;
|
|
11
|
+
/**
|
|
12
|
+
* Request timeout in milliseconds
|
|
13
|
+
* @default 5000
|
|
14
|
+
*/
|
|
15
|
+
timeout?: number;
|
|
11
16
|
/**
|
|
12
17
|
* Default channel name for events
|
|
13
18
|
* @default 'general'
|
|
@@ -10,6 +10,11 @@ export interface PirschClientConfig {
|
|
|
10
10
|
* The hostname/domain being tracked (e.g., "example.com")
|
|
11
11
|
*/
|
|
12
12
|
hostname?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Request timeout in milliseconds
|
|
15
|
+
* @default 5000
|
|
16
|
+
*/
|
|
17
|
+
timeout?: number;
|
|
13
18
|
/**
|
|
14
19
|
* Enable debug logging
|
|
15
20
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseEvent, EventContext } from '../../core/events/types.js';
|
|
2
2
|
import { BaseAnalyticsProvider } from '../base.provider.js';
|
|
3
|
-
|
|
3
|
+
type Protocol = "http" | "https";
|
|
4
4
|
export interface PirschServerConfig {
|
|
5
5
|
/**
|
|
6
6
|
* The hostname/domain being tracked (required)
|
|
@@ -22,9 +22,10 @@ export interface PirschServerConfig {
|
|
|
22
22
|
*/
|
|
23
23
|
clientSecret: string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Request timeout in milliseconds
|
|
26
|
+
* @default 10000
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
timeout?: number;
|
|
28
29
|
/**
|
|
29
30
|
* Enable debug logging
|
|
30
31
|
*/
|
|
@@ -33,17 +34,50 @@ export interface PirschServerConfig {
|
|
|
33
34
|
* Enable/disable the provider
|
|
34
35
|
*/
|
|
35
36
|
enabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Disable Pirsch's bot filter
|
|
39
|
+
* Useful for controlled environments where you want to track all requests
|
|
40
|
+
*/
|
|
41
|
+
disableBotFilter?: boolean;
|
|
36
42
|
}
|
|
37
43
|
export declare class PirschServerProvider extends BaseAnalyticsProvider {
|
|
38
44
|
name: string;
|
|
39
|
-
private client?;
|
|
40
45
|
private initialized;
|
|
41
46
|
private config;
|
|
47
|
+
private accessToken;
|
|
48
|
+
private tokenExpiresAt;
|
|
49
|
+
private isAccessKey;
|
|
42
50
|
constructor(config: PirschServerConfig);
|
|
43
51
|
initialize(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Fetch with timeout using AbortController
|
|
54
|
+
*/
|
|
55
|
+
private fetchWithTimeout;
|
|
56
|
+
/**
|
|
57
|
+
* Ensure we have a valid access token (for OAuth mode)
|
|
58
|
+
*/
|
|
59
|
+
private ensureToken;
|
|
60
|
+
/**
|
|
61
|
+
* Make an authenticated request to Pirsch API
|
|
62
|
+
*/
|
|
63
|
+
private request;
|
|
64
|
+
/**
|
|
65
|
+
* Filter object to only include scalar values (string, number, boolean)
|
|
66
|
+
*/
|
|
67
|
+
private filterScalars;
|
|
68
|
+
/**
|
|
69
|
+
* Convert object values to strings for Pirsch event_meta
|
|
70
|
+
* Pirsch API requires event_meta to be a single dimension object of string values
|
|
71
|
+
*/
|
|
72
|
+
private toStringRecord;
|
|
73
|
+
/**
|
|
74
|
+
* Build a Pirsch hit from context
|
|
75
|
+
*/
|
|
76
|
+
private buildHit;
|
|
44
77
|
identify(userId: string, traits?: Record<string, unknown>): void;
|
|
45
78
|
track(event: BaseEvent, context?: EventContext): Promise<void>;
|
|
46
79
|
pageView(properties?: Record<string, unknown>, context?: EventContext): void;
|
|
47
80
|
reset(): Promise<void>;
|
|
48
81
|
shutdown(): Promise<void>;
|
|
49
82
|
}
|
|
83
|
+
export {};
|