import type { DataSourceFn } from '../../../libs/integration-data-source'; import type { Pageable } from '../../../libs/util-domain-models'; import type * as Models from '../models'; declare global { export namespace SearchDomain { type Product = ProductDomain.Product; type Refinement = Models.Refinement; interface SearchIndex extends Models.SearchIndex { products: Product[]; sortingOptions?: SortOption[]; refinements?: Refinement[]; rawResponse?: unknown; } type SortOption = Models.SortOption; type Suggestion = Models.Suggestion; interface ProductIndex extends Models.ProductIndex { products: Product[]; sortingOptions?: SortOption[]; refinements?: Refinement[]; rawResponse?: unknown; } } } export interface BaseIndexInput { /** * A key representing the type of sort to be applied to the product query. The possible * values are dependent on the data source and are typically described in a ProductIndex. * * @example 'price-high-to-low' */ sortBy?: Models.SortOption['id']; /** * IDs of refinements and corresponding values to filter the product results. These identifers * are dependent on the data source and are typically described in a ProductIndex. * * The Search Domain will automatically generate this based off of the refinements object in productIndex * * @example * { * 'cgid': ['womens'] * } */ refinements?: Models.RefinementsInput; /** * data for pagination */ pageData?: Pageable; } export declare type FetchProductIndexInput = BaseIndexInput & { /** * an identifier for a specific product index to fetch. */ id: string; }; export declare type FetchProductIndex = DataSourceFn; export declare type FetchProductResultsInput = BaseIndexInput & { /** * the specific term to search the index with */ searchTerm: string; }; /** * Query the data source for products matching a specified keyword or query. * * @param input - the search query object * @return A Promise representing a search index */ export declare type FetchProductResults = DataSourceFn; export declare type FetchSuggestions = DataSourceFn; export declare type SearchDataSource = { fetchBrandSuggestions: FetchSuggestions; fetchCategorySuggestions: FetchSuggestions; fetchProductSuggestions: FetchSuggestions; fetchQuerySuggestions: FetchSuggestions; fetchProductResults: FetchProductResults; fetchProductIndex: FetchProductIndex; };