import { ChatSessionElements } from '@whop/embedded-components-vanilla-js/types'; import React__default from 'react'; /** * Valid element type strings that can be passed to createElement. */ type ElementType = keyof ChatSessionElements; /** * Extract the options type for a given element type using indexed access. * PayoutsSessionElements maps element types to [Options, Element] tuples. */ type ElementOptionsFor = ChatSessionElements[T][0]; /** * Component definition with a constrained element type. * The type must be a valid element type from the SDK. */ interface ElementComponentDefinition { displayName: string; type: T; } interface WithFallbackPropsBase { className?: string; style?: React__default.CSSProperties; onReady?: () => void; fallback?: React__default.ReactNode; } interface WithFallbackPropsRequired extends WithFallbackPropsBase { options: TOptions; } interface WithFallbackPropsOptional extends WithFallbackPropsBase { options?: TOptions; } type WithFallbackComponent = { (props: TRequired extends true ? WithFallbackPropsRequired : WithFallbackPropsOptional): React__default.ReactNode; displayName: string; type: string; }; /** * Creates a React component that wraps an embedded element with fallback support. * * @example * ```tsx * // Type-safe: options type is inferred from the element type * export const ChatElement = withFallback({ * displayName: "ChatElement", * type: "chat-element", * } as const); * * // Usage - TypeScript knows the correct options type * * ``` */ declare function withFallback(Component: ElementComponentDefinition): WithFallbackComponent, TRequired>; export { type WithFallbackPropsOptional, type WithFallbackPropsRequired, withFallback };