@databuddy/sdk 2.2.11 → 2.2.12
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/core/index.d.mts +11 -6
- package/dist/core/index.d.ts +11 -6
- package/dist/core/index.mjs +23 -12
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.mjs +1 -1
- package/dist/shared/@databuddy/{sdk.B1NyVg8b.d.mts → sdk.CLiT66HO.d.mts} +2 -2
- package/dist/shared/@databuddy/{sdk.B1NyVg8b.d.ts → sdk.CLiT66HO.d.ts} +2 -2
- package/dist/shared/@databuddy/{sdk.DihibvA_.mjs → sdk.IxoH6TAZ.mjs} +1 -1
- package/dist/vue/index.mjs +1 -1
- package/package.json +2 -5
package/dist/core/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as StorageInterface, F as FlagsManager, a as FlagsManagerOptions, b as FlagResult, c as FlagState, d as FlagsConfig } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
|
|
2
2
|
export { e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
|
|
3
|
-
import { D as DatabuddyConfig, a as DatabuddyTracker
|
|
4
|
-
export { B as BaseEventProperties, d as DataAttributes, c as EventName, E as EventProperties, b as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, e as SetGlobalPropertiesFunction } from '../shared/@databuddy/sdk.
|
|
3
|
+
import { D as DatabuddyConfig, a as DatabuddyTracker } from '../shared/@databuddy/sdk.CLiT66HO.mjs';
|
|
4
|
+
export { B as BaseEventProperties, d as DataAttributes, c as EventName, E as EventProperties, b as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, e as SetGlobalPropertiesFunction, T as TrackFunction } from '../shared/@databuddy/sdk.CLiT66HO.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Auto-detect Databuddy client ID from environment variables
|
|
@@ -64,9 +64,14 @@ declare function isTrackerAvailable(): boolean;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function getTracker(): DatabuddyTracker | null;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Track a custom event (lean, goes to custom_event_spans table)
|
|
68
68
|
*/
|
|
69
|
-
declare
|
|
69
|
+
declare function trackCustomEvent(name: string, properties?: Record<string, unknown>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Track a custom event (alias for trackCustomEvent)
|
|
72
|
+
* Goes to the lean custom_event_spans table
|
|
73
|
+
*/
|
|
74
|
+
declare function track(eventName: string, properties?: Record<string, unknown>): void;
|
|
70
75
|
/**
|
|
71
76
|
* Clear the current session
|
|
72
77
|
*/
|
|
@@ -85,7 +90,7 @@ declare function trackError(message: string, properties?: {
|
|
|
85
90
|
stack?: string;
|
|
86
91
|
error_type?: string;
|
|
87
92
|
[key: string]: string | number | boolean | null | undefined;
|
|
88
|
-
}):
|
|
93
|
+
}): void;
|
|
89
94
|
/**
|
|
90
95
|
* Get anonymous ID from multiple sources
|
|
91
96
|
* Priority: URL params > tracker instance > localStorage
|
|
@@ -109,4 +114,4 @@ declare function getTrackingIds(urlParams?: URLSearchParams): {
|
|
|
109
114
|
*/
|
|
110
115
|
declare function getTrackingParams(urlParams?: URLSearchParams): string;
|
|
111
116
|
|
|
112
|
-
export { BrowserFlagStorage, CoreFlagsManager, DatabuddyConfig, DatabuddyTracker, FlagResult, FlagState, FlagsConfig, FlagsManager, FlagsManagerOptions, StorageInterface,
|
|
117
|
+
export { BrowserFlagStorage, CoreFlagsManager, DatabuddyConfig, DatabuddyTracker, FlagResult, FlagState, FlagsConfig, FlagsManager, FlagsManagerOptions, StorageInterface, clear, createScript, detectClientId, flush, getAnonymousId, getSessionId, getTracker, getTrackingIds, getTrackingParams, isScriptInjected, isTrackerAvailable, track, trackCustomEvent, trackError };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as StorageInterface, F as FlagsManager, a as FlagsManagerOptions, b as FlagResult, c as FlagState, d as FlagsConfig } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
|
|
2
2
|
export { e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
|
|
3
|
-
import { D as DatabuddyConfig, a as DatabuddyTracker
|
|
4
|
-
export { B as BaseEventProperties, d as DataAttributes, c as EventName, E as EventProperties, b as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, e as SetGlobalPropertiesFunction } from '../shared/@databuddy/sdk.
|
|
3
|
+
import { D as DatabuddyConfig, a as DatabuddyTracker } from '../shared/@databuddy/sdk.CLiT66HO.js';
|
|
4
|
+
export { B as BaseEventProperties, d as DataAttributes, c as EventName, E as EventProperties, b as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, e as SetGlobalPropertiesFunction, T as TrackFunction } from '../shared/@databuddy/sdk.CLiT66HO.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Auto-detect Databuddy client ID from environment variables
|
|
@@ -64,9 +64,14 @@ declare function isTrackerAvailable(): boolean;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function getTracker(): DatabuddyTracker | null;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Track a custom event (lean, goes to custom_event_spans table)
|
|
68
68
|
*/
|
|
69
|
-
declare
|
|
69
|
+
declare function trackCustomEvent(name: string, properties?: Record<string, unknown>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Track a custom event (alias for trackCustomEvent)
|
|
72
|
+
* Goes to the lean custom_event_spans table
|
|
73
|
+
*/
|
|
74
|
+
declare function track(eventName: string, properties?: Record<string, unknown>): void;
|
|
70
75
|
/**
|
|
71
76
|
* Clear the current session
|
|
72
77
|
*/
|
|
@@ -85,7 +90,7 @@ declare function trackError(message: string, properties?: {
|
|
|
85
90
|
stack?: string;
|
|
86
91
|
error_type?: string;
|
|
87
92
|
[key: string]: string | number | boolean | null | undefined;
|
|
88
|
-
}):
|
|
93
|
+
}): void;
|
|
89
94
|
/**
|
|
90
95
|
* Get anonymous ID from multiple sources
|
|
91
96
|
* Priority: URL params > tracker instance > localStorage
|
|
@@ -109,4 +114,4 @@ declare function getTrackingIds(urlParams?: URLSearchParams): {
|
|
|
109
114
|
*/
|
|
110
115
|
declare function getTrackingParams(urlParams?: URLSearchParams): string;
|
|
111
116
|
|
|
112
|
-
export { BrowserFlagStorage, CoreFlagsManager, DatabuddyConfig, DatabuddyTracker, FlagResult, FlagState, FlagsConfig, FlagsManager, FlagsManagerOptions, StorageInterface,
|
|
117
|
+
export { BrowserFlagStorage, CoreFlagsManager, DatabuddyConfig, DatabuddyTracker, FlagResult, FlagState, FlagsConfig, FlagsManager, FlagsManagerOptions, StorageInterface, clear, createScript, detectClientId, flush, getAnonymousId, getSessionId, getTracker, getTrackingIds, getTrackingParams, isScriptInjected, isTrackerAvailable, track, trackCustomEvent, trackError };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { d as detectClientId } from '../shared/@databuddy/sdk.BUsPV0LH.mjs';
|
|
2
|
-
export { B as BrowserFlagStorage, C as CoreFlagsManager, c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.
|
|
2
|
+
export { B as BrowserFlagStorage, C as CoreFlagsManager, c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.IxoH6TAZ.mjs';
|
|
3
3
|
|
|
4
4
|
function isTrackerAvailable() {
|
|
5
5
|
return typeof window !== "undefined" && (!!window.databuddy || !!window.db);
|
|
@@ -10,20 +10,23 @@ function getTracker() {
|
|
|
10
10
|
}
|
|
11
11
|
return window.databuddy || null;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
function trackCustomEvent(name, properties) {
|
|
14
14
|
if (typeof window === "undefined") {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const tracker = window.db?.
|
|
17
|
+
const tracker = window.db?.trackCustomEvent || window.databuddy?.trackCustomEvent;
|
|
18
18
|
if (!tracker) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
tracker(name, properties);
|
|
23
23
|
} catch (error) {
|
|
24
|
-
console.error("Databuddy
|
|
24
|
+
console.error("Databuddy trackCustomEvent error:", error);
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
|
+
function track(eventName, properties) {
|
|
28
|
+
trackCustomEvent(eventName, properties);
|
|
29
|
+
}
|
|
27
30
|
function clear() {
|
|
28
31
|
if (typeof window === "undefined") {
|
|
29
32
|
return;
|
|
@@ -53,14 +56,18 @@ function flush() {
|
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
function trackError(message, properties) {
|
|
56
|
-
|
|
59
|
+
track("error", { message, ...properties });
|
|
57
60
|
}
|
|
58
61
|
function getAnonymousId(urlParams) {
|
|
59
|
-
if (typeof window === "undefined")
|
|
62
|
+
if (typeof window === "undefined") {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
60
65
|
return urlParams?.get("anonId") || window.databuddy?.anonymousId || localStorage.getItem("did") || null;
|
|
61
66
|
}
|
|
62
67
|
function getSessionId(urlParams) {
|
|
63
|
-
if (typeof window === "undefined")
|
|
68
|
+
if (typeof window === "undefined") {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
64
71
|
return urlParams?.get("sessionId") || window.databuddy?.sessionId || sessionStorage.getItem("did_session") || null;
|
|
65
72
|
}
|
|
66
73
|
function getTrackingIds(urlParams) {
|
|
@@ -73,9 +80,13 @@ function getTrackingParams(urlParams) {
|
|
|
73
80
|
const anonId = getAnonymousId(urlParams);
|
|
74
81
|
const sessionId = getSessionId(urlParams);
|
|
75
82
|
const params = new URLSearchParams();
|
|
76
|
-
if (anonId)
|
|
77
|
-
|
|
83
|
+
if (anonId) {
|
|
84
|
+
params.set("anonId", anonId);
|
|
85
|
+
}
|
|
86
|
+
if (sessionId) {
|
|
87
|
+
params.set("sessionId", sessionId);
|
|
88
|
+
}
|
|
78
89
|
return params.toString();
|
|
79
90
|
}
|
|
80
91
|
|
|
81
|
-
export { clear, flush, getAnonymousId, getSessionId, getTracker, getTrackingIds, getTrackingParams, isTrackerAvailable, track, trackError };
|
|
92
|
+
export { clear, flush, getAnonymousId, getSessionId, getTracker, getTrackingIds, getTrackingParams, isTrackerAvailable, track, trackCustomEvent, trackError };
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.
|
|
1
|
+
import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.CLiT66HO.mjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import * as jotai_vanilla_internals from 'jotai/vanilla/internals';
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.
|
|
1
|
+
import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.CLiT66HO.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import * as jotai_vanilla_internals from 'jotai/vanilla/internals';
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager, l as logger } from '../shared/@databuddy/sdk.
|
|
3
|
+
import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager, l as logger } from '../shared/@databuddy/sdk.IxoH6TAZ.mjs';
|
|
4
4
|
import { d as detectClientId } from '../shared/@databuddy/sdk.BUsPV0LH.mjs';
|
|
5
5
|
import { createStore, atom, Provider, useAtom } from 'jotai';
|
|
6
6
|
import { useRef, useEffect, createElement } from 'react';
|
|
@@ -251,9 +251,9 @@ type DatabuddyTracker = {
|
|
|
251
251
|
*/
|
|
252
252
|
flush(): void;
|
|
253
253
|
/**
|
|
254
|
-
* Track a custom event
|
|
254
|
+
* Track a lean custom event (goes to custom_event_spans table)
|
|
255
255
|
*/
|
|
256
|
-
trackCustomEvent(eventName: string, properties?:
|
|
256
|
+
trackCustomEvent(eventName: string, properties?: Record<string, unknown>): void;
|
|
257
257
|
};
|
|
258
258
|
/**
|
|
259
259
|
* Global window interface extensions
|
|
@@ -251,9 +251,9 @@ type DatabuddyTracker = {
|
|
|
251
251
|
*/
|
|
252
252
|
flush(): void;
|
|
253
253
|
/**
|
|
254
|
-
* Track a custom event
|
|
254
|
+
* Track a lean custom event (goes to custom_event_spans table)
|
|
255
255
|
*/
|
|
256
|
-
trackCustomEvent(eventName: string, properties?:
|
|
256
|
+
trackCustomEvent(eventName: string, properties?: Record<string, unknown>): void;
|
|
257
257
|
};
|
|
258
258
|
/**
|
|
259
259
|
* Global window interface extensions
|
package/dist/vue/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, onUnmounted, watch, reactive, watchEffect, computed } from 'vue';
|
|
2
|
-
import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager } from '../shared/@databuddy/sdk.
|
|
2
|
+
import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager } from '../shared/@databuddy/sdk.IxoH6TAZ.mjs';
|
|
3
3
|
|
|
4
4
|
const Databuddy = defineComponent({
|
|
5
5
|
props: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databuddy/sdk",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
4
4
|
"description": "Official Databuddy Analytics SDK",
|
|
5
5
|
"main": "./dist/core/index.mjs",
|
|
6
6
|
"types": "./dist/core/index.d.ts",
|
|
@@ -9,13 +9,10 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "unbuild",
|
|
11
11
|
"test": "bun test",
|
|
12
|
-
"version:patch": "bun run version:patch",
|
|
13
|
-
"version:minor": "bun run version:minor",
|
|
14
|
-
"version:major": "bun run version:major",
|
|
15
12
|
"vscode:prepublish": "bun run build"
|
|
16
13
|
},
|
|
17
14
|
"dependencies": {
|
|
18
|
-
"jotai": "
|
|
15
|
+
"jotai": "^2.15.1"
|
|
19
16
|
},
|
|
20
17
|
"devDependencies": {
|
|
21
18
|
"@ai-sdk/provider": "^2.0.0",
|