2
0

(wordpress) Add lib_version prop in shortcode

Closes #1035
This commit is contained in:
Baptiste Arnaud
2023-11-30 17:25:37 +01:00
parent 8d413f0865
commit eeac493387
6 changed files with 19 additions and 9 deletions

View File

@ -13,6 +13,7 @@ import { useState } from 'react'
import { StandardSettings } from '../../../settings/StandardSettings'
import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
import { env } from '@typebot.io/env'
import packageJson from '../../../../../../../../../../packages/embeds/js/package.json'
type Props = {
publicId: string
@ -76,7 +77,9 @@ const parseWordpressShortcode = ({
publicId: string
}) => {
return `[typebot typebot="${publicId}"${
isCloudProdInstance() ? '' : ` host="${env.NEXT_PUBLIC_VIEWER_URL[0]}"`
isCloudProdInstance()
? ''
: ` host="${env.NEXT_PUBLIC_VIEWER_URL[0]}" lib_version="${packageJson.version}"`
}${width ? ` width="${width}"` : ''}${height ? ` height="${height}"` : ''}]
`
}

View File

@ -87,7 +87,6 @@ const getCurrentUserMode = (
workspace: { members: { userId: string }[] }
}
) => {
if (user?.email === env.ADMIN_EMAIL) return 'read'
const collaborator = typebot.collaborators.find((c) => c.userId === user?.id)
const isMemberOfWorkspace = typebot.workspace.members.some(
(m) => m.userId === user?.id
@ -100,5 +99,6 @@ const getCurrentUserMode = (
return 'write'
if (collaborator) return 'read'
if (user?.email === env.ADMIN_EMAIL) return 'read'
return 'guest'
}