♻️ Remove @typebot.io/schemas from @typebot.io/lib
This commit is contained in:
19
packages/billing/getChatsLimit.ts
Normal file
19
packages/billing/getChatsLimit.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Plan } from '@typebot.io/prisma'
|
||||
import { chatsLimits } from './constants'
|
||||
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
|
||||
)
|
||||
return 'inf'
|
||||
if (plan === Plan.CUSTOM) return customChatsLimit ?? 'inf'
|
||||
return chatsLimits[plan]
|
||||
}
|
||||
Reference in New Issue
Block a user