mirror of
https://github.com/vercel/commerce.git
synced 2025-07-27 04:01:23 +00:00
WIP POC in progress
This commit is contained in:
@@ -1,17 +1,60 @@
|
||||
import type { RawProductWithPrice } from '@framework/types/product'
|
||||
import type { RawProduct } from '@framework/types/product'
|
||||
import type { Product } from '@commerce/types/product'
|
||||
|
||||
export function normalize(product: RawProductWithPrice): Product {
|
||||
export function normalize(product: RawProduct): Product {
|
||||
return {
|
||||
id: product.ID,
|
||||
name: product.Name,
|
||||
description: product.Description,
|
||||
images: [],
|
||||
variants: [],
|
||||
slug: product.ID,
|
||||
images: product.xp.Images,
|
||||
price: {
|
||||
value: product.priceSchedule.PriceBreaks[0].Price,
|
||||
currencyCode: 'USD',
|
||||
value: product.xp.Price,
|
||||
currencyCode: product.xp.PriceCurrency,
|
||||
},
|
||||
options: [],
|
||||
// TODO: Implement this
|
||||
variants: [
|
||||
{
|
||||
id: 'unique',
|
||||
options: [
|
||||
{
|
||||
id: 'unique',
|
||||
displayName: 'Model',
|
||||
values: [
|
||||
{
|
||||
label: 'Unique',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
id: 'option-color',
|
||||
displayName: 'Color',
|
||||
values: [
|
||||
{
|
||||
label: 'color',
|
||||
hexColors: ['#222'],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'option-size',
|
||||
displayName: 'Size',
|
||||
values: [
|
||||
{
|
||||
label: 'S',
|
||||
},
|
||||
{
|
||||
label: 'M',
|
||||
},
|
||||
{
|
||||
label: 'L',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user