From a06ce78cc502d787b9c20ebb62b9fb6a4e77ddc2 Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Wed, 28 Aug 2024 16:20:19 -0300 Subject: [PATCH] use period usage count for remaining calculations on any plan except free --- .../blocks/ai-assistant/hooks/use-ai-feature/index.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/projects/plugins/jetpack/extensions/blocks/ai-assistant/hooks/use-ai-feature/index.ts b/projects/plugins/jetpack/extensions/blocks/ai-assistant/hooks/use-ai-feature/index.ts index 3ec27eac2ed90..db84bbd4577c7 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-assistant/hooks/use-ai-feature/index.ts +++ b/projects/plugins/jetpack/extensions/blocks/ai-assistant/hooks/use-ai-feature/index.ts @@ -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() { @@ -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 {