@databuddy/sdk 2.2.0 → 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.
- package/dist/ai/vercel/index.d.mts +12 -0
- package/dist/ai/vercel/index.d.ts +12 -0
- package/dist/ai/vercel/index.mjs +43 -0
- package/dist/core/index.d.mts +27 -10
- package/dist/core/index.d.ts +27 -10
- package/dist/core/index.mjs +31 -9
- package/dist/node/index.d.mts +144 -39
- package/dist/node/index.d.ts +144 -39
- package/dist/node/index.mjs +212 -38
- package/dist/react/index.d.mts +18 -5
- package/dist/react/index.d.ts +18 -5
- package/dist/react/index.mjs +20 -3
- package/dist/shared/@databuddy/{sdk.C8T93n5r.d.mts → sdk.B1NyVg8b.d.mts} +26 -81
- package/dist/shared/@databuddy/{sdk.C8T93n5r.d.ts → sdk.B1NyVg8b.d.ts} +26 -81
- package/dist/shared/@databuddy/{sdk.aVQee-4k.mjs → sdk.BUsPV0LH.mjs} +1 -20
- package/dist/shared/@databuddy/{sdk.tFAHtL2M.mjs → sdk.DihibvA_.mjs} +1 -1
- package/dist/shared/@databuddy/{sdk.YfiY9DoZ.d.mts → sdk.OK9Nbqlf.d.mts} +3 -3
- package/dist/shared/@databuddy/{sdk.YfiY9DoZ.d.ts → sdk.OK9Nbqlf.d.ts} +3 -3
- package/dist/vue/index.d.mts +56 -3
- package/dist/vue/index.d.ts +56 -3
- package/dist/vue/index.mjs +3 -7
- package/package.json +35 -7
package/dist/react/index.mjs
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { i as isScriptInjected, c as createScript, B as BrowserFlagStorage, C as CoreFlagsManager, l as logger } from '../shared/@databuddy/sdk.DihibvA_.mjs';
|
|
4
|
+
import { d as detectClientId } from '../shared/@databuddy/sdk.BUsPV0LH.mjs';
|
|
4
5
|
import { createStore, atom, Provider, useAtom } from 'jotai';
|
|
5
6
|
import { useRef, useEffect, createElement } from 'react';
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
function Databuddy(props) {
|
|
9
|
+
const clientId = detectClientId(props.clientId);
|
|
10
|
+
if (!clientId) {
|
|
11
|
+
if (typeof window !== "undefined" && !props.disabled && props.debug) {
|
|
12
|
+
console.warn(
|
|
13
|
+
"Databuddy: No client ID found. Please provide clientId prop or set NEXT_PUBLIC_DATABUDDY_CLIENT_ID environment variable."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (typeof window !== "undefined" && !props.disabled && !isScriptInjected()) {
|
|
19
|
+
const script = createScript({ ...props, clientId });
|
|
20
|
+
document.head.appendChild(script);
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
7
24
|
|
|
8
25
|
const flagsStore = createStore();
|
|
9
26
|
const managerAtom = atom(null);
|
|
@@ -102,4 +119,4 @@ function useFlags() {
|
|
|
102
119
|
};
|
|
103
120
|
}
|
|
104
121
|
|
|
105
|
-
export { FlagsProvider, useFlags };
|
|
122
|
+
export { Databuddy, FlagsProvider, useFlags };
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,15 @@ type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? Ev
|
|
|
275
221
|
/**
|
|
276
222
|
* Databuddy tracker instance interface
|
|
277
223
|
*/
|
|
278
|
-
|
|
224
|
+
type DatabuddyTracker = {
|
|
225
|
+
/**
|
|
226
|
+
* Current anonymous user ID
|
|
227
|
+
*/
|
|
228
|
+
anonymousId: string;
|
|
229
|
+
/**
|
|
230
|
+
* Current session ID
|
|
231
|
+
*/
|
|
232
|
+
sessionId: string;
|
|
279
233
|
/**
|
|
280
234
|
* Track a custom event
|
|
281
235
|
*/
|
|
@@ -300,7 +254,7 @@ interface DatabuddyTracker {
|
|
|
300
254
|
* Track a custom event with full type safety
|
|
301
255
|
*/
|
|
302
256
|
trackCustomEvent(eventName: string, properties?: EventProperties): void;
|
|
303
|
-
}
|
|
257
|
+
};
|
|
304
258
|
/**
|
|
305
259
|
* Global window interface extensions
|
|
306
260
|
*/
|
|
@@ -308,24 +262,24 @@ declare global {
|
|
|
308
262
|
interface Window {
|
|
309
263
|
databuddy?: DatabuddyTracker;
|
|
310
264
|
db?: {
|
|
311
|
-
track: DatabuddyTracker[
|
|
312
|
-
screenView: DatabuddyTracker[
|
|
313
|
-
clear: DatabuddyTracker[
|
|
314
|
-
flush: DatabuddyTracker[
|
|
315
|
-
setGlobalProperties: DatabuddyTracker[
|
|
316
|
-
trackCustomEvent: DatabuddyTracker[
|
|
265
|
+
track: DatabuddyTracker["track"];
|
|
266
|
+
screenView: DatabuddyTracker["screenView"];
|
|
267
|
+
clear: DatabuddyTracker["clear"];
|
|
268
|
+
flush: DatabuddyTracker["flush"];
|
|
269
|
+
setGlobalProperties: DatabuddyTracker["setGlobalProperties"];
|
|
270
|
+
trackCustomEvent: DatabuddyTracker["trackCustomEvent"];
|
|
317
271
|
};
|
|
318
272
|
}
|
|
319
273
|
}
|
|
320
274
|
/**
|
|
321
275
|
* Helper type for HTML data attributes for automatic tracking
|
|
322
276
|
*/
|
|
323
|
-
|
|
277
|
+
type DataAttributes = {
|
|
324
278
|
/** Event name to track when element is clicked */
|
|
325
|
-
|
|
279
|
+
"data-track": string;
|
|
326
280
|
/** Additional data attributes (converted to camelCase) */
|
|
327
281
|
[key: `data-${string}`]: string;
|
|
328
|
-
}
|
|
282
|
+
};
|
|
329
283
|
/**
|
|
330
284
|
* Utility types for creating typed event tracking functions
|
|
331
285
|
*/
|
|
@@ -333,13 +287,4 @@ type TrackFunction = <T extends EventName>(eventName: T, properties?: Properties
|
|
|
333
287
|
type ScreenViewFunction = (path?: string, properties?: EventProperties) => void;
|
|
334
288
|
type SetGlobalPropertiesFunction = (properties: EventProperties) => void;
|
|
335
289
|
|
|
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 };
|
|
290
|
+
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 };
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,15 @@ type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? Ev
|
|
|
275
221
|
/**
|
|
276
222
|
* Databuddy tracker instance interface
|
|
277
223
|
*/
|
|
278
|
-
|
|
224
|
+
type DatabuddyTracker = {
|
|
225
|
+
/**
|
|
226
|
+
* Current anonymous user ID
|
|
227
|
+
*/
|
|
228
|
+
anonymousId: string;
|
|
229
|
+
/**
|
|
230
|
+
* Current session ID
|
|
231
|
+
*/
|
|
232
|
+
sessionId: string;
|
|
279
233
|
/**
|
|
280
234
|
* Track a custom event
|
|
281
235
|
*/
|
|
@@ -300,7 +254,7 @@ interface DatabuddyTracker {
|
|
|
300
254
|
* Track a custom event with full type safety
|
|
301
255
|
*/
|
|
302
256
|
trackCustomEvent(eventName: string, properties?: EventProperties): void;
|
|
303
|
-
}
|
|
257
|
+
};
|
|
304
258
|
/**
|
|
305
259
|
* Global window interface extensions
|
|
306
260
|
*/
|
|
@@ -308,24 +262,24 @@ declare global {
|
|
|
308
262
|
interface Window {
|
|
309
263
|
databuddy?: DatabuddyTracker;
|
|
310
264
|
db?: {
|
|
311
|
-
track: DatabuddyTracker[
|
|
312
|
-
screenView: DatabuddyTracker[
|
|
313
|
-
clear: DatabuddyTracker[
|
|
314
|
-
flush: DatabuddyTracker[
|
|
315
|
-
setGlobalProperties: DatabuddyTracker[
|
|
316
|
-
trackCustomEvent: DatabuddyTracker[
|
|
265
|
+
track: DatabuddyTracker["track"];
|
|
266
|
+
screenView: DatabuddyTracker["screenView"];
|
|
267
|
+
clear: DatabuddyTracker["clear"];
|
|
268
|
+
flush: DatabuddyTracker["flush"];
|
|
269
|
+
setGlobalProperties: DatabuddyTracker["setGlobalProperties"];
|
|
270
|
+
trackCustomEvent: DatabuddyTracker["trackCustomEvent"];
|
|
317
271
|
};
|
|
318
272
|
}
|
|
319
273
|
}
|
|
320
274
|
/**
|
|
321
275
|
* Helper type for HTML data attributes for automatic tracking
|
|
322
276
|
*/
|
|
323
|
-
|
|
277
|
+
type DataAttributes = {
|
|
324
278
|
/** Event name to track when element is clicked */
|
|
325
|
-
|
|
279
|
+
"data-track": string;
|
|
326
280
|
/** Additional data attributes (converted to camelCase) */
|
|
327
281
|
[key: `data-${string}`]: string;
|
|
328
|
-
}
|
|
282
|
+
};
|
|
329
283
|
/**
|
|
330
284
|
* Utility types for creating typed event tracking functions
|
|
331
285
|
*/
|
|
@@ -333,13 +287,4 @@ type TrackFunction = <T extends EventName>(eventName: T, properties?: Properties
|
|
|
333
287
|
type ScreenViewFunction = (path?: string, properties?: EventProperties) => void;
|
|
334
288
|
type SetGlobalPropertiesFunction = (properties: EventProperties) => void;
|
|
335
289
|
|
|
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 };
|
|
290
|
+
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,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
|
-
|
|
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 };
|
|
@@ -4,7 +4,7 @@ interface FlagResult {
|
|
|
4
4
|
payload: any;
|
|
5
5
|
reason: string;
|
|
6
6
|
flagId?: string;
|
|
7
|
-
flagType?:
|
|
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[
|
|
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[
|
|
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?:
|
|
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[
|
|
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[
|
|
57
|
+
updateUser: (user: FlagsConfig["user"]) => void;
|
|
58
58
|
refresh: (forceClear?: boolean) => void;
|
|
59
59
|
updateConfig: (config: FlagsConfig) => void;
|
|
60
60
|
getMemoryFlags: () => Record<string, FlagResult>;
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -1,8 +1,61 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
1
2
|
import { App, ComputedRef } from 'vue';
|
|
2
|
-
import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.
|
|
3
|
-
export { e as FlagsContext } from '../shared/@databuddy/sdk.
|
|
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';
|
|
4
5
|
|
|
5
|
-
declare const Databuddy:
|
|
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
|
+
trackHashChanges?: boolean | undefined;
|
|
16
|
+
trackAttributes?: boolean | undefined;
|
|
17
|
+
trackOutgoingLinks?: boolean | undefined;
|
|
18
|
+
trackInteractions?: boolean | undefined;
|
|
19
|
+
trackScrollDepth?: boolean | undefined;
|
|
20
|
+
trackPerformance?: boolean | undefined;
|
|
21
|
+
trackWebVitals?: boolean | undefined;
|
|
22
|
+
trackErrors?: boolean | undefined;
|
|
23
|
+
samplingRate?: number | undefined;
|
|
24
|
+
enableRetries?: boolean | undefined;
|
|
25
|
+
maxRetries?: number | undefined;
|
|
26
|
+
initialRetryDelay?: number | undefined;
|
|
27
|
+
enableBatching?: boolean | undefined;
|
|
28
|
+
batchSize?: number | undefined;
|
|
29
|
+
batchTimeout?: number | undefined;
|
|
30
|
+
skipPatterns?: string[] | undefined;
|
|
31
|
+
maskPatterns?: string[] | undefined;
|
|
32
|
+
}, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{
|
|
33
|
+
clientId?: string | undefined;
|
|
34
|
+
clientSecret?: string | undefined;
|
|
35
|
+
apiUrl?: string | undefined;
|
|
36
|
+
scriptUrl?: string | undefined;
|
|
37
|
+
sdk?: string | undefined;
|
|
38
|
+
sdkVersion?: string | undefined;
|
|
39
|
+
disabled?: boolean | undefined;
|
|
40
|
+
debug?: boolean | undefined;
|
|
41
|
+
trackHashChanges?: boolean | undefined;
|
|
42
|
+
trackAttributes?: boolean | undefined;
|
|
43
|
+
trackOutgoingLinks?: boolean | undefined;
|
|
44
|
+
trackInteractions?: boolean | undefined;
|
|
45
|
+
trackScrollDepth?: boolean | undefined;
|
|
46
|
+
trackPerformance?: boolean | undefined;
|
|
47
|
+
trackWebVitals?: boolean | undefined;
|
|
48
|
+
trackErrors?: boolean | undefined;
|
|
49
|
+
samplingRate?: number | undefined;
|
|
50
|
+
enableRetries?: boolean | undefined;
|
|
51
|
+
maxRetries?: number | undefined;
|
|
52
|
+
initialRetryDelay?: number | undefined;
|
|
53
|
+
enableBatching?: boolean | undefined;
|
|
54
|
+
batchSize?: number | undefined;
|
|
55
|
+
batchTimeout?: number | undefined;
|
|
56
|
+
skipPatterns?: string[] | undefined;
|
|
57
|
+
maskPatterns?: string[] | undefined;
|
|
58
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
6
59
|
|
|
7
60
|
interface FlagsPluginOptions extends FlagsConfig {
|
|
8
61
|
}
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,8 +1,61 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
1
2
|
import { App, ComputedRef } from 'vue';
|
|
2
|
-
import { d as FlagsConfig, c as FlagState, b as FlagResult } from '../shared/@databuddy/sdk.
|
|
3
|
-
export { e as FlagsContext } from '../shared/@databuddy/sdk.
|
|
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';
|
|
4
5
|
|
|
5
|
-
declare const Databuddy:
|
|
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
|
+
trackHashChanges?: boolean | undefined;
|
|
16
|
+
trackAttributes?: boolean | undefined;
|
|
17
|
+
trackOutgoingLinks?: boolean | undefined;
|
|
18
|
+
trackInteractions?: boolean | undefined;
|
|
19
|
+
trackScrollDepth?: boolean | undefined;
|
|
20
|
+
trackPerformance?: boolean | undefined;
|
|
21
|
+
trackWebVitals?: boolean | undefined;
|
|
22
|
+
trackErrors?: boolean | undefined;
|
|
23
|
+
samplingRate?: number | undefined;
|
|
24
|
+
enableRetries?: boolean | undefined;
|
|
25
|
+
maxRetries?: number | undefined;
|
|
26
|
+
initialRetryDelay?: number | undefined;
|
|
27
|
+
enableBatching?: boolean | undefined;
|
|
28
|
+
batchSize?: number | undefined;
|
|
29
|
+
batchTimeout?: number | undefined;
|
|
30
|
+
skipPatterns?: string[] | undefined;
|
|
31
|
+
maskPatterns?: string[] | undefined;
|
|
32
|
+
}, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{
|
|
33
|
+
clientId?: string | undefined;
|
|
34
|
+
clientSecret?: string | undefined;
|
|
35
|
+
apiUrl?: string | undefined;
|
|
36
|
+
scriptUrl?: string | undefined;
|
|
37
|
+
sdk?: string | undefined;
|
|
38
|
+
sdkVersion?: string | undefined;
|
|
39
|
+
disabled?: boolean | undefined;
|
|
40
|
+
debug?: boolean | undefined;
|
|
41
|
+
trackHashChanges?: boolean | undefined;
|
|
42
|
+
trackAttributes?: boolean | undefined;
|
|
43
|
+
trackOutgoingLinks?: boolean | undefined;
|
|
44
|
+
trackInteractions?: boolean | undefined;
|
|
45
|
+
trackScrollDepth?: boolean | undefined;
|
|
46
|
+
trackPerformance?: boolean | undefined;
|
|
47
|
+
trackWebVitals?: boolean | undefined;
|
|
48
|
+
trackErrors?: boolean | undefined;
|
|
49
|
+
samplingRate?: number | undefined;
|
|
50
|
+
enableRetries?: boolean | undefined;
|
|
51
|
+
maxRetries?: number | undefined;
|
|
52
|
+
initialRetryDelay?: number | undefined;
|
|
53
|
+
enableBatching?: boolean | undefined;
|
|
54
|
+
batchSize?: number | undefined;
|
|
55
|
+
batchTimeout?: number | undefined;
|
|
56
|
+
skipPatterns?: string[] | undefined;
|
|
57
|
+
maskPatterns?: string[] | undefined;
|
|
58
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
6
59
|
|
|
7
60
|
interface FlagsPluginOptions extends FlagsConfig {
|
|
8
61
|
}
|