fix(api): 🩹 Switch from stepId to id (for Zapier)
This commit is contained in:
@ -15,7 +15,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
select: { blocks: true },
|
select: { blocks: true },
|
||||||
})
|
})
|
||||||
const emptyWebhookSteps = (typebot?.blocks as Block[]).reduce<
|
const emptyWebhookSteps = (typebot?.blocks as Block[]).reduce<
|
||||||
{ blockId: string; stepId: string; name: string }[]
|
{ blockId: string; id: string; name: string }[]
|
||||||
>((emptyWebhookSteps, block) => {
|
>((emptyWebhookSteps, block) => {
|
||||||
const steps = block.steps.filter(
|
const steps = block.steps.filter(
|
||||||
(step) => step.type === IntegrationStepType.WEBHOOK && !step.webhook.url
|
(step) => step.type === IntegrationStepType.WEBHOOK && !step.webhook.url
|
||||||
@ -23,8 +23,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
return [
|
return [
|
||||||
...emptyWebhookSteps,
|
...emptyWebhookSteps,
|
||||||
...steps.map((s) => ({
|
...steps.map((s) => ({
|
||||||
|
id: s.id,
|
||||||
blockId: s.blockId,
|
blockId: s.blockId,
|
||||||
stepId: s.id,
|
|
||||||
name: `${block.title} > ${s.id}`,
|
name: `${block.title} > ${s.id}`,
|
||||||
})),
|
})),
|
||||||
]
|
]
|
||||||
|
@ -49,7 +49,7 @@ test('can get webhook steps', async ({ request }) => {
|
|||||||
const { steps } = await response.json()
|
const { steps } = await response.json()
|
||||||
expect(steps).toHaveLength(1)
|
expect(steps).toHaveLength(1)
|
||||||
expect(steps[0]).toEqual({
|
expect(steps[0]).toEqual({
|
||||||
stepId: 'step1',
|
id: 'step1',
|
||||||
blockId: 'block1',
|
blockId: 'block1',
|
||||||
name: 'Block #1 > step1',
|
name: 'Block #1 > step1',
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user