From 33b36d76fced9a3f5f59476eb2ad5b3d3d62d1fb Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 17 Sep 2025 14:15:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20published=20typebot=20for?= =?UTF-8?q?=20result=20transcript=20instead=20of=20dev=20typebot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../results/api/getResultTranscript.ts | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/builder/src/features/results/api/getResultTranscript.ts b/apps/builder/src/features/results/api/getResultTranscript.ts index af8266315..14599036a 100644 --- a/apps/builder/src/features/results/api/getResultTranscript.ts +++ b/apps/builder/src/features/results/api/getResultTranscript.ts @@ -53,12 +53,15 @@ export const getResultTranscript = authenticatedProcedure id: input.typebotId, }, select: { - id: true, - version: true, - groups: true, - edges: true, - variables: true, - events: true, + publishedTypebot: { + select: { + version: true, + groups: true, + edges: true, + variables: true, + events: true, + }, + }, workspace: { select: { isSuspended: true, @@ -79,14 +82,17 @@ export const getResultTranscript = authenticatedProcedure }, }); - if (!typebot || (await isReadTypebotForbidden(typebot, user))) + if ( + !typebot?.publishedTypebot || + (await isReadTypebotForbidden(typebot, user)) + ) throw new TRPCError({ code: "NOT_FOUND", message: "Typebot not found" }); // Fetch result data const result = await prisma.result.findUnique({ where: { id: input.resultId, - typebotId: typebot.id, + typebotId: input.typebotId, }, select: { answers: { @@ -148,7 +154,10 @@ export const getResultTranscript = authenticatedProcedure })); const transcript = computeResultTranscript({ - typebot: typebotInSessionStateSchema.parse(typebot), + typebot: typebotInSessionStateSchema.parse({ + ...typebot.publishedTypebot, + id: input.typebotId, + }), answers, setVariableHistory, visitedEdges,