commerce/lib/types.ts
2024-09-23 16:46:29 -04:00

91 lines
1.5 KiB
TypeScript

export type Cart = {
id: string | undefined;
checkoutUrl: string;
cost: {
subtotalAmount: Money;
totalAmount: Money;
};
totalQuantity: number;
lines: CartItem[];
currency: string;
};
export type CartProduct = {
id: string;
handle: string;
title: string;
featuredImage: Image;
};
export type CartItem = {
id: string | undefined;
quantity: number;
cost: {
totalAmount: Money;
};
merchandise: {
id: string;
title: string;
selectedOptions: {
name: string;
value: string;
}[];
product: CartProduct;
};
};
export type Collection = {
handle: string;
title: string;
description: string;
};
export type Image = {
url: string;
altText: string;
width: number;
height: number;
};
export type Money = {
amount: string;
currencyCode: string;
};
export type Product = {
id: string;
handle: string;
availableForSale: boolean;
title: string;
description: string;
descriptionHtml: string;
options: ProductOption[];
priceRange: {
maxVariantPrice: Money;
minVariantPrice: Money;
};
featuredImage: Image;
tags: string[];
updatedAt: string;
variants: ProductVariant[];
images: Image[];
};
export type ProductOption = {
id: string;
name: string;
values: string[];
};
export type ProductVariant = {
id: string;
title: string;
availableForSale: boolean;
selectedOptions: {
name: string;
value: string;
}[];
price: Money;
images: Image[];
};