2
0

fix(viewer): 💚 Attempt to fix LP rewrites

This commit is contained in:
Baptiste Arnaud
2022-02-10 16:23:21 +01:00
parent 92515efcc3
commit 19f4fdb83a
11 changed files with 65 additions and 73 deletions

View File

@@ -0,0 +1,4 @@
NOTION_API_TOKEN=
NOTION_DATABASE_ID=
NEXT_PUBLIC_VIEWER_HOST=http://localhost:3001
LANDING_PAGE_HOST=http://localhost:3002

View File

@@ -10,6 +10,16 @@ const securityHeaders = [
},
]
const pages = [
'blog',
'pricing',
'privacy-policies',
'terms-of-service',
'vs-landbot',
'vs-tally',
'vs-typeform',
]
module.exports = withBundleAnalyzer({
async headers() {
return [
@@ -30,11 +40,31 @@ module.exports = withBundleAnalyzer({
]
},
async rewrites() {
return [
{
source: '/:path*',
destination: `${process.env.NEXT_PUBLIC_VIEWER_HOST}/:path*`,
},
]
return {
beforeFiles: [
{
source: '/_next/static/:static*',
destination:
process.env.NEXT_PUBLIC_VIEWER_HOST + '/_next/static/:static*',
has: [
{
type: 'header',
key: 'referer',
value:
process.env.LANDING_PAGE_HOST +
'/(?!' +
pages.join('|') +
'|\\?).+',
},
],
},
],
fallback: [
{
source: '/:user*',
destination: process.env.NEXT_PUBLIC_VIEWER_HOST + '/:user*',
},
],
}
},
})

View File

@@ -15,13 +15,14 @@ import {
} from '@chakra-ui/react'
import loadLandbot from '../lib/landbot'
import Image from 'next/image'
import Typebot from 'typebot-js'
import { initContainer } from 'typebot-js'
import { ArticleCallToAction } from 'components/common/ArticleCta'
import { Footer } from 'components/common/Footer'
import { Navbar } from 'components/common/Navbar/Navbar'
import { NextChakraLink } from 'components/common/nextChakraAdapters/NextChakraLink'
import { SocialMetaTags } from 'components/common/SocialMetaTags'
import { Yes, No } from 'components/common/TableCells'
import landbotVisualFlowSrc from 'public/images/landbot/visual-flow.png'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare const Landbot: any
@@ -35,7 +36,7 @@ const VsTypebot = () => {
'https://chats.landbot.io/v3/H-937813-ZLZEY720UH1TWN5S/index.json',
})
})
Typebot.initContainer('typebot-container', {
initContainer('typebot-container', {
publishId: 'example-vs-other-tools',
})
}, [])
@@ -91,7 +92,7 @@ const VsTypebot = () => {
</Text>
<Box h="400px" pos="relative">
<Image
src="landbotVisualFlowSrc"
src={landbotVisualFlowSrc}
layout="fill"
objectFit="contain"
alt="Visual flow screenshot"

View File

@@ -12,7 +12,7 @@ import {
Th,
Flex,
} from '@chakra-ui/react'
import Typebot from 'typebot-js'
import { initContainer } from 'typebot-js'
import { ArticleCallToAction } from 'components/common/ArticleCta'
import { roadmapLink, Footer } from 'components/common/Footer'
import { Navbar } from 'components/common/Navbar/Navbar'
@@ -22,7 +22,7 @@ import { Yes, No } from 'components/common/TableCells'
const VsTypebot = () => {
useEffect(() => {
Typebot.initContainer('typebot-container', {
initContainer('typebot-container', {
publishId: 'example-vs-other-tools',
})
}, [])

View File

@@ -12,7 +12,7 @@ import {
Th,
Flex,
} from '@chakra-ui/react'
import Typebot from 'typebot-js'
import { initContainer } from 'typebot-js'
import { CheckIcon } from 'assets/icons/CheckIcon'
import { CloseIcon } from 'assets/icons/CloseIcon'
import { ArticleCallToAction } from 'components/common/ArticleCta'
@@ -25,7 +25,7 @@ import loadTypeform from 'lib/typeform'
const VsTypebot = () => {
useEffect(() => {
loadTypeform().then()
Typebot.initContainer('typebot-container', {
initContainer('typebot-container', {
publishId: 'example-vs-other-tools',
})
}, [])