import React from "react"; import { createSearchStore } from "./redux/store"; import { FullValuSearchConfig, UIStrings, ReactGroup, Slots, Group } from "./config"; import { open } from "./utils/shared-helpers"; import { SearchResultsViewer } from "./components/SearchResultsViewer"; import { SearchEngine } from "./redux/search-engine"; import { ValuSearchEventListener, ValuSearchEvents } from "./events"; import { GetJwtToken, CustomFields, FindkitFetch } from "@findkit/fetch"; export * from "./components/SharedComponents"; export { useIsSearchActive } from "./utils/use-search-terms"; export * from "./utils/shared-helpers"; export { useValuSearch } from "./config"; export { ValuSearchEvent, ValuSearchBrowserEvent } from "./events"; export * from "./components/ReactIcons"; export { useGroupSearchResults, useIsSearching } from "./redux/hooks"; export { Group, Slots, CustomFields }; interface FindkitWindow { ["rvs-loaded"]?: string; FINDKIT_GET_JWT_TOKEN?: GetJwtToken; } export declare const findkitWindow: FindkitWindow | undefined; /** * English and fallback translations in UI */ export declare const defaultTranslation: UIStrings; /** * Finnish and Swedish UI translations */ export declare const translations: Record; export interface ValuSearchUIConfig { instanceId: FullValuSearchConfig["instanceId"]; uiStrings: UIStrings; /** * @deprecated Use .bindInput() or .useInput() */ inputSelectors: string; validateTabbable: FullValuSearchConfig["validateTabbable"]; orderBy: FullValuSearchConfig["orderBy"]; /** * @deprecated Use "slots" instead */ slotOverrides: FullValuSearchConfig["slots"]; slots: FullValuSearchConfig["slots"]; } /** * Options for the ValuSearch class */ export interface ValuSearchConfig { /** * Customer id string */ customer?: string; /** * API key for the search endpint */ apiKey: string; /** * Enable focus trapping. Defaults to true */ focusTrap?: boolean; /** * Result group configuration. Customize group titles, filters, decays etc. */ groups?: Group[]; /** * Validate tabbable for the focus trapping */ validateTabbable?: FullValuSearchConfig["validateTabbable"]; /** * Customize the appearance via render props slots */ slots?: Slots; /** * The group order. Default to "score" */ orderBy?: FullValuSearchConfig["orderBy"]; /** * @deprecated use uiLang and searchLang */ lang?: string; /** * Set UI strings to lang */ uiLang?: string; /** * Set searches to lang, * only first language from the array is supported * array type for possible future extensions to multiple languages * for now, leave undefined to search with all languages */ searchLang?: string[] | undefined; /** * Custom instance id. Only needed when running multiple RVS instances on * the same page. Affects the url query string names */ instanceId?: string; /** * How many items to preview in the groups */ previewGroupSize?: number; /** * How many results to search for in group view */ searchMoreSize?: number; /** * Min search term lenght */ minSearchTermsLength?: number; /** * How often a search is made when user types to an input */ searchThrottleTime?: number; /** * @deprecated Just use the slotOverrides */ mode?: "fullScreen"; /** * @deprecated Use ValuSearch#bindInput() */ inputSelectors?: string; /** * Event listener to be called on ValuSearchEvents */ onEvent?: ValuSearchEventListener; /** * @deprecated Use "slots" instead */ slotOverrides?: Slots; /** * @deprecated Use "customer" instead */ searchEndpoint?: string; /** * @deprecated Use "groups" instead */ tagGroups?: Group[]; /** * Enable infinite scrolling by automatically loading results when the last * item appears to the screen */ infiniteScroll?: boolean; /** * Custom @findkit/fetch implementation. Can be used to add jwt support */ fetcher?: FindkitFetch; } interface ProviderProps { children: React.ReactNode; /**@deprecated use uiLang and searchLang instead */ lang?: string; uiLang?: string; searchLang?: string[] | undefined; uiStrings?: Partial; groups?: Group[]; disabled?: boolean; /** * @deprecated Use the "groups" prop instead */ tagGroups?: Group[]; slots?: Slots; } export declare class ValuSearch { readonly config: Readonly; fetcher: FindkitFetch; initialized: boolean; instanceId: string; engine: SearchEngine; store: ReturnType; constructorGroups?: Group[]; events: ValuSearchEvents; hasBeenOpened: boolean; /** * @deprecated */ legacyFullscreen: boolean; /** * @deprecated */ legacyInputSelectors: string | undefined; constructor(config: ValuSearchConfig); /** * Just globally listen the Escape key and deactivate the instance when * pressed. */ private bindEsc; getTerms: () => string; private buildEngine; /** * @deprecated */ ValuSearchActions: () => import("immer-reducer").ActionCreators; /** * @deprecated */ private connectOpenerOnWindow; /** * @deprecated use .initModal() */ renderMultiSearchResultsOnWindow: (uiStrings?: UIStrings | undefined) => void; initModal: (options?: { uiStrings?: UIStrings | undefined; } | undefined) => void; /** * Connect Valu Search Results UI to an input element and one or more submit * buttons. * * @deprecated Use .bindInput() or .activate() instead * * @param options.inputs an input element or "FROM_LOADER" which will * autotomatically pick up the input from loader script */ connectSearchElementsOnWindow: (options: { inputs: HTMLCollectionOf | "FROM_LOADER"; openers?: HTMLCollectionOf | "FROM_LOADER" | null; }) => void; /** * Connects necessary listeners to Input and document * Returns an unmounting function * @param searchInputElement */ connectInputOnWindow: (searchInputElement: HTMLInputElement | null) => boolean; /** * Set search terms to a given value */ setSearchTerms: (terms: string) => void; bindInput: (input: HTMLInputElement) => boolean; unbindInput(input: HTMLInputElement): void; /** * Bind input only as an opener. This for fullscreen modals where the * actual vs input is inside the modal but there's another input outside it * which should open the modal when typed on but not really work as bound * vs input. */ bindInputAsOpener: (input: HTMLInputElement) => () => void; useInput: () => React.MutableRefObject; /** * @deprecated Use .useInput() */ useValuSearchInputConnect: () => React.MutableRefObject; /** * Manage RVS active status */ useStatus: () => { isActive: boolean; activate: () => void; deactivate: () => void; }; /** * Get and set search terms like useState() */ useSearchTerms: () => readonly [string, (terms: string) => void]; private UseValuSearchHooks; private setInputs?; toReactGroups(groups: Group[]): ReactGroup[]; Provider: (props: ProviderProps) => JSX.Element | null; getSearchLang: (props: ProviderProps) => string[] | undefined; private ProviderInner; ValuSearchProvider: (props: ProviderProps) => JSX.Element | null; Modal: (props: { topMargin?: number | string; }) => JSX.Element; /** * @deprecated Use */ SearchResultsViewerComponent: typeof SearchResultsViewer; Results: (props: { header?: React.ReactNode; footer?: React.ReactNode; }) => JSX.Element; /** * If you have custom components that you want to include in * focus trap, wrap VS UI with this component * * e.g. * * * * * @param props */ FocusTrapContainer: React.ForwardRefExoticComponent, HTMLDivElement>, "key" | keyof React.HTMLAttributes> & React.RefAttributes>; /** * Helper function for closing Valu Search. * Handles history api calls for you. */ deactivate: () => void; /** * @deprecated use .deactivate() */ close: () => void; activate: () => void; isActive: () => boolean; addListener: (listener: ValuSearchEventListener) => () => void; /** * Class name used to create FocusTrap containers */ get trapClassName(): string; } /** * @deprecated For backwards compatibility reasons only, do not use in post 14.0.0 installations * Only use this if connectSearchElements() is called with "FROM_LOADER", values */ export declare const renderMultiSearchResults: (config: ValuSearchConfig & { uiStrings?: UIStrings; }) => ValuSearch; export declare const vsOpenOnWindow: typeof open; export declare const VERSION: string;