fix: 🐛 misc
- Collaboration / Invitation type change failed - ChoiceForm items text align left - Webhook fails when choosing GET only
This commit is contained in:
@ -72,7 +72,11 @@ export const CollaborationList = () => {
|
|||||||
const handleChangeInvitationCollabType =
|
const handleChangeInvitationCollabType =
|
||||||
(email: string) => async (type: CollaborationType) => {
|
(email: string) => async (type: CollaborationType) => {
|
||||||
if (!typebot || !isOwner) return
|
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 })
|
if (error) return toast({ title: error.name, description: error.message })
|
||||||
mutateInvitations({
|
mutateInvitations({
|
||||||
invitations: (invitations ?? []).map((i) =>
|
invitations: (invitations ?? []).map((i) =>
|
||||||
@ -92,7 +96,11 @@ export const CollaborationList = () => {
|
|||||||
const handleChangeCollaborationType =
|
const handleChangeCollaborationType =
|
||||||
(userId: string) => async (type: CollaborationType) => {
|
(userId: string) => async (type: CollaborationType) => {
|
||||||
if (!typebot || !isOwner) return
|
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 })
|
if (error) return toast({ title: error.name, description: error.message })
|
||||||
mutateCollaborators({
|
mutateCollaborators({
|
||||||
collaborators: (collaborators ?? []).map((c) =>
|
collaborators: (collaborators ?? []).map((c) =>
|
||||||
|
@ -33,12 +33,12 @@ export const useCollaborators = ({
|
|||||||
export const updateCollaborator = (
|
export const updateCollaborator = (
|
||||||
typebotId: string,
|
typebotId: string,
|
||||||
userId: string,
|
userId: string,
|
||||||
updates: Partial<CollaboratorsOnTypebots>
|
collaborator: CollaboratorsOnTypebots
|
||||||
) =>
|
) =>
|
||||||
sendRequest({
|
sendRequest({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
url: `/api/typebots/${typebotId}/collaborators/${userId}`,
|
url: `/api/typebots/${typebotId}/collaborators/${userId}`,
|
||||||
body: updates,
|
body: collaborator,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const deleteCollaborator = (typebotId: string, userId: string) =>
|
export const deleteCollaborator = (typebotId: string, userId: string) =>
|
||||||
|
@ -35,17 +35,17 @@ export const sendInvitation = (
|
|||||||
|
|
||||||
export const updateInvitation = (
|
export const updateInvitation = (
|
||||||
typebotId: string,
|
typebotId: string,
|
||||||
userId: string,
|
email: string,
|
||||||
updates: Partial<Invitation>
|
invitation: Omit<Invitation, 'createdAt'>
|
||||||
) =>
|
) =>
|
||||||
sendRequest({
|
sendRequest({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
url: `/api/typebots/${typebotId}/invitations/${userId}`,
|
url: `/api/typebots/${typebotId}/invitations/${email}`,
|
||||||
body: updates,
|
body: invitation,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const deleteInvitation = (typebotId: string, userId: string) =>
|
export const deleteInvitation = (typebotId: string, email: string) =>
|
||||||
sendRequest({
|
sendRequest({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: `/api/typebots/${typebotId}/invitations/${userId}`,
|
url: `/api/typebots/${typebotId}/invitations/${email}`,
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import {
|
import {
|
||||||
defaultWebhookAttributes,
|
defaultWebhookAttributes,
|
||||||
|
HttpMethod,
|
||||||
KeyValue,
|
KeyValue,
|
||||||
PublicTypebot,
|
PublicTypebot,
|
||||||
ResultValues,
|
ResultValues,
|
||||||
@ -105,11 +106,14 @@ const executeWebhook =
|
|||||||
convertKeyValueTableToObject(webhook.queryParams, variables)
|
convertKeyValueTableToObject(webhook.queryParams, variables)
|
||||||
)
|
)
|
||||||
const contentType = headers ? headers['Content-Type'] : undefined
|
const contentType = headers ? headers['Content-Type'] : undefined
|
||||||
const body = getBodyContent(typebot)({
|
const body =
|
||||||
body: webhook.body,
|
webhook.method !== HttpMethod.GET
|
||||||
resultValues,
|
? getBodyContent(typebot)({
|
||||||
blockId,
|
body: webhook.body,
|
||||||
})
|
resultValues,
|
||||||
|
blockId,
|
||||||
|
})
|
||||||
|
: undefined
|
||||||
try {
|
try {
|
||||||
const response = await got(
|
const response = await got(
|
||||||
parseVariables(variables)(
|
parseVariables(variables)(
|
||||||
|
@ -42,7 +42,7 @@ export const ChoiceForm = ({ step, onSubmit }: ChoiceFormProps) => {
|
|||||||
role={step.options?.isMultipleChoice ? 'checkbox' : 'button'}
|
role={step.options?.isMultipleChoice ? 'checkbox' : 'button'}
|
||||||
onClick={handleClick(idx)}
|
onClick={handleClick(idx)}
|
||||||
className={
|
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
|
(selectedIndices.includes(idx) || !step.options?.isMultipleChoice
|
||||||
? ''
|
? ''
|
||||||
: 'selectable')
|
: 'selectable')
|
||||||
|
Reference in New Issue
Block a user