Skip to main content

Overview

The useLicenseStatus hook provides a convenient way to manage and monitor VoiceTypr’s license and trial status in React components. It wraps the License Context and provides derived state for common license checks.

Import

Usage

Return Values

The hook returns an object with the following properties:
LicenseStatus | null
Current license status object, or null if not yet loaded
boolean
Computed boolean indicating if user has valid access (trial or licensed)
boolean
True while license status is being checked from the backend
() => Promise<void>
Function to manually trigger a license status check

LicenseStatus Type

The status field uses 'active' in the frontend (mapped from 'licensed' in backend) for consistency with UI state naming.

Examples

Display Trial Countdown

Conditional Feature Access

Manual License Check

License Activation Flow

Show Expiration Warning

Account Tab Integration

Implementation Details

The useLicenseStatus hook is a thin wrapper around the LicenseContext that:
  1. Accesses license state from React Context
  2. Computes derived values like isValid
  3. Provides a cleaner API for component use
Source:

Context Provider

The hook requires the LicenseProvider to be present in the component tree:

Automatic Status Checks

The License Context automatically:
  • Checks license status on app startup
  • Respects 8-hour cache TTL
  • Validates against offline grace periods
  • Updates status when license commands are invoked

See Also