@databuddy/sdk 2.2.0 → 2.2.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.
@@ -1,5 +1,3 @@
1
- import { i as isScriptInjected, c as createScript } from './sdk.tFAHtL2M.mjs';
2
-
3
1
  function detectClientId(providedClientId) {
4
2
  if (providedClientId) {
5
3
  return providedClientId;
@@ -24,21 +22,4 @@ function detectClientId(providedClientId) {
24
22
  return;
25
23
  }
26
24
 
27
- function Databuddy(props) {
28
- const clientId = detectClientId(props.clientId);
29
- if (!clientId) {
30
- if (typeof window !== "undefined" && !props.disabled && props.debug) {
31
- console.warn(
32
- "Databuddy: No client ID found. Please provide clientId prop or set NEXT_PUBLIC_DATABUDDY_CLIENT_ID environment variable."
33
- );
34
- }
35
- return null;
36
- }
37
- if (typeof window !== "undefined" && !props.disabled && !isScriptInjected()) {
38
- const script = createScript({ ...props, clientId });
39
- document.head.appendChild(script);
40
- }
41
- return null;
42
- }
43
-
44
- export { Databuddy as D, detectClientId as d };
25
+ export { detectClientId as d };
@@ -276,6 +276,14 @@ type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? Ev
276
276
  * Databuddy tracker instance interface
277
277
  */
278
278
  interface DatabuddyTracker {
279
+ /**
280
+ * Current anonymous user ID
281
+ */
282
+ anonymousId: string;
283
+ /**
284
+ * Current session ID
285
+ */
286
+ sessionId: string;
279
287
  /**
280
288
  * Track a custom event
281
289
  */
@@ -333,13 +341,4 @@ type TrackFunction = <T extends EventName>(eventName: T, properties?: Properties
333
341
  type ScreenViewFunction = (path?: string, properties?: EventProperties) => void;
334
342
  type SetGlobalPropertiesFunction = (properties: EventProperties) => void;
335
343
 
336
- /**
337
- * <Databuddy /> component for Next.js/React apps
338
- * Injects the databuddy.js script with all config as data attributes
339
- * Usage: <Databuddy clientId="..." trackScreenViews trackPerformance ... />
340
- * Or simply: <Databuddy /> (auto-detects clientId from environment variables)
341
- */
342
- declare function Databuddy(props: DatabuddyConfig): null;
343
-
344
- export { Databuddy as b };
345
- export type { BaseEventProperties as B, DatabuddyConfig as D, EventProperties as E, PropertiesForEvent as P, ScreenViewFunction as S, TrackFunction as T, DatabuddyTracker as a, EventTypeMap as c, EventName as d, DataAttributes as e, SetGlobalPropertiesFunction as f };
344
+ export type { BaseEventProperties as B, DatabuddyConfig as D, EventProperties as E, PropertiesForEvent as P, ScreenViewFunction as S, TrackFunction as T, DatabuddyTracker as a, EventTypeMap as b, EventName as c, DataAttributes as d, SetGlobalPropertiesFunction as e };
@@ -276,6 +276,14 @@ type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? Ev
276
276
  * Databuddy tracker instance interface
277
277
  */
278
278
  interface DatabuddyTracker {
279
+ /**
280
+ * Current anonymous user ID
281
+ */
282
+ anonymousId: string;
283
+ /**
284
+ * Current session ID
285
+ */
286
+ sessionId: string;
279
287
  /**
280
288
  * Track a custom event
281
289
  */
@@ -333,13 +341,4 @@ type TrackFunction = <T extends EventName>(eventName: T, properties?: Properties
333
341
  type ScreenViewFunction = (path?: string, properties?: EventProperties) => void;
334
342
  type SetGlobalPropertiesFunction = (properties: EventProperties) => void;
335
343
 
336
- /**
337
- * <Databuddy /> component for Next.js/React apps
338
- * Injects the databuddy.js script with all config as data attributes
339
- * Usage: <Databuddy clientId="..." trackScreenViews trackPerformance ... />
340
- * Or simply: <Databuddy /> (auto-detects clientId from environment variables)
341
- */
342
- declare function Databuddy(props: DatabuddyConfig): null;
343
-
344
- export { Databuddy as b };
345
- export type { BaseEventProperties as B, DatabuddyConfig as D, EventProperties as E, PropertiesForEvent as P, ScreenViewFunction as S, TrackFunction as T, DatabuddyTracker as a, EventTypeMap as c, EventName as d, DataAttributes as e, SetGlobalPropertiesFunction as f };
344
+ export type { BaseEventProperties as B, DatabuddyConfig as D, EventProperties as E, PropertiesForEvent as P, ScreenViewFunction as S, TrackFunction as T, DatabuddyTracker as a, EventTypeMap as b, EventName as c, DataAttributes as d, SetGlobalPropertiesFunction as e };
@@ -1,8 +1,87 @@
1
+ import * as vue from 'vue';
1
2
  import { App, ComputedRef } from 'vue';
2
3
  import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
3
4
  export { e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
4
5
 
5
- declare const Databuddy: any;
6
+ declare const Databuddy: vue.DefineComponent<{
7
+ clientId?: string | undefined;
8
+ clientSecret?: string | undefined;
9
+ apiUrl?: string | undefined;
10
+ scriptUrl?: string | undefined;
11
+ sdk?: string | undefined;
12
+ sdkVersion?: string | undefined;
13
+ disabled?: boolean | undefined;
14
+ debug?: boolean | undefined;
15
+ waitForProfile?: boolean | undefined;
16
+ trackScreenViews?: boolean | undefined;
17
+ trackHashChanges?: boolean | undefined;
18
+ trackSessions?: boolean | undefined;
19
+ trackAttributes?: boolean | undefined;
20
+ trackOutgoingLinks?: boolean | undefined;
21
+ trackInteractions?: boolean | undefined;
22
+ trackEngagement?: boolean | undefined;
23
+ trackScrollDepth?: boolean | undefined;
24
+ trackExitIntent?: boolean | undefined;
25
+ trackBounceRate?: boolean | undefined;
26
+ trackPerformance?: boolean | undefined;
27
+ trackWebVitals?: boolean | undefined;
28
+ trackErrors?: boolean | undefined;
29
+ enableObservability?: boolean | undefined;
30
+ observabilityService?: string | undefined;
31
+ observabilityEnvironment?: string | undefined;
32
+ observabilityVersion?: string | undefined;
33
+ enableLogging?: boolean | undefined;
34
+ enableTracing?: boolean | undefined;
35
+ enableErrorTracking?: boolean | undefined;
36
+ samplingRate?: number | undefined;
37
+ enableRetries?: boolean | undefined;
38
+ maxRetries?: number | undefined;
39
+ initialRetryDelay?: number | undefined;
40
+ enableBatching?: boolean | undefined;
41
+ batchSize?: number | undefined;
42
+ batchTimeout?: number | undefined;
43
+ skipPatterns?: string[] | undefined;
44
+ maskPatterns?: string[] | undefined;
45
+ }, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{
46
+ clientId?: string | undefined;
47
+ clientSecret?: string | undefined;
48
+ apiUrl?: string | undefined;
49
+ scriptUrl?: string | undefined;
50
+ sdk?: string | undefined;
51
+ sdkVersion?: string | undefined;
52
+ disabled?: boolean | undefined;
53
+ debug?: boolean | undefined;
54
+ waitForProfile?: boolean | undefined;
55
+ trackScreenViews?: boolean | undefined;
56
+ trackHashChanges?: boolean | undefined;
57
+ trackSessions?: boolean | undefined;
58
+ trackAttributes?: boolean | undefined;
59
+ trackOutgoingLinks?: boolean | undefined;
60
+ trackInteractions?: boolean | undefined;
61
+ trackEngagement?: boolean | undefined;
62
+ trackScrollDepth?: boolean | undefined;
63
+ trackExitIntent?: boolean | undefined;
64
+ trackBounceRate?: boolean | undefined;
65
+ trackPerformance?: boolean | undefined;
66
+ trackWebVitals?: boolean | undefined;
67
+ trackErrors?: boolean | undefined;
68
+ enableObservability?: boolean | undefined;
69
+ observabilityService?: string | undefined;
70
+ observabilityEnvironment?: string | undefined;
71
+ observabilityVersion?: string | undefined;
72
+ enableLogging?: boolean | undefined;
73
+ enableTracing?: boolean | undefined;
74
+ enableErrorTracking?: boolean | undefined;
75
+ samplingRate?: number | undefined;
76
+ enableRetries?: boolean | undefined;
77
+ maxRetries?: number | undefined;
78
+ initialRetryDelay?: number | undefined;
79
+ enableBatching?: boolean | undefined;
80
+ batchSize?: number | undefined;
81
+ batchTimeout?: number | undefined;
82
+ skipPatterns?: string[] | undefined;
83
+ maskPatterns?: string[] | undefined;
84
+ }> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
6
85
 
7
86
  interface FlagsPluginOptions extends FlagsConfig {
8
87
  }
@@ -1,8 +1,87 @@
1
+ import * as vue from 'vue';
1
2
  import { App, ComputedRef } from 'vue';
2
3
  import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
3
4
  export { e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
4
5
 
5
- declare const Databuddy: any;
6
+ declare const Databuddy: vue.DefineComponent<{
7
+ clientId?: string | undefined;
8
+ clientSecret?: string | undefined;
9
+ apiUrl?: string | undefined;
10
+ scriptUrl?: string | undefined;
11
+ sdk?: string | undefined;
12
+ sdkVersion?: string | undefined;
13
+ disabled?: boolean | undefined;
14
+ debug?: boolean | undefined;
15
+ waitForProfile?: boolean | undefined;
16
+ trackScreenViews?: boolean | undefined;
17
+ trackHashChanges?: boolean | undefined;
18
+ trackSessions?: boolean | undefined;
19
+ trackAttributes?: boolean | undefined;
20
+ trackOutgoingLinks?: boolean | undefined;
21
+ trackInteractions?: boolean | undefined;
22
+ trackEngagement?: boolean | undefined;
23
+ trackScrollDepth?: boolean | undefined;
24
+ trackExitIntent?: boolean | undefined;
25
+ trackBounceRate?: boolean | undefined;
26
+ trackPerformance?: boolean | undefined;
27
+ trackWebVitals?: boolean | undefined;
28
+ trackErrors?: boolean | undefined;
29
+ enableObservability?: boolean | undefined;
30
+ observabilityService?: string | undefined;
31
+ observabilityEnvironment?: string | undefined;
32
+ observabilityVersion?: string | undefined;
33
+ enableLogging?: boolean | undefined;
34
+ enableTracing?: boolean | undefined;
35
+ enableErrorTracking?: boolean | undefined;
36
+ samplingRate?: number | undefined;
37
+ enableRetries?: boolean | undefined;
38
+ maxRetries?: number | undefined;
39
+ initialRetryDelay?: number | undefined;
40
+ enableBatching?: boolean | undefined;
41
+ batchSize?: number | undefined;
42
+ batchTimeout?: number | undefined;
43
+ skipPatterns?: string[] | undefined;
44
+ maskPatterns?: string[] | undefined;
45
+ }, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{
46
+ clientId?: string | undefined;
47
+ clientSecret?: string | undefined;
48
+ apiUrl?: string | undefined;
49
+ scriptUrl?: string | undefined;
50
+ sdk?: string | undefined;
51
+ sdkVersion?: string | undefined;
52
+ disabled?: boolean | undefined;
53
+ debug?: boolean | undefined;
54
+ waitForProfile?: boolean | undefined;
55
+ trackScreenViews?: boolean | undefined;
56
+ trackHashChanges?: boolean | undefined;
57
+ trackSessions?: boolean | undefined;
58
+ trackAttributes?: boolean | undefined;
59
+ trackOutgoingLinks?: boolean | undefined;
60
+ trackInteractions?: boolean | undefined;
61
+ trackEngagement?: boolean | undefined;
62
+ trackScrollDepth?: boolean | undefined;
63
+ trackExitIntent?: boolean | undefined;
64
+ trackBounceRate?: boolean | undefined;
65
+ trackPerformance?: boolean | undefined;
66
+ trackWebVitals?: boolean | undefined;
67
+ trackErrors?: boolean | undefined;
68
+ enableObservability?: boolean | undefined;
69
+ observabilityService?: string | undefined;
70
+ observabilityEnvironment?: string | undefined;
71
+ observabilityVersion?: string | undefined;
72
+ enableLogging?: boolean | undefined;
73
+ enableTracing?: boolean | undefined;
74
+ enableErrorTracking?: boolean | undefined;
75
+ samplingRate?: number | undefined;
76
+ enableRetries?: boolean | undefined;
77
+ maxRetries?: number | undefined;
78
+ initialRetryDelay?: number | undefined;
79
+ enableBatching?: boolean | undefined;
80
+ batchSize?: number | undefined;
81
+ batchTimeout?: number | undefined;
82
+ skipPatterns?: string[] | undefined;
83
+ maskPatterns?: string[] | undefined;
84
+ }> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
6
85
 
7
86
  interface FlagsPluginOptions extends FlagsConfig {
8
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databuddy/sdk",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Official Databuddy Analytics SDK",
5
5
  "main": "./dist/core/index.mjs",
6
6
  "types": "./dist/core/index.d.ts",
@@ -10,26 +10,48 @@
10
10
  "build": "unbuild",
11
11
  "test": "bun test"
12
12
  },
13
- "dependencies": {
14
- "jotai": ">=2.0.0"
15
- },
16
- "optionalDependencies": {
17
- "pino": "^9.0.0"
18
- },
19
13
  "devDependencies": {
14
+ "@ai-sdk/provider": "^2.0.0",
20
15
  "@types/node": "^20.0.0",
21
16
  "@vitejs/plugin-react": "^5.0.0",
17
+ "ai": "^5.0.51",
18
+ "jotai": "catalog:",
19
+ "react": "catalog:",
20
+ "@types/react": "catalog:",
21
+ "tokenlens": "^2.0.0-alpha.3",
22
22
  "typescript": "catalog:",
23
- "unbuild": "^3.6.1"
23
+ "unbuild": "^3.6.1",
24
+ "vue": ">=3",
25
+ "msw": "^2.11.5"
24
26
  },
25
27
  "peerDependencies": {
28
+ "@ai-sdk/provider": "^2.0.0",
29
+ "ai": "^5.0.51",
30
+ "jotai": ">=2.0.0",
26
31
  "react": ">=18",
32
+ "tokenlens": "^2.0.0-alpha.3",
33
+ "msw": "^2.11.5",
27
34
  "vue": ">=3"
28
35
  },
29
36
  "peerDependenciesMeta": {
37
+ "@ai-sdk/provider": {
38
+ "optional": true
39
+ },
40
+ "ai": {
41
+ "optional": true
42
+ },
43
+ "jotai": {
44
+ "optional": true
45
+ },
30
46
  "react": {
31
47
  "optional": true
32
48
  },
49
+ "tokenlens": {
50
+ "optional": true
51
+ },
52
+ "msw": {
53
+ "optional": true
54
+ },
33
55
  "vue": {
34
56
  "optional": true
35
57
  }
@@ -50,6 +72,10 @@
50
72
  "./node": {
51
73
  "types": "./dist/node/index.d.ts",
52
74
  "import": "./dist/node/index.mjs"
75
+ },
76
+ "./ai/vercel": {
77
+ "types": "./dist/ai/vercel/index.d.ts",
78
+ "import": "./dist/ai/vercel/index.mjs"
53
79
  }
54
80
  },
55
81
  "files": [