4
0
forked from crowetic/commerce
commerce/framework/types.d.ts

86 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-01-10 16:16:49 -03:00
interface Entity {
2021-01-06 17:01:32 -03:00
id: string | number
2021-01-10 16:16:49 -03:00
[prop: string]: any
}
interface Product extends Entity {
2021-01-06 17:01:32 -03:00
name: string
description: string
slug?: string
path?: string
2021-01-11 14:13:29 -03:00
images: ProductImage[]
variants: ProductVariant[]
2021-01-10 15:55:11 -03:00
price: ProductPrice
2021-01-11 14:54:05 -03:00
options: ProductOption[]
2021-01-14 12:58:41 -03:00
sku?: string
2021-01-06 17:01:32 -03:00
}
2021-01-11 14:54:05 -03:00
interface ProductOption extends Entity {
displayName: string
values: ProductOptionValues[]
}
interface ProductOptionValues {
label: string
hexColors?: string[]
}
2021-01-07 16:28:50 -03:00
interface ProductImage {
url: string
alt?: string
}
interface ProductVariant {
id: string | number
2021-01-11 16:16:00 -03:00
options: ProductOption[]
2021-01-07 16:28:50 -03:00
}
2021-01-06 17:01:32 -03:00
2021-01-07 11:58:00 -03:00
interface ProductPrice {
2021-01-10 15:55:11 -03:00
value: number
2021-01-10 16:16:49 -03:00
currencyCode: 'USD' | 'ARS' | string | undefined
2021-01-14 12:58:41 -03:00
retailPrice?: number
salePrice?: number
listPrice?: number
extendedSalePrice?: number
extendedListPrice?: number
2021-01-06 17:01:32 -03:00
}
2021-01-09 12:05:40 -03:00
2021-01-10 16:16:49 -03:00
interface Cart extends Entity {
2021-01-12 16:59:07 -03:00
id: string | undefined
currency: { code: string }
taxIncluded?: boolean
2021-01-19 12:33:50 -03:00
items: Pick<Product, 'id' | 'name' | 'prices'> & CartItem[]
2021-01-19 11:07:40 -03:00
subTotal: number | string
total: number | string
2021-01-19 12:33:50 -03:00
customerId: Customer['id']
2021-01-14 12:58:41 -03:00
}
interface CartItem extends Entity {
quantity: number
productId: Product['id']
variantId: ProductVariant['id']
images: ProductImage[]
2021-01-09 12:07:17 -03:00
}
2021-01-10 16:16:49 -03:00
interface Wishlist extends Entity {
2021-01-09 12:07:17 -03:00
products: Pick<Product, 'id' | 'name' | 'prices'>[]
2021-01-09 12:05:40 -03:00
}
2021-01-09 12:17:31 -03:00
interface Order {}
2021-01-11 16:16:00 -03:00
interface Customer extends Entity {}
2021-01-09 12:05:40 -03:00
2021-01-10 14:11:00 -03:00
type UseCustomerResponse = {
customer: Customer
} | null
2021-01-10 16:16:49 -03:00
interface Category extends Entity {
2021-01-09 12:17:31 -03:00
name: string
}
2021-01-10 16:16:49 -03:00
interface Brand extends Entity {
2021-01-09 12:17:31 -03:00
name: string
}
2021-01-09 12:05:40 -03:00
2021-01-09 12:17:31 -03:00
type Features = 'wishlist' | 'customer'