import { PollingObserver } from './long-polling.service'; import { IGetPostsReturnValue, IGetPostRequestReturnValue, IGetAggregationsReturnValue, IQueryParam, ISinglePost, PublicPostBody, ReviewBody } from './api.service'; import { AxiosResponse } from 'axios'; import { ISocialFeedsGroupedItem } from '../mappers/map-social-feeds'; import { IPersonalization, IPersonalizationData } from '../types/Personalization'; import { IPost, IPostRelationships, SocialFeedsTypesMap, IAggregation } from '../index'; export interface ITintMeta { id: string; slug: string; } export interface ITintConfig { network?: string; defaultQueryCount?: number; defaultQuery?: string; personalizationId?: number; tags?: string; saved_filter_id?: number; from?: number; product_sku?: string; } export interface TintRunResult { postsResponse: { posts: ReadonlyArray; postsRelationships?: ReadonlyArray; links: { first: string; self: string; next?: string; previous?: string; }; }; aggregations?: { aggregations: ReadonlyArray; }; personalization: IPersonalization; socialFeeds: SocialFeedsTypesMap; meta: ITintMeta; pollingObserver: PollingObserver | undefined; } export default class TintService { private readonly tintSlug; private readonly config; private readonly apiService; private realTimeService?; constructor(tintSlug: string, config?: ITintConfig); /** * Fetch the single post. * * @param id - The post id * @returns The promise of {@link ISinglePost} * */ getSinglePost(id: string): Promise; /** * Fetch the posts. * * @param config - The config object of query: {@link IQueryParam} * @returns The promise of posts: {@link IGetPostsReturnValue} * */ getPosts(config?: IQueryParam): Promise; /** * Fetch the aggregations. * * @returns The promise of aggregations: {@link IGetAggregationsReturnValue} * */ getAggregations(): Promise; /** * Fetch the posts from url - using for pagination. * * @param pageUrl - The config object of query: {@link IQueryParam} * @returns The promise of posts: {@link IGetPostsReturnValue} * */ getPage(pageUrl: string): Promise; /** * Post the public post. * * @param payload - The payload: {@link PublicPostBody} * @returns The promise of AxiosResponse * */ addPublicPost(payload: PublicPostBody): Promise; /** * Post the review . * * @param payload - The payload: {@link ReviewBody} * @returns The promise of AxiosResponse * */ addReview(payload: ReviewBody): Promise; /** * Get the public post request status. * * @param requestId - The request id * @returns The promise of AxiosResponse * */ getPublicPostRequest(requestId: string): Promise>; /** * Get social feeds * * @returns The promise of {@link SocialFeedsTypesMap>; /** * Fetch all basic data from tint: posts, social-feeds, personalization, webSocketObserver. * * @param config - post config {@link IQueryParam} * * @returns The promise of {@link TintRunResult} * */ up(config?: IQueryParam): Promise; private pollingServiceObservable; private isNewPersonalization; private mapToPersonalization; }