@tinyweb_dev/oe-exam-sdk 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/exams/take/ExamTakingPageContainer.js +6 -0
- package/dist/components/exams/take/components/QuestionRenderer.js +7 -7
- package/dist/components/exams/take/components/question-renderers/MoversCrossOutWordGroupRenderer.js +24 -10
- package/dist/components/exams/take/components/question-renderers/MoversCrosswordPuzzleRenderer.js +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversFillInBlankGroupRenderer.js +2 -1
- package/dist/components/exams/take/components/question-renderers/MoversMatchWordToPictureGroupRenderer.d.ts +14 -0
- package/dist/components/exams/take/components/question-renderers/MoversMatchWordToPictureGroupRenderer.js +36 -0
- package/dist/components/exams/take/components/question-renderers/MoversMatchingWithLinesGroupRenderer.js +4 -0
- package/dist/components/exams/take/components/question-renderers/index.d.ts +1 -0
- package/dist/components/exams/take/components/question-renderers/index.js +1 -0
- package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQaGroupRenderer.js +12 -2
- package/dist/components/exams/take/hooks/useSpontaneousQaGroupRendererSetup.js +2 -1
- package/dist/components/exams/take/utils/answer-transformers.js +17 -1
- package/dist/components/exams/take/utils/cross-out-word-group.transformer.js +4 -6
- package/dist/components/exams/take/utils/question-transformers.d.ts +32 -3
- package/dist/components/exams/take/utils/question-transformers.js +51 -2
- package/dist/components/questions/_shared/components/compact/KidChoiceRow.d.ts +12 -0
- package/dist/components/questions/_shared/components/compact/KidChoiceRow.js +33 -0
- package/dist/components/questions/_shared/components/compact/KidInstruction.d.ts +5 -0
- package/dist/components/questions/_shared/components/compact/KidInstruction.js +9 -0
- package/dist/components/questions/_shared/components/compact/KidPrompt.d.ts +5 -0
- package/dist/components/questions/_shared/components/compact/KidPrompt.js +9 -0
- package/dist/components/questions/_shared/components/compact/KidQuestionCard.d.ts +12 -0
- package/dist/components/questions/_shared/components/compact/KidQuestionCard.js +7 -0
- package/dist/components/questions/_shared/components/compact/index.d.ts +4 -0
- package/dist/components/questions/_shared/components/compact/index.js +4 -0
- package/dist/components/questions/_shared/types/crossword-puzzle.type.d.ts +5 -1
- package/dist/components/questions/_shared/types/match-word-to-picture-group.type.d.ts +1 -0
- package/dist/components/questions/_shared/types/match-word-to-picture-group.type.js +14 -0
- package/dist/components/questions/_shared/types/matching-with-lines-group.type.d.ts +2 -2
- package/dist/components/questions/_shared/types/spontaneous-qa-group.type.d.ts +17 -0
- package/dist/components/questions/components/QuestionSearchDropdown.js +1 -0
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionClient.js +18 -19
- package/dist/components/questions/types/answer-the-question-group/AnswerTheQuestionGroupClient.js +8 -7
- package/dist/components/questions/types/answer-the-question-group/AnswerTheQuestionGroupCreator.js +5 -4
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsClient.js +17 -11
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveClient.js +15 -42
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +15 -36
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +9 -30
- package/dist/components/questions/types/choose-then-answer-group/ChooseThenAnswerGroupClient.js +8 -7
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +50 -32
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +24 -44
- package/dist/components/questions/types/cross-out-word-group/index.d.ts +1 -0
- package/dist/components/questions/types/cross-out-word-group/index.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/map-cross-out-word-group-data.js +9 -9
- package/dist/components/questions/types/cross-out-word-group/tokenize.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/tokenize.js +11 -0
- package/dist/components/questions/types/cross-out-word-group/transform.js +2 -4
- package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleClient.d.ts +2 -1
- package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleClient.js +8 -6
- package/dist/components/questions/types/crossword-puzzle/CrosswordPuzzleCreator.js +68 -11
- package/dist/components/questions/types/crossword-puzzle/transform.js +59 -30
- package/dist/components/questions/types/fill-in-blank/FillInBlankClient.js +26 -31
- package/dist/components/questions/types/fill-in-blank-group/FillInBlankAnswerKey.d.ts +6 -0
- package/dist/components/questions/types/fill-in-blank-group/FillInBlankAnswerKey.js +17 -0
- package/dist/components/questions/types/fill-in-blank-group/FillInBlankGroupClient.js +32 -28
- package/dist/components/questions/types/fill-in-blank-group/FillInBlankGroupCreator.js +109 -26
- package/dist/components/questions/types/fill-in-blank-group/FillInBlankGroupMediaField.js +21 -11
- package/dist/components/questions/types/fill-in-blank-group/blank-utils.d.ts +1 -0
- package/dist/components/questions/types/fill-in-blank-group/blank-utils.js +4 -1
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridClient.js +32 -31
- package/dist/components/questions/types/find-words-in-matrix/FindWordsInMatrixClient.js +71 -28
- package/dist/components/questions/types/find-words-in-matrix/FindWordsInMatrixCreator.js +6 -2
- package/dist/components/questions/types/find-words-in-matrix/transform.js +5 -0
- package/dist/components/questions/types/label-the-picture/LabelThePictureClient.js +4 -3
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupClient.js +11 -30
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerClient.js +7 -6
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesClient.js +2 -1
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupClient.js +14 -13
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeClient.js +4 -3
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutClient.js +4 -3
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListClient.js +11 -10
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesClient.js +4 -3
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerClient.js +13 -11
- package/dist/components/questions/types/match-columns-to-make-sentences/MatchColumnsToMakeSentencesClient.js +17 -14
- package/dist/components/questions/types/match-word-to-picture/MatchWordToPictureClient.js +16 -12
- package/dist/components/questions/types/match-word-to-picture/MatchWordToPictureGroupClient.js +14 -14
- package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupClient.js +24 -35
- package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupCreator.js +16 -3
- package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupImageField.d.ts +2 -1
- package/dist/components/questions/types/match-word-to-picture-group/MatchWordToPictureGroupImageField.js +25 -6
- package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesBoard.js +1 -1
- package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesGroupClient.js +22 -10
- package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesGroupCreator.js +60 -18
- package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesImageField.d.ts +2 -1
- package/dist/components/questions/types/matching-with-lines-group/MatchingWithLinesImageField.js +24 -5
- package/dist/components/questions/types/matching-with-lines-group/map-matching-with-lines-group-data.js +8 -4
- package/dist/components/questions/types/matching-with-lines-group/transform.js +5 -4
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsClient.js +8 -26
- package/dist/components/questions/types/sort-words-into-categories/SortWordsIntoCategoriesClient.js +2 -1
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationPreviewClient.js +6 -5
- package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardClient.js +2 -1
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageClient.js +5 -4
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.d.ts +1 -1
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.js +54 -11
- package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.js +11 -7
- package/dist/components/questions/types/spontaneous-qa-group/creator-helpers.js +8 -2
- package/dist/components/questions/types/spontaneous-qa-group/flatten.d.ts +1 -0
- package/dist/components/questions/types/spontaneous-qa-group/flatten.js +4 -2
- package/dist/components/questions/types/spontaneous-qa-group/map-spontaneous-qa-group-data.js +5 -3
- package/dist/components/questions/types/spontaneous-qa-group/register.js +5 -2
- package/dist/components/questions/types/spontaneous-qa-group/transform.js +6 -2
- package/dist/components/questions/types/true-false/TrueFalseClient.js +5 -54
- package/dist/components/questions/types/true-false-correct-group/TrueFalseCorrectGroupClient.js +21 -23
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +8 -17
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphClient.js +76 -81
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +17 -16
- package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.js +31 -36
- package/dist/components/questions/types/word-ordering/WordOrderingClient.js +15 -14
- package/dist/components/questions/types/word-ordering-group/WordOrderingGroupClient.js +9 -8
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormClient.js +16 -13
- package/dist/components/questions/viewer/CrossOutWordGroupViewer.js +1 -4
- package/dist/components/questions/viewer/FillInBlankGroupViewer.d.ts +6 -2
- package/dist/components/questions/viewer/FillInBlankGroupViewer.js +13 -7
- package/dist/components/questions/viewer/QuestionViewer.js +2 -2
- package/dist/components/questions/viewer/SpontaneousQaGroupViewer.d.ts +7 -1
- package/dist/components/questions/viewer/SpontaneousQaGroupViewer.js +14 -2
- package/dist/components/results/renderers/review-question-body-movers.js +7 -3
- package/dist/components/results/review-data.js +20 -1
- package/dist/shared/lib/utils/question-reverse-transform.js +48 -7
- package/dist/shared/types/questions/crossword-puzzle.d.ts +1 -0
- package/dist/shared/types/questions/find-words-in-matrix.d.ts +1 -0
- package/dist/shared/types/questions/matching-with-lines-group.d.ts +2 -2
- package/package.json +1 -1
|
@@ -511,14 +511,29 @@ const reverseMatchingWithLinesGroup = (apiQuestion) => {
|
|
|
511
511
|
questionNumber: asNumber(item.questionNumber, index + 1),
|
|
512
512
|
};
|
|
513
513
|
});
|
|
514
|
+
const readMatchingMedia = (value) => {
|
|
515
|
+
if (Array.isArray(value)) {
|
|
516
|
+
const cleaned = value
|
|
517
|
+
.filter((item) => typeof item === 'string')
|
|
518
|
+
.map((item) => item.trim())
|
|
519
|
+
.filter((item) => item !== '');
|
|
520
|
+
if (cleaned.length === 0)
|
|
521
|
+
return undefined;
|
|
522
|
+
return cleaned.length === 1 ? cleaned[0] : cleaned;
|
|
523
|
+
}
|
|
524
|
+
const single = asString(value).trim();
|
|
525
|
+
return single || undefined;
|
|
526
|
+
};
|
|
527
|
+
const audioUrl = readMatchingMedia(meta.audioUrl);
|
|
528
|
+
const imageUrl = readMatchingMedia(meta.imageUrl);
|
|
514
529
|
return {
|
|
515
530
|
content: '',
|
|
516
531
|
answer: {
|
|
517
532
|
title: asString(meta.title),
|
|
518
533
|
instruction: asString(meta.instruction, 'Look and match.'),
|
|
519
534
|
...(asString(meta.passage).trim() ? { passage: asString(meta.passage).trim() } : {}),
|
|
520
|
-
...(
|
|
521
|
-
...(
|
|
535
|
+
...(audioUrl !== undefined ? { audioUrl } : {}),
|
|
536
|
+
...(imageUrl !== undefined ? { imageUrl } : {}),
|
|
522
537
|
rightItems,
|
|
523
538
|
items,
|
|
524
539
|
explanation: asString(apiQuestion.explanation),
|
|
@@ -537,18 +552,27 @@ const reverseCrossOutWordGroup = (apiQuestion) => {
|
|
|
537
552
|
const fallback = asRecord(fallbackAnswers[index]);
|
|
538
553
|
const answerRaw = Object.keys(itemAnswer).length > 0 ? itemAnswer : fallback;
|
|
539
554
|
const isExample = item.isExample === true;
|
|
540
|
-
const type = itemContent.type === 'CROSS_OUT_AND_REPLACE'
|
|
541
|
-
answerRaw.type === 'CROSS_OUT_AND_REPLACE'
|
|
555
|
+
const type = itemContent.type === 'CROSS_OUT_AND_REPLACE'
|
|
542
556
|
? 'CROSS_OUT_AND_REPLACE'
|
|
543
|
-
: 'CROSS_OUT'
|
|
557
|
+
: itemContent.type === 'CROSS_OUT'
|
|
558
|
+
? 'CROSS_OUT'
|
|
559
|
+
: answerRaw.type === 'CROSS_OUT_AND_REPLACE'
|
|
560
|
+
? 'CROSS_OUT_AND_REPLACE'
|
|
561
|
+
: 'CROSS_OUT';
|
|
562
|
+
const rawIndex = answerRaw.wordIndex;
|
|
563
|
+
const wordIndex = typeof rawIndex === 'number' && Number.isInteger(rawIndex) && rawIndex >= 0
|
|
564
|
+
? rawIndex
|
|
565
|
+
: null;
|
|
544
566
|
const correctAnswer = type === 'CROSS_OUT_AND_REPLACE'
|
|
545
567
|
? {
|
|
546
568
|
type: 'CROSS_OUT_AND_REPLACE',
|
|
569
|
+
wordIndex,
|
|
547
570
|
crossOut: asString(answerRaw.crossOut),
|
|
548
571
|
replaceWith: asString(answerRaw.replaceWith),
|
|
549
572
|
}
|
|
550
573
|
: {
|
|
551
574
|
type: 'CROSS_OUT',
|
|
575
|
+
wordIndex,
|
|
552
576
|
crossOut: asString(answerRaw.crossOut),
|
|
553
577
|
};
|
|
554
578
|
return {
|
|
@@ -638,12 +662,14 @@ const reverseSpontaneousQaGroup = (apiQuestion) => {
|
|
|
638
662
|
const fallback = asRecord(flattenedAnswers[questionIndex]);
|
|
639
663
|
const expected = asArray(childAnswer.expectedAnswers ?? fallback.expectedAnswers)
|
|
640
664
|
.filter((value) => typeof value === 'string');
|
|
665
|
+
const isExample = child.isExample === true;
|
|
641
666
|
return {
|
|
642
667
|
questionText: asString(childContent.questionText),
|
|
643
668
|
inputType: asString(childContent.inputType, 'TEXT') === 'AUDIO' ? 'AUDIO' : 'TEXT',
|
|
644
669
|
audioUrl: asString(childContent.audioUrl),
|
|
645
670
|
expectedAnswers: expected.length > 0 ? expected : [''],
|
|
646
|
-
|
|
671
|
+
isExample,
|
|
672
|
+
points: isExample ? 0 : asNumber(child.points, 1),
|
|
647
673
|
questionNumber: asNumber(child.questionNumber, questionIndex + 1),
|
|
648
674
|
};
|
|
649
675
|
}),
|
|
@@ -890,6 +916,9 @@ function reverseCrosswordPuzzle(apiQuestion) {
|
|
|
890
916
|
const rows = apiContent.gridSize?.rows || apiContent.rows || 12;
|
|
891
917
|
const cols = apiContent.gridSize?.cols || apiContent.cols || 12;
|
|
892
918
|
const title = apiContent.title || '';
|
|
919
|
+
const type = apiContent.type === 'HIDDEN_WORD' ? 'HIDDEN_WORD' : 'STANDARD';
|
|
920
|
+
const instruction = asString(apiQuestion.instruction, asString(apiContent.instruction));
|
|
921
|
+
const markedColumn = typeof apiContent.markedColumn === 'number' ? apiContent.markedColumn : undefined;
|
|
893
922
|
const across = Array.isArray(apiContent.clues?.across) ? apiContent.clues.across : [];
|
|
894
923
|
const down = Array.isArray(apiContent.clues?.down) ? apiContent.clues.down : [];
|
|
895
924
|
const answers = apiAnswer.answers || {};
|
|
@@ -904,6 +933,7 @@ function reverseCrosswordPuzzle(apiQuestion) {
|
|
|
904
933
|
length: a.length || 1,
|
|
905
934
|
direction: 'across',
|
|
906
935
|
answer: answers[`across-${a.number}`] || '',
|
|
936
|
+
...(a.isExample === true ? { isExample: true } : {}),
|
|
907
937
|
});
|
|
908
938
|
}
|
|
909
939
|
for (const d of down) {
|
|
@@ -916,24 +946,32 @@ function reverseCrosswordPuzzle(apiQuestion) {
|
|
|
916
946
|
length: d.length || 1,
|
|
917
947
|
direction: 'down',
|
|
918
948
|
answer: answers[`down-${d.number}`] || '',
|
|
949
|
+
...(d.isExample === true ? { isExample: true } : {}),
|
|
919
950
|
});
|
|
920
951
|
}
|
|
921
952
|
return {
|
|
922
953
|
content: {
|
|
954
|
+
type,
|
|
923
955
|
title,
|
|
956
|
+
instruction,
|
|
924
957
|
rows,
|
|
925
958
|
cols,
|
|
926
959
|
gridSize: { rows, cols },
|
|
960
|
+
...(type === 'HIDDEN_WORD' && markedColumn ? { markedColumn } : {}),
|
|
927
961
|
clues: { across, down },
|
|
928
962
|
},
|
|
929
963
|
answer: {
|
|
964
|
+
type,
|
|
930
965
|
title,
|
|
966
|
+
instruction,
|
|
931
967
|
rows,
|
|
932
968
|
cols,
|
|
969
|
+
...(type === 'HIDDEN_WORD' && markedColumn ? { markedColumn } : {}),
|
|
970
|
+
hiddenWord: answers['hidden-word'] || '',
|
|
933
971
|
clues,
|
|
934
972
|
answers,
|
|
935
973
|
caseSensitive: apiAnswer.caseSensitive || false,
|
|
936
|
-
explanation: apiQuestion.explanation
|
|
974
|
+
explanation: asString(apiQuestion.explanation),
|
|
937
975
|
},
|
|
938
976
|
};
|
|
939
977
|
}
|
|
@@ -944,6 +982,7 @@ function reverseFindWordsInMatrix(apiQuestion) {
|
|
|
944
982
|
const rows = apiContent.gridSize?.rows || (Array.isArray(apiContent.grid) ? apiContent.grid.length : 14);
|
|
945
983
|
const cols = apiContent.gridSize?.cols || (Array.isArray(apiContent.grid?.[0]) ? apiContent.grid[0].length : 14);
|
|
946
984
|
const title = apiContent.title || '';
|
|
985
|
+
const instruction = typeof apiContent.instruction === 'string' ? apiContent.instruction : '';
|
|
947
986
|
const grid = Array.isArray(apiContent.grid) ? apiContent.grid : [];
|
|
948
987
|
const categories = Array.isArray(apiContent.categories) ? apiContent.categories : [];
|
|
949
988
|
const wordBank = Array.isArray(apiContent.wordBank) ? apiContent.wordBank : [];
|
|
@@ -977,6 +1016,7 @@ function reverseFindWordsInMatrix(apiQuestion) {
|
|
|
977
1016
|
content: {
|
|
978
1017
|
type,
|
|
979
1018
|
title,
|
|
1019
|
+
instruction,
|
|
980
1020
|
rows,
|
|
981
1021
|
cols,
|
|
982
1022
|
gridSize: { rows, cols },
|
|
@@ -989,6 +1029,7 @@ function reverseFindWordsInMatrix(apiQuestion) {
|
|
|
989
1029
|
answer: {
|
|
990
1030
|
type,
|
|
991
1031
|
title,
|
|
1032
|
+
instruction,
|
|
992
1033
|
rows,
|
|
993
1034
|
cols,
|
|
994
1035
|
grid,
|
|
@@ -20,9 +20,9 @@ export interface MatchingWithLinesGroupContent {
|
|
|
20
20
|
meta?: {
|
|
21
21
|
instruction?: string;
|
|
22
22
|
title?: string;
|
|
23
|
-
audioUrl?: string;
|
|
23
|
+
audioUrl?: string | string[];
|
|
24
24
|
passage?: string;
|
|
25
|
-
imageUrl?: string;
|
|
25
|
+
imageUrl?: string | string[];
|
|
26
26
|
};
|
|
27
27
|
rightItems: MatchingWithLinesRightItem[];
|
|
28
28
|
items: MatchingWithLinesGroupItem[];
|