@databuddy/sdk 2.1.75 → 2.1.77

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,7 @@
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';
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, b as Databuddy$1 } from '../shared/@databuddy/sdk.C8T93n5r.mjs';
4
+ 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.C8T93n5r.mjs';
3
5
 
4
6
  /**
5
7
  * Auto-detect Databuddy client ID from environment variables
@@ -7,6 +9,44 @@ export { B as BaseEventProperties, e as DataAttributes, d as EventName, E as Eve
7
9
  */
8
10
  declare function detectClientId(providedClientId?: string): string | undefined;
9
11
 
12
+ declare class BrowserFlagStorage implements StorageInterface {
13
+ private ttl;
14
+ get(key: string): any;
15
+ set(key: string, value: unknown): void;
16
+ getAll(): Record<string, unknown>;
17
+ clear(): void;
18
+ private getFromLocalStorage;
19
+ private setToLocalStorage;
20
+ private isExpired;
21
+ delete(key: string): void;
22
+ deleteMultiple(keys: string[]): void;
23
+ setAll(flags: Record<string, unknown>): void;
24
+ cleanupExpired(): void;
25
+ }
26
+
27
+ declare class CoreFlagsManager implements FlagsManager {
28
+ private config;
29
+ private storage?;
30
+ private onFlagsUpdate?;
31
+ private onConfigUpdate?;
32
+ private memoryFlags;
33
+ private pendingFlags;
34
+ constructor(options: FlagsManagerOptions);
35
+ private withDefaults;
36
+ private initialize;
37
+ private loadCachedFlags;
38
+ fetchAllFlags(): Promise<void>;
39
+ getFlag(key: string): Promise<FlagResult>;
40
+ private fetchFlag;
41
+ isEnabled(key: string): FlagState;
42
+ refresh(forceClear?: boolean): void;
43
+ updateUser(user: FlagsConfig['user']): void;
44
+ updateConfig(config: FlagsConfig): void;
45
+ getMemoryFlags(): Record<string, FlagResult>;
46
+ getPendingFlags(): Set<string>;
47
+ private notifyFlagsUpdate;
48
+ }
49
+
10
50
  declare function isScriptInjected(): boolean;
11
51
  declare function createScript({ scriptUrl, sdkVersion, ...props }: DatabuddyConfig): HTMLScriptElement;
12
52
 
