🛂 Prevent blocking everything once limit is reached
The idea is to make the hard limit less scary. I'd prefer manually reaching out to users when they are over their monthly limit
This commit is contained in:
@ -58,7 +58,7 @@ export const getUploadUrl = publicProcedure
|
||||
'S3 not properly configured. Missing one of those variables: S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY',
|
||||
})
|
||||
|
||||
const hasReachedStorageLimit = await checkIfStorageLimitReached(typebotId)
|
||||
await checkIfStorageLimitReached(typebotId)
|
||||
const publicTypebot = (await prisma.publicTypebot.findFirst({
|
||||
where: { typebotId },
|
||||
select: {
|
||||
@ -87,7 +87,7 @@ export const getUploadUrl = publicProcedure
|
||||
|
||||
return {
|
||||
presignedUrl,
|
||||
hasReachedStorageLimit,
|
||||
hasReachedStorageLimit: false,
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -284,19 +284,12 @@ const getTypebot = async (
|
||||
message: 'Typebot is closed',
|
||||
})
|
||||
|
||||
const hasReachedLimit =
|
||||
typebotQuery && 'typebot' in typebotQuery
|
||||
? await checkChatsUsage({
|
||||
typebotId: parsedTypebot.id,
|
||||
workspace: typebotQuery.typebot.workspace,
|
||||
})
|
||||
: false
|
||||
|
||||
if (hasReachedLimit)
|
||||
throw new TRPCError({
|
||||
code: 'FORBIDDEN',
|
||||
message: 'You have reached your chats limit',
|
||||
})
|
||||
typebotQuery && 'typebot' in typebotQuery
|
||||
? await checkChatsUsage({
|
||||
typebotId: parsedTypebot.id,
|
||||
workspace: typebotQuery.typebot.workspace,
|
||||
})
|
||||
: false
|
||||
|
||||
return parsedTypebot
|
||||
}
|
||||
|
@ -49,12 +49,8 @@ export const AlmostReachedChatsLimitEmail = ({
|
||||
</Text>
|
||||
<Text>This limit will be reset on {readableResetDate}.</Text>
|
||||
<Text fontWeight="800">
|
||||
Your bots won't start the chat if you reach the limit before
|
||||
this date❗
|
||||
</Text>
|
||||
<Text>
|
||||
If you need more monthly responses, you will need to upgrade your
|
||||
plan.
|
||||
Upon this limit your bots will still continue to chat, but we ask
|
||||
you kindly to upgrade your monthly chats limit.
|
||||
</Text>
|
||||
|
||||
<MjmlSpacer height="24px" />
|
||||
|
@ -40,11 +40,9 @@ export const AlmostReachedStorageLimitEmail = ({
|
||||
limit.
|
||||
</Text>
|
||||
<Text fontWeight="800">
|
||||
Your bots won't collect new files once you reach the limit❗
|
||||
</Text>
|
||||
<Text>
|
||||
To make sure it won't happen, you need to upgrade your plan
|
||||
or delete existing results to free up space.
|
||||
Upon this limit your bots will still continue to collect new
|
||||
files, but we ask you kindly to upgrade your storage limit or
|
||||
delete existing results to free up space.
|
||||
</Text>
|
||||
<MjmlSpacer height="24px" />
|
||||
<Button link={url}>Upgrade workspace</Button>
|
||||
|
@ -46,12 +46,9 @@ export const ReachedChatsLimitEmail = ({
|
||||
It just happened, you've reached your monthly{' '}
|
||||
{readableChatsLimit} chats limit 😮
|
||||
</Text>
|
||||
<Text fontWeight="800">
|
||||
It means your bots are closed until {readableResetDate}❗
|
||||
</Text>
|
||||
<Text>
|
||||
If you'd like to continue chatting with your users this
|
||||
month, then you need to upgrade your plan. 🚀
|
||||
If you'd like your bots to continue chatting with your users
|
||||
this month, then you need to upgrade your plan. 🚀
|
||||
</Text>
|
||||
|
||||
<MjmlSpacer height="24px" />
|
||||
|
@ -37,9 +37,6 @@ export const ReachedStorageLimitEmail = ({
|
||||
It just happened, you've reached your {readableStorageLimit}{' '}
|
||||
storage limit 😮
|
||||
</Text>
|
||||
<Text fontWeight="800">
|
||||
It means your bots won't collect new files from your users❗
|
||||
</Text>
|
||||
<Text>
|
||||
If you'd like to continue collecting files, then you need to
|
||||
upgrade your plan or remove existing results to free up space. 🚀
|
||||
|
Reference in New Issue
Block a user