citeon-pricing
v0.0.1
Published
Pricing and subscription plan definitions for CiteOn app
Downloads
92
Readme
citeon-pricing
Shared pricing and subscription plan definitions for CiteOn app.
Overview
This module contains the centralized definitions for app subscription plans and their associated features. It provides type-safe access to plan configurations including:
- Maximum number of products in LLMS files
- Synchronization frequency options (hourly, daily, weekly)
- Instant sync capability (push to channel on webhook updates)
- FAQ schema data for AI features
The module is designed to be shared across multiple services (API, Queue, etc.) to ensure consistency in plan feature enforcement.
Installation
# From the backend directory
cd pricing
npm install
npm run buildUsage
import {
SHOP_APP_PLANS,
APP_PLANS,
AppPlanConfig,
getAppPlanCountProducts,
getAppPlanInstantSync,
getAppPlanSyncFrequency,
getAppPlanFaqSchemaForAi,
} from 'citeon-pricing';
// Get plan features for standard plans
const maxProducts = getAppPlanCountProducts('basic'); // 100
const hasInstantSync = getAppPlanInstantSync('free'); // false
const syncFreq = getAppPlanSyncFrequency('pro'); // ['hourly', 'daily', 'weekly']
const hasFaqSchema = getAppPlanFaqSchemaForAi('basic'); // true
// Custom plan requires configuration
const customConfig: AppPlanConfig = {
name: 'Enterprise', // optional
price: 99, // optional
recurring: true,
count_products: 10000,
sync_frequency: ['hourly', 'daily'],
instant_sync: true,
has_faq_schema_for_ai: true,
};
const customMaxProducts = getAppPlanCountProducts('custom', customConfig); // 10000Plan Features
| Feature | Free | Basic | Pro | Plus | Custom | |---------|------|-------|-----|------|--------| | Max Products in LLMS Files | 10 | 100 | 1,000 | 5,000 | Configurable | | Sync Frequency | Daily, Weekly | Hourly, Daily, Weekly | Hourly, Daily, Weekly | Hourly, Daily, Weekly | Configurable | | Instant Sync | ❌ | ✅ | ✅ | ✅ | Configurable | | FAQ Schema for AI | ❌ | ✅ | ✅ | ✅ | Configurable |
Note: Custom plans require an
AppPlanConfigobject to be provided. All features are configurable per customer requirements.
API Reference
Constants
SHOP_APP_PLANS
Available subscription plan identifiers.
const SHOP_APP_PLANS = {
FREE: 'free',
BASIC: 'basic',
PRO: 'pro',
PLUS: 'plus',
CUSTOM: 'custom',
} as const;SYNC_FREQUENCY
Available synchronization frequencies.
const SYNC_FREQUENCY = {
HOURLY: 'hourly',
DAILY: 'daily',
WEEKLY: 'weekly',
} as const;APP_PLANS
Complete plan configuration object with all features per plan.
AppPlanConfig
Interface for custom plan configuration. Required when using 'custom' plan type.
interface AppPlanConfig {
name?: string;
price?: number;
recurring: boolean;
count_products: number;
sync_frequency: readonly SyncFrequency[];
instant_sync: boolean;
has_faq_schema_for_ai: boolean;
}Helper Functions
| Function | Description | Return Type |
|----------|-------------|-------------|
| getAppPlanCountProducts(plan) or getAppPlanCountProducts('custom', config) | Get maximum number of products in llms files | number |
| getAppPlanInstantSync(plan) or getAppPlanInstantSync('custom', config) | Check if instant sync is available | boolean |
| getAppPlanSyncFrequency(plan) or getAppPlanSyncFrequency('custom', config) | Get allowed sync frequencies | SyncFrequency[] |
| getAppPlanFaqSchemaForAi(plan) or getAppPlanFaqSchemaForAi('custom', config) | Check if FAQ schema for AI is available | boolean |
Note: For standard plans (
'free','basic','pro'), only pass theplanparameter. For'custom'plan, you must also pass theconfigparameter.
Function Signatures:
// For custom plans - customPlanConfig is required
function getAppPlanCountProducts(
appPlan: 'custom',
customPlanConfig: AppPlanConfig
): number;
// For standard plans - customPlanConfig is not needed
function getAppPlanCountProducts(
appPlan: AppPlan | null
): number;
// ... similar for all other functionsNote:
- All helper functions use function overloading to enforce type safety
- For standard plans (
'free','basic','pro'), you do not need to passcustomPlanConfig- For
'custom'plan,customPlanConfigis required (TypeScript will enforce this at compile time)- Functions default to FREE plan features when
appPlanisnull- Functions throw a runtime error if
appPlan === 'custom'andcustomPlanConfigis not provided
Types
type AppPlan = 'free' | 'basic' | 'pro' | 'plus' | 'custom';
type SyncFrequency = 'hourly' | 'daily' | 'weekly';
interface AppPlanConfig {
name?: string;
price?: number;
recurring: boolean;
count_products: number;
sync_frequency: readonly SyncFrequency[];
instant_sync: boolean;
has_faq_schema_for_ai: boolean;
}Development
# Build the module
npm run build
# Clean build artifacts
npm run cleanLicense
UNLICENSED - Private module for CiteOn
