WebExeBuilder Documentation

packageName

Category: Application Control

Namespace: web.app.packageName

Description

Get the current license package name (e.g., "Professional", "Enterprise", "Standard"). This identifies which license tier or edition the user has purchased.

Syntax

const packageName = await web.app.packageName();

Parameters

None

Returns

Promise<string> - Package name (e.g., "Professional", "Enterprise"), or empty string if not licensed

Example

Simple example

const package = await web.app.packageName();
console.log('Package:', package);

Practical example

const package = await web.app.packageName();

if (package) {
    document.getElementById('package-badge').textContent = package;
} else {
    document.getElementById('package-badge').textContent = 'Trial';
}

Advanced example

async function canUseFeature(feature) {
    const package = await web.app.packageName();
    
    const features = {
        'Standard': ['basic', 'export'],
        'Professional': ['basic', 'export', 'advanced', 'cloud'],
        'Enterprise': ['basic', 'export', 'advanced', 'cloud', 'api', 'priority']
    };
    
    if (!package) {
        // Trial version - limited features
        return ['basic'].includes(feature);
    }
    
    const allowedFeatures = features[package] || [];
    return allowedFeatures.includes(feature);
}

// Usage
const canExport = await canUseFeature('export');
if (canExport) {
    await exportData();
} else {
    alert('Export feature requires Professional or Enterprise package');
}

Use Cases

  • Display package type in About dialog
  • Enable/disable features based on package
  • Show upgrade prompts for higher tiers
  • Display package badge in UI
  • Implement package-specific behavior
  • Track package for analytics
  • Show available features by package
  • Provide upgrade path information

Error Handling

This method does not throw errors. Returns empty string if not licensed.

const package = await web.app.packageName();

if (package) {
    console.log('Package:', package);
} else {
    console.log('Trial version or not licensed');
}

Performance Tips

  • Cache the result at startup
  • Use for feature gating
  • Store in application state
  • Combine with feature matrix for access control
  • web.app.licensed() - Check if licensed
  • web.app.licenseInfo() - Get all license details
  • web.app.registrationName() - Get registered user
  • web.app.trialInfo() - Get trial information

Notes

  • Returns package/edition name from license
  • Empty string for trial or unlicensed versions
  • Use for feature differentiation
  • Common values: "Standard", "Professional", "Enterprise"
  • Package names are defined by your licensing system