🐛 (share) Enable back empty public ID for self-hosted version
Closes #576
This commit is contained in:
@ -5,11 +5,11 @@ import { SEO } from './Seo'
|
||||
|
||||
export type TypebotPageProps = {
|
||||
url: string
|
||||
typebot?: Pick<Typebot, 'settings' | 'theme' | 'name' | 'publicId'>
|
||||
typebot: Pick<Typebot, 'settings' | 'theme' | 'name' | 'publicId'>
|
||||
}
|
||||
|
||||
export const TypebotPageV3 = ({ url, typebot }: TypebotPageProps) => {
|
||||
const { asPath, push, query } = useRouter()
|
||||
const { asPath, push } = useRouter()
|
||||
|
||||
const background = typebot?.theme.general.background
|
||||
|
||||
@ -36,15 +36,13 @@ export const TypebotPageV3 = ({ url, typebot }: TypebotPageProps) => {
|
||||
: '#fff',
|
||||
}}
|
||||
>
|
||||
{typebot && (
|
||||
<SEO
|
||||
url={url}
|
||||
typebotName={typebot.name}
|
||||
metadata={typebot.settings.metadata}
|
||||
/>
|
||||
)}
|
||||
<SEO
|
||||
url={url}
|
||||
typebotName={typebot.name}
|
||||
metadata={typebot.settings.metadata}
|
||||
/>
|
||||
<Standard
|
||||
typebot={typebot?.publicId ?? query.publicId?.toString() ?? 'n'}
|
||||
typebot={typebot.publicId}
|
||||
onInit={clearQueryParamsIfNecessary}
|
||||
/>
|
||||
</div>
|
||||
|
@ -125,10 +125,10 @@ export const sendMessage = publicProcedure
|
||||
)
|
||||
|
||||
const startSession = async (startParams?: StartParams, userId?: string) => {
|
||||
if (!startParams?.typebot)
|
||||
if (!startParams)
|
||||
throw new TRPCError({
|
||||
code: 'BAD_REQUEST',
|
||||
message: 'No typebot provided in startParams',
|
||||
message: 'StartParams are missing',
|
||||
})
|
||||
|
||||
const typebot = await getTypebot(startParams, userId)
|
||||
|
@ -94,7 +94,14 @@ const getTypebotFromPublicId = async (
|
||||
const publishedTypebot = await prisma.publicTypebot.findFirst({
|
||||
where: { typebot: { publicId: publicId ?? '' } },
|
||||
include: {
|
||||
typebot: { select: { name: true, isClosed: true, isArchived: true } },
|
||||
typebot: {
|
||||
select: {
|
||||
name: true,
|
||||
isClosed: true,
|
||||
isArchived: true,
|
||||
publicId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if (isNotDefined(publishedTypebot)) return null
|
||||
|
Reference in New Issue
Block a user