import { LineItem } from "@medusajs/medusa" import { ReservationItemDTO } from "@medusajs/types" import ImagePlaceholder from "../../../../components/fundamentals/image-placeholder" import { formatAmountWithSymbol } from "../../../../utils/prices" import { useFeatureFlag } from "../../../../providers/feature-flag-provider" import ReservationIndicator from "../../components/reservation-indicator/reservation-indicator" type OrderLineProps = { item: LineItem currencyCode: string reservations?: ReservationItemDTO[] isAllocatable?: boolean } const OrderLine = ({ item, currencyCode, reservations, isAllocatable = true, }: OrderLineProps) => { const { isFeatureEnabled } = useFeatureFlag() return (
{item.thumbnail ? ( ) : ( )}
{item.title} {item?.variant && ( {`${item.variant.title}${ item.variant.sku ? ` (${item.variant.sku})` : "" }`} )}
{formatAmountWithSymbol({ amount: (item?.total ?? 0) / item.quantity, currency: currencyCode, digits: 2, tax: [], })}
x {item.quantity}
{isFeatureEnabled("inventoryService") && isAllocatable && ( )}
{formatAmountWithSymbol({ amount: item.total ?? 0, currency: currencyCode, digits: 2, tax: [], })}
{currencyCode.toUpperCase()}
) } export default OrderLine