mirror of
https://github.com/vercel/commerce.git
synced 2025-03-27 07:45:53 +00:00
29 lines
722 B
TypeScript
29 lines
722 B
TypeScript
import type { ItemBody as WishlistItemBody } from '../wishlist'
|
|
import type { CartItemBody, OptionSelections } from '../../types'
|
|
|
|
type BCWishlistItemBody = {
|
|
product_id: number
|
|
variant_id: number
|
|
}
|
|
|
|
type BCCartItemBody = {
|
|
product_id: number
|
|
variant_id: number
|
|
quantity?: number
|
|
option_selections?: OptionSelections
|
|
}
|
|
|
|
export const parseWishlistItem = (
|
|
item: WishlistItemBody
|
|
): BCWishlistItemBody => ({
|
|
product_id: Number(item.productId),
|
|
variant_id: Number(item.variantId),
|
|
})
|
|
|
|
export const parseCartItem = (item: CartItemBody): BCCartItemBody => ({
|
|
quantity: item.quantity,
|
|
product_id: Number(item.productId),
|
|
variant_id: Number(item.variantId),
|
|
option_selections: item.optionSelections,
|
|
})
|