/** * TypeScript types for QwikCard SDK */ // ───────────────────────────────────────────────────────────────────────────── // Core Types // ───────────────────────────────────────────────────────────────────────────── export interface Player { id: string; displayName: string; email?: string; metadata?: PlayerMetadata; createdAt: string; updatedAt: string; } export interface PlayerMetadata { externalId?: string; // QwikCard users.id qwikTag?: string; // @handle collegeName?: string; qwikGoals?: string[]; workStatus?: string; [key: string]: unknown; } // ───────────────────────────────────────────────────────────────────────────── // Points & Currency // ───────────────────────────────────────────────────────────────────────────── export interface PointBalance { currency: string; balance: number; updatedAt: string; } export type Currency = 'xp' | 'coins'; // ───────────────────────────────────────────────────────────────────────────── // Quests // ───────────────────────────────────────────────────────────────────────────── export interface Quest { id: string; name: string; description: string; status: QuestStatus; progress: number; target: number; rewards: QuestReward[]; expiresAt?: string; completedAt?: string; } export type QuestStatus = 'not_started' | 'in_progress' | 'completed' | 'expired'; export interface QuestReward { type: 'points' | 'badge' | 'reward'; currency?: string; amount?: number; badgeId?: string; rewardId?: string; } // ───────────────────────────────────────────────────────────────────────────── // Badges // ───────────────────────────────────────────────────────────────────────────── export interface Badge { id: string; name: string; description: string; slug?: string; imageUrl?: string; earnedAt?: string; isEarned: boolean; } // ───────────────────────────────────────────────────────────────────────────── // Rewards // ───────────────────────────────────────────────────────────────────────────── export interface Reward { id: string; name: string; description: string; imageUrl?: string; cost: number; currency: string; available: boolean; expiresAt?: string; } export interface RedemptionResult { success: boolean; redemptionId?: string; code?: string; message?: string; } // ───────────────────────────────────────────────────────────────────────────── // Leaderboard // ───────────────────────────────────────────────────────────────────────────── export interface LeaderboardEntry { playerId: string; displayName: string; rank: number; score: number; metadata?: PlayerMetadata; } export interface PlayerRank { playerId: string; rank: number; score: number; above: LeaderboardEntry[]; below: LeaderboardEntry[]; } // ───────────────────────────────────────────────────────────────────────────── // Events (QwikCard-specific) // ───────────────────────────────────────────────────────────────────────────── export type QwikCardEventType = | 'card.purchase' | 'card.deposit' | 'card.atm' | 'qwikit.sent' | 'qwikit.received' | 'referral.signup' | 'profile.complete'; export interface TrackEventInput { type: QwikCardEventType; playerId: string; referenceId?: string; data?: Record; } export interface CardPurchaseData { i2cTransId: string; amount: number; mcc?: string; category?: string; merchant?: string; } export interface QwikItData { recipientPlayerId: string; amount: number; senderQwikTag?: string; recipientQwikTag?: string; } // ───────────────────────────────────────────────────────────────────────────── // API Response Types // ───────────────────────────────────────────────────────────────────────────── export interface ApiResponse { success: boolean; data?: T; error?: ApiError; } export interface ApiError { code: string; message: string; details?: Record; } export interface PaginatedResponse { items: T[]; total: number; cursor?: string; hasMore: boolean; }