289 lines
8.8 KiB
JavaScript
289 lines
8.8 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Mock Data cho từng Game Code
|
|
* Game developers dùng để test game standalone
|
|
*
|
|
* Usage:
|
|
* ```typescript
|
|
* import { MockData } from 'game-iframe-sdk/client';
|
|
*
|
|
* // Lấy sample data cho Quiz Text-Text
|
|
* const quizData = MockData.G001;
|
|
*
|
|
* // Lấy sample data cho Sequence Word
|
|
* const seqData = MockData.G110;
|
|
* ```
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.MockData = exports.MOCK_G123 = exports.MOCK_G122 = exports.MOCK_G121 = exports.MOCK_G120 = exports.MOCK_G113 = exports.MOCK_G112 = exports.MOCK_G111 = exports.MOCK_G110 = exports.MOCK_G005 = exports.MOCK_G004 = exports.MOCK_G003 = exports.MOCK_G002 = exports.MOCK_G001 = void 0;
|
|
exports.getMockData = getMockData;
|
|
exports.getAvailableGameCodes = getAvailableGameCodes;
|
|
// =============================================================================
|
|
// QUIZ MOCK DATA
|
|
// =============================================================================
|
|
/** G001: Quiz Text-Text */
|
|
exports.MOCK_G001 = {
|
|
game_code: 'G001',
|
|
game_id: 'mock-quiz-text-text',
|
|
data: [
|
|
{
|
|
id: 'q1',
|
|
question: 'Thủ đô của Việt Nam là gì?',
|
|
options: ['Hà Nội', 'Hồ Chí Minh', 'Đà Nẵng', 'Huế'],
|
|
answer: 0, // Index của đáp án đúng
|
|
},
|
|
{
|
|
id: 'q2',
|
|
question: '2 + 2 = ?',
|
|
options: ['3', '4', '5', '6'],
|
|
answer: 1,
|
|
},
|
|
{
|
|
id: 'q3',
|
|
question: 'Con vật nào biết bay?',
|
|
options: ['Chó', 'Mèo', 'Chim', 'Cá'],
|
|
answer: 2,
|
|
},
|
|
],
|
|
};
|
|
/** G002: Quiz Audio-Text */
|
|
exports.MOCK_G002 = {
|
|
game_code: 'G002',
|
|
game_id: 'mock-quiz-audio-text',
|
|
data: [
|
|
{
|
|
id: 'q1',
|
|
question_audio: 'https://example.com/audio/question1.mp3',
|
|
options: ['Apple', 'Banana', 'Orange', 'Grape'],
|
|
answer: 0,
|
|
},
|
|
{
|
|
id: 'q2',
|
|
question_audio: 'https://example.com/audio/question2.mp3',
|
|
options: ['Dog', 'Cat', 'Bird', 'Fish'],
|
|
answer: 2,
|
|
},
|
|
],
|
|
};
|
|
/** G003: Quiz Text-Audio */
|
|
exports.MOCK_G003 = {
|
|
game_code: 'G003',
|
|
game_id: 'mock-quiz-text-audio',
|
|
data: [
|
|
{
|
|
id: 'q1',
|
|
question: 'Chọn phát âm đúng của từ "Hello"',
|
|
options: [
|
|
'https://example.com/audio/hello1.mp3',
|
|
'https://example.com/audio/hello2.mp3',
|
|
'https://example.com/audio/hello3.mp3',
|
|
],
|
|
answer: 0,
|
|
},
|
|
],
|
|
};
|
|
/** G004: Quiz Image-Text */
|
|
exports.MOCK_G004 = {
|
|
game_code: 'G004',
|
|
game_id: 'mock-quiz-image-text',
|
|
data: [
|
|
{
|
|
id: 'q1',
|
|
question_image: 'https://example.com/images/apple.jpg',
|
|
question: 'Đây là quả gì?', // Optional hint
|
|
options: ['Táo', 'Cam', 'Chuối', 'Nho'],
|
|
answer: 0,
|
|
},
|
|
{
|
|
id: 'q2',
|
|
question_image: 'https://example.com/images/cat.jpg',
|
|
options: ['Chó', 'Mèo', 'Thỏ', 'Chuột'],
|
|
answer: 1,
|
|
},
|
|
],
|
|
};
|
|
/** G005: Quiz Text-Image */
|
|
exports.MOCK_G005 = {
|
|
game_code: 'G005',
|
|
game_id: 'mock-quiz-text-image',
|
|
data: [
|
|
{
|
|
id: 'q1',
|
|
question: 'Chọn hình ảnh con mèo',
|
|
options: [
|
|
'https://example.com/images/dog.jpg',
|
|
'https://example.com/images/cat.jpg',
|
|
'https://example.com/images/bird.jpg',
|
|
],
|
|
answer: 1,
|
|
},
|
|
],
|
|
};
|
|
// =============================================================================
|
|
// SEQUENCE WORD MOCK DATA
|
|
// =============================================================================
|
|
/** G110: Sequence Word - no audio */
|
|
exports.MOCK_G110 = {
|
|
game_code: 'G110',
|
|
game_id: 'mock-sequence-word',
|
|
data: [
|
|
{
|
|
id: 'sw1',
|
|
word: 'APPLE',
|
|
parts: ['A', 'P', 'P', 'L', 'E'], // Đáp án đúng theo thứ tự
|
|
answer: ['A', 'P', 'P', 'L', 'E'], // SDK sẽ shuffle parts, giữ answer để verify
|
|
},
|
|
{
|
|
id: 'sw2',
|
|
word: 'HELLO',
|
|
parts: ['H', 'E', 'L', 'L', 'O'],
|
|
answer: ['H', 'E', 'L', 'L', 'O'],
|
|
},
|
|
{
|
|
id: 'sw3',
|
|
word: 'WORLD',
|
|
parts: ['W', 'O', 'R', 'L', 'D'],
|
|
answer: ['W', 'O', 'R', 'L', 'D'],
|
|
},
|
|
],
|
|
};
|
|
/** G111: Sequence Word - audio, hide 2 */
|
|
exports.MOCK_G111 = {
|
|
game_code: 'G111',
|
|
game_id: 'mock-sequence-word-audio-2',
|
|
data: [
|
|
{
|
|
id: 'sw1',
|
|
word: 'BANANA',
|
|
parts: ['B', 'A', 'N', 'A', 'N', 'A'],
|
|
answer: ['B', 'A', 'N', 'A', 'N', 'A'],
|
|
audio_url: 'https://example.com/audio/banana.mp3',
|
|
},
|
|
],
|
|
};
|
|
/** G112: Sequence Word - audio, hide 4 */
|
|
exports.MOCK_G112 = {
|
|
game_code: 'G112',
|
|
game_id: 'mock-sequence-word-audio-4',
|
|
data: [
|
|
{
|
|
id: 'sw1',
|
|
word: 'COMPUTER',
|
|
parts: ['C', 'O', 'M', 'P', 'U', 'T', 'E', 'R'],
|
|
answer: ['C', 'O', 'M', 'P', 'U', 'T', 'E', 'R'],
|
|
audio_url: 'https://example.com/audio/computer.mp3',
|
|
},
|
|
],
|
|
};
|
|
/** G113: Sequence Word - audio, hide all */
|
|
exports.MOCK_G113 = {
|
|
game_code: 'G113',
|
|
game_id: 'mock-sequence-word-audio-all',
|
|
data: [
|
|
{
|
|
id: 'sw1',
|
|
word: 'ELEPHANT',
|
|
parts: ['E', 'L', 'E', 'P', 'H', 'A', 'N', 'T'],
|
|
answer: ['E', 'L', 'E', 'P', 'H', 'A', 'N', 'T'],
|
|
audio_url: 'https://example.com/audio/elephant.mp3',
|
|
},
|
|
],
|
|
};
|
|
// =============================================================================
|
|
// SEQUENCE SENTENCE MOCK DATA
|
|
// =============================================================================
|
|
/** G120: Sequence Sentence - no audio */
|
|
exports.MOCK_G120 = {
|
|
game_code: 'G120',
|
|
game_id: 'mock-sequence-sentence',
|
|
data: [
|
|
{
|
|
id: 'ss1',
|
|
sentence: 'I love learning English.',
|
|
parts: ['I', 'love', 'learning', 'English.'],
|
|
answer: ['I', 'love', 'learning', 'English.'],
|
|
},
|
|
{
|
|
id: 'ss2',
|
|
sentence: 'The cat is sleeping.',
|
|
parts: ['The', 'cat', 'is', 'sleeping.'],
|
|
answer: ['The', 'cat', 'is', 'sleeping.'],
|
|
},
|
|
],
|
|
};
|
|
/** G121: Sequence Sentence - audio, hide 2 */
|
|
exports.MOCK_G121 = {
|
|
game_code: 'G121',
|
|
game_id: 'mock-sequence-sentence-audio-2',
|
|
data: [
|
|
{
|
|
id: 'ss1',
|
|
sentence: 'She goes to school every day.',
|
|
parts: ['She', 'goes', 'to', 'school', 'every', 'day.'],
|
|
answer: ['She', 'goes', 'to', 'school', 'every', 'day.'],
|
|
audio_url: 'https://example.com/audio/sentence1.mp3',
|
|
},
|
|
],
|
|
};
|
|
/** G122: Sequence Sentence - audio, hide 4 */
|
|
exports.MOCK_G122 = {
|
|
game_code: 'G122',
|
|
game_id: 'mock-sequence-sentence-audio-4',
|
|
data: [
|
|
{
|
|
id: 'ss1',
|
|
sentence: 'My brother plays football in the park.',
|
|
parts: ['My', 'brother', 'plays', 'football', 'in', 'the', 'park.'],
|
|
answer: ['My', 'brother', 'plays', 'football', 'in', 'the', 'park.'],
|
|
audio_url: 'https://example.com/audio/sentence2.mp3',
|
|
},
|
|
],
|
|
};
|
|
/** G123: Sequence Sentence - audio, hide all */
|
|
exports.MOCK_G123 = {
|
|
game_code: 'G123',
|
|
game_id: 'mock-sequence-sentence-audio-all',
|
|
data: [
|
|
{
|
|
id: 'ss1',
|
|
sentence: 'The quick brown fox jumps over the lazy dog.',
|
|
parts: ['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.'],
|
|
answer: ['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.'],
|
|
audio_url: 'https://example.com/audio/sentence3.mp3',
|
|
},
|
|
],
|
|
};
|
|
// =============================================================================
|
|
// MOCK DATA MAP
|
|
// =============================================================================
|
|
exports.MockData = {
|
|
// Quiz
|
|
G001: exports.MOCK_G001,
|
|
G002: exports.MOCK_G002,
|
|
G003: exports.MOCK_G003,
|
|
G004: exports.MOCK_G004,
|
|
// Sequence Word
|
|
G110: exports.MOCK_G110,
|
|
G111: exports.MOCK_G111,
|
|
G112: exports.MOCK_G112,
|
|
G113: exports.MOCK_G113,
|
|
// Sequence Sentence
|
|
G120: exports.MOCK_G120,
|
|
G121: exports.MOCK_G121,
|
|
G122: exports.MOCK_G122,
|
|
G123: exports.MOCK_G123,
|
|
G005: exports.MOCK_G005,
|
|
};
|
|
/**
|
|
* Get mock data for a game code
|
|
*/
|
|
function getMockData(code) {
|
|
return exports.MockData[code] ?? null;
|
|
}
|
|
/**
|
|
* Get all available game codes
|
|
*/
|
|
function getAvailableGameCodes() {
|
|
return Object.keys(exports.MockData);
|
|
}
|
|
//# sourceMappingURL=MockData.js.map
|