🐛 (whatsapp) Fix WA preview not starting and accept audio and documents messages
This commit is contained in:
@@ -14,13 +14,6 @@ const inputShape = {
|
||||
} as const
|
||||
|
||||
export const createCredentials = authenticatedProcedure
|
||||
.meta({
|
||||
openapi: {
|
||||
method: 'POST',
|
||||
path: '/credentials',
|
||||
protect: true,
|
||||
},
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
credentials: z.discriminatedUnion(
|
||||
@@ -31,11 +24,6 @@ export const createCredentials = authenticatedProcedure
|
||||
),
|
||||
})
|
||||
)
|
||||
.output(
|
||||
z.object({
|
||||
credentialsId: z.string(),
|
||||
})
|
||||
)
|
||||
.mutation(async ({ input: { credentials }, ctx: { user } }) => {
|
||||
const workspace = await prisma.workspace.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -11,11 +11,6 @@ export const deleteCredentials = authenticatedProcedure
|
||||
workspaceId: z.string(),
|
||||
})
|
||||
)
|
||||
.output(
|
||||
z.object({
|
||||
credentialsId: z.string(),
|
||||
})
|
||||
)
|
||||
.mutation(
|
||||
async ({ input: { credentialsId, workspaceId }, ctx: { user } }) => {
|
||||
const workspace = await prisma.workspace.findFirst({
|
||||
|
||||
@@ -12,11 +12,6 @@ export const listCredentials = authenticatedProcedure
|
||||
type: z.enum(enabledBlocks),
|
||||
})
|
||||
)
|
||||
.output(
|
||||
z.object({
|
||||
credentials: z.array(z.object({ id: z.string(), name: z.string() })),
|
||||
})
|
||||
)
|
||||
.query(async ({ input: { workspaceId, type }, ctx: { user } }) => {
|
||||
const workspace = await prisma.workspace.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { router } from '@/helpers/server/trpc'
|
||||
import { createCredentials } from './createCredentials'
|
||||
import { deleteCredentials } from './deleteCredentials'
|
||||
import { listCredentials } from './listCredentials'
|
||||
|
||||
export const forgedCredentialsRouter = router({
|
||||
createCredentials,
|
||||
listCredentials,
|
||||
deleteCredentials,
|
||||
})
|
||||
@@ -15,13 +15,6 @@ export const fetchSelectItems = authenticatedProcedure
|
||||
workspaceId: z.string(),
|
||||
})
|
||||
)
|
||||
.output(
|
||||
z.object({
|
||||
items: z.array(
|
||||
z.string().or(z.object({ label: z.string(), value: z.string() }))
|
||||
),
|
||||
})
|
||||
)
|
||||
.query(
|
||||
async ({
|
||||
input: { workspaceId, integrationId, fetcherId, options },
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { router } from '@/helpers/server/trpc'
|
||||
import { fetchSelectItems } from './fetchSelectItems'
|
||||
import { createCredentials } from './credentials/createCredentials'
|
||||
import { deleteCredentials } from './credentials/deleteCredentials'
|
||||
import { listCredentials } from './credentials/listCredentials'
|
||||
|
||||
export const integrationsRouter = router({
|
||||
export const forgeRouter = router({
|
||||
fetchSelectItems,
|
||||
createCredentials,
|
||||
listCredentials,
|
||||
deleteCredentials,
|
||||
})
|
||||
|
||||
@@ -54,7 +54,7 @@ export const ForgeSelectInput = ({
|
||||
return fetchers.find((fetcher) => fetcher.id === fetcherId)
|
||||
}, [baseFetcher, blockDef.actions, fetcherId])
|
||||
|
||||
const { data } = trpc.integrations.fetchSelectItems.useQuery(
|
||||
const { data } = trpc.forge.fetchSelectItems.useQuery(
|
||||
{
|
||||
integrationId: blockDef.id,
|
||||
options: pick(options, [
|
||||
|
||||
@@ -34,14 +34,13 @@ export const ForgedCredentialsDropdown = ({
|
||||
const router = useRouter()
|
||||
const { showToast } = useToast()
|
||||
const { workspace, currentRole } = useWorkspace()
|
||||
const { data, refetch, isLoading } =
|
||||
trpc.integrationCredentials.listCredentials.useQuery(
|
||||
{
|
||||
workspaceId: workspace?.id as string,
|
||||
type: blockDef.id,
|
||||
},
|
||||
{ enabled: !!workspace?.id }
|
||||
)
|
||||
const { data, refetch, isLoading } = trpc.forge.listCredentials.useQuery(
|
||||
{
|
||||
workspaceId: workspace?.id as string,
|
||||
type: blockDef.id,
|
||||
},
|
||||
{ enabled: !!workspace?.id }
|
||||
)
|
||||
const [isDeleting, setIsDeleting] = useState<string>()
|
||||
|
||||
const { mutate } = trpc.credentials.deleteCredentials.useMutation({
|
||||
|
||||
@@ -42,7 +42,7 @@ export const ForgedCredentialsModal = ({
|
||||
listCredentials: { refetch: refetchCredentials },
|
||||
},
|
||||
} = trpc.useContext()
|
||||
const { mutate } = trpc.integrationCredentials.createCredentials.useMutation({
|
||||
const { mutate } = trpc.forge.createCredentials.useMutation({
|
||||
onMutate: () => setIsCreating(true),
|
||||
onSettled: () => setIsCreating(false),
|
||||
onError: (err) => {
|
||||
|
||||
Reference in New Issue
Block a user