diff --git a/README.md b/README.md index a5dca89ff..09b773f3a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ A Next.js 14 and App Router-ready ecommerce template featuring: Vercel will only be actively maintaining a Shopify version [as outlined in our vision and strategy for Next.js Commerce](https://github.com/vercel/commerce/pull/966). -Vercel is happy to partner and work with any commerce provider to help them get a similar template up and running and listed below. Alternative providers should be able to fork this repository and swap out the `lib/shopify` file with their own implementation while leaving the rest of the template mostly unchanged. +Vercel is happy to partner and work with any commerce provider to help them get a similar template up and running and listed below. Alternative providers should be able to fork this repository and swap out the `lib/cms` file with their own implementation while leaving the rest of the template mostly unchanged. - Shopify (this repository) - [BigCommerce](https://github.com/bigcommerce/nextjs-commerce) ([Demo](https://next-commerce-v2.vercel.app/)) diff --git a/app/[page]/page.tsx b/app/[page]/page.tsx index 02aaf1366..e65ec4f14 100644 --- a/app/[page]/page.tsx +++ b/app/[page]/page.tsx @@ -1,7 +1,7 @@ import type { Metadata } from 'next'; import Prose from 'components/prose'; -import { getPage } from 'lib/shopify'; +import { getPage } from 'lib/cms'; import { notFound } from 'next/navigation'; export async function generateMetadata({ diff --git a/app/api/checkout/route.ts b/app/api/checkout/route.ts index 3b034fced..7b4ceabd9 100644 --- a/app/api/checkout/route.ts +++ b/app/api/checkout/route.ts @@ -1,4 +1,4 @@ -import { ajax } from 'lib/shopify/ajax'; +import { ajax } from 'lib/cms/ajax'; import { cookies } from 'next/headers'; import { NextResponse } from 'next/server'; diff --git a/app/product/[handle]/page.tsx b/app/product/[handle]/page.tsx index 87d67b582..15a1698e9 100644 --- a/app/product/[handle]/page.tsx +++ b/app/product/[handle]/page.tsx @@ -5,8 +5,8 @@ import { GridTileImage } from 'components/grid/tile'; import Footer from 'components/layout/footer'; import { Gallery } from 'components/product/gallery'; import { ProductDescription } from 'components/product/product-description'; -import { getProduct, getProductRecommendations } from 'lib/shopify'; -import { Image } from 'lib/shopify/types'; +import { getProduct, getProductRecommendations } from 'lib/cms'; +import { Image } from 'lib/cms/types'; import Link from 'next/link'; import { Suspense } from 'react'; diff --git a/app/search/[collection]/opengraph-image.tsx b/app/search/[collection]/opengraph-image.tsx index 9eb9c47f7..296255eec 100644 --- a/app/search/[collection]/opengraph-image.tsx +++ b/app/search/[collection]/opengraph-image.tsx @@ -1,5 +1,5 @@ import OpengraphImage from 'components/opengraph-image'; -import { getCollection } from 'lib/shopify'; +import { getCollection } from 'lib/cms'; export const runtime = 'edge'; diff --git a/app/search/[collection]/page.tsx b/app/search/[collection]/page.tsx index f3a7a0222..529a2967c 100644 --- a/app/search/[collection]/page.tsx +++ b/app/search/[collection]/page.tsx @@ -1,4 +1,4 @@ -import { getCollection, getCollectionProducts } from 'lib/shopify'; +import { getCollection, getCollectionProducts } from 'lib/cms'; import { Metadata } from 'next'; import { notFound } from 'next/navigation'; diff --git a/app/search/page.tsx b/app/search/page.tsx index eb839b1f6..288d32576 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -1,7 +1,7 @@ import Grid from 'components/grid'; import ProductGridItems from 'components/layout/product-grid-items'; import { DEFAULT_SORT, SORTING } from 'lib/constants'; -import { getProducts } from 'lib/shopify'; +import { getProducts } from 'lib/cms'; export const metadata = { title: 'Search', diff --git a/app/sitemap.ts b/app/sitemap.ts index 8f31ee94f..87179d51f 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -1,4 +1,4 @@ -import { getCollections, getPages, getProducts } from 'lib/shopify'; +import { getCollections, getPages, getProducts } from 'lib/cms'; import { validateEnvironmentVariables } from 'lib/utils'; import { MetadataRoute } from 'next'; diff --git a/components/carousel.tsx b/components/carousel.tsx index 526b5d9c7..3ccf83fca 100644 --- a/components/carousel.tsx +++ b/components/carousel.tsx @@ -1,4 +1,4 @@ -import { getCollectionProducts } from 'lib/shopify'; +import { getCollectionProducts } from 'lib/cms'; import Link from 'next/link'; import { GridTileImage } from './grid/tile'; diff --git a/components/cart/actions.ts b/components/cart/actions.ts index fa2c34d37..1634a5f08 100644 --- a/components/cart/actions.ts +++ b/components/cart/actions.ts @@ -1,7 +1,7 @@ 'use server'; import { TAGS } from 'lib/constants'; -import { addToCart, createCart, getCart, removeFromCart, updateCart } from 'lib/shopify'; +import { addToCart, createCart, getCart, removeFromCart, updateCart } from 'lib/cms'; import { revalidateTag } from 'next/cache'; import { cookies } from 'next/headers'; diff --git a/components/cart/add-to-cart.tsx b/components/cart/add-to-cart.tsx index 35329b03d..d995114ef 100644 --- a/components/cart/add-to-cart.tsx +++ b/components/cart/add-to-cart.tsx @@ -4,7 +4,7 @@ import { PlusIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import { addItem } from 'components/cart/actions'; import LoadingDots from 'components/loading-dots'; -import { ProductVariant } from 'lib/shopify/types'; +import { ProductVariant } from 'lib/cms/types'; import { useSearchParams } from 'next/navigation'; import { useFormState, useFormStatus } from 'react-dom'; diff --git a/components/cart/delete-item-button.tsx b/components/cart/delete-item-button.tsx index 814e1f389..42d0d7123 100644 --- a/components/cart/delete-item-button.tsx +++ b/components/cart/delete-item-button.tsx @@ -4,7 +4,7 @@ import { XMarkIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import { removeItem } from 'components/cart/actions'; import LoadingDots from 'components/loading-dots'; -import type { CartItem } from 'lib/shopify/types'; +import type { CartItem } from 'lib/cms/types'; import { useFormState, useFormStatus } from 'react-dom'; function SubmitButton() { diff --git a/components/cart/edit-item-quantity-button.tsx b/components/cart/edit-item-quantity-button.tsx index b743ab704..6d14575b6 100644 --- a/components/cart/edit-item-quantity-button.tsx +++ b/components/cart/edit-item-quantity-button.tsx @@ -4,7 +4,7 @@ import { MinusIcon, PlusIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import { updateItemQuantity } from 'components/cart/actions'; import LoadingDots from 'components/loading-dots'; -import type { CartItem } from 'lib/shopify/types'; +import type { CartItem } from 'lib/cms/types'; import { useFormState, useFormStatus } from 'react-dom'; function SubmitButton({ type }: { type: 'plus' | 'minus' }) { diff --git a/components/cart/index.tsx b/components/cart/index.tsx index 3e250ba93..80c998de9 100644 --- a/components/cart/index.tsx +++ b/components/cart/index.tsx @@ -1,4 +1,4 @@ -import { getCart } from 'lib/shopify'; +import { getCart } from 'lib/cms'; import { cookies } from 'next/headers'; import CartModal from './modal'; diff --git a/components/cart/modal.tsx b/components/cart/modal.tsx index a30818940..a3493f119 100644 --- a/components/cart/modal.tsx +++ b/components/cart/modal.tsx @@ -4,7 +4,7 @@ import { Dialog, Transition } from '@headlessui/react'; import { ShoppingCartIcon } from '@heroicons/react/24/outline'; import Price from 'components/price'; import { DEFAULT_OPTION } from 'lib/constants'; -import type { Cart } from 'lib/shopify/types'; +import type { Cart } from 'lib/cms/types'; import { createUrl } from 'lib/utils'; import Image from 'next/image'; import Link from 'next/link'; diff --git a/components/grid/three-items.tsx b/components/grid/three-items.tsx index ebd317e19..630c01088 100644 --- a/components/grid/three-items.tsx +++ b/components/grid/three-items.tsx @@ -1,6 +1,6 @@ import { GridTileImage } from 'components/grid/tile'; -import { getCollectionProducts } from 'lib/shopify'; -import type { Product } from 'lib/shopify/types'; +import { getCollectionProducts } from 'lib/cms'; +import type { Product } from 'lib/cms/types'; import Link from 'next/link'; function ThreeItemGridItem({ diff --git a/components/layout/footer-menu.tsx b/components/layout/footer-menu.tsx index 444406294..c72fe51e4 100644 --- a/components/layout/footer-menu.tsx +++ b/components/layout/footer-menu.tsx @@ -1,7 +1,7 @@ 'use client'; import clsx from 'clsx'; -import { Menu } from 'lib/shopify/types'; +import { Menu } from 'lib/cms/types'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useEffect, useState } from 'react'; diff --git a/components/layout/footer.tsx b/components/layout/footer.tsx index ef1b1e8c7..feb74e7f3 100644 --- a/components/layout/footer.tsx +++ b/components/layout/footer.tsx @@ -2,7 +2,7 @@ import Link from 'next/link'; import FooterMenu from 'components/layout/footer-menu'; import LogoSquare from 'components/logo-square'; -import { getMenu } from 'lib/shopify'; +import { getMenu } from 'lib/cms'; import { Suspense } from 'react'; const { COMPANY_NAME, SITE_NAME } = process.env; diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx index f7d2f6af9..e3030d970 100644 --- a/components/layout/navbar/index.tsx +++ b/components/layout/navbar/index.tsx @@ -1,8 +1,8 @@ import Cart from 'components/cart'; import OpenCart from 'components/cart/open-cart'; import LogoSquare from 'components/logo-square'; -import { getMenu } from 'lib/shopify'; -import { Menu } from 'lib/shopify/types'; +import { getMenu } from 'lib/cms'; +import { Menu } from 'lib/cms/types'; import Link from 'next/link'; import { Suspense } from 'react'; import MobileMenu from './mobile-menu'; diff --git a/components/layout/navbar/mobile-menu.tsx b/components/layout/navbar/mobile-menu.tsx index 9091f93d3..d2e715145 100644 --- a/components/layout/navbar/mobile-menu.tsx +++ b/components/layout/navbar/mobile-menu.tsx @@ -6,7 +6,7 @@ import { usePathname, useSearchParams } from 'next/navigation'; import { Fragment, Suspense, useEffect, useState } from 'react'; import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline'; -import { Menu } from 'lib/shopify/types'; +import { Menu } from 'lib/cms/types'; import Search, { SearchSkeleton } from './search'; export default function MobileMenu({ menu }: { menu: Menu[] }) { diff --git a/components/layout/product-grid-items.tsx b/components/layout/product-grid-items.tsx index ea8a5ebf7..30956eef8 100644 --- a/components/layout/product-grid-items.tsx +++ b/components/layout/product-grid-items.tsx @@ -1,6 +1,6 @@ import Grid from 'components/grid'; import { GridTileImage } from 'components/grid/tile'; -import { Product } from 'lib/shopify/types'; +import { Product } from 'lib/cms/types'; import Link from 'next/link'; export default function ProductGridItems({ products }: { products: Product[] }) { diff --git a/components/layout/search/collections.tsx b/components/layout/search/collections.tsx index c45833a39..0bd1c2298 100644 --- a/components/layout/search/collections.tsx +++ b/components/layout/search/collections.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import { Suspense } from 'react'; -import { getCollections } from 'lib/shopify'; +import { getCollections } from 'lib/cms'; import FilterList from './filter'; async function CollectionList() { diff --git a/components/product/product-description.tsx b/components/product/product-description.tsx index 10232ae3d..cc421be03 100644 --- a/components/product/product-description.tsx +++ b/components/product/product-description.tsx @@ -1,7 +1,7 @@ import { AddToCart } from 'components/cart/add-to-cart'; import Price from 'components/price'; import Prose from 'components/prose'; -import { Product } from 'lib/shopify/types'; +import { Product } from 'lib/cms/types'; import { Suspense } from 'react'; import { VariantSelector } from './variant-selector'; diff --git a/components/product/variant-selector.tsx b/components/product/variant-selector.tsx index 9d47eb5c8..f3c8d2455 100644 --- a/components/product/variant-selector.tsx +++ b/components/product/variant-selector.tsx @@ -1,7 +1,7 @@ 'use client'; import clsx from 'clsx'; -import { ProductOption, ProductVariant } from 'lib/shopify/types'; +import { ProductOption, ProductVariant } from 'lib/cms/types'; import { createUrl } from 'lib/utils'; import { usePathname, useRouter, useSearchParams } from 'next/navigation'; diff --git a/lib/shopify/ajax.ts b/lib/cms/ajax.ts similarity index 100% rename from lib/shopify/ajax.ts rename to lib/cms/ajax.ts diff --git a/lib/shopify/index.ts b/lib/cms/index.ts similarity index 98% rename from lib/shopify/index.ts rename to lib/cms/index.ts index f222c53df..5a6e40cbb 100644 --- a/lib/shopify/index.ts +++ b/lib/cms/index.ts @@ -1,12 +1,12 @@ -import { AjaxError } from 'lib/shopify/ajax'; -import { Payload, Where } from 'lib/shopify/payload'; +import { AjaxError } from 'lib/cms/ajax'; +import { Payload, Where } from 'lib/cms/payload'; import { Cart as PayloadCart, Category as PayloadCategory, Media as PayloadMedia, Option as PayloadOption, Product as PayloadProduct -} from 'lib/shopify/payload-types'; +} from 'lib/cms/payload-types'; import { Cart, CartItem, diff --git a/lib/shopify/payload-types.ts b/lib/cms/payload-types.ts similarity index 100% rename from lib/shopify/payload-types.ts rename to lib/cms/payload-types.ts diff --git a/lib/shopify/payload.ts b/lib/cms/payload.ts similarity index 95% rename from lib/shopify/payload.ts rename to lib/cms/payload.ts index 45981996a..4d83b2e15 100644 --- a/lib/shopify/payload.ts +++ b/lib/cms/payload.ts @@ -1,5 +1,5 @@ -import { ajax } from 'lib/shopify/ajax'; -import { Config } from 'lib/shopify/payload-types'; +import { ajax } from 'lib/cms/ajax'; +import { Config } from 'lib/cms/payload-types'; import qs from 'qs'; type Collection = keyof Config['collections']; diff --git a/lib/shopify/types.ts b/lib/cms/types.ts similarity index 100% rename from lib/shopify/types.ts rename to lib/cms/types.ts