@@ -52,4 +92,4 @@ declare function trackError(message: string, properties?: {
52
92
  */
53
93
  declare const Databuddy: typeof Databuddy$1;
54
94
 
55
- export { Databuddy, DatabuddyConfig, DatabuddyTracker, TrackFunction, clear, createScript, detectClientId, flush, getTracker, isScriptInjected, isTrackerAvailable, track, trackError };
95
+ export { BrowserFlagStorage, CoreFlagsManager, Databuddy, DatabuddyConfig, DatabuddyTracker, FlagResult, FlagState, FlagsConfig, FlagsManager, FlagsManagerOptions, StorageInterface, TrackFunction, clear, createScript, detectClientId, flush, getTracker, isScriptInjected, isTrackerAvailable, track, trackError };
@@ -1,5 +1,7 @@
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';
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, b as Databuddy$1 } from '../shared/@databuddy/sdk.C8T93n5r.js';
4
+ 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.C8T93n5r.js';
3
5
 
4
6
  /**
5
7
  * Auto-detect Databuddy client ID from environment variables
@@ -7,6 +9,44 @@ export { B as BaseEventProperties, e as DataAttributes, d as EventName, E as Eve
7
9
  */
8
10
  declare function detectClientId(providedClientId?: string): string | undefined;
9
11
 
12
+ declare class BrowserFlagStorage implements StorageInterface {
13
+ private ttl;
14
+ get(key: string): any;
15
+ set(key: string, value: unknown): void;
16
+ getAll(): Record<string, unknown>;
17
+ clear(): void;
18
+ private getFromLocalStorage;
19
+ private setToLocalStorage;
20
+ private isExpired;
21
+ delete(key: string): void;
22
+ deleteMultiple(keys: string[]): void;
23
+ setAll(flags: Record<string, unknown>): void;
24
+ cleanupExpired(): void;
25
+ }
26
+
27
+ declare class CoreFlagsManager implements FlagsManager {
28
+ private config;
29
+ private storage?;
30
+ private onFlagsUpdate?;
31
+ private onConfigUpdate?;
32
+ private memoryFlags;
33
+ private pendingFlags;
34
+ constructor(options: FlagsManagerOptions);
35
+ private withDefaults;
36
+ private initialize;
37
+ private loadCachedFlags;
38
+ fetchAllFlags(): Promise<void>;
39
+ getFlag(key: string): Promise<FlagResult>;
40
+ private fetchFlag;
41
+ isEnabled(key: string): FlagState;
42
+ refresh(forceClear?: boolean): void;
43
+ updateUser(user: FlagsConfig['user']): void;
44
+ updateConfig(config: FlagsConfig): void;
45
+ getMemoryFlags(): Record<string, FlagResult>;
46
+ getPendingFlags(): Set<string>;
47
+ private notifyFlagsUpdate;
48
+ }
49
+
10
50
  declare function isScriptInjected(): boolean;
11
51
  declare function createScript({ scriptUrl, sdkVersion, ...props }: DatabuddyConfig): HTMLScriptElement;
12
52
 
@@ -52,4 +92,4 @@ declare function trackError(message: string, properties?: {
52
92
  */
53
93
  declare const Databuddy: typeof Databuddy$1;
54
94
 
55
- export { Databuddy, DatabuddyConfig, DatabuddyTracker, TrackFunction, clear, createScript, detectClientId, flush, getTracker, isScriptInjected, isTrackerAvailable, track, trackError };
95
+ export { BrowserFlagStorage, CoreFlagsManager, Databuddy, DatabuddyConfig, DatabuddyTracker, FlagResult, FlagState, FlagsConfig, FlagsManager, FlagsManagerOptions, StorageInterface, TrackFunction, clear, createScript, detectClientId, flush, getTracker, isScriptInjected, isTrackerAvailable, track, trackError };
@@ -1,6 +1,6 @@
1
- import { D as Databuddy$1 } from '../shared/@databuddy/sdk.mo6tEgU3.mjs';
2
- export { d as detectClientId } from '../shared/@databuddy/sdk.mo6tEgU3.mjs';
3
- export { c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.DsZP9wPD.mjs';
1
+ import { D as Databuddy$1 } from '../shared/@databuddy/sdk.VZOaS2Dk.mjs';
2
+ export { d as detectClientId } from '../shared/@databuddy/sdk.VZOaS2Dk.mjs';
3
+ export { B as BrowserFlagStorage, C as CoreFlagsManager, c as createScript, i as isScriptInjected } from '../shared/@databuddy/sdk.DsZMb6-q.mjs';
4
4
 
5
5
  function isTrackerAvailable() {
6
6
  return typeof window !== "undefined" && (!!window.databuddy || !!window.db);
@@ -1,46 +1,9 @@
1
- export { b as Databuddy } from '../shared/@databuddy/sdk.BEpoKc14.mjs';
1
+ export { b as Databuddy } from '../shared/@databuddy/sdk.C8T93n5r.mjs';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
4
  import * as jotai from 'jotai';
5
-
6
- interface FlagResult {
7
- enabled: boolean;
8
- value: boolean;
9
- payload: any;
10
- reason: string;
11
- flagId?: string;
12
- flagType?: 'boolean' | 'rollout';
13
- }
14
- interface FlagsConfig {
15
- /** Client ID for flag evaluation */
16
- clientId: string;
17
- apiUrl?: string;
18
- user?: {
19
- userId?: string;
20
- email?: string;
21
- properties?: Record<string, any>;
22
- };
23
- disabled?: boolean;
24
- /** Enable debug logging */
25
- debug?: boolean;
26
- /** Skip persistent storage */
27
- skipStorage?: boolean;
28
- /** Whether session is loading */
29
- isPending?: boolean;
30
- /** Automatically fetch all flags on initialization (default: true) */
31
- autoFetch?: boolean;
32
- }
33
- interface FlagState {
34
- enabled: boolean;
35
- isLoading: boolean;
36
- isReady: boolean;
37
- }
38
- interface FlagsContext {
39
- isEnabled: (key: string) => FlagState;
40
- fetchAllFlags: () => Promise<void>;
41
- updateUser: (user: FlagsConfig['user']) => void;
42
- refresh: (forceClear?: boolean) => Promise<void>;
43
- }
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';
44
7
 
45
8
  interface FlagsProviderProps extends FlagsConfig {
46
9
  children: ReactNode;
@@ -55,10 +18,9 @@ declare function FlagsProvider({ children, ...config }: FlagsProviderProps): rea
55
18
  }>;
56
19
  declare function useFlags(): {
57
20
  isEnabled: (key: string) => FlagState;
58
- fetchAllFlags: () => Promise<void>;
21
+ fetchAllFlags: () => Promise<void> | undefined;
59
22
  updateUser: (user: FlagsConfig["user"]) => void;
60
23
  refresh: (forceClear?: boolean) => void;
61
24
  };
62
25
 
63
- export { FlagsProvider, useFlags };
64
- export type { FlagResult, FlagState, FlagsConfig, FlagsContext };
26
+ export { FlagState, FlagsConfig, FlagsProvider, useFlags };
@@ -1,46 +1,9 @@
1
- export { b as Databuddy } from '../shared/@databuddy/sdk.BEpoKc14.js';
1
+ export { b as Databuddy } from '../shared/@databuddy/sdk.C8T93n5r.js';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
4
  import * as jotai from 'jotai';
5
-
6
- interface FlagResult {
7
- enabled: boolean;
8
- value: boolean;
9
- payload: any;
10
- reason: string;
11
- flagId?: string;
12
- flagType?: 'boolean' | 'rollout';
13
- }
14
- interface FlagsConfig {
15
- /** Client ID for flag evaluation */
16
- clientId: string;
17
- apiUrl?: string;
18
- user?: {
19
- userId?: string;
20
- email?: string;
21
- properties?: Record<string, any>;
22
- };
23
- disabled?: boolean;
24
- /** Enable debug logging */
25
- debug?: boolean;
26
- /** Skip persistent storage */
27
- skipStorage?: boolean;
28
- /** Whether session is loading */
29
- isPending?: boolean;
30
- /** Automatically fetch all flags on initialization (default: true) */
31
- autoFetch?: boolean;
32
- }
33
- interface FlagState {
34
- enabled: boolean;
35
- isLoading: boolean;
36
- isReady: boolean;
37
- }
38
- interface FlagsContext {
39
- isEnabled: (key: string) => FlagState;
40
- fetchAllFlags: () => Promise<void>;
41
- updateUser: (user: FlagsConfig['user']) => void;
42
- refresh: (forceClear?: boolean) => Promise<void>;
43
- }
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';
44
7
 
45
8
  interface FlagsProviderProps extends FlagsConfig {
46
9
  children: ReactNode;
@@ -55,10 +18,9 @@ declare function FlagsProvider({ children, ...config }: FlagsProviderProps): rea
55
18
  }>;
56
19
  declare function useFlags(): {
57
20
  isEnabled: (key: string) => FlagState;
58
- fetchAllFlags: () => Promise<void>;
21
+ fetchAllFlags: () => Promise<void> | undefined;
59
22
  updateUser: (user: FlagsConfig["user"]) => void;
60
23
  refresh: (forceClear?: boolean) => void;
61
24
  };
62
25
 
63
- export { FlagsProvider, useFlags };
64
- export type { FlagResult, FlagState, FlagsConfig, FlagsContext };
26
+ export { FlagState, FlagsConfig, FlagsProvider, useFlags };