File size: 579 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { type } from './constants';
import { ResponseDomain } from './types';

export function isDomainRenewable( domain: ResponseDomain ) {
	// Only registered domains can be manually renewed
	if ( domain.type !== type.REGISTERED ) {
		return false;
	}
	const shouldNotAllowManualRenew =
		! domain.subscriptionId ||
		domain.isPendingRenewal ||
		domain.pendingRegistrationAtRegistry ||
		domain.pendingRegistration ||
		! domain.currentUserCanManage ||
		( ! domain.isRenewable && ! domain.isRedeemable ) ||
		domain.aftermarketAuction;
	return ! shouldNotAllowManualRenew;
}