import { FacetRequired, Narrow, Product, RelatedCategoryServer, SortBy } from "./fullTextSearch"; import { ServerFacet } from "@fast-simon/utilities"; import { Channel, CollectionsPersonalization, SDKUtils } from "./common"; export interface SmartCollectionsResponse { ancestor_categories: CategoryAncestor[]; category_description: string; category_id: string; category_name: string; category_url: string; facets: ServerFacet[]; facets_completed: false; isp_quick_view_mode: 0; items: Product[]; p: number; str_site_key: string; term: string; total_p: number; total_results: number; personalization_recency_limit: number; use_personalized_collection: boolean; uuid: string; sort_by?: SortBy; narrow: [string, string, string][]; pop_products_no_results?: boolean; avoid_tag_prefixes?: string; merch?: any; banner_html?: string; related_categories?: RelatedCategoryServer[]; personalized_products?: number[]; } export type CategoryAncestor = [string, string, string]; export interface smartCollections { storeID: number; uuid: string; cdn: number; categoryID: string; userToken: string; sessionStart: number; page?: number; productsPerPage?: number; sortBy?: SortBy; narrowBy?: Narrow[]; facetRequired?: FacetRequired; withAttributes?: boolean; recent?: string; recentTimestamps?: Record; cartTimestamps?: Record; rec?: boolean; searchWithinSearch?: string; segments?: string[]; hasShopifyMarkets?: boolean; companyLocationContext?: number; withProductTypes?: boolean; abTestingVariations?: { [key: string]: { [key: string]: object; }; }; disableMerchandising?: boolean; disableStrategies?: boolean; disableMerchandisingRules?: boolean; isPersonalizedFiltersActive?: boolean; disableTurbolinks?: boolean; collectionPersonalization?: CollectionsPersonalization; channel?: Channel; self?: SDKUtils; } export interface smartCollectionsResults { ancestors: CategoryAncestor[]; categoryID: string; name: string; products: Product[]; facets?: ServerFacet[]; totalResults: number; sortBy?: SortBy; narrow?: Narrow[]; isNoResults?: boolean; page?: number; pageCount?: number; avoidPrefixList?: string[]; merch?: any; bannerHTML?: string; relatedCategories?: RelatedCategory[]; error?: boolean; } export type smartCollectionsCallback = ({}: { action: "products" | "facets and products"; payload: smartCollectionsResults; }) => void; export interface RecentSmartCollectionProduct { id: string; time: number; } export interface RelatedCategory { id: string; title: string; image: string; url: string; }