fix(licensing): resolve variant from product_name when variant_name lacks tier info (#382)

Lemon Squeezy variant names describe billing periods ("Lifetime",
"Monthly", "Annual") without containing the tier name. resolveVariantType
now checks both variant_name and product_name (e.g. "Sencho Admiral") to
correctly identify the tier. Fixes Admiral licenses being misidentified
as Skipper when the LS variant name is just "Lifetime".
This commit is contained in:
Anso
2026-04-05 19:56:59 -04:00
committed by GitHub
parent ebb696e382
commit b08f698e8f
2 changed files with 33 additions and 10 deletions
@@ -94,6 +94,26 @@ describe('LicenseService.getVariant()', () => {
setLicenseState({ license_status: 'active', license_variant_name: 'Unknown Variant' });
expect(svc.getVariant()).toBe('skipper');
});
it('resolves from product_name when variant_name has no tier info (Admiral)', () => {
setLicenseState({
license_status: 'active',
license_variant_name: 'Lifetime',
license_product_name: 'Sencho Admiral',
});
expect(svc.getVariant()).toBe('admiral');
expect(DatabaseService.getInstance().getSystemState('license_variant_type')).toBe('admiral');
});
it('resolves from product_name when variant_name has no tier info (Skipper)', () => {
setLicenseState({
license_status: 'active',
license_variant_name: 'Monthly',
license_product_name: 'Sencho Skipper',
});
expect(svc.getVariant()).toBe('skipper');
expect(DatabaseService.getInstance().getSystemState('license_variant_type')).toBe('skipper');
});
});
describe('LicenseService.getTier()', () => {