2
0

feat(editor): Restore published version button

Had to migrate webhooks into a standalone table
This commit is contained in:
Baptiste Arnaud
2022-03-01 07:13:09 +01:00
parent 0df719d531
commit e17a1a0869
46 changed files with 578 additions and 348 deletions

View File

@ -11,9 +11,9 @@ import {
GoogleAnalyticsStep,
WebhookStep,
SendEmailStep,
PublicBlock,
ZapierStep,
ResultValues,
Block,
} from 'models'
import { stringify } from 'qs'
import { sendRequest } from 'utils'
@ -31,7 +31,7 @@ type IntegrationContext = {
isPreview: boolean
variables: Variable[]
resultValues: ResultValues
blocks: PublicBlock[]
blocks: Block[]
updateVariableValue: (variableId: string, value: string) => void
}
@ -170,7 +170,6 @@ const executeWebhook = async (
isPreview,
}: IntegrationContext
) => {
if (!step.webhook) return step.outgoingEdgeId
const { data, error } = await sendRequest({
url: `${apiHost}/api/typebots/${typebotId}/blocks/${blockId}/steps/${stepId}/executeWebhook`,
method: 'POST',
@ -186,6 +185,7 @@ const executeWebhook = async (
const value = safeEval(`(${JSON.stringify(data)}).${varMapping?.bodyPath}`)
updateVariableValue(varMapping.variableId, value)
})
return step.outgoingEdgeId
}
const sendEmail = async (