mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
✨ feat: featured products
:%s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { CurrencyCode } from './../../vendure/schema.d';
|
||||
import { CurrencyCode, FacetValue } from './../../vendure/schema.d';
|
||||
import { FacetValueFilterInput, LogicalOperator, SearchResultSortParameter } from "@framework/schema"
|
||||
|
||||
export type ProductImage = {
|
||||
@@ -54,9 +54,11 @@ export type ProductCard = {
|
||||
imageSrc: string
|
||||
price: number
|
||||
currencyCode: CurrencyCode
|
||||
oldPrice?: number,
|
||||
oldPrice?: number
|
||||
discount?: number
|
||||
weight?: number
|
||||
facetValueIds?: string[],
|
||||
collectionIds?: string[],
|
||||
// TODO: collection
|
||||
category?: string,
|
||||
isNotSell?: boolean
|
||||
|
3
framework/vendure/schema.d.ts
vendored
3
framework/vendure/schema.d.ts
vendored
@@ -1,3 +1,4 @@
|
||||
import { FacetValue } from './schema.d';
|
||||
export type Maybe<T> = T | null
|
||||
export type Exact<T extends { [key: string]: unknown }> = {
|
||||
[K in keyof T]: T[K]
|
||||
@@ -3038,7 +3039,7 @@ export type SearchResultFragment = { __typename?: 'SearchResult' } & Pick<
|
||||
SearchResult,
|
||||
'productId' | 'sku' | 'productName' | 'description' | 'slug' | 'sku' | 'currencyCode'
|
||||
| 'productAsset' | 'price' | 'priceWithTax' | 'currencyCode'
|
||||
| 'collectionIds'
|
||||
| 'collectionIds' | 'facetValueIds' | 'collectionIds'
|
||||
> & {
|
||||
productAsset?: Maybe<
|
||||
{ __typename?: 'SearchResultAsset' } & Pick<
|
||||
|
@@ -19,6 +19,8 @@ export const searchResultFragment = /* GraphQL */ `
|
||||
min
|
||||
max
|
||||
}
|
||||
}
|
||||
},
|
||||
facetValueIds,
|
||||
collectionIds,
|
||||
}
|
||||
`
|
||||
|
@@ -1,16 +1,17 @@
|
||||
import { Product, ProductCard } from '@commerce/types/product'
|
||||
import { Cart } from '@commerce/types/cart'
|
||||
import { ProductCard } from '@commerce/types/product'
|
||||
import { CartFragment, SearchResultFragment } from '../schema'
|
||||
|
||||
export function normalizeSearchResult(item: SearchResultFragment): ProductCard {
|
||||
return {
|
||||
|
||||
id: item.productId,
|
||||
name: item.productName,
|
||||
slug: item.slug,
|
||||
imageSrc: item.productAsset?.preview ? item.productAsset?.preview + '?w=800&mode=crop' : '',
|
||||
price: (item.priceWithTax as any).min / 100,
|
||||
currencyCode: item.currencyCode,
|
||||
facetValueIds: item.facetValueIds,
|
||||
collectionIds: item.collectionIds,
|
||||
|
||||
// TODO:
|
||||
// oldPrice: item.price
|
||||
|
Reference in New Issue
Block a user