add trial period ending banner + server logic (#11389)
Solution : - if user reaches his workflow usage cap + in trial period > display banner - end trial period if user has payment method (if not, not possible) <img width="941" alt="Screenshot 2025-04-04 at 10 27 32" src="https://github.com/user-attachments/assets/d7a1d5f7-9b12-4a92-a7c7-15ef8847c790" />
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { BillingProductKey } from '~/generated/graphql';
|
||||
|
||||
export const useIsSomeMeteredProductCapReached = (): boolean => {
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
|
||||
const meteredProductKeys = Object.values(BillingProductKey).filter(
|
||||
(productKey) => productKey !== BillingProductKey.BASE_PRODUCT,
|
||||
);
|
||||
|
||||
return meteredProductKeys.some((productKey) => {
|
||||
return (
|
||||
currentWorkspace?.currentBillingSubscription?.billingSubscriptionItems?.find(
|
||||
(item) => item.billingProduct?.metadata.productKey === productKey,
|
||||
)?.hasReachedCurrentPeriodCap ?? false
|
||||
);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user