mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Updates
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
export type SortFilterItem = {
|
||||
title: string;
|
||||
slug: string | null;
|
||||
sortKey: 'RELEVANCE' | 'BEST_SELLING' | 'CREATED_AT' | 'PRICE';
|
||||
reverse: boolean;
|
||||
};
|
||||
|
||||
export const defaultSort: SortFilterItem = {
|
||||
title: 'Relevance',
|
||||
slug: null,
|
||||
sortKey: 'RELEVANCE',
|
||||
reverse: false
|
||||
};
|
||||
|
||||
export const sorting: SortFilterItem[] = [
|
||||
defaultSort,
|
||||
{ title: 'Trending', slug: 'trending-desc', sortKey: 'BEST_SELLING', reverse: false }, // asc
|
||||
{ title: 'Latest arrivals', slug: 'latest-desc', sortKey: 'CREATED_AT', reverse: true },
|
||||
{ title: 'Price: Low to high', slug: 'price-asc', sortKey: 'PRICE', reverse: false }, // asc
|
||||
{ title: 'Price: High to low', slug: 'price-desc', sortKey: 'PRICE', reverse: true }
|
||||
];
|
||||
|
||||
export const HIDDEN_PRODUCT_TAG = 'nextjs-frontend-hidden';
|
||||
export const DEFAULT_OPTION = 'Default Title';
|
||||
export const SHOPIFY_GRAPHQL_API_ENDPOINT = '/api/2023-01/graphql.json';
|
||||
|
@@ -147,61 +147,6 @@ export interface Product {
|
||||
locale?: string
|
||||
}
|
||||
|
||||
export interface SearchProductsBody {
|
||||
/**
|
||||
* The search query string to filter the products by.
|
||||
*/
|
||||
search?: string
|
||||
/**
|
||||
* The category ID to filter the products by.
|
||||
*/
|
||||
categoryId?: string
|
||||
/**
|
||||
* The brand ID to filter the products by.
|
||||
*/
|
||||
brandId?: string
|
||||
/**
|
||||
* The sort key to sort the products by.
|
||||
* @example 'trending-desc' | 'latest-desc' | 'price-asc' | 'price-desc'
|
||||
*/
|
||||
sort?: string
|
||||
/**
|
||||
* The locale code, used to localize the product data (if the provider supports it).
|
||||
*/
|
||||
locale?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a list of products based on the given search criteria.
|
||||
*/
|
||||
export type SearchProductsHook = {
|
||||
data: {
|
||||
/**
|
||||
* List of products matching the query.
|
||||
*/
|
||||
products: Product[]
|
||||
/**
|
||||
* Indicates if there are any products matching the query.
|
||||
*/
|
||||
found: boolean
|
||||
}
|
||||
body: SearchProductsBody
|
||||
input: SearchProductsBody
|
||||
fetcherInput: SearchProductsBody
|
||||
}
|
||||
|
||||
/**
|
||||
* Product API schema
|
||||
*/
|
||||
|
||||
export type ProductsSchema = {
|
||||
endpoint: {
|
||||
options: {}
|
||||
handlers: {
|
||||
getProducts: SearchProductsHook
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Product operations
|
||||
|
Reference in New Issue
Block a user