diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..15b1ed9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,3 @@ { - "extends": "next/core-web-vitals" + "extends": "next" } diff --git a/README.md b/README.md index b00b35d..804c7be 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,29 @@ This project makes uses of NextJs, Optimizely Fullstack and the JS SDK. I want [![Netlify Status](https://api.netlify.com/api/v1/badges/19b26768-2571-46e7-89b3-eefc07ec35c2/deploy-status)](https://app.netlify.com/sites/optimizely-demo/deploys) +## Api + + + ## How To Use ☄️ -First, run the development server: +**Website**: First, run the development server: ```bash npm run dev ``` +The site will load on `http:localhost:3000` + +**API**: TO run the admin API + +```bash +npm run start-api +``` + +The API will load on `http://localhost:9000/admin` + + Click this button to create a new Github repo, new Netlify project and deploy this example yourself [![Deploy to Netlify Button](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/jondjones-poc/Fullstack-demo) diff --git a/component/ABComponent.js b/component/ABComponent.js index cb73c48..e5717e9 100644 --- a/component/ABComponent.js +++ b/component/ABComponent.js @@ -18,12 +18,7 @@ const sectionStyle = (backgroundColor) => ( const ABComponent = ({...props}) => { - const { backgroundColor, bannerText } = props; - - const addEvent = () => { - console.log("AB Component Event Example") - props.optimizelyClient.track('button_click', props.userId); - } + const { backgroundColor, bannerText, buttonUrl } = props; return ( @@ -31,7 +26,7 @@ const ABComponent = ({...props}) => {

- A/B/C Experiment + A/B/C Experiment

@@ -45,7 +40,7 @@ const ABComponent = ({...props}) => { {bannerText} today! - + Buy now diff --git a/component/Content.js b/component/Content.js deleted file mode 100644 index f429e52..0000000 --- a/component/Content.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useEffect } from "react"; -import { fetchEntry } from '../utils/contentfulConnector1'; - -const Content = ({...props}) => { - - const { content, variationToUse } = props; - const entityId = content?.fields?.meta[variationToUse]; - - useEffect(() => { - const fetchData = async () => { - const entries = await fetchEntry(entityId); - console.log('entries', entries); - } - fetchData().catch(console.error); - }, [entityId]); - - return ( -
- CONTENT -
- ) -} - -export default Content; \ No newline at end of file diff --git a/component/ContentRecommendations.js b/component/ContentRecommendations.js new file mode 100644 index 0000000..0d79263 --- /dev/null +++ b/component/ContentRecommendations.js @@ -0,0 +1,111 @@ +import { useEffect, useState, useCallback } from "react"; + +const imageStyle = { + backgroundRepeat: 'no-repeat', + width: '100%', + height: '100%', +}; + +const ContentRecommendations= ({...props}) => { + + const { contentRecsKey } = props; + const recommendations = useContentRecommendations() + + return ( + <> +