@scayle/storefront-nuxt
Version:
Nuxt integration for the SCAYLE Commerce Engine and Storefront API
36 lines (35 loc) • 1.67 kB
TypeScript
import type { SearchV2SuggestionsEndpointResponseData, SearchV2With } from '@scayle/storefront-core';
import type { Status } from '../core/useRpc.js';
import type { Ref } from 'vue';
/**
* Representation of options for the search composable.
*/
export type SearchOptions = Partial<{
params: Partial<{
categoryId: number;
with: SearchV2With;
}>;
key: string;
}>;
/**
* A composable that provides a way to fetch and manage search suggestions and results.
*
* @deprecated `useStorefrontSearch` is deprecated. Consider using `useSearch` of `@scayle/storefront-search` instead.
*
* @param searchQuery A reactive reference to the search query string.
* @param options An object containing options for the search request.
* @param options.params Parameters for the search request.
* @param key A unique key for this search instance. Used internally for state management.
*
* @returns An object containing reactive data and computed properties for managing search results and suggestions.
*/
export declare function useStorefrontSearch(searchQuery: Ref<string>, { params }?: SearchOptions, key?: string): {
data: Ref<SearchV2SuggestionsEndpointResponseData | undefined, SearchV2SuggestionsEndpointResponseData | undefined>;
status: Ref<Status, Status>;
error: Ref<unknown, unknown>;
resetSearch: () => void;
getSearchSuggestions: () => Promise<void>;
resolveSearch: () => Promise<import("@scayle/storefront-api").CategorySearchSuggestion | import("@scayle/storefront-api").ProductSearchSuggestion | import("@scayle/storefront-api").NavigationItemSuggestion | {
type: undefined;
} | null | undefined>;
};