@databuddy/sdk 2.2.1 → 2.2.11

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.
@@ -35,11 +35,9 @@ const buddyWare = (buddy) => {
35
35
  }
36
36
  };
37
37
  };
38
- const wrapVercelLanguageModel = (model, buddy) => {
39
- return wrapLanguageModel({
40
- model,
41
- middleware: buddyWare()
42
- });
43
- };
38
+ const wrapVercelLanguageModel = (model, buddy) => wrapLanguageModel({
39
+ model,
40
+ middleware: buddyWare()
41
+ });
44
42
 
45
43
  export { wrapVercelLanguageModel as withBuddy };
@@ -1,7 +1,7 @@
1
- import { S as StorageInterface, F as FlagsManager, a as FlagsManagerOptions, b as FlagResult, c as FlagState, d as FlagsConfig } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
2
- export { e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
3
- import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction } from '../shared/@databuddy/sdk.DNing6--.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 } from '../shared/@databuddy/sdk.DNing6--.mjs';
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
+ export { e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
3
+ import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction } from '../shared/@databuddy/sdk.B1NyVg8b.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 } from '../shared/@databuddy/sdk.B1NyVg8b.mjs';
5
5
 
6
6
  /**
7
7
  * Auto-detect Databuddy client ID from environment variables
@@ -40,7 +40,7 @@ declare class CoreFlagsManager implements FlagsManager {
40
40
  private fetchFlag;
41
41
  isEnabled(key: string): FlagState;
42
42
  refresh(forceClear?: boolean): void;
43
- updateUser(user: FlagsConfig['user']): void;
43
+ updateUser(user: FlagsConfig["user"]): void;
44
44
  updateConfig(config: FlagsConfig): void;
45
45
  getMemoryFlags(): Record<string, FlagResult>;
46
46
  getPendingFlags(): Set<string>;
@@ -1,7 +1,7 @@
1
- import { S as StorageInterface, F as FlagsManager, a as FlagsManagerOptions, b as FlagResult, c as FlagState, d as FlagsConfig } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
2
- export { e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
3
- import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction } from '../shared/@databuddy/sdk.DNing6--.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 } from '../shared/@databuddy/sdk.DNing6--.js';
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
+ export { e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
3
+ import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction } from '../shared/@databuddy/sdk.B1NyVg8b.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 } from '../shared/@databuddy/sdk.B1NyVg8b.js';
5
5
 
6
6
  /**
7
7
  * Auto-detect Databuddy client ID from environment variables
@@ -40,7 +40,7 @@ declare class CoreFlagsManager implements FlagsManager {
40
40
  private fetchFlag;
41
41
  isEnabled(key: string): FlagState;
42
42
  refresh(forceClear?: boolean): void;
43
- updateUser(user: FlagsConfig['user']): void;
43
+ updateUser(user: FlagsConfig["user"]): void;
44
44
  updateConfig(config: FlagsConfig): void;
45
45
  getMemoryFlags(): Record<string, FlagResult>;
46
46
  getPendingFlags(): Set<string>;
@@ -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.tFAHtL2M.mjs';
2
+ export { B as BrowserFlagStorage, C as CoreFlagsManager, c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.DihibvA_.mjs';
3
3
 
4
4
  function isTrackerAvailable() {
5
5
  return typeof window !== "undefined" && (!!window.databuddy || !!window.db);
@@ -58,7 +58,7 @@ interface EventResponse {
58
58
  }
59
59
  interface BatchEventInput {
60
60
  /** Event type */
61
- type: 'custom';
61
+ type: "custom";
62
62
  /** Event name */
63
63
  name: string;
64
64
  /** Unique event ID for deduplication */
@@ -96,7 +96,7 @@ interface BatchEventResponse {
96
96
  }
97
97
 
