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