mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 19:51:23 +00:00
Aligned with upstream changes
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import { Product } from '@commerce/types'
|
||||
import { getConfig, ShopifyConfig } from '../api'
|
||||
import fetchAllProducts from '../api/utils/fetch-all-products'
|
||||
import { ProductEdge } from '../schema'
|
||||
import getAllProductsPathsQuery from '../utils/queries/get-all-products-paths-query'
|
||||
|
||||
type ProductPath = {
|
||||
path: string
|
||||
}
|
||||
|
||||
export type ProductPathNode = {
|
||||
node: ProductPath
|
||||
}
|
||||
|
||||
type ReturnType = {
|
||||
products: any[]
|
||||
products: ProductPathNode[]
|
||||
}
|
||||
|
||||
const getAllProductPaths = async (options?: {
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import { GraphQLFetcherResult } from '@commerce/api'
|
||||
import { getConfig, ShopifyConfig } from '../api'
|
||||
import { Product, ProductEdge } from '../schema'
|
||||
import { ProductEdge } from '../schema'
|
||||
import { getAllProductsQuery } from '../utils/queries'
|
||||
import { normalizeProduct } from '@framework/utils/normalize'
|
||||
|
||||
export type ProductNode = Product
|
||||
import { Product } from '@commerce/types'
|
||||
|
||||
type Variables = {
|
||||
first?: number
|
||||
@@ -12,7 +11,7 @@ type Variables = {
|
||||
}
|
||||
|
||||
type ReturnType = {
|
||||
products: any[]
|
||||
products: Product[]
|
||||
}
|
||||
|
||||
const getAllProducts = async (options: {
|
||||
@@ -28,9 +27,10 @@ const getAllProducts = async (options: {
|
||||
{ variables }
|
||||
)
|
||||
|
||||
const products = data.products?.edges?.map(({ node: p }: ProductEdge) =>
|
||||
normalizeProduct(p)
|
||||
)
|
||||
const products =
|
||||
data.products?.edges?.map(({ node: p }: ProductEdge) =>
|
||||
normalizeProduct(p)
|
||||
) ?? []
|
||||
|
||||
return {
|
||||
products,
|
||||
|
@@ -1,2 +1,2 @@
|
||||
export * from '@commerce/use-price'
|
||||
export { default } from '@commerce/use-price'
|
||||
export * from '@commerce/product/use-price'
|
||||
export { default } from '@commerce/product/use-price'
|
||||
|
Reference in New Issue
Block a user