@hsuite/subscriptions-types

A comprehensive TypeScript library that provides type definitions and interfaces for managing subscription-related functionality in the HSuite ecosystem.

Overview

The @hsuite/subscriptions-types package is a core library that defines the type system for subscription management. It includes interfaces, enums, and models for handling subscription plans, billing periods, statuses, and related functionality, with specific support for Web3 and configuration management.

Installation

npm install @hsuite/subscriptions-types

Dependencies

Peer Dependencies

  • @nestjs/common: ^10.4.2

  • @nestjs/core: ^10.4.2

Dependencies

  • @hsuite/nestjs-swagger: 2.0.0

  • @hsuite/smart-network-types: 2.0.0

Features

Subscription Plans

The library provides a standardized enumeration of subscription tiers:

  • BASIC: Entry-level plan with core features

  • PREMIUM: Mid-tier plan with enhanced capabilities

  • ENTERPRISE: Top-tier plan with complete feature access and dedicated support

Billing Periods

Supported billing cycles include:

  • MONTHLY: Monthly billing and renewal

  • YEARLY: Yearly billing and renewal

Subscription Statuses

Comprehensive status tracking for the entire subscription lifecycle:

  • PENDING: Awaiting processing or confirmation

  • PROCESSING: Currently being processed

  • MINTED: Subscription token minted on blockchain

  • DELIVERED: Successfully delivered to user

  • ACTIVE: Currently active and in use

  • CANCELLED: Terminated by user or system

  • EXPIRED: Reached end date

  • FAILED: Processing or activation failed

Namespaces

ISubscription

The main namespace that encapsulates all subscription-related functionality:

  • Type definitions for subscription management

  • Enums for plans, periodicities, and statuses

  • Integration with Web3 and configuration subsystems

Web3 Integration

Dedicated namespace for blockchain-related subscription features:

  • Web3 subscription entities

  • Payment processing structures

  • Analytics tracking

Configuration Management

Specialized namespace for subscription system configuration:

  • Plan configurations

  • System settings

  • Entity configurations

Usage

import { ISubscription } from '@hsuite/subscriptions-types';

// Using subscription plans
const plan = ISubscription.IPlan.PREMIUM;

// Working with billing periods
const period = ISubscription.IPeriodicity.MONTHLY;

// Managing subscription status
const status = ISubscription.IStatus.ACTIVE;

// Web3 subscription handling
const web3Sub = new Subscription.Web3.Entity();

// Configuration management
const config = new Subscription.Config.Entity();

Documentation

Detailed documentation can be generated using Compodoc:

npm run compodoc

For documentation with coverage testing:

npm run compodoc:coverage

Version

Current version: 2.0.0

License

This package is part of the HSuite ecosystem. All rights reserved.


Built with ❤️ by the HbarSuite Team Copyright © 2024 HbarSuite. All rights reserved.

Last updated