diff --git a/examples/content-source-maps-cpa/lib/api-rest.ts b/examples/content-source-maps-cpa/lib/api-rest.ts index bbed787c..e645cdfe 100644 --- a/examples/content-source-maps-cpa/lib/api-rest.ts +++ b/examples/content-source-maps-cpa/lib/api-rest.ts @@ -1,4 +1,4 @@ -import { Entry, createClient, EntrySys } from 'contentful'; +import { createClient, EntrySys } from 'contentful'; type PostFields = { title: string; diff --git a/examples/content-source-maps-cpa/package.json b/examples/content-source-maps-cpa/package.json index 1735627b..492cf9f5 100644 --- a/examples/content-source-maps-cpa/package.json +++ b/examples/content-source-maps-cpa/package.json @@ -3,29 +3,33 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { - "@contentful/live-preview": "^4.2.2", + "@contentful/live-preview": "^4.6.0", "@types/node": "20.2.3", "@types/react": "18.2.7", "@types/react-dom": "18.2.4", "contentful": "^10.12.0", - "next": "14.2.10", - "react": "18.2.0", - "react-dom": "18.2.0", + "next": "15.0.4", + "react": "19.0.0", + "react-dom": "19.0.0", "typescript": "5.0.4" }, "devDependencies": { "@types/leaflet": "^1.9.8", "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", + "@types/react": "19.0.1", + "@types/react-dom": "19.0.1", "eslint": "^8", - "eslint-config-next": "14.0.4", + "eslint-config-next": "15.0.4", "typescript": "^5" + }, + "overrides": { + "@types/react": "19.0.1", + "@types/react-dom": "19.0.1" } } diff --git a/examples/content-source-maps-graphql/app/api/disable-draft/route.ts b/examples/content-source-maps-graphql/app/api/disable-draft/route.ts index 128e6852..6224d6d1 100644 --- a/examples/content-source-maps-graphql/app/api/disable-draft/route.ts +++ b/examples/content-source-maps-graphql/app/api/disable-draft/route.ts @@ -1,6 +1,6 @@ import { draftMode } from 'next/headers'; export async function GET(request: Request) { - draftMode().disable(); + (await draftMode()).disable(); return new Response('Draft mode is disabled'); } diff --git a/examples/content-source-maps-graphql/app/api/enable-draft/route.ts b/examples/content-source-maps-graphql/app/api/enable-draft/route.ts index a8057746..85cd2077 100644 --- a/examples/content-source-maps-graphql/app/api/enable-draft/route.ts +++ b/examples/content-source-maps-graphql/app/api/enable-draft/route.ts @@ -17,13 +17,13 @@ export async function GET(request: Request) { } // Enable Draft Mode by setting the cookie - draftMode().enable(); + (await draftMode()).enable(); // Override cookie header for draft mode for usage in live-preview // https://github.com/vercel/next.js/issues/49927 - const cookieStore = cookies(); + const cookieStore = await cookies(); const cookie = cookieStore.get('__prerender_bypass')!; - cookies().set({ + cookieStore.set({ name: '__prerender_bypass', value: cookie?.value, httpOnly: true, diff --git a/examples/content-source-maps-graphql/app/layout.tsx b/examples/content-source-maps-graphql/app/layout.tsx index dd7ef0da..5ff4894d 100644 --- a/examples/content-source-maps-graphql/app/layout.tsx +++ b/examples/content-source-maps-graphql/app/layout.tsx @@ -7,12 +7,12 @@ export const metadata: Metadata = { description: 'Generated by create next app', }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { - const { isEnabled } = draftMode(); + const { isEnabled } = await draftMode(); return ( diff --git a/examples/next-app-router-ssr/app/page.tsx b/examples/next-app-router-ssr/app/page.tsx index d9eefb04..321aa14e 100644 --- a/examples/next-app-router-ssr/app/page.tsx +++ b/examples/next-app-router-ssr/app/page.tsx @@ -8,7 +8,7 @@ export const metadata: Metadata = { }; export default async function Home() { - const { isEnabled } = draftMode(); + const { isEnabled } = await draftMode(); const posts = await getAllPostsForHome(isEnabled); diff --git a/examples/next-app-router-ssr/app/posts/[slug]/page.tsx b/examples/next-app-router-ssr/app/posts/[slug]/page.tsx index fddadff9..12ad5c55 100644 --- a/examples/next-app-router-ssr/app/posts/[slug]/page.tsx +++ b/examples/next-app-router-ssr/app/posts/[slug]/page.tsx @@ -3,12 +3,12 @@ import { getAllPostsWithSlug, getPost } from '../../../lib/api-graphql'; import PostLayout from '../../components/post-layout'; -export default async function Post({ params }: { params: { slug: string } }) { - const { isEnabled } = draftMode(); +export default async function Post(props: { params: Promise<{ slug: string }> }) { + const params = await props.params; + const { isEnabled } = await draftMode(); const { post } = await getPost(params.slug, isEnabled); - console.log({ post, isEnabled }); if (!post) { const formattedPost = `Post ${params.slug} not found`; return

