@databuddy/sdk 2.1.1 → 2.1.3
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 +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.mjs +3 -3
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.mjs +63 -78
- package/dist/shared/@databuddy/{sdk.DqscWwcO.mjs → sdk.B5hAFq2y.mjs} +1 -1
- package/dist/shared/@databuddy/{sdk.ClgMzRh8.d.mts → sdk.BEpoKc14.d.mts} +4 -0
- package/dist/shared/@databuddy/{sdk.ClgMzRh8.d.ts → sdk.BEpoKc14.d.ts} +4 -0
- package/dist/shared/@databuddy/{sdk.B1Fz4Gpw.mjs → sdk.DQJLj9Dk.mjs} +2 -2
- package/dist/vue/index.d.mts +6 -1
- package/dist/vue/index.d.ts +6 -1
- package/dist/vue/index.mjs +1 -1
- package/package.json +62 -62
package/dist/core/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction, b as Databuddy$1 } from '../shared/@databuddy/sdk.
|
|
2
|
-
export { B as BaseEventProperties, e as DataAttributes, d as EventName, E as EventProperties, c as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, f as SetGlobalPropertiesFunction } from '../shared/@databuddy/sdk.
|
|
1
|
+
import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction, b as Databuddy$1 } from '../shared/@databuddy/sdk.BEpoKc14.mjs';
|
|
2
|
+
export { B as BaseEventProperties, e as DataAttributes, d as EventName, E as EventProperties, c as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, f as SetGlobalPropertiesFunction } from '../shared/@databuddy/sdk.BEpoKc14.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Auto-detect Databuddy client ID from environment variables
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction, b as Databuddy$1 } from '../shared/@databuddy/sdk.
|
|
2
|
-
export { B as BaseEventProperties, e as DataAttributes, d as EventName, E as EventProperties, c as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, f as SetGlobalPropertiesFunction } from '../shared/@databuddy/sdk.
|
|
1
|
+
import { D as DatabuddyConfig, a as DatabuddyTracker, T as TrackFunction, b as Databuddy$1 } from '../shared/@databuddy/sdk.BEpoKc14.js';
|
|
2
|
+
export { B as BaseEventProperties, e as DataAttributes, d as EventName, E as EventProperties, c as EventTypeMap, P as PropertiesForEvent, S as ScreenViewFunction, f as SetGlobalPropertiesFunction } from '../shared/@databuddy/sdk.BEpoKc14.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Auto-detect Databuddy client ID from environment variables
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as Databuddy$1 } from '../shared/@databuddy/sdk.
|
|
2
|
-
export { d as detectClientId } from '../shared/@databuddy/sdk.
|
|
3
|
-
export { c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.
|
|
1
|
+
import { D as Databuddy$1 } from '../shared/@databuddy/sdk.DQJLj9Dk.mjs';
|
|
2
|
+
export { d as detectClientId } from '../shared/@databuddy/sdk.DQJLj9Dk.mjs';
|
|
3
|
+
export { c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.B5hAFq2y.mjs';
|
|
4
4
|
|
|
5
5
|
function isTrackerAvailable() {
|
|
6
6
|
return typeof window !== "undefined" && (!!window.databuddy || !!window.db);
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as Databuddy } from '../shared/@databuddy/sdk.
|
|
1
|
+
export { b as Databuddy } from '../shared/@databuddy/sdk.BEpoKc14.mjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import * as jotai from 'jotai';
|
|
@@ -31,7 +31,7 @@ interface FlagsConfig {
|
|
|
31
31
|
autoFetch?: boolean;
|
|
32
32
|
}
|
|
33
33
|
interface FlagsContext {
|
|
34
|
-
isEnabled: (key: string) => boolean;
|
|
34
|
+
isEnabled: (key: string) => boolean | undefined;
|
|
35
35
|
getValue: (key: string, defaultValue?: boolean) => boolean;
|
|
36
36
|
fetchAllFlags: () => Promise<void>;
|
|
37
37
|
updateUser: (user: FlagsConfig['user']) => void;
|
|
@@ -50,7 +50,7 @@ declare function FlagsProvider({ children, ...config }: FlagsProviderProps): rea
|
|
|
50
50
|
};
|
|
51
51
|
}>;
|
|
52
52
|
declare function useFlags(): {
|
|
53
|
-
isEnabled: (key: string) => boolean;
|
|
53
|
+
isEnabled: (key: string) => boolean | undefined;
|
|
54
54
|
getValue: (key: string, defaultValue?: boolean) => boolean;
|
|
55
55
|
fetchAllFlags: () => Promise<void>;
|
|
56
56
|
updateUser: (user: FlagsConfig["user"]) => void;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as Databuddy } from '../shared/@databuddy/sdk.
|
|
1
|
+
export { b as Databuddy } from '../shared/@databuddy/sdk.BEpoKc14.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import * as jotai from 'jotai';
|
|
@@ -31,7 +31,7 @@ interface FlagsConfig {
|
|
|
31
31
|
autoFetch?: boolean;
|
|
32
32
|
}
|
|
33
33
|
interface FlagsContext {
|
|
34
|
-
isEnabled: (key: string) => boolean;
|
|
34
|
+
isEnabled: (key: string) => boolean | undefined;
|
|
35
35
|
getValue: (key: string, defaultValue?: boolean) => boolean;
|
|
36
36
|
fetchAllFlags: () => Promise<void>;
|
|
37
37
|
updateUser: (user: FlagsConfig['user']) => void;
|
|
@@ -50,7 +50,7 @@ declare function FlagsProvider({ children, ...config }: FlagsProviderProps): rea
|
|
|
50
50
|
};
|
|
51
51
|
}>;
|
|
52
52
|
declare function useFlags(): {
|
|
53
|
-
isEnabled: (key: string) => boolean;
|
|
53
|
+
isEnabled: (key: string) => boolean | undefined;
|
|
54
54
|
getValue: (key: string, defaultValue?: boolean) => boolean;
|
|
55
55
|
fetchAllFlags: () => Promise<void>;
|
|
56
56
|
updateUser: (user: FlagsConfig["user"]) => void;
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
export { D as Databuddy } from '../shared/@databuddy/sdk.
|
|
3
|
+
export { D as Databuddy } from '../shared/@databuddy/sdk.DQJLj9Dk.mjs';
|
|
4
4
|
import { createStore, atom, Provider, useAtom } from 'jotai';
|
|
5
5
|
import { useEffect, createElement } from 'react';
|
|
6
|
-
import '../shared/@databuddy/sdk.
|
|
6
|
+
import '../shared/@databuddy/sdk.B5hAFq2y.mjs';
|
|
7
7
|
|
|
8
8
|
class FlagStorage {
|
|
9
9
|
dbName = "databuddy-flags";
|
|
@@ -235,33 +235,38 @@ const configAtom = atom(null);
|
|
|
235
235
|
const memoryFlagsAtom = atom({});
|
|
236
236
|
const pendingFlagsAtom = atom(/* @__PURE__ */ new Set());
|
|
237
237
|
function FlagsProvider({ children, ...config }) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
isPending: config.isPending,
|
|
242
|
-
hasUser: !!config.user
|
|
243
|
-
});
|
|
244
|
-
useEffect(() => {
|
|
245
|
-
const newConfig = {
|
|
238
|
+
const debug = config.debug ?? false;
|
|
239
|
+
if (debug) {
|
|
240
|
+
console.log("[Databuddy Flags] Provider rendering with config:", {
|
|
246
241
|
clientId: config.clientId,
|
|
247
|
-
|
|
248
|
-
user: config.user,
|
|
249
|
-
disabled: config.disabled,
|
|
250
|
-
debug: config.debug,
|
|
251
|
-
skipStorage: config.skipStorage,
|
|
242
|
+
debug,
|
|
252
243
|
isPending: config.isPending,
|
|
253
|
-
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
|
|
244
|
+
hasUser: !!config.user
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
const configWithDefaults = {
|
|
257
249
|
clientId: config.clientId,
|
|
258
|
-
apiUrl: config.apiUrl,
|
|
250
|
+
apiUrl: config.apiUrl ?? "https://api.databuddy.cc",
|
|
259
251
|
user: config.user,
|
|
252
|
+
disabled: config.disabled ?? false,
|
|
253
|
+
debug,
|
|
254
|
+
skipStorage: config.skipStorage ?? false,
|
|
260
255
|
isPending: config.isPending,
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
autoFetch: config.autoFetch !== false
|
|
257
|
+
};
|
|
258
|
+
flagsStore.set(configAtom, configWithDefaults);
|
|
259
|
+
if (debug) {
|
|
260
|
+
console.log("[Databuddy Flags] Config set on store", {
|
|
261
|
+
clientId: config.clientId,
|
|
262
|
+
apiUrl: configWithDefaults.apiUrl,
|
|
263
|
+
user: config.user,
|
|
264
|
+
isPending: config.isPending,
|
|
265
|
+
skipStorage: config.skipStorage ?? false
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
if (!(config.skipStorage ?? false)) {
|
|
269
|
+
loadCachedFlagsImmediate(configWithDefaults);
|
|
265
270
|
flagStorage.cleanupExpired().catch(() => {
|
|
266
271
|
});
|
|
267
272
|
}
|
|
@@ -276,8 +281,8 @@ function FlagsProvider({ children, ...config }) {
|
|
|
276
281
|
config.isPending,
|
|
277
282
|
config.autoFetch
|
|
278
283
|
]);
|
|
279
|
-
const loadCachedFlagsImmediate = (
|
|
280
|
-
if (
|
|
284
|
+
const loadCachedFlagsImmediate = (config2) => {
|
|
285
|
+
if (config2.skipStorage) {
|
|
281
286
|
return;
|
|
282
287
|
}
|
|
283
288
|
try {
|
|
@@ -297,7 +302,7 @@ function FlagsProvider({ children, ...config }) {
|
|
|
297
302
|
}
|
|
298
303
|
if (Object.keys(cachedFlags).length > 0) {
|
|
299
304
|
flagsStore.set(memoryFlagsAtom, cachedFlags);
|
|
300
|
-
if (
|
|
305
|
+
if (config2.debug) {
|
|
301
306
|
console.log(
|
|
302
307
|
"[Databuddy Flags] Loaded cached flags immediately:",
|
|
303
308
|
Object.keys(cachedFlags)
|
|
@@ -305,7 +310,7 @@ function FlagsProvider({ children, ...config }) {
|
|
|
305
310
|
}
|
|
306
311
|
}
|
|
307
312
|
} catch (err) {
|
|
308
|
-
if (
|
|
313
|
+
if (config2.debug) {
|
|
309
314
|
console.warn(
|
|
310
315
|
"[Databuddy Flags] Error loading cached flags immediately:",
|
|
311
316
|
err
|
|
@@ -318,7 +323,7 @@ function FlagsProvider({ children, ...config }) {
|
|
|
318
323
|
...prev,
|
|
319
324
|
...cachedFlags
|
|
320
325
|
}));
|
|
321
|
-
if (
|
|
326
|
+
if (config2.debug) {
|
|
322
327
|
console.log(
|
|
323
328
|
"[Databuddy Flags] Loaded cached flags from IndexedDB:",
|
|
324
329
|
Object.keys(cachedFlags)
|
|
@@ -326,7 +331,7 @@ function FlagsProvider({ children, ...config }) {
|
|
|
326
331
|
}
|
|
327
332
|
}
|
|
328
333
|
}).catch((err) => {
|
|
329
|
-
if (
|
|
334
|
+
if (config2.debug) {
|
|
330
335
|
console.warn("[Databuddy Flags] Error loading from IndexedDB:", err);
|
|
331
336
|
}
|
|
332
337
|
});
|
|
@@ -341,15 +346,17 @@ function useFlags() {
|
|
|
341
346
|
const [pendingFlags, setPendingFlags] = useAtom(pendingFlagsAtom, {
|
|
342
347
|
store: flagsStore
|
|
343
348
|
});
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
349
|
+
if (config?.debug) {
|
|
350
|
+
console.log("[Databuddy Flags] useFlags called with config:", {
|
|
351
|
+
hasConfig: !!config,
|
|
352
|
+
clientId: config?.clientId,
|
|
353
|
+
isPending: config?.isPending,
|
|
354
|
+
debug: config?.debug,
|
|
355
|
+
skipStorage: config?.skipStorage,
|
|
356
|
+
memoryFlagsCount: Object.keys(memoryFlags).length,
|
|
357
|
+
memoryFlags: Object.keys(memoryFlags)
|
|
358
|
+
});
|
|
359
|
+
}
|
|
353
360
|
const fetchAllFlags = async () => {
|
|
354
361
|
if (!config) {
|
|
355
362
|
console.warn("[Databuddy Flags] No config for bulk fetch");
|
|
@@ -374,10 +381,7 @@ function useFlags() {
|
|
|
374
381
|
}
|
|
375
382
|
const url = `${config.apiUrl}/public/v1/flags/bulk?${params.toString()}`;
|
|
376
383
|
try {
|
|
377
|
-
const response = await fetch(url
|
|
378
|
-
method: "GET",
|
|
379
|
-
headers: { Accept: "application/json" }
|
|
380
|
-
});
|
|
384
|
+
const response = await fetch(url);
|
|
381
385
|
if (!response.ok) {
|
|
382
386
|
throw new Error(`HTTP ${response.status}`);
|
|
383
387
|
}
|
|
@@ -391,9 +395,7 @@ function useFlags() {
|
|
|
391
395
|
try {
|
|
392
396
|
await flagStorage.setAll(result.flags);
|
|
393
397
|
if (config.debug) {
|
|
394
|
-
console.log(
|
|
395
|
-
"[Databuddy Flags] Bulk flags synced to cache, removed old flags"
|
|
396
|
-
);
|
|
398
|
+
console.log("[Databuddy Flags] Bulk flags synced to cache");
|
|
397
399
|
}
|
|
398
400
|
} catch (err) {
|
|
399
401
|
if (config.debug) {
|
|
@@ -433,44 +435,34 @@ function useFlags() {
|
|
|
433
435
|
}
|
|
434
436
|
const url = `${config.apiUrl}/public/v1/flags/evaluate?${params.toString()}`;
|
|
435
437
|
if (config.debug) {
|
|
436
|
-
console.log(`[Databuddy Flags] Fetching
|
|
437
|
-
console.log(`[Databuddy Flags] Request details for ${key}:`, {
|
|
438
|
-
hasConfig: !!config,
|
|
439
|
-
hasUser: !!config.user,
|
|
440
|
-
userId: config.user?.userId || "MISSING",
|
|
441
|
-
email: config.user?.email || "MISSING",
|
|
442
|
-
clientId: config.clientId || "MISSING"
|
|
443
|
-
});
|
|
438
|
+
console.log(`[Databuddy Flags] Fetching: ${key}`);
|
|
444
439
|
}
|
|
445
440
|
try {
|
|
446
|
-
const response = await fetch(url
|
|
447
|
-
method: "GET",
|
|
448
|
-
headers: { Accept: "application/json" }
|
|
449
|
-
});
|
|
441
|
+
const response = await fetch(url);
|
|
450
442
|
if (!response.ok) {
|
|
451
443
|
throw new Error(`HTTP ${response.status}`);
|
|
452
444
|
}
|
|
453
445
|
const result = await response.json();
|
|
454
446
|
if (config.debug) {
|
|
455
|
-
console.log(`[Databuddy Flags]
|
|
447
|
+
console.log(`[Databuddy Flags] Response for ${key}:`, result);
|
|
456
448
|
}
|
|
457
449
|
setMemoryFlags((prev) => ({ ...prev, [key]: result }));
|
|
458
450
|
if (!config.skipStorage) {
|
|
459
451
|
try {
|
|
460
452
|
await flagStorage.set(key, result);
|
|
461
453
|
if (config.debug) {
|
|
462
|
-
console.log(`[Databuddy Flags]
|
|
454
|
+
console.log(`[Databuddy Flags] Cached: ${key}`);
|
|
463
455
|
}
|
|
464
456
|
} catch (err) {
|
|
465
457
|
if (config.debug) {
|
|
466
|
-
console.warn(`[Databuddy Flags]
|
|
458
|
+
console.warn(`[Databuddy Flags] Cache error: ${key}`, err);
|
|
467
459
|
}
|
|
468
460
|
}
|
|
469
461
|
}
|
|
470
462
|
return result;
|
|
471
463
|
} catch (err) {
|
|
472
464
|
if (config.debug) {
|
|
473
|
-
console.error(`[Databuddy Flags] Fetch error
|
|
465
|
+
console.error(`[Databuddy Flags] Fetch error: ${key}`, err);
|
|
474
466
|
}
|
|
475
467
|
const fallback = {
|
|
476
468
|
enabled: false,
|
|
@@ -490,13 +482,11 @@ function useFlags() {
|
|
|
490
482
|
};
|
|
491
483
|
const getFlag = async (key) => {
|
|
492
484
|
if (config?.debug) {
|
|
493
|
-
console.log(`[Databuddy Flags] Getting
|
|
485
|
+
console.log(`[Databuddy Flags] Getting: ${key}`);
|
|
494
486
|
}
|
|
495
487
|
if (config?.isPending) {
|
|
496
488
|
if (config?.debug) {
|
|
497
|
-
console.log(
|
|
498
|
-
`[Databuddy Flags] Session pending, returning default for: ${key}`
|
|
499
|
-
);
|
|
489
|
+
console.log(`[Databuddy Flags] Session pending for: ${key}`);
|
|
500
490
|
}
|
|
501
491
|
return {
|
|
502
492
|
enabled: false,
|
|
@@ -507,18 +497,13 @@ function useFlags() {
|
|
|
507
497
|
}
|
|
508
498
|
if (memoryFlags[key]) {
|
|
509
499
|
if (config?.debug) {
|
|
510
|
-
console.log(
|
|
511
|
-
`[Databuddy Flags] Found in memory: ${key}`,
|
|
512
|
-
memoryFlags[key]
|
|
513
|
-
);
|
|
500
|
+
console.log(`[Databuddy Flags] Memory: ${key}`);
|
|
514
501
|
}
|
|
515
502
|
return memoryFlags[key];
|
|
516
503
|
}
|
|
517
504
|
if (pendingFlags.has(key)) {
|
|
518
505
|
if (config?.debug) {
|
|
519
|
-
console.log(
|
|
520
|
-
`[Databuddy Flags] Already fetching: ${key}, returning default`
|
|
521
|
-
);
|
|
506
|
+
console.log(`[Databuddy Flags] Pending: ${key}`);
|
|
522
507
|
}
|
|
523
508
|
return {
|
|
524
509
|
enabled: false,
|
|
@@ -532,14 +517,14 @@ function useFlags() {
|
|
|
532
517
|
const cached = await flagStorage.get(key);
|
|
533
518
|
if (cached) {
|
|
534
519
|
if (config?.debug) {
|
|
535
|
-
console.log(`[Databuddy Flags]
|
|
520
|
+
console.log(`[Databuddy Flags] Cache: ${key}`);
|
|
536
521
|
}
|
|
537
522
|
setMemoryFlags((prev) => ({ ...prev, [key]: cached }));
|
|
538
523
|
return cached;
|
|
539
524
|
}
|
|
540
525
|
} catch (err) {
|
|
541
526
|
if (config?.debug) {
|
|
542
|
-
console.warn(`[Databuddy Flags] Storage error
|
|
527
|
+
console.warn(`[Databuddy Flags] Storage error: ${key}`, err);
|
|
543
528
|
}
|
|
544
529
|
}
|
|
545
530
|
}
|
|
@@ -550,7 +535,7 @@ function useFlags() {
|
|
|
550
535
|
return memoryFlags[key].enabled;
|
|
551
536
|
}
|
|
552
537
|
getFlag(key);
|
|
553
|
-
return
|
|
538
|
+
return;
|
|
554
539
|
};
|
|
555
540
|
const getValue = (key, defaultValue = false) => {
|
|
556
541
|
if (memoryFlags[key]) {
|
|
@@ -561,7 +546,7 @@ function useFlags() {
|
|
|
561
546
|
};
|
|
562
547
|
const refresh = async (forceClear = false) => {
|
|
563
548
|
if (config?.debug) {
|
|
564
|
-
console.log("[Databuddy Flags] Refreshing
|
|
549
|
+
console.log("[Databuddy Flags] Refreshing", { forceClear });
|
|
565
550
|
}
|
|
566
551
|
if (forceClear) {
|
|
567
552
|
setMemoryFlags({});
|
|
@@ -589,7 +574,7 @@ function useFlags() {
|
|
|
589
574
|
useEffect(() => {
|
|
590
575
|
if (config && !config.isPending && config.autoFetch !== false) {
|
|
591
576
|
if (config.debug) {
|
|
592
|
-
console.log("[Databuddy Flags] Auto-fetching
|
|
577
|
+
console.log("[Databuddy Flags] Auto-fetching");
|
|
593
578
|
}
|
|
594
579
|
fetchAllFlags();
|
|
595
580
|
}
|
|
@@ -40,6 +40,10 @@ interface DatabuddyConfig {
|
|
|
40
40
|
* If true, no events will be sent.
|
|
41
41
|
*/
|
|
42
42
|
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Enable debug logging (default: false).
|
|
45
|
+
*/
|
|
46
|
+
debug?: boolean;
|
|
43
47
|
/**
|
|
44
48
|
* Wait for user profile before sending events (advanced, default: false).
|
|
45
49
|
*/
|
|
@@ -40,6 +40,10 @@ interface DatabuddyConfig {
|
|
|
40
40
|
* If true, no events will be sent.
|
|
41
41
|
*/
|
|
42
42
|
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Enable debug logging (default: false).
|
|
45
|
+
*/
|
|
46
|
+
debug?: boolean;
|
|
43
47
|
/**
|
|
44
48
|
* Wait for user profile before sending events (advanced, default: false).
|
|
45
49
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isScriptInjected, c as createScript } from './sdk.
|
|
1
|
+
import { i as isScriptInjected, c as createScript } from './sdk.B5hAFq2y.mjs';
|
|
2
2
|
|
|
3
3
|
function detectClientId(providedClientId) {
|
|
4
4
|
if (providedClientId) {
|
|
@@ -27,7 +27,7 @@ function detectClientId(providedClientId) {
|
|
|
27
27
|
function Databuddy(props) {
|
|
28
28
|
const clientId = detectClientId(props.clientId);
|
|
29
29
|
if (!clientId) {
|
|
30
|
-
if (typeof window !== "undefined" && !props.disabled) {
|
|
30
|
+
if (typeof window !== "undefined" && !props.disabled && props.debug) {
|
|
31
31
|
console.warn(
|
|
32
32
|
"Databuddy: No client ID found. Please provide clientId prop or set NEXT_PUBLIC_DATABUDDY_CLIENT_ID environment variable."
|
|
33
33
|
);
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -29,6 +29,10 @@ declare const Databuddy: vue.DefineComponent<{
|
|
|
29
29
|
type: BooleanConstructor;
|
|
30
30
|
required: false;
|
|
31
31
|
} | undefined;
|
|
32
|
+
debug?: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
required: false;
|
|
35
|
+
} | undefined;
|
|
32
36
|
waitForProfile?: {
|
|
33
37
|
type: BooleanConstructor;
|
|
34
38
|
required: false;
|
|
@@ -142,13 +146,14 @@ declare const Databuddy: vue.DefineComponent<{
|
|
|
142
146
|
required: false;
|
|
143
147
|
} | undefined;
|
|
144
148
|
}, () => null, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<{} & {
|
|
145
|
-
sdk?: string | undefined;
|
|
146
149
|
clientId?: string | undefined;
|
|
147
150
|
clientSecret?: string | undefined;
|
|
148
151
|
apiUrl?: string | undefined;
|
|
149
152
|
scriptUrl?: string | undefined;
|
|
153
|
+
sdk?: string | undefined;
|
|
150
154
|
sdkVersion?: string | undefined;
|
|
151
155
|
disabled?: boolean | undefined;
|
|
156
|
+
debug?: boolean | undefined;
|
|
152
157
|
waitForProfile?: boolean | undefined;
|
|
153
158
|
trackScreenViews?: boolean | undefined;
|
|
154
159
|
trackHashChanges?: boolean | undefined;
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ declare const Databuddy: vue.DefineComponent<{
|
|
|
29
29
|
type: BooleanConstructor;
|
|
30
30
|
required: false;
|
|
31
31
|
} | undefined;
|
|
32
|
+
debug?: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
required: false;
|
|
35
|
+
} | undefined;
|
|
32
36
|
waitForProfile?: {
|
|
33
37
|
type: BooleanConstructor;
|
|
34
38
|
required: false;
|
|
@@ -142,13 +146,14 @@ declare const Databuddy: vue.DefineComponent<{
|
|
|
142
146
|
required: false;
|
|
143
147
|
} | undefined;
|
|
144
148
|
}, () => null, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<{} & {
|
|
145
|
-
sdk?: string | undefined;
|
|
146
149
|
clientId?: string | undefined;
|
|
147
150
|
clientSecret?: string | undefined;
|
|
148
151
|
apiUrl?: string | undefined;
|
|
149
152
|
scriptUrl?: string | undefined;
|
|
153
|
+
sdk?: string | undefined;
|
|
150
154
|
sdkVersion?: string | undefined;
|
|
151
155
|
disabled?: boolean | undefined;
|
|
156
|
+
debug?: boolean | undefined;
|
|
152
157
|
waitForProfile?: boolean | undefined;
|
|
153
158
|
trackScreenViews?: boolean | undefined;
|
|
154
159
|
trackHashChanges?: boolean | undefined;
|
package/dist/vue/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, onUnmounted, watch } from 'vue';
|
|
2
|
-
import { i as isScriptInjected, c as createScript } from '../shared/@databuddy/sdk.
|
|
2
|
+
import { i as isScriptInjected, c as createScript } from '../shared/@databuddy/sdk.B5hAFq2y.mjs';
|
|
3
3
|
|
|
4
4
|
const Databuddy = defineComponent({
|
|
5
5
|
props: {},
|
package/package.json
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@databuddy/sdk",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Official Databuddy Analytics SDK",
|
|
5
|
-
"main": "./dist/core/index.mjs",
|
|
6
|
-
"types": "./dist/core/index.d.ts",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"private": false,
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "unbuild"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@types/node": "^20.0.0",
|
|
14
|
-
"@vitejs/plugin-react": "^5.0.0",
|
|
15
|
-
"react": "18.0.0",
|
|
16
|
-
"typescript": "catalog:",
|
|
17
|
-
"unbuild": "^3.6.1",
|
|
18
|
-
"vue": "3.0.0",
|
|
19
|
-
"vue-sfc-transformer": "^0.1.16"
|
|
20
|
-
},
|
|
21
|
-
"peerDependencies": {
|
|
22
|
-
"react": ">=18",
|
|
23
|
-
"vue": ">=3",
|
|
24
|
-
"jotai": ">=2.0.0"
|
|
25
|
-
},
|
|
26
|
-
"peerDependenciesMeta": {
|
|
27
|
-
"react": {
|
|
28
|
-
"optional": true
|
|
29
|
-
},
|
|
30
|
-
"vue": {
|
|
31
|
-
"optional": true
|
|
32
|
-
},
|
|
33
|
-
"jotai": {
|
|
34
|
-
"optional": true
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"exports": {
|
|
38
|
-
".": {
|
|
39
|
-
"types": "./dist/core/index.d.ts",
|
|
40
|
-
"import": "./dist/core/index.mjs"
|
|
41
|
-
},
|
|
42
|
-
"./react": {
|
|
43
|
-
"types": "./dist/react/index.d.ts",
|
|
44
|
-
"import": "./dist/react/index.mjs"
|
|
45
|
-
},
|
|
46
|
-
"./vue": {
|
|
47
|
-
"types": "./dist/vue/index.d.ts",
|
|
48
|
-
"import": "./dist/vue/index.mjs"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"files": [
|
|
52
|
-
"dist"
|
|
53
|
-
],
|
|
54
|
-
"keywords": [
|
|
55
|
-
"analytics",
|
|
56
|
-
"tracking",
|
|
57
|
-
"databuddy",
|
|
58
|
-
"sdk",
|
|
59
|
-
"react",
|
|
60
|
-
"vue"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@databuddy/sdk",
|
|
3
|
+
"version": "2.1.3",
|
|
4
|
+
"description": "Official Databuddy Analytics SDK",
|
|
5
|
+
"main": "./dist/core/index.mjs",
|
|
6
|
+
"types": "./dist/core/index.d.ts",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"private": false,
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "unbuild"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^20.0.0",
|
|
14
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
15
|
+
"react": "18.0.0",
|
|
16
|
+
"typescript": "catalog:",
|
|
17
|
+
"unbuild": "^3.6.1",
|
|
18
|
+
"vue": "3.0.0",
|
|
19
|
+
"vue-sfc-transformer": "^0.1.16"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": ">=18",
|
|
23
|
+
"vue": ">=3",
|
|
24
|
+
"jotai": ">=2.0.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"react": {
|
|
28
|
+
"optional": true
|
|
29
|
+
},
|
|
30
|
+
"vue": {
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
"jotai": {
|
|
34
|
+
"optional": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/core/index.d.ts",
|
|
40
|
+
"import": "./dist/core/index.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./react": {
|
|
43
|
+
"types": "./dist/react/index.d.ts",
|
|
44
|
+
"import": "./dist/react/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
"./vue": {
|
|
47
|
+
"types": "./dist/vue/index.d.ts",
|
|
48
|
+
"import": "./dist/vue/index.mjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist"
|
|
53
|
+
],
|
|
54
|
+
"keywords": [
|
|
55
|
+
"analytics",
|
|
56
|
+
"tracking",
|
|
57
|
+
"databuddy",
|
|
58
|
+
"sdk",
|
|
59
|
+
"react",
|
|
60
|
+
"vue"
|
|
61
|
+
]
|
|
62
|
+
}
|