mirror of
https://github.com/vercel/commerce.git
synced 2025-05-14 21:47:51 +00:00
mocked nonproduct pages
This commit is contained in:
parent
38ff03aad6
commit
724f2bbcc0
@ -1,15 +1,13 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import {
|
import {
|
||||||
mockMoney,
|
|
||||||
mockImage,
|
|
||||||
mockShopifyProduct,
|
mockShopifyProduct,
|
||||||
mockCartItem,
|
mockCartItem,
|
||||||
mockShopifyCart,
|
mockShopifyCart,
|
||||||
winterCollection,
|
winterCollection,
|
||||||
summerCollection,
|
summerCollection,
|
||||||
europeCollection,
|
europeCollection,
|
||||||
mockPage,
|
collections,
|
||||||
collections
|
pages
|
||||||
} from './mock';
|
} from './mock';
|
||||||
import {
|
import {
|
||||||
Cart,
|
Cart,
|
||||||
@ -161,20 +159,28 @@ export const getMenu = async (handle: string): Promise<Menu[]> => {
|
|||||||
menu: {
|
menu: {
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
title: 'All',
|
title: 'Home',
|
||||||
path: '/'
|
path: '/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Summer',
|
title: 'About',
|
||||||
path: '/search/summer-collection'
|
path: '/about'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Winter',
|
title: 'Terms & Conditions',
|
||||||
path: '/search/winter-collection'
|
path: '/tc'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Europe',
|
title: 'Shipping & Return Policy',
|
||||||
path: '/search/europe-collection'
|
path: '/sr'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Privacy Policy',
|
||||||
|
path: '/pp'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'FAQ',
|
||||||
|
path: '/faq'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -184,18 +190,13 @@ export const getMenu = async (handle: string): Promise<Menu[]> => {
|
|||||||
|
|
||||||
export const getPage = async (handle: string): Promise<Page> => {
|
export const getPage = async (handle: string): Promise<Page> => {
|
||||||
const res = mockFetchResponse({
|
const res = mockFetchResponse({
|
||||||
pageByHandle: mockPage
|
pageByHandle: pages.find((page) => page.handle === handle)
|
||||||
});
|
});
|
||||||
return res.body.data.pageByHandle;
|
return res.body.data.pageByHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPages = async (): Promise<Page[]> => {
|
export const getPages = async (): Promise<Page[]> => {
|
||||||
const res = mockFetchResponse({
|
return pages;
|
||||||
pages: {
|
|
||||||
edges: [{ node: mockPage }]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return removeEdgesAndNodes(res.body.data.pages);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getProduct = async (handle: string): Promise<Product | undefined> => {
|
export const getProduct = async (handle: string): Promise<Product | undefined> => {
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
// Mock data for the defined types
|
// Mock data for the defined types
|
||||||
|
|
||||||
const { adventureProducts } = require('./adventures');
|
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];
|
export const mockShopifyProduct = adventureProducts[0];
|
||||||
|
|
||||||
@ -49,7 +38,7 @@ export const mockCartItem = {
|
|||||||
},
|
},
|
||||||
merchandise: {
|
merchandise: {
|
||||||
id: 'merchandise1',
|
id: 'merchandise1',
|
||||||
title: 'WKDN Adventure',
|
title: 'WKND Adventure',
|
||||||
selectedOptions: [
|
selectedOptions: [
|
||||||
{
|
{
|
||||||
name: 'Duration',
|
name: 'Duration',
|
||||||
@ -114,34 +103,76 @@ export const europeCollection = {
|
|||||||
updatedAt: '2023-08-10T00:00:00Z'
|
updatedAt: '2023-08-10T00:00:00Z'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockPage = {
|
export const tcPage = {
|
||||||
id: 'page1',
|
id: 'tc',
|
||||||
title: 'Sample Page',
|
title: 'Terms & Conditions',
|
||||||
handle: 'sample-page',
|
handle: 'tc',
|
||||||
body: 'This is a sample page.',
|
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
||||||
bodySummary: 'Sample summary.',
|
bodySummary: 'Summary',
|
||||||
seo: {
|
seo: {
|
||||||
title: 'Sample Page',
|
title: 'Terms & Conditions Page',
|
||||||
description: 'This is a sample page.'
|
description: 'This is a sample page.'
|
||||||
},
|
},
|
||||||
createdAt: '2023-08-01T00:00:00Z',
|
createdAt: '2023-08-01T00:00:00Z',
|
||||||
updatedAt: '2023-08-10T00: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];
|
export const collections = [winterCollection, summerCollection, europeCollection];
|
||||||
//
|
|
||||||
// module.exports = {
|
|
||||||
// mockMoney,
|
|
||||||
// mockImage,
|
|
||||||
// mockProductOption,
|
|
||||||
// mockProductVariant,
|
|
||||||
// mockShopifyProduct,
|
|
||||||
// mockCartItem,
|
|
||||||
// mockShopifyCart,
|
|
||||||
// winterCollection: winterCollection,
|
|
||||||
// summerCollection: summerCollection,
|
|
||||||
// europeCollection: europeCollection,
|
|
||||||
// mockPage
|
|
||||||
// };
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user