This commit is contained in:
96
G102-sequence/sdk/package/dist/kit/react/GameTestPlayer.d.ts
vendored
Normal file
96
G102-sequence/sdk/package/dist/kit/react/GameTestPlayer.d.ts
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import React from 'react';
|
||||
export interface GameTestPlayerProps {
|
||||
/**
|
||||
* URL của game iframe
|
||||
*/
|
||||
gameUrl: string;
|
||||
/**
|
||||
* Data game (array of questions)
|
||||
*/
|
||||
gameData: any[];
|
||||
/**
|
||||
* User ID (optional, default 'test_user')
|
||||
*/
|
||||
userId?: string;
|
||||
/**
|
||||
* Game ID (optional, default 'test_game')
|
||||
*/
|
||||
gameId?: string | number;
|
||||
/**
|
||||
* Extra data to pass to iframe
|
||||
*/
|
||||
extraData?: Record<string, any>;
|
||||
/**
|
||||
* End time ISO (optional - for countdown)
|
||||
*/
|
||||
endTimeIso?: string;
|
||||
/**
|
||||
* CSS class
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* CSS style
|
||||
*/
|
||||
style?: React.CSSProperties;
|
||||
/**
|
||||
* Debug mode
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* Callback khi nhận answer từ iframe
|
||||
*/
|
||||
onAnswer?: (data: any) => void;
|
||||
/**
|
||||
* Callback khi game hoàn thành
|
||||
*/
|
||||
onComplete?: (result: any) => void;
|
||||
/**
|
||||
* Callback log
|
||||
*/
|
||||
onLog?: (message: string, type?: 'info' | 'success' | 'error' | 'warning') => void;
|
||||
/**
|
||||
* Callback khi iframe yêu cầu leaderboard
|
||||
*/
|
||||
onLeaderboardRequest?: (top: number) => void;
|
||||
/**
|
||||
* Mock leaderboard data (optional - sẽ tự gửi khi iframe request)
|
||||
*/
|
||||
mockLeaderboard?: {
|
||||
top_players: Array<{
|
||||
rank: number;
|
||||
name: string;
|
||||
score: number;
|
||||
time_spent?: number;
|
||||
}>;
|
||||
user_rank?: {
|
||||
rank: number;
|
||||
name: string;
|
||||
score: number;
|
||||
time_spent?: number;
|
||||
} | null;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* GameTestPlayer - Component test đơn giản
|
||||
*
|
||||
* Chỉ load game data vào iframe, KHÔNG gọi API
|
||||
* Dùng để test game iframe locally
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* <GameTestPlayer
|
||||
* gameUrl="http://localhost:3000/game"
|
||||
* gameData={[
|
||||
* { id: 1, question: "What is 2+2?", options: ["3","4","5"], answer: "4" },
|
||||
* { id: 2, question: "Capital of France?", options: ["London","Paris","Berlin"], answer: "Paris" }
|
||||
* ]}
|
||||
* debug={true}
|
||||
* onLog={(msg, type) => console.log(`[${type}] ${msg}`)}
|
||||
* onAnswer={(data) => console.log('Answer:', data)}
|
||||
* onComplete={(result) => console.log('Complete:', result)}
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
export declare const GameTestPlayer: React.FC<GameTestPlayerProps>;
|
||||
export default GameTestPlayer;
|
||||
//# sourceMappingURL=GameTestPlayer.d.ts.map
|
||||
Reference in New Issue
Block a user