mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
* Add codegen, update fragments & schemas * Update checkout-create.ts * Update checkout-create.ts * Update README.md * Update product mutations & queries * Uptate customer fetch types * Update schemas * Start updates * Moved Page, AllPages & Site Info * Moved product, all products (paths) * Add translations, update operations & fixes * Update api endpoints, types & fixes * Add api checkout endpoint * Updates * Fixes * Update commerce.config.json Co-authored-by: B <curciobelen@gmail.com>
29 lines
724 B
TypeScript
29 lines
724 B
TypeScript
import type { WishlistItemBody } from '../../types/wishlist'
|
|
import type { CartItemBody, OptionSelections } from '../../types/cart'
|
|
|
|
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,
|
|
})
|