fix: ✨ Allow webhook with basic auth
This commit is contained in:
@ -19,7 +19,6 @@ import { parseRetryStep, stepCanBeRetried } from 'services/inputs'
|
||||
type ChatBlockProps = {
|
||||
steps: PublicStep[]
|
||||
startStepIndex: number
|
||||
blockIndex: number
|
||||
onScroll: () => void
|
||||
onBlockEnd: (edgeId?: string) => void
|
||||
}
|
||||
@ -27,7 +26,6 @@ type ChatBlockProps = {
|
||||
export const ChatBlock = ({
|
||||
steps,
|
||||
startStepIndex,
|
||||
blockIndex,
|
||||
onScroll,
|
||||
onBlockEnd,
|
||||
}: ChatBlockProps) => {
|
||||
@ -35,8 +33,6 @@ export const ChatBlock = ({
|
||||
useTypebot()
|
||||
const [displayedSteps, setDisplayedSteps] = useState<PublicStep[]>([])
|
||||
|
||||
const currentStepIndex = displayedSteps.length - 1
|
||||
|
||||
useEffect(() => {
|
||||
const nextStep = steps[startStepIndex]
|
||||
if (nextStep) setDisplayedSteps([...displayedSteps, nextStep])
|
||||
@ -65,8 +61,9 @@ export const ChatBlock = ({
|
||||
step: currentStep,
|
||||
context: {
|
||||
apiHost,
|
||||
typebotId: typebot.id,
|
||||
indices: { blockIndex, stepIndex: currentStepIndex },
|
||||
typebotId: typebot.typebotId,
|
||||
blockId: currentStep.blockId,
|
||||
stepId: currentStep.id,
|
||||
variables: typebot.variables,
|
||||
isPreview,
|
||||
updateVariableValue,
|
||||
|
@ -82,7 +82,6 @@ export const ConversationContainer = ({
|
||||
key={displayedBlock.block.id + idx}
|
||||
steps={displayedBlock.block.steps}
|
||||
startStepIndex={displayedBlock.startStepIndex}
|
||||
blockIndex={idx}
|
||||
onScroll={autoScrollToBottom}
|
||||
onBlockEnd={displayNextBlock}
|
||||
/>
|
||||
|
@ -20,11 +20,11 @@ import { parseVariables, parseVariablesInObject } from './variable'
|
||||
|
||||
const safeEval = eval
|
||||
|
||||
type Indices = { blockIndex: number; stepIndex: number }
|
||||
type IntegrationContext = {
|
||||
apiHost: string
|
||||
typebotId: string
|
||||
indices: Indices
|
||||
blockId: string
|
||||
stepId: string
|
||||
isPreview: boolean
|
||||
variables: Variable[]
|
||||
updateVariableValue: (variableId: string, value: string) => void
|
||||
@ -153,7 +153,8 @@ const parseCellValues = (
|
||||
const executeWebhook = async (
|
||||
step: WebhookStep,
|
||||
{
|
||||
indices,
|
||||
blockId,
|
||||
stepId,
|
||||
variables,
|
||||
updateVariableValue,
|
||||
typebotId,
|
||||
@ -161,9 +162,8 @@ const executeWebhook = async (
|
||||
}: IntegrationContext
|
||||
) => {
|
||||
if (!step.webhook) return step.outgoingEdgeId
|
||||
const { blockIndex, stepIndex } = indices
|
||||
const { data, error } = await sendRequest({
|
||||
url: `${apiHost}/api/typebots/${typebotId}/blocks/${blockIndex}/steps/${stepIndex}/executeWebhook`,
|
||||
url: `${apiHost}/api/typebots/${typebotId}/blocks/${blockId}/steps/${stepId}/executeWebhook`,
|
||||
method: 'POST',
|
||||
body: {
|
||||
variables,
|
||||
|
Reference in New Issue
Block a user