UNPKG

@solarpunkltd/comment-system

Version:

A library for writing and reading comments from the Swarm network.

33 lines 1.5 kB
import { Topic } from '@ethersphere/bee-js'; import { MessageData } from '../model'; /** * Generates a reaction feed ID based on the provided target comment feed ID. * * @param identifier - The ID of the target comment feed for which the reaction feed ID is generated. * @default getIdentifierFromUrl(window.location.href) * * @returns A `Topic` object created from the target comment feed ID. */ export declare const getReactionFeedId: (identifier?: string) => Topic; /** * Generates a reaction feed ID based on the provided target comment feed ID. * * @param identifier - The ID of the target comment feed for which the reaction feed ID is generated. * @default getIdentifierFromUrl(window.location.href) * * @returns A `Topic` object created from the target comment feed ID. */ export declare const getReactionFeedIdForComment: (targetMessageId: string) => Topic; /** * Updates the list of reactions. * * @param reactions - The current list of reactions. * @param newReaction - The new reaction to be added, removed, or edited. * ### Behavior: * - **ADD**: Adds the `newReaction` to the list if it does not already exist. * - **REMOVE**: Removes the existing reaction that matches the `newReaction`'s user and reaction type. * * @returns The updated list of reactions, or `undefined` if no changes were made. */ export declare function updateReactions(reactions: MessageData[], newReaction: MessageData): MessageData[] | undefined; //# sourceMappingURL=reactions.d.ts.map