commerce/framework/aquilacms/customer/get-customer-wishlist.ts
Gérard Le Cloerec 8be640e90f fix: Wishlist type
chore: exclude only node_modules from tsconfig
2021-04-13 15:36:12 +02:00

59 lines
1.2 KiB
TypeScript

import { AquilacmsConfig, getConfig } from '../api'
type wishlist_Full = {
id?: number
customer_id?: number
name?: string
is_public?: boolean
token?: string
}
export type Wishlist = wishlist_Full & {
items?: WishlistItem[]
}
export type WishlistItem = NonNullable<any>[0] & {
product?: any
}
export type GetCustomerWishlistResult<
T extends { wishlist?: any } = { wishlist?: Wishlist }
> = T
export type GetCustomerWishlistVariables = {
customerId: string
}
async function getCustomerWishlist(opts: {
variables: GetCustomerWishlistVariables
config?: AquilacmsConfig
includeProducts?: boolean
}): Promise<GetCustomerWishlistResult>
async function getCustomerWishlist<
T extends { wishlist?: any },
V = any
>(opts: {
url: string
variables: V
config?: AquilacmsConfig
includeProducts?: boolean
}): Promise<GetCustomerWishlistResult<T>>
async function getCustomerWishlist({
config,
variables,
includeProducts,
}: {
url?: string
variables: GetCustomerWishlistVariables
config?: AquilacmsConfig
includeProducts?: boolean
}): Promise<GetCustomerWishlistResult> {
config = getConfig(config)
return { wishlist: {} }
}
export default getCustomerWishlist