@alfadesmeta/nocodecart-cli
Version:
CLI tool for installing NoCodeCart premium templates and components in FlutterFlow projects
98 lines (97 loc) • 2.96 kB
TypeScript
export declare enum LicenseErrorType {
VALIDATION_ERROR = "VALIDATION_ERROR",
ACTIVATION_ERROR = "ACTIVATION_ERROR",
DEACTIVATION_ERROR = "DEACTIVATION_ERROR",
NETWORK_ERROR = "NETWORK_ERROR",
CONFIGURATION_ERROR = "CONFIGURATION_ERROR"
}
export declare class LicenseError extends Error {
type: LicenseErrorType;
originalError?: any | undefined;
constructor(type: LicenseErrorType, message: string, originalError?: any | undefined);
}
export interface LicenseUser {
id: string;
email: string;
public_name: string;
avatar_url: string | null;
}
export interface LicenseCustomer {
id: string;
email: string;
name: string | null;
organization_id: string;
avatar_url: string;
created_at: string;
modified_at: string | null;
metadata: Record<string, any>;
email_verified: boolean;
billing_address: {
line1: string | null;
line2: string | null;
postal_code: string | null;
city: string | null;
state: string | null;
country: string;
} | null;
tax_id: any[] | null;
}
export interface LicenseActivation {
id: string;
license_key_id: string;
label: string;
meta: Record<string, any>;
created_at: string;
modified_at: string | null;
}
export interface LicenseResponse {
id: string;
organization_id: string;
customer_id: string;
benefit_id: string;
key: string;
display_key: string;
status: 'granted' | 'revoked' | 'disabled';
limit_activations: number | null;
usage: number;
limit_usage: number | null;
validations: number;
last_validated_at: string | null;
expires_at: string | null;
activation?: LicenseActivation;
user: LicenseUser;
customer: LicenseCustomer;
}
export interface LicenseActivationMeta {
hostname: string;
platform: string;
activation_date: string;
app_version?: string;
device_info?: {
os: string;
platform: string;
release: string;
arch: string;
memory: string;
cpu: string;
};
}
export declare class LicenseService {
private readonly config;
private readonly API_URL;
private readonly headers;
constructor(config?: {
organizationId: string;
accessToken: string;
});
private bytesToGB;
private generateActivationMeta;
private handleAxiosError;
validateLicense(licenseKey: string, activationId?: string): Promise<LicenseResponse>;
activateLicense(licenseKey: string, label?: string, customMeta?: Record<string, any>): Promise<LicenseResponse>;
deactivateLicense(licenseKey: string, activationId: string): Promise<void>;
getLicenseDetails(licenseId: string): Promise<LicenseResponse>;
isLicenseValid(licenseKey: string): Promise<boolean>;
getRemainingActivations(licenseKey: string): Promise<number | null>;
hasActiveActivation(licenseKey: string): Promise<boolean>;
}