{formattedPost}

; diff --git a/examples/next-app-router-ssr/lib/api-graphql.ts b/examples/next-app-router-ssr/lib/api-graphql.ts index 4c36bab2..5b7329da 100644 --- a/examples/next-app-router-ssr/lib/api-graphql.ts +++ b/examples/next-app-router-ssr/lib/api-graphql.ts @@ -34,6 +34,7 @@ const POST_GRAPHQL_FIELDS = ` title description banner { + __typename sys { id } @@ -107,7 +108,6 @@ export async function getAllPostsForHome(draftMode: boolean): Promise }) { + const params = await props.params; + const { isEnabled } = await draftMode(); const blog = await getBlog(params.slug, isEnabled); if (!blog) { diff --git a/examples/next-app-router/app/globals.css b/examples/next-app-router/app/globals.css index 6b3c9b5b..b5c61c95 100644 --- a/examples/next-app-router/app/globals.css +++ b/examples/next-app-router/app/globals.css @@ -1,25 +1,3 @@ @tailwind base; @tailwind components; @tailwind utilities; - -:root { - --foreground-rgb: 0, 0, 0; - --background-start-rgb: 214, 219, 220; - --background-end-rgb: 255, 255, 255; -} - -@media (prefers-color-scheme: dark) { - :root { - --foreground-rgb: 255, 255, 255; - } -} - -body { - color: rgb(var(--foreground-rgb)); -} - -@layer utilities { - .text-balance { - text-wrap: balance; - } -} diff --git a/examples/next-app-router/app/page.tsx b/examples/next-app-router/app/page.tsx index 04568571..bb09eb37 100644 --- a/examples/next-app-router/app/page.tsx +++ b/examples/next-app-router/app/page.tsx @@ -4,7 +4,7 @@ import Image from 'next/image'; import Link from 'next/link'; export default async function Home() { - const { isEnabled } = draftMode(); + const { isEnabled } = await draftMode(); const blogs = await getAllBlogs(3, isEnabled); return ( diff --git a/examples/next-app-router/components/article.tsx b/examples/next-app-router/components/article.tsx index a1dfa89f..15227794 100644 --- a/examples/next-app-router/components/article.tsx +++ b/examples/next-app-router/components/article.tsx @@ -5,7 +5,6 @@ */ 'use client'; -import { documentToReactComponents } from '@contentful/rich-text-react-renderer'; import Image from 'next/image'; import { useContentfulInspectorMode, @@ -56,16 +55,6 @@ export const Blog = ({ blog }: { blog: BlogProps }) => { fieldId: 'file', })} /> -
-
-
- {documentToReactComponents(updatedBlog.details.json)} -
-
-
diff --git a/examples/next-app-router/package.json b/examples/next-app-router/package.json index a8132302..256f9188 100644 --- a/examples/next-app-router/package.json +++ b/examples/next-app-router/package.json @@ -2,29 +2,32 @@ "name": "contentful-app-router", "version": "0.1.0", "scripts": { - "dev": "next dev", + "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint", "setup": "node ./lib/contentful/setup.js" }, "dependencies": { - "@contentful/live-preview": "^3.1.0", - "@contentful/rich-text-react-renderer": "^15.19.4", - "next": "14.2.10", - "react": "^18", - "react-dom": "^18" + "@contentful/live-preview": "^4.6.0", + "next": "15.0.4", + "react": "19.0.0", + "react-dom": "19.0.0" }, "devDependencies": { "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", + "@types/react": "19.0.1", + "@types/react-dom": "19.0.1", "autoprefixer": "^10.0.1", "contentful-import": "^9.4.38", "eslint": "^8", - "eslint-config-next": "14.1.0", + "eslint-config-next": "15.0.4", "postcss": "^8", "tailwindcss": "^3.3.0", "typescript": "^5" + }, + "overrides": { + "@types/react": "19.0.1", + "@types/react-dom": "19.0.1" } } diff --git a/examples/next-app-router/tsconfig.json b/examples/next-app-router/tsconfig.json index e7ff90fd..64c21044 100644 --- a/examples/next-app-router/tsconfig.json +++ b/examples/next-app-router/tsconfig.json @@ -19,7 +19,8 @@ ], "paths": { "@/*": ["./*"] - } + }, + "target": "ES2017" }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"] diff --git a/examples/next-pages-router/.nvmrc b/examples/next-pages-router/.nvmrc index 7950a445..016e34ba 100644 --- a/examples/next-pages-router/.nvmrc +++ b/examples/next-pages-router/.nvmrc @@ -1 +1 @@ -v18.17.0 +v20.17.0 diff --git a/examples/next-pages-router/README.md b/examples/next-pages-router/README.md index fc4d2353..73e5eb09 100644 --- a/examples/next-pages-router/README.md +++ b/examples/next-pages-router/README.md @@ -87,7 +87,7 @@ Next, add these fields (you don't have to modify the settings unless specified): - `details` - **Rich text** field - `date` - **Date and time** field - `author` - **Text** field (type **short text**) -- `category` - **Text** field (type **short text**) +- `categoryName` - **Text** field (type **short text**) - `heroImage` - **Media** field (type **one file**) Save the content type and continue. diff --git a/examples/next-pages-router/package.json b/examples/next-pages-router/package.json index dd67e830..a8637be4 100644 --- a/examples/next-pages-router/package.json +++ b/examples/next-pages-router/package.json @@ -3,29 +3,31 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { - "@contentful/live-preview": "^3.1.0", - "@contentful/rich-text-react-renderer": "^15.19.3", + "@contentful/live-preview": "^4.6.0", "contentful": "^10.6.21", - "next": "14.2.10", - "react": "^18", - "react-dom": "^18", - "swr": "^2.2.4" + "next": "15.0.4", + "react": "19.0.0", + "react-dom": "19.0.0" }, "devDependencies": { "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", + "@types/react": "19.0.1", + "@types/react-dom": "19.0.1", "autoprefixer": "^10.0.1", "eslint": "^8", - "eslint-config-next": "14.1.0", + "eslint-config-next": "15.0.4", "postcss": "^8", "tailwindcss": "^3.3.0", "typescript": "^5" + }, + "overrides": { + "@types/react": "19.0.1", + "@types/react-dom": "19.0.1" } } diff --git a/examples/next-pages-router/pages/blogs/[slug].tsx b/examples/next-pages-router/pages/blogs/[slug].tsx index 27869721..ec4fc6c9 100644 --- a/examples/next-pages-router/pages/blogs/[slug].tsx +++ b/examples/next-pages-router/pages/blogs/[slug].tsx @@ -1,7 +1,6 @@ import { Blog, getAllBlogsWithSlug, getBlog } from '@/lib/contentful/api'; import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next'; -import { documentToReactComponents } from '@contentful/rich-text-react-renderer'; import { useContentfulInspectorMode, useContentfulLiveUpdates, @@ -67,16 +66,6 @@ export default function BlogPage({ blog }: { blog: Blog }) { fieldId: 'file', })} /> -
-
-
- {documentToReactComponents(updatedBlog.fields.details)} -
-
-
diff --git a/examples/next-pages-router/styles/globals.css b/examples/next-pages-router/styles/globals.css index 875c01e8..b5c61c95 100644 --- a/examples/next-pages-router/styles/globals.css +++ b/examples/next-pages-router/styles/globals.css @@ -1,33 +1,3 @@ @tailwind base; @tailwind components; @tailwind utilities; - -:root { - --foreground-rgb: 0, 0, 0; - --background-start-rgb: 214, 219, 220; - --background-end-rgb: 255, 255, 255; -} - -@media (prefers-color-scheme: dark) { - :root { - --foreground-rgb: 255, 255, 255; - --background-start-rgb: 0, 0, 0; - --background-end-rgb: 0, 0, 0; - } -} - -body { - color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); -} - -@layer utilities { - .text-balance { - text-wrap: balance; - } -} diff --git a/examples/next-pages-router/tsconfig.json b/examples/next-pages-router/tsconfig.json index e7ff90fd..64c21044 100644 --- a/examples/next-pages-router/tsconfig.json +++ b/examples/next-pages-router/tsconfig.json @@ -19,7 +19,8 @@ ], "paths": { "@/*": ["./*"] - } + }, + "target": "ES2017" }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"]