UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

169 lines (168 loc) 6.05 kB
type AppNotificationType = "system" | "entity-comment" | "comment-reply" | "entity-mention" | "comment-mention" | "entity-upvote" | "comment-upvote" | "new-follow" | "connection-request" | "connection-accepted"; interface BaseAppNotification { id: string; userId: string; type: AppNotificationType; isRead: boolean; metadata: Record<string, any>; createdAt: string; } export interface SystemNotification extends BaseAppNotification { type: "system"; action: string; metadata: { title?: string; content?: string; buttonData: { text: string; url: string; } | null; }; } 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 interface ConnectionRequestNotification extends BaseAppNotification { type: "connection-request"; action: "open-profile"; metadata: { connectionId: string; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export interface ConnectionAcceptedNotification extends BaseAppNotification { type: "connection-accepted"; action: "open-profile"; metadata: { connectionId: string; initiatorId: string; initiatorName: string | null | undefined; initiatorUsername: string | null | undefined; initiatorAvatar: string | null | undefined; }; } export type UnifiedAppNotification = SystemNotification | EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | NewFollowNotification | ConnectionRequestNotification | ConnectionAcceptedNotification; export type NotificationTemplate = { title?: string; content?: string; }; export type NotificationTemplates = { entityComment: NotificationTemplate; commentReply: NotificationTemplate; entityMention: NotificationTemplate; commentMention: NotificationTemplate; entityUpvote: NotificationTemplate; commentUpvote: NotificationTemplate; newFollow: NotificationTemplate; connectionRequest: NotificationTemplate; connectionAccepted: NotificationTemplate; }; export type PotentiallyPopulatedUnifiedAppNotification = UnifiedAppNotification & { title?: string; content?: string; }; export {};