import immutable from 'immutable'; import StreamAnalytics from 'stream-analytics'; import { UR, StreamClient, StreamUser, FeedAPIResponse, RealTimeMessage, GetFeedOptions, Activity, FlatActivityEnriched, AggregatedActivityEnriched, NotificationActivityEnriched, Reaction, ReactionAddOptions, ReactionAddChildOptions, ReactionFilterAPIResponse, EnrichedReaction, ForeignIDTimes } from 'getstream'; import { ErrorHandler } from '../utils/errors'; import { DefaultUT, DefaultAT } from './StreamApp'; import { FeedProps } from './Feed'; import { Subscription } from 'faye'; declare type MarkAsGroup = boolean | { id: string; } | Array<{ id: string; }>; declare type TrackAnalytics = { trackAnalytics?: boolean; }; declare type ResponseResult = FlatActivityEnriched | AggregatedActivityEnriched | NotificationActivityEnriched; export declare type UpdateTriggeredCallback = () => void; export declare type FeedManagerProps = FeedProps & { analyticsClient: StreamAnalytics | null; client: StreamClient; errorHandler: ErrorHandler; user?: StreamUser; }; export declare type FeedManagerState = { activities: immutable.Map>>; activityIdToPath: Record>; activityIdToPaths: Record>>; activityOrder: string[]; childReactionsBeingToggled: Record>; numSubscribers: number; reactionActivities: Record; reactionIdToPaths: Record>>; reactionsBeingToggled: Record>; realtimeAdds: RealTimeMessage['new']; realtimeDeletes: string[]; refreshing: boolean; subscription: Promise | null; unread: number; unseen: number; lastResponse?: FeedAPIResponse | null; lastReverseResponse?: { next: string; } | null; }; export interface DoFeedResponseType { items?: ForeignIDTimes[]; activityId?: string; count?: number; next?: number; } export declare class FeedManager { registeredCallbacks: Array; props: FeedManagerProps; state: FeedManagerState; constructor(props: FeedManagerProps); register(callback: UpdateTriggeredCallback): void; unregister(callback: UpdateTriggeredCallback): void; triggerUpdate(): void; setState: (changed: Partial> | ((oldState: FeedManagerState) => Partial>)) => void; trackAnalytics: (label: string, activity: { foreign_id: string; }, track?: boolean | undefined) => void; getActivityPath: (activity: Activity | string, ...rest: string[]) => (string | number)[]; getActivityPaths: (activity: Activity | string) => (string | number)[][]; getReactionPaths: (reaction: Reaction | string) => (string | number)[][]; onAddReaction: (kind: string, activity: Activity, data?: RT | undefined, options?: ReactionAddOptions & TrackAnalytics) => Promise; onRemoveReaction: (kind: string, activity: Activity, id: string, options?: TrackAnalytics) => Promise; onToggleReaction: (kind: string, activity: Activity, data?: RT | undefined, options?: ReactionAddOptions & TrackAnalytics) => Promise; onAddChildReaction: (kind: string, reaction: Reaction, data?: CRT | undefined, options?: ReactionAddChildOptions) => Promise; onRemoveChildReaction: (kind: string, reaction: Reaction, id: string) => Promise; onToggleChildReaction: (kind: string, reaction: Reaction, data?: CRT | undefined, options?: ReactionAddChildOptions) => Promise; _removeActivityFromState: (activityId: string) => void; onRemoveActivity: (activityId: string) => Promise; onMarkAsRead: (group: MarkAsGroup) => Promise; onMarkAsSeen: (group: MarkAsGroup) => Promise; _onMarkAs: (type: 'seen' | 'read', group: MarkAsGroup) => Promise; getOptions: (extraOptions?: GetFeedOptions) => { id_gt?: string | undefined; id_gte?: string | undefined; id_lt?: string | undefined; id_lte?: string | undefined; limit: number; enrich?: boolean | undefined; ownReactions?: boolean | undefined; reactionKindsFilter?: string | undefined; recentReactionsLimit?: number | undefined; withOwnChildren?: boolean | undefined; withOwnReactions: boolean; withReactionCounts: boolean; withRecentReactions?: boolean | undefined; offset?: number | undefined; ranking?: string | undefined; session?: string | undefined; mark_read?: boolean | string[] | "current" | undefined; mark_seen?: boolean | string[] | "current" | undefined; }; doFeedRequest: (options?: GetFeedOptions | undefined) => Promise>; feed: () => import("getstream").StreamFeed; responseToActivityMap: (response: FeedAPIResponse) => immutable.Map>>; responseToActivityIdToPath: (response: FeedAPIResponse) => Record; responseToActivityIdToPaths: (response: FeedAPIResponse, previous?: FeedManagerState['activityIdToPaths']) => Record; feedResponseToReactionIdToPaths: (response: FeedAPIResponse, previous?: FeedManagerState['reactionIdToPaths']) => Record; reactionResponseToReactionIdToPaths: (response: ReactionFilterAPIResponse, previous: FeedManagerState['reactionIdToPaths'], basePath: Array, oldLength: number) => Record; removeFoundReactionIdPaths: (data: EnrichedReaction | EnrichedReaction[], previous: FeedManagerState['reactionIdToPaths'], basePath: Array) => Record; removeFoundActivityIdPaths: (data: ResponseResult | ResponseResult[], previous: FeedManagerState['activityIdToPaths'], basePath: Array) => Record; removeFoundActivityIdPath: (data: ResponseResult[], previous: FeedManagerState['activityIdToPath'], basePath: Array) => Record; addFoundReactionIdPaths: (data: EnrichedReaction | EnrichedReaction[], previous: FeedManagerState['reactionIdToPaths'], basePath: Array) => Record; addFoundActivityIdPaths: (data: ResponseResult | ResponseResult[], previous: FeedManagerState['activityIdToPaths'], basePath: Array) => Record; addFoundActivityIdPath: (data: ResponseResult[], previous: FeedManagerState['activityIdToPath'], basePath: Array) => Record; responseToReactionActivities: (response: FeedAPIResponse) => Record; unseenUnreadFromResponse(response: FeedAPIResponse): { unseen: number; unread: number; }; refresh: (extraOptions?: GetFeedOptions | undefined) => Promise; subscribe: () => Promise; unsubscribe: () => Promise; hasNextPage: () => boolean; hasReverseNextPage: () => boolean; loadNextPage: () => Promise; loadReverseNextPage: () => Promise; loadNextReactions: (activityId: string, kind: string, activityPath?: (string | number)[] | undefined, oldestToNewest?: boolean | undefined) => Promise; refreshUnreadUnseen: () => Promise; } export {}; //# sourceMappingURL=FeedManager.d.ts.map