From fd6b94bb1b61f2ce416e2f004afb52dde36dbdb4 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 13 Dec 2022 08:21:18 +0100 Subject: [PATCH] :bug: (workspace) Read custom limits even without CUSTOM plan --- packages/utils/pricing.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/utils/pricing.ts b/packages/utils/pricing.ts index ee6b7f218..25b2b632f 100644 --- a/packages/utils/pricing.ts +++ b/packages/utils/pricing.ts @@ -23,6 +23,13 @@ export const chatsLimit = { price: 10, }, }, + [Plan.CUSTOM]: { + totalIncluded: 2000, + increaseStep: { + amount: 500, + price: 10, + }, + }, [Plan.OFFERED]: { totalIncluded: infinity }, [Plan.LIFETIME]: { totalIncluded: infinity }, } as const @@ -43,6 +50,13 @@ export const storageLimit = { price: 2, }, }, + [Plan.CUSTOM]: { + totalIncluded: 2, + increaseStep: { + amount: 1, + price: 2, + }, + }, [Plan.OFFERED]: { totalIncluded: 2 }, [Plan.LIFETIME]: { totalIncluded: 10 }, } as const @@ -55,6 +69,9 @@ export const seatsLimit = { [Plan.PRO]: { totalIncluded: 5, }, + [Plan.CUSTOM]: { + totalIncluded: 2, + }, [Plan.OFFERED]: { totalIncluded: 2 }, [Plan.LIFETIME]: { totalIncluded: 8 }, } as const @@ -64,8 +81,7 @@ export const getChatsLimit = ({ additionalChatsIndex, customChatsLimit, }: Pick) => { - if (plan === Plan.CUSTOM) - return customChatsLimit ?? chatsLimit[Plan.FREE].totalIncluded + if (customChatsLimit) return customChatsLimit const { totalIncluded } = chatsLimit[plan] const increaseStep = plan === Plan.STARTER || plan === Plan.PRO @@ -83,8 +99,7 @@ export const getStorageLimit = ({ Workspace, 'additionalStorageIndex' | 'plan' | 'customStorageLimit' >) => { - if (plan === Plan.CUSTOM) - return customStorageLimit ?? storageLimit[Plan.FREE].totalIncluded + if (customStorageLimit) return customStorageLimit const { totalIncluded } = storageLimit[plan] const increaseStep = plan === Plan.STARTER || plan === Plan.PRO @@ -97,8 +112,7 @@ export const getSeatsLimit = ({ plan, customSeatsLimit, }: Pick) => { - if (plan === Plan.CUSTOM) - return customSeatsLimit ?? seatsLimit[Plan.FREE].totalIncluded + if (customSeatsLimit) return customSeatsLimit return seatsLimit[plan].totalIncluded }