787 lines
15 KiB
TypeScript
787 lines
15 KiB
TypeScript
type Connection<T> = {
|
|
edges: Array<Edge<T>>
|
|
}
|
|
|
|
type Edge<T> = {
|
|
node: T
|
|
}
|
|
|
|
interface Address {
|
|
firstName: string
|
|
lastName: string
|
|
address1: string
|
|
address2?: string
|
|
city: string
|
|
countryCode: string
|
|
stateOrProvince: string
|
|
phone: string
|
|
postalCode: string
|
|
}
|
|
interface BigCommerceAddress {
|
|
address1: string
|
|
address2: string
|
|
address_type: string
|
|
city: string
|
|
company: string
|
|
country: string
|
|
country_code: string
|
|
customer_id: number
|
|
first_name: string
|
|
id: number
|
|
last_name: string
|
|
phone: string
|
|
postal_code: string
|
|
state_or_province: string
|
|
form_fields: []
|
|
}
|
|
|
|
interface RegisterCustomerInput {
|
|
firstName?: string
|
|
lastName?: string
|
|
email: string
|
|
password: string
|
|
phone?: string
|
|
address?: Address
|
|
}
|
|
|
|
interface BigCommerceRegisterCustomerOperation {
|
|
customer: {
|
|
registerCustomer: {
|
|
input: RegisterCustomerInput
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceCartOperation {
|
|
data: {
|
|
site: {
|
|
cart: BigCommerceCart
|
|
}
|
|
}
|
|
variables: {
|
|
entityId: string
|
|
}
|
|
}
|
|
|
|
interface BigCommerceCreateCartOperation {
|
|
data: {
|
|
cart: {
|
|
createCart: {
|
|
cart: BigCommerceCart
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
createCartInput: {
|
|
lineItems: CartItem[]
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceAddToCartOperation {
|
|
data: {
|
|
cart: {
|
|
addCartLineItems: {
|
|
cart: BigCommerceCart
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
addCartLineItemsInput: {
|
|
cartEntityId: string
|
|
data: {
|
|
lineItems: CartItem[]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceDeleteCartItemOperation {
|
|
data: {
|
|
cart: {
|
|
deleteCartLineItem: {
|
|
cart: BigCommerceCart
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
deleteCartLineItemInput: {
|
|
cartEntityId: string
|
|
lineItemEntityId: string
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceUpdateCartItemOperation {
|
|
data: {
|
|
cart: {
|
|
updateCartLineItem: {
|
|
cart: BigCommerceCart
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
updateCartLineItemInput: {
|
|
cartEntityId: string
|
|
lineItemEntityId: string
|
|
data: {
|
|
lineItem: CartItem
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceCheckoutOperation {
|
|
data: {
|
|
site: {
|
|
checkout: BigCommerceCheckout
|
|
}
|
|
}
|
|
variables: {
|
|
entityId: string
|
|
}
|
|
}
|
|
|
|
interface BigCommerceProductOperation {
|
|
data: {
|
|
site: {
|
|
product: BigCommerceProduct
|
|
}
|
|
}
|
|
variables: {
|
|
productId: number
|
|
}
|
|
}
|
|
|
|
interface BigCommerceProductByHandleOperation {
|
|
data: {
|
|
site: {
|
|
route: {
|
|
node: BigCommerceProduct
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
path: string
|
|
}
|
|
}
|
|
|
|
interface BigCommerceProductsOperation {
|
|
data: {
|
|
site: {
|
|
products: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
variables: {
|
|
entityIds: number[] | []
|
|
}
|
|
}
|
|
|
|
interface BigCommerceEntityIdOperation {
|
|
data: {
|
|
site: {
|
|
route: {
|
|
node: {
|
|
__typename:
|
|
| "Product"
|
|
| "Category"
|
|
| "Brand"
|
|
| "NormalPage"
|
|
| "ContactPage"
|
|
| "RawHtmlPage"
|
|
| "BlogIndexPage"
|
|
entityId: number
|
|
}
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
path: string
|
|
}
|
|
}
|
|
|
|
interface WishlistProduct {
|
|
addToWishlistUrl: string
|
|
}
|
|
|
|
interface WishlistItem {
|
|
product: WishlistProduct
|
|
}
|
|
|
|
interface Wishlist {
|
|
items: {
|
|
edges: { node: WishlistItem }[]
|
|
}
|
|
}
|
|
|
|
interface Customer {
|
|
addressCount: number
|
|
phone: string
|
|
email: string
|
|
entityId: number
|
|
firstName: string
|
|
lastName: string
|
|
wishlists: {
|
|
edges: { node: Wishlist }[]
|
|
}
|
|
}
|
|
|
|
interface BigCommerceWishlistQueryOperation {
|
|
data: { customer: { wishlists: { edges: { node: Wishlist }[] } } }
|
|
variables: { customerEntityId: number }
|
|
}
|
|
|
|
interface BigCommerceCustomerQueryOperation {
|
|
data: { customer: Customer }
|
|
variables: { customerEntityId: number }
|
|
}
|
|
|
|
interface BigCommerceRecommendationsOperation {
|
|
data: {
|
|
site: {
|
|
product: {
|
|
relatedProducts: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
productId: number | string
|
|
}
|
|
}
|
|
|
|
interface BigCommerceSearchProductsOperation {
|
|
data: {
|
|
site: {
|
|
search: {
|
|
searchProducts: {
|
|
products: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
filters: {
|
|
searchTerm: string
|
|
}
|
|
sort: string | null
|
|
}
|
|
}
|
|
|
|
interface BigCommerceMenuOperation {
|
|
data: {
|
|
site: {
|
|
categoryTree: BigCommerceCategoryTreeItem[]
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceCategoryOperation {
|
|
data: {
|
|
site: {
|
|
categoryTree: BigCommerceCategory[]
|
|
}
|
|
}
|
|
variables: {
|
|
entityId: number
|
|
}
|
|
}
|
|
|
|
interface BigCommerceProductsCategoryOperation {
|
|
data: {
|
|
site: {
|
|
category: {
|
|
products: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
entityId: number
|
|
hideOutOfStock: boolean
|
|
sortBy: string
|
|
first: number
|
|
}
|
|
}
|
|
|
|
interface BigCommerceNewestProductsOperation {
|
|
data: {
|
|
site: {
|
|
newestProducts: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
variables: {
|
|
first: number
|
|
}
|
|
}
|
|
|
|
interface BigCommerceFeaturedProductsOperation {
|
|
data: {
|
|
site: {
|
|
featuredProducts: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
variables: {
|
|
first?: number
|
|
}
|
|
}
|
|
|
|
interface BigCommercePopularProductsOperation {
|
|
data: {
|
|
site: {
|
|
bestSellingProducts: Connection<BigCommerceProduct>
|
|
}
|
|
}
|
|
variables: {
|
|
first: number
|
|
}
|
|
}
|
|
|
|
interface Category {
|
|
name: string
|
|
path: string
|
|
entityId: number
|
|
description: string
|
|
children: Category[]
|
|
}
|
|
|
|
interface BigCommerceCategoryOperation {
|
|
data: {
|
|
site: {
|
|
categoryTree: Category[]
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommercePageOperation {
|
|
data: {
|
|
site: {
|
|
content: {
|
|
page: BigCommercePage
|
|
}
|
|
}
|
|
}
|
|
variables: { entityId: number }
|
|
}
|
|
|
|
interface BigCommercePagesOperation {
|
|
data: {
|
|
site: {
|
|
content: {
|
|
pages: Connection<BigCommercePage>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
interface BigCommerceCheckout {
|
|
subtotal: BigCommerceMoney
|
|
grandTotal: BigCommerceMoney
|
|
taxTotal: BigCommerceMoney
|
|
}
|
|
|
|
interface BigCommerceSEO {
|
|
pageTitle: string
|
|
metaDescription: string
|
|
metaKeywords: string
|
|
}
|
|
|
|
interface BigCommerceCategory {
|
|
entityId: number
|
|
name: string
|
|
path: string
|
|
description: string
|
|
seo: BigCommerceSEO
|
|
children: BigCommerceCategory[]
|
|
}
|
|
|
|
interface BigCommerceCart {
|
|
entityId: string
|
|
currencyCode: string
|
|
isTaxIncluded: boolean
|
|
baseAmount: BigCommerceMoney
|
|
discountedAmount: BigCommerceMoney
|
|
amount: BigCommerceMoney
|
|
discounts: CartDiscount[]
|
|
lineItems: CartLineItems
|
|
createdAt: { utc: Date }
|
|
updatedAt: { utc: Date }
|
|
locale: string
|
|
}
|
|
|
|
interface CartLineItems {
|
|
physicalItems: PhysicalItem[]
|
|
digitalItems: PhysicalItem[]
|
|
customItems: CartCustomItem[]
|
|
giftCertificates: CartGiftCertificate[]
|
|
totalQuantity: number
|
|
}
|
|
|
|
interface CartItem {
|
|
quantity: number
|
|
productEntityId: number
|
|
variantEntityId?: number
|
|
}
|
|
|
|
interface BigCommerceCategoryTreeItem {
|
|
name: string
|
|
path: string
|
|
hasChildren: boolean
|
|
entityId: number
|
|
children?: BigCommerceCategoryTreeItem[]
|
|
}
|
|
|
|
interface BigCommercePage {
|
|
__typename: "NormalPage" | "ContactPage" | "RawHtmlPage" | "BlogIndexPage"
|
|
entityId: number
|
|
name: string
|
|
isVisibleInNavigation: boolean
|
|
seo: BigCommerceSEO
|
|
path: string
|
|
plainTextSummary?: string
|
|
htmlBody?: string
|
|
}
|
|
|
|
interface BigCommerceMoney {
|
|
value: number
|
|
currencyCode: string
|
|
}
|
|
|
|
interface CartDiscount {
|
|
entityId: string
|
|
discountedAmount: BigCommerceMoney
|
|
}
|
|
|
|
interface CartGiftCertificatePersonDetails {
|
|
name: string
|
|
email: string
|
|
}
|
|
|
|
interface PhysicalItem {
|
|
entityId: number
|
|
parentEntityId: number | null
|
|
productEntityId: number
|
|
variantEntityId: number | null
|
|
sku: string
|
|
name: string
|
|
url: string
|
|
imageUrl: string | null
|
|
brand: string | null
|
|
quantity: number
|
|
isTaxable: boolean
|
|
listPrice: BigCommerceMoney
|
|
extendedListPrice: BigCommerceMoney
|
|
selectedOptions: {
|
|
entityId: number
|
|
name: string
|
|
value?: string
|
|
date?: { utc: Date }
|
|
text?: string
|
|
number?: string
|
|
fileName?: ScrollSetting
|
|
}[]
|
|
isShippingRequired: boolean
|
|
}
|
|
|
|
interface CartCustomItem {
|
|
entityId: string
|
|
productEntityId: undefined
|
|
sku: string
|
|
name: string
|
|
quantity: number
|
|
listPrice: BigCommerceMoney
|
|
extendedListPrice: BigCommerceMoney
|
|
}
|
|
|
|
interface CartGiftCertificate {
|
|
entityId: number
|
|
productEntityId: undefined
|
|
name: string
|
|
amount: BigCommerceMoney
|
|
isTaxable: boolean
|
|
message: string
|
|
sender: CartGiftCertificatePersonDetails
|
|
recipient: CartGiftCertificatePersonDetails
|
|
}
|
|
|
|
interface BigCommerceProductVariant {
|
|
id: number
|
|
entityId: number
|
|
sku: string
|
|
upc: string | null
|
|
isPurchasable: boolean
|
|
defaultImage: {
|
|
url: string
|
|
altText: string
|
|
}
|
|
prices: {
|
|
price: BigCommerceMoney
|
|
priceRange: {
|
|
min: BigCommerceMoney
|
|
max: BigCommerceMoney
|
|
}
|
|
}
|
|
options: {
|
|
edges: Array<{
|
|
node: {
|
|
entityId: number
|
|
displayName: string
|
|
values: {
|
|
edges: Array<{
|
|
node: {
|
|
entityId: number
|
|
label: string
|
|
}
|
|
}>
|
|
}
|
|
}
|
|
}>
|
|
}
|
|
}
|
|
|
|
interface BigCommerceProductOption {
|
|
__typename: string
|
|
entityId: number
|
|
displayName: string
|
|
isRequired: boolean
|
|
displayStyle: string
|
|
values: {
|
|
edges: Array<{
|
|
node: {
|
|
entityId: number
|
|
label: string
|
|
isDefault: boolean
|
|
hexColors: string[]
|
|
imageUrl: string | null
|
|
isSelected: boolean
|
|
}
|
|
}>
|
|
}
|
|
}
|
|
|
|
interface BigCommerceProduct {
|
|
id: number
|
|
entityId: number
|
|
sku: string
|
|
categories: {
|
|
edges: {
|
|
node: {
|
|
name: string
|
|
description: string
|
|
path: string
|
|
entityId: number
|
|
}
|
|
}[]
|
|
}
|
|
upc: string | null
|
|
|
|
name: string
|
|
brand: {
|
|
name: string
|
|
} | null
|
|
plainTextDescription: string
|
|
description: string
|
|
availabilityV2: {
|
|
status: "Available" | "Unavailable" | "Preorder"
|
|
description: string
|
|
}
|
|
defaultImage: {
|
|
url: string
|
|
altText: string
|
|
}
|
|
images: {
|
|
edges: Array<{
|
|
node: {
|
|
url: string
|
|
altText: string
|
|
}
|
|
}>
|
|
}
|
|
reviews: {
|
|
edges: Array<{
|
|
node: {
|
|
rating: number
|
|
}
|
|
}>
|
|
}
|
|
seo: BigCommerceSEO
|
|
path: string
|
|
prices: {
|
|
price: BigCommerceMoney
|
|
salePrice: BigCommerceMoney | null
|
|
retailPrice: BigCommerceMoney | null
|
|
priceRange: {
|
|
min: BigCommerceMoney
|
|
max: BigCommerceMoney
|
|
}
|
|
}
|
|
createdAt: {
|
|
utc: Date
|
|
}
|
|
variants: Connection<BigCommerceProductVariant>
|
|
productOptions: Connection<BigCommerceProductOption>
|
|
}
|
|
interface BigCommerceCustomer {
|
|
id: number
|
|
company: string
|
|
first_name: string
|
|
last_name: string
|
|
email: string
|
|
phone: string
|
|
store_credit: string
|
|
registration_ip_address: string
|
|
customer_group_id: number
|
|
notes: string
|
|
tax_exempt_category: string
|
|
authentication?: {
|
|
force_password_reset: boolean
|
|
new_password: string
|
|
}
|
|
form_fields: (
|
|
| {
|
|
name: "birthday"
|
|
value: Date | string
|
|
customer_id?: number
|
|
}
|
|
| {
|
|
name: "gender"
|
|
value: "male" | "female"
|
|
customer_id?: number
|
|
}
|
|
| {
|
|
name: "username"
|
|
value: string
|
|
customer_id?: number
|
|
}
|
|
)[]
|
|
addresses: {
|
|
url: string
|
|
resource: string
|
|
}
|
|
}
|
|
|
|
type BigCommerceError = {
|
|
__typename: "EmailAlreadyInUseError"
|
|
message: string
|
|
}
|
|
|
|
interface BigCommerceRegisterCustomerOperation {
|
|
data: {
|
|
customer: {
|
|
registerCustomer: {
|
|
customer: BigCommerceCustomer
|
|
errors?: BigCommerceError[]
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
registerCustomerInput: RegisterCustomerInput
|
|
}
|
|
}
|
|
|
|
interface AddWishlistItemsInput {
|
|
entityId: number
|
|
items: {
|
|
productEntityId: number
|
|
}[]
|
|
}
|
|
|
|
interface CreateWishlistInput {
|
|
name: string
|
|
isPublic: boolean
|
|
}
|
|
|
|
interface DeleteWishlistItemsInput {
|
|
entityId: number
|
|
itemEntityIds: number[]
|
|
}
|
|
|
|
interface DeleteWishlistsInput {
|
|
entityIds: number[]
|
|
}
|
|
|
|
interface UpdateWishlistInput {
|
|
entityId: number
|
|
data: {
|
|
name: string
|
|
}
|
|
}
|
|
|
|
interface BigCommerceWishlist {
|
|
entityId: number
|
|
name: string
|
|
items: {
|
|
edges: {
|
|
node: {
|
|
product: BigCommerceProduct
|
|
}
|
|
}[]
|
|
}
|
|
}
|
|
|
|
interface BigCommerceAddWishlistItemsOperation {
|
|
data: {
|
|
wishlist: {
|
|
addWishlistItems: {
|
|
result: BigCommerceWishlist
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
addWishlistItemsInput: AddWishlistItemsInput
|
|
}
|
|
}
|
|
|
|
interface BigCommerceCreateWishlistOperation {
|
|
data: {
|
|
wishlist: {
|
|
createWishlist: {
|
|
result: {
|
|
entityId: number
|
|
name: string
|
|
}
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
createWishlistInput: CreateWishlistInput
|
|
}
|
|
}
|
|
|
|
interface BigCommerceDeleteWishlistItemsOperation {
|
|
data: {
|
|
wishlist: {
|
|
deleteWishlistItems: {
|
|
result: BigCommerceWishlist
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
deleteWishlistItemsInput: DeleteWishlistItemsInput
|
|
}
|
|
}
|
|
|
|
interface BigCommerceDeleteWishlistsOperation {
|
|
data: {
|
|
wishlist: {
|
|
deleteWishlists: {
|
|
result: boolean
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
deleteWishlistsInput: DeleteWishlistsInput
|
|
}
|
|
}
|
|
|
|
interface BigCommerceUpdateWishlistOperation {
|
|
data: {
|
|
wishlist: {
|
|
updateWishlist: {
|
|
result: BigCommerceWishlist
|
|
}
|
|
}
|
|
}
|
|
variables: {
|
|
updateWishlistInput: UpdateWishlistInput
|
|
}
|
|
}
|