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

70 lines
1.2 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-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-10 15:55:11 -03:00
retailValue?: number
saleValue?: 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-09 12:05:40 -03:00
id: string
2021-01-09 12:07:17 -03:00
products: Pick<Product, 'id' | 'name' | 'prices'>[]
}
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'