mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-25 01:37:05 +00:00
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:
@@ -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()', () => {
|
||||
|
||||
Reference in New Issue
Block a user