diff --git a/apps/builder/components/shared/TypebotHeader/CollaborationMenuButton/CollaborationList.tsx b/apps/builder/components/shared/TypebotHeader/CollaborationMenuButton/CollaborationList.tsx index a57dc9ce3..f5b81597a 100644 --- a/apps/builder/components/shared/TypebotHeader/CollaborationMenuButton/CollaborationList.tsx +++ b/apps/builder/components/shared/TypebotHeader/CollaborationMenuButton/CollaborationList.tsx @@ -72,7 +72,11 @@ export const CollaborationList = () => { const handleChangeInvitationCollabType = (email: string) => async (type: CollaborationType) => { if (!typebot || !isOwner) return - const { error } = await updateInvitation(typebot?.id, email, { type }) + const { error } = await updateInvitation(typebot?.id, email, { + email, + typebotId: typebot.id, + type, + }) if (error) return toast({ title: error.name, description: error.message }) mutateInvitations({ invitations: (invitations ?? []).map((i) => @@ -92,7 +96,11 @@ export const CollaborationList = () => { const handleChangeCollaborationType = (userId: string) => async (type: CollaborationType) => { if (!typebot || !isOwner) return - const { error } = await updateCollaborator(typebot?.id, userId, { type }) + const { error } = await updateCollaborator(typebot?.id, userId, { + userId, + type, + typebotId: typebot.id, + }) if (error) return toast({ title: error.name, description: error.message }) mutateCollaborators({ collaborators: (collaborators ?? []).map((c) => diff --git a/apps/builder/services/typebots/collaborators.ts b/apps/builder/services/typebots/collaborators.ts index 899103cc7..81f92fc0c 100644 --- a/apps/builder/services/typebots/collaborators.ts +++ b/apps/builder/services/typebots/collaborators.ts @@ -33,12 +33,12 @@ export const useCollaborators = ({ export const updateCollaborator = ( typebotId: string, userId: string, - updates: Partial + collaborator: CollaboratorsOnTypebots ) => sendRequest({ method: 'PUT', url: `/api/typebots/${typebotId}/collaborators/${userId}`, - body: updates, + body: collaborator, }) export const deleteCollaborator = (typebotId: string, userId: string) => diff --git a/apps/builder/services/typebots/invitations.ts b/apps/builder/services/typebots/invitations.ts index 09d09b011..6cfc09ca6 100644 --- a/apps/builder/services/typebots/invitations.ts +++ b/apps/builder/services/typebots/invitations.ts @@ -35,17 +35,17 @@ export const sendInvitation = ( export const updateInvitation = ( typebotId: string, - userId: string, - updates: Partial + email: string, + invitation: Omit ) => sendRequest({ method: 'PUT', - url: `/api/typebots/${typebotId}/invitations/${userId}`, - body: updates, + url: `/api/typebots/${typebotId}/invitations/${email}`, + body: invitation, }) -export const deleteInvitation = (typebotId: string, userId: string) => +export const deleteInvitation = (typebotId: string, email: string) => sendRequest({ method: 'DELETE', - url: `/api/typebots/${typebotId}/invitations/${userId}`, + url: `/api/typebots/${typebotId}/invitations/${email}`, }) diff --git a/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts b/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts index 4731e4adb..8cbca6663 100644 --- a/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts +++ b/apps/viewer/pages/api/typebots/[typebotId]/blocks/[blockId]/steps/[stepId]/executeWebhook.ts @@ -1,6 +1,7 @@ import prisma from 'libs/prisma' import { defaultWebhookAttributes, + HttpMethod, KeyValue, PublicTypebot, ResultValues, @@ -105,11 +106,14 @@ const executeWebhook = convertKeyValueTableToObject(webhook.queryParams, variables) ) const contentType = headers ? headers['Content-Type'] : undefined - const body = getBodyContent(typebot)({ - body: webhook.body, - resultValues, - blockId, - }) + const body = + webhook.method !== HttpMethod.GET + ? getBodyContent(typebot)({ + body: webhook.body, + resultValues, + blockId, + }) + : undefined try { const response = await got( parseVariables(variables)( diff --git a/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx b/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx index e19bb0df8..66c390d0a 100644 --- a/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx +++ b/packages/bot-engine/src/components/ChatBlock/ChatStep/inputs/ChoiceForm.tsx @@ -42,7 +42,7 @@ export const ChoiceForm = ({ step, onSubmit }: ChoiceFormProps) => { role={step.options?.isMultipleChoice ? 'checkbox' : 'button'} onClick={handleClick(idx)} className={ - 'py-2 px-4 font-semibold rounded-md transition-all filter hover:brightness-90 active:brightness-75 duration-100 focus:outline-none mr-2 mb-2 typebot-button ' + + 'py-2 px-4 text-left font-semibold rounded-md transition-all filter hover:brightness-90 active:brightness-75 duration-100 focus:outline-none mr-2 mb-2 typebot-button ' + (selectedIndices.includes(idx) || !step.options?.isMultipleChoice ? '' : 'selectable')