UNPKG

@contentstack/live-preview-utils

Version:

Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.

1 lines 7.38 kB
{"version":3,"sources":["../../../../src/visualBuilder/types/collab.types.ts"],"sourcesContent":["//User\nexport interface IUserDTO {\n display?: string;\n email: string;\n uid: string;\n firstName?: string | null;\n lastName?: string | null;\n}\n\nexport declare interface IUserState {\n mentionsList: Array<IMentionList>;\n userMap: IUserMap;\n currentUser: IUserDTO;\n}\n\nexport declare type IUserMap = { [key: string]: IUserDTO };\n\n// Invite Metadata and Context\nexport declare interface IInviteMetadata {\n users: Array<IUserDTO>;\n currentUser: IUserDTO;\n inviteUid: string;\n}\n\n// Mention Related Types\nexport declare type IMentionItem = { id: string; display: string };\n\nexport declare interface IMentionList {\n display: string;\n email?: string;\n uid?: string;\n}\n\nexport declare type IMentionedList = Array<IMentionItem>;\n\n// Comment State\nexport declare interface ICommentState {\n message: string;\n toUsers?: Array<IMentionItem>;\n images?: string[];\n createdBy: string;\n author: string;\n}\n\n// Message DTO\nexport declare interface IMessageDTO {\n _id: string;\n threadUid: string;\n message: string;\n author: string;\n toUsers?: string[];\n images?: string[];\n createdAt: string;\n updatedAt?: string;\n createdBy: string;\n}\n\n// Thread Context\nexport declare interface IThreadContext {\n inviteMetadata: IInviteMetadata;\n commentCount: number;\n error: IErrorState;\n userState: IUserState;\n onCreateComment: (data: ICommentPayload) => Promise<ICommentResponse>;\n onEditComment: (data: IEditCommentArgs) => Promise<ICommentResponse>;\n onDeleteComment: (data: IDeleteCommentArgs) => Promise<IDefaultAPIResponse>;\n onDeleteThread: (data: IDeleteThreadArgs) => void;\n setThreadState: (\n state:\n | IThreadPopupState\n | ((prevState: IThreadPopupState) => IThreadPopupState)\n ) => void;\n onClose: (isResolved?: boolean) => void;\n setError: Function;\n editComment: string;\n activeThread: IActiveThread;\n setActiveThread: (thread: IActiveThread) => void;\n createNewThread: () => Promise<any>;\n}\n\nexport interface IThreadPopupState {\n commentCount: number;\n userState: IUserState;\n isLoading: boolean;\n comments: Array<IMessageDTO>;\n editComment: string;\n}\n\nexport interface IThreadRenderStatus {\n threadId: string;\n attempts: number;\n isRendered: boolean;\n}\n\nexport interface ICommentDTO {\n _id: string;\n threadUid: string;\n message: string;\n author: string;\n toUsers: string[];\n images: string[];\n createdAt: string;\n createdBy: string;\n updatedAt?: string;\n}\n\nexport interface IDefaultAPIResponse {\n notice: string;\n}\n\nexport interface ICommentResponse extends IDefaultAPIResponse {\n comment: ICommentDTO;\n}\n\nexport interface IFetchCommentsResponse {\n comments: Array<ICommentDTO>;\n count: number;\n}\n\nexport interface ICommentPayload {\n threadUid: string;\n commentPayload: ICommentState;\n}\nexport interface IThreadPayload {\n elementXPath: string;\n position: {\n x: number;\n y: number;\n };\n author: string;\n pageRoute: string;\n inviteUid: string;\n createdBy: string;\n}\n\nexport interface IThreadDTO {\n _id: string;\n author: string;\n inviteUid: string;\n position: {\n x: number;\n y: number;\n };\n elementXPath: string;\n isElementPresent: boolean;\n pageRoute: string;\n createdBy: string;\n sequenceNumber: number;\n threadState: number;\n createdAt: string;\n updatedAt?: string;\n}\nexport interface IThreadResponseDTO extends IDefaultAPIResponse {\n thread: IThreadDTO;\n}\n\nexport interface IEditCommentArgs {\n threadUid: string;\n commentUid: string;\n payload: ICommentState;\n}\n\nexport interface IDeleteCommentArgs {\n threadUid: string;\n commentUid: string;\n}\n\nexport interface IDeleteThreadArgs {\n threadUid: string;\n}\n\nexport interface IThreadResolveArgs {\n threadUid: string;\n payload: {\n threadState: number;\n };\n}\n\nexport interface MissingThreadsInfo {\n payload: {\n isElementPresent: boolean;\n };\n threadUids: string[];\n}\n\nexport interface IErrorState {\n hasError: boolean;\n message: string;\n}\n\nexport interface IActiveThread extends Partial<IThreadDTO> {\n _id: string;\n}\n\nexport interface IFetchComments {\n threadUid: string;\n offset: number;\n limit: number;\n}\n\nexport interface toggleCollabPopupEvent {\n threadUid: string;\n action: string;\n}\n\nexport interface ICommentActionBar {\n mode: \"edit\" | \"view\";\n commentUser: IUserDTO;\n currentUser: IUserDTO;\n commentUID?: string | undefined;\n}\n\nexport interface ICommentCard {\n comment: IMessageDTO | null;\n onClose: (isResolved?: boolean) => void;\n userState: IUserState;\n mode: \"edit\" | \"view\";\n handleOnSaveRef: React.MutableRefObject<any>;\n}\n\nexport interface ICommentResolvedText {\n comment: IMessageDTO;\n userState: IUserState;\n}\n\nexport interface ICommentTextAreaProps {\n userState: IUserState;\n onClose: (isResolved?: boolean) => void;\n handleOnSaveRef: React.MutableRefObject<any>;\n comment?: IMessageDTO | null;\n}\n\nexport interface IThreadPopup {\n onCreateComment: (data: ICommentPayload) => Promise<ICommentResponse>;\n onEditComment: (data: IEditCommentArgs) => Promise<ICommentResponse>;\n onDeleteComment: (data: IDeleteCommentArgs) => Promise<IDefaultAPIResponse>;\n onDeleteThread: (data: IDeleteThreadArgs) => void;\n onClose: (isResolved?: boolean) => void;\n onResolve: (data: IThreadResolveArgs) => Promise<IThreadResponseDTO>;\n inviteMetadata: IInviteMetadata;\n loadMoreMessages: (data: IFetchComments) => Promise<IFetchCommentsResponse>;\n activeThread: IActiveThread;\n setActiveThread: (thread: IActiveThread) => void;\n createNewThread: () => Promise<IThreadResponseDTO>;\n}\n\nexport interface IThreadBody {\n handleOnSaveRef: React.MutableRefObject<any>;\n onClose: (isResolved?: boolean) => void;\n userState: IUserState;\n isLoading: boolean;\n comments: IMessageDTO[];\n fetchingMore: boolean;\n editComment: string;\n}\n\nexport interface IThreadFooter {\n onClose: (isResolved?: boolean) => void;\n handleOnSaveRef: React.MutableRefObject<any>;\n isDisabled: boolean;\n editComment: string;\n}\n\nexport interface IThreadHeader {\n onClose: (isResolved?: boolean) => void;\n displayResolve: boolean;\n onResolve: (data: IThreadResolveArgs) => Promise<IDefaultAPIResponse>;\n commentCount: number;\n activeThread: IActiveThread;\n}\n\nexport interface ICollabConfig {\n collab: {\n fromShare: boolean;\n pauseFeedback: boolean;\n enable: boolean;\n isFeedbackMode: boolean;\n inviteMetadata: IInviteMetadata;\n payload: IThreadDTO[];\n };\n}\n\nexport interface IThreadIdentifier {\n threadUid: string;\n}\n\nexport interface IThreadRemove {\n threadUids: string[];\n updateConfig?: boolean;\n}\n\nexport interface IThreadReopen {\n thread: IThreadDTO;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}