diff --git a/framework/shopify/auth/use-login.tsx b/framework/shopify/auth/use-login.tsx index 2143907d8..32dd91920 100644 --- a/framework/shopify/auth/use-login.tsx +++ b/framework/shopify/auth/use-login.tsx @@ -15,8 +15,6 @@ import { setCustomerToken } from '@framework/utils' export default useLogin as UseLogin const getErrorMessage = ({ code, message }: CustomerUserError) => { - console.log(code) - switch (code) { case 'UNIDENTIFIED_CUSTOMER': message = 'Cannot find an account that matches the provided credentials' diff --git a/framework/shopify/common/get-all-pages.ts b/framework/shopify/common/get-all-pages.ts index 0be05ee47..6f06185e2 100644 --- a/framework/shopify/common/get-all-pages.ts +++ b/framework/shopify/common/get-all-pages.ts @@ -25,14 +25,12 @@ const getAllPages = async (options?: { }): Promise => { let { config, variables = { first: 250 } } = options ?? {} config = getConfig(config) - const { data } = await config.fetch(getAllPagesQuery, { variables }) - const edges = data.pages?.edges - const pages = edges?.map( - ({ node: { title: name, handle: url, ...node } }: PageEdge) => ({ + const pages = data.pages?.edges?.map( + ({ node: { title: name, handle, ...node } }: PageEdge) => ({ ...node, - url, + url: `/${handle}`, name, }) ) diff --git a/framework/shopify/common/get-page.ts b/framework/shopify/common/get-page.ts index 2a52c02d5..6016c8c9a 100644 --- a/framework/shopify/common/get-page.ts +++ b/framework/shopify/common/get-page.ts @@ -22,7 +22,7 @@ const getPage = async (options: { variables, }) - const page = data.pageByHandle + const { pageByHandle: page } = data return { page: page diff --git a/framework/shopify/next.config.js b/framework/shopify/next.config.js index 0f9bc31ff..fa80f3be2 100644 --- a/framework/shopify/next.config.js +++ b/framework/shopify/next.config.js @@ -8,4 +8,7 @@ module.exports = { images: { domains: ['cdn.shopify.com'], }, + typescript: { + ignoreBuildErrors: true, + }, } diff --git a/framework/shopify/product/get-product.ts b/framework/shopify/product/get-product.ts index abb7834a6..1f00288c7 100644 --- a/framework/shopify/product/get-product.ts +++ b/framework/shopify/product/get-product.ts @@ -1,10 +1,6 @@ import { GraphQLFetcherResult } from '@commerce/api' import { getConfig, ShopifyConfig } from '../api' -import { Product } from '../schema' -import getProductQuery from '../utils/queries/get-product-query' -import { normalizeProduct } from '@framework/utils/normalize' - -export type ProductNode = Product +import { normalizeProduct, getProductQuery } from '../utils' type Variables = { slug: string diff --git a/framework/shopify/utils/normalize.ts b/framework/shopify/utils/normalize.ts index 7c3464f44..1eee9f336 100644 --- a/framework/shopify/utils/normalize.ts +++ b/framework/shopify/utils/normalize.ts @@ -41,7 +41,6 @@ const normalizeProductImages = ({ edges }: ImageConnection) => })) const normalizeProductVariants = ({ edges }: ProductVariantConnection) => { - console.log(edges) return edges?.map(({ node: { id, selectedOptions } }) => ({ id, options: selectedOptions.map(({ name, value }: SelectedOption) => diff --git a/framework/shopify/utils/queries/get-all-pages-query.ts b/framework/shopify/utils/queries/get-all-pages-query.ts index 7f979dd24..e3aee1f10 100644 --- a/framework/shopify/utils/queries/get-all-pages-query.ts +++ b/framework/shopify/utils/queries/get-all-pages-query.ts @@ -1,5 +1,5 @@ export const getAllPagesQuery = /* GraphQL */ ` - query($first: Int!) { + query getAllPages($first: Int = 250) { pages(first: $first) { edges { node { diff --git a/framework/shopify/utils/queries/get-all-products-paths-query.ts b/framework/shopify/utils/queries/get-all-products-paths-query.ts index b8fe23b5b..56298c204 100644 --- a/framework/shopify/utils/queries/get-all-products-paths-query.ts +++ b/framework/shopify/utils/queries/get-all-products-paths-query.ts @@ -1,5 +1,5 @@ const getAllProductsPathsQuery = /* GraphQL */ ` - query getAllProductPaths($first: Int!, $cursor: String) { + query getAllProductPaths($first: Int = 250, $cursor: String) { products(first: $first, after: $cursor) { pageInfo { hasNextPage diff --git a/framework/shopify/utils/queries/get-page-query.ts b/framework/shopify/utils/queries/get-page-query.ts index 01db22e43..dcafdc30d 100644 --- a/framework/shopify/utils/queries/get-page-query.ts +++ b/framework/shopify/utils/queries/get-page-query.ts @@ -1,15 +1,12 @@ export const getPageQuery = /* GraphQL */ ` - query($first: Int!) { - pages(first: $first) { - edges { - node { - id - title - handle - body - url - } - } + query getPageBySlug($slug: String!) { + pageByHandle(handle: $slug) { + id + title + handle + body + bodySummary + url } } ` diff --git a/framework/shopify/utils/queries/index.ts b/framework/shopify/utils/queries/index.ts index 4f10d7b65..e19be9c8c 100644 --- a/framework/shopify/utils/queries/index.ts +++ b/framework/shopify/utils/queries/index.ts @@ -1,5 +1,5 @@ export { default as getSiteCollectionsQuery } from './get-all-collections-query' -export { default as getProductQuery } from './get-all-products-paths-query' +export { default as getProductQuery } from './get-product-query' export { default as getAllProductsQuery } from './get-all-products-query' export { default as getAllProductsPathtsQuery } from './get-all-products-paths-query' export { default as getAllProductVendors } from './get-all-product-vendors-query'