UNPKG

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

57 lines 2.57 kB
import { default as React } from 'react'; export interface WeaveAdFormatContainerProps { /** Unique ID for this message container */ messageId: string; /** The LLM response content (may contain AdMesh links) */ children: React.ReactNode; /** 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 CSS class for the container */ className?: string; /** Optional query text for fallback API calls (used when no links are detected) */ query?: string; /** Optional callback to notify parent when fallback state changes */ onFallbackChange?: (shouldFallback: boolean) => void; /** Optional callback when weave injection is attempted */ onWeaveAttempt?: (messageId: string) => void; /** Optional callback when weave injection outcome is determined */ onWeaveOutcome?: (messageId: string, success: boolean, reason?: string) => void; /** Optional container ID for follow-up suggestions */ followups_container_id?: string; /** Callback to execute query when follow-up is selected (required for follow-up functionality) */ onExecuteQuery?: (query: string) => void | Promise<void>; /** Optional callback when a sponsored followup is detected */ onFollowupDetected?: (followupQuery: string, followupEngagementUrl: string, recommendationId: string) => void; /** Signal indicating if the followup container is ready in the DOM */ isContainerReady?: boolean; } /** * WeaveAdFormatContainer - Automatic Weave Ad Format handling component * * Wraps LLM response content and automatically: * - Detects AdMesh links in the content * - Fires exposure tracking for detected links * - Adds [Ad] labels to links * - Shows "Why this ad?" tooltip on hover * - Provides context for WeaveFallbackRecommendations component * * @example * ```tsx * <WeaveAdFormatContainer * messageId={message.id} * query={userQuery} * onLinksDetected={(count) => console.log(`Found ${count} ads`)} * > * {llmResponseContent} * </WeaveAdFormatContainer> * ``` */ export declare const WeaveAdFormatContainer: React.FC<WeaveAdFormatContainerProps>; export default WeaveAdFormatContainer; //# sourceMappingURL=WeaveAdFormatContainer.d.ts.map