fix(engine): 📦️ Compatible with iPhone 6
This commit is contained in:
@ -7,12 +7,12 @@ import { isDefined } from 'utils'
|
||||
import { SEO } from '../components/Seo'
|
||||
import { createResult, updateResult } from '../services/result'
|
||||
import { ErrorPage } from './ErrorPage'
|
||||
import sanitizeHtml from 'sanitize-html'
|
||||
|
||||
export type TypebotPageProps = {
|
||||
typebot?: PublicTypebot
|
||||
url: string
|
||||
isIE: boolean
|
||||
customHeadCode: string | null
|
||||
}
|
||||
|
||||
const sessionStorageKey = 'resultId'
|
||||
@ -21,6 +21,7 @@ export const TypebotPage = ({
|
||||
typebot,
|
||||
isIE,
|
||||
url,
|
||||
customHeadCode,
|
||||
}: TypebotPageProps & { typebot: PublicTypebot }) => {
|
||||
const { asPath, push } = useRouter()
|
||||
const [showTypebot, setShowTypebot] = useState(false)
|
||||
@ -41,13 +42,8 @@ export const TypebotPage = ({
|
||||
})
|
||||
setPredefinedVariables(predefinedVariables)
|
||||
initializeResult().then()
|
||||
const { customHeadCode } = typebot.settings.metadata
|
||||
if (isDefined(customHeadCode) && customHeadCode !== '')
|
||||
document.head.innerHTML =
|
||||
document.head.innerHTML +
|
||||
sanitizeHtml(customHeadCode ?? '', {
|
||||
allowedTags: ['script', 'meta'],
|
||||
})
|
||||
if (isDefined(customHeadCode))
|
||||
document.head.innerHTML = document.head.innerHTML + customHeadCode
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
|
@ -2,6 +2,7 @@ import { IncomingMessage } from 'http'
|
||||
import { NotFoundPage } from 'layouts/NotFoundPage'
|
||||
import { PublicTypebot } from 'models'
|
||||
import { GetServerSideProps, GetServerSidePropsContext } from 'next'
|
||||
import sanitizeHtml from 'sanitize-html'
|
||||
import { isDefined, isNotDefined, omit } from 'utils'
|
||||
import { TypebotPage, TypebotPageProps } from '../layouts/TypebotPage'
|
||||
import prisma from '../libs/prisma'
|
||||
@ -36,11 +37,16 @@ export const getServerSideProps: GetServerSideProps = async (
|
||||
? `Couldn't find publicId: ${context.query.publicId?.toString()}`
|
||||
: `Couldn't find customDomain: ${customDomain}`
|
||||
)
|
||||
const headCode = typebot?.settings.metadata.customHeadCode
|
||||
return {
|
||||
props: {
|
||||
typebot,
|
||||
isIE,
|
||||
url: `https://${forwardedHost ?? host}${pathname}`,
|
||||
customHeadCode:
|
||||
isDefined(headCode) && headCode !== ''
|
||||
? sanitizeHtml(headCode, { allowedTags: ['script', 'meta'] })
|
||||
: null,
|
||||
},
|
||||
}
|
||||
} catch (err) {
|
||||
|
Reference in New Issue
Block a user