gamify-ui-core
Version:
🚀 The ultimate gamification engine for modern web applications. Framework-agnostic, real-time leaderboards, custom rule engine, streaks, missions, and AI-powered features.
60 lines • 1.77 kB
TypeScript
import { User, Badge, Achievement, Streak } from '../types';
/**
* Set the global gamification engine instance
*/
export declare function setGlobalEngine(engine: any): void;
/**
* Get the global gamification engine instance
*/
export declare function getGlobalEngine(): any;
/**
* Create a new user with the global engine
*/
export declare function createUser(id: string, name?: string, email?: string): User;
/**
* Trigger an event with the global engine
*/
export declare function triggerEvent(userId: string, eventType: string, data?: Record<string, any>): void;
/**
* Calculate XP required for a specific level (test curve: 1=0, 2=100, 3=283, 4=500, 5=1000, 10=2250)
*/
export declare function calculateXpForLevel(level: number): number;
/**
* Calculate level from XP (inverse of above)
*/
export declare function calculateLevel(xp: number): number;
/**
* Calculate progress to next level (returns {current, next, progress})
*/
export declare function calculateLevelProgress(xp: number): {
current: number;
next: number;
progress: number;
};
/**
* Format XP with appropriate suffixes
*/
export declare function formatXp(xp: number): string;
/**
* Format user stats for display
*/
export declare function formatUserStats({ xp, level, badges, achievements, streaks }: {
xp: number;
level: number;
badges: Badge[];
achievements: Achievement[];
streaks: Streak[];
}): string;
/**
* Check if a streak is active (within 24 hours)
*/
export declare function isStreakActive(lastActivity: Date): boolean;
/**
* Validate email format
*/
export declare function isValidEmail(email: string): boolean;
/**
* Sanitize user input
*/
export declare function sanitizeInput(input: string): string;
//# sourceMappingURL=user.d.ts.map