diff --git a/lib/bigcommerce/api/operations/get-all-products.ts b/lib/bigcommerce/api/operations/get-all-products.ts index 5ba9c008f..cf761db87 100644 --- a/lib/bigcommerce/api/operations/get-all-products.ts +++ b/lib/bigcommerce/api/operations/get-all-products.ts @@ -4,7 +4,12 @@ import type { } from 'lib/bigcommerce/schema'; import type { RecursivePartial, RecursiveRequired } from '../utils/types'; import { productInfoFragment } from '../fragments/product'; -import { getConfig, Images, ProductImageVariables } from '..'; +import { + BigcommerceConfig, + getConfig, + Images, + ProductImageVariables, +} from '..'; export const getAllProductsQuery = /* GraphQL */ ` query getAllProducts( @@ -49,21 +54,24 @@ export type ProductVariables = Images & async function getAllProducts(opts?: { query?: string; variables?: ProductVariables; + config?: BigcommerceConfig; }): Promise>; async function getAllProducts(opts: { query: string; variables?: V; + config?: BigcommerceConfig; }): Promise>; async function getAllProducts({ query = getAllProductsQuery, variables: vars, + config = getConfig(), }: { query?: string; variables?: ProductVariables; + config?: BigcommerceConfig; } = {}): Promise> { - const config = getConfig(); const variables: GetAllProductsQueryVariables = { ...config.imageVariables, ...vars, diff --git a/lib/bigcommerce/api/operations/get-product.ts b/lib/bigcommerce/api/operations/get-product.ts index 5761978c8..c548f3873 100644 --- a/lib/bigcommerce/api/operations/get-product.ts +++ b/lib/bigcommerce/api/operations/get-product.ts @@ -4,7 +4,12 @@ import type { } from 'lib/bigcommerce/schema'; import type { RecursivePartial, RecursiveRequired } from '../utils/types'; import { productInfoFragment } from '../fragments/product'; -import { getConfig, Images, ProductImageVariables } from '..'; +import { + BigcommerceConfig, + getConfig, + Images, + ProductImageVariables, +} from '..'; export const getProductQuery = /* GraphQL */ ` query getProduct( @@ -45,21 +50,24 @@ export type ProductVariables = Images & async function getProduct(opts: { query?: string; variables: ProductVariables; + config?: BigcommerceConfig; }): Promise>; async function getProduct(opts: { query: string; variables: V; + config?: BigcommerceConfig; }): Promise>; async function getProduct({ query = getProductQuery, variables: vars, + config = getConfig(), }: { query?: string; variables: ProductVariables; + config?: BigcommerceConfig; }): Promise> { - const config = getConfig(); const variables: GetProductQueryVariables = { ...config.imageVariables, ...vars,