You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
890 B
43 lines
890 B
/**
|
|
* Shared cart types for client and server
|
|
* These types mirror the server-side types from server/utils/cart-helpers.ts
|
|
*/
|
|
|
|
/**
|
|
* Cart item with product details and computed subtotal
|
|
*/
|
|
export interface CartItemWithProduct {
|
|
id: string
|
|
cartId: string
|
|
productId: string
|
|
quantity: number
|
|
addedAt: Date
|
|
product: {
|
|
id: string
|
|
name: string
|
|
description: string | null
|
|
price: string
|
|
stockQuantity: number
|
|
active: boolean
|
|
category: string | null
|
|
imageUrl: string | null
|
|
}
|
|
subtotal: number
|
|
}
|
|
|
|
/**
|
|
* Cart summary with items and totals
|
|
*/
|
|
export interface CartSummary {
|
|
cart: {
|
|
id: string
|
|
userId: string | null
|
|
sessionId: string
|
|
createdAt: Date
|
|
updatedAt: Date
|
|
}
|
|
items: CartItemWithProduct[]
|
|
total: number
|
|
itemCount: number
|
|
removedItems?: string[] // Names of products that were removed due to unavailability
|
|
}
|
|
|