diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index 95beafe9a..9f57fdb44 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -1,15 +1,13 @@ // @ts-ignore import { - mockMoney, - mockImage, mockShopifyProduct, mockCartItem, mockShopifyCart, winterCollection, summerCollection, europeCollection, - mockPage, - collections + collections, + pages } from './mock'; import { Cart, @@ -161,20 +159,28 @@ export const getMenu = async (handle: string): Promise => { menu: { items: [ { - title: 'All', + title: 'Home', path: '/' }, { - title: 'Summer', - path: '/search/summer-collection' + title: 'About', + path: '/about' }, { - title: 'Winter', - path: '/search/winter-collection' + title: 'Terms & Conditions', + path: '/tc' }, { - title: 'Europe', - path: '/search/europe-collection' + title: 'Shipping & Return Policy', + path: '/sr' + }, + { + title: 'Privacy Policy', + path: '/pp' + }, + { + title: 'FAQ', + path: '/faq' } ] } @@ -184,18 +190,13 @@ export const getMenu = async (handle: string): Promise => { export const getPage = async (handle: string): Promise => { const res = mockFetchResponse({ - pageByHandle: mockPage + pageByHandle: pages.find((page) => page.handle === handle) }); return res.body.data.pageByHandle; }; export const getPages = async (): Promise => { - const res = mockFetchResponse({ - pages: { - edges: [{ node: mockPage }] - } - }); - return removeEdgesAndNodes(res.body.data.pages); + return pages; }; export const getProduct = async (handle: string): Promise => { diff --git a/lib/shopify/mock.js b/lib/shopify/mock.js index d21cf3e0c..2bff98197 100644 --- a/lib/shopify/mock.js +++ b/lib/shopify/mock.js @@ -1,17 +1,6 @@ // Mock data for the defined types const { adventureProducts } = require('./adventures'); -export const mockMoney = { - amount: '100.00', - currencyCode: 'USD' -}; - -export const mockImage = { - url: 'https://ssc-sparkle.vercel.app/_next/image?url=https%3A%2F%2Fpublish-p64257-e147834-cmstg.adobeaemcloud.com%2Fcontent%2Fdam%2Faem-demo-assets%2Fen%2Fadventures%2Fcycling-tuscany%2FAdobeStock_261097343.jpeg&w=2048&q=75', - altText: 'Sample Image', - width: 500, - height: 500 -}; export const mockShopifyProduct = adventureProducts[0]; @@ -49,7 +38,7 @@ export const mockCartItem = { }, merchandise: { id: 'merchandise1', - title: 'WKDN Adventure', + title: 'WKND Adventure', selectedOptions: [ { name: 'Duration', @@ -114,34 +103,76 @@ export const europeCollection = { updatedAt: '2023-08-10T00:00:00Z' }; -export const mockPage = { - id: 'page1', - title: 'Sample Page', - handle: 'sample-page', - body: 'This is a sample page.', - bodySummary: 'Sample summary.', +export const tcPage = { + id: 'tc', + title: 'Terms & Conditions', + handle: 'tc', + body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', + bodySummary: 'Summary', seo: { - title: 'Sample Page', + title: 'Terms & Conditions Page', description: 'This is a sample page.' }, createdAt: '2023-08-01T00:00:00Z', updatedAt: '2023-08-10T00:00:00Z' }; -// Exporting the mock data +export const aboutPage = { + id: 'about', + title: 'About', + handle: 'about', + body: 'This website is built with Next.js Commerce, which is a ecommerce template for creating a headless storefront. ', + bodySummary: 'Summary of about page', + seo: { + title: 'About Page', + description: 'This is a sample page.' + }, + createdAt: '2023-08-01T00:00:00Z', + updatedAt: '2023-08-10T00:00:00Z' +}; + +export const faqPage = { + id: 'faq', + title: 'FAQ', + handle: 'faq', + body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', + bodySummary: 'Summary of about page', + seo: { + title: 'About Page', + description: 'This is a sample page.' + }, + createdAt: '2023-08-01T00:00:00Z', + updatedAt: '2023-08-10T00:00:00Z' +}; + +export const ppPage = { + id: 'pp', + title: 'Privacy Policy', + handle: 'pp', + body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', + bodySummary: 'Summary of about page', + seo: { + title: 'Privacy Page', + description: 'This is a sample page.' + }, + createdAt: '2023-08-01T00:00:00Z', + updatedAt: '2023-08-10T00:00:00Z' +}; + +export const srPage = { + id: 'sr', + title: 'Shipping & Return Policy', + handle: 'sr', + body: 'Shipping & Return Policy Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', + bodySummary: 'Summary of about page', + seo: { + title: 'Privacy Page', + description: 'This is a sample page.' + }, + createdAt: '2023-08-01T00:00:00Z', + updatedAt: '2023-08-10T00:00:00Z' +}; + +export const pages = [tcPage, aboutPage, ppPage, faqPage, srPage]; export const collections = [winterCollection, summerCollection, europeCollection]; -// -// module.exports = { -// mockMoney, -// mockImage, -// mockProductOption, -// mockProductVariant, -// mockShopifyProduct, -// mockCartItem, -// mockShopifyCart, -// winterCollection: winterCollection, -// summerCollection: summerCollection, -// europeCollection: europeCollection, -// mockPage -// };