From 8abef590299def04a01a226b9dfd414934f8bd91 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 27 Feb 2026 11:42:11 -0300 Subject: [PATCH 1/6] fix: adapts component too works for events --- .../editor/StepsSideBar/StepCard.tsx | 10 ++-- .../editor/StepsSideBar/StepSideBar.tsx | 9 ++- .../InterpretDataWithAI.tsx | 60 ++++++++++++------- .../useInterpretDataWithAI.ts | 7 ++- 4 files changed, 55 insertions(+), 31 deletions(-) diff --git a/apps/builder/components/editor/StepsSideBar/StepCard.tsx b/apps/builder/components/editor/StepsSideBar/StepCard.tsx index 230fc015a0..5f91ae0cb9 100644 --- a/apps/builder/components/editor/StepsSideBar/StepCard.tsx +++ b/apps/builder/components/editor/StepsSideBar/StepCard.tsx @@ -12,6 +12,7 @@ import React, { useEffect, useState } from 'react' import { StepIcon } from './StepIcon' import { StepTypeLabel } from './StepTypeLabel' import { InfoIcon } from '@chakra-ui/icons' +import { useTypebot } from 'contexts/TypebotContext/TypebotContext' export const StepCard = ({ type, @@ -28,6 +29,7 @@ export const StepCard = ({ }) => { const { draggedStepType } = useStepDnd() const [isMouseDown, setIsMouseDown] = useState(false) + const { typebot } = useTypebot() useEffect(() => { setIsMouseDown(draggedStepType === type) @@ -35,10 +37,10 @@ export const StepCard = ({ const handleMouseDown = (e: React.MouseEvent) => onMouseDown(e, type) - const shouldAddGradientBorder = [ - WOZStepType.MESSAGE, - WOZStepType.INTERPRET_DATA_WITH_AI, - ].includes(type as WOZStepType) + const shouldAddGradientBorder = + [WOZStepType.MESSAGE, WOZStepType.INTERPRET_DATA_WITH_AI].includes( + type as WOZStepType + ) && typebot?.availableFor?.includes('automated-tasks') return ( { ) } - const EVENT_AVAILABLE_STEPS: StepType[] = [IntegrationStepType.WEBHOOK] + const EVENT_AVAILABLE_STEPS: StepType[] = [ + IntegrationStepType.WEBHOOK, + WOZStepType.INTERPRET_DATA_WITH_AI, + ] const AUTOMATED_TASKS_AVAILABLE_STEPS: StepType[] = [ WOZStepType.MESSAGE, WOZStepType.INTERPRET_DATA_WITH_AI, @@ -225,8 +228,8 @@ export const StepsSideBar = () => { verifyFeatureToggle('commerce-enabled') ) - const wozAssign = Object.values(WOZStepType).filter((step) => - shouldShowComponent(step) && step === WOZStepType.ASSIGN + const wozAssign = Object.values(WOZStepType).filter( + (step) => shouldShowComponent(step) && step === WOZStepType.ASSIGN ) const wozInterpretDataWithAI = Object.values(WOZStepType).filter( diff --git a/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx b/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx index 70a1177169..7dec581e72 100644 --- a/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx +++ b/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx @@ -19,6 +19,7 @@ import { VariablesMenu } from './VariablesMenu' import { MdInfoOutline } from 'react-icons/md' import { WOZInterpretDataWithAI } from 'models' import { getDeepKeys } from 'services/integrations' +import { useTypebot } from 'contexts/TypebotContext' type Props = { step: WOZInterpretDataWithAI @@ -34,6 +35,9 @@ export const InterpretDataWithAI = ({ step, onContentChange }: Props) => { testReturn, refetch, } = useInterpretDataWithAI({ step }) + + const { typebot } = useTypebot() + const isAutomatedTasksBot = typebot?.availableFor.includes('automated-tasks') const [isTesting, setIsTesting] = useState(false) const [resultOfInterpretWithAi, setResultOfInterpretWithAi] = @@ -129,7 +133,10 @@ Clique em 'Testar retorno' para ver como ficará na prática.` if (whoIsConnectedOnMyBlock?.length === 1) { const block = whoIsConnectedOnMyBlock[0] - if (block.steps[0].type !== IntegrationStepType.WEBHOOK) + if ( + block.steps[0].type !== IntegrationStepType.WEBHOOK && + isAutomatedTasksBot + ) return ( @@ -144,8 +151,11 @@ Clique em 'Testar retorno' para ver como ficará na prática.` return ( - Este bloco deve receber apenas uma conexão, sendo esta conexão um - componente chamado "Conecte a outro sistema" + Este bloco deve receber apenas uma conexão{' '} + {isAutomatedTasksBot + ? `, sendo esta conexão um + componente chamado "Conecte a outro sistema"` + : ''} ) @@ -160,7 +170,7 @@ Clique em 'Testar retorno' para ver como ficará na prática.` ) } - if (!success) { + if (!success && isAutomatedTasksBot) { return ( @@ -215,12 +225,14 @@ Clique em 'Testar retorno' para ver como ficará na prática.` className="scrollbar-custom" /> - - - + {responseKeys.length > 0 && ( + + + + )} {resultOfInterpretWithAi.length > 0 && ( @@ -241,19 +253,21 @@ Clique em 'Testar retorno' para ver como ficará na prática.` )} - + {isAutomatedTasksBot && ( + + )} ) diff --git a/apps/builder/hooks/InterpretDataWithAI/useInterpretDataWithAI.ts b/apps/builder/hooks/InterpretDataWithAI/useInterpretDataWithAI.ts index cf2b5124f4..23076e90ad 100644 --- a/apps/builder/hooks/InterpretDataWithAI/useInterpretDataWithAI.ts +++ b/apps/builder/hooks/InterpretDataWithAI/useInterpretDataWithAI.ts @@ -73,7 +73,12 @@ export const useInterpretDataWithAI = ({ } const requestParams = useMemo(() => { - if (!whoIsConnectedOnMyBlock?.length || !typebot) return null + if ( + !whoIsConnectedOnMyBlock?.length || + !typebot || + typebot?.availableFor?.includes('event') + ) + return null const block = whoIsConnectedOnMyBlock[0] From dc7116ca01924aa9d13c0fb4d21c3790dcceb367 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 2 Mar 2026 17:27:57 -0300 Subject: [PATCH 2/6] fix: adding missing Box --- .../InterpretDataWithAI.tsx | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx b/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx index 29339abae1..7cff5e63e7 100644 --- a/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx +++ b/apps/builder/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/InterpretDataWithAI/InterpretDataWithAI.tsx @@ -214,28 +214,30 @@ Use as variáveis: {{ numero-ticket }}, {{ status-ticket }}, - -