@zerocost/sdk 0.1.0 → 0.3.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/index.d.ts CHANGED
@@ -1,45 +1,41 @@
1
- interface ZerocostConfig {
2
- appId: string;
3
- environment?: 'production' | 'development';
4
- debug?: boolean;
5
- }
6
- interface UserConsent {
7
- analytics: boolean;
8
- advertising: boolean;
9
- }
10
- interface AdUnitConfig {
11
- placementId: string;
12
- format: 'video' | 'display' | 'native';
13
- targetElementId?: string;
14
- }
15
- interface TrackingEvent {
16
- eventName: string;
17
- properties?: Record<string, any>;
18
- timestamp: number;
19
- }
20
-
21
- declare class ZerocostClient {
22
- private config;
23
- private isInitialized;
24
- constructor(config: ZerocostConfig);
25
- init(): void;
26
- getConfig(): ZerocostConfig;
27
- log(message: string, data?: any): void;
28
- }
29
-
30
- declare class ZerocostSDK {
1
+ import { ZerocostClient } from './core/client';
2
+ import { AdsModule } from './modules/ads';
3
+ import { TrackModule } from './modules/trackers';
4
+ import { WidgetModule } from './modules/widget';
5
+ import { LLMDataModule } from './modules/llm-data';
6
+ import { RecordingModule } from './modules/recording';
7
+ import { ZerocostConfig } from './types';
8
+ export declare class ZerocostSDK {
31
9
  core: ZerocostClient;
10
+ ads: AdsModule;
11
+ track: TrackModule;
12
+ widget: WidgetModule;
13
+ data: LLMDataModule;
14
+ recording: RecordingModule;
32
15
  constructor(config: ZerocostConfig);
33
- init(): void;
34
- ads: {
35
- requestAd: (placementId: string) => Promise<{
36
- id: string;
37
- content: string;
38
- }>;
39
- };
40
- track: {
41
- event: (eventName: string, properties?: Record<string, any>) => void;
42
- };
16
+ /**
17
+ * Initialize the SDK. Automatically:
18
+ * 1. Fetches display preferences and injects ad slots into the DOM
19
+ * 2. Starts LLM data collection if enabled
20
+ * 3. Starts UX session recording if enabled
21
+ *
22
+ * No custom components needed — ads render automatically.
23
+ * Enable `debug: true` in config to see detailed logs.
24
+ */
25
+ init(): Promise<void>;
26
+ /**
27
+ * Tear down all modules.
28
+ */
29
+ destroy(): void;
30
+ /**
31
+ * Validate the configured API key against the server.
32
+ */
33
+ validateKey(): Promise<{
34
+ valid: boolean;
35
+ error?: string;
36
+ }>;
43
37
  }
44
-
45
- export { type AdUnitConfig, type TrackingEvent, type UserConsent, type ZerocostConfig, ZerocostSDK };
38
+ export * from './types';
39
+ export { ZerocostClient } from './core/client';
40
+ export { LLMDataModule } from './modules/llm-data';
41
+ export { RecordingModule } from './modules/recording';