admesh-ui-sdk
Version:
Beautiful, modern React components for displaying AI-powered product recommendations with citation-based conversation ads, auto-triggered widgets, floating chat, conversational interfaces, persistent sidebar, and built-in tracking. Includes zero-code SDK
46 lines • 1.7 kB
TypeScript
export interface UseWeaveAdFormatOptions {
/** Container ID for the LLM output (where AdMesh links will be detected) */
llmOutputContainerId: string;
/** Timeout for link detection (default: 900ms) */
timeoutMs?: number;
/** Fallback format if no links detected (default: 'tail') */
fallbackFormat?: 'product' | 'tail';
/** Optional callback when AdMesh links are detected */
onLinksDetected?: (count: number) => void;
/** Optional callback when no links are detected (fallback should be rendered) */
onNoLinksDetected?: () => void;
/** Optional callback on error */
onError?: (error: Error) => void;
/** Optional query for fallback API calls (used when no links are detected) */
query?: string;
/** Optional message ID for fallback API calls (used when no links are detected) */
messageId?: string;
}
/**
* useWeaveAdFormat - Hook for automatic Weave Ad Format handling
*
* Automatically:
* - Detects AdMesh links in LLM output
* - Fires exposure tracking for detected links
* - Adds [Ad] labels to links
* - Shows "Why this ad?" tooltip on hover
* - Renders fallback UI if no links detected
*
* @example
* ```tsx
* const { isProcessing, detectedLinksCount } = useWeaveAdFormat({
* llmOutputContainerId: 'llm-output-123',
* timeoutMs: 1500,
* fallbackFormat: 'tail'
* });
* ```
*/
export declare const useWeaveAdFormat: (options: UseWeaveAdFormatOptions) => {
isProcessing: boolean;
detectedLinksCount: number;
linksFound: boolean;
shouldRenderFallback: boolean;
processWeaveFormat: () => Promise<void>;
};
export default useWeaveAdFormat;
//# sourceMappingURL=useWeaveAdFormat.d.ts.map