optumflex-subscription-ui
Version:
A comprehensive React UI component library for subscription management, pricing tables, shopping cart, and checkout systems with full customization support
82 lines • 2.42 kB
TypeScript
export interface PricingPackage {
id: string;
title: string;
package_name?: string;
description: string;
prices: {
weekly: number;
monthly: number;
quarterly: number;
halfyearly: number;
yearly: number;
};
discounted: {
weekly: number;
monthly: number;
quarterly: number;
halfyearly: number;
yearly: number;
};
features: string[];
popular?: boolean;
}
export type BillingCycle = keyof PricingPackage['prices'];
export type PlanType = 'subscriptionPlans' | 'modelPortfolios';
export interface CartItem {
plan: PricingPackage;
cycle: BillingCycle;
}
export interface SubscriptionState {
subscriptionPlans: PricingPackage[];
modelPortfolios: PricingPackage[];
loading: boolean;
error: string | null;
selectedCycles: {
[planId: string]: BillingCycle;
};
sortBy: string;
planType: PlanType;
}
export interface CheckoutPayload {
packageCode: string;
duration: BillingCycle;
}
export interface DiscountInfo {
originalPrice: number;
discountedPrice: number;
savings: number;
savingsPercentage: number;
isDiscounted: boolean;
}
export interface SubscriptionConfig {
initialPlanType?: PlanType;
initialSortBy?: string;
currencySymbol?: string;
showCart?: boolean;
enableSorting?: boolean;
enableFiltering?: boolean;
showSavingsAsPercentage?: boolean;
}
export interface UseSubscriptionOptions {
initialPlanType?: PlanType;
initialSortBy?: string;
initialData?: {
subscriptionPlans: PricingPackage[];
modelPortfolios: PricingPackage[];
};
config?: Partial<SubscriptionConfig>;
onError?: (error: string) => void;
onSuccess?: (message: string) => void;
}
export interface UseSubscriptionReturn extends SubscriptionState {
setPlanType: (type: PlanType) => void;
setSortBy: (sortBy: string) => void;
setSelectedCycle: (planId: string, cycle: BillingCycle) => void;
refreshData: () => Promise<void>;
getDisplayedPlans: () => PricingPackage[];
getSortedPlans: () => PricingPackage[];
getFilteredPlans: (searchQuery?: string) => PricingPackage[];
getDiscountInfo: (plan: PricingPackage, cycle: BillingCycle) => DiscountInfo;
getAvailableCycles: (plan: PricingPackage) => BillingCycle[];
}
//# sourceMappingURL=subscription.d.ts.map