diff --git a/src/plus/gk/checkin.ts b/src/plus/gk/checkin.ts index 5628872d9baf1..73284af87a772 100644 --- a/src/plus/gk/checkin.ts +++ b/src/plus/gk/checkin.ts @@ -1,11 +1,10 @@ import type { Organization } from './account/organization'; import type { Subscription } from './account/subscription'; import { - computeSubscriptionState, getSubscriptionPlan, getSubscriptionPlanPriority, + isSubscriptionExpired, SubscriptionPlanId, - SubscriptionState, } from './account/subscription'; export interface GKCheckInResponse { @@ -72,7 +71,6 @@ export function getSubscriptionFromCheckIn( let effectiveLicenses = Object.entries(data.licenses.effectiveLicenses) as [GKLicenseType, GKLicense][]; let paidLicenses = Object.entries(data.licenses.paidLicenses) as [GKLicenseType, GKLicense][]; - paidLicenses = paidLicenses.filter(license => license[1].latestStatus !== 'cancelled'); if (paidLicenses.length > 1) { paidLicenses.sort( (a, b) => @@ -82,6 +80,7 @@ export function getSubscriptionFromCheckIn( licenseStatusPriority(a[1].latestStatus)), ); } + if (effectiveLicenses.length > 1) { effectiveLicenses.sort( (a, b) => @@ -180,17 +179,10 @@ export function getSubscriptionFromCheckIn( ); } - const isActualLicenseExpired = - computeSubscriptionState({ - plan: { - actual: actual, - effective: actual, - }, - account: account, - }) === SubscriptionState.PaidExpired; if ( effective == null || - (getSubscriptionPlanPriority(actual.id) >= getSubscriptionPlanPriority(effective.id) && !isActualLicenseExpired) + (getSubscriptionPlanPriority(actual.id) >= getSubscriptionPlanPriority(effective.id) && + !isSubscriptionExpired(actual)) ) { effective = { ...actual }; }