import React from "react"; import { FeatureKey, UsageTracking } from "../components/atoms/SubscriptionGuard/PlanLimits.types"; /** * Usage context value */ interface UsageContextValue { /** * Current plan ID */ planId: string; /** * Current usage tracking data */ usage: UsageTracking; /** * Update usage for a feature */ updateUsage: (feature: FeatureKey, count: number) => void; /** * Increment usage for a feature */ incrementUsage: (feature: FeatureKey, count?: number) => void; /** * Decrement usage for a feature */ decrementUsage: (feature: FeatureKey, count?: number) => void; /** * Reset usage for current period */ resetPeriodUsage: () => void; /** * Set usage from external source */ setUsage: (usage: UsageTracking) => void; /** * Set plan ID */ setPlanId: (planId: string) => void; } /** * Props for UsageProvider */ export interface UsageProviderProps { /** * Initial plan ID * @default "free" */ initialPlanId?: string; /** * Initial usage data */ initialUsage?: UsageTracking; /** * Callback when usage changes */ onUsageChange?: (usage: UsageTracking) => void; /** * Callback when plan changes */ onPlanChange?: (planId: string) => void; /** * Children */ children: React.ReactNode; } /** * Usage Provider Component * * Provides usage tracking context to the entire application * * @example * ```tsx * * * * ``` */ export declare const UsageProvider: React.FC; /** * Hook to access usage context * * @throws Error if used outside UsageProvider * * @example * ```tsx * const { planId, usage, incrementUsage } = useUsageContext(); * * // When creating a new event * incrementUsage("events"); * ``` */ export declare const useUsageContext: () => UsageContextValue; /** * Optional hook that returns null if outside provider */ export declare const useOptionalUsageContext: () => UsageContextValue | null; export default UsageProvider;