mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Progress
This commit is contained in:
@@ -75,10 +75,12 @@ export function normalizeProduct(productNode: any): Product {
|
||||
})
|
||||
}
|
||||
|
||||
export function normalizeCart(cart: any): Cart {
|
||||
return update(cart, {
|
||||
export function normalizeCart(data: any): Cart {
|
||||
return update(data, {
|
||||
$auto: {
|
||||
products: { $set: cart?.line_items?.physical_items?.map(itemsToProducts)}
|
||||
products: { $set: data?.line_items?.physical_items?.map(itemsToProducts)},
|
||||
subTotal: { $set: data.base_amount },
|
||||
total: { $set: data.cart_amount }
|
||||
},
|
||||
$unset: ['created_time', 'coupons', 'line_items']
|
||||
})
|
||||
|
3
framework/types.d.ts
vendored
3
framework/types.d.ts
vendored
@@ -49,8 +49,9 @@ interface Cart extends Entity {
|
||||
id: string | undefined
|
||||
currency: { code: string }
|
||||
taxIncluded?: boolean
|
||||
totalAmmount: number | string
|
||||
products: Pick<Product, 'id' | 'name' | 'prices'> & CartItem[]
|
||||
subTotal: number | string
|
||||
total: number | string
|
||||
}
|
||||
|
||||
interface CartItem extends Entity {
|
||||
|
Reference in New Issue
Block a user