@ai-ad-network/frontend-sdk 1.0.8 → 1.0.9

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.
Files changed (39) hide show
  1. package/dist/client-info/collector.d.ts +123 -0
  2. package/dist/client-info/index.d.ts +21 -0
  3. package/dist/client-info/utils.d.ts +151 -0
  4. package/dist/components/ActionCardAd.d.ts +26 -0
  5. package/dist/components/AdAnalytics.d.ts +65 -0
  6. package/dist/components/AdErrorBoundary.d.ts +86 -0
  7. package/dist/components/AdProvider.d.ts +121 -0
  8. package/dist/components/AdSkeleton.d.ts +50 -0
  9. package/dist/components/EnhancedContent.d.ts +53 -0
  10. package/dist/components/FollowUpAd.d.ts +53 -0
  11. package/dist/components/LeadGenAd.d.ts +52 -0
  12. package/dist/components/SponsoredSource.d.ts +62 -0
  13. package/dist/components/StaticAd.d.ts +114 -0
  14. package/dist/components/SuffixAd.d.ts +34 -0
  15. package/dist/hooks/useAdSlots.d.ts +179 -0
  16. package/dist/hooks/useAdTracking.d.ts +59 -0
  17. package/dist/hooks/useAiAds.d.ts +54 -0
  18. package/dist/index.d.ts +52 -0
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/lib/cn.d.ts +6 -0
  22. package/dist/mockData.d.ts +58 -0
  23. package/dist/types/index.d.ts +670 -0
  24. package/dist/universal/index.d.ts +2169 -0
  25. package/dist/universal/universal.cjs.js +3634 -0
  26. package/dist/universal/universal.cjs.js.map +1 -0
  27. package/dist/universal/universal.esm.js +3634 -0
  28. package/dist/universal/universal.esm.js.map +1 -0
  29. package/dist/universal/universal.iife.js +3637 -0
  30. package/dist/universal/universal.iife.js.map +1 -0
  31. package/dist/universal/universal.umd.js +3638 -0
  32. package/dist/universal/universal.umd.js.map +1 -0
  33. package/dist/utils/text-weaver.d.ts +49 -0
  34. package/dist/utils/tracking.d.ts +34 -0
  35. package/dist/version.d.ts +1 -0
  36. package/docs/AD_FORMATS.md +815 -0
  37. package/docs/QUICK_START.md +344 -4
  38. package/docs/UNIVERSAL_SDK_GUIDE.md +451 -3
  39. package/package.json +15 -14
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Client Information Collector
3
+ *
4
+ * Automatically collects OpenRTB-compliant device and app information
5
+ * following OpenRTB 2.5/2.6 specifications.
6
+ *
7
+ * Features:
8
+ * - Static info caching (UA, OS, device type) - collected once
9
+ * - Dynamic info collection (connection type, bandwidth) - collected each time
10
+ * - Privacy-compliant (no permissions required for basic info)
11
+ * - Optional overrides for app-provided data (IDFA, location, etc.)
12
+ */
13
+ import { ClientInfo, ClientInfoOptions } from '../types';
14
+ export declare class ClientInfoCollector {
15
+ private static instance;
16
+ private cachedStaticInfo;
17
+ private cacheTimestamp;
18
+ private readonly CACHE_TTL;
19
+ private inferAppInfo;
20
+ /**
21
+ * 自动推断bundle/domain
22
+ */
23
+ private inferBundle;
24
+ /**
25
+ * 自动推断应用名称
26
+ */
27
+ private inferAppName;
28
+ /**
29
+ * 自动推断应用版本
30
+ */
31
+ private inferAppVersion;
32
+ /**
33
+ * 自动推断publisher ID
34
+ */
35
+ private inferPublisherId;
36
+ private constructor();
37
+ /**
38
+ * Get singleton instance
39
+ */
40
+ static getInstance(): ClientInfoCollector;
41
+ /**
42
+ * Collect all available client information
43
+ * @param options Optional overrides from app
44
+ * @returns ClientInfo object compliant with OpenRTB 2.5/2.6
45
+ */
46
+ collect(options?: ClientInfoOptions): ClientInfo;
47
+ /**
48
+ * Collect static device information (cached)
49
+ * These values don't change during app lifecycle
50
+ */
51
+ private collectStaticInfo;
52
+ /**
53
+ * Collect dynamic device information (not cached)
54
+ * These values may change during app lifecycle
55
+ */
56
+ private collectDynamicInfo;
57
+ /**
58
+ * Collect user information
59
+ */
60
+ private collectUserInfo;
61
+ /**
62
+ * Collect geographic information (inferred)
63
+ */
64
+ private collectGeoInfo;
65
+ /**
66
+ * Detect Operating System
67
+ */
68
+ private detectOS;
69
+ /**
70
+ * Detect OS Version
71
+ */
72
+ private detectOSVersion;
73
+ /**
74
+ * Detect Device Type (OpenRTB standard)
75
+ * 0 = Unknown/Other
76
+ * 1 = Mobile/Phone
77
+ * 2 = Tablet
78
+ * 3 = Personal Computer
79
+ * 4 = Connected TV
80
+ * 5 = Set Top Box
81
+ */
82
+ private detectDeviceType;
83
+ /**
84
+ * Detect Device Model
85
+ */
86
+ private detectModel;
87
+ /**
88
+ * Detect Device Make
89
+ */
90
+ private detectMake;
91
+ /**
92
+ * Get Network Connection Info
93
+ */
94
+ private getConnectionInfo;
95
+ /**
96
+ * Map Network Information API type to OpenRTB
97
+ * 0 = Unknown
98
+ * 1 = Ethernet
99
+ * 2 = WiFi
100
+ * 3 = 2G
101
+ * 4 = 3G
102
+ * 5 = 4G
103
+ * 6 = 5G
104
+ */
105
+ private mapConnectionType;
106
+ /**
107
+ * Infer country from language and timezone
108
+ */
109
+ private inferCountry;
110
+ /**
111
+ * Generate UUID v4
112
+ */
113
+ private generateUUID;
114
+ /**
115
+ * Get fallback info for SSR or restricted environments
116
+ */
117
+ private getFallbackInfo;
118
+ /**
119
+ * Clear cache (call when device state changes)
120
+ */
121
+ clearCache(): void;
122
+ }
123
+ export declare const getClientInfoCollector: () => ClientInfoCollector;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Client Information Collection Module
3
+ *
4
+ * Automatically collects OpenRTB-compliant device and app information
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { getClientInfo } from '@ai-ad-network/frontend-sdk';
9
+ *
10
+ * // Get current client info
11
+ * const clientInfo = getClientInfo();
12
+ * console.log(clientInfo.device.os); // "macOS"
13
+ * console.log(clientInfo.user.id); // "uuid-xxx-xxx"
14
+ *
15
+ * // Get with custom options
16
+ * const customInfo = getClientInfo({ customUserId: 'user-123' });
17
+ * ```
18
+ */
19
+ export { ClientInfoCollector, getClientInfoCollector } from './collector';
20
+ export { getClientInfo, getDeviceInfo, getUserInfo, getAppInfo, getGeoInfo, getUserId, clearClientInfoCache, getClientInfoJSON, getClientInfoSummary, } from './utils';
21
+ export type { DeviceInfo, AppInfo, UserInfo, GeoInfo, ClientInfo, ClientInfoOptions, } from '../types';
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Client Info Utility Functions
3
+ *
4
+ * Convenience functions for easy access to client information
5
+ */
6
+ import type { ClientInfo, ClientInfoOptions } from '../types';
7
+ /**
8
+ * Get current client information (convenience function)
9
+ *
10
+ * This is a shortcut for getClientInfoCollector().collect()
11
+ *
12
+ * @param options - Optional custom options
13
+ * @returns Complete client information
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { getClientInfo } from '@ai-ad-network/frontend-sdk';
18
+ *
19
+ * // Get all client info
20
+ * const info = getClientInfo();
21
+ * console.log(info.device.os); // "macOS"
22
+ * console.log(info.user.id); // "uuid-xxx-xxx"
23
+ *
24
+ * // Get with custom user ID
25
+ * const customInfo = getClientInfo({ customUserId: 'user-123' });
26
+ * ```
27
+ */
28
+ export declare function getClientInfo(options?: ClientInfoOptions): ClientInfo;
29
+ /**
30
+ * Get device information only
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { getDeviceInfo } from '@ai-ad-network/frontend-sdk';
35
+ *
36
+ * const device = getDeviceInfo();
37
+ * console.log(device.os); // "macOS"
38
+ * console.log(device.model); // "Mac"
39
+ * ```
40
+ */
41
+ export declare function getDeviceInfo(): import(".").DeviceInfo;
42
+ /**
43
+ * Get user information only
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * import { getUserInfo } from '@ai-ad-network/frontend-sdk';
48
+ *
49
+ * const user = getUserInfo();
50
+ * console.log(user.id); // "uuid-xxx-xxx"
51
+ * ```
52
+ */
53
+ export declare function getUserInfo(): import(".").UserInfo;
54
+ /**
55
+ * Get app information only
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * import { getAppInfo } from '@ai-ad-network/frontend-sdk';
60
+ *
61
+ * const app = getAppInfo();
62
+ * console.log(app.name); // "My App"
63
+ * console.log(app.bundle); // "example.com"
64
+ * ```
65
+ */
66
+ export declare function getAppInfo(): import(".").AppInfo;
67
+ /**
68
+ * Get geo information only
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * import { getGeoInfo } from '@ai-ad-network/frontend-sdk';
73
+ *
74
+ * const geo = getGeoInfo();
75
+ * console.log(geo?.country); // "CN"
76
+ * console.log(geo?.language); // "zh"
77
+ * ```
78
+ */
79
+ export declare function getGeoInfo(): import(".").GeoInfo | undefined;
80
+ /**
81
+ * Get user ID (persistent across sessions)
82
+ *
83
+ * This is a convenience function to quickly get the user ID
84
+ * without accessing the full client info object.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * import { getUserId } from '@ai-ad-network/frontend-sdk';
89
+ *
90
+ * const userId = getUserId();
91
+ * console.log(userId); // "uuid-xxx-xxx"
92
+ *
93
+ * // Send to your analytics
94
+ * analytics.identify(userId);
95
+ * ```
96
+ */
97
+ export declare function getUserId(): string;
98
+ /**
99
+ * Clear client info cache
100
+ *
101
+ * Forces re-collection on next call. Useful when device state changes.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * import { clearClientInfoCache } from '@ai-ad-network/frontend-sdk';
106
+ *
107
+ * // Clear cache (e.g., after network change)
108
+ * clearClientInfoCache();
109
+ *
110
+ * // Next call will re-collect fresh data
111
+ * const freshInfo = getClientInfo();
112
+ * ```
113
+ */
114
+ export declare function clearClientInfoCache(): void;
115
+ /**
116
+ * Get client info as JSON string
117
+ *
118
+ * Useful for logging or sending to APIs
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * import { getClientInfoJSON } from '@ai-ad-network/frontend-sdk';
123
+ *
124
+ * const json = getClientInfoJSON();
125
+ * console.log(json);
126
+ * // {"device":{"os":"macOS",...},"user":{"id":"xxx"},...}
127
+ *
128
+ * // Send to server
129
+ * fetch('/api/log', {
130
+ * method: 'POST',
131
+ * body: json,
132
+ * headers: { 'Content-Type': 'application/json' }
133
+ * });
134
+ * ```
135
+ */
136
+ export declare function getClientInfoJSON(options?: ClientInfoOptions): string;
137
+ /**
138
+ * Get client info summary (human-readable)
139
+ *
140
+ * Returns a simplified summary for debugging/display
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * import { getClientInfoSummary } from '@ai-ad-network/frontend-sdk';
145
+ *
146
+ * const summary = getClientInfoSummary();
147
+ * console.log(summary);
148
+ * // macOS 14.5 / Chrome / user-123 / CN
149
+ * ```
150
+ */
151
+ export declare function getClientInfoSummary(): string;
@@ -0,0 +1,26 @@
1
+ import type { KoahAd, ActionCardVariant } from '@/types';
2
+ /**
3
+ * ActionCardAd Props
4
+ */
5
+ export interface ActionCardAdProps {
6
+ /** The ad data to display */
7
+ ad: KoahAd;
8
+ /** Visual variant */
9
+ variant?: ActionCardVariant;
10
+ /** Custom class name */
11
+ className?: string;
12
+ /** Loading state */
13
+ isLoading?: boolean;
14
+ /** Tracking options */
15
+ onClick?: () => void;
16
+ onImpression?: () => void;
17
+ }
18
+ /**
19
+ * ActionCardAd - Rich media card component with modern glassmorphism design
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <ActionCardAd ad={ad} variant="horizontal" />
24
+ * ```
25
+ */
26
+ export declare function ActionCardAd({ ad, variant, className, isLoading, onClick, onImpression, }: ActionCardAdProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Ad Metrics Data Structure
3
+ */
4
+ export interface AdMetrics {
5
+ adId: string;
6
+ adTitle: string;
7
+ impressions: number;
8
+ clicks: number;
9
+ ctr: number;
10
+ revenue: number;
11
+ source: 'internal' | 'affiliate' | 'programmatic';
12
+ lastUpdated: Date;
13
+ }
14
+ /**
15
+ * Aggregated Metrics
16
+ */
17
+ export interface AggregatedMetrics {
18
+ totalImpressions: number;
19
+ totalClicks: number;
20
+ averageCtr: number;
21
+ totalRevenue: number;
22
+ topPerformingAd: AdMetrics | null;
23
+ bySource: Record<string, {
24
+ impressions: number;
25
+ clicks: number;
26
+ revenue: number;
27
+ }>;
28
+ }
29
+ /**
30
+ * AdAnalyticsDashboard Props
31
+ */
32
+ export interface AdAnalyticsDashboardProps {
33
+ /** Initial metrics data */
34
+ data?: AdMetrics[];
35
+ /** Auto-refresh interval in ms */
36
+ refreshInterval?: number;
37
+ /** Callback to fetch fresh data */
38
+ onRefresh?: () => Promise<AdMetrics[]>;
39
+ /** Show/hide sections */
40
+ showRevenue?: boolean;
41
+ showBySource?: boolean;
42
+ /** Custom class name */
43
+ className?: string;
44
+ }
45
+ /**
46
+ * AdAnalyticsDashboard - Modern analytics dashboard with glassmorphism design
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * <AdAnalyticsDashboard
51
+ * data={metricsData}
52
+ * refreshInterval={30000}
53
+ * onRefresh={async () => await fetchMetrics()}
54
+ * />
55
+ * ```
56
+ */
57
+ export declare function AdAnalyticsDashboard({ data: initialData, refreshInterval, onRefresh, showRevenue, showBySource, className, }: AdAnalyticsDashboardProps): import("react/jsx-runtime").JSX.Element;
58
+ /**
59
+ * MiniDashboard - Compact version with modern design
60
+ */
61
+ export interface MiniDashboardProps {
62
+ data?: AdMetrics[];
63
+ className?: string;
64
+ }
65
+ export declare function MiniDashboard({ data, className }: MiniDashboardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,86 @@
1
+ import React, { Component, ReactNode } from 'react';
2
+ /**
3
+ * Error Boundary Props
4
+ */
5
+ export interface AdErrorBoundaryProps {
6
+ /** Child components */
7
+ children: ReactNode;
8
+ /** Fallback component when error occurs */
9
+ fallback?: ReactNode | ((error: Error, errorInfo: React.ErrorInfo) => ReactNode);
10
+ /** Custom class name for error container */
11
+ className?: string;
12
+ /** Callback when error occurs */
13
+ onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
14
+ }
15
+ /**
16
+ * Error Boundary State
17
+ */
18
+ interface AdErrorBoundaryState {
19
+ hasError: boolean;
20
+ error?: Error;
21
+ }
22
+ /**
23
+ * AdErrorBoundary - Error boundary for ad components
24
+ *
25
+ * Catches JavaScript errors in ad components and displays a fallback UI.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <AdErrorBoundary
30
+ * fallback={<CustomErrorFallback />}
31
+ * onError={(error, errorInfo) => console.error('Ad error:', error)}
32
+ * >
33
+ * <ActionCardAd ad={ad} />
34
+ * </AdErrorBoundary>
35
+ * ```
36
+ */
37
+ export declare class AdErrorBoundary extends Component<AdErrorBoundaryProps, AdErrorBoundaryState> {
38
+ constructor(props: AdErrorBoundaryProps);
39
+ static getDerivedStateFromError(error: Error): AdErrorBoundaryState;
40
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
41
+ render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
42
+ }
43
+ /**
44
+ * withAdErrorBoundary - HOC to wrap components with error boundary
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * const SafeActionCard = withAdErrorBoundary(ActionCardAd, {
49
+ * fallback: <CustomErrorFallback />,
50
+ * });
51
+ * ```
52
+ */
53
+ export declare function withAdErrorBoundary<P extends object>(Component: React.ComponentType<P>, errorBoundaryProps?: Omit<AdErrorBoundaryProps, 'children'>): {
54
+ (props: P): import("react/jsx-runtime").JSX.Element;
55
+ displayName: string;
56
+ };
57
+ /**
58
+ * AdErrorHandler - Component to handle errors in ad hooks
59
+ */
60
+ export interface AdErrorHandlerProps {
61
+ /** Error object */
62
+ error: Error | null;
63
+ /** Retry callback */
64
+ onRetry?: () => void;
65
+ /** Custom class name */
66
+ className?: string;
67
+ /** Hide error message */
68
+ silent?: boolean;
69
+ }
70
+ /**
71
+ * AdErrorHandler - Display error message with retry option
72
+ *
73
+ * @example
74
+ * ```tsx
75
+ * const { ads, error, refetch } = useAiAds(...);
76
+ *
77
+ * {error && (
78
+ * <AdErrorHandler
79
+ * error={error}
80
+ * onRetry={() => refetch()}
81
+ * />
82
+ * )}
83
+ * ```
84
+ */
85
+ export declare function AdErrorHandler({ error, onRetry, className, silent }: AdErrorHandlerProps): import("react/jsx-runtime").JSX.Element | null;
86
+ export {};
@@ -0,0 +1,121 @@
1
+ import React, { ReactNode } from 'react';
2
+ /**
3
+ * Ad Configuration Options
4
+ */
5
+ export interface AdConfig {
6
+ /** Base URL for API requests */
7
+ apiBaseUrl?: string;
8
+ /** API Key for authentication (format: ak_tenant_key) */
9
+ apiKey?: string;
10
+ /** Default ad formats to request */
11
+ defaultFormats?: string[];
12
+ /** Default placement */
13
+ defaultPlacement?: 'post_response' | 'sidebar' | 'empty_state' | 'inline';
14
+ /** Enable/disable ads globally */
15
+ enabled?: boolean;
16
+ /** Enable debug logging */
17
+ debug?: boolean;
18
+ /** Custom headers for API requests */
19
+ headers?: Record<string, string>;
20
+ /** Request timeout in milliseconds */
21
+ timeout?: number;
22
+ /** Maximum retry attempts */
23
+ maxRetries?: number;
24
+ /** User ID for tracking (hashed automatically) */
25
+ userId?: string;
26
+ }
27
+ /**
28
+ * Ad Context Type
29
+ */
30
+ interface AdContextType {
31
+ config: AdConfig;
32
+ updateConfig: (updates: Partial<AdConfig>) => void;
33
+ resetConfig: () => void;
34
+ }
35
+ /**
36
+ * AdProvider Props
37
+ */
38
+ export interface AdProviderProps {
39
+ /** Configuration options */
40
+ config?: Partial<AdConfig>;
41
+ /** Child components */
42
+ children: ReactNode;
43
+ /** Initial configuration (merged with defaults) */
44
+ initialConfig?: AdConfig;
45
+ }
46
+ /**
47
+ * AdProvider - Provider component for ad SDK configuration
48
+ *
49
+ * Wrap your app with this provider to configure the ad SDK globally.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * import { AdProvider } from '@ai-ad-network/frontend-sdk';
54
+ *
55
+ * function App() {
56
+ * return (
57
+ * <AdProvider
58
+ * config={{
59
+ * apiBaseUrl: 'https://api.example.com/v1',
60
+ * apiKey: 'ak_your_tenant_your_key',
61
+ * enabled: true,
62
+ * debug: process.env.NODE_ENV === 'development',
63
+ * }}
64
+ * >
65
+ * <YourApp />
66
+ * </AdProvider>
67
+ * );
68
+ * }
69
+ * ```
70
+ */
71
+ export declare function AdProvider({ config: configProp, initialConfig, children }: AdProviderProps): import("react/jsx-runtime").JSX.Element;
72
+ /**
73
+ * useAdConfig - Hook to access ad configuration
74
+ *
75
+ * @example
76
+ * ```tsx
77
+ * function MyComponent() {
78
+ * const { config, updateConfig } = useAdConfig();
79
+ *
80
+ * return (
81
+ * <div>
82
+ * <p>Ads enabled: {config.enabled}</p>
83
+ * <button onClick={() => updateConfig({ enabled: false })}>
84
+ * Disable ads
85
+ * </button>
86
+ * </div>
87
+ * );
88
+ * }
89
+ * ```
90
+ */
91
+ export declare function useAdConfig(): AdContextType;
92
+ /**
93
+ * withAdConfig - HOC to provide config as prop
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * const ComponentWithConfig = withAdConfig(MyComponent);
98
+ * ```
99
+ */
100
+ export declare function withAdConfig<P extends {
101
+ adConfig?: AdConfig;
102
+ }>(Component: React.ComponentType<P>): (props: Omit<P, "adConfig">) => import("react/jsx-runtime").JSX.Element;
103
+ /**
104
+ * Debug logger for ad SDK
105
+ */
106
+ export declare class AdLogger {
107
+ private debug;
108
+ private prefix;
109
+ constructor(debug?: boolean);
110
+ enable(): void;
111
+ disable(): void;
112
+ log(...args: any[]): void;
113
+ warn(...args: any[]): void;
114
+ error(...args: any[]): void;
115
+ info(...args: any[]): void;
116
+ }
117
+ /**
118
+ * Create logger instance from config
119
+ */
120
+ export declare function createLogger(config: AdConfig): AdLogger;
121
+ export {};
@@ -0,0 +1,50 @@
1
+ /**
2
+ * AdSkeleton Props
3
+ */
4
+ export interface AdSkeletonProps {
5
+ /** Type of ad skeleton */
6
+ variant?: 'action_card' | 'suffix' | 'followup' | 'source';
7
+ /** Layout variant */
8
+ layout?: 'horizontal' | 'vertical' | 'compact';
9
+ /** Custom class name */
10
+ className?: string;
11
+ /** Number of skeletons to show */
12
+ count?: number;
13
+ }
14
+ /**
15
+ * AdSkeleton - Loading placeholder for ad components
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <AdSkeleton variant="action_card" layout="horizontal" count={3} />
20
+ * ```
21
+ */
22
+ export declare function AdSkeleton({ variant, layout, className, count, }: AdSkeletonProps): import("react/jsx-runtime").JSX.Element;
23
+ /**
24
+ * InlineLoading - Small inline loading indicator
25
+ */
26
+ export interface InlineLoadingProps {
27
+ /** Size of the indicator */
28
+ size?: 'sm' | 'md' | 'lg';
29
+ /** Custom class name */
30
+ className?: string;
31
+ }
32
+ export declare function InlineLoading({ size, className }: InlineLoadingProps): import("react/jsx-runtime").JSX.Element;
33
+ /**
34
+ * DotsLoading - Animated dots loading indicator
35
+ */
36
+ export interface DotsLoadingProps {
37
+ /** Custom class name */
38
+ className?: string;
39
+ }
40
+ export declare function DotsLoading({ className }: DotsLoadingProps): import("react/jsx-runtime").JSX.Element;
41
+ /**
42
+ * FullPageLoading - Full screen loading overlay
43
+ */
44
+ export interface FullPageLoadingProps {
45
+ /** Message to display */
46
+ message?: string;
47
+ /** Custom class name */
48
+ className?: string;
49
+ }
50
+ export declare function FullPageLoading({ message, className }: FullPageLoadingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,53 @@
1
+ import type { EntityInfo, EnhancedContentProps } from '@/types';
2
+ /**
3
+ * EnhancedContent Component
4
+ *
5
+ * Renders content with entity-linked affiliate URLs.
6
+ * Supports different badge styles and handles overlapping entities.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <EnhancedContent
11
+ * content="推荐 Sony WH-1000XM5 降噪耳机"
12
+ * enhancements={{
13
+ * entities: [
14
+ * {
15
+ * text: "Sony WH-1000XM5",
16
+ * type: "product",
17
+ * startPosition: 12,
18
+ * endPosition: 26,
19
+ * confidence: 0.95,
20
+ * }
21
+ * ],
22
+ * replacements: [
23
+ * {
24
+ * originalText: "Sony WH-1000XM5",
25
+ * affiliateUrl: "https://amazon.com/dp/B09XS7JWHH?tag=koah20-20",
26
+ * trackingId: "track-123",
27
+ * affiliateNetwork: "amazon",
28
+ * }
29
+ * ]
30
+ * }}
31
+ * />
32
+ * ```
33
+ */
34
+ export declare function EnhancedContent({ content, enhancements, className, onEntityClick, }: EnhancedContentProps): import("react/jsx-runtime").JSX.Element;
35
+ /**
36
+ * Convenience components for common use cases
37
+ */
38
+ /**
39
+ * Inline variant - for embedding within existing text
40
+ */
41
+ export declare function EnhancedContentInline(props: Omit<EnhancedContentProps, 'className'>): import("react/jsx-runtime").JSX.Element;
42
+ /**
43
+ * Block variant - for standalone content blocks
44
+ */
45
+ export declare function EnhancedContentBlock(props: EnhancedContentProps): import("react/jsx-runtime").JSX.Element;
46
+ /**
47
+ * Hook to get entity statistics from enhanced content
48
+ */
49
+ export declare function useEntityStats(entities: EntityInfo[]): {
50
+ totalCount: number;
51
+ byType: Record<string, number>;
52
+ avgConfidence: number;
53
+ };