Browse Source

Updates license status handling

Adds teams plan
main
Eric Amodio 2 years ago
parent
commit
02f8f6c3d3
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/plus/subscription/subscriptionService.ts

+ 9
- 1
src/plus/subscription/subscriptionService.ts View File

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

Loading…
Cancel
Save