UNPKG

pricing4ts

Version:

![NPM Version](https://img.shields.io/npm/v/pricing4ts) Pricing4TS is a TypeScript-based toolkit designed to enhance the server-side functionality of a pricing-driven SaaS by enabling the seamless integration of pricing plans into the application logic. T

21 lines (17 loc) 570 B
import { PricingJwtUtils } from '../utils/pricing-jwt-utils'; import { PricingContext } from './PricingContext'; export class PricingContextManager { private static context: PricingContext | null = null; static registerContext(context: PricingContext): void { this.context = context; PricingJwtUtils.setContext(context); } static getContext(): PricingContext { if (!this.context) { throw new Error( "PricingContext is not registered. Call 'PricingContextManager.registerContext' first." ); } return this.context; } }