From 22953a3445f701eebe65ed4035811febae801f31 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 29 Jul 2024 16:35:02 +0200 Subject: [PATCH] :bug: Fix append values bug when value contains "`" --- .../blocks/logic/setVariable/executeSetVariable.ts | 6 +++--- packages/embeds/js/package.json | 2 +- .../embeds/js/src/components/TextInputAddFileButton.tsx | 2 +- packages/embeds/nextjs/package.json | 2 +- packages/embeds/react/package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/bot-engine/blocks/logic/setVariable/executeSetVariable.ts b/packages/bot-engine/blocks/logic/setVariable/executeSetVariable.ts index 2364e6671..560b4ec36 100644 --- a/packages/bot-engine/blocks/logic/setVariable/executeSetVariable.ts +++ b/packages/bot-engine/blocks/logic/setVariable/executeSetVariable.ts @@ -194,9 +194,9 @@ const getExpressionToEvaluate = case 'Append value(s)': { const item = parseVariables(state.typebotsQueue[0].typebot.variables)( options.item - ) - return `if(\`${item}\` === '') return ${options.variableId}; - if(!${options.variableId}) return [\`${item}\`]; + ).replaceAll('`', '\\`') + if (isEmpty(item)) return `return ${options.variableId}` + return `if(!${options.variableId}) return [\`${item}\`]; if(!Array.isArray(${options.variableId})) return [${options.variableId}, \`${item}\`]; return (${options.variableId}).concat(\`${item}\`);` } diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index 14bf17c45..c6908b42f 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/js", - "version": "0.3.6", + "version": "0.3.7", "description": "Javascript library to display typebots on your website", "type": "module", "main": "dist/index.js", diff --git a/packages/embeds/js/src/components/TextInputAddFileButton.tsx b/packages/embeds/js/src/components/TextInputAddFileButton.tsx index 381e82893..8a39d4b20 100644 --- a/packages/embeds/js/src/components/TextInputAddFileButton.tsx +++ b/packages/embeds/js/src/components/TextInputAddFileButton.tsx @@ -26,7 +26,7 @@ export const TextInputAddFileButton = (props: Props) => { { diff --git a/packages/embeds/nextjs/package.json b/packages/embeds/nextjs/package.json index 785c9a2fe..74201b5cd 100644 --- a/packages/embeds/nextjs/package.json +++ b/packages/embeds/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/nextjs", - "version": "0.3.6", + "version": "0.3.7", "description": "Convenient library to display typebots on your Next.js website", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/embeds/react/package.json b/packages/embeds/react/package.json index c027b59d2..99cc1cca1 100644 --- a/packages/embeds/react/package.json +++ b/packages/embeds/react/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/react", - "version": "0.3.6", + "version": "0.3.7", "description": "Convenient library to display typebots on your React app", "main": "dist/index.js", "types": "dist/index.d.ts",