Download wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan-term.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 593 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan-term.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan-term.ts
-
curl -L -o use-current-plan-term.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan-term.ts
593 Bytes
| import { type BillingTerm, getTermFromDuration } from '@automattic/calypso-products'; | |
| import usePlans from '../queries/use-plans'; | |
| import useCurrentPlan from './use-current-plan'; | |
| interface Props { | |
| siteId?: string | number | null; | |
| } | |
| const useCurrentPlanTerm = ( { siteId }: Props ): BillingTerm[ 'term' ] | undefined => { | |
| const plans = usePlans( { coupon: undefined } ).data; | |
| const currentPlan = useCurrentPlan( { siteId } ); | |
| return plans && currentPlan | |
| ? getTermFromDuration( plans[ currentPlan.planSlug ]?.pricing?.billPeriod ) | |
| : undefined; | |
| }; | |
| export default useCurrentPlanTerm; | |