98
98
  declare class Databuddy {
99
- private clientId;
99
+ private readonly clientId;
100
100
  private apiUrl;
101
101
  private logger;
102
102
  private enableBatching;
@@ -58,7 +58,7 @@ interface EventResponse {
58
58
  }
59
59
  interface BatchEventInput {
60
60
  /** Event type */
61
- type: 'custom';
61
+ type: "custom";
62
62
  /** Event name */
63
63
  name: string;
64
64
  /** Unique event ID for deduplication */
@@ -96,7 +96,7 @@ interface BatchEventResponse {
96
96
  }
97
97
 
98
98
  declare class Databuddy {
99
- private clientId;
99
+ private readonly clientId;
100
100
  private apiUrl;
101
101
  private logger;
102
102
  private enableBatching;
@@ -20,10 +20,7 @@ function createConsoleLogger(debug) {
20
20
  },
21
21
  error(msg, data) {
22
22
  if (debug) {
23
- console.error(
24
- `[Databuddy] ${msg}`,
25
- data ? JSON.stringify(data) : ""
26
- );
23
+ console.error(`[Databuddy] ${msg}`, data ? JSON.stringify(data) : "");
27
24
  }
28
25
  },
29
26
  warn(msg, data) {
@@ -32,10 +29,7 @@ function createConsoleLogger(debug) {
32
29
  }
33
30
  },
34
31
  debug: debug ? (msg, data) => {
35
- console.debug(
36
- `[Databuddy] ${msg}`,
37
- data ? JSON.stringify(data) : ""
38
- );
32
+ console.debug(`[Databuddy] ${msg}`, data ? JSON.stringify(data) : "");
39
33
  } : noop
40
34
  };
41
35
  }
@@ -161,7 +155,9 @@ class Databuddy {
161
155
  }
162
156
  if (this.enableDeduplication && processedEvent.eventId) {
163
157
  if (this.deduplicationCache.has(processedEvent.eventId)) {
164
- this.logger.debug("Event deduplicated", { eventId: processedEvent.eventId });
158
+ this.logger.debug("Event deduplicated", {
159
+ eventId: processedEvent.eventId
160
+ });
165
161
  return { success: true };
166
162
  }
167
163
  this.addToDeduplicationCache(processedEvent.eventId);
@@ -319,7 +315,9 @@ class Databuddy {
319
315
  }
320
316
  if (this.enableDeduplication && processedEvent.eventId) {
321
317
  if (this.deduplicationCache.has(processedEvent.eventId)) {
322
- this.logger.debug("Event deduplicated in batch", { eventId: processedEvent.eventId });
318
+ this.logger.debug("Event deduplicated in batch", {
319
+ eventId: processedEvent.eventId
320
+ });
323
321
  continue;
324
322
  }
325
323
  this.addToDeduplicationCache(processedEvent.eventId);
@@ -338,8 +336,14 @@ class Databuddy {
338
336
  this.logger.info("\u{1F4E6} SENDING BATCH EVENTS:", {
339
337
  count: processedEvents.length,
340
338
  firstEventName: processedEvents[0]?.name,
341
- firstEventProperties: JSON.stringify(processedEvents[0]?.properties, null, 2),
342
- firstEventPropertiesCount: Object.keys(processedEvents[0]?.properties || {}).length
339
+ firstEventProperties: JSON.stringify(
340
+ processedEvents[0]?.properties,
341
+ null,
342
+ 2
343
+ ),
344
+ firstEventPropertiesCount: Object.keys(
345
+ processedEvents[0]?.properties || {}
346
+ ).length
343
347
  });
344
348
  const response = await fetch(url, {
345
349
  method: "POST",
@@ -433,7 +437,7 @@ class Databuddy {
433
437
  * event.properties = { ...event.properties, processed: true };
434
438
  * return event;
435
439
  * });
436
- *
440
+ *
437
441
  * // Drop events matching a condition
438
442
  * client.addMiddleware((event) => {
439
443
  * if (event.name === 'unwanted_event') return null;
@@ -443,7 +447,9 @@ class Databuddy {
443
447
  */
444
448
  addMiddleware(middleware) {
445
449
  this.middleware.push(middleware);
446
- this.logger.debug("Middleware added", { totalMiddleware: this.middleware.length });
450
+ this.logger.debug("Middleware added", {
451
+ totalMiddleware: this.middleware.length
452
+ });
447
453
  }
448
454
  /**
449
455
  * Remove all middleware functions
@@ -1,9 +1,9 @@
1
- import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.DNing6--.mjs';
1
+ import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.B1NyVg8b.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';
5
- import { d as FlagsConfig, c as FlagState } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
6
- export { b as FlagResult, e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
5
+ import { d as FlagsConfig, c as FlagState } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
6
+ export { b as FlagResult, e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
7
7
 
8
8
  /**
9
9
  * <Databuddy /> component for Next.js/React apps
@@ -1,9 +1,9 @@
1
- import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.DNing6--.js';
1
+ import { D as DatabuddyConfig } from '../shared/@databuddy/sdk.B1NyVg8b.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';
5
- import { d as FlagsConfig, c as FlagState } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
6
- export { b as FlagResult, e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
5
+ import { d as FlagsConfig, c as FlagState } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
6
+ export { b as FlagResult, e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
7
7
 
8
8
  /**
9
9
  * <Databuddy /> component for Next.js/React apps
@@ -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.tFAHtL2M.mjs';
3
+ import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager, l as logger } from '../shared/@databuddy/sdk.DihibvA_.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';
@@ -2,7 +2,7 @@
2
2
  * Configuration options for the Databuddy SDK and <Databuddy /> component.
3
3
  * All options are passed as data attributes to the injected script.
4
4
  */
5
- interface DatabuddyConfig {
5
+ type DatabuddyConfig = {
6
6
  /**
7
7
  * Your Databuddy project client ID.
8
8
  * If not provided, will automatically detect from NEXT_PUBLIC_DATABUDDY_CLIENT_ID environment variable.
@@ -44,22 +44,10 @@ interface DatabuddyConfig {
44
44
  * Enable debug logging (default: false).
45
45
  */
46
46
  debug?: boolean;
47
- /**
48
- * Wait for user profile before sending events (advanced, default: false).
49
- */
50
- waitForProfile?: boolean;
51
- /**
52
- * Automatically track screen/page views (default: true).
53
- */
54
- trackScreenViews?: boolean;
55
47
  /**
56
48
  * Track hash changes in the URL (default: false).
57
49
  */
58
50
  trackHashChanges?: boolean;
59
- /**
60
- * Track user sessions (default: true).
61
- */
62
- trackSessions?: boolean;
63
51
  /**
64
52
  * Track data-* attributes on elements (default: false).
65
53
  */
@@ -72,22 +60,10 @@ interface DatabuddyConfig {
72
60
  * Track user interactions (default: false).
73
61
  */
74
62
  trackInteractions?: boolean;
75
- /**
76
- * Track user engagement metrics (default: false).
77
- */
78
- trackEngagement?: boolean;
79
63
  /**
80
64
  * Track scroll depth (default: false).
81
65
  */
82
66
  trackScrollDepth?: boolean;
83
- /**
84
- * Track exit intent (default: false).
85
- */
86
- trackExitIntent?: boolean;
87
- /**
88
- * Track bounce rate (default: false).
89
- */
90
- trackBounceRate?: boolean;
91
67
  /**
92
68
  * Track page performance metrics (default: true).
93
69
  */
@@ -100,34 +76,6 @@ interface DatabuddyConfig {
100
76
  * Track JavaScript errors (default: false).
101
77
  */
102
78
  trackErrors?: boolean;
103
- /**
104
- * Enable observability features (logging, error tracking, tracing) (default: false).
105
- */
106
- enableObservability?: boolean;
107
- /**
108
- * Service name for observability events.
109
- */
110
- observabilityService?: string;
111
- /**
112
- * Environment for observability events.
113
- */
114
- observabilityEnvironment?: string;
115
- /**
116
- * Service version for observability events.
117
- */
118
- observabilityVersion?: string;
119
- /**
120
- * Enable structured logging (default: false).
121
- */
122
- enableLogging?: boolean;
123
- /**
124
- * Enable distributed tracing (default: false).
125
- */
126
- enableTracing?: boolean;
127
- /**
128
- * Enable error tracking (default: false).
129
- */
130
- enableErrorTracking?: boolean;
131
79
  /**
132
80
  * Sampling rate for events (0.0 to 1.0, default: 1.0).
133
81
  * Example: 0.5 = 50% of events sent.
@@ -166,11 +114,11 @@ interface DatabuddyConfig {
166
114
  /** Array of glob patterns to skip tracking on matching paths (e.g., ['/admin/**']) */
167
115
  skipPatterns?: string[];
168
116
  maskPatterns?: string[];
169
- }
117
+ };
170
118
  /**
171
119
  * Base event properties that can be attached to any event
172
120
  */
173
- interface BaseEventProperties {
121
+ type BaseEventProperties = {
174
122
  /** Page URL */
175
123
  __path?: string;
176
124
  /** Page title */
@@ -185,8 +133,6 @@ interface BaseEventProperties {
185
133
  sessionStartTime?: number;
186
134
  /** Page count in session */
187
135
  page_count?: number;
188
- /** Screen resolution */
189
- screen_resolution?: string;
190
136
  /** Viewport size */
191
137
  viewport_size?: string;
192
138
  /** User timezone */
@@ -199,7 +145,7 @@ interface BaseEventProperties {
199
145
  utm_campaign?: string;
200
146
  utm_term?: string;
201
147
  utm_content?: string;
202
- }
148
+ };
203
149
  /**
204
150
  * Custom event properties that can be attached to any event
205
151
  */
@@ -210,7 +156,7 @@ interface EventProperties extends BaseEventProperties {
210
156
  /**
211
157
  * Pre-defined event types with their specific properties
212
158
  */
213
- interface EventTypeMap {
159
+ type EventTypeMap = {
214
160
  screen_view: {
215
161
  time_on_page?: number;
216
162
  scroll_depth?: number;
@@ -263,7 +209,7 @@ interface EventTypeMap {
263
209
  error_type?: string;
264
210
  };
265
211
  [eventName: string]: EventProperties;
266
- }
212
+ };
267
213
  /**
268
214
  * Available event names
269
215
  */
@@ -275,7 +221,7 @@ type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? Ev
275
221
  /**
276
222
  * Databuddy tracker instance interface
277
223
  */
278
- interface DatabuddyTracker {
224
+ type DatabuddyTracker = {
279
225
  /**
280
226
  * Current anonymous user ID
281
227
  */
@@ -308,7 +254,7 @@ interface DatabuddyTracker {
308
254
  * Track a custom event with full type safety
309
255
  */
310
256
  trackCustomEvent(eventName: string, properties?: EventProperties): void;
311
- }
257
+ };
312
258
  /**
313
259
  * Global window interface extensions
314
260
  */
@@ -316,24 +262,24 @@ declare global {
316
262
  interface Window {
317
263
  databuddy?: DatabuddyTracker;
318
264
  db?: {
319
- track: DatabuddyTracker['track'];
320
- screenView: DatabuddyTracker['screenView'];
321
- clear: DatabuddyTracker['clear'];
322
- flush: DatabuddyTracker['flush'];
323
- setGlobalProperties: DatabuddyTracker['setGlobalProperties'];
324
- trackCustomEvent: DatabuddyTracker['trackCustomEvent'];
265
+ track: DatabuddyTracker["track"];
266
+ screenView: DatabuddyTracker["screenView"];
267
+ clear: DatabuddyTracker["clear"];
268
+ flush: DatabuddyTracker["flush"];
269
+ setGlobalProperties: DatabuddyTracker["setGlobalProperties"];
270
+ trackCustomEvent: DatabuddyTracker["trackCustomEvent"];
325
271
  };
326
272
  }
327
273
  }
328
274
  /**
329
275
  * Helper type for HTML data attributes for automatic tracking
330
276
  */
331
- interface DataAttributes {
277
+ type DataAttributes = {
332
278
  /** Event name to track when element is clicked */
333
- 'data-track': string;
279
+ "data-track": string;
334
280
  /** Additional data attributes (converted to camelCase) */
335
281
  [key: `data-${string}`]: string;
336
- }
282
+ };
337
283
  /**
338
284
  * Utility types for creating typed event tracking functions
339
285
  */
@@ -2,7 +2,7 @@
2
2
  * Configuration options for the Databuddy SDK and <Databuddy /> component.
3
3
  * All options are passed as data attributes to the injected script.
4
4
  */
5
- interface DatabuddyConfig {
5
+ type DatabuddyConfig = {
6
6
  /**
7
7
  * Your Databuddy project client ID.
8
8
  * If not provided, will automatically detect from NEXT_PUBLIC_DATABUDDY_CLIENT_ID environment variable.
@@ -44,22 +44,10 @@ interface DatabuddyConfig {
44
44
  * Enable debug logging (default: false).
45
45
  */
46
46
  debug?: boolean;
47
- /**
48
- * Wait for user profile before sending events (advanced, default: false).
49
- */
50
- waitForProfile?: boolean;
51
- /**
52
- * Automatically track screen/page views (default: true).
53
- */
54
- trackScreenViews?: boolean;
55
47
  /**
56
48
  * Track hash changes in the URL (default: false).
57
49
  */
58
50
  trackHashChanges?: boolean;
59
- /**
60
- * Track user sessions (default: true).
61
- */
62
- trackSessions?: boolean;
63
51
  /**
64
52
  * Track data-* attributes on elements (default: false).
65
53
  */
@@ -72,22 +60,10 @@ interface DatabuddyConfig {
72
60
  * Track user interactions (default: false).
73
61
  */
74
62
  trackInteractions?: boolean;
75
- /**
76
- * Track user engagement metrics (default: false).
77
- */
78
- trackEngagement?: boolean;
79
63
  /**
80
64
  * Track scroll depth (default: false).
81
65
  */
82
66
  trackScrollDepth?: boolean;
83
- /**
84
- * Track exit intent (default: false).
85
- */
86
- trackExitIntent?: boolean;
87
- /**
88
- * Track bounce rate (default: false).
89
- */
90
- trackBounceRate?: boolean;
91
67
  /**
92
68
  * Track page performance metrics (default: true).
93
69
  */
@@ -100,34 +76,6 @@ interface DatabuddyConfig {
100
76
  * Track JavaScript errors (default: false).
101
77
  */
102
78
  trackErrors?: boolean;
103
- /**
104
- * Enable observability features (logging, error tracking, tracing) (default: false).
105
- */
106
- enableObservability?: boolean;
107
- /**
108
- * Service name for observability events.
109
- */
110
- observabilityService?: string;
111
- /**
112
- * Environment for observability events.
113
- */
114
- observabilityEnvironment?: string;
115
- /**
116
- * Service version for observability events.
117
- */
118
- observabilityVersion?: string;
119
- /**
120
- * Enable structured logging (default: false).
121
- */
122
- enableLogging?: boolean;
123
- /**
124
- * Enable distributed tracing (default: false).
125
- */
126
- enableTracing?: boolean;
127
- /**
128
- * Enable error tracking (default: false).
129
- */
130
- enableErrorTracking?: boolean;
131
79
  /**
132
80
  * Sampling rate for events (0.0 to 1.0, default: 1.0).
133
81
  * Example: 0.5 = 50% of events sent.
@@ -166,11 +114,11 @@ interface DatabuddyConfig {
166
114
  /** Array of glob patterns to skip tracking on matching paths (e.g., ['/admin/**']) */
167
115
  skipPatterns?: string[];
168
116
  maskPatterns?: string[];
169
- }
117
+ };
170
118
  /**
171
119
  * Base event properties that can be attached to any event
172
120
  */
173
- interface BaseEventProperties {
121
+ type BaseEventProperties = {
174
122
  /** Page URL */
175
123
  __path?: string;
176
124
  /** Page title */
@@ -185,8 +133,6 @@ interface BaseEventProperties {
185
133
  sessionStartTime?: number;
186
134
  /** Page count in session */
187
135
  page_count?: number;
188
- /** Screen resolution */
189
- screen_resolution?: string;
190
136
  /** Viewport size */
191
137
  viewport_size?: string;
192
138
  /** User timezone */
@@ -199,7 +145,7 @@ interface BaseEventProperties {
199
145
  utm_campaign?: string;
200
146
  utm_term?: string;
201
147
  utm_content?: string;
202
- }
148
+ };
203
149
  /**
204
150
  * Custom event properties that can be attached to any event
205
151
  */
@@ -210,7 +156,7 @@ interface EventProperties extends BaseEventProperties {
210
156
  /**
211
157
  * Pre-defined event types with their specific properties
212
158
  */
213
- interface EventTypeMap {
159
+ type EventTypeMap = {
214
160
  screen_view: {
215
161
  time_on_page?: number;
216
162
  scroll_depth?: number;
@@ -263,7 +209,7 @@ interface EventTypeMap {
263
209
  error_type?: string;
264
210
  };
265
211
  [eventName: string]: EventProperties;
266
- }
212
+ };
267
213
  /**
268
214
  * Available event names
269
215
  */
@@ -275,7 +221,7 @@ type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? Ev
275
221
  /**
276
222
  * Databuddy tracker instance interface
277
223
  */
278
- interface DatabuddyTracker {
224
+ type DatabuddyTracker = {
279
225
  /**
280
226
  * Current anonymous user ID
281
227
  */
@@ -308,7 +254,7 @@ interface DatabuddyTracker {
308
254
  * Track a custom event with full type safety
309
255
  */
310
256
  trackCustomEvent(eventName: string, properties?: EventProperties): void;
311
- }
257
+ };
312
258
  /**
313
259
  * Global window interface extensions
314
260
  */
@@ -316,24 +262,24 @@ declare global {
316
262
  interface Window {
317
263
  databuddy?: DatabuddyTracker;
318
264
  db?: {
319
- track: DatabuddyTracker['track'];
320
- screenView: DatabuddyTracker['screenView'];
321
- clear: DatabuddyTracker['clear'];
322
- flush: DatabuddyTracker['flush'];
323
- setGlobalProperties: DatabuddyTracker['setGlobalProperties'];
324
- trackCustomEvent: DatabuddyTracker['trackCustomEvent'];
265
+ track: DatabuddyTracker["track"];
266
+ screenView: DatabuddyTracker["screenView"];
267
+ clear: DatabuddyTracker["clear"];
268
+ flush: DatabuddyTracker["flush"];
269
+ setGlobalProperties: DatabuddyTracker["setGlobalProperties"];
270
+ trackCustomEvent: DatabuddyTracker["trackCustomEvent"];
325
271
  };
326
272
  }
327
273
  }
328
274
  /**
329
275
  * Helper type for HTML data attributes for automatic tracking
330
276
  */
331
- interface DataAttributes {
277
+ type DataAttributes = {
332
278
  /** Event name to track when element is clicked */
333
- 'data-track': string;
279
+ "data-track": string;
334
280
  /** Additional data attributes (converted to camelCase) */
335
281
  [key: `data-${string}`]: string;
336
- }
282
+ };
337
283
  /**
338
284
  * Utility types for creating typed event tracking functions
339
285
  */
@@ -434,7 +434,7 @@ class CoreFlagsManager {
434
434
  }
435
435
  }
436
436
 
437
- const version = "2.2.0";
437
+ const version = "2.2.1";
438
438
 
439
439
  const INJECTED_SCRIPT_ATTRIBUTE = "data-databuddy-injected";
440
440
  function isScriptInjected() {
@@ -4,7 +4,7 @@ interface FlagResult {
4
4
  payload: any;
5
5
  reason: string;
6
6
  flagId?: string;
7
- flagType?: 'boolean' | 'rollout';
7
+ flagType?: "boolean" | "rollout";
8
8
  }
9
9
  interface FlagsConfig {
10
10
  /** Client ID for flag evaluation */
@@ -33,7 +33,7 @@ interface FlagState {
33
33
  interface FlagsContext {
34
34
  isEnabled: (key: string) => FlagState;
35
35
  fetchAllFlags: () => Promise<void>;
36
- updateUser: (user: FlagsConfig['user']) => void;
36
+ updateUser: (user: FlagsConfig["user"]) => void;
37
37
  refresh: (forceClear?: boolean) => Promise<void>;
38
38
  }
39
39
  interface StorageInterface {
@@ -54,7 +54,7 @@ interface FlagsManager {
54
54
  getFlag: (key: string) => Promise<FlagResult>;
55
55
  isEnabled: (key: string) => FlagState;
56
56
  fetchAllFlags: () => Promise<void>;
57
- updateUser: (user: FlagsConfig['user']) => void;
57
+ updateUser: (user: FlagsConfig["user"]) => void;
58
58
  refresh: (forceClear?: boolean) => void;
59
59
  updateConfig: (config: FlagsConfig) => void;
60
60
  getMemoryFlags: () => Record<string, FlagResult>;
@@ -4,7 +4,7 @@ interface FlagResult {
4
4
  payload: any;
5
5
  reason: string;
6
6
  flagId?: string;
7
- flagType?: 'boolean' | 'rollout';
7
+ flagType?: "boolean" | "rollout";
8
8
  }
9
9
  interface FlagsConfig {
10
10
  /** Client ID for flag evaluation */
@@ -33,7 +33,7 @@ interface FlagState {
33
33
  interface FlagsContext {
34
34
  isEnabled: (key: string) => FlagState;
35
35
  fetchAllFlags: () => Promise<void>;
36
- updateUser: (user: FlagsConfig['user']) => void;
36
+ updateUser: (user: FlagsConfig["user"]) => void;
37
37
  refresh: (forceClear?: boolean) => Promise<void>;
38
38
  }
39
39
  interface StorageInterface {
@@ -54,7 +54,7 @@ interface FlagsManager {
54
54
  getFlag: (key: string) => Promise<FlagResult>;
55
55
  isEnabled: (key: string) => FlagState;
56
56
  fetchAllFlags: () => Promise<void>;
57
- updateUser: (user: FlagsConfig['user']) => void;
57
+ updateUser: (user: FlagsConfig["user"]) => void;
58
58
  refresh: (forceClear?: boolean) => void;
59
59
  updateConfig: (config: FlagsConfig) => void;
60
60
  getMemoryFlags: () => Record<string, FlagResult>;
@@ -1,7 +1,7 @@
1
1
  import * as vue from 'vue';
2
2
  import { App, ComputedRef } from 'vue';
3
- import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
4
- export { e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.mjs';
3
+ import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
4
+ export { e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.mjs';
5
5
 
6
6
  declare const Databuddy: vue.DefineComponent<{
7
7
  clientId?: string | undefined;
@@ -12,27 +12,14 @@ declare const Databuddy: vue.DefineComponent<{
12
12
  sdkVersion?: string | undefined;
13
13
  disabled?: boolean | undefined;
14
14
  debug?: boolean | undefined;
15
- waitForProfile?: boolean | undefined;
16
- trackScreenViews?: boolean | undefined;
17
15
  trackHashChanges?: boolean | undefined;
18
- trackSessions?: boolean | undefined;
19
16
  trackAttributes?: boolean | undefined;
20
17
  trackOutgoingLinks?: boolean | undefined;
21
18
  trackInteractions?: boolean | undefined;
22
- trackEngagement?: boolean | undefined;
23
19
  trackScrollDepth?: boolean | undefined;
24
- trackExitIntent?: boolean | undefined;
25
- trackBounceRate?: boolean | undefined;
26
20
  trackPerformance?: boolean | undefined;
27
21
  trackWebVitals?: boolean | undefined;
28
22
  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
23
  samplingRate?: number | undefined;
37
24
  enableRetries?: boolean | undefined;
38
25
  maxRetries?: number | undefined;
@@ -51,27 +38,14 @@ declare const Databuddy: vue.DefineComponent<{
51
38
  sdkVersion?: string | undefined;
52
39
  disabled?: boolean | undefined;
53
40
  debug?: boolean | undefined;
54
- waitForProfile?: boolean | undefined;
55
- trackScreenViews?: boolean | undefined;
56
41
  trackHashChanges?: boolean | undefined;
57
- trackSessions?: boolean | undefined;
58
42
  trackAttributes?: boolean | undefined;
59
43
  trackOutgoingLinks?: boolean | undefined;
60
44
  trackInteractions?: boolean | undefined;
61
- trackEngagement?: boolean | undefined;
62
45
  trackScrollDepth?: boolean | undefined;
63
- trackExitIntent?: boolean | undefined;
64
- trackBounceRate?: boolean | undefined;
65
46
  trackPerformance?: boolean | undefined;
66
47
  trackWebVitals?: boolean | undefined;
67
48
  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
49
  samplingRate?: number | undefined;
76
50
  enableRetries?: boolean | undefined;
77
51
  maxRetries?: number | undefined;
@@ -1,7 +1,7 @@
1
1
  import * as vue from 'vue';
2
2
  import { App, ComputedRef } from 'vue';
3
- import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
4
- export { e as FlagsContext } from '../shared/@databuddy/sdk.YfiY9DoZ.js';
3
+ import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
4
+ export { e as FlagsContext } from '../shared/@databuddy/sdk.OK9Nbqlf.js';
5
5
 
6
6
  declare const Databuddy: vue.DefineComponent<{
7
7
  clientId?: string | undefined;
@@ -12,27 +12,14 @@ declare const Databuddy: vue.DefineComponent<{
12
12
  sdkVersion?: string | undefined;
13
13
  disabled?: boolean | undefined;
14
14
  debug?: boolean | undefined;
15
- waitForProfile?: boolean | undefined;
16
- trackScreenViews?: boolean | undefined;
17
15
  trackHashChanges?: boolean | undefined;
18
- trackSessions?: boolean | undefined;
19
16
  trackAttributes?: boolean | undefined;
20
17
  trackOutgoingLinks?: boolean | undefined;
21
18
  trackInteractions?: boolean | undefined;
22
- trackEngagement?: boolean | undefined;
23
19
  trackScrollDepth?: boolean | undefined;
24
- trackExitIntent?: boolean | undefined;
25
- trackBounceRate?: boolean | undefined;
26
20
  trackPerformance?: boolean | undefined;
27
21
  trackWebVitals?: boolean | undefined;
28
22
  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
23
  samplingRate?: number | undefined;
37
24
  enableRetries?: boolean | undefined;
38
25
  maxRetries?: number | undefined;
@@ -51,27 +38,14 @@ declare const Databuddy: vue.DefineComponent<{
51
38
  sdkVersion?: string | undefined;
52
39
  disabled?: boolean | undefined;
53
40
  debug?: boolean | undefined;
54
- waitForProfile?: boolean | undefined;
55
- trackScreenViews?: boolean | undefined;
56
41
  trackHashChanges?: boolean | undefined;
57
- trackSessions?: boolean | undefined;
58
42
  trackAttributes?: boolean | undefined;
59
43
  trackOutgoingLinks?: boolean | undefined;
60
44
  trackInteractions?: boolean | undefined;
61
- trackEngagement?: boolean | undefined;
62
45
  trackScrollDepth?: boolean | undefined;
63
- trackExitIntent?: boolean | undefined;
64
- trackBounceRate?: boolean | undefined;
65
46
  trackPerformance?: boolean | undefined;
66
47
  trackWebVitals?: boolean | undefined;
67
48
  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
49
  samplingRate?: number | undefined;
76
50
  enableRetries?: boolean | undefined;
77
51
  maxRetries?: number | undefined;
@@ -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.tFAHtL2M.mjs';
2
+ import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager } from '../shared/@databuddy/sdk.DihibvA_.mjs';
3
3
 
4
4
  const Databuddy = defineComponent({
5
5
  props: {},
@@ -74,12 +74,8 @@ function useFlags() {
74
74
  }
75
75
  const state = globalState;
76
76
  const manager = globalManager;
77
- const isEnabled = (key) => {
78
- return manager.isEnabled(key);
79
- };
80
- const fetchAllFlags = () => {
81
- return manager.fetchAllFlags();
82
- };
77
+ const isEnabled = (key) => manager.isEnabled(key);
78
+ const fetchAllFlags = () => manager.fetchAllFlags();
83
79
  const updateUser = (user) => {
84
80
  manager.updateUser(user);
85
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databuddy/sdk",
3
- "version": "2.2.1",
3
+ "version": "2.2.11",
4
4
  "description": "Official Databuddy Analytics SDK",
5
5
  "main": "./dist/core/index.mjs",
6
6
  "types": "./dist/core/index.d.ts",
@@ -8,14 +8,20 @@
8
8
  "private": false,
9
9
  "scripts": {
10
10
  "build": "unbuild",
11
- "test": "bun test"
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
+ "vscode:prepublish": "bun run build"
16
+ },
17
+ "dependencies": {
18
+ "jotai": ">=2.12.5"
12
19
  },
13
20
  "devDependencies": {
14
21
  "@ai-sdk/provider": "^2.0.0",
15
22
  "@types/node": "^20.0.0",
16
23
  "@vitejs/plugin-react": "^5.0.0",
17
24
  "ai": "^5.0.51",
18
- "jotai": "catalog:",
19
25
  "react": "catalog:",
20
26
  "@types/react": "catalog:",
21
27
  "tokenlens": "^2.0.0-alpha.3",
@@ -27,7 +33,6 @@
27
33
  "peerDependencies": {
28
34
  "@ai-sdk/provider": "^2.0.0",
29
35
  "ai": "^5.0.51",
30
- "jotai": ">=2.0.0",
31
36
  "react": ">=18",
32
37
  "tokenlens": "^2.0.0-alpha.3",
33
38
  "msw": "^2.11.5",
@@ -40,9 +45,6 @@
40
45
  "ai": {
41
46
  "optional": true
42
47
  },
43
- "jotai": {
44
- "optional": true
45
- },
46
48
  "react": {
47
49
  "optional": true
48
50
  },