🐛 (credentials) Fix credentials not listing when workspace has legacy zemantic
This commit is contained in:
@ -62,6 +62,8 @@ const CredentialsCreateModalContent = ({
|
||||
onClose={onClose}
|
||||
/>
|
||||
)
|
||||
case 'zemanticAi':
|
||||
return null
|
||||
default:
|
||||
return (
|
||||
<CreateForgedCredentialsModalContent
|
||||
|
@ -211,6 +211,8 @@ const CredentialsIcon = ({
|
||||
return <StripeLogo rounded="sm" {...props} />
|
||||
case 'whatsApp':
|
||||
return <WhatsAppLogo {...props} />
|
||||
case 'zemanticAi':
|
||||
return null
|
||||
default:
|
||||
return <BlockIcon type={type} {...props} />
|
||||
}
|
||||
@ -245,6 +247,8 @@ const CredentialsLabel = ({
|
||||
WhatsApp
|
||||
</Text>
|
||||
)
|
||||
case 'zemanticAi':
|
||||
return null
|
||||
default:
|
||||
return <BlockLabel type={type} {...props} />
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ const CredentialsUpdateModalContent = ({
|
||||
onUpdate={onSubmit}
|
||||
/>
|
||||
)
|
||||
case 'zemanticAi':
|
||||
case 'whatsApp':
|
||||
return null
|
||||
default:
|
||||
|
@ -16,7 +16,7 @@ import {
|
||||
import React, { useState } from 'react'
|
||||
import { ZodObjectLayout } from '../zodLayouts/ZodObjectLayout'
|
||||
import { ForgedBlockDefinition } from '@typebot.io/forge-repository/types'
|
||||
import { Credentials } from '@typebot.io/schemas'
|
||||
import { CredentialsWithoutLegacy } from '@typebot.io/schemas'
|
||||
|
||||
type Props = {
|
||||
blockDef: ForgedBlockDefinition
|
||||
@ -87,11 +87,11 @@ export const CreateForgedCredentialsModalContent = ({
|
||||
if (!workspace || !blockDef.auth) return
|
||||
mutate({
|
||||
credentials: {
|
||||
type: blockDef.id as Credentials['type'],
|
||||
type: blockDef.id,
|
||||
workspaceId: workspace.id,
|
||||
name,
|
||||
data,
|
||||
} as Credentials,
|
||||
} as CredentialsWithoutLegacy,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { ZodObjectLayout } from '../zodLayouts/ZodObjectLayout'
|
||||
import { ForgedBlockDefinition } from '@typebot.io/forge-repository/types'
|
||||
import { Credentials } from '@typebot.io/schemas'
|
||||
import { CredentialsWithoutLegacy } from '@typebot.io/schemas'
|
||||
|
||||
type Props = {
|
||||
credentialsId: string
|
||||
@ -76,7 +76,7 @@ export const UpdateForgedCredentialsModalContent = ({
|
||||
workspaceId: workspace.id,
|
||||
name,
|
||||
data,
|
||||
} as Credentials,
|
||||
} as CredentialsWithoutLegacy,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { z } from '../zod'
|
||||
import { zemanticAiCredentialsSchema } from './blocks'
|
||||
import { stripeCredentialsSchema } from './blocks/inputs/payment/schema'
|
||||
import { googleSheetsCredentialsSchema } from './blocks/integrations/googleSheets/schema'
|
||||
import { smtpCredentialsSchema } from './blocks/integrations/sendEmail'
|
||||
@ -10,19 +11,30 @@ const credentialsSchema = z.discriminatedUnion('type', [
|
||||
googleSheetsCredentialsSchema,
|
||||
stripeCredentialsSchema,
|
||||
whatsAppCredentialsSchema,
|
||||
zemanticAiCredentialsSchema,
|
||||
...Object.values(forgedCredentialsSchemas),
|
||||
])
|
||||
|
||||
export type Credentials = z.infer<typeof credentialsSchema>
|
||||
|
||||
export type CredentialsWithoutLegacy = Exclude<
|
||||
Credentials,
|
||||
{
|
||||
type: 'zemanticAi'
|
||||
}
|
||||
>
|
||||
|
||||
export const credentialsTypes = [
|
||||
'smtp',
|
||||
'google sheets',
|
||||
'stripe',
|
||||
'whatsApp',
|
||||
'zemanticAi',
|
||||
...(Object.keys(forgedCredentialsSchemas) as Array<
|
||||
keyof typeof forgedCredentialsSchemas
|
||||
>),
|
||||
] as const
|
||||
|
||||
export const credentialsTypeSchema = z.enum(credentialsTypes)
|
||||
|
||||
export const legacyCredentialsTypes = ['zemanticAi']
|
||||
|
Reference in New Issue
Block a user