diff --git a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx index ade63982a35..005d47023a9 100644 --- a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx +++ b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx @@ -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}"` : ''}] ` } diff --git a/apps/builder/src/features/typebot/api/getTypebot.ts b/apps/builder/src/features/typebot/api/getTypebot.ts index e2267582913..02e399afe2e 100644 --- a/apps/builder/src/features/typebot/api/getTypebot.ts +++ b/apps/builder/src/features/typebot/api/getTypebot.ts @@ -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' } diff --git a/packages/embeds/wordpress/package.json b/packages/embeds/wordpress/package.json index 380c08fd5b6..2f9a33e0c93 100644 --- a/packages/embeds/wordpress/package.json +++ b/packages/embeds/wordpress/package.json @@ -1,13 +1,13 @@ { "name": "@typebot.io/wordpress", - "version": "3.4.2", + "version": "3.5.0", "main": "index.js", "repository": "https://github.com/baptisteArno/typebot.io", "author": "baptisteArno", "license": "AGPL-3.0-or-later", "scripts": { "deploy": "pnpm copy && pnpm commit", - "copy": "svn copy ./trunk ./tags/3.4.2", - "commit": "svn ci -m 'Affect v0.2.15 to Standard embed'" + "copy": "svn copy ./trunk ./tags/3.5.0", + "commit": "svn ci -m 'Add lib_version attr in shortcode'" } } diff --git a/packages/embeds/wordpress/trunk/README.txt b/packages/embeds/wordpress/trunk/README.txt index ed8c16845f6..5f08b9960d1 100644 --- a/packages/embeds/wordpress/trunk/README.txt +++ b/packages/embeds/wordpress/trunk/README.txt @@ -5,7 +5,7 @@ Requires at least: 5.0 Tested up to: 6.0 License: GPL 2.0 License URI: http://www.gnu.org/licenses/gpl-2.0.txt -Stable Tag: 3.4.2 +Stable Tag: 3.5.0 == Description == Collect 4x more responses with conversational apps using Typebot. @@ -24,6 +24,9 @@ This plugin relies on Typebot which is a tool that allows you to create conversa 3. Activate your Typebot with the "Typebot" admin button located in the sidebar == Changelog == += 3.5.0 = +* Add the lib_version attribute in shortcode + = 3.4.2 = * Affect v0.2.15 to Standard embed as well diff --git a/packages/embeds/wordpress/trunk/public/class-typebot-public.php b/packages/embeds/wordpress/trunk/public/class-typebot-public.php index 1c43a58947f..8c25cae0059 100644 --- a/packages/embeds/wordpress/trunk/public/class-typebot-public.php +++ b/packages/embeds/wordpress/trunk/public/class-typebot-public.php @@ -91,7 +91,11 @@ function typebot_script() public function add_typebot_container($attributes = []) { - $lib_url = "https://cdn.jsdelivr.net/npm/@typebot.io/js@0.2.15/dist/web.js"; + $lib_version = '0.2'; + if(array_key_exists('lib_version', $attributes)) { + $lib_version = sanitize_text_field($attributes['lib_version']); + } + $lib_url = "https://cdn.jsdelivr.net/npm/@typebot.io/js@". $lib_version ."/dist/web.js"; $width = '100%'; $height = '500px'; $api_host = 'https://typebot.io'; diff --git a/packages/embeds/wordpress/trunk/typebot.php b/packages/embeds/wordpress/trunk/typebot.php index 7c63c38dc45..5a2036e4679 100644 --- a/packages/embeds/wordpress/trunk/typebot.php +++ b/packages/embeds/wordpress/trunk/typebot.php @@ -3,7 +3,7 @@ /** * Plugin Name: Typebot * Description: Convert more with conversational forms - * Version: 3.4.2 + * Version: 3.5.0 * Author: Typebot * Author URI: http://typebot.io/ * License: GPL-2.0+ @@ -16,7 +16,7 @@ die(); } -define('TYPEBOT_VERSION', '3.4.2'); +define('TYPEBOT_VERSION', '3.5.0'); function activate_typebot() {