diff --git a/examples/with-sfcc/.env.local.example b/examples/with-sfcc/.env.local.example deleted file mode 100644 index eaae9d407ab6b1..00000000000000 --- a/examples/with-sfcc/.env.local.example +++ /dev/null @@ -1,5 +0,0 @@ -SFDC_CLIENT_ID= -SFDC_SECRET= -SFDC_ORGANIZATIONID= -SFDC_SHORTCODE= -SFDC_SITEID= diff --git a/examples/with-sfcc/.gitignore b/examples/with-sfcc/.gitignore deleted file mode 100644 index 8777267507c0ee..00000000000000 --- a/examples/with-sfcc/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.* -.yarn/* -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/versions - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/examples/with-sfcc/README.md b/examples/with-sfcc/README.md deleted file mode 100644 index df39929a16fb11..00000000000000 --- a/examples/with-sfcc/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Example Next.js app with Salesforce Commerce Cloud - -This example shows how to create a headless ecommerce application using Next.js, [Salesforce commerce cloud](https://www.salesforce.com/products/commerce-cloud/overview/), and [Tailwind](https://tailwindcss.com). - -## Deploy your own - -Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or view the demo [here](https://salesforce-cloud-commerce.vercel.app/) - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-sfcc&project-name=with-sfcc&repository-name=with-sfcc&env=SFDC_CLIENT_ID,SFDC_SECRET,SFDC_ORGANIZATIONID,SFDC_SHORTCODE,SFDC_SITEID&envDescription=API%20Keys%20from%20SFCC%20needed%20to%20run%20this%20application.) - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. - -## How to use - -Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: - -```bash -npx create-next-app --example with-sfcc nextjs-sfcc-app -``` - -```bash -yarn create next-app --example with-sfcc nextjs-sfcc-app -``` - -```bash -pnpm create next-app --example with-sfcc nextjs-sfcc-app -``` - -## References - -- SDK: https://github.com/SalesforceCommerceCloud/commerce-sdk diff --git a/examples/with-sfcc/components/Footer.tsx b/examples/with-sfcc/components/Footer.tsx deleted file mode 100644 index 8fb91636c4f1a7..00000000000000 --- a/examples/with-sfcc/components/Footer.tsx +++ /dev/null @@ -1,14 +0,0 @@ -export default function Footer() { - return ( - - ); -} diff --git a/examples/with-sfcc/components/Header.tsx b/examples/with-sfcc/components/Header.tsx deleted file mode 100644 index efd073167d9f2a..00000000000000 --- a/examples/with-sfcc/components/Header.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import Image from "next/image"; -import img from "../public/hero.jpg"; - -export default function Header({ scrollHandler }) { - return ( -
-
-
-
-
- Coffee grinder -
-
-
-

- The Coffee House -

-

- Life is better with - coffee -

- -
- -
-
-
-
-
- ); -} diff --git a/examples/with-sfcc/components/ProductCard.tsx b/examples/with-sfcc/components/ProductCard.tsx deleted file mode 100644 index 30dcbc0d8da9de..00000000000000 --- a/examples/with-sfcc/components/ProductCard.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import Image from "next/image"; -import Link from "next/link"; -import { useState } from "react"; - -function cn(...classes) { - return classes.filter(Boolean).join(" "); -} - -export default function ProductCard({ product }) { - const [isLoading, setLoading] = useState(true); - - return ( - -
- product image setLoading(false)} - /> -
-
-

{product.name}

-

${product.price}

-
-

- {product.shortDescription} -

- - ); -} diff --git a/examples/with-sfcc/next.config.js b/examples/with-sfcc/next.config.js deleted file mode 100644 index adc30ce3c1f580..00000000000000 --- a/examples/with-sfcc/next.config.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - reactStrictMode: true, - images: { - remotePatterns: [ - { - protocol: "https", - hostname: "myaccount.dx.commercecloud.salesforce.com", - port: "", - }, - ], - }, -}; diff --git a/examples/with-sfcc/package.json b/examples/with-sfcc/package.json deleted file mode 100644 index 22b24d60cf8d54..00000000000000 --- a/examples/with-sfcc/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start" - }, - "dependencies": { - "commerce-sdk": "^2.8.0", - "next": "latest", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@tailwindcss/aspect-ratio": "^0.4.0", - "@types/node": "18.11.9", - "@types/react": "18.2.8", - "autoprefixer": "^10.4.0", - "postcss": "^8.4.5", - "tailwindcss": "^3.0.7", - "typescript": "4.8.4" - } -} diff --git a/examples/with-sfcc/pages/_app.tsx b/examples/with-sfcc/pages/_app.tsx deleted file mode 100644 index d245d86acae746..00000000000000 --- a/examples/with-sfcc/pages/_app.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import "../styles/globals.css"; -import Footer from "../components/Footer"; -import Head from "next/head"; -import { Montserrat } from "next/font/google"; - -const montserrat = Montserrat({ - subsets: ["latin"], - variable: "--font-montserrat", -}); - -export default function MyApp({ Component, pageProps }) { - return ( - <> - - The Coffee House - -
- -
- - ); -} diff --git a/examples/with-sfcc/pages/_document.tsx b/examples/with-sfcc/pages/_document.tsx deleted file mode 100644 index 6e8e15f2bd4e8d..00000000000000 --- a/examples/with-sfcc/pages/_document.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Head, Html, Main, NextScript } from "next/document"; - -export default function Document() { - return ( - - - - - -
- - - - ); -} diff --git a/examples/with-sfcc/pages/index.tsx b/examples/with-sfcc/pages/index.tsx deleted file mode 100644 index 6dc258d60e42a3..00000000000000 --- a/examples/with-sfcc/pages/index.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { useRef } from "react"; -import Header from "../components/Header"; -import ProductCard from "../components/ProductCard"; -import getProducts from "../sfcc.js"; - -export default function Gallery({ data }) { - let coffeeRef = useRef(); - - const scrollHandler = (e) => { - e.preventDefault(); - // @ts-ignore - coffeeRef.scrollIntoView({ - behavior: "smooth", - block: "start", - }); - }; - - return ( - <> -
-
-
-
-

- Crafted by us, for you -

-
-
-
- {data && - data.map((product) => ( - - ))} -
-
- - ); -} - -export async function getStaticProps() { - const searchResults = await getProducts("coffee"); - - return { - props: { - data: searchResults, - }, - }; -} diff --git a/examples/with-sfcc/pages/products/[slug].tsx b/examples/with-sfcc/pages/products/[slug].tsx deleted file mode 100644 index ae07c326bde1ca..00000000000000 --- a/examples/with-sfcc/pages/products/[slug].tsx +++ /dev/null @@ -1,57 +0,0 @@ -import Image from "next/image"; -import getProducts from "../../sfcc.js"; - -export default function Product({ product }) { - return ( -
-
-
- coffee -
-

- {product.name} -

-

- ${product.price} -

-
- Description -
-

{product.longDescription}

-
-
-
-
- ); -} - -export async function getStaticProps({ params }) { - const searchResults = await getProducts(params.slug); - const coffeeProduct = searchResults[0]; - - return { - props: { - product: coffeeProduct, - }, - }; -} - -export async function getStaticPaths() { - const coffeeProducts = await getProducts("coffee"); - let fullPaths = []; - - for (let product of coffeeProducts) { - fullPaths.push({ params: { slug: product.id } }); - } - - return { - paths: fullPaths, - fallback: "blocking", - }; -} diff --git a/examples/with-sfcc/postcss.config.js b/examples/with-sfcc/postcss.config.js deleted file mode 100644 index 12a703d900da81..00000000000000 --- a/examples/with-sfcc/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; diff --git a/examples/with-sfcc/public/favicon.ico b/examples/with-sfcc/public/favicon.ico deleted file mode 100644 index 4965832f2c9b06..00000000000000 Binary files a/examples/with-sfcc/public/favicon.ico and /dev/null differ diff --git a/examples/with-sfcc/public/hero.jpg b/examples/with-sfcc/public/hero.jpg deleted file mode 100644 index 625e25b1774335..00000000000000 Binary files a/examples/with-sfcc/public/hero.jpg and /dev/null differ diff --git a/examples/with-sfcc/public/vercel.svg b/examples/with-sfcc/public/vercel.svg deleted file mode 100644 index fbf0e25a651c28..00000000000000 --- a/examples/with-sfcc/public/vercel.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/examples/with-sfcc/sfcc.js b/examples/with-sfcc/sfcc.js deleted file mode 100644 index 8de88fee5545f3..00000000000000 --- a/examples/with-sfcc/sfcc.js +++ /dev/null @@ -1,57 +0,0 @@ -import { Customer, Product, Search } from "commerce-sdk"; - -export default async function getProducts(searchQuery) { - const clientConfig = { - headers: { - authorization: ``, - }, - parameters: { - clientId: process.env.SFDC_CLIENT_ID, - secret: process.env.SFDC_SECRET, - organizationId: process.env.SFDC_ORGANIZATIONID, - shortCode: process.env.SFDC_SHORTCODE, - siteId: process.env.SFDC_SITEID, - }, - }; - - const credentials = `${clientConfig.parameters.clientId}:${clientConfig.parameters.secret}`; - const base64data = Buffer.from(credentials).toString("base64"); - const headers = { Authorization: `Basic ${base64data}` }; - const client = new Customer.ShopperLogin(clientConfig); - - const shopperToken = await client.getAccessToken({ - headers, - body: { - grant_type: "client_credentials", - }, - }); - - const configWithAuth = { - ...clientConfig, - headers: { authorization: `Bearer ${shopperToken.access_token}` }, - }; - - const searchClient = new Search.ShopperSearch(configWithAuth); - const searchResults = await searchClient.productSearch({ - parameters: { q: searchQuery }, - }); - - const results = []; - - const productsClient = new Product.ShopperProducts(configWithAuth); - await Promise.all( - searchResults.hits.map(async (product) => { - const productResults = await productsClient.getProduct({ - parameters: { - organizationId: clientConfig.parameters.organizationId, - siteId: clientConfig.parameters.siteId, - id: product.productId, - }, - }); - - results.push(productResults); - }), - ); - - return results; -} diff --git a/examples/with-sfcc/styles/globals.css b/examples/with-sfcc/styles/globals.css deleted file mode 100644 index b5c61c956711f9..00000000000000 --- a/examples/with-sfcc/styles/globals.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/examples/with-sfcc/tailwind.config.js b/examples/with-sfcc/tailwind.config.js deleted file mode 100644 index 1e93302f4ea5a0..00000000000000 --- a/examples/with-sfcc/tailwind.config.js +++ /dev/null @@ -1,16 +0,0 @@ -/** @type {import('tailwindcss').Config} \*/ -module.exports = { - content: [ - "./pages/**/*.{js,ts,jsx,tsx}", - "./components/**/*.{js,ts,jsx,tsx}", - ], - theme: { - fontFamily: { - sans: ["var(--font-montserrat)"], - }, - }, - future: { - hoverOnlyWhenSupported: true, - }, - plugins: [require("@tailwindcss/aspect-ratio")], -}; diff --git a/examples/with-sfcc/tsconfig.json b/examples/with-sfcc/tsconfig.json deleted file mode 100644 index 23c73185186d1e..00000000000000 --- a/examples/with-sfcc/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "incremental": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react-jsx" - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} diff --git a/test/turbopack-dev-examples-manifest.json b/test/turbopack-dev-examples-manifest.json index 8573b4c94bd84f..20f2196863510c 100644 --- a/test/turbopack-dev-examples-manifest.json +++ b/test/turbopack-dev-examples-manifest.json @@ -156,7 +156,6 @@ "with-segment-analytics-pages-router": true, "with-sentry": true, "with-service-worker": true, - "with-sfcc": true, "with-shallow-routing": true, "with-sitemap": true, "with-slate": true,