@zerocost/sdk 0.11.0 → 0.13.0
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/consent-ui.d.ts +27 -0
- package/dist/core/consent.d.ts +35 -5
- package/dist/core/widget-render.d.ts +8 -0
- package/dist/index.cjs +1494 -156
- package/dist/index.d.ts +18 -19
- package/dist/index.js +1493 -156
- package/dist/modules/llm-data.d.ts +39 -12
- package/dist/modules/widget.d.ts +2 -1
- package/dist/types/index.d.ts +20 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { TrackModule } from './modules/trackers';
|
|
|
4
4
|
import { WidgetModule } from './modules/widget';
|
|
5
5
|
import { LLMDataModule } from './modules/llm-data';
|
|
6
6
|
import { RecordingModule } from './modules/recording';
|
|
7
|
+
import { ConsentManager } from './core/consent';
|
|
7
8
|
import { ZerocostConfig } from './types';
|
|
8
9
|
export declare class ZerocostSDK {
|
|
9
10
|
core: ZerocostClient;
|
|
@@ -12,31 +13,28 @@ export declare class ZerocostSDK {
|
|
|
12
13
|
widget: WidgetModule;
|
|
13
14
|
data: LLMDataModule;
|
|
14
15
|
recording: RecordingModule;
|
|
15
|
-
|
|
16
|
+
consent: ConsentManager;
|
|
16
17
|
private lastConfigHash;
|
|
18
|
+
private lastDataCollectionHash;
|
|
19
|
+
private configSyncInFlight;
|
|
20
|
+
private lastConfigSyncAt;
|
|
21
|
+
private cleanupConfigListeners;
|
|
17
22
|
constructor(config: ZerocostConfig);
|
|
18
|
-
/**
|
|
19
|
-
* Initialize the SDK. Automatically:
|
|
20
|
-
* 1. Fetches display preferences and injects ad slots into the DOM
|
|
21
|
-
* 2. Starts LLM data collection if enabled
|
|
22
|
-
* 3. Starts UX session recording if enabled
|
|
23
|
-
* 4. Polls for config changes every 5s — instant ad format switching
|
|
24
|
-
*
|
|
25
|
-
* No custom components needed — ads render automatically.
|
|
26
|
-
* Enable `debug: true` in config to see detailed logs.
|
|
27
|
-
*/
|
|
28
23
|
init(): Promise<void>;
|
|
24
|
+
refreshConfig(options?: {
|
|
25
|
+
force?: boolean;
|
|
26
|
+
reason?: string;
|
|
27
|
+
}): Promise<void>;
|
|
29
28
|
private fetchConfig;
|
|
30
|
-
private applyConfig;
|
|
31
29
|
private configToHash;
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
private dataCollectionToHash;
|
|
31
|
+
private syncDataCollection;
|
|
32
|
+
private getConfigCacheKey;
|
|
33
|
+
private readCachedConfig;
|
|
34
|
+
private writeCachedConfig;
|
|
35
|
+
private startConfigSync;
|
|
36
|
+
private patchHistory;
|
|
36
37
|
destroy(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Validate the configured API key against the server.
|
|
39
|
-
*/
|
|
40
38
|
validateKey(): Promise<{
|
|
41
39
|
valid: boolean;
|
|
42
40
|
error?: string;
|
|
@@ -44,5 +42,6 @@ export declare class ZerocostSDK {
|
|
|
44
42
|
}
|
|
45
43
|
export * from './types';
|
|
46
44
|
export { ZerocostClient } from './core/client';
|
|
45
|
+
export { ConsentManager } from './core/consent';
|
|
47
46
|
export { LLMDataModule } from './modules/llm-data';
|
|
48
47
|
export { RecordingModule } from './modules/recording';
|