@preprio/prepr-nextjs 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ easier personalization & A/B testing implementation in your NextJS project.
|
|
|
10
10
|
To install the Prepr NextJS package, run the following command:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npm install @prepr/prepr-nextjs
|
|
13
|
+
npm install @prepr/@preprio/prepr-nextjs
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Next you should navigate to your .env file and add the following environment variables:
|
|
@@ -28,7 +28,7 @@ file. If you don't have this file, you can create it in the root of your project
|
|
|
28
28
|
Then add the following code to the `middleware.js|middleware.ts` file:
|
|
29
29
|
```javascript
|
|
30
30
|
import type { NextRequest } from 'next/server'
|
|
31
|
-
import { PreprMiddleware } from 'prepr-nextjs'
|
|
31
|
+
import { PreprMiddleware } from '@preprio/prepr-nextjs'
|
|
32
32
|
|
|
33
33
|
export function middleware(request: NextRequest) {
|
|
34
34
|
return PreprMiddleware(request)
|
|
@@ -51,7 +51,7 @@ To setup the headers with your API calls, you can call the `getPreprHeaders()` h
|
|
|
51
51
|
```javascript
|
|
52
52
|
import { getClient } from '@/lib/client'
|
|
53
53
|
import { GetPageBySlugDocument, GetPageBySlugQuery } from '@/gql/graphql'
|
|
54
|
-
import { getPreprHeaders } from 'prepr-nextjs'
|
|
54
|
+
import { getPreprHeaders } from '@preprio/prepr-nextjs'
|
|
55
55
|
|
|
56
56
|
const getData = async () => {
|
|
57
57
|
// Fetching the data using Apollo Client
|
|
@@ -85,11 +85,11 @@ Then add the following code to the `layout.tsx` file:
|
|
|
85
85
|
|
|
86
86
|
```javascript
|
|
87
87
|
// Helper function to get all the props for the PreviewBar component (this needs a server component)
|
|
88
|
-
import { getPreviewBarProps } from 'prepr-nextjs'
|
|
88
|
+
import { getPreviewBarProps } from '@preprio/prepr-nextjs'
|
|
89
89
|
// Import the PreviewBar component
|
|
90
|
-
import { PreprPreviewBar } from 'prepr-nextjs/components'
|
|
90
|
+
import { PreprPreviewBar } from '@preprio/prepr-nextjs/components'
|
|
91
91
|
// Import the PreviewBar CSS
|
|
92
|
-
import 'prepr-nextjs/dist/components.css'
|
|
92
|
+
import '@preprio/prepr-nextjs/dist/components.css'
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
export default async function RootLayout({children}: {children: React.ReactNode}) {
|