forked from crowetic/commerce
parent
a98c95d447
commit
0e804d09f9
@ -1 +1,4 @@
|
|||||||
|
COMMERCE_PROVIDER=vendure
|
||||||
|
|
||||||
NEXT_PUBLIC_VENDURE_SHOP_API_URL=http://localhost:3001/shop-api
|
NEXT_PUBLIC_VENDURE_SHOP_API_URL=http://localhost:3001/shop-api
|
||||||
|
NEXT_PUBLIC_VENDURE_LOCAL_URL=/vendure-shop-api
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
@ -1 +0,0 @@
|
|||||||
export default function () {}
|
|
1
framework/vendure/api/endpoints/cart/index.ts
Normal file
1
framework/vendure/api/endpoints/cart/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
1
framework/vendure/api/endpoints/catalog/index.ts
Normal file
1
framework/vendure/api/endpoints/catalog/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
1
framework/vendure/api/endpoints/catalog/products.ts
Normal file
1
framework/vendure/api/endpoints/catalog/products.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
@ -1,6 +1,13 @@
|
|||||||
import { NextApiHandler } from 'next'
|
import { NextApiHandler } from 'next'
|
||||||
|
import { CommerceAPI, createEndpoint, GetAPISchema } from '@commerce/api'
|
||||||
|
import { CheckoutSchema } from '@commerce/types/checkout'
|
||||||
|
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||||
|
|
||||||
const checkoutApi = async (req: any, res: any, config: any) => {
|
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
config,
|
||||||
|
}) => {
|
||||||
try {
|
try {
|
||||||
const html = `
|
const html = `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -37,27 +44,15 @@ const checkoutApi = async (req: any, res: any, config: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createApiHandler<T = any, H = {}, Options extends {} = {}>(
|
export type CheckoutAPI = GetAPISchema<CommerceAPI, CheckoutSchema>
|
||||||
handler: any,
|
|
||||||
handlers: H,
|
|
||||||
defaultOptions: Options
|
|
||||||
) {
|
|
||||||
return function getApiHandler({
|
|
||||||
config,
|
|
||||||
operations,
|
|
||||||
options,
|
|
||||||
}: {
|
|
||||||
config?: any
|
|
||||||
operations?: Partial<H>
|
|
||||||
options?: Options extends {} ? Partial<Options> : never
|
|
||||||
} = {}): NextApiHandler {
|
|
||||||
const ops = { ...operations, ...handlers }
|
|
||||||
const opts = { ...defaultOptions, ...options }
|
|
||||||
|
|
||||||
return function apiHandler(req, res) {
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
||||||
return handler(req, res, config, ops, opts)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default createApiHandler(checkoutApi, {}, {})
|
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
||||||
|
|
||||||
|
const checkoutApi = createEndpoint<CheckoutAPI>({
|
||||||
|
handler: checkoutEndpoint,
|
||||||
|
handlers,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default checkoutApi
|
1
framework/vendure/api/endpoints/customer/index.ts
Normal file
1
framework/vendure/api/endpoints/customer/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
1
framework/vendure/api/endpoints/login/index.ts
Normal file
1
framework/vendure/api/endpoints/login/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
1
framework/vendure/api/endpoints/logout/index.ts
Normal file
1
framework/vendure/api/endpoints/logout/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
1
framework/vendure/api/endpoints/signup/index.ts
Normal file
1
framework/vendure/api/endpoints/signup/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
1
framework/vendure/api/endpoints/wishlist/index.tsx
Normal file
1
framework/vendure/api/endpoints/wishlist/index.tsx
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default function noopApi(...args: any[]): void {}
|
@ -1,6 +1,16 @@
|
|||||||
import type { CommerceAPIConfig } from '@commerce/api'
|
import type { APIProvider, CommerceAPIConfig } from '@commerce/api'
|
||||||
|
import { CommerceAPI, getCommerceApi as commerceApi } from '@commerce/api'
|
||||||
import fetchGraphqlApi from './utils/fetch-graphql-api'
|
import fetchGraphqlApi from './utils/fetch-graphql-api'
|
||||||
|
|
||||||
|
import login from './operations/login'
|
||||||
|
import getAllPages from './operations/get-all-pages'
|
||||||
|
import getPage from './operations/get-page'
|
||||||
|
import getSiteInfo from './operations/get-site-info'
|
||||||
|
import getCustomerWishlist from './operations/get-customer-wishlist'
|
||||||
|
import getAllProductPaths from './operations/get-all-product-paths'
|
||||||
|
import getAllProducts from './operations/get-all-products'
|
||||||
|
import getProduct from './operations/get-product'
|
||||||
|
|
||||||
export interface VendureConfig extends CommerceAPIConfig {}
|
export interface VendureConfig extends CommerceAPIConfig {}
|
||||||
|
|
||||||
const API_URL = process.env.NEXT_PUBLIC_VENDURE_SHOP_API_URL
|
const API_URL = process.env.NEXT_PUBLIC_VENDURE_SHOP_API_URL
|
||||||
@ -11,41 +21,33 @@ if (!API_URL) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Config {
|
|
||||||
private config: VendureConfig
|
|
||||||
|
|
||||||
constructor(config: VendureConfig) {
|
|
||||||
this.config = {
|
|
||||||
...config,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getConfig(userConfig: Partial<VendureConfig> = {}) {
|
|
||||||
return Object.entries(userConfig).reduce<VendureConfig>(
|
|
||||||
(cfg, [key, value]) => Object.assign(cfg, { [key]: value }),
|
|
||||||
{ ...this.config }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
setConfig(newConfig: Partial<VendureConfig>) {
|
|
||||||
Object.assign(this.config, newConfig)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ONE_DAY = 60 * 60 * 24
|
const ONE_DAY = 60 * 60 * 24
|
||||||
const config = new Config({
|
const config: VendureConfig = {
|
||||||
commerceUrl: API_URL,
|
commerceUrl: API_URL,
|
||||||
apiToken: '',
|
apiToken: '',
|
||||||
cartCookie: '',
|
cartCookie: '',
|
||||||
customerCookie: '',
|
customerCookie: '',
|
||||||
cartCookieMaxAge: ONE_DAY * 30,
|
cartCookieMaxAge: ONE_DAY * 30,
|
||||||
fetch: fetchGraphqlApi,
|
fetch: fetchGraphqlApi,
|
||||||
})
|
|
||||||
|
|
||||||
export function getConfig(userConfig?: Partial<VendureConfig>) {
|
|
||||||
return config.getConfig(userConfig)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setConfig(newConfig: Partial<VendureConfig>) {
|
const operations = {
|
||||||
return config.setConfig(newConfig)
|
login,
|
||||||
|
getAllPages,
|
||||||
|
getPage,
|
||||||
|
getSiteInfo,
|
||||||
|
getCustomerWishlist,
|
||||||
|
getAllProductPaths,
|
||||||
|
getAllProducts,
|
||||||
|
getProduct,
|
||||||
|
}
|
||||||
|
|
||||||
|
export const provider = { config, operations }
|
||||||
|
|
||||||
|
export type Provider = typeof provider
|
||||||
|
|
||||||
|
export function getCommerceApi<P extends Provider>(
|
||||||
|
customProvider: P = provider as any
|
||||||
|
): CommerceAPI<P> {
|
||||||
|
return commerceApi(customProvider)
|
||||||
}
|
}
|
||||||
|
41
framework/vendure/api/operations/get-all-pages.ts
Normal file
41
framework/vendure/api/operations/get-all-pages.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import { VendureConfig } from '../'
|
||||||
|
import { OperationContext } from '@commerce/api/operations'
|
||||||
|
import { Provider } from '../../../bigcommerce/api'
|
||||||
|
|
||||||
|
export type Page = any
|
||||||
|
|
||||||
|
export type GetAllPagesResult<
|
||||||
|
T extends { pages: any[] } = { pages: Page[] }
|
||||||
|
> = T
|
||||||
|
|
||||||
|
export default function getAllPagesOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getAllPages(opts?: {
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<GetAllPagesResult>
|
||||||
|
|
||||||
|
async function getAllPages<T extends { pages: any[] }>(opts: {
|
||||||
|
url: string
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<GetAllPagesResult<T>>
|
||||||
|
|
||||||
|
async function getAllPages({
|
||||||
|
config: cfg,
|
||||||
|
preview,
|
||||||
|
}: {
|
||||||
|
url?: string
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
} = {}): Promise<GetAllPagesResult> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
|
||||||
|
return {
|
||||||
|
pages: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAllPages
|
||||||
|
}
|
52
framework/vendure/api/operations/get-all-product-paths.ts
Normal file
52
framework/vendure/api/operations/get-all-product-paths.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import { OperationContext, OperationOptions } from '@commerce/api/operations'
|
||||||
|
import type { GetAllProductPathsQuery } from '../../schema'
|
||||||
|
import { Provider } from '../index'
|
||||||
|
import { getAllProductPathsQuery } from '../../utils/queries/get-all-product-paths-query'
|
||||||
|
import { GetAllProductPathsOperation } from '@commerce/types/product'
|
||||||
|
import { BigcommerceConfig } from '../../../bigcommerce/api'
|
||||||
|
|
||||||
|
export type GetAllProductPathsResult = {
|
||||||
|
products: Array<{ node: { path: string } }>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function getAllProductPathsOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getAllProductPaths<
|
||||||
|
T extends GetAllProductPathsOperation
|
||||||
|
>(opts?: {
|
||||||
|
variables?: T['variables']
|
||||||
|
config?: BigcommerceConfig
|
||||||
|
}): Promise<T['data']>
|
||||||
|
|
||||||
|
async function getAllProductPaths<T extends GetAllProductPathsOperation>(
|
||||||
|
opts: {
|
||||||
|
variables?: T['variables']
|
||||||
|
config?: BigcommerceConfig
|
||||||
|
} & OperationOptions
|
||||||
|
): Promise<T['data']>
|
||||||
|
|
||||||
|
async function getAllProductPaths<T extends GetAllProductPathsOperation>({
|
||||||
|
query = getAllProductPathsQuery,
|
||||||
|
variables,
|
||||||
|
config: cfg,
|
||||||
|
}: {
|
||||||
|
query?: string
|
||||||
|
variables?: T['variables']
|
||||||
|
config?: BigcommerceConfig
|
||||||
|
} = {}): Promise<T['data']> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
// RecursivePartial forces the method to check for every prop in the data, which is
|
||||||
|
// required in case there's a custom `query`
|
||||||
|
const { data } = await config.fetch<GetAllProductPathsQuery>(query, {
|
||||||
|
variables,
|
||||||
|
})
|
||||||
|
const products = data.products.items
|
||||||
|
|
||||||
|
return {
|
||||||
|
products: products.map((p) => ({ path: `/${p.slug}` })),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAllProductPaths
|
||||||
|
}
|
46
framework/vendure/api/operations/get-all-products.ts
Normal file
46
framework/vendure/api/operations/get-all-products.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { Product } from '@commerce/types/product'
|
||||||
|
import { Provider, VendureConfig } from '../'
|
||||||
|
import { GetAllProductsQuery } from '../../schema'
|
||||||
|
import { normalizeSearchResult } from '../../utils/normalize'
|
||||||
|
import { getAllProductsQuery } from '../../utils/queries/get-all-products-query'
|
||||||
|
import { OperationContext } from '@commerce/api/operations'
|
||||||
|
|
||||||
|
export type ProductVariables = { first?: number }
|
||||||
|
|
||||||
|
export default function getAllProductsOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getAllProducts(opts?: {
|
||||||
|
variables?: ProductVariables
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<{ products: Product[] }>
|
||||||
|
|
||||||
|
async function getAllProducts({
|
||||||
|
query = getAllProductsQuery,
|
||||||
|
variables: { ...vars } = {},
|
||||||
|
config: cfg,
|
||||||
|
}: {
|
||||||
|
query?: string
|
||||||
|
variables?: ProductVariables
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
} = {}): Promise<{ products: Product[] | any[] }> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
const variables = {
|
||||||
|
input: {
|
||||||
|
take: vars.first,
|
||||||
|
groupByProduct: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const { data } = await config.fetch<GetAllProductsQuery>(query, {
|
||||||
|
variables,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
products: data.search.items.map((item) => normalizeSearchResult(item)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAllProducts
|
||||||
|
}
|
23
framework/vendure/api/operations/get-customer-wishlist.ts
Normal file
23
framework/vendure/api/operations/get-customer-wishlist.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { OperationContext } from '@commerce/api/operations'
|
||||||
|
import { Provider, VendureConfig } from '../'
|
||||||
|
|
||||||
|
export default function getCustomerWishlistOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getCustomerWishlist({
|
||||||
|
config: cfg,
|
||||||
|
variables,
|
||||||
|
includeProducts,
|
||||||
|
}: {
|
||||||
|
url?: string
|
||||||
|
variables: any
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
includeProducts?: boolean
|
||||||
|
}): Promise<any> {
|
||||||
|
// Not implemented as Vendure does not ship with wishlist functionality at present
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
return { wishlist: {} }
|
||||||
|
}
|
||||||
|
|
||||||
|
return getCustomerWishlist
|
||||||
|
}
|
45
framework/vendure/api/operations/get-page.ts
Normal file
45
framework/vendure/api/operations/get-page.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { VendureConfig, Provider } from '../'
|
||||||
|
import { OperationContext } from '@commerce/api/operations'
|
||||||
|
|
||||||
|
export type Page = any
|
||||||
|
|
||||||
|
export type GetPageResult<T extends { page?: any } = { page?: Page }> = T
|
||||||
|
|
||||||
|
export type PageVariables = {
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function getPageOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getPage(opts: {
|
||||||
|
url?: string
|
||||||
|
variables: PageVariables
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<GetPageResult>
|
||||||
|
|
||||||
|
async function getPage<T extends { page?: any }, V = any>(opts: {
|
||||||
|
url: string
|
||||||
|
variables: V
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<GetPageResult<T>>
|
||||||
|
|
||||||
|
async function getPage({
|
||||||
|
url,
|
||||||
|
variables,
|
||||||
|
config: cfg,
|
||||||
|
preview,
|
||||||
|
}: {
|
||||||
|
url?: string
|
||||||
|
variables: PageVariables
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<GetPageResult> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getPage
|
||||||
|
}
|
69
framework/vendure/api/operations/get-product.ts
Normal file
69
framework/vendure/api/operations/get-product.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { Product } from '@commerce/types/product'
|
||||||
|
import { OperationContext } from '@commerce/api/operations'
|
||||||
|
import { Provider, VendureConfig } from '../'
|
||||||
|
import { GetProductQuery } from '../../schema'
|
||||||
|
import { getProductQuery } from '../../utils/queries/get-product-query'
|
||||||
|
|
||||||
|
export default function getProductOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getProduct({
|
||||||
|
query = getProductQuery,
|
||||||
|
variables,
|
||||||
|
config: cfg,
|
||||||
|
}: {
|
||||||
|
query?: string
|
||||||
|
variables: { slug: string }
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<Product | {} | any> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
|
||||||
|
const locale = config.locale
|
||||||
|
const { data } = await config.fetch<GetProductQuery>(query, { variables })
|
||||||
|
const product = data.product
|
||||||
|
|
||||||
|
if (product) {
|
||||||
|
const getOptionGroupName = (id: string): string => {
|
||||||
|
return product.optionGroups.find((og) => og.id === id)!.name
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
product: {
|
||||||
|
id: product.id,
|
||||||
|
name: product.name,
|
||||||
|
description: product.description,
|
||||||
|
slug: product.slug,
|
||||||
|
images: product.assets.map((a) => ({
|
||||||
|
url: a.preview,
|
||||||
|
alt: a.name,
|
||||||
|
})),
|
||||||
|
variants: product.variants.map((v) => ({
|
||||||
|
id: v.id,
|
||||||
|
options: v.options.map((o) => ({
|
||||||
|
// This __typename property is required in order for the correct
|
||||||
|
// variant selection to work, see `components/product/helpers.ts`
|
||||||
|
// `getVariant()` function.
|
||||||
|
__typename: 'MultipleChoiceOption',
|
||||||
|
id: o.id,
|
||||||
|
displayName: getOptionGroupName(o.groupId),
|
||||||
|
values: [{ label: o.name }],
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
price: {
|
||||||
|
value: product.variants[0].priceWithTax / 100,
|
||||||
|
currencyCode: product.variants[0].currencyCode,
|
||||||
|
},
|
||||||
|
options: product.optionGroups.map((og) => ({
|
||||||
|
id: og.id,
|
||||||
|
displayName: og.name,
|
||||||
|
values: og.options.map((o) => ({ label: o.name })),
|
||||||
|
})),
|
||||||
|
} as Product,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getProduct
|
||||||
|
}
|
50
framework/vendure/api/operations/get-site-info.ts
Normal file
50
framework/vendure/api/operations/get-site-info.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import { Provider, VendureConfig } from '../'
|
||||||
|
import { GetCollectionsQuery } from '../../schema'
|
||||||
|
import { arrayToTree } from '../../utils/array-to-tree'
|
||||||
|
import { getCollectionsQuery } from '../../utils/queries/get-collections-query'
|
||||||
|
import { OperationContext } from '@commerce/api/operations'
|
||||||
|
import { Category } from '@commerce/types/site'
|
||||||
|
|
||||||
|
export type GetSiteInfoResult<
|
||||||
|
T extends { categories: any[]; brands: any[] } = {
|
||||||
|
categories: Category[]
|
||||||
|
brands: any[]
|
||||||
|
}
|
||||||
|
> = T
|
||||||
|
|
||||||
|
export default function getSiteInfoOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getSiteInfo({
|
||||||
|
query = getCollectionsQuery,
|
||||||
|
variables,
|
||||||
|
config: cfg,
|
||||||
|
}: {
|
||||||
|
query?: string
|
||||||
|
variables?: any
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
preview?: boolean
|
||||||
|
} = {}): Promise<GetSiteInfoResult> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
// RecursivePartial forces the method to check for every prop in the data, which is
|
||||||
|
// required in case there's a custom `query`
|
||||||
|
const { data } = await config.fetch<GetCollectionsQuery>(query, {
|
||||||
|
variables,
|
||||||
|
})
|
||||||
|
const collections = data.collections?.items.map((i) => ({
|
||||||
|
...i,
|
||||||
|
entityId: i.id,
|
||||||
|
path: i.slug,
|
||||||
|
productCount: i.productVariants.totalItems,
|
||||||
|
}))
|
||||||
|
const categories = arrayToTree(collections).children
|
||||||
|
const brands = [] as any[]
|
||||||
|
|
||||||
|
return {
|
||||||
|
categories: categories ?? [],
|
||||||
|
brands,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getSiteInfo
|
||||||
|
}
|
60
framework/vendure/api/operations/login.ts
Normal file
60
framework/vendure/api/operations/login.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import type { ServerResponse } from 'http'
|
||||||
|
import type {
|
||||||
|
OperationContext,
|
||||||
|
OperationOptions,
|
||||||
|
} from '@commerce/api/operations'
|
||||||
|
import { ValidationError } from '@commerce/utils/errors'
|
||||||
|
import type { LoginOperation } from '../../types/login'
|
||||||
|
import type { LoginMutation } from '../../schema'
|
||||||
|
import { Provider, VendureConfig } from '..'
|
||||||
|
import { loginMutation } from '../../utils/mutations/log-in-mutation'
|
||||||
|
|
||||||
|
export default function loginOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function login<T extends LoginOperation>(opts: {
|
||||||
|
variables: T['variables']
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
res: ServerResponse
|
||||||
|
}): Promise<T['data']>
|
||||||
|
|
||||||
|
async function login<T extends LoginOperation>(
|
||||||
|
opts: {
|
||||||
|
variables: T['variables']
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
res: ServerResponse
|
||||||
|
} & OperationOptions
|
||||||
|
): Promise<T['data']>
|
||||||
|
|
||||||
|
async function login<T extends LoginOperation>({
|
||||||
|
query = loginMutation,
|
||||||
|
variables,
|
||||||
|
res: response,
|
||||||
|
config: cfg,
|
||||||
|
}: {
|
||||||
|
query?: string
|
||||||
|
variables: T['variables']
|
||||||
|
res: ServerResponse
|
||||||
|
config?: Partial<VendureConfig>
|
||||||
|
}): Promise<T['data']> {
|
||||||
|
const config = commerce.getConfig(cfg)
|
||||||
|
|
||||||
|
const { data, res } = await config.fetch<LoginMutation>(query, {
|
||||||
|
variables,
|
||||||
|
})
|
||||||
|
switch (data.login.__typename) {
|
||||||
|
case 'NativeAuthStrategyError':
|
||||||
|
case 'InvalidCredentialsError':
|
||||||
|
case 'NotVerifiedError':
|
||||||
|
throw new ValidationError({
|
||||||
|
code: data.login.errorCode,
|
||||||
|
message: data.login.message,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
result: data.login.id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return login
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import { FetcherError } from '@commerce/utils/errors'
|
import { FetcherError } from '@commerce/utils/errors'
|
||||||
import type { GraphQLFetcher } from '@commerce/api'
|
import type { GraphQLFetcher } from '@commerce/api'
|
||||||
import { getConfig } from '..'
|
import { getCommerceApi } from '../'
|
||||||
import fetch from './fetch'
|
import fetch from './fetch'
|
||||||
|
|
||||||
const fetchGraphqlApi: GraphQLFetcher = async (
|
const fetchGraphqlApi: GraphQLFetcher = async (
|
||||||
@ -8,12 +8,11 @@ const fetchGraphqlApi: GraphQLFetcher = async (
|
|||||||
{ variables, preview } = {},
|
{ variables, preview } = {},
|
||||||
fetchOptions
|
fetchOptions
|
||||||
) => {
|
) => {
|
||||||
const config = getConfig()
|
const config = getCommerceApi().getConfig()
|
||||||
const res = await fetch(config.commerceUrl, {
|
const res = await fetch(config.commerceUrl, {
|
||||||
...fetchOptions,
|
...fetchOptions,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${config.apiToken}`,
|
|
||||||
...fetchOptions?.headers,
|
...fetchOptions?.headers,
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
export type WishlistItem = { product: any; id: number }
|
|
||||||
export default function () {}
|
|
3
framework/vendure/auth/index.ts
Normal file
3
framework/vendure/auth/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export { default as useLogin } from './use-login'
|
||||||
|
export { default as useLogout } from './use-logout'
|
||||||
|
export { default as useSignup } from './use-signup'
|
@ -1,14 +1,15 @@
|
|||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { MutationHook } from '@commerce/utils/types'
|
import { MutationHook } from '@commerce/utils/types'
|
||||||
import useLogin, { UseLogin } from '@commerce/auth/use-login'
|
import useLogin, { UseLogin } from '@commerce/auth/use-login'
|
||||||
|
import { LoginHook } from '../types/login'
|
||||||
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
||||||
import useCustomer from '../customer/use-customer'
|
import useCustomer from '../customer/use-customer'
|
||||||
import { LoginMutation, LoginMutationVariables } from '../schema'
|
import { LoginMutation, LoginMutationVariables } from '../schema'
|
||||||
import { loginMutation } from '../lib/mutations/log-in-mutation'
|
import { loginMutation } from '../utils/mutations/log-in-mutation'
|
||||||
|
|
||||||
export default useLogin as UseLogin<typeof handler>
|
export default useLogin as UseLogin<typeof handler>
|
||||||
|
|
||||||
export const handler: MutationHook<null, {}, any> = {
|
export const handler: MutationHook<LoginHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: loginMutation,
|
query: loginMutation,
|
||||||
},
|
},
|
||||||
|
@ -3,11 +3,12 @@ import { MutationHook } from '@commerce/utils/types'
|
|||||||
import useLogout, { UseLogout } from '@commerce/auth/use-logout'
|
import useLogout, { UseLogout } from '@commerce/auth/use-logout'
|
||||||
import useCustomer from '../customer/use-customer'
|
import useCustomer from '../customer/use-customer'
|
||||||
import { LogoutMutation } from '../schema'
|
import { LogoutMutation } from '../schema'
|
||||||
import { logoutMutation } from '../lib/mutations/log-out-mutation'
|
import { logoutMutation } from '../utils/mutations/log-out-mutation'
|
||||||
|
import { LogoutHook } from '../types/logout'
|
||||||
|
|
||||||
export default useLogout as UseLogout<typeof handler>
|
export default useLogout as UseLogout<typeof handler>
|
||||||
|
|
||||||
export const handler: MutationHook<null> = {
|
export const handler: MutationHook<LogoutHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: logoutMutation,
|
query: logoutMutation,
|
||||||
},
|
},
|
||||||
|
@ -8,7 +8,8 @@ import {
|
|||||||
SignupMutation,
|
SignupMutation,
|
||||||
SignupMutationVariables,
|
SignupMutationVariables,
|
||||||
} from '../schema'
|
} from '../schema'
|
||||||
import { signupMutation } from '../lib/mutations/sign-up-mutation'
|
import { signupMutation } from '../utils/mutations/sign-up-mutation'
|
||||||
|
import { SignupHook } from '../types/signup'
|
||||||
|
|
||||||
export default useSignup as UseSignup<typeof handler>
|
export default useSignup as UseSignup<typeof handler>
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ export type SignupInput = {
|
|||||||
password: string
|
password: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handler: MutationHook<null, {}, SignupInput, SignupInput> = {
|
export const handler: MutationHook<SignupHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: signupMutation,
|
query: signupMutation,
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
export { default as useCart } from './use-cart'
|
export { default as useCart } from './use-cart'
|
||||||
export { default as useAddItem } from './use-add-item'
|
export { default as useAddItem } from './use-add-item'
|
||||||
export { default as useRemoveItem } from './use-remove-item'
|
export { default as useRemoveItem } from './use-remove-item'
|
||||||
export { default as useWishlistActions } from './use-cart-actions'
|
export { default as useUpdateItem } from './use-update-item'
|
||||||
export { default as useUpdateItem } from './use-cart-actions'
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import { Cart, CartItemBody } from '@commerce/types'
|
|
||||||
import useAddItem, { UseAddItem } from '@commerce/cart/use-add-item'
|
import useAddItem, { UseAddItem } from '@commerce/cart/use-add-item'
|
||||||
import { CommerceError } from '@commerce/utils/errors'
|
import { CommerceError } from '@commerce/utils/errors'
|
||||||
import { MutationHook } from '@commerce/utils/types'
|
import { MutationHook } from '@commerce/utils/types'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import useCart from './use-cart'
|
import useCart from './use-cart'
|
||||||
import { AddItemToOrderMutation } from '../schema'
|
import { AddItemToOrderMutation } from '../schema'
|
||||||
import { normalizeCart } from '../lib/normalize'
|
import { normalizeCart } from '../utils/normalize'
|
||||||
import { addItemToOrderMutation } from '../lib/mutations/add-item-to-order-mutation'
|
import { addItemToOrderMutation } from '../utils/mutations/add-item-to-order-mutation'
|
||||||
|
import { AddItemHook } from '../types/cart'
|
||||||
|
|
||||||
export default useAddItem as UseAddItem<typeof handler>
|
export default useAddItem as UseAddItem<typeof handler>
|
||||||
|
|
||||||
export const handler: MutationHook<Cart, {}, CartItemBody> = {
|
export const handler: MutationHook<AddItemHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: addItemToOrderMutation,
|
query: addItemToOrderMutation,
|
||||||
},
|
},
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import useAddItem from './use-add-item'
|
|
||||||
import useRemoveItem from './use-remove-item'
|
|
||||||
import useUpdateItem from './use-update-item'
|
|
||||||
|
|
||||||
// This hook is probably not going to be used, but it's here
|
|
||||||
// to show how a commerce should be structuring it
|
|
||||||
export default function useCartActions() {
|
|
||||||
const addItem = useAddItem()
|
|
||||||
const updateItem = useUpdateItem()
|
|
||||||
const removeItem = useRemoveItem()
|
|
||||||
|
|
||||||
return { addItem, updateItem, removeItem }
|
|
||||||
}
|
|
@ -1,10 +1,10 @@
|
|||||||
import { Cart } from '@commerce/types'
|
|
||||||
import { SWRHook } from '@commerce/utils/types'
|
import { SWRHook } from '@commerce/utils/types'
|
||||||
import useCart, { FetchCartInput, UseCart } from '@commerce/cart/use-cart'
|
import useCart, { UseCart } from '@commerce/cart/use-cart'
|
||||||
import { ActiveOrderQuery, CartFragment } from '../schema'
|
import { ActiveOrderQuery, CartFragment } from '../schema'
|
||||||
import { normalizeCart } from '../lib/normalize'
|
import { normalizeCart } from '../utils/normalize'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import { getCartQuery } from '../lib/queries/get-cart-query'
|
import { getCartQuery } from '../utils/queries/get-cart-query'
|
||||||
|
import { GetCartHook } from '../types/cart'
|
||||||
|
|
||||||
export type CartResult = {
|
export type CartResult = {
|
||||||
activeOrder?: CartFragment
|
activeOrder?: CartFragment
|
||||||
@ -15,12 +15,7 @@ export type CartResult = {
|
|||||||
|
|
||||||
export default useCart as UseCart<typeof handler>
|
export default useCart as UseCart<typeof handler>
|
||||||
|
|
||||||
export const handler: SWRHook<
|
export const handler: SWRHook<GetCartHook> = {
|
||||||
Cart | null,
|
|
||||||
{},
|
|
||||||
FetchCartInput,
|
|
||||||
{ isEmpty?: boolean }
|
|
||||||
> = {
|
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: getCartQuery,
|
query: getCartQuery,
|
||||||
},
|
},
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { HookFetcherContext, MutationHookContext } from '@commerce/utils/types'
|
import {
|
||||||
|
HookFetcherContext,
|
||||||
|
MutationHook,
|
||||||
|
MutationHookContext,
|
||||||
|
SWRHook,
|
||||||
|
} from '@commerce/utils/types'
|
||||||
import useRemoveItem, { UseRemoveItem } from '@commerce/cart/use-remove-item'
|
import useRemoveItem, { UseRemoveItem } from '@commerce/cart/use-remove-item'
|
||||||
import { CommerceError } from '@commerce/utils/errors'
|
import { CommerceError } from '@commerce/utils/errors'
|
||||||
|
import { Cart } from '@commerce/types/cart'
|
||||||
import useCart from './use-cart'
|
import useCart from './use-cart'
|
||||||
import {
|
import {
|
||||||
RemoveOrderLineMutation,
|
RemoveOrderLineMutation,
|
||||||
RemoveOrderLineMutationVariables,
|
RemoveOrderLineMutationVariables,
|
||||||
} from '../schema'
|
} from '../schema'
|
||||||
import { Cart, LineItem, RemoveCartItemBody } from '@commerce/types'
|
import { normalizeCart } from '../utils/normalize'
|
||||||
import { normalizeCart } from '../lib/normalize'
|
import { RemoveItemHook } from '../types/cart'
|
||||||
import { removeOrderLineMutation } from '../lib/mutations/remove-order-line-mutation'
|
import { removeOrderLineMutation } from '../utils/mutations/remove-order-line-mutation'
|
||||||
|
|
||||||
export default useRemoveItem as UseRemoveItem<typeof handler>
|
export default useRemoveItem as UseRemoveItem<typeof handler>
|
||||||
|
|
||||||
export const handler = {
|
export const handler: MutationHook<RemoveItemHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: removeOrderLineMutation,
|
query: removeOrderLineMutation,
|
||||||
},
|
},
|
||||||
async fetcher({ input, options, fetch }: HookFetcherContext<LineItem>) {
|
async fetcher({ input, options, fetch }) {
|
||||||
const variables: RemoveOrderLineMutationVariables = {
|
const variables: RemoveOrderLineMutationVariables = {
|
||||||
orderLineId: input.id,
|
orderLineId: input.itemId,
|
||||||
}
|
}
|
||||||
const { removeOrderLine } = await fetch<RemoveOrderLineMutation>({
|
const { removeOrderLine } = await fetch<RemoveOrderLineMutation>({
|
||||||
...options,
|
...options,
|
||||||
@ -31,14 +37,12 @@ export const handler = {
|
|||||||
}
|
}
|
||||||
throw new CommerceError(removeOrderLine)
|
throw new CommerceError(removeOrderLine)
|
||||||
},
|
},
|
||||||
useHook: ({
|
useHook: ({ fetch }) => () => {
|
||||||
fetch,
|
|
||||||
}: MutationHookContext<Cart | null, RemoveCartItemBody>) => (ctx = {}) => {
|
|
||||||
const { mutate } = useCart()
|
const { mutate } = useCart()
|
||||||
|
|
||||||
return useCallback(
|
return useCallback(
|
||||||
async function removeItem(input) {
|
async function removeItem(input) {
|
||||||
const data = await fetch({ input })
|
const data = await fetch({ input: { itemId: input.id } })
|
||||||
await mutate(data, false)
|
await mutate(data, false)
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
|
@ -1,20 +1,24 @@
|
|||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { HookFetcherContext, MutationHookContext } from '@commerce/utils/types'
|
import {
|
||||||
|
HookFetcherContext,
|
||||||
|
MutationHook,
|
||||||
|
MutationHookContext,
|
||||||
|
} from '@commerce/utils/types'
|
||||||
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
||||||
import useUpdateItem, { UseUpdateItem } from '@commerce/cart/use-update-item'
|
import useUpdateItem, { UseUpdateItem } from '@commerce/cart/use-update-item'
|
||||||
import {
|
import { CartItemBody, LineItem } from '@commerce/types/cart'
|
||||||
Cart,
|
|
||||||
CartItemBody,
|
|
||||||
LineItem,
|
|
||||||
UpdateCartItemBody,
|
|
||||||
} from '@commerce/types'
|
|
||||||
import useCart from './use-cart'
|
import useCart from './use-cart'
|
||||||
import {
|
import {
|
||||||
AdjustOrderLineMutation,
|
AdjustOrderLineMutation,
|
||||||
AdjustOrderLineMutationVariables,
|
AdjustOrderLineMutationVariables,
|
||||||
} from '../schema'
|
} from '../schema'
|
||||||
import { normalizeCart } from '../lib/normalize'
|
import { normalizeCart } from '../utils/normalize'
|
||||||
import { adjustOrderLineMutation } from '../lib/mutations/adjust-order-line-mutation'
|
import { adjustOrderLineMutation } from '../utils/mutations/adjust-order-line-mutation'
|
||||||
|
import { UpdateItemHook } from '../types/cart'
|
||||||
|
|
||||||
|
export type UpdateItemActionInput<T = any> = T extends LineItem
|
||||||
|
? Partial<UpdateItemHook['actionInput']>
|
||||||
|
: UpdateItemHook['actionInput']
|
||||||
|
|
||||||
export default useUpdateItem as UseUpdateItem<typeof handler>
|
export default useUpdateItem as UseUpdateItem<typeof handler>
|
||||||
|
|
||||||
@ -22,7 +26,7 @@ export const handler = {
|
|||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: adjustOrderLineMutation,
|
query: adjustOrderLineMutation,
|
||||||
},
|
},
|
||||||
async fetcher(context: HookFetcherContext<UpdateCartItemBody<CartItemBody>>) {
|
async fetcher(context: HookFetcherContext<UpdateItemHook>) {
|
||||||
const { input, options, fetch } = context
|
const { input, options, fetch } = context
|
||||||
const variables: AdjustOrderLineMutationVariables = {
|
const variables: AdjustOrderLineMutationVariables = {
|
||||||
quantity: input.item.quantity || 1,
|
quantity: input.item.quantity || 1,
|
||||||
@ -38,9 +42,7 @@ export const handler = {
|
|||||||
}
|
}
|
||||||
throw new CommerceError(adjustOrderLine)
|
throw new CommerceError(adjustOrderLine)
|
||||||
},
|
},
|
||||||
useHook: ({
|
useHook: ({ fetch }: MutationHookContext<UpdateItemHook>) => (
|
||||||
fetch,
|
|
||||||
}: MutationHookContext<Cart | null, UpdateCartItemBody<CartItemBody>>) => (
|
|
||||||
ctx: {
|
ctx: {
|
||||||
item?: LineItem
|
item?: LineItem
|
||||||
wait?: number
|
wait?: number
|
||||||
@ -50,7 +52,7 @@ export const handler = {
|
|||||||
const { mutate } = useCart()
|
const { mutate } = useCart()
|
||||||
|
|
||||||
return useCallback(
|
return useCallback(
|
||||||
async function addItem(input: Partial<CartItemBody>) {
|
async function addItem(input: UpdateItemActionInput) {
|
||||||
const itemId = item?.id
|
const itemId = item?.id
|
||||||
const productId = input.productId ?? item?.productId
|
const productId = input.productId ?? item?.productId
|
||||||
const variantId = input.productId ?? item?.variantId
|
const variantId = input.productId ?? item?.variantId
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
import { getConfig, VendureConfig } from '../api'
|
|
||||||
|
|
||||||
export type Page = any
|
|
||||||
|
|
||||||
export type GetAllPagesResult<
|
|
||||||
T extends { pages: any[] } = { pages: Page[] }
|
|
||||||
> = T
|
|
||||||
|
|
||||||
async function getAllPages(opts?: {
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<GetAllPagesResult>
|
|
||||||
|
|
||||||
async function getAllPages<T extends { pages: any[] }>(opts: {
|
|
||||||
url: string
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<GetAllPagesResult<T>>
|
|
||||||
|
|
||||||
async function getAllPages({
|
|
||||||
config,
|
|
||||||
preview,
|
|
||||||
}: {
|
|
||||||
url?: string
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
} = {}): Promise<GetAllPagesResult> {
|
|
||||||
config = getConfig(config)
|
|
||||||
|
|
||||||
return {
|
|
||||||
pages: [],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getAllPages
|
|
@ -1,40 +0,0 @@
|
|||||||
import { VendureConfig, getConfig } from '../api'
|
|
||||||
|
|
||||||
export type Page = any
|
|
||||||
|
|
||||||
export type GetPageResult<T extends { page?: any } = { page?: Page }> = T
|
|
||||||
|
|
||||||
export type PageVariables = {
|
|
||||||
id: number
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getPage(opts: {
|
|
||||||
url?: string
|
|
||||||
variables: PageVariables
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<GetPageResult>
|
|
||||||
|
|
||||||
async function getPage<T extends { page?: any }, V = any>(opts: {
|
|
||||||
url: string
|
|
||||||
variables: V
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<GetPageResult<T>>
|
|
||||||
|
|
||||||
async function getPage({
|
|
||||||
url,
|
|
||||||
variables,
|
|
||||||
config,
|
|
||||||
preview,
|
|
||||||
}: {
|
|
||||||
url?: string
|
|
||||||
variables: PageVariables
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<GetPageResult> {
|
|
||||||
config = getConfig(config)
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getPage
|
|
@ -1,43 +0,0 @@
|
|||||||
import { getConfig, VendureConfig } from '../api'
|
|
||||||
import { GetCollectionsQuery } from '../schema'
|
|
||||||
import { arrayToTree } from '../lib/array-to-tree'
|
|
||||||
import { getCollectionsQuery } from '../lib/queries/get-collections-query'
|
|
||||||
import { Category } from '@commerce/types'
|
|
||||||
|
|
||||||
export type GetSiteInfoResult<
|
|
||||||
T extends { categories: any[]; brands: any[] } = {
|
|
||||||
categories: Category[]
|
|
||||||
brands: any[]
|
|
||||||
}
|
|
||||||
> = T
|
|
||||||
|
|
||||||
async function getSiteInfo({
|
|
||||||
query = getCollectionsQuery,
|
|
||||||
variables,
|
|
||||||
config,
|
|
||||||
}: {
|
|
||||||
query?: string
|
|
||||||
variables?: any
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
} = {}): Promise<GetSiteInfoResult> {
|
|
||||||
config = getConfig(config)
|
|
||||||
// RecursivePartial forces the method to check for every prop in the data, which is
|
|
||||||
// required in case there's a custom `query`
|
|
||||||
const { data } = await config.fetch<GetCollectionsQuery>(query, { variables })
|
|
||||||
const collections = data.collections?.items.map((i) => ({
|
|
||||||
...i,
|
|
||||||
entityId: i.id,
|
|
||||||
path: i.slug,
|
|
||||||
productCount: i.productVariants.totalItems,
|
|
||||||
}))
|
|
||||||
const categories = arrayToTree(collections).children
|
|
||||||
const brands = [] as any[]
|
|
||||||
|
|
||||||
return {
|
|
||||||
categories: categories ?? [],
|
|
||||||
brands,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getSiteInfo
|
|
@ -1,18 +0,0 @@
|
|||||||
import { getConfig, VendureConfig } from '../api'
|
|
||||||
|
|
||||||
async function getCustomerWishlist({
|
|
||||||
config,
|
|
||||||
variables,
|
|
||||||
includeProducts,
|
|
||||||
}: {
|
|
||||||
url?: string
|
|
||||||
variables: any
|
|
||||||
config?: VendureConfig
|
|
||||||
includeProducts?: boolean
|
|
||||||
}): Promise<any> {
|
|
||||||
// Not implemented as Vendure does not ship with wishlist functionality at present
|
|
||||||
config = getConfig(config)
|
|
||||||
return { wishlist: {} }
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getCustomerWishlist
|
|
@ -1,12 +1,12 @@
|
|||||||
import { SWRHook } from '@commerce/utils/types'
|
import { SWRHook } from '@commerce/utils/types'
|
||||||
import useCustomer, { UseCustomer } from '@commerce/customer/use-customer'
|
import useCustomer, { UseCustomer } from '@commerce/customer/use-customer'
|
||||||
import { Customer } from '@commerce/types'
|
|
||||||
import { ActiveCustomerQuery } from '../schema'
|
import { ActiveCustomerQuery } from '../schema'
|
||||||
import { activeCustomerQuery } from '../lib/queries/active-customer-query'
|
import { activeCustomerQuery } from '../utils/queries/active-customer-query'
|
||||||
|
import { CustomerHook } from '../types/customer'
|
||||||
|
|
||||||
export default useCustomer as UseCustomer<typeof handler>
|
export default useCustomer as UseCustomer<typeof handler>
|
||||||
|
|
||||||
export const handler: SWRHook<Customer | null> = {
|
export const handler: SWRHook<CustomerHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: activeCustomerQuery,
|
query: activeCustomerQuery,
|
||||||
},
|
},
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
import type {
|
|
||||||
GetAllProductPathsQuery,
|
|
||||||
GetAllProductPathsQueryVariables,
|
|
||||||
} from '../schema'
|
|
||||||
import { getConfig, VendureConfig } from '../api'
|
|
||||||
import { getAllProductPathsQuery } from '../lib/queries/get-all-product-paths-query'
|
|
||||||
|
|
||||||
export type GetAllProductPathsResult = {
|
|
||||||
products: Array<{ node: { path: string } }>
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getAllProductPaths(opts?: {
|
|
||||||
variables?: GetAllProductPathsQueryVariables
|
|
||||||
config?: VendureConfig
|
|
||||||
}): Promise<GetAllProductPathsResult>
|
|
||||||
|
|
||||||
async function getAllProductPaths<
|
|
||||||
T extends { products: any[] },
|
|
||||||
V = any
|
|
||||||
>(opts: {
|
|
||||||
query: string
|
|
||||||
variables?: V
|
|
||||||
config?: VendureConfig
|
|
||||||
}): Promise<GetAllProductPathsResult>
|
|
||||||
|
|
||||||
async function getAllProductPaths({
|
|
||||||
query = getAllProductPathsQuery,
|
|
||||||
variables,
|
|
||||||
config,
|
|
||||||
}: {
|
|
||||||
query?: string
|
|
||||||
variables?: GetAllProductPathsQueryVariables
|
|
||||||
config?: VendureConfig
|
|
||||||
} = {}): Promise<GetAllProductPathsResult> {
|
|
||||||
config = getConfig(config)
|
|
||||||
// RecursivePartial forces the method to check for every prop in the data, which is
|
|
||||||
// required in case there's a custom `query`
|
|
||||||
const { data } = await config.fetch<GetAllProductPathsQuery>(query, {
|
|
||||||
variables,
|
|
||||||
})
|
|
||||||
const products = data.products.items
|
|
||||||
|
|
||||||
return {
|
|
||||||
products: products.map((p) => ({ node: { path: `/${p.slug}` } })),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getAllProductPaths
|
|
@ -1,39 +0,0 @@
|
|||||||
import { Product } from '@commerce/types'
|
|
||||||
import { getConfig, VendureConfig } from '../api'
|
|
||||||
import { GetAllProductsQuery } from '../schema'
|
|
||||||
import { normalizeSearchResult } from '../lib/normalize'
|
|
||||||
import { getAllProductsQuery } from '../lib/queries/get-all-products-query'
|
|
||||||
|
|
||||||
export type ProductVariables = { first?: number }
|
|
||||||
|
|
||||||
async function getAllProducts(opts?: {
|
|
||||||
variables?: ProductVariables
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<{ products: Product[] }>
|
|
||||||
|
|
||||||
async function getAllProducts({
|
|
||||||
query = getAllProductsQuery,
|
|
||||||
variables: { ...vars } = {},
|
|
||||||
config,
|
|
||||||
}: {
|
|
||||||
query?: string
|
|
||||||
variables?: ProductVariables
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
} = {}): Promise<{ products: Product[] | any[] }> {
|
|
||||||
config = getConfig(config)
|
|
||||||
const variables = {
|
|
||||||
input: {
|
|
||||||
take: vars.first,
|
|
||||||
groupByProduct: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
const { data } = await config.fetch<GetAllProductsQuery>(query, { variables })
|
|
||||||
|
|
||||||
return {
|
|
||||||
products: data.search.items.map((item) => normalizeSearchResult(item)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getAllProducts
|
|
@ -1,64 +0,0 @@
|
|||||||
import { Product } from '@commerce/types'
|
|
||||||
import { getConfig, VendureConfig } from '../api'
|
|
||||||
import { GetProductQuery } from '../schema'
|
|
||||||
import { getProductQuery } from '../lib/queries/get-product-query'
|
|
||||||
|
|
||||||
async function getProduct({
|
|
||||||
query = getProductQuery,
|
|
||||||
variables,
|
|
||||||
config,
|
|
||||||
}: {
|
|
||||||
query?: string
|
|
||||||
variables: { slug: string }
|
|
||||||
config?: VendureConfig
|
|
||||||
preview?: boolean
|
|
||||||
}): Promise<Product | {} | any> {
|
|
||||||
config = getConfig(config)
|
|
||||||
|
|
||||||
const locale = config.locale
|
|
||||||
const { data } = await config.fetch<GetProductQuery>(query, { variables })
|
|
||||||
const product = data.product
|
|
||||||
|
|
||||||
if (product) {
|
|
||||||
const getOptionGroupName = (id: string): string => {
|
|
||||||
return product.optionGroups.find((og) => og.id === id)!.name
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
product: {
|
|
||||||
id: product.id,
|
|
||||||
name: product.name,
|
|
||||||
description: product.description,
|
|
||||||
slug: product.slug,
|
|
||||||
images: product.assets.map((a) => ({
|
|
||||||
url: a.preview,
|
|
||||||
alt: a.name,
|
|
||||||
})),
|
|
||||||
variants: product.variants.map((v) => ({
|
|
||||||
id: v.id,
|
|
||||||
options: v.options.map((o) => ({
|
|
||||||
// This __typename property is required in order for the correct
|
|
||||||
// variant selection to work, see `components/product/helpers.ts`
|
|
||||||
// `getVariant()` function.
|
|
||||||
__typename: 'MultipleChoiceOption',
|
|
||||||
id: o.id,
|
|
||||||
displayName: getOptionGroupName(o.groupId),
|
|
||||||
values: [{ label: o.name }],
|
|
||||||
})),
|
|
||||||
})),
|
|
||||||
price: {
|
|
||||||
value: product.variants[0].priceWithTax / 100,
|
|
||||||
currencyCode: product.variants[0].currencyCode,
|
|
||||||
},
|
|
||||||
options: product.optionGroups.map((og) => ({
|
|
||||||
id: og.id,
|
|
||||||
displayName: og.name,
|
|
||||||
values: og.options.map((o) => ({ label: o.name })),
|
|
||||||
})),
|
|
||||||
} as Product,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getProduct
|
|
@ -1,4 +1,2 @@
|
|||||||
export { default as usePrice } from './use-price'
|
export { default as usePrice } from './use-price'
|
||||||
export { default as useSearch } from './use-search'
|
export { default as useSearch } from './use-search'
|
||||||
export { default as getProduct } from './get-product'
|
|
||||||
export { default as getAllProducts } from './get-all-products'
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { SWRHook } from '@commerce/utils/types'
|
import { SWRHook } from '@commerce/utils/types'
|
||||||
import useSearch, { UseSearch } from '@commerce/product/use-search'
|
import useSearch, { UseSearch } from '@commerce/product/use-search'
|
||||||
import { Product } from '@commerce/types'
|
import { Product } from '@commerce/types/product'
|
||||||
import { SearchQuery, SearchQueryVariables } from '../schema'
|
import { SearchQuery, SearchQueryVariables } from '../schema'
|
||||||
import { normalizeSearchResult } from '../lib/normalize'
|
import { normalizeSearchResult } from '../utils/normalize'
|
||||||
import { searchQuery } from '../lib/queries/search-query'
|
import { searchQuery } from '../utils/queries/search-query'
|
||||||
|
import { SearchProductsHook } from '../types/product'
|
||||||
|
|
||||||
export default useSearch as UseSearch<typeof handler>
|
export default useSearch as UseSearch<typeof handler>
|
||||||
|
|
||||||
@ -19,11 +20,7 @@ export type SearchProductsData = {
|
|||||||
found: boolean
|
found: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handler: SWRHook<
|
export const handler: SWRHook<SearchProductsHook> = {
|
||||||
SearchProductsData,
|
|
||||||
SearchProductsInput,
|
|
||||||
SearchProductsInput
|
|
||||||
> = {
|
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
query: searchQuery,
|
query: searchQuery,
|
||||||
},
|
},
|
||||||
@ -33,7 +30,7 @@ export const handler: SWRHook<
|
|||||||
const variables: SearchQueryVariables = {
|
const variables: SearchQueryVariables = {
|
||||||
input: {
|
input: {
|
||||||
term: input.search,
|
term: input.search,
|
||||||
collectionId: input.categoryId,
|
collectionId: input.categoryId?.toString(),
|
||||||
groupByProduct: true,
|
groupByProduct: true,
|
||||||
// TODO: what is the "sort" value?
|
// TODO: what is the "sort" value?
|
||||||
},
|
},
|
||||||
|
487
framework/vendure/schema.d.ts
vendored
487
framework/vendure/schema.d.ts
vendored
@ -437,6 +437,13 @@ export type ProductVariantList = PaginatedList & {
|
|||||||
totalItems: Scalars['Int']
|
totalItems: Scalars['Int']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ProductVariantListOptions = {
|
||||||
|
skip?: Maybe<Scalars['Int']>
|
||||||
|
take?: Maybe<Scalars['Int']>
|
||||||
|
sort?: Maybe<ProductVariantSortParameter>
|
||||||
|
filter?: Maybe<ProductVariantFilterParameter>
|
||||||
|
}
|
||||||
|
|
||||||
export enum GlobalFlag {
|
export enum GlobalFlag {
|
||||||
True = 'TRUE',
|
True = 'TRUE',
|
||||||
False = 'FALSE',
|
False = 'FALSE',
|
||||||
@ -463,6 +470,7 @@ export enum DeletionResult {
|
|||||||
* @docsCategory common
|
* @docsCategory common
|
||||||
*/
|
*/
|
||||||
export enum Permission {
|
export enum Permission {
|
||||||
|
Placeholder = 'Placeholder',
|
||||||
/** Authenticated means simply that the user is logged in */
|
/** Authenticated means simply that the user is logged in */
|
||||||
Authenticated = 'Authenticated',
|
Authenticated = 'Authenticated',
|
||||||
/** SuperAdmin has unrestricted access to all operations */
|
/** SuperAdmin has unrestricted access to all operations */
|
||||||
@ -471,22 +479,24 @@ export enum Permission {
|
|||||||
Owner = 'Owner',
|
Owner = 'Owner',
|
||||||
/** Public means any unauthenticated user may perform the operation */
|
/** Public means any unauthenticated user may perform the operation */
|
||||||
Public = 'Public',
|
Public = 'Public',
|
||||||
/** Grants permission to create Catalog */
|
/** Grants permission to update GlobalSettings */
|
||||||
|
UpdateGlobalSettings = 'UpdateGlobalSettings',
|
||||||
|
/** Grants permission to create Products, Facets, Assets, Collections */
|
||||||
CreateCatalog = 'CreateCatalog',
|
CreateCatalog = 'CreateCatalog',
|
||||||
/** Grants permission to read Catalog */
|
/** Grants permission to read Products, Facets, Assets, Collections */
|
||||||
ReadCatalog = 'ReadCatalog',
|
ReadCatalog = 'ReadCatalog',
|
||||||
/** Grants permission to update Catalog */
|
/** Grants permission to update Products, Facets, Assets, Collections */
|
||||||
UpdateCatalog = 'UpdateCatalog',
|
UpdateCatalog = 'UpdateCatalog',
|
||||||
/** Grants permission to delete Catalog */
|
/** Grants permission to delete Products, Facets, Assets, Collections */
|
||||||
DeleteCatalog = 'DeleteCatalog',
|
DeleteCatalog = 'DeleteCatalog',
|
||||||
/** Grants permission to create Customer */
|
/** Grants permission to create PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */
|
||||||
CreateCustomer = 'CreateCustomer',
|
CreateSettings = 'CreateSettings',
|
||||||
/** Grants permission to read Customer */
|
/** Grants permission to read PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */
|
||||||
ReadCustomer = 'ReadCustomer',
|
ReadSettings = 'ReadSettings',
|
||||||
/** Grants permission to update Customer */
|
/** Grants permission to update PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */
|
||||||
UpdateCustomer = 'UpdateCustomer',
|
UpdateSettings = 'UpdateSettings',
|
||||||
/** Grants permission to delete Customer */
|
/** Grants permission to delete PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */
|
||||||
DeleteCustomer = 'DeleteCustomer',
|
DeleteSettings = 'DeleteSettings',
|
||||||
/** Grants permission to create Administrator */
|
/** Grants permission to create Administrator */
|
||||||
CreateAdministrator = 'CreateAdministrator',
|
CreateAdministrator = 'CreateAdministrator',
|
||||||
/** Grants permission to read Administrator */
|
/** Grants permission to read Administrator */
|
||||||
@ -495,6 +505,62 @@ export enum Permission {
|
|||||||
UpdateAdministrator = 'UpdateAdministrator',
|
UpdateAdministrator = 'UpdateAdministrator',
|
||||||
/** Grants permission to delete Administrator */
|
/** Grants permission to delete Administrator */
|
||||||
DeleteAdministrator = 'DeleteAdministrator',
|
DeleteAdministrator = 'DeleteAdministrator',
|
||||||
|
/** Grants permission to create Asset */
|
||||||
|
CreateAsset = 'CreateAsset',
|
||||||
|
/** Grants permission to read Asset */
|
||||||
|
ReadAsset = 'ReadAsset',
|
||||||
|
/** Grants permission to update Asset */
|
||||||
|
UpdateAsset = 'UpdateAsset',
|
||||||
|
/** Grants permission to delete Asset */
|
||||||
|
DeleteAsset = 'DeleteAsset',
|
||||||
|
/** Grants permission to create Channel */
|
||||||
|
CreateChannel = 'CreateChannel',
|
||||||
|
/** Grants permission to read Channel */
|
||||||
|
ReadChannel = 'ReadChannel',
|
||||||
|
/** Grants permission to update Channel */
|
||||||
|
UpdateChannel = 'UpdateChannel',
|
||||||
|
/** Grants permission to delete Channel */
|
||||||
|
DeleteChannel = 'DeleteChannel',
|
||||||
|
/** Grants permission to create Collection */
|
||||||
|
CreateCollection = 'CreateCollection',
|
||||||
|
/** Grants permission to read Collection */
|
||||||
|
ReadCollection = 'ReadCollection',
|
||||||
|
/** Grants permission to update Collection */
|
||||||
|
UpdateCollection = 'UpdateCollection',
|
||||||
|
/** Grants permission to delete Collection */
|
||||||
|
DeleteCollection = 'DeleteCollection',
|
||||||
|
/** Grants permission to create Country */
|
||||||
|
CreateCountry = 'CreateCountry',
|
||||||
|
/** Grants permission to read Country */
|
||||||
|
ReadCountry = 'ReadCountry',
|
||||||
|
/** Grants permission to update Country */
|
||||||
|
UpdateCountry = 'UpdateCountry',
|
||||||
|
/** Grants permission to delete Country */
|
||||||
|
DeleteCountry = 'DeleteCountry',
|
||||||
|
/** Grants permission to create Customer */
|
||||||
|
CreateCustomer = 'CreateCustomer',
|
||||||
|
/** Grants permission to read Customer */
|
||||||
|
ReadCustomer = 'ReadCustomer',
|
||||||
|
/** Grants permission to update Customer */
|
||||||
|
UpdateCustomer = 'UpdateCustomer',
|
||||||
|
/** Grants permission to delete Customer */
|
||||||
|
DeleteCustomer = 'DeleteCustomer',
|
||||||
|
/** Grants permission to create CustomerGroup */
|
||||||
|
CreateCustomerGroup = 'CreateCustomerGroup',
|
||||||
|
/** Grants permission to read CustomerGroup */
|
||||||
|
ReadCustomerGroup = 'ReadCustomerGroup',
|
||||||
|
/** Grants permission to update CustomerGroup */
|
||||||
|
UpdateCustomerGroup = 'UpdateCustomerGroup',
|
||||||
|
/** Grants permission to delete CustomerGroup */
|
||||||
|
DeleteCustomerGroup = 'DeleteCustomerGroup',
|
||||||
|
/** Grants permission to create Facet */
|
||||||
|
CreateFacet = 'CreateFacet',
|
||||||
|
/** Grants permission to read Facet */
|
||||||
|
ReadFacet = 'ReadFacet',
|
||||||
|
/** Grants permission to update Facet */
|
||||||
|
UpdateFacet = 'UpdateFacet',
|
||||||
|
/** Grants permission to delete Facet */
|
||||||
|
DeleteFacet = 'DeleteFacet',
|
||||||
/** Grants permission to create Order */
|
/** Grants permission to create Order */
|
||||||
CreateOrder = 'CreateOrder',
|
CreateOrder = 'CreateOrder',
|
||||||
/** Grants permission to read Order */
|
/** Grants permission to read Order */
|
||||||
@ -503,6 +569,22 @@ export enum Permission {
|
|||||||
UpdateOrder = 'UpdateOrder',
|
UpdateOrder = 'UpdateOrder',
|
||||||
/** Grants permission to delete Order */
|
/** Grants permission to delete Order */
|
||||||
DeleteOrder = 'DeleteOrder',
|
DeleteOrder = 'DeleteOrder',
|
||||||
|
/** Grants permission to create PaymentMethod */
|
||||||
|
CreatePaymentMethod = 'CreatePaymentMethod',
|
||||||
|
/** Grants permission to read PaymentMethod */
|
||||||
|
ReadPaymentMethod = 'ReadPaymentMethod',
|
||||||
|
/** Grants permission to update PaymentMethod */
|
||||||
|
UpdatePaymentMethod = 'UpdatePaymentMethod',
|
||||||
|
/** Grants permission to delete PaymentMethod */
|
||||||
|
DeletePaymentMethod = 'DeletePaymentMethod',
|
||||||
|
/** Grants permission to create Product */
|
||||||
|
CreateProduct = 'CreateProduct',
|
||||||
|
/** Grants permission to read Product */
|
||||||
|
ReadProduct = 'ReadProduct',
|
||||||
|
/** Grants permission to update Product */
|
||||||
|
UpdateProduct = 'UpdateProduct',
|
||||||
|
/** Grants permission to delete Product */
|
||||||
|
DeleteProduct = 'DeleteProduct',
|
||||||
/** Grants permission to create Promotion */
|
/** Grants permission to create Promotion */
|
||||||
CreatePromotion = 'CreatePromotion',
|
CreatePromotion = 'CreatePromotion',
|
||||||
/** Grants permission to read Promotion */
|
/** Grants permission to read Promotion */
|
||||||
@ -511,14 +593,54 @@ export enum Permission {
|
|||||||
UpdatePromotion = 'UpdatePromotion',
|
UpdatePromotion = 'UpdatePromotion',
|
||||||
/** Grants permission to delete Promotion */
|
/** Grants permission to delete Promotion */
|
||||||
DeletePromotion = 'DeletePromotion',
|
DeletePromotion = 'DeletePromotion',
|
||||||
/** Grants permission to create Settings */
|
/** Grants permission to create ShippingMethod */
|
||||||
CreateSettings = 'CreateSettings',
|
CreateShippingMethod = 'CreateShippingMethod',
|
||||||
/** Grants permission to read Settings */
|
/** Grants permission to read ShippingMethod */
|
||||||
ReadSettings = 'ReadSettings',
|
ReadShippingMethod = 'ReadShippingMethod',
|
||||||
/** Grants permission to update Settings */
|
/** Grants permission to update ShippingMethod */
|
||||||
UpdateSettings = 'UpdateSettings',
|
UpdateShippingMethod = 'UpdateShippingMethod',
|
||||||
/** Grants permission to delete Settings */
|
/** Grants permission to delete ShippingMethod */
|
||||||
DeleteSettings = 'DeleteSettings',
|
DeleteShippingMethod = 'DeleteShippingMethod',
|
||||||
|
/** Grants permission to create Tag */
|
||||||
|
CreateTag = 'CreateTag',
|
||||||
|
/** Grants permission to read Tag */
|
||||||
|
ReadTag = 'ReadTag',
|
||||||
|
/** Grants permission to update Tag */
|
||||||
|
UpdateTag = 'UpdateTag',
|
||||||
|
/** Grants permission to delete Tag */
|
||||||
|
DeleteTag = 'DeleteTag',
|
||||||
|
/** Grants permission to create TaxCategory */
|
||||||
|
CreateTaxCategory = 'CreateTaxCategory',
|
||||||
|
/** Grants permission to read TaxCategory */
|
||||||
|
ReadTaxCategory = 'ReadTaxCategory',
|
||||||
|
/** Grants permission to update TaxCategory */
|
||||||
|
UpdateTaxCategory = 'UpdateTaxCategory',
|
||||||
|
/** Grants permission to delete TaxCategory */
|
||||||
|
DeleteTaxCategory = 'DeleteTaxCategory',
|
||||||
|
/** Grants permission to create TaxRate */
|
||||||
|
CreateTaxRate = 'CreateTaxRate',
|
||||||
|
/** Grants permission to read TaxRate */
|
||||||
|
ReadTaxRate = 'ReadTaxRate',
|
||||||
|
/** Grants permission to update TaxRate */
|
||||||
|
UpdateTaxRate = 'UpdateTaxRate',
|
||||||
|
/** Grants permission to delete TaxRate */
|
||||||
|
DeleteTaxRate = 'DeleteTaxRate',
|
||||||
|
/** Grants permission to create System */
|
||||||
|
CreateSystem = 'CreateSystem',
|
||||||
|
/** Grants permission to read System */
|
||||||
|
ReadSystem = 'ReadSystem',
|
||||||
|
/** Grants permission to update System */
|
||||||
|
UpdateSystem = 'UpdateSystem',
|
||||||
|
/** Grants permission to delete System */
|
||||||
|
DeleteSystem = 'DeleteSystem',
|
||||||
|
/** Grants permission to create Zone */
|
||||||
|
CreateZone = 'CreateZone',
|
||||||
|
/** Grants permission to read Zone */
|
||||||
|
ReadZone = 'ReadZone',
|
||||||
|
/** Grants permission to update Zone */
|
||||||
|
UpdateZone = 'UpdateZone',
|
||||||
|
/** Grants permission to delete Zone */
|
||||||
|
DeleteZone = 'DeleteZone',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SortOrder {
|
export enum SortOrder {
|
||||||
@ -734,10 +856,24 @@ export type DateOperators = {
|
|||||||
between?: Maybe<DateRange>
|
between?: Maybe<DateRange>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to construct boolean expressions for filtering search results
|
||||||
|
* by FacetValue ID. Examples:
|
||||||
|
*
|
||||||
|
* * ID=1 OR ID=2: `{ facetValueFilters: [{ or: [1,2] }] }`
|
||||||
|
* * ID=1 AND ID=2: `{ facetValueFilters: [{ and: 1 }, { and: 2 }] }`
|
||||||
|
* * ID=1 AND (ID=2 OR ID=3): `{ facetValueFilters: [{ and: 1 }, { or: [2,3] }] }`
|
||||||
|
*/
|
||||||
|
export type FacetValueFilterInput = {
|
||||||
|
and?: Maybe<Scalars['ID']>
|
||||||
|
or?: Maybe<Array<Scalars['ID']>>
|
||||||
|
}
|
||||||
|
|
||||||
export type SearchInput = {
|
export type SearchInput = {
|
||||||
term?: Maybe<Scalars['String']>
|
term?: Maybe<Scalars['String']>
|
||||||
facetValueIds?: Maybe<Array<Scalars['ID']>>
|
facetValueIds?: Maybe<Array<Scalars['ID']>>
|
||||||
facetValueOperator?: Maybe<LogicalOperator>
|
facetValueOperator?: Maybe<LogicalOperator>
|
||||||
|
facetValueFilters?: Maybe<Array<FacetValueFilterInput>>
|
||||||
collectionId?: Maybe<Scalars['ID']>
|
collectionId?: Maybe<Scalars['ID']>
|
||||||
collectionSlug?: Maybe<Scalars['String']>
|
collectionSlug?: Maybe<Scalars['String']>
|
||||||
groupByProduct?: Maybe<Scalars['Boolean']>
|
groupByProduct?: Maybe<Scalars['Boolean']>
|
||||||
@ -802,6 +938,7 @@ export type ShippingMethodQuote = {
|
|||||||
id: Scalars['ID']
|
id: Scalars['ID']
|
||||||
price: Scalars['Int']
|
price: Scalars['Int']
|
||||||
priceWithTax: Scalars['Int']
|
priceWithTax: Scalars['Int']
|
||||||
|
code: Scalars['String']
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
description: Scalars['String']
|
description: Scalars['String']
|
||||||
/** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */
|
/** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */
|
||||||
@ -812,6 +949,8 @@ export type PaymentMethodQuote = {
|
|||||||
__typename?: 'PaymentMethodQuote'
|
__typename?: 'PaymentMethodQuote'
|
||||||
id: Scalars['ID']
|
id: Scalars['ID']
|
||||||
code: Scalars['String']
|
code: Scalars['String']
|
||||||
|
name: Scalars['String']
|
||||||
|
description: Scalars['String']
|
||||||
isEligible: Scalars['Boolean']
|
isEligible: Scalars['Boolean']
|
||||||
eligibilityMessage?: Maybe<Scalars['String']>
|
eligibilityMessage?: Maybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
@ -1307,6 +1446,13 @@ export type CustomerGroupCustomersArgs = {
|
|||||||
options?: Maybe<CustomerListOptions>
|
options?: Maybe<CustomerListOptions>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CustomerListOptions = {
|
||||||
|
skip?: Maybe<Scalars['Int']>
|
||||||
|
take?: Maybe<Scalars['Int']>
|
||||||
|
sort?: Maybe<CustomerSortParameter>
|
||||||
|
filter?: Maybe<CustomerFilterParameter>
|
||||||
|
}
|
||||||
|
|
||||||
export type Customer = Node & {
|
export type Customer = Node & {
|
||||||
__typename?: 'Customer'
|
__typename?: 'Customer'
|
||||||
id: Scalars['ID']
|
id: Scalars['ID']
|
||||||
@ -1425,6 +1571,13 @@ export type HistoryEntryList = PaginatedList & {
|
|||||||
totalItems: Scalars['Int']
|
totalItems: Scalars['Int']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type HistoryEntryListOptions = {
|
||||||
|
skip?: Maybe<Scalars['Int']>
|
||||||
|
take?: Maybe<Scalars['Int']>
|
||||||
|
sort?: Maybe<HistoryEntrySortParameter>
|
||||||
|
filter?: Maybe<HistoryEntryFilterParameter>
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description
|
* @description
|
||||||
* Languages in the form of a ISO 639-1 language code with optional
|
* Languages in the form of a ISO 639-1 language code with optional
|
||||||
@ -1777,12 +1930,7 @@ export type Order = Node & {
|
|||||||
* methods.
|
* methods.
|
||||||
*/
|
*/
|
||||||
surcharges: Array<Surcharge>
|
surcharges: Array<Surcharge>
|
||||||
/**
|
discounts: Array<Discount>
|
||||||
* Order-level adjustments to the order total, such as discounts from promotions
|
|
||||||
* @deprecated Use `discounts` instead
|
|
||||||
*/
|
|
||||||
adjustments: Array<Adjustment>
|
|
||||||
discounts: Array<Adjustment>
|
|
||||||
/** An array of all coupon codes applied to the Order */
|
/** An array of all coupon codes applied to the Order */
|
||||||
couponCodes: Array<Scalars['String']>
|
couponCodes: Array<Scalars['String']>
|
||||||
/** Promotions applied to the order. Only gets populated after the payment process has completed. */
|
/** Promotions applied to the order. Only gets populated after the payment process has completed. */
|
||||||
@ -1861,7 +2009,16 @@ export type ShippingLine = {
|
|||||||
priceWithTax: Scalars['Int']
|
priceWithTax: Scalars['Int']
|
||||||
discountedPrice: Scalars['Int']
|
discountedPrice: Scalars['Int']
|
||||||
discountedPriceWithTax: Scalars['Int']
|
discountedPriceWithTax: Scalars['Int']
|
||||||
discounts: Array<Adjustment>
|
discounts: Array<Discount>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Discount = {
|
||||||
|
__typename?: 'Discount'
|
||||||
|
adjustmentSource: Scalars['String']
|
||||||
|
type: AdjustmentType
|
||||||
|
description: Scalars['String']
|
||||||
|
amount: Scalars['Int']
|
||||||
|
amountWithTax: Scalars['Int']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OrderItem = Node & {
|
export type OrderItem = Node & {
|
||||||
@ -1894,8 +2051,6 @@ export type OrderItem = Node & {
|
|||||||
/** The proratedUnitPrice including tax */
|
/** The proratedUnitPrice including tax */
|
||||||
proratedUnitPriceWithTax: Scalars['Int']
|
proratedUnitPriceWithTax: Scalars['Int']
|
||||||
unitTax: Scalars['Int']
|
unitTax: Scalars['Int']
|
||||||
/** @deprecated `unitPrice` is now always without tax */
|
|
||||||
unitPriceIncludesTax: Scalars['Boolean']
|
|
||||||
taxRate: Scalars['Float']
|
taxRate: Scalars['Float']
|
||||||
adjustments: Array<Adjustment>
|
adjustments: Array<Adjustment>
|
||||||
taxLines: Array<TaxLine>
|
taxLines: Array<TaxLine>
|
||||||
@ -1939,8 +2094,6 @@ export type OrderLine = Node & {
|
|||||||
proratedUnitPriceWithTax: Scalars['Int']
|
proratedUnitPriceWithTax: Scalars['Int']
|
||||||
quantity: Scalars['Int']
|
quantity: Scalars['Int']
|
||||||
items: Array<OrderItem>
|
items: Array<OrderItem>
|
||||||
/** @deprecated Use `linePriceWithTax` instead */
|
|
||||||
totalPrice: Scalars['Int']
|
|
||||||
taxRate: Scalars['Float']
|
taxRate: Scalars['Float']
|
||||||
/** The total price of the line excluding tax and discounts. */
|
/** The total price of the line excluding tax and discounts. */
|
||||||
linePrice: Scalars['Int']
|
linePrice: Scalars['Int']
|
||||||
@ -1960,9 +2113,7 @@ export type OrderLine = Node & {
|
|||||||
proratedLinePriceWithTax: Scalars['Int']
|
proratedLinePriceWithTax: Scalars['Int']
|
||||||
/** The total tax on this line */
|
/** The total tax on this line */
|
||||||
lineTax: Scalars['Int']
|
lineTax: Scalars['Int']
|
||||||
/** @deprecated Use `discounts` instead */
|
discounts: Array<Discount>
|
||||||
adjustments: Array<Adjustment>
|
|
||||||
discounts: Array<Adjustment>
|
|
||||||
taxLines: Array<TaxLine>
|
taxLines: Array<TaxLine>
|
||||||
order: Order
|
order: Order
|
||||||
customFields?: Maybe<Scalars['JSON']>
|
customFields?: Maybe<Scalars['JSON']>
|
||||||
@ -2105,13 +2256,9 @@ export type SearchResult = {
|
|||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
productId: Scalars['ID']
|
productId: Scalars['ID']
|
||||||
productName: Scalars['String']
|
productName: Scalars['String']
|
||||||
/** @deprecated Use `productAsset.preview` instead */
|
|
||||||
productPreview: Scalars['String']
|
|
||||||
productAsset?: Maybe<SearchResultAsset>
|
productAsset?: Maybe<SearchResultAsset>
|
||||||
productVariantId: Scalars['ID']
|
productVariantId: Scalars['ID']
|
||||||
productVariantName: Scalars['String']
|
productVariantName: Scalars['String']
|
||||||
/** @deprecated Use `productVariantAsset.preview` instead */
|
|
||||||
productVariantPreview: Scalars['String']
|
|
||||||
productVariantAsset?: Maybe<SearchResultAsset>
|
productVariantAsset?: Maybe<SearchResultAsset>
|
||||||
price: SearchResultPrice
|
price: SearchResultPrice
|
||||||
priceWithTax: SearchResultPrice
|
priceWithTax: SearchResultPrice
|
||||||
@ -2191,8 +2338,6 @@ export type ProductVariant = Node & {
|
|||||||
assets: Array<Asset>
|
assets: Array<Asset>
|
||||||
price: Scalars['Int']
|
price: Scalars['Int']
|
||||||
currencyCode: CurrencyCode
|
currencyCode: CurrencyCode
|
||||||
/** @deprecated price now always excludes tax */
|
|
||||||
priceIncludesTax: Scalars['Boolean']
|
|
||||||
priceWithTax: Scalars['Int']
|
priceWithTax: Scalars['Int']
|
||||||
stockLevel: Scalars['String']
|
stockLevel: Scalars['String']
|
||||||
taxRateApplied: TaxRate
|
taxRateApplied: TaxRate
|
||||||
@ -2200,7 +2345,7 @@ export type ProductVariant = Node & {
|
|||||||
options: Array<ProductOption>
|
options: Array<ProductOption>
|
||||||
facetValues: Array<FacetValue>
|
facetValues: Array<FacetValue>
|
||||||
translations: Array<ProductVariantTranslation>
|
translations: Array<ProductVariantTranslation>
|
||||||
customFields?: Maybe<Scalars['JSON']>
|
customFields?: Maybe<ProductVariantCustomFields>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProductVariantTranslation = {
|
export type ProductVariantTranslation = {
|
||||||
@ -2524,6 +2669,10 @@ export type NoActiveOrderError = ErrorResult & {
|
|||||||
message: Scalars['String']
|
message: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AuthenticationInput = {
|
||||||
|
native?: Maybe<NativeAuthInput>
|
||||||
|
}
|
||||||
|
|
||||||
export type RegisterCustomerInput = {
|
export type RegisterCustomerInput = {
|
||||||
emailAddress: Scalars['String']
|
emailAddress: Scalars['String']
|
||||||
title?: Maybe<Scalars['String']>
|
title?: Maybe<Scalars['String']>
|
||||||
@ -2541,6 +2690,10 @@ export type UpdateCustomerInput = {
|
|||||||
customFields?: Maybe<Scalars['JSON']>
|
customFields?: Maybe<Scalars['JSON']>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type UpdateOrderInput = {
|
||||||
|
customFields?: Maybe<Scalars['JSON']>
|
||||||
|
}
|
||||||
|
|
||||||
/** Passed as input to the `addPaymentToOrder` mutation. */
|
/** Passed as input to the `addPaymentToOrder` mutation. */
|
||||||
export type PaymentInput = {
|
export type PaymentInput = {
|
||||||
/** This field should correspond to the `code` property of a PaymentMethodHandler. */
|
/** This field should correspond to the `code` property of a PaymentMethodHandler. */
|
||||||
@ -2553,6 +2706,27 @@ export type PaymentInput = {
|
|||||||
metadata: Scalars['JSON']
|
metadata: Scalars['JSON']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CollectionListOptions = {
|
||||||
|
skip?: Maybe<Scalars['Int']>
|
||||||
|
take?: Maybe<Scalars['Int']>
|
||||||
|
sort?: Maybe<CollectionSortParameter>
|
||||||
|
filter?: Maybe<CollectionFilterParameter>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type OrderListOptions = {
|
||||||
|
skip?: Maybe<Scalars['Int']>
|
||||||
|
take?: Maybe<Scalars['Int']>
|
||||||
|
sort?: Maybe<OrderSortParameter>
|
||||||
|
filter?: Maybe<OrderFilterParameter>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ProductListOptions = {
|
||||||
|
skip?: Maybe<Scalars['Int']>
|
||||||
|
take?: Maybe<Scalars['Int']>
|
||||||
|
sort?: Maybe<ProductSortParameter>
|
||||||
|
filter?: Maybe<ProductFilterParameter>
|
||||||
|
}
|
||||||
|
|
||||||
export type UpdateOrderItemsResult =
|
export type UpdateOrderItemsResult =
|
||||||
| Order
|
| Order
|
||||||
| OrderModificationError
|
| OrderModificationError
|
||||||
@ -2646,48 +2820,6 @@ export type AuthenticationResult =
|
|||||||
|
|
||||||
export type ActiveOrderResult = Order | NoActiveOrderError
|
export type ActiveOrderResult = Order | NoActiveOrderError
|
||||||
|
|
||||||
export type CollectionListOptions = {
|
|
||||||
skip?: Maybe<Scalars['Int']>
|
|
||||||
take?: Maybe<Scalars['Int']>
|
|
||||||
sort?: Maybe<CollectionSortParameter>
|
|
||||||
filter?: Maybe<CollectionFilterParameter>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ProductListOptions = {
|
|
||||||
skip?: Maybe<Scalars['Int']>
|
|
||||||
take?: Maybe<Scalars['Int']>
|
|
||||||
sort?: Maybe<ProductSortParameter>
|
|
||||||
filter?: Maybe<ProductFilterParameter>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ProductVariantListOptions = {
|
|
||||||
skip?: Maybe<Scalars['Int']>
|
|
||||||
take?: Maybe<Scalars['Int']>
|
|
||||||
sort?: Maybe<ProductVariantSortParameter>
|
|
||||||
filter?: Maybe<ProductVariantFilterParameter>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CustomerListOptions = {
|
|
||||||
skip?: Maybe<Scalars['Int']>
|
|
||||||
take?: Maybe<Scalars['Int']>
|
|
||||||
sort?: Maybe<CustomerSortParameter>
|
|
||||||
filter?: Maybe<CustomerFilterParameter>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type OrderListOptions = {
|
|
||||||
skip?: Maybe<Scalars['Int']>
|
|
||||||
take?: Maybe<Scalars['Int']>
|
|
||||||
sort?: Maybe<OrderSortParameter>
|
|
||||||
filter?: Maybe<OrderFilterParameter>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type HistoryEntryListOptions = {
|
|
||||||
skip?: Maybe<Scalars['Int']>
|
|
||||||
take?: Maybe<Scalars['Int']>
|
|
||||||
sort?: Maybe<HistoryEntrySortParameter>
|
|
||||||
filter?: Maybe<HistoryEntryFilterParameter>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CollectionFilterParameter = {
|
export type CollectionFilterParameter = {
|
||||||
createdAt?: Maybe<DateOperators>
|
createdAt?: Maybe<DateOperators>
|
||||||
updatedAt?: Maybe<DateOperators>
|
updatedAt?: Maybe<DateOperators>
|
||||||
@ -2734,9 +2866,9 @@ export type ProductVariantFilterParameter = {
|
|||||||
name?: Maybe<StringOperators>
|
name?: Maybe<StringOperators>
|
||||||
price?: Maybe<NumberOperators>
|
price?: Maybe<NumberOperators>
|
||||||
currencyCode?: Maybe<StringOperators>
|
currencyCode?: Maybe<StringOperators>
|
||||||
priceIncludesTax?: Maybe<BooleanOperators>
|
|
||||||
priceWithTax?: Maybe<NumberOperators>
|
priceWithTax?: Maybe<NumberOperators>
|
||||||
stockLevel?: Maybe<StringOperators>
|
stockLevel?: Maybe<StringOperators>
|
||||||
|
discountPrice?: Maybe<NumberOperators>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProductVariantSortParameter = {
|
export type ProductVariantSortParameter = {
|
||||||
@ -2749,6 +2881,7 @@ export type ProductVariantSortParameter = {
|
|||||||
price?: Maybe<SortOrder>
|
price?: Maybe<SortOrder>
|
||||||
priceWithTax?: Maybe<SortOrder>
|
priceWithTax?: Maybe<SortOrder>
|
||||||
stockLevel?: Maybe<SortOrder>
|
stockLevel?: Maybe<SortOrder>
|
||||||
|
discountPrice?: Maybe<SortOrder>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CustomerFilterParameter = {
|
export type CustomerFilterParameter = {
|
||||||
@ -2817,12 +2950,9 @@ export type HistoryEntrySortParameter = {
|
|||||||
updatedAt?: Maybe<SortOrder>
|
updatedAt?: Maybe<SortOrder>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateOrderInput = {
|
export type ProductVariantCustomFields = {
|
||||||
customFields?: Maybe<Scalars['JSON']>
|
__typename?: 'ProductVariantCustomFields'
|
||||||
}
|
discountPrice?: Maybe<Scalars['Int']>
|
||||||
|
|
||||||
export type AuthenticationInput = {
|
|
||||||
native?: Maybe<NativeAuthInput>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NativeAuthInput = {
|
export type NativeAuthInput = {
|
||||||
@ -2846,14 +2976,19 @@ export type CartFragment = { __typename?: 'Order' } & Pick<
|
|||||||
lines: Array<
|
lines: Array<
|
||||||
{ __typename?: 'OrderLine' } & Pick<
|
{ __typename?: 'OrderLine' } & Pick<
|
||||||
OrderLine,
|
OrderLine,
|
||||||
'id' | 'quantity' | 'linePriceWithTax' | 'discountedLinePriceWithTax'
|
| 'id'
|
||||||
|
| 'quantity'
|
||||||
|
| 'linePriceWithTax'
|
||||||
|
| 'discountedLinePriceWithTax'
|
||||||
|
| 'unitPriceWithTax'
|
||||||
|
| 'discountedUnitPriceWithTax'
|
||||||
> & {
|
> & {
|
||||||
featuredAsset?: Maybe<
|
featuredAsset?: Maybe<
|
||||||
{ __typename?: 'Asset' } & Pick<Asset, 'id' | 'preview'>
|
{ __typename?: 'Asset' } & Pick<Asset, 'id' | 'preview'>
|
||||||
>
|
>
|
||||||
discounts: Array<
|
discounts: Array<
|
||||||
{ __typename?: 'Adjustment' } & Pick<
|
{ __typename?: 'Discount' } & Pick<
|
||||||
Adjustment,
|
Discount,
|
||||||
'description' | 'amount'
|
'description' | 'amount'
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
@ -2886,51 +3021,6 @@ export type SearchResultFragment = { __typename?: 'SearchResult' } & Pick<
|
|||||||
| ({ __typename?: 'SinglePrice' } & Pick<SinglePrice, 'value'>)
|
| ({ __typename?: 'SinglePrice' } & Pick<SinglePrice, 'value'>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LoginMutationVariables = Exact<{
|
|
||||||
username: Scalars['String']
|
|
||||||
password: Scalars['String']
|
|
||||||
}>
|
|
||||||
|
|
||||||
export type LoginMutation = { __typename?: 'Mutation' } & {
|
|
||||||
login:
|
|
||||||
| ({ __typename: 'CurrentUser' } & Pick<CurrentUser, 'id'>)
|
|
||||||
| ({ __typename: 'InvalidCredentialsError' } & Pick<
|
|
||||||
InvalidCredentialsError,
|
|
||||||
'errorCode' | 'message'
|
|
||||||
>)
|
|
||||||
| ({ __typename: 'NotVerifiedError' } & Pick<
|
|
||||||
NotVerifiedError,
|
|
||||||
'errorCode' | 'message'
|
|
||||||
>)
|
|
||||||
| ({ __typename: 'NativeAuthStrategyError' } & Pick<
|
|
||||||
NativeAuthStrategyError,
|
|
||||||
'errorCode' | 'message'
|
|
||||||
>)
|
|
||||||
}
|
|
||||||
|
|
||||||
export type LogoutMutationVariables = Exact<{ [key: string]: never }>
|
|
||||||
|
|
||||||
export type LogoutMutation = { __typename?: 'Mutation' } & {
|
|
||||||
logout: { __typename?: 'Success' } & Pick<Success, 'success'>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SignupMutationVariables = Exact<{
|
|
||||||
input: RegisterCustomerInput
|
|
||||||
}>
|
|
||||||
|
|
||||||
export type SignupMutation = { __typename?: 'Mutation' } & {
|
|
||||||
registerCustomerAccount:
|
|
||||||
| ({ __typename: 'Success' } & Pick<Success, 'success'>)
|
|
||||||
| ({ __typename: 'MissingPasswordError' } & Pick<
|
|
||||||
MissingPasswordError,
|
|
||||||
'errorCode' | 'message'
|
|
||||||
>)
|
|
||||||
| ({ __typename: 'NativeAuthStrategyError' } & Pick<
|
|
||||||
NativeAuthStrategyError,
|
|
||||||
'errorCode' | 'message'
|
|
||||||
>)
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AddItemToOrderMutationVariables = Exact<{
|
export type AddItemToOrderMutationVariables = Exact<{
|
||||||
variantId: Scalars['ID']
|
variantId: Scalars['ID']
|
||||||
quantity: Scalars['Int']
|
quantity: Scalars['Int']
|
||||||
@ -2957,25 +3047,6 @@ export type AddItemToOrderMutation = { __typename?: 'Mutation' } & {
|
|||||||
>)
|
>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ActiveOrderQueryVariables = Exact<{ [key: string]: never }>
|
|
||||||
|
|
||||||
export type ActiveOrderQuery = { __typename?: 'Query' } & {
|
|
||||||
activeOrder?: Maybe<{ __typename?: 'Order' } & CartFragment>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RemoveOrderLineMutationVariables = Exact<{
|
|
||||||
orderLineId: Scalars['ID']
|
|
||||||
}>
|
|
||||||
|
|
||||||
export type RemoveOrderLineMutation = { __typename?: 'Mutation' } & {
|
|
||||||
removeOrderLine:
|
|
||||||
| ({ __typename: 'Order' } & CartFragment)
|
|
||||||
| ({ __typename: 'OrderModificationError' } & Pick<
|
|
||||||
OrderModificationError,
|
|
||||||
'errorCode' | 'message'
|
|
||||||
>)
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AdjustOrderLineMutationVariables = Exact<{
|
export type AdjustOrderLineMutationVariables = Exact<{
|
||||||
orderLineId: Scalars['ID']
|
orderLineId: Scalars['ID']
|
||||||
quantity: Scalars['Int']
|
quantity: Scalars['Int']
|
||||||
@ -3002,26 +3073,62 @@ export type AdjustOrderLineMutation = { __typename?: 'Mutation' } & {
|
|||||||
>)
|
>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GetCollectionsQueryVariables = Exact<{ [key: string]: never }>
|
export type LoginMutationVariables = Exact<{
|
||||||
|
username: Scalars['String']
|
||||||
|
password: Scalars['String']
|
||||||
|
}>
|
||||||
|
|
||||||
export type GetCollectionsQuery = { __typename?: 'Query' } & {
|
export type LoginMutation = { __typename?: 'Mutation' } & {
|
||||||
collections: { __typename?: 'CollectionList' } & {
|
login:
|
||||||
items: Array<
|
| ({ __typename: 'CurrentUser' } & Pick<CurrentUser, 'id'>)
|
||||||
{ __typename?: 'Collection' } & Pick<
|
| ({ __typename: 'InvalidCredentialsError' } & Pick<
|
||||||
Collection,
|
InvalidCredentialsError,
|
||||||
'id' | 'name' | 'description' | 'slug'
|
'errorCode' | 'message'
|
||||||
> & {
|
>)
|
||||||
productVariants: { __typename?: 'ProductVariantList' } & Pick<
|
| ({ __typename: 'NotVerifiedError' } & Pick<
|
||||||
ProductVariantList,
|
NotVerifiedError,
|
||||||
'totalItems'
|
'errorCode' | 'message'
|
||||||
>
|
>)
|
||||||
parent?: Maybe<{ __typename?: 'Collection' } & Pick<Collection, 'id'>>
|
| ({ __typename: 'NativeAuthStrategyError' } & Pick<
|
||||||
children?: Maybe<
|
NativeAuthStrategyError,
|
||||||
Array<{ __typename?: 'Collection' } & Pick<Collection, 'id'>>
|
'errorCode' | 'message'
|
||||||
>
|
>)
|
||||||
}
|
}
|
||||||
>
|
|
||||||
}
|
export type LogoutMutationVariables = Exact<{ [key: string]: never }>
|
||||||
|
|
||||||
|
export type LogoutMutation = { __typename?: 'Mutation' } & {
|
||||||
|
logout: { __typename?: 'Success' } & Pick<Success, 'success'>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RemoveOrderLineMutationVariables = Exact<{
|
||||||
|
orderLineId: Scalars['ID']
|
||||||
|
}>
|
||||||
|
|
||||||
|
export type RemoveOrderLineMutation = { __typename?: 'Mutation' } & {
|
||||||
|
removeOrderLine:
|
||||||
|
| ({ __typename: 'Order' } & CartFragment)
|
||||||
|
| ({ __typename: 'OrderModificationError' } & Pick<
|
||||||
|
OrderModificationError,
|
||||||
|
'errorCode' | 'message'
|
||||||
|
>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SignupMutationVariables = Exact<{
|
||||||
|
input: RegisterCustomerInput
|
||||||
|
}>
|
||||||
|
|
||||||
|
export type SignupMutation = { __typename?: 'Mutation' } & {
|
||||||
|
registerCustomerAccount:
|
||||||
|
| ({ __typename: 'Success' } & Pick<Success, 'success'>)
|
||||||
|
| ({ __typename: 'MissingPasswordError' } & Pick<
|
||||||
|
MissingPasswordError,
|
||||||
|
'errorCode' | 'message'
|
||||||
|
>)
|
||||||
|
| ({ __typename: 'NativeAuthStrategyError' } & Pick<
|
||||||
|
NativeAuthStrategyError,
|
||||||
|
'errorCode' | 'message'
|
||||||
|
>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ActiveCustomerQueryVariables = Exact<{ [key: string]: never }>
|
export type ActiveCustomerQueryVariables = Exact<{ [key: string]: never }>
|
||||||
@ -3055,6 +3162,34 @@ export type GetAllProductsQuery = { __typename?: 'Query' } & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ActiveOrderQueryVariables = Exact<{ [key: string]: never }>
|
||||||
|
|
||||||
|
export type ActiveOrderQuery = { __typename?: 'Query' } & {
|
||||||
|
activeOrder?: Maybe<{ __typename?: 'Order' } & CartFragment>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GetCollectionsQueryVariables = Exact<{ [key: string]: never }>
|
||||||
|
|
||||||
|
export type GetCollectionsQuery = { __typename?: 'Query' } & {
|
||||||
|
collections: { __typename?: 'CollectionList' } & {
|
||||||
|
items: Array<
|
||||||
|
{ __typename?: 'Collection' } & Pick<
|
||||||
|
Collection,
|
||||||
|
'id' | 'name' | 'description' | 'slug'
|
||||||
|
> & {
|
||||||
|
productVariants: { __typename?: 'ProductVariantList' } & Pick<
|
||||||
|
ProductVariantList,
|
||||||
|
'totalItems'
|
||||||
|
>
|
||||||
|
parent?: Maybe<{ __typename?: 'Collection' } & Pick<Collection, 'id'>>
|
||||||
|
children?: Maybe<
|
||||||
|
Array<{ __typename?: 'Collection' } & Pick<Collection, 'id'>>
|
||||||
|
>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export type GetProductQueryVariables = Exact<{
|
export type GetProductQueryVariables = Exact<{
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
}>
|
}>
|
||||||
|
@ -386,6 +386,13 @@ type ProductVariantList implements PaginatedList {
|
|||||||
totalItems: Int!
|
totalItems: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input ProductVariantListOptions {
|
||||||
|
skip: Int
|
||||||
|
take: Int
|
||||||
|
sort: ProductVariantSortParameter
|
||||||
|
filter: ProductVariantFilterParameter
|
||||||
|
}
|
||||||
|
|
||||||
enum GlobalFlag {
|
enum GlobalFlag {
|
||||||
TRUE
|
TRUE
|
||||||
FALSE
|
FALSE
|
||||||
@ -417,6 +424,8 @@ GraphQL resolvers via the {@link Allow} decorator.
|
|||||||
@docsCategory common
|
@docsCategory common
|
||||||
"""
|
"""
|
||||||
enum Permission {
|
enum Permission {
|
||||||
|
Placeholder
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Authenticated means simply that the user is logged in
|
Authenticated means simply that the user is logged in
|
||||||
"""
|
"""
|
||||||
@ -438,44 +447,49 @@ enum Permission {
|
|||||||
Public
|
Public
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to create Catalog
|
Grants permission to update GlobalSettings
|
||||||
|
"""
|
||||||
|
UpdateGlobalSettings
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Products, Facets, Assets, Collections
|
||||||
"""
|
"""
|
||||||
CreateCatalog
|
CreateCatalog
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to read Catalog
|
Grants permission to read Products, Facets, Assets, Collections
|
||||||
"""
|
"""
|
||||||
ReadCatalog
|
ReadCatalog
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to update Catalog
|
Grants permission to update Products, Facets, Assets, Collections
|
||||||
"""
|
"""
|
||||||
UpdateCatalog
|
UpdateCatalog
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to delete Catalog
|
Grants permission to delete Products, Facets, Assets, Collections
|
||||||
"""
|
"""
|
||||||
DeleteCatalog
|
DeleteCatalog
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to create Customer
|
Grants permission to create PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings
|
||||||
"""
|
"""
|
||||||
CreateCustomer
|
CreateSettings
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to read Customer
|
Grants permission to read PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings
|
||||||
"""
|
"""
|
||||||
ReadCustomer
|
ReadSettings
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to update Customer
|
Grants permission to update PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings
|
||||||
"""
|
"""
|
||||||
UpdateCustomer
|
UpdateSettings
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to delete Customer
|
Grants permission to delete PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings
|
||||||
"""
|
"""
|
||||||
DeleteCustomer
|
DeleteSettings
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to create Administrator
|
Grants permission to create Administrator
|
||||||
@ -497,6 +511,146 @@ enum Permission {
|
|||||||
"""
|
"""
|
||||||
DeleteAdministrator
|
DeleteAdministrator
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Asset
|
||||||
|
"""
|
||||||
|
CreateAsset
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Asset
|
||||||
|
"""
|
||||||
|
ReadAsset
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Asset
|
||||||
|
"""
|
||||||
|
UpdateAsset
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Asset
|
||||||
|
"""
|
||||||
|
DeleteAsset
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Channel
|
||||||
|
"""
|
||||||
|
CreateChannel
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Channel
|
||||||
|
"""
|
||||||
|
ReadChannel
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Channel
|
||||||
|
"""
|
||||||
|
UpdateChannel
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Channel
|
||||||
|
"""
|
||||||
|
DeleteChannel
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Collection
|
||||||
|
"""
|
||||||
|
CreateCollection
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Collection
|
||||||
|
"""
|
||||||
|
ReadCollection
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Collection
|
||||||
|
"""
|
||||||
|
UpdateCollection
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Collection
|
||||||
|
"""
|
||||||
|
DeleteCollection
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Country
|
||||||
|
"""
|
||||||
|
CreateCountry
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Country
|
||||||
|
"""
|
||||||
|
ReadCountry
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Country
|
||||||
|
"""
|
||||||
|
UpdateCountry
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Country
|
||||||
|
"""
|
||||||
|
DeleteCountry
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Customer
|
||||||
|
"""
|
||||||
|
CreateCustomer
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Customer
|
||||||
|
"""
|
||||||
|
ReadCustomer
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Customer
|
||||||
|
"""
|
||||||
|
UpdateCustomer
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Customer
|
||||||
|
"""
|
||||||
|
DeleteCustomer
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create CustomerGroup
|
||||||
|
"""
|
||||||
|
CreateCustomerGroup
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read CustomerGroup
|
||||||
|
"""
|
||||||
|
ReadCustomerGroup
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update CustomerGroup
|
||||||
|
"""
|
||||||
|
UpdateCustomerGroup
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete CustomerGroup
|
||||||
|
"""
|
||||||
|
DeleteCustomerGroup
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Facet
|
||||||
|
"""
|
||||||
|
CreateFacet
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Facet
|
||||||
|
"""
|
||||||
|
ReadFacet
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Facet
|
||||||
|
"""
|
||||||
|
UpdateFacet
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Facet
|
||||||
|
"""
|
||||||
|
DeleteFacet
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to create Order
|
Grants permission to create Order
|
||||||
"""
|
"""
|
||||||
@ -517,6 +671,46 @@ enum Permission {
|
|||||||
"""
|
"""
|
||||||
DeleteOrder
|
DeleteOrder
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create PaymentMethod
|
||||||
|
"""
|
||||||
|
CreatePaymentMethod
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read PaymentMethod
|
||||||
|
"""
|
||||||
|
ReadPaymentMethod
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update PaymentMethod
|
||||||
|
"""
|
||||||
|
UpdatePaymentMethod
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete PaymentMethod
|
||||||
|
"""
|
||||||
|
DeletePaymentMethod
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Product
|
||||||
|
"""
|
||||||
|
CreateProduct
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Product
|
||||||
|
"""
|
||||||
|
ReadProduct
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Product
|
||||||
|
"""
|
||||||
|
UpdateProduct
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Product
|
||||||
|
"""
|
||||||
|
DeleteProduct
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to create Promotion
|
Grants permission to create Promotion
|
||||||
"""
|
"""
|
||||||
@ -538,24 +732,124 @@ enum Permission {
|
|||||||
DeletePromotion
|
DeletePromotion
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to create Settings
|
Grants permission to create ShippingMethod
|
||||||
"""
|
"""
|
||||||
CreateSettings
|
CreateShippingMethod
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to read Settings
|
Grants permission to read ShippingMethod
|
||||||
"""
|
"""
|
||||||
ReadSettings
|
ReadShippingMethod
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to update Settings
|
Grants permission to update ShippingMethod
|
||||||
"""
|
"""
|
||||||
UpdateSettings
|
UpdateShippingMethod
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Grants permission to delete Settings
|
Grants permission to delete ShippingMethod
|
||||||
"""
|
"""
|
||||||
DeleteSettings
|
DeleteShippingMethod
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Tag
|
||||||
|
"""
|
||||||
|
CreateTag
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Tag
|
||||||
|
"""
|
||||||
|
ReadTag
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Tag
|
||||||
|
"""
|
||||||
|
UpdateTag
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Tag
|
||||||
|
"""
|
||||||
|
DeleteTag
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create TaxCategory
|
||||||
|
"""
|
||||||
|
CreateTaxCategory
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read TaxCategory
|
||||||
|
"""
|
||||||
|
ReadTaxCategory
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update TaxCategory
|
||||||
|
"""
|
||||||
|
UpdateTaxCategory
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete TaxCategory
|
||||||
|
"""
|
||||||
|
DeleteTaxCategory
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create TaxRate
|
||||||
|
"""
|
||||||
|
CreateTaxRate
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read TaxRate
|
||||||
|
"""
|
||||||
|
ReadTaxRate
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update TaxRate
|
||||||
|
"""
|
||||||
|
UpdateTaxRate
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete TaxRate
|
||||||
|
"""
|
||||||
|
DeleteTaxRate
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create System
|
||||||
|
"""
|
||||||
|
CreateSystem
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read System
|
||||||
|
"""
|
||||||
|
ReadSystem
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update System
|
||||||
|
"""
|
||||||
|
UpdateSystem
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete System
|
||||||
|
"""
|
||||||
|
DeleteSystem
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to create Zone
|
||||||
|
"""
|
||||||
|
CreateZone
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to read Zone
|
||||||
|
"""
|
||||||
|
ReadZone
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to update Zone
|
||||||
|
"""
|
||||||
|
UpdateZone
|
||||||
|
|
||||||
|
"""
|
||||||
|
Grants permission to delete Zone
|
||||||
|
"""
|
||||||
|
DeleteZone
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SortOrder {
|
enum SortOrder {
|
||||||
@ -789,10 +1083,24 @@ input DateOperators {
|
|||||||
between: DateRange
|
between: DateRange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Used to construct boolean expressions for filtering search results
|
||||||
|
by FacetValue ID. Examples:
|
||||||
|
|
||||||
|
* ID=1 OR ID=2: `{ facetValueFilters: [{ or: [1,2] }] }`
|
||||||
|
* ID=1 AND ID=2: `{ facetValueFilters: [{ and: 1 }, { and: 2 }] }`
|
||||||
|
* ID=1 AND (ID=2 OR ID=3): `{ facetValueFilters: [{ and: 1 }, { or: [2,3] }] }`
|
||||||
|
"""
|
||||||
|
input FacetValueFilterInput {
|
||||||
|
and: ID
|
||||||
|
or: [ID!]
|
||||||
|
}
|
||||||
|
|
||||||
input SearchInput {
|
input SearchInput {
|
||||||
term: String
|
term: String
|
||||||
facetValueIds: [ID!]
|
facetValueIds: [ID!]
|
||||||
facetValueOperator: LogicalOperator
|
facetValueOperator: LogicalOperator
|
||||||
|
facetValueFilters: [FacetValueFilterInput!]
|
||||||
collectionId: ID
|
collectionId: ID
|
||||||
collectionSlug: String
|
collectionSlug: String
|
||||||
groupByProduct: Boolean
|
groupByProduct: Boolean
|
||||||
@ -857,6 +1165,7 @@ type ShippingMethodQuote {
|
|||||||
id: ID!
|
id: ID!
|
||||||
price: Int!
|
price: Int!
|
||||||
priceWithTax: Int!
|
priceWithTax: Int!
|
||||||
|
code: String!
|
||||||
name: String!
|
name: String!
|
||||||
description: String!
|
description: String!
|
||||||
|
|
||||||
@ -869,6 +1178,8 @@ type ShippingMethodQuote {
|
|||||||
type PaymentMethodQuote {
|
type PaymentMethodQuote {
|
||||||
id: ID!
|
id: ID!
|
||||||
code: String!
|
code: String!
|
||||||
|
name: String!
|
||||||
|
description: String!
|
||||||
isEligible: Boolean!
|
isEligible: Boolean!
|
||||||
eligibilityMessage: String
|
eligibilityMessage: String
|
||||||
}
|
}
|
||||||
@ -1817,6 +2128,13 @@ type CustomerGroup implements Node {
|
|||||||
customers(options: CustomerListOptions): CustomerList!
|
customers(options: CustomerListOptions): CustomerList!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input CustomerListOptions {
|
||||||
|
skip: Int
|
||||||
|
take: Int
|
||||||
|
sort: CustomerSortParameter
|
||||||
|
filter: CustomerFilterParameter
|
||||||
|
}
|
||||||
|
|
||||||
type Customer implements Node {
|
type Customer implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
createdAt: DateTime!
|
createdAt: DateTime!
|
||||||
@ -1922,6 +2240,13 @@ type HistoryEntryList implements PaginatedList {
|
|||||||
totalItems: Int!
|
totalItems: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input HistoryEntryListOptions {
|
||||||
|
skip: Int
|
||||||
|
take: Int
|
||||||
|
sort: HistoryEntrySortParameter
|
||||||
|
filter: HistoryEntryFilterParameter
|
||||||
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@description
|
@description
|
||||||
Languages in the form of a ISO 639-1 language code with optional
|
Languages in the form of a ISO 639-1 language code with optional
|
||||||
@ -2751,12 +3076,7 @@ type Order implements Node {
|
|||||||
methods.
|
methods.
|
||||||
"""
|
"""
|
||||||
surcharges: [Surcharge!]!
|
surcharges: [Surcharge!]!
|
||||||
|
discounts: [Discount!]!
|
||||||
"""
|
|
||||||
Order-level adjustments to the order total, such as discounts from promotions
|
|
||||||
"""
|
|
||||||
adjustments: [Adjustment!]! @deprecated(reason: "Use `discounts` instead")
|
|
||||||
discounts: [Adjustment!]!
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
An array of all coupon codes applied to the Order
|
An array of all coupon codes applied to the Order
|
||||||
@ -2857,7 +3177,15 @@ type ShippingLine {
|
|||||||
priceWithTax: Int!
|
priceWithTax: Int!
|
||||||
discountedPrice: Int!
|
discountedPrice: Int!
|
||||||
discountedPriceWithTax: Int!
|
discountedPriceWithTax: Int!
|
||||||
discounts: [Adjustment!]!
|
discounts: [Discount!]!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Discount {
|
||||||
|
adjustmentSource: String!
|
||||||
|
type: AdjustmentType!
|
||||||
|
description: String!
|
||||||
|
amount: Int!
|
||||||
|
amountWithTax: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderItem implements Node {
|
type OrderItem implements Node {
|
||||||
@ -2903,8 +3231,6 @@ type OrderItem implements Node {
|
|||||||
"""
|
"""
|
||||||
proratedUnitPriceWithTax: Int!
|
proratedUnitPriceWithTax: Int!
|
||||||
unitTax: Int!
|
unitTax: Int!
|
||||||
unitPriceIncludesTax: Boolean!
|
|
||||||
@deprecated(reason: "`unitPrice` is now always without tax")
|
|
||||||
taxRate: Float!
|
taxRate: Float!
|
||||||
adjustments: [Adjustment!]!
|
adjustments: [Adjustment!]!
|
||||||
taxLines: [TaxLine!]!
|
taxLines: [TaxLine!]!
|
||||||
@ -2967,7 +3293,6 @@ type OrderLine implements Node {
|
|||||||
proratedUnitPriceWithTax: Int!
|
proratedUnitPriceWithTax: Int!
|
||||||
quantity: Int!
|
quantity: Int!
|
||||||
items: [OrderItem!]!
|
items: [OrderItem!]!
|
||||||
totalPrice: Int! @deprecated(reason: "Use `linePriceWithTax` instead")
|
|
||||||
taxRate: Float!
|
taxRate: Float!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -3006,8 +3331,7 @@ type OrderLine implements Node {
|
|||||||
The total tax on this line
|
The total tax on this line
|
||||||
"""
|
"""
|
||||||
lineTax: Int!
|
lineTax: Int!
|
||||||
adjustments: [Adjustment!]! @deprecated(reason: "Use `discounts` instead")
|
discounts: [Discount!]!
|
||||||
discounts: [Adjustment!]!
|
|
||||||
taxLines: [TaxLine!]!
|
taxLines: [TaxLine!]!
|
||||||
order: Order!
|
order: Order!
|
||||||
customFields: JSON
|
customFields: JSON
|
||||||
@ -3137,13 +3461,9 @@ type SearchResult {
|
|||||||
slug: String!
|
slug: String!
|
||||||
productId: ID!
|
productId: ID!
|
||||||
productName: String!
|
productName: String!
|
||||||
productPreview: String!
|
|
||||||
@deprecated(reason: "Use `productAsset.preview` instead")
|
|
||||||
productAsset: SearchResultAsset
|
productAsset: SearchResultAsset
|
||||||
productVariantId: ID!
|
productVariantId: ID!
|
||||||
productVariantName: String!
|
productVariantName: String!
|
||||||
productVariantPreview: String!
|
|
||||||
@deprecated(reason: "Use `productVariantAsset.preview` instead")
|
|
||||||
productVariantAsset: SearchResultAsset
|
productVariantAsset: SearchResultAsset
|
||||||
price: SearchResultPrice!
|
price: SearchResultPrice!
|
||||||
priceWithTax: SearchResultPrice!
|
priceWithTax: SearchResultPrice!
|
||||||
@ -3229,8 +3549,6 @@ type ProductVariant implements Node {
|
|||||||
assets: [Asset!]!
|
assets: [Asset!]!
|
||||||
price: Int!
|
price: Int!
|
||||||
currencyCode: CurrencyCode!
|
currencyCode: CurrencyCode!
|
||||||
priceIncludesTax: Boolean!
|
|
||||||
@deprecated(reason: "price now always excludes tax")
|
|
||||||
priceWithTax: Int!
|
priceWithTax: Int!
|
||||||
stockLevel: String!
|
stockLevel: String!
|
||||||
taxRateApplied: TaxRate!
|
taxRateApplied: TaxRate!
|
||||||
@ -3238,7 +3556,7 @@ type ProductVariant implements Node {
|
|||||||
options: [ProductOption!]!
|
options: [ProductOption!]!
|
||||||
facetValues: [FacetValue!]!
|
facetValues: [FacetValue!]!
|
||||||
translations: [ProductVariantTranslation!]!
|
translations: [ProductVariantTranslation!]!
|
||||||
customFields: JSON
|
customFields: ProductVariantCustomFields
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProductVariantTranslation {
|
type ProductVariantTranslation {
|
||||||
@ -3550,6 +3868,10 @@ type NoActiveOrderError implements ErrorResult {
|
|||||||
message: String!
|
message: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input AuthenticationInput {
|
||||||
|
native: NativeAuthInput
|
||||||
|
}
|
||||||
|
|
||||||
input RegisterCustomerInput {
|
input RegisterCustomerInput {
|
||||||
emailAddress: String!
|
emailAddress: String!
|
||||||
title: String
|
title: String
|
||||||
@ -3567,6 +3889,10 @@ input UpdateCustomerInput {
|
|||||||
customFields: JSON
|
customFields: JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input UpdateOrderInput {
|
||||||
|
customFields: JSON
|
||||||
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Passed as input to the `addPaymentToOrder` mutation.
|
Passed as input to the `addPaymentToOrder` mutation.
|
||||||
"""
|
"""
|
||||||
@ -3584,6 +3910,27 @@ input PaymentInput {
|
|||||||
metadata: JSON!
|
metadata: JSON!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input CollectionListOptions {
|
||||||
|
skip: Int
|
||||||
|
take: Int
|
||||||
|
sort: CollectionSortParameter
|
||||||
|
filter: CollectionFilterParameter
|
||||||
|
}
|
||||||
|
|
||||||
|
input OrderListOptions {
|
||||||
|
skip: Int
|
||||||
|
take: Int
|
||||||
|
sort: OrderSortParameter
|
||||||
|
filter: OrderFilterParameter
|
||||||
|
}
|
||||||
|
|
||||||
|
input ProductListOptions {
|
||||||
|
skip: Int
|
||||||
|
take: Int
|
||||||
|
sort: ProductSortParameter
|
||||||
|
filter: ProductFilterParameter
|
||||||
|
}
|
||||||
|
|
||||||
union UpdateOrderItemsResult =
|
union UpdateOrderItemsResult =
|
||||||
Order
|
Order
|
||||||
| OrderModificationError
|
| OrderModificationError
|
||||||
@ -3675,48 +4022,6 @@ union AuthenticationResult =
|
|||||||
|
|
||||||
union ActiveOrderResult = Order | NoActiveOrderError
|
union ActiveOrderResult = Order | NoActiveOrderError
|
||||||
|
|
||||||
input CollectionListOptions {
|
|
||||||
skip: Int
|
|
||||||
take: Int
|
|
||||||
sort: CollectionSortParameter
|
|
||||||
filter: CollectionFilterParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
input ProductListOptions {
|
|
||||||
skip: Int
|
|
||||||
take: Int
|
|
||||||
sort: ProductSortParameter
|
|
||||||
filter: ProductFilterParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
input ProductVariantListOptions {
|
|
||||||
skip: Int
|
|
||||||
take: Int
|
|
||||||
sort: ProductVariantSortParameter
|
|
||||||
filter: ProductVariantFilterParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
input CustomerListOptions {
|
|
||||||
skip: Int
|
|
||||||
take: Int
|
|
||||||
sort: CustomerSortParameter
|
|
||||||
filter: CustomerFilterParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
input OrderListOptions {
|
|
||||||
skip: Int
|
|
||||||
take: Int
|
|
||||||
sort: OrderSortParameter
|
|
||||||
filter: OrderFilterParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
input HistoryEntryListOptions {
|
|
||||||
skip: Int
|
|
||||||
take: Int
|
|
||||||
sort: HistoryEntrySortParameter
|
|
||||||
filter: HistoryEntryFilterParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
input CollectionFilterParameter {
|
input CollectionFilterParameter {
|
||||||
createdAt: DateOperators
|
createdAt: DateOperators
|
||||||
updatedAt: DateOperators
|
updatedAt: DateOperators
|
||||||
@ -3763,9 +4068,9 @@ input ProductVariantFilterParameter {
|
|||||||
name: StringOperators
|
name: StringOperators
|
||||||
price: NumberOperators
|
price: NumberOperators
|
||||||
currencyCode: StringOperators
|
currencyCode: StringOperators
|
||||||
priceIncludesTax: BooleanOperators
|
|
||||||
priceWithTax: NumberOperators
|
priceWithTax: NumberOperators
|
||||||
stockLevel: StringOperators
|
stockLevel: StringOperators
|
||||||
|
discountPrice: NumberOperators
|
||||||
}
|
}
|
||||||
|
|
||||||
input ProductVariantSortParameter {
|
input ProductVariantSortParameter {
|
||||||
@ -3778,6 +4083,7 @@ input ProductVariantSortParameter {
|
|||||||
price: SortOrder
|
price: SortOrder
|
||||||
priceWithTax: SortOrder
|
priceWithTax: SortOrder
|
||||||
stockLevel: SortOrder
|
stockLevel: SortOrder
|
||||||
|
discountPrice: SortOrder
|
||||||
}
|
}
|
||||||
|
|
||||||
input CustomerFilterParameter {
|
input CustomerFilterParameter {
|
||||||
@ -3846,12 +4152,8 @@ input HistoryEntrySortParameter {
|
|||||||
updatedAt: SortOrder
|
updatedAt: SortOrder
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateOrderInput {
|
type ProductVariantCustomFields {
|
||||||
customFields: JSON
|
discountPrice: Int
|
||||||
}
|
|
||||||
|
|
||||||
input AuthenticationInput {
|
|
||||||
native: NativeAuthInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input NativeAuthInput {
|
input NativeAuthInput {
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
import * as Core from '@commerce/types'
|
|
||||||
|
|
||||||
export interface LineItem extends Core.LineItem {
|
|
||||||
options?: any[]
|
|
||||||
}
|
|
1
framework/vendure/types/cart.ts
Normal file
1
framework/vendure/types/cart.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/cart'
|
1
framework/vendure/types/checkout.ts
Normal file
1
framework/vendure/types/checkout.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/checkout'
|
1
framework/vendure/types/common.ts
Normal file
1
framework/vendure/types/common.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/common'
|
1
framework/vendure/types/customer.ts
Normal file
1
framework/vendure/types/customer.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/customer'
|
25
framework/vendure/types/index.ts
Normal file
25
framework/vendure/types/index.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import * as Cart from './cart'
|
||||||
|
import * as Checkout from './checkout'
|
||||||
|
import * as Common from './common'
|
||||||
|
import * as Customer from './customer'
|
||||||
|
import * as Login from './login'
|
||||||
|
import * as Logout from './logout'
|
||||||
|
import * as Page from './page'
|
||||||
|
import * as Product from './product'
|
||||||
|
import * as Signup from './signup'
|
||||||
|
import * as Site from './site'
|
||||||
|
import * as Wishlist from './wishlist'
|
||||||
|
|
||||||
|
export type {
|
||||||
|
Cart,
|
||||||
|
Checkout,
|
||||||
|
Common,
|
||||||
|
Customer,
|
||||||
|
Login,
|
||||||
|
Logout,
|
||||||
|
Page,
|
||||||
|
Product,
|
||||||
|
Signup,
|
||||||
|
Site,
|
||||||
|
Wishlist,
|
||||||
|
}
|
12
framework/vendure/types/login.ts
Normal file
12
framework/vendure/types/login.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as Core from '@commerce/types/login'
|
||||||
|
import type { LoginMutationVariables } from '../schema'
|
||||||
|
import { LoginBody, LoginTypes } from '@commerce/types/login'
|
||||||
|
|
||||||
|
export * from '@commerce/types/login'
|
||||||
|
|
||||||
|
export type LoginHook<T extends LoginTypes = LoginTypes> = {
|
||||||
|
data: null
|
||||||
|
actionInput: LoginBody
|
||||||
|
fetcherInput: LoginBody
|
||||||
|
body: T['body']
|
||||||
|
}
|
1
framework/vendure/types/logout.ts
Normal file
1
framework/vendure/types/logout.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/logout'
|
1
framework/vendure/types/page.ts
Normal file
1
framework/vendure/types/page.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/page'
|
1
framework/vendure/types/product.ts
Normal file
1
framework/vendure/types/product.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/product'
|
1
framework/vendure/types/signup.ts
Normal file
1
framework/vendure/types/signup.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/signup'
|
1
framework/vendure/types/site.ts
Normal file
1
framework/vendure/types/site.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/site'
|
1
framework/vendure/types/wishlist.ts
Normal file
1
framework/vendure/types/wishlist.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from '@commerce/types/wishlist'
|
@ -17,6 +17,8 @@ export const cartFragment = /* GraphQL */ `
|
|||||||
quantity
|
quantity
|
||||||
linePriceWithTax
|
linePriceWithTax
|
||||||
discountedLinePriceWithTax
|
discountedLinePriceWithTax
|
||||||
|
unitPriceWithTax
|
||||||
|
discountedUnitPriceWithTax
|
||||||
featuredAsset {
|
featuredAsset {
|
||||||
id
|
id
|
||||||
preview
|
preview
|
@ -1,4 +1,5 @@
|
|||||||
import { Cart, Product } from '@commerce/types'
|
import { Product } from '@commerce/types/product'
|
||||||
|
import { Cart } from '@commerce/types/cart'
|
||||||
import { CartFragment, SearchResultFragment } from '../schema'
|
import { CartFragment, SearchResultFragment } from '../schema'
|
||||||
|
|
||||||
export function normalizeSearchResult(item: SearchResultFragment): Product {
|
export function normalizeSearchResult(item: SearchResultFragment): Product {
|
||||||
@ -43,8 +44,8 @@ export function normalizeCart(order: CartFragment): Cart {
|
|||||||
id: l.productVariant.id,
|
id: l.productVariant.id,
|
||||||
name: l.productVariant.name,
|
name: l.productVariant.name,
|
||||||
sku: l.productVariant.sku,
|
sku: l.productVariant.sku,
|
||||||
price: l.discountedLinePriceWithTax / 100,
|
price: l.discountedUnitPriceWithTax / 100,
|
||||||
listPrice: l.linePriceWithTax / 100,
|
listPrice: l.unitPriceWithTax / 100,
|
||||||
image: {
|
image: {
|
||||||
url: l.featuredAsset?.preview + '?preset=thumb' || '',
|
url: l.featuredAsset?.preview + '?preset=thumb' || '',
|
||||||
},
|
},
|
@ -1,5 +1,5 @@
|
|||||||
// TODO: replace this hook and other wishlist hooks with a handler, or remove them if
|
// TODO: replace this hook and other wishlist hooks with a handler, or remove them if
|
||||||
// Shopify doesn't have a wishlist
|
// Vendure doesn't have a built-in wishlist
|
||||||
|
|
||||||
import { HookFetcher } from '@commerce/utils/types'
|
import { HookFetcher } from '@commerce/utils/types'
|
||||||
import { Product } from '../schema'
|
import { Product } from '../schema'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user