react-achievements-zustand
Version:
This package allows users to transpose a React achievements engine over their React apps using Zustand for state management
26 lines (25 loc) • 1.15 kB
TypeScript
import { InitialAchievementMetrics, AchievementMetrics, AchievementDetails, SerializedAchievementConfiguration } from '../types';
interface AchievementState {
isInitialized: boolean;
config: SerializedAchievementConfiguration;
metrics: AchievementMetrics;
unlockedAchievements: string[];
previouslyAwardedAchievements: string[];
storageKey: string | null;
notifications: AchievementDetails[];
initialize: (params: {
config: SerializedAchievementConfiguration;
initialState?: InitialAchievementMetrics & {
previouslyAwardedAchievements?: string[];
};
storageKey: string;
}) => void;
setMetrics: (metrics: AchievementMetrics) => void;
unlockAchievement: (achievementId: string) => void;
markAchievementAsAwarded: (achievementId: string) => void;
resetAchievements: () => void;
addNotification: (notification: AchievementDetails) => void;
clearNotifications: (displayedNotifications: AchievementDetails[]) => void;
}
export declare const useAchievementStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AchievementState>>;
export {};