import { PostStyle, TsxAllowUnknowProperties } from ".."; import { GuidValue, OmitProperties, ThemeDefinition, IPostBaseWithContext, IPostBaseContext, IPersistedPost, ResolvedUserIdentity, ReactionType } from "../../models"; import { IRichTextEditor } from "../richtexteditor"; export interface IPostCustomSlots { /** * Should render both the author name and custom part, if not passed will render default author name * */ renderTitle?: (post: IPersistedPost>, targetThemeId?: GuidValue) => JSX.Element | JSX.Element[]; /** * Render additional content next to the Post/Save button * */ renderActionButtons?: (post: IPersistedPost>, targetThemeId?: GuidValue) => JSX.Element | JSX.Element[]; /** * Render promote post actions, next to Reply * */ promotePostAction?: (post: IPersistedPost>, targetThemeId?: GuidValue) => JSX.Element | JSX.Element[]; } export interface PostPermission { contributor: boolean; moderator: boolean; } export type PostHandler, TPostContext extends IPostBaseContext> = { handleAddingPost: (addingPost: TPostTypeWithContext) => Promise>; handleEditingPosts?: (postsBeingEdited: Array>) => void; handleUpdatingPost: (updatingPost: IPersistedPost) => Promise>; handleDeletingPost: (deletingPost: IPersistedPost) => Promise>; handleTogglingLike: (togglingPost: IPersistedPost) => Promise>; handleSocialReacts: (postToReact: IPersistedPost, isReacts: boolean, reactionType: ReactionType) => Promise>; }; export interface PostProvider = IPostBaseWithContext> { posts: Array>; promotedPost?: IPersistedPost; handler: PostHandler; } export interface IPostComponent { omniaServiceId: GuidValue; postTypeId: GuidValue; provider: PostProvider; richTextSettings?: OmitProperties; cardStyle?: ThemeDefinition; showMoreSize?: number; styles?: typeof PostStyle; allowLikes?: boolean; enableMention?: boolean; customSlots?: IPostCustomSlots; hideEditOption?: boolean; editContentOnTop?: boolean; getTopPostIds: () => { [commentId: string]: string; }; getUserHash: () => { [principalName: string]: ResolvedUserIdentity; }; topicPermissionDictionary: { [topicId: string]: PostPermission; }; } declare global { namespace JSX { interface Element { } interface ElementClass { } interface IntrinsicElements { "omfx-post-component": TsxAllowUnknowProperties; } } }