import { KlevuFetchQueryResult, KlevuSearchSorting } from "@klevu/core";
import { EventEmitter } from "../../stencil-public-runtime";
export type SearchResultsEventData = {
  fallback?: KlevuFetchQueryResult;
  search?: KlevuFetchQueryResult;
  category?: KlevuFetchQueryResult;
  cms?: KlevuFetchQueryResult;
};
export type SuggestionsEventData = string[];
export type SearchFieldVariant = "default" | "pill";
/**
 * 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.
   */
  placeholder: string;
  /**
   * Button text
   */
  searchText: 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;
  /**
   * When results come from after typing in the search field. This is debounced to avoid excessive requests.
   */
  klevuSearchResults: EventEmitter<SearchResultsEventData>;
  /**
   * When searchfield gives some suggestions
   */
  klevuSearchSuggestions: EventEmitter<SuggestionsEventData>;
  /**
   * When user clicks search button. Returns the search term.
   */
  klevuSearchClick: EventEmitter<string>;
  connectedCallback(): Promise<void>;
  /**
   * Programmatically trigger search
   *
   * @param term What to search
   */
  makeSearch(term: string): Promise<void>;
  /**
   * 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<void>;
  /**
   * Fetches query result from last request
   *
   * @param type type of query result
   * @returns
   */
  getQueryResult(type: "search" | "category" | "cms"): Promise<KlevuFetchQueryResult | undefined>;
  propsChanged(): Promise<void>;
  render(): any;
}
