commerce/lib/storm/product.ts
2023-08-11 10:19:55 +02:00

148 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Image } from './types'
export interface ProductPrice {
/**
* The price after all discounts are applied.
*/
value: number
/**
* The currency code for the price. This is a 3-letter ISO 4217 code.
* @example USD
*/
currencyCode?: 'USD' | 'EUR' | 'ARS' | 'GBP' | string
/**
* The retail price of the product. This can be used to mark a product as on sale, when `retailPrice` is higher than the price a.k.a `value`.
*/
retailPrice?: number
}
export interface ProductOption {
__typename?: 'MultipleChoiceOption'
/**
* The unique identifier for the option.
*/
id: string
/**
* The product options name.
* @example `Color` or `Size`
*/
displayName: string
/**
* List of option values.
* @example `["Red", "Green", "Blue"]`
*/
values: ProductOptionValues[]
}
export interface ProductOptionValues {
/**
* A string that uniquely identifies the option value.
*/
label: string
/**
* List of hex colors used to display the actual colors in the swatches instead of the name.
*/
hexColors?: string[]
}
export interface ProductVariant {
/**
* The unique identifier for the variant.
*/
id: string
/**
* The SKU (stock keeping unit) associated with the product variant.
*/
sku?: string
/**
* The product variants name, or the product's name.
*/
name?: string
/**
* List of product options.
*/
options: ProductOption[]
/**
* The product variants price after all discounts are applied.
*/
price?: ProductPrice
/**
* The retail price of the product. This can be used to mark a product as on sale, when `retailPrice` is higher than the `price`.
*/
retailPrice?: ProductPrice
/**
* Indicates if the variant is available for sale.
*/
availableForSale?: boolean
/**
* Whether a customer needs to provide a shipping address when placing an order for the product variant.
*/
requiresShipping?: boolean
/**
* The image associated with the variant.
*/
image?: Image
}
export interface Product {
/**
* The currency for the product.
*/
currencyCode: string
/**
* The title for the product.
*/
title: string
/**
* The unique identifier for the product.
*/
id: string
/**
* The name of the product.
*/
name: string
/**
* Stripped description of the product, single line.
*/
description: string
/**
* The description of the product, complete with HTML formatting.
*/
descriptionHtml?: string
/**
* The SKU (stock keeping unit) associated with the product.
*/
sku?: string
/**
* A human-friendly unique string for the product, automatically generated from its title.
*/
slug?: string
/**
* Relative URL on the storefront for the product.
*/
path?: string
/**
* List of images associated with the product.
*/
images: Image[]
/**
* List of the products variants.
*/
variants: ProductVariant[]
/**
* The product's base price. Could be the minimum value, or default variant price.
*/
price: ProductPrice
/**
* List of product's options.
*/
options: ProductOption[]
/**
* The products vendor name.
*/
vendor?: string
/**
* The locale version of the product.
*/
locale?: string
}