import type { comments } from '@wix/comments'; import { type AsChildChildren } from '@wix/headless-utils/react'; import type { members } from '@wix/members'; import React from 'react'; import { type CommentWithResolvedFields } from '../services/comments-service.js'; export * as Form from './CommentForm.js'; export interface CommentContentProps { asChild?: boolean; className?: string; children?: AsChildChildren<{ content: any; }> | React.ReactNode; } interface CommentContextValue { comment: CommentWithResolvedFields; replies: CommentWithResolvedFields[]; deleteComment: () => Promise; currentMemberId: string | undefined; } export declare const CommentContext: React.Context; /** * Hook to access the current comment context. * Must be used within a Comment.Root or Comment.ReplyItemRepeater component. * * @returns The comment context containing comment data, replies, and delete function * @throws Error if used outside of Comment.Root */ export declare function useCommentContext(): CommentContextValue; type RootProps = { comment: CommentWithResolvedFields; children: React.ReactNode | AsChildChildren<{ comment: CommentWithResolvedFields; replies: CommentWithResolvedFields[]; }>; asChild?: boolean; className?: string; currentMemberId: string | undefined; }; /** * Root component for rendering a single comment. * Provides comment context to all child components. * * @component * @example * ```tsx * * * * * * ``` */ export declare const Root: React.ForwardRefExoticComponent>; /** * Displays the comment content with rich text support. * * @component * @example * ```tsx * // Custom rendering with asChild * * {({ content }) => ( *
* *
* )} *
* ``` */ export declare const Content: React.ForwardRefExoticComponent>; export interface AuthorProps { asChild?: boolean; className?: string; children?: AsChildChildren<{ author: members.Member | null | undefined; }> | React.ReactNode; } /** * Displays the comment author's name. * * @component * @example * ```tsx * // Default rendering * * * // Custom rendering with asChild * * {({ author }) => author?.profile?.nickname ?? 'Unknown'} />} * * ``` */ export declare const Author: React.ForwardRefExoticComponent>; export interface CommentDateProps { asChild?: boolean; className?: string; locale?: Intl.LocalesArgument; children?: AsChildChildren<{ commentDate: string; }> | React.ReactNode; } /** * Displays the comment date in a formatted way. * * @component * @example * ```tsx * // Default rendering * * * // With custom locale * * * // Custom rendering with asChild * * {({ commentDate }) => } * * ``` */ export declare const CommentDate: React.ForwardRefExoticComponent>; export interface OwnerProps { children?: React.ReactNode; } /** * Renders if the current member is the owner of the comment. * * @component * @example * ```tsx * * * * ``` */ export declare const Owner: { (props: OwnerProps): React.ReactNode; displayName: string; }; export interface StatusProps { asChild?: boolean; className?: string; children?: AsChildChildren<{ status: comments.Comment['status']; isPending: boolean; }> | React.ReactNode; } /** * Displays or provides access to the comment status (PUBLISHED, PENDING, DELETED, etc.). * * @component * @example * ```tsx * // Default rendering * * * // Conditional rendering with asChild * * {({ status }) => ( * status === 'PENDING' ? Awaiting approval : null * )} * * ``` */ export declare const Status: React.ForwardRefExoticComponent>; export interface ReplyItemsProps { className?: string; children: React.ReactNode; } /** * Container for comment replies with empty state support. * Follows List Container Level pattern from architecture rules. * Always renders if there are total replies, even if no replies are loaded initially. * * @component * @example * ```tsx * * * * * * * * ``` */ export declare const ReplyItems: React.ForwardRefExoticComponent>; export interface ReplyItemRepeaterProps { children: React.ReactNode; } /** * Repeater component that renders all replies to a comment. * Follows Repeater Level pattern from architecture rules. * Note: Repeater components do NOT support asChild as per architecture rules. * * @component * @example * ```tsx * * * * * * * ``` */ export declare const ReplyItemRepeater: React.ForwardRefExoticComponent>; export interface ParentCommentProps extends Omit { } /** * Displays the parent comment when the current comment is a reply to another reply. * Only renders if the parent is not a top-level comment. * * @component * @example * ```tsx * // Default rendering * * * * * * // Custom rendering with asChild * * {({ comment: parentComment }) => ( *
* Replying to: *
* )} *
* ``` */ export declare const ParentComment: React.ForwardRefExoticComponent>; export interface LoadMoreRepliesProps { asChild?: boolean; className?: string; loadingState?: React.ReactNode; children?: AsChildChildren<{ isLoading: boolean; hasNextPage: boolean; loadNextPage: () => Promise; }> | React.ReactNode; } /** * Button to load more replies when there are additional pages. * Only renders when there are more replies to load. * * @component * @example * ```tsx * // Default rendering * * * // Custom rendering with asChild * * {({ hasNextPage, isLoading, loadNextPage }) => ( * * )} * * ``` */ export declare const LoadMoreReplies: React.ForwardRefExoticComponent>; export interface DeleteActionProps { /** If callback returns false, the delete action will not be performed. */ onDelete?: () => boolean; asChild?: boolean; className?: string; children?: React.ReactNode | AsChildChildren<{ deleteComment: () => Promise; }>; } export declare const Action: { Delete: React.ForwardRefExoticComponent>; };