fix(engine): 🚑️ Webhook return func
This commit is contained in:
@@ -96,7 +96,7 @@ export const VariableSearchInput = ({
|
|||||||
|
|
||||||
const handleCreateNewVariableClick = () => {
|
const handleCreateNewVariableClick = () => {
|
||||||
if (!inputValue || inputValue === '') return
|
if (!inputValue || inputValue === '') return
|
||||||
const id = cuid()
|
const id = 'v' + cuid()
|
||||||
onSelectVariable({ id, name: inputValue })
|
onSelectVariable({ id, name: inputValue })
|
||||||
createVariable({ id, name: inputValue })
|
createVariable({ id, name: inputValue })
|
||||||
onClose()
|
onClose()
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
"button": "Send",
|
"button": "Send",
|
||||||
"placeholder": "Describe the bug..."
|
"placeholder": "Describe the bug..."
|
||||||
},
|
},
|
||||||
"variableId": "51BcuecnB6kRU1tsttaGyR"
|
"variableId": "v51BcuecnB6kRU1tsttaGyR"
|
||||||
},
|
},
|
||||||
"outgoingEdgeId": "cl1571jhh00022e6dk77f52wg"
|
"outgoingEdgeId": "cl1571jhh00022e6dk77f52wg"
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@
|
|||||||
"button": "Send",
|
"button": "Send",
|
||||||
"placeholder": "Type your answer..."
|
"placeholder": "Type your answer..."
|
||||||
},
|
},
|
||||||
"variableId": "51BcuecnB6kRU1tsttaGyR"
|
"variableId": "v51BcuecnB6kRU1tsttaGyR"
|
||||||
},
|
},
|
||||||
"outgoingEdgeId": "cl1571ktd00032e6dyti22850"
|
"outgoingEdgeId": "cl1571ktd00032e6dyti22850"
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@
|
|||||||
],
|
],
|
||||||
"variables": [
|
"variables": [
|
||||||
{ "id": "t2k6cj3uYfNdJX13APA4b9", "name": "Email" },
|
{ "id": "t2k6cj3uYfNdJX13APA4b9", "name": "Email" },
|
||||||
{ "id": "51BcuecnB6kRU1tsttaGyR", "name": "Content" }
|
{ "id": "v51BcuecnB6kRU1tsttaGyR", "name": "Content" }
|
||||||
],
|
],
|
||||||
"edges": [
|
"edges": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
"blockId": "o4SH1UtKANnW5N5D67oZUz",
|
"blockId": "o4SH1UtKANnW5N5D67oZUz",
|
||||||
"options": {
|
"options": {
|
||||||
"labels": { "button": "Send", "placeholder": "Type your email..." },
|
"labels": { "button": "Send", "placeholder": "Type your email..." },
|
||||||
"variableId": "3VFChNVSCXQ2rXv4DrJ8Ah"
|
"variableId": "v3VFChNVSCXQ2rXv4DrJ8Ah"
|
||||||
},
|
},
|
||||||
"outgoingEdgeId": "w3MiN1Ct38jT5NykVsgmb5"
|
"outgoingEdgeId": "w3MiN1Ct38jT5NykVsgmb5"
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@
|
|||||||
],
|
],
|
||||||
"variables": [
|
"variables": [
|
||||||
{ "id": "giiLFGw5xXBCHzvp1qAbdX", "name": "Name" },
|
{ "id": "giiLFGw5xXBCHzvp1qAbdX", "name": "Name" },
|
||||||
{ "id": "3VFChNVSCXQ2rXv4DrJ8Ah", "name": "Email" }
|
{ "id": "v3VFChNVSCXQ2rXv4DrJ8Ah", "name": "Email" }
|
||||||
],
|
],
|
||||||
"edges": [
|
"edges": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ const executeWebhook = async (
|
|||||||
const existingVariable = variables.find(byId(varMapping.variableId))
|
const existingVariable = variables.find(byId(varMapping.variableId))
|
||||||
if (!existingVariable) return newVariables
|
if (!existingVariable) return newVariables
|
||||||
const func = Function('data', `return data.${varMapping?.bodyPath}`)
|
const func = Function('data', `return data.${varMapping?.bodyPath}`)
|
||||||
const value = func(JSON.stringify(data))
|
const value = func(data)
|
||||||
updateVariableValue(existingVariable?.id, value)
|
updateVariableValue(existingVariable?.id, value)
|
||||||
return [...newVariables, { ...existingVariable, value }]
|
return [...newVariables, { ...existingVariable, value }]
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
Reference in New Issue
Block a user