optumflex-subscription-ui
Version:
A comprehensive React UI component library for subscription management, pricing tables, shopping cart, and checkout systems with full customization support
69 lines • 2.27 kB
TypeScript
import { PricingPackage, BillingCycle, CartItem, CheckoutPayload, DiscountInfo } from '../types/subscription';
/**
* Parse features from API response format
*/
export declare const parseFeatures: (featuresArr: any[]) => string[];
/**
* Parse a single plan from API response
*/
export declare const parsePlan: (pkg: any) => PricingPackage;
/**
* Find the minimum price cycle for a plan
*/
export declare const getMinimumPriceCycle: (prices: PricingPackage["prices"]) => BillingCycle;
/**
* Get available billing cycles for a plan
*/
export declare const getAvailableCycles: (prices: PricingPackage["prices"]) => BillingCycle[];
/**
* Calculate discount information for a plan and cycle
*/
export declare const calculateDiscountInfo: (plan: PricingPackage, cycle: BillingCycle) => DiscountInfo;
/**
* Sort plans based on criteria
*/
export declare const sortPlans: (plans: PricingPackage[], sortBy: string, selectedCycles: {
[planId: string]: BillingCycle;
}) => PricingPackage[];
/**
* Generate checkout URL with cart data
*/
export declare const generateCheckoutUrl: (cart: CheckoutPayload[], baseUrl: string) => string;
/**
* Handle buy now functionality for a single plan
*/
export declare const handleBuyNow: (plan: PricingPackage, cycle: BillingCycle, companyInfo?: {
application?: string;
}) => void;
/**
* Format price with currency symbol
*/
export declare const formatPrice: (price: number) => string;
/**
* Calculate total cart value
*/
export declare const calculateCartTotal: (cart: {
plan: PricingPackage;
cycle: BillingCycle;
}[]) => number;
/**
* Create checkout payload from cart items
*/
export declare const createCheckoutPayload: (cart: CartItem[]) => CheckoutPayload[];
/**
* Check if a plan has any discounts
*/
export declare const hasDiscounts: (plan: PricingPackage) => boolean;
/**
* Get the best discount percentage for a plan
*/
export declare const getBestDiscountPercentage: (plan: PricingPackage) => number;
/**
* Validate plan data
*/
export declare const validatePlan: (plan: any) => boolean;
/**
* Filter plans by search query
*/
export declare const filterPlansBySearch: (plans: PricingPackage[], searchQuery: string) => PricingPackage[];
//# sourceMappingURL=subscription-utils.d.ts.map