@ -74,8 +74,8 @@ They can be initialized in the URL as [URL parameters](https://www.semrush.com/b
|
|||||||
|
|
||||||
Then the variables will be prefilled as following:
|
Then the variables will be prefilled as following:
|
||||||
|
|
||||||
- Email => <test@test.com>
|
- Email => `test@test.com`
|
||||||
- First name => John
|
- First name => `John`
|
||||||
|
|
||||||
Prefilling variables using the embed library is even easier. You need to add an object named `prefilledVariables` that contains a dictionary of your values. For example:
|
Prefilling variables using the embed library is even easier. You need to add an object named `prefilledVariables` that contains a dictionary of your values. For example:
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import { useMemo } from 'react'
|
|||||||
|
|
||||||
export type TypebotV3PageProps = {
|
export type TypebotV3PageProps = {
|
||||||
url: string
|
url: string
|
||||||
|
isMatchingViewerUrl?: boolean
|
||||||
name: string
|
name: string
|
||||||
publicId: string | null
|
publicId: string | null
|
||||||
font: Font | null
|
font: Font | null
|
||||||
@ -19,6 +20,7 @@ export type TypebotV3PageProps = {
|
|||||||
|
|
||||||
export const TypebotPageV3 = ({
|
export const TypebotPageV3 = ({
|
||||||
font,
|
font,
|
||||||
|
isMatchingViewerUrl,
|
||||||
publicId,
|
publicId,
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
@ -41,7 +43,10 @@ export const TypebotPageV3 = ({
|
|||||||
push(asPath.split('?')[0], undefined, { shallow: true })
|
push(asPath.split('?')[0], undefined, { shallow: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiOrigin = useMemo(() => new URL(url).origin, [url])
|
const apiOrigin = useMemo(() => {
|
||||||
|
if (isMatchingViewerUrl) return
|
||||||
|
return new URL(url).origin
|
||||||
|
}, [isMatchingViewerUrl, url])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -78,6 +78,7 @@ export const getServerSideProps: GetServerSideProps = async (
|
|||||||
props: {
|
props: {
|
||||||
publishedTypebot,
|
publishedTypebot,
|
||||||
incompatibleBrowser,
|
incompatibleBrowser,
|
||||||
|
isMatchingViewerUrl,
|
||||||
url: `${protocol}://${forwardedHost ?? host}${pathname}`,
|
url: `${protocol}://${forwardedHost ?? host}${pathname}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -203,6 +204,7 @@ const App = ({
|
|||||||
isIE: boolean
|
isIE: boolean
|
||||||
customHeadCode: string | null
|
customHeadCode: string | null
|
||||||
url: string
|
url: string
|
||||||
|
isMatchingViewerUrl?: boolean
|
||||||
publishedTypebot:
|
publishedTypebot:
|
||||||
| TypebotPageProps['publishedTypebot']
|
| TypebotPageProps['publishedTypebot']
|
||||||
| Pick<
|
| Pick<
|
||||||
@ -238,6 +240,7 @@ const App = ({
|
|||||||
) : (
|
) : (
|
||||||
<TypebotPageV3
|
<TypebotPageV3
|
||||||
url={props.url}
|
url={props.url}
|
||||||
|
isMatchingViewerUrl={props.isMatchingViewerUrl}
|
||||||
name={publishedTypebot.name}
|
name={publishedTypebot.name}
|
||||||
publicId={publishedTypebot.publicId}
|
publicId={publishedTypebot.publicId}
|
||||||
isHideQueryParamsEnabled={
|
isHideQueryParamsEnabled={
|
||||||
|
Reference in New Issue
Block a user