@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
131 lines (130 loc) • 4.69 kB
TypeScript
type AppNotificationType = "entity-comment" | "comment-reply" | "entity-mention" | "comment-mention" | "entity-upvote" | "comment-upvote" | "new-follow";
interface BaseAppNotification {
id: string;
userId: string;
type: AppNotificationType;
isRead: boolean;
metadata: Record<string, any>;
title?: string;
content?: string;
createdAt: Date;
}
export interface EntityCommentNotification extends BaseAppNotification {
type: "entity-comment";
action: "open-comment";
metadata: {
entityId: string;
entityShortId: string;
entityTitle: string | null | undefined;
entityContent: string | null | undefined;
commentId: string;
commentContent: string | null | undefined;
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export interface CommentReplyNotification extends BaseAppNotification {
type: "comment-reply";
action: "open-comment";
metadata: {
entityId: string;
entityShortId: string;
entityTitle: string | null | undefined;
entityContent: string | null | undefined;
commentId: string;
commentContent: string | null | undefined;
replyId: string;
replyContent: string | null | undefined;
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export interface EntityMentionNotification extends BaseAppNotification {
type: "entity-mention";
action: "open-entity";
metadata: {
entityId: string;
entityShortId: string;
entityTitle: string | null | undefined;
entityContent: string | null | undefined;
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export interface CommentMentionNotification extends BaseAppNotification {
type: "comment-mention";
action: "open-comment";
metadata: {
entityId: string;
entityShortId: string;
entityTitle: string | null | undefined;
entityContent: string | null | undefined;
commentId: string;
commentContent: string | null | undefined;
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export interface EntityUpvoteNotification extends BaseAppNotification {
type: "entity-upvote";
action: "open-entity";
metadata: {
entityId: string;
entityShortId: string;
entityTitle: string | null | undefined;
entityContent: string | null | undefined;
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export interface CommentUpvoteNotification extends BaseAppNotification {
type: "comment-upvote";
action: "open-comment";
metadata: {
entityId: string;
entityShortId: string;
entityTitle: string | null | undefined;
entityContent: string | null | undefined;
commentId: string;
commentContent: string | null | undefined;
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export interface NewFollowNotification extends BaseAppNotification {
type: "new-follow";
action: "open-profile";
metadata: {
initiatorId: string;
initiatorName: string | null | undefined;
initiatorUsername: string | null | undefined;
initiatorAvatar: string | null | undefined;
};
}
export type UnifiedAppNotification = EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | NewFollowNotification;
export type NotificationTemplate = {
title?: string;
content?: string;
};
export type NotificationTemplates = {
entityComment: NotificationTemplate;
commentReply: NotificationTemplate;
entityMention: NotificationTemplate;
commentMention: NotificationTemplate;
entityUpvote: NotificationTemplate;
commentUpvote: NotificationTemplate;
newFollow: NotificationTemplate;
};
export {};