@tinyweb_dev/oe-exam-sdk 0.1.1 → 0.1.3
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/api/exam-create.js +1 -179
- package/dist/api/exam-create.types.js +1 -1
- package/dist/api/exam-questions.d.ts +1 -1
- package/dist/api/exam-questions.js +1 -98
- package/dist/api/exam-questions.types.d.ts +45 -1
- package/dist/api/exam-questions.types.js +1 -1
- package/dist/api/exam-taking.js +1 -73
- package/dist/api/exam-taking.types.js +1 -1
- package/dist/api/index.js +1 -6
- package/dist/api/result-review.js +1 -50
- package/dist/api/result-review.types.js +1 -1
- package/dist/components/CueCardEditor.js +1 -58
- package/dist/components/common/ResolvedImage.js +1 -15
- package/dist/components/exams/CompletionDialog.d.ts +8 -0
- package/dist/components/exams/CompletionDialog.js +1 -0
- package/dist/components/exams/CreateExamInfoForm.d.ts +4 -1
- package/dist/components/exams/CreateExamInfoForm.js +1 -35
- package/dist/components/exams/CreateExamPageContainer.d.ts +3 -0
- package/dist/components/exams/CreateExamPageContainer.js +1 -103
- package/dist/components/exams/ExamCreator.d.ts +9 -3
- package/dist/components/exams/ExamCreator.js +1 -89
- package/dist/components/exams/ExamPartTabs.d.ts +1 -1
- package/dist/components/exams/ExamPartTabs.js +1 -40
- package/dist/components/exams/ExamPreviewDialog.d.ts +20 -0
- package/dist/components/exams/ExamPreviewDialog.js +1 -0
- package/dist/components/exams/ExamQuestionGrid.d.ts +1 -1
- package/dist/components/exams/ExamQuestionGrid.js +1 -18
- package/dist/components/exams/ExamQuestionsPageContainer.d.ts +3 -0
- package/dist/components/exams/ExamQuestionsPageContainer.js +1 -90
- package/dist/components/exams/ExamViewDialog.d.ts +24 -0
- package/dist/components/exams/ExamViewDialog.js +1 -0
- package/dist/components/exams/PartAudioUploader.js +1 -9
- package/dist/components/exams/TemplateSelector.js +1 -66
- package/dist/components/exams/UnsavedChangesDialog.d.ts +8 -0
- package/dist/components/exams/UnsavedChangesDialog.js +1 -0
- package/dist/components/exams/api.d.ts +1 -1
- package/dist/components/exams/api.js +1 -3
- package/dist/components/exams/create-exam.texts.d.ts +58 -0
- package/dist/components/exams/create-exam.texts.js +1 -0
- package/dist/components/exams/create-exam.validation.js +1 -18
- package/dist/components/exams/exam-question-status.d.ts +9 -0
- package/dist/components/exams/exam-question-status.js +1 -0
- package/dist/components/exams/exam-template.utils.js +1 -18
- package/dist/components/exams/index.d.ts +11 -1
- package/dist/components/exams/index.js +1 -10
- package/dist/components/exams/take/ExamTakingPageContainer.js +1 -153
- package/dist/components/exams/take/GenericQuestionRenderer.js +1 -14
- package/dist/components/exams/take/exam-taking.utils.js +1 -88
- package/dist/components/exams/take/hooks/useSpeakingRecorder.js +1 -24
- package/dist/components/exams/take/index.js +1 -2
- package/dist/components/exams/take/types.js +1 -1
- package/dist/components/index.js +1 -42
- package/dist/components/questions/_shared/config/question-types.config.js +1 -333
- package/dist/components/questions/_shared/constants/color-palette.js +1 -21
- package/dist/components/questions/_shared/hooks/useAnswerGroupQuestionGroup.js +1 -105
- package/dist/components/questions/_shared/hooks/useBasicQuestionGroup.js +1 -222
- package/dist/components/questions/_shared/hooks/useCompareImagesGroup.js +1 -140
- package/dist/components/questions/_shared/hooks/useImageQuestionGroup.js +1 -123
- package/dist/components/questions/_shared/hooks/useInfoExchangeGroup.js +1 -50
- package/dist/components/questions/_shared/hooks/useQuestionFormState.js +1 -54
- package/dist/components/questions/_shared/hooks/useQuestionInitialization.js +1 -123
- package/dist/components/questions/_shared/hooks/useQuestionListGroup.js +1 -121
- package/dist/components/questions/_shared/hooks/useQuestionOnChange.js +1 -70
- package/dist/components/questions/_shared/hooks/useSceneQuestionGroup.js +1 -194
- package/dist/components/questions/_shared/index.js +1 -7
- package/dist/components/questions/_shared/types/answer-the-question.type.js +1 -1
- package/dist/components/questions/_shared/types/arrange-letters-into-words.type.js +1 -1
- package/dist/components/questions/_shared/types/choose-correct-adjective.type.js +1 -3
- package/dist/components/questions/_shared/types/color-region.config.js +1 -1
- package/dist/components/questions/_shared/types/fill-in-blank.type.js +1 -1
- package/dist/components/questions/_shared/types/fill-missing-words-in-grid.type.js +1 -1
- package/dist/components/questions/_shared/types/gn-speaking-interview.type.js +1 -1
- package/dist/components/questions/_shared/types/index.js +1 -12
- package/dist/components/questions/_shared/types/label-the-picture.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-choose-from-answer-group.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-choose-objects-in-scene.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-drag-objects-into-scene.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-compare-images.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-image-group.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-info-exchange.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-odd-one-out.type.js +1 -3
- package/dist/components/questions/_shared/types/listen-and-speak-question-list.type.js +1 -1
- package/dist/components/questions/_shared/types/listen-and-speak-with-story-images.type.js +1 -3
- package/dist/components/questions/_shared/types/listen-and-tick-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/listening-drawline.type.js +1 -1
- package/dist/components/questions/_shared/types/look-and-choose-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.js +1 -1
- package/dist/components/questions/_shared/types/match-by-writing-answer.type.js +1 -1
- package/dist/components/questions/_shared/types/multiple-choice.type.js +1 -1
- package/dist/components/questions/_shared/types/question-group.type.js +1 -11
- package/dist/components/questions/_shared/types/read-and-color-objects.type.js +1 -1
- package/dist/components/questions/_shared/types/read-displayed-content.type.js +1 -1
- package/dist/components/questions/_shared/types/read-passage-and-answer-questions.type.js +1 -1
- package/dist/components/questions/_shared/types/speaking-describe-image.type.js +1 -1
- package/dist/components/questions/_shared/types/spontaneous-qa.type.js +1 -1
- package/dist/components/questions/_shared/types/word-fill-paragraph-with-options.type.js +1 -1
- package/dist/components/questions/_shared/types/word-fill-paragraph.type.js +1 -1
- package/dist/components/questions/_shared/types/word-fill-structured-form.type.js +1 -1
- package/dist/components/questions/_shared/types/word-ordering.type.js +1 -1
- package/dist/components/questions/_shared/types/write-a-short-letter.type.js +1 -1
- package/dist/components/questions/_shared/types/write-correct-verb-form.type.js +1 -3
- package/dist/components/questions/_shared/types/write-sentences.type.js +1 -1
- package/dist/components/questions/_shared/types/write-short-paragraph.type.js +1 -1
- package/dist/components/questions/_shared/utils/answer-builder.js +1 -79
- package/dist/components/questions/_shared/utils/createColorRegionRegistration.js +1 -39
- package/dist/components/questions/_shared/utils/id-generator.js +1 -3
- package/dist/components/questions/_shared/utils/question-validation.js +1 -21
- package/dist/components/questions/components/ColorNode.js +1 -85
- package/dist/components/questions/components/ColorRegionClient.js +1 -545
- package/dist/components/questions/components/ColorRegionCreator.js +1 -420
- package/dist/components/questions/components/ColorRegionNode.js +1 -59
- package/dist/components/questions/components/CreatorGuide.js +1 -103
- package/dist/components/questions/components/NameNode.js +1 -26
- package/dist/components/questions/components/QuestionBankOption.js +1 -46
- package/dist/components/questions/components/QuestionBasicInfoForm.js +1 -9
- package/dist/components/questions/components/QuestionCommonFields.js +1 -33
- package/dist/components/questions/components/QuestionSearchDropdown.js +1 -258
- package/dist/components/questions/components/QuestionTypeSelector.js +1 -32
- package/dist/components/questions/components/QuestionTypeSpecificForms.js +1 -6
- package/dist/components/questions/components/RegionNode.js +1 -94
- package/dist/components/questions/components/index.js +1 -14
- package/dist/components/questions/creator/QuestionCreator.js +1 -90
- package/dist/components/questions/creator/QuestionGroupCreator.js +1 -119
- package/dist/components/questions/creator/dedicated-component-router.js +1 -79
- package/dist/components/questions/creator/index.js +1 -3
- package/dist/components/questions/creator/question-type-registry.js +1 -80
- package/dist/components/questions/groups/ArticlesGroupCard.js +1 -121
- package/dist/components/questions/groups/BasicQuestionGroupCard.js +1 -50
- package/dist/components/questions/groups/DocumentGroupCard.js +1 -114
- package/dist/components/questions/groups/MatchAnswerGroupCard.js +1 -25
- package/dist/components/questions/index.js +1 -10
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionClient.js +1 -37
- package/dist/components/questions/types/answer-the-question/AnswerTheQuestionCreator.js +1 -351
- package/dist/components/questions/types/answer-the-question/register.js +1 -67
- package/dist/components/questions/types/answer-the-question/transform.js +1 -36
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsClient.js +1 -141
- package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsCreator.js +1 -118
- package/dist/components/questions/types/arrange-letters-into-words/index.js +1 -2
- package/dist/components/questions/types/arrange-letters-into-words/register.js +1 -4
- package/dist/components/questions/types/arrange-letters-into-words/transform.js +1 -24
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveClient.js +1 -64
- package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveCreator.js +1 -169
- package/dist/components/questions/types/choose-correct-adjective/index.js +1 -2
- package/dist/components/questions/types/choose-correct-adjective/register.js +1 -55
- package/dist/components/questions/types/choose-correct-adjective/transform.js +1 -16
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +1 -131
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerCreator.js +1 -581
- package/dist/components/questions/types/choose-the-correct-answer/index.js +1 -2
- package/dist/components/questions/types/choose-the-correct-answer/register.js +1 -101
- package/dist/components/questions/types/choose-the-correct-answer/transform.js +1 -43
- package/dist/components/questions/types/fill-in-blank/FillInBlankClient.js +1 -275
- package/dist/components/questions/types/fill-in-blank/FillInBlankCreator.js +1 -448
- package/dist/components/questions/types/fill-in-blank/index.js +1 -2
- package/dist/components/questions/types/fill-in-blank/register.js +1 -138
- package/dist/components/questions/types/fill-in-blank/transform.js +1 -59
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridClient.js +1 -117
- package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridCreator.js +1 -671
- package/dist/components/questions/types/fill-missing-words-in-grid/index.js +1 -2
- package/dist/components/questions/types/fill-missing-words-in-grid/register.js +1 -37
- package/dist/components/questions/types/fill-missing-words-in-grid/transform.js +1 -15
- package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.js +1 -262
- package/dist/components/questions/types/gn-speaking-interview/register.js +1 -121
- package/dist/components/questions/types/gn-speaking-interview/transform.js +1 -48
- package/dist/components/questions/types/image-object-matching/ImageObjectMatchingClient.js +1 -16
- package/dist/components/questions/types/image-object-matching/ImageObjectMatchingCreator.js +1 -27
- package/dist/components/questions/types/image-object-matching/index.js +1 -2
- package/dist/components/questions/types/image-object-matching/register.js +1 -3
- package/dist/components/questions/types/image-object-matching/transform.js +1 -2
- package/dist/components/questions/types/label-the-picture/LabelThePictureClient.js +1 -102
- package/dist/components/questions/types/label-the-picture/LabelThePictureCreator.js +1 -344
- package/dist/components/questions/types/label-the-picture/index.js +1 -2
- package/dist/components/questions/types/label-the-picture/register.js +1 -54
- package/dist/components/questions/types/label-the-picture/transform.js +1 -28
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupClient.js +1 -78
- package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupCreator.js +1 -232
- package/dist/components/questions/types/listen-and-choose-from-answer-group/index.js +1 -2
- package/dist/components/questions/types/listen-and-choose-from-answer-group/register.js +1 -82
- package/dist/components/questions/types/listen-and-choose-from-answer-group/transform.js +1 -27
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneClient.js +1 -70
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneCreator.js +1 -386
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/index.js +1 -2
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/register.js +1 -100
- package/dist/components/questions/types/listen-and-choose-objects-in-scene/transform.js +1 -33
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneClient.js +1 -106
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneCreator.js +1 -457
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/index.js +1 -2
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/register.js +1 -110
- package/dist/components/questions/types/listen-and-drag-objects-into-scene/transform.js +1 -35
- package/dist/components/questions/types/listen-and-speak-answer/ArrowIndicator.js +1 -8
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerClient.js +1 -22
- package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerCreator.js +1 -291
- package/dist/components/questions/types/listen-and-speak-answer/index.js +1 -2
- package/dist/components/questions/types/listen-and-speak-answer/register.js +1 -84
- package/dist/components/questions/types/listen-and-speak-answer/transform.js +1 -27
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesClient.js +1 -32
- package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesCreator.js +1 -295
- package/dist/components/questions/types/listen-and-speak-compare-images/register.js +1 -79
- package/dist/components/questions/types/listen-and-speak-compare-images/transform.js +1 -27
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupClient.js +1 -34
- package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupCreator.js +1 -285
- package/dist/components/questions/types/listen-and-speak-image-group/register.js +1 -81
- package/dist/components/questions/types/listen-and-speak-image-group/transform.js +1 -26
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeClient.js +1 -38
- package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeCreator.js +1 -385
- package/dist/components/questions/types/listen-and-speak-info-exchange/register.js +1 -87
- package/dist/components/questions/types/listen-and-speak-info-exchange/transform.js +1 -32
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutClient.js +1 -26
- package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutCreator.js +1 -247
- package/dist/components/questions/types/listen-and-speak-odd-one-out/register.js +1 -59
- package/dist/components/questions/types/listen-and-speak-odd-one-out/transform.js +1 -18
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListClient.js +1 -26
- package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListCreator.js +1 -256
- package/dist/components/questions/types/listen-and-speak-question-list/register.js +1 -81
- package/dist/components/questions/types/listen-and-speak-question-list/transform.js +1 -26
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesClient.js +1 -26
- package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesCreator.js +1 -230
- package/dist/components/questions/types/listen-and-speak-with-story-images/register.js +1 -56
- package/dist/components/questions/types/listen-and-speak-with-story-images/transform.js +1 -16
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.js +1 -72
- package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.js +1 -230
- package/dist/components/questions/types/look-picture-choose-correct-answer/index.js +1 -1
- package/dist/components/questions/types/look-picture-choose-correct-answer/register.js +1 -66
- package/dist/components/questions/types/look-picture-choose-correct-answer/transform.js +1 -42
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.js +1 -96
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.js +1 -238
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.js +1 -2
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.js +1 -76
- package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.js +1 -19
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.js +1 -134
- package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.js +1 -617
- package/dist/components/questions/types/look-picture-fill-word-hint/index.js +1 -2
- package/dist/components/questions/types/look-picture-fill-word-hint/register.js +1 -82
- package/dist/components/questions/types/look-picture-fill-word-hint/transform.js +1 -29
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerClient.js +1 -38
- package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerCreator.js +1 -359
- package/dist/components/questions/types/match-by-writing-answer/index.js +1 -3
- package/dist/components/questions/types/match-by-writing-answer/register.js +1 -58
- package/dist/components/questions/types/match-by-writing-answer/transform.js +1 -61
- package/dist/components/questions/types/read-and-color-objects/ReadAndColorObjectsClient.js +1 -16
- package/dist/components/questions/types/read-and-color-objects/ReadAndColorObjectsCreator.js +1 -23
- package/dist/components/questions/types/read-and-color-objects/index.js +1 -2
- package/dist/components/questions/types/read-and-color-objects/register.js +1 -3
- package/dist/components/questions/types/read-and-color-objects/transform.js +1 -36
- package/dist/components/questions/types/read-displayed-content/ReadDisplayedContentCreator.js +1 -125
- package/dist/components/questions/types/read-displayed-content/register.js +1 -64
- package/dist/components/questions/types/read-displayed-content/transform.js +1 -12
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsClient.js +1 -64
- package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsCreator.js +1 -511
- package/dist/components/questions/types/read-passage-and-answer-questions/index.js +1 -2
- package/dist/components/questions/types/read-passage-and-answer-questions/register.js +1 -58
- package/dist/components/questions/types/read-passage-and-answer-questions/transform.js +1 -28
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationCreator.js +1 -373
- package/dist/components/questions/types/speaking-conversation/SpeakingConversationPreviewClient.js +1 -41
- package/dist/components/questions/types/speaking-conversation/register.js +1 -110
- package/dist/components/questions/types/speaking-conversation/transform.js +1 -34
- package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardCreator.js +1 -74
- package/dist/components/questions/types/speaking-cue-card/register.js +1 -52
- package/dist/components/questions/types/speaking-cue-card/transform.js +1 -12
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageClient.js +1 -10
- package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageCreator.js +1 -161
- package/dist/components/questions/types/speaking-describe-image/index.js +1 -2
- package/dist/components/questions/types/speaking-describe-image/register.js +1 -69
- package/dist/components/questions/types/speaking-describe-image/transform.js +1 -16
- package/dist/components/questions/types/spontaneous-qa/SpontaneousQACreator.js +1 -234
- package/dist/components/questions/types/spontaneous-qa/register.js +1 -93
- package/dist/components/questions/types/spontaneous-qa/transform.js +1 -34
- package/dist/components/questions/types/true-false/TrueFalseClient.js +1 -75
- package/dist/components/questions/types/true-false/TrueFalseCreator.js +1 -244
- package/dist/components/questions/types/true-false/index.js +1 -2
- package/dist/components/questions/types/true-false/register.js +1 -77
- package/dist/components/questions/types/true-false/transform.js +1 -32
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphClient.js +1 -233
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphCreator.js +1 -631
- package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphWrapper.js +1 -28
- package/dist/components/questions/types/word-fill-paragraph/index.js +1 -2
- package/dist/components/questions/types/word-fill-paragraph/register.js +1 -136
- package/dist/components/questions/types/word-fill-paragraph/transform.js +1 -56
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +1 -138
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.js +1 -261
- package/dist/components/questions/types/word-fill-structured-form/index.js +1 -2
- package/dist/components/questions/types/word-fill-structured-form/register.js +1 -67
- package/dist/components/questions/types/word-fill-structured-form/transform.js +1 -40
- package/dist/components/questions/types/word-ordering/WordOrderingClient.js +1 -84
- package/dist/components/questions/types/word-ordering/WordOrderingCreator.js +1 -192
- package/dist/components/questions/types/word-ordering/index.js +1 -2
- package/dist/components/questions/types/word-ordering/register.js +1 -46
- package/dist/components/questions/types/word-ordering/transform.js +1 -24
- package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterClient.js +1 -98
- package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterCreator.js +1 -320
- package/dist/components/questions/types/write-a-short-letter/index.js +1 -2
- package/dist/components/questions/types/write-a-short-letter/register.js +1 -68
- package/dist/components/questions/types/write-a-short-letter/transform.js +1 -25
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormClient.js +1 -61
- package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormCreator.js +1 -196
- package/dist/components/questions/types/write-correct-verb-form/index.js +1 -2
- package/dist/components/questions/types/write-correct-verb-form/register.js +1 -62
- package/dist/components/questions/types/write-correct-verb-form/transform.js +1 -17
- package/dist/components/questions/types/write-sentences/WriteSentencesClient.js +1 -22
- package/dist/components/questions/types/write-sentences/WriteSentencesCreator.js +1 -174
- package/dist/components/questions/types/write-sentences/index.js +1 -2
- package/dist/components/questions/types/write-sentences/register.js +1 -58
- package/dist/components/questions/types/write-sentences/transform.js +1 -28
- package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphClient.js +1 -96
- package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphCreator.js +1 -161
- package/dist/components/questions/types/write-short-paragraph/index.js +1 -2
- package/dist/components/questions/types/write-short-paragraph/register.js +1 -4
- package/dist/components/questions/types/write-short-paragraph/transform.js +1 -21
- package/dist/components/questions/viewer/QuestionGroupViewer.js +1 -36
- package/dist/components/questions/viewer/QuestionViewer.js +1 -446
- package/dist/components/questions/viewer/index.js +1 -2
- package/dist/components/results/ResultReviewPageContainer.js +1 -98
- package/dist/components/results/ReviewQuestionRenderer.js +1 -72
- package/dist/components/results/index.js +1 -2
- package/dist/components/results/result-review.utils.js +1 -6
- package/dist/components/results/review-data.js +1 -150
- package/dist/components/results/review-renderer.utils.js +1 -97
- package/dist/components/results/review-types.js +1 -1
- package/dist/components/themes/cambridge-yle/CambridgeYleAudioPlayer.js +1 -138
- package/dist/components/themes/cambridge-yle/CambridgeYleBottomNav.js +1 -12
- package/dist/components/themes/cambridge-yle/CambridgeYleExamLayout.js +1 -18
- package/dist/components/themes/cambridge-yle/CambridgeYleExampleText.js +1 -11
- package/dist/components/themes/cambridge-yle/CambridgeYleHeader.js +1 -11
- package/dist/components/themes/cambridge-yle/CambridgeYleInstructionBanner.js +1 -9
- package/dist/components/themes/cambridge-yle/CambridgeYleNavButton.js +1 -13
- package/dist/components/themes/cambridge-yle/CambridgeYlePartBanner.js +1 -8
- package/dist/components/themes/cambridge-yle/CambridgeYleProgressBar.js +1 -6
- package/dist/components/themes/cambridge-yle/CambridgeYleQuestionCard.js +1 -5
- package/dist/components/themes/cambridge-yle/CambridgeYleQuestionCardFullWidth.js +1 -9
- package/dist/components/themes/cambridge-yle/CambridgeYleSidebar.js +1 -41
- package/dist/components/themes/cambridge-yle/CambridgeYleTimer.js +1 -25
- package/dist/components/themes/cambridge-yle/index.js +1 -13
- package/dist/components/themes/english-certification/EcAnswerTheQuestion.js +1 -24
- package/dist/components/themes/english-certification/EcMatchByWritingAnswer.js +1 -88
- package/dist/components/themes/english-certification/EcWordFillParagraph.js +1 -55
- package/dist/components/themes/english-certification/EcWordFillStructuredForm.js +1 -156
- package/dist/components/themes/english-certification/EcWritingTask.js +1 -34
- package/dist/components/themes/english-certification/EnglishCertificationAudioPlayer.js +1 -114
- package/dist/components/themes/english-certification/EnglishCertificationBrand.js +1 -11
- package/dist/components/themes/english-certification/EnglishCertificationExamLayout.js +1 -21
- package/dist/components/themes/english-certification/EnglishCertificationFlagButton.js +1 -15
- package/dist/components/themes/english-certification/EnglishCertificationFooterBar.js +1 -19
- package/dist/components/themes/english-certification/EnglishCertificationGroupedQuestion.js +1 -148
- package/dist/components/themes/english-certification/EnglishCertificationHeader.js +1 -31
- package/dist/components/themes/english-certification/EnglishCertificationNavigationPanel.js +1 -71
- package/dist/components/themes/english-certification/EnglishCertificationOptionSelector.js +1 -33
- package/dist/components/themes/english-certification/EnglishCertificationPassagePanel.js +1 -16
- package/dist/components/themes/english-certification/EnglishCertificationQuestionCard.js +1 -22
- package/dist/components/themes/english-certification/EnglishCertificationQuestionItem.js +1 -37
- package/dist/components/themes/english-certification/EnglishCertificationQuestionRenderer.js +1 -72
- package/dist/components/themes/english-certification/EnglishCertificationReadingSection.js +1 -90
- package/dist/components/themes/english-certification/EnglishCertificationSingleQuestion.js +1 -18
- package/dist/components/themes/english-certification/EnglishCertificationSingleQuestionList.js +1 -29
- package/dist/components/themes/english-certification/english-certification-theme.js +1 -58
- package/dist/components/themes/english-certification/grouped-question-utils.js +1 -218
- package/dist/components/themes/english-certification/index.js +1 -21
- package/dist/components/themes/index.js +1 -6
- package/dist/components/themes/summer-sky/SummerSkyAudioPlayer.js +1 -170
- package/dist/components/themes/summer-sky/SummerSkyLayout.js +1 -221
- package/dist/components/themes/summer-sky/SummerSkySubmitModal.js +1 -18
- package/dist/components/themes/summer-sky/SummerSkyWaitingRoom.js +1 -194
- package/dist/components/themes/types.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -26
- package/dist/components/ui/alert.js +1 -22
- package/dist/components/ui/avatar.js +1 -12
- package/dist/components/ui/badge.js +1 -38
- package/dist/components/ui/button.js +1 -35
- package/dist/components/ui/calendar.js +1 -76
- package/dist/components/ui/card.js +1 -16
- package/dist/components/ui/carousel.js +1 -91
- package/dist/components/ui/checkbox.js +1 -9
- package/dist/components/ui/collapsible.js +1 -13
- package/dist/components/ui/command.js +1 -34
- package/dist/components/ui/confirm-dialog.js +1 -49
- package/dist/components/ui/dialog.js +1 -23
- package/dist/components/ui/drawer.js +1 -35
- package/dist/components/ui/dropdown-menu.js +1 -33
- package/dist/components/ui/file-upload.js +1 -155
- package/dist/components/ui/form.js +1 -62
- package/dist/components/ui/hover-card.js +1 -10
- package/dist/components/ui/image-preview.js +1 -29
- package/dist/components/ui/input.js +1 -8
- package/dist/components/ui/label.js +1 -9
- package/dist/components/ui/language-switcher.js +1 -15
- package/dist/components/ui/multi-select.js +1 -90
- package/dist/components/ui/points-input.js +1 -33
- package/dist/components/ui/popover.js +1 -26
- package/dist/components/ui/progress.js +1 -16
- package/dist/components/ui/radio-group.js +1 -12
- package/dist/components/ui/scroll-area.js +1 -11
- package/dist/components/ui/select.js +1 -38
- package/dist/components/ui/separator.js +1 -8
- package/dist/components/ui/sheet.js +1 -40
- package/dist/components/ui/single-select.js +1 -76
- package/dist/components/ui/skeleton.js +1 -6
- package/dist/components/ui/switch.js +1 -8
- package/dist/components/ui/table.js +1 -20
- package/dist/components/ui/tabs.js +1 -17
- package/dist/components/ui/textarea.js +1 -8
- package/dist/components/ui/tooltip.js +1 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -19
- package/dist/mcp/config.js +1 -32
- package/dist/mcp/http-client.js +1 -48
- package/dist/mcp/index.js +1 -29
- package/dist/mcp/tools/_helpers.js +1 -25
- package/dist/mcp/tools/exams.js +1 -439
- package/dist/mcp/tools/index.js +1 -6
- package/dist/mcp/tools/results.js +1 -19
- package/dist/shared/constants/ApiConstant.js +1 -276
- package/dist/shared/constants/QueryKeyConstant.js +1 -112
- package/dist/shared/constants/exam-level.enum.js +1 -41
- package/dist/shared/constants/landings/placement-test.constants.js +1 -431
- package/dist/shared/constants/question-skills.js +1 -267
- package/dist/shared/constants/routes.js +1 -81
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.js +1 -7
- package/dist/shared/lib/hooks/index.js +1 -10
- package/dist/shared/lib/hooks/useAlertDialog.js +1 -57
- package/dist/shared/lib/hooks/useAudioPlayCounter.js +1 -30
- package/dist/shared/lib/hooks/useAudioPreview.js +1 -81
- package/dist/shared/lib/hooks/useAudioUpload.js +1 -24
- package/dist/shared/lib/hooks/useConfirmDialog.js +1 -89
- package/dist/shared/lib/hooks/useDebouncedCallback.js +1 -32
- package/dist/shared/lib/hooks/useDelayedAutoPlay.js +1 -12
- package/dist/shared/lib/hooks/useFileUpload.js +1 -24
- package/dist/shared/lib/hooks/useImageUrl.js +1 -5
- package/dist/shared/lib/hooks/usePresignedFileUrl.js +1 -10
- package/dist/shared/lib/hooks/useReactHookForm.js +1 -31
- package/dist/shared/lib/hooks/useToast.js +1 -62
- package/dist/shared/lib/i18n/index.js +1 -54
- package/dist/shared/lib/i18n/messages/en/admin.js +1 -2104
- package/dist/shared/lib/i18n/messages/en/auth.js +1 -86
- package/dist/shared/lib/i18n/messages/en/common.js +1 -140
- package/dist/shared/lib/i18n/messages/en/file-upload.js +1 -18
- package/dist/shared/lib/i18n/messages/en/student.js +1 -133
- package/dist/shared/lib/i18n/messages/en/terms.js +1 -37
- package/dist/shared/lib/i18n/messages/en.js +1 -15
- package/dist/shared/lib/i18n/messages/vi/admin.js +1 -2104
- package/dist/shared/lib/i18n/messages/vi/auth.js +1 -86
- package/dist/shared/lib/i18n/messages/vi/common.js +1 -140
- package/dist/shared/lib/i18n/messages/vi/file-upload.js +1 -18
- package/dist/shared/lib/i18n/messages/vi/student.js +1 -133
- package/dist/shared/lib/i18n/messages/vi/terms.js +1 -37
- package/dist/shared/lib/i18n/messages/vi.js +1 -15
- package/dist/shared/lib/i18n/types.js +1 -1
- package/dist/shared/lib/stores/examQuestionStore.js +1 -212
- package/dist/shared/lib/stores/localeStore.js +1 -10
- package/dist/shared/lib/utils/public-page.js +1 -44
- package/dist/shared/lib/utils/question-reverse-transform.d.ts +6 -0
- package/dist/shared/lib/utils/question-reverse-transform.js +1 -0
- package/dist/shared/lib/utils/question-transform-types.js +1 -1
- package/dist/shared/lib/utils/question-transform-validation.d.ts +6 -0
- package/dist/shared/lib/utils/question-transform-validation.js +1 -0
- package/dist/shared/lib/utils/question-transform.d.ts +6 -2
- package/dist/shared/lib/utils/question-transform.js +1 -174
- package/dist/shared/lib/utils.js +1 -168
- package/dist/shared/lib/validation/choose-correct-answer.validation.js +1 -111
- package/dist/shared/lib/validation/label-the-picture.validation.js +1 -19
- package/dist/shared/lib/validation/listen-and-choose-from-answer-group.validation.js +1 -46
- package/dist/shared/lib/validation/listen-and-choose-objects-in-scene.validation.js +1 -21
- package/dist/shared/lib/validation/listen-and-drag-objects-into-scene.validation.js +1 -34
- package/dist/shared/lib/validation/listen-and-speak-answer.validation.js +1 -40
- package/dist/shared/lib/validation/listen-and-speak-compare-images.validation.js +1 -45
- package/dist/shared/lib/validation/listen-and-speak-image-group.validation.js +1 -19
- package/dist/shared/lib/validation/listen-and-speak-info-exchange.validation.js +1 -39
- package/dist/shared/lib/validation/listen-and-speak-odd-one-out.validation.js +1 -32
- package/dist/shared/lib/validation/listen-and-speak-question-list.validation.js +1 -19
- package/dist/shared/lib/validation/listen-and-speak-with-story-images.validation.js +1 -28
- package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.js +1 -12
- package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.js +1 -47
- package/dist/shared/lib/validation/read-and-color-objects.validation.js +1 -29
- package/dist/shared/lib/validation/read-displayed-content.validation.js +1 -28
- package/dist/shared/lib/validation/speaking-conversation.validation.js +1 -75
- package/dist/shared/lib/validation/speaking-describe-image.validation.js +1 -31
- package/dist/shared/lib/validation/spontaneous-qa.validation.js +1 -48
- package/dist/shared/lib/validation/word-fill-paragraph-default.validation.js +1 -38
- package/dist/shared/lib/validation/word-fill-paragraph-with-options.validation.js +1 -39
- package/dist/shared/lib/validation/word-fill-paragraph.validation.js +1 -43
- package/dist/shared/lib/validation/word-ordering.validation.js +1 -33
- package/dist/shared/types/branch.types.js +1 -6
- package/dist/shared/types/common.types.js +1 -50
- package/dist/shared/types/entities/exam-schedule.types.js +1 -5
- package/dist/shared/types/entities/exam.types.js +1 -1
- package/dist/shared/types/entities/question.types.js +1 -4
- package/dist/shared/types/entities/result.types.js +1 -4
- package/dist/shared/types/entities/user.types.js +1 -4
- package/dist/shared/types/exam-taking.types.js +1 -2
- package/dist/shared/types/history.types.js +1 -34
- package/dist/shared/types/index.js +1 -1
- package/dist/shared/types/questions/choose-correct-adjective.js +1 -4
- package/dist/shared/types/questions/choose-the-correct-answer.js +1 -9
- package/dist/shared/types/questions/fill-missing-words-in-grid.js +1 -11
- package/dist/shared/types/questions/index.js +1 -40
- package/dist/shared/types/questions/listen-and-speak-answer.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-compare-images.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-image-group.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-info-exchange.js +1 -3
- package/dist/shared/types/questions/listen-and-speak-odd-one-out.js +1 -3
- package/dist/shared/types/questions/listen-and-speak-question-list.js +1 -1
- package/dist/shared/types/questions/listen-and-speak-with-story-images.js +1 -3
- package/dist/shared/types/questions/look-picture-choose-correct-answer.js +1 -5
- package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.js +1 -9
- package/dist/shared/types/questions/look-picture-fill-word-hint.js +1 -7
- package/dist/shared/types/questions/read-displayed-content.js +1 -1
- package/dist/shared/types/questions/speaking-conversation.js +1 -7
- package/dist/shared/types/questions/speaking-describe-image.js +1 -1
- package/dist/shared/types/questions/spontaneous-qa.js +1 -1
- package/dist/shared/types/questions/write-correct-verb-form.js +1 -12
- package/dist/shared/types/role.types.js +1 -1
- package/dist/shared/types/structure-management.js +1 -28
- package/dist/shared/types/student.types.js +1 -54
- package/dist/shared/types/teacher-dashboard-rooms.js +1 -2
- package/package.json +12 -3
|
@@ -1,89 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useCallback, useState } from 'react';
|
|
3
|
-
const DEFAULT_CONFIG = {
|
|
4
|
-
confirmLabel: 'Confirm',
|
|
5
|
-
cancelLabel: 'Cancel',
|
|
6
|
-
isDestructive: false,
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Hook for managing confirmation dialogs
|
|
10
|
-
* Use this when you need user confirmation before performing an action
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const { isOpen, config, confirm } = useConfirmDialog();
|
|
14
|
-
*
|
|
15
|
-
* const handleDelete = () => {
|
|
16
|
-
* confirm({
|
|
17
|
-
* title: 'Delete Item',
|
|
18
|
-
* description: 'Are you sure you want to delete this item?',
|
|
19
|
-
* isDestructive: true,
|
|
20
|
-
* onConfirm: async () => {
|
|
21
|
-
* await deleteItem();
|
|
22
|
-
* }
|
|
23
|
-
* });
|
|
24
|
-
* };
|
|
25
|
-
*/
|
|
26
|
-
export function useConfirmDialog() {
|
|
27
|
-
const [state, setState] = useState({
|
|
28
|
-
isOpen: false,
|
|
29
|
-
isLoading: false,
|
|
30
|
-
title: '',
|
|
31
|
-
description: '',
|
|
32
|
-
...DEFAULT_CONFIG,
|
|
33
|
-
});
|
|
34
|
-
const confirm = useCallback((config) => {
|
|
35
|
-
setState((prev) => ({
|
|
36
|
-
...prev,
|
|
37
|
-
...config,
|
|
38
|
-
isOpen: true,
|
|
39
|
-
isLoading: false,
|
|
40
|
-
onConfirm: config.onConfirm,
|
|
41
|
-
onCancel: config.onCancel,
|
|
42
|
-
}));
|
|
43
|
-
}, []);
|
|
44
|
-
const close = useCallback(() => {
|
|
45
|
-
setState((prev) => ({
|
|
46
|
-
...prev,
|
|
47
|
-
isOpen: false,
|
|
48
|
-
}));
|
|
49
|
-
}, []);
|
|
50
|
-
const setLoading = useCallback((isLoading) => {
|
|
51
|
-
setState((prev) => ({
|
|
52
|
-
...prev,
|
|
53
|
-
isLoading,
|
|
54
|
-
}));
|
|
55
|
-
}, []);
|
|
56
|
-
const handleConfirm = useCallback(async () => {
|
|
57
|
-
if (state.onConfirm) {
|
|
58
|
-
try {
|
|
59
|
-
setLoading(true);
|
|
60
|
-
await state.onConfirm();
|
|
61
|
-
close();
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
setLoading(false);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, [state.onConfirm, setLoading, close]);
|
|
68
|
-
const handleCancel = useCallback(() => {
|
|
69
|
-
if (state.onCancel) {
|
|
70
|
-
state.onCancel();
|
|
71
|
-
}
|
|
72
|
-
close();
|
|
73
|
-
}, [state.onCancel, close]);
|
|
74
|
-
return {
|
|
75
|
-
isOpen: state.isOpen,
|
|
76
|
-
isLoading: state.isLoading,
|
|
77
|
-
config: {
|
|
78
|
-
title: state.title,
|
|
79
|
-
description: state.description,
|
|
80
|
-
confirmLabel: state.confirmLabel || DEFAULT_CONFIG.confirmLabel,
|
|
81
|
-
cancelLabel: state.cancelLabel || DEFAULT_CONFIG.cancelLabel,
|
|
82
|
-
isDestructive: state.isDestructive || DEFAULT_CONFIG.isDestructive,
|
|
83
|
-
},
|
|
84
|
-
confirm,
|
|
85
|
-
close,
|
|
86
|
-
handleConfirm,
|
|
87
|
-
handleCancel,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
1
|
+
"use client";import{useCallback as n,useState as i}from"react";const e={confirmLabel:"Confirm",cancelLabel:"Cancel",isDestructive:!1};export function useConfirmDialog(){const[o,c]=i({isOpen:!1,isLoading:!1,title:"",description:"",...e}),a=n(n=>{c(i=>({...i,...n,isOpen:!0,isLoading:!1,onConfirm:n.onConfirm,onCancel:n.onCancel}))},[]),l=n(()=>{c(n=>({...n,isOpen:!1}))},[]),r=n(n=>{c(i=>({...i,isLoading:n}))},[]),s=n(async()=>{if(o.onConfirm)try{r(!0),await o.onConfirm(),l()}finally{r(!1)}},[o.onConfirm,r,l]),t=n(()=>{o.onCancel&&o.onCancel(),l()},[o.onCancel,l]);return{isOpen:o.isOpen,isLoading:o.isLoading,config:{title:o.title,description:o.description,confirmLabel:o.confirmLabel||e.confirmLabel,cancelLabel:o.cancelLabel||e.cancelLabel,isDestructive:o.isDestructive||e.isDestructive},confirm:a,close:l,handleConfirm:s,handleCancel:t}}
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* Custom hook for debouncing a callback function
|
|
4
|
-
* @param callback The function to debounce
|
|
5
|
-
* @param delay The debounce delay in milliseconds
|
|
6
|
-
* @returns A debounced version of the callback
|
|
7
|
-
*/
|
|
8
|
-
export function useDebouncedCallback(callback, delay) {
|
|
9
|
-
const callbackRef = useRef(callback);
|
|
10
|
-
const timeoutRef = useRef(null);
|
|
11
|
-
// Keep callback ref up to date
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
callbackRef.current = callback;
|
|
14
|
-
}, [callback]);
|
|
15
|
-
// Cleanup timeout on unmount
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
return () => {
|
|
18
|
-
if (timeoutRef.current) {
|
|
19
|
-
clearTimeout(timeoutRef.current);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
const debouncedCallback = useCallback((...args) => {
|
|
24
|
-
if (timeoutRef.current) {
|
|
25
|
-
clearTimeout(timeoutRef.current);
|
|
26
|
-
}
|
|
27
|
-
timeoutRef.current = setTimeout(() => {
|
|
28
|
-
callbackRef.current(...args);
|
|
29
|
-
}, delay);
|
|
30
|
-
}, [delay]);
|
|
31
|
-
return debouncedCallback;
|
|
32
|
-
}
|
|
1
|
+
import{useCallback as r,useRef as e,useEffect as t}from"react";export function useDebouncedCallback(u,c){const n=e(u),o=e(null);t(()=>{n.current=u},[u]),t(()=>()=>{o.current&&clearTimeout(o.current)},[]);return r((...r)=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n.current(...r)},c)},[c])}
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
export const DEFAULT_AUTO_PLAY_DELAY_MS = 3000;
|
|
4
|
-
export function useDelayedAutoPlay({ audioRef, audioUrl, delayMs = DEFAULT_AUTO_PLAY_DELAY_MS, enabled = true }) {
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (!enabled || !audioRef.current || !audioUrl)
|
|
7
|
-
return;
|
|
8
|
-
const audio = audioRef.current;
|
|
9
|
-
const timer = window.setTimeout(() => { void audio.play().catch(() => undefined); }, delayMs);
|
|
10
|
-
return () => window.clearTimeout(timer);
|
|
11
|
-
}, [audioRef, audioUrl, delayMs, enabled]);
|
|
12
|
-
}
|
|
1
|
+
"use client";import{useEffect as e}from"react";export const DEFAULT_AUTO_PLAY_DELAY_MS=3e3;export function useDelayedAutoPlay({audioRef:t,audioUrl:r,delayMs:o=3e3,enabled:n=!0}){e(()=>{if(!n||!t.current||!r)return;const e=t.current,u=window.setTimeout(()=>{e.play().catch(()=>{})},o);return()=>window.clearTimeout(u)},[t,r,o,n])}
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function useFileUpload(options = {}) {
|
|
3
|
-
const [isUploading, setIsUploading] = useState(false);
|
|
4
|
-
const [error, setError] = useState(null);
|
|
5
|
-
const uploadFile = useCallback(async (file) => {
|
|
6
|
-
setIsUploading(true);
|
|
7
|
-
setError(null);
|
|
8
|
-
try {
|
|
9
|
-
const url = URL.createObjectURL(file);
|
|
10
|
-
options.onSuccess?.(url, url);
|
|
11
|
-
return { key: url, presignedUrl: url };
|
|
12
|
-
}
|
|
13
|
-
catch (err) {
|
|
14
|
-
const error = err instanceof Error ? err : new Error('Upload failed');
|
|
15
|
-
setError(error);
|
|
16
|
-
options.onError?.(error);
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
finally {
|
|
20
|
-
setIsUploading(false);
|
|
21
|
-
}
|
|
22
|
-
}, [options]);
|
|
23
|
-
return { uploadFile, isUploading, error };
|
|
24
|
-
}
|
|
1
|
+
import{useState as r,useCallback as n}from"react";export function useFileUpload(e={}){const[o,l]=r(!1),[t,c]=r(null),a=n(async r=>{l(!0),c(null);try{const n=URL.createObjectURL(r);return e.onSuccess?.(n,n),{key:n,presignedUrl:n}}catch(r){const n=r instanceof Error?r:new Error("Upload failed");return c(n),e.onError?.(n),null}finally{l(!1)}},[e]);return{uploadFile:a,isUploading:o,error:t}}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { usePresignedFileUrl } from './usePresignedFileUrl';
|
|
3
|
-
export function useImageUrl(src) {
|
|
4
|
-
return usePresignedFileUrl(src).previewUrl || src || '';
|
|
5
|
-
}
|
|
1
|
+
"use client";import{usePresignedFileUrl as e}from"./usePresignedFileUrl";export function useImageUrl(r){return e(r).previewUrl||r||""}
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export function usePresignedFileUrl(fileKey) {
|
|
3
|
-
const previewUrl = useMemo(() => fileKey || '', [fileKey]);
|
|
4
|
-
return {
|
|
5
|
-
// Components-only SDK: host should pass displayable URLs. Storage-key resolving belongs to the host app.
|
|
6
|
-
previewUrl,
|
|
7
|
-
isLoading: false,
|
|
8
|
-
error: null,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
1
|
+
import{useMemo as r}from"react";export function usePresignedFileUrl(e){return{previewUrl:r(()=>e||"",[e]),isLoading:!1,error:null}}
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
-
/**
|
|
4
|
-
* Wrapper hook cho React Hook Form với Zod integration
|
|
5
|
-
* Cung cấp interface đơn giản hơn và tích hợp sẵn Zod resolver
|
|
6
|
-
*/
|
|
7
|
-
export const useReactHookForm = (options) => {
|
|
8
|
-
const { zodSchema, ...formOptions } = options;
|
|
9
|
-
const form = useRHF({
|
|
10
|
-
resolver: zodSchema ? zodResolver(zodSchema) : undefined,
|
|
11
|
-
mode: 'onSubmit',
|
|
12
|
-
reValidateMode: 'onChange', // After errors appear, re-validate on change to clear them
|
|
13
|
-
...formOptions,
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
...form,
|
|
17
|
-
// Helper methods for easier usage
|
|
18
|
-
setFieldValue: (field, value) => {
|
|
19
|
-
form.setValue(field, value, { shouldValidate: true });
|
|
20
|
-
},
|
|
21
|
-
clearFieldError: (field) => {
|
|
22
|
-
form.clearErrors(field);
|
|
23
|
-
},
|
|
24
|
-
hasError: (field) => {
|
|
25
|
-
return !!form.formState.errors[field];
|
|
26
|
-
},
|
|
27
|
-
getFieldError: (field) => {
|
|
28
|
-
return form.formState.errors[field]?.message;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
1
|
+
import{useForm as r}from"react-hook-form";import{zodResolver as o}from"@hookform/resolvers/zod";export const useReactHookForm=e=>{const{zodSchema:t,...a}=e,s=r({resolver:t?o(t):void 0,mode:"onSubmit",reValidateMode:"onChange",...a});return{...s,setFieldValue:(r,o)=>{s.setValue(r,o,{shouldValidate:!0})},clearFieldError:r=>{s.clearErrors(r)},hasError:r=>!!s.formState.errors[r],getFieldError:r=>s.formState.errors[r]?.message}};
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { toast } from 'sonner';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* Hook for showing toast notifications using Sonner
|
|
6
|
-
* Use this hook instead of alert() for non-blocking notifications
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* const { success, error, info, warning } = useToast();
|
|
10
|
-
*
|
|
11
|
-
* success({
|
|
12
|
-
* message: 'Success!',
|
|
13
|
-
* description: 'Your action was completed'
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* error({
|
|
17
|
-
* message: 'Error!',
|
|
18
|
-
* description: 'Something went wrong'
|
|
19
|
-
* });
|
|
20
|
-
*/
|
|
21
|
-
export function useToast() {
|
|
22
|
-
const success = useCallback((config) => {
|
|
23
|
-
toast.success(config.message, {
|
|
24
|
-
description: config.description,
|
|
25
|
-
duration: config.duration,
|
|
26
|
-
action: config.action,
|
|
27
|
-
});
|
|
28
|
-
}, []);
|
|
29
|
-
const error = useCallback((config) => {
|
|
30
|
-
toast.error(config.message, {
|
|
31
|
-
description: config.description,
|
|
32
|
-
duration: config.duration,
|
|
33
|
-
action: config.action,
|
|
34
|
-
});
|
|
35
|
-
}, []);
|
|
36
|
-
const info = useCallback((config) => {
|
|
37
|
-
toast.info(config.message, {
|
|
38
|
-
description: config.description,
|
|
39
|
-
duration: config.duration,
|
|
40
|
-
action: config.action,
|
|
41
|
-
});
|
|
42
|
-
}, []);
|
|
43
|
-
const warning = useCallback((config) => {
|
|
44
|
-
toast.warning(config.message, {
|
|
45
|
-
description: config.description,
|
|
46
|
-
duration: config.duration,
|
|
47
|
-
action: config.action,
|
|
48
|
-
});
|
|
49
|
-
}, []);
|
|
50
|
-
const loading = useCallback((config) => {
|
|
51
|
-
toast.loading(config.message, {
|
|
52
|
-
description: config.description,
|
|
53
|
-
});
|
|
54
|
-
}, []);
|
|
55
|
-
return {
|
|
56
|
-
success,
|
|
57
|
-
error,
|
|
58
|
-
info,
|
|
59
|
-
warning,
|
|
60
|
-
loading,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
1
|
+
"use client";import{toast as i}from"sonner";import{useCallback as n}from"react";export function useToast(){return{success:n(n=>{i.success(n.message,{description:n.description,duration:n.duration,action:n.action})},[]),error:n(n=>{i.error(n.message,{description:n.description,duration:n.duration,action:n.action})},[]),info:n(n=>{i.info(n.message,{description:n.description,duration:n.duration,action:n.action})},[]),warning:n(n=>{i.warning(n.message,{description:n.description,duration:n.duration,action:n.action})},[]),loading:n(n=>{i.loading(n.message,{description:n.description})},[])}}
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useLocaleStore } from '../../lib/stores/localeStore';
|
|
3
|
-
import vi from './messages/vi';
|
|
4
|
-
import en from './messages/en';
|
|
5
|
-
export const SUPPORTED_LOCALES = ['vi', 'en'];
|
|
6
|
-
const messages = { vi, en };
|
|
7
|
-
/** Get the current locale from Zustand store (works outside React components) */
|
|
8
|
-
export function getLocale() {
|
|
9
|
-
return useLocaleStore.getState().locale;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Translate a message key with optional parameter interpolation.
|
|
13
|
-
*
|
|
14
|
-
* Lookup order: messages[currentLocale] → messages['vi'] → raw key.
|
|
15
|
-
*
|
|
16
|
-
* **Non-reactive** — reads locale via `getState()` (snapshot).
|
|
17
|
-
* Use in toast callbacks, event handlers, or outside React components.
|
|
18
|
-
* For reactive usage inside components, use `useT()` instead.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* t('common.http.400')
|
|
22
|
-
* t('admin.exam.copy.success', { name: 'Exam 01', count: '10' })
|
|
23
|
-
*/
|
|
24
|
-
export function t(key, params) {
|
|
25
|
-
const locale = getLocale();
|
|
26
|
-
let message = messages[locale]?.[key] ?? messages.vi[key] ?? key;
|
|
27
|
-
if (params) {
|
|
28
|
-
Object.entries(params).forEach(([k, v]) => {
|
|
29
|
-
message = message.replace(new RegExp(`\\{${k}\\}`, 'g'), String(v));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return message;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Reactive translation hook — subscribes to locale changes via Zustand.
|
|
36
|
-
*
|
|
37
|
-
* Components using `useT()` will re-render when the user switches language.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* const t = useT();
|
|
41
|
-
* return <h1>{t('admin.reports.title')}</h1>;
|
|
42
|
-
*/
|
|
43
|
-
export function useT() {
|
|
44
|
-
const locale = useLocaleStore((s) => s.locale);
|
|
45
|
-
return useCallback((key, params) => {
|
|
46
|
-
let message = messages[locale]?.[key] ?? messages.vi[key] ?? key;
|
|
47
|
-
if (params) {
|
|
48
|
-
Object.entries(params).forEach(([k, v]) => {
|
|
49
|
-
message = message.replace(new RegExp(`\\{${k}\\}`, 'g'), String(v));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return message;
|
|
53
|
-
}, [locale]);
|
|
54
|
-
}
|
|
1
|
+
import{useCallback as e}from"react";import{useLocaleStore as r}from"../../lib/stores/localeStore";import o from"./messages/vi";import n from"./messages/en";export const SUPPORTED_LOCALES=["vi","en"];const c={vi:o,en:n};export function getLocale(){return r.getState().locale}export function t(e,r){const o=getLocale();let n=c[o]?.[e]??c.vi[e]??e;return r&&Object.entries(r).forEach(([e,r])=>{n=n.replace(new RegExp(`\\{${e}\\}`,"g"),String(r))}),n}export function useT(){const o=r(e=>e.locale);return e((e,r)=>{let n=c[o]?.[e]??c.vi[e]??e;return r&&Object.entries(r).forEach(([e,r])=>{n=n.replace(new RegExp(`\\{${e}\\}`,"g"),String(r))}),n},[o])}
|