Skip to content

Commit

Permalink
use period usage count for remaining calculations on any plan except …
Browse files Browse the repository at this point in the history
…free
  • Loading branch information
CGastrell committed Aug 28, 2024
1 parent 5fd7f76 commit a06ce78
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
* External dependencies
*/
import { useDispatch, useSelect } from '@wordpress/data';
import {
PLAN_TYPE_FREE,
PLAN_TYPE_TIERED,
usePlanType as getPlanType,
} from '../../../../shared/use-plan-type';
import { PLAN_TYPE_FREE, usePlanType as getPlanType } from '../../../../shared/use-plan-type';
import type { WordPressPlansSelectors } from 'extensions/store/wordpress-com';

export default function useAiFeature() {
Expand All @@ -29,7 +25,7 @@ export default function useAiFeature() {
const currentTierLimit = currentTier?.limit || freeRequestsLimit;

const actualRequestsCount =
planType === PLAN_TYPE_TIERED ? usagePeriod?.requestsCount : allTimeRequestsCount;
planType === PLAN_TYPE_FREE ? allTimeRequestsCount : usagePeriod?.requestsCount;
const actualRequestsLimit = planType === PLAN_TYPE_FREE ? freeRequestsLimit : currentTierLimit;

return {
Expand Down

0 comments on commit a06ce78

Please sign in to comment.