avada-feature-request
Version:
Feature Request component library for React applications
44 lines (43 loc) • 1.7 kB
TypeScript
import { Firestore } from "firebase/firestore";
import { FeatureRequest, FeatureReqQuery, Shop, Comment } from "../types";
interface LiveVoteFeatureReqConstructor {
db: Firestore;
shop: Shop;
}
interface ToggleVoteParams {
targetId: string;
shopId: string;
byFeatureReq: boolean;
}
export declare class LiveVoteFeatureReq {
private featureReqRef;
private commentFeatureReqRef;
private support;
private db;
private shopId;
private shop;
private data;
private activeSubscriptions;
constructor(props: LiveVoteFeatureReqConstructor);
private initialize;
subscribeToDocumentCounts(callback: (data: any) => void, dataQuery: any): Promise<(() => void) | undefined>;
toggleVote({ targetId, shopId, byFeatureReq }: ToggleVoteParams): Promise<void>;
subscribeToComments(parentId: string, callback: (comments: Comment[]) => void): Promise<(() => void) | undefined>;
cleanup(): void;
subscribeTrendingRequests(callback: (result: {
data: FeatureRequest[];
}) => void, limitCount?: number): () => void;
subscribeFeatureRequests(callback: (result: {
data: FeatureRequest[];
lastDoc: any;
}) => void, queryParams?: FeatureReqQuery): () => void;
subscribeFeatureRequest(id: string, callback: (data: FeatureRequest) => void): () => void;
removeFeatureRequest(id: string): Promise<void>;
updateFeatureRequest(id: string, updateData: Partial<FeatureRequest>): Promise<{
success: boolean;
message: string;
}>;
removeComment(commentId: string, shopId: string): Promise<void>;
subscribeSupport(shopId: string, callback: (data: any) => void): () => void;
}
export {};