import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import Footer from 'components/layout/footer'; import { Gallery } from 'components/product/gallery'; import { ProductProvider } from 'components/product/product-context'; import { ProductDescription } from 'components/product/product-description'; import { Wrapper } from 'components/wrapper'; import { HIDDEN_PRODUCT_TAG } from 'lib/constants'; import { getCart, getProduct } from 'lib/fourthwall'; import { cookies } from 'next/headers'; import { Suspense } from 'react'; export async function generateMetadata({ params }: { params: { handle: string }; }): Promise { const product = await getProduct({ handle: params.handle, currency: 'USD' }); if (!product) return notFound(); const { url, width, height, altText: alt } = product.featuredImage || {}; const indexable = !product.tags.includes(HIDDEN_PRODUCT_TAG); return { title: product.title, description: product.description, robots: { index: indexable, follow: indexable, googleBot: { index: indexable, follow: indexable } }, openGraph: url ? { images: [ { url, width, height, alt } ] } : null }; } export default async function ProductPage({ params, searchParams }: { params: { handle: string }, searchParams: { currency?: string } }) { const currency = searchParams.currency || 'USD'; const cartId = cookies().get('cartId')?.value; const cart = getCart(cartId, currency) const product = await getProduct({ handle: params.handle, currency, }); if (!product) return notFound(); const productJsonLd = { '@context': 'https://schema.org', '@type': 'Product', name: product.title, description: product.description, image: product.featuredImage.url, offers: { '@type': 'AggregateOffer', availability: product.availableForSale ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock', priceCurrency: product.priceRange.minVariantPrice.currencyCode, highPrice: product.priceRange.maxVariantPrice.amount, lowPrice: product.priceRange.minVariantPrice.amount } }; return (