import * as React from 'react'; import { useMutation } from '@apollo/client'; import Collapse from '@mui/material/Collapse'; import ListItem from '@mui/material/ListItem'; import Button from '@mui/material/Button'; import { EXECUTE_FLOW } from 'graphql/mutations/execute-flow'; import FlowSubstepTitle from 'components/FlowSubstepTitle'; import type { IStep, ISubstep } from '@automatisch/types'; type TestSubstepProps = { substep: ISubstep, expanded?: boolean; onExpand: () => void; onCollapse: () => void; onChange?: ({ step }: { step: IStep }) => void; onSubmit?: () => void; step: IStep; }; function TestSubstep(props: TestSubstepProps): React.ReactElement { const { substep, expanded = false, onExpand, onCollapse, onSubmit, step, } = props; const [executeFlow, { data }] = useMutation(EXECUTE_FLOW); const response = data?.executeFlow?.data; const { name, } = substep; const handleSubmit = React.useCallback(() => { executeFlow({ variables: { input: { stepId: step.id, }, }, }) }, [onSubmit, step.id]); const onToggle = expanded ? onCollapse : onExpand; return ( {response && (
              {JSON.stringify(response, null, 2)}
            
)}
); }; export default TestSubstep;