2023-10-17 08:03:30 +02:00
|
|
|
import { Plan } from '@typebot.io/prisma'
|
2024-05-23 10:42:23 +02:00
|
|
|
import { chatsLimits } from '../constants'
|
2023-10-17 08:03:30 +02:00
|
|
|
import { Workspace } from '@typebot.io/schemas'
|
|
|
|
|
|
|
|
export const getChatsLimit = ({
|
|
|
|
plan,
|
|
|
|
customChatsLimit,
|
|
|
|
}: Pick<Workspace, 'plan'> & {
|
|
|
|
customChatsLimit?: Workspace['customChatsLimit']
|
|
|
|
}) => {
|
|
|
|
if (
|
|
|
|
plan === Plan.UNLIMITED ||
|
|
|
|
plan === Plan.LIFETIME ||
|
|
|
|
plan === Plan.OFFERED
|
|
|
|
)
|
2023-10-25 17:57:13 +02:00
|
|
|
return 'inf'
|
|
|
|
if (plan === Plan.CUSTOM) return customChatsLimit ?? 'inf'
|
2023-10-17 08:03:30 +02:00
|
|
|
return chatsLimits[plan]
|
|
|
|
}
|