import type { Dispatch, KeyboardEventHandler, MouseEvent, ReactElement, ReactNode, Ref, RefObject, SetStateAction } from 'react'; import type { AvatarProps, ComboBoxProps, DateTimeDisplayProps, FileItemProps, FileListProps, MenuItemProps, MenuProps, NoChildrenProp, OmitStrict, WithAttributes } from '@pega/cosmos-react-core'; import type { InteractionRenderers, MDMap, RichTextEditorProps, RichTextEditorState, RichTextViewerProps } from '@pega/cosmos-react-rte'; import type { BaseDialogProps } from '@pega/cosmos-react-core/lib/components/Dialog/Dialog.types'; import type { OpenGraphData } from '../OpenGraphPreview/OpenGraphPreview'; export interface SubComponentVariant { variant: 'post' | 'reply'; } export interface FeedAttachmentsProps extends SubComponentVariant, Pick { attachments?: FileItemProps[]; openGraphData?: OpenGraphData; disabled?: boolean; ref?: Ref; } export interface PostVisibilityControlProps extends Pick { visibility: Visibility; setVisibility?: Dispatch>; /** Props for the private recipient control. */ recipientInput: RecipientInputProps; } export interface CustomPostSubmitEvent { id: FeedNewPostProps['id']; username: string; /** The object identifying the type of the post. */ postType?: PostType; visibility?: Visibility; recipients?: RecipientMenuItem[]; } export interface DefaultPostSubmitEvent extends CustomPostSubmitEvent { value: string; attachments: FileItemProps[]; clear: () => void; } interface FeedBaseInputRegionProps extends SubComponentVariant, FeedCompositionBaseProps { recipients?: RecipientMenuItem[]; postType?: PostType; postTypeMenu?: ReactNode; visibility?: Visibility; visibilityControl?: ReactNode; } export interface FeedInputRegionProps extends FeedBaseInputRegionProps, DefaultPostConfig { rteRef: RefObject; } export type FeedCustomInputRegionProps = FeedBaseInputRegionProps & CustomPostConfig; export interface FeedEditRegionProps extends SubComponentVariant, DefaultEditConfig, Pick, Pick { content: RichTextEditorProps['defaultValue']; emptyEditText: boolean; setEmptyEditText: Dispatch>; } export type FeedCustomEditRegionProps = CustomEditConfig & Pick & Pick; export interface FeedModalListProps { count?: number; heading: string; listItems: MenuItemProps[]; onLoadMore?: () => void; loading?: boolean; } export interface AutopilotInfo { id: string; label: string; meta?: string; description?: string; } export interface FeedContentProps { children: ReactElement | string; maxContentHeight?: number; onLinkRender?: RichTextViewerProps['onMarkdownLinkRender']; ref?: Ref; } export type FeedContentHeaderProps = SubComponentVariant & Pick & Pick; export type FeedContentFooterProps = SubComponentVariant & Pick & Pick; export interface Filter { id: string; label: ReactNode; disabled?: boolean; on?: boolean; } export interface FeedRichTextProps extends Pick, Pick { onKeyDown?: KeyboardEventHandler; } export type SearchType = { id: string; label: string; icon?: string; }; export type FeedProps = WithAttributes<'div', NoChildrenProp & { title: string; userInfo: { username: string; fullname: string; avatarSrc?: string; userStatus?: AvatarProps['status']; meta?: string[]; timeZone?: string; }; searchTypes?: SearchType[]; onDecoratorSearch?: (e: { type: 'mention' | 'tag'; search: string; mentionType: string; }) => void; searchResults?: MenuItemProps[]; autopilotInfo?: AutopilotInfo; onAutopilotClick?: (e: { target?: BaseDialogProps['target']; onDismiss?: () => void; }) => JSX.Element | undefined; onMentionClick?: (e: { id: string; text: string; type: string; target?: BaseDialogProps['target']; closeGlimpse?: () => void; }) => JSX.Element | undefined; onMentionPreview?: (e: { id: string; text: string; type: string; }) => void; onTagClick?: (tag: string) => void; interactionRenderers?: InteractionRenderers[]; markdownMap?: MDMap; filters?: Filter[]; onFilterChange?: (filterId: string, on: boolean) => void; onLoadMore?: () => void; loadingPosts?: boolean; progress?: boolean; newPostRegion?: ReactNode; posts?: ReactNode[]; onLinkRender?: (href: string, signal: AbortSignal) => Promise; }>; export type Visibility = 'public' | 'private'; export type PostType = { id: string; label: string; icon?: string; }; export type RecipientMenuItem = Pick; export interface RecipientInputProps extends Pick, Pick { availableRecipients: RecipientMenuItem[]; recipients: RecipientMenuItem[]; onSearch: (search: string) => void; onAdd: (id: MenuItemProps['id']) => void; onRemove: (id: MenuItemProps['id']) => void; onToggle?: (id: MenuItemProps['id']) => void; } interface FeedCompositionBaseProps { id: string; banners?: ReactNode; progress?: boolean; onRewriteClick?: (originalText: string, rewriteAction: string, additionalInstructions: string, onSuccess: (rewrittenText: string) => void, isEditContext: boolean) => void; } export interface DefaultPostConfig extends Pick { attachments?: FileItemProps[]; onFilesAdded?: (files: File[]) => void; onSubmit: (event: DefaultPostSubmitEvent) => void; /** Use to capture the editor's uncontrolled value when the component unmounts. */ onUnmount?: (rteValue: string) => void; } export interface CustomPostConfig { content: ReactNode; onSubmit: (event: CustomPostSubmitEvent) => void; onCancel: (id: FeedNewPostProps['id']) => void; } export type FeedNewPostProps = WithAttributes<'div', FeedCompositionBaseProps & { visibilityMode?: Visibility | 'selectable'; /** Props for the private recipient Combobox. */ recipientInput?: RecipientInputProps; defaultConfig?: DefaultPostConfig; customConfig?: CustomPostConfig; postType?: PostType; postTypes?: PostType[]; onPostTypeChange?: (postType: PostType) => void; }>; export type FeedReplyInputProps = WithAttributes<'div', FeedCompositionBaseProps & DefaultPostConfig & { onSetInputRef?: (event: { ref: RefObject; }) => void; }>; export interface FeedPostBaseProps { id: string; fullname: string; username: string; postTimestamp: DateTimeDisplayProps['value']; content: ReactElement | string; attachments?: FileItemProps[]; avatarSrc?: string; icon?: string; userStatus?: AvatarProps['status']; liked?: boolean; likes?: MenuItemProps[]; likeCount?: number; interactionsEnabled?: boolean; maxContentHeight?: FeedContentProps['maxContentHeight']; menuItems?: MenuItemProps[]; onEdit?: (event: { id: string; postType?: PostType; visibility?: Visibility; recipients?: RecipientMenuItem[]; }) => void; edited?: boolean; editTimestamp?: DateTimeDisplayProps['value']; onMouseEnter?: (event: { id: string; }) => void; onMouseLeave?: (event: { id: string; }) => void; onUserClick?: (event: { id: string; username: string; }, clickEvent?: MouseEvent) => void; onCommentClick: (event: { id: string; username: string; }) => void; onLikeClick: (event: { id: string; user: MenuItemProps; }) => void; onLikeCountInteraction?: () => void; onLoadMoreLikes?: () => void; likesLoading?: boolean; } export interface DefaultEditConfig extends Pick, Pick { editContent?: never; onEditSubmit: (event: { id: FeedPostBaseProps['id']; value: string; visibility?: Visibility; recipients?: RecipientMenuItem[]; }) => void; onEditCancel?: (id: FeedPostBaseProps['id']) => void; /** Props for the private recipient Combobox. */ recipientInput?: RecipientInputProps; /** Use to capture the editor's uncontrolled value when the component unmounts. */ onUnmount?: (rteValue: string) => void; } export interface CustomEditConfig extends Pick { editContent: ReactNode; onEditSubmit: (event: { id: FeedPostBaseProps['id']; visibility?: Visibility; recipients?: RecipientMenuItem[]; }) => void; onEditCancel: (id: FeedPostBaseProps['id']) => void; /** Props for the private recipient Combobox. */ recipientInput?: RecipientInputProps; } export type FeedPostProps = WithAttributes<'div', FeedPostBaseProps & { editConfig?: DefaultEditConfig | CustomEditConfig; visibility?: Visibility; postType?: PostType; customPostType?: boolean; recipients?: RecipientMenuItem[]; recipientsCount?: number; postContext?: ReactElement | string; onRecipientInteraction?: () => void; onLoadMoreRecipients?: () => void; recipientsLoading?: boolean; replyInput: OmitStrict & DefaultPostConfig; replyInputShown?: boolean; replies?: ReactElement[]; replyCount?: number; onShowMoreReplies?: (event: { id: FeedPostBaseProps['id']; }) => void; onShowLessReplies?: (event: { id: FeedPostBaseProps['id']; }) => void; repliesLoading?: boolean; }>; export type FeedReplyProps = WithAttributes<'div', FeedPostBaseProps & { editConfig?: DefaultEditConfig; }>; export {}; //# sourceMappingURL=Feed.types.d.ts.map