mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 15:06:59 +00:00
Updates
This commit is contained in:
parent
41f8a651f7
commit
aad0a909ac
@ -50,7 +50,7 @@ export function normalizeProduct(productNode: any): Product {
|
||||
alt: altText,
|
||||
...rest,
|
||||
})),
|
||||
|
||||
// merge variant default image with product images
|
||||
...productNode.variants?.edges
|
||||
?.map(({ node: { defaultImage } }: any) =>
|
||||
defaultImage
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Fetcher } from '@vercel/commerce/utils/types'
|
||||
import type { Fetcher } from '@vercel/commerce/utils/types'
|
||||
import { API_TOKEN, API_URL } from './const'
|
||||
import { handleFetchResponse } from './utils/handle-fetch-response'
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
export { throwUserErrors } from './throw-user-errors'
|
||||
export { handleFetchResponse } from './handle-fetch-response'
|
||||
|
||||
export {
|
||||
handleLogin,
|
||||
handleAutomaticLogin,
|
||||
handleAccountActivation,
|
||||
} from './auth'
|
||||
|
||||
export * from './auth'
|
||||
export * from './cart'
|
||||
export * from './metafields'
|
||||
|
@ -10,7 +10,7 @@ const Head: VFC = () => {
|
||||
content="width=device-width, initial-scale=1"
|
||||
/>
|
||||
<link rel="manifest" href="/site.webmanifest" key="site-manifest" />
|
||||
{process.env.COMMERCE_PROVIDER === '@vercel/commerce-shopify' && (
|
||||
{process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN && (
|
||||
<link
|
||||
rel="preconnect"
|
||||
href={`https://${process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN?.replace(
|
||||
|
@ -2,10 +2,10 @@ import type { ProductCustomField } from '@commerce/types/product'
|
||||
|
||||
const ProductCustomFields = ({ fields }: { fields: ProductCustomField[] }) => {
|
||||
return (
|
||||
<ul className="flex flex-col space-y-2.5 divide-y divide-accent-2 divide-dashed">
|
||||
<ul className="flex flex-col space-y-3 divide-y divide-accent-2 divide-dashed">
|
||||
{fields.map((m) => (
|
||||
<li
|
||||
className="flex space-x-2 justify-start items-start pt-2.5 text-sm"
|
||||
className="flex space-x-2 justify-start items-start pt-3 text-sm"
|
||||
key={m.key}
|
||||
>
|
||||
<span className="font-bold capitalize whitespace-nowrap">
|
||||
|
@ -22,7 +22,7 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ className }) => {
|
||||
try {
|
||||
await addItem({
|
||||
productId: String(product.id),
|
||||
variantId: String(variant ? variant.id : product.variants[0]?.id),
|
||||
variantId: String(variant.id),
|
||||
})
|
||||
setSidebarView('CART_VIEW')
|
||||
openSidebar()
|
||||
|
@ -1,15 +1,13 @@
|
||||
import { useMemo, useState, useEffect, useContext, createContext } from 'react'
|
||||
|
||||
import type { FC, ReactNode, Dispatch, SetStateAction } from 'react'
|
||||
|
||||
import type { SelectedOptions } from './helpers'
|
||||
import type {
|
||||
Product,
|
||||
ProductImage,
|
||||
ProductVariant,
|
||||
} from '@commerce/types/product'
|
||||
|
||||
import type { SelectedOptions } from './helpers'
|
||||
|
||||
import usePrice from '@framework/product/use-price'
|
||||
import { getProductVariant, selectDefaultOptionFromProduct } from './helpers'
|
||||
|
||||
@ -36,8 +34,8 @@ export const ProductProvider: FC<ProductProviderProps> = ({
|
||||
product,
|
||||
children,
|
||||
}) => {
|
||||
const [selectedOptions, setSelectedOptions] = useState<SelectedOptions>({})
|
||||
const [imageIndex, setImageIndex] = useState<number | null>(null)
|
||||
const [selectedOptions, setSelectedOptions] = useState<SelectedOptions>({})
|
||||
|
||||
useEffect(
|
||||
() => selectDefaultOptionFromProduct(product, setSelectedOptions),
|
||||
|
Loading…
x
Reference in New Issue
Block a user