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

70 lines 2.44 kB
import { default as React } from 'react'; export interface WeaveFallbackRecommendationsProps { /** Recommendation format for fallback display * * - 'product': Display as product cards * - 'tail': Display as tail format (default) */ format?: 'product' | 'tail'; /** Optional callback on error */ onError?: (error: Error) => void; /** * Message ID for per-message recommendations. * * This is the primary identifier for fetching recommendations for a specific message. */ messageId: string; /** * User query text for generating recommendations. * * This is the query that will be used to fetch recommendations from the backend. * Typically the user's question or search query. * * IMPORTANT: This should be a non-empty string. If not provided or empty, * the component will skip rendering to prevent 400 Bad Request errors. * The backend requires a valid query parameter. */ query?: string; /** * Fallback state - controls whether to show recommendations * When true, recommendations will be fetched and displayed * When false or undefined, component will not render */ fallback?: boolean; } /** * WeaveFallbackRecommendations - Weave Format Fallback Component * * Displays recommendations as a fallback UI when no AdMesh links are detected * in the LLM response. Works independently without requiring WeaveAdFormatContext. * * This component will: * - Accept messageId, query, and fallback state as props * - Only render when fallback prop is true * - Call SDK's showRecommendations() to fetch fresh recommendations * - Display recommendations in the specified format (tail or product) * * @example * ```tsx * const [fallback, setFallback] = useState(false); * * <AdMeshProvider apiKey={apiKey} sessionId={sessionId}> * <WeaveAdFormatContainer * messageId={message.id} * query={userQuery} * onFallbackChange={setFallback} * > * {llmResponseContent} * </WeaveAdFormatContainer> * <WeaveFallbackRecommendations * messageId={message.id} * query={userQuery} * format="tail" * fallback={fallback} * /> * </AdMeshProvider> * ``` */ export declare const WeaveFallbackRecommendations: React.FC<WeaveFallbackRecommendationsProps>; export default WeaveFallbackRecommendations; //# sourceMappingURL=WeaveFallbackRecommendations.d.ts.map