import { KlevuSearchOptions, KlevuResponseQueryObject, KlevuSearchSorting } from "@klevu/core"; import { EventEmitter } from "../../stencil-public-runtime"; export type SearchResultsEventData = { fallback?: KlevuResponseQueryObject; search?: KlevuResponseQueryObject; category?: KlevuResponseQueryObject; cms?: KlevuResponseQueryObject; }; export type SuggestionsEventData = string[]; export type SearchFieldVariant = "default" | "pill" | "default-no-button"; /** * Plain textfield that does the searching. It queries Klevu and returns the results * in a custom event. Then you can decide what to do with the results. */ export declare class KlevuSearchField { #private; term: string; /** * The placeholder text to display in the search field. */ tPlaceholder: string; /** * Button text */ tSearchText: string; /** * Maximum amount of results */ limit: number; /** * Fallback term to use if there are no results */ fallbackTerm?: string; /** * Should search products */ searchProducts?: boolean; /** * Should search suggestions */ searchSuggestions?: boolean; /** * Should try to find categories as well */ searchCategories?: boolean; /** * Should try to find cms pages as well */ searchCmsPages?: boolean; /** * Sends analytics when making query */ sendAnalytics?: boolean; /** * In case you want to sort the results */ sort?: KlevuSearchSorting; /** * Variant of the search field */ variant: SearchFieldVariant; /** * Enable personalisation on the query */ usePersonalisation?: boolean; /** * Enable Klaviyo integration for search terms and clicks */ useKlaviyo?: boolean; /** * Object to override and settings on search options */ options?: KlevuSearchOptions; /** * Used to enable loading indicator */ useLoadingIndicator: boolean; /** * When results come from after typing in the search field. This is debounced to avoid excessive requests. */ klevuSearchResults: EventEmitter; /** * When searchfield gives some suggestions */ klevuSearchSuggestions: EventEmitter; /** * When user clicks search button. Returns the search term. */ klevuSearchClick: EventEmitter; isLoading: boolean; connectedCallback(): Promise; /** * Programmatically trigger search * * @param term What to search */ makeSearch(term: string): Promise; /** * Fetch next page of results from previous query * * @param type what type of content to get page from * @param pageIndex from what page. If empty next page is fetched */ getPage(type: "search" | "category" | "cms", pageIndex?: number): Promise; /** * Fetches query result from last request * * @param type type of query result * @returns */ getQueryResult(type: "search" | "category" | "cms"): Promise; propsChanged(): Promise; termChanged(): Promise; render(): any; }