Skip to content

Commit

Permalink
Updates license status handling
Browse files Browse the repository at this point in the history
Adds teams plan
  • Loading branch information
eamodio committed Mar 17, 2022
1 parent cf5e1c2 commit 02f8f6c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plus/subscription/subscriptionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,12 @@ interface GKLicenseInfo {

type GKLicenseType =
| 'gitlens-pro'
| 'gitlens-teams'
| 'gitlens-hosted-enterprise'
| 'gitlens-self-hosted-enterprise'
| 'gitlens-standalone-enterprise'
| 'bundle-pro'
| 'bundle-teams'
| 'bundle-hosted-enterprise'
| 'bundle-self-hosted-enterprise'
| 'bundle-standalone-enterprise';
Expand All @@ -909,6 +911,9 @@ function convertLicenseTypeToPlanId(licenseType: GKLicenseType): SubscriptionPla
case 'gitlens-pro':
case 'bundle-pro':
return SubscriptionPlanId.Pro;
case 'gitlens-teams':
case 'bundle-teams':
return SubscriptionPlanId.Teams;
case 'gitlens-hosted-enterprise':
case 'gitlens-self-hosted-enterprise':
case 'gitlens-standalone-enterprise':
Expand All @@ -926,16 +931,19 @@ function licenseStatusPriority(status: GKLicense['latestStatus']): number {
case 'active':
return 100;
case 'expired':
case 'cancelled':
return -100;
case 'in_trial':
case 'trial':
return 1;
case 'canceled':
case 'non_renewing':
return 0;
}
}

interface GKLicense {
latestStatus: 'active' | 'canceled' | 'expired' | 'trial';
latestStatus: 'active' | 'canceled' | 'cancelled' | 'expired' | 'in_trial' | 'non_renewing' | 'trial';
latestStartDate: string;
latestEndDate: string;
}
Expand Down

0 comments on commit 02f8f6c

Please sign in to comment.